[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/script-host](https://jsprismarine.dev/api/@jsprismarine/script-host/index.md) / debugger/DebugSession

# debugger/DebugSession

## Classes

- [ScriptDebugSession](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/classes/ScriptDebugSession.md)

## Interfaces

### DebugSessionOptions

Defined in: [script-host/src/debugger/DebugSession.ts:52](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L52)

How a [ScriptDebugSession](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/DebugSession/classes/ScriptDebugSession.md) presents the world's scripts to the extension.

#### Properties

##### diagnosticsTabs?

> `readonly` `optional` **diagnosticsTabs?**: readonly [`DiagnosticsTab`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/protocol/index.md#diagnosticstab)[]

Defined in: [script-host/src/debugger/DebugSession.ts:77](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L77)

The tabs the `SchemaEvent` after the handshake describes; BDS's [DIAGNOSTICS\_TABS](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/protocol/index.md#diagnostics_tabs) when absent.

##### fromDebuggerPath?

> `readonly` `optional` **fromDebuggerPath?**: (`path`) => `string`

Defined in: [script-host/src/debugger/DebugSession.ts:62](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L62)

Turns a path from the extension into the engine's file name. The same path when absent.

###### Parameters

###### path

`string`

###### Returns

`string`

##### knowsFile?

> `readonly` `optional` **knowsFile?**: (`file`) => `boolean`

Defined in: [script-host/src/debugger/DebugSession.ts:64](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L64)

Whether the engine knows a file, so a breakpoint in it is verified. Every file when absent.

###### Parameters

###### file

`string`

###### Returns

`boolean`

##### passcode?

> `readonly` `optional` **passcode?**: `string`

Defined in: [script-host/src/debugger/DebugSession.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L56)

The `script-debugger-passcode` the extension must send. None when absent or empty.

##### plugins

> `readonly` **plugins**: readonly [`DebuggerPlugin`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/protocol/index.md#debuggerplugin)[]

Defined in: [script-host/src/debugger/DebugSession.ts:54](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L54)

The script packs the extension may pick, by the UUID of each pack's script module.

##### pollLines?

> `readonly` `optional` **pollLines?**: `number`

Defined in: [script-host/src/debugger/DebugSession.ts:75](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L75)

The lines a running script runs between polls, `DebuggerOptions.pollLines`. The
profiler samples the stack at each poll.

##### profilerClock?

> `readonly` `optional` **profilerClock?**: () => `number`

Defined in: [script-host/src/debugger/DebugSession.ts:79](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L79)

The time in microseconds, which labels the profiler's samples; the system clock when absent.

###### Returns

`number`

##### runCommand?

> `readonly` `optional` **runCommand?**: (`command`, `dimension`) => `void`

Defined in: [script-host/src/debugger/DebugSession.ts:70](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L70)

Runs a command the extension's command box sent, in the named dimension. It is called while
the session handles a message, which can be inside a stopped or running script, so a host
whose commands reach the scripts queues it for later.

###### Parameters

###### command

`string`

###### dimension

`string`

###### Returns

`void`

##### threadId?

> `readonly` `optional` **threadId?**: `number`

Defined in: [script-host/src/debugger/DebugSession.ts:58](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L58)

The thread id the extension shows for the scripts.

##### toDebuggerPath?

> `readonly` `optional` **toDebuggerPath?**: (`file`) => `string`

Defined in: [script-host/src/debugger/DebugSession.ts:60](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L60)

Turns an engine file name into the path the extension knows it by. The same name when absent.

###### Parameters

###### file

`string`

###### Returns

`string`

***

### DebuggerChannel

Defined in: [script-host/src/debugger/DebugSession.ts:37](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L37)

Carries whole messages between a session and the extension. A session calls it only on the
engine's thread.

#### Properties

##### closed

> `readonly` **closed**: `boolean`

Defined in: [script-host/src/debugger/DebugSession.ts:48](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L48)

Whether the connection has closed. `receive` and `poll` still return the messages that
arrived before it closed.

#### Methods

##### poll()

> **poll**(): `unknown`

Defined in: [script-host/src/debugger/DebugSession.ts:43](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L43)

Returns the next message if one has arrived, without waiting; undefined otherwise.

###### Returns

`unknown`

##### receive()

> **receive**(): `unknown`

Defined in: [script-host/src/debugger/DebugSession.ts:41](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L41)

Returns the next message, waiting as long as it takes; undefined once the connection has closed.

###### Returns

`unknown`

##### send()

> **send**(`message`): `void`

Defined in: [script-host/src/debugger/DebugSession.ts:39](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L39)

Sends one message to the extension.

###### Parameters

###### message

[`HostMessage`](https://jsprismarine.dev/api/@jsprismarine/script-host/debugger/protocol/index.md#hostmessage)

###### Returns

`void`

## Variables

### DEFAULT\_THREAD\_ID

> `const` **DEFAULT\_THREAD\_ID**: `1` = `1`

Defined in: [script-host/src/debugger/DebugSession.ts:83](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/script-host/src/debugger/DebugSession.ts#L83)

The thread id a session reports when none is given.
