From 060c0f78f08a684ff8bc238284068394cfe330da Mon Sep 17 00:00:00 2001 From: _Kerman Date: Fri, 31 Jul 2026 10:01:35 +0800 Subject: [PATCH] fix(agent): restore public send method --- docs/cordis-catalog/events.md | 20 +++++++++---------- docs/core-data-structures/core.i18n.yaml | 4 ++-- docs/core-data-structures/core.md | 11 +++++++++- docs/core-data-structures/core.zh.md | 11 +++++++++- .../time-context/tests/time-context.spec.ts | 1 + .../tmux-context/tests/tmux-context.spec.ts | 1 + .../tests/workspace-context.spec.ts | 1 + .../cordis/tool-cordis/src/api-catalog.ts | 2 +- packages/core/agent-loop/src/agent.ts | 10 +++++----- packages/core/agent/src/types.ts | 9 +++++++++ packages/core/agent/tests/agent.spec.ts | 1 + .../tests/tools.spec.ts | 1 + .../command-goal/tests/command-goal.spec.ts | 1 + packages/goal/goal/tests/goal.spec.ts | 1 + packages/goal/goal/tests/projection.spec.ts | 1 + .../goal/tool-goal/tests/tool-goal.spec.ts | 1 + .../tests/api-proxy-workspace.spec.ts | 1 + packages/pty/pty-local/tests/index.spec.ts | 6 +++--- packages/pty/pty-local/tests/local.spec.ts | 2 +- packages/pty/pty/tests/service.spec.ts | 1 + .../tests/loader-composition.spec.ts | 1 + .../tool-bash-persistent/tests/tools.spec.ts | 1 + .../tool-pty/tests/loader-composition.spec.ts | 2 +- packages/pty/tool-pty/tests/tools.spec.ts | 2 +- .../skill/tool-skill/tests/tool-skill.spec.ts | 2 ++ .../tasks/tasks-local/tests/tasks.spec.ts | 1 + packages/ui/tui/tests/harness.ts | 1 + packages/ui/tui/tests/tui.spec.ts | 12 +++++------ 28 files changed, 76 insertions(+), 32 deletions(-) diff --git a/docs/cordis-catalog/events.md b/docs/cordis-catalog/events.md index 0c012e58da..2fd95806b1 100644 --- a/docs/cordis-catalog/events.md +++ b/docs/cordis-catalog/events.md @@ -33,7 +33,7 @@ A fully configured agent and live session were published. Setup is composition-o Types: [Agent](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:151`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:160`](../../packages/core/agent/src/types.ts) ### `agent/disposed` — emit @@ -53,7 +53,7 @@ An agent left the registry; AgentLoop emits this after driver quiescence and sco Types: [Agent](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:160`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:169`](../../packages/core/agent/src/types.ts) ### `agent/error` — emit @@ -75,7 +75,7 @@ A step or turn errored. The machine reports a failure here (plus the logger) eve Types: [Agent](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:261`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:270`](../../packages/core/agent/src/types.ts) ### `agent/prompt-submit` — waterfall @@ -98,7 +98,7 @@ Allow, rewrite, or block one claimed inbox batch before it becomes model-visible Types: [Agent](../core-data-structures/core.md) · [PromptDecision](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) · [UserMessage](../core-data-structures/session.md) -Source: [`packages/core/agent/src/types.ts:196`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:205`](../../packages/core/agent/src/types.ts) ### `agent/request` — waterfall @@ -122,7 +122,7 @@ Replace the frozen call configuration. `await next()` yields the config the mach Types: [Agent](../core-data-structures/core.md) · [LlmCallConfig](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:222`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:231`](../../packages/core/agent/src/types.ts) ### `agent/request-error` — waterfall @@ -145,7 +145,7 @@ Handle one failed model-request attempt before the loop retries or closes its st Types: [Agent](../core-data-structures/core.md) · [RequestErrorAction](../core-data-structures/core.md) · [RequestFailureContext](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:234`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:243`](../../packages/core/agent/src/types.ts) ### `agent/session-start` — emit @@ -167,7 +167,7 @@ The session lifecycle began, once before the first turn. Use `agent.inject()` to Types: [Agent](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) · [SessionStartSource](../core-data-structures/core.md) -Source: [`packages/core/agent/src/types.ts:182`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:191`](../../packages/core/agent/src/types.ts) ### `agent/status` — emit @@ -188,7 +188,7 @@ Agent status changed (`idle` ⇄ `running`). A waking delivery enters `running` Types: [Agent](../core-data-structures/core.md) · [AgentStatus](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:170`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:179`](../../packages/core/agent/src/types.ts) ### `agent/step` — serial @@ -212,7 +212,7 @@ Awaited serial checkpoint before EVERY request of a turn is built (the first as Types: [Agent](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:209`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:218`](../../packages/core/agent/src/types.ts) ### `agent/turn-stopping` — serial @@ -238,7 +238,7 @@ The turn is about to close: the model owes no response (no live tool calls, no f Types: [Agent](../core-data-structures/core.md) · [Scoped](../core-data-structures/scope.md) -Source: [`packages/core/agent/src/types.ts:249`](../../packages/core/agent/src/types.ts) +Source: [`packages/core/agent/src/types.ts:258`](../../packages/core/agent/src/types.ts) ## `agent-loop/*` diff --git a/docs/core-data-structures/core.i18n.yaml b/docs/core-data-structures/core.i18n.yaml index 84c2a906c4..5b8ffc1995 100644 --- a/docs/core-data-structures/core.i18n.yaml +++ b/docs/core-data-structures/core.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write docs/core-data-structures/core.md -core.md: 3bbfe3c4c763a24edb6ec1362344cef6ce50f650 -core.zh.md: d54159c25659a89baded31b8e3aa5207715e0c12 +core.md: 9c1015ddeedcf3355d03678088ec7bcc6759d677 +core.zh.md: 840cc929a7c63b63b3eb2d860b59ace2f1a63ed5 diff --git a/docs/core-data-structures/core.md b/docs/core-data-structures/core.md index 3bbfe3c4c7..9c1015ddee 100644 --- a/docs/core-data-structures/core.md +++ b/docs/core-data-structures/core.md @@ -441,7 +441,7 @@ type AgentCancelCause = | { readonly kind: 'disposed' } ``` -`Agent` is an interface over the public live-agent contract. Concrete drivers implement `followup`, `steer`, and `inject`; routing policy remains private to the driver. +`Agent` is an interface over the public live-agent contract. Its unified `send` method exposes target and wakeup routing directly; `followup`, `steer`, and `inject` are fixed-preset aliases. ```ts type-equiv /** Public live-agent handle. */ @@ -476,6 +476,15 @@ interface Agent { */ whenIdle(): Promise + /** + * Route identified input to an inbox boundary and optionally wake the driver. + * Waking input submitted after active cancellation is queued for the next turn. + * @param message - identified content and its producer provenance. + * @param target - the preferred next-turn or next-step inbox boundary. + * @param wakeup - whether delivery may wake the driver. + */ + send(message: UserMessage, target: InboxTarget, wakeup: boolean): void + /** * Queue an ordinary follow-up turn and wake the driver. The item becomes the * sole ordinary message of its own turn. diff --git a/docs/core-data-structures/core.zh.md b/docs/core-data-structures/core.zh.md index d54159c256..840cc929a7 100644 --- a/docs/core-data-structures/core.zh.md +++ b/docs/core-data-structures/core.zh.md @@ -449,7 +449,7 @@ type AgentCancelCause = | { readonly kind: 'disposed' } ``` -`Agent` 是覆盖公开活跃 agent 契约的接口。具体驱动器实现 `followup`、`steer` 和 `inject`;路由策略仍为驱动器私有。 +`Agent` 是覆盖公开活跃 agent 契约的接口。它的统一 `send` 方法直接公开目标与唤醒路由;`followup`、`steer` 和 `inject` 是固定预设别名。 ```ts type-equiv /** Public live-agent handle. */ @@ -484,6 +484,15 @@ interface Agent { */ whenIdle(): Promise + /** + * Route identified input to an inbox boundary and optionally wake the driver. + * Waking input submitted after active cancellation is queued for the next turn. + * @param message - identified content and its producer provenance. + * @param target - the preferred next-turn or next-step inbox boundary. + * @param wakeup - whether delivery may wake the driver. + */ + send(message: UserMessage, target: InboxTarget, wakeup: boolean): void + /** * Queue an ordinary follow-up turn and wake the driver. The item becomes the * sole ordinary message of its own turn. diff --git a/packages/context/time-context/tests/time-context.spec.ts b/packages/context/time-context/tests/time-context.spec.ts index 17e86c3562..fb246cf068 100644 --- a/packages/context/time-context/tests/time-context.spec.ts +++ b/packages/context/time-context/tests/time-context.spec.ts @@ -43,6 +43,7 @@ function sessionAgent(session: Session, id = 'agent'): Agent { inbox: new Inbox(session), status: 'running', ctx: new Context(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => { throw new Error('time-context must append directly to the open step') }, diff --git a/packages/context/tmux-context/tests/tmux-context.spec.ts b/packages/context/tmux-context/tests/tmux-context.spec.ts index 097cc66802..941838c001 100644 --- a/packages/context/tmux-context/tests/tmux-context.spec.ts +++ b/packages/context/tmux-context/tests/tmux-context.spec.ts @@ -99,6 +99,7 @@ function sessionAgent(session: Session, id = 'agent'): Agent { inbox: new Inbox(session), status: 'running', ctx: new Context(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => { throw new Error('tmux-context must append directly to the open step') }, diff --git a/packages/context/workspace-context/tests/workspace-context.spec.ts b/packages/context/workspace-context/tests/workspace-context.spec.ts index 04e7fa4fdc..1ed1140624 100644 --- a/packages/context/workspace-context/tests/workspace-context.spec.ts +++ b/packages/context/workspace-context/tests/workspace-context.spec.ts @@ -178,6 +178,7 @@ function stubAgent(cwd?: string, seed: SessionEvent[] = []): Agent { session, inbox: new Inbox(session), status: 'idle', + send: () => {}, followup: () => {}, steer: () => {}, inject: () => { throw new Error('workspace-context must append directly to the open step') }, diff --git a/packages/cordis/tool-cordis/src/api-catalog.ts b/packages/cordis/tool-cordis/src/api-catalog.ts index ad9e760157..9747c667d7 100644 --- a/packages/cordis/tool-cordis/src/api-catalog.ts +++ b/packages/cordis/tool-cordis/src/api-catalog.ts @@ -1419,7 +1419,7 @@ export const EVENT_API: readonly EventApiEntry[] = [ export const TYPE_API: readonly TypeApiEntry[] = [ { name: 'Agent', - declaration: 'export interface Agent {\n readonly id: SessionId;\n readonly options: AgentOptions;\n readonly session: Session;\n readonly inbox: Inbox;\n readonly status: AgentStatus;\n readonly ctx: Context;\n cancel(cause: AgentCancelCause, options?: CancelOptions): void;\n whenIdle(): Promise;\n followup(message: UserMessage): void;\n steer(message: UserMessage): void;\n inject(message: UserMessage): void;\n}', + declaration: 'export interface Agent {\n readonly id: SessionId;\n readonly options: AgentOptions;\n readonly session: Session;\n readonly inbox: Inbox;\n readonly status: AgentStatus;\n readonly ctx: Context;\n cancel(cause: AgentCancelCause, options?: CancelOptions): void;\n whenIdle(): Promise;\n send(message: UserMessage, target: InboxTarget, wakeup: boolean): void;\n followup(message: UserMessage): void;\n steer(message: UserMessage): void;\n inject(message: UserMessage): void;\n}', }, { name: 'AgentCancelCause', diff --git a/packages/core/agent-loop/src/agent.ts b/packages/core/agent-loop/src/agent.ts index 144a12634c..c125837462 100644 --- a/packages/core/agent-loop/src/agent.ts +++ b/packages/core/agent-loop/src/agent.ts @@ -81,7 +81,7 @@ export class ReactLoopAgent implements Agent { } } - private send(message: UserMessage, target: InboxTarget, wakeup: boolean): void { + send(message: UserMessage, target: InboxTarget, wakeup: boolean): void { // Waking input cannot join an aborted admission or turn, so it starts the next turn. const wakingAfterAbort = wakeup && this.phase.kind !== 'idle' && this.phase.abort.signal.aborted const resolvedTarget = wakingAfterAbort ? 'next-turn' : target @@ -180,7 +180,7 @@ export class ReactLoopAgent implements Agent { if (admission.kind !== 'admitted') return false signal.throwIfAborted() } catch (error: unknown) { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- cancel may abort while admission awaits + // oxlint-disable-next-line typescript/no-unnecessary-condition -- cancel may abort while admission awaits if (signal.aborted) return this.inbox.hasPending throw error } @@ -216,11 +216,11 @@ export class ReactLoopAgent implements Agent { if (admission.kind === 'empty' && turnEnds) break } } catch (error: unknown) { - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- cancel may abort during any awaited turn operation + // oxlint-disable-next-line typescript/no-unnecessary-condition -- cancel may abort during any awaited turn operation if (signal.aborted) turnEnds = { kind: 'aborted', reason: signal.reason as AgentCancelCause } else turnEnds = { kind: 'error', error: errorChain(error) } } finally { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the turn is always ended in this block + // oxlint-disable-next-line typescript/no-non-null-assertion -- the turn is always ended in this block this.session.append('turn/end', { turn, reason: turnEnds! }) } return this.inbox.hasPending @@ -317,7 +317,7 @@ export class ReactLoopAgent implements Agent { : undefined const maxTokens = this.options.maxTokens const seedConfig = this.requestHeaderLogged - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the instance logged the frozen header it now folds + // oxlint-disable-next-line typescript/no-non-null-assertion -- the instance logged the frozen header it now folds ? persistedConfig! : deepFreeze({ ...route, diff --git a/packages/core/agent/src/types.ts b/packages/core/agent/src/types.ts index 29f536e2c0..456a7f95fe 100644 --- a/packages/core/agent/src/types.ts +++ b/packages/core/agent/src/types.ts @@ -109,6 +109,15 @@ export interface Agent { */ whenIdle(): Promise + /** + * Route identified input to an inbox boundary and optionally wake the driver. + * Waking input submitted after active cancellation is queued for the next turn. + * @param message - identified content and its producer provenance. + * @param target - the preferred next-turn or next-step inbox boundary. + * @param wakeup - whether delivery may wake the driver. + */ + send(message: UserMessage, target: InboxTarget, wakeup: boolean): void + /** * Queue an ordinary follow-up turn and wake the driver. The item becomes the * sole ordinary message of its own turn. diff --git a/packages/core/agent/tests/agent.spec.ts b/packages/core/agent/tests/agent.spec.ts index 8ffc467e20..7d9b4399fa 100644 --- a/packages/core/agent/tests/agent.spec.ts +++ b/packages/core/agent/tests/agent.spec.ts @@ -24,6 +24,7 @@ function stubAgent(rawId: string, overrides: Partial = {}): Agent { inbox: new Inbox(session), status: 'idle', ctx: new Context(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/fs/tool-str-replace-editor/tests/tools.spec.ts b/packages/fs/tool-str-replace-editor/tests/tools.spec.ts index 268fa8fa28..ef776d4de4 100644 --- a/packages/fs/tool-str-replace-editor/tests/tools.spec.ts +++ b/packages/fs/tool-str-replace-editor/tests/tools.spec.ts @@ -36,6 +36,7 @@ function agent(ctx: Context, cwd: string): Agent { inbox: new Inbox(session), status: 'idle', ctx: scope.ctx, + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/goal/command-goal/tests/command-goal.spec.ts b/packages/goal/command-goal/tests/command-goal.spec.ts index f7a1a5b304..78ba5abd6c 100644 --- a/packages/goal/command-goal/tests/command-goal.spec.ts +++ b/packages/goal/command-goal/tests/command-goal.spec.ts @@ -37,6 +37,7 @@ function stubAgent(ctx: Context, id: string): { agent: Agent; session: Session } inbox: new Inbox(session), ctx: new Context(), get status() { return status }, + send: () => {}, followup: () => {}, steer: () => {}, inject(input) { appendInjection(session, input) }, diff --git a/packages/goal/goal/tests/goal.spec.ts b/packages/goal/goal/tests/goal.spec.ts index b4802204dc..47c9b6b1ad 100644 --- a/packages/goal/goal/tests/goal.spec.ts +++ b/packages/goal/goal/tests/goal.spec.ts @@ -47,6 +47,7 @@ function stubAgentForSession(session: Session): StubAgent { inbox: new Inbox(session), ctx: new Context(), get status() { return status }, + send: () => {}, followup: () => {}, steer: () => {}, inject(input) { diff --git a/packages/goal/goal/tests/projection.spec.ts b/packages/goal/goal/tests/projection.spec.ts index 23496935e6..ccff0b7491 100644 --- a/packages/goal/goal/tests/projection.spec.ts +++ b/packages/goal/goal/tests/projection.spec.ts @@ -38,6 +38,7 @@ function liveAgent(ctx: Context, session: Session): Agent { inbox: new Inbox(session), ctx, get status() { return status }, + send: () => {}, followup: () => {}, steer: () => {}, inject(input: UserMessage) { diff --git a/packages/goal/tool-goal/tests/tool-goal.spec.ts b/packages/goal/tool-goal/tests/tool-goal.spec.ts index 89ff0206a6..b99463a586 100644 --- a/packages/goal/tool-goal/tests/tool-goal.spec.ts +++ b/packages/goal/tool-goal/tests/tool-goal.spec.ts @@ -32,6 +32,7 @@ function stubAgent(rawId: string, supplied?: Session): StubAgent { inbox: new Inbox(session), get status() { return status }, ctx: new Context(), + send: () => {}, followup: () => {}, steer: () => {}, inject(input) { diff --git a/packages/host/apiproxy/tests/api-proxy-workspace.spec.ts b/packages/host/apiproxy/tests/api-proxy-workspace.spec.ts index c8f522f950..1b324a9794 100644 --- a/packages/host/apiproxy/tests/api-proxy-workspace.spec.ts +++ b/packages/host/apiproxy/tests/api-proxy-workspace.spec.ts @@ -47,6 +47,7 @@ function stubAgent(session: Session): Agent { inbox: new Inbox(session), status: 'idle', ctx: new Context(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/pty/pty-local/tests/index.spec.ts b/packages/pty/pty-local/tests/index.spec.ts index 46cc691a38..1000d0e78a 100644 --- a/packages/pty/pty-local/tests/index.spec.ts +++ b/packages/pty/pty-local/tests/index.spec.ts @@ -43,7 +43,7 @@ function agent(ctx: Context): Agent { const session = new Session(id) return { id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } } @@ -250,7 +250,7 @@ describe('pty-local plugin shape', () => { const ownerFiber = await ctx.plugin(() => {}) const owner: Agent = { id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: ownerFiber.ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } ctx.agents.register(owner) const providerFiber = await registerStubLocalBackend(ctx, () => stubLocalSession()) @@ -293,7 +293,7 @@ describe('pty-local plugin shape', () => { const ownerFiber = await ctx.plugin(() => {}) const owner: Agent = { id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: ownerFiber.ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } ctx.agents.register(owner) const gate = Promise.withResolvers() diff --git a/packages/pty/pty-local/tests/local.spec.ts b/packages/pty/pty-local/tests/local.spec.ts index 1a52bcc672..96d59367ec 100644 --- a/packages/pty/pty-local/tests/local.spec.ts +++ b/packages/pty/pty-local/tests/local.spec.ts @@ -36,7 +36,7 @@ function stubAgent(ctx: Context, rawId: string): Agent { const session = new Session(id) return { id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: scope.ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } } diff --git a/packages/pty/pty/tests/service.spec.ts b/packages/pty/pty/tests/service.spec.ts index 5cb1dea2d0..1b885e1c5e 100644 --- a/packages/pty/pty/tests/service.spec.ts +++ b/packages/pty/pty/tests/service.spec.ts @@ -29,6 +29,7 @@ function stubAgent(ctx: Context, rawId: string): Agent { inbox: new Inbox(session), status: 'idle', ctx: scopeFiber.ctx, + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/pty/tool-bash-persistent/tests/loader-composition.spec.ts b/packages/pty/tool-bash-persistent/tests/loader-composition.spec.ts index 68f08223ff..e49c652f1d 100644 --- a/packages/pty/tool-bash-persistent/tests/loader-composition.spec.ts +++ b/packages/pty/tool-bash-persistent/tests/loader-composition.spec.ts @@ -46,6 +46,7 @@ function agent(ctx: Context, cwd: string): Agent { inbox: new Inbox(session), status: 'idle', ctx: scope.ctx, + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/pty/tool-bash-persistent/tests/tools.spec.ts b/packages/pty/tool-bash-persistent/tests/tools.spec.ts index b0e64b770c..76cd72f2e8 100644 --- a/packages/pty/tool-bash-persistent/tests/tools.spec.ts +++ b/packages/pty/tool-bash-persistent/tests/tools.spec.ts @@ -42,6 +42,7 @@ function agent(ctx: Context, cwd: string | undefined): Agent { inbox: new Inbox(session), status: 'idle', ctx: scope.ctx, + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/pty/tool-pty/tests/loader-composition.spec.ts b/packages/pty/tool-pty/tests/loader-composition.spec.ts index 29ad29e65d..ca7bc6a3e8 100644 --- a/packages/pty/tool-pty/tests/loader-composition.spec.ts +++ b/packages/pty/tool-pty/tests/loader-composition.spec.ts @@ -41,7 +41,7 @@ function agent(ctx: Context): Agent { const session = new Session(id) const value: Agent = { id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: scope.ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } ctx.agents.register(value) return value diff --git a/packages/pty/tool-pty/tests/tools.spec.ts b/packages/pty/tool-pty/tests/tools.spec.ts index bc25489fcf..13bd8b9e23 100644 --- a/packages/pty/tool-pty/tests/tools.spec.ts +++ b/packages/pty/tool-pty/tests/tools.spec.ts @@ -19,7 +19,7 @@ function fakeAgent(ctx: Context, rawId: string): Agent { const session = new Session(id) const agent: Agent = { id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx: scope.ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } ctx.agents.register(agent) return agent diff --git a/packages/skill/tool-skill/tests/tool-skill.spec.ts b/packages/skill/tool-skill/tests/tool-skill.spec.ts index c633e8faca..cf9ed4b1c7 100644 --- a/packages/skill/tool-skill/tests/tool-skill.spec.ts +++ b/packages/skill/tool-skill/tests/tool-skill.spec.ts @@ -46,6 +46,7 @@ function agentForCwd(cwd: string): Agent { session, inbox: new Inbox(session), status: 'idle', + send: () => {}, followup: () => {}, steer: () => {}, inject: () => { throw new Error('step-boundary catalog must not use agent.inject()') }, @@ -62,6 +63,7 @@ function sessionAgent(session: Session, id = 'tool-skill-agent'): Agent { inbox: new Inbox(session), status: 'running', ctx: new Context(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => { throw new Error('step-boundary catalog must not use agent.inject()') }, diff --git a/packages/tasks/tasks-local/tests/tasks.spec.ts b/packages/tasks/tasks-local/tests/tasks.spec.ts index c3495a1cd2..3f5fd22db1 100644 --- a/packages/tasks/tasks-local/tests/tasks.spec.ts +++ b/packages/tasks/tasks-local/tests/tasks.spec.ts @@ -26,6 +26,7 @@ function stubAgent(ctx: Context, rawId: string): Agent { inbox: new Inbox(session), status: 'idle' as const, ctx: scopeFiber.ctx, + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, diff --git a/packages/ui/tui/tests/harness.ts b/packages/ui/tui/tests/harness.ts index 8e3ae3d634..95b94d7b73 100644 --- a/packages/ui/tui/tests/harness.ts +++ b/packages/ui/tui/tests/harness.ts @@ -202,6 +202,7 @@ export async function createTuiTestHarness { const session = ctx.sessions.create(SessionId('main')) ctx.agents.register({ id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), }) const terminal = new FakeTerminal() mountTui(ctx, { theme: { color: false } }, { terminal, exit: vi.fn() }) @@ -4930,7 +4930,7 @@ describe('terminal mounting', () => { const session = ctx.sessions.create(SessionId('main')) ctx.agents.register({ id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), }) const terminal = new FakeTerminal() // Mirror dsh-tui's own inject (minus loader, the absence under test). @@ -4965,14 +4965,14 @@ describe('terminal mounting', () => { const otherSession = ctx.sessions.create(SessionId('other-session')) ctx.agents.register({ id: otherSession.id, options: {}, session: otherSession, inbox: new Inbox(otherSession), status: 'idle', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), }) expect(terminal.started).toBe(0) const session = ctx.sessions.create(SessionId('late-session')) const agent = { id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), } as Agent ctx.agents.register(agent) await tick() @@ -5003,7 +5003,7 @@ describe('terminal mounting', () => { const session = ctx.sessions.create(SessionId('main-session')) ctx.agents.register({ id: session.id, options: {}, session, inbox: new Inbox(session), status: 'idle', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), }) await tick() expect(terminal.started).toBe(0) @@ -5047,7 +5047,7 @@ describe('terminal mounting', () => { session.append('step/start', { turn: 1, step: 1 }) ctx.agents.register({ id: session.id, options: {}, session, inbox: new Inbox(session), status: 'running', ctx, - followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), + send: () => {}, followup: () => {}, steer: () => {}, inject: () => {}, cancel() {}, whenIdle: () => Promise.resolve(), }) const terminal = new FakeTerminal() terminal.start = () => { throw new Error('terminal startup failed') }