@zvada/agent-server 0.3.18 → 0.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -26
- package/CHANGELOG.md +1005 -1
- package/README.md +35 -39
- package/dist/types/accounts/chatgpt.d.ts +34 -0
- package/dist/types/accounts/chatgpt.d.ts.map +1 -0
- package/dist/types/accounts/check.d.ts +24 -0
- package/dist/types/accounts/check.d.ts.map +1 -0
- package/dist/types/accounts/claude.d.ts +21 -0
- package/dist/types/accounts/claude.d.ts.map +1 -0
- package/dist/types/accounts/endpoint.d.ts +50 -0
- package/dist/types/accounts/endpoint.d.ts.map +1 -0
- package/dist/types/accounts/http.d.ts +38 -0
- package/dist/types/accounts/http.d.ts.map +1 -0
- package/dist/types/accounts/index.d.ts +6 -0
- package/dist/types/accounts/index.d.ts.map +1 -0
- package/dist/types/client/client.d.ts +272 -0
- package/dist/types/client/client.d.ts.map +1 -0
- package/dist/types/client/connection.d.ts +160 -0
- package/dist/types/client/connection.d.ts.map +1 -0
- package/dist/types/client/history.d.ts +8 -0
- package/dist/types/client/history.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/listeners.d.ts +8 -0
- package/dist/types/client/listeners.d.ts.map +1 -0
- package/dist/types/client/logins.d.ts +35 -0
- package/dist/types/client/logins.d.ts.map +1 -0
- package/dist/types/client/rpc.d.ts +46 -0
- package/dist/types/client/rpc.d.ts.map +1 -0
- package/dist/types/client/streams.d.ts +150 -0
- package/dist/types/client/streams.d.ts.map +1 -0
- package/dist/types/client/transports.d.ts +35 -0
- package/dist/types/client/transports.d.ts.map +1 -0
- package/dist/types/client/turns.d.ts +81 -0
- package/dist/types/client/turns.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +68 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -0
- package/dist/types/core/agents/acp/adapter.d.ts +39 -0
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/acp/client.d.ts +90 -0
- package/dist/types/core/agents/acp/client.d.ts.map +1 -0
- package/dist/types/core/agents/acp/known-agents.d.ts +35 -0
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -0
- package/dist/types/core/agents/acp/mappings.d.ts +46 -0
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +26 -0
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -0
- package/dist/types/core/agents/attachments.d.ts +11 -0
- package/dist/types/core/agents/attachments.d.ts.map +1 -0
- package/dist/types/core/agents/base.d.ts +227 -0
- package/dist/types/core/agents/base.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts +58 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts +26 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +70 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts +54 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/events.d.ts +42 -0
- package/dist/types/core/agents/claude-code/events.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/login.d.ts +61 -0
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts +52 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/models.d.ts +30 -0
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/options.d.ts +183 -0
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts +50 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts +36 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session.d.ts +148 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts +29 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spend.d.ts +58 -0
- package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/tools.d.ts +4 -0
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts +52 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn.d.ts +121 -0
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts +59 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts +116 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +113 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts +66 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts +49 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts +12 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts +45 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts +20 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts +26 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts +31 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts +38 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +62 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts +67 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts +40 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +19 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts +99 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts +42 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts +96 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts +53 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +87 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts +33 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts +163 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -0
- package/dist/types/core/agents/config-fingerprint.d.ts +5 -0
- package/dist/types/core/agents/config-fingerprint.d.ts.map +1 -0
- package/dist/types/core/agents/credentials.d.ts +28 -0
- package/dist/types/core/agents/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/elicitation.d.ts +37 -0
- package/dist/types/core/agents/elicitation.d.ts.map +1 -0
- package/dist/types/core/agents/inherit-config.d.ts +18 -0
- package/dist/types/core/agents/inherit-config.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +67 -0
- package/dist/types/core/agents/login.d.ts.map +1 -0
- package/dist/types/core/agents/mcp-config.d.ts +57 -0
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -0
- package/dist/types/core/agents/plan.d.ts +16 -0
- package/dist/types/core/agents/plan.d.ts.map +1 -0
- package/dist/types/core/agents/registry.d.ts +30 -0
- package/dist/types/core/agents/registry.d.ts.map +1 -0
- package/dist/types/core/agents/session-agent.d.ts +48 -0
- package/dist/types/core/agents/session-agent.d.ts.map +1 -0
- package/dist/types/core/agents/session-pool.d.ts +41 -0
- package/dist/types/core/agents/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/stderr-tail.d.ts +28 -0
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -0
- package/dist/types/core/agents/thinking-levels.d.ts +4 -0
- package/dist/types/core/agents/thinking-levels.d.ts.map +1 -0
- package/dist/types/core/agents/types.d.ts +124 -0
- package/dist/types/core/agents/types.d.ts.map +1 -0
- package/dist/types/core/diagnostics.d.ts +36 -0
- package/dist/types/core/diagnostics.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +29 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/presets.d.ts +80 -0
- package/dist/types/core/presets.d.ts.map +1 -0
- package/dist/types/core/processes/identity.d.ts +31 -0
- package/dist/types/core/processes/identity.d.ts.map +1 -0
- package/dist/types/core/processes/lifeline.d.ts +47 -0
- package/dist/types/core/processes/lifeline.d.ts.map +1 -0
- package/dist/types/core/processes/native-processes.d.ts +130 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -0
- package/dist/types/core/processes/process-table.d.ts +43 -0
- package/dist/types/core/processes/process-table.d.ts.map +1 -0
- package/dist/types/core/provision/cache-trust.d.ts +13 -0
- package/dist/types/core/provision/cache-trust.d.ts.map +1 -0
- package/dist/types/core/provision/cache-usage.d.ts +14 -0
- package/dist/types/core/provision/cache-usage.d.ts.map +1 -0
- package/dist/types/core/provision/checksums.d.ts +46 -0
- package/dist/types/core/provision/checksums.d.ts.map +1 -0
- package/dist/types/core/provision/extract.d.ts +7 -0
- package/dist/types/core/provision/extract.d.ts.map +1 -0
- package/dist/types/core/provision/index.d.ts +5 -0
- package/dist/types/core/provision/index.d.ts.map +1 -0
- package/dist/types/core/provision/install-build.d.ts +36 -0
- package/dist/types/core/provision/install-build.d.ts.map +1 -0
- package/dist/types/core/provision/npm.d.ts +40 -0
- package/dist/types/core/provision/npm.d.ts.map +1 -0
- package/dist/types/core/provision/pins.d.ts +24 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -0
- package/dist/types/core/provision/platform.d.ts +28 -0
- package/dist/types/core/provision/platform.d.ts.map +1 -0
- package/dist/types/core/provision/provisioner.d.ts +189 -0
- package/dist/types/core/provision/provisioner.d.ts.map +1 -0
- package/dist/types/core/provision/releases.d.ts +8 -0
- package/dist/types/core/provision/releases.d.ts.map +1 -0
- package/dist/types/core/provision/tools.d.ts +81 -0
- package/dist/types/core/provision/tools.d.ts.map +1 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts +52 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts.map +1 -0
- package/dist/types/core/proxy/api-key-store.d.ts +37 -0
- package/dist/types/core/proxy/api-key-store.d.ts.map +1 -0
- package/dist/types/core/proxy/index.d.ts +3 -0
- package/dist/types/core/proxy/index.d.ts.map +1 -0
- package/dist/types/core/proxy/loopback.d.ts +14 -0
- package/dist/types/core/proxy/loopback.d.ts.map +1 -0
- package/dist/types/core/runtime/agent-runtime.d.ts +181 -0
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -0
- package/dist/types/core/runtime/event-processor.d.ts +87 -0
- package/dist/types/core/runtime/event-processor.d.ts.map +1 -0
- package/dist/types/core/runtime/event-sink.d.ts +44 -0
- package/dist/types/core/runtime/event-sink.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-clis.d.ts +10 -0
- package/dist/types/core/runtime/harness-clis.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-logins.d.ts +68 -0
- package/dist/types/core/runtime/harness-logins.d.ts.map +1 -0
- package/dist/types/core/runtime/login-reads.d.ts +28 -0
- package/dist/types/core/runtime/login-reads.d.ts.map +1 -0
- package/dist/types/core/runtime/model-lists.d.ts +37 -0
- package/dist/types/core/runtime/model-lists.d.ts.map +1 -0
- package/dist/types/core/runtime/permission-policy.d.ts +61 -0
- package/dist/types/core/runtime/permission-policy.d.ts.map +1 -0
- package/dist/types/core/runtime/request-broker.d.ts +49 -0
- package/dist/types/core/runtime/request-broker.d.ts.map +1 -0
- package/dist/types/core/runtime/steering.d.ts +38 -0
- package/dist/types/core/runtime/steering.d.ts.map +1 -0
- package/dist/types/core/runtime/turn-outcome.d.ts +21 -0
- package/dist/types/core/runtime/turn-outcome.d.ts.map +1 -0
- package/dist/types/core/runtime/turn.d.ts +121 -0
- package/dist/types/core/runtime/turn.d.ts.map +1 -0
- package/dist/types/core/utils/bounded.d.ts +6 -0
- package/dist/types/core/utils/bounded.d.ts.map +1 -0
- package/dist/types/core/utils/deadline.d.ts +14 -0
- package/dist/types/core/utils/deadline.d.ts.map +1 -0
- package/dist/types/core/utils/errors.d.ts +104 -0
- package/dist/types/core/utils/errors.d.ts.map +1 -0
- package/dist/types/core/utils/is-record.d.ts +3 -0
- package/dist/types/core/utils/is-record.d.ts.map +1 -0
- package/dist/types/core/utils/loopback.d.ts +6 -0
- package/dist/types/core/utils/loopback.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/protocol/account.d.ts +26 -0
- package/dist/types/protocol/account.d.ts.map +1 -0
- package/dist/types/protocol/async-queue.d.ts +21 -0
- package/dist/types/protocol/async-queue.d.ts.map +1 -0
- package/dist/types/protocol/auth.d.ts +228 -0
- package/dist/types/protocol/auth.d.ts.map +1 -0
- package/dist/types/protocol/canonical.d.ts +9 -0
- package/dist/types/protocol/canonical.d.ts.map +1 -0
- package/dist/types/protocol/clis.d.ts +74 -0
- package/dist/types/protocol/clis.d.ts.map +1 -0
- package/dist/types/protocol/config.d.ts +200 -0
- package/dist/types/protocol/config.d.ts.map +1 -0
- package/dist/types/protocol/conversation.d.ts +942 -0
- package/dist/types/protocol/conversation.d.ts.map +1 -0
- package/dist/types/protocol/credentials.d.ts +145 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -0
- package/dist/types/protocol/errors.d.ts +36 -0
- package/dist/types/protocol/errors.d.ts.map +1 -0
- package/dist/types/protocol/execution.d.ts +28 -0
- package/dist/types/protocol/execution.d.ts.map +1 -0
- package/dist/types/protocol/factories.d.ts +94 -0
- package/dist/types/protocol/factories.d.ts.map +1 -0
- package/dist/types/protocol/guards.d.ts +55 -0
- package/dist/types/protocol/guards.d.ts.map +1 -0
- package/dist/types/protocol/harness.d.ts +70 -0
- package/dist/types/protocol/harness.d.ts.map +1 -0
- package/dist/types/protocol/history.d.ts +318 -0
- package/dist/types/protocol/history.d.ts.map +1 -0
- package/dist/types/protocol/ids.d.ts +9 -0
- package/dist/types/protocol/ids.d.ts.map +1 -0
- package/dist/types/protocol/index.d.ts +35 -0
- package/dist/types/protocol/index.d.ts.map +1 -0
- package/dist/types/protocol/lifecycle.d.ts +1190 -0
- package/dist/types/protocol/lifecycle.d.ts.map +1 -0
- package/dist/types/protocol/meta-keys.d.ts +17 -0
- package/dist/types/protocol/meta-keys.d.ts.map +1 -0
- package/dist/types/protocol/meta.d.ts +13 -0
- package/dist/types/protocol/meta.d.ts.map +1 -0
- package/dist/types/protocol/model-catalog.d.ts +11 -0
- package/dist/types/protocol/model-catalog.d.ts.map +1 -0
- package/dist/types/protocol/models.d.ts +107 -0
- package/dist/types/protocol/models.d.ts.map +1 -0
- package/dist/types/protocol/part-input.d.ts +101 -0
- package/dist/types/protocol/part-input.d.ts.map +1 -0
- package/dist/types/protocol/parts.d.ts +357 -0
- package/dist/types/protocol/parts.d.ts.map +1 -0
- package/dist/types/protocol/reduce.d.ts +26 -0
- package/dist/types/protocol/reduce.d.ts.map +1 -0
- package/dist/types/protocol/selectors.d.ts +64 -0
- package/dist/types/protocol/selectors.d.ts.map +1 -0
- package/dist/types/protocol/seq-cursor.d.ts +66 -0
- package/dist/types/protocol/seq-cursor.d.ts.map +1 -0
- package/dist/types/protocol/stop-reasons.d.ts +33 -0
- package/dist/types/protocol/stop-reasons.d.ts.map +1 -0
- package/dist/types/protocol/thinking.d.ts +28 -0
- package/dist/types/protocol/thinking.d.ts.map +1 -0
- package/dist/types/protocol/time.d.ts +21 -0
- package/dist/types/protocol/time.d.ts.map +1 -0
- package/dist/types/protocol/tokens.d.ts +29 -0
- package/dist/types/protocol/tokens.d.ts.map +1 -0
- package/dist/types/protocol/tool-closure.d.ts +25 -0
- package/dist/types/protocol/tool-closure.d.ts.map +1 -0
- package/dist/types/protocol/tool-state.d.ts +209 -0
- package/dist/types/protocol/tool-state.d.ts.map +1 -0
- package/dist/types/protocol/verify.d.ts +52 -0
- package/dist/types/protocol/verify.d.ts.map +1 -0
- package/dist/types/protocol/vocabulary.d.ts +19 -0
- package/dist/types/protocol/vocabulary.d.ts.map +1 -0
- package/dist/types/protocol/wire-api.d.ts +1983 -0
- package/dist/types/protocol/wire-api.d.ts.map +1 -0
- package/dist/types/protocol/wire.d.ts +1758 -0
- package/dist/types/protocol/wire.d.ts.map +1 -0
- package/dist/types/server/acp/binding.d.ts +33 -0
- package/dist/types/server/acp/binding.d.ts.map +1 -0
- package/dist/types/server/acp/session-records.d.ts +17 -0
- package/dist/types/server/acp/session-records.d.ts.map +1 -0
- package/dist/types/server/acp/translate.d.ts +48 -0
- package/dist/types/server/acp/translate.d.ts.map +1 -0
- package/dist/types/server/agent-server.d.ts +121 -0
- package/dist/types/server/agent-server.d.ts.map +1 -0
- package/dist/types/server/feedback.d.ts +37 -0
- package/dist/types/server/feedback.d.ts.map +1 -0
- package/dist/types/server/history.d.ts +15 -0
- package/dist/types/server/history.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/install.d.ts +42 -0
- package/dist/types/server/install.d.ts.map +1 -0
- package/dist/types/server/open-parts.d.ts +27 -0
- package/dist/types/server/open-parts.d.ts.map +1 -0
- package/dist/types/server/routes.d.ts +61 -0
- package/dist/types/server/routes.d.ts.map +1 -0
- package/dist/types/server/secrets.d.ts +11 -0
- package/dist/types/server/secrets.d.ts.map +1 -0
- package/dist/types/server/session-gate.d.ts +32 -0
- package/dist/types/server/session-gate.d.ts.map +1 -0
- package/dist/types/server/session-log.d.ts +39 -0
- package/dist/types/server/session-log.d.ts.map +1 -0
- package/dist/types/server/session-store.d.ts +119 -0
- package/dist/types/server/session-store.d.ts.map +1 -0
- package/dist/types/server/subscriptions.d.ts +74 -0
- package/dist/types/server/subscriptions.d.ts.map +1 -0
- package/dist/types/server/transports.d.ts +74 -0
- package/dist/types/server/transports.d.ts.map +1 -0
- package/dist/types/server/wire-error.d.ts +9 -0
- package/dist/types/server/wire-error.d.ts.map +1 -0
- package/dist/types/sync/event-log.d.ts +45 -0
- package/dist/types/sync/event-log.d.ts.map +1 -0
- package/dist/types/sync/fit.d.ts +40 -0
- package/dist/types/sync/fit.d.ts.map +1 -0
- package/dist/types/sync/history-reader.d.ts +8 -0
- package/dist/types/sync/history-reader.d.ts.map +1 -0
- package/dist/types/sync/history-sqlite.d.ts +37 -0
- package/dist/types/sync/history-sqlite.d.ts.map +1 -0
- package/dist/types/sync/history.d.ts +70 -0
- package/dist/types/sync/history.d.ts.map +1 -0
- package/dist/types/sync/index.d.ts +4 -0
- package/dist/types/sync/index.d.ts.map +1 -0
- package/dist/types/sync/journal-sqlite.d.ts +51 -0
- package/dist/types/sync/journal-sqlite.d.ts.map +1 -0
- package/dist/types/sync/journal.d.ts +107 -0
- package/dist/types/sync/journal.d.ts.map +1 -0
- package/dist/types/sync/live-tails.d.ts +30 -0
- package/dist/types/sync/live-tails.d.ts.map +1 -0
- package/dist/types/sync/node-sqlite.d.ts +7 -0
- package/dist/types/sync/node-sqlite.d.ts.map +1 -0
- package/dist/types/sync/projection.d.ts +10 -0
- package/dist/types/sync/projection.d.ts.map +1 -0
- package/dist/types/sync/recovery.d.ts +25 -0
- package/dist/types/sync/recovery.d.ts.map +1 -0
- package/dist/types/sync/retry.d.ts +25 -0
- package/dist/types/sync/retry.d.ts.map +1 -0
- package/dist/types/sync/schema.d.ts +4 -0
- package/dist/types/sync/schema.d.ts.map +1 -0
- package/dist/types/sync/sql.d.ts +38 -0
- package/dist/types/sync/sql.d.ts.map +1 -0
- package/dist/types/sync/sqlite-file.d.ts +9 -0
- package/dist/types/sync/sqlite-file.d.ts.map +1 -0
- package/dist/types/sync/sqlite.d.ts +6 -0
- package/dist/types/sync/sqlite.d.ts.map +1 -0
- package/dist/types/sync/worker.d.ts +63 -0
- package/dist/types/sync/worker.d.ts.map +1 -0
- package/docs/consuming.md +452 -53
- package/docs/deploy.md +218 -47
- package/docs/{sync-experiment.md → durable-sessions.md} +77 -72
- package/docs/feedback.md +116 -0
- package/docs/harnesses.md +212 -88
- package/docs/sync-history.md +29 -13
- package/docs/sync-integration.md +52 -66
- package/package.json +43 -25
- package/src/accounts/chatgpt.ts +194 -0
- package/src/accounts/check.ts +112 -0
- package/src/accounts/claude.ts +111 -0
- package/src/accounts/endpoint.ts +151 -0
- package/src/accounts/http.ts +97 -0
- package/src/accounts/index.ts +19 -0
- package/src/client/client.ts +604 -670
- package/src/client/connection.ts +371 -0
- package/src/client/history.ts +29 -52
- package/src/client/index.ts +11 -2
- package/src/client/listeners.ts +20 -0
- package/src/client/logins.ts +105 -0
- package/src/client/rpc.ts +144 -0
- package/src/client/streams.ts +488 -0
- package/src/client/transports.ts +62 -8
- package/src/client/turns.ts +171 -0
- package/src/core/agents/acp/acp-agent.ts +94 -118
- package/src/core/agents/acp/adapter.ts +20 -9
- package/src/core/agents/acp/client.ts +125 -47
- package/src/core/agents/acp/known-agents.ts +36 -4
- package/src/core/agents/acp/mappings.ts +64 -18
- package/src/core/agents/acp/requests.ts +125 -0
- package/src/core/agents/attachments.ts +18 -0
- package/src/core/agents/base.ts +120 -42
- package/src/core/agents/claude-code/adapter.ts +177 -238
- package/src/core/agents/claude-code/approvals.ts +270 -0
- package/src/core/agents/claude-code/claude-agent.ts +175 -158
- package/src/core/agents/claude-code/credentials.ts +171 -0
- package/src/core/agents/claude-code/events.ts +55 -0
- package/src/core/agents/claude-code/login.ts +269 -0
- package/src/core/agents/claude-code/mcp.ts +206 -0
- package/src/core/agents/claude-code/models.ts +15 -9
- package/src/core/agents/claude-code/options.ts +326 -39
- package/src/core/agents/claude-code/outcome.ts +209 -0
- package/src/core/agents/claude-code/session-pool.ts +136 -0
- package/src/core/agents/claude-code/session.ts +513 -0
- package/src/core/agents/claude-code/spawn.ts +144 -0
- package/src/core/agents/claude-code/spend.ts +160 -0
- package/src/core/agents/claude-code/tools.ts +47 -0
- package/src/core/agents/claude-code/turn-usage.ts +135 -0
- package/src/core/agents/claude-code/turn.ts +232 -0
- package/src/core/agents/codex-app-server/adapter.ts +314 -117
- package/src/core/agents/codex-app-server/client.ts +186 -84
- package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
- package/src/core/agents/codex-app-server/commands.ts +228 -0
- package/src/core/agents/codex-app-server/credentials.ts +126 -0
- package/src/core/agents/codex-app-server/effort.ts +29 -0
- package/src/core/agents/codex-app-server/events.ts +47 -0
- package/src/core/agents/codex-app-server/homes.ts +64 -0
- package/src/core/agents/codex-app-server/input.ts +60 -0
- package/src/core/agents/codex-app-server/items.ts +149 -0
- package/src/core/agents/codex-app-server/login.ts +180 -0
- package/src/core/agents/codex-app-server/mcp.ts +182 -37
- package/src/core/agents/codex-app-server/models.ts +99 -46
- package/src/core/agents/codex-app-server/options.ts +146 -0
- package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
- package/src/core/agents/codex-app-server/protocol.ts +117 -0
- package/src/core/agents/codex-app-server/requests.ts +332 -0
- package/src/core/agents/codex-app-server/session.ts +285 -0
- package/src/core/agents/codex-app-server/subagents.ts +108 -42
- package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
- package/src/core/agents/codex-app-server/turn-items.ts +88 -0
- package/src/core/agents/codex-app-server/turn.ts +463 -0
- package/src/core/agents/config-fingerprint.ts +7 -14
- package/src/core/agents/credentials.ts +98 -0
- package/src/core/agents/elicitation.ts +75 -0
- package/src/core/agents/inherit-config.ts +21 -0
- package/src/core/agents/login.ts +116 -0
- package/src/core/agents/mcp-config.ts +112 -8
- package/src/core/agents/plan.ts +25 -0
- package/src/core/agents/registry.ts +21 -4
- package/src/core/agents/session-agent.ts +96 -4
- package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
- package/src/core/agents/stderr-tail.ts +75 -0
- package/src/core/agents/types.ts +40 -5
- package/src/core/index.ts +58 -48
- package/src/core/presets.ts +100 -39
- package/src/core/processes/identity.ts +113 -0
- package/src/core/processes/lifeline.ts +170 -0
- package/src/core/processes/native-processes.ts +379 -0
- package/src/core/processes/process-table.ts +174 -0
- package/src/core/provision/cache-trust.ts +121 -0
- package/src/core/provision/cache-usage.ts +69 -0
- package/src/core/provision/checksums.ts +64 -0
- package/src/core/provision/extract.ts +11 -2
- package/src/core/provision/index.ts +4 -1
- package/src/core/provision/install-build.ts +136 -0
- package/src/core/provision/npm.ts +112 -17
- package/src/core/provision/pins.ts +9 -33
- package/src/core/provision/platform.ts +12 -1
- package/src/core/provision/provisioner.ts +329 -397
- package/src/core/provision/releases.ts +86 -0
- package/src/core/provision/tools.ts +329 -0
- package/src/core/proxy/anthropic-proxy.ts +55 -25
- package/src/core/proxy/api-key-store.ts +2 -12
- package/src/core/proxy/loopback.ts +106 -0
- package/src/core/runtime/agent-runtime.ts +327 -498
- package/src/core/runtime/event-processor.ts +197 -70
- package/src/core/runtime/harness-clis.ts +61 -0
- package/src/core/runtime/harness-logins.ts +328 -0
- package/src/core/runtime/login-reads.ts +78 -0
- package/src/core/runtime/model-lists.ts +33 -48
- package/src/core/runtime/permission-policy.ts +113 -0
- package/src/core/runtime/request-broker.ts +204 -0
- package/src/core/runtime/steering.ts +112 -0
- package/src/core/runtime/turn-outcome.ts +30 -0
- package/src/core/runtime/turn.ts +360 -0
- package/src/core/utils/bounded.ts +12 -0
- package/src/core/utils/deadline.ts +38 -0
- package/src/core/utils/errors.ts +113 -21
- package/src/core/utils/is-record.ts +4 -0
- package/src/core/utils/loopback.ts +10 -0
- package/src/protocol/account.ts +104 -0
- package/src/protocol/auth.ts +199 -0
- package/src/protocol/canonical.ts +16 -0
- package/src/protocol/clis.ts +69 -0
- package/src/protocol/config.ts +60 -6
- package/src/protocol/conversation.ts +272 -0
- package/src/protocol/credentials.ts +145 -0
- package/src/protocol/errors.ts +78 -20
- package/src/protocol/execution.ts +5 -2
- package/src/protocol/factories.ts +55 -7
- package/src/protocol/guards.ts +55 -2
- package/src/protocol/harness.ts +56 -6
- package/src/protocol/history.ts +72 -64
- package/src/protocol/ids.ts +0 -12
- package/src/protocol/index.ts +9 -0
- package/src/protocol/lifecycle.ts +250 -79
- package/src/protocol/meta-keys.ts +17 -0
- package/src/protocol/meta.ts +3 -3
- package/src/protocol/models.ts +2 -43
- package/src/protocol/part-input.ts +2 -1
- package/src/protocol/parts.ts +12 -3
- package/src/protocol/reduce.ts +302 -413
- package/src/protocol/selectors.ts +1 -20
- package/src/protocol/seq-cursor.ts +14 -0
- package/src/protocol/stop-reasons.ts +1 -1
- package/src/protocol/thinking.ts +1 -30
- package/src/protocol/time.ts +2 -2
- package/src/protocol/tool-closure.ts +93 -0
- package/src/protocol/tool-state.ts +19 -4
- package/src/protocol/verify.ts +222 -92
- package/src/protocol/vocabulary.ts +21 -5
- package/src/protocol/wire-api.ts +232 -0
- package/src/protocol/wire.ts +351 -64
- package/src/server/acp/binding.ts +63 -103
- package/src/server/acp/session-records.ts +53 -0
- package/src/server/acp/translate.ts +129 -20
- package/src/server/agent-server.ts +223 -387
- package/src/server/bin.ts +280 -78
- package/src/server/feedback.ts +204 -14
- package/src/server/history.ts +116 -122
- package/src/server/index.ts +3 -8
- package/src/server/install.ts +107 -8
- package/src/server/open-parts.ts +95 -0
- package/src/server/routes.ts +391 -0
- package/src/server/secrets.ts +24 -0
- package/src/server/session-gate.ts +69 -0
- package/src/server/session-log.ts +14 -2
- package/src/server/session-store.ts +136 -72
- package/src/server/subscriptions.ts +232 -0
- package/src/server/transports.ts +125 -25
- package/src/server/wire-error.ts +31 -45
- package/src/sync/event-log.ts +31 -3
- package/src/sync/fit.ts +27 -11
- package/src/sync/history-reader.ts +10 -5
- package/src/sync/history-sqlite.ts +37 -42
- package/src/sync/history.ts +9 -15
- package/src/sync/index.ts +17 -5
- package/src/sync/journal-sqlite.ts +162 -76
- package/src/sync/journal.ts +91 -32
- package/src/sync/live-tails.ts +107 -0
- package/src/sync/projection.ts +35 -0
- package/src/sync/recovery.ts +80 -51
- package/src/sync/schema.ts +27 -6
- package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
- package/docs/rfds/0002-native-subagents.md +0 -197
- package/src/client/request.ts +0 -19
- package/src/core/agents/claude-code/generator-session.ts +0 -572
- package/src/core/agents/claude-code/session-manager.ts +0 -166
- package/src/core/agents/codex-app-server/codex-app-server-agent.ts +0 -962
- package/src/core/agents/codex-items.ts +0 -149
- package/src/core/agents/codex-sdk/adapter.ts +0 -237
- package/src/core/agents/codex-sdk/codex-sdk-agent.ts +0 -330
- package/src/core/agents/tool-meta.ts +0 -68
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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ACd,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAOjF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IACpC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,cAAc,CAAC,IAAI,MAAM,CAAC;CAC1B,GAAG;IACH,SAAS,EAAE,aAAa,CAAC;IACzB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CA6CA;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,CAAC,MAAM,EAAE,MAAM,IAAI,KAAK,IAAqB,GAAG;IACpF,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAkBA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentApp, AgentConnection } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { AgentRuntime } from "../../core/index.ts";
|
|
3
|
+
import type { AgentHarness, PermissionMode } from "../../protocol/index.ts";
|
|
4
|
+
export interface AcpBindingOptions {
|
|
5
|
+
runtime: AgentRuntime;
|
|
6
|
+
/** The harness this ACP agent fronts (operator-chosen at launch). */
|
|
7
|
+
harness: AgentHarness;
|
|
8
|
+
model?: string;
|
|
9
|
+
/** Defaults to `default` so tool approvals flow to the ACP client. */
|
|
10
|
+
permissionMode?: PermissionMode;
|
|
11
|
+
name?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Where to record each session's native id so `session/resume` works after
|
|
15
|
+
* this process restarts. Absent: sessions resume only within the process.
|
|
16
|
+
*/
|
|
17
|
+
sessionDir?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The ACP *server* binding: exposes the runtime as an Agent Client
|
|
21
|
+
* Protocol v1 agent, so anything that speaks ACP (Zed, another agent-server's
|
|
22
|
+
* `acp` harness, any product) can drive our harnesses with zero custom
|
|
23
|
+
* integration. `session/prompt` runs one engine turn; LifecycleEvents stream
|
|
24
|
+
* out as `session/update`; engine-brokered permissions become
|
|
25
|
+
* `session/request_permission` round-trips (identical option vocabulary).
|
|
26
|
+
* An ACP sessionId stays valid for the binding's lifetime; with `sessionDir`
|
|
27
|
+
* its native conversation is recorded, so `session/resume` also works after a
|
|
28
|
+
* restart.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createAcpAgentApp(options: AcpBindingOptions): Promise<AgentApp>;
|
|
31
|
+
/** Serve the binding on this process's stdio (what an ACP client spawns). */
|
|
32
|
+
export declare function serveAcpStdio(options: AcpBindingOptions): Promise<AgentConnection>;
|
|
33
|
+
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../../../src/server/acp/binding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EACX,YAAY,EAEZ,cAAc,EAEd,MAAM,yBAAyB,CAAC;AAajC,MAAM,WAAW,iBAAiB;IACjC,OAAO,EAAE,YAAY,CAAC;IACtB,qEAAqE;IACrE,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAoBD;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuJrF;AAED,6EAA6E;AAC7E,wBAAsB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CASxF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentHarness } from "../../protocol/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Each ACP session's native conversation, a file per session in `dir`, so
|
|
4
|
+
* `session/resume` works after this process restarts. Without `dir` nothing is
|
|
5
|
+
* kept, and sessions resume only within the process.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SessionRecords {
|
|
8
|
+
private readonly dir;
|
|
9
|
+
private readonly harness;
|
|
10
|
+
constructor(dir: string | undefined, harness: AgentHarness);
|
|
11
|
+
/** Best effort: without the record the session resumes only in-process. */
|
|
12
|
+
remember(sessionId: string, nativeSessionId: string): Promise<void>;
|
|
13
|
+
/** The native conversation recorded for the session, if this harness recorded one. */
|
|
14
|
+
recall(sessionId: string): Promise<string | undefined>;
|
|
15
|
+
private pathOf;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=session-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-records.d.ts","sourceRoot":"","sources":["../../../../src/server/acp/session-records.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAK5D;;;;GAIG;AACH,qBAAa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,EAAE,YAAY;IAGvC,2EAA2E;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzE,sFAAsF;IAChF,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAa5D,OAAO,CAAC,MAAM;CAGd"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ContentBlock, McpServer, PromptResponse, RequestPermissionRequest, SessionUpdate } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { RunSummary } from "../../core/index.ts";
|
|
3
|
+
import { type LifecycleEvent, type McpServerConfig, type PartInput, type PermissionRequestedEvent, type TokenUsage } from "../../protocol/index.ts";
|
|
4
|
+
/** The engine's disjoint token buckets as ACP's (still unstable) turn usage. */
|
|
5
|
+
export declare function toAcpUsage(usage: TokenUsage): NonNullable<PromptResponse["usage"]>;
|
|
6
|
+
/**
|
|
7
|
+
* A turn's end as ACP's prompt response, our open stop reasons mapped onto
|
|
8
|
+
* ACP's closed set: `error` reports as an ended turn with the failure in
|
|
9
|
+
* `_meta` (an ACP client must see a stop, not a JSON-RPC failure), and
|
|
10
|
+
* extension and unknown values fall back to `end_turn`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function toAcpPromptResponse(summary: Pick<RunSummary, "stopReason" | "usage" | "error">): PromptResponse;
|
|
13
|
+
/**
|
|
14
|
+
* A brokered permission request as ACP's `session/request_permission`: the
|
|
15
|
+
* option vocabulary is ACP's, so the options pass through (one of a kind ACP
|
|
16
|
+
* cannot carry is not offered, never read as an approval).
|
|
17
|
+
*/
|
|
18
|
+
export declare function toAcpPermissionRequest(sessionId: string, event: PermissionRequestedEvent): RequestPermissionRequest;
|
|
19
|
+
/**
|
|
20
|
+
* Per-prompt translator from the engine's LifecycleEvents to ACP v1
|
|
21
|
+
* `session/update` payloads — the exact inverse of the acp harness adapter
|
|
22
|
+
* (the vocabularies were aligned for this: ToolKind, tool status, and
|
|
23
|
+
* permission shapes pass through unchanged).
|
|
24
|
+
*
|
|
25
|
+
* Deliberate v1 gaps: sub-agent parts (`parentToolCallId`) have no ACP slot
|
|
26
|
+
* and are dropped (the parent tool's result carries the outcome); the
|
|
27
|
+
* `session.compaction` entity has no v1 equivalent; `usage_update` requires
|
|
28
|
+
* `size`, so gauges without a window size are skipped. The user echo is
|
|
29
|
+
* skipped too — the ACP client authored the prompt and re-chunking it back
|
|
30
|
+
* would duplicate it.
|
|
31
|
+
*/
|
|
32
|
+
export declare class AcpUpdateTranslator {
|
|
33
|
+
/** toolCallIds already announced via `tool_call`. */
|
|
34
|
+
private readonly openedTools;
|
|
35
|
+
/** Text/reasoning characters already emitted per part (dedupe snapshots vs deltas). */
|
|
36
|
+
private readonly sentByPart;
|
|
37
|
+
/** Message ids of the user echo (role "user") — skipped entirely. */
|
|
38
|
+
private readonly userMessageIds;
|
|
39
|
+
/** Part ids that belong to a sub-agent (parented) — their deltas are skipped. */
|
|
40
|
+
private readonly parentedParts;
|
|
41
|
+
translate(event: LifecycleEvent): SessionUpdate[];
|
|
42
|
+
private toolUpdate;
|
|
43
|
+
}
|
|
44
|
+
/** ACP prompt content → engine input (text + base64 images; the rest is dropped). */
|
|
45
|
+
export declare function fromPromptBlocks(prompt: ContentBlock[]): string | PartInput[];
|
|
46
|
+
/** ACP `McpServer[]` → engine MCP config map (inverse of the harness-side mapping). */
|
|
47
|
+
export declare function fromAcpMcpServers(servers: McpServer[] | undefined): Record<string, McpServerConfig> | undefined;
|
|
48
|
+
//# sourceMappingURL=translate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../../../src/server/acp/translate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,SAAS,EAGT,cAAc,EACd,wBAAwB,EACxB,aAAa,EAEb,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,KAAK,cAAc,EAEnB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EAGf,MAAM,yBAAyB,CAAC;AA4CjC,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAWlF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC,GACzD,cAAc,CAchB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,wBAAwB,GAC7B,wBAAwB,CAa1B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,mBAAmB;IAC/B,qDAAqD;IACrD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,uFAAuF;IACvF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,qEAAqE;IACrE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;IACpD,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IAEnD,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,EAAE;IAmEjD,OAAO,CAAC,UAAU;CAoDlB;AAUD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,GAAG,SAAS,EAAE,CAU7E;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,GAC9B,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,CAqB7C"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { type AgentRuntime } from "../core/index.ts";
|
|
2
|
+
import { type WireEventEnvelope, type WireImplementationInfo, type WireTransport } from "../protocol/index.ts";
|
|
3
|
+
import type { ClaimOptions, SessionJournal } from "../sync/journal.ts";
|
|
4
|
+
import { type HistoryHost } from "./history.ts";
|
|
5
|
+
export interface AgentServerOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Durable sessions: every admission and event is committed to this journal
|
|
8
|
+
* before it is acknowledged or delivered, and sessions survive a restart.
|
|
9
|
+
* The server takes execution ownership (one owner per journal); the host
|
|
10
|
+
* opens the journal and closes it after shutdown. Open the server with
|
|
11
|
+
* `AgentServer.open`, which stops what a previous owner left running first.
|
|
12
|
+
*/
|
|
13
|
+
journal?: SessionJournal;
|
|
14
|
+
/**
|
|
15
|
+
* The journal failed to write. The server then stops (as `shutdown`), and
|
|
16
|
+
* restart recovery decides what the turns it cut off did. Called once,
|
|
17
|
+
* before `onShutdown`.
|
|
18
|
+
*/
|
|
19
|
+
onJournalError?: (error: unknown) => void;
|
|
20
|
+
/** Opt-in `history/*` methods. The host supplies the store and its access control. */
|
|
21
|
+
history?: HistoryHost;
|
|
22
|
+
/** Replay ring-buffer size per session (envelopes). Volatile sessions only. */
|
|
23
|
+
bufferSize?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Sessions one connection may ask to watch (`session/subscribe`;
|
|
26
|
+
* `session/subscribeAll` counts once), past which it is refused
|
|
27
|
+
* `subscriptionLimit`. The sessions its own turns subscribe it to do not
|
|
28
|
+
* count. Default 256.
|
|
29
|
+
*/
|
|
30
|
+
maxSubscriptions?: number;
|
|
31
|
+
/**
|
|
32
|
+
* How far behind (in bytes its transport has yet to write) a connection may
|
|
33
|
+
* fall before the server stops streaming it the session it fell behind on,
|
|
34
|
+
* with `session/overflow`. Default 16 MiB. Only a transport that reports
|
|
35
|
+
* `bufferedAmount` is bounded.
|
|
36
|
+
*/
|
|
37
|
+
maxBacklogBytes?: number;
|
|
38
|
+
/** Reported in the `initialize` result. */
|
|
39
|
+
info?: WireImplementationInfo;
|
|
40
|
+
/** Called once a `shutdown` request has been acked and the runtime drained. */
|
|
41
|
+
onShutdown?: () => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The wire binding: serves the engine over JSON-RPC 2.0 on any
|
|
45
|
+
* number of attached transports. Requests flow client -> server only; every
|
|
46
|
+
* lifecycle event is stamped with a per-session monotonic `seq`, buffered for
|
|
47
|
+
* `events/replay`, and sent as an `event` notification to the connections
|
|
48
|
+
* subscribed to its session (`session/subscribe`; `turn/start` subscribes its
|
|
49
|
+
* caller) — token deltas with the seq of the last kept event, never buffered.
|
|
50
|
+
* `turn/start` is quick-ack: the response only accepts the turn; completion is
|
|
51
|
+
* the `turn.ended` event. One active turn per session.
|
|
52
|
+
*/
|
|
53
|
+
export declare class AgentServer {
|
|
54
|
+
private readonly runtime;
|
|
55
|
+
private readonly options;
|
|
56
|
+
/** The attached connections, and the sessions each receives. */
|
|
57
|
+
private readonly subscriptions;
|
|
58
|
+
/** The ONE persistence decision: everything else asks the store. */
|
|
59
|
+
private readonly store;
|
|
60
|
+
/** Each session's open parts and latest turn start, from the frames this server delivers. */
|
|
61
|
+
private readonly openParts;
|
|
62
|
+
private readonly gate;
|
|
63
|
+
/** Every method this server answers: being durable, or serving history, is having their routes. */
|
|
64
|
+
private readonly routes;
|
|
65
|
+
private readonly observers;
|
|
66
|
+
private shuttingDown;
|
|
67
|
+
private shutdownPromise;
|
|
68
|
+
private turnsDrained;
|
|
69
|
+
/** Stops writing the runtime's native process records into the journal. */
|
|
70
|
+
private readonly unrecord;
|
|
71
|
+
private readonly unprogress;
|
|
72
|
+
private readonly unauth;
|
|
73
|
+
/**
|
|
74
|
+
* A server whose restart sweep ran before it took the journal: each native
|
|
75
|
+
* process a previous owner recorded is verified (boot, start time,
|
|
76
|
+
* executable) and, while it is still that process, stopped with its tool
|
|
77
|
+
* sessions. The claim then fences only the sessions whose agent could not
|
|
78
|
+
* be confirmed stopped. Without a journal it is the constructor.
|
|
79
|
+
*/
|
|
80
|
+
static open(runtime: AgentRuntime, options?: AgentServerOptions): Promise<AgentServer>;
|
|
81
|
+
/**
|
|
82
|
+
* `swept`: what the restart sweep found of the journal's records
|
|
83
|
+
* (`AgentServer.open` passes it). Without it, every session a restart cut
|
|
84
|
+
* off is fenced until the host confirms its agent stopped.
|
|
85
|
+
*/
|
|
86
|
+
constructor(runtime: AgentRuntime, options?: AgentServerOptions, swept?: ClaimOptions);
|
|
87
|
+
/** Serve the wire on a transport; returns a detach function, which drops its subscriptions. */
|
|
88
|
+
attach(transport: WireTransport): () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Observe every broadcast envelope in-process; returns an unsubscribe.
|
|
91
|
+
*
|
|
92
|
+
* Every session's envelopes, subscribed or not — the same sequenced
|
|
93
|
+
* envelopes subscribed transports receive, already appended to the session
|
|
94
|
+
* log (a token delta, which no log keeps, carries the last kept seq) — a
|
|
95
|
+
* host that embeds the server (to keep its own session bookkeeping, mirror
|
|
96
|
+
* events into a DB, trigger follow-up work) gets them as decoded objects
|
|
97
|
+
* instead of attaching a fake transport and parsing its own wire back out
|
|
98
|
+
* of NDJSON.
|
|
99
|
+
*
|
|
100
|
+
* Synchronous and isolated: an observer that throws is swallowed, exactly
|
|
101
|
+
* like a faulty transport or a failing sink — an event is a fact that
|
|
102
|
+
* already happened, and a consumer's bug must not unwind the broadcast for
|
|
103
|
+
* everyone else. Do the slow part yourself (queue it, don't block here).
|
|
104
|
+
*/
|
|
105
|
+
onEvent(observer: (envelope: WireEventEnvelope) => void): () => void;
|
|
106
|
+
/** Cancel all turns, terminate harnesses, and close every transport. Every
|
|
107
|
+
* caller waits for the same drain. */
|
|
108
|
+
shutdown(): Promise<void>;
|
|
109
|
+
/** Cancel all turns and terminate harnesses: their turn.ended are broadcast. */
|
|
110
|
+
private drainTurns;
|
|
111
|
+
private drain;
|
|
112
|
+
/** The journal failed to write: stop, delivering nothing it did not commit. */
|
|
113
|
+
private failStop;
|
|
114
|
+
private handleLine;
|
|
115
|
+
private handleRequest;
|
|
116
|
+
/** A request's answer from its route, its params parsed by `WIRE_API` unless the route reads its own. */
|
|
117
|
+
private answer;
|
|
118
|
+
private executeTurn;
|
|
119
|
+
private broadcast;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=agent-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-server.d.ts","sourceRoot":"","sources":["../../../src/server/agent-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAgC,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAON,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAG3B,KAAK,aAAa,EAQlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,KAAK,WAAW,EAAiB,MAAM,cAAc,CAAC;AAkB/D,MAAM,WAAW,kBAAkB;IAClC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,sFAAsF;IACtF,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,qBAAa,WAAW;IAqCtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IArCzB,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,K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|
+
actual?: string;
|
|
5
|
+
mistake?: string;
|
|
6
|
+
attempts?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface FeedbackOptions {
|
|
9
|
+
message: string;
|
|
10
|
+
/** Any category without whitespace, up to 64 characters. Defaults to cli. */
|
|
11
|
+
category?: string;
|
|
12
|
+
/** The exact item: export, error code, harness, or command. */
|
|
13
|
+
subject?: string;
|
|
14
|
+
/** Continue an existing thread instead of opening a new one. */
|
|
15
|
+
resume?: string;
|
|
16
|
+
/** The id of the maintainer question this report answers. */
|
|
17
|
+
question?: string;
|
|
18
|
+
eval?: FeedbackEval;
|
|
19
|
+
/** Print the payload without sending a report. */
|
|
20
|
+
dryRun?: boolean;
|
|
21
|
+
clientVersion?: string;
|
|
22
|
+
/** Injectable transport boundary for tests. */
|
|
23
|
+
fetchImpl?: (url: string, init: RequestInit) => Promise<Response>;
|
|
24
|
+
}
|
|
25
|
+
export interface FeedbackResult {
|
|
26
|
+
delivered: boolean;
|
|
27
|
+
threadId: string;
|
|
28
|
+
/** Human-readable lines to print (thread id, guidance, ask). */
|
|
29
|
+
lines: string[];
|
|
30
|
+
}
|
|
31
|
+
/** POST one feedback report; returns the lines the CLI should print. */
|
|
32
|
+
export declare function runFeedback(options: FeedbackOptions): Promise<FeedbackResult>;
|
|
33
|
+
/** Parse feedback independently of serve/chat flags, before starting any runtime. */
|
|
34
|
+
export declare function parseFeedbackArgs(argv: string[]): FeedbackOptions | undefined;
|
|
35
|
+
/** Shared by the published server bin and the repository's interactive CLI. */
|
|
36
|
+
export declare function runFeedbackCommand(argv: string[], clientVersion: string): Promise<number>;
|
|
37
|
+
//# sourceMappingURL=feedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.d.ts","sourceRoot":"","sources":["../../../src/server/feedback.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAClE;AAED,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,KAAK,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wEAAwE;AACxE,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA6EnF;AA8CD,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,eAAe,GAAG,SAAS,CAqE7E;AAED,+EAA+E;AAC/E,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB/F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HistoryMethod, type HistoryStore, type SessionRef, type WireTransport } from "../protocol/index.ts";
|
|
2
|
+
import type { Routes } from "./routes.ts";
|
|
3
|
+
export interface HistoryHost {
|
|
4
|
+
store: HistoryStore;
|
|
5
|
+
/** Undefined ref means catalog permission. Use tenant-scoped stores/catalogs.
|
|
6
|
+
* This protects history methods only; the host must restrict execution methods. */
|
|
7
|
+
authorize(transport: WireTransport, ref: SessionRef | undefined, operation: "read" | "write" | "list"): boolean | Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The `history/*` routes: one per method, so a method added to HISTORY_METHODS
|
|
11
|
+
* does not compile without one. Every mutation is one storage transaction, and
|
|
12
|
+
* no agent is ever invoked from here.
|
|
13
|
+
*/
|
|
14
|
+
export declare function historyRoutes(host: HistoryHost): Routes<HistoryMethod>;
|
|
15
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/server/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EAGf,KAAK,aAAa,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,YAAY,CAAC;IACpB;uFACmF;IACnF,SAAS,CACR,SAAS,EAAE,aAAa,EACxB,GAAG,EAAE,UAAU,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAClC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9B;AAqBD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAsEtE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AgentServer, type AgentServerOptions } from "./agent-server.ts";
|
|
2
|
+
export { runFeedbackCommand } from "./feedback.ts";
|
|
3
|
+
export type { HistoryHost } from "./history.ts";
|
|
4
|
+
export { type InstallOptions, type InstallResult, runInstall } from "./install.ts";
|
|
5
|
+
export { dial, type DialOptions, listen, type ListenOptions, stdioTransport, } from "./transports.ts";
|
|
6
|
+
export { type AcpBindingOptions, createAcpAgentApp, serveAcpStdio, } from "./acp/binding.ts";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EACN,IAAI,EACJ,KAAK,WAAW,EAChB,MAAM,EACN,KAAK,aAAa,EAClB,cAAc,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,aAAa,GACb,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CliProvisioner, type CliTool, type PlatformInfo, type ProvisionOptions, type ResolvedCli } from "../core/index.ts";
|
|
2
|
+
import type { AgentHarness } from "../protocol/index.ts";
|
|
3
|
+
export interface InstallOptions {
|
|
4
|
+
/** Restrict to the CLIs these harnesses need. Defaults to every tool. */
|
|
5
|
+
harnesses?: AgentHarness[];
|
|
6
|
+
/**
|
|
7
|
+
* The platforms to install for, as the cache names them (`darwin-arm64`,
|
|
8
|
+
* `linux-x64-musl`, …): an app bundle or an image for other machines.
|
|
9
|
+
* Defaults to this machine's.
|
|
10
|
+
*/
|
|
11
|
+
platforms?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Install into this folder, in the cache's layout and readable by every
|
|
14
|
+
* user, for `provision.bundleDirs` / `$AGENT_SERVER_BUNDLE_DIR`, instead of
|
|
15
|
+
* the managed cache.
|
|
16
|
+
*/
|
|
17
|
+
dir?: string;
|
|
18
|
+
/** Then remove the cached builds no process used for 14 days. */
|
|
19
|
+
prune?: boolean;
|
|
20
|
+
provision?: ProvisionOptions;
|
|
21
|
+
/** Injectable provisioner boundary for tests. */
|
|
22
|
+
createProvisioner?: (options: ProvisionOptions, platform: PlatformInfo) => Pick<CliProvisioner, "install" | "prune">;
|
|
23
|
+
}
|
|
24
|
+
export interface InstallResult {
|
|
25
|
+
tool: CliTool;
|
|
26
|
+
/** The platform it was installed for. */
|
|
27
|
+
platform: string;
|
|
28
|
+
cli: ResolvedCli;
|
|
29
|
+
}
|
|
30
|
+
/** Which managed CLIs a set of harnesses needs (deduped, stable order). */
|
|
31
|
+
export declare function toolsFor(harnesses: AgentHarness[] | undefined): CliTool[];
|
|
32
|
+
/** The platforms named, each one some CLI is published for, or what is wrong. */
|
|
33
|
+
export declare function platformsFor(names: readonly string[]): PlatformInfo[];
|
|
34
|
+
/**
|
|
35
|
+
* Prefetch the pinned CLI builds into the managed cache — the cold-start
|
|
36
|
+
* eraser: run it while building a container/sandbox image and runtime turns
|
|
37
|
+
* never download. Or stage them for other platforms into a folder an app or
|
|
38
|
+
* an image ships (`dir`). Downloads run in parallel; failures reject with the
|
|
39
|
+
* first error after all settle (so one flaky download doesn't hide the others).
|
|
40
|
+
*/
|
|
41
|
+
export declare function runInstall(options?: InstallOptions): Promise<InstallResult[]>;
|
|
42
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/server/install.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,cAAc,EACd,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAEhB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC9B,yEAAyE;IACzE,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,CACnB,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,YAAY,KAClB,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,WAAW,CAAC;CACjB;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,CAOzE;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,EAAE,CAQrE;AAsCD;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAqCvF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type WireEventEnvelope } from "../protocol/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* What the server keeps in memory of each session as it streams, from the
|
|
4
|
+
* frames it delivers: a kept event as its store kept it (what replay and
|
|
5
|
+
* history return, a journal's possibly cut down), and every delta. It holds
|
|
6
|
+
* the session's open parts, each a streaming part's last kept snapshot with
|
|
7
|
+
* every delta since applied (what a client that subscribes mid-part receives
|
|
8
|
+
* at once, instead of the deltas it missed), and where its latest turn
|
|
9
|
+
* started. Updated in the same synchronous call that delivers the frame, so a
|
|
10
|
+
* subscription lands either before a delta (and receives it live) or after it
|
|
11
|
+
* (and finds it here), never both. Whatever the store, volatile or a journal.
|
|
12
|
+
*/
|
|
13
|
+
export declare class OpenParts {
|
|
14
|
+
private readonly sessions;
|
|
15
|
+
/** The turn each session ran last, by the seq of its `turn.started`. */
|
|
16
|
+
private readonly started;
|
|
17
|
+
/** A frame the server delivers. */
|
|
18
|
+
delivered(envelope: WireEventEnvelope): void;
|
|
19
|
+
/** The session's open parts, in the order they opened, as live frames at `headSeq`. */
|
|
20
|
+
of(sessionId: string, headSeq: number): WireEventEnvelope[];
|
|
21
|
+
/** The seq of the turn's `turn.started`, while it is the session's latest turn. */
|
|
22
|
+
startedSeq(sessionId: string, turnId: string): number | undefined;
|
|
23
|
+
/** A delta: its part gains what it streamed, dated by it. */
|
|
24
|
+
private extend;
|
|
25
|
+
private close;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=open-parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-parts.d.ts","sourceRoot":"","sources":["../../../src/server/open-parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,iBAAiB,EAGtB,MAAM,sBAAsB,CAAC;AAS9B;;;;;;;;;;GAUG;AACH,qBAAa,SAAS;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoD;IAC7E,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsD;IAE9E,mCAAmC;IACnC,SAAS,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IA+B5C,uFAAuF;IACvF,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAS3D,mFAAmF;IACnF,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKjE,6DAA6D;IAC7D,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,KAAK;CAKb"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AgentRuntime } from "../core/index.ts";
|
|
2
|
+
import { type HistoryMethod, type InitializeResult, type RunRequest, WIRE_METHODS, type WireEventEnvelope, type WireParsedParams, type WireRequestMethod, type WireResult, type WireTransport } from "../protocol/index.ts";
|
|
3
|
+
import type { OpenParts } from "./open-parts.ts";
|
|
4
|
+
import type { SessionGate } from "./session-gate.ts";
|
|
5
|
+
import type { JournalSessionStore, SessionLogStore } from "./session-store.ts";
|
|
6
|
+
import type { Subscriptions } from "./subscriptions.ts";
|
|
7
|
+
/** What a request's handler may ask of the connection it came on. */
|
|
8
|
+
export interface RouteContext {
|
|
9
|
+
transport: WireTransport;
|
|
10
|
+
/** Run `then` once the response is sent, or failed to send: work that must not precede it. */
|
|
11
|
+
afterResponse(then: () => void): void;
|
|
12
|
+
}
|
|
13
|
+
type Answer<M extends WireRequestMethod> = WireResult<M> | Promise<WireResult<M>>;
|
|
14
|
+
/**
|
|
15
|
+
* A request's handler, given its params as `WIRE_API` parses them: what it
|
|
16
|
+
* returns is the response; what it throws, the error response.
|
|
17
|
+
*/
|
|
18
|
+
export type Route<M extends WireRequestMethod> = (params: WireParsedParams<M>, context: RouteContext) => Answer<M>;
|
|
19
|
+
/** A handler that reads its own params: one that must refuse a caller before it reads what it sent. */
|
|
20
|
+
export interface UnparsedRoute<M extends WireRequestMethod> {
|
|
21
|
+
readonly unparsed: (params: unknown, context: RouteContext) => Answer<M>;
|
|
22
|
+
}
|
|
23
|
+
/** One handler per method: a method without one does not compile. */
|
|
24
|
+
export type Routes<Methods extends WireRequestMethod> = {
|
|
25
|
+
readonly [M in Methods]: Route<M> | UnparsedRoute<M>;
|
|
26
|
+
};
|
|
27
|
+
/** The methods only a server with a journal answers. */
|
|
28
|
+
type DurableMethod = typeof WIRE_METHODS.turnGet | typeof WIRE_METHODS.sessionGet | typeof WIRE_METHODS.sessionConfirmStopped | typeof WIRE_METHODS.sessionRelease;
|
|
29
|
+
/** What every server answers (a server serving history answers `history/*` too). */
|
|
30
|
+
type ExecutionMethod = Exclude<WireRequestMethod, DurableMethod | HistoryMethod>;
|
|
31
|
+
/** What the routes run on: the server's runtime, session logs and turns. */
|
|
32
|
+
export interface RouteHost {
|
|
33
|
+
readonly runtime: AgentRuntime;
|
|
34
|
+
readonly store: SessionLogStore;
|
|
35
|
+
/** Each session's open parts and latest turn start, as the server delivered them. */
|
|
36
|
+
readonly openParts: OpenParts;
|
|
37
|
+
readonly gate: SessionGate;
|
|
38
|
+
/** Which connections receive which sessions. */
|
|
39
|
+
readonly subscriptions: Subscriptions;
|
|
40
|
+
/** The `initialize` result's fixed fields. */
|
|
41
|
+
readonly identity: Pick<InitializeResult, "server" | "instanceId" | "historyId">;
|
|
42
|
+
/** False once the server stopped taking turns. */
|
|
43
|
+
accepting(): boolean;
|
|
44
|
+
/** Run an admitted turn: its events go to its log and every transport. */
|
|
45
|
+
executeTurn(request: RunRequest): void;
|
|
46
|
+
broadcast(envelope: WireEventEnvelope): void;
|
|
47
|
+
/** Cancel every turn, and wait until each one's `turn.ended` was broadcast. */
|
|
48
|
+
drainTurns(): Promise<void>;
|
|
49
|
+
shutdown(): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/** The routes every server has, one per method: a method without one does not compile. */
|
|
52
|
+
export declare function executionRoutes(host: RouteHost): Routes<ExecutionMethod>;
|
|
53
|
+
/**
|
|
54
|
+
* The routes only a server with a journal has: a volatile session has no
|
|
55
|
+
* receipt, no fence to lift and no journal to ask its next turn for a
|
|
56
|
+
* conversation it let go (`session/close` frees it), so a volatile server
|
|
57
|
+
* answers these `methodNotFound`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function durableRoutes(store: JournalSessionStore, { runtime, gate }: Pick<RouteHost, "runtime" | "gate">): Routes<DurableMethod>;
|
|
60
|
+
export {};
|
|
61
|
+
//# sour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E,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,CAkPxE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC5B,KAAK,EAAE,mBAAmB,EAC1B,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC,GACpD,MAAM,CAAC,aAAa,CAAC,CAkCvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The secrets the server reads from its environment: what a listener, `--dial` and `--credentials-url` present. */
|
|
2
|
+
declare const SERVER_SECRETS: readonly ["AGENT_SERVER_TOKEN", "AGENT_SERVER_DIAL_TOKEN", "AGENT_SERVER_CREDENTIALS_TOKEN"];
|
|
3
|
+
/**
|
|
4
|
+
* Take this server's secrets out of its environment, answering them: every
|
|
5
|
+
* CLI the server starts inherits the environment, and the tools those run
|
|
6
|
+
* with it, so a secret left there is one an agent can read. An empty one
|
|
7
|
+
* stays empty, for its user to refuse.
|
|
8
|
+
*/
|
|
9
|
+
export declare function takeSecrets(env?: NodeJS.ProcessEnv): Record<(typeof SERVER_SECRETS)[number], string | undefined>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../src/server/secrets.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,QAAA,MAAM,cAAc,8FAIV,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,WAAW,CAC1B,GAAG,GAAE,MAAM,CAAC,UAAwB,GAClC,MAAM,CAAC,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,CAQ7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AgentHarness } from "../protocol/index.ts";
|
|
2
|
+
/** The turn a session runs. */
|
|
3
|
+
export interface ActiveTurn {
|
|
4
|
+
turnId: string;
|
|
5
|
+
harness: AgentHarness;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Which sessions are busy: running their one turn, or letting their native
|
|
9
|
+
* state go (`session/close`, `session/release`). A request that would race
|
|
10
|
+
* either is refused before it touches the session.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SessionGate {
|
|
13
|
+
private readonly turns;
|
|
14
|
+
private readonly closing;
|
|
15
|
+
/** The turn the session runs, if any. */
|
|
16
|
+
activeTurn(sessionId: string): ActiveTurn | undefined;
|
|
17
|
+
/** The sessions running a turn. */
|
|
18
|
+
running(): string[];
|
|
19
|
+
/** Refuse a session whose native state is going: it is idle, not busy, so retry shortly. */
|
|
20
|
+
assertOpen(sessionId: string): void;
|
|
21
|
+
/** Refuse a session that runs a turn, or whose native state is going. */
|
|
22
|
+
assertIdle(sessionId: string): void;
|
|
23
|
+
begin(sessionId: string, turn: ActiveTurn): void;
|
|
24
|
+
/**
|
|
25
|
+
* The turn ended: its session is idle — unless a newer turn was admitted
|
|
26
|
+
* between this one's `turn.ended` and its run settling, whose mark stays.
|
|
27
|
+
*/
|
|
28
|
+
settle(sessionId: string, turnId: string): void;
|
|
29
|
+
/** Let the session's native state go with `release`; no turn starts meanwhile. */
|
|
30
|
+
whileClosing<T>(sessionId: string, kind: "closing" | "releasing", release: () => Promise<T>): Promise<T>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=session-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-gate.d.ts","sourceRoot":"","sources":["../../../src/server/session-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,sBAAsB,CAAC;AAEtE,+BAA+B;AAC/B,MAAM,WAAW,UAAU;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,WAAW;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IAEtE,yCAAyC;IACzC,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIrD,mCAAmC;IACnC,OAAO,IAAI,MAAM,EAAE;IAInB,4FAA4F;IAC5F,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKnC,yEAAyE;IACzE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IASnC,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAIhD;;;OAGG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/C,kFAAkF;IAC5E,YAAY,CAAC,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,SAAS,GAAG,WAAW,EAC7B,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC;CAQb"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AgentHarness, LifecycleEvent, MessagePartDeltaEvent, WireEventEnvelope } from "../protocol/index.ts";
|
|
2
|
+
export declare const DEFAULT_BUFFER_SIZE = 4096;
|
|
3
|
+
/**
|
|
4
|
+
* Per-session monotonic sequence + bounded replay buffer. Every
|
|
5
|
+
* outbound event is stamped with `seq` (starting at 1) and kept in a ring
|
|
6
|
+
* buffer so a reconnecting client can `events/replay({fromSeq})`. Eviction is
|
|
7
|
+
* visible to clients via `firstAvailableSeq`.
|
|
8
|
+
*
|
|
9
|
+
* Eviction advances a head index (O(1) amortized) instead of shifting the
|
|
10
|
+
* array; the dead prefix is compacted away once it reaches one full capacity,
|
|
11
|
+
* bounding memory at ~2x `maxBuffer` envelopes.
|
|
12
|
+
*/
|
|
13
|
+
export declare class SessionLog {
|
|
14
|
+
readonly sessionId: string;
|
|
15
|
+
/** The harness this session is bound to (first turn wins). */
|
|
16
|
+
readonly harness: AgentHarness;
|
|
17
|
+
private buffer;
|
|
18
|
+
private head;
|
|
19
|
+
private nextSeq;
|
|
20
|
+
private readonly maxBuffer;
|
|
21
|
+
constructor(sessionId: string,
|
|
22
|
+
/** The harness this session is bound to (first turn wins). */
|
|
23
|
+
harness: AgentHarness, maxBuffer?: number,
|
|
24
|
+
/** First seq to assign — a session reused after `session/close` continues
|
|
25
|
+
* where its previous incarnation stopped, so peers never see seq go
|
|
26
|
+
* backwards (a backwards seq reads as a duplicate and masks event loss). */
|
|
27
|
+
startSeq?: number);
|
|
28
|
+
append(event: LifecycleEvent): WireEventEnvelope;
|
|
29
|
+
/** A live-only event's envelope: the seq of the last kept event, nothing buffered.
|
|
30
|
+
* A delta follows its turn's `turn.started`, so there always is one. */
|
|
31
|
+
live(event: MessagePartDeltaEvent): WireEventEnvelope;
|
|
32
|
+
/** Buffered envelopes with `seq >= fromSeq` (seq is contiguous — index math). */
|
|
33
|
+
replay(fromSeq: number): WireEventEnvelope[];
|
|
34
|
+
/** Oldest seq still buffered, or null when nothing has been emitted. */
|
|
35
|
+
get firstAvailableSeq(): number | null;
|
|
36
|
+
/** Newest seq assigned, or null when nothing has been emitted. */
|
|
37
|
+
get latestSeq(): number | null;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=session-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-log.d.ts","sourceRoot":"","sources":["../../../src/server/session-log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAGxC;;;;;;;;;GASG;AACH,qBAAa,UAAU;IAOrB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,YAAY;IAR/B,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAGzB,SAAS,EAAE,MAAM;IAC1B,8DAA8D;IACrD,OAAO,EAAE,YAAY,EAC9B,SAAS,SAAsB;IAC/B;;gFAE4E;IAC5E,QAAQ,SAAI;IAQb,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB;IAahD;4EACwE;IACxE,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,iBAAiB;IAIrD,iFAAiF;IACjF,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,EAAE;IAM5C,wEAAwE;IACxE,IAAI,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAErC;IAED,kEAAkE;IAClE,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAE7B;CACD"}
|