@zvada/agent-server 0.3.25 → 0.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +113 -0
- package/README.md +4 -1
- package/dist/client/client.js +27 -11
- package/dist/client/connection.js +35 -3
- package/dist/core/agents/acp/acp-agent.js +91 -14
- package/dist/core/agents/acp/mappings.js +5 -1
- package/dist/core/agents/claude-code/approvals.js +3 -2
- package/dist/core/agents/claude-code/claude-agent.js +12 -2
- package/dist/core/agents/claude-code/mcp.js +9 -1
- package/dist/core/agents/claude-code/models.js +16 -10
- package/dist/core/agents/claude-code/options.js +23 -2
- package/dist/core/agents/claude-code/session.js +21 -1
- package/dist/core/agents/claude-code/tools.js +9 -4
- package/dist/core/agents/claude-code/turn.js +2 -0
- package/dist/core/agents/codex-app-server/adapter.js +2 -0
- package/dist/core/agents/codex-app-server/client.js +8 -5
- package/dist/core/agents/codex-app-server/codex-agent.js +35 -2
- package/dist/core/agents/codex-app-server/effort.js +13 -6
- package/dist/core/agents/codex-app-server/mcp.js +35 -18
- package/dist/core/agents/codex-app-server/models.js +10 -10
- package/dist/core/agents/codex-app-server/options.js +11 -2
- package/dist/core/agents/codex-app-server/plan-approval.js +1 -1
- package/dist/core/agents/codex-app-server/session.js +11 -4
- package/dist/core/agents/codex-app-server/thread-settings.js +30 -11
- package/dist/core/agents/host-tools.js +493 -0
- package/dist/core/agents/mcp-config.js +6 -2
- package/dist/core/agents/scripted/scripted-agent.js +39 -6
- package/dist/core/agents/scripted/steps.js +5 -1
- package/dist/core/agents/session-agent.js +70 -2
- package/dist/core/agents/thinking-levels.js +8 -5
- package/dist/core/index.js +1 -0
- package/dist/core/presets.js +16 -3
- package/dist/core/processes/lifeline.js +9 -5
- package/dist/core/provision/pins.js +7 -16
- package/dist/core/provision/releases.js +25 -25
- package/dist/core/proxy/loopback.js +22 -4
- package/dist/core/runtime/agent-runtime.js +15 -5
- package/dist/core/runtime/event-processor.js +13 -8
- package/dist/core/runtime/origin-line.js +42 -0
- package/dist/core/runtime/request-broker.js +2 -1
- package/dist/core/runtime/steering.js +4 -3
- package/dist/core/runtime/turn.js +6 -4
- package/dist/operator/errors.js +97 -0
- package/dist/operator/index.js +10 -5
- package/dist/operator/mcp.js +7 -12
- package/dist/operator/operator.js +1336 -380
- package/dist/operator/refs.js +59 -0
- package/dist/operator/render.js +171 -74
- package/dist/operator/session-tools.js +87 -0
- package/dist/operator/types.js +30 -0
- package/dist/operator/view.js +82 -27
- package/dist/protocol/config.js +33 -6
- package/dist/protocol/conversation.js +3 -0
- package/dist/protocol/history.js +2 -1
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/lifecycle.js +19 -0
- package/dist/protocol/model-catalog.js +58 -18
- package/dist/protocol/models.js +6 -27
- package/dist/protocol/origin.js +39 -0
- package/dist/protocol/reduce.js +2 -0
- package/dist/protocol/thinking.js +22 -9
- package/dist/protocol/wire-api.js +2 -2
- package/dist/protocol/wire.js +17 -0
- package/dist/server/bin.js +6 -4
- package/dist/server/routes.js +15 -5
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/client/connection.d.ts +14 -2
- package/dist/types/client/connection.d.ts.map +1 -1
- package/dist/types/client/turns.d.ts +2 -2
- package/dist/types/client/turns.d.ts.map +1 -1
- package/dist/types/core/agents/acp/acp-agent.d.ts +15 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
- package/dist/types/core/agents/acp/mappings.d.ts +5 -1
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
- package/dist/types/core/agents/acp/requests.d.ts +2 -0
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -1
- package/dist/types/core/agents/base.d.ts +2 -0
- package/dist/types/core/agents/base.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/approvals.d.ts +2 -1
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +1 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/mcp.d.ts +8 -1
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/models.d.ts +9 -5
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts +10 -1
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/session.d.ts +2 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/turn.d.ts +3 -0
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/client.d.ts +2 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +11 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/effort.d.ts +7 -7
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +11 -3
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/models.d.ts +4 -1
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/options.d.ts +9 -2
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/requests.d.ts +2 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/session.d.ts +6 -3
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
- package/dist/types/core/agents/host-tools.d.ts +162 -0
- package/dist/types/core/agents/host-tools.d.ts.map +1 -0
- package/dist/types/core/agents/mcp-config.d.ts +11 -2
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
- package/dist/types/core/agents/scripted/scripted-agent.d.ts +14 -1
- package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -1
- package/dist/types/core/agents/scripted/steps.d.ts.map +1 -1
- package/dist/types/core/agents/session-agent.d.ts +2 -7
- package/dist/types/core/agents/session-agent.d.ts.map +1 -1
- package/dist/types/core/agents/thinking-levels.d.ts +7 -3
- package/dist/types/core/agents/thinking-levels.d.ts.map +1 -1
- package/dist/types/core/index.d.ts +1 -0
- package/dist/types/core/index.d.ts.map +1 -1
- package/dist/types/core/presets.d.ts +11 -1
- package/dist/types/core/presets.d.ts.map +1 -1
- package/dist/types/core/processes/lifeline.d.ts.map +1 -1
- package/dist/types/core/provision/pins.d.ts +5 -4
- package/dist/types/core/provision/pins.d.ts.map +1 -1
- package/dist/types/core/proxy/loopback.d.ts.map +1 -1
- package/dist/types/core/runtime/agent-runtime.d.ts +4 -2
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
- package/dist/types/core/runtime/event-processor.d.ts +2 -2
- package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
- package/dist/types/core/runtime/origin-line.d.ts +15 -0
- package/dist/types/core/runtime/origin-line.d.ts.map +1 -0
- package/dist/types/core/runtime/request-broker.d.ts +1 -1
- package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
- package/dist/types/core/runtime/steering.d.ts +7 -4
- package/dist/types/core/runtime/steering.d.ts.map +1 -1
- package/dist/types/core/runtime/turn.d.ts.map +1 -1
- package/dist/types/operator/errors.d.ts +83 -0
- package/dist/types/operator/errors.d.ts.map +1 -0
- package/dist/types/operator/index.d.ts +10 -5
- package/dist/types/operator/index.d.ts.map +1 -1
- package/dist/types/operator/mcp.d.ts +1 -1
- package/dist/types/operator/mcp.d.ts.map +1 -1
- package/dist/types/operator/operator.d.ts +15 -197
- package/dist/types/operator/operator.d.ts.map +1 -1
- package/dist/types/operator/refs.d.ts +25 -0
- package/dist/types/operator/refs.d.ts.map +1 -0
- package/dist/types/operator/render.d.ts +59 -19
- package/dist/types/operator/render.d.ts.map +1 -1
- package/dist/types/operator/session-tools.d.ts +61 -0
- package/dist/types/operator/session-tools.d.ts.map +1 -0
- package/dist/types/operator/types.d.ts +441 -0
- package/dist/types/operator/types.d.ts.map +1 -0
- package/dist/types/operator/view.d.ts +19 -29
- package/dist/types/operator/view.d.ts.map +1 -1
- package/dist/types/protocol/config.d.ts +32 -24
- package/dist/types/protocol/config.d.ts.map +1 -1
- package/dist/types/protocol/conversation.d.ts +48 -39
- package/dist/types/protocol/conversation.d.ts.map +1 -1
- package/dist/types/protocol/execution.d.ts +2 -18
- package/dist/types/protocol/execution.d.ts.map +1 -1
- package/dist/types/protocol/history.d.ts +1 -1
- package/dist/types/protocol/history.d.ts.map +1 -1
- package/dist/types/protocol/index.d.ts +1 -0
- package/dist/types/protocol/index.d.ts.map +1 -1
- package/dist/types/protocol/lifecycle.d.ts +48 -74
- package/dist/types/protocol/lifecycle.d.ts.map +1 -1
- package/dist/types/protocol/model-catalog.d.ts.map +1 -1
- package/dist/types/protocol/models.d.ts +4 -42
- package/dist/types/protocol/models.d.ts.map +1 -1
- package/dist/types/protocol/origin.d.ts +49 -0
- package/dist/types/protocol/origin.d.ts.map +1 -0
- package/dist/types/protocol/reduce.d.ts.map +1 -1
- package/dist/types/protocol/thinking.d.ts +19 -19
- package/dist/types/protocol/thinking.d.ts.map +1 -1
- package/dist/types/protocol/wire-api.d.ts +59 -106
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +81 -119
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/dist/types/server/routes.d.ts.map +1 -1
- package/docs/consuming.md +124 -132
- package/docs/deploy.md +6 -5
- package/docs/harnesses.md +79 -31
- package/docs/sync-history.md +2 -1
- package/package.json +4 -4
- package/src/client/client.ts +36 -9
- package/src/client/connection.ts +31 -1
- package/src/client/turns.ts +2 -1
- package/src/core/agents/acp/acp-agent.ts +123 -17
- package/src/core/agents/acp/mappings.ts +5 -1
- package/src/core/agents/acp/requests.ts +2 -0
- package/src/core/agents/base.ts +2 -0
- package/src/core/agents/claude-code/approvals.ts +4 -3
- package/src/core/agents/claude-code/claude-agent.ts +14 -2
- package/src/core/agents/claude-code/mcp.ts +11 -1
- package/src/core/agents/claude-code/models.ts +15 -10
- package/src/core/agents/claude-code/options.ts +33 -3
- package/src/core/agents/claude-code/session.ts +26 -1
- package/src/core/agents/claude-code/tools.ts +10 -4
- package/src/core/agents/claude-code/turn.ts +4 -0
- package/src/core/agents/codex-app-server/adapter.ts +2 -0
- package/src/core/agents/codex-app-server/client.ts +11 -5
- package/src/core/agents/codex-app-server/codex-agent.ts +45 -1
- package/src/core/agents/codex-app-server/effort.ts +15 -20
- package/src/core/agents/codex-app-server/mcp.ts +46 -23
- package/src/core/agents/codex-app-server/models.ts +10 -10
- package/src/core/agents/codex-app-server/options.ts +16 -2
- package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
- package/src/core/agents/codex-app-server/requests.ts +2 -0
- package/src/core/agents/codex-app-server/session.ts +19 -4
- package/src/core/agents/codex-app-server/thread-settings.ts +31 -11
- package/src/core/agents/host-tools.ts +649 -0
- package/src/core/agents/mcp-config.ts +15 -3
- package/src/core/agents/scripted/scripted-agent.ts +51 -5
- package/src/core/agents/scripted/steps.ts +5 -1
- package/src/core/agents/session-agent.ts +78 -2
- package/src/core/agents/thinking-levels.ts +9 -6
- package/src/core/index.ts +9 -0
- package/src/core/presets.ts +28 -4
- package/src/core/processes/lifeline.ts +9 -5
- package/src/core/provision/pins.ts +7 -16
- package/src/core/provision/releases.ts +25 -25
- package/src/core/proxy/loopback.ts +25 -4
- package/src/core/runtime/agent-runtime.ts +31 -7
- package/src/core/runtime/event-processor.ts +13 -6
- package/src/core/runtime/origin-line.ts +43 -0
- package/src/core/runtime/request-broker.ts +2 -0
- package/src/core/runtime/steering.ts +8 -4
- package/src/core/runtime/turn.ts +11 -4
- package/src/operator/errors.ts +218 -0
- package/src/operator/index.ts +18 -23
- package/src/operator/mcp.ts +7 -16
- package/src/operator/operator.ts +1583 -613
- package/src/operator/refs.ts +75 -0
- package/src/operator/render.ts +208 -98
- package/src/operator/session-tools.ts +126 -0
- package/src/operator/types.ts +505 -0
- package/src/operator/view.ts +93 -42
- package/src/protocol/config.ts +36 -7
- package/src/protocol/conversation.ts +3 -0
- package/src/protocol/history.ts +2 -1
- package/src/protocol/index.ts +1 -0
- package/src/protocol/lifecycle.ts +21 -0
- package/src/protocol/model-catalog.ts +58 -18
- package/src/protocol/models.ts +6 -26
- package/src/protocol/origin.ts +47 -0
- package/src/protocol/reduce.ts +4 -0
- package/src/protocol/thinking.ts +27 -14
- package/src/protocol/wire-api.ts +2 -2
- package/src/protocol/wire.ts +18 -0
- package/src/server/bin.ts +6 -4
- package/src/server/routes.ts +16 -5
package/docs/consuming.md
CHANGED
|
@@ -420,6 +420,11 @@ const choice = models.find((m) => m.isDefault) ?? models[0];
|
|
|
420
420
|
const level = savedLevelFor(choice.id) ?? choice.thinking.default; // never invent one
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
+
Show `thinking.levels` as listed, in that order, and a name your app has no
|
|
424
|
+
label for as it is: a harness may list a level agent-server does not know
|
|
425
|
+
(`KnownThinkingLevel` is the seven it does). A level the model does not list
|
|
426
|
+
is fitted to the nearest level the engine can order, and when there is none
|
|
427
|
+
it is not applied (`execution.notApplied` names `thinkingLevel`).
|
|
423
428
|
`thinking.levels` empty means the model has no thinking control: a turn
|
|
424
429
|
that names a level for it runs without one (`off` is still sent on Claude),
|
|
425
430
|
and reports no `appliedThinkingLevel`. Keep the
|
|
@@ -486,7 +491,8 @@ above. A product that must keep sessions longer sets it for
|
|
|
486
491
|
its own processes through `claudeCode.sdkOptions`
|
|
487
492
|
(`settings: { cleanupPeriodDays }`), which holds only where no other Claude
|
|
488
493
|
process shares that config folder. The engine sets none: at `all` it would
|
|
489
|
-
override the person's own choice.
|
|
494
|
+
override the person's own choice. What was measured: LLP 0015.001, Claude's
|
|
495
|
+
transcript sweep.
|
|
490
496
|
|
|
491
497
|
## Steer a running turn
|
|
492
498
|
|
|
@@ -642,11 +648,13 @@ per-turn MCP in a home below. A fresh home has no login: run it on the
|
|
|
642
648
|
person's own Codex login (`codexAppServer.userLogin`, below), or hand one over
|
|
643
649
|
with [`credentials`](harnesses.md#host-managed-codex-authentication) or the
|
|
644
650
|
turn's `apiKey`. Below `all` Codex's apps, the ChatGPT account's connectors,
|
|
645
|
-
are off in every thread, as Claude's claude.ai connectors are, and
|
|
646
|
-
|
|
647
|
-
(`-c features.plugins=false`), so
|
|
648
|
-
|
|
649
|
-
|
|
651
|
+
are off in every thread, as Claude's claude.ai connectors are, and every
|
|
652
|
+
app-server that runs in such a home starts with plugins off
|
|
653
|
+
(`-c features.plugins=false`), so Codex's plugin catalogue is not downloaded
|
|
654
|
+
and a fresh home stays about 4 MB where it cloned the catalogue (about
|
|
655
|
+
85 MB). A plugin you install in a home you own still loads: the thread's
|
|
656
|
+
own `features`, which the engine sends, decide for it. A product that wants
|
|
657
|
+
a plugin installs it there, runs at `all`, or brings it as an MCP server. A home removed and made again
|
|
650
658
|
under a session's warm process starts a new process on the next turn, which
|
|
651
659
|
resumes the thread if the home still holds it, or fails `resume_failed`.
|
|
652
660
|
Codex loads the repository's skills and
|
|
@@ -714,9 +722,20 @@ await runtime.run({
|
|
|
714
722
|
first. Signed out, the turn fails `auth` before Codex starts. Codex still
|
|
715
723
|
loads the repository's skills and `~/.agents/skills`.
|
|
716
724
|
- `builtInTools`: each of Codex's own tool groups is on unless set `false`.
|
|
717
|
-
`local: false` takes away the shell, `
|
|
718
|
-
|
|
719
|
-
|
|
725
|
+
`local: false` takes away the shell, `view_image` and `write_stdin`, from
|
|
726
|
+
the sub-agents Codex spawns too. Codex still lists `apply_patch` to the
|
|
727
|
+
model and refuses a call to it without touching a file, and the stream
|
|
728
|
+
shows nothing of the attempt: say in your agent's instructions that it has
|
|
729
|
+
no files. So nothing the agent runs reads or writes the disk. That holds
|
|
730
|
+
for code mode's `exec` itself (measured on Codex 0.160.0 in `default` and
|
|
731
|
+
`bypass_permissions`, and on 0.169.1 with full access): its JavaScript
|
|
732
|
+
has no `process`, `require` or `fetch`, every `import()` fails, and it
|
|
733
|
+
read no file, saw no environment variable, started no process and made no
|
|
734
|
+
request. What it reaches is your MCP servers' tools and resources;
|
|
735
|
+
`read_mcp_resource` hands any URI to the server it names, so a server of
|
|
736
|
+
yours decides what a `file://` URI gives back (LLP 0015.001, What a
|
|
737
|
+
code-mode `exec` can reach; LLP 0017.000, Codex's local tools since
|
|
738
|
+
0.164.0);
|
|
720
739
|
`webSearch: false` and `imageGeneration: false` take away those. With
|
|
721
740
|
image generation on, a picture comes as an `image_generation` tool part
|
|
722
741
|
without its bytes: `metadata.savedPath`, when Codex gives one, names a file
|
|
@@ -757,7 +776,7 @@ applied through the harness's native configuration API before the prompt
|
|
|
757
776
|
(a Codex turn that names no home starts a new process for them, below);
|
|
758
777
|
finishing a turn does not restart the agent or its servers. Omitting the map
|
|
759
778
|
on a later turn removes the previous wire-configured set, just like `{}`.
|
|
760
|
-
|
|
779
|
+
The host's own tools (`hostTools`, below) and Claude's `sdkMcpServers` remain attached. The native CLI may also load MCP servers
|
|
761
780
|
from settings or plugins (Claude not at `inheritConfig: "none"`); this map is
|
|
762
781
|
not an exclusive tool allowlist.
|
|
763
782
|
|
|
@@ -865,6 +884,43 @@ the turn; an explicitly submitted next turn reapplies the configuration so a
|
|
|
865
884
|
previously failed native client can reconnect. No model turn or tool call is
|
|
866
885
|
automatically replayed.
|
|
867
886
|
|
|
887
|
+
### Give your agents your own tools
|
|
888
|
+
|
|
889
|
+
`createAgentRuntime({ hostTools })` gives every session's agent the product's
|
|
890
|
+
own tools, on every harness, with no MCP server of yours to run (LLP 0018):
|
|
891
|
+
|
|
892
|
+
```ts
|
|
893
|
+
createAgentRuntime({
|
|
894
|
+
hostTools: ({ sessionId, cwd, harness }) => ({
|
|
895
|
+
name: "product", // the MCP server's name, on every harness
|
|
896
|
+
instructions: "The product's tools: get_diff …",
|
|
897
|
+
tools: [{ name: "get_diff", description: "…", inputSchema: { type: "object" },
|
|
898
|
+
annotations: { readOnly: true } }],
|
|
899
|
+
async call(name, args, caller, signal) {
|
|
900
|
+
// caller: { sessionId, harness, turnId, permissionMode }, as they stand now
|
|
901
|
+
return { content: [{ type: "text", text: "…" }] }; // or { type: "image", data, mimeType }
|
|
902
|
+
},
|
|
903
|
+
}),
|
|
904
|
+
});
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
- Asked once per session, at its first turn; released with the session.
|
|
908
|
+
- Claude runs it in process. Codex, and an ACP agent that takes HTTP MCP
|
|
909
|
+
servers, reach it at the engine's loopback with a secret of the session's
|
|
910
|
+
own in a header (never the URL); a call carrying it is that session's. An
|
|
911
|
+
ACP agent that takes no HTTP server goes without, and its turn says so.
|
|
912
|
+
- `caller` is read at the call: the turn running and the mode the session
|
|
913
|
+
runs in then (a plan approved mid-turn included). A call while no turn of
|
|
914
|
+
the session runs is refused before you see it.
|
|
915
|
+
- A tool marked `readOnly` runs unasked; any other asks through
|
|
916
|
+
`permission.requested` unless the session runs with full access, and is
|
|
917
|
+
refused where nobody can be asked (`dont_ask`).
|
|
918
|
+
- A call may run 30 minutes (`timeoutMs` on the source changes it); `signal`
|
|
919
|
+
aborts when the agent gives the call up or the session is released. A
|
|
920
|
+
throw is a failed call whose message the model reads.
|
|
921
|
+
- A turn's own MCP server may not take the source's name. Draw your cards
|
|
922
|
+
from the tool part's `mcp: { server, tool }`, not `toolName`.
|
|
923
|
+
|
|
868
924
|
### Resume a suspended host
|
|
869
925
|
|
|
870
926
|
After thawing a VM, call `runtime.invalidateMcpConnections()` before admitting
|
|
@@ -903,7 +959,8 @@ host resume replaced the subprocess — usually respawns immediately with contex
|
|
|
903
959
|
answers at once; `onSessionEnd(sessionId, "released")` for that process can
|
|
904
960
|
come after the cancel's answer (130 to 325 ms on the real CLI), and comes
|
|
905
961
|
before that turn's end. Set up the next turn's per-session resources after
|
|
906
|
-
the turn's end, not after the cancel's answer
|
|
962
|
+
the turn's end, not after the cancel's answer (LLP 0015.001, `onSessionEnd`
|
|
963
|
+
and a cancelled Claude start). On the wire, call `session/close`
|
|
907
964
|
when a logical session will not be resumed: it frees the replay buffer and
|
|
908
965
|
the harness-native state (until then, memory cost ≈ `bufferSize` events per
|
|
909
966
|
session).
|
|
@@ -920,140 +977,75 @@ event later: its `events/replay` answers `unknownSession`, and that answer *is*
|
|
|
920
977
|
the terminal signal (the session is gone; nothing more will be appended to it).
|
|
921
978
|
Treat `unknownSession` on replay as "session over", not as an error to retry.
|
|
922
979
|
|
|
923
|
-
## Let
|
|
980
|
+
## Let agents operate your sessions
|
|
924
981
|
|
|
925
|
-
In this section the operator is
|
|
982
|
+
In this section the operator is the agent doing it; elsewhere in this guide
|
|
926
983
|
it is whoever runs the engine (an operator option).
|
|
927
|
-
`@zvada/agent-server/operator` gives
|
|
928
|
-
CLI agent)
|
|
929
|
-
|
|
930
|
-
`
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
`
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
984
|
+
`@zvada/agent-server/operator` gives an outside assistant (ChatGPT, Claude, a
|
|
985
|
+
CLI agent), your own window, and your own sessions' agents one set of tools
|
|
986
|
+
over your product's sessions: `whoami`, `list_sessions`, `read_session`,
|
|
987
|
+
`wait_for_sessions`, `list_models`, `start_session`, `send_message`,
|
|
988
|
+
`answer_request`, `stop_sessions`, `archive` (LLP 0019, LLP 0014). A tool your
|
|
989
|
+
host cannot serve is not listed. They answer in short text that names the
|
|
990
|
+
next call (only calls that exist), quote what agents and repositories wrote
|
|
991
|
+
after ` | `, and refuse with a closed set of codes:
|
|
992
|
+
`refused (<code>): <sentence>`.
|
|
993
|
+
|
|
994
|
+
The package owns, for every host, and keeps nothing between calls: a
|
|
995
|
+
message is sent only while the call carrying it is open (to a busy session
|
|
996
|
+
after its turn ends on its own, within the call's wait; otherwise the
|
|
997
|
+
answer says nothing was sent); an identical request in flight runs nothing
|
|
998
|
+
new;
|
|
999
|
+
a session may not act on itself, reads only in plan mode, answers only in
|
|
1000
|
+
sessions it started, and a permission only with full access; depth, starts
|
|
1001
|
+
per session, agent setups and starts per minute are limited (`limits`);
|
|
1002
|
+
waits are capped by caller (a session 120 s by default, at most 240; an
|
|
1003
|
+
outside caller 60, at most 90 and never past `endsAt`). Each message carries
|
|
1004
|
+
its sender to the engine (`origin`), which tells the receiving agent when it
|
|
1005
|
+
is not the person.
|
|
1006
|
+
|
|
1007
|
+
You implement `OperatorHost`: `list`, `view` (with the turn facts
|
|
1008
|
+
`running` and `lastEnded`, whatever page it shows), `turn` (one turn by
|
|
1009
|
+
id), `send` and `onChange` are required; the rest are capabilities (`entry`, `projects`, `start`,
|
|
1010
|
+
`cancel`, `respond`, `archive`, `models`, `authorize`, `policy`, `admit`,
|
|
1011
|
+
`outcome`, `describe`). A session is an engine session, its id minted by
|
|
1012
|
+
your `start` before it returns, even while its new workspace is set up
|
|
1013
|
+
(`status: setting_up`), and delivering the first message once it is set
|
|
1014
|
+
up is your `start`'s, as the turn `input.turnId` (a `cancel` with no turn
|
|
1015
|
+
id drops it); a workspace is your container for sessions. The package's
|
|
1016
|
+
checks are preflight: enforce archive eligibility, a start into an archived
|
|
1017
|
+
workspace or by an archived starter, and any cap across starters (agent
|
|
1018
|
+
setups, disk) atomically at your own commit, by throwing `Refused` with the
|
|
1019
|
+
code and the sessions concerned; the package words it. `viewOf` makes a session's
|
|
1020
|
+
`SessionView` from the engine's folded state; a host with rows of its own
|
|
1021
|
+
builds the same shape. `send` gets a turn id the package minted, to pass to
|
|
1022
|
+
`turn/start` as is, so a repeat converges. Keep your own access check at
|
|
1023
|
+
each write as well: the package asks `authorize` before each tool and each
|
|
1024
|
+
write it makes, not inside yours. A host that serves session callers gives
|
|
1025
|
+
`policy`, the facts the rules and limits rest on, from its own store.
|
|
1026
|
+
`test/operator/engine-host.ts` is a complete host over the engine in about
|
|
1027
|
+
200 lines.
|
|
946
1028
|
|
|
947
1029
|
```ts
|
|
948
|
-
import {
|
|
1030
|
+
import { createMcpHandler, createOperator, tool } from "@zvada/agent-server/operator";
|
|
949
1031
|
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
if (held) held.state = reduceConversation(held.state, event);
|
|
953
|
-
for (const wake of waiters) wake(); // `changed` below
|
|
1032
|
+
const operator = createOperator(host, {
|
|
1033
|
+
extra: [tool({ name: "read_changes", title: "Read changes", description: "…", input: {…}, effect: "read", run })],
|
|
954
1034
|
});
|
|
955
|
-
const
|
|
956
|
-
list: async () => [...sessions].map(([id, s]) =>
|
|
957
|
-
({ id, name: s.name, group: s.project, phase: phaseOf(viewOf(s.state)), root: s.cwd })),
|
|
958
|
-
view: async (_caller, id) => viewOf(sessions.get(id)!.state),
|
|
959
|
-
async send(_caller, id, message, { delivery }) {
|
|
960
|
-
if (delivery === "interrupt") await client.cancelTurn(id);
|
|
961
|
-
try {
|
|
962
|
-
await client.startTurn({ sessionId: id, turnId: crypto.randomUUID(), input: message, config: configFor(id) });
|
|
963
|
-
} catch (error) {
|
|
964
|
-
if (/turnActive/.test(String(error))) throw new OperatorError("It is still working. Nothing was sent.");
|
|
965
|
-
throw error;
|
|
966
|
-
}
|
|
967
|
-
},
|
|
968
|
-
cancel: async (_caller, id) => void (await client.cancelTurn(id)),
|
|
969
|
-
async respond(_caller, id, answer) {
|
|
970
|
-
if (answer.kind === "question") await client.respondElicitation(id, answer.requestId, answer.outcome);
|
|
971
|
-
else await client.respondPermission(id, answer.requestId, answer.outcome);
|
|
972
|
-
},
|
|
973
|
-
start: async (_caller, { group, message }) => newSession(group, message), // optional
|
|
974
|
-
groups: async () => projects.map((p) => p.name), // optional
|
|
975
|
-
outcome: async (_caller, entry) => `changes: ${await diffStat(entry.root)}`, // optional
|
|
976
|
-
changed: (signal) => new Promise((resolve) => { // optional
|
|
977
|
-
const wake = () => { waiters.delete(wake); resolve(); };
|
|
978
|
-
waiters.add(wake);
|
|
979
|
-
signal.addEventListener("abort", wake, { once: true });
|
|
980
|
-
}),
|
|
981
|
-
};
|
|
982
|
-
const operator = createOperator(host);
|
|
983
|
-
```
|
|
984
|
-
|
|
985
|
-
`viewOf` makes a session's view from the engine's folded state; a host that
|
|
986
|
-
keeps rows of its own builds the same `SessionView` (its messages, what it
|
|
987
|
-
waits on in the engine's request shapes). This host makes its own turn ids
|
|
988
|
-
and does not detect repeats, so a model that sends the same message twice is
|
|
989
|
-
told the session is busy. A host that wants to join a repeat instead (the
|
|
990
|
-
same caller, session and message while the turn that message started has not
|
|
991
|
-
ended) sends nothing and resolves `send` to `{ duplicate: true }`; `start`
|
|
992
|
-
returns its `SessionEntry` with `duplicate: true` for the same caller's same
|
|
993
|
-
task in the same project while that session sets up or its first turn runs
|
|
994
|
-
(`StartResult`). Only then does `wait: 0` look at the session, answering how
|
|
995
|
-
that turn stands, and a wait settle from the current view at once; a fresh
|
|
996
|
-
send or start answers "the agent is working", since your view may not show
|
|
997
|
-
its turn yet. `start` may return as soon as the session exists: until its
|
|
998
|
-
first turn begins, its view is `working` with no messages, and the wait
|
|
999
|
-
covers setup and the turn alike. When a send or a stop did something your
|
|
1000
|
-
view cannot show (a message you held and replaced, or dropped before it was
|
|
1001
|
-
sent), say it in one line: `send` resolves to `{ note }`, which
|
|
1002
|
-
`send_message` says before the outcome, and `cancel` resolves to `{ note }`,
|
|
1003
|
-
which `stop_session` answers with instead of waiting for the view to change.
|
|
1004
|
-
`start` is optional, and without it there is no `start_session`.
|
|
1005
|
-
`entry(caller, id)` is optional too: a host whose `list` holds only its
|
|
1006
|
-
newest sessions gives the others by id there. It gets any reference that
|
|
1007
|
-
names nothing listed, and may throw an `OperatorError` to refuse one in your
|
|
1008
|
-
words (a session archived). `groups(caller)` is optional: every project a
|
|
1009
|
-
session could start in, so `list_sessions` shows the ones with no session
|
|
1010
|
-
yet. `extra: [tool({...})]` adds your own tools (a diff, an archive) beside
|
|
1011
|
-
these; mark one that reaches past your host `openWorld` and one that may
|
|
1012
|
-
lose work `destructive`. `changed` must remove what it registered when its
|
|
1013
|
-
signal aborts; the operator aborts it after every look. A plan request you
|
|
1014
|
-
build yourself uses the engine's `PLAN_OPTIONS` and `PLAN_TITLE`, exported
|
|
1015
|
-
here, so `answer_request` reads it as a plan.
|
|
1016
|
-
|
|
1017
|
-
Access is yours too. `tools()` is the same for every caller (an assistant
|
|
1018
|
-
keeps the list it got when it connected), so refuse a call around `call`, in
|
|
1019
|
-
your words:
|
|
1020
|
-
|
|
1021
|
-
```ts
|
|
1022
|
-
import { OperatorError, type ToolSource } from "@zvada/agent-server/operator";
|
|
1023
|
-
|
|
1024
|
-
const tools: ToolSource<Caller> = {
|
|
1025
|
-
tools: (caller) => operator.tools(caller),
|
|
1026
|
-
async call(name, args, caller) {
|
|
1027
|
-
const found = operator.tools(caller).find((tool) => tool.name === name);
|
|
1028
|
-
if (found && !found.readOnly && !caller.canOperate) {
|
|
1029
|
-
throw new OperatorError(`${name} needs operate access here. Nothing was done.`);
|
|
1030
|
-
}
|
|
1031
|
-
return operator.call(name, args, caller);
|
|
1032
|
-
},
|
|
1033
|
-
};
|
|
1034
|
-
```
|
|
1035
|
-
|
|
1036
|
-
Serve them over MCP (stateless Streamable HTTP) with `createMcpHandler`. It
|
|
1037
|
-
has no dependency and is not a server: your route authenticates and names the
|
|
1038
|
-
caller.
|
|
1039
|
-
|
|
1040
|
-
```ts
|
|
1041
|
-
import { createMcpHandler } from "@zvada/agent-server/operator";
|
|
1042
|
-
|
|
1043
|
-
const mcp = createMcpHandler(tools, { name: "my-product", version: "1.0.0" });
|
|
1035
|
+
const mcp = createMcpHandler(operator, { name: "my-product", version: "1.0.0" });
|
|
1044
1036
|
app.post("/mcp", async (c) => {
|
|
1045
1037
|
const caller = await authenticate(c.req.header("authorization")); // yours: 401 if not
|
|
1046
|
-
const answer = await mcp(await c.req.json(), caller);
|
|
1038
|
+
const answer = await mcp(await c.req.json(), caller); // an ExternalCaller
|
|
1047
1039
|
return answer === null ? c.body(null, 202) : c.json(answer);
|
|
1048
1040
|
});
|
|
1049
1041
|
app.get("/mcp", (c) => c.body(null, 405));
|
|
1050
1042
|
```
|
|
1051
1043
|
|
|
1052
|
-
A
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1044
|
+
A host's own tool declares its `effect` honestly (anything that changes
|
|
1045
|
+
something or posts outside is `write`); plan mode and `authorize` apply to
|
|
1046
|
+
it, and it may not change sessions. A failed call reaches the model as an
|
|
1047
|
+
`isError` tool result: an `OperatorError`'s words as they are, any other
|
|
1048
|
+
failure as `refused (failed)` with none of its text.
|
|
1057
1049
|
|
|
1058
1050
|
## Listen to the engine's diagnostics
|
|
1059
1051
|
|
package/docs/deploy.md
CHANGED
|
@@ -243,11 +243,12 @@ AGENT_SERVER_CREDENTIALS_TOKEN=<this sandbox's token> \
|
|
|
243
243
|
Claude's credential stays in the engine (its proxy on 127.0.0.1), not in the
|
|
244
244
|
CLI's environment its tools can read; Codex keeps ChatGPT tokens in memory.
|
|
245
245
|
|
|
246
|
-
Every process the engine starts itself (each CLI, the
|
|
247
|
-
`
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
Every process the engine starts itself (each CLI, the `ps`, `sysctl` and
|
|
247
|
+
`tar` it runs) gets the engine's `process.env` as it is at that start, with
|
|
248
|
+
the turn's `env` over it for a CLI, under Bun as under Node. The lifeline
|
|
249
|
+
shell, which lives as long as the engine, gets `PATH` alone. A secret your
|
|
250
|
+
product deletes from `process.env` before it starts the engine reaches none
|
|
251
|
+
of them; the bin takes its own tokens out the same way (LLP
|
|
251
252
|
0007, The environment a process is given).
|
|
252
253
|
|
|
253
254
|
## App bundles and images for another machine
|
package/docs/harnesses.md
CHANGED
|
@@ -146,13 +146,27 @@ ACP server binding, a client's stdio and HTTP servers take the first path;
|
|
|
146
146
|
an SSE server or one named `codex_apps` is refused at `session/new` or
|
|
147
147
|
`session/resume`, naming it.
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
An MCP server's `timeoutMs` says how long one call to its tools may run, in
|
|
150
|
+
milliseconds, on any transport: past it the call fails and the model is told
|
|
151
|
+
it timed out. The engine gives it to Claude as that server's `timeout`
|
|
152
|
+
(Claude ignores a value under 1000) and to Codex as its `tool_timeout_sec`,
|
|
153
|
+
in whole seconds rounded up (1118 becomes 2 s). It is at most 2,147,483,647,
|
|
154
|
+
a timer's own limit. A changed value applies from a warm session's
|
|
155
|
+
next turn. Without it each agent's own limit applies. Claude cuts a call to an HTTP or SSE server at 60 s: the tool part
|
|
156
|
+
fails with "The operation timed out." and the turn goes on.
|
|
157
|
+
`MCP_TOOL_TIMEOUT` (milliseconds) in the turn's `env`, or in the engine's
|
|
158
|
+
own, still sets that limit on Claude. A call to a stdio server or to an
|
|
159
|
+
in-process SDK server is not cut at 60 s (one ran 70 s, one 75 s); longer
|
|
160
|
+
was not measured, and Claude's own limits for those still apply. Codex cuts a call at 300 s ("timed
|
|
161
|
+
out awaiting tools/call after 300s"). Neither agent sends the server a
|
|
162
|
+
cancel when it cuts a call. An ACP agent is not given the limit, since ACP
|
|
163
|
+
has no field for it, and keeps its own. What was measured: LLP 0015.001, How long an
|
|
164
|
+
MCP tool call may run. The host's own tools
|
|
165
|
+
(`hostTools`) run 30 minutes unless their source says otherwise (LLP 0018,
|
|
166
|
+
Timeouts). Over ACP a host tool not marked read-only runs only when the
|
|
167
|
+
session has full access (`bypass_permissions`): an ACP agent need not ask
|
|
168
|
+
before it calls one, so the engine answers it that the tool needs full
|
|
169
|
+
access (LLP 0018, Permissions).
|
|
156
170
|
|
|
157
171
|
Below `inheritConfig: "all"` every Codex turn needs a home of its session's
|
|
158
172
|
own, so the bin refuses `--acp --harness codex-app-server` with
|
|
@@ -199,20 +213,37 @@ turn runs at `none`. Claude's built-in plugins and skills and the host's
|
|
|
199
213
|
managed policy load at every level, and `~/.claude.json` is read for the
|
|
200
214
|
account (its MCP servers follow the user and local sources). A Codex session at `project` or `none`
|
|
201
215
|
runs in the `CODEX_HOME` its turn names, of the session's own, with Codex's
|
|
202
|
-
apps (the ChatGPT account's connectors) off,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
216
|
+
apps (the ChatGPT account's connectors) off, Codex's plugin catalogue not
|
|
217
|
+
downloaded (plugins off from the moment its process starts,
|
|
218
|
+
`-c features.plugins=false`: a fresh home otherwise clones the catalogue,
|
|
219
|
+
about 85 MB and 5,500 files, before any thread opens) while a plugin a
|
|
220
|
+
product installs in a home it owns still loads, and at `none` without the
|
|
221
|
+
repository's `AGENTS.md`. A session whose
|
|
206
222
|
home was removed or made again under its warm process starts a new one on its
|
|
207
223
|
next turn, which resumes the thread there or fails `resume_failed` as a cold
|
|
208
224
|
start would; the repository's skills and `~/.agents/skills` load
|
|
209
225
|
at every level. With `codexAppServer.userLogin` such a session runs on the
|
|
210
226
|
user's own Codex login ([below](#the-users-own-codex-login-in-a-sessions-home)).
|
|
211
227
|
|
|
212
|
-
`thinkingLevel`
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
228
|
+
`thinkingLevel` names one of the model's `thinking.levels`: the harness's own
|
|
229
|
+
names, in the order it lists them (both CLIs list lowest first). `off`, `low`,
|
|
230
|
+
`medium`, `high`, `xhigh`, `max` and `ultra` are the levels agent-server knows
|
|
231
|
+
and orders (`THINKING_LEVELS`); a model may list others, and they are kept as
|
|
232
|
+
named. agent-server fits a level to the model's levels when it knows them. A
|
|
233
|
+
level the model lists is sent as it is. A level the model does not list is
|
|
234
|
+
fitted to the nearest level the engine can order: a level above the model's
|
|
235
|
+
top becomes that top (`ultra` on a model whose top is `max` runs `max`), and
|
|
236
|
+
on Codex `off` becomes the model's lowest (current models reject `minimal`).
|
|
237
|
+
When there is none (a level agent-server does not know, or a model that lists
|
|
238
|
+
none it knows), it is not applied: the harness is sent no level, the model
|
|
239
|
+
runs as on a turn that names none, and `turn.ended.execution.notApplied`
|
|
240
|
+
names `thinkingLevel`. When the model's levels are unknown (no list read, and
|
|
241
|
+
not in the catalog), any level is sent as asked (on Claude, `ultra` as
|
|
242
|
+
`max`). Measured on Claude Code
|
|
243
|
+
2.1.327 on 2026-11-19, Claude Code ignores an effort it does not know and
|
|
244
|
+
runs the model's default (it warns `Unknown --effort value` on stderr); on
|
|
245
|
+
Codex 0.169.1, the same day, Codex passes it to the provider as the request's
|
|
246
|
+
`reasoning.effort`, and the provider decides. The levels come
|
|
216
247
|
from the list `models()` read for the turn's login and folder; for a concrete
|
|
217
248
|
model id, any login's list or the catalog also serves, even one that names the
|
|
218
249
|
model only as what an alias runs (an API key's Claude list names Opus 5.5 only
|
|
@@ -224,15 +255,20 @@ cancelled before the model answered:
|
|
|
224
255
|
- **claude-code** fits the level before starting Claude, because Claude Code
|
|
225
256
|
lowers a level its model lacks without saying so (`xhigh` on Sonnet 4.6 runs
|
|
226
257
|
`high`). With no known levels the level passes through and no applied level
|
|
227
|
-
is reported. A model known to have no levels (`thinking.levels: []`, Haiku
|
|
228
|
-
is started without one, as Claude Code runs it by default (Haiku
|
|
229
|
-
thinks
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
258
|
+
is reported. A model known to have no levels (`thinking.levels: []`, Haiku
|
|
259
|
+
4.5) is started without one, as Claude Code runs it by default (Haiku 4.5
|
|
260
|
+
then still thinks: 53 reasoning tokens on a turn that asked for `high`),
|
|
261
|
+
and no applied level is reported. `off` is sent as is, on Haiku 4.5 too,
|
|
262
|
+
where it stops that default thinking. Some models do not let thinking be
|
|
263
|
+
disabled: Haiku 5.5 at `off` still spends thinking tokens (36, with one
|
|
264
|
+
empty reasoning part; both measured on Claude Code 2.1.327, 2026-11-19).
|
|
265
|
+
An operator `sdkOptions` that sets `effort` or `thinking` wins, and then no
|
|
266
|
+
level is reported.
|
|
233
267
|
- **codex-app-server** reads what the thread's model accepts from its own
|
|
234
268
|
`model/list`. A model it lists with no efforts at all, or the engine knows
|
|
235
|
-
has no levels, is sent no effort, and no level is reported.
|
|
269
|
+
has no levels, is sent no effort, and no level is reported. A level with no
|
|
270
|
+
fit among the levels the model lists runs as a turn that names no level,
|
|
271
|
+
below, and the thread's effort is the level reported. With no level
|
|
236
272
|
requested it reports the thread's effort (for
|
|
237
273
|
example from `~/.codex/config.toml`), and the thread's model in
|
|
238
274
|
`reportedModels` when the stream names none. Codex runs the effort it is
|
|
@@ -292,8 +328,9 @@ operator's, and not named as not applied.
|
|
|
292
328
|
|
|
293
329
|
## What each permission mode does, per agent
|
|
294
330
|
|
|
295
|
-
Measured on
|
|
296
|
-
Haiku
|
|
331
|
+
Measured on macOS on Claude Code 2.1.327 (Claude SDK 0.3.327, model `haiku`,
|
|
332
|
+
which is Haiku 5.5 and runs its `plan` turns on Sonnet 5.5) on 2026-11-19, and
|
|
333
|
+
on Codex 0.160.0 on 2026-11-15, through the engine at `inheritConfig: "none"`. Each
|
|
297
334
|
call ran in a fresh session and folder, with every `permission.requested`
|
|
298
335
|
answered `allow_once`, and each call that asked ran again with the request
|
|
299
336
|
answered `reject_once`. Whether a call ran is read from the file on disk, the
|
|
@@ -309,8 +346,10 @@ bun run harness -- --harness=claude-code,codex-app-server --scenario=permission-
|
|
|
309
346
|
```
|
|
310
347
|
|
|
311
348
|
On Claude it costs one small paid turn per cell on this computer's own Claude
|
|
312
|
-
login (64 turns
|
|
313
|
-
|
|
349
|
+
login (64 turns before retries: one per cell, and one more for each of the 19
|
|
350
|
+
that ask). On
|
|
351
|
+
Codex it is free; its 5 web-search turns are paid and run only with
|
|
352
|
+
`PERMISSION_MODES_PAID=1`.
|
|
314
353
|
|
|
315
354
|
In each cell, Claude's result comes first, then Codex's. **asks**: a
|
|
316
355
|
`permission.requested` arrives, and the call runs when allowed and does not
|
|
@@ -333,7 +372,12 @@ nothing is asked and the call does not run.
|
|
|
333
372
|
Claude reads with `Read` and runs commands with `Bash`. Codex runs both reads
|
|
334
373
|
and commands as shell commands (`cat`, `echo pm > file`). \*Claude's `WebFetch`
|
|
335
374
|
of a page on loopback switches to https and fails, so for it only whether it
|
|
336
|
-
asks is measured.
|
|
375
|
+
asks is measured. On a Claude login that has Claude's `web-fetch` agent, a
|
|
376
|
+
direct `WebFetch` is refused and names that agent, which makes the call: its
|
|
377
|
+
request reaches the broker as any other, from the sub-agent
|
|
378
|
+
(`parentToolCallId` is the `Agent` call), and the cell reads that request
|
|
379
|
+
(Claude Code 2.1.288 and 2.1.327 alike, 2026-11-19; behind a custom base URL
|
|
380
|
+
neither has the agent, and a direct call runs).
|
|
337
381
|
|
|
338
382
|
What differs, and so what a product should not assume of one agent from the
|
|
339
383
|
other:
|
|
@@ -350,7 +394,10 @@ other:
|
|
|
350
394
|
in every mode. Claude asks for it as for any MCP tool, and refuses it in
|
|
351
395
|
`dont_ask`.
|
|
352
396
|
- **`plan` does not stop writes.** On Claude every write the model makes is
|
|
353
|
-
asked and runs when allowed
|
|
397
|
+
asked and runs when allowed: the engine keeps plan mode off auto mode's
|
|
398
|
+
semantics (`useAutoModeDuringPlan: false`), under which a model that has
|
|
399
|
+
auto mode, Sonnet 5.5 among them, runs a read outside the folder, a shell
|
|
400
|
+
write and an MCP tool unasked. On Codex `apply_patch` is refused, but a shell
|
|
354
401
|
write the model retries with escalation is asked and runs when allowed.
|
|
355
402
|
- **`dont_ask` refuses different calls.** Claude runs only a read in the
|
|
356
403
|
folder and a command that writes nothing. Codex refuses writes and MCP tools
|
|
@@ -370,7 +417,7 @@ a turn with the same `cwd`, `env` and `apiKey` would use:
|
|
|
370
417
|
|
|
371
418
|
| Harness | Source | Notes |
|
|
372
419
|
| --- | --- | --- |
|
|
373
|
-
| `claude-code` | `query().supportedModels()` on an idle CLI (no prompt, MCP servers or hooks), at the operator's `inheritConfig` | The folder's `availableModels` setting narrows the list. `default` is a model id: the account's default. Haiku lists no levels. Operator `sdkOptions` are not applied. |
|
|
420
|
+
| `claude-code` | `query().supportedModels()` on an idle CLI (no prompt, MCP servers or hooks), at the operator's `inheritConfig` | The folder's `availableModels` setting narrows the list. `default` is a model id: the account's default. Haiku 4.5 lists no levels; `haiku` runs Haiku 5.5, which does. Operator `sdkOptions` are not applied. |
|
|
374
421
|
| `codex-app-server` | `model/list`, on the session's own process when `sessionId` has one | Lists what the login can run (a ChatGPT login gets no `gpt-5.5`). The default is the model `~/.codex/config.toml` selects, else Codex's own. With host-managed auth, pass the `sessionId` whose account to list. |
|
|
375
422
|
| `acp` | none | The catalog (empty). ACP agents describe models as session config options. |
|
|
376
423
|
| `scripted` | the harness | One model, `scripted`, with no thinking levels. |
|
|
@@ -501,7 +548,8 @@ account: the engine refuses another account and a renewal that outlives its
|
|
|
501
548
|
turn. The host owns sign-in, durable refresh-token storage, serialized
|
|
502
549
|
renewal and revocation (`@zvada/agent-server/accounts` has them). No
|
|
503
550
|
credentials are added to `RunConfig` or the engine's public wire.
|
|
504
|
-
The protocol
|
|
551
|
+
The protocol is checked at every pin bump against the pinned Codex CLI (the
|
|
552
|
+
version `core/provision/pins.ts` names) and the
|
|
505
553
|
[official app-server authentication documentation](https://learn.chatgpt.com/docs/app-server#3c-log-in-with-externally-managed-chatgpt-tokens-chatgptauthtokens).
|
|
506
554
|
|
|
507
555
|
## What a tool call says, per harness
|
|
@@ -660,7 +708,7 @@ refused when the script is read, never skipped.
|
|
|
660
708
|
| `{ echo: "input" }` | Says the turn's input as a model reads it (`inputToText`). |
|
|
661
709
|
| `{ echo: "config" }` | Says the turn's config as JSON: `model`, `thinkingLevel`, `cwd`, `additionalDirectories`, `systemPromptAppend`, `permissionMode`, the names of its MCP servers and the keys of its `env`, never their values. |
|
|
662
710
|
| `{ wait: ms }` | A pause; a cancel ends it. |
|
|
663
|
-
| `{ hang: true, stopTakes?: ms }` | Runs until the turn is cancelled; `stopTakes` ms more before it stops, as a harness slow to stop, also when the cancel came before the hang began. The cancel is confirmed at once. |
|
|
711
|
+
| `{ hang: true, stopTakes?: ms }` | Runs until the turn is cancelled; `stopTakes` ms more before it stops, as a harness slow to stop, also when the cancel came before the hang began, the turn's start included; not in a script an async generator makes, whose next step a cancel does not wait for. The cancel is confirmed at once. |
|
|
664
712
|
| `{ fail: string, category? }` | Ends the turn in an error: of `category` when given, else what the engine's classifier makes of the text. |
|
|
665
713
|
| `{ end: true, stopReason?, usage?, cost? }` | Ends the turn: `end_turn` and zero usage by default. |
|
|
666
714
|
|
package/docs/sync-history.md
CHANGED
|
@@ -161,7 +161,8 @@ each increment. `openHistory` applies a checkpoint only at or before each
|
|
|
161
161
|
segment's pinned cut, after verifying that prefix, then folds the tail; a newer
|
|
162
162
|
checkpoint never substitutes for an older fork cut. A checkpoint in an unknown
|
|
163
163
|
format is skipped and the events replayed, and `{checkpoints: false}` forces it.
|
|
164
|
-
The format `agent-server.conversation.
|
|
164
|
+
The format (`agent-server.conversation.v2` since user messages carry `origin`)
|
|
165
|
+
changes whenever reducer semantics do.
|
|
165
166
|
No method accepts an uploaded projection: stores build them from their own
|
|
166
167
|
events, which stay authoritative.
|
|
167
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zvada/agent-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.27",
|
|
4
4
|
"description": "Harness-agnostic agent execution engine: run Claude Code, Codex (app-server), and any ACP agent behind one interface with a normalized event stream, multi-turn sessions, and resume. Root export is the wire contract; /core, /server, /client are the seats.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"bin": {
|
|
42
|
-
"agent-server": "
|
|
42
|
+
"agent-server": "src/server/bin.ts"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"prepack": "rm -rf dist && tsc -p tsconfig.build.json"
|
|
@@ -162,9 +162,9 @@
|
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
164
|
"@agentclientprotocol/sdk": "^1.7.0",
|
|
165
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
165
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.327",
|
|
166
166
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
167
|
-
"@openai/codex": "0.
|
|
167
|
+
"@openai/codex": "0.169.1",
|
|
168
168
|
"@types/bun": "^1.2.0",
|
|
169
169
|
"zod": "^4.6.7"
|
|
170
170
|
}
|