Skip to content
Developer Preview

Turn

A turn, as a CONSUMER sees it — the turn surface and nothing else.

Session.turn() returns this rather than the concrete TurnHandle because the handle’s “fed by Session” mutators (settleCompleted, settleUnqueued, fail, pushItem, …) would otherwise be public: an embedder could call settleCompleted and fabricate a terminal the server never authored, which is exactly what the protocol forbids. They stay reachable only through Session.apply, i.e. only from a server-authored event.

Property Type Stability Presence Description
completed Promise<TurnOutcome> required
observedStart boolean required Did THIS session observe a turn/started? Not a launch-failure marker.
turnId string required
Method Signature Stability Description
cancel cancel(): Promise<TurnCancelResult> Cancel this turn on the normal command lane. Admission only: the turn is over when its turn/completed folds.
deltas deltas(): AsyncIterableIterator<ItemDeltaParams>
interrupt interrupt(options?: Readonly<Pick<TurnInterruptParams, "retract">>): Promise<TurnInterruptResult> Stop this turn on the priority lane, the user’s stop gesture; retract: true also asks to retract the prompt. Admission only, like cancel.
items items(): AsyncIterableIterator<object>
steer steer(options: SteerTurnOptions<I>): Promise<TurnSteerResult> Add input to this turn while it runs. The steer is a pending command until its userMessage folds.
unqueue unqueue(): Promise<TurnUnqueueOutcome<I>> Take this queued turn back before it launches. An accepted ack means the turn never launches, so this session’s queued entry retires at once (Reclaimed) and comes back as retirement; the turn itself settles unqueued when the server’s turn/unqueued folds.
Source

clients/sdk-ts/src/facade/turn-handle.ts:251

{
"kind": "Interface",
"canonicalPath": "Turn"
}