Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(eve)!: remove conversation/task run mode (#3817)

Andrew Barbaf9addc3a903c
diff --git a/.changeset/remove-run-mode.md b/.changeset/remove-run-mode.md
new file mode 100644
index 000000000..caf099ecc
--- /dev/null
+++ b/.changeset/remove-run-mode.md
@@ -0,0 +1,5 @@
+---
+"eve": minor
+---
+
+Remove the `conversation` / `task` run mode. Every session now parks after each turn instead of ending, including markdown schedules and MCP `agent_start` invocations. Sessions that cannot request input, such as markdown schedules, still fail when a tool needs approval. `agent_get` reports `completed` once the turn settles, and a recoverable model failure fails only that turn. The `mode` option is gone from `ChannelAddress` and Chat SDK `send(...)` options, as well as from audience and trace-policy inputs. The eve HTTP channel now ignores a `mode` field on session creation. `outputSchema` is removed from `defineAgent`, `defineRemoteAgent`, `defineWorkspaceAgent`, dynamic subagent configs, agent info, the model-facing subagent and `agentRouter()` tool inputs, MCP `agent_start`, and channel `from(address).send()` / `respond()` options; request structured output per turn through the session API or `ctx.agent()`.
diff --git a/docs/agent-config.md b/docs/agent-config.md
index d7990ebc7..869ba4959 100644
--- a/docs/agent-config.md
+++ b/docs/agent-config.md
@@ -191,8 +191,8 @@ could retry against a fresh quota share. A reply that answers neither option
is queued while the existing prompt stays pending; eve does not raise another
copy. The reply is processed once the budget is granted.
-Sessions that cannot reach a human — task-mode runs such as schedules and
-delegated runs without input proxying — skip the prompt and fail the next model
+Sessions that cannot request input from a human, such as markdown schedules and
+delegated runs without input proxying, skip the prompt and fail the next model
call with `SESSION_TOKEN_LIMIT_REACHED` for token budgets or
`SESSION_TOKEN_COST_LIMIT_REACHED` for model token cost. A delegated task with
no inherited quota also fails instead of raising a continuation prompt that
@@ -328,15 +328,14 @@ it falls back to the World's default retention period.
`defineAgent` takes a few more fields, all optional. For the exported types, see the [TypeScript API Reference](./reference/typescript-api).
-| Field | Type | Default | Description |
-| -------------- | --------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `reasoning` | `AgentReasoningDefinition` | provider default | Provider-agnostic reasoning effort forwarded to the agent's turn model calls. |
-| `modelOptions` | `AgentModelOptionsDefinition` | none | Provider option overrides forwarded to the model call. |
-| `limits` | `AgentLimitsDefinition` | field-specific | Framework-owned runtime limits. Sessions complete after 30 days by default; usage-limit defaults and inheritance are described above. Set a limit to `false` to disable it. |
-| `experimental` | `AgentExperimentalDefinition` | unset | Unstable opt-ins. `workflow.world` selects the Workflow world package on the root agent; `workflow.modelCallsPerStep` batches sequential model calls into a wider replay unit; `workflow.retention` controls how long the durable runtime keeps run data. |
-| `outputSchema` | Standard Schema or a JSON Schema object | none | Structured return type for function-like invocations such as a subagent turn, schedule, or remote job. Ordinary interactive turns ignore it unless the client supplies a per-message schema. |
-| `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |
-| `tool` | `boolean` | `true` | Exposes this agent to its parent model as a tool. On the root agent, controls the built-in `agent` tool. A subagent with `tool: false` remains callable from authored workflow tools through `ctx.agent()`. |
+| Field | Type | Default | Description |
+| -------------- | ------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `reasoning` | `AgentReasoningDefinition` | provider default | Provider-agnostic reasoning effort forwarded to the agent's turn model calls. |
+| `modelOptions` | `AgentModelOptionsDefinition` | none | Provider option overrides forwarded to the model call. |
+| `limits` | `AgentLimitsDefinition` | field-specific | Framework-owned runtime limits. Sessions complete after 30 days by default; usage-limit defaults and inheritance are described above. Set a limit to `false` to disable it. |
+| `experimental` | `AgentExperimentalDefinition` | unset | Unstable opt-ins. `workflow.world` selects the Workflow world package on the root agent; `workflow.modelCallsPerStep` batches sequential model calls into a wider replay unit; `workflow.retention` controls how long the durable runtime keeps run data. |
+| `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |
+| `tool` | `boolean` | `true` | Exposes this agent to its parent model as a tool. On the root agent, controls the built-in `agent` tool. A subagent with `tool: false` remains callable from authored workflow tools through `ctx.agent()`. |
`externalDependencies` is a packaging control only. It keeps selected packages as runtime dependencies in the hosted output; it does not authorize, configure, or review any third-party service those packages may call.
diff --git a/docs/channels/chat-sdk.mdx b/docs/channels/chat-sdk.mdx
index a7190a3c7..368b93fd5 100644
--- a/docs/channels/chat-sdk.mdx
+++ b/docs/channels/chat-sdk.mdx
@@ -104,7 +104,7 @@ bot.onNewMention(async (thread, message) => {
});
```
-`options` accepts `{ thread, auth?, title?, mode?, callback?, adapterName?, turnPolicy? }`. `title` sets the eve session's display title without changing the model message; `auth` attaches an authenticated principal to the turn.
+`options` accepts `{ thread, auth?, title?, callback?, adapterName?, turnPolicy? }`. `title` sets the eve session's display title without changing the model message; `auth` attaches an authenticated principal to the turn.
### Steering
diff --git a/docs/channels/custom.mdx b/docs/channels/custom.mdx
index 8971ca07e..6f7d8ebb7 100644
--- a/docs/channels/custom.mdx
+++ b/docs/channels/custom.mdx
@@ -334,7 +334,7 @@ export default defineChannel({
});
```
-The input contains the channel's `state`, `caller`, `channel`, `mode`, and `environment`. A principal caller omits `principalId`, `issuer`, and `subject`, but its `attributes` come from route auth and can still contain identifying values. Return `"public"`, `"private"`, or `"unknown"`. Return `"unknown"` when the channel does not have enough evidence to classify confidently; consumers treat it as non-public. A missing, throwing, asynchronous, or malformed classifier also fails closed to `"unknown"`.
+The input contains the channel's `state`, `caller`, `channel`, and `environment`. A principal caller omits `principalId`, `issuer`, and `subject`, but its `attributes` come from route auth and can still contain identifying values. Return `"public"`, `"private"`, or `"unknown"`. Return `"unknown"` when the channel does not have enough evidence to classify confidently; consumers treat it as non-public. A missing, throwing, asynchronous, or malformed classifier also fails closed to `"unknown"`.
When you explicitly annotate a callback, use `AudienceContext<TState>`. `AudienceInput<TState>` remains supported for existing callbacks while you migrate.
diff --git a/docs/channels/eve.mdx b/docs/channels/eve.mdx
index d50105f66..da4d68408 100644
--- a/docs/channels/eve.mdx
+++ b/docs/channels/eve.mdx
@@ -49,8 +49,8 @@ See [Start a session](../concepts/sessions-runs-and-streaming#start-a-session) f
initialization boundary, first-turn identity, readiness response, and retry behavior.
The create request still requires route auth. Session audience and the timeout are selected
-at creation; they do not change when the first message arrives. Task mode and turn-scoped
-fields such as `clientContext` and `outputSchema` require a message on the create request.
+at creation; they do not change when the first message arrives. Turn-scoped fields such as
+`clientContext` and `outputSchema` require a message on the create request.
Include an initial message to create the session and start its first turn in one request:
@@ -200,8 +200,8 @@ call the endpoint. `auth` still controls access. For a classification that
depends on channel state or application-specific verified data, use a [custom
channel audience](./custom#conversation-audience).
-You can also pass a function that receives `caller`, channel, run mode, and
-deployment environment. Classification is fixed at session creation, so a later
+You can also pass a function that receives `caller`, channel, and deployment
+environment. Classification is fixed at session creation, so a later
turn from a different caller does not reclassify the session.
For a remote agent, a trusted dispatch can forward the original audience and
diff --git a/docs/channels/mcp.mdx b/docs/channels/mcp.mdx
index aa8eaa922..580b5223e 100644
--- a/docs/channels/mcp.mdx
+++ b/docs/channels/mcp.mdx
@@ -168,7 +168,7 @@ MCP clients receive four tools:
| Tool | Input | Purpose |
| -------------- | ----------------------------- | ----------------------------------------------------------- |
-| `agent_start` | `{ message, outputSchema? }` | Start durable work and immediately return an invocation ID. |
+| `agent_start` | `{ message }` | Start durable work and immediately return an invocation ID. |
| `agent_get` | `{ invocationId }` | Read the invocation's complete current state. |
| `agent_update` | `{ invocationId, responses }` | Answer the complete pending human-input batch. |
| `agent_cancel` | `{ invocationId }` | Request cooperative cancellation of non-terminal work. |
@@ -177,7 +177,7 @@ The server also returns `instructions` from `initialize` and `server/discover` t
protocol for the connecting model, so a hosted client does not have to infer it from the tool
schemas alone.
-`agent_start` creates one task-mode eve session and returns after durable acceptance without
+`agent_start` creates one eve session and returns after durable acceptance without
waiting for the session continuation hook to become readable. Keep its `invocationId`, then call
`agent_get` until the invocation reaches a terminal state. While the status is `working`, wait at
least `pollAfterMs` before polling again.
@@ -187,22 +187,22 @@ The invocation response is discriminated by `status`:
- `working`: work is active; continue polling according to `pollAfterMs`.
- `input_required`: present `inputRequests`, then send the complete answer batch through `agent_update`. A successful update returns the current invocation state.
- `authorization_required`: present the returned sign-in URL, user code, or instructions. The connection callback resumes the invocation automatically; continue polling.
-- `completed`: consume the optional `result`.
+- `completed`: the agent's turn settled. Consume the optional `result`: the final assistant message.
- `failed`: inspect the structured `error`.
- `cancelled`: cancellation reached a terminal state.
A tool result with `isError: true` means the call itself was rejected. A `failed` status means the call succeeded and the task itself failed. Handle them differently: correct the call in the first case, report the task failure in the second. Rejected calls carry `structuredContent.error` with a stable `code`, a short `message`, and `retryable`:
-| `code` | Meaning | `retryable` |
-| --------------- | ------------------------------------------------------------------------------ | ----------- |
-| `invalid_input` | An argument was rejected, for example an oversized or external `outputSchema`. | `false` |
-| `not_found` | The invocation does not exist, has expired, or belongs to another caller. | `false` |
-| `conflict` | The invocation is not in the expected state; read it with `agent_get` first. | `true` |
-| `internal` | eve failed; `errorId` correlates with server logs. No details are exposed. | `false` |
+| `code` | Meaning | `retryable` |
+| --------------- | ---------------------------------------------------------------------------- | ----------- |
+| `invalid_input` | An argument was rejected, for example an oversized `message`. | `false` |
+| `not_found` | The invocation does not exist, has expired, or belongs to another caller. | `false` |
+| `conflict` | The invocation is not in the expected state; read it with `agent_get` first. | `true` |
+| `internal` | eve failed; `errorId` correlates with server logs. No details are exposed. | `false` |
Cancellation is cooperative, so call `agent_get` after `agent_cancel` until the state becomes terminal.
-Requests are bounded: the whole MCP request body is limited to 1 MiB, `message` to 64 KiB, each input-response `text` to 16 KiB (both measured as UTF-8 bytes, not characters), and one `agent_update` to 64 responses. Optional output schemas are limited to 64 KiB, 32 levels, and 2,048 nodes, and external `$ref` values are rejected. Oversized bodies receive a JSON-RPC `413`; oversized fields fail input validation before any work starts.
+Requests are bounded: the whole MCP request body is limited to 1 MiB, `message` to 64 KiB, each input-response `text` to 16 KiB (both measured as UTF-8 bytes, not characters), and one `agent_update` to 64 responses. Oversized bodies receive a JSON-RPC `413`; oversized fields fail input validation before any work starts.
### Durability guarantees
diff --git a/docs/concepts/sessions-runs-and-streaming.md b/docs/concepts/sessions-runs-and-streaming.md
index 8df7c12bf..62d566ad8 100644
--- a/docs/concepts/sessions-runs-and-streaming.md
+++ b/docs/concepts/sessions-runs-and-streaming.md
@@ -41,8 +41,8 @@ curl -X POST http://127.0.0.1:2000/eve/v1/session
eve starts the durable workflow, establishes its inbox, and waits for the first message before
running session-scoped initialization or emitting `session.started`. The first message sent to the returned
-`sessionId` remains `turn_0`. Message-free creation supports conversation mode only and does not
-accept turn-scoped `clientContext`, `outputSchema`, callbacks, or activity observers.
+`sessionId` remains `turn_0`. Message-free creation does not accept turn-scoped `clientContext`,
+`outputSchema`, callbacks, or activity observers.
To create the session and start its first turn in one request, include the message:
@@ -128,8 +128,7 @@ A provider response ending with `content-filter` fails with `MODEL_CALL_FAILED`,
`details.finishReason: "content-filter"`. Details also include the Gateway
`generationId` when available. eve does not retry the filtered response or emit
`message.completed` for its partial text; deltas already streamed remain visible.
-Conversation sessions wait for another user message, while task-mode runs return
-a failed result.
+The session then waits for another user message.
## The event envelope
diff --git a/docs/guides/dynamic-capabilities.md b/docs/guides/dynamic-capabilities.md
index b723ca52e..0e9654250 100644
--- a/docs/guides/dynamic-capabilities.md
+++ b/docs/guides/dynamic-capabilities.md
@@ -126,8 +126,8 @@ export default defineDynamic({
});
```
-The returned remote definition can change its URL, path, headers, auth,
-principal forwarding, and output schema. Function-valued URLs resolve when the
+The returned remote definition can change its URL, path, headers, auth, and
+principal forwarding. Function-valued URLs resolve when the
dynamic event runs. Auth and headers remain lazy and resolve before each
outbound request without entering durable workflow state.
diff --git a/docs/guides/hooks.md b/docs/guides/hooks.md
index 06d3c032f..6940da5c9 100644
--- a/docs/guides/hooks.md
+++ b/docs/guides/hooks.md
@@ -181,7 +181,7 @@ Hooks always run after the event is durably recorded, so if a hook throws, the s
## What happens when a hook throws
-A thrown handler during a model turn propagates through turn execution and surfaces as `turn.failed`. In a conversation session, this includes handlers for `turn.started` and the first `step.started` of a model call: the failed turn ends with `session.waiting`, and the next message can start another turn. Task-mode boundary failures remain terminal. If a hook subscribed to a failure-cascade event also throws, it escalates to `session.failed`. For belt-and-suspenders semantics inside a hook, wrap the body in `try`/`catch`. eve treats a thrown hook as a real failure.
+A thrown handler during a model turn propagates through turn execution and surfaces as `turn.failed`. This includes handlers for `turn.started` and the first `step.started` of a model call: the failed turn ends with `session.waiting`, and the next message can start another turn. If a hook subscribed to a failure-cascade event also throws, it escalates to `session.failed`. For belt-and-suspenders semantics inside a hook, wrap the body in `try`/`catch`. eve treats a thrown hook as a real failure.
For `subagent.called`, `subagent.completed`, and events proxied from a child, a thrown handler fails the publishing step and follows the workflow runtime's step retry policy. A retry can publish the event again before rerunning its hooks. Parent execution waits for the publishing step to finish or exhaust its retries. Exhausting retries fails the session.
diff --git a/docs/guides/instrumentation/instrumentation.mdx b/docs/guides/instrumentation/instrumentation.mdx
index 77588745b..cef7204aa 100644
--- a/docs/guides/instrumentation/instrumentation.mdx
+++ b/docs/guides/instrumentation/instrumentation.mdx
@@ -83,8 +83,8 @@ export default defineInstrumentation({
});
```
-The function receives `agentName`, `channel`, `audience`, `mode`,
-`environment`, and `principalType`. `audience` is `"public"`, `"private"`, or
+The function receives `agentName`, `channel`, `audience`, `environment`, and
+`principalType`. `audience` is `"public"`, `"private"`, or
`"unknown"`; `environment` is `"development"`, `"preview"`, or
`"production"`.
diff --git a/docs/guides/remote-agents.md b/docs/guides/remote-agents.md
index a30c41118..15d7245bf 100644
--- a/docs/guides/remote-agents.md
+++ b/docs/guides/remote-agents.md
@@ -28,7 +28,6 @@ export default defineRemoteAgent({
| `forwardPrincipal` | `boolean` | No | `false` | Forward the dispatching turn's session principal to the remote deployment (see [Forwarding the caller identity](#forwarding-the-caller-identity)). |
| `headers` | `HeadersValue` | No | none | Static or lazily resolved request headers. |
| `path` | `string` | No | `/eve/v1/session` | Route appended to `url` for the create-session request. |
-| `outputSchema` | `StandardSchema \| JSON Schema` | No | none | Structured return type for the first turn of each fresh remote session. A continuation may provide its own per-call schema. |
| `tool` | `boolean` | No | `true` | Expose the remote agent as a tool to the parent model. Set `false` to allow only `ctx.agent()` calls from authored workflow tools. |
## Dynamic remote agents
@@ -81,9 +80,9 @@ The function may be async and must return a non-empty string. `auth` and `header
## Calling a remote agent
-By default, a remote agent is another subagent tool to the model. The model calls it the same way it calls a local subagent, with a `message` and an optional `outputSchema`. Set `tool: false` when an authored workflow tool should be the only model-facing routing surface; the workflow can still call the remote agent by its path-derived name through `ctx.agent()`. The message must carry the full task, including any context the remote agent needs, because it never receives the parent's conversation history.
+By default, a remote agent is another subagent tool to the model. The model calls it the same way it calls a local subagent, with a `message` and an optional `agentId`. Set `tool: false` when an authored workflow tool should be the only model-facing routing surface; the workflow can still call the remote agent by its path-derived name through `ctx.agent()`. The message must carry the full task, including any context the remote agent needs, because it never receives the parent's conversation history.
-To require structured output, set an `outputSchema` on the agent definition for fresh delegations or on an individual call for that turn. The structured value arrives in the task's completion notification, and the remote child remains available for follow-up messages. See [Subagents](../subagents) for continuation behavior.
+To require structured output, call the remote agent from an authored workflow tool with `ctx.agent(name, { message, outputSchema })`. The schema applies to that turn, the structured value is the call's result, and the remote child remains available for follow-up messages. See [Subagents](../subagents) for continuation behavior.
## Outbound auth
@@ -200,7 +199,7 @@ You can also steer a running remote background child by calling its subagent too
When the parent session ends, eve sends an authenticated `POST /eve/v1/session/:childSessionId/reset` for each remote child. Reset retires the parked remote session and recursively cleans up its descendants. The request uses freshly resolved `headers` and `auth`; failures are logged so an unreachable remote cannot block parent finalization.
-A failed _start_ rejects admission before a task receipt is returned. After a remote starts, a terminal failure callback fails the task and notifies the parent with the remote's error (or `REMOTE_AGENT_FAILED` when none is supplied). Terminal callback delivery runs as a durable step on the underlying workflow engine (see [Execution model & durability](../concepts/execution-model-and-durability)). A failed callback POST is rethrown rather than marking the task complete, so the engine retries it.
+A failed _start_ rejects admission before a task receipt is returned. After a remote starts, a terminal failure callback fails the task and notifies the parent with the remote's error. Terminal callback delivery runs as a durable step on the underlying workflow engine (see [Execution model & durability](../concepts/execution-model-and-durability)). A failed callback POST is rethrown rather than marking the task complete, so the engine retries it.
## What to read next
diff --git a/docs/schedules.mdx b/docs/schedules.mdx
index 262b65f21..b5e1cf978 100644
--- a/docs/schedules.mdx
+++ b/docs/schedules.mdx
@@ -14,7 +14,7 @@ Every schedule provides a `cron` and exactly one of `markdown` or `run`:
```ts
interface ScheduleDefinition {
cron: string;
- markdown?: string; // fire-and-forget prompt (task mode)
+ markdown?: string; // fire-and-forget prompt
run?: (args: ScheduleHandlerArgs) => Promise<void> | void; // handler
}
@@ -33,7 +33,7 @@ A TypeScript schedule with `markdown` is compile-only because eve stores the pro
## Markdown form (fire-and-forget)
-This is the minimal schedule. eve runs the agent on the prompt and throws away the output, though the agent can still call tools, write to backends, and log along the way. We call this task mode. A task-mode session runs to completion or fails, and cannot park to wait for a person or an OAuth sign-in.
+This is the minimal schedule. eve runs the agent on the prompt and throws away the output, though the agent can still call tools, write to backends, and log along the way. The session has no channel, so it cannot ask a person for input, and nothing can send it a follow-up message. If the agent calls a tool that needs approval, the session fails instead of waiting for an answer. After its turn settles, the session parks like any other session until its [session timeout](./agent-config#runtime-limits) ends it.
```ts title="agent/schedules/heartbeat.ts"
import { defineSchedule } from "eve/schedules";
@@ -86,7 +86,7 @@ The agent does not have to deliver a message on every run. When a prompt makes d
The `auth` option controls which principal the session runs as. A handler may instead supply a user principal when scheduled work needs that user's grants; a session created by that dispatch still retains schedule provenance and conditional delivery behavior.
-A handler-form session runs on the same durable runtime engine as any other session, so it can park (durably suspend), for instance when the channel handoff is waiting for a Slack reply. Only markdown task mode is barred from waiting.
+A handler-form session runs on the same durable runtime engine as any other session, so it can park (durably suspend), for instance when the channel handoff is waiting for a Slack reply. Markdown-form sessions park too, but no channel is attached, so they cannot receive follow-up messages.
## Background task results
@@ -118,8 +118,7 @@ its policy unless the send supplies an explicit value.
Under `"auto"`, a model call may finish silently while related work is pending.
Available results remain in the next reporting context so the parent can combine
-previously withheld outputs later. A scheduled task-mode session stays alive while
-it owns pending background tasks. See
+previously withheld outputs later. See
[Background task results](./channels/overview#background-task-results).
## Session continuity
diff --git a/docs/subagents/index.mdx b/docs/subagents/index.mdx
index 2b0a6ad79..ddbebf718 100644
--- a/docs/subagents/index.mdx
+++ b/docs/subagents/index.mdx
@@ -51,9 +51,8 @@ The root session receives `agent` by default. The model calls it to delegate a t
```ts
{
- message: string; // everything the child needs; it does not see the parent's history
- agentId?: string; // continue or steer an existing child
- outputSchema?: object; // require structured output for this turn
+ message: string; // everything the child needs; it does not see the parent's history
+ agentId?: string; // continue or steer an existing child
}
```
@@ -239,7 +238,7 @@ The root built-in `agent` tool is the exception. Its children reuse the root's s
## What the parent sees
-eve lowers every tool-enabled subagent visible to the current agent (the root built-in copy, declared, or [remote](./guides/remote-agents)) into a model-visible tool with the same `{ message, agentId?, outputSchema? }` shape. The parent packs `message` with everything the child needs, since the child never sees the parent's history. Set `outputSchema` to require structured output for that turn; the child remains available for follow-up messages afterward.
+eve lowers every tool-enabled subagent visible to the current agent (the root built-in copy, declared, or [remote](./guides/remote-agents)) into a model-visible tool with the same `{ message, agentId? }` shape. The parent packs `message` with everything the child needs, since the child never sees the parent's history. To require structured output from a child, call it from an authored workflow tool with [`ctx.agent(name, { message, outputSchema })`](./tools/workflows); the schema applies to that turn, and the child remains available for follow-up messages afterward.
Declared subagents can call nested subagents defined under their own directories. eve does not apply a separate depth limit; nesting ends where the authored directory tree ends. The built-in `agent` follows the stricter root-only rule above, so `limits.maxSubagentDepth` no longer exists.
@@ -249,9 +248,8 @@ A directly declared subagent's tool name is the bare path-derived name, with no
```ts
{
- message: string; // all context the child needs; it never sees the parent's history
- agentId?: string; // continue or steer an existing child
- outputSchema?: object; // require structured output for this turn
+ message: string; // all context the child needs; it never sees the parent's history
+ agentId?: string; // continue or steer an existing child
}
```
diff --git a/docs/tools/workflows.mdx b/docs/tools/workflows.mdx
index d0c7d2fdd..91530a891 100644
--- a/docs/tools/workflows.mdx
+++ b/docs/tools/workflows.mdx
@@ -441,7 +441,7 @@ import { agentRouter } from "eve/tools/agent-router";
export default agentRouter();
```
-Its input is `{ message: string, outputSchema?: object }`. `agentRouter()` ignores entries without a non-empty description. With two or more described targets, it sends the message and effective descriptions to Jev, then invokes the selected name through `ctx.agent()`. It invokes a sole target without evaluation and forwards an optional `outputSchema` unchanged. In a top-level root session, the candidates include the root-copy `agent`; delegated root copies and declared subagent contexts include only their declared targets.
+Its input is `{ message: string }`. `agentRouter()` ignores entries without a non-empty description. With two or more described targets, it sends the message and effective descriptions to Jev, then invokes the selected name through `ctx.agent()`. It invokes a sole target without evaluation. In a top-level root session, the candidates include the root-copy `agent`; delegated root copies and declared subagent contexts include only their declared targets.
When an authored tool accepts a JSON Schema supplied by the model, represent that input with a permissive object such as `z.looseObject({})`. Avoid `z.record(z.string(), z.json())`: its generated JSON Schema uses `propertyNames`, which OpenAI does not support. Validate the supplied value at the point where your tool consumes it.
diff --git a/e2e/fixtures/agent-schedules/agent/schedules/heartbeat.ts b/e2e/fixtures/agent-schedules/agent/schedules/heartbeat.ts
index ca6d1115b..37a744279 100644
--- a/e2e/fixtures/agent-schedules/agent/schedules/heartbeat.ts
+++ b/e2e/fixtures/agent-schedules/agent/schedules/heartbeat.ts
@@ -1,7 +1,7 @@
import { defineSchedule } from "eve/schedules";
/**
- * Markdown (task-mode) schedule used by `evals/schedule-dispatch.eval.ts`.
+ * Markdown schedule used by `evals/schedule-dispatch.eval.ts`.
*
* The eval fires it out of band through the dev-only dispatch route
* (`t.target.dispatchSchedule("heartbeat")`), which runs the exact path the
diff --git a/e2e/fixtures/agent-subagents/agent/subagents/remote-loopback.ts b/e2e/fixtures/agent-subagents/agent/subagents/remote-loopback.ts
index 748388bce..9315ce240 100644
--- a/e2e/fixtures/agent-subagents/agent/subagents/remote-loopback.ts
+++ b/e2e/fixtures/agent-subagents/agent/subagents/remote-loopback.ts
@@ -15,7 +15,7 @@ export default defineDynamic({
"session.started": () =>
defineRemoteAgent({
description:
- "Remote loopback agent. Call this only when the user explicitly asks to use the remote-loopback agent, passing the user's requested message through unchanged. Never pass `outputSchema`.",
+ "Remote loopback agent. Call this only when the user explicitly asks to use the remote-loopback agent, passing the user's requested message through unchanged.",
url: () =>
process.env.VERCEL_URL !== undefined && process.env.VERCEL_URL !== ""
? `https://${process.env.VERCEL_URL}`
diff --git a/e2e/fixtures/agent-subagents/evals/agent-messaging-remote.eval.ts b/e2e/fixtures/agent-subagents/evals/agent-messaging-remote.eval.ts
index fbc620879..2bb2e194b 100644
--- a/e2e/fixtures/agent-subagents/evals/agent-messaging-remote.eval.ts
+++ b/e2e/fixtures/agent-subagents/evals/agent-messaging-remote.eval.ts
@@ -15,7 +15,7 @@ export default defineEval({
async test(t) {
const started = await t.send(
[
- "Use the remote-loopback agent with this message (no outputSchema):",
+ "Use the remote-loopback agent with this message:",
`"Remember this exact fact: ${MEMORABLE_FACT} Reply only with READY."`,
"When it returns, reply with the single word: delegated.",
].join(" "),
diff --git a/e2e/fixtures/agent-workflow-tools/evals/dynamic-skill-context.eval.ts b/e2e/fixtures/agent-workflow-tools/evals/dynamic-skill-context.eval.ts
index 3c54278e9..14861d66c 100644
--- a/e2e/fixtures/agent-workflow-tools/evals/dynamic-skill-context.eval.ts
+++ b/e2e/fixtures/agent-workflow-tools/evals/dynamic-skill-context.eval.ts
@@ -109,7 +109,6 @@ export default (["direct", "waiting", "background"] as const).map((mode) =>
conversation: {
audience: "private",
channel: { kind: "channel:skill-context", name: "skill-context" },
- mode: "conversation",
environment: started.environment,
principalType: "user",
},
diff --git a/packages/eve/extension-contracts/reports/channel/v33.json b/packages/eve/extension-contracts/reports/channel/v33.json
new file mode 100644
index 000000000..c40451ad0
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/channel/v33.json
@@ -0,0 +1,21 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "channel",
+ "epoch": 33,
+ "sha256": "ab420ed08cdc982d1990fefe8aaf585a9139028b212e30c6c5e673de02e4739d",
+ "exports": [
+ "DELETE",
+ "GET",
+ "HEAD",
+ "OPTIONS",
+ "PATCH",
+ "POST",
+ "PUT",
+ "WS",
+ "createWebSocketUpgradeServer",
+ "defineChannel",
+ "disableRoute",
+ "isChannel",
+ "isDisabledRouteSentinel"
+ ]
+}
diff --git a/packages/eve/extension-contracts/reports/connection/v28.json b/packages/eve/extension-contracts/reports/connection/v28.json
new file mode 100644
index 000000000..efda39636
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/connection/v28.json
@@ -0,0 +1,16 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "connection",
+ "epoch": 28,
+ "sha256": "b52882733c8c94fd41167a4d0143c4d0a9912eb600de727de0a9f72daed12cfa",
+ "exports": [
+ "ConnectionAuthorizationFailedError",
+ "ConnectionAuthorizationRequiredError",
+ "defineDynamic",
+ "defineInteractiveAuthorization",
+ "defineMcpClientConnection",
+ "defineOpenAPIConnection",
+ "isConnectionAuthorizationFailedError",
+ "isConnectionAuthorizationRequiredError"
+ ]
+}
diff --git a/packages/eve/extension-contracts/reports/dynamicInstructions/v24.json b/packages/eve/extension-contracts/reports/dynamicInstructions/v24.json
new file mode 100644
index 000000000..2222bc1dc
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/dynamicInstructions/v24.json
@@ -0,0 +1,7 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "dynamicInstructions",
+ "epoch": 24,
+ "sha256": "6452cc674f65e01b0e1457b98f0cf5e7c2315259a7cc8280d6ea9917e4509755",
+ "exports": ["defineDynamic"]
+}
diff --git a/packages/eve/extension-contracts/reports/dynamicSkill/v23.json b/packages/eve/extension-contracts/reports/dynamicSkill/v23.json
new file mode 100644
index 000000000..4b035c8fa
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/dynamicSkill/v23.json
@@ -0,0 +1,7 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "dynamicSkill",
+ "epoch": 23,
+ "sha256": "71368ad87421ce6e5bff8dabc673430a3ef38fc233884224cbcabbbc1e22f269",
+ "exports": ["defineDynamic"]
+}
diff --git a/packages/eve/extension-contracts/reports/dynamicTool/v56.json b/packages/eve/extension-contracts/reports/dynamicTool/v56.json
new file mode 100644
index 000000000..5882ec036
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/dynamicTool/v56.json
@@ -0,0 +1,16 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "dynamicTool",
+ "epoch": 56,
+ "sha256": "c65a69cd368aaa1097034d5c6d58a371522cc788da15f4fec8a35f25051eaaa5",
+ "exports": [
+ "DynamicToolEntry",
+ "DynamicToolEvents",
+ "DynamicToolResult",
+ "DynamicToolSet",
+ "auto",
+ "defineDurableCallback",
+ "defineDurableSchema",
+ "defineDynamic"
+ ]
+}
diff --git a/packages/eve/extension-contracts/reports/subagent/v21.json b/packages/eve/extension-contracts/reports/subagent/v21.json
new file mode 100644
index 000000000..817f8f9b8
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/subagent/v21.json
@@ -0,0 +1,23 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "subagent",
+ "epoch": 21,
+ "sha256": "ba16f77db1bbe79040760245e892a1db286c73d9c53b0be891046b046ed15ea0",
+ "exports": [
+ "AgentCompactionDefinition",
+ "AgentDefinition",
+ "AgentModelDefinition",
+ "AgentStaticModelDefinition",
+ "DefinedAgent",
+ "DynamicLocalSubagentDefinition",
+ "DynamicSubagentDefinition",
+ "RemoteAgentDefinition",
+ "RemoteAgentDefinitionInput",
+ "WorkspaceAgentDefinition",
+ "WorkspaceAgentTransport",
+ "defineAgent",
+ "defineDynamic",
+ "defineRemoteAgent",
+ "defineWorkspaceAgent"
+ ]
+}
diff --git a/packages/eve/extension-contracts/reports/tool/v58.json b/packages/eve/extension-contracts/reports/tool/v58.json
new file mode 100644
index 000000000..d9e9cea49
--- /dev/null
+++ b/packages/eve/extension-contracts/reports/tool/v58.json
@@ -0,0 +1,27 @@
+{
+ "kind": "eve-extension-capability-contract",
+ "capability": "tool",
+ "epoch": 58,
+ "sha256": "1165e5068a254e233454733243ace11d86441d3a20759fa8ba571908c2e30e1d",
+ "exports": [
+ "AgentRouterInput",
+ "AgentRouterTool",
+ "WorkflowStepToolContext",
+ "WorkflowTool",
+ "WorkflowToolInput",
+ "WorkflowToolOptions",
+ "agentRouter",
+ "defaultWebSearch",
+ "defineTool",
+ "defineWorkflowTool",
+ "disableTool",
+ "evaluate",
+ "isDisabledToolSentinel",
+ "isWebSearchToolDefinition",
+ "toolOutput",
+ "toolOutputPart",
+ "toolResultFrom",
+ "webSearch",
+ "workflow"
+ ]
+}
diff --git a/packages/eve/src/channel/channel-address.ts b/packages/eve/src/channel/channel-address.ts
index eeac78c0c..1a65fc33b 100644
--- a/packages/eve/src/channel/channel-address.ts
+++ b/packages/eve/src/channel/channel-address.ts
@@ -24,13 +24,11 @@ import type {
} from "#channel/types.js";
import { DEFAULT_TURN_POLICY } from "#channel/types.js";
import { isReservedSessionCommandToken } from "#execution/session-inbox/address.js";
-import type { RunMode } from "#shared/run-mode.js";
interface BaseChannelAddressDeliveryOptions {
readonly auth: SessionAuthContext | null;
readonly callback?: SessionCallback;
readonly initiatorAuth?: SessionAuthContext | null;
- readonly mode?: RunMode;
readonly title?: string;
readonly turnPolicy?: TurnPolicy;
readonly taskDeliveryPolicy?: TaskDeliveryPolicy;
@@ -141,13 +139,11 @@ export function createChannelAddress<TState = undefined>(input: {
state: { ...input.adapter.state, ...(state as Record<string, unknown>) },
};
if (adapter !== input.adapter) copyChannelActivityPresentation(input.adapter, adapter);
- const capabilities: RunInput["capabilities"] =
- options.mode === "task" ? undefined : { requestInput: true };
const runInput: RunInput = {
taskDeliveryPolicy,
adapter,
auth: options.auth,
- capabilities,
+ capabilities: { requestInput: true },
callback: options.callback,
channelName: input.channelName,
continuationConflictCommand: command,
@@ -159,7 +155,6 @@ export function createChannelAddress<TState = undefined>(input: {
message: serializeUrlFilePartsInMessage(payload.message) ?? "",
outputSchema: payload.outputSchema,
},
- mode: options.mode ?? "conversation",
requestId: metadata.requestId,
title: options.title,
};
diff --git a/packages/eve/src/channel/channel-operations.ts b/packages/eve/src/channel/channel-operations.ts
index 05a90a9d9..cda22f38b 100644
--- a/packages/eve/src/channel/channel-operations.ts
+++ b/packages/eve/src/channel/channel-operations.ts
@@ -24,16 +24,12 @@ import {
parseInputResponses,
type StrictInputResponses,
} from "#shared/input.js";
-import type { JsonObject } from "#shared/json.js";
-import type { RunMode } from "#shared/run-mode.js";
interface BaseChannelSendOptions {
readonly auth: SessionAuthContext | null;
readonly callback?: SessionCallback;
readonly context?: readonly string[];
readonly initiatorAuth?: SessionAuthContext | null;
- readonly mode?: RunMode;
- readonly outputSchema?: JsonObject;
readonly title?: string;
readonly turnPolicy?: TurnPolicy;
/** Updates the session policy; omission preserves it. New sessions default to auto, schedules to cohort. */
@@ -48,7 +44,6 @@ export type ChannelSendOptions<TState = undefined> = [TState] extends [undefined
interface BaseChannelRespondOptions<TState = undefined> {
readonly auth: SessionAuthContext | null;
readonly context?: readonly string[];
- readonly outputSchema?: JsonObject;
readonly state?: Partial<TState>;
}
@@ -116,7 +111,6 @@ export function createChannelOperations<TState = undefined>(input: {
{
context: options.context,
message,
- outputSchema: options.outputSchema,
},
options,
);
@@ -130,7 +124,6 @@ export function createChannelOperations<TState = undefined>(input: {
{
context: options.context,
inputResponses: validatedInputResponses,
- outputSchema: options.outputSchema,
state: options.state,
},
options,
diff --git a/packages/eve/src/channel/conversation-context.ts b/packages/eve/src/channel/conversation-context.ts
index c6b77913b..db73a1deb 100644
--- a/packages/eve/src/channel/conversation-context.ts
+++ b/packages/eve/src/channel/conversation-context.ts
@@ -36,7 +36,6 @@ export function buildConversationContext(
auth,
caller: toAudienceCaller(auth),
channel,
- mode: run.mode,
environment,
});
@@ -45,7 +44,6 @@ export function buildConversationContext(
channelKind: projection.kind,
environment,
forwardedTracePolicy,
- mode: run.mode,
principalType: auth?.principalType,
}),
audience,
diff --git a/packages/eve/src/channel/instrumentation.test.ts b/packages/eve/src/channel/instrumentation.test.ts
index 4466d4db1..67e051b23 100644
--- a/packages/eve/src/channel/instrumentation.test.ts
+++ b/packages/eve/src/channel/instrumentation.test.ts
@@ -10,7 +10,6 @@ const audienceInput: AudienceContext<Record<string, unknown>> = {
caller: { type: "anonymous" },
channel: { kind: "channel:support", name: "support" },
environment: "production",
- mode: "conversation",
state: {},
};
diff --git a/packages/eve/src/channel/routes.ts b/packages/eve/src/channel/routes.ts
index 15122cdec..a9acb9af0 100644
--- a/packages/eve/src/channel/routes.ts
+++ b/packages/eve/src/channel/routes.ts
@@ -45,8 +45,7 @@ export interface SendPayload {
*/
readonly context?: readonly string[];
/**
- * Run-scoped JSON schema the turn's result must match. eve enforces the
- * schema in conversation and task mode; mode only decides failure behavior.
+ * Run-scoped JSON schema the turn's result must match.
*/
readonly outputSchema?: JsonObject;
}
diff --git a/packages/eve/src/channel/schedule.test.ts b/packages/eve/src/channel/schedule.test.ts
index 2a391b094..3a8674206 100644
--- a/packages/eve/src/channel/schedule.test.ts
+++ b/packages/eve/src/channel/schedule.test.ts
@@ -108,7 +108,6 @@ describe("ScheduleDispatcher", () => {
expect.objectContaining({
adapter: SCHEDULE_ADAPTER,
input: { message: "Run heartbeat task." },
- mode: "task",
auth: SCHEDULE_APP_AUTH,
}),
);
diff --git a/packages/eve/src/channel/schedule.ts b/packages/eve/src/channel/schedule.ts
index 62deb16f2..d13c815d9 100644
--- a/packages/eve/src/channel/schedule.ts
+++ b/packages/eve/src/channel/schedule.ts
@@ -49,8 +49,8 @@ export interface ScheduleDispatchInput {
* so the dispatcher awaits in-flight work before settling.
*
* For markdown schedules: synthesizes a channel-less run that starts a
- * session with {@link SCHEDULE_ADAPTER} in task mode and the markdown
- * body as the message.
+ * session with {@link SCHEDULE_ADAPTER} and the markdown body as the
+ * message.
*
* Returns a {@link ScheduleDispatchResult} carrying any sessions the
* handler started (for telemetry / task-result observability) and the
@@ -120,7 +120,6 @@ export class ScheduleDispatcher {
adapter: SCHEDULE_ADAPTER,
auth: SCHEDULE_APP_AUTH,
input: { message: markdown },
- mode: "task",
});
return createSession(handle.sessionId, this.runtime);
}
diff --git a/packages/eve/src/channel/types.ts b/packages/eve/src/channel/types.ts
index 70d769219..7cd6f3440 100644
--- a/packages/eve/src/channel/types.ts
+++ b/packages/eve/src/channel/types.ts
@@ -3,7 +3,6 @@ import type { UserContent } from "ai";
import type { SessionInboxAddress } from "#execution/session-inbox/address.js";
import type { MessageStreamEvent, UnstampedMessageStreamEvent } from "#protocol/message.js";
import type { CancelTurnResult as ProtocolCancelTurnResult } from "#protocol/cancel-turn.js";
-import type { RunMode } from "#shared/run-mode.js";
import type {
RuntimeSubagentChildResult,
RuntimeSubagentDispatchFailure,
@@ -409,9 +408,9 @@ export type HookPayload =
*
* `url` is the absolute callback endpoint. `token` is the capability token
* embedded in the framework-owned callback route. `callId` and `subagentName`
- * correlate the callee's result to the pending tool call. Task sessions send a
- * terminal session result. Conversation sessions use this as their first turn's
- * caller; each continuation supplies the caller for that turn.
+ * correlate the callee's result to the pending tool call. The session uses
+ * this as its first turn's caller; each continuation supplies the caller for
+ * that turn.
*/
export interface ActivitySinkV1 {
readonly url: string;
@@ -438,9 +437,7 @@ export interface SessionCallback {
/**
* Runtime capabilities granted to one eve session.
*
- * Capabilities describe what the session may do mid-turn: a session-level
- * contract, orthogonal to {@link RunInput.mode} which decides done-vs-park on
- * an empty turn.
+ * Capabilities describe what the session may do mid-turn.
*
* Channel routes that can reach a human (HTTP, Slack, etc.) set
* `requestInput: true` when starting a run. Subagent dispatch inherits the
@@ -454,8 +451,8 @@ export interface SessionCapabilities {
*
* 1. `ctx.ask()` resolves as `unavailable` instead of waiting when the
* session cannot request input.
- * 2. The pending-input park guard: scheduled task sessions without this flag
- * fail fast rather than waiting for a response to a tool approval.
+ * 2. The pending-input park guard: sessions without this flag and without a
+ * delegating parent fail fast rather than waiting for a tool approval.
*/
readonly requestInput?: boolean;
}
@@ -511,9 +508,8 @@ export interface RunInput {
*/
readonly title?: string;
/**
- * Optional caller callback. Task sessions post when the session completes or
- * fails. Conversation sessions use it for the first turn; continuations carry
- * the caller for their own turn.
+ * Optional caller callback for the first turn; continuations carry the
+ * caller for their own turn.
*/
readonly callback?: SessionCallback;
/** Private collector capability and current work lineage. */
@@ -549,7 +545,6 @@ export interface RunInput {
readonly context?: readonly string[];
readonly outputSchema?: JsonObject;
};
- readonly mode: RunMode;
/** Observability correlation only; never grants delegated-session privileges. */
readonly conversationId?: string;
readonly parent?: SessionParent;
diff --git a/packages/eve/src/cli/dev/tui/subagent-pump.ts b/packages/eve/src/cli/dev/tui/subagent-pump.ts
index a2bd47ace..79a97c6c5 100644
--- a/packages/eve/src/cli/dev/tui/subagent-pump.ts
+++ b/packages/eve/src/cli/dev/tui/subagent-pump.ts
@@ -242,12 +242,10 @@ export class SubagentPump {
* nested subagent blocks.
*
* Pumps are fire-and-forget and must never be awaited at a turn boundary:
- * a subagent dispatched in `task` mode that parks for HITL never emits a
- * turn-boundary event on its own stream (`harness/tool-loop.ts` gates
- * `emitTurnEpilogue` on `mode === "conversation"`), so blocking on a child
- * stream would stall the prompt until the subagent's serverless function
- * times out. Pumps stay open across HITL prompts and resume rendering when
- * the subagent unparks; they end on the child's own boundary or via abort.
+ * a child session parks instead of ending, so its stream stays open and
+ * blocking on it would stall the prompt. Pumps stay open across HITL prompts
+ * and resume rendering when the subagent unparks; they end on the child's
+ * own boundary or via abort.
*/
#activateOrQueue(callId: string): void {
const run = this.#runs.get(callId);
diff --git a/packages/eve/src/cli/dev/tui/tool-presentation.ts b/packages/eve/src/cli/dev/tui/tool-presentation.ts
index c661ea6fc..dd86acbb7 100644
--- a/packages/eve/src/cli/dev/tui/tool-presentation.ts
+++ b/packages/eve/src/cli/dev/tui/tool-presentation.ts
@@ -233,7 +233,7 @@ export function presentTool(
};
}
if (baseName === "final_output") {
- // Task-mode terminal signal (subagent streams): its input is the
+ // Structured-output terminal signal: its input is the
// structured result itself, kept behind the expanded `--tools full` view.
return { title: FINAL_OUTPUT_TITLE, subtitle: "", summarizeResult: () => undefined };
}
diff --git a/packages/eve/src/compiler/compile-from-memory.ts b/packages/eve/src/compiler/compile-from-memory.ts
index 574634389..07bc46b0f 100644
--- a/packages/eve/src/compiler/compile-from-memory.ts
+++ b/packages/eve/src/compiler/compile-from-memory.ts
@@ -30,7 +30,6 @@ export interface CompileFromMemoryInput {
readonly maxTokenCostUsdPerSession?: number | false;
readonly sessionTimeoutMs?: number | false;
};
- readonly outputSchema?: JsonObject;
readonly revision?: string;
readonly modules?: readonly ProgrammaticAgentModule[];
readonly tools?: readonly CompileFromMemoryToolInput[];
@@ -70,7 +69,6 @@ export async function compileFromMemory(
input.agent ?? {
limits: input.limits,
model: input.model,
- outputSchema: input.outputSchema,
},
);
const modules = [
diff --git a/packages/eve/src/compiler/extension-compatibility.ts b/packages/eve/src/compiler/extension-compatibility.ts
index 2e63506b6..c21588744 100644
--- a/packages/eve/src/compiler/extension-compatibility.ts
+++ b/packages/eve/src/compiler/extension-compatibility.ts
@@ -22,8 +22,8 @@ interface ExtensionCapabilityContract {
const EXTENSION_CAPABILITY_CONTRACTS = {
extension: { current: 1, supported: [1], dropped: {} },
tool: {
- current: 57,
- supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 29, 30, 31, 32, 34, 35, 54, 55, 57],
+ current: 58,
+ supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 29, 30, 31, 32, 34, 35, 54, 55, 58],
dropped: {
14: "TaskExec.delegated was removed; migrate to workflow-backed background tools",
15: "TaskExec replaces stageEffect with send",
@@ -60,13 +60,14 @@ const EXTENSION_CAPABILITY_CONTRACTS = {
52: "Background defineTool and TaskExec were removed; use defineWorkflowTool for durable background work.",
53: "Sandbox sessions no longer expose core identity and mutable networking is provider-specific.",
56: "SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities",
+ 57: "agentRouter() no longer accepts a model-facing outputSchema; structured subagent output is requested only through ctx.agent().",
},
},
dynamicTool: {
- current: 55,
+ current: 56,
supported: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 31, 32, 33, 52, 54,
- 55,
+ 56,
],
dropped: {
21: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
@@ -97,11 +98,12 @@ const EXTENSION_CAPABILITY_CONTRACTS = {
50: "Background dynamic tools were removed; use a static defineWorkflowTool for durable background work.",
51: "Sandbox sessions no longer expose core identity and mutable networking is provider-specific.",
53: "SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities",
+ 55: "Run mode was removed; sessions always park and ConversationContext no longer carries mode.",
},
},
channel: {
- current: 32,
- supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 29, 31, 32],
+ current: 33,
+ supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 29, 31, 33],
dropped: {
12: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
19: "Continuation rekey was removed; channel extensions must use additive continuation.alias instead.",
@@ -115,6 +117,7 @@ const EXTENSION_CAPABILITY_CONTRACTS = {
27: "Sandbox sessions no longer expose core identity and mutable networking is provider-specific.",
28: "Sandbox sessions no longer expose core identity and mutable networking is provider-specific.",
30: "SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities",
+ 32: "Run mode and caller-supplied output schemas were removed from channel operations; sessions always park, and send options, audience inputs, and ConversationContext no longer carry mode, while from().send() and from().respond() no longer accept outputSchema.",
},
},
schedule: {
@@ -125,24 +128,26 @@ const EXTENSION_CAPABILITY_CONTRACTS = {
},
},
subagent: {
- current: 20,
- supported: [3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20],
+ current: 21,
+ supported: [3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 21],
dropped: {
1: "Persistent subagent sessions are now the default and the experimental opt-in was removed",
2: "Persistent subagent sessions are now the default and the experimental opt-in was removed",
5: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
17: "Removed experimental.instrumentationProviders; instrumentation is now always enabled for root agents.",
18: "Removed experimental.instrumentationProviders; instrumentation is now always enabled for root agents.",
+ 20: "Run mode was removed and agent definitions no longer declare outputSchema; sessions always park, ConversationContext no longer carries mode, and structured output is requested per turn.",
},
},
connection: {
- current: 27,
- supported: [1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 27],
+ current: 28,
+ supported: [1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26, 28],
dropped: {
9: "Dynamic connection resolvers no longer receive conversation or channel continuation data",
10: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
23: "Sandbox sessions no longer expose core identity and mutable networking is provider-specific.",
25: "SandboxSession no longer exposes setNetworkPolicy; pass the configured environment to ctx.getSandbox(environment) to access network policy capabilities",
+ 27: "Run mode was removed; sessions always park and ConversationContext no longer carries mode.",
},
},
hook: {
@@ -165,18 +170,20 @@ const EXTENSION_CAPABILITY_CONTRACTS = {
},
skill: { current: 2, supported: [1, 2], dropped: {} },
dynamicSkill: {
- current: 22,
- supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22],
+ current: 23,
+ supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 23],
dropped: {
13: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
+ 22: "Run mode was removed; sessions always park and ConversationContext no longer carries mode.",
},
},
instructions: { current: 2, supported: [1, 2], dropped: {} },
dynamicInstructions: {
- current: 23,
- supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23],
+ current: 24,
+ supported: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 24],
dropped: {
14: "Message and reasoning append events now expose deltas instead of cumulative snapshots.",
+ 23: "Run mode was removed; sessions always park and ConversationContext no longer carries mode.",
},
},
config: { current: 1, supported: [1], dropped: {} },
diff --git a/packages/eve/src/compiler/manifest.ts b/packages/eve/src/compiler/manifest.ts
index 1b4f0bcba..855d55378 100644
--- a/packages/eve/src/compiler/manifest.ts
+++ b/packages/eve/src/compiler/manifest.ts
@@ -604,7 +604,6 @@ const compiledAgentConfigBaseFields = {
.strict()
.optional(),
name: z.string(),
- outputSchema: jsonObjectSchema.optional(),
reasoning: z
.enum(["provider-default", "none", "minimal", "low", "medium", "high", "xhigh"])
.optional(),
@@ -1191,7 +1190,6 @@ function cloneCompiledAgentDefinition(config: CompiledAgentDefinition): Compiled
},
},
name: config.name,
- outputSchema: config.outputSchema,
reasoning: config.reasoning,
limits:
config.limits === undefined
diff --git a/packages/eve/src/compiler/normalize-agent-config.ts b/packages/eve/src/compiler/normalize-agent-config.ts
index 552ad0395..f751cf744 100644
--- a/packages/eve/src/compiler/normalize-agent-config.ts
+++ b/packages/eve/src/compiler/normalize-agent-config.ts
@@ -3,7 +3,6 @@ import { isAbsolute, relative, resolve } from "node:path";
import type { AgentSourceManifest } from "#discover/manifest.js";
import { normalizeLogicalPath } from "#discover/filesystem.js";
import { normalizeAgentDefinition } from "#internal/authored-definition/core.js";
-import { serializeOutputSchema } from "#tools/schema.js";
import { formatLanguageModelGatewayId } from "#internal/runtime-model.js";
import { classifyModelRouting } from "#internal/classify-model-routing.js";
import { isChatGptModelRouting } from "#shared/chatgpt-model.js";
@@ -86,7 +85,6 @@ export async function compileAgentConfig(
description?: string;
experimental?: CompiledAgentDefinition["experimental"];
name: string;
- outputSchema?: JsonObject;
reasoning?: CompiledAgentDefinition["reasoning"];
source: ModuleSourceRef;
tool?: boolean;
@@ -130,10 +128,6 @@ export async function compileAgentConfig(
};
}
- if (definition.outputSchema !== undefined) {
- compiledConfig.outputSchema = serializeOutputSchema(definition.outputSchema);
- }
-
if (definition.reasoning !== undefined) {
compiledConfig.reasoning = definition.reasoning;
}
diff --git a/packages/eve/src/compiler/normalize-manifest-helpers.ts b/packages/eve/src/compiler/normalize-manifest-helpers.ts
index 8f7dfc61a..51250cc50 100644
--- a/packages/eve/src/compiler/normalize-manifest-helpers.ts
+++ b/packages/eve/src/compiler/normalize-manifest-helpers.ts
@@ -167,9 +167,6 @@ export function createCompiledRemoteAgent(input: {
if (input.sourceRef.exportName !== undefined) {
Object.assign(node, { exportName: input.sourceRef.exportName });
}
- if (input.definition.outputSchema !== undefined) {
- Object.assign(node, { outputSchema: input.definition.outputSchema });
- }
if (input.definition.tool !== undefined) Object.assign(node, { tool: input.definition.tool });
if (input.definition.url !== undefined) Object.assign(node, { url: input.definition.url });
return node;
diff --git a/packages/eve/src/compiler/normalize-subagent.ts b/packages/eve/src/compiler/normalize-subagent.ts
index ae98c20b1..b43b3654c 100644
--- a/packages/eve/src/compiler/normalize-subagent.ts
+++ b/packages/eve/src/compiler/normalize-subagent.ts
@@ -6,8 +6,6 @@ import {
expectString,
} from "#internal/authored-module.js";
import { EVE_SESSION_ROUTE_PATH } from "#protocol/routes.js";
-import { serializeOutputSchema, type ToolSchemaSource } from "#tools/schema.js";
-import type { JsonObject } from "#shared/json.js";
import { isDynamicSentinel, type DynamicToolEventName } from "#dynamic/definition.js";
import type { LocalSubagentSourceRef } from "#discover/manifest.js";
@@ -29,7 +27,6 @@ export type NormalizedSubagentConfig =
| {
readonly description: string;
readonly kind: "remote";
- readonly outputSchema?: JsonObject;
readonly path: string;
readonly tool?: boolean;
readonly url?: string;
@@ -65,17 +62,7 @@ export function normalizeSubagentConfig(value: unknown, message: string): Normal
const record = expectObjectRecord(value, message);
expectOnlyKnownKeys(
record,
- [
- "auth",
- "description",
- "forwardPrincipal",
- "headers",
- "kind",
- "outputSchema",
- "path",
- "tool",
- "url",
- ],
+ ["auth", "description", "forwardPrincipal", "headers", "kind", "path", "tool", "url"],
message,
);
if (record.forwardPrincipal !== undefined) {
@@ -84,11 +71,9 @@ export function normalizeSubagentConfig(value: unknown, message: string): Normal
`${message} Expected "forwardPrincipal" to be a boolean.`,
);
}
- const outputSchema = serializeOutputSchema(record.outputSchema as ToolSchemaSource | undefined);
return {
description: expectString(record.description, message),
kind: "remote",
- outputSchema,
path: record.path === undefined ? EVE_SESSION_ROUTE_PATH : expectString(record.path, message),
tool: record.tool === undefined ? undefined : expectBoolean(record.tool, message),
url: typeof record.url === "function" ? undefined : expectString(record.url, message),
diff --git a/packages/eve/src/compiler/remote-agent-node.ts b/packages/eve/src/compiler/remote-agent-node.ts
index 1eb3cda3f..eaac08278 100644
--- a/packages/eve/src/compiler/remote-agent-node.ts
+++ b/packages/eve/src/compiler/remote-agent-node.ts
@@ -1,7 +1,5 @@
import { z } from "#compiled/zod/index.js";
-import { jsonObjectSchema } from "#shared/json-schemas.js";
-import type { JsonObject } from "#shared/json.js";
import type { Node } from "#shared/node.js";
import type { ModuleSourceRef } from "#shared/source-ref.js";
import type { AgentSourceOwner, CompiledModuleBinding } from "#compiler/source-graph.js";
@@ -28,7 +26,6 @@ export type CompiledRemoteAgentNode = Readonly<
name: string;
owner: AgentSourceOwner;
parentNodeId: string;
- outputSchema?: JsonObject;
path: string;
rootPath: string;
tool?: boolean;
@@ -96,7 +93,6 @@ export const compiledRemoteAgentNodeSchema: z.ZodType<CompiledRemoteAgentNode> =
.strict(),
]),
parentNodeId: z.string(),
- outputSchema: jsonObjectSchema.optional(),
path: z.string(),
rootPath: z.string(),
tool: z.boolean().optional(),
diff --git a/packages/eve/src/context/dynamic-subagent-lifecycle.test.ts b/packages/eve/src/context/dynamic-subagent-lifecycle.test.ts
index 052b6eb62..2e321090d 100644
--- a/packages/eve/src/context/dynamic-subagent-lifecycle.test.ts
+++ b/packages/eve/src/context/dynamic-subagent-lifecycle.test.ts
@@ -299,7 +299,6 @@ describe("dynamic subagent lifecycle", () => {
description: "Research on the remote deployment.",
forwardPrincipal: true,
headers,
- outputSchema: { properties: { answer: { type: "string" } }, type: "object" },
url: async () => "https://research.example.com",
});
const credentialsFactory = Object.assign(
diff --git a/packages/eve/src/context/dynamic-subagent-lifecycle.ts b/packages/eve/src/context/dynamic-subagent-lifecycle.ts
index 247556116..157cce8ef 100644
--- a/packages/eve/src/context/dynamic-subagent-lifecycle.ts
+++ b/packages/eve/src/context/dynamic-subagent-lifecycle.ts
@@ -54,7 +54,6 @@ async function resolveSelections(input: {
logicalPath: resolver.logicalPath,
name: resolver.name,
nodeId: resolver.nodeId,
- outputSchema: effectiveRemoteAgent.outputSchema,
path: effectiveRemoteAgent.path,
sourceId: resolver.sourceId,
sourceKind: resolver.sourceKind,
diff --git a/packages/eve/src/context/keys.ts b/packages/eve/src/context/keys.ts
index 8273d7cc8..013f7ceaa 100644
--- a/packages/eve/src/context/keys.ts
+++ b/packages/eve/src/context/keys.ts
@@ -32,7 +32,6 @@ import type { PersistedDynamicToolMetadata } from "#context/dynamic-tool-metadat
import type { DynamicSubagentAgentConfig } from "#runtime/subagents/dynamic-agent-config.js";
import type { DynamicRemoteAgentConfig } from "#runtime/subagents/dynamic-remote-agent-config.js";
import type { SandboxAccess } from "#sandbox/state.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { HistoryViewProjector } from "#shared/history-view.js";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import type { PreparedRuntimeDelegationTool } from "#runtime/sessions/turn.js";
@@ -136,8 +135,6 @@ export const ActiveChannelDeliveriesKey = new ContextKey<readonly ActiveChannelD
export const ChannelInstrumentationKey = new ContextKey<ChannelInstrumentationProjection>(
"eve.channelInstrumentation",
);
-/** Trace ceiling and immutable origin accepted from a trusted forwarding deployment. */
-export const ModeKey = new ContextKey<RunMode>("eve.mode");
export const ParentSessionKey = new ContextKey<SessionParent>("eve.parentSession");
/** Separate from {@link ParentSessionKey} so it stays out of what extensions read. */
export const ParentTraceContextKey = new ContextKey<SessionTraceContext>("eve.parentTraceContext");
diff --git a/packages/eve/src/eve-channel/audience.test.ts b/packages/eve/src/eve-channel/audience.test.ts
index 43d5ef720..a4930f58b 100644
--- a/packages/eve/src/eve-channel/audience.test.ts
+++ b/packages/eve/src/eve-channel/audience.test.ts
@@ -22,7 +22,6 @@ function input(principalType: string | null): Omit<AudienceContext<undefined>, "
},
channel: { kind: "http" },
environment: "production",
- mode: "conversation",
};
}
diff --git a/packages/eve/src/eve-channel/create-request.ts b/packages/eve/src/eve-channel/create-request.ts
index f807ae4e6..598c2f234 100644
--- a/packages/eve/src/eve-channel/create-request.ts
+++ b/packages/eve/src/eve-channel/create-request.ts
@@ -7,7 +7,6 @@ import type {
TaskDeliveryPolicy,
} from "#channel/types.js";
import type { JsonObject } from "#shared/json.js";
-import type { RunMode } from "#shared/run-mode.js";
export interface ParsedCreateBody {
taskDeliveryPolicy?: TaskDeliveryPolicy;
@@ -15,7 +14,6 @@ export interface ParsedCreateBody {
callback?: SessionCallback;
capabilities?: SessionCapabilities;
message?: string | UserContent;
- mode?: RunMode;
context?: readonly string[];
operationId?: string;
outputSchema?: JsonObject;
@@ -28,7 +26,6 @@ export function validateMessageFreeCreate(input: {
readonly hasClientContext: boolean;
readonly hasMessageField: boolean;
readonly message: string | UserContent | undefined;
- readonly mode: RunMode | undefined;
readonly outputSchema: JsonObject | undefined;
}): Response | undefined {
if (input.hasMessageField && input.message === undefined) {
@@ -38,12 +35,6 @@ export function validateMessageFreeCreate(input: {
);
}
if (input.message !== undefined) return undefined;
- if (input.mode === "task") {
- return Response.json(
- { error: "Task sessions require a non-empty 'message'.", ok: false },
- { status: 400 },
- );
- }
if (
input.hasClientContext ||
input.callback !== undefined ||
diff --git a/packages/eve/src/eve-channel/index.ts b/packages/eve/src/eve-channel/index.ts
index 155840087..388410e00 100644
--- a/packages/eve/src/eve-channel/index.ts
+++ b/packages/eve/src/eve-channel/index.ts
@@ -312,8 +312,7 @@ export function eveChannel(input: EveChannelInput): EveChannel {
activityObserver: body.activityObserver,
audienceAuth: authResult,
auth: messageResult.auth,
- capabilities:
- body.capabilities ?? (body.mode === "task" ? undefined : { requestInput: true }),
+ capabilities: body.capabilities ?? { requestInput: true },
callback: body.callback,
continuationToken: operationToken,
initiatorAuth: forwarded.accepted ? forwarded.initiatorAuth : undefined,
@@ -325,7 +324,6 @@ export function eveChannel(input: EveChannelInput): EveChannel {
},
body.context,
),
- mode: body.mode ?? "conversation",
conversationId:
body.callback === undefined
? undefined
diff --git a/packages/eve/src/eve-channel/request.test.ts b/packages/eve/src/eve-channel/request.test.ts
index c821580e7..86f7d39ff 100644
--- a/packages/eve/src/eve-channel/request.test.ts
+++ b/packages/eve/src/eve-channel/request.test.ts
@@ -9,7 +9,6 @@ describe("parseCreateBody", () => {
callback: undefined,
capabilities: undefined,
context: undefined,
- mode: undefined,
outputSchema: undefined,
});
});
@@ -29,12 +28,4 @@ describe("parseCreateBody", () => {
error: expect.stringContaining("does not accept"),
});
});
-
- it("requires a message for task mode", async () => {
- const response = parseCreateBody({ mode: "task" });
- expect(response).toBeInstanceOf(Response);
- await expect((response as Response).json()).resolves.toMatchObject({
- error: "Task sessions require a non-empty 'message'.",
- });
- });
});
diff --git a/packages/eve/src/eve-channel/request.ts b/packages/eve/src/eve-channel/request.ts
index e25f2bd0f..437b891d1 100644
--- a/packages/eve/src/eve-channel/request.ts
+++ b/packages/eve/src/eve-channel/request.ts
@@ -34,7 +34,6 @@ import {
} from "#public/channels/upload-policy.js";
import { isInputResponse, type ValidatedInputResponse } from "#shared/input.js";
import { parseJsonObject, type JsonObject } from "#shared/json.js";
-import type { RunMode } from "#shared/run-mode.js";
import {
parseTaskDeliveryPolicyField,
parseTurnPolicyField,
@@ -90,9 +89,6 @@ export function parseCreateBody(payload: Record<string, unknown>): ParsedCreateB
if (observerRejection !== undefined) return observerRejection;
}
- const mode = parseModeField(payload.mode);
- if (mode instanceof Response) return mode;
-
const taskDeliveryPolicy = parseTaskDeliveryPolicyField(payload.taskDeliveryPolicy, message);
if (taskDeliveryPolicy instanceof Response) return taskDeliveryPolicy;
const outputSchema = parseOutputSchemaField(payload.outputSchema);
@@ -104,7 +100,6 @@ export function parseCreateBody(payload: Record<string, unknown>): ParsedCreateB
hasClientContext: payload.clientContext !== undefined,
hasMessageField: "message" in payload,
message,
- mode,
outputSchema,
});
if (messageFreeRejection !== undefined) return messageFreeRejection;
@@ -122,7 +117,6 @@ export function parseCreateBody(payload: Record<string, unknown>): ParsedCreateB
activityObserver,
callback,
capabilities,
- mode,
context,
outputSchema,
};
@@ -399,15 +393,6 @@ function parseCapabilitiesField(value: unknown): SessionCapabilities | Response
return requestInput === undefined ? {} : { requestInput };
}
-function parseModeField(value: unknown): RunMode | Response | undefined {
- if (value === undefined) return undefined;
- if (value === "conversation" || value === "task") return value;
- return Response.json(
- { error: "Expected 'mode' to be either 'conversation' or 'task'.", ok: false },
- { status: 400 },
- );
-}
-
function parseMessageField(value: unknown): string | UserContent | undefined | Response {
if (value === undefined) return undefined;
if (typeof value === "string") return value.length > 0 ? value : undefined;
diff --git a/packages/eve/src/eve-channel/types.ts b/packages/eve/src/eve-channel/types.ts
index 62335e2bf..50a4c20fd 100644
--- a/packages/eve/src/eve-channel/types.ts
+++ b/packages/eve/src/eve-channel/types.ts
@@ -106,7 +106,7 @@ export interface EveChannelInput {
* trace consumers treat as non-public.
*
* Pass a constant audience, or a function receiving the authenticated
- * principal, channel, run mode, and deployment environment. Continuation
+ * principal, channel, and deployment environment. Continuation
* turns from a different caller do not reclassify an existing session.
*/
readonly audience?:
diff --git a/packages/eve/src/execution/effective-agent-config.ts b/packages/eve/src/execution/effective-agent-config.ts
index c9a099bdd..c2f5ad0ec 100644
--- a/packages/eve/src/execution/effective-agent-config.ts
+++ b/packages/eve/src/execution/effective-agent-config.ts
@@ -47,7 +47,6 @@ export function resolveEffectiveAgentRuntimeFromConfig(
...turnAgent,
compactionModel: config.compaction?.model,
model: config.model,
- outputSchema: config.outputSchema,
reasoning: config.reasoning,
},
};
diff --git a/packages/eve/src/execution/effective-output-schema.ts b/packages/eve/src/execution/effective-output-schema.ts
deleted file mode 100644
index c90ba4226..000000000
--- a/packages/eve/src/execution/effective-output-schema.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { HarnessSession, StepInput } from "#harness/types.js";
-import type { JsonObject } from "#shared/json.js";
-import type { RunMode } from "#shared/run-mode.js";
-
-/**
- * Resolves the single output schema in effect for this turn, decoupling schema
- * enforcement from {@link RunMode}: downstream the harness reads
- * `session.outputSchema` unconditionally and never re-derives it from mode.
- *
- * A run-scoped (client-supplied) schema on the turn's {@link StepInput} always
- * wins. With no run-scoped schema, a task run adopts the agent's declared
- * return schema — its function-output contract, which only applies when the
- * agent is invoked directly as a task-mode schedule or job. Subagent
- * dispatch carries its declared schema as a run-scoped schema instead.
- * A conversation run with no run-scoped schema enforces nothing. Continuation
- * steps (no new `StepInput`) preserve whatever is already in effect.
- */
-export function resolveEffectiveOutputSchema(input: {
- readonly agentOutputSchema: JsonObject | undefined;
- readonly input: StepInput | undefined;
- readonly mode: RunMode;
- readonly session: HarnessSession;
-}): HarnessSession {
- const { agentOutputSchema, input: stepInput, mode, session } = input;
-
- if (stepInput?.outputSchema !== undefined) {
- return { ...session, outputSchema: stepInput.outputSchema };
- }
-
- if (mode === "task" && session.outputSchema === undefined && agentOutputSchema !== undefined) {
- return { ...session, outputSchema: agentOutputSchema };
- }
-
- return session;
-}
diff --git a/packages/eve/src/execution/eve-workflow-attributes.test.ts b/packages/eve/src/execution/eve-workflow-attributes.test.ts
index 0185b45bf..737d3d0f0 100644
--- a/packages/eve/src/execution/eve-workflow-attributes.test.ts
+++ b/packages/eve/src/execution/eve-workflow-attributes.test.ts
@@ -28,7 +28,6 @@ const publicConversation = {
audience: "public",
channel: { kind: "channel:slack", name: "slack" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
} as const;
@@ -36,7 +35,6 @@ const unknownConversation = {
audience: "unknown",
channel: { kind: "http" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
} as const;
diff --git a/packages/eve/src/execution/file-memory.integration.test.ts b/packages/eve/src/execution/file-memory.integration.test.ts
index bf16397b0..bc0967071 100644
--- a/packages/eve/src/execution/file-memory.integration.test.ts
+++ b/packages/eve/src/execution/file-memory.integration.test.ts
@@ -93,7 +93,6 @@ async function runTurn(input: { readonly message: string; readonly principalId:
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": { kind: "http", state: {} },
"eve.continuationToken": `http:file-memory:${input.principalId}:${crypto.randomUUID()}`,
- "eve.mode": "conversation",
},
},
]);
diff --git a/packages/eve/src/execution/legacy-session/import.integration.test.ts b/packages/eve/src/execution/legacy-session/import.integration.test.ts
index 11097b2cb..7d8f2d919 100644
--- a/packages/eve/src/execution/legacy-session/import.integration.test.ts
+++ b/packages/eve/src/execution/legacy-session/import.integration.test.ts
@@ -36,7 +36,6 @@ describe("legacy session import", () => {
"eve.auth": null,
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": { kind: "http", state: {} },
- "eve.mode": "conversation",
},
},
]);
@@ -250,6 +249,5 @@ function legacyContext() {
"eve.auth": null,
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": { kind: "http", state: {} },
- "eve.mode": "conversation",
};
}
diff --git a/packages/eve/src/execution/legacy-session/input.test.ts b/packages/eve/src/execution/legacy-session/input.test.ts
index f1ced2aa6..06be72600 100644
--- a/packages/eve/src/execution/legacy-session/input.test.ts
+++ b/packages/eve/src/execution/legacy-session/input.test.ts
@@ -13,7 +13,6 @@ describe("legacy turn input", () => {
version,
stepInput: step,
completionToken: "old:turn:0",
- mode: "conversation",
}).delivery,
).toEqual(step.input);
});
@@ -23,7 +22,6 @@ describe("legacy turn input", () => {
...step,
delivery: step.input,
completionToken: "old:turn:0",
- mode: "conversation",
}),
).toThrow("Unsupported legacy turn input version.");
});
@@ -36,7 +34,6 @@ describe("legacy turn input", () => {
version: 2,
stepInput: step,
completionToken: "old:turn:0",
- mode: "conversation",
initialStep: { beforeStep: step, result: committed },
});
expect(input.sessionState).toEqual(committed.sessionState);
@@ -49,7 +46,6 @@ describe("legacy turn input", () => {
version: 2,
stepInput: step,
completionToken: "old:turn:0",
- mode: "conversation",
initialStep: {
result: {
action: "park",
diff --git a/packages/eve/src/execution/legacy-session/input.ts b/packages/eve/src/execution/legacy-session/input.ts
index d96524e0c..398ba431f 100644
--- a/packages/eve/src/execution/legacy-session/input.ts
+++ b/packages/eve/src/execution/legacy-session/input.ts
@@ -1,12 +1,10 @@
import type { DeliverHookPayload, SessionCapabilities } from "#channel/types.js";
import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
-import type { RunMode } from "#shared/run-mode.js";
import { isObject } from "#shared/guards.js";
export interface LegacyTurnInput {
readonly completionToken: string;
readonly capabilities?: SessionCapabilities;
- readonly mode: RunMode;
readonly retention?: AgentWorkflowRetentionDefinition;
readonly sessionWritable: WritableStream<Uint8Array>;
readonly serializedContext: Record<string, unknown>;
@@ -21,12 +19,7 @@ export function readLegacyTurnInput(value: unknown): LegacyTurnInput {
if (!isObject(value) || (value.version !== 1 && value.version !== 2))
throw new Error("Unsupported legacy turn input version.");
const step = value.stepInput;
- if (
- !isObject(step) ||
- typeof value.completionToken !== "string" ||
- !value.completionToken ||
- (value.mode !== "conversation" && value.mode !== "task")
- )
+ if (!isObject(step) || typeof value.completionToken !== "string" || !value.completionToken)
throw new Error("Invalid legacy turn input.");
const committed =
isObject(value.initialStep) && isObject(value.initialStep.result)
@@ -62,7 +55,6 @@ export function readLegacyTurnInput(value: unknown): LegacyTurnInput {
: undefined;
return {
completionToken: value.completionToken,
- mode: value.mode,
capabilities: value.capabilities as SessionCapabilities | undefined,
retention: value.retention as AgentWorkflowRetentionDefinition | undefined,
// The former driver's wire field; the stream is the session's, not a parent's.
diff --git a/packages/eve/src/execution/legacy-session/interrupt-step.test.ts b/packages/eve/src/execution/legacy-session/interrupt-step.test.ts
index af0cccbe6..16fcc7761 100644
--- a/packages/eve/src/execution/legacy-session/interrupt-step.test.ts
+++ b/packages/eve/src/execution/legacy-session/interrupt-step.test.ts
@@ -37,7 +37,6 @@ function fixture(turnId = ""): PreparedLegacySession {
deploymentId: "new",
input: {
retention: undefined,
- mode: "conversation",
completionToken: "old:completion",
sessionWritable: new WritableStream(),
serializedContext: {},
diff --git a/packages/eve/src/execution/legacy-session/prepare-step.test.ts b/packages/eve/src/execution/legacy-session/prepare-step.test.ts
index d2789335c..271eb4361 100644
--- a/packages/eve/src/execution/legacy-session/prepare-step.test.ts
+++ b/packages/eve/src/execution/legacy-session/prepare-step.test.ts
@@ -17,7 +17,6 @@ const session = {
};
const input = {
completionToken: "original:turn",
- mode: "task",
version: 2,
stepInput: {
input: { kind: "deliver", payloads: [] },
diff --git a/packages/eve/src/execution/legacy-session/turn-workflow.ts b/packages/eve/src/execution/legacy-session/turn-workflow.ts
index 8f4a6ca6f..ebb48c247 100644
--- a/packages/eve/src/execution/legacy-session/turn-workflow.ts
+++ b/packages/eve/src/execution/legacy-session/turn-workflow.ts
@@ -27,7 +27,7 @@ export async function turnWorkflow(rawInput: unknown): Promise<void> {
if (isHookConflictError(error)) return;
throw error;
}
- const { mode, sessionWritable } = prepared.input;
+ const { sessionWritable } = prepared.input;
let interrupted;
try {
await inbox.claimSessionHooks(sessionHookTokens(prepared));
@@ -36,7 +36,6 @@ export async function turnWorkflow(rawInput: unknown): Promise<void> {
await inbox.dispose();
return await failSession({
error,
- mode,
serializedContext: prepared.serializedContext,
sessionId,
sessionState: prepared.sessionState,
@@ -64,7 +63,6 @@ export async function turnWorkflow(rawInput: unknown): Promise<void> {
? undefined
: { ...prepared.input.delivery, caller: undefined },
awaitFirstMessage: false,
- mode,
retention: prepared.input.retention,
serializedContext: interrupted.serializedContext,
sessionId,
diff --git a/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts b/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts
index bb53262b2..b09c5ec16 100644
--- a/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts
+++ b/packages/eve/src/execution/multi-agent-callback-routing.scenario.test.ts
@@ -13,7 +13,6 @@ import {
notifyTurnCallerStep,
resolveInitialTurnCallerStep,
} from "#subagents/parent-notification.js";
-import { fireSessionCallbackStep } from "#subagents/callback-step.js";
import { startRemoteAgentSession } from "#subagents/remote-dispatch.js";
import { resolveWorkflowCallbackBaseUrl } from "#execution/workflow-callback-url.js";
import { authHookToken, CallbackBaseUrlKey, getHookUrl } from "#harness/authorization.js";
@@ -401,7 +400,7 @@ describe("multi-agent callback routing", () => {
}
});
- it.each(["session.completed", "turn.completed", "turn.failed"] as const)(
+ it.each(["turn.completed", "turn.failed"] as const)(
"logs %s delivery failures when the public route prefix is absent",
async (kind) => {
stubAgentRuntimeEnvironment(undefined);
@@ -426,23 +425,15 @@ describe("multi-agent callback routing", () => {
[SessionCallbackKey.name]: sessionCallback,
};
const deliver = async () => {
- if (kind === "session.completed") {
- await fireSessionCallbackStep({
- output: "report done",
- serializedContext,
- status: "completed",
- });
- } else {
- await notifyTurnCallerStep({
- caller: await resolveInitialTurnCallerStep({ serializedContext }),
- lifecycle: "terminal",
- sessionId: "remote-session-1",
- settled:
- kind === "turn.failed"
- ? { isError: true, output: { message: "private failure" } }
- : { output: "report done" },
- });
- }
+ await notifyTurnCallerStep({
+ caller: await resolveInitialTurnCallerStep({ serializedContext }),
+ lifecycle: "terminal",
+ sessionId: "remote-session-1",
+ settled:
+ kind === "turn.failed"
+ ? { isError: true, output: { message: "private failure" } }
+ : { output: "report done" },
+ });
};
await expect(deliver()).rejects.toThrow(/callback failed with HTTP 404/);
expect(errorSpy).toHaveBeenCalledExactlyOnceWith(
diff --git a/packages/eve/src/execution/node-step.test.ts b/packages/eve/src/execution/node-step.test.ts
index d9b3cf0df..3a2304617 100644
--- a/packages/eve/src/execution/node-step.test.ts
+++ b/packages/eve/src/execution/node-step.test.ts
@@ -388,7 +388,6 @@ describe("createExecutionNodeStep", () => {
const step = createExecutionNodeStep({
createRuntime: () => createNoopRuntime(),
instrumentation,
- mode: "task",
modelResolutionScope,
node: rootNode,
});
@@ -420,7 +419,8 @@ describe("createExecutionNodeStep", () => {
),
);
- expect(result.next).toEqual({ done: true, output: "tool-output" });
+ expect(result.next).toBeNull();
+ expect(result.settledTurn).toEqual({ output: "tool-output" });
expect(resolveRuntimeModelReference).toHaveBeenCalledWith(
rootNode.turnAgent.model,
modelResolutionScope,
@@ -465,7 +465,6 @@ describe("createExecutionNodeStep", () => {
const step = createExecutionNodeStep({
createRuntime: () => createNoopRuntime(),
instrumentation: undefined,
- mode: "task",
modelResolutionScope: { moduleMap: { nodes: {} }, nodeId: undefined },
node,
});
diff --git a/packages/eve/src/execution/node-step.ts b/packages/eve/src/execution/node-step.ts
index ce27cfad7..5ea0e632e 100644
--- a/packages/eve/src/execution/node-step.ts
+++ b/packages/eve/src/execution/node-step.ts
@@ -12,7 +12,6 @@ import { resolveInstalledPackageInfo } from "#internal/application/package.js";
import { createLogger } from "#internal/logging.js";
import type { RuntimeIdentity } from "#protocol/message.js";
import { UNSPECIFIED_INPUT_SCHEMA } from "#tools/schema.js";
-import type { RunMode } from "#shared/run-mode.js";
import {
resolveRuntimeModelReference,
type RuntimeModelResolutionScope,
@@ -77,7 +76,6 @@ export interface CreateExecutionNodeStepInput {
readonly historyProjector?: HistoryViewProjector;
readonly historyView?: PreparedHistoryView;
readonly instrumentation: ExecutionInstrumentation | undefined;
- readonly mode: RunMode;
readonly modelResolutionScope: RuntimeModelResolutionScope;
readonly node: ResolvedRuntimeAgentNode;
}
@@ -109,7 +107,6 @@ export function createExecutionNodeStep(input: CreateExecutionNodeStepInput): St
historyProjector: input.historyProjector,
historyView: input.historyView,
instrumentation: sessionInstrumentation,
- mode: input.mode,
prepareApprovalTurn: input.prepareApprovalTurn,
toolReplayIdentity: connectionToolReplayIdentity,
resolveStepDynamicTools: (resolveInput) =>
diff --git a/packages/eve/src/execution/runtime-context.test.ts b/packages/eve/src/execution/runtime-context.test.ts
index 41a75293c..62c38127a 100644
--- a/packages/eve/src/execution/runtime-context.test.ts
+++ b/packages/eve/src/execution/runtime-context.test.ts
@@ -165,7 +165,6 @@ describe("buildRunContext", () => {
auth: null,
adapter: { kind: "http" },
input: { message: "Report" },
- mode: "conversation",
taskDeliveryPolicy,
},
});
@@ -183,7 +182,6 @@ describe("buildRunContext", () => {
initiatorAuth,
adapter: { kind: "http" },
input: {},
- mode: "conversation",
},
});
expect(ctx.get(AuthKey)).toEqual(testAuth);
@@ -200,7 +198,6 @@ describe("buildRunContext", () => {
adapter: { kind: "http" },
continuationToken: "t",
input: { message: "hi" },
- mode: "conversation",
},
});
@@ -217,7 +214,6 @@ describe("buildRunContext", () => {
adapter: { kind: "http" },
continuationToken: "t",
input: { message: "hi" },
- mode: "conversation",
},
});
@@ -235,7 +231,6 @@ describe("buildRunContext", () => {
auth: testAuth,
adapter: { kind: "channel:slack" },
input: { message: "run the scheduled task" },
- mode: "conversation",
},
}),
);
@@ -255,7 +250,6 @@ describe("buildRunContext", () => {
auth: testAuth,
adapter: { kind: "subagent" },
input: { message: "Prepare report A" },
- mode: "task",
parent: {
callId: "call-1",
rootSessionId: "root-session",
@@ -276,7 +270,6 @@ describe("buildRunContext", () => {
auth: null,
adapter: { kind: "http" },
input: { message: "Investigate the incident" },
- mode: "conversation",
},
});
const child = buildRunContext({
@@ -285,7 +278,6 @@ describe("buildRunContext", () => {
auth: null,
adapter: { kind: "subagent" },
input: { message: "Delegated prompt" },
- mode: "task",
parent: {
callId: "call-1",
rootSessionId: "root-session",
@@ -306,7 +298,6 @@ describe("buildRunContext", () => {
auth: null,
adapter: { kind: "http" },
input: { message: "hi" },
- mode: "conversation",
},
});
@@ -323,7 +314,6 @@ describe("buildRunContext", () => {
adapter: { kind: "http" },
continuationToken: "t",
input: { message: "hi" },
- mode: "conversation",
},
}),
).not.toThrow();
@@ -337,7 +327,6 @@ describe("buildRunContext", () => {
adapter: { kind: "http" },
continuationToken: "t",
input: { message: "hi" },
- mode: "conversation",
},
});
@@ -362,7 +351,6 @@ describe("buildRunContext", () => {
auth: null,
adapter: { kind: "subagent" },
input: { message: "hi" },
- mode: "task",
activityObserver: { sink, workIdentity },
},
});
@@ -379,7 +367,6 @@ describe("buildRunContext", () => {
audience: "public" as const,
channel: { kind: "channel:slack" as const, name: "slack" },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "user",
};
const ctx = buildRunContext({
@@ -391,7 +378,6 @@ describe("buildRunContext", () => {
inheritedConversation,
continuationToken: "t",
input: { message: "hi" },
- mode: "task",
},
});
@@ -401,7 +387,6 @@ describe("buildRunContext", () => {
expect(ctx.get(ConversationContextKey)).toEqual({
...inheritedConversation,
channel: { kind: "subagent", name: undefined },
- mode: "task",
principalType: "anonymous",
});
@@ -417,7 +402,6 @@ describe("buildRunContext", () => {
adapter: { kind: "http" },
continuationToken: "t",
input: { message: "hi" },
- mode: "conversation",
},
});
@@ -439,7 +423,6 @@ describe("buildRunContext", () => {
adapter: { kind: "eve" },
channelMetadata: { kind: "eve", metadata: {} },
input: { message: "hi" },
- mode: "task",
parentTraceContext: {
forwardedTracePolicy,
spanId: "1".repeat(16),
diff --git a/packages/eve/src/execution/runtime-context.ts b/packages/eve/src/execution/runtime-context.ts
index 65d420118..a71d47788 100644
--- a/packages/eve/src/execution/runtime-context.ts
+++ b/packages/eve/src/execution/runtime-context.ts
@@ -12,7 +12,6 @@ import {
ConversationIdKey,
DynamicSubagentAgentConfigKey,
InitiatorAuthKey,
- ModeKey,
ParentSessionKey,
ParentTraceContextKey,
ActivityObserverKey,
@@ -67,7 +66,6 @@ export function buildRunContext(input: {
ctx.set(ContinuationTokenKey, run.continuationToken);
ctx.set(ContinuationHookTokensKey, [run.continuationToken]);
}
- ctx.set(ModeKey, run.mode);
ctx.set(AuthKey, auth);
if (run.initiatorAuth !== undefined || run.input.message !== undefined) {
ctx.set(InitiatorAuthKey, run.initiatorAuth ?? auth);
diff --git a/packages/eve/src/execution/session-limit-cancellation.integration.test.ts b/packages/eve/src/execution/session-limit-cancellation.integration.test.ts
index e8d8d344d..a9211423b 100644
--- a/packages/eve/src/execution/session-limit-cancellation.integration.test.ts
+++ b/packages/eve/src/execution/session-limit-cancellation.integration.test.ts
@@ -26,14 +26,13 @@ const FAILURE_EVENT_TYPES = ["step.failed", "turn.failed", "session.failed"] as
function buildSerializedContext(overrides: {
channelKind: string;
continuationToken: string;
- mode: string;
}): Record<string, unknown> {
return {
"eve.auth": null,
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
+ "eve.capabilities": { requestInput: true },
"eve.channel": { kind: overrides.channelKind, state: {} },
"eve.continuationToken": overrides.continuationToken,
- "eve.mode": overrides.mode,
};
}
@@ -96,7 +95,6 @@ describe("session-limit continuation decline integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/session.test.ts b/packages/eve/src/execution/session.test.ts
index 1f915a44c..a445edbef 100644
--- a/packages/eve/src/execution/session.test.ts
+++ b/packages/eve/src/execution/session.test.ts
@@ -82,7 +82,7 @@ describe("createSession", () => {
continuationToken: "root-token",
outputSchema,
sessionId: "sess-root",
- turnAgent: createTestTurnAgent({ outputSchema, reasoning: "high" }),
+ turnAgent: createTestTurnAgent({ reasoning: "high" }),
});
expect(session.agent.compactionModelReference).toEqual({ id: "summary-model" });
@@ -324,11 +324,6 @@ describe("createSession", () => {
});
it("persists run outputSchema through durable session projection and hydration", () => {
- const agentOutputSchema = {
- properties: { ignored: { type: "string" } },
- required: ["ignored"],
- type: "object",
- } as const;
const runOutputSchema = {
properties: { title: { type: "string" } },
required: ["title"],
@@ -338,13 +333,13 @@ describe("createSession", () => {
continuationToken: "root-token",
outputSchema: runOutputSchema,
sessionId: "sess-root",
- turnAgent: createTestTurnAgent({ outputSchema: agentOutputSchema }),
+ turnAgent: createTestTurnAgent(),
});
const durable = projectToDurableSession(session);
const hydrated = hydrateDurableSession({
durable,
- turnAgent: createTestTurnAgent({ outputSchema: agentOutputSchema }),
+ turnAgent: createTestTurnAgent(),
});
expect(durable.outputSchema).toEqual(runOutputSchema);
diff --git a/packages/eve/src/execution/session/entry-authorization.integration.test.ts b/packages/eve/src/execution/session/entry-authorization.integration.test.ts
index e11bec8e1..5041524ea 100644
--- a/packages/eve/src/execution/session/entry-authorization.integration.test.ts
+++ b/packages/eve/src/execution/session/entry-authorization.integration.test.ts
@@ -51,7 +51,6 @@ describe("workflowEntry integration", () => {
},
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -172,7 +171,6 @@ describe("workflowEntry integration", () => {
},
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -291,78 +289,6 @@ describe("workflowEntry integration", () => {
});
});
- it("defers ordinary deliveries while a task waits for authorization", async () => {
- const { completeCalls, runtime } = await createWeatherAuthRuntime(
- "workflow-entry-task-auth-open",
- );
- const continuationToken = "http:workflow-entry-task-auth-open";
-
- await runtime.run(async () => {
- const run = await start(workflowEntry, [
- {
- kind: "initial",
- ownerDeploymentId: "dpl_inline",
- input: { message: "Use the get_weather tool to check the weather in Lisbon." },
- serializedContext: buildSerializedContext({
- auth: {
- attributes: {},
- authenticator: "test-idp",
- issuer: "test-idp",
- principalId: "user-1",
- principalType: "user",
- },
- channelKind: "http",
- continuationToken,
- mode: "task",
- }),
- },
- ]);
- const stream = captureEvents(run);
-
- try {
- const firstTurn = await stream.nextUntil(
- "initial task auth-required event",
- (event) => event.type === "authorization.required",
- );
-
- await waitForHook(
- { runId: run.runId },
- { token: sessionInboxHookToken(continuationToken) },
- );
- await resumeHook(sessionInboxHookToken(continuationToken), {
- kind: "send",
- payload: { message: "This must not become a second task turn." },
- });
- await resumeHook(sessionInboxHookToken(sessionCommandHookToken(run.runId)), {
- kind: "authorization-callback",
- payloads: [
- {
- authorizationCallback: {
- attemptId: authorizationAttemptId(firstTurn),
- callback: { method: "GET", params: { code: "oauth-code" } },
- connectionName: "weather",
- },
- },
- ],
- });
-
- const completion = await stream.nextUntil(
- "authorized task completion",
- (event) => event.type === "session.completed",
- );
- const allEvents = [...firstTurn, ...completion];
- expect(filterEventsByType(allEvents, "turn.started")).toHaveLength(1);
- expect(filterEventsByType(allEvents, "message.received")).toHaveLength(1);
- expect(filterEventsByType(allEvents, "authorization.completed")).toHaveLength(1);
- expect(filterEventsByType(allEvents, "session.waiting")).toHaveLength(0);
- expect(completeCalls()).toBe(1);
- } finally {
- stream.dispose();
- await run.cancel();
- }
- });
- });
-
it("ignores stale and duplicate callbacks after a challenge is replaced", async () => {
const { completeCalls, runtime } = await createWeatherAuthRuntime(
"workflow-entry-auth-replaced",
@@ -385,7 +311,6 @@ describe("workflowEntry integration", () => {
},
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -483,7 +408,6 @@ describe("workflowEntry integration", () => {
},
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/session/entry-handoff-lifetime.integration.test.ts b/packages/eve/src/execution/session/entry-handoff-lifetime.integration.test.ts
index 9178c0479..db7b434ec 100644
--- a/packages/eve/src/execution/session/entry-handoff-lifetime.integration.test.ts
+++ b/packages/eve/src/execution/session/entry-handoff-lifetime.integration.test.ts
@@ -35,7 +35,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
acceptedDeploymentId: "dpl_a",
channelKind: "http",
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/session/entry-handoff.integration.test.ts b/packages/eve/src/execution/session/entry-handoff.integration.test.ts
index b5a75f7cc..27a760851 100644
--- a/packages/eve/src/execution/session/entry-handoff.integration.test.ts
+++ b/packages/eve/src/execution/session/entry-handoff.integration.test.ts
@@ -33,7 +33,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
acceptedDeploymentId: "dpl_a",
channelKind: "http",
- mode: "conversation",
}),
},
]);
@@ -191,7 +190,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
acceptedDeploymentId: "dpl_a",
channelKind: "http",
- mode: "conversation",
}),
},
]);
@@ -302,7 +300,6 @@ describe("workflowEntry integration", () => {
acceptedDeploymentId: "dpl_a",
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -406,7 +403,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
acceptedDeploymentId: "dpl_a",
channelKind: "http",
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/session/entry.integration.test.ts b/packages/eve/src/execution/session/entry.integration.test.ts
index 412636e24..911e96508 100644
--- a/packages/eve/src/execution/session/entry.integration.test.ts
+++ b/packages/eve/src/execution/session/entry.integration.test.ts
@@ -70,7 +70,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
auth: { authenticator: "test", principalId: "mount", principalType: "user" },
channelKind: "http",
- mode: "conversation",
}),
},
]);
@@ -153,7 +152,6 @@ describe("workflowEntry integration", () => {
input: { message: "Say hello to Alice." },
serializedContext: buildSerializedContext({
channelKind: "http",
- mode: "conversation",
}),
},
]);
@@ -190,7 +188,6 @@ describe("workflowEntry integration", () => {
acceptedDeploymentId: "dpl_inline",
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -285,7 +282,6 @@ describe("workflowEntry integration", () => {
input: { message: "hello there" },
serializedContext: buildSerializedContext({
channelKind: "http",
- mode: "conversation",
}),
},
]);
@@ -317,7 +313,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -385,7 +380,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
sessionTimeoutMs: 25,
},
@@ -458,7 +452,6 @@ describe("workflowEntry integration", () => {
subagentName: "researcher",
},
continuationToken: childContinuationToken,
- mode: "conversation",
}),
},
]);
@@ -562,7 +555,6 @@ describe("workflowEntry integration", () => {
subagentName: "researcher",
},
continuationToken: firstCallerToken,
- mode: "conversation",
}),
"eve.capabilities": { requestInput: true },
},
@@ -619,7 +611,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -645,7 +636,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -689,7 +679,6 @@ describe("workflowEntry integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -729,63 +718,6 @@ describe("workflowEntry integration", () => {
});
});
- it("completes immediately in task mode", async () => {
- const runtime = await createTestRuntime({ agent: { name: "workflow-entry-task" } });
-
- await runtime.run(async () => {
- const run = await start(workflowEntry, [
- {
- kind: "initial",
- ownerDeploymentId: "dpl_inline",
- input: { message: "hello there" },
- serializedContext: buildSerializedContext({
- channelKind: "http",
- continuationToken: "http:workflow-entry-task",
- mode: "task",
- }),
- },
- ]);
-
- await expect(run.returnValue).resolves.toEqual({
- output: expect.stringContaining("hello there"),
- });
- await expect(run.status).resolves.toBe("completed");
- });
- });
-
- it("returns agent-declared structured output in task mode", async () => {
- const outputSchema = {
- properties: {
- summary: { type: "string" },
- },
- required: ["summary"],
- type: "object",
- } as const;
- const runtime = await createTestRuntime({
- agent: { name: "workflow-entry-task-output-schema", outputSchema },
- });
-
- await runtime.run(async () => {
- const run = await start(workflowEntry, [
- {
- kind: "initial",
- ownerDeploymentId: "dpl_inline",
- input: { message: "hello there" },
- serializedContext: buildSerializedContext({
- channelKind: "http",
- continuationToken: "http:workflow-entry-task-output-schema",
- mode: "task",
- }),
- },
- ]);
-
- await expect(run.returnValue).resolves.toEqual({
- output: { summary: "structured-output" },
- });
- await expect(run.status).resolves.toBe("completed");
- });
- });
-
it("emits `$eve.*` session attributes onto the parent workflow run", async () => {
const runtime = await createTestRuntime({ agent: { name: "workflow-entry-tags" } });
const continuationToken = "http:workflow-entry-tags";
@@ -796,7 +728,6 @@ describe("workflowEntry integration", () => {
audience: "public",
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
[SessionTitleKey.name]: "session tag round-trip",
};
@@ -850,7 +781,6 @@ describe("workflowEntry integration", () => {
audience: "public",
channelKind: "subagent",
continuationToken: "subagent:parent-session:call-subagent-1",
- mode: "task",
parent: {
callId: "call-subagent-1",
rootSessionId: "root-session",
@@ -883,22 +813,25 @@ describe("workflowEntry integration", () => {
},
);
- await expect(run.returnValue).resolves.toEqual({
- output: expect.stringContaining("subagent tag round-trip"),
- });
- await expect(run.status).resolves.toBe("completed");
-
- const world = await getWorld();
- const persisted = await world.runs.get(run.runId);
- const attrs = (persisted as { attributes?: Record<string, string> }).attributes ?? {};
-
- expect(attrs["$eve.type"]).toBe("subagent");
- expect(attrs["$eve.is_trace_content_visible"]).toBe("true");
- expect(attrs["$eve.parent"]).toBe("parent-session");
- expect(attrs["$eve.parent_call"]).toBe("call-subagent-1");
- expect(attrs["$eve.parent_turn"]).toBe("turn-parent");
- expect(attrs["$eve.root"]).toBe("root-session");
- expect(attrs["$eve.trigger"]).toBe("subagent");
+ const stream = captureTurnEvents(run);
+ try {
+ await stream.nextTurn();
+
+ const world = await getWorld();
+ const persisted = await world.runs.get(run.runId);
+ const attrs = (persisted as { attributes?: Record<string, string> }).attributes ?? {};
+
+ expect(attrs["$eve.type"]).toBe("subagent");
+ expect(attrs["$eve.is_trace_content_visible"]).toBe("true");
+ expect(attrs["$eve.parent"]).toBe("parent-session");
+ expect(attrs["$eve.parent_call"]).toBe("call-subagent-1");
+ expect(attrs["$eve.parent_turn"]).toBe("turn-parent");
+ expect(attrs["$eve.root"]).toBe("root-session");
+ expect(attrs["$eve.trigger"]).toBe("subagent");
+ } finally {
+ stream.dispose();
+ await run.cancel();
+ }
});
});
});
diff --git a/packages/eve/src/execution/session/entry.ts b/packages/eve/src/execution/session/entry.ts
index 02c66406b..f654a59c0 100644
--- a/packages/eve/src/execution/session/entry.ts
+++ b/packages/eve/src/execution/session/entry.ts
@@ -1,9 +1,9 @@
import { failSession, runPreparedSession, type SessionBoot } from "#execution/session/program.js";
+import { hasDelegatedCallerContext } from "#execution/session/turn.js";
import { getWorkflowMetadata, getWritable } from "#compiled/@workflow/core/index.js";
import type { DeliverHookPayload, RunInput, SessionCapabilities } from "#channel/types.js";
import { readChannelRequestId, readRootSessionId } from "#execution/eve-workflow-attributes.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { DurableCompiledArtifactsSource } from "#runtime/durable-compiled-artifacts-source.js";
import { resolveInitialTurnCallerStep } from "#subagents/parent-notification.js";
import { normalizeSerializableError } from "#execution/workflow-errors.js";
@@ -80,7 +80,6 @@ async function bootInitialOwner(
): Promise<BootOutcome | undefined> {
const serializedContext = stampSessionIdentity(input.serializedContext, sessionId);
const sessionWritable = getWritable<Uint8Array>();
- const mode = serializedContext["eve.mode"] as RunMode;
const inbox = createSessionInbox(sessionId);
const { workflowStartedAt } = getWorkflowMetadata();
const sessionTimeoutMs = input.sessionTimeoutMs ?? DEFAULT_SESSION_TIMEOUT_MS;
@@ -90,9 +89,6 @@ async function bootInitialOwner(
nodeId?: string;
};
try {
- if (input.input.message === undefined && mode !== "conversation") {
- throw new Error("A message-free session must use conversation mode.");
- }
const [sessionCreation, stableClaim, aliasClaim] = await Promise.allSettled([
createSessionStep({
compiledArtifactsSource: serializedBundle.source,
@@ -138,7 +134,6 @@ async function bootInitialOwner(
deploymentId: input.ownerDeploymentId,
initialInput: createInitialDelivery(input, serializedContext),
awaitFirstMessage: input.input.message === undefined,
- mode,
retention: input.retention,
serializedContext,
sessionId,
@@ -155,7 +150,6 @@ async function bootInitialOwner(
await inbox.dispose();
return await failSession({
error,
- mode,
serializedContext,
sessionId,
sessionState: undefined,
@@ -197,7 +191,6 @@ async function bootHandoffOwner(
deploymentId: input.ownerDeploymentId,
initialInput: input.delivery,
awaitFirstMessage: false,
- mode: checkpoint.mode,
retention: checkpoint.retention,
serializedContext,
sessionId,
@@ -209,14 +202,6 @@ async function bootHandoffOwner(
};
}
-function hasDelegatedCallerContext(serializedContext: Record<string, unknown>): boolean {
- if (serializedContext["eve.sessionCallback"] !== undefined) return true;
- const channel = serializedContext["eve.channel"];
- return (
- typeof channel === "object" && channel !== null && Reflect.get(channel, "kind") === "subagent"
- );
-}
-
function createInitialDelivery(
input: InitialWorkflowEntryInput,
serializedContext: Record<string, unknown>,
diff --git a/packages/eve/src/execution/session/finalization.test.ts b/packages/eve/src/execution/session/finalization.test.ts
index 31e8badad..5e90ab319 100644
--- a/packages/eve/src/execution/session/finalization.test.ts
+++ b/packages/eve/src/execution/session/finalization.test.ts
@@ -15,9 +15,7 @@ vi.mock("#execution/terminal-session-completion-step.js", () => ({
vi.mock("#execution/terminal-session-failure-step.js", () => ({
emitTerminalSessionFailureStep: vi.fn(),
}));
-vi.mock("#subagents/callback-step.js", () => ({ fireSessionCallbackStep: vi.fn() }));
vi.mock("#subagents/parent-notification.js", () => ({
- notifyDelegatedParentStep: vi.fn(),
notifyTurnCallerStep: vi.fn(),
}));
@@ -61,7 +59,6 @@ function sessionAwaitingCallerNotification() {
settledTurn: { output: "Verification is running." },
},
{},
- "conversation",
{},
"current",
);
@@ -86,7 +83,6 @@ describe("session finalization with an unsettled caller", () => {
const result = await finalizeSession(outcome, {
caller,
cursor: { serializedContext: {}, sessionState: sessionAwaitingCallerNotification() },
- mode: "conversation",
sessionWritable: new WritableStream(),
});
expect(result).toMatchObject({
@@ -114,7 +110,6 @@ describe("session finalization with an unsettled caller", () => {
{
caller: undefined,
cursor: { serializedContext: {}, sessionState: sessionAwaitingCallerNotification() },
- mode: "conversation",
sessionWritable: new WritableStream(),
},
);
diff --git a/packages/eve/src/execution/session/finalization.ts b/packages/eve/src/execution/session/finalization.ts
index 7a330731b..80361fd18 100644
--- a/packages/eve/src/execution/session/finalization.ts
+++ b/packages/eve/src/execution/session/finalization.ts
@@ -6,15 +6,9 @@ import { terminateChildSessionsStep } from "#execution/terminate-child-sessions-
import type { TurnOutcome } from "#execution/session/turn-step-types.js";
import { normalizeSerializableError } from "#execution/workflow-errors.js";
import type { WorkflowEntryResult } from "#execution/session/entry-input.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { TokenUsage } from "#shared/token-usage.js";
import { getSessionTokenUsage, takeSessionUsageDelta, toUsage } from "#harness/turn-tag-state.js";
-import { fireSessionCallbackStep } from "#subagents/callback-step.js";
-import { notifyDelegatedParentStep, notifyTurnCallerStep } from "#subagents/parent-notification.js";
-import {
- createDelegatedSubagentErrorResult,
- createDelegatedSubagentSuccessResult,
-} from "#subagents/parent-result.js";
+import { notifyTurnCallerStep } from "#subagents/parent-notification.js";
/** The three ways a session ends. `done` already emitted its terminal event inside the turn. */
export type SessionTerminalOutcome =
@@ -28,14 +22,12 @@ export interface SessionFinalizationContext {
readonly serializedContext: Record<string, unknown>;
readonly sessionState: DurableSessionState | undefined;
};
- readonly mode: RunMode;
readonly sessionWritable: WritableStream<Uint8Array>;
}
/**
* Terminates descendants, emits the terminal protocol event when the turn has
- * not already done so, then settles whoever is waiting on this session: the
- * task callback and delegated parent in task mode, or the parked caller.
+ * not already done so, then settles the parked caller waiting on this session.
*/
export async function finalizeSession(
outcome: SessionTerminalOutcome,
@@ -60,22 +52,7 @@ export async function finalizeSession(
}
const settled = settledResult(outcome, context);
- if (context.mode === "task") {
- await fireSessionCallbackStep({
- error: settled.isError ? settled.output : undefined,
- output: settled.isError ? undefined : settled.output,
- serializedContext,
- status: settled.isError ? "failed" : "completed",
- usage: settled.sessionUsage,
- });
- await notifyDelegatedParentStep({
- result: settled.isError
- ? createDelegatedSubagentErrorResult(serializedContext, settled.output)
- : createDelegatedSubagentSuccessResult(serializedContext, settled.output),
- serializedContext,
- usage: settled.sessionUsage,
- });
- } else if (context.caller !== undefined) {
+ if (context.caller !== undefined) {
const notification: { isError?: boolean; output: unknown; usage?: TokenUsage } = {
output: settled.output,
usage: settled.turnUsage,
diff --git a/packages/eve/src/execution/session/handoff-steps.test.ts b/packages/eve/src/execution/session/handoff-steps.test.ts
index 550a3f47d..49fdbb084 100644
--- a/packages/eve/src/execution/session/handoff-steps.test.ts
+++ b/packages/eve/src/execution/session/handoff-steps.test.ts
@@ -64,7 +64,7 @@ describe("validateSessionCheckpointStep", () => {
);
});
- it.each([5, 6, 7, 9])(
+ it.each([5, 6, 7, 8, 10])(
"rejects checkpoint version %s before reading nested state",
async (version) => {
const checkpoint = createCheckpoint();
@@ -93,9 +93,8 @@ describe("validateSessionCheckpointStep", () => {
function createCheckpoint(): SessionCheckpoint {
return {
- version: 8,
+ version: 9,
sessionTimeoutMs: false,
- mode: "conversation",
serializedContext: {},
sessionState: createTestSessionState({
continuationToken: "channel:current",
diff --git a/packages/eve/src/execution/session/handoff.test.ts b/packages/eve/src/execution/session/handoff.test.ts
index 2937ec509..eb571bc30 100644
--- a/packages/eve/src/execution/session/handoff.test.ts
+++ b/packages/eve/src/execution/session/handoff.test.ts
@@ -42,9 +42,8 @@ describe("SessionHandoff", () => {
activationToken: "owner-1:handoff",
anchorRunId: "session-1",
checkpoint: expect.objectContaining({
- mode: "conversation",
sessionTimeoutMs: 60_000,
- version: 8,
+ version: 9,
}),
delivery: trigger.delivery,
targetDeploymentId: "deployment-b",
@@ -211,7 +210,7 @@ function state(
function createHandoff(inbox: SessionInboxHandle): SessionHandoff {
return new SessionHandoff({
- checkpoint: { mode: "conversation", sessionTimeoutMs: 60_000 },
+ checkpoint: { sessionTimeoutMs: 60_000 },
deploymentId: "deployment-a",
inbox,
isInitialOwner: true,
diff --git a/packages/eve/src/execution/session/handoff.ts b/packages/eve/src/execution/session/handoff.ts
index 6c75e03ec..7674336e7 100644
--- a/packages/eve/src/execution/session/handoff.ts
+++ b/packages/eve/src/execution/session/handoff.ts
@@ -12,7 +12,6 @@ import { startSessionOwnerStep } from "#execution/workflow-runtime.js";
import { sessionHandoffMarkerToken } from "#execution/session-inbox/address.js";
import { isSessionIdleForHandoffStep } from "#execution/session/handoff-steps.js";
import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
-import type { RunMode } from "#shared/run-mode.js";
/**
* Cross-deployment checkpoint contract. The successor may run a different eve
@@ -20,13 +19,12 @@ import type { RunMode } from "#shared/run-mode.js";
* an incompatible successor rejects the handoff instead of misreading state.
* Dynamic skill manifests retain instruction bodies and package revisions.
*/
-export const SESSION_CHECKPOINT_VERSION = 8;
+export const SESSION_CHECKPOINT_VERSION = 9;
/** Everything a successor needs to continue an idle session. Hooks are derived from the state. */
export interface SessionCheckpoint {
readonly version: typeof SESSION_CHECKPOINT_VERSION;
readonly capabilities?: SessionCapabilities;
- readonly mode: RunMode;
readonly retention?: AgentWorkflowRetentionDefinition;
readonly serializedContext: Record<string, unknown>;
readonly sessionState: DurableSessionState;
diff --git a/packages/eve/src/execution/session/input-queue.ts b/packages/eve/src/execution/session/input-queue.ts
index ddc820ccc..c1a848a76 100644
--- a/packages/eve/src/execution/session/input-queue.ts
+++ b/packages/eve/src/execution/session/input-queue.ts
@@ -181,7 +181,6 @@ export class SessionInputQueue {
takeNext(
state: SessionStateMap | undefined,
options?: {
- readonly deferDeliveries?: boolean;
readonly taskDeliveryPolicy?: TaskDeliveryPolicy;
/**
* Attempt ids of the open authorization challenge. Callbacks for other
@@ -224,7 +223,6 @@ export class SessionInputQueue {
const index = this.nextActionableIndex(
tasks,
pendingCohorts,
- options?.deferDeliveries === true,
options?.taskDeliveryPolicy ?? "cohort",
);
if (index < 0) return undefined;
@@ -234,12 +232,11 @@ export class SessionInputQueue {
private nextActionableIndex(
tasks: BackgroundTasks,
pendingCohorts: ReadonlySet<string>,
- deferDeliveries: boolean,
taskDeliveryPolicy: TaskDeliveryPolicy,
): number {
return this.entries.findIndex((entry) => {
if (entry.kind === "control") return true;
- if (entry.kind === "authorization" || deferDeliveries) return false;
+ if (entry.kind === "authorization") return false;
if (this.isCancelledDelivery(entry.delivery)) return false;
const cohort = terminalCohort(entry.delivery, tasks);
return taskDeliveryPolicy === "auto" || cohort === undefined || !pendingCohorts.has(cohort);
diff --git a/packages/eve/src/execution/session/next-input.test.ts b/packages/eve/src/execution/session/next-input.test.ts
index 41c05b429..2489d1c5c 100644
--- a/packages/eve/src/execution/session/next-input.test.ts
+++ b/packages/eve/src/execution/session/next-input.test.ts
@@ -338,16 +338,6 @@ describe("nextTurnDelivery", () => {
expect(queue.pendingCount).toBe(1);
});
- it("buffers task deliveries until the authorization callback arrives", async () => {
- const inbox = createMockInbox([messageRead("deferred"), authorizationRead()]);
- const queue = new SessionInputQueue();
-
- const next = await nextTurnDelivery({ ...waitInput(inbox), queue, deferDeliveries: true });
-
- expect(next.kind).toBe("authorization-resume");
- expect(queue.pendingCount).toBe(1);
- });
-
it("reports session closure while waiting for authorization", async () => {
const inbox = createMockInbox([{ result: { done: true, value: undefined } }]);
@@ -661,7 +651,7 @@ describe("buffered task completion batching", () => {
expect(input.queue.pendingCount).toBe(0);
});
- it("auto preserves intervening user input and deferred delivery boundaries", async () => {
+ it("auto preserves intervening user input boundaries", async () => {
const input = batchingInput(3);
await input.cursor.apply({ serializedContext: { "eve.runtime.taskDeliveryPolicy": "auto" } });
const question = {
@@ -677,9 +667,6 @@ describe("buffered task completion batching", () => {
kind: "turn",
delivery: question,
});
- expect(
- input.queue.takeNext(undefined, { taskDeliveryPolicy: "auto", deferDeliveries: true }),
- ).toBeUndefined();
expect(input.queue.pendingCount).toBe(2);
await expect(nextTurnDelivery(input)).resolves.toMatchObject({
kind: "turn",
diff --git a/packages/eve/src/execution/session/next-input.ts b/packages/eve/src/execution/session/next-input.ts
index e23b20c02..4346a2220 100644
--- a/packages/eve/src/execution/session/next-input.ts
+++ b/packages/eve/src/execution/session/next-input.ts
@@ -33,7 +33,6 @@ export type NextTurnInstruction =
export async function nextTurnDelivery(input: {
readonly inbox: SessionInboxReader;
readonly cursor: SessionStateCursor;
- readonly deferDeliveries?: boolean;
readonly expectedAttemptIds?: ReadonlySet<string>;
readonly queue: SessionInputQueue;
}): Promise<NextTurnInstruction> {
@@ -54,7 +53,6 @@ export async function nextTurnDelivery(input: {
if (routed.kind === "cancel-turn") return routed;
}
const selected = queue.takeNext(cursor.sessionState.snapshot.session.state, {
- deferDeliveries: input.deferDeliveries,
taskDeliveryPolicy:
cursor.serializedContext[TASK_DELIVERY_POLICY_CONTEXT_KEY_NAME] === "auto"
? "auto"
diff --git a/packages/eve/src/execution/session/program.ts b/packages/eve/src/execution/session/program.ts
index adc0b6f7d..f6fd18284 100644
--- a/packages/eve/src/execution/session/program.ts
+++ b/packages/eve/src/execution/session/program.ts
@@ -1,6 +1,5 @@
import type { DeliverHookPayload, SessionCapabilities, TurnCaller } from "#channel/types.js";
import type { AgentWorkflowRetentionDefinition } from "#shared/agent-definition.js";
-import type { RunMode } from "#shared/run-mode.js";
import {
bindTurnCallerContextStep,
notifyCancelledTaskCallerStep,
@@ -50,7 +49,6 @@ export interface SessionBoot {
readonly initialInput: DeliverHookPayload | undefined;
/** Parks on the inbox before any session-scoped lifecycle work. */
readonly awaitFirstMessage: boolean;
- readonly mode: RunMode;
readonly retention?: AgentWorkflowRetentionDefinition;
readonly serializedContext: Record<string, unknown>;
readonly sessionId: string;
@@ -92,7 +90,6 @@ export async function runPreparedSession(
const handoff = new SessionHandoff({
checkpoint: {
capabilities: boot.capabilities,
- mode: boot.mode,
retention: boot.retention,
sessionTimeoutMs: boot.sessionTimeoutMs,
},
@@ -117,7 +114,6 @@ export async function runPreparedSession(
result = await finalizeSession(loop.outcome, {
caller: progress.caller,
cursor,
- mode: boot.mode,
sessionWritable: boot.sessionWritable,
});
progress.terminalEmitted = true;
@@ -126,7 +122,7 @@ export async function runPreparedSession(
if (!progress.terminalEmitted) {
await finalizeSession(
{ error, kind: "failed", turnId: progress.turnId },
- { caller: progress.caller, cursor, mode: boot.mode, sessionWritable: boot.sessionWritable },
+ { caller: progress.caller, cursor, sessionWritable: boot.sessionWritable },
);
}
throw createSafeOuterWorkflowError();
@@ -141,7 +137,6 @@ export async function runPreparedSession(
*/
export async function failSession(input: {
readonly error: unknown;
- readonly mode: RunMode;
readonly serializedContext: Record<string, unknown>;
readonly sessionId: string;
readonly sessionState: DurableSessionState | undefined;
@@ -161,7 +156,6 @@ export async function failSession(input: {
serializedContext: input.serializedContext,
sessionState: input.sessionState,
},
- mode: input.mode,
sessionWritable: input.sessionWritable,
},
);
@@ -201,7 +195,6 @@ async function runSessionLoop(
capabilities: boot.capabilities,
cursor,
inbox,
- mode: boot.mode,
queue,
sessionId: boot.sessionId,
});
@@ -219,7 +212,6 @@ async function runSessionLoop(
while (true) {
const next = await nextTurnDelivery({
cursor,
- deferDeliveries: boot.mode === "task" && expectedAttemptIds.size > 0,
expectedAttemptIds,
inbox,
queue,
diff --git a/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts b/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts
index 08af73e0b..db3d3004e 100644
--- a/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts
+++ b/packages/eve/src/execution/session/turn-connection-approval.integration.test.ts
@@ -2,7 +2,7 @@ import { simulateReadableStream } from "ai";
import { MockLanguageModelV4 } from "ai/test";
import { afterEach, describe, expect, it, vi } from "vitest";
import { ContextContainer } from "#context/container.js";
-import { AuthKey, InitiatorAuthKey, ModeKey, SessionIdKey } from "#context/keys.js";
+import { AuthKey, InitiatorAuthKey, SessionIdKey } from "#context/keys.js";
import { serializeContext } from "#context/serialize.js";
import { createDurableSessionState, readDurableSession } from "#execution/durable-session-store.js";
import { turnStep } from "#execution/session/turn-step.js";
@@ -244,7 +244,6 @@ function setup(
ctx.set(InitiatorAuthKey, alice);
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, adapter);
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, sessionId);
const session: HarnessSession = {
agent: { modelReference: { id: "test" }, system: "Save notes.", tools: [] },
diff --git a/packages/eve/src/execution/session/turn-step-result.test.ts b/packages/eve/src/execution/session/turn-step-result.test.ts
index 68b5fe35a..e23abff34 100644
--- a/packages/eve/src/execution/session/turn-step-result.test.ts
+++ b/packages/eve/src/execution/session/turn-step-result.test.ts
@@ -34,13 +34,7 @@ function startWorker(
}
function endTurn(session: HarnessSession, settledTurn: SettledTurn, turnId = "current-turn") {
- return resolveSessionStepResult(
- { next: null, session, settledTurn },
- {},
- "conversation",
- {},
- turnId,
- );
+ return resolveSessionStepResult({ next: null, session, settledTurn }, {}, {}, turnId);
}
function withUsage(session: HarnessSession, inputTokens: number): HarnessSession {
diff --git a/packages/eve/src/execution/session/turn-step-result.ts b/packages/eve/src/execution/session/turn-step-result.ts
index bfb234f98..b996758c4 100644
--- a/packages/eve/src/execution/session/turn-step-result.ts
+++ b/packages/eve/src/execution/session/turn-step-result.ts
@@ -2,16 +2,13 @@ import { createDurableSessionState } from "#execution/durable-session-store.js";
import { derivePendingState } from "#execution/session/pending-turn-state.js";
import type { DurableStepResult } from "#execution/session/turn-step-types.js";
import { getBackgroundTasks } from "#harness/workflow-tool-runs.js";
-import { hasPendingInputBatch } from "#harness/input-requests.js";
import { getTurnUsageState, takeSessionUsageDelta, toUsage } from "#harness/turn-tag-state.js";
import type { StepResult } from "#harness/types.js";
-import type { RunMode } from "#shared/run-mode.js";
import { preserveSerializedBackgroundTaskObservabilityState } from "#shared/serialized-observability-state.js";
export function resolveSessionStepResult(
stepResult: StepResult,
nextSerializedContext: Record<string, unknown>,
- mode: RunMode,
beforeStepContext: Record<string, unknown>,
/** The turn this step belongs to. */
turnId: string,
@@ -43,9 +40,6 @@ export function resolveSessionStepResult(
typeof stepResult.next === "object" &&
"done" in stepResult.next
) {
- if (mode === "task" && hasPendingInputBatch(stepResult.session.state)) {
- throw new Error("Task mode cannot complete while input requests remain pending.");
- }
const sessionTotals = getTurnUsageState(stepResult.session.state)?.session;
return {
action: "done",
diff --git a/packages/eve/src/execution/session/turn-step.test.ts b/packages/eve/src/execution/session/turn-step.test.ts
index 090949953..f12ce4d33 100644
--- a/packages/eve/src/execution/session/turn-step.test.ts
+++ b/packages/eve/src/execution/session/turn-step.test.ts
@@ -17,7 +17,6 @@ import {
ContinuationHookTokensKey,
ContinuationTokenKey,
DynamicSubagentAgentConfigKey,
- ModeKey,
ScheduleIdKey,
SessionCallbackKey,
SessionDynamicSubagentRuntimeRevisionKey,
@@ -65,7 +64,6 @@ import { runProxySubagentEventStep } from "#subagents/event-proxy-step.js";
import { sendTaskInboundPayload } from "#execution/tasks/parent/run-parent.js";
import { recordTaskInputRequestStep } from "#execution/tasks/parent/hitl-proxy-steps.js";
import { emitTerminalSessionFailureStep } from "#execution/terminal-session-failure-step.js";
-import { resolveEffectiveOutputSchema } from "#execution/effective-output-schema.js";
import { turnStep as runTurnStep } from "#execution/session/turn-step.js";
import type { TurnStepInput, TurnStepPayload } from "#execution/session/turn-step-types.js";
import type { DeliverHookPayload } from "#channel/types.js";
@@ -278,15 +276,12 @@ function createStubSession(overrides: Partial<HarnessSession> = {}): HarnessSess
};
}
-function createSerializedContext(
- mode: "conversation" | "task" = "conversation",
-): Record<string, unknown> {
+function createSerializedContext(): Record<string, unknown> {
const ctx = new ContextContainer();
ctx.set(AuthKey, null);
ctx.set(BundleKey, createStubBundle());
ctx.set(ChannelKey, threadContextAdapter);
ctx.set(ContinuationTokenKey, "http:thread-context");
- ctx.set(ModeKey, mode);
ctx.set(SessionIdKey, "session-1");
return serializeContext(ctx);
}
@@ -1090,7 +1085,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, adapter);
ctx.set(ContinuationTokenKey, "ignore-correction");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "sess-test");
const result = await turnStep({
@@ -1234,7 +1228,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, adapter);
ctx.set(ContinuationTokenKey, "http:scheduled-output-capture");
- ctx.set(ModeKey, "task");
ctx.set(ScheduleIdKey, "daily-report");
ctx.set(SessionIdKey, "session-1");
const serializedContext = serializeContext(ctx);
@@ -1661,7 +1654,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, compiledBundle);
ctx.set(ChannelKey, threadContextAdapter);
ctx.set(ContinuationTokenKey, "http:thread-context");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "session-1");
ctx.set(SessionDynamicSubagentRuntimeRevisionKey, "deployment:dpl_old");
ctx.set(SessionDynamicToolRuntimeRevisionKey, "deployment:dpl_old");
@@ -1746,7 +1738,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, compiledBundle);
ctx.set(ChannelKey, adapter);
ctx.set(ContinuationTokenKey, "projection-failure");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "session-1");
await expect(
@@ -1781,7 +1772,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, createStubBundle());
ctx.set(ChannelKey, adapter);
ctx.set(ContinuationTokenKey, "deliver-failure");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "session-1");
const sessionWritable = createTestWritable();
@@ -1845,7 +1835,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, threadContextAdapter);
ctx.set(ContinuationTokenKey, "http:auth-replacement");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "session-1");
let observed: SessionAuthContext | null | undefined;
@@ -1967,7 +1956,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, compiledBundle);
ctx.set(ChannelKey, remoteTaskAdapter);
ctx.set(ContinuationTokenKey, "child-token");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionCallbackKey, {
callId: "parent-call",
subagentName: "remote-worker",
@@ -2135,45 +2123,6 @@ describe("turnStep", () => {
]);
});
- it("rejects task completion while input requests remain pending", async () => {
- const session = appendPendingInputBatch({
- requests: [
- {
- action: {
- callId: "call-pending-approval",
- input: {},
- kind: "tool-call",
- toolName: "confirm",
- },
- kind: "tool-approval",
- prompt: "Approve?",
- requestId: "request-pending-approval",
- },
- ],
- responseMessages: [],
- session: createStubSession(),
- });
- installSessionStoreMocks([session]);
- vi.mocked(createExecutionNodeStep).mockImplementation(() => {
- return async (stepSession): Promise<StepResult> => ({
- next: { done: true, output: "must not complete" },
- session: stepSession,
- });
- });
-
- await expect(
- turnStep({
- input: {
- kind: "deliver",
- payloads: [{ message: "unrelated message" }],
- },
- sessionWritable: createTestWritable(),
- serializedContext: createSerializedContext("task"),
- sessionState: createStubSessionState(),
- }),
- ).rejects.toThrow("Task mode cannot complete while input requests remain pending.");
- });
-
it("prepares the session trace boundary before instrumenting a first-turn delivery", async () => {
const published: string[] = [];
const prepareSessionTrace = vi.fn(async () => {
@@ -2229,7 +2178,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, compiledBundle);
ctx.set(ChannelKey, threadContextAdapter);
ctx.set(ContinuationTokenKey, "first-turn-delivery");
- ctx.set(ModeKey, "task");
ctx.set(SessionIdKey, "session-1");
await turnStep({
@@ -2296,7 +2244,6 @@ describe("turnStep", () => {
description: "Perform deep research.",
model: { id: "anthropic/claude-opus-4.6" },
});
- ctx.set(ModeKey, "task");
ctx.set(SessionIdKey, "session-1");
await turnStep({
@@ -3116,7 +3063,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, compiledBundle);
ctx.set(ChannelKey, threadContextAdapter);
ctx.set(ContinuationTokenKey, "http:thread-context");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "session-1");
await turnStep({
@@ -3229,7 +3175,6 @@ describe("turnStep", () => {
ctx.set(BundleKey, compiledBundle);
ctx.set(ChannelKey, threadContextAdapter);
ctx.set(ContinuationTokenKey, "http:thread-context");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "session-1");
ctx.set(SessionDynamicToolRuntimeRevisionKey, "deployment:dpl_old");
ctx.set(SessionDynamicToolMetadataKey, [
@@ -3497,7 +3442,6 @@ describe("emitTerminalSessionFailureStep", () => {
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, adapter);
ctx.set(ContinuationTokenKey, `http:${sessionId}`);
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, sessionId);
const serialized = serializeContext(ctx);
serialized["eve.sessionId"] = sessionId;
@@ -3688,7 +3632,6 @@ describe("runProxySubagentEventStep", () => {
});
}
ctx.set(ContinuationTokenKey, "http:proxy-test");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, "parent-session");
return serializeContext(ctx);
}
@@ -3898,51 +3841,3 @@ describe("runProxySubagentEventStep", () => {
]);
});
});
-
-describe("resolveEffectiveOutputSchema", () => {
- const runSchema = { properties: { title: { type: "string" } }, type: "object" } as const;
- const agentSchema = { properties: { summary: { type: "string" } }, type: "object" } as const;
-
- it("uses a run-scoped schema in either mode", () => {
- for (const mode of ["conversation", "task"] as const) {
- const session = createStubSession();
- const resolved = resolveEffectiveOutputSchema({
- agentOutputSchema: agentSchema,
- input: { outputSchema: runSchema },
- mode,
- session,
- });
- // Run-scoped schema always wins over the agent-declared one.
- expect(resolved.outputSchema).toEqual(runSchema);
- }
- });
-
- it("adopts the agent schema only for task runs without a run-scoped schema", () => {
- const task = resolveEffectiveOutputSchema({
- agentOutputSchema: agentSchema,
- input: { message: "hi" },
- mode: "task",
- session: createStubSession(),
- });
- expect(task.outputSchema).toEqual(agentSchema);
-
- const conversation = resolveEffectiveOutputSchema({
- agentOutputSchema: agentSchema,
- input: { message: "hi" },
- mode: "conversation",
- session: createStubSession(),
- });
- expect(conversation.outputSchema).toBeUndefined();
- });
-
- it("preserves the in-effect schema on a continuation step with no new input", () => {
- const session = createStubSession({ outputSchema: runSchema });
- const resolved = resolveEffectiveOutputSchema({
- agentOutputSchema: agentSchema,
- input: undefined,
- mode: "conversation",
- session,
- });
- expect(resolved).toBe(session);
- });
-});
diff --git a/packages/eve/src/execution/session/turn-step.ts b/packages/eve/src/execution/session/turn-step.ts
index 27b7f812e..a4156839c 100644
--- a/packages/eve/src/execution/session/turn-step.ts
+++ b/packages/eve/src/execution/session/turn-step.ts
@@ -30,7 +30,6 @@ import {
CapabilitiesKey,
ChannelDeliveryKey,
HandleEventKey,
- ModeKey,
SessionDynamicSubagentRuntimeRevisionKey,
SessionDynamicToolRuntimeRevisionKey,
StaticModelReferenceKey,
@@ -84,7 +83,6 @@ import {
PendingAuthorizationResultKey,
} from "#harness/authorization.js";
import { resolveWorkflowCallbackBaseUrl } from "#execution/workflow-callback-url.js";
-import { resolveEffectiveOutputSchema } from "#execution/effective-output-schema.js";
import { createDurableSessionState, readDurableSession } from "#execution/durable-session-store.js";
import { buildRuntimeIdentity, createExecutionNodeStep } from "#execution/node-step.js";
import {
@@ -450,7 +448,6 @@ async function runSessionStep(input: TurnStepInput): Promise<DurableStepResult>
throw error;
}
- const mode = ctx.require(ModeKey);
const modelCallsPerStep =
bundle.resolvedAgent.config?.experimental?.workflow?.modelCallsPerStep ?? 1;
const capabilities = ctx.get(CapabilitiesKey);
@@ -480,7 +477,6 @@ async function runSessionStep(input: TurnStepInput): Promise<DurableStepResult>
historyProjector: history.projector,
historyView: history.prepare(modelSession),
instrumentation,
- mode,
modelResolutionScope: {
moduleMap: bundle.moduleMap,
nodeId: bundle.nodeId,
@@ -506,14 +502,10 @@ async function runSessionStep(input: TurnStepInput): Promise<DurableStepResult>
const result = await runBackgroundStep(ctx, session, async (enrichedSession) => {
ctx.setVirtualContext(HandleEventKey, handleEvent);
ctx.setVirtualContext(StaticModelReferenceKey, effectiveAgent.turnAgent.model ?? null);
- let schemaSession = firstCall
- ? resolveEffectiveOutputSchema({
- agentOutputSchema: effectiveAgent.turnAgent.outputSchema,
- input: resolved,
- mode,
- session: enrichedSession,
- })
- : enrichedSession;
+ let schemaSession =
+ firstCall && resolved?.outputSchema !== undefined
+ ? { ...enrichedSession, outputSchema: resolved.outputSchema }
+ : enrichedSession;
const connectionState = getHarnessEmissionState(schemaSession.state);
await dynamicConnections.rehydrate(
connectionState,
@@ -620,7 +612,6 @@ async function runSessionStep(input: TurnStepInput): Promise<DurableStepResult>
const durableResult = resolveSessionStepResult(
stepResult,
nextSerializedContext,
- mode,
input.serializedContext,
activeTurnId(initialEmissionState),
);
diff --git a/packages/eve/src/execution/session/turn.test.ts b/packages/eve/src/execution/session/turn.test.ts
index d62b6ce25..bb7a8017e 100644
--- a/packages/eve/src/execution/session/turn.test.ts
+++ b/packages/eve/src/execution/session/turn.test.ts
@@ -8,10 +8,9 @@ import { SessionStateCursor } from "#execution/session/state-cursor.js";
import { cancelDescendantTurnsStep } from "#execution/cancel-descendant-turns-step.js";
import { acknowledgeDelegatedTasksStep } from "#execution/tasks/parent/delegate.js";
import { turnStep } from "#execution/session/turn-step.js";
-import type { DeliverHookPayload } from "#channel/types.js";
+import type { DeliverHookPayload, SessionCapabilities } from "#channel/types.js";
import { dispatchCoordinationStep } from "#execution/coordination-dispatch-step.js";
import { routeDeliverToChildren } from "#execution/route-child-delivery.js";
-import type { RunMode } from "#shared/run-mode.js";
vi.mock("#compiled/@workflow/core/index.js", async (importOriginal) => ({
...(await importOriginal()),
@@ -45,38 +44,6 @@ beforeEach(() => {
afterEach(() => vi.restoreAllMocks());
describe("SessionExecution background task checkpoints", () => {
- it("parks a yielded task-mode turn for background delivery", async () => {
- const inbox: SessionInbox = {
- claimedTokens: [],
- claimSessionHook: vi.fn(),
- claimSessionHooks: vi.fn(),
- drain: () => [],
- hasPending: () => false,
- next: vi.fn(),
- restore: vi.fn(),
- onDelivery: () => () => {},
- onInterrupt: () => () => {},
- };
- const sessionState = state("");
- const settled = { notifyCaller: false, output: "Verification is running." };
- vi.mocked(turnStep).mockResolvedValue({
- action: "park",
- hasPendingAuthorization: false,
- hasPendingInputBatch: false,
- serializedContext: {},
- sessionState,
- settled,
- });
-
- await expect(
- createExecution({ inbox, mode: "task", sessionState }).runTurn(undefined),
- ).resolves.toEqual({
- authorizationAttemptIds: undefined,
- kind: "park",
- settled,
- });
- });
-
it("retains the durable steering signal across steps until a correction uses it", async () => {
const inbox: SessionInbox = {
claimedTokens: [],
@@ -558,6 +525,55 @@ describe("SessionExecution background task checkpoints", () => {
expect(queue.pendingCount).toBe(1);
});
+ it.each([
+ { capabilities: undefined, parks: false, serializedContext: {} },
+ { capabilities: { requestInput: true }, parks: true, serializedContext: {} },
+ {
+ capabilities: undefined,
+ parks: true,
+ serializedContext: { "eve.sessionCallback": { callId: "call_1", token: "parent" } },
+ },
+ ])(
+ "parks on pending input only when someone can answer it: %o",
+ async ({ capabilities, parks, serializedContext }) => {
+ const inbox: SessionInbox = {
+ claimedTokens: [],
+ claimSessionHook: vi.fn(),
+ claimSessionHooks: vi.fn(),
+ drain: vi.fn(() => []),
+ hasPending: vi.fn(() => false),
+ next: vi.fn(() => new Promise<never>(() => {})),
+ onDelivery: vi.fn(() => () => {}),
+ onInterrupt: vi.fn(() => () => {}),
+ restore: vi.fn(),
+ };
+ const execution = createExecution({
+ capabilities,
+ inbox,
+ serializedContext,
+ sessionState: state(""),
+ });
+ vi.mocked(turnStep)
+ .mockReset()
+ .mockImplementation(async (input) => ({
+ action: "park",
+ hasPendingAuthorization: false,
+ hasPendingInputBatch: true,
+ serializedContext: input.serializedContext,
+ sessionState: input.sessionState,
+ }));
+
+ const turn = execution.runTurn({
+ delivery: { kind: "deliver", payloads: [{ message: "Deploy the release." }] },
+ });
+ if (parks) {
+ await expect(turn).resolves.toMatchObject({ kind: "park" });
+ } else {
+ await expect(turn).rejects.toThrow("cannot request human input");
+ }
+ },
+ );
+
it.each([
{ backgroundTasks: false, settled: { notifyCaller: true, output: "Done." } },
{ backgroundTasks: true, settled: { notifyCaller: true, output: "Done." } },
@@ -761,8 +777,8 @@ describe("SessionExecution background task checkpoints", () => {
});
function createExecution(input: {
+ readonly capabilities?: SessionCapabilities;
readonly inbox: SessionInbox;
- readonly mode?: RunMode;
readonly queue?: SessionInputQueue;
readonly serializedContext?: Record<string, unknown>;
readonly sessionState: DurableSessionState;
@@ -774,9 +790,9 @@ function createExecution(input: {
sessionState: input.sessionState,
});
return new SessionExecution({
+ capabilities: input.capabilities,
cursor,
inbox: input.inbox,
- mode: input.mode ?? "conversation",
queue: input.queue ?? new SessionInputQueue(),
sessionId: input.sessionState.sessionId,
});
diff --git a/packages/eve/src/execution/session/turn.ts b/packages/eve/src/execution/session/turn.ts
index ddb58508e..3e2b9717a 100644
--- a/packages/eve/src/execution/session/turn.ts
+++ b/packages/eve/src/execution/session/turn.ts
@@ -34,16 +34,25 @@ import { decodeSessionInboxPayload } from "#execution/session-inbox/protocol.js"
import { isInboxToolResultFromRecordedWorkflowToolRun } from "#harness/workflow-tool-runs.js";
import { isInboxSubagentResultFromRunningHandle } from "#subagents/handles/query.js";
import { resolveRuntimeActionResultsForCallIds } from "#runtime/actions/results.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { RuntimeActionResult } from "#shared/action-types.js";
-const TASK_MODE_WAIT_ERROR_MESSAGE = "Task mode cannot wait for follow-up input (`next: null`).";
+/** True when a delegating parent (local or remote) receives this session's input requests. */
+export function hasDelegatedCallerContext(serializedContext: Record<string, unknown>): boolean {
+ if (serializedContext["eve.sessionCallback"] !== undefined) return true;
+ const channel = serializedContext["eve.channel"];
+ return (
+ typeof channel === "object" && channel !== null && Reflect.get(channel, "kind") === "subagent"
+ );
+}
+
+const NO_INPUT_CAPABILITY_ERROR_MESSAGE =
+ "This session cannot request human input, so it cannot wait for a tool approval or question. " +
+ "Sessions started without `capabilities.requestInput`, such as schedules, must not use approval-gated tools.";
export interface SessionExecutionInput {
readonly capabilities?: SessionCapabilities;
readonly cursor: SessionStateCursor;
readonly inbox: SessionInboxReader;
- readonly mode: RunMode;
readonly queue: SessionInputQueue;
readonly sessionId: string;
}
@@ -161,12 +170,13 @@ export class SessionExecution {
}
if (result.action === "park") {
- const canPark =
- result.hasPendingAuthorization ||
- (result.hasPendingInputBatch && this.input.capabilities?.requestInput === true) ||
- result.settled?.notifyCaller === false ||
- this.input.mode === "conversation";
- if (!canPark) throw new Error(TASK_MODE_WAIT_ERROR_MESSAGE);
+ if (
+ result.hasPendingInputBatch &&
+ this.input.capabilities?.requestInput !== true &&
+ !hasDelegatedCallerContext(this.input.cursor.serializedContext)
+ ) {
+ throw new Error(NO_INPUT_CAPABILITY_ERROR_MESSAGE);
+ }
return {
authorizationAttemptIds: result.authorizationAttemptIds,
kind: "park",
diff --git a/packages/eve/src/execution/settle-cancelled-turn-step.integration.test.ts b/packages/eve/src/execution/settle-cancelled-turn-step.integration.test.ts
index 309b232c2..b94f71393 100644
--- a/packages/eve/src/execution/settle-cancelled-turn-step.integration.test.ts
+++ b/packages/eve/src/execution/settle-cancelled-turn-step.integration.test.ts
@@ -128,7 +128,6 @@ function buildSerializedContext(): Record<string, unknown> {
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": { kind: "http", state: {} },
"eve.continuationToken": CONTINUATION_TOKEN,
- "eve.mode": "conversation",
"eve.sessionId": PARENT_SESSION_ID,
};
}
diff --git a/packages/eve/src/execution/task-model-retry.integration.test.ts b/packages/eve/src/execution/task-model-retry.integration.test.ts
deleted file mode 100644
index a0d9284c1..000000000
--- a/packages/eve/src/execution/task-model-retry.integration.test.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import { describe, expect, it } from "vitest";
-
-import { start } from "#internal/workflow/runtime.js";
-
-import { createTestRuntime } from "#internal/testing/app-harness.js";
-import { taskModelRetryFixtureWorkflow } from "#internal/testing/task-model-retry-workflow.js";
-
-describe("task model retry integration", () => {
- it("retries a recoverable task error from the committed session snapshot", async () => {
- const runtime = await createTestRuntime({ agent: { name: "task-model-retry-fixture" } });
-
- await runtime.run(async () => {
- const run = await start(taskModelRetryFixtureWorkflow, [{ failThroughAttempt: 1 }]);
- const outcome = await run.returnValue;
-
- expect(outcome.kind).toBe("completed");
- if (outcome.kind !== "completed") return;
-
- expect(outcome.parentNotifications).toBe(0);
- expect(outcome.result.attempt).toBe(2);
- expect(outcome.result.output).toBe("Recovered task output.");
- expect(outcome.result.historyBeforeModelCall).toEqual([
- { content: "Complete the delegated task.", kind: "user", role: "user" },
- { content: "Prior durable work is complete.", role: "assistant" },
- ]);
- expect(outcome.result.history).toContainEqual({
- content: "Prior durable work is complete.",
- role: "assistant",
- });
- expect(JSON.stringify(outcome.result.history)).toContain("Recovered task output.");
- });
- });
-
- it("notifies the parent once after Workflow exhausts persistent failures", async () => {
- const runtime = await createTestRuntime({
- agent: { name: "task-model-retry-exhaustion-fixture" },
- });
-
- await runtime.run(async () => {
- const run = await start(taskModelRetryFixtureWorkflow, [
- { failThroughAttempt: Number.MAX_SAFE_INTEGER },
- ]);
- const outcome = await run.returnValue;
-
- expect(outcome).toMatchObject({
- kind: "failed",
- parentNotifications: 1,
- });
- if (outcome.kind !== "failed") return;
- expect(outcome.failureMessage).toContain(
- "failed after 3 retries: recoverable task failure on Workflow attempt 4",
- );
- });
- });
-});
diff --git a/packages/eve/src/execution/tools/agent-router-workflow.ts b/packages/eve/src/execution/tools/agent-router-workflow.ts
index 7032b83ce..ef9463af2 100644
--- a/packages/eve/src/execution/tools/agent-router-workflow.ts
+++ b/packages/eve/src/execution/tools/agent-router-workflow.ts
@@ -11,12 +11,7 @@ export async function executeAgentRouterTool(
"use workflow";
const target = await chooseTarget(input.message, descriptions(ctx), ctx.abortSignal);
- return ctx.agent(
- target,
- input.outputSchema === undefined
- ? { message: input.message }
- : { message: input.message, outputSchema: input.outputSchema },
- );
+ return ctx.agent(target, { message: input.message });
}
async function chooseTarget(
diff --git a/packages/eve/src/execution/tools/agent-router.ts b/packages/eve/src/execution/tools/agent-router.ts
index ce720e134..6a863aba9 100644
--- a/packages/eve/src/execution/tools/agent-router.ts
+++ b/packages/eve/src/execution/tools/agent-router.ts
@@ -1,4 +1,3 @@
-import type { JsonObject } from "#shared/json.js";
import { defineJsonSchema } from "#tools/schema.js";
export { executeAgentRouterTool } from "#execution/tools/agent-router-workflow.js";
@@ -8,7 +7,6 @@ export const AGENT_ROUTER_TOOL_DESCRIPTION =
export interface AgentRouterInput {
readonly message: string;
- readonly outputSchema?: JsonObject;
}
export const AGENT_ROUTER_INPUT_SCHEMA = defineJsonSchema<AgentRouterInput>({
@@ -19,11 +17,6 @@ export const AGENT_ROUTER_INPUT_SCHEMA = defineJsonSchema<AgentRouterInput>({
minLength: 1,
description: "The complete task to send to the selected agent.",
},
- outputSchema: {
- type: "object",
- description:
- "Only provide a non-empty JSON Schema when the caller explicitly requests structured output; otherwise omit this field. The selected agent must match a provided schema, and that structured output becomes the tool result.",
- },
},
required: ["message"],
additionalProperties: false,
diff --git a/packages/eve/src/execution/tools/subagent/invoke-preparation.ts b/packages/eve/src/execution/tools/subagent/invoke-preparation.ts
index 17ae4175f..a3dabd7a2 100644
--- a/packages/eve/src/execution/tools/subagent/invoke-preparation.ts
+++ b/packages/eve/src/execution/tools/subagent/invoke-preparation.ts
@@ -194,15 +194,7 @@ function classifyFreshStart(input: {
dynamicAgentConfig?.description ??
(registered?.definition.kind === "subagent" ? registered.definition.description : undefined);
const source: SubagentInputSource =
- description === undefined
- ? { outputSchema: input.bundle.turnAgent.outputSchema, type: "runtime" }
- : {
- description,
- outputSchema:
- dynamicAgentConfig?.outputSchema ??
- input.bundle.graph?.nodesByNodeId.get(action.nodeId)?.turnAgent?.outputSchema,
- type: "local",
- };
+ description === undefined ? { type: "runtime" } : { description, type: "local" };
return {
kind: "start",
target: { action, dynamicSubagentAgentConfig: dynamicAgentConfig, kind: "local", source },
diff --git a/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization-close.integration.test.ts b/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization-close.integration.test.ts
index d15da7fb5..e6a0ce148 100644
--- a/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization-close.integration.test.ts
+++ b/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization-close.integration.test.ts
@@ -36,7 +36,6 @@ describe("workflow step authorization failures", () => {
serializedContext: {
...buildWorkflowToolSerializedContext({
continuationToken: "http:step-auth-failure",
- mode: "conversation",
requestInput: true,
}),
"eve.auth": {
diff --git a/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization.integration.test.ts b/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization.integration.test.ts
index eed50e979..8981fc4cb 100644
--- a/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization.integration.test.ts
+++ b/packages/eve/src/execution/tools/workflow/workflow-tool-run-authorization.integration.test.ts
@@ -26,7 +26,6 @@ describe("workflow step authorization", () => {
serializedContext: {
...buildWorkflowToolSerializedContext({
continuationToken: "http:step-token",
- mode: "conversation",
}),
"eve.auth": {
attributes: {},
@@ -77,7 +76,6 @@ describe("workflow step authorization", () => {
serializedContext: {
...buildWorkflowToolSerializedContext({
continuationToken: "http:step-auth",
- mode: "conversation",
requestInput: true,
}),
"eve.auth": {
diff --git a/packages/eve/src/execution/tools/workflow/workflow-tool-run-background.integration.test.ts b/packages/eve/src/execution/tools/workflow/workflow-tool-run-background.integration.test.ts
index ab682b64d..cf67fc539 100644
--- a/packages/eve/src/execution/tools/workflow/workflow-tool-run-background.integration.test.ts
+++ b/packages/eve/src/execution/tools/workflow/workflow-tool-run-background.integration.test.ts
@@ -37,7 +37,6 @@ describe("background workflow tools", () => {
serializedContext: buildWorkflowToolSerializedContext({
acceptedDeploymentId: "dpl_inline",
continuationToken: "http:workflow-tool-background",
- mode: "conversation",
}),
},
]);
@@ -90,7 +89,6 @@ describe("background workflow tools", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "http:workflow-tool-background-fail",
- mode: "conversation",
}),
},
]);
@@ -137,7 +135,6 @@ describe("background workflow tools", () => {
input: { message: 'Run confirm_deploy with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "http:workflow-tool-background-hitl",
- mode: "conversation",
requestInput: true,
}),
},
diff --git a/packages/eve/src/execution/tools/workflow/workflow-tool-run-cancellation.integration.test.ts b/packages/eve/src/execution/tools/workflow/workflow-tool-run-cancellation.integration.test.ts
index 7cc468fc3..30ca22844 100644
--- a/packages/eve/src/execution/tools/workflow/workflow-tool-run-cancellation.integration.test.ts
+++ b/packages/eve/src/execution/tools/workflow/workflow-tool-run-cancellation.integration.test.ts
@@ -45,7 +45,6 @@ describe("workflow tool cancellation", () => {
serializedContext: {
...buildWorkflowToolSerializedContext({
continuationToken: `child-${kind}`,
- mode: "conversation",
}),
"eve.channel": {
kind: "subagent",
@@ -116,7 +115,6 @@ describe("workflow tool cancellation", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "http:yielded-child-cancel",
- mode: "conversation",
}),
},
]);
@@ -208,7 +206,6 @@ describe("workflow tool cancellation", () => {
serializedContext: buildWorkflowToolSerializedContext({
acceptedDeploymentId: "dpl_inline",
continuationToken: "http:workflow-tool-cancel",
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/tools/workflow/workflow-tool-run.integration.test.ts b/packages/eve/src/execution/tools/workflow/workflow-tool-run.integration.test.ts
index 357559648..72713f934 100644
--- a/packages/eve/src/execution/tools/workflow/workflow-tool-run.integration.test.ts
+++ b/packages/eve/src/execution/tools/workflow/workflow-tool-run.integration.test.ts
@@ -1,6 +1,10 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { start } from "#internal/workflow/runtime.js";
-import { captureTurnEvents, filterEventsByType } from "#internal/testing/events.js";
+import {
+ captureTurnEvents,
+ filterEventsByType,
+ readFirstTurnReply,
+} from "#internal/testing/events.js";
import { workflowEntry } from "#execution/session/entry.js";
import { sessionCommandHookToken } from "#execution/session-inbox/address.js";
import { SLEEP_INPUT_SCHEMA, executeSleepTool } from "#execution/tools/sleep.js";
@@ -36,11 +40,10 @@ describe("workflow tools", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "schedule:step-reference",
- mode: "task",
}),
},
]);
- return String((await run.returnValue).output);
+ return String(await readFirstTurnReply(run));
});
expect(output).toContain('"argument":"plan:api"');
expect(output).toContain('"receiver":"api"');
@@ -61,12 +64,10 @@ describe("workflow tools", () => {
input: { message: "Run sleep" },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "schedule:workflow-tool-sleep",
- mode: "task",
}),
},
]);
- const result = await run.returnValue;
- return String(result.output);
+ return String(await readFirstTurnReply(run));
});
expect(output).toContain('"waitedSeconds":1');
@@ -87,12 +88,10 @@ describe("workflow tools", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "schedule:workflow-tool-wait",
- mode: "task",
}),
},
]);
- const result = await run.returnValue;
- return String(result.output);
+ return String(await readFirstTurnReply(run));
});
expect(output).toContain('"plan":"plan:api"');
@@ -114,12 +113,10 @@ describe("workflow tools", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "schedule:workflow-step-context-misuse",
- mode: "task",
}),
},
]);
- const result = await run.returnValue;
- return String(result.output);
+ return String(await readFirstTurnReply(run));
});
expect(output).toContain('ctx.agents is unavailable inside a "use step" function.');
@@ -144,12 +141,10 @@ describe("workflow tools", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "schedule:workflow-tool-fail",
- mode: "task",
}),
},
]);
- const result = await run.returnValue;
- return String(result.output);
+ return String(await readFirstTurnReply(run));
});
expect(output).toContain("deploy of api exploded");
@@ -172,7 +167,6 @@ describe("workflow tools", () => {
serializedContext: buildWorkflowToolSerializedContext({
acceptedDeploymentId: "dpl_inline",
continuationToken: "http:workflow-tool-hitl",
- mode: "conversation",
requestInput: true,
}),
},
@@ -241,7 +235,6 @@ describe("workflow tools", () => {
input: { message: 'Run confirm_deploy with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "http:workflow-tool-ask-deadline",
- mode: "conversation",
requestInput: true,
}),
},
@@ -287,7 +280,6 @@ describe("workflow tools", () => {
input: { message: 'Run deploy_service with service "api"' },
serializedContext: buildWorkflowToolSerializedContext({
continuationToken: "http:workflow-tool-progress",
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/turn-cancellation.integration.test.ts b/packages/eve/src/execution/turn-cancellation.integration.test.ts
index 510083119..f77d017b0 100644
--- a/packages/eve/src/execution/turn-cancellation.integration.test.ts
+++ b/packages/eve/src/execution/turn-cancellation.integration.test.ts
@@ -41,14 +41,12 @@ const WAIT_TOOL_NAME = "wait_for_cancel";
function buildSerializedContext(overrides: {
channelKind: string;
continuationToken: string;
- mode: string;
}): Record<string, unknown> {
return {
"eve.auth": null,
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": { kind: overrides.channelKind, state: {} },
"eve.continuationToken": overrides.continuationToken,
- "eve.mode": overrides.mode,
};
}
@@ -350,7 +348,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -415,7 +412,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken: "http:turn-active-memory-abort",
- mode: "conversation",
}),
},
]);
@@ -465,7 +461,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -517,7 +512,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -601,7 +595,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -694,7 +687,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -769,7 +761,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
@@ -818,7 +809,6 @@ describe("turn cancellation integration", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken,
- mode: "conversation",
}),
},
]);
diff --git a/packages/eve/src/execution/workflow-runtime.test.ts b/packages/eve/src/execution/workflow-runtime.test.ts
index ee888a3ed..40fb5ecbd 100644
--- a/packages/eve/src/execution/workflow-runtime.test.ts
+++ b/packages/eve/src/execution/workflow-runtime.test.ts
@@ -160,8 +160,7 @@ describe("session owner starts", () => {
getRunMock.mockReturnValue({ getWritable: () => sessionWritable });
startMock.mockResolvedValue({ runId: "owner-2" });
const checkpoint = {
- version: 8,
- mode: "conversation",
+ version: 9,
serializedContext: {},
sessionState: { continuationToken: "continuation-1", sessionId: "session-1" },
sessionTimeoutMs: 60_000,
@@ -562,7 +561,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "task",
});
expect(startMock).toHaveBeenCalledWith(
@@ -575,7 +573,6 @@ describe("createWorkflowRuntime#createSession", () => {
serializedContext: expect.objectContaining({
"eve.bundle": { source: compiledArtifactsSource },
"eve.channel": expect.objectContaining({ kind: "http", state: {} }),
- "eve.mode": "task",
"eve.otelTraceEnabled": false,
}),
},
@@ -604,7 +601,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "conversation",
}),
).resolves.toMatchObject({ sessionId: "owner-run" });
@@ -626,7 +622,6 @@ describe("createWorkflowRuntime#createSession", () => {
ownerKey: "owner",
},
input: { message: "hello" },
- mode: "task",
}),
).resolves.toMatchObject({ sessionId: "owner-run" });
@@ -649,7 +644,6 @@ describe("createWorkflowRuntime#createSession", () => {
continuationConflictCommand,
continuationToken: "slack:thread",
input: { message: "hello" },
- mode: "conversation",
});
expect(startMock.mock.calls[0]?.[1][0]).toMatchObject({
@@ -667,7 +661,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message },
- mode: "conversation",
title: "ship it",
});
@@ -688,7 +681,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "conversation",
});
const [, [workflowInput]] = startMock.mock.calls[0]!;
@@ -710,7 +702,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter: activityAdapter(),
auth: null,
input: { message: "hello" },
- mode: "conversation",
});
expect(startMock.mock.calls[0]?.[0]).toBe(activityCollectorWorkflowReference);
@@ -744,7 +735,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter: activityAdapter(),
auth: null,
input: { message: "hello" },
- mode: "conversation",
});
expect(startMock.mock.calls[0]?.[0]).toBe(activityCollectorWorkflowReference);
@@ -768,7 +758,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter: activityAdapter(),
auth: null,
input: { message: "hello" },
- mode: "conversation",
});
const workflowInput = startMock.mock.calls[1]?.[1][0];
@@ -786,7 +775,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter: activityAdapter(),
auth: null,
input: { message: "hello" },
- mode: "conversation",
}),
).rejects.toBe(failure);
@@ -807,7 +795,6 @@ describe("createWorkflowRuntime#createSession", () => {
auth: null,
continuationToken: "slack:thread",
input: { message: "hello" },
- mode: "conversation",
}),
).resolves.toMatchObject({ sessionId: "owner-run" });
@@ -832,7 +819,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "research this" },
- mode: "task",
});
const [, [workflowInput]] = startMock.mock.calls[0]!;
@@ -858,7 +844,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "task",
requestId: "req_run",
});
@@ -908,7 +893,6 @@ describe("createWorkflowRuntime#createSession", () => {
auth: null,
continuationToken: "subagent:parent-session:call-1",
input: { message: "research this" },
- mode: "task",
parent: {
callId: "call-1",
rootSessionId: "root-session",
@@ -944,7 +928,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter: { kind: "subagent", state: { parentContinuationToken: "opaque-reply-hook" } },
auth: null,
input: { message: "research this" },
- mode: "conversation",
taskId: "task-1",
});
@@ -960,7 +943,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "task",
});
expect(startMock).toHaveBeenCalledTimes(1);
@@ -1002,7 +984,6 @@ describe("createWorkflowRuntime#createSession", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "task",
});
expect(getRunMock).not.toHaveBeenCalled();
@@ -1130,7 +1111,6 @@ describe("createWorkflowRuntime#createSession trace seed allocation", () => {
auth: null,
channelMetadata: { kind: "http", metadata: {} },
input: { message: "hello" },
- mode: "conversation",
});
const [, workflowInput] = startMock.mock.calls[0]!;
@@ -1179,7 +1159,6 @@ describe("createWorkflowRuntime#createSession trace seed allocation", () => {
auth: null,
channelMetadata: { kind: "slack", metadata: {} },
input: { message: "hello" },
- mode: "conversation",
});
expect(captured?.channel.kind).toBe("channel:slack");
@@ -1195,7 +1174,6 @@ describe("createWorkflowRuntime#createSession trace seed allocation", () => {
auth: null,
channelMetadata: { kind: "http", metadata: { audience: "private" } },
input: { message: "hello" },
- mode: "conversation",
});
const [, workflowInput] = startMock.mock.calls[0]!;
@@ -1225,7 +1203,6 @@ describe("createWorkflowRuntime#createSession trace seed allocation", () => {
adapter: { kind: "subagent" },
auth: null,
input: { message: "research" },
- mode: "task",
parent: {
callId: "call-1",
rootSessionId: "root-session",
@@ -1260,7 +1237,6 @@ describe("createWorkflowRuntime#createSession trace seed allocation", () => {
adapter,
auth: null,
input: { message: "hello" },
- mode: "conversation",
});
const [, workflowInput] = startMock.mock.calls[0]!;
@@ -1291,7 +1267,6 @@ describe("createWorkflowRuntime#createSession trace seed allocation", () => {
auth: null,
channelMetadata: { kind: "http", metadata: { audience: "public" } },
input: { message: "hello" },
- mode: "conversation",
});
const [, workflowInput] = startMock.mock.calls[0]!;
diff --git a/packages/eve/src/harness/emission.ts b/packages/eve/src/harness/emission.ts
index c562ec84c..44387c489 100644
--- a/packages/eve/src/harness/emission.ts
+++ b/packages/eve/src/harness/emission.ts
@@ -25,7 +25,6 @@ import {
createMessageReceivedEvent,
createReasoningAppendedEvent,
createReasoningCompletedEvent,
- createSessionCompletedEvent,
createSessionFailedEvent,
createSessionStartedEvent,
createSessionWaitingEvent,
@@ -35,7 +34,6 @@ import {
createTurnFailedEvent,
createTurnStartedEvent,
} from "#protocol/message.js";
-import type { RunMode } from "#shared/run-mode.js";
import { hasEmptyDeliverySentinel } from "#shared/empty-delivery.js";
import type { JsonObject } from "#shared/json.js";
import {
@@ -225,13 +223,12 @@ export function advanceStep(state: HarnessEmissionState): HarnessEmissionState {
}
/**
- * Emits `turn.completed` and either `session.waiting` or `session.completed`.
+ * Emits `turn.completed` and `session.waiting`.
* Returns updated emission state with an incremented sequence.
*/
export async function emitTurnEpilogue(
emitFn: HarnessEmitFn,
state: HarnessEmissionState,
- mode: RunMode,
): Promise<HarnessEmissionState> {
await emitFn(
createTurnCompletedEvent({
@@ -239,12 +236,7 @@ export async function emitTurnEpilogue(
turnId: state.turnId,
}),
);
-
- if (mode === "conversation") {
- await emitFn(createSessionWaitingEvent());
- } else {
- await emitFn(createSessionCompletedEvent());
- }
+ await emitFn(createSessionWaitingEvent());
return {
sessionStarted: state.sessionStarted,
diff --git a/packages/eve/src/harness/input-requests.ts b/packages/eve/src/harness/input-requests.ts
index c2cf87b7e..c8d32ba34 100644
--- a/packages/eve/src/harness/input-requests.ts
+++ b/packages/eve/src/harness/input-requests.ts
@@ -78,13 +78,6 @@ export function hasRunnableDeferredStepInput(session: HarnessSession): boolean {
}
}
-/** Returns true when any pending batch still contains a tool approval. */
-export function hasPendingApprovalBatch(session: HarnessSession): boolean {
- return getPendingInputBatches(session.state).some((batch) =>
- batch.requests.some((request) => isApprovalRequest(request)),
- );
-}
-
/** Selects the complete approval batch that pending-input resolution will resume. */
export function selectApprovalReplayBatch(
session: HarnessSession,
@@ -119,7 +112,6 @@ export function resolvePendingInput(input: {
readonly activeTurnId?: string;
/** True while the harness has an open turn to continue. */
readonly internalStep?: boolean;
- readonly deferMessagesWhileApprovalsPending?: boolean;
readonly history?: readonly ModelMessage[];
readonly resolveApprovalKey?: (request: InputRequest) => string | undefined;
readonly session: HarnessSession;
@@ -161,20 +153,6 @@ export function resolvePendingInput(input: {
};
}
- if (
- route.kind === "approvals" &&
- input.deferMessagesWhileApprovalsPending === true &&
- resolvedStepInput?.message !== undefined &&
- findAnsweredApprovalBatches(batches, responses).length === 0
- ) {
- return {
- deferredMessage: true,
- outcome: "unresolved",
- messages: baseHistory,
- session: queueDeferredStepInput(input.session, compactStepInput(resolvedStepInput)),
- };
- }
-
if (responses.length === 0 && resolvedStepInput?.message === undefined) {
const deferredInput = compactStepInput(resolvedStepInput);
const session =
diff --git a/packages/eve/src/harness/issue-3494-adversarial.integration.test.ts b/packages/eve/src/harness/issue-3494-adversarial.integration.test.ts
index ec1dbfe0b..1ebce4c6d 100644
--- a/packages/eve/src/harness/issue-3494-adversarial.integration.test.ts
+++ b/packages/eve/src/harness/issue-3494-adversarial.integration.test.ts
@@ -184,7 +184,6 @@ function fixture(
],
}).dispatch(createTurnStartedEvent(event));
},
- mode: "conversation",
capabilities: { requestInput: true },
tools,
resolveModel: async () => model,
diff --git a/packages/eve/src/harness/issue-3494-diagnosis.integration.test.ts b/packages/eve/src/harness/issue-3494-diagnosis.integration.test.ts
index 71a810ae9..e50b98fa6 100644
--- a/packages/eve/src/harness/issue-3494-diagnosis.integration.test.ts
+++ b/packages/eve/src/harness/issue-3494-diagnosis.integration.test.ts
@@ -60,7 +60,6 @@ it("continues the second step past an older approval batch", async () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
tools: new Map<string, HarnessToolDefinition>([
[
"gate",
diff --git a/packages/eve/src/harness/pending-input-batches.ts b/packages/eve/src/harness/pending-input-batches.ts
index 038c5a6a2..16cfeaf91 100644
--- a/packages/eve/src/harness/pending-input-batches.ts
+++ b/packages/eve/src/harness/pending-input-batches.ts
@@ -201,15 +201,13 @@ export function activityRequestIdsForRootTurn(
/**
* Merges any queued follow-up input into the current step input and clears it
- * from session state. When `preferCurrentInput` is set, fresh input is returned
- * alone and the queued input remains deferred.
+ * from session state.
*
* Used when the harness has to process a pending tool-approval response first
* and defer the user's new message to the next internal model step.
*/
export function consumeDeferredStepInput(input: {
readonly input?: StepInput;
- readonly preferCurrentInput?: boolean;
readonly session: HarnessSession;
}): {
readonly input?: StepInput;
@@ -221,12 +219,6 @@ export function consumeDeferredStepInput(input: {
return input;
}
- // A fresh task delivery may answer the request that caused the deferral.
- // Resolve it alone, leaving the older turn input queued for the next step.
- if (input.preferCurrentInput === true && input.input !== undefined) {
- return { input: input.input, session: input.session };
- }
-
const session = clearDeferredStepInput(input.session);
if (input.input === undefined) {
diff --git a/packages/eve/src/harness/session-limit-enforcement.ts b/packages/eve/src/harness/session-limit-enforcement.ts
index 289ece1da..bbf65dd28 100644
--- a/packages/eve/src/harness/session-limit-enforcement.ts
+++ b/packages/eve/src/harness/session-limit-enforcement.ts
@@ -8,8 +8,8 @@
* grant a fresh budget window, or cancel the in-flight turn tree.
* 2. {@link enforceSessionUsageLimit} runs before each model call and, when
* the session is over budget, parks it on the deterministic continuation
- * prompt (sessions that can reach a human) or fails it (task-mode sessions
- * without HITL — nobody can answer the prompt).
+ * prompt (sessions that can request input) or fails it (nobody can answer
+ * the prompt).
*/
import { createInputRequestedEvent } from "#protocol/message.js";
import {
@@ -70,25 +70,6 @@ export async function applySessionLimitContinuation(
return { result: null, session: bumpSessionRuntimeUsageLimits(input.session) };
}
- // A session parked on the continuation prompt always satisfies the
- // cancelled-park guard (conversation mode, or a continuation token
- // anchoring it to a waiting parent) — parking the prompt required one of
- // the two. The terminal fallback covers any future caller that resolves
- // a decline outside that state, where a thrown cancellation could not
- // settle as a park.
- const canSettleCancelledPark =
- input.config.mode === "conversation" || input.session.continuationToken !== "";
- if (!canSettleCancelledPark) {
- const violation = getSessionUsageLimitViolation(input.session);
- return {
- result:
- violation === null
- ? { next: { done: true, output: "" }, session: input.session }
- : await failSessionUsageLimit({ ...input, violation }),
- session: input.session,
- };
- }
-
throw new SessionLimitDeclinedError();
}
@@ -96,9 +77,8 @@ export async function applySessionLimitContinuation(
* Pre-model-call gate for the session token budget.
*
* Returns `null` when the session is within budget. Over budget, sessions
- * that can reach a human park on the deterministic continuation prompt;
- * task-mode sessions without HITL fail fast with
- * `SESSION_TOKEN_LIMIT_REACHED`.
+ * that can request input park on the deterministic continuation prompt;
+ * others fail fast with `SESSION_TOKEN_LIMIT_REACHED`.
*/
export async function enforceSessionUsageLimit(
input: SessionLimitPolicyInput & { readonly messages: readonly HarnessModelMessage[] },
@@ -115,7 +95,7 @@ export async function enforceSessionUsageLimit(
if (
violationWindow(violation) > 0 &&
emit !== undefined &&
- (input.config.mode === "conversation" || input.config.capabilities?.requestInput === true)
+ input.config.capabilities?.requestInput === true
) {
return parkOnSessionUsageLimit({ ...input, emit, violation });
}
@@ -163,9 +143,7 @@ async function parkOnSessionUsageLimit(input: {
}),
);
- if (input.config.mode === "conversation") {
- emissionState = await emitTurnEpilogue(input.emit, emissionState, input.config.mode);
- }
+ emissionState = await emitTurnEpilogue(input.emit, emissionState);
return {
next: null,
@@ -221,11 +199,7 @@ async function failSessionUsageLimit(input: {
}
return {
- next: {
- done: true,
- isError: input.config.mode === "task" ? true : undefined,
- output: input.config.mode === "task" ? message : "",
- },
+ next: { done: true, output: "" },
session: input.session,
};
}
diff --git a/packages/eve/src/harness/tool-input-validation.integration.test.ts b/packages/eve/src/harness/tool-input-validation.integration.test.ts
index e6328b7ad..9eb433ad4 100644
--- a/packages/eve/src/harness/tool-input-validation.integration.test.ts
+++ b/packages/eve/src/harness/tool-input-validation.integration.test.ts
@@ -31,7 +31,7 @@ function findToolResult(messages: readonly ModelMessage[], toolCallId: string):
}
describe("framework tool input validation (real AI SDK)", () => {
- it("rejects invalid final_output input instead of terminating the task", async () => {
+ it("rejects invalid final_output input instead of settling the turn", async () => {
const invalidCallId = "final-invalid";
const validCallId = "final-valid";
const outputSchema = {
@@ -73,7 +73,6 @@ describe("framework tool input validation (real AI SDK)", () => {
provider: "eve-integration-mock",
});
const config: ToolLoopHarnessConfig = {
- mode: "task",
resolveModel: async (): Promise<LanguageModel> => model,
tools: new Map(),
};
@@ -106,6 +105,7 @@ describe("framework tool input validation (real AI SDK)", () => {
expect(model.doGenerateCalls).toHaveLength(2);
expect(findToolResult(model.doGenerateCalls[1]?.prompt ?? [], invalidCallId)).toBeDefined();
- expect(validStep.next).toEqual({ done: true, output: { answer: "done" } });
+ expect(validStep.next).toBeNull();
+ expect(validStep.settledTurn).toEqual({ output: { answer: "done" } });
});
});
diff --git a/packages/eve/src/harness/tool-loop-cancellation.integration.test.ts b/packages/eve/src/harness/tool-loop-cancellation.integration.test.ts
index dc0051352..8cdd88dfc 100644
--- a/packages/eve/src/harness/tool-loop-cancellation.integration.test.ts
+++ b/packages/eve/src/harness/tool-loop-cancellation.integration.test.ts
@@ -45,7 +45,6 @@ function createConfig(
): ToolLoopHarnessConfig {
return {
handleEvent: emit,
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue(model),
tools: new Map(),
...overrides,
diff --git a/packages/eve/src/harness/tool-loop-compaction-accounting.test.ts b/packages/eve/src/harness/tool-loop-compaction-accounting.test.ts
index 8323f9db2..b8332e7c5 100644
--- a/packages/eve/src/harness/tool-loop-compaction-accounting.test.ts
+++ b/packages/eve/src/harness/tool-loop-compaction-accounting.test.ts
@@ -42,7 +42,6 @@ function createTestSession(overrides?: Partial<HarnessSession>): HarnessSession
function createTestConfig(overrides?: Partial<ToolLoopHarnessConfig>): ToolLoopHarnessConfig {
return {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue({} as LanguageModel),
tools: new Map([
[
diff --git a/packages/eve/src/harness/tool-loop-content-filter.integration.test.ts b/packages/eve/src/harness/tool-loop-content-filter.integration.test.ts
index ce920b123..c1acc089f 100644
--- a/packages/eve/src/harness/tool-loop-content-filter.integration.test.ts
+++ b/packages/eve/src/harness/tool-loop-content-filter.integration.test.ts
@@ -46,7 +46,6 @@ describe("content-filter reporting (real AI SDK)", () => {
});
const events: UnstampedMessageStreamEvent[] = [];
const step = createToolLoopHarness({
- mode: "conversation",
resolveModel: async () => model,
tools: new Map(),
handleEvent: async (event) => {
@@ -95,7 +94,6 @@ describe("content-filter reporting (real AI SDK)", () => {
},
});
const step = createToolLoopHarness({
- mode: "task",
resolveModel: async () => model,
tools: new Map(),
});
diff --git a/packages/eve/src/harness/tool-loop-generate-approval-resume.integration.test.ts b/packages/eve/src/harness/tool-loop-generate-approval-resume.integration.test.ts
index e917595c6..dbe67d499 100644
--- a/packages/eve/src/harness/tool-loop-generate-approval-resume.integration.test.ts
+++ b/packages/eve/src/harness/tool-loop-generate-approval-resume.integration.test.ts
@@ -261,7 +261,6 @@ function createConfig(
],
]);
return {
- mode: "conversation",
resolveModel: async (): Promise<LanguageModel> => model,
tools,
};
@@ -452,7 +451,6 @@ describe("tool loop generate approval resume (real AI SDK)", () => {
order.push(`step.started:${String(version)}`);
}
},
- mode: "conversation",
resolveStepDynamicTools: (input) =>
preparePersistedStepDynamicToolMetadata({ ...input, resolvers: [resolver] }),
resolveModel: async (): Promise<LanguageModel> => model,
@@ -732,6 +730,7 @@ describe("tool loop generate approval resume (real AI SDK)", () => {
});
const config = {
...createConfig(model, execute),
+ capabilities: { requestInput: true },
handleEvent: async () => {},
} satisfies ToolLoopHarnessConfig;
const usageState = {
diff --git a/packages/eve/src/harness/tool-loop-request-envelope.integration.test.ts b/packages/eve/src/harness/tool-loop-request-envelope.integration.test.ts
index 2be9750f0..704ad1d3d 100644
--- a/packages/eve/src/harness/tool-loop-request-envelope.integration.test.ts
+++ b/packages/eve/src/harness/tool-loop-request-envelope.integration.test.ts
@@ -49,7 +49,6 @@ describe("model request envelope accounting", () => {
},
});
const runStep = createToolLoopHarness({
- mode: "conversation",
tools: new Map(),
resolveModel: async (reference) =>
(reference.id === "summary" ? summary : task) as LanguageModel,
@@ -93,7 +92,6 @@ describe("model request envelope accounting", () => {
},
});
const runStep = createToolLoopHarness({
- mode: "conversation",
tools: new Map(),
resolveModel: async (reference) =>
(reference.id === "summary" ? summary : task) as LanguageModel,
@@ -129,7 +127,6 @@ describe("model request envelope accounting", () => {
},
});
const runStep = createToolLoopHarness({
- mode: "conversation",
tools: new Map(),
resolveModel: async (reference) =>
(reference.id === "summary" ? summary : task) as LanguageModel,
diff --git a/packages/eve/src/harness/tool-loop-steering.integration.test.ts b/packages/eve/src/harness/tool-loop-steering.integration.test.ts
index b03de2890..a12e71979 100644
--- a/packages/eve/src/harness/tool-loop-steering.integration.test.ts
+++ b/packages/eve/src/harness/tool-loop-steering.integration.test.ts
@@ -57,7 +57,6 @@ describe("generation steering with the real AI SDK", () => {
}));
try {
const running = createToolLoopHarness({
- mode: "conversation",
abortSignal: cancellation.signal,
steeringSignal: steering.signal,
tools: new Map(),
@@ -105,7 +104,6 @@ describe("generation steering with the real AI SDK", () => {
},
});
const harness = createToolLoopHarness({
- mode: "conversation",
capabilities: { requestInput: true },
steeringSignal: steering.signal,
tools: new Map([
@@ -150,7 +148,6 @@ describe("generation steering with the real AI SDK", () => {
const model = new MockLanguageModelV3({ doStream });
const events: UnstampedMessageStreamEvent[] = [];
const result = await createToolLoopHarness({
- mode: "conversation",
steeringSignal: steering.signal,
tools: new Map(),
resolveModel: async () => model,
@@ -201,7 +198,6 @@ describe("generation steering with the real AI SDK", () => {
const model = new MockLanguageModelV3({ doStream });
const createStep = (signal?: AbortSignal) =>
createToolLoopHarness({
- mode: "conversation",
resolveModel: async () => model,
tools: new Map(),
steeringSignal: signal,
@@ -283,7 +279,6 @@ describe("generation steering with the real AI SDK", () => {
const model = new MockLanguageModelV3({ doStream });
const createStep = (signal?: AbortSignal) =>
createToolLoopHarness({
- mode: "conversation",
steeringSignal: signal,
resolveModel: async () => model,
handleEvent: async () => {},
@@ -329,7 +324,6 @@ describe("generation steering with the real AI SDK", () => {
},
});
const result = await createToolLoopHarness({
- mode: "conversation",
steeringSignal: steering.signal,
tools: new Map(),
resolveModel: async () => model,
diff --git a/packages/eve/src/harness/tool-loop-stream-retry.integration.test.ts b/packages/eve/src/harness/tool-loop-stream-retry.integration.test.ts
index d72e789d6..00783dc70 100644
--- a/packages/eve/src/harness/tool-loop-stream-retry.integration.test.ts
+++ b/packages/eve/src/harness/tool-loop-stream-retry.integration.test.ts
@@ -47,7 +47,6 @@ function createEventCollector(): {
function createConfig(model: LanguageModel, emit: HarnessEmitFn): ToolLoopHarnessConfig {
return {
handleEvent: emit,
- mode: "task",
resolveModel: vi.fn().mockResolvedValue(model),
tools: new Map(),
};
@@ -91,7 +90,7 @@ afterEach(() => {
});
describe("tool loop streamed provider retries", () => {
- it("retries an overloaded stream and preserves prior task work", async () => {
+ it("retries an overloaded stream and preserves prior work", async () => {
vi.spyOn(Math, "random").mockReturnValue(0);
vi.spyOn(console, "error").mockImplementation(() => {});
vi.spyOn(console, "warn").mockImplementation(() => {});
@@ -121,7 +120,8 @@ describe("tool loop streamed provider retries", () => {
});
expect(doStream).toHaveBeenCalledTimes(2);
- expect(result.next).toEqual({ done: true, output: "Recovered answer." });
+ expect(result.next).toBeNull();
+ expect(result.settledTurn).toEqual({ output: "Recovered answer." });
expect(result.session.history).toContainEqual({
content: "Prior work is complete.",
role: "assistant",
@@ -172,8 +172,8 @@ describe("tool loop streamed provider retries", () => {
// The exhausted failure reports the catalog's curated summary for the
// overloaded shape rather than the provider's raw "Overloaded", with
// the remediation hint riding along in the parent-facing output.
- expect(result.next).toMatchObject({
- done: true,
+ expect(result.next).toBeNull();
+ expect(result.settledTurn).toEqual({
isError: true,
output:
"The model provider is overloaded or timing out upstream of AI Gateway. " +
@@ -181,6 +181,7 @@ describe("tool loop streamed provider retries", () => {
});
expect(events.filter((event) => event.type === "step.failed")).toHaveLength(1);
expect(events.filter((event) => event.type === "turn.failed")).toHaveLength(1);
- expect(events.filter((event) => event.type === "session.failed")).toHaveLength(1);
+ expect(events.filter((event) => event.type === "session.failed")).toHaveLength(0);
+ expect(events.at(-1)?.type).toBe("session.waiting");
});
});
diff --git a/packages/eve/src/harness/tool-loop.test.ts b/packages/eve/src/harness/tool-loop.test.ts
index 98fbbf3da..0c11f35b9 100644
--- a/packages/eve/src/harness/tool-loop.test.ts
+++ b/packages/eve/src/harness/tool-loop.test.ts
@@ -48,7 +48,6 @@ import type { ResolvedDynamicInstructionsResolver } from "#runtime/types.js";
import { createPreparedRuntimeSubagentTool } from "#runtime/subagents/registry.js";
import type { DynamicResolveContext } from "#dynamic/definition.js";
import { registerDurableDynamicCallback } from "#tools/durable-callbacks.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { ChannelAudience } from "#shared/channel-audience.js";
import {
ConversationContextKey,
@@ -80,7 +79,7 @@ import {
appendPendingInputBatch,
} from "#harness/input-requests.js";
import { activeTurnId } from "#harness/active-turn-id.js";
-import { recordWorkflowTaskView, registerWorkflowToolRun } from "#harness/workflow-tool-runs.js";
+import { registerWorkflowToolRun } from "#harness/workflow-tool-runs.js";
import { getPendingCoordinationBatch } from "#harness/coordination.js";
import { AGENT_HANDLES_STATE_KEY } from "#subagents/handles/store.js";
import { BackgroundToolExecutorKey } from "#harness/background-tools.js";
@@ -187,7 +186,6 @@ function setConversationContext(
audience,
channel: { kind, name: "test" },
environment,
- mode: "conversation",
principalType: "anonymous",
});
}
@@ -317,14 +315,13 @@ function recordBackgroundTask(session: HarnessSession, taskId = "analysis"): Har
}
function createTestConfig(
- mode: RunMode = "conversation",
emit?: HarnessEmitFn,
overrides?: Partial<ToolLoopHarnessConfig>,
): ToolLoopHarnessConfig {
return {
+ capabilities: { requestInput: true },
handleEvent: emit,
instrumentation: declaredInstrumentation,
- mode,
resolveModel: vi.fn().mockResolvedValue({} as LanguageModel),
tools: new Map([
[
@@ -856,85 +853,6 @@ function createGatewayModelCallError(input: {
}
describe("createToolLoopHarness", () => {
- it("keeps a scheduled task session alive across individual results until all tasks settle", async () => {
- const { SessionInputQueue } = await import("#execution/session/input-queue.js");
- const { recordWorkflowTaskView, getBackgroundTasks } =
- await import("#harness/workflow-tool-runs.js");
- const { resolveTaskDeliveryContext } = await import("#tasks/delivery-context.js");
- const { backgroundToolExecutionProvider } =
- await import("#execution/tasks/parent/tool-execution.js");
- const schema = {
- properties: { summary: { type: "string" } },
- required: ["summary"],
- type: "object",
- } as const;
- let session = recordBackgroundTask(
- recordBackgroundTask(createTestSession({ outputSchema: schema }), "A"),
- "B",
- );
- const queue = new SessionInputQueue();
- queue.enqueueDelivery({
- kind: "deliver",
- taskDeliveryId: "A:ready:completed",
- payloads: [{ message: "A completed" }],
- });
- expect(queue.takeNext(session.state, { taskDeliveryPolicy: "cohort" })).toBeUndefined();
- expect(queue.takeNext(session.state, { taskDeliveryPolicy: "auto" })?.kind).toBe("turn");
- session = {
- ...session,
- state: recordWorkflowTaskView(session.state, {
- taskId: "A",
- metadata: { kind: "report-probe", name: "A" },
- status: "completed",
- lastOutput: { type: "result", data: "Report A" },
- }).state,
- };
- const report = resolveTaskDeliveryContext({
- state: session.state,
- taskDeliveryIds: ["A:ready:completed"],
- taskDeliveryPolicy: "auto",
- })!;
- const ctx = new ContextContainer();
- ctx.set(ScheduleIdKey, "scheduled-report");
- ctx.set(TurnTaskDeliveryKey, report.phase);
- const scope = await backgroundToolExecutionProvider.create(ctx, session);
- if (scope === undefined) throw new Error("Expected background executor");
- ctx.set(BackgroundToolExecutorKey, scope.value);
- expect(scope.value.hasPendingTasks?.()).toBe(true);
- setupMockAgent(finalOutputResult("Report A", { summary: "Report A" }));
- const runStep = createToolLoopHarness(createTestConfig("task"));
- const result = await contextStorage.run(ctx, () =>
- runStep(session, { message: "A completed", context: [report.context] }),
- );
- expect(getBackgroundTasks(result.session.state).get("B")?.status).toBe("working");
- expect(result.next).toBeNull();
-
- session = {
- ...result.session,
- state: recordWorkflowTaskView(result.session.state, {
- taskId: "B",
- metadata: { kind: "report-probe", name: "B" },
- status: "completed",
- lastOutput: { type: "result", data: "Report B" },
- }).state,
- };
- const finalReport = resolveTaskDeliveryContext({
- state: session.state,
- taskDeliveryIds: ["B:ready:completed"],
- taskDeliveryPolicy: "auto",
- })!;
- ctx.set(TurnTaskDeliveryKey, finalReport.phase);
- const finalScope = await backgroundToolExecutionProvider.create(ctx, session);
- if (finalScope === undefined) throw new Error("Expected background executor");
- ctx.set(BackgroundToolExecutorKey, finalScope.value);
- expect(finalScope.value.hasPendingTasks?.()).toBe(false);
- setupMockAgent(finalOutputResult("Report B", { summary: "Report B" }));
- const finalResult = await contextStorage.run(ctx, () =>
- runStep(session, { message: "B completed", context: [finalReport.context] }),
- );
- expect(finalResult.next).toEqual({ done: true, output: { summary: "Report B" } });
- });
-
it("uses one projected history view for step consumers while preserving raw history", async () => {
setupMockAgent({
finishReason: "stop",
@@ -961,7 +879,7 @@ describe("createToolLoopHarness", () => {
};
const dynamicModelMessages: Array<readonly ModelMessage[]> = [];
const runStep = createToolLoopHarness(
- createTestConfig("conversation", handleEvent, {
+ createTestConfig(handleEvent, {
dispatchDynamicModelEvent: async ({ messages }) => {
dynamicModelMessages.push(messages);
},
@@ -1007,7 +925,7 @@ describe("createToolLoopHarness", () => {
const handleEvent = vi.fn();
const dispatchDynamicModelEvent = vi.fn();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", handleEvent, {
+ createTestConfig(handleEvent, {
dispatchDynamicModelEvent,
historyProjector: () => {
throw new Error("projection failed");
@@ -1032,7 +950,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -1075,7 +993,7 @@ describe("createToolLoopHarness", () => {
},
]);
const { emit, events } = createEventCollector();
- const config = createTestConfig("conversation", emit, {
+ const config = createTestConfig(emit, {
tools: new Map([
[
"web_search",
@@ -1132,7 +1050,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const blankMessages: Array<string | UserContent> = [
"",
" \n\t",
@@ -1162,7 +1080,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
await runStep(
createTestSession({
history: [
@@ -1211,7 +1129,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -1242,7 +1160,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
expect(result.next).toBeNull();
@@ -1275,7 +1193,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -1297,7 +1215,7 @@ describe("createToolLoopHarness", () => {
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
tools: new Map([
[
"background_work",
@@ -1373,7 +1291,7 @@ describe("createToolLoopHarness", () => {
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
historyProjector: ({ messages }) => [...messages],
resolveModel: vi.fn().mockResolvedValue(
new MockLanguageModelV3({
@@ -1447,7 +1365,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession({
state: {
[AGENT_HANDLES_STATE_KEY]: {
@@ -1498,7 +1416,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession({
history: [
{ content: "Delegate this.", kind: "user" as const, role: "user" },
@@ -1604,7 +1522,7 @@ describe("createToolLoopHarness", () => {
},
});
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
dispatchDynamicModelEvent,
resolveModel,
});
@@ -1666,7 +1584,7 @@ describe("createToolLoopHarness", () => {
});
return "selected-model" as LanguageModel;
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
resolveModel,
});
const runStep = createToolLoopHarness(config);
@@ -1707,7 +1625,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
resolveModel: vi.fn().mockResolvedValue("selected-model" as LanguageModel),
});
const runStep = createToolLoopHarness(config);
@@ -1752,7 +1670,6 @@ describe("createToolLoopHarness", () => {
const hidden = { content: "Hidden context", kind: "user" as const, role: "user" as const };
const runStep = createToolLoopHarness(
createTestConfig(
- "conversation",
async (event, messages) => {
if (event.type === "turn.started") snapshots.push(messages);
},
@@ -1778,7 +1695,7 @@ describe("createToolLoopHarness", () => {
it("emits a terminal failure when no dynamic model selection is active", async () => {
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const session = createTestSession({
agent: {
dynamicModel: true,
@@ -1813,7 +1730,7 @@ describe("createToolLoopHarness", () => {
throw new DynamicModelSelectionError(new Error("flag service unavailable"));
}
};
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession({ outputSchema: { type: "object" } }), {
message: "Hi",
@@ -1841,7 +1758,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
tools: createDelegationToolMap(),
});
const runStep = createToolLoopHarness(config);
@@ -1888,7 +1805,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, { tools: createDelegationToolMap() }),
+ createTestConfig(emit, { tools: createDelegationToolMap() }),
);
const result = await runStep(createTestSession({ rootSessionId: "root-session" }), {
@@ -1962,7 +1879,7 @@ describe("createToolLoopHarness", () => {
},
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await contextStorage.run(ctx, () =>
runStep(createTestSession(), { message: "Research this." }),
@@ -2039,7 +1956,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, { tools: createDelegationToolMap() }),
+ createTestConfig(emit, { tools: createDelegationToolMap() }),
);
const parked = await runStep(createPendingBashApprovalSession(), {
@@ -2247,7 +2164,7 @@ describe("createToolLoopHarness", () => {
"fails fast after the $tokenKind limit when the session cannot request input",
async (testCase) => {
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit, { capabilities: undefined }));
const session = setTurnUsageState(createTestSession({ limits: testCase.limits }), {
turnId: "turn_previous",
...testCase.usage,
@@ -2257,7 +2174,7 @@ describe("createToolLoopHarness", () => {
const result = await runStep(session, { message: "Hi again" });
expect(vi.mocked(ToolLoopAgent)).not.toHaveBeenCalled();
- expect(result.next).toEqual({ done: true, isError: true, output: testCase.message });
+ expect(result.next).toEqual({ done: true, output: "" });
expect(events.map((event) => event.type)).toEqual([
"session.started",
"turn.started",
@@ -2330,7 +2247,6 @@ describe("createToolLoopHarness", () => {
: [];
const runStep = createToolLoopHarness(
createTestConfig(
- "conversation",
async (event, messages) => {
const lifecycleMessages = await dispatchMemoryLifecycleEvent({
appRoot: "/app",
@@ -2412,7 +2328,7 @@ describe("createToolLoopHarness", () => {
it("parks on a deterministic continuation prompt when the session reaches its token limit", async () => {
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createLimitReachedSession(), { message: "Hi again" });
@@ -2465,7 +2381,7 @@ describe("createToolLoopHarness", () => {
{ turnId: "turn_previous", ...usage, session: usage },
);
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const parked = await runStep(reached, { message: "Hi again" });
expect(events.find((event) => event.type === "input.requested")?.data).toMatchObject({
@@ -2505,7 +2421,7 @@ describe("createToolLoopHarness", () => {
usage: { inputTokens: 7, outputTokens: 3 },
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const parked = await runStep(createLimitReachedSession(), { message: "Hi again" });
expect(vi.mocked(ToolLoopAgent)).not.toHaveBeenCalled();
@@ -2553,7 +2469,7 @@ describe("createToolLoopHarness", () => {
usage: { inputTokens: 7, outputTokens: 3 },
});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const parked = await runStep(createLimitReachedSession(), { message: "Hi again" });
@@ -2568,7 +2484,7 @@ describe("createToolLoopHarness", () => {
it("cancels the turn when the user declines the limit continuation prompt", async () => {
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const parked = await runStep(createLimitReachedSession(), { message: "Hi again" });
const declined = runStep(parked.session, {
@@ -2586,42 +2502,15 @@ describe("createToolLoopHarness", () => {
expect(events.some((event) => event.type === "session.completed")).toBe(false);
});
- it("declines with the same cancellation when the prompt was proxied to a task session", async () => {
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(
- createTestConfig("task", emit, { capabilities: { requestInput: true } }),
- );
-
- const parked = await runStep(createLimitReachedSession(), { message: "Hi again" });
- expect(parked.next).toBeNull();
-
- const declined = runStep(parked.session, {
- inputResponses: [{ optionId: "stop", requestId: LIMIT_REQUEST_ID }],
- });
-
- // The delegating parent must never receive an error result it could
- // retry against a fresh budget share: task-mode declines throw the same
- // decline-flavored cancellation instead of failing the step.
- await expect(declined).rejects.toSatisfy((error) => isSessionLimitDecline(error));
- expect(vi.mocked(ToolLoopAgent)).not.toHaveBeenCalled();
- expect(events.some((event) => event.type.endsWith(".failed"))).toBe(false);
- });
-
- it("fails a zero-budget task instead of raising a continuation that cannot grant tokens", async () => {
+ it("fails a zero-budget session instead of raising a continuation that cannot grant tokens", async () => {
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(
- createTestConfig("task", emit, { capabilities: { requestInput: true } }),
- );
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const session = createTestSession({ limits: { maxInputTokensPerSession: 0 } });
const result = await runStep(session, { message: "Hi again" });
expect(vi.mocked(ToolLoopAgent)).not.toHaveBeenCalled();
- expect(result.next).toEqual({
- done: true,
- isError: true,
- output: "The session reached its configured input token limit.",
- });
+ expect(result.next).toEqual({ done: true, output: "" });
expect(events.some((event) => event.type === "input.requested")).toBe(false);
});
@@ -2635,7 +2524,7 @@ describe("createToolLoopHarness", () => {
usage: { inputTokens: 7, outputTokens: 3 },
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const parked = await runStep(createLimitReachedSession(), { message: "Hi again" });
const reparked = await runStep(parked.session, { message: "also do this other thing" });
@@ -2712,7 +2601,7 @@ describe("createToolLoopHarness", () => {
},
]);
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
await contextStorage.run(ctx, () => runStep(createTestSession(), { message: "Hi" }));
@@ -2772,7 +2661,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue({} as LanguageModel),
tools: new Map([
[
@@ -2807,48 +2695,6 @@ describe("createToolLoopHarness", () => {
expect(agentCall!.tools).not.toHaveProperty("Workflow");
});
- it("returns done when task mode finishes with stop", async () => {
- setupMockAgent({
- finishReason: "stop",
- response: { messages: [{ content: "Hello!", role: "assistant" }] },
- text: "Hello!",
- toolCalls: [],
- toolResults: [],
- });
-
- const config = createTestConfig("task");
- const runStep = createToolLoopHarness(config);
- const session = createTestSession();
-
- const result = await runStep(session, { message: "Hi" });
-
- expect(result.next).toEqual({ done: true, output: "Hello!" });
- });
-
- it("returns an empty successful result when a task chooses not to deliver", async () => {
- setupMockAgent({
- finishReason: "stop",
- response: { messages: [{ content: EMPTY_DELIVERY_SENTINEL, role: "assistant" }] },
- text: EMPTY_DELIVERY_SENTINEL,
- toolCalls: [],
- toolResults: [],
- });
-
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
-
- const result = await runStep(createTestSession(), { message: "Check for alerts." });
-
- expect(result.next).toEqual({ done: true, output: "" });
- expect(vi.mocked(ToolLoopAgent)).toHaveBeenCalledTimes(1);
- expect(events).toContainEqual(
- expect.objectContaining({
- data: expect.objectContaining({ message: null }),
- type: "message.completed",
- }),
- );
- });
-
it("emits result.completed when a run output schema is requested", async () => {
const schema = {
properties: { title: { type: "string" } },
@@ -2858,7 +2704,7 @@ describe("createToolLoopHarness", () => {
setupMockAgent(finalOutputResult("Here is the summary.", { title: "Done" }));
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const session = createTestSession({ outputSchema: schema });
const result = await runStep(session, { message: "Hi" });
@@ -2892,108 +2738,6 @@ describe("createToolLoopHarness", () => {
});
});
- it("produces structured task output when a schema is in effect", async () => {
- const schema = {
- properties: { summary: { type: "string" } },
- required: ["summary"],
- type: "object",
- } as const;
- setupMockAgent(finalOutputResult("Done.", { summary: "Done" }));
-
- const config = createTestConfig("task");
- const runStep = createToolLoopHarness(config);
- const session = createTestSession({ outputSchema: schema });
-
- const result = await runStep(session, { message: "Hi" });
-
- expect(result.next).toEqual({ done: true, output: { summary: "Done" } });
- });
-
- it("parks a scheduled task turn while its launched background task is pending", async () => {
- const schema = {
- properties: { summary: { type: "string" } },
- required: ["summary"],
- type: "object",
- } as const;
- setupMockAgent(finalOutputResult("Starting.", { summary: "Pending" }));
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
- const ctx = new ContextContainer();
- ctx.set(ScheduleIdKey, "scheduled-report");
- ctx.set(BackgroundToolExecutorKey, {
- execute: vi.fn(),
- hasPendingTasks: () => true,
- });
-
- const result = await contextStorage.run(ctx, () =>
- runStep(createTestSession({ outputSchema: schema }), { message: "Run the report" }),
- );
-
- expect(result.next).toBeNull();
- expect(result.settledTurn).toEqual({ output: { summary: "Pending" } });
- expect(result.session.outputSchema).toBe(schema);
- expect(events.some((event) => event.type === "result.completed")).toBe(false);
- expect(events.at(-1)?.type).toBe("session.waiting");
- });
-
- it("parks a task turn without completing the session while durable background work is pending", async () => {
- setupMockAgent({
- finishReason: "stop",
- response: { messages: [{ content: "Still working.", role: "assistant" }] },
- text: "Still working.",
- toolCalls: [],
- toolResults: [],
- });
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
-
- const result = await contextStorage.run(new ContextContainer(), () =>
- runStep(recordBackgroundTask(createTestSession()), { message: "Continue" }),
- );
-
- expect(result.next).toBeNull();
- expect(result.settledTurn).toEqual({ output: "Still working." });
- expect(events.some((event) => event.type === "session.completed")).toBe(false);
- expect(events.at(-1)?.type).toBe("session.waiting");
-
- const completed = await contextStorage.run(new ContextContainer(), () =>
- runStep(
- {
- ...result.session,
- state: recordWorkflowTaskView(result.session.state, {
- lastOutput: { data: "MCP-CHILD-ANSWER", type: "result" },
- metadata: { kind: "report-probe", name: "analysis" },
- status: "completed",
- taskId: "analysis",
- }),
- },
- { message: "Background work finished." },
- ),
- );
-
- expect(completed.next).toEqual({ done: true, output: "Still working." });
- expect(events.filter((event) => event.type === "session.completed")).toHaveLength(1);
- expect(events.at(-1)?.type).toBe("session.completed");
- });
-
- it("fails a task turn as an error when structured output is not produced", async () => {
- setupMockAgent({
- finishReason: "stop",
- response: { messages: [{ content: "Plain prose, no tool call.", role: "assistant" }] },
- text: "Plain prose, no tool call.",
- toolCalls: [],
- toolResults: [],
- });
-
- const config = createTestConfig("task");
- const runStep = createToolLoopHarness(config);
- const session = createTestSession({ outputSchema: { type: "object" } });
-
- const result = await runStep(session, { message: "Hi" });
-
- expect(result.next).toMatchObject({ done: true, isError: true });
- });
-
it("does not offer final_output when no schema is in effect", async () => {
setupMockAgent({
finishReason: "stop",
@@ -3003,7 +2747,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -3054,13 +2798,14 @@ describe("createToolLoopHarness", () => {
toolResults: [{ toolCallId: "add-1", toolName: "add", output: "42" }],
});
- const config = createTestConfig("task");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession({ outputSchema: schema });
const result = await runStep(session, { message: "Hi" });
- expect(result.next).toEqual({ done: true, output: { title: "Done" } });
+ expect(result.next).toBeNull();
+ expect(result.settledTurn).toEqual({ output: { title: "Done" } });
// The un-executed final_output call is never persisted, so no dangling
// tool_use survives into history.
expect(result.session.history).toEqual([
@@ -3080,7 +2825,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const session = createTestSession({ outputSchema: { type: "object" } });
const result = await runStep(session, { message: "Hi" });
@@ -3110,76 +2855,6 @@ describe("createToolLoopHarness", () => {
expect(result.session.outputSchema).toBeUndefined();
});
- it("returns only the final assistant reply when a completed task step includes tool work", async () => {
- setupMockAgent({
- finishReason: "stop",
- response: {
- messages: [
- {
- content: [
- { text: "I'll look that up.", type: "text" },
- {
- input: { query: "weather in ny" },
- toolCallId: "call-1",
- toolName: "web_search",
- type: "tool-call",
- },
- ],
- role: "assistant",
- },
- {
- content: [
- {
- output: { temperature: "41 F" },
- toolCallId: "call-1",
- toolName: "web_search",
- type: "tool-result",
- },
- ],
- role: "tool",
- },
- { content: "It is 41 F in New York right now.", role: "assistant" },
- ],
- },
- text: "It is 41 F in New York right now.",
- toolCalls: [
- {
- input: { query: "weather in ny" },
- toolCallId: "call-1",
- toolName: "web_search",
- type: "tool-call",
- },
- ],
- toolResults: [
- {
- input: { query: "weather in ny" },
- output: { temperature: "41 F" },
- toolCallId: "call-1",
- toolName: "web_search",
- type: "tool-result",
- },
- ],
- });
-
- const config = createTestConfig("task", undefined, {
- tools: new Map(),
- });
- const runStep = createToolLoopHarness(config);
- const session = createTestSession({
- agent: {
- modelReference: { id: "openai/gpt-5.4" },
- system: "You are a test assistant.",
- tools: [
- { description: "Search the web", name: "web_search", inputSchema: { type: "object" } },
- ],
- },
- });
-
- const result = await runStep(session, { message: "What's the weather in NY?" });
-
- expect(result.next).toEqual({ done: true, output: "It is 41 F in New York right now." });
- });
-
it("returns next: runStep (continue) when model makes tool calls", async () => {
setupMockAgent({
finishReason: "tool-calls",
@@ -3213,7 +2888,7 @@ describe("createToolLoopHarness", () => {
],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -3274,7 +2949,7 @@ describe("createToolLoopHarness", () => {
],
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
tools: new Map([
[
"web_search",
@@ -3380,7 +3055,7 @@ describe("createToolLoopHarness", () => {
],
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
tools: new Map([
[
"web_search",
@@ -3471,7 +3146,7 @@ describe("createToolLoopHarness", () => {
],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -3501,7 +3176,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession({
history: [{ content: "prior message", kind: "user" as const, role: "user" }],
@@ -3526,7 +3201,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -3545,7 +3220,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Hi" });
@@ -3571,7 +3246,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(
createTestSession({ history: [{ content: "prior", kind: "user" as const, role: "user" }] }),
@@ -3620,7 +3295,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const config = createTestConfig("conversation", emit, {
+ const config = createTestConfig(emit, {
tools: new Map([
[
"add",
@@ -3743,14 +3418,9 @@ describe("createToolLoopHarness", () => {
});
});
- it.each([
- ["conversation", ""],
- ["conversation", "Alice's inventory list is"],
- ["task", ""],
- ["task", "Alice's inventory list is"],
- ] as const)(
- "reports content-filter without retrying in %s mode (text: %j)",
- async (mode, text) => {
+ it.each(["", "Alice's inventory list is"])(
+ "reports content-filter without retrying (text: %j)",
+ async (text) => {
setupMockAgent({
finishReason: "content-filter",
providerMetadata: {
@@ -3762,10 +3432,9 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
const { emit, events } = createEventCollector();
- const result = await createToolLoopHarness(createTestConfig(mode, emit))(
- createTestSession(),
- { message: "Help Alice prepare Bob's inventory list." },
- );
+ const result = await createToolLoopHarness(createTestConfig(emit))(createTestSession(), {
+ message: "Help Alice prepare Bob's inventory list.",
+ });
expect(ToolLoopAgent).toHaveBeenCalledTimes(1);
expect(events.find((event) => event.type === "step.failed")).toMatchObject({
@@ -3790,16 +3459,8 @@ describe("createToolLoopHarness", () => {
expect(JSON.stringify(events.filter((event) => event.type === "step.failed"))).not.toContain(
"not-for-clients",
);
- if (mode === "task") {
- expect(result.next).toMatchObject({
- done: true,
- isError: true,
- output: expect.stringContaining("filtered this response"),
- });
- } else {
- expect(result.next).toBeNull();
- expect(events.some((event) => event.type === "session.waiting")).toBe(true);
- }
+ expect(result.next).toBeNull();
+ expect(events.some((event) => event.type === "session.waiting")).toBe(true);
},
);
@@ -3824,32 +3485,6 @@ describe("createToolLoopHarness", () => {
expect(ToolLoopAgent).toHaveBeenCalledTimes(1);
});
- it("emits session.completed instead of session.waiting in task mode", async () => {
- setupMockAgent({
- finishReason: "stop",
- response: { messages: [{ content: "done", role: "assistant" }] },
- text: "done",
- toolCalls: [],
- toolResults: [],
- });
-
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
-
- await runStep(createTestSession(), { message: "run task" });
-
- expect(getCompatibilityEventTypes(events)).toEqual([
- "session.started",
- "turn.started",
- "message.received",
- "step.started",
- "message.completed",
- "step.completed",
- "turn.completed",
- "session.completed",
- ]);
- });
-
it("emits actions.requested and action.result on tool call step", async () => {
setupMockAgent({
finishReason: "tool-calls",
@@ -3884,7 +3519,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Add 1 and 2" });
@@ -3974,7 +3609,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
// Must not throw.
await expect(runStep(createTestSession(), { message: "Do it" })).resolves.toBeDefined();
@@ -4026,7 +3661,7 @@ describe("createToolLoopHarness", () => {
});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const firstStep = await runStep(createTestSession(), { message: "Add these" });
expect(firstStep.next).toBe(runStep);
@@ -4136,7 +3771,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Add 1 and 2" });
@@ -4190,7 +3825,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const session = createTestSession();
- const config = createTestConfig("conversation", emit, {
+ const config = createTestConfig(emit, {
tools: new Map([
[
"delegate",
@@ -4246,7 +3881,7 @@ describe("createToolLoopHarness", () => {
});
const { emit } = createEventCollector();
- const config = createTestConfig("conversation", emit, {
+ const config = createTestConfig(emit, {
tools: new Map([
[
"delegate",
@@ -4332,7 +3967,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Weather in Vienna" });
@@ -4412,7 +4047,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const config = createTestConfig("conversation", emit, {
+ const config = createTestConfig(emit, {
tools: new Map([
[
"load_skill",
@@ -4555,7 +4190,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Weather in Vienna" });
@@ -4610,7 +4245,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, { abortSignal: abortController.signal }),
+ createTestConfig(emit, { abortSignal: abortController.signal }),
);
await expect(runStep(createTestSession(), { message: "Hi" })).rejects.toBe(abortReason);
@@ -4636,7 +4271,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, { abortSignal: abortController.signal }),
+ createTestConfig(emit, { abortSignal: abortController.signal }),
);
await expect(runStep(createTestSession(), { message: "Hi" })).rejects.toBe(cancellation);
@@ -4761,7 +4396,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -4843,7 +4478,7 @@ describe("createToolLoopHarness", () => {
const { emit } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, { abortSignal: abortController.signal }),
+ createTestConfig(emit, { abortSignal: abortController.signal }),
);
await expect(runStep(createTestSession(), { message: "Hi" })).rejects.toBe(cancellation);
@@ -4854,7 +4489,7 @@ describe("createToolLoopHarness", () => {
setupMockAgentError(new Error("Model blew up"));
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -4911,7 +4546,7 @@ describe("createToolLoopHarness", () => {
);
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -4925,23 +4560,6 @@ describe("createToolLoopHarness", () => {
},
);
- it("rethrows a recoverable task-mode model error for durable step retry", async () => {
- setupMockAgentError(new Error("Model blew up"));
-
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
-
- await expect(runStep(createTestSession(), { message: "Delegated task" })).rejects.toThrow(
- "Model blew up",
- );
-
- const types = events.map((event) => event.type);
- expect(types).not.toContain("step.failed");
- expect(types).not.toContain("turn.failed");
- expect(types).not.toContain("session.failed");
- expect(types).not.toContain("session.waiting");
- });
-
it("parks the session on an ambiguous GatewayInternalServerError 400 model-call error", async () => {
setupMockAgentError(
createGatewayModelCallError({
@@ -4952,7 +4570,7 @@ describe("createToolLoopHarness", () => {
);
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -4995,7 +4613,7 @@ describe("createToolLoopHarness", () => {
setupMockAgentError(error);
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -5008,39 +4626,6 @@ describe("createToolLoopHarness", () => {
expect(types).not.toContain("session.waiting");
});
- it("surfaces a terminal model-call error to the parent as a failed task result", async () => {
- // Regression test for https://github.com/vercel/eve/issues/412 — a
- // delegated task-mode child whose model id does not resolve (terminal 404)
- // must report an error to its parent, not a successful empty output.
- const error = Object.assign(new Error("No endpoints found for anthropic/claude-3.5-haiku"), {
- name: "AI_APICallError",
- statusCode: 404,
- });
- setupMockAgentError(error);
-
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
- const ctx = new ContextContainer();
- setDelegatedParent(ctx);
-
- const result = await contextStorage.run(ctx, () =>
- runStep(createTestSession(), { message: "Delegated task" }),
- );
-
- // The terminal result must be marked as an error with the failure
- // message as output, matching the non-terminal task-mode failure shape.
- expect(result.next).toMatchObject({
- done: true,
- isError: true,
- output: expect.stringContaining("No endpoints found for anthropic/claude-3.5-haiku"),
- });
-
- const types = events.map((e) => e.type);
- expect(types).toContain("step.failed");
- expect(types).toContain("turn.failed");
- expect(types).toContain("session.failed");
- });
-
it("surfaces a terminal model-call error to a delegated conversation caller", async () => {
const error = Object.assign(new Error("No endpoints found for anthropic/claude-3.5-haiku"), {
name: "AI_APICallError",
@@ -5049,7 +4634,7 @@ describe("createToolLoopHarness", () => {
setupMockAgentError(error);
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const ctx = new ContextContainer();
setDelegatedParent(ctx);
@@ -5079,7 +4664,7 @@ describe("createToolLoopHarness", () => {
);
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -5297,7 +4882,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-opus-4.7"),
tools: new Map([
[
@@ -5379,7 +4963,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-opus-4.7"),
tools: new Map([
[
@@ -5449,7 +5032,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-opus-4.7"),
tools: new Map([
[
@@ -5516,7 +5098,6 @@ describe("createToolLoopHarness", () => {
});
const config: ToolLoopHarnessConfig = {
instrumentation: declaredInstrumentation,
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-opus-4.7"),
tools: new Map([
[
@@ -5604,7 +5185,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-opus-4.7"),
tools: new Map([
[
@@ -5638,7 +5218,7 @@ describe("createToolLoopHarness", () => {
setupMockAgentError(new Error("Model blew up"));
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Hi" });
// Exactly one agent construction — no recovery retry was attempted.
@@ -5726,7 +5306,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(emptyResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
try {
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -5843,7 +5423,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(emptyResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit, { tools }));
+ const runStep = createToolLoopHarness(createTestConfig(emit, { tools }));
try {
await runStep(session, { message: refreshRequest });
@@ -5918,7 +5498,7 @@ describe("createToolLoopHarness", () => {
setupMockAgentSequence([completedWrite, emptyResult, successResult]);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit, { tools }));
+ const runStep = createToolLoopHarness(createTestConfig(emit, { tools }));
try {
const first = await runStep(createTestSession(), { message: "Update the report." });
@@ -5957,7 +5537,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(emptyResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
try {
await contextStorage.run(createScheduleContext(), () =>
@@ -5985,7 +5565,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(emptyResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, "initiating");
@@ -6016,7 +5596,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(emptyResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const ctx = createScheduledUserContext();
ctx.set(TurnTaskDeliveryKey, "initiating");
@@ -6042,7 +5622,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(emptyResult, finalOutputResult("Done.", { status: "ok" }));
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
try {
await contextStorage.run(createScheduleContext(), () =>
@@ -6072,7 +5652,7 @@ describe("createToolLoopHarness", () => {
it("reissues a blank 'stop' response instead of treating it as intentional silence", async () => {
setupFirstThenAgent(emptyStopResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
try {
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -6092,7 +5672,7 @@ describe("createToolLoopHarness", () => {
setupFirstThenAgent(noOutputStreamResult, successResult);
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
try {
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -6143,7 +5723,7 @@ describe("createToolLoopHarness", () => {
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
try {
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -6173,7 +5753,7 @@ describe("createToolLoopHarness", () => {
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
try {
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -6195,36 +5775,6 @@ describe("createToolLoopHarness", () => {
errorSpy.mockRestore();
}
});
-
- it("fails a task run terminally when the reissue also comes back empty", async () => {
- setupMockAgent(emptyResult);
- const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
- const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
- const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("task", emit));
-
- try {
- const result = await runStep(createTestSession(), { message: "Hi" });
-
- expect(vi.mocked(ToolLoopAgent).mock.calls.length).toBe(2);
- // A task cannot park for a user retry; the failure is the task's
- // terminal result instead of a `next: null` park that turnWorkflow
- // would reject.
- expect(result.next).toEqual({
- done: true,
- isError: true,
- output: expect.stringContaining("did not return a response"),
- });
-
- const types = events.map((event) => event.type);
- expect(types).not.toContain("session.waiting");
- expect(types).toContain("step.failed");
- expect(types).toContain("session.failed");
- } finally {
- warnSpy.mockRestore();
- errorSpy.mockRestore();
- }
- });
});
it("does not pin gateway routing when web_search is enabled", async () => {
@@ -6243,7 +5793,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-opus-4.7"),
tools: new Map([
[
@@ -6330,7 +5879,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -6491,7 +6040,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -6586,7 +6135,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -6652,7 +6201,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -6763,7 +6312,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map([
[
"protected_action",
@@ -6860,7 +6409,7 @@ describe("createToolLoopHarness", () => {
const dispatchDynamicModelEvent = vi.fn();
const { emit } = createEventCollector();
const harness = createToolLoopHarness(
- createTestConfig("conversation", emit, { dispatchDynamicModelEvent, tools: new Map() }),
+ createTestConfig(emit, { dispatchDynamicModelEvent, tools: new Map() }),
);
await contextStorage.run(new ContextContainer(), () => harness(createTestSession()));
@@ -6924,7 +6473,7 @@ describe("createToolLoopHarness", () => {
};
const harness = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
historyProjector: ({ messages }) => messages.filter((message) => message !== hidden),
tools: new Map(),
}),
@@ -6993,9 +6542,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", undefined, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(undefined, { tools: new Map() }));
const result = await harness(createPendingBashApprovalSession(), {
inputResponses: [{ optionId: "approve", requestId: "approval-1" }],
});
@@ -7074,9 +6621,7 @@ describe("createToolLoopHarness", () => {
},
},
};
- const harness = createToolLoopHarness(
- createTestConfig("conversation", undefined, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(undefined, { tools: new Map() }));
await harness(session, {
inputResponses: [{ optionId: "approve", requestId: "approval-1" }],
@@ -7177,9 +6722,7 @@ describe("createToolLoopHarness", () => {
],
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", emit, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(emit, { tools: new Map() }));
const result = await harness(session, { message: "continue" });
@@ -7306,9 +6849,7 @@ describe("createToolLoopHarness", () => {
tools: [{ description: "Search the web", name: "web_search", inputSchema: null }],
},
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", emit, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(emit, { tools: new Map() }));
const result = await harness(session, { message: "Use web_search." });
@@ -7429,9 +6970,7 @@ describe("createToolLoopHarness", () => {
],
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", undefined, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(undefined, { tools: new Map() }));
const result = await harness(
createTestSession({
agent: {
@@ -7562,7 +7101,7 @@ describe("createToolLoopHarness", () => {
});
const harness = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
capabilities: { requestInput: true },
}),
);
@@ -7672,9 +7211,7 @@ describe("createToolLoopHarness", () => {
],
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", undefined, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(undefined, { tools: new Map() }));
const result = await harness(
createTestSession({
agent: {
@@ -7754,9 +7291,7 @@ describe("createToolLoopHarness", () => {
],
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", undefined, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(undefined, { tools: new Map() }));
const result = await harness(
createTestSession({
agent: {
@@ -7875,9 +7410,7 @@ describe("createToolLoopHarness", () => {
tools: [{ description: "Search the web", name: "web_search", inputSchema: null }],
},
});
- const harness = createToolLoopHarness(
- createTestConfig("conversation", emit, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(emit, { tools: new Map() }));
const result = await harness(session, { message: "Use web_search." });
@@ -8012,9 +7545,7 @@ describe("createToolLoopHarness", () => {
const { emit } = createEventCollector();
const session = createPendingBashApprovalSession();
- const harness = createToolLoopHarness(
- createTestConfig("conversation", emit, { tools: new Map() }),
- );
+ const harness = createToolLoopHarness(createTestConfig(emit, { tools: new Map() }));
const result = await harness(session, {
inputResponses: [{ optionId: "approve", requestId: "approval-1" }],
});
@@ -8148,7 +7679,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -8270,7 +7801,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map(),
}),
);
@@ -8306,7 +7837,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map([
[
"bash",
@@ -8478,7 +8009,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
tools: new Map([
[
"bash",
@@ -8566,7 +8097,7 @@ describe("createToolLoopHarness", () => {
};
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
tools: new Map([
[
"bash",
@@ -8770,7 +8301,7 @@ describe("createToolLoopHarness", () => {
],
},
};
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
tools: new Map([
[
"bash",
@@ -8890,7 +8421,7 @@ describe("createToolLoopHarness", () => {
},
};
- const result = await createToolLoopHarness(createTestConfig("conversation"))(wedged, {
+ const result = await createToolLoopHarness(createTestConfig())(wedged, {
message: "Are you there?",
});
@@ -8991,7 +8522,7 @@ describe("createToolLoopHarness", () => {
}),
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
tools: new Map([
[
"guarded_echo",
@@ -9078,7 +8609,7 @@ describe("createToolLoopHarness", () => {
return prepared.messages ?? [];
};
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
resolveModel: vi.fn().mockResolvedValue(
new MockLanguageModelV3({
modelId: "claude-sonnet-4-5",
@@ -9260,7 +8791,7 @@ describe("createToolLoopHarness", () => {
}),
});
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
tools: new Map([
[
"bash",
@@ -9310,141 +8841,6 @@ describe("createToolLoopHarness", () => {
expect(hasPendingInputBatch(deniedResult.session.state)).toBe(false);
});
- it.each([
- { delegated: false, label: "task" },
- { delegated: true, label: "delegated task" },
- ])(
- "defers an unrelated message behind an open approval in $label mode",
- async ({ delegated }) => {
- const { emit, events } = createEventCollector();
- const config = createTestConfig("task", emit, {
- capabilities: { requestInput: true },
- tools: new Map([
- [
- "bash",
- {
- description: "Run shell commands",
- execute: vi.fn().mockResolvedValue("ok"),
- inputSchema: jsonSchema({ type: "object" }),
- name: "bash",
- },
- ],
- ]),
- });
- const run = () =>
- createToolLoopHarness(config)(createPendingBashApprovalSession(), {
- message: "Do something unrelated.",
- });
-
- let result: Awaited<ReturnType<typeof run>>;
- if (delegated) {
- const ctx = new ContextContainer();
- setDelegatedParent(ctx);
- result = await contextStorage.run(ctx, run);
- } else {
- result = await run();
- }
-
- expect(vi.mocked(ToolLoopAgent)).not.toHaveBeenCalled();
- expect(result.next).toBeNull();
- expect(getPendingInputRequestIds(result.session.state)).toEqual(new Set(["approval-1"]));
- expect(hasDeferredStepInput(result.session)).toBe(true);
- expect(events.some((event) => event.type === "session.completed")).toBe(false);
- },
- );
-
- it.each([
- { approved: true, reply: "approve" },
- { approved: false, reply: "cancel" },
- ])(
- "resolves text $reply before replaying a deferred task message",
- async ({ approved, reply }) => {
- const generateCalls: Array<Array<{ content: unknown; role: string }>> = [];
- const agentResults = [
- {
- finishReason: "stop",
- response: { messages: [{ content: "Approval resolved.", role: "assistant" }] },
- text: "Approval resolved.",
- toolCalls: [],
- toolResults: [],
- },
- {
- finishReason: "stop",
- response: { messages: [{ content: "Task complete.", role: "assistant" }] },
- text: "Task complete.",
- toolCalls: [],
- toolResults: [],
- },
- ] satisfies Record<string, unknown>[];
- let resultIndex = 0;
- vi.mocked(ToolLoopAgent).mockImplementation(function (
- this: MockAgentInstance,
- settings: MockAgentSettings,
- ) {
- const result = agentResults[resultIndex++];
- if (result === undefined) throw new Error("ToolLoopAgent mock exhausted its results.");
- const { onStepEnd, prepareStep } = settings;
- this.generate = vi.fn().mockImplementation(async (input: { messages: unknown[] }) => {
- if (prepareStep) {
- await prepareStep({
- context: undefined,
- messages: input.messages,
- model: {},
- stepNumber: 0,
- steps: [],
- });
- }
- generateCalls.push(input.messages as Array<{ content: unknown; role: string }>);
- if (onStepEnd) await onStepEnd(result);
- return createMockGenerateResult(result);
- });
- return this;
- } as MockAgentConstructor);
-
- const config = createTestConfig("task", undefined, {
- capabilities: { requestInput: true },
- tools: new Map([
- [
- "bash",
- {
- description: "Run shell commands",
- execute: vi.fn().mockResolvedValue("ok"),
- inputSchema: jsonSchema({ type: "object" }),
- name: "bash",
- },
- ],
- ]),
- });
- const harness = createToolLoopHarness(config);
- const deferred = await harness(createPendingBashApprovalSession(), {
- message: "Do something unrelated.",
- });
-
- const resolved = await harness(deferred.session, { message: reply });
-
- expect(generateCalls).toHaveLength(1);
- const approvalMessage = generateCalls[0]?.at(-1);
- expect(approvalMessage?.role).toBe("tool");
- expect(approvalMessage?.content).toEqual(
- expect.arrayContaining([expect.objectContaining({ approvalId: "approval-1", approved })]),
- );
- expect(hasPendingInputBatch(resolved.session.state)).toBe(false);
- expect(hasDeferredStepInput(resolved.session)).toBe(true);
- expect(typeof resolved.next).toBe("function");
- if (typeof resolved.next !== "function") throw new Error("Expected deferred replay step.");
-
- const completed = await resolved.next(resolved.session);
-
- expect(generateCalls).toHaveLength(2);
- expect(generateCalls[1]?.at(-1)).toEqual({
- content: "Do something unrelated.",
- kind: "user" as const,
- role: "user",
- });
- expect(completed.next).toEqual({ done: true, output: "Task complete." });
- },
- );
-
it("emits compaction.requested and compaction.completed when compaction triggers", async () => {
vi.mocked(shouldCompact).mockReturnValue(true);
vi.mocked(compactMessages).mockResolvedValue([
@@ -9463,7 +8859,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
resolveModel: vi
.fn()
.mockResolvedValue({ modelId: "gpt-4", provider: "openai" } as LanguageModel),
@@ -9558,7 +8954,7 @@ describe("createToolLoopHarness", () => {
if (event.type === "step.started") stepViews.push(messages ?? []);
};
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
dispatchDynamicModelEvent: async ({ messages }) => {
preCompactionModelViews.push(messages);
},
@@ -9594,7 +8990,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const resolveModel = vi.fn();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
clearOnly: true,
resolveModel,
}),
@@ -9657,7 +9053,7 @@ describe("createToolLoopHarness", () => {
role: "user" as const,
};
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
compactOnly: true,
historyProjector: ({ messages }) => messages.filter((message) => message !== hidden),
resolveModel: vi
@@ -9703,7 +9099,7 @@ describe("createToolLoopHarness", () => {
it("returns an empty session to its waiting boundary after manual compaction", async () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
compactOnly: true,
}),
);
@@ -9723,7 +9119,7 @@ describe("createToolLoopHarness", () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
compactOnly: true,
resolveModel: vi
.fn()
@@ -9747,7 +9143,7 @@ describe("createToolLoopHarness", () => {
it("returns a failed manual model resolution to its waiting boundary", async () => {
const { emit, events } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
compactOnly: true,
resolveModel: vi.fn().mockRejectedValueOnce(new Error("model unavailable")),
}),
@@ -9782,7 +9178,7 @@ describe("createToolLoopHarness", () => {
});
const config: ToolLoopHarnessConfig = {
- ...createTestConfig("conversation"),
+ ...createTestConfig(),
resolveModel: vi.fn().mockImplementation(
async (reference) =>
({
@@ -9852,7 +9248,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Hi" });
@@ -9906,7 +9302,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "Hi" });
@@ -9969,7 +9365,7 @@ describe("createToolLoopHarness", () => {
},
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const result = await runStep(createTestSession(), { message: "Hi" });
@@ -10002,7 +9398,7 @@ describe("createToolLoopHarness", () => {
toolResults: [{ toolCallId: "call-1", toolName: "add", output: "42" }],
});
- const step1Harness = createToolLoopHarness(createTestConfig("conversation"));
+ const step1Harness = createToolLoopHarness(createTestConfig());
const result1 = await step1Harness(createTestSession(), { message: "add stuff" });
expect(result1.next).toBe(step1Harness);
expect(result1.session.history.at(-1)).toMatchObject({ role: "tool" });
@@ -10017,7 +9413,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const step2Harness = createToolLoopHarness(createTestConfig("conversation"));
+ const step2Harness = createToolLoopHarness(createTestConfig());
const result2 = await step2Harness(result1.session);
expect(result2.next).toBeNull();
expect(result2.session.history.at(-1)).toMatchObject({
@@ -10044,7 +9440,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const step3Harness = createToolLoopHarness(createTestConfig("conversation"));
+ const step3Harness = createToolLoopHarness(createTestConfig());
await step3Harness(result2.session, {});
// Verify the model received the continuation user message, not the
@@ -10214,7 +9610,7 @@ describe("createToolLoopHarness", () => {
},
],
]);
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
tools,
});
@@ -10325,7 +9721,7 @@ describe("createToolLoopHarness", () => {
},
});
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
resolveModel: vi.fn().mockResolvedValue("openai/gpt-5.6-sol"),
}),
);
@@ -10366,7 +9762,6 @@ describe("createToolLoopHarness", () => {
it("gateway-auto path: merges gateway.caching='auto' into providerOptions for string model ids", async () => {
setupStopResult();
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
tools: new Map([
[
@@ -10413,7 +9808,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
tools: new Map([
[
@@ -10460,7 +9854,6 @@ describe("createToolLoopHarness", () => {
},
});
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
tools: new Map([
[
@@ -10497,7 +9890,6 @@ describe("createToolLoopHarness", () => {
it("anthropic-direct path: marks the last tool without dropping approval", async () => {
setupStopResult();
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue({
provider: "anthropic.messages",
modelId: "claude-sonnet-4-5",
@@ -10562,7 +9954,6 @@ describe("createToolLoopHarness", () => {
it("anthropic-direct path: prepareStep marks last user and last assistant messages", async () => {
setupStopResult();
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue({
provider: "anthropic.messages",
modelId: "claude-sonnet-4-5",
@@ -10621,7 +10012,6 @@ describe("createToolLoopHarness", () => {
it("none path: direct OpenAI instance gets no caching changes", async () => {
setupStopResult();
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue({
provider: "openai.chat",
modelId: "gpt-5",
@@ -10689,7 +10079,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "hi" });
const stepCompleted = events.find((e) => e.type === "step.completed");
@@ -10715,7 +10105,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "hi" });
const stepCompleted = events.find((e) => e.type === "step.completed");
@@ -10738,7 +10128,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
await runStep(createTestSession(), { message: "hi" });
const stepCompleted = events.find((e) => e.type === "step.completed");
@@ -10766,7 +10156,6 @@ describe("createToolLoopHarness", () => {
process.env.VERCEL_PROJECT_PRODUCTION_URL = "my-agent.vercel.app";
try {
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
runtimeIdentity: {
agentId: "weather-agent",
@@ -10801,7 +10190,6 @@ describe("createToolLoopHarness", () => {
delete process.env.VERCEL_URL;
try {
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
runtimeIdentity: {
agentId: "weather-agent",
@@ -10835,7 +10223,6 @@ describe("createToolLoopHarness", () => {
process.env.VERCEL_URL = "preview-123.vercel.app";
try {
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
runtimeIdentity: {
agentId: "my-agent",
@@ -10868,7 +10255,6 @@ describe("createToolLoopHarness", () => {
it("does not set attribution headers for non-gateway model objects", async () => {
setupStopResultForAttribution();
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue({
provider: "anthropic.messages",
modelId: "claude-sonnet-4-5-20250514",
@@ -10891,7 +10277,6 @@ describe("createToolLoopHarness", () => {
it("sets the eve user-agent for explicit Gateway model objects", async () => {
setupStopResultForAttribution();
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue(
new MockLanguageModelV3({
provider: "gateway.language-model",
@@ -10917,7 +10302,6 @@ describe("createToolLoopHarness", () => {
delete process.env.VERCEL_URL;
try {
const config: ToolLoopHarnessConfig = {
- mode: "conversation",
resolveModel: vi.fn().mockResolvedValue("anthropic/claude-sonnet-4-5"),
tools: new Map(),
};
@@ -10952,7 +10336,6 @@ describe("createToolLoopHarness", () => {
const { emit } = createEventCollector();
const config: ToolLoopHarnessConfig = {
handleEvent: emit,
- mode: "conversation",
resolveModel: vi.fn().mockImplementation(async (reference) =>
reference.id === "compaction-model"
? "anthropic/claude-sonnet-4-5"
@@ -11023,7 +10406,7 @@ describe("createToolLoopHarness", () => {
});
declareTelemetry({ tracePolicy: () => true });
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const result = await runStep(createTestSession(), { message: "add stuff" });
declareTelemetry(undefined);
@@ -11058,7 +10441,7 @@ describe("createToolLoopHarness", () => {
toolResults: [{ toolCallId: "call-1", toolName: "add", output: "42" }],
});
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const result = await runStep(createTestSession(), { message: "add stuff" });
@@ -11090,7 +10473,7 @@ describe("createToolLoopHarness", () => {
});
declareTelemetry({ tracePolicy: () => true });
- const step1Config = createTestConfig("conversation");
+ const step1Config = createTestConfig();
const step1 = createToolLoopHarness(step1Config);
const result1 = await step1(createTestSession(), { message: "add stuff" });
@@ -11114,7 +10497,7 @@ describe("createToolLoopHarness", () => {
toolResults: [],
});
- const step2Config = createTestConfig("conversation");
+ const step2Config = createTestConfig();
const step2 = createToolLoopHarness(step2Config);
// No input — continuation step
const result2 = await step2(result1.session);
@@ -11157,7 +10540,7 @@ describe("createToolLoopHarness", () => {
registeredAuthorIntegration,
]);
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
instrumentation: declaredInstrumentation,
}),
);
@@ -11235,7 +10618,7 @@ describe("createToolLoopHarness", () => {
},
]);
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
instrumentation: bindHookInstrumentation(hooks, undefined, true),
}),
);
@@ -11278,7 +10661,7 @@ describe("createToolLoopHarness", () => {
},
]);
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
instrumentation: bindHookInstrumentation(hooks, undefined, true),
}),
);
@@ -11435,7 +10818,7 @@ describe("createToolLoopHarness", () => {
const events: UnstampedMessageStreamEvent[] = [];
declareTelemetry({ tracePolicy: () => true });
const runStep = createToolLoopHarness(
- createTestConfig("conversation", async (event) => {
+ createTestConfig(async (event) => {
events.push(event);
}),
);
@@ -11464,7 +10847,7 @@ describe("createToolLoopHarness", () => {
});
declareTelemetry({ runtimeContext: () => undefined, tracePolicy: () => true });
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
await runStep(createTestSession(), { message: "hi" });
declareTelemetry(undefined);
@@ -11500,7 +10883,7 @@ describe("createToolLoopHarness", () => {
{ events: { "step.attempt.completed": attemptCompleted }, name: "attempt" },
]);
const runInContext: InstrumentationContextRunner = (_operation, execute) => execute();
- const config = createTestConfig("conversation", undefined, {
+ const config = createTestConfig(undefined, {
instrumentation: bindHookInstrumentation(hooks, runInContext),
});
@@ -11580,7 +10963,7 @@ describe("createToolLoopHarness", () => {
]);
const { emit } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
instrumentation: bindHookInstrumentation(hooks),
tools: createDelegationToolMap(),
}),
@@ -11614,7 +10997,7 @@ describe("createToolLoopHarness", () => {
registeredAuthorIntegration,
]);
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
instrumentation: declaredInstrumentation,
}),
);
@@ -11648,7 +11031,7 @@ describe("createToolLoopHarness", () => {
});
declareTelemetry({ recordInputs: true, recordOutputs: true });
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
await runStep(createTestSession(), { message: "hi" });
const agentCall = vi.mocked(ToolLoopAgent).mock.calls[0]?.[0] as {
@@ -11679,7 +11062,7 @@ describe("createToolLoopHarness", () => {
"development",
);
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
await runStep(createTestSession(), { message: "hi" });
const agentCall = vi.mocked(ToolLoopAgent).mock.calls[0]?.[0] as {
@@ -11738,7 +11121,7 @@ describe("createToolLoopHarness", () => {
kind: "user" as const,
role: "user" as const,
};
- const config = createTestConfig("conversation", emit, {
+ const config = createTestConfig(emit, {
historyProjector: ({ messages }) => messages.filter((message) => message !== hidden),
});
const runStep = createToolLoopHarness(config);
@@ -11801,7 +11184,7 @@ describe("createToolLoopHarness", () => {
});
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession(), { message: "hi" });
expect(result.next).toBeNull();
@@ -11833,7 +11216,7 @@ describe("createToolLoopHarness", () => {
});
const { emit } = createEventCollector();
- const config = createTestConfig("conversation", emit);
+ const config = createTestConfig(emit);
const session = createTestSession();
setupMockAgent({
@@ -11941,7 +11324,7 @@ describe("createToolLoopHarness", () => {
const ctx = new ContextContainer();
ctx.set(SandboxKey, sandbox.access);
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -12013,7 +11396,7 @@ describe("createToolLoopHarness", () => {
const ctx = new ContextContainer();
ctx.set(SandboxKey, sandbox.access);
- const config = createTestConfig("conversation");
+ const config = createTestConfig();
const runStep = createToolLoopHarness(config);
const session = createTestSession();
@@ -12093,7 +11476,7 @@ describe("createToolLoopHarness", () => {
it("appends durable channel context as user messages", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession();
await runStep(session, {
@@ -12109,7 +11492,7 @@ describe("createToolLoopHarness", () => {
it("routes role:system durable history into instructions, not messages", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession({
history: [{ role: "system", content: "durable-system" }],
});
@@ -12127,7 +11510,7 @@ describe("createToolLoopHarness", () => {
it("persists context strings in session history as user messages", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession();
const result = await runStep(session, {
@@ -12144,7 +11527,7 @@ describe("createToolLoopHarness", () => {
it("does not replay ephemeral client context on later turns", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
let session = createTestSession();
for (const token of ["CTX-A", "CTX-B", "CTX-C"]) {
@@ -12208,7 +11591,7 @@ describe("createToolLoopHarness", () => {
},
],
});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const clientContext = "Client context:\nroute=/billing";
const firstStep = await runStep(
@@ -12286,7 +11669,7 @@ describe("createToolLoopHarness", () => {
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, "initiating");
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
historyProjector:
scenario === "projected history"
? ({ messages }) =>
@@ -12350,7 +11733,7 @@ describe("createToolLoopHarness", () => {
const ctx = new ContextContainer();
ctx.set(PendingSkillAnnouncementKey, "Available skills\n- policy: Tenant policy");
const { emit } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
setupMockAgentError(new Error("Model unavailable"));
const failed = await contextStorage.run(ctx, () =>
@@ -12382,7 +11765,7 @@ describe("createToolLoopHarness", () => {
ctx.set(PendingSkillAnnouncementKey, "Available skills\n- policy: Tenant policy");
const failure = new Error("Failed to finish the turn");
const runStep = createToolLoopHarness(
- createTestConfig("conversation", async (event) => {
+ createTestConfig(async (event) => {
if (event.type === "session.waiting") throw failure;
}),
);
@@ -12415,7 +11798,7 @@ describe("createToolLoopHarness", () => {
});
const { emit } = createEventCollector();
const runStep = createToolLoopHarness(
- createTestConfig("conversation", emit, {
+ createTestConfig(emit, {
resolveModel: vi.fn().mockResolvedValue({ modelId: "test-model", provider: "openai" }),
}),
);
@@ -12458,7 +11841,7 @@ describe("createToolLoopHarness", () => {
const taskState = analysisTaskAnnouncement;
ctx.set(PendingSkillAnnouncementKey, availableSkills);
ctx.set(TurnTaskDeliveryKey, "initiating");
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
setupMockAgent(defaultModelResult());
const first = await contextStorage.run(ctx, () =>
runStep(recordBackgroundTask(createTestSession()), { message: "Check progress." }),
@@ -12478,7 +11861,7 @@ describe("createToolLoopHarness", () => {
vi.mocked(shouldCompact).mockReturnValueOnce(true);
} else {
const replaceHistory = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
clearOnly: replacement === "clear",
compactOnly: replacement === "manual compaction",
}),
@@ -12503,7 +11886,7 @@ describe("createToolLoopHarness", () => {
it("skips empty skill announcements without rewriting earlier history", async () => {
const ctx = new ContextContainer();
ctx.set(PendingSkillAnnouncementKey, "Available skills\n- policy: Tenant policy");
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
setupMockAgent(defaultModelResult());
const first = await contextStorage.run(ctx, () =>
runStep(createTestSession(), { message: "Check the policy." }),
@@ -12529,7 +11912,7 @@ describe("createToolLoopHarness", () => {
...defaultModelResult(),
usage: { inputTokens: 321 },
});
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession({
history: [{ content: "earlier", kind: "user" as const, role: "user" }],
});
@@ -12564,7 +11947,7 @@ describe("createToolLoopHarness", () => {
it("leaves instructions unchanged when no context is provided", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession();
await runStep(session, { message: "Hi" });
@@ -12573,48 +11956,32 @@ describe("createToolLoopHarness", () => {
expect(instructions).toBe("You are a test assistant.");
});
- it.each(["conversation", "task"] as const)(
- "adds conditional-delivery guidance to a top-level scheduled %s turn",
- async (mode) => {
- setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig(mode));
-
- await contextStorage.run(createScheduleContext(), () =>
- runStep(createTestSession(), { message: "Check for alerts." }),
- );
-
- const { instructions, messages } = getLastAgentSettings();
- expect(instructions).toBe("You are a test assistant.");
- expect(messages).toContainEqual({
- role: "user",
- content: CONDITIONAL_DELIVERY_INSTRUCTION,
- kind: "context.instruction",
- });
- },
- );
-
- it.each(["conversation", "task"] as const)(
- "does not add conditional-delivery guidance when a scheduled %s turn has an output schema",
- async (mode) => {
- setupMockAgent(finalOutputResult("Done.", { status: "ok" }));
- const runStep = createToolLoopHarness(createTestConfig(mode));
+ it("adds conditional-delivery guidance to a top-level scheduled turn", async () => {
+ setupMockAgent(defaultModelResult());
+ const runStep = createToolLoopHarness(createTestConfig());
- await contextStorage.run(createScheduleContext(), () =>
- runStep(createTestSession({ outputSchema: { type: "object" } }), {
- message: "Check for alerts.",
- }),
- );
+ await contextStorage.run(createScheduleContext(), () =>
+ runStep(createTestSession(), { message: "Check for alerts." }),
+ );
- const { instructions } = getLastAgentSettings();
- expect(instructions).toBe("You are a test assistant.");
- },
- );
+ const { instructions, messages } = getLastAgentSettings();
+ expect(instructions).toBe("You are a test assistant.");
+ expect(messages).toContainEqual({
+ role: "user",
+ content: CONDITIONAL_DELIVERY_INSTRUCTION,
+ kind: "context.instruction",
+ });
+ });
- it("does not add conditional-delivery guidance to an ordinary task run", async () => {
- setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("task"));
+ it("does not add conditional-delivery guidance when a scheduled turn has an output schema", async () => {
+ setupMockAgent(finalOutputResult("Done.", { status: "ok" }));
+ const runStep = createToolLoopHarness(createTestConfig());
- await runStep(createTestSession(), { message: "Run this task." });
+ await contextStorage.run(createScheduleContext(), () =>
+ runStep(createTestSession({ outputSchema: { type: "object" } }), {
+ message: "Check for alerts.",
+ }),
+ );
const { instructions } = getLastAgentSettings();
expect(instructions).toBe("You are a test assistant.");
@@ -12622,7 +11989,7 @@ describe("createToolLoopHarness", () => {
it("adds initiating task-reporting guidance without enabling silent delivery", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, "initiating");
@@ -12646,7 +12013,7 @@ describe("createToolLoopHarness", () => {
it("routes later-turn initiating task context through user messages", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = new ContextContainer();
const taskState = analysisTaskAnnouncement;
ctx.set(TurnTaskDeliveryKey, "initiating");
@@ -12681,10 +12048,9 @@ describe("createToolLoopHarness", () => {
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, phase);
await contextStorage.run(ctx, () =>
- createToolLoopHarness(createTestConfig("conversation"))(
- recordBackgroundTask(createTestSession()),
- { message: "Check progress." },
- ),
+ createToolLoopHarness(createTestConfig())(recordBackgroundTask(createTestSession()), {
+ message: "Check progress.",
+ }),
);
expect(getLastAgentSettings().messages).not.toContainEqual({
kind: "user" as const,
@@ -12697,7 +12063,7 @@ describe("createToolLoopHarness", () => {
it("keeps a scheduled initiating task turn conditionally deliverable", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = createScheduledUserContext();
ctx.set(TurnTaskDeliveryKey, "initiating");
@@ -12716,7 +12082,7 @@ describe("createToolLoopHarness", () => {
it("does not apply session schedule provenance to a later human turn", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = createScheduledUserContext();
const session = setHarnessEmissionState(createTestSession(), {
sequence: 1,
@@ -12732,7 +12098,7 @@ describe("createToolLoopHarness", () => {
it("does not inject or retain silence guidance after a pending task wake", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, "pending");
const session = setHarnessEmissionState(createTestSession(), {
@@ -12784,7 +12150,7 @@ describe("createToolLoopHarness", () => {
ctx.set(TurnTaskDeliveryKey, phase);
ctx.set(TaskDeliveryPolicyKey, "auto");
const { emit, events } = createEventCollector();
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await contextStorage.run(ctx, () =>
runStep(
createTestSession(),
@@ -12812,7 +12178,7 @@ describe("createToolLoopHarness", () => {
it("adds settled task-delivery guidance to a top-level framework wake", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, "settled");
const session = setHarnessEmissionState(createTestSession(), {
@@ -12850,7 +12216,7 @@ describe("createToolLoopHarness", () => {
it("does not add conditional-delivery guidance to a task-owned conversation child", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const ctx = new ContextContainer();
ctx.set(TurnTaskDeliveryKey, "pending");
setDelegatedParent(ctx);
@@ -12865,7 +12231,7 @@ describe("createToolLoopHarness", () => {
it("routes dynamic instruction messages from durable keys into instructions", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession();
const ctx = new ContextContainer();
@@ -12923,7 +12289,7 @@ describe("createToolLoopHarness", () => {
role: "user" as const,
};
const runStep = createToolLoopHarness(
- createTestConfig("conversation", handleEvent, {
+ createTestConfig(handleEvent, {
historyProjector: ({ messages }) => messages.filter((message) => message !== hidden),
}),
);
@@ -12954,7 +12320,7 @@ describe("createToolLoopHarness", () => {
it("preserves the Anthropic system cache breakpoint when merging instructions", async () => {
setupMockAgent(defaultModelResult());
const runStep = createToolLoopHarness(
- createTestConfig("conversation", undefined, {
+ createTestConfig(undefined, {
resolveModel: vi.fn().mockResolvedValue(
new MockLanguageModelV3({
modelId: "claude-sonnet-4-5",
@@ -12983,7 +12349,7 @@ describe("createToolLoopHarness", () => {
it("does not persist dynamic instruction messages to session history", async () => {
setupMockAgent(defaultModelResult());
- const runStep = createToolLoopHarness(createTestConfig("conversation"));
+ const runStep = createToolLoopHarness(createTestConfig());
const session = createTestSession();
const ctx = new ContextContainer();
@@ -13021,7 +12387,7 @@ describe("createToolLoopHarness", () => {
toolCalls: [],
toolResults: [],
});
- await createToolLoopHarness(createTestConfig("conversation"))(createTestSession(), {
+ await createToolLoopHarness(createTestConfig())(createTestSession(), {
message: "Hi",
});
}
@@ -13194,7 +12560,7 @@ describe("boundary event failures", () => {
if (denied && event.type === boundary)
throw new BoundaryHookError(new Error("admission denied"));
};
- const runStep = createToolLoopHarness(createTestConfig("conversation", emit));
+ const runStep = createToolLoopHarness(createTestConfig(emit));
const result = await runStep(createTestSession({ outputSchema: { type: "object" } }), {
message: "Denied request",
});
@@ -13249,7 +12615,7 @@ describe("boundary event failures", () => {
stepIndex: 3,
turnId: "turn_2",
});
- const result = await createToolLoopHarness(createTestConfig("conversation", emit))(session);
+ const result = await createToolLoopHarness(createTestConfig(emit))(session);
expect(result.next).toBeNull();
expect(events[1]).toMatchObject({
type: "step.failed",
@@ -13264,31 +12630,19 @@ describe("boundary event failures", () => {
if (event.type === "turn.failed") throw new Error("failure handler failed");
};
await expect(
- createToolLoopHarness(createTestConfig("conversation", emit))(createTestSession(), {
+ createToolLoopHarness(createTestConfig(emit))(createTestSession(), {
message: "Hi",
}),
).rejects.toThrow("failure handler failed");
});
- it("keeps task failures terminal", async () => {
- const events: UnstampedMessageStreamEvent[] = [];
- const emit: HarnessEmitFn = async (event) => {
- events.push(event);
- if (event.type === "turn.started") throw new BoundaryHookError(new Error("task denied"));
- };
- await expect(
- createToolLoopHarness(createTestConfig("task", emit))(createTestSession(), { message: "Hi" }),
- ).rejects.toThrow("task denied");
- expect(events.map((event) => event.type)).not.toContain("session.waiting");
- });
-
it("keeps runtime preamble failures terminal", async () => {
const failure = new Error("memory recall failed");
const emit: HarnessEmitFn = async (event) => {
if (event.type === "turn.started") throw failure;
};
await expect(
- createToolLoopHarness(createTestConfig("conversation", emit))(createTestSession(), {
+ createToolLoopHarness(createTestConfig(emit))(createTestSession(), {
message: "Hi",
}),
).rejects.toBe(failure);
@@ -13300,7 +12654,7 @@ describe("boundary event failures", () => {
throw cancellation;
};
await expect(
- createToolLoopHarness(createTestConfig("conversation", emit))(createTestSession(), {
+ createToolLoopHarness(createTestConfig(emit))(createTestSession(), {
message: "Hi",
}),
).rejects.toBe(cancellation);
diff --git a/packages/eve/src/harness/tool-loop.ts b/packages/eve/src/harness/tool-loop.ts
index c347d2b05..adde8fe1d 100644
--- a/packages/eve/src/harness/tool-loop.ts
+++ b/packages/eve/src/harness/tool-loop.ts
@@ -86,7 +86,6 @@ import {
shouldCompact,
} from "#harness/compaction.js";
import { createCurrentMessages } from "#harness/current-messages.js";
-import { getBackgroundTasks } from "#harness/workflow-tool-runs.js";
import { estimateTokens } from "#harness/token-estimate.js";
import {
accumulateTurnUsage,
@@ -136,7 +135,6 @@ import {
getApprovedTools,
getPendingInputRequestIds,
hasRunnableDeferredStepInput,
- hasPendingApprovalBatch,
hasStepInput,
resolvePendingInput,
selectApprovalReplayBatch,
@@ -226,7 +224,6 @@ import {
import { buildFinalOutputTool, FINAL_OUTPUT_TOOL_NAME } from "#harness/final-output.js";
import { toModelSchema } from "#tools/schema.js";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
-import type { RunMode } from "#shared/run-mode.js";
import { createHistoryViewPreparer, type HistoryViewProjector } from "#shared/history-view.js";
import {
canonicalizeMemoryRecords,
@@ -546,10 +543,9 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
});
return {
- next:
- config.mode === "task" || hasDelegatedCaller
- ? { done: true, isError: true, output: message }
- : { done: true, output: "" },
+ next: hasDelegatedCaller
+ ? { done: true, isError: true, output: message }
+ : { done: true, output: "" },
session,
};
};
@@ -560,7 +556,7 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
throwIfTurnAborted(config.abortSignal);
if (isTurnCancellation(error)) throw error;
if (isDynamicModelSelectionError(error)) return failModelSelection(error, failureState);
- if (!emit || config.mode !== "conversation" || !(error instanceof BoundaryHookError)) {
+ if (!emit || !(error instanceof BoundaryHookError)) {
throw error;
}
@@ -652,12 +648,7 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
// Resolve deferred input, task/control coordination, then HITL input; each stage
// may park when its resume payload has not arrived.
- const stepInput = consumeDeferredStepInput({
- input,
- preferCurrentInput:
- config.mode !== "conversation" && input !== undefined && hasPendingApprovalBatch(session),
- session,
- });
+ const stepInput = consumeDeferredStepInput({ input, session });
session = stepInput.session;
const pendingCoordination = getPendingCoordinationBatch(session.state);
@@ -883,7 +874,6 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
replayBatch === undefined ? config.tools : await prepareApprovalTools(replayBatch);
const pending = resolvePendingInput({
activeTurnId: pendingCoordination?.event.turnId ?? activeTurnId(emissionState),
- deferMessagesWhileApprovalsPending: config.mode !== "conversation",
history: resolvedCoordination.messages,
internalStep: !isHarnessBetweenTurns(session),
resolveApprovalKey: resolveApprovalKeyFromTools(responseAuthorizationTools),
@@ -901,12 +891,7 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
}
: pending.session;
- if (
- emit &&
- config.mode === "conversation" &&
- pending.deferredMessage === true &&
- hasStepInput(input)
- ) {
+ if (emit && pending.deferredMessage === true && hasStepInput(input)) {
const deferredInput = createTurnInputMessages(effectiveStepInput);
if (store !== undefined) {
prepareDynamicInstructionPreamble(
@@ -962,7 +947,7 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
]),
state: memoryCommit?.state ?? parkedSession.state,
};
- emissionState = await emitTurnEpilogue(emit, emissionState, config.mode);
+ emissionState = await emitTurnEpilogue(emit, emissionState);
return {
next: null,
session: setHarnessEmissionState(parkedSession, emissionState),
@@ -970,8 +955,8 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
}
if (resolvedCoordination.outcome === "resolved") {
- if (emit && config.mode === "conversation") {
- emissionState = await emitTurnEpilogue(emit, emissionState, config.mode);
+ if (emit) {
+ emissionState = await emitTurnEpilogue(emit, emissionState);
parkedSession = setHarnessEmissionState(parkedSession, emissionState);
}
return { next: null, session: parkedSession };
@@ -979,7 +964,6 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
if (
coordinated.kind === "responses-completed" &&
- config.mode === "conversation" &&
isHarnessBetweenTurns(pending.session) &&
getPendingAuthorization(pending.session.state) === undefined
) {
@@ -1969,49 +1953,9 @@ export function createToolLoopHarness(config: ToolLoopHarnessConfig): StepFn {
// failed `subagent-result`; top-level conversation failures already
// emit `session.failed` here.
return {
- next:
- config.mode === "task" || hasDelegatedCaller
- ? { done: true, isError: true, output: taskFailureOutput }
- : { done: true, output: "" },
- session,
- };
- }
-
- if (config.mode === "task") {
- if (
- classification === "recoverable" &&
- !(finalError instanceof EmptyModelResponseError) &&
- !(finalError instanceof ContentFilteredModelResponseError)
- ) {
- // Task runs cannot park for user-driven recovery. Let the durable
- // step retry from committed session state, but only for errors
- // that did not already consume the in-process transient budget or
- // the dedicated empty-response reissue. Filtering is an explicit
- // rejection, so it must not receive durable retries either.
- log.warn(
- upstreamRejection?.message ??
- "model call failed recoverably in task mode — rethrowing for durable step retry",
- modelCallLogFields,
- );
- throw finalError;
- }
-
- // A task run cannot park for a user retry (turnWorkflow rejects
- // `next: null` in task mode). Classified transient errors arrive
- // here only after their bounded in-process retries are exhausted;
- // empty responses already received their specialized reissue.
- log.error(
- upstreamRejection?.message ?? "model call failed; failing the task run",
- modelCallLogFields,
- );
- await emitFailedStep(emit, emissionState, {
- code: "MODEL_CALL_FAILED",
- details,
- message: errorMessage,
- sessionId: session.sessionId,
- });
- return {
- next: { done: true, isError: true, output: taskFailureOutput },
+ next: hasDelegatedCaller
+ ? { done: true, isError: true, output: taskFailureOutput }
+ : { done: true, output: "" },
session,
};
}
@@ -2857,10 +2801,8 @@ async function handleStepResult(input: {
}),
);
- if (config.mode === "conversation") {
- emissionState = await emitTurnEpilogue(emit, emissionState, config.mode);
- parkedSession = setHarnessEmissionState(parkedSession, emissionState);
- }
+ emissionState = await emitTurnEpilogue(emit, emissionState);
+ parkedSession = setHarnessEmissionState(parkedSession, emissionState);
}
return {
@@ -2915,9 +2857,7 @@ async function handleStepResult(input: {
// above: the session keeps serving ordinary turns while the challenge
// is open, so the stream must close its turn boundary — clients wait
// on `session.waiting` and would otherwise hang on the parked turn.
- if (config.mode === "conversation") {
- emissionState = await emitTurnEpilogue(emit, emissionState, config.mode);
- }
+ emissionState = await emitTurnEpilogue(emit, emissionState);
}
return {
@@ -2966,35 +2906,7 @@ async function handleStepResult(input: {
return { next: runStep, session: nextSession };
}
- if (
- config.mode === "task" &&
- (getBackgroundTasks(nextSession.state).query({ state: "working" }).length > 0 ||
- contextStorage.getStore()?.get(BackgroundToolExecutorKey)?.hasPendingTasks?.() === true)
- ) {
- return deferTaskTurn({
- emissionState,
- emit,
- history: promptMessages,
- result,
- schema: nextSession.outputSchema,
- session: nextSession,
- stepOutput,
- });
- }
-
- if (config.mode === "task") {
- return finishTaskTurn({
- emissionState,
- emit,
- history: promptMessages,
- result,
- schema: nextSession.outputSchema,
- session: nextSession,
- stepOutput,
- });
- }
-
- return finishConversationTurn({
+ return finishTurn({
emissionState,
emit,
history: promptMessages,
@@ -3005,37 +2917,6 @@ async function handleStepResult(input: {
});
}
-/** Keeps a task session open until its background work settles. */
-async function deferTaskTurn(input: {
- readonly emissionState: ReturnType<typeof getHarnessEmissionState>;
- readonly emit?: ToolLoopHarnessConfig["handleEvent"];
- readonly history: readonly HarnessModelMessage[];
- readonly result: HarnessStepResult;
- readonly schema: JsonObject | undefined;
- readonly session: HarnessSession;
- readonly stepOutput: string | null;
-}): Promise<StepResult> {
- const { emit, history, result, schema, stepOutput } = input;
- let { emissionState, session } = input;
- session = clearTurnClientContextState(session);
- const structured = schema === undefined ? undefined : extractFinalOutput(result);
- if (structured !== undefined) {
- session = {
- ...persistStructuredAssistantTurn(session, history, structured),
- outputSchema: schema,
- };
- }
- if (emit) {
- emissionState = await emitTurnEpilogue(emit, emissionState, "conversation");
- session = setHarnessEmissionState(session, emissionState);
- }
- return {
- next: null,
- session,
- settledTurn: { output: structured ?? stepOutput ?? "" },
- };
-}
-
function isDeferredHarnessTool(tool: HarnessToolDefinition | undefined): boolean {
return (
tool?.runtimeAction !== undefined ||
@@ -3075,12 +2956,11 @@ function persistStructuredAssistantTurn(
};
}
-/** Emits `result.completed` followed by the turn epilogue for `mode`. */
+/** Emits `result.completed` followed by the turn epilogue. */
async function emitStructuredResult(
emit: NonNullable<ToolLoopHarnessConfig["handleEvent"]>,
emissionState: ReturnType<typeof getHarnessEmissionState>,
structured: JsonValue,
- mode: RunMode,
): Promise<ReturnType<typeof getHarnessEmissionState>> {
await emit(
createResultCompletedEvent({
@@ -3090,65 +2970,15 @@ async function emitStructuredResult(
turnId: emissionState.turnId,
}),
);
- return emitTurnEpilogue(emit, emissionState, mode);
-}
-
-/**
- * Closes a terminal task turn. Task runs cannot park, so an unmet output
- * schema fails as an error a delegating parent can surface; otherwise the
- * structured value — or the plain assistant text — is the run's output.
- */
-async function finishTaskTurn(input: {
- readonly emissionState: ReturnType<typeof getHarnessEmissionState>;
- readonly emit?: ToolLoopHarnessConfig["handleEvent"];
- readonly history: readonly HarnessModelMessage[];
- readonly result: HarnessStepResult;
- readonly schema: JsonObject | undefined;
- readonly session: HarnessSession;
- readonly stepOutput: string | null;
-}): Promise<StepResult> {
- const { emit, history, result, schema, stepOutput } = input;
- let { emissionState, session } = input;
- session = clearTurnClientContextState(session);
-
- if (schema === undefined) {
- if (emit) {
- emissionState = await emitTurnEpilogue(emit, emissionState, "task");
- session = setHarnessEmissionState(session, emissionState);
- }
- return { next: { done: true, output: stepOutput ?? "" }, session };
- }
-
- const structured = extractFinalOutput(result);
- if (structured === undefined) {
- // The schema belongs to the settled invocation.
- session = { ...session, outputSchema: undefined };
- if (emit) {
- await emitFailedStep(emit, emissionState, {
- ...OUTPUT_SCHEMA_NOT_FULFILLED,
- sessionId: session.sessionId,
- });
- }
- return {
- next: { done: true, isError: true, output: OUTPUT_SCHEMA_NOT_FULFILLED.message },
- session,
- };
- }
-
- session = persistStructuredAssistantTurn(session, history, structured);
- if (emit) {
- emissionState = await emitStructuredResult(emit, emissionState, structured, "task");
- session = setHarnessEmissionState(session, emissionState);
- }
- return { next: { done: true, output: structured }, session };
+ return emitTurnEpilogue(emit, emissionState);
}
/**
- * Closes a terminal conversation turn. Conversation runs may park, so an unmet
- * output schema parks recoverably; otherwise the structured value (or prose)
- * ends the turn and the session waits for the next message.
+ * Closes a terminal turn. An unmet output schema fails the turn recoverably;
+ * otherwise the structured value (or prose) ends the turn and the session
+ * waits for the next message.
*/
-async function finishConversationTurn(input: {
+async function finishTurn(input: {
readonly emissionState: ReturnType<typeof getHarnessEmissionState>;
readonly emit?: ToolLoopHarnessConfig["handleEvent"];
readonly history: readonly HarnessModelMessage[];
@@ -3163,7 +2993,7 @@ async function finishConversationTurn(input: {
if (schema === undefined) {
if (emit) {
- emissionState = await emitTurnEpilogue(emit, emissionState, "conversation");
+ emissionState = await emitTurnEpilogue(emit, emissionState);
session = setHarnessEmissionState(session, emissionState);
}
const settledTurn = { output: stepOutput ?? "" } satisfies SettledTurn;
@@ -3191,7 +3021,7 @@ async function finishConversationTurn(input: {
session = persistStructuredAssistantTurn(session, history, structured);
if (emit) {
- emissionState = await emitStructuredResult(emit, emissionState, structured, "conversation");
+ emissionState = await emitStructuredResult(emit, emissionState, structured);
session = setHarnessEmissionState(session, emissionState);
}
const settledTurn = { output: structured } satisfies SettledTurn;
diff --git a/packages/eve/src/harness/types.ts b/packages/eve/src/harness/types.ts
index 8b4f0aa32..ac59e0797 100644
--- a/packages/eve/src/harness/types.ts
+++ b/packages/eve/src/harness/types.ts
@@ -7,7 +7,6 @@ import type {
StepStartedStreamEvent,
UnstampedMessageStreamEvent,
} from "#protocol/message.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { RuntimeActionResult } from "#shared/action-types.js";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import type { InputResponse } from "#shared/input.js";
@@ -180,9 +179,9 @@ export interface StepDone {
readonly done: true;
readonly output: unknown;
/**
- * Marks a terminal turn that failed (e.g. a task-mode turn that could not
- * fulfil its output schema). For a delegated subagent this routes the result
- * to the parent as an error tool-result rather than an empty success.
+ * Marks a terminal turn that failed. For a delegated subagent this routes
+ * the result to the parent as an error tool-result rather than an empty
+ * success.
*/
readonly isError?: boolean;
}
@@ -280,7 +279,7 @@ export interface ToolLoopHarnessConfig {
/**
* Session-level capabilities. The harness reads
* {@link SessionCapabilities.requestInput} to decide whether a session-limit
- * continuation prompt may park a task-mode session.
+ * continuation prompt may park the session.
*/
readonly capabilities?: SessionCapabilities;
/** Clears model-message history without running a model turn. */
@@ -297,14 +296,6 @@ export interface ToolLoopHarnessConfig {
* Omitted in production until an instrumentation runtime opts in.
*/
readonly instrumentation?: SessionInstrumentation;
- /**
- * Execution mode for the current harness.
- *
- * Conversation mode parks after a final assistant reply so the runtime can
- * await the next user message. Task mode must return `{ done: true, output }`
- * for terminal assistant text inside the current invocation.
- */
- readonly mode: RunMode;
/** Whether this node enables framework background-task behavior. */
readonly tasksEnabled?: boolean;
/** Restores runtime resources for the originating turn before approval work. */
diff --git a/packages/eve/src/instrumentation/ai-sdk-hook-bridge.test.ts b/packages/eve/src/instrumentation/ai-sdk-hook-bridge.test.ts
index 744192bd8..c63dc1bf8 100644
--- a/packages/eve/src/instrumentation/ai-sdk-hook-bridge.test.ts
+++ b/packages/eve/src/instrumentation/ai-sdk-hook-bridge.test.ts
@@ -28,7 +28,6 @@ const traceContext = (audience: "public" | "private" | "unknown" = "unknown") =>
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/instrumentation/channel-delivery.test.ts b/packages/eve/src/instrumentation/channel-delivery.test.ts
index 7b7f911d6..e4ae24eb5 100644
--- a/packages/eve/src/instrumentation/channel-delivery.test.ts
+++ b/packages/eve/src/instrumentation/channel-delivery.test.ts
@@ -22,7 +22,6 @@ function setConversation(
audience,
channel: { kind, name: "slack" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
});
}
@@ -205,7 +204,6 @@ describe("channel delivery instrumentation", () => {
audience: "public",
channel: { kind: "channel:slack", name: "slack" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
});
});
diff --git a/packages/eve/src/instrumentation/eve-channel-audience-production.scenario.test.ts b/packages/eve/src/instrumentation/eve-channel-audience-production.scenario.test.ts
index 50f8a164f..cb615daf7 100644
--- a/packages/eve/src/instrumentation/eve-channel-audience-production.scenario.test.ts
+++ b/packages/eve/src/instrumentation/eve-channel-audience-production.scenario.test.ts
@@ -58,7 +58,6 @@ describe("eve channel production audience", () => {
adapter: channel.adapter,
auth,
input: { message: "private message" },
- mode: "conversation",
} satisfies RunInput,
"production",
);
diff --git a/packages/eve/src/instrumentation/lifecycle.test.ts b/packages/eve/src/instrumentation/lifecycle.test.ts
index 296405724..dd47b4a3c 100644
--- a/packages/eve/src/instrumentation/lifecycle.test.ts
+++ b/packages/eve/src/instrumentation/lifecycle.test.ts
@@ -35,7 +35,6 @@ const traceContext = (
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/instrumentation/providers-otel-policy.test.ts b/packages/eve/src/instrumentation/providers-otel-policy.test.ts
index 88e4a87aa..d823d8768 100644
--- a/packages/eve/src/instrumentation/providers-otel-policy.test.ts
+++ b/packages/eve/src/instrumentation/providers-otel-policy.test.ts
@@ -29,7 +29,6 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/instrumentation/providers.integration.test.ts b/packages/eve/src/instrumentation/providers.integration.test.ts
index 54ca00ce4..9b3d21dd1 100644
--- a/packages/eve/src/instrumentation/providers.integration.test.ts
+++ b/packages/eve/src/instrumentation/providers.integration.test.ts
@@ -15,7 +15,6 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/instrumentation/providers.test.ts b/packages/eve/src/instrumentation/providers.test.ts
index 34bf884c3..8177eef76 100644
--- a/packages/eve/src/instrumentation/providers.test.ts
+++ b/packages/eve/src/instrumentation/providers.test.ts
@@ -28,7 +28,6 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/instrumentation/runtime.test.ts b/packages/eve/src/instrumentation/runtime.test.ts
index acd0110e0..cc3846793 100644
--- a/packages/eve/src/instrumentation/runtime.test.ts
+++ b/packages/eve/src/instrumentation/runtime.test.ts
@@ -65,7 +65,6 @@ function createContext(audience: "private" | "public" | "unknown" = "public"): C
audience,
channel: { kind: "channel:test", name: "test" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
});
return ctx;
@@ -419,7 +418,6 @@ describe("bindInstrumentationRuntime", () => {
audience: "private",
channel: { kind: "channel:test", name: "test" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
});
});
@@ -735,7 +733,6 @@ describe("bindInstrumentationRuntime", () => {
audience: "public",
channel: { kind: "channel:test", name: "test" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
});
const second = instrumentation?.runStep(stepInput, async (scope) => readScopedState(scope));
diff --git a/packages/eve/src/instrumentation/session-context.test.ts b/packages/eve/src/instrumentation/session-context.test.ts
index 184ef4e7a..07861e90b 100644
--- a/packages/eve/src/instrumentation/session-context.test.ts
+++ b/packages/eve/src/instrumentation/session-context.test.ts
@@ -7,7 +7,6 @@ import {
ChannelInstrumentationKey,
InitiatorAuthKey,
ParentSessionKey,
- ModeKey,
} from "#context/keys.js";
import { readInstrumentationSessionContext } from "#instrumentation/session-context.js";
import { ConversationContextKey } from "#shared/conversation-context.js";
@@ -32,7 +31,6 @@ function setConversation(context: ContextContainer, audience: "public" | "privat
audience,
channel: { kind: "channel:test", name: "test" },
environment: "production",
- mode: "conversation",
principalType: "user",
});
}
@@ -100,7 +98,6 @@ describe("readInstrumentationSessionContext", () => {
const context = new ContextContainer();
context.set(ChannelInstrumentationKey, { kind: "channel:test", metadata: {} });
context.set(AuthKey, current);
- context.set(ModeKey, "task");
const { conversation } = readInstrumentationSessionContext(context);
@@ -108,7 +105,6 @@ describe("readInstrumentationSessionContext", () => {
audience: "unknown",
channel: { kind: "channel:test", name: undefined },
environment: "development",
- mode: "task",
principalType: "service",
});
});
diff --git a/packages/eve/src/instrumentation/session-context.ts b/packages/eve/src/instrumentation/session-context.ts
index 8a91507a0..16c8f67db 100644
--- a/packages/eve/src/instrumentation/session-context.ts
+++ b/packages/eve/src/instrumentation/session-context.ts
@@ -1,7 +1,6 @@
import type { AlsContext } from "#context/container.js";
import {
ChannelInstrumentationKey,
- ModeKey,
ParentSessionKey,
ParentTraceContextKey,
AuthKey,
@@ -38,7 +37,6 @@ export function readInstrumentationSessionContext(context: AlsContext) {
channelKind: instrumentation?.kind,
environment: resolveInstrumentationEnvironment(),
forwardedTracePolicy,
- mode: context.get(ModeKey),
principalType: context.get(AuthKey)?.principalType,
});
return {
diff --git a/packages/eve/src/instrumentation/session-init.test.ts b/packages/eve/src/instrumentation/session-init.test.ts
index 294fac7ba..5861c18c8 100644
--- a/packages/eve/src/instrumentation/session-init.test.ts
+++ b/packages/eve/src/instrumentation/session-init.test.ts
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { ContextContainer } from "#context/container.js";
-import { AuthKey, ChannelInstrumentationKey, ModeKey, SessionTraceSeedKey } from "#context/keys.js";
+import { AuthKey, ChannelInstrumentationKey, SessionTraceSeedKey } from "#context/keys.js";
import { initializeSessionInstrumentation } from "#instrumentation/session-init.js";
import { registerInstrumentationRuntime } from "#instrumentation/runtime-global.js";
import type { InstrumentationRuntime } from "#instrumentation/runtime.js";
@@ -47,7 +47,6 @@ describe("initializeSessionInstrumentation", () => {
principalId: "service-1",
principalType: "service",
});
- ctx.set(ModeKey, "task");
initializeSessionInstrumentation({ agentName: "test-agent", ctx });
diff --git a/packages/eve/src/instrumentation/session-init.ts b/packages/eve/src/instrumentation/session-init.ts
index 70f09fe04..83634f2ae 100644
--- a/packages/eve/src/instrumentation/session-init.ts
+++ b/packages/eve/src/instrumentation/session-init.ts
@@ -2,7 +2,6 @@ import type { ContextContainer } from "#context/container.js";
import {
AuthKey,
ChannelInstrumentationKey,
- ModeKey,
OtelTraceEnabledKey,
ParentTraceContextKey,
SessionTraceSeedKey,
@@ -53,7 +52,6 @@ export function initializeSessionInstrumentation(input: {
channelKind: input.ctx.get(ChannelInstrumentationKey)?.kind,
environment: resolveInstrumentationEnvironment(),
forwardedTracePolicy,
- mode: input.ctx.get(ModeKey),
principalType: input.ctx.get(AuthKey)?.principalType,
},
{ forwardedOverridesStored: true },
diff --git a/packages/eve/src/internal/authored-definition/core.ts b/packages/eve/src/internal/authored-definition/core.ts
index 8c4cbc278..4dc81e52e 100644
--- a/packages/eve/src/internal/authored-definition/core.ts
+++ b/packages/eve/src/internal/authored-definition/core.ts
@@ -60,7 +60,6 @@ export function normalizeAgentDefinition(
"model",
"modelContextWindowTokens",
"modelOptions",
- "outputSchema",
"reasoning",
"tool",
],
@@ -114,10 +113,6 @@ export function normalizeAgentDefinition(
);
}
- if (record.outputSchema !== undefined) {
- definition.outputSchema = record.outputSchema as NormalizedAgentDefinition["outputSchema"];
- }
-
if (record.reasoning !== undefined) {
definition.reasoning = normalizeAgentReasoningDefinition(record.reasoning, message);
}
diff --git a/packages/eve/src/internal/invocation/mcp-agent-channel.scenario.test.ts b/packages/eve/src/internal/invocation/mcp-agent-channel.scenario.test.ts
index f73fc388c..bda4897ed 100644
--- a/packages/eve/src/internal/invocation/mcp-agent-channel.scenario.test.ts
+++ b/packages/eve/src/internal/invocation/mcp-agent-channel.scenario.test.ts
@@ -68,94 +68,7 @@ export default askQuestion();
name: "mcp-agent-channel",
};
-const MCP_BACKGROUND_SUBAGENT_DESCRIPTOR: ScenarioAppDescriptor = {
- files: {
- "agent/agent.ts": `import { defineAgent } from "eve";
-import { mockModel } from "eve/evals";
-
-const model = mockModel((request) => {
- const messages = JSON.stringify(request.messages);
- if (messages.includes("MCP-CHILD-ANSWER")) {
- return "MCP-CHILD-ANSWER";
- }
- if (request.toolResults.some((result) => result.name === "researcher")) {
- return "MCP-FIRST-TURN-STATUS";
- }
- return {
- toolCalls: [{
- id: "delegate-1",
- input: { message: "Return the durable child answer." },
- name: "researcher",
- }],
- };
-});
-
-export default defineAgent({
- description: "Delegates every MCP request to the researcher subagent.",
- model,
- modelContextWindowTokens: 32_000,
-});
-`,
- "agent/channels/mcp.ts": `import { mcpChannel } from "eve/channels/mcp";
-
-export default mcpChannel({
- auth: (request) => {
- const principalId = request.headers.get("x-test-principal");
- return principalId === null
- ? null
- : { attributes: {}, authenticator: "scenario", principalId, principalType: "user" };
- },
-});
-`,
- "agent/instructions.md": "Delegate the request to the declared researcher subagent.\n",
- "agent/subagents/researcher/agent.ts": `import { defineAgent } from "eve";
-import { mockModel } from "eve/evals";
-
-export default defineAgent({
- description: "Returns the durable child answer.",
- model: mockModel(() => "MCP-CHILD-ANSWER"),
- modelContextWindowTokens: 32_000,
-});
-`,
- "agent/subagents/researcher/instructions.md": "Reply with the requested answer.\n",
- },
- dependencies: { "just-bash": "3.4.2" },
- installDependencies: true,
- name: "mcp-background-subagent",
-};
-
describe("MCP agent channel", () => {
- it(
- "returns a background subagent result from a durable MCP invocation",
- async () => {
- const app = await scenarioApp(MCP_BACKGROUND_SUBAGENT_DESCRIPTOR);
- const server = await startEveDev(app.appRoot);
-
- try {
- const started = await callTool(server.url, "alice", "modern", "agent_start", {
- message: "Delegate this request and return the researcher result.",
- });
- const invocationId = requiredString(started.invocationId, "invocationId");
- const completed = await pollInvocation(server.url, "alice", "modern", invocationId, [
- "completed",
- ]);
-
- expect(completed).toMatchObject({
- result: "MCP-CHILD-ANSWER",
- status: "completed",
- });
- } catch (error) {
- throw new Error(
- [`stdout:\n${server.stdout()}`, `stderr:\n${server.stderr()}`].join("\n\n"),
- { cause: error },
- );
- } finally {
- await server.stop();
- }
- },
- SCENARIO_TIMEOUT_MS,
- );
-
it(
"runs a durable input lifecycle through modern and legacy Nitro requests",
async () => {
diff --git a/packages/eve/src/internal/invocation/workflow-execution.test.ts b/packages/eve/src/internal/invocation/workflow-execution.test.ts
index dadd8cf31..a87d8e397 100644
--- a/packages/eve/src/internal/invocation/workflow-execution.test.ts
+++ b/packages/eve/src/internal/invocation/workflow-execution.test.ts
@@ -15,18 +15,11 @@ import { normalizeEveAttributes } from "#runtime/attributes/normalize.js";
const runsGet = vi.fn();
const cancel = vi.fn();
-const returnValue = vi.fn();
const getReadable = vi.fn();
vi.mock("#internal/workflow/runtime.js", () => ({
getWorld: async () => ({ runs: { get: runsGet } }),
- getRun: () => ({
- cancel,
- get returnValue() {
- return returnValue();
- },
- getReadable,
- }),
+ getRun: () => ({ cancel, getReadable }),
}));
const auth: SessionAuthContext = {
@@ -66,7 +59,6 @@ describe("WorkflowAgentInvocationExecution", () => {
capabilities: { requestInput: true },
continuationToken: expect.stringMatching(/^invocation:/),
externalInvocation: expect.objectContaining({ continuationToken: expect.any(String) }),
- mode: "task",
}),
);
const createInput = createSession.mock.calls[0]?.[0];
@@ -158,6 +150,7 @@ describe("WorkflowAgentInvocationExecution", () => {
},
meta: { at: "2026-07-20T00:00:01.000Z", id: "event_2" },
} as HandleMessageStreamEvent,
+ ...turnSettledEvents("turn_1"),
]),
);
@@ -356,14 +349,15 @@ describe("WorkflowAgentInvocationExecution", () => {
expect(deliver).not.toHaveBeenCalled();
});
- it("acknowledges a repeated answer after the run completes", async () => {
- runsGet.mockResolvedValue(run({ status: "completed" }));
- returnValue.mockResolvedValue({ output: "done" });
+ it("acknowledges a repeated answer after the turn completes", async () => {
+ runsGet.mockResolvedValue(run({ status: "running" }));
const requestId = invocationInputRequestId("event_1", "question");
getReadable.mockImplementation(() =>
eventStream([
inputRequestedEvent("event_1", ["question"]),
inputResolvedEvent("event_2", [{ requestId: "question", text: "go" }]),
+ messageCompletedEvent("done"),
+ ...turnSettledEvents("turn_1"),
]),
);
@@ -398,7 +392,7 @@ describe("WorkflowAgentInvocationExecution", () => {
},
meta: { at: "2026-07-20T00:00:00.000Z", id: "event_1" },
} as HandleMessageStreamEvent;
- getReadable.mockReturnValue(eventStream([required]));
+ getReadable.mockReturnValue(eventStream([required, ...turnSettledEvents("turn_1")]));
await expect(
execution().read({ auth, invocationId: "wrun_invocation" }),
@@ -420,6 +414,7 @@ describe("WorkflowAgentInvocationExecution", () => {
getReadable.mockReturnValue(
eventStream([
required,
+ ...turnSettledEvents("turn_1"),
{
type: "authorization.completed",
data: {
@@ -438,6 +433,38 @@ describe("WorkflowAgentInvocationExecution", () => {
).resolves.toMatchObject({ status: "working" });
});
+ it.each([
+ {
+ events: [inputRequestedEvent("event_1", ["question"])],
+ expected: { status: "completed" },
+ runStatus: "completed",
+ },
+ {
+ events: [
+ {
+ data: {
+ description: "Sign in to Linear",
+ name: "linear",
+ sequence: 0,
+ stepIndex: 0,
+ turnId: "turn_1",
+ },
+ meta: { at: "2026-07-20T00:00:00.000Z", id: "event_1" },
+ type: "authorization.required",
+ } as HandleMessageStreamEvent,
+ ],
+ expected: { error: { message: "Invocation failed." }, status: "failed" },
+ runStatus: "failed",
+ },
+ ])("reports a $runStatus run over a batch its session can no longer answer", async (input) => {
+ runsGet.mockResolvedValue(run({ status: input.runStatus }));
+ getReadable.mockReturnValue(eventStream([...input.events, ...turnSettledEvents("turn_1")]));
+
+ await expect(
+ execution().read({ auth, invocationId: "wrun_invocation" }),
+ ).resolves.toMatchObject(input.expected);
+ });
+
it("does not project intermediate tool-call narration as a result", async () => {
runsGet.mockResolvedValue(run({ status: "running" }));
getReadable.mockReturnValue(
@@ -488,15 +515,18 @@ describe("WorkflowAgentInvocationExecution", () => {
).resolves.toMatchObject({ result: "Done.", status: "working" });
});
- it("uses workflow return value as terminal result", async () => {
- runsGet.mockResolvedValue(run({ status: "completed" }));
- getReadable.mockReturnValue(eventStream([{ type: "session.completed" }]));
- returnValue.mockResolvedValue({ output: { answer: 42 } });
+ it("completes with the final message even when the model hit its output limit", async () => {
+ runsGet.mockResolvedValue(run({ status: "running" }));
+ getReadable.mockReturnValue(
+ eventStream([
+ messageCompletedEvent("# Migration guide\n\n1. Upgrade", "length"),
+ ...turnSettledEvents("turn_1"),
+ ]),
+ );
await expect(
execution().read({ auth, invocationId: "wrun_invocation" }),
- ).resolves.toMatchObject({ result: { answer: 42 }, status: "completed" });
- expect(getReadable).not.toHaveBeenCalled();
+ ).resolves.toMatchObject({ result: "# Migration guide\n\n1. Upgrade", status: "completed" });
});
it("projects the workflow run reference without private error data", async () => {
@@ -545,20 +575,26 @@ describe("WorkflowAgentInvocationExecution", () => {
});
});
- it("projects a bounded unknown failure message and correlation id", async () => {
- runsGet.mockResolvedValue(run({ status: "failed" }));
+ it("fails with a bounded message and correlation id when the turn fails and the session parks", async () => {
+ runsGet.mockResolvedValue(run({ status: "running" }));
getReadable.mockReturnValue(
eventStream([
{
- type: "session.failed",
+ type: "turn.failed",
data: {
code: "MODEL_CALL_FAILED",
details: { errorId: "err_unknown", upstreamMessage: "private provider detail" },
message: "private provider detail",
- sessionId: "wrun_invocation",
+ sequence: 0,
+ turnId: "turn_1",
},
meta: { at: "2026-07-20T00:00:00.000Z", id: "event_1" },
} as HandleMessageStreamEvent,
+ {
+ data: {},
+ meta: { at: "2026-07-20T00:00:01.000Z", id: "event_2" },
+ type: "session.waiting",
+ } as HandleMessageStreamEvent,
]),
);
@@ -682,6 +718,32 @@ function inputRequestedEvent(id: string, requestIds: readonly string[]): HandleM
};
}
+function messageCompletedEvent(
+ message: string,
+ finishReason: "length" | "stop" = "stop",
+): HandleMessageStreamEvent {
+ return {
+ data: { finishReason, message, sequence: 0, stepIndex: 0, turnId: "turn_1" },
+ meta: { at: "2026-07-20T00:00:00.000Z", id: "event_message" },
+ type: "message.completed",
+ };
+}
+
+function turnSettledEvents(turnId: string): HandleMessageStreamEvent[] {
+ return [
+ {
+ data: { sequence: 0, turnId },
+ meta: { at: "2026-07-20T00:00:02.000Z", id: "event_turn_completed" },
+ type: "turn.completed",
+ },
+ {
+ data: {},
+ meta: { at: "2026-07-20T00:00:02.000Z", id: "event_session_waiting" },
+ type: "session.waiting",
+ } as HandleMessageStreamEvent,
+ ];
+}
+
function inputResolvedEvent(
id: string,
responses: readonly { optionId?: string; requestId: string; text?: string }[],
diff --git a/packages/eve/src/internal/invocation/workflow-execution.ts b/packages/eve/src/internal/invocation/workflow-execution.ts
index 2aa28c6bb..06b09958d 100644
--- a/packages/eve/src/internal/invocation/workflow-execution.ts
+++ b/packages/eve/src/internal/invocation/workflow-execution.ts
@@ -24,7 +24,7 @@ import type { RouteSessionCreator } from "#internal/nitro/routes/channel-route-c
import { getRun, getWorld } from "#internal/workflow/runtime.js";
import type { HandleMessageStreamEvent, InputResolution } from "#protocol/message.js";
import type { InputRequest, InputResponse } from "#shared/input.js";
-import type { JsonObject, JsonValue } from "#shared/json.js";
+import type { JsonValue } from "#shared/json.js";
import { parseJsonValue } from "#shared/json.js";
export class WorkflowAgentInvocationExecution {
@@ -39,7 +39,6 @@ export class WorkflowAgentInvocationExecution {
async create(input: {
readonly auth: SessionAuthContext | null;
readonly message: string | UserContent;
- readonly outputSchema?: JsonObject;
}): Promise<AgentInvocation> {
const continuationToken = `invocation:${crypto.randomUUID()}`;
const handle = await this.#createSession({
@@ -50,8 +49,7 @@ export class WorkflowAgentInvocationExecution {
continuationToken,
ownerKey: invocationOwnerKey(input.auth),
},
- input: { message: input.message, outputSchema: input.outputSchema },
- mode: "task",
+ input: { message: input.message },
});
const run = await this.#readInvocationRun(handle.sessionId, input.auth);
@@ -71,19 +69,13 @@ export class WorkflowAgentInvocationExecution {
}): Promise<AgentInvocation | undefined> {
const run = await this.#readInvocationRun(input.invocationId, input.auth);
if (run === undefined) return undefined;
-
- if (isTerminalRunStatus(run.status)) {
- const events =
- run.status === "failed" ? await readRecentPersistedEvents(input.invocationId) : [];
- return await terminalInvocation(run, events);
- }
- const events = await readRecentPersistedEvents(input.invocationId);
- return projectNonterminal(
- run.runId,
- run.createdAt.toISOString(),
- run.expiredAt?.toISOString(),
- events,
- );
+ const base = {
+ createdAt: run.createdAt.toISOString(),
+ expiresAt: run.expiredAt?.toISOString(),
+ invocationId: run.runId,
+ };
+ if (run.status === "cancelled") return { ...base, status: "cancelled" };
+ return projectInvocation(base, run.status, await readRecentPersistedEvents(input.invocationId));
}
async update(input: {
@@ -310,55 +302,94 @@ function replaysResolvedBatch(
return true;
}
-function projectNonterminal(
- invocationId: string,
- createdAt: string,
- expiresAt: string | undefined,
+type InvocationFailureEvent = Extract<
+ HandleMessageStreamEvent,
+ { type: "session.failed" | "turn.failed" }
+>;
+
+/**
+ * Projects the invocation from its latest turn. The session parks after the
+ * turn settles, so `turn.completed` or a failure event — not the run
+ * status — is what completes the invocation. A pending input or
+ * authorization park also closes its turn, so it takes precedence.
+ */
+function projectInvocation(
+ base: { readonly createdAt: string; readonly expiresAt?: string; readonly invocationId: string },
+ runStatus: string,
events: readonly HandleMessageStreamEvent[],
): AgentInvocation {
const authorizations = new Map<string, AgentInvocationAuthorizationRequest>();
let inputBatch: PendingInputBatch | undefined;
let result: JsonValue | undefined;
+ let settled: "completed" | "cancelled" | InvocationFailureEvent | undefined;
for (const event of events) {
- if (event.type === "input.requested") {
- inputBatch = pendingInputBatch(event);
- } else if (event.type === "input.resolved") {
- if (inputBatch !== undefined) {
- inputBatch = withoutResolved(inputBatch, event.data.resolutions);
- }
- } else if (event.type === "turn.started") {
- authorizations.clear();
- inputBatch = undefined;
- result = undefined;
- } else if (event.type === "authorization.required") {
- const authorization: {
- authorization?: AgentInvocationAuthorizationRequest["authorization"];
- description: string;
- name: string;
- webhookUrl?: string;
- } = {
- description: event.data.description,
- name: event.data.name,
- };
- if (event.data.authorization !== undefined) {
- authorization.authorization = event.data.authorization;
+ switch (event.type) {
+ case "turn.started":
+ authorizations.clear();
+ inputBatch = undefined;
+ result = undefined;
+ settled = undefined;
+ break;
+ case "input.requested":
+ inputBatch = pendingInputBatch(event);
+ break;
+ case "input.resolved":
+ if (inputBatch !== undefined) {
+ inputBatch = withoutResolved(inputBatch, event.data.resolutions);
+ }
+ settled = undefined;
+ break;
+ case "authorization.required": {
+ const authorization: {
+ authorization?: AgentInvocationAuthorizationRequest["authorization"];
+ description: string;
+ name: string;
+ webhookUrl?: string;
+ } = {
+ description: event.data.description,
+ name: event.data.name,
+ };
+ if (event.data.authorization !== undefined) {
+ authorization.authorization = event.data.authorization;
+ }
+ if (event.data.webhookUrl !== undefined) {
+ authorization.webhookUrl = event.data.webhookUrl;
+ }
+ authorizations.set(event.data.name, authorization);
+ break;
}
- if (event.data.webhookUrl !== undefined) {
- authorization.webhookUrl = event.data.webhookUrl;
- }
- authorizations.set(event.data.name, authorization);
- } else if (event.type === "authorization.completed") {
- authorizations.delete(event.data.name);
- } else if (
- event.type === "message.completed" &&
- event.data.finishReason !== "tool-calls" &&
- event.data.message !== null
- ) {
- result = safeJson(event.data.message);
+ case "authorization.completed":
+ authorizations.delete(event.data.name);
+ settled = undefined;
+ break;
+ case "message.completed":
+ // Only tool-call narration continues the turn; any other finish is the reply.
+ if (event.data.finishReason !== "tool-calls" && event.data.message !== null) {
+ result = safeJson(event.data.message);
+ }
+ break;
+ case "turn.completed":
+ settled = "completed";
+ break;
+ case "turn.cancelled":
+ settled = "cancelled";
+ break;
+ case "turn.failed":
+ case "session.failed":
+ settled = event;
+ break;
}
}
+ const failure = typeof settled === "object" ? settled : undefined;
+ const failed = (): AgentInvocation => ({
+ ...base,
+ error: publicInvocationFailure(base.invocationId, failure),
+ status: "failed",
+ });
+ // A pending batch can outlive its session (timeout, failure); nobody can answer it then.
+ if (runStatus === "failed" || failure?.type === "session.failed") return failed();
+ if (runStatus === "completed") return { ...base, result, status: "completed" };
const pendingAuthorizations = [...authorizations.values()];
- const base = { createdAt, expiresAt, invocationId, result };
if (pendingAuthorizations.length > 0) {
return {
...base,
@@ -367,40 +398,17 @@ function projectNonterminal(
...AgentInvocationAuthorizationRequest[],
],
pollAfterMs: 1_000,
+ result,
status: "authorization_required",
};
}
if (inputBatch !== undefined) {
- return { ...base, inputRequests: inputBatch.requests, status: "input_required" };
+ return { ...base, inputRequests: inputBatch.requests, result, status: "input_required" };
}
- return { ...base, pollAfterMs: 1_000, status: "working" };
-}
-
-async function terminalInvocation(
- run: {
- readonly createdAt: Date;
- readonly error?: unknown;
- readonly expiredAt?: Date;
- readonly runId: string;
- readonly status: string;
- },
- events: readonly HandleMessageStreamEvent[],
-): Promise<AgentInvocation> {
- const base = {
- createdAt: run.createdAt.toISOString(),
- expiresAt: run.expiredAt?.toISOString(),
- invocationId: run.runId,
- };
- if (run.status === "cancelled") return { ...base, status: "cancelled" };
- if (run.status === "failed") {
- return {
- ...base,
- error: publicInvocationFailure(run.runId, events),
- status: "failed",
- };
- }
- const returned = await getRun<{ readonly output: unknown }>(run.runId).returnValue;
- return { ...base, result: safeJson(returned.output), status: "completed" };
+ if (failure !== undefined) return failed();
+ if (settled === "cancelled") return { ...base, status: "cancelled" };
+ if (settled === "completed") return { ...base, result, status: "completed" };
+ return { ...base, pollAfterMs: 1_000, result, status: "working" };
}
function workingInvocation(
@@ -421,9 +429,8 @@ function safeJson(value: unknown): JsonValue {
function publicInvocationFailure(
runId: string,
- events: readonly HandleMessageStreamEvent[],
+ event: InvocationFailureEvent | undefined,
): Extract<AgentInvocation, { readonly status: "failed" }>["error"] {
- const event = [...events].reverse().find((candidate) => candidate.type === "session.failed");
const data: Record<string, string> = { runId };
if (event !== undefined) data.eveCode = event.data.code;
@@ -445,9 +452,7 @@ function publicInvocationFailure(
return { code: -32603, data, message: semantic.message };
}
-function semanticFailure(
- event: Extract<HandleMessageStreamEvent, { type: "session.failed" }>["data"],
-): {
+function semanticFailure(event: InvocationFailureEvent["data"]): {
readonly hint?: string;
readonly id: string;
readonly message: string;
@@ -487,9 +492,7 @@ function semanticFailure(
return summary;
}
-function fallbackFailure(
- event: Extract<HandleMessageStreamEvent, { type: "session.failed" }>["data"],
-): {
+function fallbackFailure(event: InvocationFailureEvent["data"]): {
readonly message: string;
readonly name?: string;
} | null {
@@ -521,7 +524,3 @@ function conflict(message: string): AgentInvocationMutationResult {
function isTerminal(status: AgentInvocationStatus): boolean {
return status === "completed" || status === "failed" || status === "cancelled";
}
-
-function isTerminalRunStatus(status: string): boolean {
- return status === "completed" || status === "failed" || status === "cancelled";
-}
diff --git a/packages/eve/src/internal/nitro/routes/agent-info/build-agent-info-response.ts b/packages/eve/src/internal/nitro/routes/agent-info/build-agent-info-response.ts
index 2cff1a261..91de0e7b7 100644
--- a/packages/eve/src/internal/nitro/routes/agent-info/build-agent-info-response.ts
+++ b/packages/eve/src/internal/nitro/routes/agent-info/build-agent-info-response.ts
@@ -81,7 +81,6 @@ export function buildAgentInfoResponse(
},
name: manifest.config.name,
nodeId: ROOT_COMPILED_AGENT_NODE_ID,
- outputSchema: manifest.config.outputSchema,
},
capabilities: { devRoutes: input.mode === "development" },
channels: {
diff --git a/packages/eve/src/internal/testing/app-harness.integration.test.ts b/packages/eve/src/internal/testing/app-harness.integration.test.ts
index f061b7f47..979ab66ad 100644
--- a/packages/eve/src/internal/testing/app-harness.integration.test.ts
+++ b/packages/eve/src/internal/testing/app-harness.integration.test.ts
@@ -5,18 +5,17 @@ import { workflowEntry } from "#execution/session/entry.js";
import { createBundledRuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
import { getActiveRuntimeSession } from "#runtime/sessions/runtime-session.js";
import { createTestRuntime } from "#internal/testing/app-harness.js";
+import { readFirstTurnReply } from "#internal/testing/events.js";
function buildSerializedContext(overrides: {
channelKind: string;
continuationToken: string;
- mode: string;
}): Record<string, unknown> {
return {
"eve.auth": null,
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": { kind: overrides.channelKind, state: {} },
"eve.continuationToken": overrides.continuationToken,
- "eve.mode": overrides.mode,
};
}
@@ -56,11 +55,10 @@ describe("AppHarness", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken: "schedule:app-harness-tenant-a",
- mode: "task",
}),
},
]);
- return (await run.returnValue).output;
+ return await readFirstTurnReply(run);
}),
runtimeB.run(async () => {
const run = await start(workflowEntry, [
@@ -71,11 +69,10 @@ describe("AppHarness", () => {
serializedContext: buildSerializedContext({
channelKind: "http",
continuationToken: "schedule:app-harness-tenant-b",
- mode: "task",
}),
},
]);
- return (await run.returnValue).output;
+ return await readFirstTurnReply(run);
}),
]);
diff --git a/packages/eve/src/internal/testing/app-harness.ts b/packages/eve/src/internal/testing/app-harness.ts
index be92c5907..7c7008525 100644
--- a/packages/eve/src/internal/testing/app-harness.ts
+++ b/packages/eve/src/internal/testing/app-harness.ts
@@ -1,4 +1,3 @@
-import type { JsonObject } from "#shared/json.js";
import type { ChannelAdapter } from "#channel/adapter.js";
import { compileFromMemory, type CompileFromMemoryInput } from "#compiler/compile-from-memory.js";
import type { CompiledAgentManifest } from "#compiler/manifest.js";
@@ -47,7 +46,6 @@ export interface TestAppDescriptor {
};
readonly model?: string;
readonly name?: string;
- readonly outputSchema?: JsonObject;
};
/**
* Authored tools projected into the compiled manifest and available to
@@ -178,7 +176,6 @@ export async function createTestRuntime(descriptor: TestAppDescriptor = {}): Pro
},
...(descriptor.modules ?? []),
],
- outputSchema: descriptor.agent?.outputSchema,
};
if (descriptor.tools !== undefined && descriptor.tools.length > 0) {
diff --git a/packages/eve/src/internal/testing/entry-test-helpers.ts b/packages/eve/src/internal/testing/entry-test-helpers.ts
index d07b827f9..4659ce5a2 100644
--- a/packages/eve/src/internal/testing/entry-test-helpers.ts
+++ b/packages/eve/src/internal/testing/entry-test-helpers.ts
@@ -13,7 +13,6 @@ export function buildSerializedContext(overrides: {
channelKind: string;
channelState?: Record<string, unknown>;
continuationToken?: string;
- mode: string;
parent?: {
readonly callId: string;
readonly rootSessionId: string;
@@ -32,14 +31,12 @@ export function buildSerializedContext(overrides: {
"eve.auth": overrides.auth ?? null,
"eve.bundle": { source: createBundledRuntimeCompiledArtifactsSource() },
"eve.channel": channel,
- "eve.mode": overrides.mode,
};
if (overrides.audience !== undefined) {
context[ConversationContextKey.name] = {
audience: overrides.audience,
channel: { kind: overrides.channelKind },
environment: "production",
- mode: overrides.mode,
principalType: "anonymous",
};
}
diff --git a/packages/eve/src/internal/testing/events.ts b/packages/eve/src/internal/testing/events.ts
index 387bcaaf3..7bbbdac3f 100644
--- a/packages/eve/src/internal/testing/events.ts
+++ b/packages/eve/src/internal/testing/events.ts
@@ -68,6 +68,21 @@ export function captureTurnEvents(
};
}
+/**
+ * Reads the run's first turn, then cancels the parked session. Returns the
+ * turn's final assistant message.
+ */
+export async function readFirstTurnReply(run: WorkflowRunHandle): Promise<string | null> {
+ const stream = captureTurnEvents(run);
+ try {
+ const turn = await stream.nextTurn();
+ return filterEventsByType(turn, "message.completed").at(-1)?.data.message ?? null;
+ } finally {
+ stream.dispose();
+ await run.cancel();
+ }
+}
+
/**
* Asserts that `events` contains one contiguous occurrence of `types`, in
* order, without intervening matches.
diff --git a/packages/eve/src/internal/testing/legacy-session-driver-workflow.ts b/packages/eve/src/internal/testing/legacy-session-driver-workflow.ts
index 48d1132b4..937f5c950 100644
--- a/packages/eve/src/internal/testing/legacy-session-driver-workflow.ts
+++ b/packages/eve/src/internal/testing/legacy-session-driver-workflow.ts
@@ -66,7 +66,6 @@ export async function legacySessionDriverWorkflow(input: {
};
const turnInput = {
version: input.inputVersion ?? 2,
- mode: "conversation",
completionToken: completion.token,
stepInput: {
input: { ...delivery, kind: "deliver", payloads: delivery.payloads ?? [delivery.payload] },
diff --git a/packages/eve/src/internal/testing/task-model-retry-workflow.ts b/packages/eve/src/internal/testing/task-model-retry-workflow.ts
deleted file mode 100644
index 0b642633f..000000000
--- a/packages/eve/src/internal/testing/task-model-retry-workflow.ts
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * Test fixture exercising task-mode model failures inside a real Workflow
- * step, including retry from a committed durable session snapshot.
- */
-import type { LanguageModel, ModelMessage } from "ai";
-import { MockLanguageModelV3 } from "ai/test";
-
-import { getStepMetadata, getWorkflowMetadata } from "#compiled/@workflow/core/index.js";
-
-import {
- createDurableSessionState,
- type DurableSessionState,
- readDurableSession,
-} from "#execution/durable-session-store.js";
-import { hydrateDurableSession } from "#execution/session.js";
-import { createToolLoopHarness } from "#harness/tool-loop.js";
-import type { HarnessSession } from "#harness/types.js";
-import { createBootstrapGenerateResult } from "#runtime/agent/bootstrap-model-utils.js";
-import type { RuntimeTurnAgent } from "#runtime/agent/bootstrap.js";
-
-const MODEL_ID = "task-model-retry-fixture";
-const PRIOR_HISTORY: HarnessSession["history"] = [
- { content: "Complete the delegated task.", kind: "user", role: "user" },
- { content: "Prior durable work is complete.", role: "assistant" },
-];
-
-function createTurnAgent(): RuntimeTurnAgent {
- return {
- id: "task-model-retry-fixture",
- instructions: ["You are a test assistant."],
- model: { id: MODEL_ID },
- tools: [],
- workspaceSpec: { rootEntries: [] },
- };
-}
-
-/** Creates the committed snapshot each retry must read. */
-export async function createTaskModelRetrySessionStep(input: {
- readonly sessionId: string;
-}): Promise<DurableSessionState> {
- "use step";
-
- const session: HarnessSession = {
- agent: {
- modelReference: { id: MODEL_ID },
- system: "You are a test assistant.",
- tools: [],
- },
- compaction: { recentWindowSize: 10, threshold: 100_000, thresholdPercent: 0.9 },
- continuationToken: `subagent:${input.sessionId}`,
- history: [...PRIOR_HISTORY],
- sessionId: input.sessionId,
- };
-
- return createDurableSessionState({ session });
-}
-
-export interface TaskModelRetryStepResult {
- readonly attempt: number;
- readonly historyBeforeModelCall: readonly ModelMessage[];
- readonly history: readonly ModelMessage[];
- readonly output: string;
-}
-
-/** Runs one task-mode model call and lets Workflow retry recoverable failures. */
-export async function taskModelRetryStep(input: {
- readonly failThroughAttempt: number;
- readonly sessionState: DurableSessionState;
-}): Promise<TaskModelRetryStepResult> {
- "use step";
-
- const { attempt } = getStepMetadata();
- const durable = readDurableSession(input.sessionState);
- const session = hydrateDurableSession({ durable, turnAgent: createTurnAgent() });
- const historyBeforeModelCall = [...session.history];
- const model = new MockLanguageModelV3({
- doGenerate: async () => {
- if (attempt <= input.failThroughAttempt) {
- throw new Error(`recoverable task failure on Workflow attempt ${String(attempt)}`);
- }
-
- return createBootstrapGenerateResult({
- inputTokens: 1,
- modelId: MODEL_ID,
- outputTokens: 1,
- text: "Recovered task output.",
- });
- },
- modelId: MODEL_ID,
- provider: "eve-integration-mock",
- });
- const runStep = createToolLoopHarness({
- mode: "task",
- resolveModel: async (): Promise<LanguageModel> => model,
- tools: new Map(),
- });
-
- const result = await runStep(session, { message: "Continue the delegated task." });
-
- if (result.next === null || typeof result.next === "function") {
- throw new Error("Task model retry fixture expected a completed task result.");
- }
- if (typeof result.next.output !== "string") {
- throw new Error("Task model retry fixture expected a string task output.");
- }
-
- return {
- attempt,
- history: result.session.history,
- historyBeforeModelCall,
- output: result.next.output,
- };
-}
-
-/** Represents the single parent-facing failure handoff after retry exhaustion. */
-export async function recordTaskModelFailureForParentStep(input: {
- readonly message: string;
-}): Promise<{ readonly count: 1; readonly message: string }> {
- "use step";
-
- return { count: 1, message: input.message };
-}
-
-export type TaskModelRetryFixtureResult =
- | {
- readonly kind: "completed";
- readonly parentNotifications: 0;
- readonly result: TaskModelRetryStepResult;
- }
- | {
- readonly failureMessage: string;
- readonly kind: "failed";
- readonly parentNotifications: 1;
- };
-
-/** Drives the task step and handles only its final, post-retry failure. */
-export async function taskModelRetryFixtureWorkflow(input: {
- readonly failThroughAttempt: number;
-}): Promise<TaskModelRetryFixtureResult> {
- "use workflow";
-
- const { workflowRunId: sessionId } = getWorkflowMetadata();
- const sessionState = await createTaskModelRetrySessionStep({ sessionId });
-
- try {
- const result = await taskModelRetryStep({
- failThroughAttempt: input.failThroughAttempt,
- sessionState,
- });
- return { kind: "completed", parentNotifications: 0, result };
- } catch (error) {
- const message = error instanceof Error ? error.message : String(error);
- const notification = await recordTaskModelFailureForParentStep({ message });
- return {
- failureMessage: notification.message,
- kind: "failed",
- parentNotifications: notification.count,
- };
- }
-}
diff --git a/packages/eve/src/internal/testing/workflow-tool-run-harness.ts b/packages/eve/src/internal/testing/workflow-tool-run-harness.ts
index 8483032b6..fc3fc400f 100644
--- a/packages/eve/src/internal/testing/workflow-tool-run-harness.ts
+++ b/packages/eve/src/internal/testing/workflow-tool-run-harness.ts
@@ -18,7 +18,6 @@ const DEPLOY_INPUT_SCHEMA = toInputSchema({
export function buildWorkflowToolSerializedContext(input: {
readonly acceptedDeploymentId?: string;
readonly continuationToken: string;
- readonly mode: "conversation" | "task";
readonly requestInput?: boolean;
}): Record<string, unknown> {
return {
@@ -37,7 +36,6 @@ export function buildWorkflowToolSerializedContext(input: {
},
}),
"eve.continuationToken": input.continuationToken,
- "eve.mode": input.mode,
};
}
diff --git a/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts b/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts
index e057fab18..851f592c4 100644
--- a/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts
+++ b/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.test.ts
@@ -169,7 +169,6 @@ describe("chatSdkChannel", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:chat-sdk" },
environment: "production",
- mode: "conversation",
state: adapter.state,
}),
).toBe(audience);
diff --git a/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.ts b/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.ts
index 9325486f4..aa9414e2a 100644
--- a/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.ts
+++ b/packages/eve/src/public/channels/chat-sdk/chatSdkChannel.ts
@@ -140,7 +140,6 @@ export type ChatSdkChannelEvents<TAdapters extends ChatSdkAdapters = ChatSdkAdap
export interface ChatSdkSendOptions {
readonly auth?: SessionAuthContext | null;
readonly callback?: ChannelAddressDeliveryOptions<ChatSdkChannelState>["callback"];
- readonly mode?: ChannelAddressDeliveryOptions<ChatSdkChannelState>["mode"];
/** Updates the session policy; omission preserves it. */
readonly taskDeliveryPolicy?: TaskDeliveryPolicy;
readonly thread: SerializedThread | Thread | string;
@@ -578,7 +577,6 @@ async function bridgeSend<TAdapters extends ChatSdkAdapters>(
state: { thread },
};
if (options.callback !== undefined) deliveryOptions.callback = options.callback;
- if (options.mode !== undefined) deliveryOptions.mode = options.mode;
if (options.title !== undefined) deliveryOptions.title = options.title;
if (options.turnPolicy !== undefined) deliveryOptions.turnPolicy = options.turnPolicy;
if (options.taskDeliveryPolicy !== undefined)
diff --git a/packages/eve/src/public/channels/discord/discordChannel.test.ts b/packages/eve/src/public/channels/discord/discordChannel.test.ts
index 8848b5691..ccc309fde 100644
--- a/packages/eve/src/public/channels/discord/discordChannel.test.ts
+++ b/packages/eve/src/public/channels/discord/discordChannel.test.ts
@@ -62,7 +62,6 @@ describe("discordChannel() audience classification", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:discord" },
environment: "production",
- mode: "conversation",
state: adapter.state,
}),
).toBe(audience);
diff --git a/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts b/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts
index 6af64e5e1..69ba9835b 100644
--- a/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts
+++ b/packages/eve/src/public/channels/eve-forwarded-principal.integration.test.ts
@@ -131,7 +131,6 @@ describe("eveChannel forwarded principal → runtime principal", () => {
url: "https://caller.example.com/eve/v1/callback/parent-token",
},
message: "check my dashboards",
- mode: "task",
}),
headers: {
"content-type": "application/json",
@@ -246,7 +245,6 @@ describe("eveChannel forwarded principal → runtime principal", () => {
url: "https://caller.example.com/eve/v1/callback/parent-token",
},
message: "check my dashboards",
- mode: "task",
}),
headers: {
"content-type": "application/json",
@@ -294,7 +292,6 @@ describe("eveChannel forwarded principal → runtime principal", () => {
url: "https://caller.example.com/eve/v1/callback/parent-token",
},
message: "check my dashboards",
- mode: "task",
}),
headers: {
"content-type": "application/json",
@@ -326,7 +323,6 @@ describe("eveChannel forwarded principal → runtime principal", () => {
url: "https://caller.example.com/eve/v1/callback/parent-token",
},
message: "check my dashboards",
- mode: "task",
}),
headers: {
"content-type": "application/json",
@@ -360,7 +356,7 @@ describe("eveChannel forwarded principal → runtime principal", () => {
await handler.fetch(
new Request("https://receiver.example.com/eve/v1/session", {
- body: JSON.stringify({ message: "check my dashboards", mode: "task" }),
+ body: JSON.stringify({ message: "check my dashboards" }),
headers: { "content-type": "application/json" },
method: "POST",
}),
@@ -411,7 +407,6 @@ describe("eveChannel forwarded principal → runtime principal", () => {
current: FORWARDED_CURRENT,
},
message: "check my dashboards",
- mode: "task",
}),
headers: {
"content-type": "application/json",
diff --git a/packages/eve/src/public/channels/eve-session-routes.test.ts b/packages/eve/src/public/channels/eve-session-routes.test.ts
index 8b2017b68..496d474a6 100644
--- a/packages/eve/src/public/channels/eve-session-routes.test.ts
+++ b/packages/eve/src/public/channels/eve-session-routes.test.ts
@@ -85,7 +85,6 @@ describe("eve ID-addressed session routes", () => {
message: undefined,
outputSchema: undefined,
},
- mode: "conversation",
}),
);
});
@@ -173,7 +172,6 @@ describe("eve ID-addressed session routes", () => {
url: "https://caller.example.com/eve/v1/callback/tok123",
},
message: "hello",
- mode: "conversation",
}),
headers: {
"content-type": "application/json",
@@ -214,7 +212,6 @@ describe("eve ID-addressed session routes", () => {
url: "https://caller.example.com/eve/v1/callback/tok123",
},
message: "hello",
- mode: "conversation",
}),
headers: {
"content-type": "application/json",
diff --git a/packages/eve/src/public/channels/eve.test.ts b/packages/eve/src/public/channels/eve.test.ts
index db1d5d1a8..4e48ab7f9 100644
--- a/packages/eve/src/public/channels/eve.test.ts
+++ b/packages/eve/src/public/channels/eve.test.ts
@@ -61,7 +61,6 @@ type MockSendOptions = Pick<
| "continuationToken"
| "activityObserver"
| "initiatorAuth"
- | "mode"
| "title"
>;
@@ -143,7 +142,6 @@ function createEveCreateHandler(
continuationToken: runInput.continuationToken,
activityObserver: runInput.activityObserver,
initiatorAuth: runInput.initiatorAuth,
- mode: runInput.mode,
title: runInput.title,
} satisfies MockSendOptions);
return {
@@ -1061,27 +1059,16 @@ describe("eveChannel — create session (text)", () => {
expect(handler.send.mock.calls[0]?.[0]).toBe("hi");
});
- it("accepts task mode for callback-driven session creation", async () => {
- const handler = createEveCreateHandler({ auth: none() });
-
- const response = await handler.fetch(createJsonMessageRequest({ message: "hi", mode: "task" }));
-
- expect(response.status).toBe(202);
- expect(handler.send).toHaveBeenCalledTimes(1);
- expect(handler.send.mock.calls[0]?.[1]).toMatchObject({ mode: "task" });
- });
-
it("accepts an explicit empty capability set for conversation sessions", async () => {
const handler = createEveCreateHandler({ auth: none() });
const response = await handler.fetch(
- createJsonMessageRequest({ capabilities: {}, message: "hi", mode: "conversation" }),
+ createJsonMessageRequest({ capabilities: {}, message: "hi" }),
);
expect(response.status).toBe(202);
expect(handler.send.mock.calls[0]?.[1]).toMatchObject({
capabilities: {},
- mode: "conversation",
});
});
@@ -1097,7 +1084,6 @@ describe("eveChannel — create session (text)", () => {
url: "https://caller.example.com/eve/v1/callback/tok123",
},
message: "hi",
- mode: "conversation",
}),
);
@@ -1110,7 +1096,6 @@ describe("eveChannel — create session (text)", () => {
token: "tok123",
url: "https://caller.example.com/eve/v1/callback/tok123",
},
- mode: "conversation",
});
});
@@ -1126,7 +1111,6 @@ describe("eveChannel — create session (text)", () => {
url: "https://caller.example.com/eve/support/v1/callback/tok123",
},
message: "hi",
- mode: "task",
}),
);
@@ -1145,7 +1129,6 @@ describe("eveChannel — create session (text)", () => {
url: "https://caller.example.com/eve/v1/callback/tok123",
},
message: "hi",
- mode: "task",
}),
);
@@ -1168,7 +1151,6 @@ describe("eveChannel — create session (text)", () => {
url: "https://caller.example.com/eve/v1/callback/other-token",
},
message: "hi",
- mode: "task",
}),
);
@@ -1192,7 +1174,6 @@ describe("eveChannel — create session (text)", () => {
url: "https://caller.example.com/eve/v1/callback/tok123",
},
message: "hi",
- mode: "task",
}),
);
@@ -1203,20 +1184,6 @@ describe("eveChannel — create session (text)", () => {
});
});
- it("rejects invalid create-session modes", async () => {
- const handler = createEveCreateHandler({ auth: none() });
-
- const response = await handler.fetch(
- createJsonMessageRequest({ message: "hi", mode: "background" }),
- );
-
- expect(response.status).toBe(400);
- expect(handler.send).not.toHaveBeenCalled();
- await expect(response.json()).resolves.toMatchObject({
- error: expect.stringContaining("mode"),
- });
- });
-
it("converts clientContext with a create-session message", async () => {
const handler = createEveCreateHandler({ auth: none() });
@@ -2055,7 +2022,7 @@ describe("eveChannel — forwarded principal", () => {
};
function forwardedRequest(forwardedPrincipal: unknown): Request {
- return createJsonMessageRequest({ forwardedPrincipal, message: "hi", mode: "task" });
+ return createJsonMessageRequest({ forwardedPrincipal, message: "hi" });
}
function stamped(context: SessionAuthContext): SessionAuthContext {
@@ -2205,7 +2172,6 @@ describe("eveChannel — forwarded principal", () => {
"eve:forwarded-by": ROUTER_CALLER.principalId,
},
});
- expect(options.mode).toBe("task");
});
it("scopes create-once operations to the forwarded principal", async () => {
diff --git a/packages/eve/src/public/channels/mcp.test.ts b/packages/eve/src/public/channels/mcp.test.ts
index e6a0e8f03..507ebe384 100644
--- a/packages/eve/src/public/channels/mcp.test.ts
+++ b/packages/eve/src/public/channels/mcp.test.ts
@@ -213,49 +213,6 @@ describe("mcpChannel", () => {
expect(authenticate).not.toHaveBeenCalled();
});
- it("bounds and rejects external output schemas before starting work", async () => {
- const createSession = vi.fn();
- const channel = mcpChannel({ auth: none() });
- const route = channel.routes[1]!;
- if (route.transport === "websocket") throw new Error("expected HTTP route");
-
- const response = await route.handler(
- mcpRequest({
- id: 1,
- jsonrpc: "2.0",
- method: "tools/call",
- params: {
- arguments: {
- message: "work",
- outputSchema: { $ref: "https://attacker.example/schema.json" },
- },
- name: "agent_start",
- },
- }),
- routeArgs(createSession),
- );
-
- await expect(jsonRpcResponse(response)).resolves.toMatchObject({
- result: {
- content: [
- {
- text: "outputSchema external $ref values are not supported.",
- type: "text",
- },
- ],
- isError: true,
- structuredContent: {
- error: {
- code: "invalid_input",
- message: "outputSchema external $ref values are not supported.",
- retryable: false,
- },
- },
- },
- });
- expect(createSession).not.toHaveBeenCalled();
- });
-
it("rejects oversized UTF-8 messages and input responses before starting work", async () => {
const createSession = vi.fn();
const channel = mcpChannel({ auth: none() });
diff --git a/packages/eve/src/public/channels/mcp.ts b/packages/eve/src/public/channels/mcp.ts
index 60f4215d6..c689c655d 100644
--- a/packages/eve/src/public/channels/mcp.ts
+++ b/packages/eve/src/public/channels/mcp.ts
@@ -1,4 +1,4 @@
-import { parseJsonObject, type JsonObject } from "#shared/json.js";
+import { parseJsonObject } from "#shared/json.js";
import { z } from "#compiled/zod/index.js";
import {
defineChannel,
@@ -421,7 +421,6 @@ function createInvocationTools(
: `${agentDescription} ${startDescription}`,
inputSchema: z.strictObject({
message: utf8Bounded(MAX_MESSAGE_BYTES).min(1),
- outputSchema: z.looseObject({}).optional(),
}),
name: "agent_start",
outputSchema: AGENT_INVOCATION_OUTPUT_SCHEMA,
@@ -430,7 +429,6 @@ function createInvocationTools(
const invocation = await execution.create({
auth: context.auth,
message: body.message,
- outputSchema: asJsonObject(body.outputSchema),
});
return invocationResult(invocation);
},
@@ -558,20 +556,6 @@ function invocationResult(invocation: AgentInvocation): McpCallToolResult {
};
}
-function asJsonObject(value: unknown): JsonObject | undefined {
- if (value === undefined) return undefined;
- try {
- const schema = parseJsonObject(value);
- validateOutputSchemaComplexity(schema);
- return schema;
- } catch (error) {
- throw new McpToolOperationError(
- "invalid_input",
- error instanceof Error ? error.message : "outputSchema must be a JSON object.",
- );
- }
-}
-
const AUTHORIZATION_CHALLENGE_SCHEMA = z.strictObject({
displayName: z.string().optional(),
expiresAt: z.iso.datetime().optional(),
@@ -655,41 +639,3 @@ const AGENT_INVOCATION_OUTPUT_SCHEMA = z.discriminatedUnion("status", [
}),
AGENT_INVOCATION_BASE_SCHEMA.extend({ status: z.literal("cancelled") }),
]);
-
-const MAX_OUTPUT_SCHEMA_BYTES = 64 * 1_024;
-const MAX_OUTPUT_SCHEMA_DEPTH = 32;
-const MAX_OUTPUT_SCHEMA_NODES = 2_048;
-
-function validateOutputSchemaComplexity(schema: JsonObject): void {
- if (new TextEncoder().encode(JSON.stringify(schema)).byteLength > MAX_OUTPUT_SCHEMA_BYTES) {
- throw new Error(`outputSchema must be at most ${String(MAX_OUTPUT_SCHEMA_BYTES)} bytes.`);
- }
-
- let nodes = 0;
- const visit = (value: import("#shared/json.js").JsonValue, depth: number): void => {
- nodes++;
- if (nodes > MAX_OUTPUT_SCHEMA_NODES) {
- throw new Error(
- `outputSchema must contain at most ${String(MAX_OUTPUT_SCHEMA_NODES)} nodes.`,
- );
- }
- if (depth > MAX_OUTPUT_SCHEMA_DEPTH) {
- throw new Error(
- `outputSchema must be at most ${String(MAX_OUTPUT_SCHEMA_DEPTH)} levels deep.`,
- );
- }
- if (Array.isArray(value)) {
- for (const item of value) visit(item, depth + 1);
- return;
- }
- if (value === null || typeof value !== "object") return;
- for (const [key, entry] of Object.entries(value)) {
- if (key === "$ref" && typeof entry === "string" && !entry.startsWith("#")) {
- throw new Error("outputSchema external $ref values are not supported.");
- }
- visit(entry, depth + 1);
- }
- };
-
- visit(schema, 0);
-}
diff --git a/packages/eve/src/public/channels/slack/slackChannel.test.ts b/packages/eve/src/public/channels/slack/slackChannel.test.ts
index ebcdc3463..ee1766927 100644
--- a/packages/eve/src/public/channels/slack/slackChannel.test.ts
+++ b/packages/eve/src/public/channels/slack/slackChannel.test.ts
@@ -501,7 +501,6 @@ describe("slackChannel()", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:slack" },
environment: "production",
- mode: "conversation",
state: adapter.state,
}),
).toBe("private");
diff --git a/packages/eve/src/public/channels/teams/teamsChannel.test.ts b/packages/eve/src/public/channels/teams/teamsChannel.test.ts
index d9ddbc018..8bf648255 100644
--- a/packages/eve/src/public/channels/teams/teamsChannel.test.ts
+++ b/packages/eve/src/public/channels/teams/teamsChannel.test.ts
@@ -137,7 +137,6 @@ describe("teamsChannel", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:teams" },
environment: "production",
- mode: "conversation",
state: teamsAdapter.state,
}),
).toBe(audience);
diff --git a/packages/eve/src/public/channels/telegram/telegramChannel.test.ts b/packages/eve/src/public/channels/telegram/telegramChannel.test.ts
index 4c2765420..b8a4efc7a 100644
--- a/packages/eve/src/public/channels/telegram/telegramChannel.test.ts
+++ b/packages/eve/src/public/channels/telegram/telegramChannel.test.ts
@@ -159,7 +159,6 @@ describe("telegramChannel() inbound route", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:telegram" },
environment: "production",
- mode: "conversation",
state: adapter.state,
}),
).toBe(audience);
diff --git a/packages/eve/src/public/channels/twilio/twilioChannel.test.ts b/packages/eve/src/public/channels/twilio/twilioChannel.test.ts
index 879f56e14..cabe156df 100644
--- a/packages/eve/src/public/channels/twilio/twilioChannel.test.ts
+++ b/packages/eve/src/public/channels/twilio/twilioChannel.test.ts
@@ -188,7 +188,6 @@ describe("twilioChannel() inbound text pipeline", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:twilio" },
environment: "production",
- mode: "conversation",
state: adapter.state,
}),
).toBe("private");
diff --git a/packages/eve/src/public/definitions/channel.test.ts b/packages/eve/src/public/definitions/channel.test.ts
index c1a94dec9..97914b659 100644
--- a/packages/eve/src/public/definitions/channel.test.ts
+++ b/packages/eve/src/public/definitions/channel.test.ts
@@ -174,7 +174,6 @@ describe("defineChannel", () => {
caller: { type: "anonymous" },
channel: { kind: "http" },
environment: "production",
- mode: "conversation",
state: undefined,
}),
).toBe("public");
@@ -204,7 +203,6 @@ describe("defineChannel", () => {
caller: { type: "anonymous" },
channel: { kind: "channel:legacy" },
environment: "production",
- mode: "conversation",
state: adapter.state,
}),
).toBe("public");
diff --git a/packages/eve/src/public/definitions/remote-agent.ts b/packages/eve/src/public/definitions/remote-agent.ts
index efb02ed55..82279b930 100644
--- a/packages/eve/src/public/definitions/remote-agent.ts
+++ b/packages/eve/src/public/definitions/remote-agent.ts
@@ -1,8 +1,6 @@
-import type { StandardJSONSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
import type { HeadersValue } from "#client/types.js";
import type { OutboundAuthFn } from "#public/agents/auth.js";
import { EVE_SESSION_ROUTE_PATH } from "#protocol/routes.js";
-import type { JsonObject } from "#shared/json.js";
/**
* Base URL of a remote eve deployment, either a static string or a function
@@ -44,13 +42,6 @@ export interface RemoteAgentDefinition {
readonly forwardPrincipal?: boolean;
readonly headers?: HeadersValue;
readonly kind: "remote";
- /**
- * Optional structured return type the caller requires from the remote agent.
- * The compiler lowers it to JSON Schema and sends it on the remote
- * create-session request; the remote deployment enforces it like any
- * task-mode output schema.
- */
- readonly outputSchema?: StandardJSONSchemaV1<unknown, unknown> | JsonObject;
/**
* Route eve appends to `url` for the create-session request. Defaults to the
* framework create-session route (`/eve/v1/session`).
diff --git a/packages/eve/src/public/definitions/workspace-agent.ts b/packages/eve/src/public/definitions/workspace-agent.ts
index 292e519f2..9ef79611b 100644
--- a/packages/eve/src/public/definitions/workspace-agent.ts
+++ b/packages/eve/src/public/definitions/workspace-agent.ts
@@ -1,5 +1,3 @@
-import type { StandardJSONSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
-
import type { HeadersValue } from "#client/types.js";
import { type OutboundAuthFn, vercelOidc } from "#public/agents/auth.js";
import {
@@ -7,7 +5,6 @@ import {
type RemoteAgentDefinition,
type RemoteAgentUrl,
} from "#public/definitions/remote-agent.js";
-import type { JsonObject } from "#shared/json.js";
import { normalizePublicRoutePrefix } from "#shared/public-route-prefix.js";
const WORKSPACE_AGENT_NAME = Symbol.for("eve.workspace-agent.name");
@@ -28,7 +25,6 @@ export interface WorkspaceAgentDefinition {
/** Overrides the peer agent's description in the parent's tool definition. */
readonly description?: string;
readonly forwardPrincipal?: boolean;
- readonly outputSchema?: StandardJSONSchemaV1<unknown, unknown> | JsonObject;
/** Name of the peer workspace member, such as `research`. */
readonly name: string;
/**
@@ -48,7 +44,6 @@ export function defineWorkspaceAgent(definition: WorkspaceAgentDefinition): Remo
description: definition.description ?? "",
forwardPrincipal: definition.forwardPrincipal,
headers: transport.headers,
- outputSchema: definition.outputSchema,
tool: definition.tool,
url: transport.url,
}) as BrandedWorkspaceSubagent;
diff --git a/packages/eve/src/public/models/openai/chatgpt/model.integration.test.ts b/packages/eve/src/public/models/openai/chatgpt/model.integration.test.ts
index 232732183..8f51b24f4 100644
--- a/packages/eve/src/public/models/openai/chatgpt/model.integration.test.ts
+++ b/packages/eve/src/public/models/openai/chatgpt/model.integration.test.ts
@@ -36,7 +36,6 @@ describe("ChatGPT streamed reasoning replay", () => {
const execute = vi.fn(async () => ({ id: "invoice-1", total: 42 }));
const runStep = createToolLoopHarness({
handleEvent: async () => {},
- mode: "conversation",
resolveModel: async () => model,
tools: new Map([
[
diff --git a/packages/eve/src/runtime/agent/bootstrap.ts b/packages/eve/src/runtime/agent/bootstrap.ts
index bafe068db..4485c5882 100644
--- a/packages/eve/src/runtime/agent/bootstrap.ts
+++ b/packages/eve/src/runtime/agent/bootstrap.ts
@@ -50,7 +50,6 @@ interface RuntimeTurnAgentBase {
*/
readonly compactionModel?: RuntimeModelReference;
readonly nodeId?: string;
- readonly outputSchema?: ResolvedAgentDefinition["outputSchema"];
readonly reasoning?: ResolvedAgentDefinition["reasoning"];
readonly tools: readonly PreparedRuntimeTool[];
readonly workspaceSpec: WorkspaceRuntimeSpec;
@@ -127,7 +126,6 @@ export function createResolvedRuntimeTurnAgent(input: {
}),
compactionModel: config?.compaction?.model,
nodeId: input.nodeId,
- outputSchema: config?.outputSchema,
reasoning: config?.reasoning,
tools: [...input.tools],
workspaceSpec: agent.workspaceSpec,
diff --git a/packages/eve/src/runtime/resolve-agent-graph.ts b/packages/eve/src/runtime/resolve-agent-graph.ts
index 77cf37fd9..9cfeecd6e 100644
--- a/packages/eve/src/runtime/resolve-agent-graph.ts
+++ b/packages/eve/src/runtime/resolve-agent-graph.ts
@@ -305,7 +305,6 @@ async function resolveRuntimeRemoteAgent(input: {
logicalPath: string;
name: string;
nodeId: string;
- outputSchema?: ResolvedRuntimeRemoteAgentNode["outputSchema"];
path: string;
sourceId: string;
sourceKind: "module";
@@ -317,7 +316,6 @@ async function resolveRuntimeRemoteAgent(input: {
logicalPath: input.sourceRef.logicalPath,
name: input.sourceRef.name,
nodeId: toRuntimeNodeId(input.sourceRef.nodeId),
- outputSchema: input.sourceRef.outputSchema,
path: input.sourceRef.path,
sourceId: input.sourceRef.sourceId,
sourceKind: "module",
diff --git a/packages/eve/src/runtime/resolve-agent.ts b/packages/eve/src/runtime/resolve-agent.ts
index 147b32db5..a8540bbca 100644
--- a/packages/eve/src/runtime/resolve-agent.ts
+++ b/packages/eve/src/runtime/resolve-agent.ts
@@ -188,7 +188,6 @@ function createResolvedAgentConfig(
description?: string;
experimental?: NonNullable<ResolvedAgent["config"]>["experimental"];
name: string;
- outputSchema?: NonNullable<ResolvedAgent["config"]>["outputSchema"];
reasoning?: NonNullable<ResolvedAgent["config"]>["reasoning"];
source?: NonNullable<ResolvedAgent["config"]>["source"];
tool?: boolean;
@@ -253,10 +252,6 @@ function createResolvedAgentConfig(
};
}
- if (manifest.config.outputSchema !== undefined) {
- config.outputSchema = manifest.config.outputSchema;
- }
-
if (manifest.config.reasoning !== undefined) {
config.reasoning = manifest.config.reasoning;
}
diff --git a/packages/eve/src/runtime/subagents/dynamic-agent-config.ts b/packages/eve/src/runtime/subagents/dynamic-agent-config.ts
index 09589ef7b..719462180 100644
--- a/packages/eve/src/runtime/subagents/dynamic-agent-config.ts
+++ b/packages/eve/src/runtime/subagents/dynamic-agent-config.ts
@@ -8,8 +8,6 @@ import {
type AgentLimitsDefinition,
type AgentReasoningDefinition,
} from "#shared/agent-definition.js";
-import type { JsonObject } from "#shared/json.js";
-import { serializeOutputSchema } from "#tools/schema.js";
export interface DynamicSubagentAgentConfig {
readonly compaction?: {
@@ -19,7 +17,6 @@ export interface DynamicSubagentAgentConfig {
readonly description: string;
readonly limits?: AgentLimitsDefinition;
readonly model: DynamicSubagentModelReference;
- readonly outputSchema?: JsonObject;
readonly reasoning?: AgentReasoningDefinition;
readonly tool?: boolean;
}
@@ -56,7 +53,6 @@ export async function normalizeDynamicSubagentAgentConfig(input: {
description: string;
limits?: AgentLimitsDefinition;
model: DynamicSubagentModelReference;
- outputSchema?: JsonObject;
reasoning?: AgentReasoningDefinition;
tool?: boolean;
} = {
@@ -96,9 +92,6 @@ export async function normalizeDynamicSubagentAgentConfig(input: {
if (definition.limits !== undefined) {
config.limits = definition.limits;
}
- if (definition.outputSchema !== undefined) {
- config.outputSchema = serializeOutputSchema(definition.outputSchema);
- }
if (definition.reasoning !== undefined) {
config.reasoning = definition.reasoning;
}
diff --git a/packages/eve/src/runtime/subagents/dynamic-remote-agent-config.ts b/packages/eve/src/runtime/subagents/dynamic-remote-agent-config.ts
index 6c85c30c8..05bd6e74c 100644
--- a/packages/eve/src/runtime/subagents/dynamic-remote-agent-config.ts
+++ b/packages/eve/src/runtime/subagents/dynamic-remote-agent-config.ts
@@ -8,14 +8,11 @@ import {
} from "#internal/authored-module.js";
import type { OutboundAuthFn } from "#public/agents/auth.js";
import { EVE_SESSION_ROUTE_PATH } from "#protocol/routes.js";
-import type { JsonObject } from "#shared/json.js";
-import { serializeOutputSchema, type ToolSchemaSource } from "#tools/schema.js";
export interface DynamicRemoteAgentConfig {
readonly credentialsStepId?: string;
readonly description: string;
readonly forwardPrincipal?: boolean;
- readonly outputSchema?: JsonObject;
readonly path: string;
readonly tool?: boolean;
readonly url: string;
@@ -29,17 +26,7 @@ export async function normalizeDynamicRemoteAgentConfig(input: {
const record = expectObjectRecord(input.value, message);
expectOnlyKnownKeys(
record,
- [
- "auth",
- "description",
- "forwardPrincipal",
- "headers",
- "kind",
- "outputSchema",
- "path",
- "tool",
- "url",
- ],
+ ["auth", "description", "forwardPrincipal", "headers", "kind", "path", "tool", "url"],
message,
);
@@ -62,7 +49,6 @@ export async function normalizeDynamicRemoteAgentConfig(input: {
credentialsStepId?: string;
description: string;
forwardPrincipal?: boolean;
- outputSchema?: JsonObject;
path: string;
tool?: boolean;
url: string;
@@ -78,9 +64,6 @@ export async function normalizeDynamicRemoteAgentConfig(input: {
if (record.forwardPrincipal !== undefined) {
config.forwardPrincipal = expectBoolean(record.forwardPrincipal, message);
}
- if (record.outputSchema !== undefined) {
- config.outputSchema = serializeOutputSchema(record.outputSchema as ToolSchemaSource);
- }
if (record.tool !== undefined) {
config.tool = expectBoolean(record.tool, message);
}
diff --git a/packages/eve/src/runtime/types.ts b/packages/eve/src/runtime/types.ts
index f1f7e4f59..840987a1c 100644
--- a/packages/eve/src/runtime/types.ts
+++ b/packages/eve/src/runtime/types.ts
@@ -21,7 +21,7 @@ import type {
import type { OpenAPISpecSource } from "#public/definitions/connections/openapi.js";
import type { CompiledWorkspaceResourceRoot } from "#compiler/manifest.js";
import type { WorkspaceRuntimeSpec } from "#runtime/workspace/types.js";
-import type { JsonObject, JsonValue } from "#shared/json.js";
+import type { JsonValue } from "#shared/json.js";
import type { Optional } from "#shared/optional.js";
import type { Node } from "#shared/node.js";
import type {
@@ -300,7 +300,6 @@ export type ResolvedRuntimeRemoteAgentNode = Readonly<
headers?: HeadersValue;
kind: "remote";
name: string;
- outputSchema?: JsonObject;
path: string;
tool?: boolean;
url: string;
diff --git a/packages/eve/src/shared/action-types.ts b/packages/eve/src/shared/action-types.ts
index f941cfdff..27880b4d0 100644
--- a/packages/eve/src/shared/action-types.ts
+++ b/packages/eve/src/shared/action-types.ts
@@ -238,8 +238,8 @@ const runtimeToolResultActionResultSchema = z
* turn. The parent settles the agent handle from `outcome.kind` and folds
* `outcome.usageDelta` into its session totals; `output`/`isError` remain
* the tool-result projection shown to the model. Every producer states the
- * envelope explicitly — task-mode boundaries synthesize a terminal one —
- * so the parent never infers lifecycle from an absent field. `usage`
+ * envelope explicitly, so the parent never infers lifecycle from an absent
+ * field. `usage`
* carries the turn's token spend so the caller can attribute the
* subagent's tokens.
*
diff --git a/packages/eve/src/shared/agent-definition.ts b/packages/eve/src/shared/agent-definition.ts
index 491d69ce0..79f48fdfc 100644
--- a/packages/eve/src/shared/agent-definition.ts
+++ b/packages/eve/src/shared/agent-definition.ts
@@ -1,5 +1,4 @@
import type { CallSettings, LanguageModel } from "ai";
-import type { StandardJSONSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
import type { JsonObject } from "#shared/json.js";
import type { ModuleSourceRef } from "#shared/source-ref.js";
import {
@@ -319,7 +318,6 @@ export type InternalAgentDefinition = {
defaultTools?: boolean;
experimental?: AgentExperimentalDefinition;
model: InternalAgentModelDefinition;
- outputSchema?: JsonObject;
reasoning?: AgentReasoningDefinition;
source?: ModuleSourceRef;
tool?: boolean;
@@ -370,13 +368,6 @@ type PublicAgentDefinitionBase = {
* in workflow tools.
*/
readonly tool?: boolean;
- /**
- * Optional structured return type used when this agent runs in task mode
- * (for example as a subagent, schedule, or remote job). Interactive
- * conversation turns ignore this field unless the client supplies a
- * per-message output schema.
- */
- readonly outputSchema?: StandardJSONSchemaV1<unknown, unknown> | JsonObject;
};
/**
diff --git a/packages/eve/src/shared/agent-turn-outcome.ts b/packages/eve/src/shared/agent-turn-outcome.ts
index b6a15ea5f..29043228d 100644
--- a/packages/eve/src/shared/agent-turn-outcome.ts
+++ b/packages/eve/src/shared/agent-turn-outcome.ts
@@ -30,7 +30,7 @@ export type AgentTurnResult =
* `parked` means the child session survived the turn and can accept another
* delivery; `terminal` means the child session ended with this turn. The
* lifecycle is carried explicitly: a failed turn can leave the child parked,
- * and a succeeded turn can be terminal (task mode). Consumers must never
+ * and a succeeded turn can be terminal. Consumers must never
* infer lifecycle from success or error codes.
*
* `usageDelta` is the provider-reported usage this turn added to the child's
diff --git a/packages/eve/src/shared/channel-definition.ts b/packages/eve/src/shared/channel-definition.ts
index 8a8d04bfc..af0ca3e1f 100644
--- a/packages/eve/src/shared/channel-definition.ts
+++ b/packages/eve/src/shared/channel-definition.ts
@@ -113,8 +113,8 @@ export interface GenericChannelDefinition<
/**
* Classifies who can observe the originating conversation. The hook runs
- * after route auth with channel state, the authenticated principal, run mode,
- * and deployment environment. Return `"unknown"` when classification is not
+ * after route auth with channel state, the authenticated principal, and
+ * deployment environment. Return `"unknown"` when classification is not
* confident; consumers treat it as non-public.
*/
readonly audience?: (input: AudienceContext<TState>) => ChannelAudience;
diff --git a/packages/eve/src/shared/conversation-context.test.ts b/packages/eve/src/shared/conversation-context.test.ts
index b41b7cec2..fafe56aff 100644
--- a/packages/eve/src/shared/conversation-context.test.ts
+++ b/packages/eve/src/shared/conversation-context.test.ts
@@ -22,7 +22,6 @@ function run(input: Partial<RunInput>): RunInput {
adapter: { kind: "http" },
auth: null,
input: { message: "hello" },
- mode: "conversation",
...input,
};
}
@@ -65,7 +64,6 @@ describe("buildConversationContext", () => {
audience: "private",
channel: { kind: "http", name: undefined },
environment: "preview",
- mode: "conversation",
principalType: "user",
});
});
@@ -191,10 +189,8 @@ describe("buildConversationContext", () => {
audience: "public",
channel: { kind: "channel:slack", name: "slack" },
environment: "production",
- mode: "conversation",
principalType: "user",
},
- mode: "task",
}),
"production",
);
diff --git a/packages/eve/src/shared/conversation-context.ts b/packages/eve/src/shared/conversation-context.ts
index 26b225c13..f0bd2dbc1 100644
--- a/packages/eve/src/shared/conversation-context.ts
+++ b/packages/eve/src/shared/conversation-context.ts
@@ -3,7 +3,6 @@ import { ContextKey } from "#context/key.js";
import { normalizeInstrumentationChannelKind } from "#shared/instrumentation-channel-kind.js";
import { isNonEmptyString } from "#shared/guards.js";
import { normalizeChannelAudience, type ChannelAudience } from "#shared/channel-audience.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { ForwardedTraceAssertion } from "#shared/forwarded-trace-policy.js";
export type ConversationEnvironment = "development" | "preview" | "production";
@@ -14,7 +13,6 @@ export interface ConversationContext {
readonly name?: string;
};
readonly audience: ChannelAudience;
- readonly mode: RunMode;
readonly environment: ConversationEnvironment;
readonly principalType: string;
}
@@ -41,7 +39,6 @@ export interface AudienceInput<TState> {
/** @deprecated Use `caller`; it excludes `principalId`, `issuer`, and `subject`. */
readonly auth: AudiencePrincipal | null;
readonly channel: ConversationContext["channel"];
- readonly mode: RunMode;
readonly environment: ConversationEnvironment;
}
@@ -55,7 +52,6 @@ export const UNKNOWN_CONVERSATION_CONTEXT: ConversationContext = {
audience: "unknown",
channel: { kind: "unknown" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
};
@@ -63,7 +59,6 @@ export interface ConversationContextFallback {
readonly channelKind?: string;
readonly environment: ConversationEnvironment;
readonly forwardedTracePolicy?: ForwardedTraceAssertion;
- readonly mode?: RunMode;
readonly principalType?: string;
}
@@ -89,7 +84,6 @@ export function resolveConversationContext(
kind: normalizeInstrumentationChannelKind(fallback.channelKind),
},
environment: fallback.environment,
- mode: fallback.mode ?? "conversation",
principalType: fallback.principalType ?? "anonymous",
};
}
@@ -98,7 +92,6 @@ interface SerializedConversationContext {
readonly audience?: unknown;
readonly channel?: unknown;
readonly environment?: unknown;
- readonly mode?: unknown;
readonly principalType?: unknown;
}
@@ -122,12 +115,10 @@ export function normalizeConversationContext(value: unknown): ConversationContex
if (typeof value !== "object" || value === null || Array.isArray(value)) return undefined;
const candidate = value as SerializedConversationContext;
const channel = normalizeConversationChannel(candidate.channel);
- const mode = candidate.mode;
const environment = candidate.environment;
const principalType = candidate.principalType;
if (
channel === undefined ||
- (mode !== "conversation" && mode !== "task") ||
(environment !== "development" && environment !== "preview" && environment !== "production") ||
!isNonEmptyString(principalType)
) {
@@ -137,7 +128,6 @@ export function normalizeConversationContext(value: unknown): ConversationContex
audience: normalizeChannelAudience(candidate.audience),
channel,
environment,
- mode,
principalType,
};
}
diff --git a/packages/eve/src/shared/run-mode.ts b/packages/eve/src/shared/run-mode.ts
deleted file mode 100644
index d47833e6a..000000000
--- a/packages/eve/src/shared/run-mode.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Execution mode for one runtime-owned run.
- *
- * Conversation runs may park and resume on follow-up input. Task runs must
- * finish within the current invocation and cannot wait for another message.
- */
-export type RunMode = "conversation" | "task";
diff --git a/packages/eve/src/subagents/agent-handle-errors.ts b/packages/eve/src/subagents/agent-handle-errors.ts
index 48858636a..475fd625a 100644
--- a/packages/eve/src/subagents/agent-handle-errors.ts
+++ b/packages/eve/src/subagents/agent-handle-errors.ts
@@ -36,9 +36,3 @@ export const SUBAGENT_EXECUTION_FAILED = "SUBAGENT_EXECUTION_FAILED";
/** Error code for a remote agent session that failed to start. */
export const REMOTE_AGENT_START_FAILED = "REMOTE_AGENT_START_FAILED";
-
-/** Fallback error code for a remote `session.failed` callback without error detail. */
-export const REMOTE_AGENT_FAILED = "REMOTE_AGENT_FAILED";
-
-/** Error code a child session reports back when the whole session failed. */
-export const SESSION_FAILED = "SESSION_FAILED";
diff --git a/packages/eve/src/subagents/auth-proxy.integration.test.ts b/packages/eve/src/subagents/auth-proxy.integration.test.ts
index 005e1adce..ffe1ec36e 100644
--- a/packages/eve/src/subagents/auth-proxy.integration.test.ts
+++ b/packages/eve/src/subagents/auth-proxy.integration.test.ts
@@ -6,7 +6,7 @@ import type {
SubagentAuthorizationEventHookPayload,
} from "#channel/types.js";
import { ContextContainer } from "#context/container.js";
-import { AuthKey, ContinuationTokenKey, ModeKey, SessionIdKey } from "#context/keys.js";
+import { AuthKey, ContinuationTokenKey, SessionIdKey } from "#context/keys.js";
import { emitProxiedSubagentEvent } from "#subagents/event-proxy-step.js";
import { projectToDurableSession } from "#execution/session.js";
import type { HarnessSession } from "#harness/types.js";
@@ -99,7 +99,6 @@ function buildContext(input: { readonly adapter: ChannelAdapter; readonly sessio
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, input.adapter);
ctx.set(ContinuationTokenKey, "http:parent");
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, input.sessionId);
return { bundle, ctx, hook };
}
@@ -119,7 +118,6 @@ function rehydrateContext(input: {
),
);
ctx.set(ContinuationTokenKey, input.serializedContext[ContinuationTokenKey.name] as string);
- ctx.set(ModeKey, "conversation");
ctx.set(SessionIdKey, input.serializedContext[SessionIdKey.name] as string);
return ctx;
}
diff --git a/packages/eve/src/subagents/callback-route.test.ts b/packages/eve/src/subagents/callback-route.test.ts
index b8ba39832..751137d14 100644
--- a/packages/eve/src/subagents/callback-route.test.ts
+++ b/packages/eve/src/subagents/callback-route.test.ts
@@ -212,257 +212,6 @@ describe("session callback route", () => {
expect(resumeHookMock).not.toHaveBeenCalled();
});
- it("synthesizes a terminal outcome envelope for session.completed", async () => {
- resumeHookMock.mockResolvedValue(undefined);
-
- const response = await handleSessionCallbackRequest(
- new Request("https://app.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- sessionId: "remote-session",
- subagentName: "research",
- }),
- method: "POST",
- }),
- createRouteContext({ token: "tok123" }),
- );
-
- expect(response.status).toBe(202);
- expect(resumeHookMock).toHaveBeenCalledWith("tok123", {
- kind: "runtime-action-result",
- results: [
- {
- callId: "call-1",
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: "done" },
- usageDelta: {
- cacheReadTokens: 0,
- cacheWriteTokens: 0,
- inputTokens: 0,
- outputTokens: 0,
- },
- },
- output: "done",
- subagentName: "research",
- },
- ],
- });
- });
-
- it("accepts a sessionId-less callback from an older eve deployment", async () => {
- resumeHookMock.mockResolvedValue(undefined);
-
- const response = await handleSessionCallbackRequest(
- new Request("https://app.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- subagentName: "research",
- }),
- method: "POST",
- }),
- createRouteContext({ token: "tok123" }),
- );
-
- expect(response.status).toBe(202);
- expect(resumeHookMock).toHaveBeenCalledWith("tok123", {
- kind: "runtime-action-result",
- results: [
- {
- callId: "call-1",
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: "done" },
- usageDelta: {
- cacheReadTokens: 0,
- cacheWriteTokens: 0,
- inputTokens: 0,
- outputTokens: 0,
- },
- },
- output: "done",
- subagentName: "research",
- },
- ],
- });
- });
-
- it("synthesizes a terminal failed outcome for session.failed", async () => {
- resumeHookMock.mockResolvedValue(undefined);
-
- const error = { code: "REMOTE_AGENT_FAILED", message: "remote crashed" };
- const response = await handleSessionCallbackRequest(
- new Request("https://app.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- error,
- kind: "session.failed",
- sessionId: "remote-session",
- subagentName: "research",
- }),
- method: "POST",
- }),
- createRouteContext({ token: "tok123" }),
- );
-
- expect(response.status).toBe(202);
- expect(resumeHookMock).toHaveBeenCalledWith("tok123", {
- kind: "runtime-action-result",
- results: [
- {
- callId: "call-1",
- isError: true,
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { error, kind: "failed" },
- usageDelta: {
- cacheReadTokens: 0,
- cacheWriteTokens: 0,
- inputTokens: 0,
- outputTokens: 0,
- },
- },
- output: error,
- subagentName: "research",
- },
- ],
- });
- });
-
- it("projects reported usage onto the resumed result and its outcome delta", async () => {
- resumeHookMock.mockResolvedValue(undefined);
-
- const usage = { cacheReadTokens: 10, cacheWriteTokens: 5, inputTokens: 100, outputTokens: 50 };
- const response = await handleSessionCallbackRequest(
- new Request("https://app.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- sessionId: "remote-session",
- subagentName: "research",
- usage,
- }),
- method: "POST",
- }),
- createRouteContext({ token: "tok123" }),
- );
-
- expect(response.status).toBe(202);
- expect(resumeHookMock).toHaveBeenCalledWith("tok123", {
- kind: "runtime-action-result",
- results: [
- {
- callId: "call-1",
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: "done" },
- usageDelta: usage,
- },
- output: "done",
- subagentName: "research",
- usage,
- },
- ],
- });
- });
-
- it("strips unknown usage keys from a newer callee", async () => {
- resumeHookMock.mockResolvedValue(undefined);
-
- const response = await handleSessionCallbackRequest(
- new Request("https://app.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- sessionId: "remote-session",
- subagentName: "research",
- usage: {
- cacheReadTokens: 10,
- cacheWriteTokens: 5,
- inputTokens: 100,
- outputTokens: 50,
- reasoningOutputTokens: 7,
- },
- }),
- method: "POST",
- }),
- createRouteContext({ token: "tok123" }),
- );
-
- expect(response.status).toBe(202);
- const payload = resumeHookMock.mock.calls[0]?.[1] as {
- results: readonly { usage?: unknown }[];
- };
- expect(payload.results[0]?.usage).toEqual({
- cacheReadTokens: 10,
- cacheWriteTokens: 5,
- inputTokens: 100,
- outputTokens: 50,
- });
- });
-
- it("drops malformed usage but still resumes the result", async () => {
- resumeHookMock.mockResolvedValue(undefined);
-
- const response = await handleSessionCallbackRequest(
- new Request("https://app.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- sessionId: "remote-session",
- subagentName: "research",
- usage: {
- cacheReadTokens: 10,
- cacheWriteTokens: 5,
- inputTokens: "lots",
- outputTokens: 50,
- },
- }),
- method: "POST",
- }),
- createRouteContext({ token: "tok123" }),
- );
-
- expect(response.status).toBe(202);
- expect(resumeHookMock).toHaveBeenCalledWith("tok123", {
- kind: "runtime-action-result",
- results: [
- {
- callId: "call-1",
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: "done" },
- usageDelta: {
- cacheReadTokens: 0,
- cacheWriteTokens: 0,
- inputTokens: 0,
- outputTokens: 0,
- },
- },
- output: "done",
- subagentName: "research",
- },
- ],
- });
- });
-
it("resumes a completed conversation turn with its outcome envelope", async () => {
resumeHookMock.mockResolvedValue(undefined);
diff --git a/packages/eve/src/subagents/callback-route.ts b/packages/eve/src/subagents/callback-route.ts
index 7e5ff1263..4859617b2 100644
--- a/packages/eve/src/subagents/callback-route.ts
+++ b/packages/eve/src/subagents/callback-route.ts
@@ -1,6 +1,5 @@
import { resumeHook } from "#internal/workflow/runtime.js";
import { z } from "#compiled/zod/index.js";
-import { REMOTE_AGENT_FAILED } from "#subagents/agent-handle-errors.js";
import type { RouteContext } from "#public/definitions/channel.js";
import type {
SubagentAuthorizationEvent,
@@ -10,18 +9,9 @@ import type {
import type { RuntimeSubagentChildResult } from "#shared/action-types.js";
import { agentTurnOutcomeWithCostSchema } from "#shared/agent-turn-outcome.js";
import { jsonValueSchema } from "#shared/json-schemas.js";
-import type { JsonValue } from "#shared/json.js";
import { isInputRequest } from "#shared/input.js";
-import { tokenUsageWithCostSchema, type TokenUsage } from "#shared/token-usage.js";
import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";
-const ZERO_TOKEN_USAGE: TokenUsage = {
- cacheReadTokens: 0,
- cacheWriteTokens: 0,
- inputTokens: 0,
- outputTokens: 0,
-};
-
// Wire schemas of the child→parent callback route. Possession of the
// callback token is the authorization to settle; results bind to the
// pending call by callId. `sessionId` is informational (tracing and
@@ -114,26 +104,9 @@ const taskTurnStartedCallbackSchema = z.object({
* Turn callbacks must carry the explicit `AgentTurnOutcome` envelope:
* the receiving parent settles the child's handle from `outcome.kind`, so
* a turn callback that cannot state its lifecycle is rejected rather than
- * guessed at (pre-1.0: no wire compatibility shims). `usage` stays
- * unvalidated here — {@link parseCallbackUsage} drops it, never rejects
- * it, when malformed.
+ * guessed at (pre-1.0: no wire compatibility shims).
*/
const sessionResultCallbackSchema = z.discriminatedUnion("kind", [
- z.object({
- callId: z.string().min(1),
- kind: z.literal("session.completed"),
- output: jsonValueSchema.optional(),
- subagentName: z.string().min(1),
- usage: z.unknown().optional(),
- }),
- z.object({
- callId: z.string().min(1),
- /** Absent on callbacks from older eve deployments. */
- error: jsonValueSchema.optional(),
- kind: z.literal("session.failed"),
- subagentName: z.string().min(1),
- usage: z.unknown().optional(),
- }),
z.object({
callId: z.string().min(1),
kind: z.literal("turn.completed"),
@@ -276,12 +249,7 @@ function projectSessionCallbackResult(value: unknown): RuntimeSubagentChildResul
}
const kind = callbackKind(value);
- if (
- kind !== "session.completed" &&
- kind !== "session.failed" &&
- kind !== "turn.completed" &&
- kind !== "turn.failed"
- ) {
+ if (kind !== "turn.completed" && kind !== "turn.failed") {
return Response.json({ error: "Unsupported callback kind.", ok: false }, { status: 400 });
}
@@ -291,51 +259,6 @@ function projectSessionCallbackResult(value: unknown): RuntimeSubagentChildResul
}
const payload = parsed.data;
- // Task-session terminal callbacks carry no outcome envelope on the wire;
- // this boundary synthesizes the terminal verdict (a task session always
- // ends with its result) so the parent settles from an explicit outcome.
- if (payload.kind === "session.completed") {
- const output = payload.output ?? "";
- const usage = parseCallbackUsage(payload.usage);
- const base: RuntimeSubagentChildResult = {
- callId: payload.callId,
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output },
- usageDelta: usage ?? ZERO_TOKEN_USAGE,
- },
- output,
- subagentName: payload.subagentName,
- };
- return usage === undefined ? base : { ...base, usage };
- }
-
- if (payload.kind === "session.failed") {
- const error: JsonValue =
- payload.error === undefined
- ? {
- code: REMOTE_AGENT_FAILED,
- message: "Remote agent failed.",
- }
- : payload.error;
- const usage = parseCallbackUsage(payload.usage);
- return {
- callId: payload.callId,
- isError: true,
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { error, kind: "failed" },
- usageDelta: usage ?? ZERO_TOKEN_USAGE,
- },
- output: error,
- subagentName: payload.subagentName,
- };
- }
-
if (payload.kind === "turn.completed") {
return {
callId: payload.callId,
@@ -360,16 +283,3 @@ function projectSessionCallbackResult(value: unknown): RuntimeSubagentChildResul
subagentName: payload.subagentName,
};
}
-
-/**
- * TokenUsage arrives from a remote callee that may run a different eve version,
- * so it is validated independently and dropped — never rejected — when
- * malformed. The rest of the callback still resumes the parent.
- */
-function parseCallbackUsage(value: unknown): TokenUsage | undefined {
- if (value === undefined) {
- return undefined;
- }
- const parsed = tokenUsageWithCostSchema.safeParse(value);
- return parsed.success ? parsed.data : undefined;
-}
diff --git a/packages/eve/src/subagents/callback-step.test.ts b/packages/eve/src/subagents/callback-step.test.ts
deleted file mode 100644
index 9af7c3045..000000000
--- a/packages/eve/src/subagents/callback-step.test.ts
+++ /dev/null
@@ -1,319 +0,0 @@
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-
-import { fireSessionCallbackStep } from "#subagents/callback-step.js";
-
-const USAGE = { cacheReadTokens: 10, cacheWriteTokens: 5, inputTokens: 100, outputTokens: 50 };
-
-describe("fireSessionCallbackStep", () => {
- let errorSpy: ReturnType<typeof vi.spyOn>;
-
- beforeEach(() => {
- errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
- });
-
- afterEach(() => {
- vi.unstubAllGlobals();
- errorSpy.mockRestore();
- });
-
- it("does nothing when the session has no callback metadata", async () => {
- const fetchMock = vi.fn();
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- output: "done",
- serializedContext: {
- "eve.sessionId": "remote-session",
- },
- status: "completed",
- });
-
- expect(fetchMock).not.toHaveBeenCalled();
- expect(errorSpy).not.toHaveBeenCalled();
- });
-
- it("posts the completed callback from serialized context", async () => {
- const fetchMock = vi.fn().mockResolvedValue(new Response(null, { status: 202 }));
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- output: "done",
- serializedContext: {
- "eve.sessionCallback": {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "https://caller.example.com/eve/v1/callback/tok123",
- },
- "eve.sessionId": "remote-session",
- },
- status: "completed",
- });
-
- expect(fetchMock).toHaveBeenCalledWith("https://caller.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- sessionId: "remote-session",
- subagentName: "research",
- }),
- headers: {
- "content-type": "application/json",
- },
- method: "POST",
- redirect: "error",
- signal: expect.any(AbortSignal),
- });
- expect(errorSpy).not.toHaveBeenCalled();
- });
-
- it("posts an empty completed output when output is omitted", async () => {
- const fetchMock = vi.fn().mockResolvedValue(new Response(null, { status: 202 }));
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- serializedContext: createSerializedContext(),
- status: "completed",
- });
-
- expect(fetchMock).toHaveBeenCalledWith("https://caller.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "",
- sessionId: "remote-session",
- subagentName: "research",
- }),
- headers: {
- "content-type": "application/json",
- },
- method: "POST",
- redirect: "error",
- signal: expect.any(AbortSignal),
- });
- });
-
- it("includes usage on the completed callback when provided", async () => {
- const fetchMock = vi.fn().mockResolvedValue(new Response(null, { status: 202 }));
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- output: "done",
- serializedContext: createSerializedContext(),
- status: "completed",
- usage: USAGE,
- });
-
- expect(fetchMock).toHaveBeenCalledWith("https://caller.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- kind: "session.completed",
- output: "done",
- sessionId: "remote-session",
- subagentName: "research",
- usage: USAGE,
- }),
- headers: {
- "content-type": "application/json",
- },
- method: "POST",
- redirect: "error",
- signal: expect.any(AbortSignal),
- });
- expect(errorSpy).not.toHaveBeenCalled();
- });
-
- it("omits usage when none is provided", async () => {
- const fetchMock = vi.fn().mockResolvedValue(new Response(null, { status: 202 }));
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- output: "done",
- serializedContext: createSerializedContext(),
- status: "completed",
- });
-
- expect(parsePostedBody(fetchMock).usage).toBeUndefined();
- expect(errorSpy).not.toHaveBeenCalled();
- });
-
- it("includes usage on failed callbacks", async () => {
- const fetchMock = vi.fn().mockResolvedValue(new Response(null, { status: 202 }));
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- error: new Error("remote exploded"),
- serializedContext: createSerializedContext(),
- status: "failed",
- usage: USAGE,
- });
-
- expect(parsePostedBody(fetchMock).usage).toEqual(USAGE);
- });
-
- it("posts the failed callback with the normalized error message", async () => {
- const fetchMock = vi.fn().mockResolvedValue(new Response(null, { status: 202 }));
- vi.stubGlobal("fetch", fetchMock);
-
- await fireSessionCallbackStep({
- error: new Error("remote exploded"),
- serializedContext: createSerializedContext(),
- status: "failed",
- });
-
- expect(fetchMock).toHaveBeenCalledWith("https://caller.example.com/eve/v1/callback/tok123", {
- body: JSON.stringify({
- callId: "call-1",
- error: {
- code: "SESSION_FAILED",
- message: "remote exploded",
- },
- kind: "session.failed",
- sessionId: "remote-session",
- subagentName: "research",
- }),
- headers: {
- "content-type": "application/json",
- },
- method: "POST",
- redirect: "error",
- signal: expect.any(AbortSignal),
- });
- });
-
- it.each([
- ["null", null],
- ["array", []],
- ["missing callId", { subagentName: "research", token: "tok123", url: "https://example.com" }],
- [
- "empty token",
- {
- callId: "call-1",
- subagentName: "research",
- token: "",
- url: "https://caller.example.com/eve/v1/callback/tok123",
- },
- ],
- [
- "relative url",
- {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "/eve/v1/callback/tok123",
- },
- ],
- [
- "wrong callback route",
- {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "https://caller.example.com/eve/v1/session/tok123",
- },
- ],
- [
- "url token mismatch",
- {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "https://caller.example.com/eve/v1/callback/other-token",
- },
- ],
- [
- "malformed encoded token",
- {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "https://caller.example.com/eve/v1/callback/%E0%A4%A",
- },
- ],
- [
- "private callback host",
- {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "http://169.254.169.254/eve/v1/callback/tok123",
- },
- ],
- [
- "extra field",
- {
- callId: "call-1",
- extra: true,
- subagentName: "research",
- token: "tok123",
- url: "https://caller.example.com/eve/v1/callback/tok123",
- },
- ],
- ])("rejects invalid serialized callback metadata: %s", async (_name, value) => {
- const fetchMock = vi.fn();
- vi.stubGlobal("fetch", fetchMock);
-
- await expect(
- fireSessionCallbackStep({
- serializedContext: {
- "eve.sessionCallback": value,
- "eve.sessionId": "remote-session",
- },
- status: "failed",
- }),
- ).rejects.toMatchObject({
- cause: expect.anything(),
- message: "Serialized session callback is invalid.",
- });
- expect(fetchMock).not.toHaveBeenCalled();
- expect(errorSpy).toHaveBeenCalled();
- });
-
- it("rethrows non-2xx responses so Workflow owns retry or failure handling", async () => {
- vi.stubGlobal("fetch", vi.fn().mockResolvedValue(new Response(null, { status: 500 })));
-
- await expect(
- fireSessionCallbackStep({
- output: "done",
- serializedContext: createSerializedContext(),
- status: "completed",
- }),
- ).rejects.toThrow("Session callback failed with HTTP 500.");
- expect(errorSpy).toHaveBeenCalled();
- });
-
- it("rethrows fetch failures so Workflow owns retry or failure handling", async () => {
- const fetchError = new Error("network down");
- vi.stubGlobal("fetch", vi.fn().mockRejectedValue(fetchError));
-
- await expect(
- fireSessionCallbackStep({
- output: "done",
- serializedContext: createSerializedContext(),
- status: "completed",
- }),
- ).rejects.toBe(fetchError);
- expect(errorSpy).toHaveBeenCalled();
- });
-});
-
-function parsePostedBody(fetchMock: ReturnType<typeof vi.fn>): Record<string, unknown> {
- const call = fetchMock.mock.calls[0];
- if (call === undefined) {
- throw new Error("expected fetch to have been called");
- }
- return JSON.parse((call[1] as { body: string }).body) as Record<string, unknown>;
-}
-
-function createSerializedContext(): Record<string, unknown> {
- return {
- "eve.sessionCallback": {
- callId: "call-1",
- subagentName: "research",
- token: "tok123",
- url: "https://caller.example.com/eve/v1/callback/tok123",
- },
- "eve.sessionId": "remote-session",
- };
-}
diff --git a/packages/eve/src/subagents/callback-step.ts b/packages/eve/src/subagents/callback-step.ts
index 5d82ece1b..98c2d5aa2 100644
--- a/packages/eve/src/subagents/callback-step.ts
+++ b/packages/eve/src/subagents/callback-step.ts
@@ -1,15 +1,8 @@
import type { SessionCallback, SubagentAuthorizationEvent } from "#channel/types.js";
import { parseSessionCallback } from "#channel/session-callback.js";
-import { SessionCallbackKey } from "#context/keys.js";
import { postSessionCallbackRequest } from "#execution/session-callback-request.js";
-import { SESSION_FAILED } from "#subagents/agent-handle-errors.js";
-import { createLogger } from "#internal/logging.js";
-import { toErrorMessage } from "#shared/errors.js";
-import type { TokenUsage } from "#shared/token-usage.js";
import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
-const log = createLogger("execution.session-callback");
-
/** Sends task-owned remote HITL and authorization events to the parent callback capability. */
export async function fireTaskEventCallbackStep(input: {
readonly callback: unknown;
@@ -42,85 +35,6 @@ export async function fireTaskEventCallbackStep(input: {
}
}
-/**
- * Sends the configured session terminal callback.
- *
- * Absence is a no-op. Once callback metadata is present, delivery is part of
- * the remote delegation result path, so failures are logged and rethrown
- * instead of being reported as a successful terminal step. Throwing is
- * intentional: this function runs as a durable Workflow step, so rejection
- * hands retry/failure policy back to the Workflow orchestrator rather than
- * letting eve falsely mark the callback delivery as complete.
- *
- * `usage` — the session's token totals — rides along on completed
- * callbacks so the caller can attribute this agent's spend. Failed
- * callbacks never carry usage.
- */
-export async function fireSessionCallbackStep(input: {
- readonly error?: unknown;
- readonly output?: unknown;
- readonly serializedContext: Record<string, unknown>;
- readonly status: "completed" | "failed";
- readonly usage?: TokenUsage;
-}): Promise<void> {
- "use step";
-
- const sessionId = (input.serializedContext["eve.sessionId"] as string | undefined) ?? "";
- const value = input.serializedContext[SessionCallbackKey.name];
- if (value === undefined) {
- return;
- }
-
- let callback: SessionCallback;
- try {
- callback = parseSerializedSessionCallback(value);
- } catch (error) {
- log.error("invalid session callback metadata", { error, sessionId });
- throw error;
- }
- const body =
- input.status === "completed"
- ? buildCompletedCallbackBody({
- callback,
- output: input.output,
- sessionId,
- usage: input.usage,
- })
- : {
- callId: callback.callId,
- error: {
- code: SESSION_FAILED,
- message: toErrorMessage(input.error),
- },
- kind: "session.failed" as const,
- sessionId,
- subagentName: callback.subagentName,
- usage: input.usage,
- };
-
- const response = await postSessionCallbackRequest({ body, url: callback.url });
-
- if (!response.ok) {
- throw new Error(`Session callback failed with HTTP ${response.status}.`);
- }
-}
-
-function buildCompletedCallbackBody(input: {
- readonly callback: SessionCallback;
- readonly output: unknown;
- readonly sessionId: string;
- readonly usage: TokenUsage | undefined;
-}): Record<string, unknown> {
- const base = {
- callId: input.callback.callId,
- kind: "session.completed" as const,
- output: input.output ?? "",
- sessionId: input.sessionId,
- subagentName: input.callback.subagentName,
- };
- return input.usage === undefined ? base : { ...base, usage: input.usage };
-}
-
function parseSerializedSessionCallback(value: unknown): SessionCallback {
const parsed = parseSessionCallback(value);
if (!parsed.ok) {
diff --git a/packages/eve/src/subagents/event-proxy-step.integration.test.ts b/packages/eve/src/subagents/event-proxy-step.integration.test.ts
index b4e2d0524..3352ca88e 100644
--- a/packages/eve/src/subagents/event-proxy-step.integration.test.ts
+++ b/packages/eve/src/subagents/event-proxy-step.integration.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, it, vi } from "vitest";
import type { ChannelAdapter } from "#channel/adapter.js";
import type { SubagentInputRequestHookPayload } from "#channel/types.js";
import { ContextContainer } from "#context/container.js";
-import { AuthKey, ContinuationTokenKey, ModeKey, SessionIdKey } from "#context/keys.js";
+import { AuthKey, ContinuationTokenKey, SessionIdKey } from "#context/keys.js";
import type { DurableSession } from "#execution/durable-session-store.js";
import { getProxyInputRequests } from "#harness/proxy-input-requests.js";
import { createSessionLimitContinuationRequest } from "#harness/session-limit-continuation.js";
@@ -15,11 +15,10 @@ import {
ChannelKey,
type CompiledBundle,
} from "#runtime/sessions/runtime-context-keys.js";
-import type { RunMode } from "#shared/run-mode.js";
import { emitProxiedSubagentEvent } from "#subagents/event-proxy-step.js";
import { routeDeliverPayload } from "#subagents/hitl-proxy.js";
-function fixture(mode: RunMode = "conversation", turnId = "parent-turn") {
+function fixture(turnId = "parent-turn") {
const order: string[] = [];
const events: MessageStreamEvent[] = [];
const typed = vi.fn(async (event: MessageStreamEvent, _ctx: HookContext) => {
@@ -71,7 +70,6 @@ function fixture(mode: RunMode = "conversation", turnId = "parent-turn") {
ctx.set(BundleKey, bundle);
ctx.set(ChannelKey, adapter);
ctx.set(ContinuationTokenKey, "http:parent");
- ctx.set(ModeKey, mode);
ctx.set(SessionIdKey, "parent-session");
const durableSession: DurableSession = {
agent: { system: "" },
@@ -115,19 +113,12 @@ function fixture(mode: RunMode = "conversation", turnId = "parent-turn") {
}
describe("proxied stream hooks", () => {
- it.each([
- { mode: "conversation", turnId: "parent-turn" },
- { mode: "conversation", turnId: "" },
- { mode: "task", turnId: "parent-turn" },
- ] as const)(
- "publishes hooks in parent context ($mode, turn=$turnId)",
- async ({ mode, turnId }) => {
- const f = fixture(mode, turnId);
+ it.each([{ turnId: "parent-turn" }, { turnId: "" }] as const)(
+ "publishes hooks in parent context (turn=$turnId)",
+ async ({ turnId }) => {
+ const f = fixture(turnId);
const result = await emitProxiedSubagentEvent(f);
- const types =
- mode === "conversation"
- ? ["input.requested", "turn.completed", "session.waiting"]
- : ["input.requested"];
+ const types = ["input.requested", "turn.completed", "session.waiting"];
expect(f.events.map((event) => event.type)).toEqual(types);
expect(f.order).toEqual(
types.flatMap((type) => [
diff --git a/packages/eve/src/subagents/event-proxy-step.ts b/packages/eve/src/subagents/event-proxy-step.ts
index 78aa167d6..e1f56219d 100644
--- a/packages/eve/src/subagents/event-proxy-step.ts
+++ b/packages/eve/src/subagents/event-proxy-step.ts
@@ -4,7 +4,6 @@ import type {
SubagentInputRequestHookPayload,
} from "#channel/types.js";
import type { ContextContainer } from "#context/container.js";
-import { ModeKey } from "#context/keys.js";
import { withContextScope } from "#context/run-step.js";
import { deserializeContext, serializeContext } from "#context/serialize.js";
import { publishChannelEvent } from "#execution/publish-channel-event.js";
@@ -28,7 +27,6 @@ import type { HarnessSession } from "#harness/types.js";
import type { UnstampedMessageStreamEvent } from "#protocol/message.js";
import { BundleKey, ChannelKey } from "#runtime/sessions/runtime-context-keys.js";
import { resolveEffectiveAgentRuntime } from "#execution/effective-agent-config.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { TaskInputRequestDelivery } from "#tasks/types.js";
type SubagentEventHookPayload =
@@ -138,7 +136,6 @@ export async function emitProxiedSubagentEvent(input: {
session: await closeStandaloneAuthorizationEvent({
emit,
eventType: input.hookPayload.event.type,
- mode: ctx.require(ModeKey),
session: enrichedSession,
}),
};
@@ -147,7 +144,6 @@ export async function emitProxiedSubagentEvent(input: {
const proxyResult = await emitProxiedInputRequest({
emit,
hookPayload: input.hookPayload,
- mode: ctx.require(ModeKey),
session: enrichedSession,
});
return { result: proxyResult.entries, session: proxyResult.session };
@@ -185,17 +181,16 @@ export async function emitProxiedSubagentEvent(input: {
async function closeStandaloneAuthorizationEvent(input: {
readonly emit: (event: UnstampedMessageStreamEvent) => Promise<void>;
readonly eventType: SubagentAuthorizationEventHookPayload["event"]["type"];
- readonly mode: RunMode;
readonly session: HarnessSession;
}): Promise<HarnessSession> {
if (
- input.mode !== "conversation" ||
- (input.eventType !== "authorization.required" && input.eventType !== "authorization.completed")
+ input.eventType !== "authorization.required" &&
+ input.eventType !== "authorization.completed"
) {
return input.session;
}
const state = getHarnessEmissionState(input.session.state);
- const nextState = await emitTurnEpilogue(input.emit, state, input.mode);
+ const nextState = await emitTurnEpilogue(input.emit, state);
return setHarnessEmissionState(input.session, nextState);
}
diff --git a/packages/eve/src/subagents/hitl-proxy.integration.test.ts b/packages/eve/src/subagents/hitl-proxy.integration.test.ts
index 9ec6dcf9c..879544649 100644
--- a/packages/eve/src/subagents/hitl-proxy.integration.test.ts
+++ b/packages/eve/src/subagents/hitl-proxy.integration.test.ts
@@ -223,7 +223,6 @@ describe("subagent HITL proxy → Slack-style text-approve regression (Finding #
const { entries, session: sessionAfterEmit } = await emitProxiedInputRequest({
emit,
hookPayload,
- mode: "conversation",
session: buildEmptySession("parent-token", "sess-parent"),
});
// Simulate the workflow step's post-step
@@ -252,10 +251,9 @@ describe("subagent HITL proxy → Slack-style text-approve regression (Finding #
],
]);
- // The parent is in conversation mode, so the helper follows the
- // proxied `input.requested` with a `turn.completed` +
- // `session.waiting` pair so client event-stream readers stop
- // draining and prompt for the HITL response.
+ // The helper follows the proxied `input.requested` with a
+ // `turn.completed` + `session.waiting` pair so client event-stream
+ // readers stop draining and prompt for the HITL response.
const emittedTypes = events.map((event) => event.type);
expect(emittedTypes).toEqual(["input.requested", "turn.completed", "session.waiting"]);
@@ -318,36 +316,6 @@ describe("subagent HITL proxy → Slack-style text-approve regression (Finding #
},
]);
});
-
- it("in task mode, skips the `turn.completed` + `session.waiting` boundary so scheduled chains do not fake a wait", async () => {
- // Scheduled-task roots must not emit `session.waiting` — a proxied
- // HITL there signals an impending `SUBAGENT_EXECUTION_FAILED`, not
- // a client-facing park. This test pins the mode-gating in place
- // so a refactor cannot re-introduce the boundary pair for task
- // mode.
- const slackishAdapter = buildSlackishAdapter();
- const bundle = buildMockBundle([slackishAdapter]);
-
- const ctx = new ContextContainer();
- ctx.set(BundleKey, bundle);
- ctx.set(ChannelKey, slackishAdapter);
-
- const { emit, events } = buildCapturingEmit(ctx);
- await emitProxiedInputRequest({
- emit,
- hookPayload: buildHitlPayload({
- callId: "call-task-1",
- childContinuationToken: "subagent:task-parent:call-task-1",
- childSessionId: "sess-task-child",
- request: buildApprovalRequest("req-task-1"),
- subagentName: "linear",
- }),
- mode: "task",
- session: buildEmptySession("task-parent-token", "sess-task-parent"),
- });
-
- expect(events.map((event) => event.type)).toEqual(["input.requested"]);
- });
});
// ---------------------------------------------------------------------------
@@ -383,7 +351,6 @@ describe("subagent HITL proxy → concurrent-descendant routing", () => {
const { entries: entriesA } = await emitProxiedInputRequest({
emit,
hookPayload: payloadA,
- mode: "conversation",
session: buildEmptySession("parent-token", "sess-parent"),
});
@@ -399,7 +366,6 @@ describe("subagent HITL proxy → concurrent-descendant routing", () => {
const { entries: entriesB } = await emitProxiedInputRequest({
emit,
hookPayload: payloadB,
- mode: "conversation",
session: buildEmptySession("parent-token", "sess-parent"),
});
persistAdapterState();
diff --git a/packages/eve/src/subagents/hitl-proxy.ts b/packages/eve/src/subagents/hitl-proxy.ts
index bdc1cb15e..6c20ff0bd 100644
--- a/packages/eve/src/subagents/hitl-proxy.ts
+++ b/packages/eve/src/subagents/hitl-proxy.ts
@@ -12,7 +12,6 @@ import {
import type { AnswerHookRoute, ProxyInputRequest } from "#harness/proxy-input-requests.js";
import type { HarnessEmitFn, HarnessSession, SessionStateMap } from "#harness/types.js";
import { createInputRequestedEvent } from "#protocol/message.js";
-import type { RunMode } from "#shared/run-mode.js";
import type { InputResponse } from "#shared/input.js";
import { resolveTextToResponse } from "#channel/resolve-text.js";
import { SESSION_LIMIT_STOP_OPTION_ID } from "#harness/session-limit-continuation.js";
@@ -22,14 +21,13 @@ import { SESSION_LIMIT_STOP_OPTION_ID } from "#harness/session-limit-continuatio
// ---------------------------------------------------------------------------
/**
- * Runs the parent-side work for a `subagent-input-request`. Conversation
- * mode emits a waiting boundary on the parent stream; the returned proxy
- * entries route the eventual response back down to the child.
+ * Runs the parent-side work for a `subagent-input-request`: emits the request
+ * and a waiting boundary on the parent stream. The returned proxy entries
+ * route the eventual response back down to the child.
*/
export async function emitProxiedInputRequest(input: {
readonly emit: HarnessEmitFn;
readonly hookPayload: SubagentInputRequestHookPayload;
- readonly mode: RunMode;
readonly session: HarnessSession;
}): Promise<{
readonly entries: readonly (readonly [requestId: string, route: ProxyInputRequest])[];
@@ -44,17 +42,11 @@ export async function emitProxiedInputRequest(input: {
}),
);
- let nextSession = input.session;
-
- if (input.mode === "conversation") {
- const state = getHarnessEmissionState(input.session.state);
- const nextState = await emitTurnEpilogue(input.emit, state, input.mode);
- nextSession = setHarnessEmissionState(input.session, nextState);
- }
-
+ const state = getHarnessEmissionState(input.session.state);
+ const nextState = await emitTurnEpilogue(input.emit, state);
return {
entries: toProxyInputRequestEntries(input.hookPayload),
- session: nextSession,
+ session: setHarnessEmissionState(input.session, nextState),
};
}
diff --git a/packages/eve/src/subagents/invocation.ts b/packages/eve/src/subagents/invocation.ts
index 10fc3b694..f95a65882 100644
--- a/packages/eve/src/subagents/invocation.ts
+++ b/packages/eve/src/subagents/invocation.ts
@@ -20,12 +20,11 @@ export interface FormattedSubagentInvocation extends StepInput {
}
/**
- * Normalizes the `outputSchema` a model passed on a subagent tool call.
- * Models routinely send an empty `{}` despite the tool schema saying to omit
- * it; an empty JSON Schema constrains nothing, but honoring it flips the
- * child into structured-output mode and discards its text reply. Only a
- * non-empty object counts as a requested schema — local and remote dispatch
- * share this rule.
+ * Reads the `outputSchema` a `ctx.agent()` call requested. An empty `{}`
+ * constrains nothing, but honoring it would flip the child into
+ * structured-output mode and discard its text reply, so only a non-empty
+ * object counts as a requested schema. Local and remote dispatch share this
+ * rule.
*/
export function normalizeRequestedOutputSchema(
outputSchema: JsonValue | undefined,
diff --git a/packages/eve/src/subagents/parent-notification.test.ts b/packages/eve/src/subagents/parent-notification.test.ts
index 3be6096d2..ebb064043 100644
--- a/packages/eve/src/subagents/parent-notification.test.ts
+++ b/packages/eve/src/subagents/parent-notification.test.ts
@@ -7,7 +7,6 @@ import { BundleKey, ChannelKey } from "#runtime/sessions/runtime-context-keys.js
import { getCompiledRuntimeAgentBundle } from "#runtime/sessions/compiled-agent-cache.js";
import {
bindTurnCallerContextStep,
- notifyDelegatedParentStep,
notifyTurnCallerStep,
resolveInitialTurnCallerStep,
} from "#subagents/parent-notification.js";
@@ -15,7 +14,6 @@ import { SUBAGENT_ADAPTER } from "#subagents/adapter.js";
import { SUBAGENT_ADAPTER_KIND } from "#subagents/adapter-state.js";
import { HookNotFoundError } from "#compiled/@workflow/errors/index.js";
import { resumeHook } from "#internal/workflow/runtime.js";
-import type { RuntimeSubagentChildResult } from "#shared/action-types.js";
vi.mock("../runtime/sessions/compiled-agent-cache.js", () => ({
getCompiledRuntimeAgentBundle: vi.fn(),
@@ -31,21 +29,6 @@ const fetchMock = vi.fn();
const USAGE = { cacheReadTokens: 10, cacheWriteTokens: 5, inputTokens: 100, outputTokens: 50 };
const ZERO_USAGE = { cacheReadTokens: 0, cacheWriteTokens: 0, inputTokens: 0, outputTokens: 0 };
-function createSuccessResult(): RuntimeSubagentChildResult {
- return {
- callId: "call-1",
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: "done" },
- usageDelta: ZERO_USAGE,
- },
- output: "done",
- subagentName: "research",
- };
-}
-
function createSerializedContext(
adapterState: Record<string, unknown> = {},
): Record<string, unknown> {
@@ -74,88 +57,6 @@ function createSerializedContext(
return serializeContext(ctx);
}
-describe("notifyDelegatedParentStep", () => {
- beforeEach(() => {
- resumeHookMock.mockReset();
- resumeHookMock.mockResolvedValue(undefined as never);
- });
-
- it("attaches usage to a success result and folds it into the outcome delta", async () => {
- await notifyDelegatedParentStep({
- result: createSuccessResult(),
- serializedContext: createSerializedContext(),
- usage: USAGE,
- });
-
- expect(resumeHookMock).toHaveBeenCalledWith("parent-tok", {
- kind: "runtime-action-result",
- results: [
- {
- callId: "call-1",
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: "done" },
- usageDelta: USAGE,
- },
- output: "done",
- subagentName: "research",
- usage: USAGE,
- },
- ],
- });
- });
-
- it("omits usage when none is provided", async () => {
- await notifyDelegatedParentStep({
- result: createSuccessResult(),
- serializedContext: createSerializedContext(),
- });
-
- expect(resumeHookMock).toHaveBeenCalledWith("parent-tok", {
- kind: "runtime-action-result",
- results: [createSuccessResult()],
- });
- });
-
- it("attaches usage to error results", async () => {
- const errorResult: RuntimeSubagentChildResult = {
- callId: "call-1",
- isError: true,
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: {
- error: { code: "SUBAGENT_EXECUTION_FAILED", message: "boom" },
- kind: "failed",
- },
- usageDelta: ZERO_USAGE,
- },
- output: { code: "SUBAGENT_EXECUTION_FAILED", message: "boom" },
- subagentName: "research",
- };
-
- await notifyDelegatedParentStep({
- result: errorResult,
- serializedContext: createSerializedContext(),
- usage: USAGE,
- });
-
- expect(resumeHookMock).toHaveBeenCalledWith("parent-tok", {
- kind: "runtime-action-result",
- results: [
- {
- ...errorResult,
- outcome: { ...errorResult.outcome, usageDelta: USAGE },
- usage: USAGE,
- },
- ],
- });
- });
-});
-
describe("turn caller notification", () => {
beforeEach(() => {
resumeHookMock.mockReset();
diff --git a/packages/eve/src/subagents/parent-notification.ts b/packages/eve/src/subagents/parent-notification.ts
index 6299f4aab..4027acbcc 100644
--- a/packages/eve/src/subagents/parent-notification.ts
+++ b/packages/eve/src/subagents/parent-notification.ts
@@ -1,7 +1,4 @@
-/**
- * Sends delegated task results to their parent and conversation results to
- * the caller of each turn.
- */
+/** Sends settled turn results to the caller of each turn. */
import { ChannelKey } from "#runtime/sessions/runtime-context-keys.js";
import { deserializeContext } from "#context/serialize.js";
@@ -27,55 +24,6 @@ import { readTaskIdFromInboxToken } from "#tasks/task-inbox-token.js";
const log = createLogger("execution.delegated-parent-notification");
-/**
- * Resumes the parent owner's hook with a delegated subagent result.
- * No-op for root sessions.
- *
- * `usage` — the completed child's session-total token spend — is
- * attached to success results so the caller can attribute the
- * subagent's tokens. Error results never carry usage.
- */
-export async function notifyDelegatedParentStep(input: {
- readonly result: RuntimeSubagentChildResult | undefined;
- readonly serializedContext: Record<string, unknown>;
- readonly usage?: TokenUsage;
-}): Promise<void> {
- "use step";
-
- if (input.result === undefined) {
- return;
- }
-
- const ctx = await deserializeContext(input.serializedContext);
- const adapter = ctx.get(ChannelKey);
-
- if (adapter?.kind !== SUBAGENT_ADAPTER_KIND) {
- return;
- }
-
- const parentContinuationToken = String(adapter.state?.parentContinuationToken ?? "");
- if (parentContinuationToken === "") {
- return;
- }
-
- // A task child reports its session totals exactly once, so those totals
- // are the turn's usage delta; the terminal envelope carries them so the
- // parent folds spend from the outcome alone.
- const result =
- input.usage === undefined
- ? input.result
- : {
- ...input.result,
- outcome: { ...input.result.outcome, usageDelta: input.usage },
- usage: input.usage,
- };
-
- await resumeHook(parentContinuationToken, {
- kind: "runtime-action-result",
- results: [result],
- });
-}
-
/** Settled turn payload forwarded from the owner to the caller. */
export interface SettledTurnNotification {
readonly output: unknown;
diff --git a/packages/eve/src/subagents/parent-result.ts b/packages/eve/src/subagents/parent-result.ts
deleted file mode 100644
index 01ddd2edf..000000000
--- a/packages/eve/src/subagents/parent-result.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Pure helpers that project a delegated subagent's terminal output
- * into the runtime-action result shape its parent owner expects.
- * Lives in its own (non-directive) file to escape the workflow
- * step-proxy transform.
- */
-
-import { SUBAGENT_EXECUTION_FAILED } from "#subagents/agent-handle-errors.js";
-import type { RuntimeSubagentChildResult } from "#shared/action-types.js";
-import type { JsonValue } from "#shared/json.js";
-import { toErrorMessage } from "#shared/errors.js";
-import type { TokenUsage } from "#shared/token-usage.js";
-import { SUBAGENT_ADAPTER_KIND } from "#subagents/adapter-state.js";
-import { CHANNEL_CONTEXT_KEY_NAME } from "#context/key-names.js";
-
-const ZERO_TOKEN_USAGE: TokenUsage = {
- cacheReadTokens: 0,
- cacheWriteTokens: 0,
- inputTokens: 0,
- outputTokens: 0,
-};
-
-/**
- * Builds the success-shaped {@link RuntimeSubagentChildResult}.
- * Returns `undefined` for root sessions (no parent to notify).
- */
-export function createDelegatedSubagentSuccessResult(
- serializedContext: Record<string, unknown>,
- output: unknown,
-): RuntimeSubagentChildResult | undefined {
- const channel = serializedContext[CHANNEL_CONTEXT_KEY_NAME] as
- | { kind?: string; state?: Record<string, unknown> }
- | undefined;
-
- if (channel?.kind !== SUBAGENT_ADAPTER_KIND) {
- return undefined;
- }
-
- // A task child ends with its result, so the outcome is always terminal.
- // `usageDelta` starts at zero; the notification step folds in the child's
- // session totals when it has them (task children report exactly once).
- return {
- callId: String(channel.state?.callId ?? ""),
- kind: "subagent-result",
- origin: "child",
- outcome: {
- kind: "terminal",
- result: { kind: "succeeded", output: output as JsonValue },
- usageDelta: ZERO_TOKEN_USAGE,
- },
- output: output as JsonValue,
- subagentName: String(channel.state?.subagentName ?? ""),
- };
-}
-
-/** Failure-path mirror of {@link createDelegatedSubagentSuccessResult}. */
-export function createDelegatedSubagentErrorResult(
- serializedContext: Record<string, unknown>,
- error: unknown,
-): RuntimeSubagentChildResult | undefined {
- const success = createDelegatedSubagentSuccessResult(serializedContext, "");
-
- if (success === undefined) {
- return undefined;
- }
-
- const output = {
- code: SUBAGENT_EXECUTION_FAILED,
- message: toErrorMessage(error),
- };
- return {
- ...success,
- isError: true,
- outcome: {
- kind: "terminal",
- result: { error: output, kind: "failed" },
- usageDelta: ZERO_TOKEN_USAGE,
- },
- output,
- };
-}
diff --git a/packages/eve/src/subagents/remote-dispatch.test.ts b/packages/eve/src/subagents/remote-dispatch.test.ts
index bcdd5e9c9..8675f812d 100644
--- a/packages/eve/src/subagents/remote-dispatch.test.ts
+++ b/packages/eve/src/subagents/remote-dispatch.test.ts
@@ -345,7 +345,6 @@ describe("startRemoteAgentSession", () => {
"find the marker",
].join("\n"),
capabilities: {},
- mode: "conversation",
});
expect(
readForwardedParentSessionBaggage(
@@ -485,7 +484,7 @@ describe("startRemoteAgentSession", () => {
);
});
- it("sends a declared outputSchema on the remote create-session request", async () => {
+ it("sends a requested outputSchema on the remote create-session request", async () => {
const fetchMock = vi.fn().mockResolvedValue(
new Response(
JSON.stringify({
@@ -504,10 +503,11 @@ describe("startRemoteAgentSession", () => {
type: "object",
} as const;
+ const action = createAction();
await startRemoteAgentSession({
- action: createAction(),
+ action: { ...action, input: { ...action.input, outputSchema } },
callbackBaseUrl: "https://caller.example.com",
- remote: { ...createRemoteAgent(), outputSchema },
+ remote: createRemoteAgent(),
session: {
agent: { modelReference: { id: "mock/test" }, system: "", tools: [] },
compaction: { recentWindowSize: 10, threshold: 100000 },
@@ -520,15 +520,13 @@ describe("startRemoteAgentSession", () => {
const body = JSON.parse(fetchMock.mock.calls[0]?.[1]?.body as string);
expect(body.outputSchema).toEqual(outputSchema);
- expect(body.mode).toBe("conversation");
expect(body.capabilities).toEqual({});
});
- it("ignores an empty model-passed outputSchema instead of forwarding it", async () => {
- // Models routinely pass `outputSchema: {}` despite the tool schema saying
- // to omit it. An empty schema constrains nothing, but forwarding it flips
- // the remote child into structured-output mode and discards its text
- // reply — local subagent dispatch already drops it; remote must match.
+ it("ignores an empty requested outputSchema instead of forwarding it", async () => {
+ // An empty schema constrains nothing, but forwarding it flips the remote
+ // child into structured-output mode and discards its text reply; local
+ // subagent dispatch already drops it, and remote must match.
const fetchMock = vi.fn().mockResolvedValue(
new Response(
JSON.stringify({
diff --git a/packages/eve/src/subagents/remote-dispatch.ts b/packages/eve/src/subagents/remote-dispatch.ts
index 18615769c..6b1e7060f 100644
--- a/packages/eve/src/subagents/remote-dispatch.ts
+++ b/packages/eve/src/subagents/remote-dispatch.ts
@@ -104,7 +104,6 @@ export async function startRemoteAgentSession(input: {
activityObserver?: ActivityObserverConfig;
forwardedPrincipal?: ForwardedPrincipal;
message: string;
- mode: "conversation" | "task";
operationId?: string;
outputSchema?: object;
} = {
@@ -123,9 +122,7 @@ export async function startRemoteAgentSession(input: {
action: input.action,
remote: input.remote,
}),
- mode: "conversation",
- outputSchema:
- normalizeRequestedOutputSchema(input.action.input.outputSchema) ?? input.remote.outputSchema,
+ outputSchema: normalizeRequestedOutputSchema(input.action.input.outputSchema),
};
if (input.activityObserver !== undefined) requestBody.activityObserver = input.activityObserver;
if (forwardedPrincipal !== undefined) {
@@ -475,7 +472,6 @@ export function resolveRemoteAgentForAction(input: {
logicalPath: string;
name: string;
nodeId: string;
- outputSchema?: ResolvedRuntimeRemoteAgentNode["outputSchema"];
path: string;
sourceId: string;
sourceKind: "module";
@@ -486,7 +482,6 @@ export function resolveRemoteAgentForAction(input: {
logicalPath: definition.logicalPath,
name: input.remoteAgentName,
nodeId: input.nodeId,
- outputSchema: config.outputSchema,
path: config.path,
sourceId: definition.sourceId,
sourceKind: "module",
diff --git a/packages/eve/src/subagents/tool.test.ts b/packages/eve/src/subagents/tool.test.ts
index dce98097b..2bc794c98 100644
--- a/packages/eve/src/subagents/tool.test.ts
+++ b/packages/eve/src/subagents/tool.test.ts
@@ -119,7 +119,6 @@ describe("buildSubagentRunInput", () => {
});
expect(runInput.continuationToken).toBe(childContinuationToken);
expect(childContinuationToken).toMatch(/^subagent:parent-session:call-1$/);
- expect(runInput.mode).toBe("conversation");
});
it("routes parent notifications to an active turn inbox when supplied", () => {
@@ -275,39 +274,6 @@ describe("buildSubagentRunInput", () => {
});
expect(runInput.input.outputSchema).toEqual(schema);
- expect(runInput.mode).toBe("conversation");
- });
-
- it("uses a declared local outputSchema on the persistent child's first turn", () => {
- const schema = { properties: { result: { type: "string" } }, type: "object" };
- const { runInput } = buildSubagentRunInput({
- action: makeAction(),
- auth: null,
- initiatorAuth: null,
- selfAgent: false,
- session: makeSession(),
- source: { description: "Research the request.", outputSchema: schema, type: "local" },
- parent: makeParent(makeSession(), { id: "turn-0", sequence: 0 }),
- });
-
- expect(runInput.input.outputSchema).toEqual(schema);
- expect(runInput.mode).toBe("conversation");
- });
-
- it("lets a per-call outputSchema override the local child's declared schema", () => {
- const declared = { properties: { declared: { type: "string" } }, type: "object" };
- const requested = { properties: { requested: { type: "number" } }, type: "object" };
- const { runInput } = buildSubagentRunInput({
- action: { ...makeAction(), input: { message: "do something", outputSchema: requested } },
- auth: null,
- initiatorAuth: null,
- selfAgent: false,
- session: makeSession(),
- source: { description: "Research the request.", outputSchema: declared, type: "local" },
- parent: makeParent(makeSession(), { id: "turn-0", sequence: 0 }),
- });
-
- expect(runInput.input.outputSchema).toEqual(requested);
});
it("hands the parent's trace window down to the child, and omits it when absent", () => {
@@ -392,22 +358,6 @@ describe("buildSubagentRunInput", () => {
expect(runInput.input.message).not.toContain(action.description);
});
- it("uses the root agent's declared outputSchema for a fresh built-in copy", () => {
- const schema = { properties: { result: { type: "string" } }, type: "object" };
- const { runInput } = buildSubagentRunInput({
- action: { ...makeAction(), name: "agent", nodeId: "root", subagentName: "agent" },
- auth: null,
- initiatorAuth: null,
- selfAgent: true,
- session: makeSession(),
- source: { outputSchema: schema, type: "runtime" },
- parent: makeParent(makeSession(), { id: "turn-0", sequence: 0 }),
- });
-
- expect(runInput.input.outputSchema).toEqual(schema);
- expect(runInput.mode).toBe("conversation");
- });
-
it("leaves outputSchema undefined when not provided", () => {
const { runInput } = buildRuntimeSubagentRunInput({
action: makeAction(),
diff --git a/packages/eve/src/subagents/tool.ts b/packages/eve/src/subagents/tool.ts
index 5e4fc7cb0..bc81e0eca 100644
--- a/packages/eve/src/subagents/tool.ts
+++ b/packages/eve/src/subagents/tool.ts
@@ -16,17 +16,14 @@ import type { HarnessSession } from "#harness/types.js";
import type { RuntimeSubagentDispatchRequest } from "#shared/action-types.js";
import { mintSubagentContinuationToken } from "#execution/session.js";
import { resolveRemainingSessionTokenLimits } from "#subagents/token-budget.js";
-import type { JsonObject } from "#shared/json.js";
import type { ConversationContext } from "#shared/conversation-context.js";
export type SubagentInputSource =
| {
readonly description: string;
- readonly outputSchema?: JsonObject;
readonly type: "local";
}
| {
- readonly outputSchema?: JsonObject;
readonly type: "runtime";
};
@@ -151,10 +148,9 @@ export function buildSubagentRunInput(input: {
action,
source,
}),
- outputSchema: requestedOutputSchema ?? source.outputSchema,
+ outputSchema: requestedOutputSchema,
},
limits: inheritedLimits,
- mode: "conversation",
conversationId: input.parent.conversationId,
parent: input.parent.lineage,
parentTraceContext: input.parent.traceContext,
diff --git a/packages/eve/src/tools/framework/agent-contract.ts b/packages/eve/src/tools/framework/agent-contract.ts
index 2cbed24ed..0b60841b1 100644
--- a/packages/eve/src/tools/framework/agent-contract.ts
+++ b/packages/eve/src/tools/framework/agent-contract.ts
@@ -1,4 +1,3 @@
-import type { JsonObject } from "#shared/json.js";
import { defineJsonSchema } from "#tools/schema.js";
export const AGENT_TOOL_NAME = "agent";
@@ -13,7 +12,6 @@ export const AGENT_TOOL_DESCRIPTION = [
export interface SubagentToolInput {
agentId?: string | null;
message: string;
- outputSchema?: JsonObject;
}
export const SUBAGENT_TOOL_INPUT_SCHEMA = defineJsonSchema<SubagentToolInput>({
@@ -29,11 +27,6 @@ export const SUBAGENT_TOOL_INPUT_SCHEMA = defineJsonSchema<SubagentToolInput>({
description:
"The message to send to the subagent. Provide all context the subagent needs to complete the task; the subagent does not see the parent's history.",
},
- outputSchema: {
- type: "object",
- description:
- "Only provide a non-empty JSON Schema when the caller explicitly requests structured output; otherwise omit this field. The subagent must match a provided schema, and that structured output becomes the tool result.",
- },
},
required: ["message"],
additionalProperties: false,
diff --git a/packages/eve/src/tools/provided/agent-router.test.ts b/packages/eve/src/tools/provided/agent-router.test.ts
index d1bc5e665..eea39c2b1 100644
--- a/packages/eve/src/tools/provided/agent-router.test.ts
+++ b/packages/eve/src/tools/provided/agent-router.test.ts
@@ -1,12 +1,8 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { agentRouter } from "#tools/provided/agent-router.js";
-import {
- AGENT_ROUTER_INPUT_SCHEMA,
- executeAgentRouterTool,
-} from "#execution/tools/agent-router.js";
+import { executeAgentRouterTool } from "#execution/tools/agent-router.js";
import { evaluate } from "#ai/evaluate.js";
-import { serializeInputSchema } from "#tools/schema.js";
import type { WorkflowToolContext } from "#tools/workflow-definition.js";
vi.mock("#ai/evaluate.js", () => ({ evaluate: vi.fn() }));
@@ -22,25 +18,6 @@ describe("agentRouter", () => {
expect(definition.execute).toBe(executeAgentRouterTool);
});
- it("advertises arbitrary output schemas without propertyNames", () => {
- const serialized = serializeInputSchema(AGENT_ROUTER_INPUT_SCHEMA);
-
- expect(serialized).toMatchObject({
- properties: { outputSchema: { type: "object" } },
- });
- expect(JSON.stringify(serialized)).not.toContain('"propertyNames"');
- expect(
- AGENT_ROUTER_INPUT_SCHEMA["~standard"].validate({
- message: "Return a structured result",
- outputSchema: {
- $defs: { answer: { type: "string" } },
- properties: { answer: { $ref: "#/$defs/answer" } },
- type: "object",
- },
- }),
- ).not.toHaveProperty("issues");
- });
-
it("routes through all workflow agent descriptions", async () => {
vi.mocked(evaluate).mockResolvedValue({
answers: { route: { choice: "operator", type: "choice" } },
@@ -107,30 +84,6 @@ describe("agentRouter", () => {
expect(agent).toHaveBeenCalledWith("researcher", { message: "Investigate" });
});
- it("forwards an output schema to the selected agent", async () => {
- vi.mocked(evaluate).mockResolvedValue({
- answers: { route: { choice: "researcher", type: "choice" } },
- } as never);
- const agent = vi.fn().mockResolvedValue({ answer: "done" });
- const ctx = workflowContext({
- agent,
- agents: { researcher: { description: "Investigate and explain." } },
- });
- const outputSchema = {
- additionalProperties: false,
- properties: { answer: { type: "string" } },
- required: ["answer"],
- type: "object",
- } as const;
-
- await executeAgentRouterTool({ message: "Investigate", outputSchema }, ctx);
-
- expect(agent).toHaveBeenCalledWith("researcher", {
- message: "Investigate",
- outputSchema,
- });
- });
-
it("rejects an agent map without descriptions before evaluation", async () => {
const ctx = workflowContext({
agent: vi.fn(),
diff --git a/packages/eve/src/tracing/agent-invocation-coordinator.test.ts b/packages/eve/src/tracing/agent-invocation-coordinator.test.ts
index 822079ca8..ad4ba5f58 100644
--- a/packages/eve/src/tracing/agent-invocation-coordinator.test.ts
+++ b/packages/eve/src/tracing/agent-invocation-coordinator.test.ts
@@ -16,7 +16,6 @@ const conversation: ConversationContext = {
audience: "private",
channel: { kind: "http" },
environment: "production",
- mode: "conversation",
principalType: "anonymous",
};
diff --git a/packages/eve/src/tracing/agent-otel-provider.test.ts b/packages/eve/src/tracing/agent-otel-provider.test.ts
index 62b7adf9b..941d597f6 100644
--- a/packages/eve/src/tracing/agent-otel-provider.test.ts
+++ b/packages/eve/src/tracing/agent-otel-provider.test.ts
@@ -80,7 +80,6 @@ const traceContext = (audience: ChannelAudience = "public") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/tracing/agent-otel-session-context.ts b/packages/eve/src/tracing/agent-otel-session-context.ts
index 148a67483..8a35862b6 100644
--- a/packages/eve/src/tracing/agent-otel-session-context.ts
+++ b/packages/eve/src/tracing/agent-otel-session-context.ts
@@ -226,7 +226,6 @@ function resolveSessionTraceDecision(
kind: normalizeInstrumentationChannelKind(event.channelKind ?? event.channelType),
},
environment,
- mode: "conversation",
principalType: "unknown",
});
}
diff --git a/packages/eve/src/tracing/agent-telemetry-contract.integration.test.ts b/packages/eve/src/tracing/agent-telemetry-contract.integration.test.ts
index 9431138f0..1edbfe1e1 100644
--- a/packages/eve/src/tracing/agent-telemetry-contract.integration.test.ts
+++ b/packages/eve/src/tracing/agent-telemetry-contract.integration.test.ts
@@ -57,7 +57,6 @@ const traceContext = (agentName: string, audience: "public" | "private") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/tracing/install-instrumentation-runtime.test.ts b/packages/eve/src/tracing/install-instrumentation-runtime.test.ts
index 28ffbbdc7..81915e698 100644
--- a/packages/eve/src/tracing/install-instrumentation-runtime.test.ts
+++ b/packages/eve/src/tracing/install-instrumentation-runtime.test.ts
@@ -205,6 +205,5 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/tracing/local-instrumentation-runtime.scenario.test.ts b/packages/eve/src/tracing/local-instrumentation-runtime.scenario.test.ts
index 77f7f85ce..1c70b1caf 100644
--- a/packages/eve/src/tracing/local-instrumentation-runtime.scenario.test.ts
+++ b/packages/eve/src/tracing/local-instrumentation-runtime.scenario.test.ts
@@ -37,7 +37,6 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/src/tracing/local-traces.test.ts b/packages/eve/src/tracing/local-traces.test.ts
index bf7c7a303..114406ecd 100644
--- a/packages/eve/src/tracing/local-traces.test.ts
+++ b/packages/eve/src/tracing/local-traces.test.ts
@@ -41,7 +41,6 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "development" as const,
- mode: "conversation" as const,
principalType: "user",
});
@@ -142,7 +141,6 @@ describe("localTracePolicy", () => {
},
channel: { kind: "http" },
environment: "development",
- mode: "conversation",
});
expect(audience).toBe("private");
diff --git a/packages/eve/src/tracing/sampled-trace.test.ts b/packages/eve/src/tracing/sampled-trace.test.ts
index d850e9ca0..e48709178 100644
--- a/packages/eve/src/tracing/sampled-trace.test.ts
+++ b/packages/eve/src/tracing/sampled-trace.test.ts
@@ -14,7 +14,6 @@ const traceContext = (
agentName: "weather",
...contentContext(audience, environment),
channel: { kind: "http" as const },
- mode: "conversation" as const,
principalType: "anonymous",
});
diff --git a/packages/eve/test/scenarios/compiled-artifacts-bootstrap.scenario.test.ts b/packages/eve/test/scenarios/compiled-artifacts-bootstrap.scenario.test.ts
index 34adc24f4..27c77c3c1 100644
--- a/packages/eve/test/scenarios/compiled-artifacts-bootstrap.scenario.test.ts
+++ b/packages/eve/test/scenarios/compiled-artifacts-bootstrap.scenario.test.ts
@@ -22,7 +22,6 @@ const traceContext = (audience: "public" | "private" | "unknown") => ({
audience,
channel: { kind: "http" as const },
environment: "production" as const,
- mode: "conversation" as const,
principalType: "anonymous",
});