@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,50 @@
|
|
|
1
|
+
import type { SDKRateLimitInfo, SDKResultMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import { type ErrorCategory, type StopReason } from "../../../protocol/index.ts";
|
|
3
|
+
import type { AdapterEvent, TransformResult } from "../types.ts";
|
|
4
|
+
/** Map Anthropic stop reasons / result subtypes onto the normalized enum. */
|
|
5
|
+
export declare function mapClaudeStopReason(stopReason: string | null | undefined, subtype: string | undefined): StopReason | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Claude's typed API failure codes, and HTTP statuses, as engine error
|
|
8
|
+
* categories. A code or status this build does not know returns `undefined`,
|
|
9
|
+
* so the message decides rather than a guess. `status === null` is a request
|
|
10
|
+
* that got no HTTP response at all.
|
|
11
|
+
*/
|
|
12
|
+
export declare function claudeErrorCategory(code: string | undefined, status?: number | null): ErrorCategory | undefined;
|
|
13
|
+
/** A window used up, and no extra usage (overage) answering in its place. */
|
|
14
|
+
export declare function planUsedUp(info: SDKRateLimitInfo): boolean;
|
|
15
|
+
/** A `rate_limit_event`: one window of the claude.ai plan (`resetsAt` is in seconds). */
|
|
16
|
+
export declare function claudeLimits(info: SDKRateLimitInfo | undefined): AdapterEvent[];
|
|
17
|
+
/**
|
|
18
|
+
* How a Claude turn ended, from its results: its stop reason, its failure and
|
|
19
|
+
* that failure's category, and whether an interrupt stopped it. A turn runs
|
|
20
|
+
* one more query for each steer it got too late; the last query decides.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ClaudeTurnOutcome {
|
|
23
|
+
private stopReason?;
|
|
24
|
+
private finishReason?;
|
|
25
|
+
private error?;
|
|
26
|
+
/** The typed code of the last failed API request the turn reported. */
|
|
27
|
+
private errorCode?;
|
|
28
|
+
/** Plan windows Claude reports used up, with no extra usage serving requests. */
|
|
29
|
+
private readonly usedUpWindows;
|
|
30
|
+
private interrupted;
|
|
31
|
+
private execFailure;
|
|
32
|
+
private succeeded;
|
|
33
|
+
/** The last result left steers for Claude's next query, still this turn. */
|
|
34
|
+
private steersPending;
|
|
35
|
+
/** One plan window's report: another window may still be used up. */
|
|
36
|
+
limits(info: SDKRateLimitInfo | undefined): AdapterEvent[];
|
|
37
|
+
/** The turn's own request failed: a top-level assistant message says so with a typed code. */
|
|
38
|
+
requestFailed(code: string): void;
|
|
39
|
+
/** The streaming model message said why it stopped (`message_delta`). */
|
|
40
|
+
messageStopped(reason: string): void;
|
|
41
|
+
/** The turn was asked to stop (`agentServer/turnInterrupted`, after its result). */
|
|
42
|
+
interrupt(): void;
|
|
43
|
+
/** A query's result; `steersPending`: Claude runs one more query, still this turn. */
|
|
44
|
+
settle(result: SDKResultMessage, steersPending: boolean): void;
|
|
45
|
+
/** How the turn ended. */
|
|
46
|
+
finish(): Pick<TransformResult, "stopReason" | "finishReason" | "error" | "errorCategory" | "cancelled">;
|
|
47
|
+
/** The turn's failure category: Claude's typed code, made finer where it is coarse. */
|
|
48
|
+
private errorCategory;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACzF,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAiB,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEjE,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,OAAO,EAAE,MAAM,GAAG,SAAS,GACzB,UAAU,GAAG,SAAS,CAexB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACpB,aAAa,GAAG,SAAS,CAyB3B;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAO1D;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAAG,YAAY,EAAE,CAkB/E;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,uEAAuE;IACvE,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;IAC1B,4EAA4E;IAC5E,OAAO,CAAC,aAAa,CAAS;IAE9B,qEAAqE;IACrE,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,GAAG,YAAY,EAAE;IAO1D,8FAA8F;IAC9F,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIjC,yEAAyE;IACzE,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC,oFAAoF;IACpF,SAAS,IAAI,IAAI;IAIjB,sFAAsF;IACtF,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,OAAO,GAAG,IAAI;IAiC9D,0BAA0B;IAC1B,MAAM,IAAI,IAAI,CACb,eAAe,EACf,YAAY,GAAG,cAAc,GAAG,OAAO,GAAG,eAAe,GAAG,WAAW,CACvE;IAwBD,uFAAuF;IACvF,OAAO,CAAC,aAAa;CAWrB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { McpSetServersResult } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import type { McpServerConfig } from "../../../protocol/index.ts";
|
|
3
|
+
import { type ClaudeCodeAgentOptions, type ClaudeSessionConfig, type ClaudeSessionSettings } from "./options.ts";
|
|
4
|
+
import { ClaudeSession } from "./session.ts";
|
|
5
|
+
/** The selected session and whether this invocation owns its new startup. */
|
|
6
|
+
export interface ClaudeSessionSpawn {
|
|
7
|
+
session: ClaudeSession;
|
|
8
|
+
spawned: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* One live `ClaudeSession` per logical session id. Decides, per turn, whether
|
|
12
|
+
* the existing session can be reused (hot-swapping model, mode and MCP) or
|
|
13
|
+
* must be replaced by a new process that resumes the conversation.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ClaudeSessionPool {
|
|
16
|
+
private readonly settings;
|
|
17
|
+
private readonly sessions;
|
|
18
|
+
/** Started before the login last changed: the next turn replaces the process. */
|
|
19
|
+
private readonly priorLogin;
|
|
20
|
+
constructor(settings: ClaudeSessionSettings & Pick<ClaudeCodeAgentOptions, "onSessionEnd">);
|
|
21
|
+
getOrCreate(sessionId: string, config: ClaudeSessionConfig): Promise<ClaudeSessionSpawn>;
|
|
22
|
+
get(sessionId: string): ClaudeSession | undefined;
|
|
23
|
+
terminate(sessionId: string): Promise<void>;
|
|
24
|
+
terminateAll(): Promise<void>;
|
|
25
|
+
invalidateMcpConnections(): void;
|
|
26
|
+
/** A running CLI keeps the credentials it started with: each session's next turn starts a new one. */
|
|
27
|
+
loginChanged(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Explicit live MCP swap (e.g. mid-conversation app registration). NOTE:
|
|
30
|
+
* this syncs the session's servers, so the NEXT turn's wire config (if it
|
|
31
|
+
* still carries the old server set) will swap back — explicit swappers
|
|
32
|
+
* must keep their per-turn `mcpServers` in step.
|
|
33
|
+
*/
|
|
34
|
+
setMcpServers(sessionId: string, servers: Record<string, McpServerConfig>): Promise<McpSetServersResult | undefined>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=session-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-pool.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/session-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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../../../protocol/index.ts";
|
|
3
|
+
import { ClaudeMcpConnections } from "./mcp.ts";
|
|
4
|
+
import { type ClaudeSessionConfig, type ClaudeSessionEndReason, type ClaudeSessionSettings } from "./options.ts";
|
|
5
|
+
import { ClaudeSpend } from "./spend.ts";
|
|
6
|
+
import { ClaudeTurn, type ClaudeTurnStart } from "./turn.ts";
|
|
7
|
+
type SessionState = "starting" | "idle" | "busy" | "terminated";
|
|
8
|
+
type ClaudeContent = SDKUserMessage["message"]["content"];
|
|
9
|
+
/** How long Claude has to confirm an interrupt before the turn counts as still running. */
|
|
10
|
+
export declare const INTERRUPT_TIMEOUT_MS = 2000;
|
|
11
|
+
/**
|
|
12
|
+
* Wraps one long-lived Claude `query()` call. The prompt input is an AsyncQueue
|
|
13
|
+
* that stays open across turns, so the same subprocess (and its context) is
|
|
14
|
+
* reused turn to turn. A background loop reads SDK output, learns what it says
|
|
15
|
+
* of the session (`observe`) and hands it to the running turn (`route`); the
|
|
16
|
+
* `result` answering the turn ends it.
|
|
17
|
+
*
|
|
18
|
+
* Lifecycle: starting → idle ⇄ busy → terminated.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ClaudeSession {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
private readonly settings;
|
|
23
|
+
private readonly onTerminated?;
|
|
24
|
+
private state;
|
|
25
|
+
/** What the session runs with; its MCP servers are `mcp`'s. */
|
|
26
|
+
private config;
|
|
27
|
+
/** What the process was started with and cannot change (`claudeSpawnKey`). */
|
|
28
|
+
readonly spawnKey: string;
|
|
29
|
+
readonly mcp: ClaudeMcpConnections;
|
|
30
|
+
/** What the conversation has spent, across the processes that ran it. */
|
|
31
|
+
readonly spend: ClaudeSpend;
|
|
32
|
+
private readonly promptQueue;
|
|
33
|
+
private query?;
|
|
34
|
+
private nativeSessionId;
|
|
35
|
+
/** Set by the CLI's first message; until then it has begun no turn. */
|
|
36
|
+
private cliStarted;
|
|
37
|
+
private startupError;
|
|
38
|
+
/** The operator's `sdkOptions` set the effort or thinking, not the engine. */
|
|
39
|
+
private thinkingOverridden;
|
|
40
|
+
/** The running turn: where its events go, and what its requests ask. */
|
|
41
|
+
private turn;
|
|
42
|
+
/** The CLI can drop queued messages with its interrupt (`interrupt_cancel_queued_v1`). */
|
|
43
|
+
private cancelsQueued;
|
|
44
|
+
/** A query has begun in this process: before one, nothing of Claude's own can run. */
|
|
45
|
+
private queryBegun;
|
|
46
|
+
/**
|
|
47
|
+
* Each plan window's last report. Claude repeats a rejection only when it
|
|
48
|
+
* changes, so a turn after a used-up window starts from that report.
|
|
49
|
+
*/
|
|
50
|
+
private readonly planWindows;
|
|
51
|
+
private idleTimer?;
|
|
52
|
+
/** The `claude` process the engine started for it; none under an operator's spawner. */
|
|
53
|
+
private native?;
|
|
54
|
+
/** Its end, once it began: settles when its process is stopped. */
|
|
55
|
+
private ending?;
|
|
56
|
+
constructor(id: string, config: ClaudeSessionConfig, settings: ClaudeSessionSettings, onTerminated?: ((reason: ClaudeSessionEndReason) => void) | undefined);
|
|
57
|
+
get currentState(): SessionState;
|
|
58
|
+
get currentSessionId(): string | null;
|
|
59
|
+
get currentConfig(): Readonly<Omit<ClaudeSessionConfig, "mcpServers">>;
|
|
60
|
+
/** Whether the operator's `sdkOptions` chose the thinking settings this session runs. */
|
|
61
|
+
get operatorThinking(): boolean;
|
|
62
|
+
/** Hot-swap the model without losing context (Claude `setModel`). */
|
|
63
|
+
setModel(model: string | undefined): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Switch the permission mode without a restart (plan, default, accept edits,
|
|
66
|
+
* don't ask). Bypass needs its flag at spawn, so the pool restarts for it.
|
|
67
|
+
*/
|
|
68
|
+
setPermissionMode(mode: PermissionMode | undefined): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Hot-swap the wire-configured MCP servers on the LIVE session (no restart,
|
|
71
|
+
* context intact). In-process servers are re-merged so a swap can never drop
|
|
72
|
+
* the host's own tools. A text-only session stays tool-free.
|
|
73
|
+
*/
|
|
74
|
+
setMcpServers(servers: Record<string, McpServerConfig>): Promise<McpSetServersResult | undefined>;
|
|
75
|
+
/** Host suspension: the next turn resumes the saved conversation in a new process. */
|
|
76
|
+
invalidateMcpConnections(): void;
|
|
77
|
+
start(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Send a turn's prompt: the turn's events stream until its result. One turn
|
|
80
|
+
* runs at a time (LLP 0001, D10): a turn's generator stops its native turn
|
|
81
|
+
* before it releases the session, so the session is idle here.
|
|
82
|
+
*/
|
|
83
|
+
sendMessage(content: ClaudeContent, start: ClaudeTurnStart): ClaudeTurn;
|
|
84
|
+
/**
|
|
85
|
+
* Send more input into the running turn. Claude reads it after the step it
|
|
86
|
+
* is on (the tool it runs), or, when it was already giving its final
|
|
87
|
+
* answer, runs it as its next query; the turn lasts until that query ends.
|
|
88
|
+
* False when no turn takes input.
|
|
89
|
+
*/
|
|
90
|
+
steer(content: ClaudeContent, steerId: string): boolean;
|
|
91
|
+
/** The last report of each plan window still used up, and not past its reset. */
|
|
92
|
+
private rejectedWindowReports;
|
|
93
|
+
/** A uuid-stamped user message: Claude names it when it replays or consumes it. */
|
|
94
|
+
private userMessage;
|
|
95
|
+
/**
|
|
96
|
+
* Stop the in-flight turn without killing the session. Returns whether the
|
|
97
|
+
* interrupt was CONFIRMED: true when there was nothing to interrupt or the
|
|
98
|
+
* SDK acknowledged it; false when the round-trip timed out or failed — the
|
|
99
|
+
* subprocess may still be running its turn and the caller must report that
|
|
100
|
+
* honestly instead of assuming a clean cancel.
|
|
101
|
+
*
|
|
102
|
+
* A session still starting, or whose CLI has sent nothing yet, is terminated
|
|
103
|
+
* instead: it has begun no turn, an interrupt would wait out its startup, and
|
|
104
|
+
* a prompt the CLI has not dequeued survives an interrupt and runs anyway.
|
|
105
|
+
*/
|
|
106
|
+
interruptTurn(timeoutMs?: number): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Stop `turn` unless it ended, for a generator that stopped reading it before
|
|
109
|
+
* its result (a transformer that threw, a sink that failed): interrupt it,
|
|
110
|
+
* and end the process when the turn has not ended within the interrupt
|
|
111
|
+
* timeout. The session is idle or terminated when this returns.
|
|
112
|
+
*/
|
|
113
|
+
stopTurn(turn: ClaudeTurn, timeoutMs?: number): Promise<void>;
|
|
114
|
+
private interrupt;
|
|
115
|
+
/**
|
|
116
|
+
* Interrupt and drop the turn's queued messages with the CLI's queue cancel
|
|
117
|
+
* (`ClaudeTurn.mustDropQueued` says why a plain interrupt would not do).
|
|
118
|
+
* Until its receipt they stay tracked, so one Claude reads meanwhile is
|
|
119
|
+
* still shown where it read it, and the turn's end waits. A CLI that cannot
|
|
120
|
+
* cancel queued messages, or does not account for every one, is replaced:
|
|
121
|
+
* the next turn resumes the conversation without them.
|
|
122
|
+
*/
|
|
123
|
+
private interruptQueued;
|
|
124
|
+
/** The queue cancel's receipt; undefined when none came in time. */
|
|
125
|
+
private cancelQueued;
|
|
126
|
+
/**
|
|
127
|
+
* End the session: close its query, and stop its process with its tool
|
|
128
|
+
* sessions and MCP servers. Settles once they are gone (at most the grace);
|
|
129
|
+
* every call shares that end.
|
|
130
|
+
*/
|
|
131
|
+
terminate(reason?: ClaudeSessionEndReason): Promise<void>;
|
|
132
|
+
private end;
|
|
133
|
+
private consumeEvents;
|
|
134
|
+
/** What an event says of the session: its native id, its mode, plan windows, spend, steers read. */
|
|
135
|
+
private observe;
|
|
136
|
+
/** Hand an event to the running turn; a result answering it settles the turn. */
|
|
137
|
+
private route;
|
|
138
|
+
/**
|
|
139
|
+
* A result while no turn runs: Claude failed its startup, or answered a
|
|
140
|
+
* query it began itself between turns. Its spend counts in no turn.
|
|
141
|
+
*/
|
|
142
|
+
private settleUnshown;
|
|
143
|
+
private endTurn;
|
|
144
|
+
private resetIdleTimer;
|
|
145
|
+
private clearIdleTimer;
|
|
146
|
+
}
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AW,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,GAAG,UAAU;IAqBvE;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAQvD,iFAAiF;IACjF,OAAO,CAAE,qBAAqB;IAU9B,mFAAmF;IACnF,OAAO,CAAC,WAAW;IAWnB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,SAAS,SAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMjE;;;;;OAKG;IACG,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,SAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;YAMnE,SAAS;IAcvB;;;;;;;OAOG;YACW,eAAe;IAc7B,oEAAoE;YACtD,YAAY;IAe1B;;;;OAIG;IACH,SAAS,CAAC,MAAM,GAAE,sBAAmC,GAAG,OAAO,CAAC,IAAI,CAAC;YAKvD,GAAG;YA2BH,aAAa;IAkB3B,oGAAoG;IACpG,OAAO,CAAC,OAAO;IAwBf,iFAAiF;IACjF,OAAO,CAAC,KAAK;IAgCb;;;OAGG;IACH,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,cAAc;CAMtB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Options } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import type { NativeProcess, NativeProcesses } from "../../processes/native-processes.ts";
|
|
3
|
+
type Spawner = NonNullable<Options["spawnClaudeCodeProcess"]>;
|
|
4
|
+
/** Where a Claude process is started from, and for which session (its record). */
|
|
5
|
+
export interface ClaudeSpawn {
|
|
6
|
+
processes: NativeProcesses;
|
|
7
|
+
/** The logical session it runs; absent for a model listing, which is not recorded. */
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
/** The process the engine started, once it has: what a session stops and reads the stderr of. */
|
|
10
|
+
onSpawned?: (native: NativeProcess) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The SDK's `spawnClaudeCodeProcess` as the engine runs Claude: in a session
|
|
14
|
+
* and group of its own, held by the lifeline and recorded for its session.
|
|
15
|
+
* An operator's own spawner (`sdkOptions`) still wins: the engine then owns no
|
|
16
|
+
* process, and records its session's as a host's (`not_owned`). The `stderr`
|
|
17
|
+
* callback, which the SDK calls only from its own spawner, is called here.
|
|
18
|
+
*/
|
|
19
|
+
export declare function claudeSpawner(spawn: ClaudeSpawn, operator?: Spawner, stderr?: (data: string) => void): Spawner;
|
|
20
|
+
/**
|
|
21
|
+
* Put the CLI's own words back into the SDK's exit error, as the SDK's own
|
|
22
|
+
* spawner words it ("Claude Code process exited with code 1. stderr: …"):
|
|
23
|
+
* the last 2 KB, trimmed, with its secrets redacted (the SDK redacts its own;
|
|
24
|
+
* this marks each `[REDACTED]`). The SDK builds that tail only from its own
|
|
25
|
+
* spawner. Its message alone changes, so the error keeps its class and fields.
|
|
26
|
+
*/
|
|
27
|
+
export declare function withStderr(error: unknown, tail: string): unknown;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=spawn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/spawn.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAgC,MAAM,gCAAgC,CAAC;AAC5F,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAK1F,KAAK,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAE9D,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,eAAe,CAAC;IAC3B,sFAAsF;IACtF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iGAAiG;IACjG,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;CAC5C;AAqDD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,WAAW,EAClB,QAAQ,CAAC,EAAE,OAAO,EAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC7B,OAAO,CAuCT;AAKD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUhE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ModelUsage, SDKResultMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import type { TokenUsage } from "../../../protocol/index.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Claude's running token totals for its conversation, summed over the models
|
|
5
|
+
* in `modelUsage`: every call through its query pipeline, sub-agents and
|
|
6
|
+
* compaction included, where a result's `usage` counts only the main loop.
|
|
7
|
+
*/
|
|
8
|
+
export interface ClaudeUsageTotals {
|
|
9
|
+
input: number;
|
|
10
|
+
output: number;
|
|
11
|
+
cacheRead: number;
|
|
12
|
+
cacheWrite: number;
|
|
13
|
+
/** Thinking tokens, part of `output`; absent when the CLI did not record them. */
|
|
14
|
+
thinking?: number;
|
|
15
|
+
}
|
|
16
|
+
/** The totals a result's `modelUsage` reports; undefined when it reports none. */
|
|
17
|
+
export declare function claudeUsageTotals(modelUsage: Readonly<Record<string, ModelUsage>>): ClaudeUsageTotals | undefined;
|
|
18
|
+
/** A result's `usage`: the main loop's, per query. */
|
|
19
|
+
export type MainLoopUsage = Partial<SDKResultMessage["usage"]>;
|
|
20
|
+
/** The 5-minute and 1-hour parts of the main loop's cache writes, as far as it reports them. */
|
|
21
|
+
export declare function cacheWriteDurations(usage: MainLoopUsage | undefined): Pick<NonNullable<TokenUsage["cache"]>, "writeEphemeral5m" | "writeEphemeral1h">;
|
|
22
|
+
/** What one query spent: its share of the conversation's running totals. */
|
|
23
|
+
export interface ClaudeQuerySpend {
|
|
24
|
+
/** Null when the baseline is unknown: a resumed process's first query, or a total that shrank. */
|
|
25
|
+
costUsd: number | null;
|
|
26
|
+
/**
|
|
27
|
+
* Every model call of the query, sub-agents and compaction included; null
|
|
28
|
+
* where only the result's `usage`, the main loop, can say.
|
|
29
|
+
*/
|
|
30
|
+
usage: TokenUsage | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What a Claude conversation has spent. Claude reports cost and tokens as
|
|
34
|
+
* running totals for its native conversation (`total_cost_usd`,
|
|
35
|
+
* `modelUsage`), and a resumed conversation restores what earlier processes
|
|
36
|
+
* spent. So a query spent what the totals grew by, and an unknown baseline
|
|
37
|
+
* reports nothing: the first query of a resumed process would otherwise report
|
|
38
|
+
* the conversation's whole spend.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ClaudeSpend {
|
|
41
|
+
private cost;
|
|
42
|
+
private totals;
|
|
43
|
+
private constructor();
|
|
44
|
+
/** A conversation this process starts: nothing spent yet. */
|
|
45
|
+
static fresh(): ClaudeSpend;
|
|
46
|
+
/** A conversation this process resumes: its totals include what earlier processes spent. */
|
|
47
|
+
static unknown(): ClaudeSpend;
|
|
48
|
+
/** The same conversation goes on in a new process, which restores the totals the old one saved. */
|
|
49
|
+
continueFrom(previous: ClaudeSpend): void;
|
|
50
|
+
/** Claude cleared the conversation (`conversation_reset`): its totals start over. */
|
|
51
|
+
reset(): void;
|
|
52
|
+
/**
|
|
53
|
+
* A query's result: what it spent, and its totals as the next query's
|
|
54
|
+
* baseline. A crash can report zeroed totals; they establish nothing.
|
|
55
|
+
*/
|
|
56
|
+
charge(result: SDKResultMessage): ClaudeQuerySpend;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=spend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spend.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/spend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,E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gB,GAAG,gBAAgB;CASlD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolLocation, ToolMeta } from "../../../protocol/index.ts";
|
|
2
|
+
export declare function toolLocationsFromInput(input: Record<string, unknown>): ToolLocation[] | undefined;
|
|
3
|
+
export declare function claudeToolMeta(toolName: string, input?: Record<string, unknown>): ToolMeta;
|
|
4
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAiCnF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,EAAE,GAAG,SAAS,CAMjG;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAK1F"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SDKAssistantMessage, SDKResultMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import type { AdapterEvent, TransformResult } from "../types.ts";
|
|
3
|
+
import { type ClaudeQuerySpend } from "./spend.ts";
|
|
4
|
+
/** A model message's usage, as Claude Code reports it. */
|
|
5
|
+
type MessageUsage = Partial<SDKAssistantMessage["message"]["usage"]>;
|
|
6
|
+
/**
|
|
7
|
+
* A Claude turn's accounting: its tokens and cost summed over the turn's
|
|
8
|
+
* queries (a turn runs one more for each steer it got too late), the models
|
|
9
|
+
* that wrote its messages, and the context gauge (`session.usage`).
|
|
10
|
+
*/
|
|
11
|
+
export declare class ClaudeTurnUsage {
|
|
12
|
+
private usage;
|
|
13
|
+
/** The usage of the queries this turn finished. */
|
|
14
|
+
private settled?;
|
|
15
|
+
/** The context in use after the latest top-level model call (the gauge). */
|
|
16
|
+
private contextUsed?;
|
|
17
|
+
/** The model of that call: its window is the gauge's size. */
|
|
18
|
+
private contextModel?;
|
|
19
|
+
/** The model the query asked for, as `modelUsage` keys it (`claude-sonnet-5-5[1m]`). */
|
|
20
|
+
private requestedModel?;
|
|
21
|
+
/** A finished query's cost went unreported, so the turn's is unknown. */
|
|
22
|
+
private costUnknown;
|
|
23
|
+
private cost?;
|
|
24
|
+
private readonly reportedModels;
|
|
25
|
+
/** The model the query asked for (`system/init`). */
|
|
26
|
+
requested(model: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* A top-level model message: the model that wrote it (none for Claude
|
|
29
|
+
* Code's own), and the gauge from its usage. Every top-level message
|
|
30
|
+
* carries fresh usage; a sub-agent's context is its own and would
|
|
31
|
+
* misreport the session's.
|
|
32
|
+
*/
|
|
33
|
+
message(model: string | undefined, usage: MessageUsage | undefined): AdapterEvent[];
|
|
34
|
+
/** What the streaming model message has output so far (`message_delta`). */
|
|
35
|
+
streamed(outputTokens: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* A query's result, and what the session says it spent (nothing when no
|
|
38
|
+
* session said so): the turn's usage and cost grow by the query's, and the
|
|
39
|
+
* gauge takes its final reading.
|
|
40
|
+
*/
|
|
41
|
+
settle(result: SDKResultMessage, spent: ClaudeQuerySpend | undefined): AdapterEvent[];
|
|
42
|
+
/** What the turn used and cost, and the models that wrote it. */
|
|
43
|
+
summary(): Pick<TransformResult, "usage" | "reportedModels" | "cost">;
|
|
44
|
+
/**
|
|
45
|
+
* The query's usage where only the main loop's can say (a resumed
|
|
46
|
+
* process's first query): its output from the stream when the result
|
|
47
|
+
* leaves it out.
|
|
48
|
+
*/
|
|
49
|
+
private mainLoop;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=turn-usage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-usage.d.ts","sourceRoot":"","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IG;IACH,OAAO,CAAC,QAAQ;CAWhB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { SDKControlInterruptResponse, SDKResultMessage } from "@anthropic-ai/claude-agent-sdk";
|
|
2
|
+
import { AsyncQueue } from "../../../protocol/index.ts";
|
|
3
|
+
import type { ElicitationRequestHandler, PermissionRequestHandler } from "../base.ts";
|
|
4
|
+
import type { ClaudeRawEvent } from "./events.ts";
|
|
5
|
+
import type { ClaudeQuerySpend } from "./spend.ts";
|
|
6
|
+
/** What a turn starts with: its id, and the brokers its requests go to. */
|
|
7
|
+
export interface ClaudeTurnStart {
|
|
8
|
+
turnId: string;
|
|
9
|
+
/**
|
|
10
|
+
* The engine's permission broker for this turn. Absent (a turn driven
|
|
11
|
+
* outside the runtime), Claude's permission mode alone decides.
|
|
12
|
+
*/
|
|
13
|
+
permissions?: PermissionRequestHandler;
|
|
14
|
+
/**
|
|
15
|
+
* The engine's elicitation broker, when the turn's client answers
|
|
16
|
+
* questions; absent, Claude's questions and its MCP servers' requests for
|
|
17
|
+
* input are declined on the user's behalf.
|
|
18
|
+
*/
|
|
19
|
+
elicitation?: ElicitationRequestHandler;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One turn on a Claude session: the events it yields, the brokers its
|
|
23
|
+
* requests go to, and the messages it still owes an answer for. The session
|
|
24
|
+
* makes one per prompt and ends it with the turn, so none of it can reach the
|
|
25
|
+
* next turn. Its methods say what the session does next.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ClaudeTurn {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly permissions?: PermissionRequestHandler;
|
|
30
|
+
readonly elicitation?: ElicitationRequestHandler;
|
|
31
|
+
/** What the turn yields, until its result or its failure. */
|
|
32
|
+
readonly events: AsyncQueue<ClaudeRawEvent>;
|
|
33
|
+
/** Settles once the turn is over. */
|
|
34
|
+
readonly ended: Promise<void>;
|
|
35
|
+
private settleEnded;
|
|
36
|
+
/** The uuid of the turn's prompt. */
|
|
37
|
+
private readonly prompt;
|
|
38
|
+
/**
|
|
39
|
+
* Every message this turn sent Claude (its prompt and steers). A result
|
|
40
|
+
* that names none of them answers a query Claude began on its own.
|
|
41
|
+
*/
|
|
42
|
+
private readonly sent;
|
|
43
|
+
/**
|
|
44
|
+
* Messages sent that Claude has not taken yet. The prompt waits here while a
|
|
45
|
+
* query Claude began itself runs; a cancel must drop them from its queue.
|
|
46
|
+
*/
|
|
47
|
+
private readonly queued;
|
|
48
|
+
/**
|
|
49
|
+
* Steers sent this turn that Claude has not read yet: the uuid each was sent
|
|
50
|
+
* with → its steer id. Claude replays a message at the step it reads it.
|
|
51
|
+
*/
|
|
52
|
+
private readonly unread;
|
|
53
|
+
/** The interrupt in flight, shared by everyone stopping the turn (its abort, `cancel`). */
|
|
54
|
+
private interrupting?;
|
|
55
|
+
private stoppedByRequest;
|
|
56
|
+
/** Queued messages are being dropped: the turn ends once their fate is known. */
|
|
57
|
+
private dropping;
|
|
58
|
+
/** The turn's last result arrived while `dropping`. */
|
|
59
|
+
private heldResult;
|
|
60
|
+
/** Set while Claude is between queries, about to run the unread steers. */
|
|
61
|
+
private watchdog?;
|
|
62
|
+
constructor(start: ClaudeTurnStart, prompt: string);
|
|
63
|
+
/** A request of the turn was answered `cancelled`: Claude stops the turn, which ends cancelled. */
|
|
64
|
+
cancelByRequest(): void;
|
|
65
|
+
/** Whether a cancelled request stopped the turn (Claude interrupts on it). */
|
|
66
|
+
get cancelled(): boolean;
|
|
67
|
+
/** A steer went to Claude with `uuid`: unread and queued until Claude says otherwise. */
|
|
68
|
+
sendSteer(uuid: string, steerId: string): void;
|
|
69
|
+
/** Mark steers read, in order, at this point of the turn's events. */
|
|
70
|
+
read(uuids: readonly string[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Claude took a message of this turn (its `command_lifecycle` "started"): it
|
|
73
|
+
* is no longer queued, and the query for the steers has begun.
|
|
74
|
+
*/
|
|
75
|
+
took(uuid: string): void;
|
|
76
|
+
/**
|
|
77
|
+
* Whether a result answers this turn. Claude names the messages a query
|
|
78
|
+
* consumed (`user_message_uuids`); a result that names none and no origin
|
|
79
|
+
* either (an older CLI, a failure) is taken at its word.
|
|
80
|
+
*/
|
|
81
|
+
answeredBy(result: SDKResultMessage): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* The result that answers this turn came: its events say what the query
|
|
84
|
+
* spent, then the result. "end": the turn is over. "await-steers": Claude
|
|
85
|
+
* has steers it has not read and runs them as its next query, still this
|
|
86
|
+
* turn. "hold": queued messages are being dropped, and the turn ends once
|
|
87
|
+
* their fate is known (`dropped`).
|
|
88
|
+
*/
|
|
89
|
+
settle(result: SDKResultMessage, spent: ClaudeQuerySpend): "end" | "await-steers" | "hold";
|
|
90
|
+
/** Wait for the query Claude runs for the unread steers; give up if it never begins. */
|
|
91
|
+
awaitSteerQuery(onTimeout: () => void): void;
|
|
92
|
+
/**
|
|
93
|
+
* Whether stopping the turn must drop messages from Claude's queue: a plain
|
|
94
|
+
* interrupt keeps them, so unread steers would run as Claude's next query,
|
|
95
|
+
* after the turn, and a prompt still waiting behind a query Claude began
|
|
96
|
+
* itself would run as if never cancelled. Only a process past its first
|
|
97
|
+
* query (`queryBegun`) can be running one of its own: before that, the CLI's
|
|
98
|
+
* own first-command latch aborts the prompt, as a plain interrupt asks.
|
|
99
|
+
*/
|
|
100
|
+
mustDropQueued(queryBegun: boolean): boolean;
|
|
101
|
+
/** Claude was asked to drop the turn's queued messages: until `dropped`, a result is held. */
|
|
102
|
+
dropQueued(): void;
|
|
103
|
+
/**
|
|
104
|
+
* The queue cancel's receipt came (undefined: none came, or not in time).
|
|
105
|
+
* What Claude dropped leaves the turn; until now a steer Claude read was
|
|
106
|
+
* still shown where it read it. "replace": something sent may still run, so
|
|
107
|
+
* the process must go and the next turn resumes without it. "end":
|
|
108
|
+
* everything sent is read or dropped and no query of the turn runs any more,
|
|
109
|
+
* since its last result is in, Claude was between queries, or its prompt
|
|
110
|
+
* never ran. "continue": a query of the turn still runs, and its result ends
|
|
111
|
+
* the turn.
|
|
112
|
+
*/
|
|
113
|
+
dropped(receipt: SDKControlInterruptResponse | undefined): "end" | "replace" | "continue";
|
|
114
|
+
/** Run `interrupt` once for everyone stopping the turn, until it settles. */
|
|
115
|
+
interruptOnce(interrupt: () => Promise<boolean>): Promise<boolean>;
|
|
116
|
+
/** The turn is over: its events end, and nothing it waited for matters. */
|
|
117
|
+
end(): void;
|
|
118
|
+
fail(error: unknown): void;
|
|
119
|
+
private stopWaiting;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=turn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/claude-code/turn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,CAAC,EAAE,wBAAwB,CAAC;IACvC;;;;OAIG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAC;CACxC;AAED;;;;;GAKG;AACH,qBAAa,UAAU;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;IAChD,QAAQ,CAAC,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACjD,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,6BAAoC;IACnD,qCAAqC;IACrC,QAAQ,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;IAI5C,8FAA8F;IAC9F,UAAU,IAAI,IAAI;IAIlB;;;;;;;;;OASG;IACH,OAAO,CAAC,OAAO,EAAE,2BAA2B,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU;IAWzF,6EAA6E;IAC7E,aAAa,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAOlE,2EAA2E;IAC3E,GAAG,IAAI,IAAI;IAMX,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAM1B,OAAO,CAAC,WAAW;CAInB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ErrorCategory } from "../../../protocol/index.ts";
|
|
2
|
+
import type { AdapterEvent, EventTransformer, TransformResult } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Parses `codex app-server` v2 notifications into AdapterEvents. This harness
|
|
5
|
+
* streams token-level deltas (item/agentMessage/delta, item/reasoning/*Delta),
|
|
6
|
+
* so no diffing is needed. Items carry camelCase fields. Tool-like items
|
|
7
|
+
* (commandExecution/fileChange/mcpToolCall/webSearch) become tool parts that
|
|
8
|
+
* complete on item/completed.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CodexAppServerTransformer implements EventTransformer<unknown> {
|
|
11
|
+
private readonly ctx;
|
|
12
|
+
/** The text and reasoning parts, by item id. */
|
|
13
|
+
private readonly texts;
|
|
14
|
+
/** The tool parts (commands, changes, MCP calls, searches, plans), by item id. */
|
|
15
|
+
private readonly tools;
|
|
16
|
+
/** The sub-agents' activities, by item id. */
|
|
17
|
+
private readonly activities;
|
|
18
|
+
private usage;
|
|
19
|
+
/** The thread's totals when this turn began: Codex's `total` counts the whole thread. */
|
|
20
|
+
private baseline?;
|
|
21
|
+
/** Codex's turns in this one: a plan's, then the one implementing it. */
|
|
22
|
+
private readonly turnIds;
|
|
23
|
+
private readonly reportedModels;
|
|
24
|
+
private stopReason?;
|
|
25
|
+
/** From the failure's typed `codexErrorInfo`, when it had one. */
|
|
26
|
+
private errorCategory?;
|
|
27
|
+
private finishReason?;
|
|
28
|
+
private error?;
|
|
29
|
+
/** Codex stopped the turn (`interrupted`), as after an approval answered cancel. */
|
|
30
|
+
private interrupted;
|
|
31
|
+
constructor(ctx: {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
});
|
|
34
|
+
process(raw: unknown): AdapterEvent[];
|
|
35
|
+
finish(): TransformResult;
|
|
36
|
+
private synthetic;
|
|
37
|
+
private notification;
|
|
38
|
+
private openItem;
|
|
39
|
+
private completeItem;
|
|
40
|
+
/** Codex's proposed plan, as the switch_mode tool part its approval points at. */
|
|
41
|
+
private plan;
|
|
42
|
+
private planDecided;
|
|
43
|
+
/**
|
|
44
|
+
* A command the cancel could not confirm stopped may still be running: it
|
|
45
|
+
* fails with its outcome unknown instead of closing as cancelled, closed by
|
|
46
|
+
* the engine as the reducer closes a tool its turn left running.
|
|
47
|
+
*/
|
|
48
|
+
private stopUnconfirmed;
|
|
49
|
+
private activity;
|
|
50
|
+
private textDelta;
|
|
51
|
+
private openTool;
|
|
52
|
+
private captureUsage;
|
|
53
|
+
}
|
|
54
|
+
export declare function createCodexAppServerTransformer(ctx: {
|
|
55
|
+
sessionId: string;
|
|
56
|
+
}): EventTransformer;
|
|
57
|
+
/** Codex's typed failure (`codexErrorInfo`) as an engine error category. */
|
|
58
|
+
export declare function codexErrorCategory(info: unknown): ErrorCategory | undefined;
|
|
59
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/codex-app-server/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,aAAa,EAiBlB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAyCnF;;;;;;GAMG;AACH,qBAAa,y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