@zvada/agent-server 0.3.18 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +11 -26
- package/CHANGELOG.md +1041 -1
- package/README.md +40 -40
- package/dist/types/accounts/chatgpt.d.ts +34 -0
- package/dist/types/accounts/chatgpt.d.ts.map +1 -0
- package/dist/types/accounts/check.d.ts +24 -0
- package/dist/types/accounts/check.d.ts.map +1 -0
- package/dist/types/accounts/claude.d.ts +21 -0
- package/dist/types/accounts/claude.d.ts.map +1 -0
- package/dist/types/accounts/endpoint.d.ts +50 -0
- package/dist/types/accounts/endpoint.d.ts.map +1 -0
- package/dist/types/accounts/http.d.ts +38 -0
- package/dist/types/accounts/http.d.ts.map +1 -0
- package/dist/types/accounts/index.d.ts +6 -0
- package/dist/types/accounts/index.d.ts.map +1 -0
- package/dist/types/client/client.d.ts +272 -0
- package/dist/types/client/client.d.ts.map +1 -0
- package/dist/types/client/connection.d.ts +160 -0
- package/dist/types/client/connection.d.ts.map +1 -0
- package/dist/types/client/history.d.ts +8 -0
- package/dist/types/client/history.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +5 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/client/listeners.d.ts +8 -0
- package/dist/types/client/listeners.d.ts.map +1 -0
- package/dist/types/client/logins.d.ts +35 -0
- package/dist/types/client/logins.d.ts.map +1 -0
- package/dist/types/client/rpc.d.ts +46 -0
- package/dist/types/client/rpc.d.ts.map +1 -0
- package/dist/types/client/streams.d.ts +150 -0
- package/dist/types/client/streams.d.ts.map +1 -0
- package/dist/types/client/transports.d.ts +35 -0
- package/dist/types/client/transports.d.ts.map +1 -0
- package/dist/types/client/turns.d.ts +81 -0
- package/dist/types/client/turns.d.ts.map +1 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts +68 -0
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -0
- package/dist/types/core/agents/acp/adapter.d.ts +39 -0
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/acp/client.d.ts +90 -0
- package/dist/types/core/agents/acp/client.d.ts.map +1 -0
- package/dist/types/core/agents/acp/known-agents.d.ts +35 -0
- package/dist/types/core/agents/acp/known-agents.d.ts.map +1 -0
- package/dist/types/core/agents/acp/mappings.d.ts +46 -0
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -0
- package/dist/types/core/agents/acp/requests.d.ts +26 -0
- package/dist/types/core/agents/acp/requests.d.ts.map +1 -0
- package/dist/types/core/agents/attachments.d.ts +11 -0
- package/dist/types/core/agents/attachments.d.ts.map +1 -0
- package/dist/types/core/agents/base.d.ts +227 -0
- package/dist/types/core/agents/base.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts +58 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts +26 -0
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +70 -0
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts +54 -0
- package/dist/types/core/agents/claude-code/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/events.d.ts +42 -0
- package/dist/types/core/agents/claude-code/events.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/login.d.ts +61 -0
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts +52 -0
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/models.d.ts +30 -0
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/options.d.ts +183 -0
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts +50 -0
- package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts +36 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session.d.ts +148 -0
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts +29 -0
- package/dist/types/core/agents/claude-code/spawn.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/spend.d.ts +58 -0
- package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/tools.d.ts +4 -0
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts +52 -0
- package/dist/types/core/agents/claude-code/turn-usage.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/turn.d.ts +121 -0
- package/dist/types/core/agents/claude-code/turn.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts +59 -0
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts +116 -0
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +113 -0
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts +66 -0
- package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts +49 -0
- package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts +12 -0
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts +45 -0
- package/dist/types/core/agents/codex-app-server/events.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts +20 -0
- package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts +26 -0
- package/dist/types/core/agents/codex-app-server/input.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts +31 -0
- package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts +38 -0
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +62 -0
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts +67 -0
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts +40 -0
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +19 -0
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts +99 -0
- package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts +42 -0
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts +96 -0
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts +53 -0
- package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +87 -0
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts +33 -0
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts +163 -0
- package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -0
- package/dist/types/core/agents/config-fingerprint.d.ts +5 -0
- package/dist/types/core/agents/config-fingerprint.d.ts.map +1 -0
- package/dist/types/core/agents/credentials.d.ts +28 -0
- package/dist/types/core/agents/credentials.d.ts.map +1 -0
- package/dist/types/core/agents/elicitation.d.ts +37 -0
- package/dist/types/core/agents/elicitation.d.ts.map +1 -0
- package/dist/types/core/agents/inherit-config.d.ts +18 -0
- package/dist/types/core/agents/inherit-config.d.ts.map +1 -0
- package/dist/types/core/agents/login.d.ts +67 -0
- package/dist/types/core/agents/login.d.ts.map +1 -0
- package/dist/types/core/agents/mcp-config.d.ts +57 -0
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -0
- package/dist/types/core/agents/plan.d.ts +16 -0
- package/dist/types/core/agents/plan.d.ts.map +1 -0
- package/dist/types/core/agents/registry.d.ts +30 -0
- package/dist/types/core/agents/registry.d.ts.map +1 -0
- package/dist/types/core/agents/session-agent.d.ts +48 -0
- package/dist/types/core/agents/session-agent.d.ts.map +1 -0
- package/dist/types/core/agents/session-pool.d.ts +41 -0
- package/dist/types/core/agents/session-pool.d.ts.map +1 -0
- package/dist/types/core/agents/stderr-tail.d.ts +28 -0
- package/dist/types/core/agents/stderr-tail.d.ts.map +1 -0
- package/dist/types/core/agents/thinking-levels.d.ts +4 -0
- package/dist/types/core/agents/thinking-levels.d.ts.map +1 -0
- package/dist/types/core/agents/types.d.ts +124 -0
- package/dist/types/core/agents/types.d.ts.map +1 -0
- package/dist/types/core/diagnostics.d.ts +36 -0
- package/dist/types/core/diagnostics.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +29 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/presets.d.ts +80 -0
- package/dist/types/core/presets.d.ts.map +1 -0
- package/dist/types/core/processes/identity.d.ts +31 -0
- package/dist/types/core/processes/identity.d.ts.map +1 -0
- package/dist/types/core/processes/lifeline.d.ts +47 -0
- package/dist/types/core/processes/lifeline.d.ts.map +1 -0
- package/dist/types/core/processes/native-processes.d.ts +130 -0
- package/dist/types/core/processes/native-processes.d.ts.map +1 -0
- package/dist/types/core/processes/process-table.d.ts +43 -0
- package/dist/types/core/processes/process-table.d.ts.map +1 -0
- package/dist/types/core/provision/cache-trust.d.ts +13 -0
- package/dist/types/core/provision/cache-trust.d.ts.map +1 -0
- package/dist/types/core/provision/cache-usage.d.ts +14 -0
- package/dist/types/core/provision/cache-usage.d.ts.map +1 -0
- package/dist/types/core/provision/checksums.d.ts +46 -0
- package/dist/types/core/provision/checksums.d.ts.map +1 -0
- package/dist/types/core/provision/extract.d.ts +7 -0
- package/dist/types/core/provision/extract.d.ts.map +1 -0
- package/dist/types/core/provision/index.d.ts +5 -0
- package/dist/types/core/provision/index.d.ts.map +1 -0
- package/dist/types/core/provision/install-build.d.ts +36 -0
- package/dist/types/core/provision/install-build.d.ts.map +1 -0
- package/dist/types/core/provision/npm.d.ts +40 -0
- package/dist/types/core/provision/npm.d.ts.map +1 -0
- package/dist/types/core/provision/pins.d.ts +24 -0
- package/dist/types/core/provision/pins.d.ts.map +1 -0
- package/dist/types/core/provision/platform.d.ts +28 -0
- package/dist/types/core/provision/platform.d.ts.map +1 -0
- package/dist/types/core/provision/provisioner.d.ts +189 -0
- package/dist/types/core/provision/provisioner.d.ts.map +1 -0
- package/dist/types/core/provision/releases.d.ts +8 -0
- package/dist/types/core/provision/releases.d.ts.map +1 -0
- package/dist/types/core/provision/tools.d.ts +81 -0
- package/dist/types/core/provision/tools.d.ts.map +1 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts +52 -0
- package/dist/types/core/proxy/anthropic-proxy.d.ts.map +1 -0
- package/dist/types/core/proxy/api-key-store.d.ts +37 -0
- package/dist/types/core/proxy/api-key-store.d.ts.map +1 -0
- package/dist/types/core/proxy/index.d.ts +3 -0
- package/dist/types/core/proxy/index.d.ts.map +1 -0
- package/dist/types/core/proxy/loopback.d.ts +14 -0
- package/dist/types/core/proxy/loopback.d.ts.map +1 -0
- package/dist/types/core/runtime/agent-runtime.d.ts +181 -0
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -0
- package/dist/types/core/runtime/event-processor.d.ts +87 -0
- package/dist/types/core/runtime/event-processor.d.ts.map +1 -0
- package/dist/types/core/runtime/event-sink.d.ts +44 -0
- package/dist/types/core/runtime/event-sink.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-clis.d.ts +10 -0
- package/dist/types/core/runtime/harness-clis.d.ts.map +1 -0
- package/dist/types/core/runtime/harness-logins.d.ts +68 -0
- package/dist/types/core/runtime/harness-logins.d.ts.map +1 -0
- package/dist/types/core/runtime/login-reads.d.ts +28 -0
- package/dist/types/core/runtime/login-reads.d.ts.map +1 -0
- package/dist/types/core/runtime/model-lists.d.ts +37 -0
- package/dist/types/core/runtime/model-lists.d.ts.map +1 -0
- package/dist/types/core/runtime/permission-policy.d.ts +61 -0
- package/dist/types/core/runtime/permission-policy.d.ts.map +1 -0
- package/dist/types/core/runtime/request-broker.d.ts +49 -0
- package/dist/types/core/runtime/request-broker.d.ts.map +1 -0
- package/dist/types/core/runtime/steering.d.ts +38 -0
- package/dist/types/core/runtime/steering.d.ts.map +1 -0
- package/dist/types/core/runtime/turn-outcome.d.ts +21 -0
- package/dist/types/core/runtime/turn-outcome.d.ts.map +1 -0
- package/dist/types/core/runtime/turn.d.ts +121 -0
- package/dist/types/core/runtime/turn.d.ts.map +1 -0
- package/dist/types/core/utils/bounded.d.ts +6 -0
- package/dist/types/core/utils/bounded.d.ts.map +1 -0
- package/dist/types/core/utils/deadline.d.ts +14 -0
- package/dist/types/core/utils/deadline.d.ts.map +1 -0
- package/dist/types/core/utils/errors.d.ts +104 -0
- package/dist/types/core/utils/errors.d.ts.map +1 -0
- package/dist/types/core/utils/is-record.d.ts +3 -0
- package/dist/types/core/utils/is-record.d.ts.map +1 -0
- package/dist/types/core/utils/loopback.d.ts +6 -0
- package/dist/types/core/utils/loopback.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/protocol/account.d.ts +26 -0
- package/dist/types/protocol/account.d.ts.map +1 -0
- package/dist/types/protocol/async-queue.d.ts +21 -0
- package/dist/types/protocol/async-queue.d.ts.map +1 -0
- package/dist/types/protocol/auth.d.ts +228 -0
- package/dist/types/protocol/auth.d.ts.map +1 -0
- package/dist/types/protocol/canonical.d.ts +9 -0
- package/dist/types/protocol/canonical.d.ts.map +1 -0
- package/dist/types/protocol/clis.d.ts +74 -0
- package/dist/types/protocol/clis.d.ts.map +1 -0
- package/dist/types/protocol/config.d.ts +200 -0
- package/dist/types/protocol/config.d.ts.map +1 -0
- package/dist/types/protocol/conversation.d.ts +942 -0
- package/dist/types/protocol/conversation.d.ts.map +1 -0
- package/dist/types/protocol/credentials.d.ts +145 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -0
- package/dist/types/protocol/errors.d.ts +36 -0
- package/dist/types/protocol/errors.d.ts.map +1 -0
- package/dist/types/protocol/execution.d.ts +28 -0
- package/dist/types/protocol/execution.d.ts.map +1 -0
- package/dist/types/protocol/factories.d.ts +94 -0
- package/dist/types/protocol/factories.d.ts.map +1 -0
- package/dist/types/protocol/guards.d.ts +55 -0
- package/dist/types/protocol/guards.d.ts.map +1 -0
- package/dist/types/protocol/harness.d.ts +70 -0
- package/dist/types/protocol/harness.d.ts.map +1 -0
- package/dist/types/protocol/history.d.ts +318 -0
- package/dist/types/protocol/history.d.ts.map +1 -0
- package/dist/types/protocol/ids.d.ts +9 -0
- package/dist/types/protocol/ids.d.ts.map +1 -0
- package/dist/types/protocol/index.d.ts +35 -0
- package/dist/types/protocol/index.d.ts.map +1 -0
- package/dist/types/protocol/lifecycle.d.ts +1190 -0
- package/dist/types/protocol/lifecycle.d.ts.map +1 -0
- package/dist/types/protocol/meta-keys.d.ts +17 -0
- package/dist/types/protocol/meta-keys.d.ts.map +1 -0
- package/dist/types/protocol/meta.d.ts +13 -0
- package/dist/types/protocol/meta.d.ts.map +1 -0
- package/dist/types/protocol/model-catalog.d.ts +11 -0
- package/dist/types/protocol/model-catalog.d.ts.map +1 -0
- package/dist/types/protocol/models.d.ts +107 -0
- package/dist/types/protocol/models.d.ts.map +1 -0
- package/dist/types/protocol/part-input.d.ts +101 -0
- package/dist/types/protocol/part-input.d.ts.map +1 -0
- package/dist/types/protocol/parts.d.ts +357 -0
- package/dist/types/protocol/parts.d.ts.map +1 -0
- package/dist/types/protocol/reduce.d.ts +26 -0
- package/dist/types/protocol/reduce.d.ts.map +1 -0
- package/dist/types/protocol/selectors.d.ts +64 -0
- package/dist/types/protocol/selectors.d.ts.map +1 -0
- package/dist/types/protocol/seq-cursor.d.ts +66 -0
- package/dist/types/protocol/seq-cursor.d.ts.map +1 -0
- package/dist/types/protocol/stop-reasons.d.ts +33 -0
- package/dist/types/protocol/stop-reasons.d.ts.map +1 -0
- package/dist/types/protocol/thinking.d.ts +28 -0
- package/dist/types/protocol/thinking.d.ts.map +1 -0
- package/dist/types/protocol/time.d.ts +21 -0
- package/dist/types/protocol/time.d.ts.map +1 -0
- package/dist/types/protocol/tokens.d.ts +29 -0
- package/dist/types/protocol/tokens.d.ts.map +1 -0
- package/dist/types/protocol/tool-closure.d.ts +25 -0
- package/dist/types/protocol/tool-closure.d.ts.map +1 -0
- package/dist/types/protocol/tool-state.d.ts +209 -0
- package/dist/types/protocol/tool-state.d.ts.map +1 -0
- package/dist/types/protocol/verify.d.ts +52 -0
- package/dist/types/protocol/verify.d.ts.map +1 -0
- package/dist/types/protocol/vocabulary.d.ts +19 -0
- package/dist/types/protocol/vocabulary.d.ts.map +1 -0
- package/dist/types/protocol/wire-api.d.ts +1983 -0
- package/dist/types/protocol/wire-api.d.ts.map +1 -0
- package/dist/types/protocol/wire.d.ts +1758 -0
- package/dist/types/protocol/wire.d.ts.map +1 -0
- package/dist/types/server/acp/binding.d.ts +33 -0
- package/dist/types/server/acp/binding.d.ts.map +1 -0
- package/dist/types/server/acp/session-records.d.ts +17 -0
- package/dist/types/server/acp/session-records.d.ts.map +1 -0
- package/dist/types/server/acp/translate.d.ts +48 -0
- package/dist/types/server/acp/translate.d.ts.map +1 -0
- package/dist/types/server/agent-server.d.ts +121 -0
- package/dist/types/server/agent-server.d.ts.map +1 -0
- package/dist/types/server/feedback.d.ts +37 -0
- package/dist/types/server/feedback.d.ts.map +1 -0
- package/dist/types/server/history.d.ts +15 -0
- package/dist/types/server/history.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +7 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/install.d.ts +42 -0
- package/dist/types/server/install.d.ts.map +1 -0
- package/dist/types/server/open-parts.d.ts +27 -0
- package/dist/types/server/open-parts.d.ts.map +1 -0
- package/dist/types/server/routes.d.ts +61 -0
- package/dist/types/server/routes.d.ts.map +1 -0
- package/dist/types/server/secrets.d.ts +11 -0
- package/dist/types/server/secrets.d.ts.map +1 -0
- package/dist/types/server/session-gate.d.ts +32 -0
- package/dist/types/server/session-gate.d.ts.map +1 -0
- package/dist/types/server/session-log.d.ts +39 -0
- package/dist/types/server/session-log.d.ts.map +1 -0
- package/dist/types/server/session-store.d.ts +119 -0
- package/dist/types/server/session-store.d.ts.map +1 -0
- package/dist/types/server/subscriptions.d.ts +74 -0
- package/dist/types/server/subscriptions.d.ts.map +1 -0
- package/dist/types/server/transports.d.ts +74 -0
- package/dist/types/server/transports.d.ts.map +1 -0
- package/dist/types/server/wire-error.d.ts +9 -0
- package/dist/types/server/wire-error.d.ts.map +1 -0
- package/dist/types/sync/event-log.d.ts +45 -0
- package/dist/types/sync/event-log.d.ts.map +1 -0
- package/dist/types/sync/fit.d.ts +40 -0
- package/dist/types/sync/fit.d.ts.map +1 -0
- package/dist/types/sync/history-reader.d.ts +8 -0
- package/dist/types/sync/history-reader.d.ts.map +1 -0
- package/dist/types/sync/history-sqlite.d.ts +37 -0
- package/dist/types/sync/history-sqlite.d.ts.map +1 -0
- package/dist/types/sync/history.d.ts +70 -0
- package/dist/types/sync/history.d.ts.map +1 -0
- package/dist/types/sync/index.d.ts +4 -0
- package/dist/types/sync/index.d.ts.map +1 -0
- package/dist/types/sync/journal-sqlite.d.ts +51 -0
- package/dist/types/sync/journal-sqlite.d.ts.map +1 -0
- package/dist/types/sync/journal.d.ts +107 -0
- package/dist/types/sync/journal.d.ts.map +1 -0
- package/dist/types/sync/live-tails.d.ts +30 -0
- package/dist/types/sync/live-tails.d.ts.map +1 -0
- package/dist/types/sync/node-sqlite.d.ts +7 -0
- package/dist/types/sync/node-sqlite.d.ts.map +1 -0
- package/dist/types/sync/projection.d.ts +10 -0
- package/dist/types/sync/projection.d.ts.map +1 -0
- package/dist/types/sync/recovery.d.ts +25 -0
- package/dist/types/sync/recovery.d.ts.map +1 -0
- package/dist/types/sync/retry.d.ts +25 -0
- package/dist/types/sync/retry.d.ts.map +1 -0
- package/dist/types/sync/schema.d.ts +4 -0
- package/dist/types/sync/schema.d.ts.map +1 -0
- package/dist/types/sync/sql.d.ts +38 -0
- package/dist/types/sync/sql.d.ts.map +1 -0
- package/dist/types/sync/sqlite-file.d.ts +9 -0
- package/dist/types/sync/sqlite-file.d.ts.map +1 -0
- package/dist/types/sync/sqlite.d.ts +6 -0
- package/dist/types/sync/sqlite.d.ts.map +1 -0
- package/dist/types/sync/worker.d.ts +63 -0
- package/dist/types/sync/worker.d.ts.map +1 -0
- package/docs/consuming.md +452 -53
- package/docs/deploy.md +218 -47
- package/docs/{sync-experiment.md → durable-sessions.md} +77 -72
- package/docs/feedback.md +116 -0
- package/docs/harnesses.md +212 -88
- package/docs/sync-history.md +29 -13
- package/docs/sync-integration.md +52 -66
- package/package.json +45 -28
- package/src/accounts/chatgpt.ts +194 -0
- package/src/accounts/check.ts +112 -0
- package/src/accounts/claude.ts +111 -0
- package/src/accounts/endpoint.ts +151 -0
- package/src/accounts/http.ts +97 -0
- package/src/accounts/index.ts +19 -0
- package/src/client/client.ts +604 -670
- package/src/client/connection.ts +371 -0
- package/src/client/history.ts +29 -52
- package/src/client/index.ts +11 -2
- package/src/client/listeners.ts +20 -0
- package/src/client/logins.ts +105 -0
- package/src/client/rpc.ts +155 -0
- package/src/client/streams.ts +488 -0
- package/src/client/transports.ts +62 -8
- package/src/client/turns.ts +171 -0
- package/src/core/agents/acp/acp-agent.ts +94 -118
- package/src/core/agents/acp/adapter.ts +20 -9
- package/src/core/agents/acp/client.ts +125 -47
- package/src/core/agents/acp/known-agents.ts +36 -4
- package/src/core/agents/acp/mappings.ts +64 -18
- package/src/core/agents/acp/requests.ts +125 -0
- package/src/core/agents/attachments.ts +18 -0
- package/src/core/agents/base.ts +120 -42
- package/src/core/agents/claude-code/adapter.ts +177 -238
- package/src/core/agents/claude-code/approvals.ts +270 -0
- package/src/core/agents/claude-code/claude-agent.ts +175 -158
- package/src/core/agents/claude-code/credentials.ts +171 -0
- package/src/core/agents/claude-code/events.ts +55 -0
- package/src/core/agents/claude-code/login.ts +269 -0
- package/src/core/agents/claude-code/mcp.ts +206 -0
- package/src/core/agents/claude-code/models.ts +15 -9
- package/src/core/agents/claude-code/options.ts +326 -39
- package/src/core/agents/claude-code/outcome.ts +209 -0
- package/src/core/agents/claude-code/session-pool.ts +136 -0
- package/src/core/agents/claude-code/session.ts +513 -0
- package/src/core/agents/claude-code/spawn.ts +144 -0
- package/src/core/agents/claude-code/spend.ts +160 -0
- package/src/core/agents/claude-code/tools.ts +47 -0
- package/src/core/agents/claude-code/turn-usage.ts +135 -0
- package/src/core/agents/claude-code/turn.ts +232 -0
- package/src/core/agents/codex-app-server/adapter.ts +314 -117
- package/src/core/agents/codex-app-server/client.ts +186 -84
- package/src/core/agents/codex-app-server/codex-agent.ts +343 -0
- package/src/core/agents/codex-app-server/commands.ts +228 -0
- package/src/core/agents/codex-app-server/credentials.ts +126 -0
- package/src/core/agents/codex-app-server/effort.ts +29 -0
- package/src/core/agents/codex-app-server/events.ts +47 -0
- package/src/core/agents/codex-app-server/homes.ts +64 -0
- package/src/core/agents/codex-app-server/input.ts +60 -0
- package/src/core/agents/codex-app-server/items.ts +149 -0
- package/src/core/agents/codex-app-server/login.ts +180 -0
- package/src/core/agents/codex-app-server/mcp.ts +182 -37
- package/src/core/agents/codex-app-server/models.ts +99 -46
- package/src/core/agents/codex-app-server/options.ts +146 -0
- package/src/core/agents/codex-app-server/plan-approval.ts +135 -0
- package/src/core/agents/codex-app-server/protocol.ts +117 -0
- package/src/core/agents/codex-app-server/requests.ts +332 -0
- package/src/core/agents/codex-app-server/session.ts +285 -0
- package/src/core/agents/codex-app-server/subagents.ts +108 -42
- package/src/core/agents/codex-app-server/thread-settings.ts +279 -0
- package/src/core/agents/codex-app-server/turn-items.ts +88 -0
- package/src/core/agents/codex-app-server/turn.ts +463 -0
- package/src/core/agents/config-fingerprint.ts +7 -14
- package/src/core/agents/credentials.ts +98 -0
- package/src/core/agents/elicitation.ts +75 -0
- package/src/core/agents/inherit-config.ts +21 -0
- package/src/core/agents/login.ts +116 -0
- package/src/core/agents/mcp-config.ts +112 -8
- package/src/core/agents/plan.ts +25 -0
- package/src/core/agents/registry.ts +21 -4
- package/src/core/agents/session-agent.ts +96 -4
- package/src/core/agents/{session-store.ts → session-pool.ts} +11 -5
- package/src/core/agents/stderr-tail.ts +75 -0
- package/src/core/agents/types.ts +40 -5
- package/src/core/index.ts +58 -48
- package/src/core/presets.ts +100 -39
- package/src/core/processes/identity.ts +113 -0
- package/src/core/processes/lifeline.ts +170 -0
- package/src/core/processes/native-processes.ts +379 -0
- package/src/core/processes/process-table.ts +174 -0
- package/src/core/provision/cache-trust.ts +121 -0
- package/src/core/provision/cache-usage.ts +69 -0
- package/src/core/provision/checksums.ts +64 -0
- package/src/core/provision/extract.ts +11 -2
- package/src/core/provision/index.ts +4 -1
- package/src/core/provision/install-build.ts +136 -0
- package/src/core/provision/npm.ts +112 -17
- package/src/core/provision/pins.ts +9 -33
- package/src/core/provision/platform.ts +12 -1
- package/src/core/provision/provisioner.ts +329 -397
- package/src/core/provision/releases.ts +86 -0
- package/src/core/provision/tools.ts +329 -0
- package/src/core/proxy/anthropic-proxy.ts +55 -25
- package/src/core/proxy/api-key-store.ts +2 -12
- package/src/core/proxy/loopback.ts +106 -0
- package/src/core/runtime/agent-runtime.ts +327 -498
- package/src/core/runtime/event-processor.ts +197 -70
- package/src/core/runtime/harness-clis.ts +61 -0
- package/src/core/runtime/harness-logins.ts +328 -0
- package/src/core/runtime/login-reads.ts +78 -0
- package/src/core/runtime/model-lists.ts +33 -48
- package/src/core/runtime/permission-policy.ts +113 -0
- package/src/core/runtime/request-broker.ts +204 -0
- package/src/core/runtime/steering.ts +112 -0
- package/src/core/runtime/turn-outcome.ts +30 -0
- package/src/core/runtime/turn.ts +360 -0
- package/src/core/utils/bounded.ts +12 -0
- package/src/core/utils/deadline.ts +38 -0
- package/src/core/utils/errors.ts +113 -21
- package/src/core/utils/is-record.ts +4 -0
- package/src/core/utils/loopback.ts +10 -0
- package/src/protocol/account.ts +104 -0
- package/src/protocol/auth.ts +199 -0
- package/src/protocol/canonical.ts +16 -0
- package/src/protocol/clis.ts +69 -0
- package/src/protocol/config.ts +60 -6
- package/src/protocol/conversation.ts +272 -0
- package/src/protocol/credentials.ts +145 -0
- package/src/protocol/errors.ts +78 -20
- package/src/protocol/execution.ts +5 -2
- package/src/protocol/factories.ts +55 -7
- package/src/protocol/guards.ts +55 -2
- package/src/protocol/harness.ts +56 -6
- package/src/protocol/history.ts +72 -64
- package/src/protocol/ids.ts +0 -12
- package/src/protocol/index.ts +9 -0
- package/src/protocol/lifecycle.ts +250 -79
- package/src/protocol/meta-keys.ts +17 -0
- package/src/protocol/meta.ts +3 -3
- package/src/protocol/models.ts +2 -43
- package/src/protocol/part-input.ts +2 -1
- package/src/protocol/parts.ts +12 -3
- package/src/protocol/reduce.ts +302 -413
- package/src/protocol/selectors.ts +1 -20
- package/src/protocol/seq-cursor.ts +14 -0
- package/src/protocol/stop-reasons.ts +1 -1
- package/src/protocol/thinking.ts +1 -30
- package/src/protocol/time.ts +2 -2
- package/src/protocol/tool-closure.ts +93 -0
- package/src/protocol/tool-state.ts +19 -4
- package/src/protocol/verify.ts +222 -92
- package/src/protocol/vocabulary.ts +21 -5
- package/src/protocol/wire-api.ts +232 -0
- package/src/protocol/wire.ts +351 -64
- package/src/server/acp/binding.ts +63 -103
- package/src/server/acp/session-records.ts +53 -0
- package/src/server/acp/translate.ts +129 -20
- package/src/server/agent-server.ts +223 -387
- package/src/server/bin.ts +280 -78
- package/src/server/feedback.ts +204 -14
- package/src/server/history.ts +116 -122
- package/src/server/index.ts +3 -8
- package/src/server/install.ts +107 -8
- package/src/server/open-parts.ts +95 -0
- package/src/server/routes.ts +391 -0
- package/src/server/secrets.ts +24 -0
- package/src/server/session-gate.ts +69 -0
- package/src/server/session-log.ts +14 -2
- package/src/server/session-store.ts +136 -72
- package/src/server/subscriptions.ts +232 -0
- package/src/server/transports.ts +125 -25
- package/src/server/wire-error.ts +31 -45
- package/src/sync/event-log.ts +31 -3
- package/src/sync/fit.ts +27 -11
- package/src/sync/history-reader.ts +10 -5
- package/src/sync/history-sqlite.ts +37 -42
- package/src/sync/history.ts +9 -15
- package/src/sync/index.ts +17 -5
- package/src/sync/journal-sqlite.ts +162 -76
- package/src/sync/journal.ts +91 -32
- package/src/sync/live-tails.ts +107 -0
- package/src/sync/projection.ts +35 -0
- package/src/sync/recovery.ts +80 -51
- package/src/sync/schema.ts +27 -6
- package/docs/rfds/0001-deterministic-echo-ids.md +0 -44
- package/docs/rfds/0002-native-subagents.md +0 -197
- package/src/client/request.ts +0 -19
- package/src/core/agents/claude-code/generator-session.ts +0 -572
- package/src/core/agents/claude-code/session-manager.ts +0 -166
- package/src/core/agents/codex-app-server/codex-app-server-agent.ts +0 -962
- package/src/core/agents/codex-items.ts +0 -149
- package/src/core/agents/codex-sdk/adapter.ts +0 -237
- package/src/core/agents/codex-sdk/codex-sdk-agent.ts +0 -330
- package/src/core/agents/tool-meta.ts +0 -68
package/README.md
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
# @zvada/agent-server
|
|
2
2
|
|
|
3
3
|
A standardized, harness-agnostic **agent execution engine**: run Claude Code,
|
|
4
|
-
OpenAI Codex (
|
|
4
|
+
OpenAI Codex (app-server), and any [ACP](https://agentclientprotocol.com)
|
|
5
5
|
agent behind one interface with a single normalized event stream, multi-turn
|
|
6
6
|
sessions, resume, engine-brokered permissions, and pinned CLI provisioning.
|
|
7
7
|
|
|
8
|
-
One package,
|
|
8
|
+
One package, six seats — pick the subpath for how you consume it:
|
|
9
9
|
|
|
10
10
|
| Import | Seat |
|
|
11
11
|
| --- | --- |
|
|
12
12
|
| `@zvada/agent-server` (or `/protocol`) | **The wire contract** — zod schemas for `Part`, `LifecycleEvent`, `RunRequest`, wire method envelopes, harness/model/thinking vocabulary, token usage, UUIDv7 ids. Zod-only, safe in any runtime (workers, browsers, node, bun). |
|
|
13
13
|
| `@zvada/agent-server/core` | **The engine** — `AgentRuntime`, harness agents + adapters, registry, CLI provisioning. Embed it in-process behind an `EventSink`. |
|
|
14
14
|
| `@zvada/agent-server/server` | **The standard wire** — serve the engine over JSON-RPC 2.0 NDJSON (stdio / WebSocket listen / dial-out) with quick-ack turns, per-session `seq`, bounded replay, and an ACP v1 binding (`--acp`). Ships the `agent-server` bin. |
|
|
15
|
-
| `@zvada/agent-server/client` | **The typed consumer client** — spawn/connect/attach, `runTurn` as an async iterable, permission responses, reconnect with sequenced replay healing (a turn start whose ack a dropped connection lost is re-sent and joins the running turn), `
|
|
15
|
+
| `@zvada/agent-server/client` | **The typed consumer client** — spawn/connect/attach, `runTurn` as an async iterable, permission responses, reconnect with sequenced replay healing (a turn start whose ack a dropped connection lost is re-sent and joins the running turn), `subscribe` / `joinTurn` to follow a session or a turn another client started, the harnesses' logins (`authStatus`, `login`). Depends only on the contract + node builtins. |
|
|
16
|
+
| `@zvada/agent-server/accounts` | **A login the product holds** — sign a subscription in for a credential the product stores (ChatGPT, Claude), renew it, and answer each turn's credential request (`createCredentialHandler`, `credentialsFrom`). `fetch` and Web Crypto only: it runs in a Worker. |
|
|
16
17
|
| `@zvada/agent-server/sync` | **Experimental.** Optional durable journal port and history helpers: transfer, open, follow, managed sync. |
|
|
17
18
|
| `@zvada/agent-server/sync/sqlite` | **Experimental.** Bun SQLite journal with its history and checkpoint store. |
|
|
18
19
|
| `@zvada/agent-server/sync/node-sqlite` | **Experimental.** Same storage under Node >=22.16 using built-in SQLite (itself experimental in Node 22). |
|
|
19
20
|
| `@zvada/agent-server/core/proxy` | Optional BYOK Anthropic proxy building block. |
|
|
20
21
|
|
|
22
|
+
zod is a peer (any 4.x): install it beside the package, and your schemas and
|
|
23
|
+
ours are one zod's.
|
|
24
|
+
|
|
21
25
|
## Embed the engine
|
|
22
26
|
|
|
23
27
|
```ts
|
|
28
|
+
import { generateUUIDv7 } from "@zvada/agent-server";
|
|
24
29
|
import { callbackSink, createAgentRuntime } from "@zvada/agent-server/core";
|
|
25
30
|
|
|
26
31
|
const runtime = createAgentRuntime({ provision: { mode: "pinned" } });
|
|
27
32
|
await runtime.run(
|
|
28
33
|
{
|
|
29
34
|
sessionId: "s1",
|
|
35
|
+
turnId: generateUUIDv7(),
|
|
30
36
|
input: "What does this repo do?",
|
|
31
37
|
config: { harness: "claude-code", cwd: process.cwd(), thinkingLevel: "high" },
|
|
32
38
|
},
|
|
@@ -34,19 +40,28 @@ await runtime.run(
|
|
|
34
40
|
);
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
Agent SDKs (`@anthropic-ai/claude-agent-sdk`, `@
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
Agent SDKs (`@anthropic-ai/claude-agent-sdk`, `@agentclientprotocol/sdk`) are
|
|
44
|
+
**optional peer dependencies**, loaded lazily — a harness only needs its own
|
|
45
|
+
SDK present. Codex needs none: its harness drives the `codex` CLI directly.
|
|
40
46
|
|
|
41
47
|
## Run the wire server
|
|
42
48
|
|
|
43
49
|
```sh
|
|
44
|
-
bunx @zvada/agent-server --listen 4747 # WebSocket wire
|
|
50
|
+
bunx @zvada/agent-server --listen 4747 # WebSocket wire on 127.0.0.1
|
|
45
51
|
bunx @zvada/agent-server --stdio # stdio wire (for spawners)
|
|
46
52
|
bunx @zvada/agent-server --acp # act as an ACP v1 agent (Zed-spawnable)
|
|
47
53
|
bunx @zvada/agent-server install # prefetch pinned claude/codex CLIs
|
|
48
54
|
```
|
|
49
55
|
|
|
56
|
+
A listener answers native clients only: a browser is refused unless
|
|
57
|
+
`--allow-origin <origin>` names its origin, since any page may open a
|
|
58
|
+
WebSocket to localhost. Beyond loopback (`--listen 0.0.0.0:4747`) it needs a
|
|
59
|
+
token, from `--token-file <path>` or `$AGENT_SERVER_TOKEN` (never argv), which
|
|
60
|
+
clients send: `AgentServerClient.connect(url, { token })`, which fails with
|
|
61
|
+
`ConnectionRefusedError` when refused. `--dial <url>` presents
|
|
62
|
+
`$AGENT_SERVER_DIAL_TOKEN` to the backend it dials, in a header. See
|
|
63
|
+
[the trust boundary](docs/deploy.md#trust-boundary).
|
|
64
|
+
|
|
50
65
|
## Talk to one
|
|
51
66
|
|
|
52
67
|
```ts
|
|
@@ -65,7 +80,7 @@ await client.closeSession(turn.sessionId);
|
|
|
65
80
|
persistent admission, commit-before-broadcast history, and replay across process
|
|
66
81
|
restarts. Each session's history is served over the `history/*` methods, which
|
|
67
82
|
`/sync` helpers copy, follow and fork into host-owned stores; nothing contacts a
|
|
68
|
-
cloud service automatically. See [the design and recovery contract](docs/
|
|
83
|
+
cloud service automatically. See [the design and recovery contract](docs/durable-sessions.md)
|
|
69
84
|
and [the history SDK](docs/sync-history.md).
|
|
70
85
|
|
|
71
86
|
This surface is experimental: the `/sync` exports, the journal's wire methods
|
|
@@ -73,30 +88,20 @@ This surface is experimental: the `/sync` exports, the journal's wire methods
|
|
|
73
88
|
journal's file format may change in minor releases. Read the changelog before
|
|
74
89
|
upgrading a host that keeps journals. Without a journal, nothing here applies.
|
|
75
90
|
|
|
76
|
-
##
|
|
91
|
+
## Feedback
|
|
77
92
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
Found agent-server itself broken, confusing, missing or notably good — an export
|
|
94
|
+
that doesn't behave as typed, a harness quirk, an event that surprised you, a
|
|
95
|
+
doc gap? Report it to the maintainers; it is keyless, and never include your
|
|
96
|
+
task's content:
|
|
82
97
|
|
|
83
98
|
```sh
|
|
84
|
-
|
|
99
|
+
agent-server feedback --category <area> --subject "<export, error code, or harness>" --message "<what happened, and what you expected>"
|
|
85
100
|
```
|
|
86
101
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```sh
|
|
92
|
-
npx --yes hivenet@latest --to agent-server --category <surface it failed on> --task "<the goal>" --expected "<correct outcome>" --actual "<what happened>" --attempts <n> "<one-line summary>"
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
The response may include `guidance` (a maintainer reply on this thread) and an
|
|
96
|
-
`ask` (their question plus a ready-to-run answer command — answer only from what
|
|
97
|
-
you actually observed; skipping is fine). Continue a thread with
|
|
98
|
-
`--resume <threadId>` (printed after each submission). `DO_NOT_TRACK=1` strips
|
|
99
|
-
auto-detected context. Only specific, actionable reports — never secrets.
|
|
102
|
+
`npx --yes hivenet@latest --to agent-server …` sends the same without the
|
|
103
|
+
binary. [The feedback guide](docs/feedback.md) covers failed-task reports,
|
|
104
|
+
replies, attachments and HTTP/MCP reporting.
|
|
100
105
|
|
|
101
106
|
## Consume the stream
|
|
102
107
|
|
|
@@ -114,8 +119,10 @@ for await (const event of turn.events) conversation = reduceConversation(convers
|
|
|
114
119
|
## Notes
|
|
115
120
|
|
|
116
121
|
- Ships as TypeScript source (Bun-first; the client and stdio/dial server
|
|
117
|
-
transports also run under Node >= 20
|
|
118
|
-
`
|
|
122
|
+
transports also run under Node >= 20, where the host bundles the source or
|
|
123
|
+
runs it through a TypeScript loader) with declarations: a consumer's `tsc`
|
|
124
|
+
reads `dist/types`, so its compiler options, Bun's types and the SDKs of
|
|
125
|
+
harnesses it does not run stay out of its build (with `skipLibCheck`).
|
|
119
126
|
- The wire vocabulary tracks the
|
|
120
127
|
[Agent Client Protocol](https://agentclientprotocol.com) where concepts
|
|
121
128
|
overlap.
|
|
@@ -127,15 +134,8 @@ for await (const event of turn.events) conversation = reduceConversation(convers
|
|
|
127
134
|
- Supersedes the four split packages `@zvada/agent-server-{protocol,core,server,client}`
|
|
128
135
|
(now deprecated); the subpaths above are their one-to-one replacements.
|
|
129
136
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
See [sync integration](docs/sync-integration.md) for adopting the journal in a
|
|
138
|
+
host that embeds the runtime or serves the wire, read-only viewers and the
|
|
139
|
+
remaining platform contracts.
|
|
133
140
|
|
|
134
|
-
|
|
135
|
-
Deus WebSocket seams, read-only viewers and remaining platform contracts.
|
|
136
|
-
In this workspace, `bun run control-agent-server doctor` checks the installed CLI;
|
|
137
|
-
`bun run control-agent-server replay session-sync --live-model` runs the real CLI
|
|
138
|
-
and Claude model, copies history into a separate local process and database,
|
|
139
|
-
exercises lost acknowledgements and restarts, and retains proof for two independent
|
|
140
|
-
viewers. This opt-in recipe uses the existing provider login and a synthetic
|
|
141
|
-
conversation, with tools disabled.
|
|
141
|
+
MIT
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CredentialGrant } from "../protocol/credentials.ts";
|
|
2
|
+
import { type ProviderOptions } from "./http.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A ChatGPT sign-in under way: show `userCode` and `verificationUrl`, then
|
|
5
|
+
* `pollChatGptLogin` every `intervalMs` until `expiresAt`. Keep it on the
|
|
6
|
+
* server: whoever holds `deviceAuthId` and `userCode` finishes the sign-in.
|
|
7
|
+
*/
|
|
8
|
+
export interface ChatGptLogin {
|
|
9
|
+
deviceAuthId: string;
|
|
10
|
+
userCode: string;
|
|
11
|
+
verificationUrl: string;
|
|
12
|
+
intervalMs: number;
|
|
13
|
+
expiresAt: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Start a ChatGPT sign-in with a device code, which a person enters on any
|
|
17
|
+
* device: what a hosted product offers, since Codex's browser sign-in calls
|
|
18
|
+
* back to `localhost` only. The account must allow device codes (ChatGPT
|
|
19
|
+
* settings, Security).
|
|
20
|
+
*/
|
|
21
|
+
export declare function startChatGptLogin(options?: ProviderOptions): Promise<ChatGptLogin>;
|
|
22
|
+
/**
|
|
23
|
+
* Ask once whether the person approved: the grant once they did, `undefined`
|
|
24
|
+
* while they have not. Poll no faster than `intervalMs`. The approval's code is
|
|
25
|
+
* exchanged once, never retried: a lost answer means sign in again.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pollChatGptLogin(login: ChatGptLogin, options?: ProviderOptions): Promise<CredentialGrant | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Renew a ChatGPT grant: the same account with fresh tokens, which the
|
|
30
|
+
* product stores in its place. One renewal at a time per grant: a renewal
|
|
31
|
+
* whose answer was lost may have happened, and is not tried again here.
|
|
32
|
+
*/
|
|
33
|
+
export declare function refreshChatGptGrant(grant: CredentialGrant, options?: ProviderOptions): Promise<CredentialGrant>;
|
|
34
|
+
//# sourceMappingURL=chatgpt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatgpt.d.ts","sourceRoot":"","sources":["../../../src/accounts/chatgpt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAgB,KAAK,eAAe,EAAkC,MAAM,WAAW,CAAC;AAW/F;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CAClB;AA8CD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CA0B5F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACrC,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE,eAAoB,GAC3B,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CA6CtC;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,eAAe,EACtB,OAAO,GAAE,eAAoB,GAC3B,OAAO,CAAC,eAAe,CAAC,CA2B1B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type CredentialGrant, type HarnessCredential } from "../protocol/credentials.ts";
|
|
2
|
+
import type { AgentHarness } from "../protocol/harness.ts";
|
|
3
|
+
import { type ProviderOptions } from "./http.ts";
|
|
4
|
+
/** What `checkCredential` found. */
|
|
5
|
+
export type CredentialCheck = {
|
|
6
|
+
ok: true;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: string;
|
|
10
|
+
reconnect: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Whether a credential works, by one cheap request to its provider (a model
|
|
14
|
+
* list): a key or token the provider refuses is `reconnect`. A ChatGPT token
|
|
15
|
+
* is checked by its expiry only, as no public request takes it, and a
|
|
16
|
+
* gateway's key (`baseUrl`) not at all.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkCredential(harness: AgentHarness, credential: HarnessCredential, options?: ProviderOptions): Promise<CredentialCheck>;
|
|
19
|
+
/**
|
|
20
|
+
* A key or token the person pasted (an API key, a `claude setup-token`
|
|
21
|
+
* token), checked: the grant to store, or why not.
|
|
22
|
+
*/
|
|
23
|
+
export declare function pastedGrant(harness: AgentHarness, credential: HarnessCredential, options?: ProviderOptions): Promise<CredentialGrant>;
|
|
24
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/accounts/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAgB,KAAK,eAAe,EAAQ,MAAM,WAAW,CAAC;AAErE,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAO9F;;;;;GAKG;AACH,wBAAsB,eAAe,CACpC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,iBAAiB,EAC7B,OAAO,GAAE,eAAoB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAU1B;AA6DD;;;GAGG;AACH,wBAAsB,WAAW,CAChC,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,iBAAiB,EAC7B,OAAO,GAAE,eAAoB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAI1B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CredentialGrant } from "../protocol/credentials.ts";
|
|
2
|
+
import { type ProviderOptions } from "./http.ts";
|
|
3
|
+
/**
|
|
4
|
+
* A Claude sign-in for a one-year token, under way: the person opens `url`,
|
|
5
|
+
* signs in to their Claude plan, and pastes the code the page shows
|
|
6
|
+
* (`completeClaudeLogin`). Keep it on the server: `verifier` finishes it.
|
|
7
|
+
*/
|
|
8
|
+
export interface ClaudeLogin {
|
|
9
|
+
url: string;
|
|
10
|
+
state: string;
|
|
11
|
+
verifier: string;
|
|
12
|
+
}
|
|
13
|
+
/** Start a Claude sign-in whose code is pasted back: it works from any device. */
|
|
14
|
+
export declare function startClaudeLogin(): Promise<ClaudeLogin>;
|
|
15
|
+
/**
|
|
16
|
+
* Finish a Claude sign-in with the code its page showed (`code#state`, the
|
|
17
|
+
* page's address, or the bare code): a one-year inference token, which needs
|
|
18
|
+
* no renewal. A code from another sign-in is refused before it is sent.
|
|
19
|
+
*/
|
|
20
|
+
export declare function completeClaudeLogin(login: ClaudeLogin, pasted: string, options?: ProviderOptions): Promise<CredentialGrant>;
|
|
21
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/accounts/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAoB,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAEN,KAAK,eAAe,EAMpB,MAAM,WAAW,CAAC;AAanB;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,kFAAkF;AAClF,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC,CAiB7D;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACxC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAoB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAgD1B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type CredentialGrant, type CredentialRequest, type HarnessCredential } from "../protocol/credentials.ts";
|
|
2
|
+
import { type ProviderOptions } from "./http.ts";
|
|
3
|
+
/** What a product's credential endpoint does with each ask. */
|
|
4
|
+
export interface CredentialHandlerOptions<Principal> {
|
|
5
|
+
/**
|
|
6
|
+
* Who asks: whose credentials this request may get (from its bearer token,
|
|
7
|
+
* say). `undefined` refuses it (401).
|
|
8
|
+
*/
|
|
9
|
+
authorize(request: Request): Principal | undefined | Promise<Principal | undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* The credential for that session and harness (`credentialsFrom` over the
|
|
12
|
+
* product's store, renewed when it must be); `undefined` runs the turn on
|
|
13
|
+
* the engine's own CLI login. An `AccountError` reaches the turn in its own
|
|
14
|
+
* words (409), saying whether the person must sign in again (`reconnect`);
|
|
15
|
+
* any other failure, as "no credential".
|
|
16
|
+
*/
|
|
17
|
+
resolve(request: CredentialRequest, principal: Principal): Promise<HarnessCredential | undefined>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A product's credential endpoint, as a Web-standard handler for any server
|
|
21
|
+
* (a Worker, Bun, Hono, Node 18+): what an engine started with
|
|
22
|
+
* `credentialsFromUrl` (`--credentials-url`) asks before each turn.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createCredentialHandler<Principal>(options: CredentialHandlerOptions<Principal>): (request: Request) => Promise<Response>;
|
|
25
|
+
/**
|
|
26
|
+
* Where a product keeps the grants it holds. Whose grant answers a request is
|
|
27
|
+
* its own decision: the principal its `authorize` read, the session's owner,
|
|
28
|
+
* the account a turn bills.
|
|
29
|
+
*/
|
|
30
|
+
export interface GrantStore<Principal> {
|
|
31
|
+
read(request: CredentialRequest, principal: Principal): Promise<CredentialGrant | undefined>;
|
|
32
|
+
/** Keep a renewed grant in place of the one read: its refresh token is spent. */
|
|
33
|
+
write(grant: CredentialGrant, request: CredentialRequest, principal: Principal): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A credential endpoint's `resolve` over the product's store: the grant's
|
|
37
|
+
* credential, renewed first when it expires within five minutes or the
|
|
38
|
+
* harness refused the very token it holds, and the renewal written back. One
|
|
39
|
+
* renewal at a time per grant in this process, deciding on the grant as read
|
|
40
|
+
* inside it; across processes, the store decides which write wins (a
|
|
41
|
+
* revision it compares before writing).
|
|
42
|
+
*/
|
|
43
|
+
export declare function credentialsFrom<Principal>(store: GrantStore<Principal>, options?: ProviderOptions): CredentialHandlerOptions<Principal>["resolve"];
|
|
44
|
+
/**
|
|
45
|
+
* Whether to renew a grant before answering: it expires within five
|
|
46
|
+
* minutes, or the harness refused the very token it holds. A refusal of an
|
|
47
|
+
* older token than the one held is answered with the one held.
|
|
48
|
+
*/
|
|
49
|
+
export declare function needsRenewal(grant: CredentialGrant, request: Pick<CredentialRequest, "rejectedSha256">, now?: number): Promise<boolean>;
|
|
50
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../src/accounts/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EAEtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAE/D,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB,CAAC,SAAS;IAClD;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IACpF;;;;;;OAMG;IACH,OAAO,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;CAClG;AAKD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAChD,OAAO,EAAE,wBAAwB,CAAC,SAAS,CAAC,GAC1C,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAoBzC;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU,CAAC,SAAS;IACpC,IAAI,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAAC;IAC7F,iFAAiF;IACjF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/F;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EACxC,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,EAC5B,OAAO,GAAE,eAAoB,GAC3B,wBAAwB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CA8BhD;AAWD;;;;GAIG;AACH,wBAAsB,YAAY,CACjC,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,EAClD,GAAG,GAAE,MAAmB,GACtB,OAAO,CAAC,OAAO,CAAC,CAMlB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why an account operation failed, in words for the person: `reconnect`
|
|
3
|
+
* means the account must be signed in again (a refused or revoked grant), as
|
|
4
|
+
* opposed to a failure worth trying again.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AccountError extends Error {
|
|
7
|
+
readonly reconnect: boolean;
|
|
8
|
+
constructor(message: string, reconnect?: boolean);
|
|
9
|
+
}
|
|
10
|
+
/** What every request to a provider can be given: its HTTP, its clock. */
|
|
11
|
+
export interface ProviderOptions {
|
|
12
|
+
fetch?: typeof fetch;
|
|
13
|
+
now?: () => number;
|
|
14
|
+
/** Each request's deadline (default 8 s). */
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
}
|
|
17
|
+
/** A provider's answer: JSON when it sent some, `undefined` when it did not. */
|
|
18
|
+
export interface Answer {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
status: number;
|
|
21
|
+
body: unknown;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One request to a provider's fixed endpoint: no redirect followed, a
|
|
25
|
+
* deadline, the body as JSON. A request that never answered throws: after a
|
|
26
|
+
* token exchange or renewal it may have happened, so it is never retried here.
|
|
27
|
+
*/
|
|
28
|
+
export declare function call(url: string, init: RequestInit, options: ProviderOptions): Promise<Answer>;
|
|
29
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
30
|
+
export declare const text: (value: unknown) => string | undefined;
|
|
31
|
+
/** Random bytes as base64url: a PKCE verifier, a state. */
|
|
32
|
+
export declare function randomToken(bytes?: number): string;
|
|
33
|
+
export declare function base64Url(bytes: Uint8Array): string;
|
|
34
|
+
/** A PKCE challenge (S256) for a verifier. */
|
|
35
|
+
export declare function challengeOf(verifier: string): Promise<string>;
|
|
36
|
+
/** A JWT's claims, read, not verified: only ever of a token its issuer just answered over TLS. */
|
|
37
|
+
export declare function claimsOf(jwt: string): Record<string, unknown>;
|
|
38
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/accounts/http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,KAAK;IAGrC,QAAQ,CAAC,SAAS;gBADlB,OAAO,EAAE,MAAM,EACN,SAAS,UAAQ;CAK3B;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC/B,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,gFAAgF;AAChF,MAAM,WAAW,MAAM;IACtB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CACJ,CAAC;AAEtE,eAAO,MAAM,IAAI,GAAI,OAAO,OAAO,KAAG,MAAM,GAAG,SACmB,CAAC;AAEnE,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,KAAK,SAAK,GAAG,MAAM,CAE9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAInD;AAED,8CAA8C;AAC9C,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnE;AAED,kGAAkG;AAClG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { type CredentialCheck, checkCredential, pastedGrant } from "./check.ts";
|
|
2
|
+
export { type ChatGptLogin, pollChatGptLogin, refreshChatGptGrant, startChatGptLogin, } from "./chatgpt.ts";
|
|
3
|
+
export { type ClaudeLogin, completeClaudeLogin, startClaudeLogin } from "./claude.ts";
|
|
4
|
+
export { type CredentialHandlerOptions, type GrantStore, createCredentialHandler, credentialsFrom, } from "./endpoint.ts";
|
|
5
|
+
export { AccountError, type ProviderOptions } from "./http.ts";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accounts/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACN,KAAK,YAAY,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,WAAW,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EACN,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,uBAAuB,EACvB,eAAe,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { type AgentHarness, type AsyncHistoryApi, type AuthUpdated, type DecodedEventsReplayResult, type DecodedWireEventEnvelope, type DurableSession, type ElicitationOutcome, type HarnessAuth, type HarnessCli, type HarnessCliProgress, type InitializeResult, type ModelList, type ModelsListParams, type PermissionOutcome, type RunningTurn, type SessionConfirmStoppedParams, type TurnCancelResult, type TurnReceipt, type TurnStartParams, type TurnStartResult, type TurnSteerParams, type TurnSteerResult, type WireTransport } from "../protocol/index.ts";
|
|
2
|
+
import { type AgentServerClientOptions, ConnectionClosedError, type ConnectionEvent, type ConnectionRefusal, ConnectionRefusedError, type TransportFactory } from "./connection.ts";
|
|
3
|
+
import { type LoginHandle } from "./logins.ts";
|
|
4
|
+
import { EventGapError, type SessionEventGap } from "./streams.ts";
|
|
5
|
+
import { type SpawnServerOptions, type WebSocketLike } from "./transports.ts";
|
|
6
|
+
import { type TurnHandle } from "./turns.ts";
|
|
7
|
+
export { type AgentServerClientOptions, ConnectionClosedError, type ConnectionEvent, type ConnectionRefusal, ConnectionRefusedError, EventGapError, type SessionEventGap, type TurnHandle, };
|
|
8
|
+
export interface SubscribeOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Catch up after this seq: the session's kept events after it reach
|
|
11
|
+
* `onEvent` first. Default: none, the head (live only). A session this
|
|
12
|
+
* client follows already keeps its place.
|
|
13
|
+
*/
|
|
14
|
+
afterSeq?: number;
|
|
15
|
+
}
|
|
16
|
+
/** How `connect` dials. */
|
|
17
|
+
export interface ConnectOptions extends AgentServerClientOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Sent as `Authorization: Bearer <token>` with every dial, redials
|
|
20
|
+
* included: what a listener with a token requires. Bun and Node only; a
|
|
21
|
+
* browser's WebSocket sends no headers.
|
|
22
|
+
*/
|
|
23
|
+
token?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Where a subscription started. */
|
|
26
|
+
export interface SessionSubscription {
|
|
27
|
+
sessionId: string;
|
|
28
|
+
/** The session's last kept seq at the subscription point. */
|
|
29
|
+
headSeq: number;
|
|
30
|
+
/** The turn running at the point. */
|
|
31
|
+
activeTurn?: RunningTurn;
|
|
32
|
+
}
|
|
33
|
+
/** How a turn handle follows its turn (`runTurn`, `joinTurn`). */
|
|
34
|
+
export interface FollowOptions {
|
|
35
|
+
/** Stop following: `events` and `result` fail with the signal's reason, an `AbortError`. */
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}
|
|
38
|
+
export interface JoinTurnOptions extends FollowOptions {
|
|
39
|
+
/** The first kept event to yield. Default: the running turn's `turn.started`. */
|
|
40
|
+
fromSeq?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Typed client for the agent-server wire. Turns are quick-ack: `runTurn`
|
|
44
|
+
* resolves once the server accepts the turn and hands back an async iterable
|
|
45
|
+
* of its events, from its `turn.started` to its `turn.ended`. The client
|
|
46
|
+
* follows the sessions it subscribed to (and its turns subscribe): each
|
|
47
|
+
* session's `seq` is tracked so duplicates are dropped and gaps healed via
|
|
48
|
+
* `events/replay`, and — in `connect` mode — a dropped socket is redialed and
|
|
49
|
+
* its sessions subscribed again.
|
|
50
|
+
*/
|
|
51
|
+
export declare class AgentServerClient {
|
|
52
|
+
private readonly options;
|
|
53
|
+
private readonly connection;
|
|
54
|
+
private readonly turns;
|
|
55
|
+
private readonly progress;
|
|
56
|
+
private readonly authUpdates;
|
|
57
|
+
private readonly streams;
|
|
58
|
+
/** Portable history operations (`history/*`), independent of execution subscriptions. */
|
|
59
|
+
readonly history: AsyncHistoryApi;
|
|
60
|
+
private constructor();
|
|
61
|
+
/**
|
|
62
|
+
* Bring your own transport: the factory is invoked for the initial
|
|
63
|
+
* connection and for every reconnect attempt (reconnect defaults to true).
|
|
64
|
+
*/
|
|
65
|
+
static fromTransportFactory(factory: TransportFactory, options?: AgentServerClientOptions): Promise<AgentServerClient>;
|
|
66
|
+
/** Spawn an agent-server subprocess and talk over its stdio. */
|
|
67
|
+
static spawn(spawnOpts: SpawnServerOptions, options?: AgentServerClientOptions): Promise<AgentServerClient>;
|
|
68
|
+
/**
|
|
69
|
+
* Dial a listening agent-server (reconnects by default). One that refuses
|
|
70
|
+
* the client (401: the token it sent, or that it sent none) fails it with
|
|
71
|
+
* `ConnectionRefusedError`, and is not redialed.
|
|
72
|
+
*/
|
|
73
|
+
static connect(url: string, options?: ConnectOptions): Promise<AgentServerClient>;
|
|
74
|
+
/** Wrap an already-connected socket (e.g. the accepted end of a dial-out). */
|
|
75
|
+
static attach(socket: WebSocketLike | WireTransport, options?: AgentServerClientOptions): Promise<AgentServerClient>;
|
|
76
|
+
/** Handshake (memoized). Called lazily by `runTurn`/`startTurn`. */
|
|
77
|
+
initialize(): Promise<InitializeResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Start a turn and stream it, from its `turn.started` to its `turn.ended`.
|
|
80
|
+
* Ids are minted client-side when omitted. The start subscribes this client
|
|
81
|
+
* to the session from its head until the turn ends, so it downloads none
|
|
82
|
+
* of its history; a start re-sent after a redial converges on the turn the
|
|
83
|
+
* server admitted and catches up on it from its `turn.started`. `signal`
|
|
84
|
+
* stops the handle, as on `joinTurn`: the turn runs on (`cancelTurn` stops
|
|
85
|
+
* it), and `onEvent` hears it to its end.
|
|
86
|
+
*/
|
|
87
|
+
runTurn(params: TurnStartParams, options?: FollowOptions): Promise<TurnHandle>;
|
|
88
|
+
/**
|
|
89
|
+
* Quick-ack only: the turn's events reach `onEvent` through its
|
|
90
|
+
* `turn.ended` (unless `subscribe: false`), and `replay` serves what came
|
|
91
|
+
* before.
|
|
92
|
+
*/
|
|
93
|
+
startTurn(params: TurnStartParams): Promise<TurnStartResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Join the turn running in `sessionId`. Yields, each once and in seq
|
|
96
|
+
* order: the session's kept events from `fromSeq` (default: the turn's
|
|
97
|
+
* `turn.started`), the turn's open parts as of the join, then live frames
|
|
98
|
+
* through the turn's `turn.ended` — so even when this client already
|
|
99
|
+
* follows the session or another handle joined earlier. Resolves once the
|
|
100
|
+
* catch-up is replayed (`catchUp` counts it); `undefined` when no turn is
|
|
101
|
+
* running. `steer` and `result` work as on `runTurn`'s handle. Joining
|
|
102
|
+
* watches the session (`subscribe`).
|
|
103
|
+
*/
|
|
104
|
+
joinTurn(sessionId: string, options?: JoinTurnOptions): Promise<TurnHandle | undefined>;
|
|
105
|
+
/**
|
|
106
|
+
* Add input to a running turn. The agent reads it at its next step, where
|
|
107
|
+
* the turn's stream shows it as a user message (`steerMessageId(steerId)`);
|
|
108
|
+
* a turn that ends first lists it in `turn.ended.undeliveredSteers`.
|
|
109
|
+
* `no_active_turn` means the turn takes no more input — send it as a new
|
|
110
|
+
* turn; `unsupported` means the harness cannot steer. `steerId` is minted
|
|
111
|
+
* when omitted; a re-send with the same one converges, so a steer whose
|
|
112
|
+
* answer was lost to a reconnect is re-sent, never doubled. A session this
|
|
113
|
+
* client does not follow is followed first, until the turn ends, so the
|
|
114
|
+
* steer's user message, its receipt, reaches it.
|
|
115
|
+
*/
|
|
116
|
+
steerTurn(params: TurnSteerParams): Promise<TurnSteerResult>;
|
|
117
|
+
/**
|
|
118
|
+
* Cancel the session's active turn; resolves once cancellation propagated.
|
|
119
|
+
* Pass `turnId` to make the cancel turn-stamped: a late cancel meant for a
|
|
120
|
+
* finished turn then returns `{outcome: "no_active_turn", activeTurnId}`
|
|
121
|
+
* instead of killing the turn that replaced it. `{outcome: "unconfirmed"}`
|
|
122
|
+
* means the harness did not acknowledge the interrupt — the agent may still
|
|
123
|
+
* be running; `turn.ended` remains the source of truth.
|
|
124
|
+
*/
|
|
125
|
+
cancelTurn(sessionId: string, turnId?: string): Promise<TurnCancelResult>;
|
|
126
|
+
/** Answer a `permission.requested` event. */
|
|
127
|
+
respondPermission(sessionId: string, requestId: string, outcome: PermissionOutcome): Promise<boolean>;
|
|
128
|
+
/** Answer an `elicitation.requested` event. */
|
|
129
|
+
respondElicitation(sessionId: string, requestId: string, outcome: ElicitationOutcome): Promise<boolean>;
|
|
130
|
+
/**
|
|
131
|
+
* Watch a session until `unsubscribe` (or its end): its kept events after
|
|
132
|
+
* `afterSeq` reach `onEvent` (and the session's handles), each once and in
|
|
133
|
+
* order, then its open parts, then its frames live; after a redial, what a
|
|
134
|
+
* dropped connection missed. Refused `unknownSession` when the server has
|
|
135
|
+
* no log for it, and `subscriptionLimit` past the sessions a connection may
|
|
136
|
+
* watch.
|
|
137
|
+
*/
|
|
138
|
+
subscribe(sessionId: string, options?: SubscribeOptions): Promise<SessionSubscription>;
|
|
139
|
+
/**
|
|
140
|
+
* Stop watching a session; `false` when this client did not. A turn of
|
|
141
|
+
* this client's that runs there is still followed to its end.
|
|
142
|
+
*/
|
|
143
|
+
unsubscribe(sessionId: string): Promise<boolean>;
|
|
144
|
+
/**
|
|
145
|
+
* Every session's frames, live from now, to `onEvent` (observers): no
|
|
146
|
+
* history, the open parts of running turns, and after a redial, the gaps a
|
|
147
|
+
* dropped connection left healed.
|
|
148
|
+
*/
|
|
149
|
+
subscribeAll(): Promise<void>;
|
|
150
|
+
/** Stop following every session (`subscribeAll`); those subscribed by name stay. */
|
|
151
|
+
unsubscribeAll(): Promise<boolean>;
|
|
152
|
+
/** Release an idle session's replay history and harness-native resources. */
|
|
153
|
+
closeSession(sessionId: string): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Durable servers: let an idle session's agent go (its process, a Codex
|
|
156
|
+
* home it holds) while the session stays open, as after a restart. Its
|
|
157
|
+
* next turn names its native conversation (`config.resumeSessionId`; a turn
|
|
158
|
+
* that does not is refused `resumeRequired`, whose data names it), also a
|
|
159
|
+
* turn another client of the session sends: nothing tells it of the
|
|
160
|
+
* release. `false` when the server holds no open session by that id.
|
|
161
|
+
*/
|
|
162
|
+
releaseSession(sessionId: string): Promise<boolean>;
|
|
163
|
+
/**
|
|
164
|
+
* The models a harness offers for the login and folder a turn with the same
|
|
165
|
+
* `cwd`, `env` and `apiKey` would use. `source: "catalog"` (with `error`)
|
|
166
|
+
* means the CLI did not answer and the list is agent-server's built-in one.
|
|
167
|
+
*/
|
|
168
|
+
listModels(params: ModelsListParams): Promise<ModelList>;
|
|
169
|
+
/**
|
|
170
|
+
* Where each harness's CLI is on the server (every harness when absent):
|
|
171
|
+
* `ready`, `missing` (what its first turn installs), `installing`,
|
|
172
|
+
* `failed` (with `error`) or `unmanaged`. Installs nothing.
|
|
173
|
+
*/
|
|
174
|
+
listClis(harnesses?: AgentHarness[]): Promise<HarnessCli[]>;
|
|
175
|
+
/**
|
|
176
|
+
* Install each harness's CLI on the server now, so a first turn does not
|
|
177
|
+
* wait for it, and answer once each is ready or failed. The server answers
|
|
178
|
+
* `clis/prepare` at once, since an install outlasts a request's timeout;
|
|
179
|
+
* this waits for `clis/progress` to say an install ended, asking
|
|
180
|
+
* `clis/list` then and every few seconds, across a redial to the same
|
|
181
|
+
* server. Safe to call again: a running install is joined. `signal` stops
|
|
182
|
+
* the waiting, not the install.
|
|
183
|
+
*/
|
|
184
|
+
prepareClis(harnesses?: AgentHarness[], options?: {
|
|
185
|
+
signal?: AbortSignal;
|
|
186
|
+
}): Promise<HarnessCli[]>;
|
|
187
|
+
/** Fetch kept events (`seq >= fromSeq`) without touching what the client follows.
|
|
188
|
+
* A durable server answers a page at a time: `hasMore` asks for the next. */
|
|
189
|
+
replay(sessionId: string, fromSeq: number): Promise<DecodedEventsReplayResult>;
|
|
190
|
+
/**
|
|
191
|
+
* The session's kept events from `fromSeq` through `throughSeq` (default:
|
|
192
|
+
* the last), oldest first: every page `replay` answers. Fails
|
|
193
|
+
* `EventGapError` when some of them were evicted.
|
|
194
|
+
*/
|
|
195
|
+
replayAll(sessionId: string, fromSeq: number, throughSeq?: number): Promise<DecodedWireEventEnvelope[]>;
|
|
196
|
+
/** Durable servers: a turn's receipt, even for a turn a restart cut off. */
|
|
197
|
+
getTurn(sessionId: string, turnId: string): Promise<TurnReceipt>;
|
|
198
|
+
/** Durable servers: the session's head, native id, and whether a restart cut off its last turn. */
|
|
199
|
+
getSession(sessionId: string): Promise<DurableSession>;
|
|
200
|
+
/** Durable servers: lift the fence a restart put on a session. Check first
|
|
201
|
+
* that its native execution stopped: history alone cannot prove that a
|
|
202
|
+
* detached agent or tool process is dead. */
|
|
203
|
+
confirmSessionStopped(params: SessionConfirmStoppedParams): Promise<boolean>;
|
|
204
|
+
/**
|
|
205
|
+
* Each harness's login on the server (every harness when `harnesses` is
|
|
206
|
+
* absent), for the store and environment a turn with `env` would use:
|
|
207
|
+
* signed in, with what and as whom, signed out, or unknown and why; and
|
|
208
|
+
* the logins it offers.
|
|
209
|
+
*/
|
|
210
|
+
authStatus(options?: {
|
|
211
|
+
harnesses?: AgentHarness[];
|
|
212
|
+
env?: Record<string, string>;
|
|
213
|
+
}): Promise<HarnessAuth[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Start one of a harness's logins through its CLI's own flow: answered
|
|
216
|
+
* once the CLI says where the user signs in (`url`, `userCode`, or from
|
|
217
|
+
* another device `codeUrl`, then `complete` with the code it shows).
|
|
218
|
+
* `done` resolves with the harness's login once it succeeded.
|
|
219
|
+
*/
|
|
220
|
+
login(harness: AgentHarness, method: string, options?: {
|
|
221
|
+
apiKey?: string;
|
|
222
|
+
env?: Record<string, string>;
|
|
223
|
+
}): Promise<LoginHandle>;
|
|
224
|
+
/** Remove a harness's CLI login on the server; answers its login after. */
|
|
225
|
+
logout(harness: AgentHarness, options?: {
|
|
226
|
+
env?: Record<string, string>;
|
|
227
|
+
}): Promise<HarnessAuth>;
|
|
228
|
+
/** The frames of the sessions this client follows, each once and in order (post-dedupe). */
|
|
229
|
+
onEvent(handler: (envelope: DecodedWireEventEnvelope) => void): () => void;
|
|
230
|
+
/** A harness's CLI being installed on the server, whatever caused it (`clis/progress`). */
|
|
231
|
+
onCliProgress(handler: (progress: HarnessCliProgress) => void): () => void;
|
|
232
|
+
/** A harness's login changed on the server, or a login ended, whoever caused it (`auth/updated`). */
|
|
233
|
+
onAuthUpdated(handler: (update: AuthUpdated) => void): () => void;
|
|
234
|
+
/** Observe unrecoverable delivery gaps even when using startTurn without a handle. */
|
|
235
|
+
onEventGap(handler: (gap: SessionEventGap) => void): () => void;
|
|
236
|
+
/**
|
|
237
|
+
* Observe the connection: a drop, each redial attempt, the reconnect (and
|
|
238
|
+
* whether the server is still the one whose logs this client followed),
|
|
239
|
+
* and the end. Handlers run synchronously, before requests waiting on the
|
|
240
|
+
* redial are sent again; one that throws is ignored.
|
|
241
|
+
*/
|
|
242
|
+
onConnection(handler: (event: ConnectionEvent) => void): () => void;
|
|
243
|
+
/** Ask the server to shut down, then close this client. */
|
|
244
|
+
shutdownServer(): Promise<void>;
|
|
245
|
+
close(): Promise<void>;
|
|
246
|
+
private handleLine;
|
|
247
|
+
/**
|
|
248
|
+
* A start or join's answer, the moment it arrives: the handle's point
|
|
249
|
+
* among the frames. What follows the point waits for the catch-up before it.
|
|
250
|
+
*/
|
|
251
|
+
private joinAt;
|
|
252
|
+
/** The kept events from `fromSeq` through `headSeq`, replayed into the handle before what followed its point. */
|
|
253
|
+
private catchUp;
|
|
254
|
+
private handleOf;
|
|
255
|
+
/**
|
|
256
|
+
* Subscribe to the session again (a redial, an overflow), for the turn of
|
|
257
|
+
* this client's it runs or, without one, watching it; what it missed heals
|
|
258
|
+
* by replay. A turn the answer says runs no more ended by its `headSeq`:
|
|
259
|
+
* the session is followed through there, then let go. A refusal is the
|
|
260
|
+
* server's answer: the session is followed no more.
|
|
261
|
+
*/
|
|
262
|
+
private resubscribe;
|
|
263
|
+
/** Every session again; refused, the client follows every session no more. */
|
|
264
|
+
private resubscribeAll;
|
|
265
|
+
/** After a redial: every session followed, from what the client holds, pipelined. */
|
|
266
|
+
private subscribeAgain;
|
|
267
|
+
/** `session/subscribeAll`, sent now. */
|
|
268
|
+
private requestAll;
|
|
269
|
+
/** `session/subscribe` for one session, `onAnswer` given its point the moment it arrives. */
|
|
270
|
+
private subscribeTo;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=client.d.ts.map
|