@zvada/agent-server 0.3.18 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -26
- package/CHANGELOG.md +1005 -1
- package/README.md +35 -39
- 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 +43 -25
- 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 +144 -0
- package/src/client/streams.ts +488 -0
- package/src/client/transports.ts +62 -8
- package/src/client/turns.ts +171 -0
- package/src/core/agents/acp/acp-agent.ts +94 -118
- package/src/core/agents/acp/adapter.ts +20 -9
- package/src/core/agents/acp/client.ts +125 -47
- package/src/core/agents/acp/known-agents.ts +36 -4
- package/src/core/agents/acp/mappings.ts +64 -18
- package/src/core/agents/acp/requests.ts +125 -0
- package/src/core/agents/attachments.ts +18 -0
- package/src/core/agents/base.ts +120 -42
- package/src/core/agents/claude-code/adapter.ts +177 -238
- package/src/core/agents/claude-code/approvals.ts +270 -0
- package/src/core/agents/claude-code/claude-agent.ts +175 -158
- package/src/core/agents/claude-code/credentials.ts +171 -0
- package/src/core/agents/claude-code/events.ts +55 -0
- package/src/core/agents/claude-code/login.ts +269 -0
- package/src/core/agents/claude-code/mcp.ts +206 -0
- package/src/core/agents/claude-code/models.ts +15 -9
- package/src/core/agents/claude-code/options.ts +326 -39
- package/src/core/agents/claude-code/outcome.ts +209 -0
- package/src/core/agents/claude-code/session-pool.ts +136 -0
- package/src/core/agents/claude-code/session.ts +513 -0
- package/src/core/agents/claude-code/spawn.ts +144 -0
- package/src/core/agents/claude-code/spend.ts +160 -0
- package/src/core/agents/claude-code/tools.ts +47 -0
- package/src/core/agents/claude-code/turn-usage.ts +135 -0
- package/src/core/agents/claude-code/turn.ts +232 -0
- package/src/core/agents/codex-app-server/adapter.ts +314 -117
- package/src/core/agents/codex-app-server/client.ts +186 -84
- package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
- package/src/core/agents/codex-app-server/commands.ts +228 -0
- package/src/core/agents/codex-app-server/credentials.ts +126 -0
- package/src/core/agents/codex-app-server/effort.ts +29 -0
- package/src/core/agents/codex-app-server/events.ts +47 -0
- package/src/core/agents/codex-app-server/homes.ts +64 -0
- package/src/core/agents/codex-app-server/input.ts +60 -0
- package/src/core/agents/codex-app-server/items.ts +149 -0
- package/src/core/agents/codex-app-server/login.ts +180 -0
- package/src/core/agents/codex-app-server/mcp.ts +182 -37
- package/src/core/agents/codex-app-server/models.ts +99 -46
- package/src/core/agents/codex-app-server/options.ts +146 -0
- package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
- package/src/core/agents/codex-app-server/protocol.ts +117 -0
- package/src/core/agents/codex-app-server/requests.ts +332 -0
- package/src/core/agents/codex-app-server/session.ts +285 -0
- package/src/core/agents/codex-app-server/subagents.ts +108 -42
- package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
- package/src/core/agents/codex-app-server/turn-items.ts +88 -0
- package/src/core/agents/codex-app-server/turn.ts +463 -0
- package/src/core/agents/config-fingerprint.ts +7 -14
- package/src/core/agents/credentials.ts +98 -0
- package/src/core/agents/elicitation.ts +75 -0
- package/src/core/agents/inherit-config.ts +21 -0
- package/src/core/agents/login.ts +116 -0
- package/src/core/agents/mcp-config.ts +112 -8
- package/src/core/agents/plan.ts +25 -0
- package/src/core/agents/registry.ts +21 -4
- package/src/core/agents/session-agent.ts +96 -4
- package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
- package/src/core/agents/stderr-tail.ts +75 -0
- package/src/core/agents/types.ts +40 -5
- package/src/core/index.ts +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,46 @@
|
|
|
1
|
+
import type { CliTool } from "./tools.ts";
|
|
2
|
+
/** One platform's build of a pinned version, as `bun run releases:refresh` recorded it. */
|
|
3
|
+
export interface CliBuild {
|
|
4
|
+
/** The npm tarball's subresource integrity (`sha512-…`). */
|
|
5
|
+
readonly integrity: string;
|
|
6
|
+
/** The binary's sha256, where its vendor signs a manifest of it (Claude). */
|
|
7
|
+
readonly sha256?: string;
|
|
8
|
+
}
|
|
9
|
+
/** A pinned version of one CLI and its builds, by platform as the cache names them. */
|
|
10
|
+
export interface CliRelease {
|
|
11
|
+
readonly version: string;
|
|
12
|
+
/** For the reader: the version the binary reports, where the package's is another (Claude's SDK version). */
|
|
13
|
+
readonly cli?: string;
|
|
14
|
+
readonly builds: Readonly<Record<string, CliBuild>>;
|
|
15
|
+
}
|
|
16
|
+
export type CliReleases = Readonly<Record<CliTool, CliRelease>>;
|
|
17
|
+
/** A binary's sha256 that something on this machine vouches for, and what. */
|
|
18
|
+
export interface LocalBuild {
|
|
19
|
+
readonly sha256: string;
|
|
20
|
+
/** Said once when it is what a download is checked against: "the installed Claude SDK's manifest". */
|
|
21
|
+
readonly vouchedBy: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a download must match, and what vouches for it: this release's table
|
|
25
|
+
* (`release`), something on this machine (`local`), or only the registry it
|
|
26
|
+
* comes from (`registry`).
|
|
27
|
+
*/
|
|
28
|
+
export type ExpectedBuild = {
|
|
29
|
+
readonly source: "release";
|
|
30
|
+
readonly integrity: string;
|
|
31
|
+
readonly sha256?: string;
|
|
32
|
+
} | {
|
|
33
|
+
readonly source: "local";
|
|
34
|
+
readonly sha256: string;
|
|
35
|
+
readonly vouchedBy: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly source: "registry";
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* What the build of `tool` at `version` for `suffix` must be. A version this
|
|
41
|
+
* release pins is checked against its table, whatever registry serves it; any
|
|
42
|
+
* other against what this machine knows of it, else only the registry.
|
|
43
|
+
*/
|
|
44
|
+
export declare function expectedBuild(tool: CliTool, version: string, suffix: string, releases: CliReleases, local?: (suffix: string, version: string) => LocalBuild | undefined): ExpectedBuild;
|
|
45
|
+
export declare function sha256Of(path: string): Promise<string>;
|
|
46
|
+
//# sourceMappingURL=checksums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checksums.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/checksums.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,2FAA2F;AAC3F,MAAM,WAAW,QAAQ;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,uFAAuF;AACvF,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,6GAA6G;IAC7G,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;CACpD;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sGAAsG;IACtG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjF;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAGnC;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,EACrB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,GACjE,aAAa,CAMf;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI5D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract a .tgz into a directory using the system `tar` (BSD, GNU, and
|
|
3
|
+
* Windows 10+ libarchive all accept these flags). npm tarballs are small
|
|
4
|
+
* enough in entry count that shelling out beats maintaining a tar parser.
|
|
5
|
+
*/
|
|
6
|
+
export declare function extractTarGz(tgzPath: string, destDir: string): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/extract.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BlF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DEFAULT_PINS } from "./pins.ts";
|
|
2
|
+
export { CLI_TOOLS, type CliTool, toolForHarness } from "./tools.ts";
|
|
3
|
+
export { type PlatformInfo, detectPlatform } from "./platform.ts";
|
|
4
|
+
export { type CliProgress, CliProvisioner, type CliStatus, type ProvisionMode, type ProvisionOptions, type ProvisionerDeps, type ResolvedCli, } from "./provisioner.ts";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EACN,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CliProvisionError } from "../utils/errors.ts";
|
|
2
|
+
import { type ExpectedBuild } from "./checksums.ts";
|
|
3
|
+
import { type DownloadTimeouts } from "./npm.ts";
|
|
4
|
+
import { type CliToolSpec, type ToolPackage } from "./tools.ts";
|
|
5
|
+
/** One build to install into the cache, and what it must match. */
|
|
6
|
+
export interface BuildInstall {
|
|
7
|
+
spec: CliToolSpec;
|
|
8
|
+
pkg: ToolPackage;
|
|
9
|
+
expected: ExpectedBuild;
|
|
10
|
+
/** The trusted cache root, and the build's folder in it. */
|
|
11
|
+
root: string;
|
|
12
|
+
dir: string;
|
|
13
|
+
registry: string;
|
|
14
|
+
fetch: typeof fetch;
|
|
15
|
+
timeouts: DownloadTimeouts;
|
|
16
|
+
extract: (tgzPath: string, destDir: string) => Promise<void>;
|
|
17
|
+
/** The bytes so far: downloading, then verifying. */
|
|
18
|
+
onProgress: (phase: "downloading" | "verifying", receivedBytes: number, totalBytes?: number) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A tree every user may read and run, and only its owner write: folders
|
|
22
|
+
* 0755, files 0644, runnable ones 0755, never through a symlink. A staged
|
|
23
|
+
* build gets it before its rename, so what a 002 umask unpacked (Ubuntu's
|
|
24
|
+
* default) is not refused as writable by others, and a process killed after
|
|
25
|
+
* the rename leaves a finished build.
|
|
26
|
+
*/
|
|
27
|
+
export declare function openToAll(path: string): Promise<void>;
|
|
28
|
+
export declare function noBinary(pkg: ToolPackage): CliProvisionError;
|
|
29
|
+
/**
|
|
30
|
+
* Download a build, check it against what it must match, unpack it in a
|
|
31
|
+
* staging folder and rename it into `dir`. Two processes installing the same
|
|
32
|
+
* build at once both download it, and the version-keyed rename decides: the
|
|
33
|
+
* one that loses adopts the winner's tree. Answers the bytes downloaded.
|
|
34
|
+
*/
|
|
35
|
+
export declare function installBuild(job: BuildInstall): Promise<number>;
|
|
36
|
+
//# sourceMappingURL=install-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-build.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/install-build.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,KAAK,aAAa,EAAY,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,KAAK,gBAAgB,EAAoD,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAY,MAAM,YAAY,CAAC;AAK1E,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,WAAW,CAAC;IACjB,QAAQ,EAAE,aAAa,CAAC;IACxB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,qDAAqD;IACrD,UAAU,EAAE,CACX,KAAK,EAAE,aAAa,GAAG,WAAW,EAClC,aAAa,EAAE,MAAM,EACrB,UAAU,CAAC,EAAE,MAAM,KACf,IAAI,CAAC;CACV;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB,CAE5D;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ErE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
2
|
+
/** The subset of npm packument `dist` we need to fetch a package verifiably. */
|
|
3
|
+
export interface NpmDist {
|
|
4
|
+
tarball: string;
|
|
5
|
+
/** Subresource integrity, e.g. `sha512-<base64>`. */
|
|
6
|
+
integrity: string;
|
|
7
|
+
}
|
|
8
|
+
type FetchLike = (url: string, init?: RequestInit) => Promise<Response>;
|
|
9
|
+
/**
|
|
10
|
+
* `text` with each URL in it shown without credentials or query, where a
|
|
11
|
+
* mirror's token or a signed link would be: what an error or a log line may
|
|
12
|
+
* say, since a turn's error reaches every connection and the journal.
|
|
13
|
+
*/
|
|
14
|
+
export declare function withoutSecrets(text: string): string;
|
|
15
|
+
/** How long a request may wait for its response, and a download for its next bytes. */
|
|
16
|
+
export interface DownloadTimeouts {
|
|
17
|
+
responseMs: number;
|
|
18
|
+
stallMs: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEFAULT_DOWNLOAD_TIMEOUTS: DownloadTimeouts;
|
|
21
|
+
/**
|
|
22
|
+
* Fetch the registry metadata for one exact package version and return its
|
|
23
|
+
* tarball location + integrity. The returned tarball URL is the registry's own
|
|
24
|
+
* (works with mirrors/private registries that rewrite hosts).
|
|
25
|
+
*/
|
|
26
|
+
export declare function fetchDist(registry: string, packageName: string, version: string, fetchImpl?: FetchLike, timeouts?: DownloadTimeouts): Promise<NpmDist>;
|
|
27
|
+
export interface DownloadOptions {
|
|
28
|
+
timeouts?: DownloadTimeouts;
|
|
29
|
+
/** The bytes received so far, and the total when the response states it. */
|
|
30
|
+
onBytes?: (received: number, total: number | undefined) => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Stream a tarball to disk, hashing as it lands, and reject on integrity
|
|
34
|
+
* mismatch. Only sha512 (what the npm registry publishes) is supported.
|
|
35
|
+
* A download that receives nothing for `stallMs` fails. Returns the byte
|
|
36
|
+
* count for progress logs.
|
|
37
|
+
*/
|
|
38
|
+
export declare function downloadWithIntegrity(url: string, destFile: string, integrity: string, fetchImpl?: FetchLike, options?: DownloadOptions): Promise<number>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=npm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/npm.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AAEjE,gFAAgF;AAChF,MAAM,WAAW,OAAO;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWnD;AAED,uFAAuF;AACvF,MAAM,WAAW,gBAAgB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,yBAAyB,EAAE,gBAA0D,CAAC;AA0CnG;;;;GAIG;AACH,wBAAsB,SAAS,CAC9B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAAiB,EAC5B,QAAQ,GAAE,gBAA4C,GACpD,OAAO,CAAC,OAAO,CAAC,CAqBlB;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAC1C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,SAAiB,EAC5B,OAAO,GAAE,eAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAyEjB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CliTool } from "./tools.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The CLI versions this engine release is tested against — the versions
|
|
4
|
+
* `agent-server install` (and on-demand provisioning) downloads.
|
|
5
|
+
*
|
|
6
|
+
* - `claude` is the version of the `@anthropic-ai/claude-agent-sdk-<platform>`
|
|
7
|
+
* packages, which carry the native CLI matched to the SDK JS we bundle. It
|
|
8
|
+
* MUST track the lockfile's claude-agent-sdk version (a test enforces this);
|
|
9
|
+
* bump both together. When the SDK is resolvable on disk, its real installed
|
|
10
|
+
* version wins over this pin so the pair can never skew.
|
|
11
|
+
* - `codex` is the `@openai/codex` platform-package version the
|
|
12
|
+
* codex-app-server adapter's protocol snapshot was verified against (see
|
|
13
|
+
* AGENTS.md "Verifying harness protocols"). Bump after re-verifying. The pin
|
|
14
|
+
* governs downloads (compiled binaries, bare sandboxes, `pinned` mode); in
|
|
15
|
+
* `auto` an installed `@openai/codex` package (a lockfile's) runs instead,
|
|
16
|
+
* and a `codex` on PATH only in `system` mode.
|
|
17
|
+
*
|
|
18
|
+
* After any bump, run `bun run releases:refresh` (each platform's build and
|
|
19
|
+
* its checksums, `releases.ts`) and `bun run models:refresh` (the model
|
|
20
|
+
* catalog, which records the versions that listed it); tests fail until both
|
|
21
|
+
* match these pins.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_PINS: Record<CliTool, string>;
|
|
24
|
+
//# sourceMappingURL=pins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/pins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAahD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The facts about this machine that pick a CLI build. Injectable in tests. */
|
|
2
|
+
export interface PlatformInfo {
|
|
3
|
+
/** `process.platform` value (darwin | linux | win32 | …). */
|
|
4
|
+
platform: string;
|
|
5
|
+
/** `process.arch` value (arm64 | x64 | …). */
|
|
6
|
+
arch: string;
|
|
7
|
+
/** linux only: glibc absent (Alpine et al.) — selects `-musl` builds. */
|
|
8
|
+
musl: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function detectPlatform(): PlatformInfo;
|
|
11
|
+
/** A platform as the cache and `install --platform` name it: `darwin-arm64`, `linux-x64-musl`. */
|
|
12
|
+
export declare function platformName(p: PlatformInfo): string;
|
|
13
|
+
/** The platform a name from `platformName` stands for (one a vendor publishes: `CliToolSpec.platforms`). */
|
|
14
|
+
export declare function parsePlatform(name: string): PlatformInfo;
|
|
15
|
+
/**
|
|
16
|
+
* Suffix of `@anthropic-ai/claude-agent-sdk-<suffix>` — the platform package
|
|
17
|
+
* carrying the native `claude` binary. Claude ships dedicated musl builds.
|
|
18
|
+
*/
|
|
19
|
+
export declare function claudePackageSuffix(p: PlatformInfo): string;
|
|
20
|
+
/**
|
|
21
|
+
* Suffix of `@openai/codex@<version>-<suffix>` — codex publishes platform
|
|
22
|
+
* builds as version suffixes of the main package. Its linux builds are static
|
|
23
|
+
* (musl) already, so there is no separate musl variant.
|
|
24
|
+
*/
|
|
25
|
+
export declare function codexPackageSuffix(p: PlatformInfo): string;
|
|
26
|
+
/** Locate an executable on PATH (the `which` we can unit-test and run anywhere). */
|
|
27
|
+
export declare function findOnPath(name: string, env?: Record<string, string | undefined>, platform?: string): string | undefined;
|
|
28
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/platform.ts"],"names":[],"mappings":"AAGA,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC5B,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,IAAI,EAAE,OAAO,CAAC;CACd;AAoBD,wBAAgB,cAAc,IAAI,YAAY,CAE7C;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAEpD;AAED,4GAA4G;AAC5G,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAGxD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAE1D;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CACzB,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EACrD,QAAQ,GAAE,MAAyB,GACjC,MAAM,GAAG,SAAS,CAepB"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { type CliReleases } from "./checksums.ts";
|
|
2
|
+
import { type DownloadTimeouts } from "./npm.ts";
|
|
3
|
+
import { type PlatformInfo } from "./platform.ts";
|
|
4
|
+
import { type CliTool } from "./tools.ts";
|
|
5
|
+
/**
|
|
6
|
+
* How CLIs are obtained (see docs/deploy.md). Every mode starts with the
|
|
7
|
+
* operator's override, then the bundle folders:
|
|
8
|
+
* - `auto` (default): → host install (the build beside the installed Claude
|
|
9
|
+
* SDK, an installed `@openai/codex` package) → managed cache → download the
|
|
10
|
+
* pinned build. Zero-config everywhere, self-healing in bare sandboxes, no
|
|
11
|
+
* download when a lockfile already installed the CLI.
|
|
12
|
+
* - `pinned`: → managed cache → download. Never trusts host installs — every
|
|
13
|
+
* process in a fleet runs the exact tested CLI build.
|
|
14
|
+
* - `system`: → host install only (Codex's on `PATH` too; Claude's the SDK
|
|
15
|
+
* finds itself). Never downloads (air-gapped / "my machine, my CLIs").
|
|
16
|
+
*/
|
|
17
|
+
export type ProvisionMode = "auto" | "pinned" | "system";
|
|
18
|
+
export interface ProvisionOptions {
|
|
19
|
+
/** Defaults to `$AGENT_SERVER_PROVISION`, then `auto`. */
|
|
20
|
+
mode?: ProvisionMode;
|
|
21
|
+
/**
|
|
22
|
+
* Where managed CLIs live. Defaults to `$AGENT_SERVER_CACHE_DIR`, then
|
|
23
|
+
* `$XDG_CACHE_HOME/agent-server/cli`, then `~/.cache/agent-server/cli`.
|
|
24
|
+
* A desktop app names a folder of its own, so removing it removes them.
|
|
25
|
+
*/
|
|
26
|
+
cacheDir?: string;
|
|
27
|
+
/** npm registry base URL. Defaults to `$AGENT_SERVER_NPM_REGISTRY`, then npmjs. */
|
|
28
|
+
registry?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Version pins overriding this release's defaults (see `DEFAULT_PINS`). A
|
|
31
|
+
* product that bundles the Claude SDK sets `claude` to the SDK's version:
|
|
32
|
+
* nothing on disk says which one runs.
|
|
33
|
+
*/
|
|
34
|
+
pins?: Partial<Record<CliTool, string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Explicit CLI paths — the operator escape hatch. Defaults to
|
|
37
|
+
* `$CLAUDE_CLI_PATH` / `$CODEX_CLI_PATH`. Never sourced from the wire:
|
|
38
|
+
* letting a remote client pick the spawned executable would be RCE.
|
|
39
|
+
*/
|
|
40
|
+
overrides?: Partial<Record<CliTool, string>>;
|
|
41
|
+
/**
|
|
42
|
+
* Read-only folders in the cache's layout (`agent-server install --dir`):
|
|
43
|
+
* the builds an app bundle or an image ships, used in every mode when they
|
|
44
|
+
* hold the version this engine runs. Defaults to `$AGENT_SERVER_BUNDLE_DIR`
|
|
45
|
+
* (a path list). Operator-level, like the overrides: what they hold runs.
|
|
46
|
+
*/
|
|
47
|
+
bundleDirs?: string[];
|
|
48
|
+
/** Progress/diagnostic lines. Defaults to stderr. */
|
|
49
|
+
log?: (line: string) => void;
|
|
50
|
+
}
|
|
51
|
+
/** Where a resolved CLI came from — logged once so runs are diagnosable. */
|
|
52
|
+
export interface ResolvedCli {
|
|
53
|
+
path: string;
|
|
54
|
+
source: "override" | "bundled" | "host" | "cache" | "downloaded";
|
|
55
|
+
version?: string;
|
|
56
|
+
}
|
|
57
|
+
/** A CLI found where it is: never `downloaded`, which only a resolve that fetched it says. */
|
|
58
|
+
type LocatedCli = ResolvedCli & {
|
|
59
|
+
source: Exclude<ResolvedCli["source"], "downloaded">;
|
|
60
|
+
};
|
|
61
|
+
/** Where one install is. */
|
|
62
|
+
export interface CliProgress {
|
|
63
|
+
tool: CliTool;
|
|
64
|
+
version: string;
|
|
65
|
+
/** `downloading`, then `verifying`, then `ready`; `failed` at any point. */
|
|
66
|
+
phase: "downloading" | "verifying" | "ready" | "failed";
|
|
67
|
+
receivedBytes: number;
|
|
68
|
+
/** The download's size, when the registry states it. */
|
|
69
|
+
totalBytes?: number;
|
|
70
|
+
/** Why it failed. */
|
|
71
|
+
error?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Where a CLI is, found without installing anything. */
|
|
74
|
+
export type CliStatus = ({
|
|
75
|
+
state: "ready";
|
|
76
|
+
} & LocatedCli)
|
|
77
|
+
/** `version` is what an install would fetch; absent where nothing installs (`system`). */
|
|
78
|
+
| {
|
|
79
|
+
state: "missing";
|
|
80
|
+
version?: string;
|
|
81
|
+
} | {
|
|
82
|
+
state: "installing";
|
|
83
|
+
version: string;
|
|
84
|
+
receivedBytes: number;
|
|
85
|
+
totalBytes?: number;
|
|
86
|
+
} | {
|
|
87
|
+
state: "failed";
|
|
88
|
+
version?: string;
|
|
89
|
+
error: string;
|
|
90
|
+
};
|
|
91
|
+
/** Process/machine seams, injectable so the policy is testable offline. */
|
|
92
|
+
export interface ProvisionerDeps {
|
|
93
|
+
fetch?: typeof fetch;
|
|
94
|
+
platform?: PlatformInfo;
|
|
95
|
+
env?: Record<string, string | undefined>;
|
|
96
|
+
extract?: (tgzPath: string, destDir: string) => Promise<void>;
|
|
97
|
+
/** Replace host-install discovery (SDK sibling package, installed package, PATH in `system`). */
|
|
98
|
+
hostResolve?: (tool: CliTool) => ResolvedCli | undefined;
|
|
99
|
+
/** The builds downloads must match (`releases.ts`). */
|
|
100
|
+
releases?: CliReleases;
|
|
101
|
+
timeouts?: DownloadTimeouts;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Resolves the native CLIs the harnesses spawn (`claude`, `codex`) and — in
|
|
105
|
+
* managed modes — downloads the pinned builds from the npm registry into a
|
|
106
|
+
* local cache, checked against this release's table of them (`releases.ts`)
|
|
107
|
+
* and installed atomically (`install-build.ts`), so concurrent processes
|
|
108
|
+
* converge on one copy. What differs per tool is its `CLI_TOOL_SPECS` entry.
|
|
109
|
+
*
|
|
110
|
+
* One instance per runtime; `resolve` is memoized per tool (a failure clears
|
|
111
|
+
* the memo so a transient network error doesn't poison the process).
|
|
112
|
+
*/
|
|
113
|
+
export declare class CliProvisioner {
|
|
114
|
+
private readonly mode;
|
|
115
|
+
private cacheDir;
|
|
116
|
+
private readonly registry;
|
|
117
|
+
/** Explicit pins only; a tool's spec says its default. */
|
|
118
|
+
private readonly pins;
|
|
119
|
+
private readonly overrides;
|
|
120
|
+
private readonly bundleDirs;
|
|
121
|
+
private readonly log;
|
|
122
|
+
private readonly fetch;
|
|
123
|
+
private readonly platform;
|
|
124
|
+
private readonly env;
|
|
125
|
+
private readonly extract;
|
|
126
|
+
private readonly hostResolve;
|
|
127
|
+
private readonly releases;
|
|
128
|
+
private readonly timeouts;
|
|
129
|
+
private readonly memo;
|
|
130
|
+
/** The tools a resolve or install is working on now, by how many. */
|
|
131
|
+
private readonly resolving;
|
|
132
|
+
/** Each tool's download while it runs. */
|
|
133
|
+
private readonly downloads;
|
|
134
|
+
/** Each tool's last failure to resolve, until one succeeds. */
|
|
135
|
+
private readonly failures;
|
|
136
|
+
/** The cache entries this process runs (`<tool>/<entry>`), and when each use was last recorded. */
|
|
137
|
+
private readonly inUse;
|
|
138
|
+
/** Lines said once per process, however often a status asks. */
|
|
139
|
+
private readonly said;
|
|
140
|
+
private readonly observers;
|
|
141
|
+
constructor(options?: ProvisionOptions, deps?: ProvisionerDeps);
|
|
142
|
+
/**
|
|
143
|
+
* Resolve a CLI per the provisioning mode. `undefined` (claude in `system`
|
|
144
|
+
* mode only) means "let the harness's own resolution speak" — the Claude SDK
|
|
145
|
+
* finds its sibling platform package and has the clearest failure message.
|
|
146
|
+
*/
|
|
147
|
+
resolve(tool: CliTool): Promise<ResolvedCli | undefined>;
|
|
148
|
+
/** Warm the managed cache with the pinned build (the `install` command). */
|
|
149
|
+
install(tool: CliTool): Promise<ResolvedCli>;
|
|
150
|
+
/** Every install's progress; returns an unsubscribe. */
|
|
151
|
+
observe(observer: (progress: CliProgress) => void): () => void;
|
|
152
|
+
/**
|
|
153
|
+
* Where `tool` is now, without installing it: ready, being installed,
|
|
154
|
+
* failed the last time it was resolved, or missing (with the version an
|
|
155
|
+
* install would fetch).
|
|
156
|
+
*/
|
|
157
|
+
status(tool: CliTool): Promise<CliStatus>;
|
|
158
|
+
/**
|
|
159
|
+
* Remove cached builds no process used for 14 days, except what this one
|
|
160
|
+
* runs, and what dead installs left — and, as `install --prune` asks,
|
|
161
|
+
* builds written by an agent-server that records no use, by their age.
|
|
162
|
+
* Returns what it removed.
|
|
163
|
+
*/
|
|
164
|
+
prune(): Promise<string[]>;
|
|
165
|
+
private resolveMemo;
|
|
166
|
+
/** Run a resolve or install of `tool`, saying meanwhile that it is installing, and recording how it ended. */
|
|
167
|
+
private working;
|
|
168
|
+
private resolveUncached;
|
|
169
|
+
/** The build `tool` resolves to without a download, per the mode. */
|
|
170
|
+
private locate;
|
|
171
|
+
/** The build of `tool` this engine runs: an explicit pin, else the tool's default. */
|
|
172
|
+
private build;
|
|
173
|
+
/** Pin trusted aliases to their physical location and recheck on every use. */
|
|
174
|
+
private ensureTrustedCacheRoot;
|
|
175
|
+
private ensureInstalled;
|
|
176
|
+
/** Download and install one build, reporting its progress to the observers and the log. */
|
|
177
|
+
private download;
|
|
178
|
+
/**
|
|
179
|
+
* Record that this process runs a cached build, so no prune removes it:
|
|
180
|
+
* now when `now` (it was just found or installed, its record perhaps
|
|
181
|
+
* pruned with it), else at most hourly as it keeps resolving it.
|
|
182
|
+
*/
|
|
183
|
+
private used;
|
|
184
|
+
/** A line said once per process. */
|
|
185
|
+
private say;
|
|
186
|
+
private modeFromEnv;
|
|
187
|
+
}
|
|
188
|
+
export {};
|
|
189
|
+
//# sourceMappingURL=provisioner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provisioner.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/provisioner.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CliReleases } from "./checksums.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The pinned CLIs' builds, by platform: each npm tarball's integrity, and for
|
|
4
|
+
* Claude the binary's sha256 from Anthropic's signed release manifest (its
|
|
5
|
+
* signature verified when this file was generated).
|
|
6
|
+
*/
|
|
7
|
+
export declare const CLI_RELEASES: CliReleases;
|
|
8
|
+
//# sourceMappingURL=releases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"releases.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/releases.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WA4E1B,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { AgentHarness } from "../../protocol/index.ts";
|
|
2
|
+
import type { LocalBuild } from "./checksums.ts";
|
|
3
|
+
import { type PlatformInfo } from "./platform.ts";
|
|
4
|
+
/**
|
|
5
|
+
* The managed CLIs. Each native harness maps onto exactly one of these; the
|
|
6
|
+
* `acp` harness maps onto none (its agent binaries are arbitrary third-party
|
|
7
|
+
* commands the operator supplies, not something we pin or download).
|
|
8
|
+
*/
|
|
9
|
+
export declare const CLI_TOOLS: readonly ["claude", "codex"];
|
|
10
|
+
export type CliTool = (typeof CLI_TOOLS)[number];
|
|
11
|
+
export declare function toolForHarness(harness: AgentHarness): CliTool | undefined;
|
|
12
|
+
/** What to download for one tool on one platform. */
|
|
13
|
+
export interface ToolPackage {
|
|
14
|
+
name: string;
|
|
15
|
+
/** Exact version string the registry knows (codex encodes the platform here). */
|
|
16
|
+
registryVersion: string;
|
|
17
|
+
/** The platform part of the cache directory's name. */
|
|
18
|
+
suffix: string;
|
|
19
|
+
}
|
|
20
|
+
/** Where a host install is looked for. */
|
|
21
|
+
export interface HostMachine {
|
|
22
|
+
platform: PlatformInfo;
|
|
23
|
+
env: Record<string, string | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Whether a binary on `PATH` counts (`system` mode): elsewhere it is no
|
|
26
|
+
* build anyone chose for this engine, and may be another app's private copy.
|
|
27
|
+
*/
|
|
28
|
+
searchPath: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** What the provisioner knows of one managed CLI. */
|
|
31
|
+
export interface CliToolSpec {
|
|
32
|
+
/** The variable an operator points at the binary to run instead (never the wire's). */
|
|
33
|
+
readonly overrideEnv: string;
|
|
34
|
+
/** Where the binary sits in an installed tree; the first regular file wins. */
|
|
35
|
+
readonly binaries: readonly string[];
|
|
36
|
+
/** The platforms the vendor publishes a build for, as the cache names them. */
|
|
37
|
+
readonly platforms: readonly string[];
|
|
38
|
+
/** The registry package carrying this platform's build of `version`. */
|
|
39
|
+
package(platform: PlatformInfo, version: string): ToolPackage;
|
|
40
|
+
/** The version to download when no pin is set. */
|
|
41
|
+
defaultVersion(): string;
|
|
42
|
+
/** Why the default may not be the build that runs, when this machine cannot tell (said once). */
|
|
43
|
+
defaultVersionNote?(): string | undefined;
|
|
44
|
+
/** An install already on this machine, if any. */
|
|
45
|
+
hostInstall(host: HostMachine): {
|
|
46
|
+
path: string;
|
|
47
|
+
version?: string;
|
|
48
|
+
} | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* This platform's binary at `version` as a source on this machine knows
|
|
51
|
+
* it, for a version the release table does not pin: the installed Claude
|
|
52
|
+
* SDK's manifest names its own CLI's sha256.
|
|
53
|
+
*/
|
|
54
|
+
localBuild?(suffix: string, version: string): LocalBuild | undefined;
|
|
55
|
+
/** The directory of an extracted tarball that becomes the install. */
|
|
56
|
+
payload(extractedRoot: string): Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* What `system` mode fails with when the host has none; absent, the
|
|
59
|
+
* harness's own resolution speaks (the Claude SDK finds its sibling
|
|
60
|
+
* platform package and has the clearest failure message).
|
|
61
|
+
*/
|
|
62
|
+
notOnHost?(): Error;
|
|
63
|
+
}
|
|
64
|
+
/** The first regular file of `binaries` under `dir` (lstat: a symlink could redirect the spawn). */
|
|
65
|
+
export declare function binaryIn(dir: string, binaries: readonly string[]): string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* The installed Claude SDK, when resolvable on disk. Its version drives both
|
|
68
|
+
* host resolution and the download pin, so the JS ↔ native-CLI pair can
|
|
69
|
+
* never skew. Unresolvable inside compiled binaries — pins take over there.
|
|
70
|
+
*/
|
|
71
|
+
export declare function claudeSdkOnDisk(): {
|
|
72
|
+
dir: string;
|
|
73
|
+
version?: string;
|
|
74
|
+
} | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* The managed CLIs, one entry each: a new tool fails to compile until it says
|
|
77
|
+
* where its builds come from, where its binary sits and how to find one
|
|
78
|
+
* installed.
|
|
79
|
+
*/
|
|
80
|
+
export declare const CLI_TOOL_SPECS: Record<CliTool, CliToolSpec>;
|
|
81
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../src/core/provision/tools.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EACN,KAAK,YAAY,EAIjB,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,eAAO,MAAM,SAAS,8BAA+B,CAAC;AACtD,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAajD,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS,CAEzE;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;CACf;AAED,0CAA0C;AAC1C,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,YAAY,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;CACpB;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,wEAAwE;IACxE,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9D,kDAAkD;IAClD,cAAc,IAAI,MAAM,CAAC;IACzB,iGAAiG;IACjG,kBAAkB,CAAC,IAAI,MAAM,GAAG,SAAS,CAAC;IAC1C,kDAAkD;IAClD,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IAC/E;;;;OAIG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IACrE,sEAAsE;IACtE,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD;;;;OAIG;IACH,SAAS,CAAC,IAAI,KAAK,CAAC;CACpB;AAED,oGAAoG;AACpG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAYrF;AA8DD;;;;GAIG;AACH,wBAAgB,eAAe,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAS/E;AAmBD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,OAAO,EAAE,WAAW,CAuHvD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type DiagnosticHandler } from "../diagnostics.ts";
|
|
2
|
+
import { type ApiKeyEntry, type ApiKeyStore } from "./api-key-store.ts";
|
|
3
|
+
/** Placeholder key handed to the agent subprocess; swapped for the real one here. */
|
|
4
|
+
export declare const PROXY_PLACEHOLDER_KEY = "sk-proxy-managed";
|
|
5
|
+
/**
|
|
6
|
+
* The `anthropic-beta` capability that must accompany OAuth bearer traffic.
|
|
7
|
+
* Anthropic's gateway guidance: proxies carrying subscription-OAuth requests
|
|
8
|
+
* must advertise this capability or the upstream rejects the bearer token.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ANTHROPIC_OAUTH_BETA = "oauth-2025-04-20";
|
|
11
|
+
/** Minimal fetch shape (`globalThis.fetch` qualifies; injectable for tests/platforms). */
|
|
12
|
+
export type FetchLike = (input: string | URL | Request, init?: RequestInit & {
|
|
13
|
+
duplex?: "half";
|
|
14
|
+
}) => Promise<Response>;
|
|
15
|
+
export interface AnthropicProxyOptions {
|
|
16
|
+
/** Store to resolve real credentials from. Defaults to the shared `apiKeyStore`. */
|
|
17
|
+
store?: ApiKeyStore;
|
|
18
|
+
/** Path prefix the proxy is mounted under. Default `/proxy/anthropic`. */
|
|
19
|
+
pathPrefix?: string;
|
|
20
|
+
/** Fetch implementation (test seam / platform override). Default `globalThis.fetch`. */
|
|
21
|
+
fetch?: FetchLike;
|
|
22
|
+
/** Notified on upstream 401/403 — the STORED key is bad, not the placeholder. */
|
|
23
|
+
onDiagnostic?: DiagnosticHandler;
|
|
24
|
+
/**
|
|
25
|
+
* Asked when the upstream refuses a session's credential (401): answer a
|
|
26
|
+
* fresher one, and the request is sent once more with it. Its body is then
|
|
27
|
+
* read before the first send, to be sent twice.
|
|
28
|
+
*/
|
|
29
|
+
renew?: (sessionId: string, rejected: ApiKeyEntry) => Promise<ApiKeyEntry | undefined>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A framework-agnostic, Web-standard `(Request) => Promise<Response>` handler
|
|
33
|
+
* implementing the BYOK Anthropic proxy. Mount it in any server (Bun, Hono,
|
|
34
|
+
* Workers, Node 18+). Requests come in at `{prefix}/{sessionId}/{...path}`; the
|
|
35
|
+
* handler looks up the real key for `sessionId`, swaps the `x-api-key` header,
|
|
36
|
+
* and forwards to the configured upstream. Responses are NOT passed through
|
|
37
|
+
* verbatim — two host-runtime bugs require reshaping (both hit Claude Code as
|
|
38
|
+
* its API client, found in agnt's production sidecar):
|
|
39
|
+
* - SSE bodies are pumped through a `TransformStream`: Bun's HTTP server
|
|
40
|
+
* mishandles direct ReadableStream passthrough for SSE and the node
|
|
41
|
+
* client sees a premature "terminated".
|
|
42
|
+
* - Non-SSE responses drop `content-encoding`/`content-length`/
|
|
43
|
+
* `transfer-encoding`: fetch already decompressed the body, so the
|
|
44
|
+
* original headers make the client gunzip plain bytes (ZlibError).
|
|
45
|
+
*
|
|
46
|
+
* Point the agent at it with:
|
|
47
|
+
* ANTHROPIC_BASE_URL=http://localhost:PORT/proxy/anthropic/<sessionId>
|
|
48
|
+
* ANTHROPIC_API_KEY=sk-proxy-managed
|
|
49
|
+
* and register the real key via `apiKeyStore.set(sessionId, realKey)`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createAnthropicProxy(options?: AnthropicProxyOptions): (request: Request) => Promise<Response>;
|
|
52
|
+
//# sourceMappingURL=anthropic-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-proxy.d.ts","sourceRoot":"","sources":["../../../../src/core/proxy/anthropic-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAkB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAe,MAAM,oBAAoB,CAAC;AAErF,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAevD,0FAA0F;AAC1F,MAAM,MAAM,SAAS,GAAG,CACvB,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KACpC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,WAAW,qBAAqB;IACrC,oFAAoF;IACpF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iFAAiF;IACjF,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,KAAK,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC;CACvF;AAeD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,GAAE,qBAA0B,GACjC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAoHzC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** How a stored credential is presented to the upstream API. */
|
|
2
|
+
export type ApiCredentialKind = "api_key" | "oauth";
|
|
3
|
+
/** A real upstream credential + base URL, keyed by an opaque proxy session id. */
|
|
4
|
+
export interface ApiKeyEntry {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
upstreamBaseUrl: string;
|
|
7
|
+
/**
|
|
8
|
+
* `api_key` → sent as `x-api-key` (Anthropic API keys).
|
|
9
|
+
* `oauth` → sent as `Authorization: Bearer` with the OAuth capability
|
|
10
|
+
* advertised in `anthropic-beta` (Claude subscription tokens from
|
|
11
|
+
* `claude setup-token`, `sk-ant-oat01-…`).
|
|
12
|
+
*/
|
|
13
|
+
kind: ApiCredentialKind;
|
|
14
|
+
}
|
|
15
|
+
export interface ApiKeyStoreSetOptions {
|
|
16
|
+
upstreamBaseUrl?: string;
|
|
17
|
+
kind?: ApiCredentialKind;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* In-memory map of proxy-session → real credentials. The agent subprocess is
|
|
21
|
+
* given a placeholder key and pointed at the local proxy; the proxy swaps in the
|
|
22
|
+
* real credential from this store before forwarding upstream, so it never lives
|
|
23
|
+
* in the subprocess environment.
|
|
24
|
+
* That no-exfiltration property is exactly why subscription OAuth tokens ride
|
|
25
|
+
* the same store instead of the child env: the child keeps the placeholder
|
|
26
|
+
* either way, only the upstream header shape differs.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ApiKeyStore {
|
|
29
|
+
private readonly entries;
|
|
30
|
+
set(sessionId: string, apiKey: string, options?: ApiKeyStoreSetOptions): void;
|
|
31
|
+
get(sessionId: string): ApiKeyEntry | undefined;
|
|
32
|
+
delete(sessionId: string): void;
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
35
|
+
/** Shared default store used by `createAnthropicProxy` when none is supplied. */
|
|
36
|
+
export declare const apiKeyStore: ApiKeyStore;
|
|
37
|
+
//# sourceMappingURL=api-key-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-store.d.ts","sourceRoot":"","sources":["../../../../src/core/proxy/api-key-store.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpD,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,IAAI,EAAE,iBAAiB,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,iBAAiB,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI;IAQjF,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAI/C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI/B,KAAK,IAAI,IAAI;CAGb;AAED,iFAAiF;AACjF,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type ApiCredentialKind, type ApiKeyEntry, ApiKeyStore, type ApiKeyStoreSetOptions, apiKeyStore, } from "./api-key-store.ts";
|
|
2
|
+
export { ANTHROPIC_OAUTH_BETA, type AnthropicProxyOptions, createAnthropicProxy, PROXY_PLACEHOLDER_KEY, } from "./anthropic-proxy.ts";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/proxy/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,qBAAqB,EAC1B,WAAW,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,sBAAsB,CAAC"}
|