> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Window

> Handle to an on-screen window.

Handle to an on-screen window. Constructed via \[`Window.all`] or
\[`Window.allForPid`] and exposes read-only metadata (`title`, `pid`)
alongside basic actions (`minimize`, `maximize`, `close`).

## Constructor

```typescript
Window(): Window
```

### Returns

`Window`

## Properties

<ResponseField name={"pid"} type={"number"} required>
  Process ID that owns this window.
</ResponseField>

<ResponseField name={"title"} type={"string"} required>
  Window title (may be empty).
</ResponseField>

## Methods

### all()

```typescript
all(): Window[]
```

All visible top-level windows across every process.

#### Returns

`Window[]`

### allForPid()

```typescript
allForPid(pid: number): Window[]
```

All visible top-level windows for a given process.

#### Parameters

<ResponseField name={"pid"} type={"number"} required />

#### Returns

`Window[]`

### close()

```typescript
close(): void
```

Close the window (user-equivalent to clicking the close button /
pressing Alt+F4 / Cmd+W).

### maximize()

```typescript
maximize(): void
```

Maximize / zoom the window.

### minimize()

```typescript
minimize(): void
```

Minimize the window (hide to taskbar / Dock).

### scoredSearch()

```typescript
scoredSearch(order: TraversalOrder, maxNodes: number, collapseStructural: boolean, query: string, threshold: number): AccessibilityNode[]
```

Search this window's accessibility subtree by *concept text*, using
bag-of-words paired-Jaccard scoring against each node's
`overallDescription`
(`simulang_rs::AXNodeSynthetic::summary_with_context`).

Mirrors `simulang_rs::Window::scored_search` (macOS / Linux) — on
Windows we use the same underlying primitive via
`WindowTrait::node().scored_search(...)`, which prebuilds the cached
UIA subtree so the walk costs a single IPC. Returns every node whose
score equals the maximum found and exceeds `threshold`.

* `order`               – `TraversalOrder.DepthFirst` or
  `TraversalOrder.BreadthFirst`
* `max_nodes`           – upper bound on nodes visited (uses `.take()`
  over the walk)
* `collapse_structural` – hoist empty structural wrappers out of the
  walk before scoring
* `query`               – natural-language concept Jaccard-compared
  against each node's `overallDescription`
* `threshold`           – minimum score to keep a node

Returned nodes are full `AccessibilityNode` handles — call action
methods (`activate`, `setValue`, …) directly on them, walk children
with `.children()`, or render a snapshot with `.snapshot()`.

#### Parameters

<ResponseField name={"order"} type={"TraversalOrder"} required />

<ResponseField name={"maxNodes"} type={"number"} required />

<ResponseField name={"collapseStructural"} type={"boolean"} required />

<ResponseField name={"query"} type={"string"} required />

<ResponseField name={"threshold"} type={"number"} required />

#### Returns

`AccessibilityNode[]`

### snapshot()

```typescript
snapshot(): string
```

Render the window's accessibility subtree as an indented
Playwright-style aria snapshot.

One line per node, two spaces of indentation per depth level, in
pre-order DFS. Roles are emitted raw (`AXWindow` on macOS,
`UIA.ControlType.*` on Windows), with title and value appended when
non-empty. No refs are assigned — for ref-based interaction use
\[`AccessibilityTree.snapshot`] instead.

#### Returns

`string`
