Watchdog
Idle detection shared by the providers. Feed it every event a session
emits; it reports a running turn that has gone quiet for too long. Any
event counts as activity, including Heartbeat, so a model that is
thinking is not idle. While a tool call is open the toolIdle limit
applies instead, since a long build or test run can be silent.
Since v0.1.0
Constructors
Section titled “Constructors”Start a watchdog. It checks for idle turns until the Scope closes.
Signature
declare const make: (options: Options) => Effect.Effect<Watchdog, never, Scope.Scope>Since v0.1.0
supervise
Section titled “supervise”The stall policy every provider follows, until the Scope closes: a turn
that goes quiet is interrupted; if it hasn’t ended grace later, the agent
process is killed. The interrupt runs on its own, so one that hangs (the
process is wedged) can’t hold up the kill.
Signature
declare const supervise: ( watchdog: Watchdog, supervisor: Supervisor,) => Effect.Effect<void, never, Scope.Scope>Since v0.2.0
Models
Section titled “Models”Expiry (interface)
Section titled “Expiry (interface)”A running turn that went quiet: for how long, and whether a tool call was open.
Signature
export interface Expiry { readonly turnId: TurnId readonly idleMs: number readonly inTool: boolean}Since v0.1.0
Options (interface)
Section titled “Options (interface)”Idle limits; toolIdle defaults to idle.
Signature
export interface Options { readonly idle: Duration.Input readonly toolIdle?: Duration.Input}Since v0.1.0
Supervisor (interface)
Section titled “Supervisor (interface)”How a provider stops a stalled turn, for supervise.
Signature
export interface Supervisor { /** How long an interrupted turn has to end before the agent process is killed. */ readonly grace: Duration.Input /** * Mark the turn as stalled (so it ends `Stalled`). False if it is no longer running: * nothing to do. */ readonly stall: (expiry: Expiry) => Effect.Effect<boolean> readonly interrupt: (expiry: Expiry) => Effect.Effect<unknown, unknown> /** Waits for the turn to end (failing counts: the session ended). */ readonly turnEnded: (turnId: TurnId) => Effect.Effect<unknown, unknown> /** Kill the agent process, which ends the turn (and the session). */ readonly kill: Effect.Effect<void>}Since v0.2.0
Watchdog (interface)
Section titled “Watchdog (interface)”Signature
export interface Watchdog { readonly observe: (event: AgentEvent) => Effect.Effect<void> /** At most one per turn. */ readonly expirations: Stream.Stream<Expiry>}Since v0.1.0