fix(tui): route prompts by next-step capability

This commit is contained in:
_Kerman
2026-07-27 18:05:43 +08:00
parent a59ce0367c
commit f63d937496
21 changed files with 87 additions and 22 deletions

View File

@@ -147,6 +147,12 @@ export interface Agent {
readonly session: Session
/** The current lifecycle state, mirrored on every `agent/status` transition. */
readonly status: AgentStatus
/**
* Whether a `next-step` send currently stages for prompt admission or the
* open turn. Unlike {@link status}, this excludes admission exit and turn
* settlement, when a waking `next-step` send becomes a queued follow-up.
*/
readonly acceptsNextStep: boolean
/** Agent-scoped context; its contributions are agent-local, unwind on disposal, and reject registration afterward. */
readonly ctx: Context

View File

@@ -17,11 +17,12 @@ import type {
function stubAgent(rawId: string, overrides: Partial<Agent> = {}): Agent {
const id = SessionId(rawId)
return {
const agent: Agent = {
id,
options: {},
session: new Session(id),
status: 'idle',
acceptsNextStep: false,
ctx: new Context(),
send: () => AgentMessageId('stub'),
followup: () => AgentMessageId('stub'),
@@ -30,8 +31,8 @@ function stubAgent(rawId: string, overrides: Partial<Agent> = {}): Agent {
cancel() {},
retry() {},
whenIdle() { return Promise.resolve() },
...overrides,
}
return Object.assign(agent, overrides)
}
describe('AgentRegistry', () => {