@zvada/agent-server 0.3.17 → 0.3.19
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/AGENTS.md +11 -26
- package/CHANGELOG.md +1060 -0
- package/README.md +50 -26
- package/dist/types/accounts/chatgpt.d.ts +34 -0
- package/dist/types/accounts/chatgpt.d.ts.map +1 -0
- package/dist/types/accounts/check.d.ts +24 -0
- package/dist/types/accounts/check.d.ts.map +1 -0
- package/dist/types/accounts/claude.d.ts +21 -0
- package/dist/types/accounts/claude.d.ts.map +1 -0
- package/dist/types/accounts/endpoint.d.ts +50 -0
- package/dist/types/accounts/endpoint.d.ts.map +1 -0
- package/dist/types/accounts/http.d.ts +38 -0
- package/dist/types/accounts/http.d.ts.map +1 -0
- package/dist/types/accounts/index.d.ts +6 -0
- package/dist/types/accounts/index.d.ts.map +1 -0
- package/dist/types/client/client.d.ts +272 -0
- package/dist/types/client/client.d.ts.map +1 -0
- package/dist/types/client/connection.d.ts +160 -0
- package/dist/types/client/connection.d.ts.map +1 -0
- package/dist/types/client/history.d.ts +8 -0
- package/dist/types/client/history.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/listeners.d.ts +8 -0
- package/dist/types/client/listeners.d.ts.map +1 -0
- package/dist/types/client/logins.d.ts +35 -0
- package/dist/types/client/logins.d.ts.map +1 -0
- package/dist/types/client/rpc.d.ts +46 -0
- package/dist/types/client/rpc.d.ts.map +1 -0
- package/dist/types/client/streams.d.ts +150 -0
- package/dist/types/client/streams.d.ts.map +1 -0
- package/dist/types/client/transports.d.ts +35 -0
- package/dist/types/client/transports.d.ts.map +1 -0
- package/dist/types/client/turns.d.ts +81 -0
- package/dist/types/client/turns.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +68 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -0
- package/dist/types/core/agents/acp/adapter.d.ts +39 -0
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/acp/client.d.ts +90 -0
- package/dist/types/core/agents/acp/client.d.ts.map +1 -0
- package/dist/types/core/agents/acp/known-agents.d.ts +35 -0
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -0
- package/dist/types/core/agents/acp/mappings.d.ts +46 -0
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +26 -0
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -0
- package/dist/types/core/agents/attachments.d.ts +11 -0
- package/dist/types/core/agents/attachments.d.ts.map +1 -0
- package/dist/types/core/agents/base.d.ts +227 -0
- package/dist/types/core/agents/base.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts +58 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts +26 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +70 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts +54 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/events.d.ts +42 -0
- package/dist/types/core/agents/claude-code/events.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/login.d.ts +61 -0
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts +52 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/models.d.ts +30 -0
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/options.d.ts +183 -0
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts +50 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts +36 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session.d.ts +148 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts +29 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spend.d.ts +58 -0
- package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/tools.d.ts +4 -0
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts +52 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn.d.ts +121 -0
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts +59 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts +116 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +113 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts +66 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts +49 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts +12 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts +45 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts +20 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts +26 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts +31 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts +38 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +62 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts +67 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts +40 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +19 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts +99 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts +42 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts +96 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts +53 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +87 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts +33 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts +163 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -0
- package/dist/types/core/agents/config-fingerprint.d.ts +5 -0
- package/dist/types/core/agents/config-fingerprint.d.ts.map +1 -0
- package/dist/types/core/agents/credentials.d.ts +28 -0
- package/dist/types/core/agents/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/elicitation.d.ts +37 -0
- package/dist/types/core/agents/elicitation.d.ts.map +1 -0
- package/dist/types/core/agents/inherit-config.d.ts +18 -0
- package/dist/types/core/agents/inherit-config.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +67 -0
- package/dist/types/core/agents/login.d.ts.map +1 -0
- package/dist/types/core/agents/mcp-config.d.ts +57 -0
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -0
- package/dist/types/core/agents/plan.d.ts +16 -0
- package/dist/types/core/agents/plan.d.ts.map +1 -0
- package/dist/types/core/agents/registry.d.ts +30 -0
- package/dist/types/core/agents/registry.d.ts.map +1 -0
- package/dist/types/core/agents/session-agent.d.ts +48 -0
- package/dist/types/core/agents/session-agent.d.ts.map +1 -0
- package/dist/types/core/agents/session-pool.d.ts +41 -0
- package/dist/types/core/agents/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/stderr-tail.d.ts +28 -0
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -0
- package/dist/types/core/agents/thinking-levels.d.ts +4 -0
- package/dist/types/core/agents/thinking-levels.d.ts.map +1 -0
- package/dist/types/core/agents/types.d.ts +124 -0
- package/dist/types/core/agents/types.d.ts.map +1 -0
- package/dist/types/core/diagnostics.d.ts +36 -0
- package/dist/types/core/diagnostics.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +29 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/presets.d.ts +80 -0
- package/dist/types/core/presets.d.ts.map +1 -0
- package/dist/types/core/processes/identity.d.ts +31 -0
- package/dist/types/core/processes/identity.d.ts.map +1 -0
- package/dist/types/core/processes/lifeline.d.ts +47 -0
- package/dist/types/core/processes/lifeline.d.ts.map +1 -0
- package/dist/types/core/processes/native-processes.d.ts +130 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -0
- package/dist/types/core/processes/process-table.d.ts +43 -0
- package/dist/types/core/processes/process-table.d.ts.map +1 -0
- package/dist/types/core/provision/cache-trust.d.ts +13 -0
- package/dist/types/core/provision/cache-trust.d.ts.map +1 -0
- package/dist/types/core/provision/cache-usage.d.ts +14 -0
- package/dist/types/core/provision/cache-usage.d.ts.map +1 -0
- package/dist/types/core/provision/checksums.d.ts +46 -0
- package/dist/types/core/provision/checksums.d.ts.map +1 -0
- package/dist/types/core/provision/extract.d.ts +7 -0
- package/dist/types/core/provision/extract.d.ts.map +1 -0
- package/dist/types/core/provision/index.d.ts +5 -0
- package/dist/types/core/provision/index.d.ts.map +1 -0
- package/dist/types/core/provision/install-build.d.ts +36 -0
- package/dist/types/core/provision/install-build.d.ts.map +1 -0
- package/dist/types/core/provision/npm.d.ts +40 -0
- package/dist/types/core/provision/npm.d.ts.map +1 -0
- package/dist/types/core/provision/pins.d.ts +24 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -0
- package/dist/types/core/provision/platform.d.ts +28 -0
- package/dist/types/core/provision/platform.d.ts.map +1 -0
- package/dist/types/core/provision/provisioner.d.ts +189 -0
- package/dist/types/core/provision/provisioner.d.ts.map +1 -0
- package/dist/types/core/provision/releases.d.ts +8 -0
- package/dist/types/core/provision/releases.d.ts.map +1 -0
- package/dist/types/core/provision/tools.d.ts +81 -0
- package/dist/types/core/provision/tools.d.ts.map +1 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts +52 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts.map +1 -0
- package/dist/types/core/proxy/api-key-store.d.ts +37 -0
- package/dist/types/core/proxy/api-key-store.d.ts.map +1 -0
- package/dist/types/core/proxy/index.d.ts +3 -0
- package/dist/types/core/proxy/index.d.ts.map +1 -0
- package/dist/types/core/proxy/loopback.d.ts +14 -0
- package/dist/types/core/proxy/loopback.d.ts.map +1 -0
- package/dist/types/core/runtime/agent-runtime.d.ts +181 -0
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -0
- package/dist/types/core/runtime/event-processor.d.ts +87 -0
- package/dist/types/core/runtime/event-processor.d.ts.map +1 -0
- package/dist/types/core/runtime/event-sink.d.ts +44 -0
- package/dist/types/core/runtime/event-sink.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-clis.d.ts +10 -0
- package/dist/types/core/runtime/harness-clis.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-logins.d.ts +68 -0
- package/dist/types/core/runtime/harness-logins.d.ts.map +1 -0
- package/dist/types/core/runtime/login-reads.d.ts +28 -0
- package/dist/types/core/runtime/login-reads.d.ts.map +1 -0
- package/dist/types/core/runtime/model-lists.d.ts +37 -0
- package/dist/types/core/runtime/model-lists.d.ts.map +1 -0
- package/dist/types/core/runtime/permission-policy.d.ts +61 -0
- package/dist/types/core/runtime/permission-policy.d.ts.map +1 -0
- package/dist/types/core/runtime/request-broker.d.ts +49 -0
- package/dist/types/core/runtime/request-broker.d.ts.map +1 -0
- package/dist/types/core/runtime/steering.d.ts +38 -0
- package/dist/types/core/runtime/steering.d.ts.map +1 -0
- package/dist/types/core/runtime/turn-outcome.d.ts +21 -0
- package/dist/types/core/runtime/turn-outcome.d.ts.map +1 -0
- package/dist/types/core/runtime/turn.d.ts +121 -0
- package/dist/types/core/runtime/turn.d.ts.map +1 -0
- package/dist/types/core/utils/bounded.d.ts +6 -0
- package/dist/types/core/utils/bounded.d.ts.map +1 -0
- package/dist/types/core/utils/deadline.d.ts +14 -0
- package/dist/types/core/utils/deadline.d.ts.map +1 -0
- package/dist/types/core/utils/errors.d.ts +104 -0
- package/dist/types/core/utils/errors.d.ts.map +1 -0
- package/dist/types/core/utils/is-record.d.ts +3 -0
- package/dist/types/core/utils/is-record.d.ts.map +1 -0
- package/dist/types/core/utils/loopback.d.ts +6 -0
- package/dist/types/core/utils/loopback.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/protocol/account.d.ts +26 -0
- package/dist/types/protocol/account.d.ts.map +1 -0
- package/dist/types/protocol/async-queue.d.ts +21 -0
- package/dist/types/protocol/async-queue.d.ts.map +1 -0
- package/dist/types/protocol/auth.d.ts +228 -0
- package/dist/types/protocol/auth.d.ts.map +1 -0
- package/dist/types/protocol/canonical.d.ts +9 -0
- package/dist/types/protocol/canonical.d.ts.map +1 -0
- package/dist/types/protocol/clis.d.ts +74 -0
- package/dist/types/protocol/clis.d.ts.map +1 -0
- package/dist/types/protocol/config.d.ts +200 -0
- package/dist/types/protocol/config.d.ts.map +1 -0
- package/dist/types/protocol/conversation.d.ts +942 -0
- package/dist/types/protocol/conversation.d.ts.map +1 -0
- package/dist/types/protocol/credentials.d.ts +145 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -0
- package/dist/types/protocol/errors.d.ts +36 -0
- package/dist/types/protocol/errors.d.ts.map +1 -0
- package/dist/types/protocol/execution.d.ts +28 -0
- package/dist/types/protocol/execution.d.ts.map +1 -0
- package/dist/types/protocol/factories.d.ts +94 -0
- package/dist/types/protocol/factories.d.ts.map +1 -0
- package/dist/types/protocol/guards.d.ts +55 -0
- package/dist/types/protocol/guards.d.ts.map +1 -0
- package/dist/types/protocol/harness.d.ts +70 -0
- package/dist/types/protocol/harness.d.ts.map +1 -0
- package/dist/types/protocol/history.d.ts +318 -0
- package/dist/types/protocol/history.d.ts.map +1 -0
- package/dist/types/protocol/ids.d.ts +9 -0
- package/dist/types/protocol/ids.d.ts.map +1 -0
- package/dist/types/protocol/index.d.ts +35 -0
- package/dist/types/protocol/index.d.ts.map +1 -0
- package/dist/types/protocol/lifecycle.d.ts +1190 -0
- package/dist/types/protocol/lifecycle.d.ts.map +1 -0
- package/dist/types/protocol/meta-keys.d.ts +17 -0
- package/dist/types/protocol/meta-keys.d.ts.map +1 -0
- package/dist/types/protocol/meta.d.ts +13 -0
- package/dist/types/protocol/meta.d.ts.map +1 -0
- package/dist/types/protocol/model-catalog.d.ts +11 -0
- package/dist/types/protocol/model-catalog.d.ts.map +1 -0
- package/dist/types/protocol/models.d.ts +107 -0
- package/dist/types/protocol/models.d.ts.map +1 -0
- package/dist/types/protocol/part-input.d.ts +101 -0
- package/dist/types/protocol/part-input.d.ts.map +1 -0
- package/dist/types/protocol/parts.d.ts +357 -0
- package/dist/types/protocol/parts.d.ts.map +1 -0
- package/dist/types/protocol/reduce.d.ts +26 -0
- package/dist/types/protocol/reduce.d.ts.map +1 -0
- package/dist/types/protocol/selectors.d.ts +64 -0
- package/dist/types/protocol/selectors.d.ts.map +1 -0
- package/dist/types/protocol/seq-cursor.d.ts +66 -0
- package/dist/types/protocol/seq-cursor.d.ts.map +1 -0
- package/dist/types/protocol/stop-reasons.d.ts +33 -0
- package/dist/types/protocol/stop-reasons.d.ts.map +1 -0
- package/dist/types/protocol/thinking.d.ts +28 -0
- package/dist/types/protocol/thinking.d.ts.map +1 -0
- package/dist/types/protocol/time.d.ts +21 -0
- package/dist/types/protocol/time.d.ts.map +1 -0
- package/dist/types/protocol/tokens.d.ts +29 -0
- package/dist/types/protocol/tokens.d.ts.map +1 -0
- package/dist/types/protocol/tool-closure.d.ts +25 -0
- package/dist/types/protocol/tool-closure.d.ts.map +1 -0
- package/dist/types/protocol/tool-state.d.ts +209 -0
- package/dist/types/protocol/tool-state.d.ts.map +1 -0
- package/dist/types/protocol/verify.d.ts +52 -0
- package/dist/types/protocol/verify.d.ts.map +1 -0
- package/dist/types/protocol/vocabulary.d.ts +19 -0
- package/dist/types/protocol/vocabulary.d.ts.map +1 -0
- package/dist/types/protocol/wire-api.d.ts +1983 -0
- package/dist/types/protocol/wire-api.d.ts.map +1 -0
- package/dist/types/protocol/wire.d.ts +1758 -0
- package/dist/types/protocol/wire.d.ts.map +1 -0
- package/dist/types/server/acp/binding.d.ts +33 -0
- package/dist/types/server/acp/binding.d.ts.map +1 -0
- package/dist/types/server/acp/session-records.d.ts +17 -0
- package/dist/types/server/acp/session-records.d.ts.map +1 -0
- package/dist/types/server/acp/translate.d.ts +48 -0
- package/dist/types/server/acp/translate.d.ts.map +1 -0
- package/dist/types/server/agent-server.d.ts +121 -0
- package/dist/types/server/agent-server.d.ts.map +1 -0
- package/dist/types/server/feedback.d.ts +37 -0
- package/dist/types/server/feedback.d.ts.map +1 -0
- package/dist/types/server/history.d.ts +15 -0
- package/dist/types/server/history.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/install.d.ts +42 -0
- package/dist/types/server/install.d.ts.map +1 -0
- package/dist/types/server/open-parts.d.ts +27 -0
- package/dist/types/server/open-parts.d.ts.map +1 -0
- package/dist/types/server/routes.d.ts +61 -0
- package/dist/types/server/routes.d.ts.map +1 -0
- package/dist/types/server/secrets.d.ts +11 -0
- package/dist/types/server/secrets.d.ts.map +1 -0
- package/dist/types/server/session-gate.d.ts +32 -0
- package/dist/types/server/session-gate.d.ts.map +1 -0
- package/dist/types/server/session-log.d.ts +39 -0
- package/dist/types/server/session-log.d.ts.map +1 -0
- package/dist/types/server/session-store.d.ts +119 -0
- package/dist/types/server/session-store.d.ts.map +1 -0
- package/dist/types/server/subscriptions.d.ts +74 -0
- package/dist/types/server/subscriptions.d.ts.map +1 -0
- package/dist/types/server/transports.d.ts +74 -0
- package/dist/types/server/transports.d.ts.map +1 -0
- package/dist/types/server/wire-error.d.ts +9 -0
- package/dist/types/server/wire-error.d.ts.map +1 -0
- package/dist/types/sync/event-log.d.ts +45 -0
- package/dist/types/sync/event-log.d.ts.map +1 -0
- package/dist/types/sync/fit.d.ts +40 -0
- package/dist/types/sync/fit.d.ts.map +1 -0
- package/dist/types/sync/history-reader.d.ts +8 -0
- package/dist/types/sync/history-reader.d.ts.map +1 -0
- package/dist/types/sync/history-sqlite.d.ts +37 -0
- package/dist/types/sync/history-sqlite.d.ts.map +1 -0
- package/dist/types/sync/history.d.ts +70 -0
- package/dist/types/sync/history.d.ts.map +1 -0
- package/dist/types/sync/index.d.ts +4 -0
- package/dist/types/sync/index.d.ts.map +1 -0
- package/dist/types/sync/journal-sqlite.d.ts +51 -0
- package/dist/types/sync/journal-sqlite.d.ts.map +1 -0
- package/dist/types/sync/journal.d.ts +107 -0
- package/dist/types/sync/journal.d.ts.map +1 -0
- package/dist/types/sync/live-tails.d.ts +30 -0
- package/dist/types/sync/live-tails.d.ts.map +1 -0
- package/dist/types/sync/node-sqlite.d.ts +7 -0
- package/dist/types/sync/node-sqlite.d.ts.map +1 -0
- package/dist/types/sync/projection.d.ts +10 -0
- package/dist/types/sync/projection.d.ts.map +1 -0
- package/dist/types/sync/recovery.d.ts +25 -0
- package/dist/types/sync/recovery.d.ts.map +1 -0
- package/dist/types/sync/retry.d.ts +25 -0
- package/dist/types/sync/retry.d.ts.map +1 -0
- package/dist/types/sync/schema.d.ts +4 -0
- package/dist/types/sync/schema.d.ts.map +1 -0
- package/dist/types/sync/sql.d.ts +38 -0
- package/dist/types/sync/sql.d.ts.map +1 -0
- package/dist/types/sync/sqlite-file.d.ts +9 -0
- package/dist/types/sync/sqlite-file.d.ts.map +1 -0
- package/dist/types/sync/sqlite.d.ts +6 -0
- package/dist/types/sync/sqlite.d.ts.map +1 -0
- package/dist/types/sync/worker.d.ts +63 -0
- package/dist/types/sync/worker.d.ts.map +1 -0
- package/docs/consuming.md +460 -54
- package/docs/deploy.md +218 -47
- package/docs/durable-sessions.md +195 -0
- package/docs/feedback.md +116 -0
- package/docs/harnesses.md +219 -87
- package/docs/sync-history.md +197 -0
- package/docs/sync-integration.md +119 -0
- package/package.json +53 -23
- package/src/accounts/chatgpt.ts +194 -0
- package/src/accounts/check.ts +112 -0
- package/src/accounts/claude.ts +111 -0
- package/src/accounts/endpoint.ts +151 -0
- package/src/accounts/http.ts +97 -0
- package/src/accounts/index.ts +19 -0
- package/src/client/client.ts +641 -602
- package/src/client/connection.ts +371 -0
- package/src/client/history.ts +65 -0
- package/src/client/index.ts +11 -2
- package/src/client/listeners.ts +20 -0
- package/src/client/logins.ts +105 -0
- package/src/client/rpc.ts +144 -0
- package/src/client/streams.ts +488 -0
- package/src/client/transports.ts +62 -8
- package/src/client/turns.ts +171 -0
- package/src/core/agents/acp/acp-agent.ts +94 -118
- package/src/core/agents/acp/adapter.ts +20 -9
- package/src/core/agents/acp/client.ts +125 -47
- package/src/core/agents/acp/known-agents.ts +36 -4
- package/src/core/agents/acp/mappings.ts +64 -18
- package/src/core/agents/acp/requests.ts +125 -0
- package/src/core/agents/attachments.ts +18 -0
- package/src/core/agents/base.ts +120 -42
- package/src/core/agents/claude-code/adapter.ts +177 -238
- package/src/core/agents/claude-code/approvals.ts +270 -0
- package/src/core/agents/claude-code/claude-agent.ts +175 -158
- package/src/core/agents/claude-code/credentials.ts +171 -0
- package/src/core/agents/claude-code/events.ts +55 -0
- package/src/core/agents/claude-code/login.ts +269 -0
- package/src/core/agents/claude-code/mcp.ts +206 -0
- package/src/core/agents/claude-code/models.ts +15 -9
- package/src/core/agents/claude-code/options.ts +326 -39
- package/src/core/agents/claude-code/outcome.ts +209 -0
- package/src/core/agents/claude-code/session-pool.ts +136 -0
- package/src/core/agents/claude-code/session.ts +513 -0
- package/src/core/agents/claude-code/spawn.ts +144 -0
- package/src/core/agents/claude-code/spend.ts +160 -0
- package/src/core/agents/claude-code/tools.ts +47 -0
- package/src/core/agents/claude-code/turn-usage.ts +135 -0
- package/src/core/agents/claude-code/turn.ts +232 -0
- package/src/core/agents/codex-app-server/adapter.ts +314 -117
- package/src/core/agents/codex-app-server/client.ts +186 -84
- package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
- package/src/core/agents/codex-app-server/commands.ts +228 -0
- package/src/core/agents/codex-app-server/credentials.ts +126 -0
- package/src/core/agents/codex-app-server/effort.ts +29 -0
- package/src/core/agents/codex-app-server/events.ts +47 -0
- package/src/core/agents/codex-app-server/homes.ts +64 -0
- package/src/core/agents/codex-app-server/input.ts +60 -0
- package/src/core/agents/codex-app-server/items.ts +149 -0
- package/src/core/agents/codex-app-server/login.ts +180 -0
- package/src/core/agents/codex-app-server/mcp.ts +182 -37
- package/src/core/agents/codex-app-server/models.ts +99 -46
- package/src/core/agents/codex-app-server/options.ts +146 -0
- package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
- package/src/core/agents/codex-app-server/protocol.ts +117 -0
- package/src/core/agents/codex-app-server/requests.ts +332 -0
- package/src/core/agents/codex-app-server/session.ts +285 -0
- package/src/core/agents/codex-app-server/subagents.ts +108 -42
- package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
- package/src/core/agents/codex-app-server/turn-items.ts +88 -0
- package/src/core/agents/codex-app-server/turn.ts +463 -0
- package/src/core/agents/config-fingerprint.ts +7 -14
- package/src/core/agents/credentials.ts +98 -0
- package/src/core/agents/elicitation.ts +75 -0
- package/src/core/agents/inherit-config.ts +21 -0
- package/src/core/agents/login.ts +116 -0
- package/src/core/agents/mcp-config.ts +112 -8
- package/src/core/agents/plan.ts +25 -0
- package/src/core/agents/registry.ts +21 -4
- package/src/core/agents/session-agent.ts +96 -4
- package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
- package/src/core/agents/stderr-tail.ts +75 -0
- package/src/core/agents/types.ts +40 -5
- package/src/core/index.ts +60 -48
- package/src/core/presets.ts +100 -39
- package/src/core/processes/identity.ts +113 -0
- package/src/core/processes/lifeline.ts +170 -0
- package/src/core/processes/native-processes.ts +379 -0
- package/src/core/processes/process-table.ts +174 -0
- package/src/core/provision/cache-trust.ts +121 -0
- package/src/core/provision/cache-usage.ts +69 -0
- package/src/core/provision/checksums.ts +64 -0
- package/src/core/provision/extract.ts +11 -2
- package/src/core/provision/index.ts +4 -1
- package/src/core/provision/install-build.ts +136 -0
- package/src/core/provision/npm.ts +112 -17
- package/src/core/provision/pins.ts +11 -34
- package/src/core/provision/platform.ts +12 -1
- package/src/core/provision/provisioner.ts +329 -397
- package/src/core/provision/releases.ts +86 -0
- package/src/core/provision/tools.ts +329 -0
- package/src/core/proxy/anthropic-proxy.ts +55 -25
- package/src/core/proxy/api-key-store.ts +2 -12
- package/src/core/proxy/loopback.ts +106 -0
- package/src/core/runtime/agent-runtime.ts +340 -481
- package/src/core/runtime/event-processor.ts +207 -75
- package/src/core/runtime/event-sink.ts +45 -2
- package/src/core/runtime/harness-clis.ts +61 -0
- package/src/core/runtime/harness-logins.ts +328 -0
- package/src/core/runtime/login-reads.ts +78 -0
- package/src/core/runtime/model-lists.ts +57 -57
- package/src/core/runtime/permission-policy.ts +113 -0
- package/src/core/runtime/request-broker.ts +204 -0
- package/src/core/runtime/steering.ts +112 -0
- package/src/core/runtime/turn-outcome.ts +30 -0
- package/src/core/runtime/turn.ts +360 -0
- package/src/core/utils/bounded.ts +12 -0
- package/src/core/utils/deadline.ts +38 -0
- package/src/core/utils/errors.ts +113 -21
- package/src/core/utils/is-record.ts +4 -0
- package/src/core/utils/loopback.ts +10 -0
- package/src/protocol/account.ts +104 -0
- package/src/protocol/auth.ts +199 -0
- package/src/protocol/canonical.ts +16 -0
- package/src/protocol/clis.ts +69 -0
- package/src/protocol/config.ts +60 -6
- package/src/protocol/conversation.ts +272 -0
- package/src/protocol/credentials.ts +145 -0
- package/src/protocol/errors.ts +78 -20
- package/src/protocol/execution.ts +5 -2
- package/src/protocol/factories.ts +55 -7
- package/src/protocol/guards.ts +55 -2
- package/src/protocol/harness.ts +56 -6
- package/src/protocol/history.ts +275 -0
- package/src/protocol/ids.ts +4 -17
- package/src/protocol/index.ts +10 -0
- package/src/protocol/lifecycle.ts +250 -79
- package/src/protocol/meta-keys.ts +17 -0
- package/src/protocol/meta.ts +3 -3
- package/src/protocol/models.ts +2 -43
- package/src/protocol/part-input.ts +2 -1
- package/src/protocol/parts.ts +12 -3
- package/src/protocol/reduce.ts +302 -413
- package/src/protocol/selectors.ts +1 -20
- package/src/protocol/seq-cursor.ts +14 -0
- package/src/protocol/stop-reasons.ts +1 -1
- package/src/protocol/thinking.ts +1 -30
- package/src/protocol/time.ts +2 -2
- package/src/protocol/tool-closure.ts +93 -0
- package/src/protocol/tool-state.ts +19 -4
- package/src/protocol/verify.ts +222 -92
- package/src/protocol/vocabulary.ts +21 -5
- package/src/protocol/wire-api.ts +232 -0
- package/src/protocol/wire.ts +425 -57
- package/src/server/acp/binding.ts +63 -103
- package/src/server/acp/session-records.ts +53 -0
- package/src/server/acp/translate.ts +129 -20
- package/src/server/agent-server.ts +275 -366
- package/src/server/bin.ts +295 -72
- package/src/server/feedback.ts +204 -14
- package/src/server/history.ts +160 -0
- package/src/server/index.ts +4 -8
- package/src/server/install.ts +107 -8
- package/src/server/open-parts.ts +95 -0
- package/src/server/routes.ts +391 -0
- package/src/server/secrets.ts +24 -0
- package/src/server/session-gate.ts +69 -0
- package/src/server/session-log.ts +14 -2
- package/src/server/session-store.ts +289 -0
- package/src/server/subscriptions.ts +232 -0
- package/src/server/transports.ts +125 -25
- package/src/server/wire-error.ts +38 -0
- package/src/sync/event-log.ts +160 -0
- package/src/sync/fit.ts +140 -0
- package/src/sync/history-reader.ts +57 -0
- package/src/sync/history-sqlite.ts +339 -0
- package/src/sync/history.ts +220 -0
- package/src/sync/index.ts +18 -0
- package/src/sync/journal-sqlite.ts +439 -0
- package/src/sync/journal.ts +132 -0
- package/src/sync/live-tails.ts +107 -0
- package/src/sync/node-sqlite.ts +20 -0
- package/src/sync/projection.ts +35 -0
- package/src/sync/recovery.ts +141 -0
- package/src/sync/retry.ts +49 -0
- package/src/sync/schema.ts +77 -0
- package/src/sync/sql.ts +106 -0
- package/src/sync/sqlite-file.ts +38 -0
- package/src/sync/sqlite.ts +21 -0
- package/src/sync/worker.ts +259 -0
- package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
- package/docs/rfds/0002-native-subagents.md +0 -197
- package/src/core/agents/claude-code/generator-session.ts +0 -572
- package/src/core/agents/claude-code/session-manager.ts +0 -166
- package/src/core/agents/codex-app-server/codex-app-server-agent.ts +0 -962
- package/src/core/agents/codex-items.ts +0 -149
- package/src/core/agents/codex-sdk/adapter.ts +0 -237
- package/src/core/agents/codex-sdk/codex-sdk-agent.ts +0 -330
- package/src/core/agents/tool-meta.ts +0 -68
package/docs/harnesses.md
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# Harness support matrix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Three harnesses, one event stream. The lifecycle event *structure* is identical
|
|
4
4
|
across harnesses (one generic `EventProcessor` drives it); payloads and config
|
|
5
5
|
support differ only where the backends genuinely do.
|
|
6
6
|
|
|
7
7
|
| Harness | Backend | Streaming | Resume | Model switch |
|
|
8
8
|
| --- | --- | --- | --- | --- |
|
|
9
|
-
| `claude-code` | `@anthropic-ai/claude-agent-sdk` (claude CLI) | token-level | yes (`resume`) |
|
|
10
|
-
| `codex-
|
|
11
|
-
| `
|
|
12
|
-
| `acp` | any ACP v1 agent via `@agentclientprotocol/sdk` | per-agent | yes (`session/resume`, else `session/load`) | per-agent (`model` config option) |
|
|
9
|
+
| `claude-code` | `@anthropic-ai/claude-agent-sdk` (claude CLI) | token-level | yes (`resume`) | `in_session` (`setModel`) |
|
|
10
|
+
| `codex-app-server` | `codex app-server` (JSON-RPC subprocess) | token-level | yes (`thread/resume`) | `in_session` (per-turn) |
|
|
11
|
+
| `acp` | any ACP v1 agent via `@agentclientprotocol/sdk` | per-agent | yes (`session/resume`, else `session/load`) | when the agent offers a `model` config option (so the capability says `unsupported`) |
|
|
13
12
|
|
|
14
13
|
The `acp` harness is opt-in (an operator-supplied launch command, never
|
|
15
14
|
wire-sourced): well-known agents run by name (`--harness=pi`,
|
|
@@ -31,6 +30,14 @@ offers it (checked against SDK 1.7.0 with `claude-agent-acp` and `codex-acp`):
|
|
|
31
30
|
advertise the capability and ignored otherwise.
|
|
32
31
|
- **Token usage:** read from the prompt response when the agent sends it. The
|
|
33
32
|
field is still unstable in ACP v1, so many agents report none.
|
|
33
|
+
- **Failures:** an agent that exits fails the turn as `process_exit` with its
|
|
34
|
+
exit code and the last two lines of its stderr (`acp agent exited (code=1
|
|
35
|
+
…): <its reason>`), where it says what is wrong, such as a missing login;
|
|
36
|
+
those words never decide the category. A child it left running cannot hold
|
|
37
|
+
the turn open, and an agent that ignores SIGTERM is killed after three
|
|
38
|
+
seconds.
|
|
39
|
+
- **`pi`** runs a pinned `pi-acp@0.0.34` through `npx`, not whatever version
|
|
40
|
+
npm published last; bump the pin after checking a new release.
|
|
34
41
|
|
|
35
42
|
All harnesses share: one stable logical `sessionId` you assign, a
|
|
36
43
|
harness-native id surfaced via `session.created` (persist it to resume later),
|
|
@@ -38,43 +45,121 @@ warm multi-turn reuse, a unified `ThinkingLevel`, and normalized token usage.
|
|
|
38
45
|
|
|
39
46
|
## `RunConfig` support per harness
|
|
40
47
|
|
|
41
|
-
| `RunConfig` field | claude-code | codex-
|
|
42
|
-
| --- | --- | --- |
|
|
43
|
-
| `model` | ✅ + hot-swap | ✅ (
|
|
44
|
-
| `thinkingLevel` | ✅ | ✅ |
|
|
45
|
-
| `permissionMode` | ✅
|
|
46
|
-
| `resumeSessionId` | ✅ | ✅ |
|
|
47
|
-
| `systemPromptAppend` | ✅ |
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
| `RunConfig` field | claude-code | codex-app-server |
|
|
49
|
+
| --- | --- | --- |
|
|
50
|
+
| `model` | ✅ + hot-swap | ✅ (per-turn) |
|
|
51
|
+
| `thinkingLevel` | ✅ | ✅ |
|
|
52
|
+
| `permissionMode` | ✅ switched live (a new process only into or out of `bypass_permissions`); a plan's approval picks the mode Claude goes on in | ✅ → sandbox (below); `plan` is Codex's Plan collaboration mode, its plan put to the user and the answer run in the same turn |
|
|
53
|
+
| `resumeSessionId` | ✅ | ✅ |
|
|
54
|
+
| `systemPromptAppend` | ✅ | ✅ (`developerInstructions`) |
|
|
55
|
+
| `additionalDirectories` | ✅ | ✅ (writable roots of the workspace-write sandbox; a change starts a new process) |
|
|
56
|
+
| `maxTurns` | ✅ | ❌ |
|
|
57
|
+
| `mcpServers` | ✅ | ✅ (stdio / Streamable HTTP; isolated `CODEX_HOME`) |
|
|
58
|
+
| `apiKey` / `env` | ✅ | ✅ (the key logs in that session's process, in memory only; a credential the product holds wins) |
|
|
59
|
+
| `disableTools` | ✅ | ❌ refused as `invalid_request`: Codex gives the model its tools however it is configured (use `plan` or `default`) |
|
|
60
|
+
| permission requests (capability `permissionRequests`) | ✅ (`canUseTool`) | ✅ (`on-request` approvals in `default`, `accept_edits` and `plan`, MCP tool consent included; a plan turn's edits are declined) |
|
|
61
|
+
| the words said with a refusal (capability `rejectionMessages`) | ✅ the denial tells Claude what the user said | ❌ a bare verdict (a plan's answer carries them) |
|
|
62
|
+
| `elicitation` (questions, MCP input) | `AskUserQuestion`; MCP `onElicitation` (form, url) | `request_user_input` (plan mode); MCP elicitation (form, url) |
|
|
63
|
+
| steering (`turn/steer`) | ✅ uuid-stamped messages, read where Claude replays them; a late steer runs as one more query in the turn | ✅ `turn/steer`, read where Codex starts its user message |
|
|
64
|
+
| image / file input (capabilities `images`, `files`) | images (data or http(s) URL), PDFs, text files (`files: text, pdf`) | images (data or local path), text files inline (`files: text`), local files as mentions |
|
|
65
|
+
| `includeRaw` | ✅ | ✅ |
|
|
66
|
+
|
|
67
|
+
Each harness says which files it reads as data, by `fileKind(mimeType)`
|
|
68
|
+
(`text`, `pdf`, `binary`), in `capabilities.files`, so a client can check a
|
|
69
|
+
file before it sends it (the CLI does). An attachment a harness cannot take fails the turn as `invalid_request`
|
|
70
|
+
rather than reaching the agent unread, and a steer carrying one is refused the
|
|
71
|
+
same way. A Codex turn with `disableTools` fails so too, before Codex starts:
|
|
72
|
+
with every feature that offers a tool turned off, Codex 0.160 still gives a
|
|
73
|
+
model its code-mode `exec`, `apply_patch` inside it, its sub-agent tools and
|
|
74
|
+
`request_user_input`, so the model would act anyway. ACP agents cannot be steered: ACP v1 has no input for a running
|
|
75
|
+
prompt, so `turn/steer` answers `unsupported`. An ACP agent takes image data with its
|
|
76
|
+
`image` prompt capability and files as embedded resources with
|
|
77
|
+
`embeddedContext`; otherwise text files go inline and links as resource links.
|
|
78
|
+
The harness states the most an agent can take (`images`, `files: text, pdf,
|
|
79
|
+
binary`), and the agent's own `initialize` decides. Its answer to a
|
|
80
|
+
permission request is an option id, with no room for the user's words
|
|
81
|
+
(`rejectionMessages: false`).
|
|
82
|
+
|
|
83
|
+
Codex runs each permission mode in one of its sandboxes, and asks through the
|
|
84
|
+
engine (`permission.requested`) only in `default`, `accept_edits` and
|
|
85
|
+
`plan`:
|
|
86
|
+
|
|
87
|
+
| Mode | Codex sandbox | What runs without asking |
|
|
88
|
+
| --- | --- | --- |
|
|
89
|
+
| `default` | read-only | reads; every write asks |
|
|
90
|
+
| `plan` | read-only | reads; commands beyond the sandbox ask, edits are declined |
|
|
91
|
+
| `accept_edits` | workspace-write | reads, and writes inside the sandbox: the folder, `additionalDirectories`, `/tmp` and `$TMPDIR`, by edits and commands alike; a write beyond it asks |
|
|
92
|
+
| `dont_ask` | read-only | reads; every write is refused, since nothing asks |
|
|
93
|
+
| `bypass_permissions` | full access | everything |
|
|
94
|
+
|
|
95
|
+
`accept_edits` differs from Claude's, which approves file edits only: Codex's
|
|
96
|
+
boundary is its sandbox, so a command that writes in the folder
|
|
97
|
+
(`printf > e1.txt`) or in `/tmp` runs unasked too.
|
|
98
|
+
|
|
99
|
+
A Codex approval shows what it approves: a command's `rawInput` is its
|
|
100
|
+
`command` and `cwd`, a file change's its `changes` (each `{path, kind, diff}`,
|
|
101
|
+
with `locations`), and an MCP tool's its arguments, as Claude's are. A command
|
|
102
|
+
or change the user declines fails, saying it was not approved (Codex
|
|
103
|
+
completes it as `declined`).
|
|
104
|
+
|
|
105
|
+
A cancelled Codex turn stops the commands it started before it ends. Codex
|
|
106
|
+
0.160 ends a turn on `turn/interrupt` but keeps a running command alive as a
|
|
107
|
+
background terminal, so the engine terminates the terminals the turn started
|
|
108
|
+
(not those it only polled or wrote to) and checks that they are gone,
|
|
109
|
+
reading Codex's list again for a while, since a terminal can register late.
|
|
110
|
+
When Codex cannot stop one, the engine ends the app-server, whose shutdown
|
|
111
|
+
stops every terminal, an earlier turn's too (the next turn resumes the
|
|
112
|
+
thread). Otherwise terminals an earlier turn left running, such as a server
|
|
113
|
+
the agent started on purpose, keep running. A command whose stop could not be
|
|
114
|
+
confirmed fails with its outcome unknown, and the cancel answers
|
|
115
|
+
`unconfirmed`. A cancel that arrives after Codex's turn ended stops nothing.
|
|
116
|
+
|
|
117
|
+
Codex per-turn MCP is supported through the engine and JSON-RPC API, and the
|
|
56
118
|
repository CLI with an explicit `--codex-home`. The ACP server binding cannot
|
|
57
119
|
provide isolated homes and rejects this combination at session admission.
|
|
120
|
+
Below `inheritConfig: "all"` every Codex turn needs such a home, so the bin
|
|
121
|
+
refuses `--acp --harness codex-app-server` with `--inherit-config project` or
|
|
122
|
+
`none`.
|
|
58
123
|
|
|
59
124
|
The ACP server binding (`agent-server --acp`) records each session's native
|
|
60
125
|
id under `$AGENT_SERVER_ACP_SESSION_DIR` (default
|
|
61
126
|
`~/.local/state/agent-server/acp-sessions`), so a client's `session/resume`
|
|
62
127
|
works after the agent process restarts. It reports per-turn usage on the prompt
|
|
63
|
-
response and advertises HTTP/SSE MCP when fronting `claude-code`.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
128
|
+
response and advertises HTTP/SSE MCP when fronting `claude-code`. It offers
|
|
129
|
+
session modes (`default`, `accept_edits`, `plan`, and the mode it was started
|
|
130
|
+
in): the client picks one with `session/set_mode`, and when the agent switches
|
|
131
|
+
(an approved plan) the session follows and the client hears
|
|
132
|
+
`current_mode_update`. A client cannot pick a mode above the one the operator
|
|
133
|
+
started it in.
|
|
134
|
+
|
|
135
|
+
What a Claude or Codex session loads by itself is the operator's
|
|
136
|
+
`inheritConfig` (LLP 0001, D17; choosing one: [consuming.md](consuming.md#choose-what-a-turn-inherits)).
|
|
137
|
+
At `all`, the default, a Claude session loads every settings source (user,
|
|
138
|
+
project and local), as the CLI does: the operator's own MCP servers, hooks and
|
|
139
|
+
plugins join the turn beside the servers its config names, and so does the
|
|
140
|
+
auto-memory Claude keeps for the repository. The logged-in account's
|
|
141
|
+
claude.ai connectors stay off unless the server's or the turn's env sets
|
|
142
|
+
`ENABLE_CLAUDEAI_MCP_SERVERS=true`. At `project` it loads the repository's
|
|
143
|
+
settings only (`settingSources: ["project"]`: its hooks, `.mcp.json` servers
|
|
144
|
+
and instruction files), at `none` no source, with `strictMcpConfig`, so only
|
|
145
|
+
the host's in-process servers and the turn's attach. Below `all` auto-memory
|
|
146
|
+
and the connectors stay off whatever either env says, and a `disableTools`
|
|
147
|
+
turn runs at `none`. Claude's built-in plugins and skills and the host's
|
|
148
|
+
managed policy load at every level, and `~/.claude.json` is read for the
|
|
149
|
+
account (its MCP servers follow the user and local sources). A Codex session at `project` or `none`
|
|
150
|
+
runs in the `CODEX_HOME` its turn names, of the session's own, and at `none`
|
|
151
|
+
without the repository's `AGENTS.md`; the repository's skills and
|
|
152
|
+
`~/.agents/skills` load at every level.
|
|
69
153
|
|
|
70
154
|
`thinkingLevel` runs from `off` to `ultra`. agent-server fits it to the
|
|
71
155
|
model's levels when it knows them: a level above the model's top becomes that
|
|
72
156
|
top (`ultra` on a model whose top is `max` runs `max`), and on Codex `off`
|
|
73
157
|
becomes the model's lowest (current models reject `minimal`). The levels come
|
|
74
158
|
from the list `models()` read for the turn's login and folder; for a concrete
|
|
75
|
-
model id, any login's list or the catalog also serves,
|
|
76
|
-
|
|
77
|
-
|
|
159
|
+
model id, any login's list or the catalog also serves, even one that names the
|
|
160
|
+
model only as what an alias runs (an API key's Claude list names Opus 5.5 only
|
|
161
|
+
through `opus`). An alias such as Claude's `opus` runs a model that depends on
|
|
162
|
+
the account, so only its own login's list fits it. `turn.ended.execution.appliedThinkingLevel` says which
|
|
78
163
|
level ran. It is absent when that is unknown, or when the turn failed or was
|
|
79
164
|
cancelled before the model answered:
|
|
80
165
|
|
|
@@ -87,11 +172,21 @@ cancelled before the model answered:
|
|
|
87
172
|
- **codex-app-server** reads what the thread's model accepts from its own
|
|
88
173
|
`model/list`. With no level requested it reports the thread's effort (for
|
|
89
174
|
example from `~/.codex/config.toml`), and the thread's model in
|
|
90
|
-
`reportedModels` when the stream names none.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
175
|
+
`reportedModels` when the stream names none. Codex runs the effort it is
|
|
176
|
+
given, so that is the one reported.
|
|
177
|
+
A turn that names no model or level runs the thread's defaults, the model
|
|
178
|
+
and effort a new thread starts with (`config.toml`, else Codex's own), also
|
|
179
|
+
after an earlier turn chose others: Codex keeps a turn's model and effort on
|
|
180
|
+
the thread, so the engine sends the default back. The default effort is
|
|
181
|
+
the configured one fitted to the turn's model, or with none configured the
|
|
182
|
+
model's own (`model/list`), worked out again whenever the model changes.
|
|
183
|
+
When Codex cannot say what the default is, a turn that switches models
|
|
184
|
+
without a level gets the thread's effort fitted to the new model, so Codex
|
|
185
|
+
is never asked for one the model lacks. The session remembers the defaults
|
|
186
|
+
across its processes, until it is closed. A turn that fails on a model it
|
|
187
|
+
switched to (Codex accepts a model the login cannot run, then fails every
|
|
188
|
+
turn on it) puts the thread back on the model and effort it had
|
|
189
|
+
(`thread/settings/update`).
|
|
95
190
|
|
|
96
191
|
`clampThinkingLevel` picks the nearest level when a picker switches models.
|
|
97
192
|
|
|
@@ -103,9 +198,8 @@ a turn with the same `cwd`, `env` and `apiKey` would use:
|
|
|
103
198
|
|
|
104
199
|
| Harness | Source | Notes |
|
|
105
200
|
| --- | --- | --- |
|
|
106
|
-
| `claude-code` | `query().supportedModels()` on an idle CLI (no prompt, MCP servers or hooks) | 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. |
|
|
201
|
+
| `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. |
|
|
107
202
|
| `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. |
|
|
108
|
-
| `codex-sdk` | `model/list` on a short-lived `codex app-server` | `codex exec` cannot list models. The app-server ignores a turn's `apiKey`, so this is the CLI's stored login (Codex's built-in list when logged out). |
|
|
109
203
|
| `acp` | none | The catalog (empty). ACP agents describe models as session config options. |
|
|
110
204
|
|
|
111
205
|
Each `ModelDescriptor` has `id` (pass as `config.model`), `label`,
|
|
@@ -114,14 +208,15 @@ Each `ModelDescriptor` has `id` (pass as `config.model`), `label`,
|
|
|
114
208
|
when the CLI states one; it is never invented) and `images`.
|
|
115
209
|
|
|
116
210
|
Lists are cached for ten minutes per harness, folder and credentials, and per
|
|
117
|
-
session only with host-managed Codex auth
|
|
118
|
-
|
|
211
|
+
session only with host-managed Codex auth. A login the engine sees change
|
|
212
|
+
(`auth/login`, `auth/logout`, or a status read after a terminal login) drops
|
|
213
|
+
the harness's lists; pass `refresh: true` after one it cannot see. Listing costs one CLI start and no tokens: about 0.7 s for Claude and
|
|
119
214
|
0.1 s for Codex once warm, a few seconds for the first read after the server
|
|
120
215
|
starts. A CLI that cannot answer within 20 s (logged out, too old) gets the
|
|
121
216
|
catalog with `source: "catalog"` and an `error`, or the last live list with the
|
|
122
217
|
`error` when one was read; a failed read is retried after 30 seconds.
|
|
123
218
|
|
|
124
|
-
The catalog (`CATALOG_MODELS
|
|
219
|
+
The catalog (`CATALOG_MODELS`) is what
|
|
125
220
|
the pinned CLIs listed when the release was built (`bun run models:refresh`):
|
|
126
221
|
Claude for the maintainer's login, Codex logged in and logged out (which adds
|
|
127
222
|
the API-key models such as `gpt-5.5`). Keep the user's thinking choice per
|
|
@@ -130,33 +225,60 @@ only for a model the user has not set.
|
|
|
130
225
|
|
|
131
226
|
Consult `runtime.capabilities(harness)` before relying on a capability.
|
|
132
227
|
|
|
228
|
+
## Logins
|
|
229
|
+
|
|
230
|
+
`auth/status` reads each harness's login from its CLI; `auth/login` runs the
|
|
231
|
+
CLI's own flow (LLP 0011; the recipe is in
|
|
232
|
+
[consuming.md](consuming.md#show-each-harnesss-login-and-sign-it-in)).
|
|
233
|
+
|
|
234
|
+
| Harness | Status from | Logins (`methods`) | Logout |
|
|
235
|
+
| --- | --- | --- | --- |
|
|
236
|
+
| `claude-code` | `claude auth status --json`, with the turn's environment | `claudeai`, `console` (`browser`, with a `codeUrl` for another device; over the SDK's control requests, CLI 2.1.220 and later), `terminal` (`claude auth login`) | `claude auth logout` |
|
|
237
|
+
| `codex-app-server` | `account/read` on an app-server of its own | `chatgpt` (`browser`, callback on `127.0.0.1:1455`, one per machine), `chatgpt_device_code`, `api_key`, `terminal` (`codex login`) | `account/logout` |
|
|
238
|
+
| `acp` | — (`unknown`: the agent signs in on its own) | none | — |
|
|
239
|
+
|
|
240
|
+
A login lands in the store a turn with the same `env` uses (`CLAUDE_CONFIG_DIR`,
|
|
241
|
+
`CODEX_HOME`). Claude reports the credential a turn would run with, so a key in
|
|
242
|
+
the environment shows as `source: "environment"` over any login. A login change
|
|
243
|
+
starts each session's next turn on a new CLI. Codex logins below `inheritConfig:
|
|
244
|
+
"all"` land in the `CODEX_HOME` the request's `env` names. The engine reads and
|
|
245
|
+
runs the CLI it starts: a host that starts Claude its own way
|
|
246
|
+
(`claudeCode.sdkOptions`, a spawner of its own) signs it in where it runs it.
|
|
247
|
+
|
|
133
248
|
## Host-managed Codex authentication
|
|
134
249
|
|
|
135
|
-
|
|
136
|
-
`
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
250
|
+
An embedding host hands Codex a login of its own with `credentials`, the same
|
|
251
|
+
`CredentialSource` Claude takes (LLP 0012; see
|
|
252
|
+
[Hold the login yourself](consuming.md#hold-the-login-yourself-for-sandboxes-and-other-devices)):
|
|
253
|
+
asked before each turn and model list with the session, harness and turn,
|
|
254
|
+
it answers an OpenAI `api_key` or a `chatgpt` access token with its account,
|
|
255
|
+
or none, which runs the turn as without it (its own `apiKey`, else the
|
|
256
|
+
`CODEX_HOME`'s own login). Throw when the selected account is unavailable:
|
|
257
|
+
the turn fails before Codex starts.
|
|
258
|
+
|
|
259
|
+
Authentication and session storage are independent. Per-turn MCP still needs an
|
|
260
|
+
isolated `CODEX_HOME` for writable configuration and conversation history, but
|
|
261
|
+
a held credential lets the host authenticate that session without a separate
|
|
262
|
+
native login or copying `auth.json` into each home. The engine keeps no token
|
|
263
|
+
store: its logins (`auth/login`) are the CLI's own, stored in a home's own
|
|
264
|
+
login, which a turn on a held credential does not use; `auth/status` then
|
|
265
|
+
reports the home's login, not the credential such a turn runs with.
|
|
266
|
+
|
|
267
|
+
The source is asked before every turn. The engine authenticates before thread
|
|
268
|
+
creation/resume and reauthenticates warm processes, so a changed account takes
|
|
269
|
+
effect on the next turn; switching between a held credential and the native
|
|
270
|
+
login, or between accounts, recreates the process while keeping the
|
|
271
|
+
conversation. A ChatGPT token uses Codex's experimental `chatgptAuthTokens`
|
|
272
|
+
mode and opts into `experimentalApi`; an API key uses Codex's own `apiKey`
|
|
273
|
+
login. Supplied credentials stay in that process's memory
|
|
274
|
+
(`cli_auth_credentials_store = "ephemeral"`) and never replace a
|
|
275
|
+
`CODEX_HOME`'s own login, and no refresh token enters the app-server. When
|
|
276
|
+
Codex asks for fresh access tokens, the source is asked again with the
|
|
277
|
+
refused token's digest (`rejectedSha256`) and must answer the same ChatGPT
|
|
278
|
+
account: the engine refuses another account and a renewal that outlives its
|
|
279
|
+
turn. The host owns sign-in, durable refresh-token storage, serialized
|
|
280
|
+
renewal and revocation (`@zvada/agent-server/accounts` has them). No
|
|
281
|
+
credentials are added to `RunConfig` or the engine's public wire.
|
|
160
282
|
The protocol was checked against Codex CLI 0.160.0 and the
|
|
161
283
|
[official app-server authentication documentation](https://learn.chatgpt.com/docs/app-server#3c-log-in-with-externally-managed-chatgpt-tokens-chatgptauthtokens).
|
|
162
284
|
|
|
@@ -165,7 +287,9 @@ The protocol was checked against Codex CLI 0.160.0 and the
|
|
|
165
287
|
- A turn ends with a normalized `stopReason`
|
|
166
288
|
(`end_turn | max_tokens | max_turn_requests | refusal | cancelled | error`);
|
|
167
289
|
the raw provider string travels in `finishReason`.
|
|
168
|
-
- `cost` is reported only by Claude; `reasoning` tokens
|
|
290
|
+
- `cost` is reported only by Claude; `reasoning` tokens by every harness whose
|
|
291
|
+
backend counts them (Claude's thinking, Codex's reasoning, an ACP agent's
|
|
292
|
+
thought tokens).
|
|
169
293
|
- Tool names are provider-native for Claude (`Bash`, `Read`) and normalized
|
|
170
294
|
for Codex (`shell`, `apply_patch`, …) — but the tool `kind`
|
|
171
295
|
(`read`/`edit`/`execute`/…) is normalized for all.
|
|
@@ -176,12 +300,15 @@ The protocol was checked against Codex CLI 0.160.0 and the
|
|
|
176
300
|
## Token and cache accounting
|
|
177
301
|
|
|
178
302
|
Every adapter uses the same `TokenUsage` on `turn.ended.tokens`, counting that
|
|
179
|
-
turn only
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
303
|
+
turn only: every model call it made, sub-agents and compaction included, the
|
|
304
|
+
same calls its `cost` covers. A custom adapter maps its provider's counts into
|
|
305
|
+
this contract; storage and consumers do not need a new schema for each harness.
|
|
306
|
+
Codex reports totals for the whole thread, so the Codex adapter reports how
|
|
307
|
+
much the totals grew during the turn. Claude's result `usage` counts only its
|
|
308
|
+
main loop, so the Claude adapter likewise reports how much its running
|
|
309
|
+
`modelUsage` totals grew, with thinking as `reasoning`, and uses `usage` only
|
|
310
|
+
for a resumed process's first turn, whose totals include the turns before it.
|
|
311
|
+
The duration buckets stay the main loop's. The `codex-app-server` context gauge
|
|
185
312
|
(`session.usage`) is the latest request's context.
|
|
186
313
|
|
|
187
314
|
| Field | Meaning |
|
|
@@ -212,15 +339,28 @@ provide the cache breakdown without an additional native usage report.
|
|
|
212
339
|
|
|
213
340
|
## Known limitations (roadmap)
|
|
214
341
|
|
|
342
|
+
- **Work after a turn:** a turn is the unit the stream shows, so the agent
|
|
343
|
+
starts nothing after it (LLP 0001, D14). Claude runs with background tasks
|
|
344
|
+
and scheduled prompts off (`CLAUDE_CODE_DISABLE_BACKGROUND_TASKS`,
|
|
345
|
+
`CLAUDE_CODE_DISABLE_CRON`; a turn's `env` can turn them on outside
|
|
346
|
+
`subagentMode: "turn"`, and what Claude then does after the turn is not
|
|
347
|
+
shown); Codex threads run with goals off.
|
|
348
|
+
Turns the agent starts itself, and goals, are on the roadmap.
|
|
215
349
|
- **Native subagents:** opt into `RunConfig.subagentMode: "turn"` for Claude
|
|
216
350
|
Code or Codex app-server. The parent collects results; native workers settle
|
|
217
351
|
before the engine releases the turn. Claude forwards nested worker text.
|
|
218
352
|
Codex emits task tools and typed `subagent` activity; it does not forward full
|
|
219
353
|
child transcripts. Managed Codex turns close the native process after cleanup
|
|
220
|
-
and resume saved context on the next turn.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
354
|
+
and resume saved context on the next turn. So a managed Codex turn puts no
|
|
355
|
+
plan to the user (its plan stands as written), does not put a failed turn's
|
|
356
|
+
model back, and its cancel is confirmed by that cleanup. A worker's background
|
|
357
|
+
terminals are read through every page Codex lists them in. Default behavior is
|
|
358
|
+
unchanged.
|
|
359
|
+
A forced exit or a native cleanup warning leaves cleanup unconfirmed: the
|
|
360
|
+
logical session is quarantined, a managed successor resumes saved context in a
|
|
361
|
+
fresh process, and releasing the quarantined session is refused. A host must
|
|
362
|
+
propagate that refusal before resetting the session or switching harnesses.
|
|
363
|
+
- **MCP servers** are supported by Claude and Codex app-server. See [MCP configuration](consuming.md#configure-mcp-between-turns)
|
|
224
364
|
for Codex home ownership, supported transports, and live-update behavior.
|
|
225
365
|
- **Codex app-server threads have one writer** (CLI 0.160 and newer). A
|
|
226
366
|
thread still loaded by a live session cannot be resumed from another
|
|
@@ -231,18 +371,10 @@ provide the cache breakdown without an additional native usage report.
|
|
|
231
371
|
into the harnesses (they use ambient/explicit keys today).
|
|
232
372
|
- **Hook bridge** (PreToolUse/Stop decisions) is exposed for the claude
|
|
233
373
|
embed tier only (`hooks` factory); there is no wire-level hook surface yet.
|
|
234
|
-
- The WebSocket
|
|
374
|
+
- The WebSocket listener refuses browsers whose origin is not allowed and
|
|
375
|
+
needs a token beyond loopback, but has no accounts or TLS of its own — see
|
|
235
376
|
[deploy.md](deploy.md#trust-boundary).
|
|
236
377
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
If anything in this guide is broken, confusing, outdated, or notably good,
|
|
240
|
-
report it to the maintainers (no auth, one command):
|
|
241
|
-
|
|
242
|
-
```sh
|
|
243
|
-
npx --yes hivenet@latest --to agent-server --category docs --subject "docs/harnesses.md" "<specific, actionable feedback>"
|
|
244
|
-
```
|
|
378
|
+
---
|
|
245
379
|
|
|
246
|
-
|
|
247
|
-
question plus a ready-to-run answer command — answer only from what you actually
|
|
248
|
-
observed). Only specific, actionable reports.
|
|
380
|
+
Something here wrong, unclear or missing? [Report it to the maintainers](feedback.md).
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Shared history: open, follow, pull and fork
|
|
2
|
+
|
|
3
|
+
A friend opens a session from an authorized relay, reads its committed history,
|
|
4
|
+
then follows new output while the owner works. The owner commits locally first;
|
|
5
|
+
a worker copies the missing suffix to the relay, and viewers read the relay's
|
|
6
|
+
durable copy. After a disconnection, the same version cursor requests only what
|
|
7
|
+
is missing. The owner can go offline; uploaded history stays readable.
|
|
8
|
+
|
|
9
|
+
A history holds what was kept: a follower sees a part when it opens, at each
|
|
10
|
+
change its harness reports (a tool's parsed input, its result) and when it
|
|
11
|
+
ends, never part way through its text. An answer that streams for a minute
|
|
12
|
+
reaches a follower whole, at its end; the text in between travels only to
|
|
13
|
+
clients streaming the session live (`session/subscribe`, LLP 0008).
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
sequenceDiagram
|
|
17
|
+
participant A as Computer A / execution owner
|
|
18
|
+
participant R as Authorized relay / durable store
|
|
19
|
+
participant B as Friend / Computer B
|
|
20
|
+
A->>A: Commit canonical events
|
|
21
|
+
A->>R: Import missing history pages
|
|
22
|
+
R->>R: Verify prefix and hash chain, commit
|
|
23
|
+
R-->>A: Committed version
|
|
24
|
+
B->>R: Open / pull history
|
|
25
|
+
R-->>B: Bounded snapshot pages
|
|
26
|
+
B->>R: Wait after saved version
|
|
27
|
+
A->>R: Import new output
|
|
28
|
+
R-->>B: Head advanced
|
|
29
|
+
B->>R: Pull after saved version
|
|
30
|
+
R-->>B: Missing suffix
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## The protocol
|
|
34
|
+
|
|
35
|
+
Every history is `{sourceId, sessionId}`: the store that writes it and its
|
|
36
|
+
session. A version is `{sourceId, sessionId, seq, hash}`. Version 0 hashes the
|
|
37
|
+
canonical descriptor; each record hashes `{event, previous, seq}`. Both are
|
|
38
|
+
SHA-256 (hex) of `canonicalJson` (sorted keys, undefined fields dropped),
|
|
39
|
+
and `historyRootPreimage` / `historyRecordPreimage` in `/protocol` define the
|
|
40
|
+
exact bytes for other implementations. The hash detects a divergent prefix or
|
|
41
|
+
an altered page; it is not a signature. The host binds authenticated producers
|
|
42
|
+
to source identities.
|
|
43
|
+
|
|
44
|
+
| Method | Port / SDK | Behavior |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| `history/list` | `list({after, limit})` | Keyset pages of at most 100 heads; catalog permission required. |
|
|
47
|
+
| `history/head` | `head(ref)` | Descriptor and current version. |
|
|
48
|
+
| `history/read` | `read({...ref, after, through, limit, maxBytes})` | At most 256 records and 8 MiB; `through` pins a snapshot. |
|
|
49
|
+
| `history/import` | `import(slice)` | Verify identity, prefix, descriptor and hash chain; commit atomically before answering. Records already held must be identical. |
|
|
50
|
+
| `history/fork` | `fork({sessionId, from})` | A new locally owned branch pinned to an immutable parent version; omit `from` for a root. |
|
|
51
|
+
| `history/commit` | `commit({commitId, expected, events})` | Append to a local branch if `expected` is its head. A retried commit id returns its first version; reused for other content, it conflicts. |
|
|
52
|
+
| `history/wait` | `wait({after, timeoutMs}, signal)` | Wakeup only: answers when the head moves or after at most 20 s; pull after it. Eight per connection. |
|
|
53
|
+
| `history/checkpoint` | `checkpoint({through})` | A saved projection at or before the cut, or null. Never built on read. |
|
|
54
|
+
|
|
55
|
+
`HistoryReader` ⊂ `HistoryArchive` ⊂ `HistoryApi` ⊂ `HistoryStore` are the
|
|
56
|
+
portable ports in `/protocol`; `client.history` is the promise-returning
|
|
57
|
+
`AsyncHistoryApi` over the wire, and `journal.history` is the SQLite store.
|
|
58
|
+
Every refusal is a `HistoryError` whose `code` is the wire error it answers
|
|
59
|
+
with, so a remote store fails the way a local one does:
|
|
60
|
+
|
|
61
|
+
| `code` | Means | Retry? |
|
|
62
|
+
| --- | --- | --- |
|
|
63
|
+
| `unknownHistory` | No such history, or not at that version | No; `transferHistory` treats a missing destination as empty. |
|
|
64
|
+
| `historyConflict` | The request contradicts committed history | No. |
|
|
65
|
+
| `notAuthorized` | The host refused this caller | No. |
|
|
66
|
+
| `invalidParams` | A malformed request, or one the store cannot hold | No. |
|
|
67
|
+
|
|
68
|
+
The `/sync` helpers refuse what a peer answers but cannot mean the same way:
|
|
69
|
+
a page that contradicts the requested prefix or revision, or a receipt for
|
|
70
|
+
another version, is `historyConflict`; a head of another history, an ancestry
|
|
71
|
+
cycle or a checkpoint outside the requested history or over the byte limit is
|
|
72
|
+
`invalidParams`.
|
|
73
|
+
|
|
74
|
+
Retry transport failures only: `ConnectionClosedError`. A reconnecting client
|
|
75
|
+
(connect mode) also fails a request left unanswered past `requestTimeoutMs`
|
|
76
|
+
that way and redials, since a half-open socket would otherwise hang it.
|
|
77
|
+
|
|
78
|
+
## Helpers in `/sync`
|
|
79
|
+
|
|
80
|
+
| Helper | Behavior |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `transferHistory(source, destination, ref, options)` | Copies pinned ancestors, then the leaf's missing suffix. The destination's committed head decides what is sent, so a lost acknowledgement costs nothing. `maxPages` / `maxBytes` bound one pass; only `complete: true` certifies the target. A destination already beyond the source is complete. |
|
|
83
|
+
| `openHistory(reader, ref)` | Ancestor and leaf segments, each reduced at its fixed version, from a compatible checkpoint plus its tail when one exists. |
|
|
84
|
+
| `followHistory(api, ref, {after, retry, signal})` | Snapshot pages, then each committed suffix, as an async iterable; resumes from the last yielded version. |
|
|
85
|
+
| `startHistorySync(source, destination, ref, options)` | The managed worker below. |
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
import { AgentServerClient, ConnectionClosedError } from "@zvada/agent-server/client";
|
|
89
|
+
import { decodeLifecycleEvent, reduceConversation } from "@zvada/agent-server/protocol";
|
|
90
|
+
import { followHistory, openHistory, transferHistory } from "@zvada/agent-server/sync";
|
|
91
|
+
|
|
92
|
+
const viewer = await AgentServerClient.connect(authenticatedViewerUrl);
|
|
93
|
+
const ref = { sourceId, sessionId }; // From the product's authorized share list.
|
|
94
|
+
const opened = await openHistory(viewer.history, ref);
|
|
95
|
+
let conversation = opened.segments.at(-1)!.conversation;
|
|
96
|
+
for await (const page of followHistory(viewer.history, ref, {
|
|
97
|
+
after: opened.version,
|
|
98
|
+
signal: viewClosed,
|
|
99
|
+
retry: (error, failures) =>
|
|
100
|
+
error instanceof ConnectionClosedError && failures <= 20 ? Math.min(250 * 2 ** failures, 5000) : undefined,
|
|
101
|
+
onState: (state) => showConnectionState(state),
|
|
102
|
+
})) {
|
|
103
|
+
for (const { event } of page.records)
|
|
104
|
+
conversation = reduceConversation(conversation, decodeLifecycleEvent(event));
|
|
105
|
+
render(conversation); // Persist it with page.next if the view survives restarts.
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Computer B keeps a local copy, ancestors included, and branches from it.
|
|
109
|
+
await transferHistory(relay.history, localStore.history, ref, { pageSize: 128 });
|
|
110
|
+
const branch = localStore.history.fork({ sessionId: crypto.randomUUID(), from: localStore.history.head(ref).version });
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Managed worker
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const job = startHistorySync(journal.history, cloudWriter.history, ref, {
|
|
117
|
+
batchMs: 25,
|
|
118
|
+
retry: (error, failures) =>
|
|
119
|
+
error instanceof ConnectionClosedError && failures <= 20 ? Math.min(250 * 2 ** failures, 5000) : undefined,
|
|
120
|
+
});
|
|
121
|
+
const unsubscribe = job.subscribe((status) => updateSyncIndicator(status));
|
|
122
|
+
// Before an action that promises uploaded history:
|
|
123
|
+
const shared = await job.flush({ timeoutMs: 30_000, signal: actionSignal });
|
|
124
|
+
// On shutdown: stop execution, optionally flush, then join the worker.
|
|
125
|
+
unsubscribe();
|
|
126
|
+
await job.stop();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Start one worker per selected history and destination, and recreate them from
|
|
130
|
+
the product's share configuration on launch; nothing is uploaded implicitly.
|
|
131
|
+
Swap source and destination to pull into a local cache.
|
|
132
|
+
|
|
133
|
+
- **Idle costs one wait.** The worker waits on the source after what the
|
|
134
|
+
destination holds; a pass runs only once the source moves. An idle worker
|
|
135
|
+
makes no destination calls, no writes and no status changes.
|
|
136
|
+
- **The destination is the record.** Nothing is saved locally: a restarted
|
|
137
|
+
worker asks the destination what it holds, so a wiped or replaced destination
|
|
138
|
+
is refilled. A host that wants to show "last synced" across restarts stores
|
|
139
|
+
`status().acknowledged` itself.
|
|
140
|
+
- **Status** is `starting`, `syncing`, `synced`, `retrying`, `blocked` or
|
|
141
|
+
`stopped`, with the source head and acknowledged version as last observed,
|
|
142
|
+
pending records, and imported pages, records and bytes. It describes the last
|
|
143
|
+
observation, not a promise about the peer.
|
|
144
|
+
- **Retries** follow the host's policy. The failure count resets only on
|
|
145
|
+
progress (an imported page) or a wait that found nothing new, never on a read
|
|
146
|
+
that changed nothing. A refusal (`HistoryError`) blocks the worker; `done`
|
|
147
|
+
resolves on stop or block, and a blocked worker is recreated once its cause is
|
|
148
|
+
fixed.
|
|
149
|
+
- **Barriers** pin a version when called: `flush()` the source head,
|
|
150
|
+
`waitUntilSynced(version)` a given one. They verify the version's hash first,
|
|
151
|
+
so a forged one below the acknowledged head is refused; their deadline covers
|
|
152
|
+
that check, and they reject on block or stop.
|
|
153
|
+
|
|
154
|
+
## Checkpoints
|
|
155
|
+
|
|
156
|
+
`journal.history.createCheckpoint(ref, {through?, maxRecords?})` stores one
|
|
157
|
+
projection per history and reducer format from the previous one plus new
|
|
158
|
+
events, capped at 8 MiB; a failure leaves the previous one. Schedule it from the
|
|
159
|
+
host (every N events, or at turn boundaries); it runs synchronously, so bound
|
|
160
|
+
each increment. `openHistory` applies a checkpoint only at or before each
|
|
161
|
+
segment's pinned cut, after verifying that prefix, then folds the tail; a newer
|
|
162
|
+
checkpoint never substitutes for an older fork cut. A checkpoint in an unknown
|
|
163
|
+
format is skipped and the events replayed, and `{checkpoints: false}` forces it.
|
|
164
|
+
The format `agent-server.conversation.v1` changes whenever reducer semantics do.
|
|
165
|
+
No method accepts an uploaded projection: stores build them from their own
|
|
166
|
+
events, which stay authoritative.
|
|
167
|
+
|
|
168
|
+
## Forks are history, not sessions
|
|
169
|
+
|
|
170
|
+
Explicit commits apply to locally owned branches; executed sessions grow only
|
|
171
|
+
through execution. A branch stores its own suffix and a parent cut that parent
|
|
172
|
+
growth cannot move; ancestry segments keep their message and turn ids. A fork
|
|
173
|
+
id is reserved in its store's execution namespace: `turn/start` refuses it.
|
|
174
|
+
Continuing a fork with a model needs a provider context bridge (importing native
|
|
175
|
+
state, or a new session seeded from chosen history), plus the workspace; nothing
|
|
176
|
+
replays tools or invents native session files.
|
|
177
|
+
|
|
178
|
+
## Hosting
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
await AgentServer.open(runtime, {
|
|
182
|
+
journal, // Only on an execution owner; `open` stops what its last owner left running.
|
|
183
|
+
history: { store: journal.history, authorize: (transport, ref, operation) => acl.canAccess(transport, ref, operation) },
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`authorize` runs for every history request (`read`, `write`, or `list` with no
|
|
188
|
+
ref) and again before a delayed `wait` answers; read never implies write. It
|
|
189
|
+
protects `history/*` only. A viewer endpoint must also refuse the execution
|
|
190
|
+
methods (`turn/start`, permission responses, shutdown) and the product's
|
|
191
|
+
tool/auth side channel: authenticate the whole transport and allow only history
|
|
192
|
+
methods. The CLI's `--journal` serves history on its trusted execution wire; it
|
|
193
|
+
is not a public endpoint.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
Something here wrong, unclear or missing? [Report it to the maintainers](feedback.md).
|