@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,463 @@
|
|
|
1
|
+
import { AsyncQueue } from "../../../protocol/index.ts";
|
|
2
|
+
import { onAbort, withTimeout } from "../../utils/deadline.ts";
|
|
3
|
+
import type { AgentExecuteOptions, SteerOutcome, SteerRequest } from "../base.ts";
|
|
4
|
+
import type { DeliverSteer } from "../session-agent.ts";
|
|
5
|
+
import { type CodexConnection, CodexRpcError } from "./client.ts";
|
|
6
|
+
import type { TurnCommands } from "./commands.ts";
|
|
7
|
+
import { CODEX_STOP_UNCONFIRMED, type CodexRawEvent } from "./events.ts";
|
|
8
|
+
import { type UserInput, toUserInput } from "./input.ts";
|
|
9
|
+
import { askPlan } from "./plan-approval.ts";
|
|
10
|
+
import {
|
|
11
|
+
type CodexNotification,
|
|
12
|
+
codexItem,
|
|
13
|
+
codexTurn,
|
|
14
|
+
endsNativeTurn,
|
|
15
|
+
retrying,
|
|
16
|
+
} from "./protocol.ts";
|
|
17
|
+
import type { CodexTurnScope } from "./requests.ts";
|
|
18
|
+
import type { CodexSession } from "./session.ts";
|
|
19
|
+
import type { ThreadSettings } from "./thread-settings.ts";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* How one of Codex's turns ended: its `turn/completed` status, or `error`
|
|
23
|
+
* when an error Codex would not retry ended it for the stream.
|
|
24
|
+
*/
|
|
25
|
+
export type NativeOutcome = "completed" | "interrupted" | "failed" | "error";
|
|
26
|
+
|
|
27
|
+
/** One of Codex's turns, `turn/start` to its end, within an engine turn. */
|
|
28
|
+
export class NativeTurn {
|
|
29
|
+
/** Codex's id for it, once `turn/started` names it. */
|
|
30
|
+
id?: string;
|
|
31
|
+
/** Its notifications, for the stream. */
|
|
32
|
+
readonly queue = new AsyncQueue<CodexRawEvent>();
|
|
33
|
+
/** How it ended; absent while it runs. */
|
|
34
|
+
outcome?: NativeOutcome;
|
|
35
|
+
/** The plan it proposed, when it planned. */
|
|
36
|
+
plan?: { itemId: string; text: string };
|
|
37
|
+
/** Its events took their last: at its end, or once a managed turn's cleanup is done. */
|
|
38
|
+
finished = false;
|
|
39
|
+
private settle!: () => void;
|
|
40
|
+
/** Settles once it ended, or once Codex's process did. */
|
|
41
|
+
readonly over = new Promise<void>((done) => {
|
|
42
|
+
this.settle = done;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/** Codex ended it with `n`. */
|
|
46
|
+
end(n: CodexNotification): void {
|
|
47
|
+
const status = codexTurn(n)?.status;
|
|
48
|
+
this.outcome =
|
|
49
|
+
n.method === "error"
|
|
50
|
+
? "error"
|
|
51
|
+
: status === "interrupted" || status === "failed"
|
|
52
|
+
? status
|
|
53
|
+
: "completed";
|
|
54
|
+
this.settle();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Codex's process went away under it. */
|
|
58
|
+
lost(): void {
|
|
59
|
+
this.settle();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Its events end, or fail with `error`. */
|
|
63
|
+
finish(error?: unknown): void {
|
|
64
|
+
this.finished = true;
|
|
65
|
+
if (error === undefined) this.queue.end();
|
|
66
|
+
else this.queue.fail(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* How an engine turn on Codex stops: by Codex's own interrupt (`InterruptStop`),
|
|
72
|
+
* or, for a managed turn (`subagentMode: "turn"`), with its native cleanup
|
|
73
|
+
* (`ManagedStop`). Chosen once, when the turn begins.
|
|
74
|
+
*/
|
|
75
|
+
export interface TurnStop {
|
|
76
|
+
/**
|
|
77
|
+
* Whether the turn goes on once Codex's turn ends: it may ask about Codex's
|
|
78
|
+
* plan, put the thread's settings back after a failure, and hold steers for
|
|
79
|
+
* Codex's next turn. A managed turn ends with its native cleanup.
|
|
80
|
+
*/
|
|
81
|
+
readonly continues: boolean;
|
|
82
|
+
/** Codex's turn ended with `n`: its events end, now or once the stop cleaned up. */
|
|
83
|
+
nativeEnded(native: NativeTurn, n: CodexNotification): void;
|
|
84
|
+
/**
|
|
85
|
+
* Stop for a cancel: Codex's turn, once it began. Resolves whether the stop
|
|
86
|
+
* is confirmed (`CancelResult.confirmed`).
|
|
87
|
+
*/
|
|
88
|
+
cancel(native?: NativeTurn): Promise<boolean>;
|
|
89
|
+
/** The commands whose outcome a turn that ended cancelled leaves unknown. */
|
|
90
|
+
outcomeUnknown(): Promise<string[]>;
|
|
91
|
+
/** The turn is over, however it ended. */
|
|
92
|
+
dispose(): Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Stop a turn by Codex's `turn/interrupt`, then stop the commands it started.
|
|
97
|
+
* When Codex does not answer within `graceMs`, or the turn never began, its
|
|
98
|
+
* events fail and its process ends.
|
|
99
|
+
*/
|
|
100
|
+
export class InterruptStop implements TurnStop {
|
|
101
|
+
readonly continues = true;
|
|
102
|
+
private forceTimer?: ReturnType<typeof setTimeout>;
|
|
103
|
+
|
|
104
|
+
constructor(
|
|
105
|
+
private readonly session: CodexSession,
|
|
106
|
+
private readonly commands: TurnCommands,
|
|
107
|
+
private readonly signal: AbortSignal,
|
|
108
|
+
private readonly graceMs: number,
|
|
109
|
+
) {}
|
|
110
|
+
|
|
111
|
+
nativeEnded(native: NativeTurn, n: CodexNotification): void {
|
|
112
|
+
if (this.signal.aborted) {
|
|
113
|
+
native.finish(new Error("turn aborted"));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
native.queue.push(n);
|
|
117
|
+
native.finish();
|
|
118
|
+
// @ref LLP 0002#tools-a-turn-leaves-open — a cancelled tool did not go on running
|
|
119
|
+
// Codex stopped its turn itself (an approval answered cancel, by a client
|
|
120
|
+
// or by `requestTimeoutMs`): the turn ends cancelled, so what it started
|
|
121
|
+
// is stopped, as after the engine's own cancel.
|
|
122
|
+
if (native.outcome === "interrupted") this.commands.interrupted();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
cancel(native?: NativeTurn): Promise<boolean> {
|
|
126
|
+
// Codex's turn ended before the cancel (the user deciding on a plan, or
|
|
127
|
+
// its end still on its way to the stream): what it left running was left
|
|
128
|
+
// on purpose, as after any turn's end. Nothing is stopped.
|
|
129
|
+
if (native?.outcome) return Promise.resolve(true);
|
|
130
|
+
this.commands.interrupted();
|
|
131
|
+
if (!native?.id) {
|
|
132
|
+
this.force(native);
|
|
133
|
+
return Promise.resolve(false);
|
|
134
|
+
}
|
|
135
|
+
this.forceTimer = setTimeout(() => this.force(native), this.graceMs);
|
|
136
|
+
this.forceTimer.unref?.();
|
|
137
|
+
return this.session.client
|
|
138
|
+
.request(
|
|
139
|
+
"turn/interrupt",
|
|
140
|
+
{ threadId: this.session.threadId, turnId: native.id },
|
|
141
|
+
this.graceMs,
|
|
142
|
+
)
|
|
143
|
+
.then(
|
|
144
|
+
async () => {
|
|
145
|
+
// Nothing started, nothing to stop. (A command Codex starts before
|
|
146
|
+
// its turn ends is stopped when the turn ends.)
|
|
147
|
+
if (!this.commands.running) return true;
|
|
148
|
+
// It ends its turn but keeps the command it was running alive as a
|
|
149
|
+
// background terminal, until that is stopped.
|
|
150
|
+
await withTimeout(native.over, this.graceMs);
|
|
151
|
+
return (await this.commands.stop()).length === 0;
|
|
152
|
+
},
|
|
153
|
+
() => {
|
|
154
|
+
this.force(native);
|
|
155
|
+
return false;
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
outcomeUnknown(): Promise<string[]> {
|
|
161
|
+
return this.commands.outcomeUnknown();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async dispose(): Promise<void> {
|
|
165
|
+
clearTimeout(this.forceTimer);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Give up on Codex's turn: its events fail, and its process ends. */
|
|
169
|
+
private force(native: NativeTurn | undefined): void {
|
|
170
|
+
if (native?.finished) return;
|
|
171
|
+
native?.finish(new Error("turn aborted"));
|
|
172
|
+
this.session.client.close();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Lets Codex's turn take steers: the agent's `openSteering` and `holdSteering`. */
|
|
177
|
+
export interface TurnSteering {
|
|
178
|
+
/** Codex's turn takes input now: the steers that wait go to it, then each as it comes. */
|
|
179
|
+
open(deliver: DeliverSteer): void;
|
|
180
|
+
/** Codex's turn takes no more: steers wait for its next. */
|
|
181
|
+
hold(): void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Whether Codex refused a `turn/steer` because its turn takes no input: it
|
|
186
|
+
* ended, another started, or it is a review or compaction turn
|
|
187
|
+
* (`activeTurnNotSteerable`). Seen from 0.160: "no active turn to steer", and
|
|
188
|
+
* "expected active turn id `…` but found `…`".
|
|
189
|
+
*/
|
|
190
|
+
export function codexSteerRefused(error: unknown): boolean {
|
|
191
|
+
if (!(error instanceof CodexRpcError)) return false;
|
|
192
|
+
return (
|
|
193
|
+
/no active turn|expected active turn id/i.test(error.message) ||
|
|
194
|
+
JSON.stringify(error.data ?? null).includes("activeTurnNotSteerable")
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Steer Codex's running turn. Codex reads it after the step it is on and
|
|
200
|
+
* starts a user message for it carrying the steer id (`clientId`).
|
|
201
|
+
*/
|
|
202
|
+
async function steerTurn(
|
|
203
|
+
client: CodexConnection,
|
|
204
|
+
threadId: string,
|
|
205
|
+
expectedTurnId: string,
|
|
206
|
+
request: SteerRequest,
|
|
207
|
+
): Promise<SteerOutcome> {
|
|
208
|
+
try {
|
|
209
|
+
await client.request("turn/steer", {
|
|
210
|
+
threadId,
|
|
211
|
+
expectedTurnId,
|
|
212
|
+
clientUserMessageId: request.steerId,
|
|
213
|
+
input: toUserInput(request.input),
|
|
214
|
+
});
|
|
215
|
+
return "steered";
|
|
216
|
+
} catch (error) {
|
|
217
|
+
if (client.closed || codexSteerRefused(error)) return "no_active_turn";
|
|
218
|
+
// Codex answered with an error: it took nothing.
|
|
219
|
+
if (error instanceof CodexRpcError) throw error;
|
|
220
|
+
// No answer (a timeout): Codex may have taken it. The stream shows it
|
|
221
|
+
// where Codex reads it, or the turn's end lists it undelivered.
|
|
222
|
+
return "steered";
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** How long an engine turn on Codex waits for it. */
|
|
227
|
+
export interface CodexTurnTiming {
|
|
228
|
+
/** `cancelGraceMs`: an interrupt, a stop, a thread settings update. */
|
|
229
|
+
graceMs: number;
|
|
230
|
+
/** How long a retryable error may go unanswered before the turn is failed. */
|
|
231
|
+
retryStallMs: number;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* One engine turn on a Codex session: Codex's turns within it (a plan's, then
|
|
236
|
+
* the one carrying out the answer), the listener that feeds them, the watchdog
|
|
237
|
+
* on a retrying Codex and the cancel's acknowledgement. Made once the session
|
|
238
|
+
* is ready and disposed with the turn, so none of it can leak into the next.
|
|
239
|
+
*/
|
|
240
|
+
export class CodexTurn {
|
|
241
|
+
/**
|
|
242
|
+
* Codex's turn running now, or the last one. The first is made with the
|
|
243
|
+
* listener, which feeds it from then on: what Codex says before the turn
|
|
244
|
+
* starts is the turn's.
|
|
245
|
+
*/
|
|
246
|
+
private native = new NativeTurn();
|
|
247
|
+
/** Codex's turns in this one: a plan's, then the one carrying out its answer. */
|
|
248
|
+
private readonly turnIds = new Set<string>();
|
|
249
|
+
private stallTimer?: ReturnType<typeof setTimeout>;
|
|
250
|
+
private acknowledged?: Promise<boolean>;
|
|
251
|
+
private readonly unsubscribe: Array<() => void>;
|
|
252
|
+
|
|
253
|
+
constructor(
|
|
254
|
+
readonly session: CodexSession,
|
|
255
|
+
readonly scope: CodexTurnScope,
|
|
256
|
+
readonly options: AgentExecuteOptions,
|
|
257
|
+
readonly commands: TurnCommands,
|
|
258
|
+
readonly stop: TurnStop,
|
|
259
|
+
readonly steering: TurnSteering,
|
|
260
|
+
readonly timing: CodexTurnTiming,
|
|
261
|
+
) {
|
|
262
|
+
const { client } = session;
|
|
263
|
+
this.unsubscribe = [
|
|
264
|
+
client.onNotification((n) => this.observe(n)),
|
|
265
|
+
// If the subprocess dies mid-turn, fail the turn instead of hanging.
|
|
266
|
+
client.onClose((error) => {
|
|
267
|
+
const native = this.native;
|
|
268
|
+
native.lost();
|
|
269
|
+
if (native.outcome) return;
|
|
270
|
+
native.finish(
|
|
271
|
+
this.signal.aborted
|
|
272
|
+
? new Error("turn aborted")
|
|
273
|
+
: (error ?? new Error("codex app-server exited mid-turn")),
|
|
274
|
+
);
|
|
275
|
+
}),
|
|
276
|
+
onAbort(this.signal, () => {
|
|
277
|
+
this.clearStall();
|
|
278
|
+
this.acknowledged ??= this.stop.cancel(this.native);
|
|
279
|
+
}),
|
|
280
|
+
];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
get signal(): AbortSignal {
|
|
284
|
+
return this.scope.signal;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** The cancel's acknowledgement, once one came: whether Codex's turn stopped. */
|
|
288
|
+
get acknowledgement(): Promise<boolean> | undefined {
|
|
289
|
+
return this.acknowledged;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** Whether the turn puts Codex's plan to the user: a plan turn with someone to ask. */
|
|
293
|
+
get asksAboutPlans(): boolean {
|
|
294
|
+
return this.stop.continues && this.scope.mode === "plan" && !!this.scope.onPermissionRequest;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Run the turn: Codex's first turn, then each one an answer to its plan runs. */
|
|
298
|
+
async *run(input: UserInput[]): AsyncGenerator<CodexRawEvent> {
|
|
299
|
+
const { thread } = this.session;
|
|
300
|
+
const previous = thread.settings;
|
|
301
|
+
const first = await thread.forTurn(this.options, this.session, this.scope.mode);
|
|
302
|
+
if (first.applied) this.options.onExecution?.(first.applied);
|
|
303
|
+
const params = { threadId: this.session.threadId, input, ...first.params };
|
|
304
|
+
let native = this.start(this.native, params, first.next);
|
|
305
|
+
yield* this.events(native);
|
|
306
|
+
// A turn that failed may have failed on the model or effort it switched
|
|
307
|
+
// to, which Codex keeps on the thread: put the thread back on its own.
|
|
308
|
+
// (Only the first of Codex's turns sends them.)
|
|
309
|
+
if (
|
|
310
|
+
this.stop.continues &&
|
|
311
|
+
!this.signal.aborted &&
|
|
312
|
+
(native.outcome === "failed" || native.outcome === "error")
|
|
313
|
+
)
|
|
314
|
+
await thread.restore(this.session, previous, params, this.timing.graceMs);
|
|
315
|
+
let next = yield* askPlan(this, native);
|
|
316
|
+
while (next) {
|
|
317
|
+
native = this.start(new NativeTurn(), next.params, next.settings, next.sandbox);
|
|
318
|
+
yield* this.events(native);
|
|
319
|
+
next = yield* askPlan(this, native);
|
|
320
|
+
}
|
|
321
|
+
if (native.outcome === "interrupted") yield* this.endCancelled();
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* The turn ends cancelled: what finished after Codex's turn ended says so,
|
|
326
|
+
* and a command whose stop was not confirmed, or that the turn left
|
|
327
|
+
* running, is not cancelled: its outcome is unknown.
|
|
328
|
+
*/
|
|
329
|
+
async *endCancelled(): AsyncGenerator<CodexRawEvent> {
|
|
330
|
+
yield* this.commands.drainLate();
|
|
331
|
+
const itemIds = await this.stop.outcomeUnknown();
|
|
332
|
+
if (itemIds.length) yield { method: CODEX_STOP_UNCONFIRMED, params: { itemIds } };
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
dispose(): void {
|
|
336
|
+
this.clearStall();
|
|
337
|
+
for (const off of this.unsubscribe) off();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** One of Codex's turns, to the stream. */
|
|
341
|
+
private async *events(native: NativeTurn): AsyncGenerator<CodexRawEvent> {
|
|
342
|
+
for await (const event of native.queue) {
|
|
343
|
+
this.commands.shown(event);
|
|
344
|
+
yield event;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Start Codex's next turn in this one. What it changes on the thread is
|
|
350
|
+
* committed now, and put back when Codex refuses it: a refused turn/start
|
|
351
|
+
* changes nothing on the thread.
|
|
352
|
+
*/
|
|
353
|
+
private start(
|
|
354
|
+
native: NativeTurn,
|
|
355
|
+
params: Record<string, unknown>,
|
|
356
|
+
settings: ThreadSettings,
|
|
357
|
+
sandbox = this.session.sandbox,
|
|
358
|
+
): NativeTurn {
|
|
359
|
+
const { session } = this;
|
|
360
|
+
if (this.signal.aborted) throw new Error("turn aborted");
|
|
361
|
+
if (session.stale) {
|
|
362
|
+
session.client.close();
|
|
363
|
+
throw new Error("Codex process was invalidated before turn admission");
|
|
364
|
+
}
|
|
365
|
+
const previous = { settings: session.thread.settings, sandbox: session.sandbox };
|
|
366
|
+
this.native = native;
|
|
367
|
+
session.thread.settings = settings;
|
|
368
|
+
session.sandbox = sandbox;
|
|
369
|
+
session.client.request("turn/start", params).catch((error: unknown) => {
|
|
370
|
+
// Codex refused it: the thread is as it was. Anything else leaves the
|
|
371
|
+
// thread's settings unknown, so this process is done with.
|
|
372
|
+
if (error instanceof CodexRpcError) {
|
|
373
|
+
session.thread.settings = previous.settings;
|
|
374
|
+
session.sandbox = previous.sandbox;
|
|
375
|
+
} else session.client.close();
|
|
376
|
+
// A cancelled turn ends by its cancel.
|
|
377
|
+
if (this.signal.aborted) return;
|
|
378
|
+
native.queue.push({ method: "error", params: { message: String(error) } });
|
|
379
|
+
native.finish();
|
|
380
|
+
});
|
|
381
|
+
return native;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
private observe(n: CodexNotification): void {
|
|
385
|
+
this.scope.items.observe(n);
|
|
386
|
+
this.scope.subagents?.observe(n);
|
|
387
|
+
if (n.params.threadId && n.params.threadId !== this.session.threadId) return;
|
|
388
|
+
// An item of an earlier turn is not this one's: a command the earlier
|
|
389
|
+
// turn's cancel killed completes late, as `failed`.
|
|
390
|
+
if (
|
|
391
|
+
n.method.startsWith("item/") &&
|
|
392
|
+
typeof n.params.turnId === "string" &&
|
|
393
|
+
!this.turnIds.has(n.params.turnId)
|
|
394
|
+
)
|
|
395
|
+
return;
|
|
396
|
+
const native = this.native;
|
|
397
|
+
switch (n.method) {
|
|
398
|
+
case "turn/started": {
|
|
399
|
+
const id = codexTurn(n)?.id;
|
|
400
|
+
if (id) this.began(native, id);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
case "item/started":
|
|
404
|
+
this.commands.started(codexItem(n));
|
|
405
|
+
break;
|
|
406
|
+
case "item/completed": {
|
|
407
|
+
const item = codexItem(n);
|
|
408
|
+
if (item?.type === "plan") native.plan = { itemId: item.id, text: item.text ?? "" };
|
|
409
|
+
// Codex's turn ended (its plan's question open): its events take no
|
|
410
|
+
// more, and a completion of one of its commands waits for the
|
|
411
|
+
// stream, shown even when a cancel comes with it.
|
|
412
|
+
if (this.commands.completed(item) && native.finished) {
|
|
413
|
+
this.commands.holdLate(n);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (endsNativeTurn(n)) {
|
|
420
|
+
this.ended(native, n);
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (native.finished) return;
|
|
424
|
+
native.queue.push(n);
|
|
425
|
+
this.watchStall(n);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
private began(native: NativeTurn, id: string): void {
|
|
429
|
+
native.id = id;
|
|
430
|
+
this.turnIds.add(id);
|
|
431
|
+
const { client, threadId } = this.session;
|
|
432
|
+
// @ref LLP 0001#d13--input-while-a-turn-runs-steers-it — Codex takes steers once its turn exists
|
|
433
|
+
this.steering.open((request) => steerTurn(client, threadId, id, request));
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
private ended(native: NativeTurn, n: CodexNotification): void {
|
|
437
|
+
native.end(n);
|
|
438
|
+
this.clearStall();
|
|
439
|
+
// A plan turn's end may only pause this one: steers wait for the turn
|
|
440
|
+
// that carries out the user's answer.
|
|
441
|
+
if (n.method === "turn/completed" && this.asksAboutPlans) this.steering.hold();
|
|
442
|
+
this.stop.nativeEnded(native, n);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* A retryable error promises more notifications. If none arrive, the
|
|
447
|
+
* subprocess is wedged-but-alive and the turn would hang forever: bound it.
|
|
448
|
+
*/
|
|
449
|
+
private watchStall(n: CodexNotification): void {
|
|
450
|
+
this.clearStall();
|
|
451
|
+
if (this.signal.aborted || !retrying(n)) return;
|
|
452
|
+
this.stallTimer = setTimeout(() => {
|
|
453
|
+
this.native.finish(new Error("codex app-server went silent after a retryable error"));
|
|
454
|
+
this.session.client.close();
|
|
455
|
+
}, this.timing.retryStallMs);
|
|
456
|
+
this.stallTimer.unref?.();
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
private clearStall(): void {
|
|
460
|
+
clearTimeout(this.stallTimer);
|
|
461
|
+
this.stallTimer = undefined;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
3
|
-
function canonicalize(value: unknown): unknown {
|
|
4
|
-
if (Array.isArray(value)) return value.map(canonicalize);
|
|
5
|
-
if (value && typeof value === "object") {
|
|
6
|
-
return Object.fromEntries(
|
|
7
|
-
Object.entries(value as Record<string, unknown>)
|
|
8
|
-
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
9
|
-
.map(([key, item]) => [key, canonicalize(item)]),
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
2
|
+
import { canonicalJson } from "../../protocol/index.ts";
|
|
14
3
|
|
|
15
4
|
/** Stable, non-reversible identity for config that may contain credentials. */
|
|
16
5
|
export function configFingerprint(value: unknown): string {
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
return createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** A session's extra directories: order and duplicates don't change what it may touch. */
|
|
10
|
+
export function directoriesFingerprint(directories: readonly string[] | undefined): string {
|
|
11
|
+
return configFingerprint([...new Set(directories ?? [])].sort());
|
|
19
12
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CredentialAnswerSchema,
|
|
3
|
+
type CredentialRequest,
|
|
4
|
+
type HarnessCredential,
|
|
5
|
+
type HarnessCredentials,
|
|
6
|
+
credentialRunsOn,
|
|
7
|
+
} from "../../protocol/index.ts";
|
|
8
|
+
import { AgentServerError } from "../utils/errors.ts";
|
|
9
|
+
import { isLoopbackHost } from "../utils/loopback.ts";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Where a turn's credential comes from when the product holds the login
|
|
13
|
+
* (LLP 0012): asked before each turn, and again, naming the refused token by
|
|
14
|
+
* its digest, when the harness refuses the one it got. `signal` aborts when
|
|
15
|
+
* the turn that asks is cancelled. `undefined` runs the turn on the CLI's own
|
|
16
|
+
* login.
|
|
17
|
+
*/
|
|
18
|
+
export type CredentialSource = (
|
|
19
|
+
request: CredentialRequest,
|
|
20
|
+
signal?: AbortSignal,
|
|
21
|
+
) => Promise<HarnessCredential | undefined>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The product's credential for a harness, as the kind it runs on: one it
|
|
25
|
+
* cannot run fails the turn here, before anything starts.
|
|
26
|
+
*/
|
|
27
|
+
export async function credentialFor<H extends keyof HarnessCredentials>(
|
|
28
|
+
source: CredentialSource,
|
|
29
|
+
request: CredentialRequest & { harness: H },
|
|
30
|
+
signal?: AbortSignal,
|
|
31
|
+
): Promise<HarnessCredentials[H] | undefined> {
|
|
32
|
+
const credential = await source(request, signal);
|
|
33
|
+
if (!credential) return undefined;
|
|
34
|
+
const runs = credentialRunsOn(request.harness, credential);
|
|
35
|
+
if (runs.ok) return runs.credential;
|
|
36
|
+
throw new AgentServerError(runs.error, "credentialsUnavailable", "internal");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** How long a credential endpoint has to answer: inside Codex's 10 s for a token refresh. */
|
|
40
|
+
const ENDPOINT_TIMEOUT_MS = 8_000;
|
|
41
|
+
|
|
42
|
+
/** Credentials travel encrypted, unless they never leave this machine. */
|
|
43
|
+
function checkEndpoint(url: string): void {
|
|
44
|
+
const parsed = URL.canParse(url) ? new URL(url) : undefined;
|
|
45
|
+
if (parsed?.protocol === "https:") return;
|
|
46
|
+
if (parsed?.protocol === "http:" && isLoopbackHost(parsed.hostname)) return;
|
|
47
|
+
throw new Error("a credential endpoint must be https (or http on this machine)");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** What an endpoint's refusal said, as the engine tells it: its words only where they are the person's. */
|
|
51
|
+
async function refusal(response: Response): Promise<Error> {
|
|
52
|
+
const body: unknown = await response.json().catch(() => undefined);
|
|
53
|
+
const answer = typeof body === "object" && body !== null ? (body as Record<string, unknown>) : {};
|
|
54
|
+
// The product's own words (an `AccountError`): the person signs in again, or it says why not.
|
|
55
|
+
if (response.status === 409 && typeof answer.error === "string") {
|
|
56
|
+
const words = answer.error.slice(0, 200);
|
|
57
|
+
return answer.reconnect === true
|
|
58
|
+
? new AgentServerError(words, "credentialsReconnect", "auth")
|
|
59
|
+
: new AgentServerError(words, "credentialsUnavailable", "internal");
|
|
60
|
+
}
|
|
61
|
+
return new AgentServerError(
|
|
62
|
+
response.status === 401 || response.status === 403
|
|
63
|
+
? "the credential endpoint refused this engine's token"
|
|
64
|
+
: `the credential endpoint answered ${response.status}`,
|
|
65
|
+
"credentialsUnavailable",
|
|
66
|
+
"internal",
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A product's credential endpoint (`createCredentialHandler` in
|
|
72
|
+
* `@zvada/agent-server/accounts`): the engine asks it before each turn, with a
|
|
73
|
+
* refused token's hash, never the token. `token` authenticates this engine to
|
|
74
|
+
* it. The URL is https, or http on loopback.
|
|
75
|
+
*/
|
|
76
|
+
export function credentialsFromUrl(options: {
|
|
77
|
+
url: string;
|
|
78
|
+
token?: string;
|
|
79
|
+
fetch?: typeof fetch;
|
|
80
|
+
}): CredentialSource {
|
|
81
|
+
checkEndpoint(options.url);
|
|
82
|
+
const doFetch = options.fetch ?? globalThis.fetch;
|
|
83
|
+
return async (request, signal) => {
|
|
84
|
+
const timeout = AbortSignal.timeout(ENDPOINT_TIMEOUT_MS);
|
|
85
|
+
const response = await doFetch(options.url, {
|
|
86
|
+
method: "POST",
|
|
87
|
+
headers: {
|
|
88
|
+
"content-type": "application/json",
|
|
89
|
+
...(options.token && { authorization: `Bearer ${options.token}` }),
|
|
90
|
+
},
|
|
91
|
+
body: JSON.stringify(request),
|
|
92
|
+
redirect: "manual",
|
|
93
|
+
signal: signal ? AbortSignal.any([signal, timeout]) : timeout,
|
|
94
|
+
});
|
|
95
|
+
if (!response.ok) throw await refusal(response);
|
|
96
|
+
return CredentialAnswerSchema.parse(await response.json()).credential ?? undefined;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { ElicitationOutcome, ElicitationQuestion } from "../../protocol/index.ts";
|
|
2
|
+
import type { ElicitationRequest } from "./base.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Told to the agent when the turn's client answers no questions
|
|
6
|
+
* (`config.elicitation` off), so it carries on instead of waiting.
|
|
7
|
+
*/
|
|
8
|
+
export const NO_ANSWERS =
|
|
9
|
+
"The user cannot answer questions in this session. Continue with your best judgment and state the assumptions you make.";
|
|
10
|
+
|
|
11
|
+
/** The agent's own questions (Claude's AskUserQuestion, Codex's request_user_input), as the broker asks them. */
|
|
12
|
+
export function questionRequest(
|
|
13
|
+
questions: ElicitationQuestion[],
|
|
14
|
+
toolCallId?: string,
|
|
15
|
+
): ElicitationRequest {
|
|
16
|
+
return {
|
|
17
|
+
mode: "question",
|
|
18
|
+
message: questions.length === 1 ? questions[0]!.question : `${questions.length} questions`,
|
|
19
|
+
...(toolCallId && { toolCallId }),
|
|
20
|
+
questions,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** What the agent is told when the user leaves its question unanswered. */
|
|
25
|
+
export function unanswered(action: "decline" | "cancel"): string {
|
|
26
|
+
return action === "decline"
|
|
27
|
+
? "The user declined to answer."
|
|
28
|
+
: "The user dismissed the question without answering.";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** An MCP server's request for input: a form to fill in, or a URL to visit. */
|
|
32
|
+
export interface McpInputRequest {
|
|
33
|
+
mode: "form" | "url";
|
|
34
|
+
message: string;
|
|
35
|
+
/** The server asking, when the harness names it. */
|
|
36
|
+
serverName?: string;
|
|
37
|
+
/** The tool call it belongs to, when the harness can tell. */
|
|
38
|
+
toolCallId?: string;
|
|
39
|
+
requestedSchema?: Record<string, unknown>;
|
|
40
|
+
url?: string;
|
|
41
|
+
elicitationId?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** An MCP server's request for input, as the broker asks it: what it leaves empty is left out. */
|
|
45
|
+
export function inputRequest(request: McpInputRequest): ElicitationRequest {
|
|
46
|
+
return {
|
|
47
|
+
mode: request.mode,
|
|
48
|
+
message: request.message,
|
|
49
|
+
...(request.serverName && { serverName: request.serverName }),
|
|
50
|
+
...(request.toolCallId && { toolCallId: request.toolCallId }),
|
|
51
|
+
...(request.requestedSchema && { requestedSchema: request.requestedSchema }),
|
|
52
|
+
...(request.url && { url: request.url }),
|
|
53
|
+
...(request.elicitationId && { elicitationId: request.elicitationId }),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The user's answer as an MCP server takes it (MCP's `ElicitResult`). A type,
|
|
59
|
+
* not an interface: the SDKs' reply types are indexable.
|
|
60
|
+
*/
|
|
61
|
+
export type McpInputReply = {
|
|
62
|
+
action: "accept" | "decline" | "cancel";
|
|
63
|
+
/** What the user filled in; only an accept carries it. */
|
|
64
|
+
content?: Record<string, string | number | boolean | string[]>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** The broker's outcome, as the MCP server that asked takes it. */
|
|
68
|
+
export function inputReply(outcome: ElicitationOutcome): McpInputReply {
|
|
69
|
+
if (outcome.action !== "accept") return { action: outcome.action };
|
|
70
|
+
return {
|
|
71
|
+
action: "accept",
|
|
72
|
+
// The user answered the server's own schema, whose values MCP types.
|
|
73
|
+
...(outcome.content && { content: outcome.content as McpInputReply["content"] }),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What ambient configuration a turn loads by itself when it starts: settings,
|
|
3
|
+
* MCP servers, hooks and memory, from the host user and from the repository
|
|
4
|
+
* (LLP 0001, D17). It never decides where the agent may read or run while it
|
|
5
|
+
* works: the permission mode, Codex's sandbox and the product's policy do.
|
|
6
|
+
*
|
|
7
|
+
* - `all`: what the harness loads by default, the host user's and the
|
|
8
|
+
* repository's.
|
|
9
|
+
* - `project`: the repository's, none of the host user's.
|
|
10
|
+
* - `none`: neither.
|
|
11
|
+
*
|
|
12
|
+
* Operator-level only: never on the wire.
|
|
13
|
+
*/
|
|
14
|
+
export type InheritConfig = "all" | "project" | "none";
|
|
15
|
+
|
|
16
|
+
/** Every level, for a command line to check a value against. */
|
|
17
|
+
export const INHERIT_CONFIGS: readonly InheritConfig[] = ["all", "project", "none"];
|
|
18
|
+
|
|
19
|
+
export function isInheritConfig(value: string): value is InheritConfig {
|
|
20
|
+
return (INHERIT_CONFIGS as readonly string[]).includes(value);
|
|
21
|
+
}
|