AgentPauseGate (src/pause.ts)

oh-my-pi · packages/agent/src/pause.ts · typescript · MIT
ai, tag:knn-classified

* Process-global pause gate for agent loops. Every agent in a process — main session, in-process subagents, advisor — funnels through {@link ../agent-loop!agentLoop}, which polls this gate at its two action boundaries: before each model call and before each tool call starts. Enga

// Source: https://github.com/can1357/oh-my-pi | License: MIT | Copyright 2025 Mario Zechner
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Process-global pause gate for agent loops.
 *
 * Every agent in a process — main session, in-process subagents, advisor —
 * funnels through {@link ../agent-loop!agentLoop}, which polls this gate at its
 * two action boundaries: before each model call and before each tool call
 * starts. Engaging the gate therefore freezes all of them at the next safe
 * point without aborting anything: in-flight provider streams and
 * already-started tool executions run to completion, then every loop parks
 * until {@link AgentPauseGate.resume}. Queued steering/follow-up messages stay
 * queued and deliver normally after resume.
 *
 * A run's

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key