@zvada/agent-server 0.3.18 → 0.3.20
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 +1041 -1
- package/README.md +40 -40
- 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 +452 -53
- package/docs/deploy.md +218 -47
- package/docs/{sync-experiment.md → durable-sessions.md} +77 -72
- package/docs/feedback.md +116 -0
- package/docs/harnesses.md +212 -88
- package/docs/sync-history.md +29 -13
- package/docs/sync-integration.md +52 -66
- package/package.json +45 -28
- 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 +604 -670
- package/src/client/connection.ts +371 -0
- package/src/client/history.ts +29 -52
- 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 +155 -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 +58 -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 +9 -33
- 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 +327 -498
- package/src/core/runtime/event-processor.ts +197 -70
- 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 +33 -48
- 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 +72 -64
- package/src/protocol/ids.ts +0 -12
- package/src/protocol/index.ts +9 -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 +351 -64
- 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 +223 -387
- package/src/server/bin.ts +280 -78
- package/src/server/feedback.ts +204 -14
- package/src/server/history.ts +116 -122
- package/src/server/index.ts +3 -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 +136 -72
- package/src/server/subscriptions.ts +232 -0
- package/src/server/transports.ts +125 -25
- package/src/server/wire-error.ts +31 -45
- package/src/sync/event-log.ts +31 -3
- package/src/sync/fit.ts +27 -11
- package/src/sync/history-reader.ts +10 -5
- package/src/sync/history-sqlite.ts +37 -42
- package/src/sync/history.ts +9 -15
- package/src/sync/index.ts +17 -5
- package/src/sync/journal-sqlite.ts +162 -76
- package/src/sync/journal.ts +91 -32
- package/src/sync/live-tails.ts +107 -0
- package/src/sync/projection.ts +35 -0
- package/src/sync/recovery.ts +80 -51
- package/src/sync/schema.ts +27 -6
- package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
- package/docs/rfds/0002-native-subagents.md +0 -197
- package/src/client/request.ts +0 -19
- 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
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { MessagePartDeltaEvent } from "../protocol/index.ts";
|
|
2
|
+
import type { Db } from "./sql.ts";
|
|
3
|
+
|
|
4
|
+
/** A streaming part with rows: what it streamed since its last kept snapshot. */
|
|
5
|
+
interface Tail {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
turnId: string;
|
|
8
|
+
partId: string;
|
|
9
|
+
/** The rows it has, the next one's `n`. */
|
|
10
|
+
rows: number;
|
|
11
|
+
}
|
|
12
|
+
const keyOf = (sessionId: string, partId: string) => `${sessionId}\u0000${partId}`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Each streaming part's tail, kept outside every history so recovery closes
|
|
16
|
+
* the part with what was shown: one row per delta. The only code that touches
|
|
17
|
+
* the `live_tails` table, as `EventLog` is for the histories; which parts
|
|
18
|
+
* have rows is kept in memory too, to number the next row and drop a turn's.
|
|
19
|
+
*/
|
|
20
|
+
export class LiveTails {
|
|
21
|
+
private readonly tails = new Map<string, Tail>();
|
|
22
|
+
|
|
23
|
+
constructor(private readonly db: Db) {}
|
|
24
|
+
|
|
25
|
+
// @ref LLP 0003#a-crash-keeps-what-was-shown — written before the delta is delivered
|
|
26
|
+
// @ref LLP 0008#the-journal-live_tails-becomes-append-only — a row per delta, never the whole part again
|
|
27
|
+
/** Append what `event` streamed to its part's tail. */
|
|
28
|
+
keep(event: MessagePartDeltaEvent): void {
|
|
29
|
+
const key = keyOf(event.sessionId, event.partId);
|
|
30
|
+
let tail = this.tails.get(key);
|
|
31
|
+
if (!tail) {
|
|
32
|
+
tail = { sessionId: event.sessionId, turnId: event.turnId, partId: event.partId, rows: 0 };
|
|
33
|
+
this.tails.set(key, tail);
|
|
34
|
+
}
|
|
35
|
+
// Every delta, as kept events are committed before delivery: a model can
|
|
36
|
+
// stream hundreds of characters in one burst, and what a client was
|
|
37
|
+
// shown must not depend on a timer. A row of its own: the tail is the
|
|
38
|
+
// whole part now that no checkpoint is kept, and rewriting it per delta
|
|
39
|
+
// grows with the square of its length (250 MB written for a 100 KB tool
|
|
40
|
+
// input, where appending costs a flat 14 µs). Without an fsync: a
|
|
41
|
+
// committed write survives the process dying at any `synchronous` level
|
|
42
|
+
// (only power loss could lose it), and the next kept event's commit
|
|
43
|
+
// flushes it; an fsync'd write took 60 µs on a laptop and a millisecond
|
|
44
|
+
// on cloud disks, on the server's one thread.
|
|
45
|
+
const level = this.relaxSync();
|
|
46
|
+
try {
|
|
47
|
+
this.db.run(
|
|
48
|
+
"INSERT INTO live_tails(session_id,turn_id,part_id,n,body) VALUES (?,?,?,?,?)",
|
|
49
|
+
tail.sessionId,
|
|
50
|
+
tail.turnId,
|
|
51
|
+
tail.partId,
|
|
52
|
+
tail.rows,
|
|
53
|
+
event.delta.type === "tool_input" ? event.delta.input : event.delta.text,
|
|
54
|
+
);
|
|
55
|
+
tail.rows++;
|
|
56
|
+
} finally {
|
|
57
|
+
if (level !== undefined) this.db.exec(`PRAGMA synchronous=${level}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The part's kept snapshot holds what it streamed so far. */
|
|
62
|
+
dropPart(sessionId: string, partId: string): void {
|
|
63
|
+
if (!this.tails.delete(keyOf(sessionId, partId))) return;
|
|
64
|
+
this.db.run("DELETE FROM live_tails WHERE session_id=? AND part_id=?", sessionId, partId);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The turn ended: its parts stream no more. */
|
|
68
|
+
dropTurn(sessionId: string, turnId: string): void {
|
|
69
|
+
for (const tail of [...this.tails.values()])
|
|
70
|
+
if (tail.sessionId === sessionId && tail.turnId === turnId)
|
|
71
|
+
this.dropPart(sessionId, tail.partId);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** What the turn's parts streamed after their last kept snapshots, by part id: their rows joined in order. */
|
|
75
|
+
ofTurn(sessionId: string, turnId: string): Map<string, string> {
|
|
76
|
+
const tails = new Map<string, string>();
|
|
77
|
+
for (const row of this.db.all<{ part_id: string; body: string }>(
|
|
78
|
+
"SELECT part_id,body FROM live_tails WHERE session_id=? AND turn_id=? ORDER BY part_id,n",
|
|
79
|
+
sessionId,
|
|
80
|
+
turnId,
|
|
81
|
+
))
|
|
82
|
+
tails.set(row.part_id, (tails.get(row.part_id) ?? "") + row.body);
|
|
83
|
+
return tails;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Forget every tail: only an interrupted turn's mean anything, and recovery took them. */
|
|
87
|
+
clear(): void {
|
|
88
|
+
this.tails.clear();
|
|
89
|
+
this.db.run("DELETE FROM live_tails");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Set the connection to NORMAL for one write, returning the level to put
|
|
94
|
+
* back: read each time, as SQLite moves an unset level by itself. Best
|
|
95
|
+
* effort: a host that refuses the pragma gets the write as it stands.
|
|
96
|
+
*/
|
|
97
|
+
private relaxSync(): number | undefined {
|
|
98
|
+
try {
|
|
99
|
+
const level = this.db.one<{ synchronous: number }>("PRAGMA synchronous")?.synchronous;
|
|
100
|
+
if (level === undefined || level <= 1) return undefined;
|
|
101
|
+
this.db.exec("PRAGMA synchronous=NORMAL");
|
|
102
|
+
return level;
|
|
103
|
+
} catch {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ConversationState,
|
|
3
|
+
HISTORY_MAX_BYTES,
|
|
4
|
+
type HistoryCheckpoint,
|
|
5
|
+
HistoryError,
|
|
6
|
+
decodeLifecycleEvent,
|
|
7
|
+
jsonBytes,
|
|
8
|
+
reduceConversation,
|
|
9
|
+
} from "../protocol/index.ts";
|
|
10
|
+
|
|
11
|
+
/** The most events a projection folds unless its caller says otherwise: it is built in memory. */
|
|
12
|
+
const MAX_PROJECTION_RECORDS = 100_000;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A fold of history events into a conversation that takes at most
|
|
16
|
+
* `maxRecords` of them, across every call: past that it throws, and a longer
|
|
17
|
+
* history is read in pages instead.
|
|
18
|
+
*/
|
|
19
|
+
export function projectionFold(
|
|
20
|
+
maxRecords = MAX_PROJECTION_RECORDS,
|
|
21
|
+
): (conversation: ConversationState, event: unknown) => ConversationState {
|
|
22
|
+
if (!Number.isSafeInteger(maxRecords) || maxRecords < 0)
|
|
23
|
+
throw new Error("maxRecords must be a nonnegative safe integer");
|
|
24
|
+
let left = maxRecords;
|
|
25
|
+
return (conversation, event) => {
|
|
26
|
+
if (--left < 0) throw new Error("History projection limit exceeded; use paged reads");
|
|
27
|
+
return reduceConversation(conversation, decodeLifecycleEvent(event));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A checkpoint fits a history page, as all history does: no store keeps, and no reader takes, a larger one. */
|
|
32
|
+
export function checkCheckpointBytes(checkpoint: HistoryCheckpoint): void {
|
|
33
|
+
if (jsonBytes(checkpoint) > HISTORY_MAX_BYTES)
|
|
34
|
+
throw new HistoryError("invalidParams", "Checkpoint exceeds byte limit; use paged history");
|
|
35
|
+
}
|
package/src/sync/recovery.ts
CHANGED
|
@@ -1,66 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type
|
|
3
|
-
|
|
2
|
+
type ConversationState,
|
|
3
|
+
type HarnessId,
|
|
4
4
|
type Part,
|
|
5
|
+
type RecoveryReason,
|
|
6
|
+
closeToolLeftOpen,
|
|
5
7
|
decodeLifecycleEvent,
|
|
6
8
|
emptyConversation,
|
|
7
9
|
isUnknownEvent,
|
|
8
10
|
reduceConversation,
|
|
9
11
|
} from "../protocol/index.ts";
|
|
12
|
+
import type { SessionEvent } from "./fit.ts";
|
|
10
13
|
|
|
11
|
-
/**
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
input: {},
|
|
24
|
-
error: INTERRUPTED_TOOL_ERROR,
|
|
25
|
-
time: { start: at, end: at },
|
|
26
|
-
...(state.partialInput && {
|
|
27
|
-
_meta: { ...state._meta, [PARTIAL_INPUT_META_KEY]: state.partialInput },
|
|
28
|
-
}),
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
if (state.status === "in_progress")
|
|
32
|
-
return {
|
|
33
|
-
...part,
|
|
34
|
-
state: {
|
|
35
|
-
status: "failed",
|
|
36
|
-
input: state.input,
|
|
37
|
-
error: INTERRUPTED_TOOL_ERROR,
|
|
38
|
-
time: { start: state.time.start, end: at },
|
|
39
|
-
...(state._meta && { _meta: state._meta }),
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
if ((part.type === "text" || part.type === "reasoning") && part.state === "streaming")
|
|
45
|
-
return { ...part, state: "done" };
|
|
46
|
-
return undefined;
|
|
14
|
+
/** A turn a server restart cut off, as the journal holds it. */
|
|
15
|
+
export interface CutOffTurn {
|
|
16
|
+
sessionId: string;
|
|
17
|
+
turnId: string;
|
|
18
|
+
/** The session's harness, which a turn cut off before its first event never named. */
|
|
19
|
+
harness: HarnessId;
|
|
20
|
+
/** When recovery ends it. */
|
|
21
|
+
at: number;
|
|
22
|
+
/** By part id, what a part streamed after its last kept snapshot. */
|
|
23
|
+
tails: ReadonlyMap<string, string>;
|
|
24
|
+
/** Why its session stays fenced; absent once the restart stopped its agent. */
|
|
25
|
+
fence?: RecoveryReason;
|
|
47
26
|
}
|
|
48
27
|
|
|
49
28
|
/**
|
|
50
|
-
* The facts that
|
|
51
|
-
* its
|
|
52
|
-
*
|
|
53
|
-
*
|
|
29
|
+
* The facts that end a turn a server restart cut off, in the order to commit
|
|
30
|
+
* them, so its history stays a valid stream: its `turn.started` when it was
|
|
31
|
+
* cut off before its first event; then what it left open closed (pending
|
|
32
|
+
* permissions and questions cancelled, running tools failed as interrupted,
|
|
33
|
+
* streaming parts done with their tails, open messages ended); then its
|
|
34
|
+
* `turn.ended`. `history` is the session's committed events, oldest first.
|
|
54
35
|
*/
|
|
55
|
-
export function
|
|
56
|
-
|
|
57
|
-
sessionId: string,
|
|
58
|
-
turnId: string,
|
|
59
|
-
at: number,
|
|
60
|
-
): LifecycleEvent[] {
|
|
36
|
+
export function recoveryFacts(history: Iterable<unknown>, turn: CutOffTurn): SessionEvent[] {
|
|
37
|
+
const { sessionId, turnId, at } = turn;
|
|
61
38
|
let state = emptyConversation();
|
|
62
39
|
const address = new Map<string, { messageId: string; outputIndex: number; partIndex: number }>();
|
|
63
|
-
for (const raw of
|
|
40
|
+
for (const raw of history) {
|
|
64
41
|
const event = decodeLifecycleEvent(raw);
|
|
65
42
|
state = reduceConversation(state, event);
|
|
66
43
|
if (!isUnknownEvent(event) && event.type === "message.part" && event.turnId === turnId)
|
|
@@ -70,7 +47,15 @@ export function interruptionFacts(
|
|
|
70
47
|
partIndex: event.partIndex,
|
|
71
48
|
});
|
|
72
49
|
}
|
|
73
|
-
const facts:
|
|
50
|
+
const facts: SessionEvent[] = [];
|
|
51
|
+
if (!state.turns.some((t) => t.turnId === turnId))
|
|
52
|
+
facts.push({
|
|
53
|
+
type: "turn.started",
|
|
54
|
+
sessionId,
|
|
55
|
+
turnId,
|
|
56
|
+
execution: { harness: turn.harness },
|
|
57
|
+
timestamp: at,
|
|
58
|
+
});
|
|
74
59
|
for (const permission of state.permissions)
|
|
75
60
|
if (permission.turnId === turnId && permission.outcome === undefined)
|
|
76
61
|
facts.push({
|
|
@@ -81,6 +66,16 @@ export function interruptionFacts(
|
|
|
81
66
|
outcome: { outcome: "cancelled" },
|
|
82
67
|
timestamp: at,
|
|
83
68
|
});
|
|
69
|
+
for (const elicitation of state.elicitations)
|
|
70
|
+
if (elicitation.turnId === turnId && elicitation.outcome === undefined)
|
|
71
|
+
facts.push({
|
|
72
|
+
type: "elicitation.resolved",
|
|
73
|
+
sessionId,
|
|
74
|
+
turnId,
|
|
75
|
+
requestId: elicitation.requestId,
|
|
76
|
+
outcome: { action: "cancel" },
|
|
77
|
+
timestamp: at,
|
|
78
|
+
});
|
|
84
79
|
for (const entry of state.timeline) {
|
|
85
80
|
if (entry.kind !== "message" || entry.turnId !== turnId) continue;
|
|
86
81
|
// A tool keeps running after the model message that called it ends, and
|
|
@@ -88,7 +83,7 @@ export function interruptionFacts(
|
|
|
88
83
|
for (const part of entry.parts) {
|
|
89
84
|
if ("raw" in part) continue;
|
|
90
85
|
const where = address.get(part.id);
|
|
91
|
-
const closed = where && closePart(part, at);
|
|
86
|
+
const closed = where && closePart(state, turnId, part, at, turn.tails.get(part.id));
|
|
92
87
|
if (where && closed)
|
|
93
88
|
facts.push({
|
|
94
89
|
type: "message.part",
|
|
@@ -108,5 +103,39 @@ export function interruptionFacts(
|
|
|
108
103
|
timestamp: at,
|
|
109
104
|
});
|
|
110
105
|
}
|
|
106
|
+
facts.push({
|
|
107
|
+
type: "turn.ended",
|
|
108
|
+
sessionId,
|
|
109
|
+
turnId,
|
|
110
|
+
stopReason: "error",
|
|
111
|
+
error: {
|
|
112
|
+
category: "server_restart",
|
|
113
|
+
message: turn.fence
|
|
114
|
+
? `Server restarted before the turn settled and could not confirm its agent stopped (${turn.fence}); check it before continuing.`
|
|
115
|
+
: "Server restarted before the turn settled. Its agent was stopped at restart; what its running tool did is unknown.",
|
|
116
|
+
},
|
|
117
|
+
timestamp: at,
|
|
118
|
+
});
|
|
111
119
|
return facts;
|
|
112
120
|
}
|
|
121
|
+
|
|
122
|
+
// A tool closes as the reducer closes it, interrupted where it may have run.
|
|
123
|
+
// A streaming part keeps what it streamed after its last kept snapshot.
|
|
124
|
+
function closePart(
|
|
125
|
+
state: ConversationState,
|
|
126
|
+
turnId: string,
|
|
127
|
+
part: Part,
|
|
128
|
+
at: number,
|
|
129
|
+
tail = "",
|
|
130
|
+
): Part | undefined {
|
|
131
|
+
if (part.type === "tool")
|
|
132
|
+
return closeToolLeftOpen(state, turnId, part, {
|
|
133
|
+
at,
|
|
134
|
+
cancelled: false,
|
|
135
|
+
outcomeUnknown: "interrupted",
|
|
136
|
+
tail,
|
|
137
|
+
});
|
|
138
|
+
if ((part.type === "text" || part.type === "reasoning") && part.state === "streaming")
|
|
139
|
+
return { ...part, text: part.text + tail, state: "done" };
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
package/src/sync/schema.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { Db } from "./sql.ts";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
3
|
+
/** The journal format, kept in `user_version`. An empty file gets this schema;
|
|
4
|
+
* a file of another version is refused, never migrated. Version 6 keeps a
|
|
5
|
+
* streaming part's tail as one row per delta, since with no checkpoints the
|
|
6
|
+
* tail is the whole part; version 5 keeps the native processes its owners
|
|
7
|
+
* started, and why a fence could not be lifted; version 4 keeps each
|
|
8
|
+
* streaming part's unsnapshotted tail for recovery; version 3 stored no token
|
|
9
|
+
* deltas (wire v3); version 2 journals kept them at their own seq. */
|
|
10
|
+
const SCHEMA_VERSION = 6;
|
|
7
11
|
|
|
8
12
|
const DDL = `
|
|
9
13
|
CREATE TABLE identity (id TEXT PRIMARY KEY);
|
|
@@ -18,9 +22,11 @@ CREATE TABLE events (
|
|
|
18
22
|
hash TEXT NOT NULL, body TEXT NOT NULL,
|
|
19
23
|
PRIMARY KEY (source_id, session_id, seq));
|
|
20
24
|
-- The sessions this store executes; their histories have its identity as source.
|
|
25
|
+
-- recovery_reason, with the fence: why a restart could not lift it.
|
|
21
26
|
CREATE TABLE sessions (
|
|
22
27
|
session_id TEXT PRIMARY KEY, harness TEXT NOT NULL, native_id TEXT,
|
|
23
|
-
closed INTEGER NOT NULL DEFAULT 0, recovery_required INTEGER NOT NULL DEFAULT 0
|
|
28
|
+
closed INTEGER NOT NULL DEFAULT 0, recovery_required INTEGER NOT NULL DEFAULT 0,
|
|
29
|
+
recovery_reason TEXT);
|
|
24
30
|
-- Admitted turns: the request's fingerprint and input, then how it settled.
|
|
25
31
|
CREATE TABLE turns (
|
|
26
32
|
session_id TEXT NOT NULL, turn_id TEXT NOT NULL, fingerprint TEXT NOT NULL,
|
|
@@ -31,6 +37,21 @@ CREATE UNIQUE INDEX one_active_turn ON turns (session_id) WHERE state = 'admitte
|
|
|
31
37
|
CREATE TABLE commits (
|
|
32
38
|
session_id TEXT NOT NULL, commit_id TEXT NOT NULL, fingerprint TEXT NOT NULL,
|
|
33
39
|
version TEXT NOT NULL, PRIMARY KEY (session_id, commit_id));
|
|
40
|
+
-- What each open part streamed since its last kept snapshot, one row per
|
|
41
|
+
-- delta: never part of a history, written before the delta is delivered,
|
|
42
|
+
-- deleted with the part's next kept snapshot or its turn's end. Recovery
|
|
43
|
+
-- closes the part with its rows, in order.
|
|
44
|
+
CREATE TABLE live_tails (
|
|
45
|
+
session_id TEXT NOT NULL, turn_id TEXT NOT NULL, part_id TEXT NOT NULL,
|
|
46
|
+
n INTEGER NOT NULL, body TEXT NOT NULL, PRIMARY KEY (session_id, part_id, n));
|
|
47
|
+
-- The native processes this store's owners started, until each is seen gone:
|
|
48
|
+
-- what a restart verifies and stops before it decides whether to fence. pid
|
|
49
|
+
-- (also its process group) is NULL when a host's own spawner started it.
|
|
50
|
+
-- Never part of a history.
|
|
51
|
+
CREATE TABLE native_processes (
|
|
52
|
+
id INTEGER PRIMARY KEY, session_id TEXT NOT NULL, harness TEXT NOT NULL,
|
|
53
|
+
pid INTEGER, boot TEXT, started TEXT, executable TEXT NOT NULL);
|
|
54
|
+
CREATE INDEX native_processes_session ON native_processes (session_id);
|
|
34
55
|
-- Cached conversation projections; the events stay authoritative.
|
|
35
56
|
CREATE TABLE checkpoints (
|
|
36
57
|
source_id TEXT NOT NULL, session_id TEXT NOT NULL, format TEXT NOT NULL,
|
|
@@ -44,7 +65,7 @@ export function openSchema(db: Db, newId: () => string): string {
|
|
|
44
65
|
const { user_version: version } = db.one<{ user_version: number }>("PRAGMA user_version")!;
|
|
45
66
|
if (version !== 0 && version !== SCHEMA_VERSION)
|
|
46
67
|
throw new Error(
|
|
47
|
-
`Unsupported journal schema ${version}; this build reads schema ${SCHEMA_VERSION}`,
|
|
68
|
+
`Unsupported journal schema ${version}; this build reads schema ${SCHEMA_VERSION}. Open it with the agent-server that wrote it, or start a new journal file`,
|
|
48
69
|
);
|
|
49
70
|
return db.atomic(() => {
|
|
50
71
|
if (version === 0) {
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# RFD 0001 — Deterministic echo ids
|
|
2
|
-
|
|
3
|
-
**Status: adopted** (0.3.0, unpublished — shipped with the consumer-machinery batch).
|
|
4
|
-
|
|
5
|
-
## Change
|
|
6
|
-
|
|
7
|
-
The user echo's ids are **derived from the turn id** instead of minted as UUIDv7:
|
|
8
|
-
|
|
9
|
-
- echo message id: `echo-<turnId>`
|
|
10
|
-
- echo part ids: `echo-<turnId>-<index>`
|
|
11
|
-
|
|
12
|
-
Exported as `echoMessageId(turnId)` / `echoPartId(turnId, index)`;
|
|
13
|
-
`createUserEchoParts(input, turnId)` stamps them. This is a **documented
|
|
14
|
-
exception to Law 8** (engine-minted UUIDv7).
|
|
15
|
-
|
|
16
|
-
## Why
|
|
17
|
-
|
|
18
|
-
The echo is not new information — it is the caller's own input played back, and
|
|
19
|
-
one turn has exactly one echo message. Every consumer that renders an
|
|
20
|
-
optimistic prompt bubble was reconciling a look-alike against the echo by
|
|
21
|
-
`turnId` (spec §7.2's old rule) — a swap with visible failure modes (deus lost
|
|
22
|
-
file parts in the swap; agnt double-echoed). With derived ids, a consumer that
|
|
23
|
-
minted the `turnId` predicts the echo **byte-for-byte**: the optimistic bubble
|
|
24
|
-
IS the echo, and it upserts onto itself. Retried turns converge the same way
|
|
25
|
-
(turn admission is idempotent on `{sessionId, turnId}`).
|
|
26
|
-
|
|
27
|
-
## What ids still are
|
|
28
|
-
|
|
29
|
-
Opaque to peers. Derivation is a producer rule matched by exported consumer
|
|
30
|
-
helpers — not a licence to parse structure out of ids anywhere else.
|
|
31
|
-
|
|
32
|
-
## Costs (documented, accepted)
|
|
33
|
-
|
|
34
|
-
- Echo ids do not time-sort against UUIDv7 ids. Never order by id; order by
|
|
35
|
-
`outputIndex`/`seq` (which the spec already mandates — Law 5).
|
|
36
|
-
- Echo ids fail UUID-shaped derivations: uuid-typed columns and
|
|
37
|
-
`createdAtFromUUID7`-style timestamp extraction (returns 0). Derive the
|
|
38
|
-
echo's time from the **`turnId` field** the event/row already carries (it is
|
|
39
|
-
UUIDv7) — never by parsing the echo id string; ids stay opaque.
|
|
40
|
-
|
|
41
|
-
## Spec delta
|
|
42
|
-
|
|
43
|
-
PROTOCOL.md §7.2 (echo reconciliation) and Law 8 (id minting) carry the
|
|
44
|
-
amendment; `docs/consuming.md` describes prediction instead of reconciliation.
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
# RFD 0002 — Native delegation within a managed turn
|
|
2
|
-
|
|
3
|
-
**Status:** implemented; native Claude and Codex qualification passed on 2026-09-29.
|
|
4
|
-
**Date:** 2026-09-29
|
|
5
|
-
**Scope:** Claude Code and Codex app-server in agent-server and AGNT.
|
|
6
|
-
**Baseline:** agent-server `7248c43`; AGNT `39df4fa9`.
|
|
7
|
-
|
|
8
|
-
## Recommendation
|
|
9
|
-
|
|
10
|
-
Support native delegation inside the existing logical engine turn. The parent
|
|
11
|
-
assigns work, collects results and produces the final answer. The engine retains
|
|
12
|
-
ownership until its native work finishes or is stopped. AGNT keeps using its
|
|
13
|
-
existing turn-scoped credentials, permission bridge, persistence and cancellation.
|
|
14
|
-
|
|
15
|
-
This is a smaller extension of [DESIGN D10](../../../../DESIGN.md#d10--built-in-turns-own-their-logical-session-through-cleanup).
|
|
16
|
-
It does not require a second scheduler, child credential leases, a worker
|
|
17
|
-
database, or a stream that remains active between managed turns. Independently
|
|
18
|
-
running workers across later turns are outside this first contract.
|
|
19
|
-
|
|
20
|
-
## What already works — observed
|
|
21
|
-
|
|
22
|
-
Deus Machine already configures this engine with `forwardSubagentText: true`
|
|
23
|
-
and renders nested subagent output. At `origin/main` `4e957a26c`, see
|
|
24
|
-
`apps/agent-server/agents/core/engine.ts`,
|
|
25
|
-
`apps/web/src/features/session/ui/blocks/SubagentGroupBlock.tsx` and
|
|
26
|
-
`apps/backend/test/unit/services/event-persistence-integration.test.ts`.
|
|
27
|
-
The last file tests nesting a worker message under its spawning tool. This is
|
|
28
|
-
source evidence, not a new live execution.
|
|
29
|
-
|
|
30
|
-
The engine already carries `ToolPart.subagent` and `parentToolCallId`; its
|
|
31
|
-
`test/server/flows.test.ts` covers nested output. AGNT already round-trips these
|
|
32
|
-
fields. Its two focused message suites passed **37 tests** during this rehearsal.
|
|
33
|
-
|
|
34
|
-
[SessionAgent](../../src/core/agents/session-agent.ts) already reserves a session
|
|
35
|
-
through `executeTurn` cleanup. AGNT's controller waits for its predecessor to
|
|
36
|
-
drain before preparing a new credential and releases credentials in its existing
|
|
37
|
-
`finally`. These are the owners to reuse.
|
|
38
|
-
|
|
39
|
-
AGNT does not globally disable native delegation. Its explicit `toolAllowlist`
|
|
40
|
-
rejects `Agent` and `Task`; QApp also omits them. AGNT's Claude SDK options omit
|
|
41
|
-
Deus Machine's forwarding flag. Saying that the whole stack lacked subagents
|
|
42
|
-
was too broad.
|
|
43
|
-
|
|
44
|
-
## Pass 1 — the smallest apparent patch
|
|
45
|
-
|
|
46
|
-
1. Enable Claude child-text forwarding in AGNT. Recognize modern `Agent` as
|
|
47
|
-
well as legacy `Task` in the Claude adapter.
|
|
48
|
-
2. Normalize Codex's existing native delegation output.
|
|
49
|
-
3. Permit delegation under AGNT's scoped tool policy.
|
|
50
|
-
|
|
51
|
-
Steps 1–3 alone are insufficient. The following counterexamples determine the
|
|
52
|
-
additional work; they do not justify a general background-worker platform.
|
|
53
|
-
|
|
54
|
-
## Pass 2 — counterexamples and smallest corrections
|
|
55
|
-
|
|
56
|
-
| Trigger and current path | Wrong result | Smallest correction and proof |
|
|
57
|
-
| --- | --- | --- |
|
|
58
|
-
| Claude returns its parent `result` while background work remains; `ClaudeGeneratorSession` closes the tap. | Late child output is lost or reaches the next tap after the host changes policy. | In the managed mode, enforce native foreground execution and qualify cleanup on the pinned SDK. Test cancellation plus a successor with changed policy. |
|
|
59
|
-
| Codex emits root `turn/completed`; `executeTurn` ends its queue and removes listeners. | Child activity disappears; credentials can be released too early. | Track native descendants for this execution, separate parent completion from execution settlement, and retain the existing session reservation through cleanup. |
|
|
60
|
-
| Merely delay Codex's queue end, leaving `turnEnded = true`. | `forceCancel` returns early, so cancellation can hang or falsely settle. | Make cancellation depend on execution settlement, target active owned native turns, and observe completion. Test cancel after the parent response. |
|
|
61
|
-
| A Codex child requests approval. `bindRequests` currently declines every foreign thread id. | Owned children cannot use the existing permission broker. | Admit only descendants proven by native ownership; route them through the current turn's handler. Test an owned child and an unrelated thread. |
|
|
62
|
-
| Treat `client.close()` or a stop request as proof of teardown. | Current `close()` marks itself closed before the OS process exits. | Await actual native completion or bounded subprocess teardown; qualify descendant tools too. Never report a clean stop from the local boolean alone. |
|
|
63
|
-
| Set foreground behavior globally for all engine consumers. | Existing interactive Deus Machine behavior changes unintentionally. | Use one explicit managed-turn option, include it in native session configuration, and preserve the default for existing consumers. |
|
|
64
|
-
| Wait for workers after the parent has already submitted its answer. | The final answer may never have used their results. | Require the parent to collect results. If it returns with outstanding work, stop that work and report incomplete execution; do not silently run another model turn. |
|
|
65
|
-
|
|
66
|
-
The earlier synthetic probes reproduced omitted adapter events and late-tap
|
|
67
|
-
routing, not a live permission escape. Artifacts remain under
|
|
68
|
-
`.context/subagents-research/` and QApp's `.context/delegation-audit/`.
|
|
69
|
-
|
|
70
|
-
## Pass 3 — revised implementation
|
|
71
|
-
|
|
72
|
-
### Engine option and lifetime
|
|
73
|
-
|
|
74
|
-
The opt-in `RunConfig.subagentMode: "turn"` preserves existing native behavior
|
|
75
|
-
when omitted. Unsupported
|
|
76
|
-
harnesses reject the request. Thread it through
|
|
77
|
-
`src/protocol/config.ts`, `src/core/agents/base.ts`,
|
|
78
|
-
`src/core/runtime/agent-runtime.ts` and native session configuration.
|
|
79
|
-
A warm process must not silently retain an incompatible mode.
|
|
80
|
-
|
|
81
|
-
The normal path remains one run: native workers execute, the parent receives
|
|
82
|
-
their results, and the engine finishes after native cleanup. Multiple native
|
|
83
|
-
workers may run concurrently where the pinned harness supports it; qualify that
|
|
84
|
-
behavior rather than promising it from an SDK option.
|
|
85
|
-
|
|
86
|
-
The adapter needs an execution-local record of owned native work, not a durable
|
|
87
|
-
child-session service. Track starts, terminal outcomes and active native turn
|
|
88
|
-
identifiers, including descendants. A spawn acknowledgement is not completion.
|
|
89
|
-
On early parent exit or cancellation, stop remaining owned work before releasing
|
|
90
|
-
ownership. Failure to establish cleanup must remain a failed/unconfirmed
|
|
91
|
-
execution and prevent unsafe session reuse. Do not add automatic retries or
|
|
92
|
-
background parent wake-ups.
|
|
93
|
-
|
|
94
|
-
### Claude
|
|
95
|
-
|
|
96
|
-
Use the native foreground control in managed mode and forward child text.
|
|
97
|
-
The current [Claude documentation](https://code.claude.com/docs/en/sub-agents#run-subagents-in-foreground-or-background)
|
|
98
|
-
documents `CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1`; verify the behavior against
|
|
99
|
-
the pinned SDK **0.3.220**, including explicit background requests and
|
|
100
|
-
cancellation. Reuse the existing message nesting.
|
|
101
|
-
|
|
102
|
-
Changes belong in `claude-code/options.ts`, `claude-agent.ts`,
|
|
103
|
-
`generator-session.ts` as required by that qualification, and the
|
|
104
|
-
`subagentFromInput` branch in `claude-code/adapter.ts`. Do not build a separate
|
|
105
|
-
Claude scheduler. If the native foreground control does not contain the pinned
|
|
106
|
-
runtime, keep the managed capability disabled until that specific gap is fixed.
|
|
107
|
-
|
|
108
|
-
### Codex
|
|
109
|
-
|
|
110
|
-
The pinned CLI **0.153.4** emits V1 `collabAgentToolCall` and V2
|
|
111
|
-
`subAgentActivity`. Both currently disappear in the adapters. V2 activity may
|
|
112
|
-
arrive after its originating parent response. The
|
|
113
|
-
[pinned app-server contract](https://github.com/openai/codex/blob/3d2ee51ca2d5db578f328aa75e20aa22c0197c9a/codex-rs/app-server/README.md)
|
|
114
|
-
supports `turn/interrupt` for parent-owned V2 children too: use each child's
|
|
115
|
-
active native turn, then observe its terminal outcome. Interrupting an already
|
|
116
|
-
completed root is insufficient. Native background terminals have a separate
|
|
117
|
-
cleanup operation; include child-owned terminals in cancellation qualification.
|
|
118
|
-
|
|
119
|
-
Implement ownership, notification selection and drain behavior in
|
|
120
|
-
`codex-app-server/codex-app-server-agent.ts`; add awaited process-exit fallback
|
|
121
|
-
in `client.ts`. Use native parent links/read APIs to settle notification-order
|
|
122
|
-
races, never permissive thread matching. Child approval handling stays on the
|
|
123
|
-
existing broker.
|
|
124
|
-
|
|
125
|
-
Normalize V1 calls in `codex-app-server/adapter.ts` and `codex-items.ts`.
|
|
126
|
-
Preserve real native ids, results and task metadata. V2 is an activity, not a
|
|
127
|
-
public tool invocation: add the small typed activity representation it needs to
|
|
128
|
-
the existing Part/adapter/reducer path rather than inventing a tool call.
|
|
129
|
-
Carry its native activity id, child thread id and observed kind. This is a
|
|
130
|
-
persisted message part, not a new independently managed session. Full child
|
|
131
|
-
transcript parity is not a prerequisite; unavailable transcripts stay explicit.
|
|
132
|
-
|
|
133
|
-
### AGNT and review consumers
|
|
134
|
-
|
|
135
|
-
AGNT enables the qualified managed mode in `AgentEngine.prepareTurn` and adds
|
|
136
|
-
`forwardSubagentText`. Its existing controller and credential cleanup remain
|
|
137
|
-
the owners. Extend existing part persistence only for the activity shape the
|
|
138
|
-
engine actually emits; no new worker table is needed.
|
|
139
|
-
|
|
140
|
-
Relax `Agent`/`Task` rejection only when child tools demonstrably obey the same
|
|
141
|
-
Claude allowlist, including bypass mode. Gate this admission on an updated
|
|
142
|
-
sidecar version. Codex's existing lack of custom `toolAllowlist` enforcement
|
|
143
|
-
remains a separate limitation; this work must not claim to solve it.
|
|
144
|
-
|
|
145
|
-
The parent decides what to test through skills, gives each worker the necessary
|
|
146
|
-
context, waits for results and submits one report. Device workers share no
|
|
147
|
-
simulator concurrently unless separate devices exist. QApp's evidence still
|
|
148
|
-
comes through its trusted capture path. No review roles belong in the engine.
|
|
149
|
-
|
|
150
|
-
## Checks that establish the feature
|
|
151
|
-
|
|
152
|
-
- Adapter fixtures cover modern Claude `Agent`, legacy `Task`, Codex V1 and
|
|
153
|
-
V2, interleaved workers, native ids and honest outcomes.
|
|
154
|
-
- Runtime tests cover early parent completion, child failure, cancellation while
|
|
155
|
-
waiting, owned/unrelated approvals, actual teardown, and a successor with
|
|
156
|
-
different credentials/MCP/policy. No old child reaches that successor.
|
|
157
|
-
- Existing reducer, replay and AGNT JSON-part round trips retain nesting and
|
|
158
|
-
activity without a separate lifecycle database.
|
|
159
|
-
- Live pinned Claude and Codex runs each delegate two tasks and incorporate both
|
|
160
|
-
results. Repeat through AGNT's real proxy/MCP path, including a denied child
|
|
161
|
-
tool for Claude. Prove stop behavior and absence of continued child execution.
|
|
162
|
-
- Existing consumers without the managed option keep their native behavior.
|
|
163
|
-
A QApp review demonstrates worker evidence reaching the final report and
|
|
164
|
-
visible partial coverage on failure.
|
|
165
|
-
|
|
166
|
-
## Implementation qualification
|
|
167
|
-
|
|
168
|
-
The deterministic engine suite passes (907 tests). The opt-in live suite
|
|
169
|
-
`test/core/live/subagents.live.test.ts` passes four real-model cases: Claude and
|
|
170
|
-
Codex each delegate to two workers and incorporate both unique file values;
|
|
171
|
-
each cancels a worker running a real shell command, confirms that PID stopped,
|
|
172
|
-
and successfully runs a successor. Proof is retained in `.context/proof/subagents`.
|
|
173
|
-
No simulator was used in these engine tests.
|
|
174
|
-
|
|
175
|
-
Live testing found that Claude can return `error_during_execution` with
|
|
176
|
-
`stop_reason: tool_use` on an acknowledged cancellation. The adapter now uses
|
|
177
|
-
the confirmed interrupt marker to distinguish that from an execution failure.
|
|
178
|
-
|
|
179
|
-
Codex can register a background terminal AFTER its thread becomes idle. An
|
|
180
|
-
interrupt response and empty terminal list therefore cannot prove cleanup.
|
|
181
|
-
Managed Codex turns close the app-server through stdin EOF after reconciliation,
|
|
182
|
-
which invokes native thread/tool shutdown. Root SIGTERM alone left a real child
|
|
183
|
-
command running on macOS. Forced exits or native cleanup warnings are unconfirmed
|
|
184
|
-
and quarantine the logical session. A managed successor resumes persisted context
|
|
185
|
-
in a fresh process; the default interactive mode retains its warm process.
|
|
186
|
-
|
|
187
|
-
This contract covers native managed work. It does not turn arbitrary shell
|
|
188
|
-
commands into an OS containment boundary; sandbox custody remains with the host.
|
|
189
|
-
AGNT and QApp integration qualification is recorded in their own design documents.
|
|
190
|
-
|
|
191
|
-
Repeated cancellation also consults persistent unconfirmed native cleanup after the wrapper turn has ended. The idle response of another harness must not erase that result in the host. AGNT cloud qualification additionally verified real child PID cleanup and a successful successor for both harnesses.
|
|
192
|
-
|
|
193
|
-
Releasing a quarantined Codex session also refuses unconfirmed cleanup. A host
|
|
194
|
-
must propagate that release failure before resetting the session or switching
|
|
195
|
-
harnesses; otherwise a successor could bypass the same-harness admission guard.
|
|
196
|
-
Deterministic regressions cover failure after normal parent completion, repeated
|
|
197
|
-
release attempts, and successful release after confirmed cleanup.
|
package/src/client/request.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
2
|
-
|
|
3
|
-
/** The server answered a request with a JSON-RPC error. */
|
|
4
|
-
export class WireRequestError extends Error {
|
|
5
|
-
override readonly name = "WireRequestError";
|
|
6
|
-
constructor(
|
|
7
|
-
readonly code: number,
|
|
8
|
-
message: string,
|
|
9
|
-
readonly data?: unknown,
|
|
10
|
-
) {
|
|
11
|
-
super(message);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface ResultSchema<T> {
|
|
16
|
-
safeParse(raw: unknown): { success: true; data: T } | { success: false };
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type Request = <T>(method: string, params: unknown, schema: ResultSchema<T>) => Promise<T>;
|