@zvada/agent-server 0.3.17 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -26
- package/CHANGELOG.md +1060 -0
- package/README.md +50 -26
- 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 +460 -54
- package/docs/deploy.md +218 -47
- package/docs/durable-sessions.md +195 -0
- package/docs/feedback.md +116 -0
- package/docs/harnesses.md +219 -87
- package/docs/sync-history.md +197 -0
- package/docs/sync-integration.md +119 -0
- package/package.json +53 -23
- 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 +641 -602
- package/src/client/connection.ts +371 -0
- package/src/client/history.ts +65 -0
- package/src/client/index.ts +11 -2
- package/src/client/listeners.ts +20 -0
- package/src/client/logins.ts +105 -0
- package/src/client/rpc.ts +144 -0
- package/src/client/streams.ts +488 -0
- package/src/client/transports.ts +62 -8
- package/src/client/turns.ts +171 -0
- package/src/core/agents/acp/acp-agent.ts +94 -118
- package/src/core/agents/acp/adapter.ts +20 -9
- package/src/core/agents/acp/client.ts +125 -47
- package/src/core/agents/acp/known-agents.ts +36 -4
- package/src/core/agents/acp/mappings.ts +64 -18
- package/src/core/agents/acp/requests.ts +125 -0
- package/src/core/agents/attachments.ts +18 -0
- package/src/core/agents/base.ts +120 -42
- package/src/core/agents/claude-code/adapter.ts +177 -238
- package/src/core/agents/claude-code/approvals.ts +270 -0
- package/src/core/agents/claude-code/claude-agent.ts +175 -158
- package/src/core/agents/claude-code/credentials.ts +171 -0
- package/src/core/agents/claude-code/events.ts +55 -0
- package/src/core/agents/claude-code/login.ts +269 -0
- package/src/core/agents/claude-code/mcp.ts +206 -0
- package/src/core/agents/claude-code/models.ts +15 -9
- package/src/core/agents/claude-code/options.ts +326 -39
- package/src/core/agents/claude-code/outcome.ts +209 -0
- package/src/core/agents/claude-code/session-pool.ts +136 -0
- package/src/core/agents/claude-code/session.ts +513 -0
- package/src/core/agents/claude-code/spawn.ts +144 -0
- package/src/core/agents/claude-code/spend.ts +160 -0
- package/src/core/agents/claude-code/tools.ts +47 -0
- package/src/core/agents/claude-code/turn-usage.ts +135 -0
- package/src/core/agents/claude-code/turn.ts +232 -0
- package/src/core/agents/codex-app-server/adapter.ts +314 -117
- package/src/core/agents/codex-app-server/client.ts +186 -84
- package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
- package/src/core/agents/codex-app-server/commands.ts +228 -0
- package/src/core/agents/codex-app-server/credentials.ts +126 -0
- package/src/core/agents/codex-app-server/effort.ts +29 -0
- package/src/core/agents/codex-app-server/events.ts +47 -0
- package/src/core/agents/codex-app-server/homes.ts +64 -0
- package/src/core/agents/codex-app-server/input.ts +60 -0
- package/src/core/agents/codex-app-server/items.ts +149 -0
- package/src/core/agents/codex-app-server/login.ts +180 -0
- package/src/core/agents/codex-app-server/mcp.ts +182 -37
- package/src/core/agents/codex-app-server/models.ts +99 -46
- package/src/core/agents/codex-app-server/options.ts +146 -0
- package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
- package/src/core/agents/codex-app-server/protocol.ts +117 -0
- package/src/core/agents/codex-app-server/requests.ts +332 -0
- package/src/core/agents/codex-app-server/session.ts +285 -0
- package/src/core/agents/codex-app-server/subagents.ts +108 -42
- package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
- package/src/core/agents/codex-app-server/turn-items.ts +88 -0
- package/src/core/agents/codex-app-server/turn.ts +463 -0
- package/src/core/agents/config-fingerprint.ts +7 -14
- package/src/core/agents/credentials.ts +98 -0
- package/src/core/agents/elicitation.ts +75 -0
- package/src/core/agents/inherit-config.ts +21 -0
- package/src/core/agents/login.ts +116 -0
- package/src/core/agents/mcp-config.ts +112 -8
- package/src/core/agents/plan.ts +25 -0
- package/src/core/agents/registry.ts +21 -4
- package/src/core/agents/session-agent.ts +96 -4
- package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
- package/src/core/agents/stderr-tail.ts +75 -0
- package/src/core/agents/types.ts +40 -5
- package/src/core/index.ts +60 -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 +11 -34
- 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 +340 -481
- package/src/core/runtime/event-processor.ts +207 -75
- package/src/core/runtime/event-sink.ts +45 -2
- 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 +57 -57
- 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 +275 -0
- package/src/protocol/ids.ts +4 -17
- package/src/protocol/index.ts +10 -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 +425 -57
- 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 +275 -366
- package/src/server/bin.ts +295 -72
- package/src/server/feedback.ts +204 -14
- package/src/server/history.ts +160 -0
- package/src/server/index.ts +4 -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 +289 -0
- package/src/server/subscriptions.ts +232 -0
- package/src/server/transports.ts +125 -25
- package/src/server/wire-error.ts +38 -0
- package/src/sync/event-log.ts +160 -0
- package/src/sync/fit.ts +140 -0
- package/src/sync/history-reader.ts +57 -0
- package/src/sync/history-sqlite.ts +339 -0
- package/src/sync/history.ts +220 -0
- package/src/sync/index.ts +18 -0
- package/src/sync/journal-sqlite.ts +439 -0
- package/src/sync/journal.ts +132 -0
- package/src/sync/live-tails.ts +107 -0
- package/src/sync/node-sqlite.ts +20 -0
- package/src/sync/projection.ts +35 -0
- package/src/sync/recovery.ts +141 -0
- package/src/sync/retry.ts +49 -0
- package/src/sync/schema.ts +77 -0
- package/src/sync/sql.ts +106 -0
- package/src/sync/sqlite-file.ts +38 -0
- package/src/sync/sqlite.ts +21 -0
- package/src/sync/worker.ts +259 -0
- package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
- package/docs/rfds/0002-native-subagents.md +0 -197
- 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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ReportedPermissionModeSchema } from "./config.ts";
|
|
2
3
|
import { ErrorCategorySchema, ErrorInfoSchema } from "./errors.ts";
|
|
3
4
|
import { TurnExecutionSchema } from "./execution.ts";
|
|
4
5
|
import { isKnownLifecycleEventType } from "./guards.ts";
|
|
5
|
-
import {
|
|
6
|
+
import { HarnessIdSchema } from "./harness.ts";
|
|
6
7
|
import { MetaSchema } from "./meta.ts";
|
|
7
8
|
import { type Part, PartSchema, type UnknownPart, decodePart } from "./parts.ts";
|
|
8
9
|
import { EpochMsSchema } from "./time.ts";
|
|
@@ -28,10 +29,13 @@ import { openVocabulary } from "./vocabulary.ts";
|
|
|
28
29
|
* first assistant message, is the normal case rather than an anomaly. It
|
|
29
30
|
* cannot be hoisted: the id does not exist until the harness produces it,
|
|
30
31
|
* and holding the echo back for it would delay the transcript of every turn
|
|
31
|
-
* on a subprocess spawn.
|
|
32
|
-
*
|
|
32
|
+
* on a subprocess spawn. It comes when it says something new (the session's
|
|
33
|
+
* first native id, a new one, or a resume that did not continue), not on
|
|
34
|
+
* every turn. Persist it whenever it arrives; never treat it as a turn
|
|
35
|
+
* preamble.
|
|
33
36
|
* session.compaction may appear anywhere within a turn (position = first
|
|
34
|
-
* appearance). permission.* and raw interleave anywhere
|
|
37
|
+
* appearance). permission.*, elicitation.* and raw interleave anywhere
|
|
38
|
+
* within a turn.
|
|
35
39
|
* session.ended may follow at any later point.
|
|
36
40
|
*
|
|
37
41
|
* Exceptions to strict message bracketing:
|
|
@@ -40,17 +44,16 @@ import { openVocabulary } from "./vocabulary.ts";
|
|
|
40
44
|
* the upsert lands there.
|
|
41
45
|
* - snapshots are authoritative over deltas: a content-bearing `message.part`
|
|
42
46
|
* wipes the delta accumulator for that part; later deltas append to the
|
|
43
|
-
* replacement. A non-terminal snapshot
|
|
44
|
-
*
|
|
47
|
+
* replacement. A non-terminal snapshot carries the complete content so far,
|
|
48
|
+
* including earlier deltas, rather than a fragment to append.
|
|
45
49
|
*/
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* Why a turn stopped (ACP StopReason verbatim, plus `error`). Normalized
|
|
49
53
|
* terminal status; the raw provider string travels in `finishReason`.
|
|
50
54
|
*
|
|
51
|
-
* OPEN
|
|
52
|
-
*
|
|
53
|
-
* for this protocol and MUST be preserved. `refusal` covers provider
|
|
55
|
+
* OPEN: `_`-prefixed values are adapter extensions; unknown non-`_` values are
|
|
56
|
+
* reserved for this protocol and MUST be preserved. `refusal` covers provider
|
|
54
57
|
* content-filter/safety stops.
|
|
55
58
|
*/
|
|
56
59
|
export const STOP_REASONS = [
|
|
@@ -62,22 +65,27 @@ export const STOP_REASONS = [
|
|
|
62
65
|
"error",
|
|
63
66
|
] as const;
|
|
64
67
|
export type StopReason = (typeof STOP_REASONS)[number] | (string & {});
|
|
65
|
-
export const StopReasonSchema = openVocabulary
|
|
68
|
+
export const StopReasonSchema = openVocabulary(STOP_REASONS);
|
|
66
69
|
|
|
67
|
-
/** Why a
|
|
68
|
-
export const SESSION_END_REASONS = ["
|
|
70
|
+
/** Why a session ended. OPEN. `closed`: `session/close` released it. */
|
|
71
|
+
export const SESSION_END_REASONS = ["closed"] as const;
|
|
69
72
|
export type SessionEndReason = (typeof SESSION_END_REASONS)[number] | (string & {});
|
|
70
|
-
export const SessionEndReasonSchema = openVocabulary
|
|
73
|
+
export const SessionEndReasonSchema = openVocabulary(SESSION_END_REASONS);
|
|
71
74
|
|
|
72
75
|
/** Compaction entity status. OPEN. */
|
|
73
76
|
export const COMPACTION_STATUSES = ["in_progress", "completed", "failed", "cancelled"] as const;
|
|
74
77
|
export type CompactionStatus = (typeof COMPACTION_STATUSES)[number] | (string & {});
|
|
75
|
-
export const CompactionStatusSchema = openVocabulary
|
|
78
|
+
export const CompactionStatusSchema = openVocabulary(COMPACTION_STATUSES);
|
|
76
79
|
|
|
77
80
|
/** What caused a compaction (Claude: `auto` | `manual`). OPEN. */
|
|
78
81
|
export const COMPACTION_TRIGGERS = ["auto", "manual"] as const;
|
|
79
82
|
export type CompactionTrigger = (typeof COMPACTION_TRIGGERS)[number] | (string & {});
|
|
80
|
-
export const CompactionTriggerSchema = openVocabulary
|
|
83
|
+
export const CompactionTriggerSchema = openVocabulary(COMPACTION_TRIGGERS);
|
|
84
|
+
|
|
85
|
+
/** The session and turn an event belongs to, after its `type`. */
|
|
86
|
+
const inTurn = { sessionId: z.string(), turnId: z.string() };
|
|
87
|
+
/** What every event ends with: when it happened, and its extensions. */
|
|
88
|
+
const stamped = { timestamp: EpochMsSchema, _meta: MetaSchema };
|
|
81
89
|
|
|
82
90
|
// ---- session events ---------------------------------------------------------
|
|
83
91
|
|
|
@@ -87,7 +95,7 @@ export const SessionCreatedEventSchema = z.object({
|
|
|
87
95
|
sessionId: z.string(),
|
|
88
96
|
/** Native id to pass back as `resumeSessionId` (Claude session_id / Codex threadId). */
|
|
89
97
|
nativeSessionId: z.string(),
|
|
90
|
-
harness:
|
|
98
|
+
harness: HarnessIdSchema,
|
|
91
99
|
model: z.string().optional(),
|
|
92
100
|
/**
|
|
93
101
|
* Present only when this turn requested a resume: whether the harness
|
|
@@ -98,18 +106,16 @@ export const SessionCreatedEventSchema = z.object({
|
|
|
98
106
|
* fresh; `false` remains readable for older engines and custom harnesses.
|
|
99
107
|
*/
|
|
100
108
|
resumed: z.boolean().optional(),
|
|
101
|
-
|
|
102
|
-
_meta: MetaSchema,
|
|
109
|
+
...stamped,
|
|
103
110
|
});
|
|
104
111
|
export type SessionCreatedEvent = z.infer<typeof SessionCreatedEventSchema>;
|
|
105
112
|
|
|
106
|
-
/** The
|
|
113
|
+
/** The session is over: nothing more arrives for it, and its id is not reused. */
|
|
107
114
|
export const SessionEndedEventSchema = z.object({
|
|
108
115
|
type: z.literal("session.ended"),
|
|
109
116
|
sessionId: z.string(),
|
|
110
117
|
reason: SessionEndReasonSchema,
|
|
111
|
-
|
|
112
|
-
_meta: MetaSchema,
|
|
118
|
+
...stamped,
|
|
113
119
|
});
|
|
114
120
|
export type SessionEndedEvent = z.infer<typeof SessionEndedEventSchema>;
|
|
115
121
|
|
|
@@ -122,19 +128,69 @@ export type SessionEndedEvent = z.infer<typeof SessionEndedEventSchema>;
|
|
|
122
128
|
*/
|
|
123
129
|
export const SessionUsageEventSchema = z.object({
|
|
124
130
|
type: z.literal("session.usage"),
|
|
125
|
-
|
|
126
|
-
turnId: z.string(),
|
|
131
|
+
...inTurn,
|
|
127
132
|
/** Tokens currently occupying the context window (prompt + output). */
|
|
128
133
|
used: z.number(),
|
|
129
134
|
/** The model's context-window size, when the harness reports it. */
|
|
130
135
|
size: z.number().optional(),
|
|
131
136
|
/** Cumulative session cost in USD, when the harness reports it. */
|
|
132
137
|
cost: z.number().optional(),
|
|
133
|
-
|
|
134
|
-
_meta: MetaSchema,
|
|
138
|
+
...stamped,
|
|
135
139
|
});
|
|
136
140
|
export type SessionUsageEvent = z.infer<typeof SessionUsageEventSchema>;
|
|
137
141
|
|
|
142
|
+
/** OPEN. `limited`: the account has hit a window and turns will fail until it resets. */
|
|
143
|
+
export const LIMIT_STATUSES = ["ok", "warning", "limited"] as const;
|
|
144
|
+
export type LimitStatus = (typeof LIMIT_STATUSES)[number] | (string & {});
|
|
145
|
+
export const LimitStatusSchema = openVocabulary(LIMIT_STATUSES);
|
|
146
|
+
|
|
147
|
+
/** One usage window of the account's plan, as the provider last reported it. */
|
|
148
|
+
export const LimitWindowSchema = z.object({
|
|
149
|
+
/** The provider's name for the window: `five_hour`, `seven_day`, … */
|
|
150
|
+
id: z.string(),
|
|
151
|
+
/** How much of the window is used, 0–100. */
|
|
152
|
+
usedPercent: z.number().optional(),
|
|
153
|
+
/** When the window resets. */
|
|
154
|
+
resetsAt: EpochMsSchema.optional(),
|
|
155
|
+
/** The window's length, when the provider says. */
|
|
156
|
+
windowMinutes: z.number().optional(),
|
|
157
|
+
/** This window's own status, when the provider reports one per window (Claude). */
|
|
158
|
+
status: LimitStatusSchema.optional(),
|
|
159
|
+
});
|
|
160
|
+
export type LimitWindow = z.infer<typeof LimitWindowSchema>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The account's plan usage, whenever the harness reports it (Claude's
|
|
164
|
+
* `rate_limit_event`, Codex's `account/rateLimits/updated`): how much of each
|
|
165
|
+
* window is used and when it resets. A report may carry only the windows that
|
|
166
|
+
* changed; consumers merge by `id` (the reducer does).
|
|
167
|
+
*/
|
|
168
|
+
export const SessionLimitsEventSchema = z.object({
|
|
169
|
+
type: z.literal("session.limits"),
|
|
170
|
+
...inTurn,
|
|
171
|
+
/** The account's overall status, when the provider reports one for the whole report (Codex). */
|
|
172
|
+
status: LimitStatusSchema.optional(),
|
|
173
|
+
windows: z.array(LimitWindowSchema),
|
|
174
|
+
/** The plan the account is on, when the harness says (`plus`, `max`, …). */
|
|
175
|
+
planType: z.string().optional(),
|
|
176
|
+
...stamped,
|
|
177
|
+
});
|
|
178
|
+
export type SessionLimitsEvent = z.infer<typeof SessionLimitsEventSchema>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The agent changed the session's permission mode during the turn: it left
|
|
182
|
+
* plan mode when the user approved its plan, or entered it by itself. Later
|
|
183
|
+
* turns run in the mode they ask for, so a client that follows the agent asks
|
|
184
|
+
* for this one (ACP's `current_mode_update`).
|
|
185
|
+
*/
|
|
186
|
+
export const SessionModeEventSchema = z.object({
|
|
187
|
+
type: z.literal("session.mode"),
|
|
188
|
+
...inTurn,
|
|
189
|
+
permissionMode: ReportedPermissionModeSchema,
|
|
190
|
+
...stamped,
|
|
191
|
+
});
|
|
192
|
+
export type SessionModeEvent = z.infer<typeof SessionModeEventSchema>;
|
|
193
|
+
|
|
138
194
|
/**
|
|
139
195
|
* The compaction entity: an ID-addressed, POSITIONAL timeline entity — UPSERT
|
|
140
196
|
* by `compactionId`. The first event for an id anchors the entity's position
|
|
@@ -146,8 +202,7 @@ export type SessionUsageEvent = z.infer<typeof SessionUsageEventSchema>;
|
|
|
146
202
|
*/
|
|
147
203
|
export const SessionCompactionEventSchema = z.object({
|
|
148
204
|
type: z.literal("session.compaction"),
|
|
149
|
-
|
|
150
|
-
turnId: z.string(),
|
|
205
|
+
...inTurn,
|
|
151
206
|
compactionId: z.string(),
|
|
152
207
|
status: CompactionStatusSchema,
|
|
153
208
|
/** What triggered it, when known (Claude: `manual` | `auto`). */
|
|
@@ -159,8 +214,7 @@ export const SessionCompactionEventSchema = z.object({
|
|
|
159
214
|
summary: z.string().optional(),
|
|
160
215
|
/** Part ids the summary subsumed — auditable compaction lineage. */
|
|
161
216
|
abstractsIds: z.array(z.string()).optional(),
|
|
162
|
-
|
|
163
|
-
_meta: MetaSchema,
|
|
217
|
+
...stamped,
|
|
164
218
|
});
|
|
165
219
|
export type SessionCompactionEvent = z.infer<typeof SessionCompactionEventSchema>;
|
|
166
220
|
|
|
@@ -168,18 +222,15 @@ export type SessionCompactionEvent = z.infer<typeof SessionCompactionEventSchema
|
|
|
168
222
|
|
|
169
223
|
export const TurnStartedEventSchema = z.object({
|
|
170
224
|
type: z.literal("turn.started"),
|
|
171
|
-
|
|
172
|
-
turnId: z.string(),
|
|
225
|
+
...inTurn,
|
|
173
226
|
execution: TurnExecutionSchema.optional(),
|
|
174
|
-
|
|
175
|
-
_meta: MetaSchema,
|
|
227
|
+
...stamped,
|
|
176
228
|
});
|
|
177
229
|
export type TurnStartedEvent = z.infer<typeof TurnStartedEventSchema>;
|
|
178
230
|
|
|
179
231
|
export const TurnEndedEventSchema = z.object({
|
|
180
232
|
type: z.literal("turn.ended"),
|
|
181
|
-
|
|
182
|
-
turnId: z.string(),
|
|
233
|
+
...inTurn,
|
|
183
234
|
execution: TurnExecutionSchema.optional(),
|
|
184
235
|
/** Normalized terminal status — `cancelled` and `error` are first-class. */
|
|
185
236
|
stopReason: StopReasonSchema,
|
|
@@ -191,8 +242,13 @@ export const TurnEndedEventSchema = z.object({
|
|
|
191
242
|
cost: z.number().optional(),
|
|
192
243
|
/** Present when stopReason === "error". */
|
|
193
244
|
error: ErrorInfoSchema.optional(),
|
|
194
|
-
|
|
195
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Steers this turn accepted (`turn/steer`) that never reached the agent:
|
|
247
|
+
* the turn ended — completed, failed or was cancelled — before its next
|
|
248
|
+
* step. Each delivered steer is a user message in the turn instead.
|
|
249
|
+
*/
|
|
250
|
+
undeliveredSteers: z.array(z.string()).optional(),
|
|
251
|
+
...stamped,
|
|
196
252
|
});
|
|
197
253
|
export type TurnEndedEvent = z.infer<typeof TurnEndedEventSchema>;
|
|
198
254
|
|
|
@@ -200,10 +256,12 @@ export type TurnEndedEvent = z.infer<typeof TurnEndedEventSchema>;
|
|
|
200
256
|
|
|
201
257
|
export const MessageStartedEventSchema = z.object({
|
|
202
258
|
type: z.literal("message.started"),
|
|
203
|
-
|
|
204
|
-
turnId: z.string(),
|
|
259
|
+
...inTurn,
|
|
205
260
|
messageId: z.string(),
|
|
206
|
-
/**
|
|
261
|
+
/**
|
|
262
|
+
* Position of this message within the turn. The user echo is 0; the
|
|
263
|
+
* agent's messages, and a user message for each steer the agent read, follow.
|
|
264
|
+
*/
|
|
207
265
|
outputIndex: z.number(),
|
|
208
266
|
role: z.enum(["user", "assistant"]),
|
|
209
267
|
/**
|
|
@@ -213,9 +271,14 @@ export const MessageStartedEventSchema = z.object({
|
|
|
213
271
|
* messages.
|
|
214
272
|
*/
|
|
215
273
|
parentToolCallId: z.string().optional(),
|
|
274
|
+
/**
|
|
275
|
+
* An assistant message's model: the one the harness said wrote it
|
|
276
|
+
* (Claude's API model, a sub-agent's own), else the one it runs the turn on
|
|
277
|
+
* (the model Codex reports for its thread, or rerouted to), else the one
|
|
278
|
+
* the turn asked for.
|
|
279
|
+
*/
|
|
216
280
|
model: z.string().optional(),
|
|
217
|
-
|
|
218
|
-
_meta: MetaSchema,
|
|
281
|
+
...stamped,
|
|
219
282
|
});
|
|
220
283
|
export type MessageStartedEvent = z.infer<typeof MessageStartedEventSchema>;
|
|
221
284
|
|
|
@@ -226,15 +289,13 @@ export type MessageStartedEvent = z.infer<typeof MessageStartedEventSchema>;
|
|
|
226
289
|
*/
|
|
227
290
|
export const MessagePartEventSchema = z.object({
|
|
228
291
|
type: z.literal("message.part"),
|
|
229
|
-
|
|
230
|
-
turnId: z.string(),
|
|
292
|
+
...inTurn,
|
|
231
293
|
messageId: z.string(),
|
|
232
294
|
outputIndex: z.number(),
|
|
233
295
|
/** Position of this part within its message — persist as the ordering key. */
|
|
234
296
|
partIndex: z.number(),
|
|
235
297
|
part: PartSchema,
|
|
236
|
-
|
|
237
|
-
_meta: MetaSchema,
|
|
298
|
+
...stamped,
|
|
238
299
|
});
|
|
239
300
|
export type MessagePartEvent = z.infer<typeof MessagePartEventSchema>;
|
|
240
301
|
|
|
@@ -252,37 +313,41 @@ export type Delta = z.infer<typeof DeltaSchema>;
|
|
|
252
313
|
|
|
253
314
|
/**
|
|
254
315
|
* An additive streaming aid for a streaming part field. Advisory: snapshots
|
|
255
|
-
* are authoritative and wipe accumulated deltas. Deltas are
|
|
256
|
-
*
|
|
316
|
+
* are authoritative and wipe accumulated deltas. Deltas are LIVE ONLY: a
|
|
317
|
+
* server never keeps one, so replay, journals and history never return it, and
|
|
318
|
+
* its envelope carries the `seq` of the session's last kept event instead of
|
|
319
|
+
* one of its own. A streaming part is kept at its opening, the changes its
|
|
320
|
+
* harness reports and its end; the engine flushes what streamed into it before
|
|
321
|
+
* the turn ends, and a client that subscribes mid-part receives the part as it
|
|
322
|
+
* stands (a live `message.part`). A journal keeps what streamed since a
|
|
323
|
+
* part's last snapshot, a row per delta, before the delta is delivered, so a
|
|
324
|
+
* server process that dies loses none of what was shown (power loss can); a
|
|
325
|
+
* server without a journal can lose it.
|
|
257
326
|
*/
|
|
258
327
|
export const MessagePartDeltaEventSchema = z.object({
|
|
259
328
|
type: z.literal("message.part.delta"),
|
|
260
|
-
|
|
261
|
-
turnId: z.string(),
|
|
329
|
+
...inTurn,
|
|
262
330
|
messageId: z.string(),
|
|
263
331
|
outputIndex: z.number(),
|
|
264
332
|
partIndex: z.number(),
|
|
265
333
|
partId: z.string(),
|
|
266
334
|
delta: DeltaSchema,
|
|
267
|
-
|
|
268
|
-
_meta: MetaSchema,
|
|
335
|
+
...stamped,
|
|
269
336
|
});
|
|
270
337
|
export type MessagePartDeltaEvent = z.infer<typeof MessagePartDeltaEventSchema>;
|
|
271
338
|
|
|
272
339
|
/** Bracket marker ONLY — billing lives on turn.ended, never here. */
|
|
273
340
|
export const MessageEndedEventSchema = z.object({
|
|
274
341
|
type: z.literal("message.ended"),
|
|
275
|
-
|
|
276
|
-
turnId: z.string(),
|
|
342
|
+
...inTurn,
|
|
277
343
|
messageId: z.string(),
|
|
278
|
-
|
|
279
|
-
_meta: MetaSchema,
|
|
344
|
+
...stamped,
|
|
280
345
|
});
|
|
281
346
|
export type MessageEndedEvent = z.infer<typeof MessageEndedEventSchema>;
|
|
282
347
|
|
|
283
348
|
// ---- permissions (ACP request_permission-shaped) ----------------------------
|
|
284
349
|
|
|
285
|
-
/** OPEN
|
|
350
|
+
/** OPEN — but unknown outcomes/kinds MUST be handled conservatively: never treated as approval. */
|
|
286
351
|
export const PERMISSION_OPTION_KINDS = [
|
|
287
352
|
"allow_once",
|
|
288
353
|
"allow_always",
|
|
@@ -290,7 +355,7 @@ export const PERMISSION_OPTION_KINDS = [
|
|
|
290
355
|
"reject_always",
|
|
291
356
|
] as const;
|
|
292
357
|
export type PermissionOptionKind = (typeof PERMISSION_OPTION_KINDS)[number] | (string & {});
|
|
293
|
-
export const PermissionOptionKindSchema = openVocabulary
|
|
358
|
+
export const PermissionOptionKindSchema = openVocabulary(PERMISSION_OPTION_KINDS);
|
|
294
359
|
|
|
295
360
|
export const PermissionOptionSchema = z.object({
|
|
296
361
|
optionId: z.string(),
|
|
@@ -325,6 +390,13 @@ export const PermissionOutcomeSchema = z.discriminatedUnion("outcome", [
|
|
|
325
390
|
* carry it).
|
|
326
391
|
*/
|
|
327
392
|
updatedInput: z.record(z.string(), z.unknown()).optional(),
|
|
393
|
+
/**
|
|
394
|
+
* What the user said with their choice. A rejection's message reaches
|
|
395
|
+
* the agent as why where the harness says so
|
|
396
|
+
* (`AgentCapabilities.rejectionMessages`; a Codex plan is revised by
|
|
397
|
+
* it); a harness whose answer has no room for it drops it.
|
|
398
|
+
*/
|
|
399
|
+
message: z.string().optional(),
|
|
328
400
|
}),
|
|
329
401
|
z.object({ outcome: z.literal("cancelled") }),
|
|
330
402
|
]);
|
|
@@ -339,35 +411,118 @@ export type PermissionOutcome = z.infer<typeof PermissionOutcomeSchema>;
|
|
|
339
411
|
*/
|
|
340
412
|
export const PermissionRequestedEventSchema = z.object({
|
|
341
413
|
type: z.literal("permission.requested"),
|
|
342
|
-
|
|
343
|
-
turnId: z.string(),
|
|
414
|
+
...inTurn,
|
|
344
415
|
requestId: z.string(),
|
|
345
416
|
/** Human-readable one-line prompt, always present (render this). */
|
|
346
417
|
title: z.string(),
|
|
347
418
|
/**
|
|
348
|
-
* Structured context when the request gates a tool call
|
|
349
|
-
* harness permission is tool-scoped
|
|
350
|
-
*
|
|
419
|
+
* Structured context when the request gates a tool call. Every built-in
|
|
420
|
+
* harness's permission is tool-scoped; the field is optional because an ACP
|
|
421
|
+
* agent can raise a request with no tool call.
|
|
351
422
|
*/
|
|
352
423
|
toolCall: PermissionToolCallSchema.optional(),
|
|
353
424
|
options: z.array(PermissionOptionSchema),
|
|
354
|
-
|
|
355
|
-
_meta: MetaSchema,
|
|
425
|
+
...stamped,
|
|
356
426
|
});
|
|
357
427
|
export type PermissionRequestedEvent = z.infer<typeof PermissionRequestedEventSchema>;
|
|
358
428
|
|
|
359
429
|
/** A pending permission request was answered (or cancelled). Resolves exactly once. */
|
|
360
430
|
export const PermissionResolvedEventSchema = z.object({
|
|
361
431
|
type: z.literal("permission.resolved"),
|
|
362
|
-
|
|
363
|
-
turnId: z.string(),
|
|
432
|
+
...inTurn,
|
|
364
433
|
requestId: z.string(),
|
|
365
434
|
outcome: PermissionOutcomeSchema,
|
|
366
|
-
|
|
367
|
-
_meta: MetaSchema,
|
|
435
|
+
...stamped,
|
|
368
436
|
});
|
|
369
437
|
export type PermissionResolvedEvent = z.infer<typeof PermissionResolvedEventSchema>;
|
|
370
438
|
|
|
439
|
+
// ---- elicitation (ACP elicitation/create-shaped) -----------------------------
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* How the agent asks. OPEN: `question` is the agent's own question with
|
|
443
|
+
* choices (Claude's AskUserQuestion, Codex's request_user_input); `form` and
|
|
444
|
+
* `url` are MCP and ACP elicitation modes. A harness declines a mode it does
|
|
445
|
+
* not know.
|
|
446
|
+
*/
|
|
447
|
+
export const ELICITATION_MODES = ["question", "form", "url"] as const;
|
|
448
|
+
export type ElicitationMode = (typeof ELICITATION_MODES)[number] | (string & {});
|
|
449
|
+
export const ElicitationModeSchema = openVocabulary(ELICITATION_MODES);
|
|
450
|
+
|
|
451
|
+
/** One question of a `question` elicitation. */
|
|
452
|
+
export const ElicitationQuestionSchema = z.object({
|
|
453
|
+
/** The answer is keyed by this id. */
|
|
454
|
+
id: z.string(),
|
|
455
|
+
question: z.string(),
|
|
456
|
+
/** A short label for the question (a chip or tag). */
|
|
457
|
+
header: z.string().optional(),
|
|
458
|
+
/** The choices to offer; absent means a free-text answer. */
|
|
459
|
+
options: z.array(z.object({ label: z.string(), description: z.string().optional() })).optional(),
|
|
460
|
+
/** More than one option may be chosen. */
|
|
461
|
+
multiSelect: z.boolean().optional(),
|
|
462
|
+
/** The user may answer in their own words instead of choosing an option. */
|
|
463
|
+
allowOther: z.boolean().optional(),
|
|
464
|
+
/** The answer is a secret (a password, a token): mask it and never echo it. */
|
|
465
|
+
secret: z.boolean().optional(),
|
|
466
|
+
});
|
|
467
|
+
export type ElicitationQuestion = z.infer<typeof ElicitationQuestionSchema>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* The agent, or one of its MCP servers, waits for the user's input. Answer via
|
|
471
|
+
* `AgentRuntime.respondElicitation(sessionId, requestId, outcome)`; pending
|
|
472
|
+
* requests resolve as `cancel` when the turn is cancelled or ends. Raised only
|
|
473
|
+
* in a turn whose `config.elicitation` says its client answers them — otherwise
|
|
474
|
+
* the harness declines on the user's behalf and the agent carries on.
|
|
475
|
+
*/
|
|
476
|
+
export const ElicitationRequestedEventSchema = z.object({
|
|
477
|
+
type: z.literal("elicitation.requested"),
|
|
478
|
+
...inTurn,
|
|
479
|
+
requestId: z.string(),
|
|
480
|
+
mode: ElicitationModeSchema,
|
|
481
|
+
/** Human-readable prompt, always present (render this). */
|
|
482
|
+
message: z.string(),
|
|
483
|
+
/** The MCP server asking; absent when the agent itself asks. */
|
|
484
|
+
serverName: z.string().optional(),
|
|
485
|
+
/** The tool part this request belongs to, when the harness can tell. */
|
|
486
|
+
toolCallId: z.string().optional(),
|
|
487
|
+
/** `question` mode: what to ask. */
|
|
488
|
+
questions: z.array(ElicitationQuestionSchema).optional(),
|
|
489
|
+
/** `form` mode: the MCP elicitation schema, a flat object of primitive properties. */
|
|
490
|
+
requestedSchema: z.record(z.string(), z.unknown()).optional(),
|
|
491
|
+
/** `url` mode: where the user completes the request. */
|
|
492
|
+
url: z.string().optional(),
|
|
493
|
+
/** `url` mode: the id a later completion notice refers to. */
|
|
494
|
+
elicitationId: z.string().optional(),
|
|
495
|
+
...stamped,
|
|
496
|
+
});
|
|
497
|
+
export type ElicitationRequestedEvent = z.infer<typeof ElicitationRequestedEventSchema>;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* The user's answer, ACP's three actions. `accept` carries `content`: in
|
|
501
|
+
* `question` mode each question id maps to an array of answers (chosen labels
|
|
502
|
+
* or the user's own words), in `form` mode the schema's properties map to
|
|
503
|
+
* their values, and `url` mode has none. `decline` is an explicit no; `cancel`
|
|
504
|
+
* dismisses without one, and is what a turn's end resolves a pending request as.
|
|
505
|
+
*/
|
|
506
|
+
export const ElicitationOutcomeSchema = z.discriminatedUnion("action", [
|
|
507
|
+
z.object({
|
|
508
|
+
action: z.literal("accept"),
|
|
509
|
+
content: z.record(z.string(), z.unknown()).optional(),
|
|
510
|
+
}),
|
|
511
|
+
z.object({ action: z.literal("decline") }),
|
|
512
|
+
z.object({ action: z.literal("cancel") }),
|
|
513
|
+
]);
|
|
514
|
+
export type ElicitationOutcome = z.infer<typeof ElicitationOutcomeSchema>;
|
|
515
|
+
|
|
516
|
+
/** A pending elicitation was answered (or cancelled). Resolves exactly once. */
|
|
517
|
+
export const ElicitationResolvedEventSchema = z.object({
|
|
518
|
+
type: z.literal("elicitation.resolved"),
|
|
519
|
+
...inTurn,
|
|
520
|
+
requestId: z.string(),
|
|
521
|
+
outcome: ElicitationOutcomeSchema,
|
|
522
|
+
...stamped,
|
|
523
|
+
});
|
|
524
|
+
export type ElicitationResolvedEvent = z.infer<typeof ElicitationResolvedEventSchema>;
|
|
525
|
+
|
|
371
526
|
// ---- error + raw ------------------------------------------------------------
|
|
372
527
|
|
|
373
528
|
export const ErrorEventSchema = z.object({
|
|
@@ -382,9 +537,16 @@ export const ErrorEventSchema = z.object({
|
|
|
382
537
|
* flip UI to an error state on recoverable errors — surface as diagnostics.
|
|
383
538
|
*/
|
|
384
539
|
recoverable: z.boolean(),
|
|
540
|
+
/** A recoverable error the harness is retrying: which attempt, of how many, after what wait. */
|
|
541
|
+
retry: z
|
|
542
|
+
.object({
|
|
543
|
+
attempt: z.number().optional(),
|
|
544
|
+
maxAttempts: z.number().optional(),
|
|
545
|
+
delayMs: z.number().optional(),
|
|
546
|
+
})
|
|
547
|
+
.optional(),
|
|
385
548
|
stack: z.string().optional(),
|
|
386
|
-
|
|
387
|
-
_meta: MetaSchema,
|
|
549
|
+
...stamped,
|
|
388
550
|
});
|
|
389
551
|
export type ErrorEvent = z.infer<typeof ErrorEventSchema>;
|
|
390
552
|
|
|
@@ -396,12 +558,10 @@ export type ErrorEvent = z.infer<typeof ErrorEventSchema>;
|
|
|
396
558
|
*/
|
|
397
559
|
export const RawEventSchema = z.object({
|
|
398
560
|
type: z.literal("raw"),
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
harness: AgentHarnessSchema,
|
|
561
|
+
...inTurn,
|
|
562
|
+
harness: HarnessIdSchema,
|
|
402
563
|
data: z.unknown(),
|
|
403
|
-
|
|
404
|
-
_meta: MetaSchema,
|
|
564
|
+
...stamped,
|
|
405
565
|
});
|
|
406
566
|
export type RawEvent = z.infer<typeof RawEventSchema>;
|
|
407
567
|
|
|
@@ -417,16 +577,21 @@ export const LifecycleEventSchema = z.discriminatedUnion("type", [
|
|
|
417
577
|
MessageEndedEventSchema,
|
|
418
578
|
TurnEndedEventSchema,
|
|
419
579
|
SessionUsageEventSchema,
|
|
580
|
+
SessionLimitsEventSchema,
|
|
581
|
+
SessionModeEventSchema,
|
|
420
582
|
SessionCompactionEventSchema,
|
|
421
583
|
ErrorEventSchema,
|
|
422
584
|
PermissionRequestedEventSchema,
|
|
423
585
|
PermissionResolvedEventSchema,
|
|
586
|
+
ElicitationRequestedEventSchema,
|
|
587
|
+
ElicitationResolvedEventSchema,
|
|
424
588
|
RawEventSchema,
|
|
425
589
|
]);
|
|
426
590
|
export type LifecycleEvent = z.infer<typeof LifecycleEventSchema>;
|
|
427
591
|
|
|
592
|
+
// @ref LLP 0002#tolerant-of-the-unknown-strict-about-the-known — preserved, never dropped
|
|
428
593
|
/**
|
|
429
|
-
*
|
|
594
|
+
* Tolerant of the unknown, strict about the known: an event with an
|
|
430
595
|
* unknown `type` is preserved (in order, never dropped) as an UnknownEvent;
|
|
431
596
|
* a KNOWN type with a malformed body is a hard error.
|
|
432
597
|
*/
|
|
@@ -435,17 +600,23 @@ export interface UnknownEvent {
|
|
|
435
600
|
sessionId?: string;
|
|
436
601
|
raw: Record<string, unknown>;
|
|
437
602
|
}
|
|
603
|
+
/** A preserved unknown event as persisted state holds it, everything it carried kept. */
|
|
604
|
+
export const UnknownEventSchema = z.looseObject({
|
|
605
|
+
type: z.string(),
|
|
606
|
+
sessionId: z.string().optional(),
|
|
607
|
+
raw: z.record(z.string(), z.unknown()),
|
|
608
|
+
}) as unknown as z.ZodType<UnknownEvent>;
|
|
438
609
|
|
|
439
610
|
/**
|
|
440
611
|
* A `message.part` whose part may be an `UnknownPart`: the event envelope is
|
|
441
|
-
* protocol-owned (strict), the part inside it is not
|
|
612
|
+
* protocol-owned (strict), the part inside it is not.
|
|
442
613
|
*/
|
|
443
614
|
export interface DecodedMessagePartEvent extends Omit<MessagePartEvent, "part"> {
|
|
444
615
|
part: Part | UnknownPart;
|
|
445
616
|
}
|
|
446
617
|
|
|
447
618
|
/**
|
|
448
|
-
* What
|
|
619
|
+
* What the tolerant decoder (LLP 0002) yields for a KNOWN event type. Identical to
|
|
449
620
|
* `LifecycleEvent` except that `message.part` may carry an unknown part — so
|
|
450
621
|
* every `LifecycleEvent` is a `DecodedLifecycleEvent`, and consumers that
|
|
451
622
|
* accept this type accept both.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Zod-free, so the factories can name the keys they write.
|
|
2
|
+
/**
|
|
3
|
+
* The `_meta` keys the engine itself writes, all under `agent-server/`
|
|
4
|
+
* (camelCase after the slash, like every wire field).
|
|
5
|
+
*/
|
|
6
|
+
export const META_KEYS = {
|
|
7
|
+
/**
|
|
8
|
+
* The partial JSON a pending tool call was still streaming when its turn
|
|
9
|
+
* closed it: its closed state carries a parsed `input` the call never had,
|
|
10
|
+
* and without this a UI would render an empty tool card.
|
|
11
|
+
*/
|
|
12
|
+
partialInput: "agent-server/partialInput",
|
|
13
|
+
/** The text element spans (mentions, pills) of a user message's text, echoed from its input. */
|
|
14
|
+
elements: "agent-server/elements",
|
|
15
|
+
/** Over ACP: the failure of a turn that ended, which ACP's stop reasons cannot carry. */
|
|
16
|
+
error: "agent-server/error",
|
|
17
|
+
} as const;
|
package/src/protocol/meta.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
+
// @ref LLP 0002#extensions-live-in-_meta — root names stay the protocol's
|
|
3
4
|
/**
|
|
4
|
-
* The extension slot (
|
|
5
|
+
* The extension slot (ACP's pattern): present on every event, part,
|
|
5
6
|
* tool state, and result-content item. Adapters and products MUST NOT add
|
|
6
7
|
* root-level fields to canonical types — all root names are reserved for
|
|
7
8
|
* future protocol versions; extensions live here under namespaced keys
|
|
8
|
-
* (`
|
|
9
|
+
* (`product/...`).
|
|
9
10
|
*
|
|
10
11
|
* Reserved keys (W3C trace context, MCP-compatible): `traceparent`,
|
|
11
12
|
* `tracestate`, `baggage`.
|
|
12
13
|
*/
|
|
13
14
|
export const MetaSchema = z.record(z.string(), z.unknown()).optional();
|
|
14
|
-
export type Meta = Record<string, unknown>;
|
package/src/protocol/models.ts
CHANGED
|
@@ -76,58 +76,17 @@ export function decodeModelList(value: unknown): ModelList {
|
|
|
76
76
|
return ModelListSchema.parse({ ...(value as object), models });
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
/**
|
|
80
|
-
* Advisory catalog entry in the 0.3 shape. `model` on a RunConfig is a
|
|
81
|
-
* free-form string (harnesses pass it through), so unlisted models still work.
|
|
82
|
-
*/
|
|
83
|
-
export interface ModelInfo {
|
|
84
|
-
readonly id: string;
|
|
85
|
-
readonly harness: AgentHarness;
|
|
86
|
-
readonly label: string;
|
|
87
|
-
/** The levels the model runs as distinct settings, lowest first. Empty: no control. */
|
|
88
|
-
readonly thinking: readonly ThinkingLevel[];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
79
|
/**
|
|
92
80
|
* The models each harness's pinned CLI listed when this release was built
|
|
93
81
|
* (`bun run models:refresh`), for a picker without a live list. The live list
|
|
94
82
|
* is the account's own: prefer `AgentRuntime.models()` / `client.listModels()`.
|
|
95
|
-
* `codex-sdk` runs the same CLI as `codex-app-server`.
|
|
96
|
-
*/
|
|
97
|
-
export const CATALOG_MODELS: readonly ModelDescriptor[] = GENERATED_MODEL_CATALOG.models.flatMap(
|
|
98
|
-
(model) =>
|
|
99
|
-
model.harness === "codex-app-server" ? [model, { ...model, harness: "codex-sdk" }] : [model],
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
export const MODEL_CATALOG: readonly ModelInfo[] = CATALOG_MODELS.map((model) => ({
|
|
103
|
-
id: model.id,
|
|
104
|
-
harness: model.harness,
|
|
105
|
-
label: model.label,
|
|
106
|
-
thinking: model.thinking.levels,
|
|
107
|
-
}));
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* The model a turn runs on when its config names none. `undefined` means the
|
|
111
|
-
* harness's CLI picks: Claude Code its own default for the account, Codex the
|
|
112
|
-
* one in `~/.codex/config.toml`. The engine never substitutes a model.
|
|
113
83
|
*/
|
|
114
|
-
export const
|
|
115
|
-
"claude-code": undefined,
|
|
116
|
-
"codex-sdk": undefined,
|
|
117
|
-
"codex-app-server": undefined,
|
|
118
|
-
// ACP v1 has no portable model parameter (selection is agent-defined via
|
|
119
|
-
// config options), so the target agent always uses its own default.
|
|
120
|
-
acp: undefined,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export function modelsForHarness(harness: AgentHarness): readonly ModelInfo[] {
|
|
124
|
-
return MODEL_CATALOG.filter((m) => m.harness === harness);
|
|
125
|
-
}
|
|
84
|
+
export const CATALOG_MODELS: readonly ModelDescriptor[] = GENERATED_MODEL_CATALOG.models;
|
|
126
85
|
|
|
127
86
|
/** The catalog's thinking levels for a model; `undefined` when it isn't listed. */
|
|
128
87
|
export function modelThinkingLevels(
|
|
129
88
|
harness: AgentHarness,
|
|
130
89
|
model: string,
|
|
131
90
|
): readonly ThinkingLevel[] | undefined {
|
|
132
|
-
return
|
|
91
|
+
return CATALOG_MODELS.find((m) => m.harness === harness && m.id === model)?.thinking.levels;
|
|
133
92
|
}
|