@zvada/agent-server 0.3.18 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -26
- package/CHANGELOG.md +1041 -1
- package/README.md +40 -40
- package/dist/types/accounts/chatgpt.d.ts +34 -0
- package/dist/types/accounts/chatgpt.d.ts.map +1 -0
- package/dist/types/accounts/check.d.ts +24 -0
- package/dist/types/accounts/check.d.ts.map +1 -0
- package/dist/types/accounts/claude.d.ts +21 -0
- package/dist/types/accounts/claude.d.ts.map +1 -0
- package/dist/types/accounts/endpoint.d.ts +50 -0
- package/dist/types/accounts/endpoint.d.ts.map +1 -0
- package/dist/types/accounts/http.d.ts +38 -0
- package/dist/types/accounts/http.d.ts.map +1 -0
- package/dist/types/accounts/index.d.ts +6 -0
- package/dist/types/accounts/index.d.ts.map +1 -0
- package/dist/types/client/client.d.ts +272 -0
- package/dist/types/client/client.d.ts.map +1 -0
- package/dist/types/client/connection.d.ts +160 -0
- package/dist/types/client/connection.d.ts.map +1 -0
- package/dist/types/client/history.d.ts +8 -0
- package/dist/types/client/history.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/listeners.d.ts +8 -0
- package/dist/types/client/listeners.d.ts.map +1 -0
- package/dist/types/client/logins.d.ts +35 -0
- package/dist/types/client/logins.d.ts.map +1 -0
- package/dist/types/client/rpc.d.ts +46 -0
- package/dist/types/client/rpc.d.ts.map +1 -0
- package/dist/types/client/streams.d.ts +150 -0
- package/dist/types/client/streams.d.ts.map +1 -0
- package/dist/types/client/transports.d.ts +35 -0
- package/dist/types/client/transports.d.ts.map +1 -0
- package/dist/types/client/turns.d.ts +81 -0
- package/dist/types/client/turns.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +68 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -0
- package/dist/types/core/agents/acp/adapter.d.ts +39 -0
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/acp/client.d.ts +90 -0
- package/dist/types/core/agents/acp/client.d.ts.map +1 -0
- package/dist/types/core/agents/acp/known-agents.d.ts +35 -0
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -0
- package/dist/types/core/agents/acp/mappings.d.ts +46 -0
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +26 -0
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -0
- package/dist/types/core/agents/attachments.d.ts +11 -0
- package/dist/types/core/agents/attachments.d.ts.map +1 -0
- package/dist/types/core/agents/base.d.ts +227 -0
- package/dist/types/core/agents/base.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts +58 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts +26 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +70 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts +54 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/events.d.ts +42 -0
- package/dist/types/core/agents/claude-code/events.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/login.d.ts +61 -0
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts +52 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/models.d.ts +30 -0
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/options.d.ts +183 -0
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts +50 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts +36 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session.d.ts +148 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts +29 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spend.d.ts +58 -0
- package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/tools.d.ts +4 -0
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts +52 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn.d.ts +121 -0
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts +59 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts +116 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +113 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts +66 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts +49 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts +12 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts +45 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts +20 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts +26 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts +31 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts +38 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +62 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts +67 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts +40 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +19 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts +99 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts +42 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts +96 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts +53 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +87 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts +33 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts +163 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -0
- package/dist/types/core/agents/config-fingerprint.d.ts +5 -0
- package/dist/types/core/agents/config-fingerprint.d.ts.map +1 -0
- package/dist/types/core/agents/credentials.d.ts +28 -0
- package/dist/types/core/agents/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/elicitation.d.ts +37 -0
- package/dist/types/core/agents/elicitation.d.ts.map +1 -0
- package/dist/types/core/agents/inherit-config.d.ts +18 -0
- package/dist/types/core/agents/inherit-config.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +67 -0
- package/dist/types/core/agents/login.d.ts.map +1 -0
- package/dist/types/core/agents/mcp-config.d.ts +57 -0
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -0
- package/dist/types/core/agents/plan.d.ts +16 -0
- package/dist/types/core/agents/plan.d.ts.map +1 -0
- package/dist/types/core/agents/registry.d.ts +30 -0
- package/dist/types/core/agents/registry.d.ts.map +1 -0
- package/dist/types/core/agents/session-agent.d.ts +48 -0
- package/dist/types/core/agents/session-agent.d.ts.map +1 -0
- package/dist/types/core/agents/session-pool.d.ts +41 -0
- package/dist/types/core/agents/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/stderr-tail.d.ts +28 -0
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -0
- package/dist/types/core/agents/thinking-levels.d.ts +4 -0
- package/dist/types/core/agents/thinking-levels.d.ts.map +1 -0
- package/dist/types/core/agents/types.d.ts +124 -0
- package/dist/types/core/agents/types.d.ts.map +1 -0
- package/dist/types/core/diagnostics.d.ts +36 -0
- package/dist/types/core/diagnostics.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +29 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/presets.d.ts +80 -0
- package/dist/types/core/presets.d.ts.map +1 -0
- package/dist/types/core/processes/identity.d.ts +31 -0
- package/dist/types/core/processes/identity.d.ts.map +1 -0
- package/dist/types/core/processes/lifeline.d.ts +47 -0
- package/dist/types/core/processes/lifeline.d.ts.map +1 -0
- package/dist/types/core/processes/native-processes.d.ts +130 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -0
- package/dist/types/core/processes/process-table.d.ts +43 -0
- package/dist/types/core/processes/process-table.d.ts.map +1 -0
- package/dist/types/core/provision/cache-trust.d.ts +13 -0
- package/dist/types/core/provision/cache-trust.d.ts.map +1 -0
- package/dist/types/core/provision/cache-usage.d.ts +14 -0
- package/dist/types/core/provision/cache-usage.d.ts.map +1 -0
- package/dist/types/core/provision/checksums.d.ts +46 -0
- package/dist/types/core/provision/checksums.d.ts.map +1 -0
- package/dist/types/core/provision/extract.d.ts +7 -0
- package/dist/types/core/provision/extract.d.ts.map +1 -0
- package/dist/types/core/provision/index.d.ts +5 -0
- package/dist/types/core/provision/index.d.ts.map +1 -0
- package/dist/types/core/provision/install-build.d.ts +36 -0
- package/dist/types/core/provision/install-build.d.ts.map +1 -0
- package/dist/types/core/provision/npm.d.ts +40 -0
- package/dist/types/core/provision/npm.d.ts.map +1 -0
- package/dist/types/core/provision/pins.d.ts +24 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -0
- package/dist/types/core/provision/platform.d.ts +28 -0
- package/dist/types/core/provision/platform.d.ts.map +1 -0
- package/dist/types/core/provision/provisioner.d.ts +189 -0
- package/dist/types/core/provision/provisioner.d.ts.map +1 -0
- package/dist/types/core/provision/releases.d.ts +8 -0
- package/dist/types/core/provision/releases.d.ts.map +1 -0
- package/dist/types/core/provision/tools.d.ts +81 -0
- package/dist/types/core/provision/tools.d.ts.map +1 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts +52 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts.map +1 -0
- package/dist/types/core/proxy/api-key-store.d.ts +37 -0
- package/dist/types/core/proxy/api-key-store.d.ts.map +1 -0
- package/dist/types/core/proxy/index.d.ts +3 -0
- package/dist/types/core/proxy/index.d.ts.map +1 -0
- package/dist/types/core/proxy/loopback.d.ts +14 -0
- package/dist/types/core/proxy/loopback.d.ts.map +1 -0
- package/dist/types/core/runtime/agent-runtime.d.ts +181 -0
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -0
- package/dist/types/core/runtime/event-processor.d.ts +87 -0
- package/dist/types/core/runtime/event-processor.d.ts.map +1 -0
- package/dist/types/core/runtime/event-sink.d.ts +44 -0
- package/dist/types/core/runtime/event-sink.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-clis.d.ts +10 -0
- package/dist/types/core/runtime/harness-clis.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-logins.d.ts +68 -0
- package/dist/types/core/runtime/harness-logins.d.ts.map +1 -0
- package/dist/types/core/runtime/login-reads.d.ts +28 -0
- package/dist/types/core/runtime/login-reads.d.ts.map +1 -0
- package/dist/types/core/runtime/model-lists.d.ts +37 -0
- package/dist/types/core/runtime/model-lists.d.ts.map +1 -0
- package/dist/types/core/runtime/permission-policy.d.ts +61 -0
- package/dist/types/core/runtime/permission-policy.d.ts.map +1 -0
- package/dist/types/core/runtime/request-broker.d.ts +49 -0
- package/dist/types/core/runtime/request-broker.d.ts.map +1 -0
- package/dist/types/core/runtime/steering.d.ts +38 -0
- package/dist/types/core/runtime/steering.d.ts.map +1 -0
- package/dist/types/core/runtime/turn-outcome.d.ts +21 -0
- package/dist/types/core/runtime/turn-outcome.d.ts.map +1 -0
- package/dist/types/core/runtime/turn.d.ts +121 -0
- package/dist/types/core/runtime/turn.d.ts.map +1 -0
- package/dist/types/core/utils/bounded.d.ts +6 -0
- package/dist/types/core/utils/bounded.d.ts.map +1 -0
- package/dist/types/core/utils/deadline.d.ts +14 -0
- package/dist/types/core/utils/deadline.d.ts.map +1 -0
- package/dist/types/core/utils/errors.d.ts +104 -0
- package/dist/types/core/utils/errors.d.ts.map +1 -0
- package/dist/types/core/utils/is-record.d.ts +3 -0
- package/dist/types/core/utils/is-record.d.ts.map +1 -0
- package/dist/types/core/utils/loopback.d.ts +6 -0
- package/dist/types/core/utils/loopback.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/protocol/account.d.ts +26 -0
- package/dist/types/protocol/account.d.ts.map +1 -0
- package/dist/types/protocol/async-queue.d.ts +21 -0
- package/dist/types/protocol/async-queue.d.ts.map +1 -0
- package/dist/types/protocol/auth.d.ts +228 -0
- package/dist/types/protocol/auth.d.ts.map +1 -0
- package/dist/types/protocol/canonical.d.ts +9 -0
- package/dist/types/protocol/canonical.d.ts.map +1 -0
- package/dist/types/protocol/clis.d.ts +74 -0
- package/dist/types/protocol/clis.d.ts.map +1 -0
- package/dist/types/protocol/config.d.ts +200 -0
- package/dist/types/protocol/config.d.ts.map +1 -0
- package/dist/types/protocol/conversation.d.ts +942 -0
- package/dist/types/protocol/conversation.d.ts.map +1 -0
- package/dist/types/protocol/credentials.d.ts +145 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -0
- package/dist/types/protocol/errors.d.ts +36 -0
- package/dist/types/protocol/errors.d.ts.map +1 -0
- package/dist/types/protocol/execution.d.ts +28 -0
- package/dist/types/protocol/execution.d.ts.map +1 -0
- package/dist/types/protocol/factories.d.ts +94 -0
- package/dist/types/protocol/factories.d.ts.map +1 -0
- package/dist/types/protocol/guards.d.ts +55 -0
- package/dist/types/protocol/guards.d.ts.map +1 -0
- package/dist/types/protocol/harness.d.ts +70 -0
- package/dist/types/protocol/harness.d.ts.map +1 -0
- package/dist/types/protocol/history.d.ts +318 -0
- package/dist/types/protocol/history.d.ts.map +1 -0
- package/dist/types/protocol/ids.d.ts +9 -0
- package/dist/types/protocol/ids.d.ts.map +1 -0
- package/dist/types/protocol/index.d.ts +35 -0
- package/dist/types/protocol/index.d.ts.map +1 -0
- package/dist/types/protocol/lifecycle.d.ts +1190 -0
- package/dist/types/protocol/lifecycle.d.ts.map +1 -0
- package/dist/types/protocol/meta-keys.d.ts +17 -0
- package/dist/types/protocol/meta-keys.d.ts.map +1 -0
- package/dist/types/protocol/meta.d.ts +13 -0
- package/dist/types/protocol/meta.d.ts.map +1 -0
- package/dist/types/protocol/model-catalog.d.ts +11 -0
- package/dist/types/protocol/model-catalog.d.ts.map +1 -0
- package/dist/types/protocol/models.d.ts +107 -0
- package/dist/types/protocol/models.d.ts.map +1 -0
- package/dist/types/protocol/part-input.d.ts +101 -0
- package/dist/types/protocol/part-input.d.ts.map +1 -0
- package/dist/types/protocol/parts.d.ts +357 -0
- package/dist/types/protocol/parts.d.ts.map +1 -0
- package/dist/types/protocol/reduce.d.ts +26 -0
- package/dist/types/protocol/reduce.d.ts.map +1 -0
- package/dist/types/protocol/selectors.d.ts +64 -0
- package/dist/types/protocol/selectors.d.ts.map +1 -0
- package/dist/types/protocol/seq-cursor.d.ts +66 -0
- package/dist/types/protocol/seq-cursor.d.ts.map +1 -0
- package/dist/types/protocol/stop-reasons.d.ts +33 -0
- package/dist/types/protocol/stop-reasons.d.ts.map +1 -0
- package/dist/types/protocol/thinking.d.ts +28 -0
- package/dist/types/protocol/thinking.d.ts.map +1 -0
- package/dist/types/protocol/time.d.ts +21 -0
- package/dist/types/protocol/time.d.ts.map +1 -0
- package/dist/types/protocol/tokens.d.ts +29 -0
- package/dist/types/protocol/tokens.d.ts.map +1 -0
- package/dist/types/protocol/tool-closure.d.ts +25 -0
- package/dist/types/protocol/tool-closure.d.ts.map +1 -0
- package/dist/types/protocol/tool-state.d.ts +209 -0
- package/dist/types/protocol/tool-state.d.ts.map +1 -0
- package/dist/types/protocol/verify.d.ts +52 -0
- package/dist/types/protocol/verify.d.ts.map +1 -0
- package/dist/types/protocol/vocabulary.d.ts +19 -0
- package/dist/types/protocol/vocabulary.d.ts.map +1 -0
- package/dist/types/protocol/wire-api.d.ts +1983 -0
- package/dist/types/protocol/wire-api.d.ts.map +1 -0
- package/dist/types/protocol/wire.d.ts +1758 -0
- package/dist/types/protocol/wire.d.ts.map +1 -0
- package/dist/types/server/acp/binding.d.ts +33 -0
- package/dist/types/server/acp/binding.d.ts.map +1 -0
- package/dist/types/server/acp/session-records.d.ts +17 -0
- package/dist/types/server/acp/session-records.d.ts.map +1 -0
- package/dist/types/server/acp/translate.d.ts +48 -0
- package/dist/types/server/acp/translate.d.ts.map +1 -0
- package/dist/types/server/agent-server.d.ts +121 -0
- package/dist/types/server/agent-server.d.ts.map +1 -0
- package/dist/types/server/feedback.d.ts +37 -0
- package/dist/types/server/feedback.d.ts.map +1 -0
- package/dist/types/server/history.d.ts +15 -0
- package/dist/types/server/history.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/install.d.ts +42 -0
- package/dist/types/server/install.d.ts.map +1 -0
- package/dist/types/server/open-parts.d.ts +27 -0
- package/dist/types/server/open-parts.d.ts.map +1 -0
- package/dist/types/server/routes.d.ts +61 -0
- package/dist/types/server/routes.d.ts.map +1 -0
- package/dist/types/server/secrets.d.ts +11 -0
- package/dist/types/server/secrets.d.ts.map +1 -0
- package/dist/types/server/session-gate.d.ts +32 -0
- package/dist/types/server/session-gate.d.ts.map +1 -0
- package/dist/types/server/session-log.d.ts +39 -0
- package/dist/types/server/session-log.d.ts.map +1 -0
- package/dist/types/server/session-store.d.ts +119 -0
- package/dist/types/server/session-store.d.ts.map +1 -0
- package/dist/types/server/subscriptions.d.ts +74 -0
- package/dist/types/server/subscriptions.d.ts.map +1 -0
- package/dist/types/server/transports.d.ts +74 -0
- package/dist/types/server/transports.d.ts.map +1 -0
- package/dist/types/server/wire-error.d.ts +9 -0
- package/dist/types/server/wire-error.d.ts.map +1 -0
- package/dist/types/sync/event-log.d.ts +45 -0
- package/dist/types/sync/event-log.d.ts.map +1 -0
- package/dist/types/sync/fit.d.ts +40 -0
- package/dist/types/sync/fit.d.ts.map +1 -0
- package/dist/types/sync/history-reader.d.ts +8 -0
- package/dist/types/sync/history-reader.d.ts.map +1 -0
- package/dist/types/sync/history-sqlite.d.ts +37 -0
- package/dist/types/sync/history-sqlite.d.ts.map +1 -0
- package/dist/types/sync/history.d.ts +70 -0
- package/dist/types/sync/history.d.ts.map +1 -0
- package/dist/types/sync/index.d.ts +4 -0
- package/dist/types/sync/index.d.ts.map +1 -0
- package/dist/types/sync/journal-sqlite.d.ts +51 -0
- package/dist/types/sync/journal-sqlite.d.ts.map +1 -0
- package/dist/types/sync/journal.d.ts +107 -0
- package/dist/types/sync/journal.d.ts.map +1 -0
- package/dist/types/sync/live-tails.d.ts +30 -0
- package/dist/types/sync/live-tails.d.ts.map +1 -0
- package/dist/types/sync/node-sqlite.d.ts +7 -0
- package/dist/types/sync/node-sqlite.d.ts.map +1 -0
- package/dist/types/sync/projection.d.ts +10 -0
- package/dist/types/sync/projection.d.ts.map +1 -0
- package/dist/types/sync/recovery.d.ts +25 -0
- package/dist/types/sync/recovery.d.ts.map +1 -0
- package/dist/types/sync/retry.d.ts +25 -0
- package/dist/types/sync/retry.d.ts.map +1 -0
- package/dist/types/sync/schema.d.ts +4 -0
- package/dist/types/sync/schema.d.ts.map +1 -0
- package/dist/types/sync/sql.d.ts +38 -0
- package/dist/types/sync/sql.d.ts.map +1 -0
- package/dist/types/sync/sqlite-file.d.ts +9 -0
- package/dist/types/sync/sqlite-file.d.ts.map +1 -0
- package/dist/types/sync/sqlite.d.ts +6 -0
- package/dist/types/sync/sqlite.d.ts.map +1 -0
- package/dist/types/sync/worker.d.ts +63 -0
- package/dist/types/sync/worker.d.ts.map +1 -0
- package/docs/consuming.md +452 -53
- package/docs/deploy.md +218 -47
- package/docs/{sync-experiment.md → durable-sessions.md} +77 -72
- package/docs/feedback.md +116 -0
- package/docs/harnesses.md +212 -88
- package/docs/sync-history.md +29 -13
- package/docs/sync-integration.md +52 -66
- package/package.json +45 -28
- package/src/accounts/chatgpt.ts +194 -0
- package/src/accounts/check.ts +112 -0
- package/src/accounts/claude.ts +111 -0
- package/src/accounts/endpoint.ts +151 -0
- package/src/accounts/http.ts +97 -0
- package/src/accounts/index.ts +19 -0
- package/src/client/client.ts +604 -670
- package/src/client/connection.ts +371 -0
- package/src/client/history.ts +29 -52
- package/src/client/index.ts +11 -2
- package/src/client/listeners.ts +20 -0
- package/src/client/logins.ts +105 -0
- package/src/client/rpc.ts +155 -0
- package/src/client/streams.ts +488 -0
- package/src/client/transports.ts +62 -8
- package/src/client/turns.ts +171 -0
- package/src/core/agents/acp/acp-agent.ts +94 -118
- package/src/core/agents/acp/adapter.ts +20 -9
- package/src/core/agents/acp/client.ts +125 -47
- package/src/core/agents/acp/known-agents.ts +36 -4
- package/src/core/agents/acp/mappings.ts +64 -18
- package/src/core/agents/acp/requests.ts +125 -0
- package/src/core/agents/attachments.ts +18 -0
- package/src/core/agents/base.ts +120 -42
- package/src/core/agents/claude-code/adapter.ts +177 -238
- package/src/core/agents/claude-code/approvals.ts +270 -0
- package/src/core/agents/claude-code/claude-agent.ts +175 -158
- package/src/core/agents/claude-code/credentials.ts +171 -0
- package/src/core/agents/claude-code/events.ts +55 -0
- package/src/core/agents/claude-code/login.ts +269 -0
- package/src/core/agents/claude-code/mcp.ts +206 -0
- package/src/core/agents/claude-code/models.ts +15 -9
- package/src/core/agents/claude-code/options.ts +326 -39
- package/src/core/agents/claude-code/outcome.ts +209 -0
- package/src/core/agents/claude-code/session-pool.ts +136 -0
- package/src/core/agents/claude-code/session.ts +513 -0
- package/src/core/agents/claude-code/spawn.ts +144 -0
- package/src/core/agents/claude-code/spend.ts +160 -0
- package/src/core/agents/claude-code/tools.ts +47 -0
- package/src/core/agents/claude-code/turn-usage.ts +135 -0
- package/src/core/agents/claude-code/turn.ts +232 -0
- package/src/core/agents/codex-app-server/adapter.ts +314 -117
- package/src/core/agents/codex-app-server/client.ts +186 -84
- package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
- package/src/core/agents/codex-app-server/commands.ts +228 -0
- package/src/core/agents/codex-app-server/credentials.ts +126 -0
- package/src/core/agents/codex-app-server/effort.ts +29 -0
- package/src/core/agents/codex-app-server/events.ts +47 -0
- package/src/core/agents/codex-app-server/homes.ts +64 -0
- package/src/core/agents/codex-app-server/input.ts +60 -0
- package/src/core/agents/codex-app-server/items.ts +149 -0
- package/src/core/agents/codex-app-server/login.ts +180 -0
- package/src/core/agents/codex-app-server/mcp.ts +182 -37
- package/src/core/agents/codex-app-server/models.ts +99 -46
- package/src/core/agents/codex-app-server/options.ts +146 -0
- package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
- package/src/core/agents/codex-app-server/protocol.ts +117 -0
- package/src/core/agents/codex-app-server/requests.ts +332 -0
- package/src/core/agents/codex-app-server/session.ts +285 -0
- package/src/core/agents/codex-app-server/subagents.ts +108 -42
- package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
- package/src/core/agents/codex-app-server/turn-items.ts +88 -0
- package/src/core/agents/codex-app-server/turn.ts +463 -0
- package/src/core/agents/config-fingerprint.ts +7 -14
- package/src/core/agents/credentials.ts +98 -0
- package/src/core/agents/elicitation.ts +75 -0
- package/src/core/agents/inherit-config.ts +21 -0
- package/src/core/agents/login.ts +116 -0
- package/src/core/agents/mcp-config.ts +112 -8
- package/src/core/agents/plan.ts +25 -0
- package/src/core/agents/registry.ts +21 -4
- package/src/core/agents/session-agent.ts +96 -4
- package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
- package/src/core/agents/stderr-tail.ts +75 -0
- package/src/core/agents/types.ts +40 -5
- package/src/core/index.ts +58 -48
- package/src/core/presets.ts +100 -39
- package/src/core/processes/identity.ts +113 -0
- package/src/core/processes/lifeline.ts +170 -0
- package/src/core/processes/native-processes.ts +379 -0
- package/src/core/processes/process-table.ts +174 -0
- package/src/core/provision/cache-trust.ts +121 -0
- package/src/core/provision/cache-usage.ts +69 -0
- package/src/core/provision/checksums.ts +64 -0
- package/src/core/provision/extract.ts +11 -2
- package/src/core/provision/index.ts +4 -1
- package/src/core/provision/install-build.ts +136 -0
- package/src/core/provision/npm.ts +112 -17
- package/src/core/provision/pins.ts +9 -33
- package/src/core/provision/platform.ts +12 -1
- package/src/core/provision/provisioner.ts +329 -397
- package/src/core/provision/releases.ts +86 -0
- package/src/core/provision/tools.ts +329 -0
- package/src/core/proxy/anthropic-proxy.ts +55 -25
- package/src/core/proxy/api-key-store.ts +2 -12
- package/src/core/proxy/loopback.ts +106 -0
- package/src/core/runtime/agent-runtime.ts +327 -498
- package/src/core/runtime/event-processor.ts +197 -70
- package/src/core/runtime/harness-clis.ts +61 -0
- package/src/core/runtime/harness-logins.ts +328 -0
- package/src/core/runtime/login-reads.ts +78 -0
- package/src/core/runtime/model-lists.ts +33 -48
- package/src/core/runtime/permission-policy.ts +113 -0
- package/src/core/runtime/request-broker.ts +204 -0
- package/src/core/runtime/steering.ts +112 -0
- package/src/core/runtime/turn-outcome.ts +30 -0
- package/src/core/runtime/turn.ts +360 -0
- package/src/core/utils/bounded.ts +12 -0
- package/src/core/utils/deadline.ts +38 -0
- package/src/core/utils/errors.ts +113 -21
- package/src/core/utils/is-record.ts +4 -0
- package/src/core/utils/loopback.ts +10 -0
- package/src/protocol/account.ts +104 -0
- package/src/protocol/auth.ts +199 -0
- package/src/protocol/canonical.ts +16 -0
- package/src/protocol/clis.ts +69 -0
- package/src/protocol/config.ts +60 -6
- package/src/protocol/conversation.ts +272 -0
- package/src/protocol/credentials.ts +145 -0
- package/src/protocol/errors.ts +78 -20
- package/src/protocol/execution.ts +5 -2
- package/src/protocol/factories.ts +55 -7
- package/src/protocol/guards.ts +55 -2
- package/src/protocol/harness.ts +56 -6
- package/src/protocol/history.ts +72 -64
- package/src/protocol/ids.ts +0 -12
- package/src/protocol/index.ts +9 -0
- package/src/protocol/lifecycle.ts +250 -79
- package/src/protocol/meta-keys.ts +17 -0
- package/src/protocol/meta.ts +3 -3
- package/src/protocol/models.ts +2 -43
- package/src/protocol/part-input.ts +2 -1
- package/src/protocol/parts.ts +12 -3
- package/src/protocol/reduce.ts +302 -413
- package/src/protocol/selectors.ts +1 -20
- package/src/protocol/seq-cursor.ts +14 -0
- package/src/protocol/stop-reasons.ts +1 -1
- package/src/protocol/thinking.ts +1 -30
- package/src/protocol/time.ts +2 -2
- package/src/protocol/tool-closure.ts +93 -0
- package/src/protocol/tool-state.ts +19 -4
- package/src/protocol/verify.ts +222 -92
- package/src/protocol/vocabulary.ts +21 -5
- package/src/protocol/wire-api.ts +232 -0
- package/src/protocol/wire.ts +351 -64
- package/src/server/acp/binding.ts +63 -103
- package/src/server/acp/session-records.ts +53 -0
- package/src/server/acp/translate.ts +129 -20
- package/src/server/agent-server.ts +223 -387
- package/src/server/bin.ts +280 -78
- package/src/server/feedback.ts +204 -14
- package/src/server/history.ts +116 -122
- package/src/server/index.ts +3 -8
- package/src/server/install.ts +107 -8
- package/src/server/open-parts.ts +95 -0
- package/src/server/routes.ts +391 -0
- package/src/server/secrets.ts +24 -0
- package/src/server/session-gate.ts +69 -0
- package/src/server/session-log.ts +14 -2
- package/src/server/session-store.ts +136 -72
- package/src/server/subscriptions.ts +232 -0
- package/src/server/transports.ts +125 -25
- package/src/server/wire-error.ts +31 -45
- package/src/sync/event-log.ts +31 -3
- package/src/sync/fit.ts +27 -11
- package/src/sync/history-reader.ts +10 -5
- package/src/sync/history-sqlite.ts +37 -42
- package/src/sync/history.ts +9 -15
- package/src/sync/index.ts +17 -5
- package/src/sync/journal-sqlite.ts +162 -76
- package/src/sync/journal.ts +91 -32
- package/src/sync/live-tails.ts +107 -0
- package/src/sync/projection.ts +35 -0
- package/src/sync/recovery.ts +80 -51
- package/src/sync/schema.ts +27 -6
- package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
- package/docs/rfds/0002-native-subagents.md +0 -197
- package/src/client/request.ts +0 -19
- package/src/core/agents/claude-code/generator-session.ts +0 -572
- package/src/core/agents/claude-code/session-manager.ts +0 -166
- package/src/core/agents/codex-app-server/codex-app-server-agent.ts +0 -962
- package/src/core/agents/codex-items.ts +0 -149
- package/src/core/agents/codex-sdk/adapter.ts +0 -237
- package/src/core/agents/codex-sdk/codex-sdk-agent.ts +0 -330
- package/src/core/agents/tool-meta.ts +0 -68
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Who a login is, wherever it lives: the CLI's own (`auth.ts`, LLP 0011) or
|
|
2
|
+
// one a product holds (`credentials.ts`, LLP 0012). Never secret.
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { HarnessAuth } from "./auth.ts";
|
|
5
|
+
import type { CredentialGrant } from "./credentials.ts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Who a harness runs as, wherever its login lives: the CLI's own
|
|
9
|
+
* (`auth/status`) or one a product holds (`CredentialGrant`). Never secret.
|
|
10
|
+
*/
|
|
11
|
+
export const AccountInfoSchema = z.object({
|
|
12
|
+
/** Who serves the model: `anthropic`, `openai`, `bedrock`, `vertex`, `foundry`, …. */
|
|
13
|
+
provider: z.string().optional(),
|
|
14
|
+
/** The account, where the provider says it. */
|
|
15
|
+
email: z.string().optional(),
|
|
16
|
+
organization: z.string().optional(),
|
|
17
|
+
/** The plan a subscription is on, as the provider names it (`max`, `pro`, `plus`, …). */
|
|
18
|
+
plan: z.string().optional(),
|
|
19
|
+
});
|
|
20
|
+
export type AccountInfo = z.infer<typeof AccountInfoSchema>;
|
|
21
|
+
|
|
22
|
+
/** What each harness's subscriptions are called, by the plan its provider names. */
|
|
23
|
+
const PLANS: Partial<Record<string, { product: string; plans: Record<string, string> }>> = {
|
|
24
|
+
"claude-code": {
|
|
25
|
+
product: "Claude",
|
|
26
|
+
plans: { free: "Free", pro: "Pro", max: "Max", team: "Team", enterprise: "Enterprise" },
|
|
27
|
+
},
|
|
28
|
+
"codex-app-server": {
|
|
29
|
+
product: "ChatGPT",
|
|
30
|
+
plans: {
|
|
31
|
+
free: "Free",
|
|
32
|
+
go: "Go",
|
|
33
|
+
plus: "Plus",
|
|
34
|
+
pro: "Pro",
|
|
35
|
+
team: "Team",
|
|
36
|
+
business: "Business",
|
|
37
|
+
enterprise: "Enterprise",
|
|
38
|
+
edu: "Edu",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const KEYS: Partial<Record<string, string>> = {
|
|
43
|
+
"claude-code": "Anthropic API key",
|
|
44
|
+
"codex-app-server": "OpenAI API key",
|
|
45
|
+
};
|
|
46
|
+
const CLOUDS: Partial<Record<string, string>> = {
|
|
47
|
+
bedrock: "Amazon Bedrock",
|
|
48
|
+
vertex: "Google Vertex AI",
|
|
49
|
+
foundry: "Microsoft Foundry",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* What to call a login, the same wherever it lives: `Claude Max`, `ChatGPT
|
|
54
|
+
* Pro`, `Claude subscription` (plan unknown), `OpenAI API key`, `Amazon
|
|
55
|
+
* Bedrock`. A plan this table does not know shows as the provider names it.
|
|
56
|
+
*/
|
|
57
|
+
export function accountLabel(
|
|
58
|
+
harness: string,
|
|
59
|
+
login: Pick<HarnessAuth, "credential" | "plan" | "provider">,
|
|
60
|
+
): string | undefined {
|
|
61
|
+
if (login.credential === "api_key") return KEYS[harness] ?? "API key";
|
|
62
|
+
if (login.credential === "cloud")
|
|
63
|
+
return login.provider && (CLOUDS[login.provider] ?? login.provider);
|
|
64
|
+
if (login.credential !== "subscription") return undefined;
|
|
65
|
+
const names = PLANS[harness];
|
|
66
|
+
if (!names) return login.plan;
|
|
67
|
+
const plan = login.plan && (names.plans[login.plan] ?? login.plan);
|
|
68
|
+
return plan ? `${names.product} ${plan}` : `${names.product} subscription`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Who serves each harness's models, where a grant does not say. */
|
|
72
|
+
const PROVIDERS: Partial<Record<string, string>> = {
|
|
73
|
+
"claude-code": "anthropic",
|
|
74
|
+
"codex-app-server": "openai",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A login the product holds, as `auth/status` says one, without its secret:
|
|
79
|
+
* a product shows both kinds with one view.
|
|
80
|
+
*/
|
|
81
|
+
export function grantAuth(grant: CredentialGrant): HarnessAuth {
|
|
82
|
+
const { harness, credential } = grant;
|
|
83
|
+
const gateway = credential.type === "api_key" && credential.baseUrl !== undefined;
|
|
84
|
+
const provider = grant.provider ?? (gateway ? undefined : PROVIDERS[harness]);
|
|
85
|
+
const plan = grant.plan ?? (credential.type === "chatgpt" ? credential.plan : undefined);
|
|
86
|
+
const login = {
|
|
87
|
+
credential: credential.type === "api_key" ? "api_key" : "subscription",
|
|
88
|
+
...(provider && { provider }),
|
|
89
|
+
...(plan && { plan }),
|
|
90
|
+
};
|
|
91
|
+
const label = accountLabel(harness, login);
|
|
92
|
+
return {
|
|
93
|
+
harness,
|
|
94
|
+
state: "signed_in",
|
|
95
|
+
source: "product",
|
|
96
|
+
...login,
|
|
97
|
+
...(grant.email && { email: grant.email }),
|
|
98
|
+
...(grant.organization && { organization: grant.organization }),
|
|
99
|
+
...(label && { label }),
|
|
100
|
+
...(credential.type !== "api_key" &&
|
|
101
|
+
credential.expiresAt !== undefined && { expiresAt: credential.expiresAt }),
|
|
102
|
+
methods: [],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AccountInfoSchema } from "./account.ts";
|
|
3
|
+
import { AgentHarnessSchema, HarnessIdSchema } from "./harness.ts";
|
|
4
|
+
import { openVocabulary } from "./vocabulary.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Whether a harness's turns can authenticate:
|
|
8
|
+
* - `signed_in` — they run with `credential`;
|
|
9
|
+
* - `signed_out` — they would fail: log in with one of `methods`, or give
|
|
10
|
+
* each turn an `apiKey`;
|
|
11
|
+
* - `unknown` — the CLI could not say, `error` says why.
|
|
12
|
+
* OPEN: treat a state this build does not know as `unknown`.
|
|
13
|
+
*/
|
|
14
|
+
export const AUTH_STATES = ["signed_in", "signed_out", "unknown"] as const;
|
|
15
|
+
export type AuthState = (typeof AUTH_STATES)[number] | (string & {});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* What kind of credential a signed-in harness's turns run on: a
|
|
19
|
+
* `subscription` (a Claude or ChatGPT plan, also as a token such as
|
|
20
|
+
* `CLAUDE_CODE_OAUTH_TOKEN`; `source` says where it comes from), an
|
|
21
|
+
* `api_key`, or a `cloud` provider's credentials (Bedrock, Vertex, Foundry).
|
|
22
|
+
* OPEN.
|
|
23
|
+
*/
|
|
24
|
+
export const AUTH_CREDENTIALS = ["subscription", "api_key", "cloud"] as const;
|
|
25
|
+
export type AuthCredential = (typeof AUTH_CREDENTIALS)[number] | (string & {});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Where that credential comes from: the CLI's own `login` (what `auth/login`
|
|
29
|
+
* and the CLI's login command store), the server's `environment`, which wins
|
|
30
|
+
* over a login, the CLI's `settings` (Claude's `apiKeyHelper`), or the
|
|
31
|
+
* `product`, which holds it and hands it to each turn (`grantAuth`). A turn's
|
|
32
|
+
* own `apiKey` wins over the first three. OPEN.
|
|
33
|
+
*/
|
|
34
|
+
export const AUTH_SOURCES = ["login", "environment", "settings", "product"] as const;
|
|
35
|
+
export type AuthSource = (typeof AUTH_SOURCES)[number] | (string & {});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* How a login method signs in:
|
|
39
|
+
* - `browser` — the user signs in at the login's `url`, and the CLI hears
|
|
40
|
+
* back on the server's machine; where the login has a `codeUrl`, a browser
|
|
41
|
+
* on another device signs in there and the user pastes the code it shows
|
|
42
|
+
* (`auth/complete`);
|
|
43
|
+
* - `device_code` — the user enters the login's `userCode` at its `url`, on
|
|
44
|
+
* any device;
|
|
45
|
+
* - `api_key` — `auth/login` carries the key;
|
|
46
|
+
* - `terminal` — the user runs the method's `command` in a terminal; it is
|
|
47
|
+
* not an `auth/login` method.
|
|
48
|
+
* OPEN.
|
|
49
|
+
*/
|
|
50
|
+
export const AUTH_METHOD_KINDS = ["browser", "device_code", "api_key", "terminal"] as const;
|
|
51
|
+
export type AuthMethodKind = (typeof AUTH_METHOD_KINDS)[number] | (string & {});
|
|
52
|
+
|
|
53
|
+
/** One way to log a harness in. */
|
|
54
|
+
export const AuthMethodSchema = z.object({
|
|
55
|
+
/** What `auth/login` names (`claudeai`, `chatgpt`, `api_key`, …). */
|
|
56
|
+
id: z.string().min(1),
|
|
57
|
+
kind: openVocabulary(AUTH_METHOD_KINDS),
|
|
58
|
+
label: z.string(),
|
|
59
|
+
/**
|
|
60
|
+
* What a login by this method runs on (`subscription`, `api_key`); absent
|
|
61
|
+
* for a `terminal` login, which may sign in either way.
|
|
62
|
+
*/
|
|
63
|
+
credential: openVocabulary(AUTH_CREDENTIALS).optional(),
|
|
64
|
+
/** `terminal`: the command line, the CLI's path first. */
|
|
65
|
+
command: z.array(z.string()).optional(),
|
|
66
|
+
/** `terminal`: what to set in its environment, to sign in where turns look. */
|
|
67
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
68
|
+
});
|
|
69
|
+
export type AuthMethod = z.infer<typeof AuthMethodSchema>;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* One harness's login, as `auth/status` and `auth/logout` answer it, and as
|
|
73
|
+
* a product shows one it holds (`grantAuth`): who, on what kind of
|
|
74
|
+
* credential, from where, and what to call it.
|
|
75
|
+
*/
|
|
76
|
+
export const HarnessAuthSchema = AccountInfoSchema.extend({
|
|
77
|
+
harness: HarnessIdSchema,
|
|
78
|
+
state: openVocabulary(AUTH_STATES),
|
|
79
|
+
credential: openVocabulary(AUTH_CREDENTIALS).optional(),
|
|
80
|
+
source: openVocabulary(AUTH_SOURCES).optional(),
|
|
81
|
+
/** What to show for it (`Claude Max`, `ChatGPT Pro`, `OpenAI API key`): `accountLabel`. */
|
|
82
|
+
label: z.string().optional(),
|
|
83
|
+
/** When the credential stops working (epoch ms), where known. */
|
|
84
|
+
expiresAt: z.number().int().optional(),
|
|
85
|
+
/** The logins this harness offers here; none where its agent signs in on its own. */
|
|
86
|
+
methods: z.array(AuthMethodSchema),
|
|
87
|
+
error: z.string().optional(),
|
|
88
|
+
});
|
|
89
|
+
export type HarnessAuth = z.infer<typeof HarnessAuthSchema>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Whether the harness already runs on the login this method would make: the
|
|
93
|
+
* CLI's own, of the method's credential. A product then shows it connected
|
|
94
|
+
* and starts no sign-in, as a local login is picked up where the user already
|
|
95
|
+
* made one. A credential from the environment or settings is not one.
|
|
96
|
+
*/
|
|
97
|
+
export function signedInBy(auth: HarnessAuth, method: AuthMethod): boolean {
|
|
98
|
+
return (
|
|
99
|
+
auth.state === "signed_in" &&
|
|
100
|
+
auth.source === "login" &&
|
|
101
|
+
method.credential !== undefined &&
|
|
102
|
+
auth.credential === method.credential
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The environment a turn would run with: it picks the CLI's store (`CLAUDE_CONFIG_DIR`, `CODEX_HOME`) and the environment's credentials. */
|
|
107
|
+
const AuthEnvSchema = z.record(z.string(), z.string());
|
|
108
|
+
|
|
109
|
+
/** `auth/status`: each harness's login; every registered harness's when `harnesses` is absent. */
|
|
110
|
+
export const AuthStatusParamsSchema = z.object({
|
|
111
|
+
harnesses: z.array(AgentHarnessSchema).optional(),
|
|
112
|
+
env: AuthEnvSchema.optional(),
|
|
113
|
+
});
|
|
114
|
+
export type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
|
|
115
|
+
|
|
116
|
+
export const AuthStatusResultSchema = z.object({ auth: z.array(HarnessAuthSchema) });
|
|
117
|
+
export type AuthStatusResult = z.infer<typeof AuthStatusResultSchema>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* `auth/login`: start one of a harness's `methods`. A newer login for the same
|
|
121
|
+
* harness and store cancels this one.
|
|
122
|
+
*/
|
|
123
|
+
export const AuthLoginParamsSchema = z.object({
|
|
124
|
+
harness: AgentHarnessSchema,
|
|
125
|
+
method: z.string().min(1),
|
|
126
|
+
/** An `api_key` method's key: never answered back, logged or journaled. */
|
|
127
|
+
apiKey: z.string().min(1).optional(),
|
|
128
|
+
env: AuthEnvSchema.optional(),
|
|
129
|
+
});
|
|
130
|
+
export type AuthLoginParams = z.infer<typeof AuthLoginParamsSchema>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* A login under way, answered at once: the user signs in at `url` (entering
|
|
134
|
+
* `userCode` there, for a device code) or, from another device, at `codeUrl`
|
|
135
|
+
* and pastes the code it shows (`auth/complete`). An `api_key` login has none
|
|
136
|
+
* of them. `auth/updated` says how it ended.
|
|
137
|
+
*/
|
|
138
|
+
export const AuthLoginSchema = z.object({
|
|
139
|
+
loginId: z.string(),
|
|
140
|
+
harness: HarnessIdSchema,
|
|
141
|
+
method: z.string(),
|
|
142
|
+
url: z.string().optional(),
|
|
143
|
+
codeUrl: z.string().optional(),
|
|
144
|
+
userCode: z.string().optional(),
|
|
145
|
+
/** When the server gives up on it (epoch ms). */
|
|
146
|
+
expiresAt: z.number().int().nonnegative(),
|
|
147
|
+
});
|
|
148
|
+
export type AuthLogin = z.infer<typeof AuthLoginSchema>;
|
|
149
|
+
|
|
150
|
+
/** `auth/complete`: the code a `codeUrl` page showed, as pasted (`code#state`, or the page's address). */
|
|
151
|
+
export const AuthCompleteParamsSchema = z.object({
|
|
152
|
+
loginId: z.string(),
|
|
153
|
+
code: z.string().min(1),
|
|
154
|
+
});
|
|
155
|
+
export type AuthCompleteParams = z.infer<typeof AuthCompleteParamsSchema>;
|
|
156
|
+
|
|
157
|
+
/** How a login ended; `disconnected`: the client lost its connection first, and reads the status again. OPEN. */
|
|
158
|
+
export const LOGIN_OUTCOMES = [
|
|
159
|
+
"succeeded",
|
|
160
|
+
"failed",
|
|
161
|
+
"cancelled",
|
|
162
|
+
"expired",
|
|
163
|
+
"disconnected",
|
|
164
|
+
] as const;
|
|
165
|
+
export type LoginOutcome = (typeof LOGIN_OUTCOMES)[number] | (string & {});
|
|
166
|
+
|
|
167
|
+
/** How a login ended, as `auth/updated` carries it. */
|
|
168
|
+
export const AuthLoginEndSchema = z.object({
|
|
169
|
+
loginId: z.string(),
|
|
170
|
+
outcome: openVocabulary(LOGIN_OUTCOMES),
|
|
171
|
+
error: z.string().optional(),
|
|
172
|
+
});
|
|
173
|
+
export type AuthLoginEnd = z.infer<typeof AuthLoginEndSchema>;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* `auth/updated` (server -> every connection): a harness's login changed, or
|
|
177
|
+
* a login ended (`login`), whoever caused it: `auth/login`, `auth/logout`, or
|
|
178
|
+
* a login in a terminal that a status read noticed. A login's end is always
|
|
179
|
+
* one of these, with the harness's login after it, as `auth/complete`
|
|
180
|
+
* answers it.
|
|
181
|
+
*/
|
|
182
|
+
export const AuthUpdatedSchema = z.object({
|
|
183
|
+
auth: HarnessAuthSchema,
|
|
184
|
+
login: AuthLoginEndSchema.optional(),
|
|
185
|
+
});
|
|
186
|
+
export type AuthUpdated = z.infer<typeof AuthUpdatedSchema>;
|
|
187
|
+
|
|
188
|
+
/** `auth/cancel`: stop a login under way. */
|
|
189
|
+
export const AuthCancelParamsSchema = z.object({ loginId: z.string() });
|
|
190
|
+
export type AuthCancelParams = z.infer<typeof AuthCancelParamsSchema>;
|
|
191
|
+
export const AuthCancelResultSchema = z.object({ outcome: z.enum(["cancelled", "not_found"]) });
|
|
192
|
+
export type AuthCancelResult = z.infer<typeof AuthCancelResultSchema>;
|
|
193
|
+
|
|
194
|
+
/** `auth/logout`: remove the CLI's own login; answers the harness's login after it. */
|
|
195
|
+
export const AuthLogoutParamsSchema = z.object({
|
|
196
|
+
harness: AgentHarnessSchema,
|
|
197
|
+
env: AuthEnvSchema.optional(),
|
|
198
|
+
});
|
|
199
|
+
export type AuthLogoutParams = z.infer<typeof AuthLogoutParamsSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic JSON: object keys sorted, `undefined` members dropped, as
|
|
3
|
+
* `JSON.stringify` drops them. The one definition of "the same value" here:
|
|
4
|
+
* a turn's identity (the runtime's admission and the journal's fingerprint
|
|
5
|
+
* agree on it) and the history hash chain, whose stored versions depend on
|
|
6
|
+
* this exact output. Pure JS, so the contract stays safe in any runtime.
|
|
7
|
+
*/
|
|
8
|
+
export function canonicalJson(value: unknown): string {
|
|
9
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
|
|
10
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
11
|
+
return `{${Object.entries(value)
|
|
12
|
+
.filter(([, v]) => v !== undefined)
|
|
13
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
14
|
+
.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`)
|
|
15
|
+
.join(",")}}`;
|
|
16
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AgentHarnessSchema, HarnessIdSchema } from "./harness.ts";
|
|
3
|
+
import { openVocabulary } from "./vocabulary.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Where a harness's CLI is:
|
|
7
|
+
* - `ready` — a turn runs it at once;
|
|
8
|
+
* - `missing` — its first turn (or `clis/prepare`) installs `version`;
|
|
9
|
+
* without a `version`, nothing will (a `system` server): the harness
|
|
10
|
+
* cannot run here;
|
|
11
|
+
* - `installing` — being installed now, `receivedBytes` of `totalBytes`
|
|
12
|
+
* downloaded (none before its download starts);
|
|
13
|
+
* - `failed` — the last install failed, `error` says why; the next turn or
|
|
14
|
+
* prepare tries again;
|
|
15
|
+
* - `unmanaged` — the engine does not install this harness's agent (ACP: the
|
|
16
|
+
* operator's launch command).
|
|
17
|
+
* OPEN: treat a state this build does not know as `missing`.
|
|
18
|
+
*/
|
|
19
|
+
export const CLI_STATES = ["ready", "missing", "installing", "failed", "unmanaged"] as const;
|
|
20
|
+
export type CliState = (typeof CLI_STATES)[number] | (string & {});
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Where a ready CLI comes from: the operator's `override`, a `bundled`
|
|
24
|
+
* folder, the `host`'s install, or the engine's `cache` (where an install
|
|
25
|
+
* puts it). OPEN.
|
|
26
|
+
*/
|
|
27
|
+
export const CLI_SOURCES = ["override", "bundled", "host", "cache"] as const;
|
|
28
|
+
export type CliSource = (typeof CLI_SOURCES)[number] | (string & {});
|
|
29
|
+
|
|
30
|
+
/** One harness's CLI, as `clis/list` and `clis/prepare` answer it. */
|
|
31
|
+
export const HarnessCliSchema = z.object({
|
|
32
|
+
harness: HarnessIdSchema,
|
|
33
|
+
state: openVocabulary(CLI_STATES),
|
|
34
|
+
/** What runs when `ready`; what an install fetches otherwise. */
|
|
35
|
+
version: z.string().optional(),
|
|
36
|
+
source: openVocabulary(CLI_SOURCES).optional(),
|
|
37
|
+
receivedBytes: z.number().int().nonnegative().optional(),
|
|
38
|
+
totalBytes: z.number().int().nonnegative().optional(),
|
|
39
|
+
error: z.string().optional(),
|
|
40
|
+
});
|
|
41
|
+
export type HarnessCli = z.infer<typeof HarnessCliSchema>;
|
|
42
|
+
|
|
43
|
+
/** Which harnesses' CLIs to list or prepare: every registered harness's when absent. */
|
|
44
|
+
export const ClisParamsSchema = z.object({
|
|
45
|
+
harnesses: z.array(AgentHarnessSchema).optional(),
|
|
46
|
+
});
|
|
47
|
+
export type ClisParams = z.infer<typeof ClisParamsSchema>;
|
|
48
|
+
|
|
49
|
+
export const ClisResultSchema = z.object({ clis: z.array(HarnessCliSchema) });
|
|
50
|
+
export type ClisResult = z.infer<typeof ClisResultSchema>;
|
|
51
|
+
|
|
52
|
+
/** An install's phases: `downloading`, then `verifying`, then `ready`; `failed` at any point. OPEN. */
|
|
53
|
+
export const CLI_PHASES = ["downloading", "verifying", "ready", "failed"] as const;
|
|
54
|
+
export type CliPhase = (typeof CLI_PHASES)[number] | (string & {});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* `clis/progress` (server -> every connection): a harness's CLI being
|
|
58
|
+
* installed, whoever caused it (a turn, a model list, `clis/prepare`). At
|
|
59
|
+
* most four a second per install, and always its last phase.
|
|
60
|
+
*/
|
|
61
|
+
export const HarnessCliProgressSchema = z.object({
|
|
62
|
+
harness: HarnessIdSchema,
|
|
63
|
+
version: z.string(),
|
|
64
|
+
phase: openVocabulary(CLI_PHASES),
|
|
65
|
+
receivedBytes: z.number().int().nonnegative(),
|
|
66
|
+
totalBytes: z.number().int().nonnegative().optional(),
|
|
67
|
+
error: z.string().optional(),
|
|
68
|
+
});
|
|
69
|
+
export type HarnessCliProgress = z.infer<typeof HarnessCliProgressSchema>;
|
package/src/protocol/config.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { z } from "zod";
|
|
|
2
2
|
import { AgentHarnessSchema } from "./harness.ts";
|
|
3
3
|
import { AgentInputSchema } from "./part-input.ts";
|
|
4
4
|
import { ThinkingLevelSchema } from "./thinking.ts";
|
|
5
|
+
import { openVocabulary } from "./vocabulary.ts";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Permission posture for a turn. `bypass_permissions` auto-approves every
|
|
8
9
|
* tool (the right default inside a sandbox); `plan` is read-only planning;
|
|
9
10
|
* `dont_ask` never prompts — unapproved tools are denied, sandboxes stay at
|
|
10
|
-
* their normal (non-dangerous) level. Values
|
|
11
|
+
* their normal (non-dangerous) level. Values are snake_case (LLP 0002, Casing);
|
|
11
12
|
* adapters map to provider vocabulary at the edge (Claude SDK: acceptEdits,
|
|
12
13
|
* bypassPermissions).
|
|
13
14
|
*/
|
|
@@ -20,6 +21,26 @@ export const PermissionModeSchema = z.enum([
|
|
|
20
21
|
]);
|
|
21
22
|
export type PermissionMode = z.infer<typeof PermissionModeSchema>;
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
* A permission mode as the stream reports it (`session.mode`, a turn's
|
|
26
|
+
* `execution`): open, so a mode a newer engine adds reaches an older client
|
|
27
|
+
* intact. A turn's config stays strict.
|
|
28
|
+
*/
|
|
29
|
+
export type ReportedPermissionMode = PermissionMode | (string & {});
|
|
30
|
+
export const ReportedPermissionModeSchema = openVocabulary(PermissionModeSchema.options);
|
|
31
|
+
|
|
32
|
+
/** The longest `requestTimeoutMs`: a timer's own limit, about 24.8 days. */
|
|
33
|
+
export const MAX_REQUEST_TIMEOUT_MS = 2_147_483_647;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Whether a turn needs the server (default `true`). A turn fails before the
|
|
37
|
+
* model runs when a required server cannot connect (`mcp_unavailable`); one
|
|
38
|
+
* that is not required is said as a recoverable `error` of that category, and
|
|
39
|
+
* the turn goes on without its tools. Claude and Codex keep the rule; an ACP
|
|
40
|
+
* agent connects its servers itself and decides.
|
|
41
|
+
*/
|
|
42
|
+
const required = z.boolean().optional();
|
|
43
|
+
|
|
23
44
|
/** Minimal external MCP server descriptor (stdio or http/sse). */
|
|
24
45
|
export const McpServerConfigSchema = z.discriminatedUnion("type", [
|
|
25
46
|
z.object({
|
|
@@ -27,16 +48,19 @@ export const McpServerConfigSchema = z.discriminatedUnion("type", [
|
|
|
27
48
|
command: z.string(),
|
|
28
49
|
args: z.array(z.string()).optional(),
|
|
29
50
|
env: z.record(z.string(), z.string()).optional(),
|
|
51
|
+
required,
|
|
30
52
|
}),
|
|
31
53
|
z.object({
|
|
32
54
|
type: z.literal("http"),
|
|
33
55
|
url: z.string(),
|
|
34
56
|
headers: z.record(z.string(), z.string()).optional(),
|
|
57
|
+
required,
|
|
35
58
|
}),
|
|
36
59
|
z.object({
|
|
37
60
|
type: z.literal("sse"),
|
|
38
61
|
url: z.string(),
|
|
39
62
|
headers: z.record(z.string(), z.string()).optional(),
|
|
63
|
+
required,
|
|
40
64
|
}),
|
|
41
65
|
]);
|
|
42
66
|
export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;
|
|
@@ -50,9 +74,9 @@ export const RunConfigSchema = z.object({
|
|
|
50
74
|
/** Working directory the agent operates in. */
|
|
51
75
|
cwd: z.string(),
|
|
52
76
|
/**
|
|
53
|
-
* Extra directories the agent may access beyond `cwd`. Mapped by
|
|
54
|
-
*
|
|
55
|
-
*
|
|
77
|
+
* Extra directories the agent may access beyond `cwd`. Mapped by every
|
|
78
|
+
* built-in harness (codex-app-server makes them writable roots of its
|
|
79
|
+
* workspace-write sandbox), and by acp for agents that advertise the capability.
|
|
56
80
|
*/
|
|
57
81
|
additionalDirectories: z.array(z.string()).optional(),
|
|
58
82
|
systemPromptAppend: z.string().optional(),
|
|
@@ -60,6 +84,20 @@ export const RunConfigSchema = z.object({
|
|
|
60
84
|
/** Native workers must settle before this managed execution releases its context. */
|
|
61
85
|
subagentMode: z.literal("turn").optional(),
|
|
62
86
|
permissionMode: PermissionModeSchema.optional(),
|
|
87
|
+
/**
|
|
88
|
+
* This turn's client answers `elicitation.requested`: the agent's questions
|
|
89
|
+
* and its MCP servers' requests for input. Absent or false, the harness
|
|
90
|
+
* declines them on the user's behalf and the agent carries on, so a turn
|
|
91
|
+
* never waits for an answer nobody will give.
|
|
92
|
+
*/
|
|
93
|
+
elicitation: z.boolean().optional(),
|
|
94
|
+
/**
|
|
95
|
+
* How long a permission request or question waits for an answer, in
|
|
96
|
+
* milliseconds. Unanswered by then, it is resolved as cancelled, as a
|
|
97
|
+
* cancel would resolve it (`*.resolved` on the stream; a cancelled
|
|
98
|
+
* permission ends a Claude turn). Absent, it waits until the turn ends.
|
|
99
|
+
*/
|
|
100
|
+
requestTimeoutMs: z.number().int().positive().max(MAX_REQUEST_TIMEOUT_MS).optional(),
|
|
63
101
|
/**
|
|
64
102
|
* Native session/thread id to resume (from a prior `session.created`). When
|
|
65
103
|
* set, the harness continues that conversation instead of starting fresh.
|
|
@@ -76,8 +114,10 @@ export const RunConfigSchema = z.object({
|
|
|
76
114
|
/** Per-turn API key override (BYOK). Falls back to ambient/proxy auth. */
|
|
77
115
|
apiKey: z.string().optional(),
|
|
78
116
|
/**
|
|
79
|
-
* Disable all built-in tools for this turn (text-only).
|
|
80
|
-
*
|
|
117
|
+
* Disable all built-in tools for this turn (text-only). Claude honors it.
|
|
118
|
+
* Codex cannot turn its tools off (a read-only sandbox still runs
|
|
119
|
+
* commands), so it fails such a turn as `invalid_request` before any model
|
|
120
|
+
* call. ACP has no way to ask an agent for it, and the acp harness ignores it.
|
|
81
121
|
*/
|
|
82
122
|
disableTools: z.boolean().optional(),
|
|
83
123
|
/**
|
|
@@ -102,3 +142,17 @@ export const RunRequestSchema = z.object({
|
|
|
102
142
|
config: RunConfigSchema,
|
|
103
143
|
});
|
|
104
144
|
export type RunRequest = z.infer<typeof RunRequestSchema>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* What makes a turn the same turn when a client sends its ids again: its input
|
|
148
|
+
* and the config that shapes what the agent does. What a client's own restart
|
|
149
|
+
* can change without making it another turn stays out: MCP endpoints (a fresh
|
|
150
|
+
* per-session URL), the environment, the API key, and raw passthrough.
|
|
151
|
+
*/
|
|
152
|
+
export function turnIdentity(request: Pick<RunRequest, "input" | "config">): {
|
|
153
|
+
input: RunRequest["input"];
|
|
154
|
+
config: Omit<RunConfig, "mcpServers" | "env" | "apiKey" | "includeRaw">;
|
|
155
|
+
} {
|
|
156
|
+
const { mcpServers: _mcp, env: _env, apiKey: _key, includeRaw: _raw, ...config } = request.config;
|
|
157
|
+
return { input: request.input, config };
|
|
158
|
+
}
|