Skip to main content
A running turn: for await it to observe typed events as they stream, and await it (before, after, or instead of iterating) for the SessionOutcome. Awaiting without iterating consumes the remaining events internally.

Constructor

Parameters

AsyncGenerator<SessionUpdate, PromptResult, undefined>
required
StandardSchema<T>
Promise<void>

Returns

Turn

Properties

Promise<void>
required
The prompt was accepted, not necessarily completed. ACP v2 acknowledges explicitly; v1 uses the matching user-message echo, falling back to the prompt response if the agent does not echo. Rejection before acceptance rejects this promise; subsequent failures reject the turn’s outcome.

Methods

[asyncIterator]()

Stream the turn’s typed events (single-pass, from the beginning).

Returns

SessionEvent

then()

Resolve the turn’s SessionOutcome once every event has streamed.

Parameters

null | (value: SessionOutcome<T>) => TResult1 | PromiseLike<TResult1>
null | (reason: unknown) => TResult2 | PromiseLike<TResult2>

Returns

Promise<TResult1 | TResult2>