Skip to main content
A normalized Agent event stream with active-session controls. interrupt() affects the current turn. close() disposes the iterator and transient Session and is idempotent. Session startup is lazy.

Example

Extends

Methods

close()

Dispose the stream and its transient session idempotently.

Returns

Promise<void> A promise settled after owned resources are handled.

Throws

When one or more teardown stages fail.

Example


interrupt()

Abort the active turn without disposing a multi-turn iterator.

Returns

Promise<void> A promise settled after the abort request.

Throws

When startup or the abort request fails.

Example


sessionId()

Start lazily when needed and return the server session id.

Returns

Promise<string> The transient server session id.

Throws

When session creation fails or the stream is already closed.

Example


setModel()

Change the active session’s model.

Parameters

model
ModelId New provider/model id.

Returns

Promise<void> A promise settled after the server applies the model.

Throws

When the stream is closed, the id is invalid, or the request fails.

Example


setPermissionMode()

Change the active session’s permission mode.

Parameters

mode
PermissionMode New runtime permission mode.

Returns

Promise<void> A promise settled after the server applies the mode.

Throws

When the stream is closed or the request fails.

Example