@zvada/agent-server 0.3.21 → 0.3.23
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/CHANGELOG.md +332 -0
- package/README.md +2 -1
- package/dist/types/accounts/chatgpt.d.ts +1 -1
- package/dist/types/accounts/chatgpt.d.ts.map +1 -1
- package/dist/types/accounts/http.d.ts +2 -4
- package/dist/types/accounts/http.d.ts.map +1 -1
- package/dist/types/client/client.d.ts +37 -11
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/client/connection.d.ts +66 -13
- package/dist/types/client/connection.d.ts.map +1 -1
- package/dist/types/client/index.d.ts +1 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/client/logins.d.ts +4 -3
- package/dist/types/client/logins.d.ts.map +1 -1
- package/dist/types/client/streams.d.ts +9 -3
- package/dist/types/client/streams.d.ts.map +1 -1
- package/dist/types/client/turns.d.ts +1 -1
- package/dist/types/client/turns.d.ts.map +1 -1
- package/dist/types/core/agents/acp/acp-agent.d.ts +34 -1
- package/dist/types/core/agents/acp/acp-agent.d.ts.map +1 -1
- package/dist/types/core/agents/acp/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/acp/client.d.ts +12 -3
- package/dist/types/core/agents/acp/client.d.ts.map +1 -1
- package/dist/types/core/agents/acp/mappings.d.ts +8 -2
- package/dist/types/core/agents/acp/mappings.d.ts.map +1 -1
- package/dist/types/core/agents/base.d.ts +22 -8
- package/dist/types/core/agents/base.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/adapter.d.ts +7 -0
- package/dist/types/core/agents/claude-code/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/approvals.d.ts +4 -1
- package/dist/types/core/agents/claude-code/approvals.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/claude-agent.d.ts +16 -5
- package/dist/types/core/agents/claude-code/claude-agent.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/events.d.ts +9 -1
- package/dist/types/core/agents/claude-code/events.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/login.d.ts +4 -1
- package/dist/types/core/agents/claude-code/login.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/mcp.d.ts +21 -7
- package/dist/types/core/agents/claude-code/mcp.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/models.d.ts +5 -1
- package/dist/types/core/agents/claude-code/models.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/options.d.ts +10 -4
- package/dist/types/core/agents/claude-code/options.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/outcome.d.ts +3 -5
- package/dist/types/core/agents/claude-code/outcome.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/results.d.ts +16 -0
- package/dist/types/core/agents/claude-code/results.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/sdk-pair.d.ts +13 -0
- package/dist/types/core/agents/claude-code/sdk-pair.d.ts.map +1 -0
- package/dist/types/core/agents/claude-code/session.d.ts +50 -12
- package/dist/types/core/agents/claude-code/session.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/spend.d.ts +2 -1
- package/dist/types/core/agents/claude-code/spend.d.ts.map +1 -1
- package/dist/types/core/agents/claude-code/tools.d.ts +26 -3
- package/dist/types/core/agents/claude-code/tools.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/adapter.d.ts +2 -2
- package/dist/types/core/agents/codex-app-server/adapter.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/client.d.ts +21 -2
- package/dist/types/core/agents/codex-app-server/client.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts +61 -14
- package/dist/types/core/agents/codex-app-server/codex-agent.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/commands.d.ts +2 -2
- package/dist/types/core/agents/codex-app-server/commands.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/credentials.d.ts +5 -1
- package/dist/types/core/agents/codex-app-server/credentials.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/effort.d.ts +2 -1
- package/dist/types/core/agents/codex-app-server/effort.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/homes.d.ts +26 -5
- package/dist/types/core/agents/codex-app-server/homes.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/items.d.ts +27 -2
- package/dist/types/core/agents/codex-app-server/items.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/login.d.ts +4 -1
- package/dist/types/core/agents/codex-app-server/login.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/mcp.d.ts +45 -20
- package/dist/types/core/agents/codex-app-server/mcp.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/models.d.ts +3 -10
- package/dist/types/core/agents/codex-app-server/models.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/options.d.ts +32 -5
- package/dist/types/core/agents/codex-app-server/options.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts +2 -1
- package/dist/types/core/agents/codex-app-server/plan-approval.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/protocol.d.ts +16 -3
- package/dist/types/core/agents/codex-app-server/protocol.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/requests.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/session.d.ts +70 -33
- package/dist/types/core/agents/codex-app-server/session.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/subagents.d.ts +9 -4
- package/dist/types/core/agents/codex-app-server/subagents.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts +3 -2
- package/dist/types/core/agents/codex-app-server/thread-settings.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts +2 -1
- package/dist/types/core/agents/codex-app-server/turn-items.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/turn.d.ts +37 -8
- package/dist/types/core/agents/codex-app-server/turn.d.ts.map +1 -1
- package/dist/types/core/agents/codex-app-server/user-login.d.ts +28 -0
- package/dist/types/core/agents/codex-app-server/user-login.d.ts.map +1 -0
- package/dist/types/core/agents/credentials.d.ts +3 -1
- package/dist/types/core/agents/credentials.d.ts.map +1 -1
- package/dist/types/core/agents/diffs.d.ts +9 -0
- package/dist/types/core/agents/diffs.d.ts.map +1 -0
- package/dist/types/core/agents/elicitation.d.ts +3 -2
- package/dist/types/core/agents/elicitation.d.ts.map +1 -1
- package/dist/types/core/agents/login.d.ts +6 -0
- package/dist/types/core/agents/login.d.ts.map +1 -1
- package/dist/types/core/agents/mcp-config.d.ts +0 -4
- package/dist/types/core/agents/mcp-config.d.ts.map +1 -1
- package/dist/types/core/agents/plan.d.ts +2 -13
- package/dist/types/core/agents/plan.d.ts.map +1 -1
- package/dist/types/core/agents/process-pool.d.ts +193 -0
- package/dist/types/core/agents/process-pool.d.ts.map +1 -0
- package/dist/types/core/agents/scripted/adapter.d.ts +68 -0
- package/dist/types/core/agents/scripted/adapter.d.ts.map +1 -0
- package/dist/types/core/agents/scripted/mcp-call.d.ts +56 -0
- package/dist/types/core/agents/scripted/mcp-call.d.ts.map +1 -0
- package/dist/types/core/agents/scripted/scripted-agent.d.ts +73 -0
- package/dist/types/core/agents/scripted/scripted-agent.d.ts.map +1 -0
- package/dist/types/core/agents/scripted/scripts.d.ts +29 -0
- package/dist/types/core/agents/scripted/scripts.d.ts.map +1 -0
- package/dist/types/core/agents/scripted/steps.d.ts +132 -0
- package/dist/types/core/agents/scripted/steps.d.ts.map +1 -0
- package/dist/types/core/agents/session-agent.d.ts +49 -6
- package/dist/types/core/agents/session-agent.d.ts.map +1 -1
- package/dist/types/core/diagnostics.d.ts +4 -1
- package/dist/types/core/diagnostics.d.ts.map +1 -1
- package/dist/types/core/index.d.ts +6 -1
- package/dist/types/core/index.d.ts.map +1 -1
- package/dist/types/core/presets.d.ts +32 -6
- package/dist/types/core/presets.d.ts.map +1 -1
- package/dist/types/core/processes/lifeline.d.ts +0 -20
- package/dist/types/core/processes/lifeline.d.ts.map +1 -1
- package/dist/types/core/provision/index.d.ts +2 -2
- package/dist/types/core/provision/index.d.ts.map +1 -1
- package/dist/types/core/provision/install-build.d.ts +2 -1
- package/dist/types/core/provision/install-build.d.ts.map +1 -1
- package/dist/types/core/provision/npm.d.ts +20 -8
- package/dist/types/core/provision/npm.d.ts.map +1 -1
- package/dist/types/core/provision/provisioner.d.ts +4 -1
- package/dist/types/core/provision/provisioner.d.ts.map +1 -1
- package/dist/types/core/provision/tools.d.ts +2 -1
- package/dist/types/core/provision/tools.d.ts.map +1 -1
- package/dist/types/core/runtime/agent-runtime.d.ts +18 -9
- package/dist/types/core/runtime/agent-runtime.d.ts.map +1 -1
- package/dist/types/core/runtime/event-processor.d.ts +5 -1
- package/dist/types/core/runtime/event-processor.d.ts.map +1 -1
- package/dist/types/core/runtime/harness-clis.d.ts +9 -0
- package/dist/types/core/runtime/harness-clis.d.ts.map +1 -1
- package/dist/types/core/runtime/harness-logins.d.ts +33 -5
- package/dist/types/core/runtime/harness-logins.d.ts.map +1 -1
- package/dist/types/core/runtime/model-lists.d.ts +2 -0
- package/dist/types/core/runtime/model-lists.d.ts.map +1 -1
- package/dist/types/core/runtime/permission-policy.d.ts +5 -3
- package/dist/types/core/runtime/permission-policy.d.ts.map +1 -1
- package/dist/types/core/runtime/request-broker.d.ts +2 -1
- package/dist/types/core/runtime/request-broker.d.ts.map +1 -1
- package/dist/types/core/runtime/turn.d.ts +14 -1
- package/dist/types/core/runtime/turn.d.ts.map +1 -1
- package/dist/types/core/utils/deadline.d.ts +6 -0
- package/dist/types/core/utils/deadline.d.ts.map +1 -1
- package/dist/types/core/utils/errors.d.ts +15 -1
- package/dist/types/core/utils/errors.d.ts.map +1 -1
- package/dist/types/operator/index.d.ts +11 -0
- package/dist/types/operator/index.d.ts.map +1 -0
- package/dist/types/operator/mcp.d.ts +33 -0
- package/dist/types/operator/mcp.d.ts.map +1 -0
- package/dist/types/operator/operator.d.ts +206 -0
- package/dist/types/operator/operator.d.ts.map +1 -0
- package/dist/types/operator/render.d.ts +89 -0
- package/dist/types/operator/render.d.ts.map +1 -0
- package/dist/types/operator/view.d.ts +44 -0
- package/dist/types/operator/view.d.ts.map +1 -0
- package/dist/types/protocol/auth.d.ts +54 -24
- package/dist/types/protocol/auth.d.ts.map +1 -1
- package/dist/types/protocol/clis.d.ts +14 -7
- package/dist/types/protocol/clis.d.ts.map +1 -1
- package/dist/types/protocol/config.d.ts +2 -0
- package/dist/types/protocol/config.d.ts.map +1 -1
- package/dist/types/protocol/conversation.d.ts +40 -3
- package/dist/types/protocol/conversation.d.ts.map +1 -1
- package/dist/types/protocol/credentials.d.ts +7 -0
- package/dist/types/protocol/credentials.d.ts.map +1 -1
- package/dist/types/protocol/execution.d.ts +2 -1
- package/dist/types/protocol/execution.d.ts.map +1 -1
- package/dist/types/protocol/factories.d.ts +12 -2
- package/dist/types/protocol/factories.d.ts.map +1 -1
- package/dist/types/protocol/harness.d.ts +6 -2
- package/dist/types/protocol/harness.d.ts.map +1 -1
- package/dist/types/protocol/history.d.ts +19 -0
- package/dist/types/protocol/history.d.ts.map +1 -1
- package/dist/types/protocol/lifecycle.d.ts +47 -8
- package/dist/types/protocol/lifecycle.d.ts.map +1 -1
- package/dist/types/protocol/model-catalog.d.ts.map +1 -1
- package/dist/types/protocol/models.d.ts +3 -0
- package/dist/types/protocol/models.d.ts.map +1 -1
- package/dist/types/protocol/parts.d.ts +14 -0
- package/dist/types/protocol/parts.d.ts.map +1 -1
- package/dist/types/protocol/plan.d.ts +20 -0
- package/dist/types/protocol/plan.d.ts.map +1 -0
- package/dist/types/protocol/tool-state.d.ts +12 -0
- package/dist/types/protocol/tool-state.d.ts.map +1 -1
- package/dist/types/protocol/wire-api.d.ts +129 -23
- package/dist/types/protocol/wire-api.d.ts.map +1 -1
- package/dist/types/protocol/wire.d.ts +70 -10
- package/dist/types/protocol/wire.d.ts.map +1 -1
- package/dist/types/server/acp/binding.d.ts +6 -1
- package/dist/types/server/acp/binding.d.ts.map +1 -1
- package/dist/types/server/acp/translate.d.ts +33 -7
- package/dist/types/server/acp/translate.d.ts.map +1 -1
- package/dist/types/server/agent-server.d.ts +6 -0
- package/dist/types/server/agent-server.d.ts.map +1 -1
- package/dist/types/server/feedback.d.ts +2 -1
- package/dist/types/server/feedback.d.ts.map +1 -1
- package/dist/types/server/install.d.ts +11 -0
- package/dist/types/server/install.d.ts.map +1 -1
- package/dist/types/server/session-gate.d.ts +2 -1
- package/dist/types/server/session-gate.d.ts.map +1 -1
- package/dist/types/server/session-store.d.ts +1 -0
- package/dist/types/server/session-store.d.ts.map +1 -1
- package/dist/types/server/subscriptions.d.ts +2 -1
- package/dist/types/server/subscriptions.d.ts.map +1 -1
- package/dist/types/server/transports.d.ts.map +1 -1
- package/dist/types/sync/fit.d.ts +8 -7
- package/dist/types/sync/fit.d.ts.map +1 -1
- package/dist/types/sync/history-sqlite.d.ts.map +1 -1
- package/dist/types/sync/index.d.ts +1 -0
- package/dist/types/sync/index.d.ts.map +1 -1
- package/dist/types/sync/journal-sqlite.d.ts +2 -1
- package/dist/types/sync/journal-sqlite.d.ts.map +1 -1
- package/dist/types/sync/journal.d.ts +11 -3
- package/dist/types/sync/journal.d.ts.map +1 -1
- package/dist/types/sync/projection.d.ts +6 -0
- package/dist/types/sync/projection.d.ts.map +1 -1
- package/dist/types/sync/recovery.d.ts +2 -1
- package/dist/types/sync/recovery.d.ts.map +1 -1
- package/dist/types/sync/schema.d.ts +10 -0
- package/dist/types/sync/schema.d.ts.map +1 -1
- package/dist/types/sync/sql.d.ts +2 -1
- package/dist/types/sync/sql.d.ts.map +1 -1
- package/dist/types/sync/worker.d.ts.map +1 -1
- package/docs/consuming.md +464 -40
- package/docs/deploy.md +36 -8
- package/docs/durable-sessions.md +35 -5
- package/docs/harnesses.md +396 -30
- package/package.json +11 -1
- package/src/accounts/chatgpt.ts +2 -2
- package/src/accounts/http.ts +2 -16
- package/src/client/client.ts +92 -31
- package/src/client/connection.ts +113 -22
- package/src/client/index.ts +1 -0
- package/src/client/logins.ts +24 -15
- package/src/client/streams.ts +12 -4
- package/src/client/turns.ts +1 -1
- package/src/core/agents/acp/acp-agent.ts +181 -52
- package/src/core/agents/acp/adapter.ts +9 -1
- package/src/core/agents/acp/client.ts +16 -4
- package/src/core/agents/acp/mappings.ts +27 -0
- package/src/core/agents/base.ts +25 -10
- package/src/core/agents/claude-code/adapter.ts +47 -17
- package/src/core/agents/claude-code/approvals.ts +6 -5
- package/src/core/agents/claude-code/claude-agent.ts +60 -30
- package/src/core/agents/claude-code/events.ts +11 -1
- package/src/core/agents/claude-code/login.ts +14 -2
- package/src/core/agents/claude-code/mcp.ts +31 -15
- package/src/core/agents/claude-code/models.ts +7 -2
- package/src/core/agents/claude-code/options.ts +11 -3
- package/src/core/agents/claude-code/outcome.ts +10 -2
- package/src/core/agents/claude-code/results.ts +73 -0
- package/src/core/agents/claude-code/sdk-pair.ts +66 -0
- package/src/core/agents/claude-code/session.ts +166 -37
- package/src/core/agents/claude-code/spend.ts +1 -1
- package/src/core/agents/claude-code/tools.ts +108 -12
- package/src/core/agents/codex-app-server/adapter.ts +37 -12
- package/src/core/agents/codex-app-server/client.ts +69 -10
- package/src/core/agents/codex-app-server/codex-agent.ts +141 -55
- package/src/core/agents/codex-app-server/commands.ts +2 -2
- package/src/core/agents/codex-app-server/credentials.ts +10 -5
- package/src/core/agents/codex-app-server/effort.ts +1 -1
- package/src/core/agents/codex-app-server/homes.ts +59 -10
- package/src/core/agents/codex-app-server/items.ts +219 -31
- package/src/core/agents/codex-app-server/login.ts +14 -2
- package/src/core/agents/codex-app-server/mcp.ts +142 -26
- package/src/core/agents/codex-app-server/models.ts +9 -8
- package/src/core/agents/codex-app-server/options.ts +79 -11
- package/src/core/agents/codex-app-server/plan-approval.ts +1 -1
- package/src/core/agents/codex-app-server/protocol.ts +14 -4
- package/src/core/agents/codex-app-server/requests.ts +14 -6
- package/src/core/agents/codex-app-server/session.ts +156 -81
- package/src/core/agents/codex-app-server/subagents.ts +21 -14
- package/src/core/agents/codex-app-server/thread-settings.ts +18 -8
- package/src/core/agents/codex-app-server/turn-items.ts +1 -1
- package/src/core/agents/codex-app-server/turn.ts +96 -35
- package/src/core/agents/codex-app-server/user-login.ts +107 -0
- package/src/core/agents/credentials.ts +5 -2
- package/src/core/agents/diffs.ts +25 -0
- package/src/core/agents/elicitation.ts +2 -2
- package/src/core/agents/login.ts +6 -0
- package/src/core/agents/mcp-config.ts +2 -2
- package/src/core/agents/plan.ts +3 -19
- package/src/core/agents/process-pool.ts +432 -0
- package/src/core/agents/scripted/adapter.ts +142 -0
- package/src/core/agents/scripted/mcp-call.ts +134 -0
- package/src/core/agents/scripted/scripted-agent.ts +418 -0
- package/src/core/agents/scripted/scripts.ts +171 -0
- package/src/core/agents/scripted/steps.ts +127 -0
- package/src/core/agents/session-agent.ts +105 -8
- package/src/core/diagnostics.ts +9 -1
- package/src/core/index.ts +12 -0
- package/src/core/presets.ts +99 -14
- package/src/core/processes/lifeline.ts +99 -25
- package/src/core/provision/index.ts +1 -2
- package/src/core/provision/install-build.ts +4 -1
- package/src/core/provision/npm.ts +309 -97
- package/src/core/provision/provisioner.ts +22 -8
- package/src/core/provision/tools.ts +44 -19
- package/src/core/runtime/agent-runtime.ts +70 -34
- package/src/core/runtime/event-processor.ts +18 -2
- package/src/core/runtime/harness-clis.ts +36 -1
- package/src/core/runtime/harness-logins.ts +82 -31
- package/src/core/runtime/model-lists.ts +1 -1
- package/src/core/runtime/permission-policy.ts +4 -3
- package/src/core/runtime/request-broker.ts +1 -1
- package/src/core/runtime/turn.ts +53 -3
- package/src/core/utils/deadline.ts +23 -0
- package/src/core/utils/errors.ts +24 -4
- package/src/operator/index.ts +40 -0
- package/src/operator/mcp.ts +171 -0
- package/src/operator/operator.ts +782 -0
- package/src/operator/render.ts +473 -0
- package/src/operator/view.ts +82 -0
- package/src/protocol/auth.ts +30 -23
- package/src/protocol/clis.ts +12 -4
- package/src/protocol/credentials.ts +19 -0
- package/src/protocol/execution.ts +5 -0
- package/src/protocol/factories.ts +25 -3
- package/src/protocol/harness.ts +11 -1
- package/src/protocol/history.ts +20 -0
- package/src/protocol/lifecycle.ts +10 -1
- package/src/protocol/model-catalog.ts +19 -8
- package/src/protocol/parts.ts +12 -1
- package/src/protocol/plan.ts +35 -0
- package/src/protocol/tool-state.ts +14 -1
- package/src/protocol/wire.ts +14 -0
- package/src/server/acp/binding.ts +113 -22
- package/src/server/acp/translate.ts +161 -8
- package/src/server/agent-server.ts +10 -1
- package/src/server/bin.ts +83 -9
- package/src/server/feedback.ts +1 -1
- package/src/server/install.ts +82 -4
- package/src/server/session-gate.ts +1 -1
- package/src/server/session-store.ts +5 -1
- package/src/server/subscriptions.ts +1 -1
- package/src/server/transports.ts +14 -0
- package/src/sync/fit.ts +115 -28
- package/src/sync/history-sqlite.ts +6 -2
- package/src/sync/index.ts +1 -0
- package/src/sync/journal-sqlite.ts +20 -2
- package/src/sync/journal.ts +10 -2
- package/src/sync/projection.ts +10 -0
- package/src/sync/recovery.ts +11 -4
- package/src/sync/schema.ts +7 -5
- package/src/sync/sql.ts +1 -1
- package/src/sync/worker.ts +4 -0
- package/dist/types/core/agents/claude-code/session-pool.d.ts +0 -36
- package/dist/types/core/agents/claude-code/session-pool.d.ts.map +0 -1
- package/dist/types/core/agents/session-pool.d.ts +0 -41
- package/dist/types/core/agents/session-pool.d.ts.map +0 -1
- package/src/core/agents/claude-code/session-pool.ts +0 -136
- package/src/core/agents/session-pool.ts +0 -111
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAEvB,MAAM,yBAAyB,CAAC;AAKjC;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,MAAM,CAAC,EAAE,WAAW,KAChB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;AAE5C;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,kBAAkB,EACrE,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,iBAAiB,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,EAC3C,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAM5C;AAiCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,gBAAgB,CAkBnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolResultContent } from "../../protocol/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* One hunk of a unified diff as a `diff` entry: `oldText` is its context and
|
|
4
|
+
* removed lines, `newText` its context and added lines, each joined by a
|
|
5
|
+
* newline. A `` marker is no line of either file,
|
|
6
|
+
* so it is dropped. Undefined for a hunk with no lines.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hunkDiff(path: string, lines: readonly string[]): ToolResultContent | undefined;
|
|
9
|
+
//# sourceMappingURL=diffs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diffs.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/diffs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,iBAAiB,GAAG,SAAS,CAe9F"}
|
|
@@ -10,7 +10,7 @@ export declare function questionRequest(questions: ElicitationQuestion[], toolCa
|
|
|
10
10
|
/** What the agent is told when the user leaves its question unanswered. */
|
|
11
11
|
export declare function unanswered(action: "decline" | "cancel"): string;
|
|
12
12
|
/** An MCP server's request for input: a form to fill in, or a URL to visit. */
|
|
13
|
-
|
|
13
|
+
interface McpInputRequest {
|
|
14
14
|
mode: "form" | "url";
|
|
15
15
|
message: string;
|
|
16
16
|
/** The server asking, when the harness names it. */
|
|
@@ -27,11 +27,12 @@ export declare function inputRequest(request: McpInputRequest): ElicitationReque
|
|
|
27
27
|
* The user's answer as an MCP server takes it (MCP's `ElicitResult`). A type,
|
|
28
28
|
* not an interface: the SDKs' reply types are indexable.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
type McpInputReply = {
|
|
31
31
|
action: "accept" | "decline" | "cancel";
|
|
32
32
|
/** What the user filled in; only an accept carries it. */
|
|
33
33
|
content?: Record<string, string | number | boolean | string[]>;
|
|
34
34
|
};
|
|
35
35
|
/** The broker's outcome, as the MCP server that asked takes it. */
|
|
36
36
|
export declare function inputReply(outcome: ElicitationOutcome): McpInputReply;
|
|
37
|
+
export {};
|
|
37
38
|
//# sourceMappingURL=elicitation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/elicitation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,UAAU,2HACkG,CAAC;AAE1H,iHAAiH;AACjH,wBAAgB,eAAe,CAC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AC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,CAAC;CAC/D,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,aAAa,CAOrE"}
|
|
@@ -40,6 +40,12 @@ export interface CliLogin {
|
|
|
40
40
|
apiKey?: string;
|
|
41
41
|
}): Promise<NativeLogin>;
|
|
42
42
|
logout(options: LoginOptions): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* The store a turn or a login with this `env` reads its login from: the
|
|
45
|
+
* value of the CLI's store variable, empty when unset. A login changed
|
|
46
|
+
* there restarts that store's sessions alone. Absent: one store.
|
|
47
|
+
*/
|
|
48
|
+
store?(env: Record<string, string> | undefined): string;
|
|
43
49
|
}
|
|
44
50
|
/** The method a login names, refused unless the harness offers it as a login. */
|
|
45
51
|
export declare function loginMethod<M extends AuthMethod>(methods: readonly M[], id: string): M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/login.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAIxE,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,mEAAmE;IACnE,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,4FAA4F;AAC5F,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;AAEnE,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uGAAuG;IACvG,OAAO,CAAC,EAAE,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,CASZ;AAKD;;;GAGG;AACH,wBAAsB,cAAc,CACnC,SAAS,EAAE,eAAe,EAC1B,IAAI,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GACC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBlE"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ErrorInfo, McpServerConfig } from "../../protocol/index.ts";
|
|
2
2
|
/** A turn owns its wire configuration even when the caller reuses its objects. */
|
|
3
3
|
export declare function snapshotMcpServers(servers: Record<string, McpServerConfig> | undefined): Record<string, McpServerConfig>;
|
|
4
|
-
/** Whether a turn needs the server: each does unless it says `required: false`. */
|
|
5
|
-
export declare function mcpServerRequired(server: McpServerConfig | undefined): boolean;
|
|
6
4
|
/** The server as its harness takes it: whether a turn needs it is the engine's rule. */
|
|
7
5
|
export declare function nativeMcpServer(server: McpServerConfig): McpServerConfig;
|
|
8
6
|
export declare function mcpConnectionErrors(names: string[], statuses: Array<{
|
|
@@ -22,8 +20,6 @@ export declare function settleMcpFailures(errors: Record<string, string>, server
|
|
|
22
20
|
* query, and the stream is journaled, replayed and synced.
|
|
23
21
|
*/
|
|
24
22
|
export declare function mcpCause(cause: string): string;
|
|
25
|
-
/** What a turn says of a server it goes on without. */
|
|
26
|
-
export declare function mcpUnavailableWarning(name: string, cause: string): ErrorInfo;
|
|
27
23
|
/**
|
|
28
24
|
* How long a turn goes on without a server that could not connect before a
|
|
29
25
|
* turn tries it again: a server that never answers would otherwise hold up
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-config.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/mcp-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1E,kFAAkF;AAClF,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,GAClD,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAEjC;
|
|
1
|
+
{"version":3,"file":"mcp-config.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/mcp-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1E,kFAAkF;AAClF,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,GAClD,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAEjC;AAQD,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,CAGxE;AAED,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACtE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC,CAAC,GAC5D,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKxB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa9C;AAWD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAS,CAAC;AAGnC;;;;GAIG;AACH,qBAAa,qBAAqB;IACjC,OAAO,CAAC,OAAO,CAAyD;IAExE,yCAAyC;IACzC,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEnC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE;IAOlF;;;OAGG;IACH,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAW7F,kFAAkF;IAC5E,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAI7F"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import type { PermissionMode
|
|
2
|
-
|
|
3
|
-
* How a user answers an agent's plan: go on in a mode, or keep planning. Each
|
|
4
|
-
* option's id is the permission mode the session goes on in. These are Claude
|
|
5
|
-
* Code's own choices; Codex's TUI asks the same ("implement this plan" / "stay
|
|
6
|
-
* in Plan mode"). Auto-accepting edits is a standing choice for the edits to
|
|
7
|
-
* come (`allow_always`, as claude-agent-acp marks it), so an approver that
|
|
8
|
-
* takes the one-time approval implements asking for each edit. No standing
|
|
9
|
-
* rule answers a later plan: the broker keeps none for a harness's options.
|
|
10
|
-
*/
|
|
11
|
-
export declare const PLAN_OPTIONS: PermissionOption[];
|
|
12
|
-
/** What a plan's approval asks. */
|
|
13
|
-
export declare const PLAN_TITLE = "Implement this plan?";
|
|
1
|
+
import type { PermissionMode } from "../../protocol/index.ts";
|
|
2
|
+
export { PLAN_OPTIONS, PLAN_TITLE } from "../../protocol/plan.ts";
|
|
14
3
|
/** The mode an approved plan is implemented in. */
|
|
15
4
|
export declare function approvedPlanMode(optionId: string | undefined): PermissionMode;
|
|
16
5
|
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAElE,mDAAmD;AACnD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAE7E"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idle time before an unused session's process is ended, unless
|
|
3
|
+
* `idleTimeoutMs` says otherwise.
|
|
4
|
+
*/
|
|
5
|
+
export declare const IDLE_TIMEOUT_MS: number;
|
|
6
|
+
/**
|
|
7
|
+
* The native process a pooled session runs on, as the pool sees it.
|
|
8
|
+
*
|
|
9
|
+
* A client sets what `gone()` returns before its `onClose` handlers run: the
|
|
10
|
+
* pool reads `gone()` in its handler, and a successor and a release wait for
|
|
11
|
+
* what it read. A client that set it after would be succeeded while it still
|
|
12
|
+
* runs.
|
|
13
|
+
*/
|
|
14
|
+
export interface PooledClient {
|
|
15
|
+
/** The process exited, or the client was closed. */
|
|
16
|
+
readonly closed: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* End the process now; its exit follows (`gone`). The pool says why
|
|
19
|
+
* (`reason`), for a harness that reports it; a client may ignore it.
|
|
20
|
+
*/
|
|
21
|
+
close(reason?: ProcessEndReason): void;
|
|
22
|
+
/** Called once, when the process ends: closed by anyone, or exited by itself. */
|
|
23
|
+
onClose(handler: (error?: Error) => void): () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Settles once a client that was closed has exited, or could not be made
|
|
26
|
+
* to, bounded by the client's own stop. Absent: nothing to wait for.
|
|
27
|
+
*/
|
|
28
|
+
gone?(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
/** What the pool needs of a harness's process: the client it runs on. */
|
|
31
|
+
export interface PooledProcess {
|
|
32
|
+
client: PooledClient;
|
|
33
|
+
}
|
|
34
|
+
/** Why a warm process did not take the session's next turn (`replaceReason`). */
|
|
35
|
+
export type ReplaceReason = "exited" | "hostResumed" | "loginChanged" | "otherConversation" | "doesNotFit" | "cannotChange";
|
|
36
|
+
/**
|
|
37
|
+
* Why the pool ended a session's process, or saw it end: an idle timeout, a
|
|
38
|
+
* release, a shutdown, its own exit (or its harness closing it), or a turn
|
|
39
|
+
* that needed another.
|
|
40
|
+
*/
|
|
41
|
+
export type ProcessEndReason = "idle" | "released" | "shutdown" | "exited" | `replaced:${ReplaceReason}`;
|
|
42
|
+
/**
|
|
43
|
+
* What a harness tells the pool about its processes. The rest (the map, the
|
|
44
|
+
* idle timer, the login generation per store, the host resume, and the waits
|
|
45
|
+
* for an exit) is the pool's. `T` is the harness's turn: whatever it needs to
|
|
46
|
+
* decide and to start.
|
|
47
|
+
*/
|
|
48
|
+
export interface ProcessHarness<P extends PooledProcess, T> {
|
|
49
|
+
/**
|
|
50
|
+
* The login store a turn's process reads its login from at its start (an
|
|
51
|
+
* `env` value, say). Absent: one store, which every login change names.
|
|
52
|
+
*/
|
|
53
|
+
store?(turn: T): string;
|
|
54
|
+
/** The conversation the turn resumes, when it names one. */
|
|
55
|
+
resumeOf(turn: T): string | undefined;
|
|
56
|
+
/** The conversations a warm process is on: a turn that resumes another needs another process. */
|
|
57
|
+
conversationsOf(process: P): readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
* Whether a warm process was started with what this turn needs, as the
|
|
60
|
+
* process is now: a process's identity can change while it runs (an
|
|
61
|
+
* approved Codex plan rewrites its sandbox), and can depend on what it
|
|
62
|
+
* said at its start (whether an ACP agent takes extra directories).
|
|
63
|
+
*/
|
|
64
|
+
fits(process: P, turn: T): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Make on a warm process the change this turn needs that a restart need
|
|
67
|
+
* not (Codex: log the turn's account in again, then compare the MCP table
|
|
68
|
+
* its thread carries): `false` when it cannot, and a new process starts.
|
|
69
|
+
* A throw fails the turn; the process stays the session's unless the
|
|
70
|
+
* harness closed it. Absent: nothing to change.
|
|
71
|
+
*/
|
|
72
|
+
applyLiveChange?(process: P, turn: T, signal: AbortSignal): Promise<boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the process holds the only copy of its conversation (an ACP
|
|
75
|
+
* agent that can neither resume nor load): no other process could go on
|
|
76
|
+
* with it, so it is neither ended for idleness nor replaced for a host
|
|
77
|
+
* resume. A turn it cannot take still replaces it.
|
|
78
|
+
*/
|
|
79
|
+
holdsOnlyCopy?(process: P): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Start a process for the turn. `own` takes its client as soon as it
|
|
82
|
+
* exists, before anything is asked of it: from then a release or a
|
|
83
|
+
* shutdown closes it, its exit is waited for, and `startedBeforeResume`
|
|
84
|
+
* answers for it. A throw must leave the client closed. `replacing` is the
|
|
85
|
+
* warm process this turn could not take, ended by now, for what a harness
|
|
86
|
+
* carries over to its successor (Claude: the conversation's spend).
|
|
87
|
+
*/
|
|
88
|
+
spawn(turn: T, own: (client: P["client"]) => void, signal: AbortSignal, replacing?: P): Promise<P>;
|
|
89
|
+
}
|
|
90
|
+
export interface ProcessPoolOptions {
|
|
91
|
+
/** Idle time before an unused process is ended; 0 or less never ends one for idleness. */
|
|
92
|
+
idleMs: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Each logical session's native process: reused while it still fits the
|
|
96
|
+
* turn, replaced otherwise, ended when idle, and never succeeded before it
|
|
97
|
+
* has exited. Claude, Codex and ACP run on it; a harness keeps only what is
|
|
98
|
+
* its own.
|
|
99
|
+
*/
|
|
100
|
+
export declare class ProcessPool<P extends PooledProcess, T> {
|
|
101
|
+
private readonly harness;
|
|
102
|
+
private readonly options;
|
|
103
|
+
private readonly held;
|
|
104
|
+
/** Clients still being started, per session: a release or a shutdown closes them too. */
|
|
105
|
+
private readonly starting;
|
|
106
|
+
/** Every exit still under way, per session: a successor and a release wait for all of them. */
|
|
107
|
+
private readonly exiting;
|
|
108
|
+
/** Per client, from the moment it is owned: a process still starting can ask too. */
|
|
109
|
+
private readonly started;
|
|
110
|
+
/** Login changes per store, and those that named none (every store). */
|
|
111
|
+
private readonly logins;
|
|
112
|
+
private loginsEverywhere;
|
|
113
|
+
/** Host resumes so far (`invalidate`). */
|
|
114
|
+
private resumes;
|
|
115
|
+
private closed;
|
|
116
|
+
constructor(harness: ProcessHarness<P, T>, options: ProcessPoolOptions);
|
|
117
|
+
/** The session's process, ready, between or during its turns. */
|
|
118
|
+
get(sessionId: string): P | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* The session's client: its process's, or the one still starting, the
|
|
121
|
+
* latest when the start owns several. An explicit change a harness queues
|
|
122
|
+
* on its client (Claude's MCP swap) reaches a session that is starting.
|
|
123
|
+
*/
|
|
124
|
+
client(sessionId: string): P["client"] | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* The session's process for the turn, which has it until `leave`: the
|
|
127
|
+
* warm one when it can take the turn, else a new one, started once every
|
|
128
|
+
* process of the session that was ended has exited. A session runs one
|
|
129
|
+
* turn at a time (`SessionAgent`), so a warm process is never under a
|
|
130
|
+
* running turn here.
|
|
131
|
+
*/
|
|
132
|
+
acquire(sessionId: string, turn: T, signal: AbortSignal): Promise<P>;
|
|
133
|
+
/**
|
|
134
|
+
* The one rule: why the warm process cannot take the turn, or nothing
|
|
135
|
+
* when it can. The facts first, the harness's checks next, and the live
|
|
136
|
+
* change last, since it acts on the process.
|
|
137
|
+
*/
|
|
138
|
+
private replaceReason;
|
|
139
|
+
/**
|
|
140
|
+
* Activity on a warm process between turns (Claude answering a query it
|
|
141
|
+
* began itself): its idle wait starts again. Nothing while a turn has it.
|
|
142
|
+
*/
|
|
143
|
+
touch(sessionId: string, process: P): void;
|
|
144
|
+
/** The turn is done with the process: a warm one waits for the next turn, at most `idleMs`. */
|
|
145
|
+
leave(sessionId: string, process: P): void;
|
|
146
|
+
/**
|
|
147
|
+
* A login changed in `store` (in every store when none is named): each
|
|
148
|
+
* session's next turn on it starts a new process, which resumes its
|
|
149
|
+
* conversation. A turn already starting or running finishes on its own.
|
|
150
|
+
*/
|
|
151
|
+
loginChanged(store?: string): void;
|
|
152
|
+
/**
|
|
153
|
+
* The host resumed from suspension, which left every process's remote
|
|
154
|
+
* connections dead: each session's next turn starts a new process. Ends
|
|
155
|
+
* nothing now, since ending at once has killed a turn still setting up.
|
|
156
|
+
*/
|
|
157
|
+
invalidate(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Whether a host resume came since the process began to start (a harness
|
|
160
|
+
* may refuse to prompt it); asked while it starts, too.
|
|
161
|
+
*/
|
|
162
|
+
startedBeforeResume(process: P): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* End the session's process for good, and any still starting, and settle
|
|
165
|
+
* once every process of the session has exited, those ended earlier
|
|
166
|
+
* (idle, replaced) included: a host removes the session's folders on this
|
|
167
|
+
* answer, and a process still exiting can write to them. Each wait is
|
|
168
|
+
* bounded by its client's stop (LLP 0007).
|
|
169
|
+
*/
|
|
170
|
+
release(sessionId: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* End every process and refuse new ones; settles once every process of
|
|
173
|
+
* every session has exited, bounded as a release is.
|
|
174
|
+
*/
|
|
175
|
+
closeAll(): Promise<void>;
|
|
176
|
+
private generation;
|
|
177
|
+
/** Every exit under way for the session, as one wait. */
|
|
178
|
+
private exits;
|
|
179
|
+
/** Wait for every ended process of the session to exit; a cancelled turn does not sit it out. */
|
|
180
|
+
private exited;
|
|
181
|
+
private start;
|
|
182
|
+
/** Own a client from its first moment: a release closes it, and its exit is waited for. */
|
|
183
|
+
private own;
|
|
184
|
+
/** Keep the client's exit until it is done: `gone()` is set by now (`PooledClient`). */
|
|
185
|
+
private exitUnderWay;
|
|
186
|
+
private disown;
|
|
187
|
+
/** End the session's process and those still starting. */
|
|
188
|
+
private remove;
|
|
189
|
+
/** End a held process, when it is still the session's; its exit is then waited for. */
|
|
190
|
+
private end;
|
|
191
|
+
private clearIdle;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=process-pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-pool.d.ts","sourceRoot":"","sources":["../../../../src/core/agents/process-pool.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,iFAAiF;IACjF,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACtD;;;OAGG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,YAAY,CAAC;CACrB;AAED,iFAAiF;AACjF,MAAM,MAAM,aAAa,GACtB,QAAQ,GACR,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,YAAY,GACZ,cAAc,CAAC;AAElB;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACzB,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,YAAY,aAAa,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,WAAW,cAA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F,OAAO,CAAC,GAAG;IAuBX,wFAAwF;IACxF,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,MAAM;IAOd,0DAA0D;IAC1D,OAAO,CAAC,MAAM;IAQd,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAOX,OAAO,CAAC,SAAS;CAMjB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type McpTool, type StopReason, type TokenUsage, type ToolKind, type ToolLocation, type ToolResultContent } from "../../../protocol/index.ts";
|
|
2
|
+
import type { AdapterEvent, EventTransformer, TransformResult } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* What the scripted agent yields as it plays a turn: its "native" events,
|
|
5
|
+
* which a real harness would read off its CLI. `includeRaw` puts them on the
|
|
6
|
+
* stream as they are.
|
|
7
|
+
*/
|
|
8
|
+
export type ScriptedEvent = {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
/** One word of a streamed text part; the first opens the part. */
|
|
13
|
+
| {
|
|
14
|
+
type: "stream";
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
/** The streamed part is complete. */
|
|
18
|
+
| {
|
|
19
|
+
type: "streamed";
|
|
20
|
+
} | {
|
|
21
|
+
type: "tool";
|
|
22
|
+
toolCallId: string;
|
|
23
|
+
toolName: string;
|
|
24
|
+
input: Record<string, unknown>;
|
|
25
|
+
kind?: ToolKind;
|
|
26
|
+
mcp?: McpTool;
|
|
27
|
+
command?: string;
|
|
28
|
+
url?: string;
|
|
29
|
+
locations?: ToolLocation[];
|
|
30
|
+
} | {
|
|
31
|
+
type: "tool-result";
|
|
32
|
+
toolCallId: string;
|
|
33
|
+
/** What ran instead of the input the call opened with (an approval that edited it). */
|
|
34
|
+
input?: Record<string, unknown>;
|
|
35
|
+
output?: string;
|
|
36
|
+
/** The call failed, or was rejected: why. */
|
|
37
|
+
error?: string;
|
|
38
|
+
content?: ToolResultContent[];
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
} | {
|
|
41
|
+
type: "end";
|
|
42
|
+
stopReason?: StopReason;
|
|
43
|
+
usage?: TokenUsage;
|
|
44
|
+
cost?: number;
|
|
45
|
+
}
|
|
46
|
+
/** The turn stopped as the user asked (a permission request answered as a cancel). */
|
|
47
|
+
| {
|
|
48
|
+
type: "cancelled";
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* The scripted harness's adapter: its events to the engine's `AdapterEvent`s.
|
|
52
|
+
* Every part goes into the turn's one assistant message, which the engine
|
|
53
|
+
* opens; ids, indices and clones are the engine's (`EventProcessor`).
|
|
54
|
+
*/
|
|
55
|
+
export declare class ScriptedTransformer implements EventTransformer<ScriptedEvent> {
|
|
56
|
+
private readonly sessionId;
|
|
57
|
+
private streaming?;
|
|
58
|
+
private readonly tools;
|
|
59
|
+
private ended?;
|
|
60
|
+
private cancelled;
|
|
61
|
+
constructor(sessionId: string);
|
|
62
|
+
process(event: ScriptedEvent): AdapterEvent[];
|
|
63
|
+
finish(): TransformResult;
|
|
64
|
+
}
|
|
65
|
+
export declare function createScriptedTransformer(ctx: {
|
|
66
|
+
sessionId: string;
|
|
67
|
+
}): EventTransformer<ScriptedEvent>;
|
|
68
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,UAAU,EAEf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EAItB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE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,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,KAAK,CAAC,CAA0C;IACxD,OAAO,CAAC,SAAS,CAAS;gBAEG,SAAS,EAAE,MAAM;IAE9C,OAAO,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,EAAE;IA6D7C,MAAM,IAAI,eAAe;CAQzB;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;CAClB,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAElC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { McpServerConfig, ToolResultContent } from "../../../protocol/index.ts";
|
|
2
|
+
/** What a `call` step's tool answered, as its tool part shows it. */
|
|
3
|
+
export interface McpCallResult {
|
|
4
|
+
output: string;
|
|
5
|
+
content?: ToolResultContent[];
|
|
6
|
+
/** The server's `structuredContent`, when it gave one. */
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
/** The server said the call failed (`isError`): `output` says why. */
|
|
9
|
+
isError: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** The part of the MCP SDK a call uses, typed here so no declaration of ours names the optional SDK. */
|
|
12
|
+
interface McpClient {
|
|
13
|
+
connect(transport: unknown): Promise<void>;
|
|
14
|
+
callTool(params: {
|
|
15
|
+
name: string;
|
|
16
|
+
arguments?: Record<string, unknown>;
|
|
17
|
+
}, resultSchema?: undefined, options?: {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
content?: unknown;
|
|
21
|
+
structuredContent?: unknown;
|
|
22
|
+
isError?: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
interface McpSdk {
|
|
27
|
+
Client: new (info: {
|
|
28
|
+
name: string;
|
|
29
|
+
version: string;
|
|
30
|
+
}) => McpClient;
|
|
31
|
+
StreamableHTTPClientTransport: new (url: URL, opts?: {
|
|
32
|
+
requestInit?: RequestInit;
|
|
33
|
+
}) => unknown;
|
|
34
|
+
}
|
|
35
|
+
/** An `http` MCP server of the turn's, with the SDK loaded to call it. */
|
|
36
|
+
export interface CallableServer {
|
|
37
|
+
url: string;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
sdk: McpSdk;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The turn's MCP server `name`, checked before its call opens a part: a server
|
|
43
|
+
* the turn does not have, one that is not `http`, or an SDK that is not
|
|
44
|
+
* installed fails the step.
|
|
45
|
+
*/
|
|
46
|
+
export declare function callableServer(name: string, servers: Record<string, McpServerConfig> | undefined): Promise<CallableServer>;
|
|
47
|
+
/**
|
|
48
|
+
* Call one tool over Streamable HTTP, on a connection of its own. A call that
|
|
49
|
+
* fails (the server down, an error it answers) answers `isError`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function callMcpTool(server: CallableServer, call: {
|
|
52
|
+
tool: string;
|
|
53
|
+
arguments?: Record<string, unknown>;
|
|
54
|
+
}, signal: AbortSignal): Promise<McpCallResult>;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=mcp-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-call.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/mcp-call.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGrF,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,wGAAwG;AACxG,UAAU,SAAS;IAClB,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,OA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CAAA;CAAE,EAC3D,MAAM,EAAE,WAAW,GACjB,OAAO,CAAC,aAAa,CAAC,CA0BxB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type AgentInput, type ModelDescriptor } from "../../../protocol/index.ts";
|
|
2
|
+
import type { NativeProcesses } from "../../processes/native-processes.ts";
|
|
3
|
+
import type { AgentExecuteOptions, RawAgentEvent } from "../base.ts";
|
|
4
|
+
import type { CliLogin } from "../login.ts";
|
|
5
|
+
import { SessionAgent } from "../session-agent.ts";
|
|
6
|
+
import { type ScriptStep, type ScriptStepOutcome } from "./steps.ts";
|
|
7
|
+
/** A turn's config as the script sees it: the turn's `RunConfig`, as the engine hands it to a harness. */
|
|
8
|
+
export type ScriptedTurnConfig = Omit<AgentExecuteOptions, "sessionId" | "turnId" | "signal" | "modelThinking" | "onNativeSession" | "onPermissionRequest" | "onElicitationRequest" | "onExecution" | "onWarning">;
|
|
9
|
+
/** What a turn was asked: what the script plays may depend on it. */
|
|
10
|
+
export interface ScriptedTurnRequest {
|
|
11
|
+
sessionId: string;
|
|
12
|
+
turnId: string;
|
|
13
|
+
input: AgentInput;
|
|
14
|
+
config: ScriptedTurnConfig;
|
|
15
|
+
/** How many turns this session ran before this one, in this engine: 0 for its first. */
|
|
16
|
+
turnIndex: number;
|
|
17
|
+
/** Aborts when the turn is cancelled. */
|
|
18
|
+
signal: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Where a turn's steps come from. An async iterable lets a test release steps
|
|
22
|
+
* when it wants; the turn waits for the next one until it is cancelled. Each
|
|
23
|
+
* `next` is passed what the step before did (`ScriptStepOutcome`), so a
|
|
24
|
+
* generator's `yield` of a step evaluates to it.
|
|
25
|
+
*/
|
|
26
|
+
export type ScriptSource = (request: ScriptedTurnRequest) => Iterable<ScriptStep, unknown, ScriptStepOutcome> | AsyncIterable<ScriptStep, unknown, ScriptStepOutcome>;
|
|
27
|
+
export interface ScriptedAgentOptions {
|
|
28
|
+
/** The steps of each turn; `scriptedQueue`, `scriptedFile` and `scriptedBySession` build the common forms. */
|
|
29
|
+
turn: ScriptSource;
|
|
30
|
+
/**
|
|
31
|
+
* The registry's processes (`createAgentRegistry` passes them). It starts
|
|
32
|
+
* none, so its runtime can vouch after a restart that nothing of its was
|
|
33
|
+
* left running, as for a real agent its sweep saw stopped. Without it a
|
|
34
|
+
* restart fences its cut-off sessions.
|
|
35
|
+
*/
|
|
36
|
+
processes?: NativeProcesses;
|
|
37
|
+
}
|
|
38
|
+
/** A harness that plays a script instead of a model (see the top of this file). */
|
|
39
|
+
export declare class ScriptedAgent extends SessionAgent {
|
|
40
|
+
private readonly options;
|
|
41
|
+
readonly harness: "scripted";
|
|
42
|
+
readonly capabilities: {
|
|
43
|
+
multiTurn: boolean;
|
|
44
|
+
sessionResume: boolean;
|
|
45
|
+
modelSwitch: (string & {}) | "in_session" | "restart_session" | "unsupported";
|
|
46
|
+
thinkingLevels: boolean;
|
|
47
|
+
images: boolean;
|
|
48
|
+
files: ((string & {}) | "text" | "pdf" | "binary")[];
|
|
49
|
+
mcpServers: boolean;
|
|
50
|
+
permissionRequests: boolean;
|
|
51
|
+
rejectionMessages: boolean;
|
|
52
|
+
turnScopedSubagents?: boolean | undefined;
|
|
53
|
+
steering?: boolean | undefined;
|
|
54
|
+
ignoredSettings?: string[] | undefined;
|
|
55
|
+
};
|
|
56
|
+
/** Signed in to nothing, and always able to run: there is no login to make or lose. */
|
|
57
|
+
readonly login: CliLogin;
|
|
58
|
+
/** Turns each session has run in this engine. */
|
|
59
|
+
private readonly turns;
|
|
60
|
+
readonly processes?: NativeProcesses;
|
|
61
|
+
constructor(options: ScriptedAgentOptions);
|
|
62
|
+
listModels(): Promise<ModelDescriptor[]>;
|
|
63
|
+
protected executeTurn(input: AgentInput, options: AgentExecuteOptions, controller: AbortController): AsyncIterableIterator<RawAgentEvent>;
|
|
64
|
+
private play;
|
|
65
|
+
/**
|
|
66
|
+
* Ask the engine's permission broker about a call: the input to run (the
|
|
67
|
+
* approved edit, when the answer edited it), why it was rejected, or that
|
|
68
|
+
* the user cancelled the turn.
|
|
69
|
+
*/
|
|
70
|
+
private permit;
|
|
71
|
+
release(sessionId: string): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=scripted-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripted-agent.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/scripted-agent.ts"],"names":[],"mappings":"AAmBA,OAAO,EAEN,KAAK,UAAU,EACf,KAAK,eAAe,EAIpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAG3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAiB,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAY,MAAM,YAAY,CAAC;AAoC9F,0GAA0G;AAC1G,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACpC,mBAAmB,EACjB,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,iBAAiB,GACjB,qBAAqB,GACrB,sBAAsB,GACtB,aAAa,GACb,WAAW,CACb,CAAC;AAEF,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,MAAM,EAAE,WAAW,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,CAC1B,OAAO,EAAE,mBAAmB,KAE1B,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,iBAAiB,CAAC,GAChD,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;AAOzD,MAAM,WAAW,oBAAoB;IACpC,8GAA8G;IAC9G,IAAI,EAAE,YAAY,CAAC;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC5B;AA2CD,mFAAmF;AACnF,qBAAa,aAAc,SAAQ,YAAY;IAmBlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAlBpC,QAAQ,CAAC,OAAO,EAAG,UAAU,CAAU;IACvC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;MAAgB;IACrC,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAStB;IACF,iDAAiD;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA6B;IAEnD,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;gBAER,OAAO,EAAE,oBAAoB;IAKpD,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;cAIpB,WAAW,CACpC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,eAAe,GACzB,qBAAqB,CAAC,aAAa,CAAC;YA6CxB,IAAI;IA0HnB;;;;OAIG;YACW,MAAM;IAwBL,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ScriptSource } from "./scripted-agent.ts";
|
|
2
|
+
import { type ScriptStep } from "./steps.ts";
|
|
3
|
+
/**
|
|
4
|
+
* One queue of steps for the whole runtime, consumed turn by turn whatever
|
|
5
|
+
* the session, one turn at a time: `{ end: true }` closes a turn, and the next
|
|
6
|
+
* turn plays on from the step after it. A turn that finds the queue empty
|
|
7
|
+
* fails, saying the script ran out, and so does one that starts while another
|
|
8
|
+
* plays (`scriptedBySession` serves sessions that run at once). Every step is
|
|
9
|
+
* read here: one the schema does not know throws now.
|
|
10
|
+
*/
|
|
11
|
+
export declare function scriptedQueue(steps: readonly ScriptStep[]): ScriptSource;
|
|
12
|
+
/**
|
|
13
|
+
* `scriptedQueue`, read from a JSONL file: one step per line (blank lines
|
|
14
|
+
* skipped), a bad line refused by its number. It plays from its start each
|
|
15
|
+
* time an engine reads it and writes nothing, unless `position` names a file
|
|
16
|
+
* that keeps how far it has played: then an engine restarted mid-script goes
|
|
17
|
+
* on where the last one stopped (inside a turn, from the next turn), and a
|
|
18
|
+
* changed script plays from its start.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scriptedFile(path: string, options?: {
|
|
21
|
+
position?: string;
|
|
22
|
+
}): ScriptSource;
|
|
23
|
+
/**
|
|
24
|
+
* A queue per session id, as `scriptedQueue` plays one; a session not named
|
|
25
|
+
* plays `otherwise` from its start, in a queue of its own. A session with
|
|
26
|
+
* neither fails its turn.
|
|
27
|
+
*/
|
|
28
|
+
export declare function scriptedBySession(scripts: Readonly<Record<string, readonly ScriptStep[]>>, otherwise?: readonly ScriptStep[]): ScriptSource;
|
|
29
|
+
//# sourceMappingURL=scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../../../../src/core/agents/scripted/scripts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAiB,KAAK,UAAU,EAAY,MAAM,YAAY,CAAC;AAmFtE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,YAAY,CAGxE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,CAyB5F;AAcD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,CAAC,EACxD,SAAS,CAAC,EAAE,SAAS,UAAU,EAAE,GAC/B,YAAY,CAgBd"}
|