@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
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type HistoryApi,
|
|
3
|
+
type HistoryArchive,
|
|
4
|
+
type HistoryVersion,
|
|
5
|
+
HistoryVersionSchema,
|
|
6
|
+
type SessionRef,
|
|
7
|
+
sameHistory,
|
|
8
|
+
sameVersion,
|
|
9
|
+
} from "../protocol/index.ts";
|
|
10
|
+
import { type HistoryTransferOptions, transferHistory } from "./history.ts";
|
|
11
|
+
import { RetryBudget, type RetryPolicy, idleAfter, pause } from "./retry.ts";
|
|
12
|
+
|
|
13
|
+
export type HistorySyncState =
|
|
14
|
+
| "starting"
|
|
15
|
+
| "syncing"
|
|
16
|
+
| "synced"
|
|
17
|
+
| "retrying"
|
|
18
|
+
| "blocked"
|
|
19
|
+
| "stopped";
|
|
20
|
+
export interface HistorySyncStatus {
|
|
21
|
+
ref: SessionRef;
|
|
22
|
+
state: HistorySyncState;
|
|
23
|
+
/** The source's head as this worker last read it. */
|
|
24
|
+
localVersion?: HistoryVersion;
|
|
25
|
+
/** What the destination has committed, as this worker last checked it. The
|
|
26
|
+
* destination is the record of what remains to send: nothing is saved here. */
|
|
27
|
+
acknowledged?: HistoryVersion;
|
|
28
|
+
/** Records the destination lacks, once both versions are known. */
|
|
29
|
+
pendingRecords?: number;
|
|
30
|
+
/** Imported since start: pages, their records, and their JSON bytes. */
|
|
31
|
+
pages: number;
|
|
32
|
+
records: number;
|
|
33
|
+
bytes: number;
|
|
34
|
+
/** Consecutive failures; while `retrying` or `blocked`, `error` is the latest. */
|
|
35
|
+
failures: number;
|
|
36
|
+
error?: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface HistorySyncOptions extends Pick<HistoryTransferOptions, "pageSize" | "pageBytes"> {
|
|
39
|
+
/** Briefly batch bursts without delaying local durability. Default 25ms. */
|
|
40
|
+
batchMs?: number;
|
|
41
|
+
/** The longest single wait on the source while idle. */
|
|
42
|
+
waitMs?: number;
|
|
43
|
+
retry?: RetryPolicy;
|
|
44
|
+
}
|
|
45
|
+
export interface SyncBarrierOptions {
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Local cancellation does not cancel the remote RPC; its own deadline still applies. */
|
|
51
|
+
async function interruptible<T>(value: T | Promise<T>, signal: AbortSignal): Promise<T> {
|
|
52
|
+
signal.throwIfAborted();
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
const aborted = () => {
|
|
55
|
+
signal.removeEventListener("abort", aborted);
|
|
56
|
+
reject(signal.reason);
|
|
57
|
+
};
|
|
58
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
59
|
+
Promise.resolve(value)
|
|
60
|
+
.then(resolve, reject)
|
|
61
|
+
.finally(() => signal.removeEventListener("abort", aborted));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** One explicitly selected history and destination. Own this lifetime in the
|
|
66
|
+
* host, not in a UI component. Recreate after a blocked failure or destination
|
|
67
|
+
* replacement. Networking remains the host's authenticated/reconnecting client. */
|
|
68
|
+
class HistorySync {
|
|
69
|
+
private readonly abort = new AbortController();
|
|
70
|
+
private readonly listeners = new Set<(status: HistorySyncStatus) => void>();
|
|
71
|
+
private current: HistorySyncStatus;
|
|
72
|
+
/** Resolves on stop or blocked failure; inspect status for the outcome. */
|
|
73
|
+
readonly done: Promise<void>;
|
|
74
|
+
constructor(
|
|
75
|
+
private readonly source: HistoryApi,
|
|
76
|
+
private readonly destination: HistoryArchive,
|
|
77
|
+
private readonly ref: SessionRef,
|
|
78
|
+
private readonly options: HistorySyncOptions,
|
|
79
|
+
) {
|
|
80
|
+
const batchMs = options.batchMs ?? 25;
|
|
81
|
+
if (!Number.isFinite(batchMs) || batchMs < 0 || batchMs > 60_000)
|
|
82
|
+
throw new Error("Invalid sync batch delay");
|
|
83
|
+
const waitMs = options.waitMs ?? 0;
|
|
84
|
+
if (!Number.isFinite(waitMs) || waitMs < 0 || waitMs > 20_000)
|
|
85
|
+
throw new Error("Invalid sync wait");
|
|
86
|
+
this.current = {
|
|
87
|
+
ref: { sourceId: ref.sourceId, sessionId: ref.sessionId },
|
|
88
|
+
state: "starting",
|
|
89
|
+
pages: 0,
|
|
90
|
+
records: 0,
|
|
91
|
+
bytes: 0,
|
|
92
|
+
failures: 0,
|
|
93
|
+
};
|
|
94
|
+
this.done = this.run();
|
|
95
|
+
}
|
|
96
|
+
status(): HistorySyncStatus {
|
|
97
|
+
return structuredClone(this.current);
|
|
98
|
+
}
|
|
99
|
+
subscribe(listener: (status: HistorySyncStatus) => void): () => void {
|
|
100
|
+
this.listeners.add(listener);
|
|
101
|
+
return () => {
|
|
102
|
+
this.listeners.delete(listener);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
private set(patch: Partial<HistorySyncStatus>): void {
|
|
106
|
+
// Stopped is final: work still landing after stop() is not news.
|
|
107
|
+
if (this.current.state === "stopped") return;
|
|
108
|
+
const next = { ...this.current, ...patch };
|
|
109
|
+
next.pendingRecords =
|
|
110
|
+
next.localVersion && next.acknowledged
|
|
111
|
+
? Math.max(0, next.localVersion.seq - next.acknowledged.seq)
|
|
112
|
+
: undefined;
|
|
113
|
+
this.current = next;
|
|
114
|
+
for (const listener of this.listeners) {
|
|
115
|
+
try {
|
|
116
|
+
listener(this.status());
|
|
117
|
+
} catch {
|
|
118
|
+
/* observers cannot change durability */
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
private async run(): Promise<void> {
|
|
123
|
+
const signal = this.abort.signal;
|
|
124
|
+
const budget = new RetryBudget(this.options.retry);
|
|
125
|
+
let acknowledged: HistoryVersion | undefined;
|
|
126
|
+
try {
|
|
127
|
+
while (!signal.aborted) {
|
|
128
|
+
try {
|
|
129
|
+
// Idle costs one wait on the source; a pass runs once it moves past
|
|
130
|
+
// what the destination holds.
|
|
131
|
+
const waited = Date.now();
|
|
132
|
+
const local = acknowledged
|
|
133
|
+
? (
|
|
134
|
+
await this.source.wait(
|
|
135
|
+
{ after: acknowledged, timeoutMs: this.options.waitMs },
|
|
136
|
+
signal,
|
|
137
|
+
)
|
|
138
|
+
).version
|
|
139
|
+
: (await this.source.head(this.ref)).version;
|
|
140
|
+
if (acknowledged && sameVersion(local, acknowledged)) {
|
|
141
|
+
budget.progressed();
|
|
142
|
+
await idleAfter(waited, signal);
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
this.set({ state: "syncing", localVersion: local });
|
|
146
|
+
await pause(this.options.batchMs ?? 25, signal);
|
|
147
|
+
signal.throwIfAborted();
|
|
148
|
+
const { version } = await transferHistory(this.source, this.destination, this.ref, {
|
|
149
|
+
signal,
|
|
150
|
+
pageSize: this.options.pageSize,
|
|
151
|
+
pageBytes: this.options.pageBytes,
|
|
152
|
+
onPage: (page, pageBytes) => {
|
|
153
|
+
budget.progressed();
|
|
154
|
+
this.set({
|
|
155
|
+
pages: this.current.pages + 1,
|
|
156
|
+
records: this.current.records + page.records.length,
|
|
157
|
+
bytes: this.current.bytes + pageBytes,
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
if (!acknowledged || version.seq > acknowledged.seq) budget.progressed();
|
|
162
|
+
acknowledged = version;
|
|
163
|
+
const head = (await this.source.head(this.ref)).version;
|
|
164
|
+
this.set({
|
|
165
|
+
state: sameVersion(head, version) ? "synced" : "syncing",
|
|
166
|
+
localVersion: head,
|
|
167
|
+
acknowledged: version,
|
|
168
|
+
failures: budget.failures,
|
|
169
|
+
error: undefined,
|
|
170
|
+
});
|
|
171
|
+
} catch (error) {
|
|
172
|
+
if (signal.aborted) break;
|
|
173
|
+
const delay = budget.fail(error);
|
|
174
|
+
this.set({ state: "retrying", failures: budget.failures, error });
|
|
175
|
+
await pause(delay, signal);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch (error) {
|
|
179
|
+
if (!signal.aborted) this.set({ state: "blocked", failures: budget.failures, error });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** Pin the current local head, then wait for its durable remote acknowledgement.
|
|
183
|
+
* New events may arrive after this barrier; they do not extend its target. */
|
|
184
|
+
async flush(options: SyncBarrierOptions = {}): Promise<HistoryVersion> {
|
|
185
|
+
return this.barrier(undefined, options);
|
|
186
|
+
}
|
|
187
|
+
async waitUntilSynced(
|
|
188
|
+
target: HistoryVersion,
|
|
189
|
+
options: SyncBarrierOptions = {},
|
|
190
|
+
): Promise<HistoryVersion> {
|
|
191
|
+
return this.barrier(HistoryVersionSchema.parse(target), options);
|
|
192
|
+
}
|
|
193
|
+
private async barrier(
|
|
194
|
+
pinned: HistoryVersion | undefined,
|
|
195
|
+
options: SyncBarrierOptions,
|
|
196
|
+
): Promise<HistoryVersion> {
|
|
197
|
+
const timeout = options.timeoutMs ?? 30_000;
|
|
198
|
+
if (!Number.isFinite(timeout) || timeout < 0 || timeout > 2_147_483_647)
|
|
199
|
+
throw new Error("Invalid sync barrier timeout");
|
|
200
|
+
const deadline = new AbortController();
|
|
201
|
+
const signal = AbortSignal.any([
|
|
202
|
+
this.abort.signal,
|
|
203
|
+
deadline.signal,
|
|
204
|
+
...(options.signal ? [options.signal] : []),
|
|
205
|
+
]);
|
|
206
|
+
const timer = setTimeout(() => deadline.abort(new Error("Sync barrier timed out")), timeout);
|
|
207
|
+
try {
|
|
208
|
+
signal.throwIfAborted();
|
|
209
|
+
if (this.current.state === "blocked") throw this.current.error;
|
|
210
|
+
const target = pinned ?? (await interruptible(this.source.head(this.ref), signal)).version;
|
|
211
|
+
if (!sameHistory(target, this.ref))
|
|
212
|
+
throw new Error("Sync barrier belongs to another history");
|
|
213
|
+
// Reject a forged hash even when its sequence is below an acknowledged head.
|
|
214
|
+
await interruptible(
|
|
215
|
+
this.source.read({ ...this.ref, after: target, through: target }),
|
|
216
|
+
signal,
|
|
217
|
+
);
|
|
218
|
+
signal.throwIfAborted();
|
|
219
|
+
return await new Promise<HistoryVersion>((resolve, reject) => {
|
|
220
|
+
let off = () => {};
|
|
221
|
+
const finish = (error?: unknown, failed = false) => {
|
|
222
|
+
off();
|
|
223
|
+
signal.removeEventListener("abort", aborted);
|
|
224
|
+
if (failed) reject(error);
|
|
225
|
+
else resolve(target);
|
|
226
|
+
};
|
|
227
|
+
const aborted = () => finish(signal.reason, true);
|
|
228
|
+
const check = (status: HistorySyncStatus) => {
|
|
229
|
+
if (status.state === "blocked") return finish(status.error, true);
|
|
230
|
+
if (status.state === "stopped") return finish(new Error("Sync stopped"), true);
|
|
231
|
+
if (status.acknowledged && status.acknowledged.seq >= target.seq) finish();
|
|
232
|
+
};
|
|
233
|
+
off = this.subscribe(check);
|
|
234
|
+
signal.addEventListener("abort", aborted, { once: true });
|
|
235
|
+
check(this.current);
|
|
236
|
+
});
|
|
237
|
+
} finally {
|
|
238
|
+
clearTimeout(timer);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Cancels waits and joins in-flight work; host RPCs must have bounded timeouts. */
|
|
243
|
+
async stop(): Promise<void> {
|
|
244
|
+
this.abort.abort(new Error("Sync stopped"));
|
|
245
|
+
this.set({ state: "stopped" });
|
|
246
|
+
await this.done;
|
|
247
|
+
this.listeners.clear();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
export type { HistorySync };
|
|
251
|
+
/** Keep `destination` holding `ref` as it grows, until stopped or blocked. */
|
|
252
|
+
export function startHistorySync(
|
|
253
|
+
source: HistoryApi,
|
|
254
|
+
destination: HistoryArchive,
|
|
255
|
+
ref: SessionRef,
|
|
256
|
+
options: HistorySyncOptions = {},
|
|
257
|
+
): HistorySync {
|
|
258
|
+
return new HistorySync(source, destination, ref, options);
|
|
259
|
+
}
|
|
@@ -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.
|