@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
package/src/client/transports.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
2
|
import { createInterface } from "node:readline";
|
|
3
3
|
import { type WireTransport, channelTransport, pushNdjsonLines } from "../protocol/index.ts";
|
|
4
|
+
import { ConnectionRefusedError } from "./connection.ts";
|
|
4
5
|
|
|
5
6
|
export interface SpawnServerOptions {
|
|
6
7
|
command: string;
|
|
@@ -41,29 +42,82 @@ export function spawnTransport(opts: SpawnServerOptions): WireTransport {
|
|
|
41
42
|
return transport;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
/**
|
|
45
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Dial a listening agent-server; resolves once the socket is open. `headers`
|
|
47
|
+
* go with the upgrade (Bun and Node; a browser's WebSocket sends none). A
|
|
48
|
+
* server that refuses the client rejects it with `ConnectionRefusedError`.
|
|
49
|
+
*/
|
|
50
|
+
export function connectTransport(
|
|
51
|
+
url: string,
|
|
52
|
+
headers?: Record<string, string>,
|
|
53
|
+
): Promise<WireTransport> {
|
|
46
54
|
return new Promise((resolve, reject) => {
|
|
47
|
-
const ws = new WebSocket(url);
|
|
55
|
+
const ws = headers ? new WebSocket(url, { headers }) : new WebSocket(url);
|
|
48
56
|
const { transport, push, end } = channelTransport({
|
|
49
57
|
send: (line) => void ws.send(line),
|
|
50
58
|
close: () => ws.close(),
|
|
51
59
|
});
|
|
52
60
|
let opened = false;
|
|
61
|
+
let failed = false;
|
|
62
|
+
const fail = () => {
|
|
63
|
+
end("socket closed");
|
|
64
|
+
if (opened || failed) return;
|
|
65
|
+
failed = true;
|
|
66
|
+
void refusal(url, headers).then((refused) =>
|
|
67
|
+
reject(refused ?? new Error(`websocket connect failed: ${url}`)),
|
|
68
|
+
);
|
|
69
|
+
};
|
|
53
70
|
ws.addEventListener("open", () => {
|
|
54
71
|
opened = true;
|
|
55
72
|
resolve(transport);
|
|
56
73
|
});
|
|
57
74
|
ws.addEventListener("message", (ev) => pushNdjsonLines(push, ev.data));
|
|
58
|
-
ws.addEventListener("close",
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
ws.addEventListener("close", fail);
|
|
76
|
+
// Browsers and Bun follow an error with a close; Node's WebSocket
|
|
77
|
+
// reports a refused connection by the error alone, which would leave
|
|
78
|
+
// the dial (and a client redialing) waiting forever.
|
|
79
|
+
ws.addEventListener("error", () => {
|
|
80
|
+
if (!opened) fail();
|
|
61
81
|
});
|
|
62
|
-
// A close event always follows; nothing to do here.
|
|
63
|
-
ws.addEventListener("error", () => {});
|
|
64
82
|
});
|
|
65
83
|
}
|
|
66
84
|
|
|
85
|
+
/** How long a failed dial waits to hear why. */
|
|
86
|
+
const REFUSAL_PROBE_MS = 2_000;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Why the server would not upgrade, when it refused this client. Neither
|
|
90
|
+
* Bun's WebSocket nor Node's tells a handshake's status, so one plain request
|
|
91
|
+
* with the same headers asks: `listen` answers it as it answered the upgrade,
|
|
92
|
+
* 401 for the token, and only then 426. Anything else, or no answer, is no
|
|
93
|
+
* refusal: no server yet, or a transient one. A 403 is none either: `listen`
|
|
94
|
+
* sends it only for an `Origin`, which a native client never sends, so it
|
|
95
|
+
* comes from something in front of the server (a proxy refusing plain
|
|
96
|
+
* requests), and the next dial may be answered.
|
|
97
|
+
*/
|
|
98
|
+
async function refusal(
|
|
99
|
+
url: string,
|
|
100
|
+
headers: Record<string, string> | undefined,
|
|
101
|
+
): Promise<ConnectionRefusedError | undefined> {
|
|
102
|
+
let status: number;
|
|
103
|
+
try {
|
|
104
|
+
// @ref LLP 0001#d16--a-listener-answers-native-clients-only-and-needs-a-token-beyond-loopback
|
|
105
|
+
// What the upgrade carried, without the upgrade; never redirected, so the token goes nowhere else.
|
|
106
|
+
const response = await fetch(url.replace(/^ws/, "http"), {
|
|
107
|
+
headers,
|
|
108
|
+
redirect: "manual",
|
|
109
|
+
signal: AbortSignal.timeout(REFUSAL_PROBE_MS),
|
|
110
|
+
});
|
|
111
|
+
status = response.status;
|
|
112
|
+
await response.body?.cancel().catch(() => undefined);
|
|
113
|
+
} catch {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
if (status !== 401) return undefined;
|
|
117
|
+
const sent = Object.keys(headers ?? {}).some((name) => name.toLowerCase() === "authorization");
|
|
118
|
+
return new ConnectionRefusedError(sent ? "token_refused" : "token_required", url);
|
|
119
|
+
}
|
|
120
|
+
|
|
67
121
|
/**
|
|
68
122
|
* The subset of a WebSocket this package needs — matches browser/Bun/Node and
|
|
69
123
|
* Cloudflare Workers sockets alike.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type AgentInput,
|
|
3
|
+
AsyncQueue,
|
|
4
|
+
type DecodedLifecycleEvent,
|
|
5
|
+
type DecodedWireEventEnvelope,
|
|
6
|
+
type TurnEndedEvent,
|
|
7
|
+
type TurnSteerResult,
|
|
8
|
+
type UnknownEvent,
|
|
9
|
+
isLiveEnvelope,
|
|
10
|
+
isUnknownEvent,
|
|
11
|
+
} from "../protocol/index.ts";
|
|
12
|
+
|
|
13
|
+
/** What a turn's handle yields: an unknown event type is delivered in order, not dropped. */
|
|
14
|
+
export type TurnEvent = DecodedLifecycleEvent | UnknownEvent;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A running turn: consume `events` (ends after `turn.ended`) or await `result`.
|
|
18
|
+
*
|
|
19
|
+
* `events` yields `UnknownEvent`s too: a newer server's event type is
|
|
20
|
+
* delivered in order rather than dropped, so consumers persist and forward it.
|
|
21
|
+
* Narrow with `isUnknownEvent` before switching on a known `type`;
|
|
22
|
+
* `reduceConversation` already accepts the union as-is.
|
|
23
|
+
*/
|
|
24
|
+
export interface TurnHandle {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
turnId: string;
|
|
27
|
+
events: AsyncIterableIterator<TurnEvent>;
|
|
28
|
+
result: Promise<TurnEndedEvent>;
|
|
29
|
+
/**
|
|
30
|
+
* How many of the first `events` are the catch-up: the session's kept
|
|
31
|
+
* events, replayed, from where the handle joined (`joinTurn`'s `fromSeq`,
|
|
32
|
+
* a retried start's `startedSeq`) up to the point it joined at. 0 for a
|
|
33
|
+
* turn this client started. A request among them may already be answered
|
|
34
|
+
* further on.
|
|
35
|
+
*/
|
|
36
|
+
readonly catchUp: number;
|
|
37
|
+
/** Add input to this turn while it runs (see `AgentServerClient.steerTurn`). */
|
|
38
|
+
steer(input: AgentInput, steerId?: string): Promise<TurnSteerResult>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Where a handle joined its session: what came after the point is its, the
|
|
43
|
+
* kept events after `headSeq` and the live frames that arrived after the
|
|
44
|
+
* `position`-th frame the client received.
|
|
45
|
+
*/
|
|
46
|
+
export interface JoinPoint {
|
|
47
|
+
headSeq: number;
|
|
48
|
+
position: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One handle's view of its session, from its point through its turn's end. */
|
|
52
|
+
class Handle {
|
|
53
|
+
readonly queue = new AsyncQueue<TurnEvent>();
|
|
54
|
+
readonly result: Promise<TurnEndedEvent>;
|
|
55
|
+
catchUp = 0;
|
|
56
|
+
point: JoinPoint | undefined;
|
|
57
|
+
done = false;
|
|
58
|
+
/** Frames after the point, waiting for the catch-up before them. */
|
|
59
|
+
private waiting: TurnEvent[] | undefined;
|
|
60
|
+
private resolve!: (ended: TurnEndedEvent) => void;
|
|
61
|
+
private reject!: (error: unknown) => void;
|
|
62
|
+
|
|
63
|
+
constructor(
|
|
64
|
+
readonly sessionId: string,
|
|
65
|
+
readonly turnId: string,
|
|
66
|
+
/** This client started the turn (`runTurn`), as opposed to joining it. */
|
|
67
|
+
readonly own: boolean,
|
|
68
|
+
private readonly settled: (handle: Handle) => void,
|
|
69
|
+
) {
|
|
70
|
+
this.result = new Promise<TurnEndedEvent>((resolve, reject) => {
|
|
71
|
+
this.resolve = resolve;
|
|
72
|
+
this.reject = reject;
|
|
73
|
+
});
|
|
74
|
+
// Consumers may only iterate `events`; don't surface an unhandled rejection.
|
|
75
|
+
this.result.catch(() => undefined);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** A frame the client delivered for the session: the handle's if it is after its point. */
|
|
79
|
+
take(envelope: DecodedWireEventEnvelope, arrival: number): void {
|
|
80
|
+
const point = this.point;
|
|
81
|
+
if (this.done || !point) return;
|
|
82
|
+
const before = isLiveEnvelope(envelope)
|
|
83
|
+
? arrival <= point.position
|
|
84
|
+
: envelope.seq <= point.headSeq;
|
|
85
|
+
if (before) return;
|
|
86
|
+
if (this.waiting) this.waiting.push(envelope.event);
|
|
87
|
+
else this.push(envelope.event);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Hold what comes after the point until the catch-up before it is in. */
|
|
91
|
+
catchingUp(): void {
|
|
92
|
+
this.waiting ??= [];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The catch-up is in: it goes first, then what waited for it. */
|
|
96
|
+
caughtUp(replayed: TurnEvent[]): void {
|
|
97
|
+
const waiting = this.waiting ?? [];
|
|
98
|
+
this.waiting = undefined;
|
|
99
|
+
this.catchUp = replayed.length;
|
|
100
|
+
for (const event of [...replayed, ...waiting]) this.push(event);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
push(event: TurnEvent): void {
|
|
104
|
+
if (this.done) return;
|
|
105
|
+
this.queue.push(event);
|
|
106
|
+
if (!isUnknownEvent(event) && event.type === "turn.ended" && event.turnId === this.turnId)
|
|
107
|
+
this.end(event);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
end(ended: TurnEndedEvent): void {
|
|
111
|
+
if (this.done) return;
|
|
112
|
+
this.done = true;
|
|
113
|
+
this.resolve(ended);
|
|
114
|
+
this.queue.end();
|
|
115
|
+
this.settled(this);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
fail(error: unknown): void {
|
|
119
|
+
if (this.done) return;
|
|
120
|
+
this.done = true;
|
|
121
|
+
this.reject(error);
|
|
122
|
+
this.queue.fail(error);
|
|
123
|
+
this.settled(this);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The turn handles of a client, by session; a session may have several (`joinTurn`). */
|
|
128
|
+
export class Turns {
|
|
129
|
+
private readonly bySession = new Map<string, Set<Handle>>();
|
|
130
|
+
|
|
131
|
+
/** A handle for a turn of the session: it takes frames once it `join`s a point. */
|
|
132
|
+
open(sessionId: string, turnId: string, own: boolean): Handle {
|
|
133
|
+
const handle = new Handle(sessionId, turnId, own, (done) => this.close(done));
|
|
134
|
+
const handles = this.bySession.get(sessionId) ?? new Set();
|
|
135
|
+
handles.add(handle);
|
|
136
|
+
this.bySession.set(sessionId, handles);
|
|
137
|
+
return handle;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Whether this client runs a turn of the session (one at a time). */
|
|
141
|
+
running(sessionId: string): boolean {
|
|
142
|
+
for (const handle of this.bySession.get(sessionId) ?? []) if (handle.own) return true;
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
sessions(): string[] {
|
|
147
|
+
return [...this.bySession.keys()];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** A frame the client delivered: to each handle of its session. */
|
|
151
|
+
deliver(envelope: DecodedWireEventEnvelope, arrival: number): void {
|
|
152
|
+
for (const handle of [...(this.bySession.get(envelope.sessionId) ?? [])])
|
|
153
|
+
handle.take(envelope, arrival);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
fail(sessionId: string, error: Error): void {
|
|
157
|
+
for (const handle of [...(this.bySession.get(sessionId) ?? [])]) handle.fail(error);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
failAll(error: Error): void {
|
|
161
|
+
for (const sessionId of this.sessions()) this.fail(sessionId, error);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private close(handle: Handle): void {
|
|
165
|
+
const handles = this.bySession.get(handle.sessionId);
|
|
166
|
+
handles?.delete(handle);
|
|
167
|
+
if (handles?.size === 0) this.bySession.delete(handle.sessionId);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type { Handle };
|
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
InitializeResponse,
|
|
3
3
|
PromptRequest,
|
|
4
|
-
RequestPermissionRequest,
|
|
5
|
-
RequestPermissionResponse,
|
|
6
4
|
SessionConfigOption,
|
|
7
5
|
} from "@agentclientprotocol/sdk";
|
|
8
|
-
import type { AgentCapabilities, AgentInput
|
|
6
|
+
import type { AgentCapabilities, AgentInput } from "../../../protocol/index.ts";
|
|
9
7
|
import { AsyncQueue } from "../../../protocol/index.ts";
|
|
8
|
+
import { type NativeProcesses, sharedNativeProcesses } from "../../processes/native-processes.ts";
|
|
9
|
+
import { onAbort } from "../../utils/deadline.ts";
|
|
10
10
|
import { SessionResumeError } from "../../utils/errors.ts";
|
|
11
|
-
import type { AgentExecuteOptions,
|
|
11
|
+
import type { AgentExecuteOptions, RawAgentEvent } from "../base.ts";
|
|
12
12
|
import { configFingerprint } from "../config-fingerprint.ts";
|
|
13
|
+
import { nativeMcpServer } from "../mcp-config.ts";
|
|
13
14
|
import { SessionAgent } from "../session-agent.ts";
|
|
14
|
-
import {
|
|
15
|
+
import { IDLE_TIMEOUT_MS, SessionPool } from "../session-pool.ts";
|
|
16
|
+
import { type AcpRawEvent, CANCELLED_PROMPT_RESULT } from "./adapter.ts";
|
|
15
17
|
import { AcpClient, type AcpClientOptions, type AcpLaunch } from "./client.ts";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
import { type AcpPromptCapabilities, toAcpMcpServers, toPromptBlocks } from "./mappings.ts";
|
|
19
|
+
import { type TurnScope, answerElicitation, answerPermission } from "./requests.ts";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* What a session's agent process was started with, as one key: a change to
|
|
23
|
+
* any of it starts another, which resumes the conversation where the agent
|
|
24
|
+
* can. MCP servers go without `required`, which is the engine's; extra
|
|
25
|
+
* directories count, in any order, only for an agent that takes them.
|
|
26
|
+
* Hashed: the env and MCP headers carry credentials.
|
|
27
|
+
*/
|
|
28
|
+
function spawnKey(
|
|
29
|
+
options: AgentExecuteOptions,
|
|
30
|
+
launch: AcpLaunch,
|
|
31
|
+
takesDirectories: boolean,
|
|
32
|
+
): string {
|
|
33
|
+
const servers = options.mcpServers;
|
|
34
|
+
return configFingerprint({
|
|
35
|
+
launch: { command: launch.command, args: launch.args ?? [], env: launch.env ?? {} },
|
|
36
|
+
cwd: options.cwd,
|
|
37
|
+
env: options.env,
|
|
38
|
+
mcpServers:
|
|
39
|
+
servers &&
|
|
40
|
+
Object.fromEntries(
|
|
41
|
+
Object.entries(servers).map(([name, server]) => [name, nativeMcpServer(server)]),
|
|
42
|
+
),
|
|
43
|
+
directories: takesDirectories
|
|
44
|
+
? [...new Set(options.additionalDirectories ?? [])].sort()
|
|
45
|
+
: undefined,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
24
48
|
|
|
25
49
|
const CAPABILITIES: AgentCapabilities = {
|
|
26
50
|
multiTurn: true,
|
|
@@ -31,17 +55,19 @@ const CAPABILITIES: AgentCapabilities = {
|
|
|
31
55
|
// option, so neither is promised here.
|
|
32
56
|
modelSwitch: "unsupported",
|
|
33
57
|
thinkingLevels: false,
|
|
58
|
+
// The most an agent can take: its `initialize` decides, image data with its
|
|
59
|
+
// `image` prompt capability and files beyond text with `embeddedContext`.
|
|
34
60
|
images: true,
|
|
61
|
+
files: ["text", "pdf", "binary"],
|
|
35
62
|
mcpServers: true,
|
|
36
63
|
permissionRequests: true,
|
|
64
|
+
// The answer is an option id.
|
|
65
|
+
rejectionMessages: false,
|
|
37
66
|
};
|
|
38
67
|
|
|
39
68
|
/** ACP protocol major version this harness speaks. */
|
|
40
69
|
const PROTOCOL_VERSION = 1;
|
|
41
70
|
|
|
42
|
-
/** Idle time before an unused agent subprocess is shut down. */
|
|
43
|
-
const IDLE_TIMEOUT_MS = 5 * 60_000;
|
|
44
|
-
|
|
45
71
|
/** How long a cancelled prompt may take to resolve before the turn is failed. */
|
|
46
72
|
const CANCEL_GRACE_MS = 10_000;
|
|
47
73
|
|
|
@@ -66,52 +92,28 @@ export interface AcpAgentOptions {
|
|
|
66
92
|
cancelGraceMs?: number;
|
|
67
93
|
/** Injectable client factory for deterministic tests. */
|
|
68
94
|
createClient?: (options: AcpClientOptions) => Promise<AcpClient>;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
interface TurnPermissions {
|
|
75
|
-
broker?: PermissionRequestHandler;
|
|
76
|
-
mode?: PermissionMode;
|
|
77
|
-
signal?: AbortSignal;
|
|
95
|
+
/**
|
|
96
|
+
* Where the agents start: each in a group of its own, held by the lifeline
|
|
97
|
+
* and recorded for its session (`createAgentRegistry` passes the runtime's).
|
|
98
|
+
*/
|
|
99
|
+
processes?: NativeProcesses;
|
|
78
100
|
}
|
|
79
101
|
|
|
80
102
|
interface AcpSession {
|
|
81
103
|
client: AcpClient;
|
|
82
104
|
acpSessionId: string;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
directoriesFingerprint?: string;
|
|
88
|
-
launchFingerprint: string;
|
|
105
|
+
/** What its agent process was started with (`spawnKey`). */
|
|
106
|
+
spawnKey: string;
|
|
107
|
+
/** From `initialize`: whether the agent takes extra directories. */
|
|
108
|
+
takesDirectories: boolean;
|
|
89
109
|
/** The agent's selectable settings, kept current by `config_option_update`. */
|
|
90
110
|
configOptions: SessionConfigOption[];
|
|
91
|
-
/** From `initialize`:
|
|
92
|
-
|
|
93
|
-
turn?:
|
|
111
|
+
/** From `initialize`: what the agent's prompts accept beyond text and links. */
|
|
112
|
+
prompt: AcpPromptCapabilities;
|
|
113
|
+
turn?: TurnScope;
|
|
94
114
|
idleTimer?: ReturnType<typeof setTimeout>;
|
|
95
115
|
}
|
|
96
116
|
|
|
97
|
-
export function acpSessionCompatible(
|
|
98
|
-
existing: AcpSession | undefined,
|
|
99
|
-
options: AgentExecuteOptions,
|
|
100
|
-
launchFingerprint: string,
|
|
101
|
-
): boolean {
|
|
102
|
-
return Boolean(
|
|
103
|
-
existing &&
|
|
104
|
-
!existing.client.closed &&
|
|
105
|
-
existing.cwd === options.cwd &&
|
|
106
|
-
existing.envFingerprint === configFingerprint(options.env) &&
|
|
107
|
-
existing.mcpFingerprint === configFingerprint(options.mcpServers) &&
|
|
108
|
-
(existing.directoriesFingerprint === undefined ||
|
|
109
|
-
existing.directoriesFingerprint === directoriesFingerprint(options)) &&
|
|
110
|
-
existing.launchFingerprint === launchFingerprint &&
|
|
111
|
-
(!options.resumeSessionId || options.resumeSessionId === existing.acpSessionId),
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
117
|
/** A JSON-RPC error's `data` usually holds the cause its message only names. */
|
|
116
118
|
function failureMessage(error: unknown): string {
|
|
117
119
|
if (!(error instanceof Error)) return String(error);
|
|
@@ -123,10 +125,6 @@ function failureMessage(error: unknown): string {
|
|
|
123
125
|
return `${error}: ${detail}`;
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
function directoriesFingerprint(options: AgentExecuteOptions): string {
|
|
127
|
-
return (options.additionalDirectories ?? []).join("\n");
|
|
128
|
-
}
|
|
129
|
-
|
|
130
128
|
/** Every value a select option offers, whether listed flat or in groups. */
|
|
131
129
|
function selectableValues(option: SessionConfigOption & { type: "select" }): string[] {
|
|
132
130
|
return option.options.flatMap((entry) =>
|
|
@@ -134,29 +132,6 @@ function selectableValues(option: SessionConfigOption & { type: "select" }): str
|
|
|
134
132
|
);
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
/** Answer an agent permission request against the session's current turn. */
|
|
138
|
-
export async function answerPermission(
|
|
139
|
-
session: AcpSession,
|
|
140
|
-
request: RequestPermissionRequest,
|
|
141
|
-
): Promise<RequestPermissionResponse> {
|
|
142
|
-
if (request.sessionId !== session.acpSessionId) return CANCELLED_OUTCOME;
|
|
143
|
-
const turn = session.turn;
|
|
144
|
-
const asks = (turn?.mode ?? "default") === "default";
|
|
145
|
-
if (!turn?.broker || !asks) return autoDecide(request, turn?.mode);
|
|
146
|
-
const decision = await turn.broker(permissionToolCall(request), { signal: turn.signal });
|
|
147
|
-
if (decision.decision === "cancel") return CANCELLED_OUTCOME;
|
|
148
|
-
// `decision.updatedInput` is unrepresentable here: ACP v1's outcome carries
|
|
149
|
-
// an optionId and nothing else, so an edited input cannot be honoured — and
|
|
150
|
-
// silently running the ORIGINAL is exactly what the field exists to prevent.
|
|
151
|
-
// An edited approval therefore DENIES: the broker authorized a call this
|
|
152
|
-
// protocol cannot deliver. (The claude-code harness, via canUseTool, is the
|
|
153
|
-
// one that can execute the edit.)
|
|
154
|
-
if (decision.decision === "allow" && decision.updatedInput !== undefined) {
|
|
155
|
-
return chooseOutcome(request.options, false);
|
|
156
|
-
}
|
|
157
|
-
return chooseOutcome(request.options, decision.decision === "allow");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
135
|
/**
|
|
161
136
|
* ACP harness: drives any Agent Client Protocol v1 agent as a long-lived
|
|
162
137
|
* subprocess (one per logical session, reused across turns). The launch
|
|
@@ -169,38 +144,38 @@ export async function answerPermission(
|
|
|
169
144
|
export class AcpAgent extends SessionAgent {
|
|
170
145
|
readonly harness = "acp" as const;
|
|
171
146
|
readonly capabilities = CAPABILITIES;
|
|
172
|
-
|
|
147
|
+
/** Its CLIs start here: the runtime's, or this OS process's own when it was made without one. */
|
|
148
|
+
readonly processes: NativeProcesses;
|
|
149
|
+
private readonly sessions = new SessionPool<AcpSession>();
|
|
173
150
|
|
|
174
151
|
constructor(private readonly agentOptions: AcpAgentOptions) {
|
|
175
152
|
super();
|
|
153
|
+
this.processes = agentOptions.processes ?? sharedNativeProcesses();
|
|
176
154
|
}
|
|
177
155
|
|
|
178
156
|
private async resolveSession(
|
|
179
157
|
options: AgentExecuteOptions,
|
|
180
158
|
signal: AbortSignal,
|
|
181
159
|
): Promise<AcpSession> {
|
|
182
|
-
|
|
160
|
+
signal.throwIfAborted();
|
|
183
161
|
const launch = await this.agentOptions.resolveLaunch();
|
|
184
|
-
|
|
162
|
+
signal.throwIfAborted();
|
|
185
163
|
if (!launch) {
|
|
186
164
|
throw new Error(
|
|
187
165
|
"acp harness is not configured: resolveLaunch returned no agent launch command",
|
|
188
166
|
);
|
|
189
167
|
}
|
|
190
|
-
const launchFingerprint = configFingerprint({
|
|
191
|
-
command: launch.command,
|
|
192
|
-
args: launch.args?.join(" ") ?? "",
|
|
193
|
-
...launch.env,
|
|
194
|
-
});
|
|
195
168
|
|
|
196
169
|
const existing = this.sessions.get(options.sessionId);
|
|
197
170
|
const resumeTarget = options.resumeSessionId;
|
|
198
171
|
if (existing && !existing.client.closed) {
|
|
199
|
-
|
|
172
|
+
const same =
|
|
173
|
+
existing.spawnKey === spawnKey(options, launch, existing.takesDirectories) &&
|
|
174
|
+
(!resumeTarget || resumeTarget === existing.acpSessionId);
|
|
175
|
+
if (same) {
|
|
200
176
|
this.sessions.clearIdle(existing);
|
|
201
177
|
return existing;
|
|
202
178
|
}
|
|
203
|
-
|
|
204
179
|
this.sessions.close(options.sessionId);
|
|
205
180
|
}
|
|
206
181
|
|
|
@@ -209,28 +184,28 @@ export class AcpAgent extends SessionAgent {
|
|
|
209
184
|
cwd: options.cwd,
|
|
210
185
|
env: options.env,
|
|
211
186
|
clientName: this.agentOptions.clientName,
|
|
187
|
+
sessionId: options.sessionId,
|
|
188
|
+
processes: this.processes,
|
|
212
189
|
};
|
|
213
190
|
const client = this.agentOptions.createClient
|
|
214
191
|
? await this.agentOptions.createClient(clientOptions)
|
|
215
192
|
: await AcpClient.create(clientOptions);
|
|
216
|
-
if (signal.aborted) {
|
|
217
|
-
client.close();
|
|
218
|
-
throw new Error("turn aborted");
|
|
219
|
-
}
|
|
220
193
|
client.onClose(() => this.sessions.dropIfCurrent(options.sessionId, client));
|
|
221
194
|
|
|
222
195
|
const untrack = this.sessions.trackPending(options.sessionId, client);
|
|
223
|
-
|
|
224
|
-
|
|
196
|
+
// Closed at once when the turn was cancelled meanwhile.
|
|
197
|
+
const offAbort = onAbort(signal, () => client.close());
|
|
225
198
|
let init: InitializeResponse;
|
|
226
199
|
let acpSessionId: string | undefined;
|
|
227
200
|
try {
|
|
228
|
-
|
|
201
|
+
signal.throwIfAborted();
|
|
229
202
|
init = await client.request(
|
|
230
203
|
"initialize",
|
|
231
204
|
{
|
|
232
205
|
protocolVersion: PROTOCOL_VERSION,
|
|
233
|
-
|
|
206
|
+
// The engine brokers the agent's requests for input, form or URL;
|
|
207
|
+
// a turn whose client cannot answer declines them.
|
|
208
|
+
clientCapabilities: { elicitation: { form: {}, url: {} } },
|
|
234
209
|
clientInfo: {
|
|
235
210
|
name: this.agentOptions.clientName ?? "agent-server",
|
|
236
211
|
version: this.agentOptions.clientVersion ?? "0.0.0",
|
|
@@ -238,13 +213,14 @@ export class AcpAgent extends SessionAgent {
|
|
|
238
213
|
},
|
|
239
214
|
INITIALIZE_TIMEOUT_MS,
|
|
240
215
|
);
|
|
241
|
-
|
|
216
|
+
signal.throwIfAborted();
|
|
242
217
|
const capabilities = init.agentCapabilities;
|
|
218
|
+
const takesDirectories = Boolean(capabilities?.sessionCapabilities?.additionalDirectories);
|
|
243
219
|
const target = {
|
|
244
220
|
cwd: options.cwd,
|
|
245
221
|
mcpServers: toAcpMcpServers(options.mcpServers),
|
|
246
222
|
// Sent only to agents that advertise it; others keep `cwd` alone.
|
|
247
|
-
...(
|
|
223
|
+
...(takesDirectories &&
|
|
248
224
|
options.additionalDirectories?.length && {
|
|
249
225
|
additionalDirectories: options.additionalDirectories,
|
|
250
226
|
}),
|
|
@@ -287,17 +263,16 @@ export class AcpAgent extends SessionAgent {
|
|
|
287
263
|
const session: AcpSession = {
|
|
288
264
|
client,
|
|
289
265
|
acpSessionId,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
mcpFingerprint: configFingerprint(options.mcpServers),
|
|
293
|
-
...(capabilities?.sessionCapabilities?.additionalDirectories && {
|
|
294
|
-
directoriesFingerprint: directoriesFingerprint(options),
|
|
295
|
-
}),
|
|
296
|
-
launchFingerprint,
|
|
266
|
+
spawnKey: spawnKey(options, launch, takesDirectories),
|
|
267
|
+
takesDirectories,
|
|
297
268
|
configOptions: configOptions ?? [],
|
|
298
|
-
|
|
269
|
+
prompt: {
|
|
270
|
+
image: Boolean(init.agentCapabilities?.promptCapabilities?.image),
|
|
271
|
+
embeddedContext: Boolean(init.agentCapabilities?.promptCapabilities?.embeddedContext),
|
|
272
|
+
},
|
|
299
273
|
};
|
|
300
274
|
client.setPermissionHandler((request) => answerPermission(session, request));
|
|
275
|
+
client.setElicitationHandler((request) => answerElicitation(session, request));
|
|
301
276
|
client.onSessionUpdate(({ sessionId, update }) => {
|
|
302
277
|
if (sessionId === session.acpSessionId && update.sessionUpdate === "config_option_update")
|
|
303
278
|
session.configOptions = update.configOptions;
|
|
@@ -306,9 +281,10 @@ export class AcpAgent extends SessionAgent {
|
|
|
306
281
|
return session;
|
|
307
282
|
} catch (error) {
|
|
308
283
|
client.close();
|
|
309
|
-
|
|
284
|
+
signal.throwIfAborted();
|
|
285
|
+
throw error;
|
|
310
286
|
} finally {
|
|
311
|
-
|
|
287
|
+
offAbort();
|
|
312
288
|
untrack();
|
|
313
289
|
}
|
|
314
290
|
}
|
|
@@ -352,7 +328,7 @@ export class AcpAgent extends SessionAgent {
|
|
|
352
328
|
options: AgentExecuteOptions,
|
|
353
329
|
controller: AbortController,
|
|
354
330
|
): AsyncIterableIterator<RawAgentEvent> {
|
|
355
|
-
const queue = new AsyncQueue<
|
|
331
|
+
const queue = new AsyncQueue<AcpRawEvent>();
|
|
356
332
|
const unsubscribe: Array<() => void> = [];
|
|
357
333
|
let cancelTimer: ReturnType<typeof setTimeout> | undefined;
|
|
358
334
|
let session: AcpSession | undefined;
|
|
@@ -363,6 +339,7 @@ export class AcpAgent extends SessionAgent {
|
|
|
363
339
|
controller.signal.throwIfAborted();
|
|
364
340
|
session.turn = {
|
|
365
341
|
broker: options.onPermissionRequest,
|
|
342
|
+
elicitation: options.onElicitationRequest,
|
|
366
343
|
mode: options.permissionMode,
|
|
367
344
|
signal: controller.signal,
|
|
368
345
|
};
|
|
@@ -378,7 +355,7 @@ export class AcpAgent extends SessionAgent {
|
|
|
378
355
|
}),
|
|
379
356
|
);
|
|
380
357
|
const finishCancelled = () => {
|
|
381
|
-
queue.push(
|
|
358
|
+
queue.push(CANCELLED_PROMPT_RESULT);
|
|
382
359
|
queue.end();
|
|
383
360
|
};
|
|
384
361
|
unsubscribe.push(
|
|
@@ -388,7 +365,7 @@ export class AcpAgent extends SessionAgent {
|
|
|
388
365
|
}),
|
|
389
366
|
);
|
|
390
367
|
|
|
391
|
-
const
|
|
368
|
+
const cancelPrompt = () => {
|
|
392
369
|
// ACP semantics: session/cancel makes the in-flight prompt resolve
|
|
393
370
|
// with stopReason=cancelled. Bound the wait for misbehaving agents.
|
|
394
371
|
void client.notify("session/cancel", { sessionId: acpSessionId }).catch(() => {});
|
|
@@ -401,15 +378,14 @@ export class AcpAgent extends SessionAgent {
|
|
|
401
378
|
};
|
|
402
379
|
|
|
403
380
|
if (controller.signal.aborted) {
|
|
404
|
-
// Aborted while the session was being set up
|
|
405
|
-
//
|
|
381
|
+
// Aborted while the session was being set up: there is no prompt to
|
|
382
|
+
// cancel, and none is started.
|
|
406
383
|
finishCancelled();
|
|
407
384
|
} else {
|
|
408
|
-
controller.signal
|
|
409
|
-
unsubscribe.push(() => controller.signal.removeEventListener("abort", onAbort));
|
|
385
|
+
unsubscribe.push(onAbort(controller.signal, cancelPrompt));
|
|
410
386
|
const prompt: PromptRequest = {
|
|
411
387
|
sessionId: acpSessionId,
|
|
412
|
-
prompt: toPromptBlocks(input, session.
|
|
388
|
+
prompt: toPromptBlocks(input, session.prompt),
|
|
413
389
|
};
|
|
414
390
|
client.request("session/prompt", prompt).then(
|
|
415
391
|
(response) => {
|
|
@@ -432,7 +408,7 @@ export class AcpAgent extends SessionAgent {
|
|
|
432
408
|
}
|
|
433
409
|
} catch (error) {
|
|
434
410
|
if (!controller.signal.aborted) throw error;
|
|
435
|
-
yield
|
|
411
|
+
yield CANCELLED_PROMPT_RESULT;
|
|
436
412
|
} finally {
|
|
437
413
|
if (cancelTimer) clearTimeout(cancelTimer);
|
|
438
414
|
for (const off of unsubscribe) off();
|