@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ConversationChange, ConversationState } from "./conversation.ts";
|
|
2
|
+
import type { DecodedLifecycleEvent, UnknownEvent } from "./lifecycle.ts";
|
|
3
|
+
/** Fold one lifecycle event into the conversation. Pure; returns a new state. */
|
|
4
|
+
export declare function reduceConversation(state: ConversationState, event: DecodedLifecycleEvent | UnknownEvent): ConversationState;
|
|
5
|
+
/**
|
|
6
|
+
* The same fold, plus the list of what it touched — for sinks that must WRITE
|
|
7
|
+
* rather than re-render: a persistence layer deciding which rows to upsert, a
|
|
8
|
+
* cache deciding which queries to invalidate, a projection keeping a second
|
|
9
|
+
* store in step.
|
|
10
|
+
*
|
|
11
|
+
* The changes are recorded BY the fold, not diffed from its output: there is
|
|
12
|
+
* exactly one implementation of the consumption rules, and `reduceConversation`
|
|
13
|
+
* is this function with the recorder thrown away. That is what makes the two
|
|
14
|
+
* impossible to drift apart — a new mutation site either reports itself or is
|
|
15
|
+
* invisible to every sink at once, which the tests pin.
|
|
16
|
+
*
|
|
17
|
+
* Ordering within one event is causal: the message shell before the part that
|
|
18
|
+
* forced it, the turn before the permissions its end cancelled. SQL semantics
|
|
19
|
+
* (ON CONFLICT vs REPLACE, COALESCE guards) stay yours — they are schema
|
|
20
|
+
* knowledge, not fold knowledge.
|
|
21
|
+
*/
|
|
22
|
+
export declare function reduceConversationWithChanges(state: ConversationState, event: DecodedLifecycleEvent | UnknownEvent): {
|
|
23
|
+
state: ConversationState;
|
|
24
|
+
changes: ConversationChange[];
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=reduce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduce.d.ts","sourceRoot":"","sources":["../../../src/protocol/reduce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,kBAAkB,EAGlB,iBAAiB,EAGjB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAEX,qBAAqB,EAErB,YAAY,EACZ,MAAM,gBAAgB,CAAC;AAoPxB,iFAAiF;AACjF,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,qBAAqB,GAAG,YAAY,GACzC,iBAAiB,CAEnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,iBAAiB,EACxB,KAAK,EAAE,qBAAqB,GAAG,YAAY,GACzC;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAI7D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ConversationMessage, ConversationState, TimelineEntry } from "./conversation.ts";
|
|
2
|
+
/**
|
|
3
|
+
* One rendered turn card: a run of consecutive timeline entries that belong to
|
|
4
|
+
* the same turn and the same speaker.
|
|
5
|
+
*/
|
|
6
|
+
export interface ConversationTurnGroup {
|
|
7
|
+
turnId: string;
|
|
8
|
+
role: "user" | "assistant";
|
|
9
|
+
/** Messages (and compactions) in stream order. */
|
|
10
|
+
entries: TimelineEntry[];
|
|
11
|
+
/** True for the final group only — see `groupIntoTurns`. */
|
|
12
|
+
isLatest: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Group the timeline into turn cards: consecutive entries break into a new
|
|
16
|
+
* group when the speaker changes or the turn changes. (A group carries one
|
|
17
|
+
* `turnId`, so two back-to-back user echoes from different turns stay
|
|
18
|
+
* separate even though the role is unchanged.) Compactions are engine-side
|
|
19
|
+
* content and group as `assistant` within their turn — a divider that renders
|
|
20
|
+
* inside the run it interrupted, which is where it happened.
|
|
21
|
+
*
|
|
22
|
+
* `isLatest` is TRUE FOR THE FINAL GROUP ONLY, and only while nothing follows
|
|
23
|
+
* it. That guard is the whole point: a consumer renders the latest group in
|
|
24
|
+
* streaming mode (expanded, live cursor), and the moment the next turn's user
|
|
25
|
+
* echo lands, the previous group MUST lose the flag. Without it, the gap
|
|
26
|
+
* between "user submits" and "first assistant part arrives" re-opens the
|
|
27
|
+
* finished turn in streaming mode — the completed answer visibly reverts to
|
|
28
|
+
* "working". Combine with your own busy flag (`isLatest && role ===
|
|
29
|
+
* "assistant" && isWorking`), never with position alone.
|
|
30
|
+
*/
|
|
31
|
+
export declare function groupIntoTurns(state: ConversationState): ConversationTurnGroup[];
|
|
32
|
+
/**
|
|
33
|
+
* Subagent output, keyed by the `toolCallId` of the tool that spawned it.
|
|
34
|
+
*
|
|
35
|
+
* A message with `parentToolCallId` is NOT top-level model output — rendering
|
|
36
|
+
* it in the main flow double-prints the subagent's work next to the tool card
|
|
37
|
+
* that owns it. Consumers nest `subagentGroups(state).get(part.toolCallId)`
|
|
38
|
+
* under the tool part and filter parented messages out of the main timeline
|
|
39
|
+
* (`groupIntoTurns` keeps them, because "which turn did this belong to" is
|
|
40
|
+
* still true — the filtering is a rendering choice).
|
|
41
|
+
*/
|
|
42
|
+
export declare function subagentGroups(state: ConversationState): Map<string, ConversationMessage[]>;
|
|
43
|
+
/** What the agent is doing right now, for a live activity indicator. */
|
|
44
|
+
export type AgentActivity = "thinking" | "generating" | "tool_running" | "tool_failed" | "idle";
|
|
45
|
+
/**
|
|
46
|
+
* Derive the live activity from the LAST part of the LAST top-level assistant
|
|
47
|
+
* message of the LAST ACTIVE turn: reasoning → `thinking`, text →
|
|
48
|
+
* `generating`, a pending/in-progress tool → `tool_running`, a failed tool →
|
|
49
|
+
* `tool_failed`.
|
|
50
|
+
*
|
|
51
|
+
* Everything else is `idle` — no active turn, no assistant output yet, an
|
|
52
|
+
* unknown part type, or a part that says nothing about what happens next (a
|
|
53
|
+
* completed tool: the model is about to speak, but the stream has not said so
|
|
54
|
+
* yet). `idle` DURING an active turn means "between observable activities",
|
|
55
|
+
* not "finished": a consumer with its own busy flag renders its default
|
|
56
|
+
* working state there rather than nothing.
|
|
57
|
+
*
|
|
58
|
+
* Subagent messages (`parentToolCallId`) are skipped: the main thread's
|
|
59
|
+
* activity is the spawning tool call, which stays `tool_running` for as long
|
|
60
|
+
* as the subagent works — otherwise the indicator would flicker on the
|
|
61
|
+
* subagent's internal steps.
|
|
62
|
+
*/
|
|
63
|
+
export declare function agentActivity(state: ConversationState): AgentActivity;
|
|
64
|
+
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/protocol/selectors.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE/F;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,kDAAkD;IAClD,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,qBAAqB,EAAE,CAchF;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,mBAAmB,EAAE,CAAC,CAS3F;AAED,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,GAAG,MAAM,CAAC;AAEhG;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,aAAa,CAwCrE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one envelope's `seq` means for a session's cursor.
|
|
3
|
+
*
|
|
4
|
+
* - `deliver` — the expected next envelope; the cursor advanced to it.
|
|
5
|
+
* - `duplicate` — already delivered (a replay overlap, a resync); drop it.
|
|
6
|
+
* The cursor does NOT move.
|
|
7
|
+
* - `gap` — envelopes were missed; hold this one and heal (replay).
|
|
8
|
+
* The cursor does NOT move, so the healed events still land
|
|
9
|
+
* in order.
|
|
10
|
+
* - `reset` — `seq` restarted at 1 while the cursor was past it: the
|
|
11
|
+
* session log began again (a new server process behind a
|
|
12
|
+
* reconnecting transport). The cursor resets and DELIVERS
|
|
13
|
+
* this envelope — treating it as a duplicate silently drops
|
|
14
|
+
* the entire post-restart stream, which is exactly the bug
|
|
15
|
+
* this verdict exists to prevent. The caller must drop the
|
|
16
|
+
* state it was holding for the dead log (held-back envelopes,
|
|
17
|
+
* partial reconstruction); the fresh log is authoritative.
|
|
18
|
+
*
|
|
19
|
+
* The reset rule is a HEURISTIC with two documented blind spots — at the seq
|
|
20
|
+
* layer, a restart is indistinguishable from a redelivery in exactly these:
|
|
21
|
+
* a restart seen while the cursor sits at 1 (the fresh seq 1 reads as a
|
|
22
|
+
* duplicate), and a restart first contacted mid-stream (fresh seq k ≤ last
|
|
23
|
+
* reads as a duplicate). Callers with a second signal close them: the wire
|
|
24
|
+
* client does not guess at all — `initialize` returns a per-process
|
|
25
|
+
* `instanceId` and a reconnect re-handshake adopts the fresh logs outright;
|
|
26
|
+
* a consumer without a handshake (a browser folding forwarded envelopes)
|
|
27
|
+
* treats any backwards seq beyond the immediately-last frame as a
|
|
28
|
+
* replacement.
|
|
29
|
+
*/
|
|
30
|
+
export type SeqVerdict = "deliver" | "duplicate" | "gap" | "reset";
|
|
31
|
+
/**
|
|
32
|
+
* Per-session `seq` bookkeeping — the whole of "did I already see this, did I
|
|
33
|
+
* miss something, did the server restart", with no transport, no schemas and
|
|
34
|
+
* no dependencies.
|
|
35
|
+
*
|
|
36
|
+
* This is the wire client's own discipline, hoisted so the consumers that
|
|
37
|
+
* cannot use the client (a backend folding envelopes forwarded over its own
|
|
38
|
+
* WebSocket, a Durable Object replaying a log) get the same answers instead of
|
|
39
|
+
* a fourth hand-rolled variant. `AgentServerClient` is implemented on it.
|
|
40
|
+
*/
|
|
41
|
+
export interface SeqCursor {
|
|
42
|
+
/** Classify `seq` for `sessionId`, advancing the cursor when it delivers. */
|
|
43
|
+
advance(sessionId: string, seq: number): SeqVerdict;
|
|
44
|
+
/**
|
|
45
|
+
* Classify a live-only envelope (`isLiveOnlyEvent`: a token delta), whose
|
|
46
|
+
* `seq` is that of the last kept event before it. It delivers when the
|
|
47
|
+
* cursor stands at that event and never moves the cursor; `duplicate` once
|
|
48
|
+
* the cursor has moved past it (a stale delta, which its part's snapshot
|
|
49
|
+
* already covers); `gap` before the cursor gets there (hold it behind the
|
|
50
|
+
* kept events still missing).
|
|
51
|
+
*/
|
|
52
|
+
advanceLive(sessionId: string, seq: number): Exclude<SeqVerdict, "reset">;
|
|
53
|
+
/** Forget the session entirely — the next `seq` starts a fresh stream. */
|
|
54
|
+
reset(sessionId: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Force the watermark (an evicted prefix accepted as lost, a snapshot
|
|
57
|
+
* restored from durable state). The next contiguous envelope is `seq + 1`.
|
|
58
|
+
*/
|
|
59
|
+
seek(sessionId: string, seq: number): void;
|
|
60
|
+
/** Highest delivered `seq` for the session; 0 when none is known. */
|
|
61
|
+
last(sessionId: string): number;
|
|
62
|
+
/** The sessions with a cursor — what to resync after a reconnect. */
|
|
63
|
+
sessions(): string[];
|
|
64
|
+
}
|
|
65
|
+
export declare function createSeqCursor(): SeqCursor;
|
|
66
|
+
//# sourceMappingURL=seq-cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seq-cursor.d.ts","sourceRoot":"","sources":["../../../src/protocol/seq-cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,KAAK,GAAG,OAAO,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,WAAW,SAAS;IACzB,6EAA6E;IAC7E,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;IACpD;;;;;;;OAOG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC1E,0EAA0E;IAC1E,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,qEAAqE;IACrE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,qEAAqE;IACrE,QAAQ,IAAI,MAAM,EAAE,CAAC;CACrB;AAED,wBAAgB,eAAe,IAAI,SAAS,CAkC3C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { StopReason } from "./lifecycle.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The stop reasons that mean "the turn finished the way it was supposed to".
|
|
4
|
+
* A subset of `STOP_REASONS` — everything except `error`.
|
|
5
|
+
*
|
|
6
|
+
* `cancelled` is CLEAN: the user asked for the turn to stop and it stopped.
|
|
7
|
+
* Products that treat it as a failure paint an error banner over the user's
|
|
8
|
+
* own action (all three copies of this set in the wild got this right, and
|
|
9
|
+
* two of them then drifted on `refusal` and `max_turn_requests`).
|
|
10
|
+
*
|
|
11
|
+
* Zod-free and dependency-free on purpose: this is a membership test, and a
|
|
12
|
+
* consumer branching on a stop reason should not have to load the schemas.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CLEAN_STOP_REASONS: readonly ["end_turn", "max_tokens", "max_turn_requests", "refusal", "cancelled"];
|
|
15
|
+
/**
|
|
16
|
+
* True when the turn stopped for a reason this build knows to be clean.
|
|
17
|
+
*
|
|
18
|
+
* `StopReason` is an OPEN vocabulary: a newer engine's value, or an
|
|
19
|
+
* adapter's `_`-prefixed extension, reaches an older consumer unchanged. Such
|
|
20
|
+
* a value is classified as NOT clean — the conservative direction. Showing a
|
|
21
|
+
* failure affordance for an outcome we cannot interpret is recoverable (the
|
|
22
|
+
* user retries); silently rendering an unknown outcome as success is not (the
|
|
23
|
+
* turn looks complete, the work is gone, nothing points at the cause).
|
|
24
|
+
*/
|
|
25
|
+
export declare function isCleanStop(reason: StopReason | undefined): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The complement of `isCleanStop`: `error`, plus every stop reason this build
|
|
28
|
+
* does not know (see the conservative-classification note above). `undefined`
|
|
29
|
+
* — a turn with no stop reason at all — is a failure too: a turn that ended
|
|
30
|
+
* without saying why did not end well.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isFailureStopReason(reason: StopReason | undefined): boolean;
|
|
33
|
+
//# sourceMappingURL=stop-reasons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-reasons.d.ts","sourceRoot":"","sources":["../../../src/protocol/stop-reasons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,kFAMrB,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAE3E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* A single, harness-agnostic reasoning dial. Each harness maps it to its own
|
|
4
|
+
* native control: Claude -> adaptive `thinking` + `effort`; Codex ->
|
|
5
|
+
* `ReasoningEffort`. What runs depends on the model: Claude's ceiling is `max`
|
|
6
|
+
* (it runs `ultra` as `max`), and Codex runs the nearest level the model
|
|
7
|
+
* accepts.
|
|
8
|
+
*/
|
|
9
|
+
export declare const THINKING_LEVELS: readonly ["off", "low", "medium", "high", "xhigh", "max", "ultra"];
|
|
10
|
+
export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
|
|
11
|
+
export declare const ThinkingLevelSchema: z.ZodEnum<{
|
|
12
|
+
off: "off";
|
|
13
|
+
low: "low";
|
|
14
|
+
medium: "medium";
|
|
15
|
+
high: "high";
|
|
16
|
+
xhigh: "xhigh";
|
|
17
|
+
max: "max";
|
|
18
|
+
ultra: "ultra";
|
|
19
|
+
}>;
|
|
20
|
+
export declare function isThinkingLevel(v: string): v is ThinkingLevel;
|
|
21
|
+
/**
|
|
22
|
+
* The level a model runs when it offers only `supported`: the highest one at
|
|
23
|
+
* or below `level`, else its lowest. Use it when switching models, so `ultra`
|
|
24
|
+
* on a model topping out at `max` becomes `max`, not a fixed fallback.
|
|
25
|
+
* `undefined` when the model offers none.
|
|
26
|
+
*/
|
|
27
|
+
export declare function clampThinkingLevel(level: ThinkingLevel, supported: readonly ThinkingLevel[]): ThinkingLevel | undefined;
|
|
28
|
+
//# sourceMappingURL=thinking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking.d.ts","sourceRoot":"","sources":["../../../src/protocol/thinking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,oEAAqE,CAAC;AAClG,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7D,eAAO,MAAM,mBAAmB;;;;;;;;EAA0B,CAAC;AAE3D,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,aAAa,CAE7D;AAID;;;;;GAKG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,SAAS,aAAa,EAAE,GACjC,aAAa,GAAG,SAAS,CAS3B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Every instant on this wire is epoch MILLISECONDS, as an integer.
|
|
4
|
+
* One schema, used by every `timestamp` and every nested `time.start`/
|
|
5
|
+
* `time.end`, so the boundary validation is real rather than prose: a bare
|
|
6
|
+
* `z.number()` accepts `-5`, `1.5` and `-0`, all of which round-trip silently
|
|
7
|
+
* and then sort, subtract and render wrong (a seconds-based stamp lands in
|
|
8
|
+
* 1970; `-0` breaks `Object.is` keyed caches).
|
|
9
|
+
*/
|
|
10
|
+
export declare const EpochMsSchema: z.ZodNumber;
|
|
11
|
+
/** A start/end span in epoch ms (tool executions, thinking blocks). */
|
|
12
|
+
export declare const TimeSpanSchema: z.ZodObject<{
|
|
13
|
+
start: z.ZodNumber;
|
|
14
|
+
end: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/** A span whose end is unknown while the thing is still running. */
|
|
17
|
+
export declare const OpenTimeSpanSchema: z.ZodObject<{
|
|
18
|
+
start: z.ZodNumber;
|
|
19
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/protocol/time.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,aAMwD,CAAC;AAEnF,uEAAuE;AACvE,eAAO,MAAM,cAAc;;;iBAAyD,CAAC;AACrF,oEAAoE;AACpE,eAAO,MAAM,kBAAkB;;;iBAAoE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Normalized token accounting. Every harness reports usage differently
|
|
4
|
+
* (Claude: input/output/cache_creation/cache_read; Codex: input/output/
|
|
5
|
+
* reasoning/cached). Adapters fold those into this single shape.
|
|
6
|
+
*
|
|
7
|
+
* INVARIANTS (normative — so consumers never subtract):
|
|
8
|
+
* - `input` is NON-CACHED input tokens ONLY; billed input =
|
|
9
|
+
* `input + cache.read + cache.write` (the three are disjoint).
|
|
10
|
+
* - `reasoning` is a subset of `output` (output already includes it).
|
|
11
|
+
* - `writeEphemeral5m`/`writeEphemeral1h` are subsets of `cache.write`.
|
|
12
|
+
* Providers that fold cache hits into a total prompt count are unfolded once,
|
|
13
|
+
* at the adapter — never downstream.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TokenUsageSchema: z.ZodObject<{
|
|
16
|
+
input: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
output: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
reasoning: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
cache: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
read: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
write: z.ZodDefault<z.ZodNumber>;
|
|
22
|
+
writeEphemeral5m: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
writeEphemeral1h: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type TokenUsage = z.infer<typeof TokenUsageSchema>;
|
|
27
|
+
export declare const DEFAULT_TOKEN_USAGE: TokenUsage;
|
|
28
|
+
export declare function addTokenUsage(a: TokenUsage, b: TokenUsage): TokenUsage;
|
|
29
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/protocol/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;iBAc3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,mBAAmB,EAAE,UAKjC,CAAC;AAOF,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,CAgBtE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ConversationState } from "./conversation.ts";
|
|
2
|
+
import type { ToolPart } from "./parts.ts";
|
|
3
|
+
/** Why a tool its turn left running failed: it may have done what it was for. */
|
|
4
|
+
export declare const TOOL_OUTCOME_UNKNOWN = "The turn ended before this tool finished. Its outcome is unknown and its effects were not undone.";
|
|
5
|
+
/** Why a tool call its turn left half-written, or never approved, failed: it never ran. */
|
|
6
|
+
export declare const TOOL_NEVER_RAN = "The turn ended before this tool call was complete, so it never ran.";
|
|
7
|
+
/** Why a tool that was running when agent-server stopped failed: as with an ended turn, it may have run. */
|
|
8
|
+
export declare const TOOL_INTERRUPTED = "Tool execution was interrupted when agent-server stopped. Its outcome is unknown and its effects were not undone. Check the current state before continuing or retrying.";
|
|
9
|
+
/**
|
|
10
|
+
* How a tool its turn left open ends; undefined for one that is not open. A
|
|
11
|
+
* cancelled turn cancels it. Otherwise a call whose input never finished
|
|
12
|
+
* streaming, or whose approval was asked for and refused, never ran; one that
|
|
13
|
+
* was running may have done what it was for, so its outcome is unknown, as
|
|
14
|
+
* `outcomeUnknown` says: its turn ended, or agent-server stopped under it. A
|
|
15
|
+
* pending call keeps what it streamed in `_meta`, and `tail`, what streamed
|
|
16
|
+
* after its last kept snapshot. The reducer closes tools at their turn's end
|
|
17
|
+
* with it, and crash recovery the turns a dead server left running.
|
|
18
|
+
*/
|
|
19
|
+
export declare function closeToolLeftOpen(state: ConversationState, turnId: string, part: ToolPart, opts: {
|
|
20
|
+
at: number;
|
|
21
|
+
cancelled: boolean;
|
|
22
|
+
outcomeUnknown: "outcome_unknown" | "interrupted";
|
|
23
|
+
tail?: string;
|
|
24
|
+
}): ToolPart | undefined;
|
|
25
|
+
//# sourceMappingURL=tool-closure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-closure.d.ts","sourceRoot":"","sources":["../../../src/protocol/tool-closure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,sGACmE,CAAC;AACrG,2FAA2F;AAC3F,eAAO,MAAM,cAAc,wEAAwE,CAAC;AACpG,4GAA4G;AAC5G,eAAO,MAAM,gBAAgB,6KAC8I,CAAC;AAU5K;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE;IACL,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,EAAE,iBAAiB,GAAG,aAAa,CAAC;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACd,GACC,QAAQ,GAAG,SAAS,CAyBtB"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime tool lifecycle: a tool call moves pending -> in_progress ->
|
|
4
|
+
* completed | failed | cancelled (ACP ToolCallStatus verbatim, incl. v2's
|
|
5
|
+
* `cancelled`). `pending` carries the partial (streaming) JSON input before it
|
|
6
|
+
* parses; the other states carry the fully-parsed input object. `cancelled` is
|
|
7
|
+
* the terminal for tools in flight when a turn is cancelled — the reducer
|
|
8
|
+
* applies it implicitly at `turn.ended{stopReason:"cancelled"}`; after any
|
|
9
|
+
* other end it closes them `failed`, saying the outcome is unknown (a running
|
|
10
|
+
* tool) or that it never ran (a half-written call), with its `closure`.
|
|
11
|
+
* Producers MAY also emit the terminal snapshot explicitly.
|
|
12
|
+
*
|
|
13
|
+
* The status set is a STRUCTURAL discriminator (each status has its own
|
|
14
|
+
* payload), so the union below is closed; new statuses are protocol additions,
|
|
15
|
+
* not extensions.
|
|
16
|
+
*/
|
|
17
|
+
export declare const RUNTIME_TOOL_STATUSES: readonly ["pending", "in_progress", "completed", "failed", "cancelled"];
|
|
18
|
+
export type RuntimeToolStatus = (typeof RUNTIME_TOOL_STATUSES)[number];
|
|
19
|
+
/**
|
|
20
|
+
* What a tool call does, normalized across harnesses — ACP's ToolKind taxonomy
|
|
21
|
+
* verbatim, plus `task` (subagent spawn; ACP has no subagent concept). Lets a
|
|
22
|
+
* consumer pick an icon / verb without knowing provider-native tool names.
|
|
23
|
+
*
|
|
24
|
+
* OPEN vocabulary: unknown non-`_` values are reserved for this
|
|
25
|
+
* protocol and MUST be preserved; `_`-prefixed values are adapter/product
|
|
26
|
+
* extensions. Display groupings (e.g. edit|delete|move -> a "write" card) are
|
|
27
|
+
* consumer maps, not wire vocabulary.
|
|
28
|
+
*/
|
|
29
|
+
export declare const TOOL_KINDS: readonly ["read", "edit", "delete", "move", "search", "execute", "think", "fetch", "switch_mode", "task", "other"];
|
|
30
|
+
export type ToolKind = (typeof TOOL_KINDS)[number] | (string & {});
|
|
31
|
+
export declare const ToolKindSchema: z.ZodType<(string & {}) | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "task" | "other", unknown, z.core.$ZodTypeInternals<(string & {}) | "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "task" | "other", unknown>>;
|
|
32
|
+
/** A file location a tool call touches — lets UIs "follow along". (ACP shape.) */
|
|
33
|
+
export declare const ToolLocationSchema: z.ZodObject<{
|
|
34
|
+
path: z.ZodString;
|
|
35
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type ToolLocation = z.infer<typeof ToolLocationSchema>;
|
|
38
|
+
/**
|
|
39
|
+
* Structured, display-grade tool output. Three-audience doctrine:
|
|
40
|
+
* `ToolStateCompleted.output` (string) is the MODEL-facing factual record and
|
|
41
|
+
* universal rendering fallback; `content` is the display-grade structured
|
|
42
|
+
* view; `metadata` is the machine channel (exitCode, ...).
|
|
43
|
+
*/
|
|
44
|
+
export declare const ToolResultContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"text">;
|
|
46
|
+
text: z.ZodString;
|
|
47
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"image">;
|
|
50
|
+
data: z.ZodString;
|
|
51
|
+
mimeType: z.ZodString;
|
|
52
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"diff">;
|
|
55
|
+
path: z.ZodString;
|
|
56
|
+
oldText: z.ZodOptional<z.ZodString>;
|
|
57
|
+
newText: z.ZodString;
|
|
58
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
+
type: z.ZodLiteral<"terminal">;
|
|
61
|
+
terminalId: z.ZodString;
|
|
62
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
63
|
+
}, z.core.$strip>], "type">;
|
|
64
|
+
export type ToolResultContent = z.infer<typeof ToolResultContentSchema>;
|
|
65
|
+
export declare const ToolStatePendingSchema: z.ZodObject<{
|
|
66
|
+
status: z.ZodLiteral<"pending">;
|
|
67
|
+
partialInput: z.ZodString;
|
|
68
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type ToolStatePending = z.infer<typeof ToolStatePendingSchema>;
|
|
71
|
+
export declare const ToolStateInProgressSchema: z.ZodObject<{
|
|
72
|
+
status: z.ZodLiteral<"in_progress">;
|
|
73
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
74
|
+
title: z.ZodOptional<z.ZodString>;
|
|
75
|
+
time: z.ZodObject<{
|
|
76
|
+
start: z.ZodNumber;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export type ToolStateInProgress = z.infer<typeof ToolStateInProgressSchema>;
|
|
81
|
+
export declare const ToolStateCompletedSchema: z.ZodObject<{
|
|
82
|
+
status: z.ZodLiteral<"completed">;
|
|
83
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
84
|
+
output: z.ZodString;
|
|
85
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"text">;
|
|
87
|
+
text: z.ZodString;
|
|
88
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
89
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"image">;
|
|
91
|
+
data: z.ZodString;
|
|
92
|
+
mimeType: z.ZodString;
|
|
93
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
94
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"diff">;
|
|
96
|
+
path: z.ZodString;
|
|
97
|
+
oldText: z.ZodOptional<z.ZodString>;
|
|
98
|
+
newText: z.ZodString;
|
|
99
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"terminal">;
|
|
102
|
+
terminalId: z.ZodString;
|
|
103
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
104
|
+
}, z.core.$strip>], "type">>>;
|
|
105
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
106
|
+
title: z.ZodOptional<z.ZodString>;
|
|
107
|
+
time: z.ZodObject<{
|
|
108
|
+
start: z.ZodNumber;
|
|
109
|
+
end: z.ZodNumber;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export type ToolStateCompleted = z.infer<typeof ToolStateCompletedSchema>;
|
|
114
|
+
/**
|
|
115
|
+
* How the engine closed a tool its turn left open, for machines: `never_ran`
|
|
116
|
+
* (its call was never complete, or its approval was refused), `outcome_unknown`
|
|
117
|
+
* (it was running when its turn ended) or `interrupted` (it was running when
|
|
118
|
+
* agent-server stopped). The failed state's `error` says the same in words
|
|
119
|
+
* (`tool-closure.ts`). OPEN: read a value you do not know as an outcome unknown.
|
|
120
|
+
*/
|
|
121
|
+
export declare const TOOL_CLOSURES: readonly ["never_ran", "outcome_unknown", "interrupted"];
|
|
122
|
+
export type ToolClosure = (typeof TOOL_CLOSURES)[number] | (string & {});
|
|
123
|
+
export declare const ToolClosureSchema: z.ZodType<(string & {}) | "interrupted" | "never_ran" | "outcome_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "interrupted" | "never_ran" | "outcome_unknown", unknown>>;
|
|
124
|
+
export declare const ToolStateFailedSchema: z.ZodObject<{
|
|
125
|
+
status: z.ZodLiteral<"failed">;
|
|
126
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
127
|
+
error: z.ZodString;
|
|
128
|
+
closure: z.ZodOptional<z.ZodType<(string & {}) | "interrupted" | "never_ran" | "outcome_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "interrupted" | "never_ran" | "outcome_unknown", unknown>>>;
|
|
129
|
+
time: z.ZodObject<{
|
|
130
|
+
start: z.ZodNumber;
|
|
131
|
+
end: z.ZodNumber;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
export type ToolStateFailed = z.infer<typeof ToolStateFailedSchema>;
|
|
136
|
+
export declare const ToolStateCancelledSchema: z.ZodObject<{
|
|
137
|
+
status: z.ZodLiteral<"cancelled">;
|
|
138
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
139
|
+
time: z.ZodObject<{
|
|
140
|
+
start: z.ZodNumber;
|
|
141
|
+
end: z.ZodNumber;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
export type ToolStateCancelled = z.infer<typeof ToolStateCancelledSchema>;
|
|
146
|
+
export declare const ToolStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
147
|
+
status: z.ZodLiteral<"pending">;
|
|
148
|
+
partialInput: z.ZodString;
|
|
149
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
status: z.ZodLiteral<"in_progress">;
|
|
152
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
153
|
+
title: z.ZodOptional<z.ZodString>;
|
|
154
|
+
time: z.ZodObject<{
|
|
155
|
+
start: z.ZodNumber;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
status: z.ZodLiteral<"completed">;
|
|
160
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
161
|
+
output: z.ZodString;
|
|
162
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"text">;
|
|
164
|
+
text: z.ZodString;
|
|
165
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
166
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"image">;
|
|
168
|
+
data: z.ZodString;
|
|
169
|
+
mimeType: z.ZodString;
|
|
170
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"diff">;
|
|
173
|
+
path: z.ZodString;
|
|
174
|
+
oldText: z.ZodOptional<z.ZodString>;
|
|
175
|
+
newText: z.ZodString;
|
|
176
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
type: z.ZodLiteral<"terminal">;
|
|
179
|
+
terminalId: z.ZodString;
|
|
180
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
181
|
+
}, z.core.$strip>], "type">>>;
|
|
182
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
183
|
+
title: z.ZodOptional<z.ZodString>;
|
|
184
|
+
time: z.ZodObject<{
|
|
185
|
+
start: z.ZodNumber;
|
|
186
|
+
end: z.ZodNumber;
|
|
187
|
+
}, z.core.$strip>;
|
|
188
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
status: z.ZodLiteral<"failed">;
|
|
191
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
192
|
+
error: z.ZodString;
|
|
193
|
+
closure: z.ZodOptional<z.ZodType<(string & {}) | "interrupted" | "never_ran" | "outcome_unknown", unknown, z.core.$ZodTypeInternals<(string & {}) | "interrupted" | "never_ran" | "outcome_unknown", unknown>>>;
|
|
194
|
+
time: z.ZodObject<{
|
|
195
|
+
start: z.ZodNumber;
|
|
196
|
+
end: z.ZodNumber;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
199
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
200
|
+
status: z.ZodLiteral<"cancelled">;
|
|
201
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
202
|
+
time: z.ZodObject<{
|
|
203
|
+
start: z.ZodNumber;
|
|
204
|
+
end: z.ZodNumber;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
_meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
207
|
+
}, z.core.$strip>], "status">;
|
|
208
|
+
export type ToolState = z.infer<typeof ToolStateSchema>;
|
|
209
|
+
//# sourceMappingURL=tool-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-state.d.ts","sourceRoot":"","sources":["../../../src/protocol/tool-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,yEAMxB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,oHAYb,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AACnE,eAAO,MAAM,cAAc,6TAA6B,CAAC;AAEzD,kFAAkF;AAClF,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;2BAuBlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,sBAAsB;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,yBAAyB;;;;;;;;iBAMpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,0DAA2D,CAAC;AACtF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AACzE,eAAO,MAAM,iBAAiB,yLAAgC,CAAC;AAE/D,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAQhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,wBAAwB;;;;;;;;iBAKnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAM1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type DecodedLifecycleEvent, type UnknownEvent } from "./lifecycle.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Machine-checkable stream-contract verifier: replay the log, validate the
|
|
4
|
+
* projection, fail on disagreement.
|
|
5
|
+
*
|
|
6
|
+
* `verifyStreamContract` takes one session's ordered event stream and returns
|
|
7
|
+
* every violation of the ordering and delivery contract it can detect,
|
|
8
|
+
* plus a projection check: the reducer's final state must agree with the
|
|
9
|
+
* authoritative part snapshots (snapshots-beat-deltas made testable).
|
|
10
|
+
*
|
|
11
|
+
* Pure and consumer-grade: the CLI's `--verify` flag, the live tests, and any
|
|
12
|
+
* product pipeline (a Durable Object, a persistence shim) can run it over a
|
|
13
|
+
* recorded stream.
|
|
14
|
+
*
|
|
15
|
+
* The ordering bookkeeping below (turns, open messages, part addresses,
|
|
16
|
+
* pending permissions) deliberately does NOT read `ConversationState`, even
|
|
17
|
+
* though the fold computes lookalikes of most of it: a checker derived from
|
|
18
|
+
* the reducer can only ever confirm that the reducer agrees with itself. The
|
|
19
|
+
* duplication is the independence that makes `projection-agrees` and the
|
|
20
|
+
* re-delivery probe able to fail.
|
|
21
|
+
*/
|
|
22
|
+
/** Every rule the verifier checks, by the id LLP 0002 names it with. */
|
|
23
|
+
export declare const CONTRACT_RULES: readonly ["turn-started-once", "turn-ended-once", "turn-ended-pairs", "session-created-once", "permission-resolves-once", "elicitation-resolves-once", "message-in-turn", "bracket-pairing", "output-index-increases", "no-messages-after-turn-end", "messages-closed-by-turn-end", "model-assistant-only", "user-messages-top-level", "message-ids-unique", "part-self-describing", "part-address-stable", "late-parts-are-terminal-tools", "delta-follows-snapshot", "echo-first", "echo-parts-done", "undelivered-steers-not-echoed", "seq-monotonic", "seq-live", "schema-valid", "timestamp-valid", "error-carries-info", "reducer-total", "reducer-idempotent", "projection-agrees"];
|
|
24
|
+
export type ContractRule = (typeof CONTRACT_RULES)[number];
|
|
25
|
+
export interface ContractViolation {
|
|
26
|
+
/** Stable rule id, e.g. "echo-first" — grep-able and assertable in tests. */
|
|
27
|
+
rule: ContractRule;
|
|
28
|
+
/** Index into the supplied event array (-1 for stream-level violations). */
|
|
29
|
+
index: number;
|
|
30
|
+
message: string;
|
|
31
|
+
}
|
|
32
|
+
export interface VerifyOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Each turn opens with the engine's echo of the user message. Disable for a
|
|
35
|
+
* capture that begins mid-turn, such as a client that joined a running turn.
|
|
36
|
+
*/
|
|
37
|
+
expectEcho?: boolean;
|
|
38
|
+
/** Per-session seq values aligned with `events` (from wire envelopes). */
|
|
39
|
+
seqs?: number[];
|
|
40
|
+
/**
|
|
41
|
+
* Which of `events` came in a live frame (`live: true` on the envelope),
|
|
42
|
+
* aligned with them: such a frame carries the last kept seq, as a delta
|
|
43
|
+
* does. A delta is live without saying so.
|
|
44
|
+
*/
|
|
45
|
+
live?: boolean[];
|
|
46
|
+
}
|
|
47
|
+
type Stream = Array<DecodedLifecycleEvent | UnknownEvent>;
|
|
48
|
+
export declare function verifyStreamContract(events: Stream, options?: VerifyOptions): ContractViolation[];
|
|
49
|
+
/** Render violations for terminal output; empty string when clean. */
|
|
50
|
+
export declare function formatViolations(violations: ContractViolation[]): string;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/protocol/verify.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAEjB,MAAM,gBAAgB,CAAC;AAIxB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,wEAAwE;AACxE,eAAO,MAAM,cAAc,4pBAsCjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IACjC,6EAA6E;IAC7E,IAAI,EAAE,YAAY,CAAC;IACnB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,KAAK,MAAM,GAAG,KAAK,CAAC,qBAAqB,GAAG,YAAY,CAAC,CAAC;AAG1D,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GACzB,iBAAiB,EAAE,CAWrB;AAseD,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAGxE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* An OPEN vocabulary. The schema accepts values this build does not
|
|
4
|
+
* know (a newer engine's `stopReason`, an adapter's `_`-prefixed extension),
|
|
5
|
+
* because rejecting them is exactly how a forward-compatible wire turns into a
|
|
6
|
+
* compatibility break — the failure ACP moved to v2 to escape. The cast keeps
|
|
7
|
+
* the TypeScript side as `"a" | "b" | (string & {})`, so the canonical members
|
|
8
|
+
* still autocomplete, while the runtime lets an unknown value through to be
|
|
9
|
+
* preserved. The schema remembers the values it knows (`knownValues`), which
|
|
10
|
+
* is how the casing test checks them.
|
|
11
|
+
*
|
|
12
|
+
* Blank is the one thing every open vocabulary rejects: `""` and `" "` are
|
|
13
|
+
* not values a consumer can switch on, render, or persist — they are a
|
|
14
|
+
* producer bug, and accepting them silently is how it reaches a UI.
|
|
15
|
+
*/
|
|
16
|
+
export declare function openVocabulary<const T extends string>(known: readonly T[]): z.ZodType<T | (string & {})>;
|
|
17
|
+
/** The values an open vocabulary's schema knows (none for any other schema). */
|
|
18
|
+
export declare function knownValues(schema: z.ZodType): readonly string[];
|
|
19
|
+
//# sourceMappingURL=vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../../src/protocol/vocabulary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACpD,KAAK,EAAE,SAAS,CAAC,EAAE,GACjB,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAM9B;AAED,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,MAAM,EAAE,CAEhE"}
|