@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
24 lines • 1.4 kB
TypeScript
import type { AgentEvent } from "@earendil-works/pi-agent-core";
/**
* Whether the agent core continued a run after its `agent_end` (senpi#3650 review H1, senpi#3351).
*
* The core drains input queued during `agent_end` into a new loop inside the same run, while the session settles the
* run from its own event queue. Settling waits for the agent to go idle; the core's new loop in turn waits on the
* session (its turn-end boundary needs the message persisted on that same queue). Which side reaches the queued input
* first depends on microtask timing, and when the core does, the two wait on each other. Observed in emission order,
* a later `agent_start` proves the core continued, so the settle steps aside and the continuation's own `agent_end`
* settles the run, whatever the timing.
*/
export declare class AgentRunContinuations {
private starts;
private readonly startsAtEnd;
private readonly waiters;
/** Call synchronously for every agent event, in emission order. */
observe(event: AgentEvent): void;
/**
* Resolves true once the core starts another loop after `agentEnd`, or false once the agent is idle. Without an
* observed `agentEnd` it only waits for idle, as before.
*/
idleOrContinued(agentEnd: AgentEvent | undefined, waitForIdle: () => Promise<void>): Promise<boolean>;
}
//# sourceMappingURL=agent-run-continuation.d.ts.map