> ## 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.

# Instance

# Class: Instance

Defined in: [index.d.ts:539](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L539)

Represents an opened application instance.

## Constructors

### Constructor

> **new Instance**(): `Instance`

#### Returns

`Instance`

## Accessors

### pid

#### Get Signature

> **get** **pid**(): `number`

Defined in: [index.d.ts:541](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L541)

Get the process ID of the opened application (returns 0 when unknown).

##### Returns

`number`

## Methods

### content()

> **content**(): `string`

Defined in: [index.d.ts:550](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L550)

#### Returns

`string`

***

### disableAccessibility()

> **disableAccessibility**(): `void`

Defined in: [index.d.ts:566](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L566)

Disable the accessibility tree for the instance.

Creating the accessibility tree is resource-intensive, so many
applications disable it by default. After we are done controlling the
instance, we should disable the accessibility tree to save resources.

#### Returns

`void`

***

### enableAccessibility()

> **enableAccessibility**(): `void`

Defined in: [index.d.ts:558](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L558)

Enables the accessibility tree for the instance.

This also works when the application is already running.

#### Returns

`void`

***

### focus()

> **focus**(): `boolean`

Defined in: [index.d.ts:549](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L549)

Brings the instance to the foreground and gives it focus.

#### Returns

`boolean`

***

### hide()

> **hide**(): `boolean`

Defined in: [index.d.ts:543](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L543)

Minimizes the instance.

#### Returns

`boolean`

***

### isAccessible()

> **isAccessible**(): `boolean`

Defined in: [index.d.ts:552](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L552)

Returns true if the instance has an accessibility tree.

#### Returns

`boolean`

***

### isFocused()

> **isFocused**(): `boolean`

Defined in: [index.d.ts:547](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L547)

Returns true if the instance has the focus.

#### Returns

`boolean`

***

### scoredSearch()

> **scoredSearch**(`order`, `maxNodes`, `collapseStructural`, `query`, `threshold`): [`AccessibilityNode`](AccessibilityNode.mdx)\[]

Defined in: [index.d.ts:591](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L591)

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

Mirrors `simulang_rs::Instance::scored_search` with `BowJaccard` as the
scorer and a permissive filter; 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

##### order

[`TraversalOrder`](../enumerations/TraversalOrder.mdx)

##### maxNodes

`number`

##### collapseStructural

`boolean`

##### query

`string`

##### threshold

`number`

#### Returns

[`AccessibilityNode`](AccessibilityNode.mdx)\[]

***

### show()

> **show**(): `boolean`

Defined in: [index.d.ts:545](https://github.com/simular-ai/simulang-js-internal/blob/d2b85c3277cbb16ce50c0781e1db8ad2c8a5690e/index.d.ts#L545)

Shows the instance.

#### Returns

`boolean`
