@orion-agents/orion-code 0.3.66 → 0.4.4
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 +87 -0
- package/README.md +78 -361
- package/README.zh-CN.md +71 -262
- package/bin/orion +4 -1
- package/dist/acp/session-updates.d.ts +35 -0
- package/dist/acp/session-updates.js +183 -0
- package/dist/acp/sessions.d.ts +32 -0
- package/dist/acp/sessions.js +328 -0
- package/dist/acp/stdio.d.ts +3 -0
- package/dist/acp/stdio.js +59 -0
- package/dist/cli.js +136 -185
- package/dist/commands/context-tool-command-handlers.d.ts +1 -1
- package/dist/commands/context-tool-command-handlers.js +24 -3
- package/dist/commands/core-command-handlers.js +10 -18
- package/dist/commands/diagnostic-command-handlers.js +58 -48
- package/dist/commands/diagnostic-commands.js +0 -12
- package/dist/commands/init-command.d.ts +3 -0
- package/dist/commands/init-command.js +131 -0
- package/dist/commands/model-command-handlers.d.ts +1 -2
- package/dist/commands/model-command-handlers.js +15 -100
- package/dist/commands/model-commands.js +0 -11
- package/dist/commands/registry.js +1 -19
- package/dist/commands/rsi-command.d.ts +2 -0
- package/dist/commands/rsi-command.js +180 -0
- package/dist/commands/session-command-handlers.js +28 -19
- package/dist/commands/system-commands.js +0 -1
- package/dist/commands/target-command.js +49 -6
- package/dist/commands/tool-commands.js +1 -1
- package/dist/commands/types.d.ts +4 -10
- package/dist/commands/types.js +1 -21
- package/dist/commands/workflow-command-handlers.js +13 -4
- package/dist/commands/workflow-commands.js +2 -2
- package/dist/framework/loop-budget-contract.d.ts +2 -8
- package/dist/framework/loop-budget-contract.js +0 -3
- package/dist/framework/loop-progress.d.ts +18 -0
- package/dist/framework/loop-progress.js +63 -0
- package/dist/framework/prompt.d.ts +0 -2
- package/dist/framework/prompt.js +9 -27
- package/dist/framework/query.d.ts +26 -31
- package/dist/framework/query.js +451 -292
- package/dist/framework/store.d.ts +6 -10
- package/dist/framework/store.js +2 -21
- package/dist/framework/tool-call-orchestrator.d.ts +7 -0
- package/dist/framework/tool-call-orchestrator.js +8 -3
- package/dist/framework/tool-state.d.ts +2 -0
- package/dist/framework/tool.d.ts +0 -23
- package/dist/framework/verification-command.d.ts +15 -0
- package/dist/framework/verification-command.js +32 -0
- package/dist/harness/assembler.d.ts +1 -0
- package/dist/harness/assembler.js +24 -0
- package/dist/harness/capsule.d.ts +1 -1
- package/dist/harness/capsule.js +33 -14
- package/dist/harness/context-harness.d.ts +37 -12
- package/dist/harness/context-harness.js +545 -35
- package/dist/harness/contract.js +1 -1
- package/dist/harness/drift-guard.d.ts +4 -0
- package/dist/harness/drift-guard.js +68 -16
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/intent.js +21 -0
- package/dist/harness/ledger.d.ts +7 -11
- package/dist/harness/ledger.js +50 -9
- package/dist/harness/progress-controller.d.ts +12 -7
- package/dist/harness/progress-controller.js +96 -29
- package/dist/harness/state.js +10 -1
- package/dist/harness/stop-controller.d.ts +0 -5
- package/dist/harness/stop-controller.js +11 -31
- package/dist/harness/task-checklist.d.ts +16 -0
- package/dist/harness/task-checklist.js +92 -0
- package/dist/harness/types.d.ts +78 -1
- package/dist/harness/verification.d.ts +19 -1
- package/dist/harness/verification.js +116 -29
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -3
- package/dist/print-ui/event-stream.d.ts +43 -0
- package/dist/print-ui/event-stream.js +204 -0
- package/dist/print-ui/launch.d.ts +12 -1
- package/dist/print-ui/launch.js +173 -11
- package/dist/product/environment.d.ts +1 -1
- package/dist/product/environment.js +1 -1
- package/dist/product/identity.d.ts +1 -1
- package/dist/product/identity.js +1 -1
- package/dist/product/paths.d.ts +3 -2
- package/dist/product/paths.js +6 -2
- package/dist/runtime/agent-loop.d.ts +12 -2
- package/dist/runtime/agent-loop.js +172 -29
- package/dist/runtime/agent-runtime-controller.d.ts +14 -4
- package/dist/runtime/agent-runtime-controller.js +366 -192
- package/dist/runtime/agent-runtime-protocol.d.ts +10 -18
- package/dist/runtime/agent-runtime-runner.d.ts +10 -0
- package/dist/runtime/builtin-tool-provider.js +5 -1
- package/dist/runtime/capability-receipt-journal.js +1 -0
- package/dist/runtime/durable-tool-receipt-reader.js +2 -1
- package/dist/runtime/first-party-tool-services.d.ts +1 -0
- package/dist/runtime/first-party-tool-services.js +2 -12
- package/dist/runtime/first-party-tool-universe.d.ts +1 -0
- package/dist/runtime/first-party-tool-universe.js +1 -1
- package/dist/runtime/followup-queue-store.d.ts +16 -0
- package/dist/runtime/followup-queue-store.js +75 -0
- package/dist/runtime/goal-lifecycle-v2.d.ts +16 -4
- package/dist/runtime/goal-lifecycle-v2.js +217 -39
- package/dist/runtime/goal-runtime-coordinator.d.ts +14 -2
- package/dist/runtime/goal-runtime-coordinator.js +147 -36
- package/dist/runtime/goals/presentation.js +3 -1
- package/dist/runtime/goals/types.d.ts +1 -3
- package/dist/runtime/goals/types.js +0 -3
- package/dist/runtime/loop-budget.d.ts +0 -7
- package/dist/runtime/loop-budget.js +8 -52
- package/dist/runtime/mcp/first-party-mcp-adapter.d.ts +2 -0
- package/dist/runtime/mcp/first-party-mcp-adapter.js +23 -19
- package/dist/runtime/model-coordinator.js +2 -5
- package/dist/runtime/orion-runtime-v1.d.ts +18 -2
- package/dist/runtime/orion-runtime-v1.js +183 -46
- package/dist/runtime/orion-session-runner.d.ts +7 -0
- package/dist/runtime/orion-session-runner.js +82 -0
- package/dist/runtime/plan-review.d.ts +1 -0
- package/dist/runtime/plan-review.js +8 -4
- package/dist/runtime/product-bootstrap.d.ts +6 -0
- package/dist/runtime/product-bootstrap.js +41 -51
- package/dist/runtime/product-orion-runtime.js +129 -58
- package/dist/runtime/release-receipts.d.ts +24 -133
- package/dist/runtime/release-receipts.js +129 -693
- package/dist/runtime/rich-text/layout.js +108 -65
- package/dist/runtime/rsi/contracts.d.ts +50 -0
- package/dist/runtime/rsi/contracts.js +17 -0
- package/dist/runtime/rsi/diagnosis.d.ts +46 -0
- package/dist/runtime/rsi/diagnosis.js +98 -0
- package/dist/runtime/rsi/evaluation-suite.d.ts +25 -0
- package/dist/runtime/rsi/evaluation-suite.js +141 -0
- package/dist/runtime/rsi/evaluation-worker.d.ts +19 -0
- package/dist/runtime/rsi/evaluation-worker.js +64 -0
- package/dist/runtime/rsi/evaluation.d.ts +49 -0
- package/dist/runtime/rsi/evaluation.js +345 -0
- package/dist/runtime/rsi/lifecycle.d.ts +54 -0
- package/dist/runtime/rsi/lifecycle.js +279 -0
- package/dist/runtime/rsi/proposal.d.ts +39 -0
- package/dist/runtime/rsi/proposal.js +312 -0
- package/dist/runtime/rsi/receipt.d.ts +28 -0
- package/dist/runtime/rsi/receipt.js +138 -0
- package/dist/runtime/rsi/skill-state.d.ts +7 -0
- package/dist/runtime/rsi/skill-state.js +50 -0
- package/dist/runtime/rsi/trajectory.d.ts +19 -0
- package/dist/runtime/rsi/trajectory.js +314 -0
- package/dist/runtime/rsi/triage.d.ts +274 -0
- package/dist/runtime/rsi/triage.js +58 -0
- package/dist/runtime/session-composer-control.d.ts +5 -24
- package/dist/runtime/session-composer-control.js +27 -189
- package/dist/runtime/step-snapshot.d.ts +4 -1
- package/dist/runtime/step-snapshot.js +11 -1
- package/dist/runtime/subagent-thread-runtime.js +27 -5
- package/dist/runtime/subagents/policy.js +0 -1
- package/dist/runtime/subagents/production.js +1 -5
- package/dist/runtime/subagents/runtime-integration.js +2 -4
- package/dist/runtime/subagents/types.d.ts +0 -5
- package/dist/runtime/subagents/types.js +0 -2
- package/dist/runtime/task-context-recovery.d.ts +55 -0
- package/dist/runtime/task-context-recovery.js +349 -0
- package/dist/runtime/task-context-service.d.ts +20 -10
- package/dist/runtime/task-context-service.js +69 -9
- package/dist/runtime/thread-admission.d.ts +3 -1
- package/dist/runtime/thread-admission.js +21 -7
- package/dist/runtime/thread-event-store.d.ts +2 -2
- package/dist/runtime/thread-event-store.js +7 -2
- package/dist/runtime/thread-projection.js +4 -2
- package/dist/runtime/thread-runtime.d.ts +10 -0
- package/dist/runtime/thread-runtime.js +85 -3
- package/dist/runtime/thread-session-index.d.ts +8 -0
- package/dist/runtime/thread-session-index.js +50 -1
- package/dist/runtime/thread-session-view.d.ts +2 -1
- package/dist/runtime/thread-session-view.js +4 -0
- package/dist/runtime/thread-tool-journal.d.ts +1 -0
- package/dist/runtime/thread-tool-journal.js +6 -2
- package/dist/runtime/thread-ui-adapter.d.ts +1 -0
- package/dist/runtime/thread-ui-adapter.js +89 -22
- package/dist/runtime/tool-gateway.d.ts +9 -0
- package/dist/runtime/tool-gateway.js +24 -0
- package/dist/runtime/tool-receipt-validator.js +4 -0
- package/dist/runtime/tool-transcript-entry.d.ts +16 -0
- package/dist/runtime/tool-transcript-entry.js +73 -0
- package/dist/runtime/turn-commit.d.ts +4 -1
- package/dist/runtime/turn-commit.js +19 -15
- package/dist/runtime/ui-events.d.ts +15 -1
- package/dist/runtime/ui-view-model.d.ts +6 -5
- package/dist/runtime/ui-view-model.js +78 -61
- package/dist/runtime/workspace-runtime-kernel.js +0 -1
- package/dist/runtime/workspace-verification.d.ts +7 -0
- package/dist/runtime/workspace-verification.js +83 -0
- package/dist/services/atomic-write.d.ts +2 -0
- package/dist/services/atomic-write.js +12 -1
- package/dist/services/code-review/format.d.ts +4 -1
- package/dist/services/code-review/format.js +5 -1
- package/dist/services/code-review/runner.d.ts +2 -2
- package/dist/services/code-review/runner.js +86 -64
- package/dist/services/code-review/snapshot.d.ts +9 -9
- package/dist/services/code-review/snapshot.js +182 -166
- package/dist/services/compact/auto-compact.d.ts +21 -6
- package/dist/services/compact/auto-compact.js +148 -22
- package/dist/services/compact/background-candidate.d.ts +33 -0
- package/dist/services/compact/background-candidate.js +184 -0
- package/dist/services/compact/compact.d.ts +4 -1
- package/dist/services/compact/compact.js +30 -3
- package/dist/services/compact/coordinator.d.ts +10 -4
- package/dist/services/compact/coordinator.js +17 -7
- package/dist/services/compact/summary-generator.d.ts +4 -2
- package/dist/services/compact/summary-generator.js +17 -3
- package/dist/services/config.d.ts +5 -5
- package/dist/services/config.js +29 -48
- package/dist/services/doctor.js +85 -13
- package/dist/services/effort.d.ts +5 -5
- package/dist/services/effort.js +5 -11
- package/dist/services/file-lock.d.ts +9 -3
- package/dist/services/file-lock.js +92 -26
- package/dist/services/global-config.d.ts +26 -64
- package/dist/services/global-config.js +233 -193
- package/dist/services/llm.d.ts +42 -4
- package/dist/services/llm.js +177 -45
- package/dist/services/model-client-pool.d.ts +15 -9
- package/dist/services/model-client-pool.js +62 -33
- package/dist/services/model-context.d.ts +2 -1
- package/dist/services/model-context.js +15 -9
- package/dist/services/model-registry.d.ts +4 -15
- package/dist/services/model-registry.js +32 -101
- package/dist/services/provider-diagnostics.d.ts +8 -0
- package/dist/services/provider-diagnostics.js +17 -12
- package/dist/services/provider-resilience/coordinator.d.ts +1 -1
- package/dist/services/provider-resilience/coordinator.js +10 -6
- package/dist/services/provider-resilience/request-gate.d.ts +3 -0
- package/dist/services/provider-resilience/request-gate.js +29 -18
- package/dist/services/provider-resilience/types.d.ts +2 -0
- package/dist/services/session-storage.d.ts +7 -10
- package/dist/services/session-storage.js +57 -30
- package/dist/services/settings-coordinator.d.ts +0 -6
- package/dist/services/settings-coordinator.js +19 -56
- package/dist/services/settings-document-repository.d.ts +3 -10
- package/dist/services/settings-document-repository.js +7 -85
- package/dist/services/usage-state.d.ts +3 -3
- package/dist/services/usage-state.js +11 -42
- package/dist/terminal-ui/answer-format.d.ts +14 -0
- package/dist/terminal-ui/answer-format.js +119 -0
- package/dist/terminal-ui/launch.d.ts +7 -6
- package/dist/terminal-ui/launch.js +160 -70
- package/dist/terminal-ui/output-queue.d.ts +2 -1
- package/dist/terminal-ui/output-queue.js +1 -1
- package/dist/terminal-ui/raw-editor.d.ts +2 -1
- package/dist/terminal-ui/raw-editor.js +56 -15
- package/dist/tools/core/edit-file.js +6 -2
- package/dist/tools/core/write-file.js +9 -2
- package/dist/tools/lsp.d.ts +16 -1
- package/dist/tools/lsp.js +60 -19
- package/dist/tools/sandbox.d.ts +1 -1
- package/dist/tools/sandbox.js +3 -16
- package/dist/tools/todo.d.ts +4 -2
- package/dist/tools/todo.js +91 -30
- package/dist/tui-core/input-parser.d.ts +1 -0
- package/dist/tui-core/input-parser.js +6 -0
- package/dist/tui-core/style.d.ts +1 -8
- package/dist/tui-core/style.js +3 -110
- package/dist/tui-ui/chrome-view-model.d.ts +1 -1
- package/dist/tui-ui/chrome-view-model.js +36 -32
- package/dist/tui-ui/launch.js +14 -14
- package/dist/tui-ui/layout.d.ts +5 -7
- package/dist/tui-ui/layout.js +129 -124
- package/dist/tui-ui/runner.d.ts +11 -12
- package/dist/tui-ui/runner.js +88 -67
- package/dist/tui-ui/state.d.ts +0 -11
- package/dist/tui-ui/state.js +22 -33
- package/dist/tui-ui/terminal-image.js +22 -4
- package/dist/tui-ui/transcript-inspector-layout.js +6 -3
- package/dist/tui-ui/transcript-inspector.d.ts +1 -0
- package/dist/tui-ui/transcript-inspector.js +7 -1
- package/dist/tui-ui/transcript-layout.js +42 -6
- package/dist/utils/terminal-text.d.ts +11 -0
- package/dist/utils/terminal-text.js +114 -0
- package/docs/cli-guide.md +575 -0
- package/docs/orion.example.yaml +43 -0
- package/docs/readme.md +12 -57
- package/npm-shrinkwrap.json +484 -1855
- package/package.json +13 -63
- package/dist/migration/command.d.ts +0 -9
- package/dist/migration/command.js +0 -100
- package/dist/migration/index.d.ts +0 -7
- package/dist/migration/index.js +0 -14
- package/dist/migration/migrate.d.ts +0 -19
- package/dist/migration/migrate.js +0 -406
- package/dist/migration/types.d.ts +0 -55
- package/dist/migration/types.js +0 -6
- package/dist/services/tool-allowlist.d.ts +0 -110
- package/dist/services/tool-allowlist.js +0 -299
- package/dist/services/yaml-config.d.ts +0 -57
- package/dist/services/yaml-config.js +0 -178
- package/dist/web/cli-options.d.ts +0 -17
- package/dist/web/cli-options.js +0 -51
- package/dist/web/code-review-run-service.d.ts +0 -68
- package/dist/web/code-review-run-service.js +0 -228
- package/dist/web/context-text.d.ts +0 -17
- package/dist/web/context-text.js +0 -40
- package/dist/web/errors.d.ts +0 -6
- package/dist/web/errors.js +0 -13
- package/dist/web/event-hub.d.ts +0 -45
- package/dist/web/event-hub.js +0 -370
- package/dist/web/file-read-service.d.ts +0 -101
- package/dist/web/file-read-service.js +0 -593
- package/dist/web/file-write-service.d.ts +0 -16
- package/dist/web/file-write-service.js +0 -103
- package/dist/web/git-compare-service.d.ts +0 -45
- package/dist/web/git-compare-service.js +0 -160
- package/dist/web/git-diff-document.d.ts +0 -102
- package/dist/web/git-diff-document.js +0 -258
- package/dist/web/git-file-source.d.ts +0 -25
- package/dist/web/git-file-source.js +0 -21
- package/dist/web/git-history-service.d.ts +0 -151
- package/dist/web/git-history-service.js +0 -619
- package/dist/web/git-index-transaction.d.ts +0 -45
- package/dist/web/git-index-transaction.js +0 -174
- package/dist/web/git-patch-builder.d.ts +0 -30
- package/dist/web/git-patch-builder.js +0 -138
- package/dist/web/git-read-model-service.d.ts +0 -452
- package/dist/web/git-read-model-service.js +0 -1833
- package/dist/web/git-version-service.d.ts +0 -79
- package/dist/web/git-version-service.js +0 -279
- package/dist/web/host-daemon.d.ts +0 -70
- package/dist/web/host-daemon.js +0 -237
- package/dist/web/index.d.ts +0 -6
- package/dist/web/index.js +0 -28
- package/dist/web/launch.d.ts +0 -12
- package/dist/web/launch.js +0 -89
- package/dist/web/native-directory-picker.d.ts +0 -63
- package/dist/web/native-directory-picker.js +0 -169
- package/dist/web/protocol.d.ts +0 -705
- package/dist/web/protocol.js +0 -639
- package/dist/web/review-service.d.ts +0 -22
- package/dist/web/review-service.js +0 -68
- package/dist/web/server.d.ts +0 -20
- package/dist/web/server.js +0 -1453
- package/dist/web/session-runtime-registry.d.ts +0 -138
- package/dist/web/session-runtime-registry.js +0 -471
- package/dist/web/terminal-manager.d.ts +0 -156
- package/dist/web/terminal-manager.js +0 -779
- package/dist/web/terminal-server.d.ts +0 -8
- package/dist/web/terminal-server.js +0 -304
- package/dist/web/workbench-controller.d.ts +0 -395
- package/dist/web/workbench-controller.js +0 -3077
- package/dist/web/workspace-discovery.d.ts +0 -92
- package/dist/web/workspace-discovery.js +0 -324
- package/dist/web/workspace-mutation-arbiter.d.ts +0 -54
- package/dist/web/workspace-mutation-arbiter.js +0 -267
- package/dist/web/workspace-open-telemetry.d.ts +0 -55
- package/dist/web/workspace-open-telemetry.js +0 -73
- package/dist/web-client/assets/FilesPanel-CPDovK_K.js +0 -1
- package/dist/web-client/assets/GitPanel-DtU_TD61.js +0 -4
- package/dist/web-client/assets/ReviewPanel-vMO7BEA3.js +0 -6
- package/dist/web-client/assets/TerminalPanel-C9vDTAlS.js +0 -23
- package/dist/web-client/assets/TerminalPanel-DLuoa74B.css +0 -1
- package/dist/web-client/assets/index-CABdwh4l.css +0 -1
- package/dist/web-client/assets/index-KvshfEbl.js +0 -20
- package/dist/web-client/assets/useAutoNotice-IE1g2wcb.js +0 -1
- package/dist/web-client/favicon.svg +0 -9
- package/dist/web-client/index.html +0 -17
- package/docs/architecture/agent-mode-permission-contract.md +0 -87
- package/docs/architecture/v0.3.0-web-api.yaml +0 -1340
- package/docs/architecture/v0.3.1-web-api.yaml +0 -2338
- package/docs/architecture/v0.3.2-web-api.yaml +0 -3029
- package/docs/architecture/v0.3.3-web-api.yaml +0 -3205
- package/docs/architecture/v0.3.4-stabilization-contract.md +0 -32
- package/docs/migration/v0.1.9-to-v0.2.0.md +0 -98
- package/docs/migration/v0.2.2-to-v0.3.0-settings.md +0 -114
- package/docs/migration/v0.2.2-to-v0.3.0.md +0 -55
- package/docs/migration/v0.3.0-to-v0.3.1.md +0 -88
- package/docs/migration/v0.3.1-to-v0.3.2.md +0 -94
- package/docs/migration/v0.3.2-to-v0.3.3.md +0 -62
- package/docs/migration/v0.3.3-to-v0.3.4.md +0 -36
- package/docs/orion.example.json +0 -86
- package/docs/plan/v0.2.0-dsh-harness-redesign-plan.md +0 -1234
- package/docs/plan/v0.2.0-release-checklist.md +0 -91
- package/docs/plan/v0.3.0-node-runtime-compatibility-plan.md +0 -57
- package/docs/plan/v0.3.0-settings-integration-plan.md +0 -740
- package/docs/plan/v0.3.0-web-workbench-plan.md +0 -376
- package/docs/plan/v0.3.1-web-workbench-professional-shell-plan.md +0 -848
- package/docs/plan/v0.3.2-web-workbench-layout-and-composer-plan.md +0 -869
- package/docs/plan/v0.3.3-plan.md +0 -1113
- package/docs/plan/v0.3.4-stabilization-plan.md +0 -89
- package/docs/test/v0.3.1-web-workbench-e2e-plan.md +0 -140
- package/docs/test/v0.3.2-web-workbench-e2e-plan.md +0 -100
- package/docs/test/v0.3.3-web-workbench-e2e-plan.md +0 -79
- package/docs/test/v0.3.4-stabilization-e2e-plan.md +0 -54
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SessionComposerControlServiceV1 = exports.SessionComposerControlError = void 0;
|
|
4
4
|
const crypto_1 = require("crypto");
|
|
5
|
-
const compact_1 = require("../services/compact");
|
|
6
5
|
const model_context_1 = require("../services/model-context");
|
|
7
6
|
const model_registry_1 = require("../services/model-registry");
|
|
8
7
|
const effort_1 = require("../services/effort");
|
|
9
8
|
const global_config_1 = require("../services/global-config");
|
|
10
9
|
const session_storage_1 = require("../services/session-storage");
|
|
11
10
|
const token_estimate_1 = require("../utils/token-estimate");
|
|
11
|
+
const model_client_pool_1 = require("../services/model-client-pool");
|
|
12
12
|
const model_coordinator_1 = require("./model-coordinator");
|
|
13
13
|
const canonical_1 = require("./protocol/canonical");
|
|
14
14
|
class SessionComposerControlError extends Error {
|
|
@@ -59,7 +59,7 @@ class SessionComposerControlServiceV1 {
|
|
|
59
59
|
}));
|
|
60
60
|
const unavailableProviders = Object.freeze(registry
|
|
61
61
|
? [...registry.providers.values()]
|
|
62
|
-
.filter(provider => !
|
|
62
|
+
.filter(provider => !(0, model_client_pool_1.resolveProviderCredential)(provider.apiKey).apiKey)
|
|
63
63
|
.map(provider => Object.freeze({
|
|
64
64
|
id: provider.id,
|
|
65
65
|
reason: 'The configured credential slot is unavailable.',
|
|
@@ -199,81 +199,6 @@ class SessionComposerControlServiceV1 {
|
|
|
199
199
|
const session = this.options.getSession() ?? this.options.ensureSession();
|
|
200
200
|
return this.selectModel({ modelId: session.model, effort });
|
|
201
201
|
}
|
|
202
|
-
async setPermissionOverride(override) {
|
|
203
|
-
if (override !== null && !['ask', 'allow', 'deny'].includes(override)) {
|
|
204
|
-
throw new SessionComposerControlError('permission_override_rejected', `Unsupported tool confirmation policy: ${String(override)}`);
|
|
205
|
-
}
|
|
206
|
-
const session = this.options.getSession() ?? this.options.ensureSession();
|
|
207
|
-
const previousState = this.project(session, true).permission;
|
|
208
|
-
const idle = this.options.runtimeIdle();
|
|
209
|
-
const before = (0, session_storage_1.projectSessionComposerPreferences)(session);
|
|
210
|
-
let persisted = null;
|
|
211
|
-
try {
|
|
212
|
-
persisted = (0, session_storage_1.updateSessionComposerPreferences)(session.id, {
|
|
213
|
-
expected: before,
|
|
214
|
-
permission: { value: override ?? undefined },
|
|
215
|
-
});
|
|
216
|
-
if (!persisted) {
|
|
217
|
-
throw new SessionComposerControlError('session_unavailable', `Session ${session.id} is no longer available.`);
|
|
218
|
-
}
|
|
219
|
-
copySessionPreferences(session, persisted);
|
|
220
|
-
this.options.applySessionState(session);
|
|
221
|
-
if (idle)
|
|
222
|
-
await this.options.rebindSessionRuntime();
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
let rollbackFailed = false;
|
|
226
|
-
if (persisted) {
|
|
227
|
-
const applied = (0, session_storage_1.projectSessionComposerPreferences)(persisted);
|
|
228
|
-
try {
|
|
229
|
-
const restored = (0, session_storage_1.updateSessionComposerPreferences)(session.id, {
|
|
230
|
-
expected: applied,
|
|
231
|
-
permission: { value: before.toolConfirmationOverride },
|
|
232
|
-
});
|
|
233
|
-
if (restored)
|
|
234
|
-
copySessionPreferences(session, restored);
|
|
235
|
-
else
|
|
236
|
-
rollbackFailed = true;
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
rollbackFailed = true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (error instanceof session_storage_1.SessionComposerPreferencesConflictError) {
|
|
243
|
-
const latest = (0, session_storage_1.loadSessionMeta)(session.id);
|
|
244
|
-
if (latest)
|
|
245
|
-
copySessionPreferences(session, latest);
|
|
246
|
-
else
|
|
247
|
-
restoreSessionObject(session, before);
|
|
248
|
-
this.options.applySessionState(session);
|
|
249
|
-
if (idle)
|
|
250
|
-
await this.options.rebindSessionRuntime().catch(() => undefined);
|
|
251
|
-
return this.failControl(session.id, new SessionComposerControlError('composer_control_conflict', error.message));
|
|
252
|
-
}
|
|
253
|
-
restoreSessionObject(session, before);
|
|
254
|
-
this.options.applySessionState(session);
|
|
255
|
-
if (idle)
|
|
256
|
-
await this.options.rebindSessionRuntime().catch(() => undefined);
|
|
257
|
-
if (rollbackFailed) {
|
|
258
|
-
return this.failControl(session.id, new SessionComposerControlError('composer_recovery_required', 'Permission selection failed and its durable Session metadata could not be rolled back.'));
|
|
259
|
-
}
|
|
260
|
-
if (error instanceof SessionComposerControlError) {
|
|
261
|
-
return this.failControl(session.id, error);
|
|
262
|
-
}
|
|
263
|
-
return this.failControl(session.id, new SessionComposerControlError('permission_override_rejected', `Permission override was rolled back: ${error instanceof Error ? error.message : String(error)}`));
|
|
264
|
-
}
|
|
265
|
-
const currentState = this.project(session, true).permission;
|
|
266
|
-
const current = (0, session_storage_1.projectSessionComposerPreferences)(session);
|
|
267
|
-
this.lastError = undefined;
|
|
268
|
-
this.emitChanged();
|
|
269
|
-
return Object.freeze({
|
|
270
|
-
receiptId: (0, crypto_1.randomUUID)(),
|
|
271
|
-
previous: previousState,
|
|
272
|
-
current: currentState,
|
|
273
|
-
appliesFrom: idle ? 'immediate' : 'next-tool-admission',
|
|
274
|
-
sessionPreferencesDigest: (0, canonical_1.digestRuntimeValue)(current),
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
202
|
/** Apply controls queued during an active turn before the next logical request starts. */
|
|
278
203
|
async applyPendingAtLogicalBoundary() {
|
|
279
204
|
if (!this.options.runtimeIdle())
|
|
@@ -303,7 +228,6 @@ class SessionComposerControlServiceV1 {
|
|
|
303
228
|
const profile = this.resolveProfile(session.model);
|
|
304
229
|
const effort = this.resolveEffort(profile, session.effortPreference ?? 'auto');
|
|
305
230
|
const provider = this.options.config.modelRegistry?.providers.get(profile.provider);
|
|
306
|
-
const projectDefault = this.options.projectToolConfirmation();
|
|
307
231
|
const observedUsage = this.options.store.getSnapshot().contextUsage;
|
|
308
232
|
const contextUsage = active &&
|
|
309
233
|
observedUsage &&
|
|
@@ -327,12 +251,6 @@ class SessionComposerControlServiceV1 {
|
|
|
327
251
|
...(effort.warning ? { warning: effort.warning } : {}),
|
|
328
252
|
}),
|
|
329
253
|
}),
|
|
330
|
-
permission: Object.freeze({
|
|
331
|
-
effective: session.toolConfirmationOverride ?? projectDefault,
|
|
332
|
-
override: session.toolConfirmationOverride ?? null,
|
|
333
|
-
projectDefault,
|
|
334
|
-
source: session.toolConfirmationOverride === undefined ? 'project' : 'session',
|
|
335
|
-
}),
|
|
336
254
|
contextUsage,
|
|
337
255
|
pending: Object.freeze({
|
|
338
256
|
model: active && this.pendingModel?.sessionId === session.id
|
|
@@ -341,7 +259,6 @@ class SessionComposerControlServiceV1 {
|
|
|
341
259
|
effort: this.pendingModel.effort,
|
|
342
260
|
})
|
|
343
261
|
: null,
|
|
344
|
-
permission: null,
|
|
345
262
|
}),
|
|
346
263
|
lastError: active && this.lastError?.sessionId === session.id
|
|
347
264
|
? Object.freeze({ code: this.lastError.code, message: this.lastError.message })
|
|
@@ -395,110 +312,46 @@ class SessionComposerControlServiceV1 {
|
|
|
395
312
|
throw error;
|
|
396
313
|
}
|
|
397
314
|
async commitCompact(request) {
|
|
398
|
-
const history = this.options.store.getSnapshot().conversationHistory;
|
|
399
|
-
const currentTokens = (0, token_estimate_1.estimateMessagesTokens)(history);
|
|
400
|
-
if (currentTokens <= request.safeInputBudget) {
|
|
401
|
-
return { status: 'not_needed', currentTokens };
|
|
402
|
-
}
|
|
403
315
|
const session = this.options.getSession() ?? this.options.ensureSession();
|
|
404
|
-
const
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
compactMode: 'manual',
|
|
411
|
-
safeInputBudget: request.safeInputBudget,
|
|
412
|
-
targetRatio: 0.65,
|
|
413
|
-
});
|
|
414
|
-
if (result.afterTokens > request.targetTokens) {
|
|
316
|
+
const before = (0, session_storage_1.loadSessionRestoreBundle)(session.id);
|
|
317
|
+
const currentTokens = Math.max((0, token_estimate_1.estimateMessagesTokens)([...before.history.messages]), (0, token_estimate_1.estimateMessagesTokens)(this.options.store.getSnapshot().conversationHistory));
|
|
318
|
+
if (currentTokens <= request.safeInputBudget)
|
|
319
|
+
return { status: 'not_needed', currentTokens };
|
|
320
|
+
const compact = this.options.compactForModelSwitch;
|
|
321
|
+
if (!compact) {
|
|
415
322
|
return {
|
|
416
323
|
status: 'rejected',
|
|
417
|
-
error:
|
|
324
|
+
error: 'Model-switch compaction requires the Session runtime maintenance transaction.',
|
|
418
325
|
};
|
|
419
326
|
}
|
|
327
|
+
const receipt = await compact(request);
|
|
328
|
+
if (receipt.status !== 'committed')
|
|
329
|
+
return receipt;
|
|
330
|
+
const restored = (0, session_storage_1.loadSessionRestoreBundle)(session.id);
|
|
331
|
+
const history = [...restored.history.messages];
|
|
332
|
+
const afterTokens = (0, token_estimate_1.estimateMessagesTokens)(history);
|
|
333
|
+
if (!restored.runtimeActivation ||
|
|
334
|
+
(0, canonical_1.digestRuntimeValue)(history) !== receipt.candidateFingerprint ||
|
|
335
|
+
afterTokens !== receipt.afterTokens ||
|
|
336
|
+
afterTokens > request.targetTokens) {
|
|
337
|
+
return { status: 'rejected', error: 'Committed compact history failed durable readback.' };
|
|
338
|
+
}
|
|
420
339
|
const afterUsage = {
|
|
421
340
|
...(0, model_context_1.createContextUsageSnapshot)({
|
|
422
341
|
modelId: request.to.id,
|
|
423
|
-
usedTokens:
|
|
342
|
+
usedTokens: afterTokens,
|
|
424
343
|
source: 'estimated',
|
|
425
344
|
outputReserveTokens: request.to.resolvedMaxOutputTokens,
|
|
345
|
+
contextWindow: request.to.resolvedContextWindow,
|
|
426
346
|
}),
|
|
427
347
|
contextWindow: request.to.resolvedContextWindow,
|
|
428
348
|
safeInputBudget: request.safeInputBudget,
|
|
429
|
-
percent: Math.min(100, Math.floor((
|
|
430
|
-
rawPercent: Math.min(100, Math.floor((
|
|
431
|
-
};
|
|
432
|
-
const traceTurnId = 'composer:model-switch';
|
|
433
|
-
const traceDetails = {
|
|
434
|
-
model: request.to.id,
|
|
435
|
-
compactMode: 'manual',
|
|
436
|
-
compactStrategy: 'model-switch-semantic-v2',
|
|
437
|
-
compactCandidateFingerprint: result.fingerprint,
|
|
438
|
-
compactBeforeTokens: result.beforeTokens,
|
|
439
|
-
compactAfterTokens: result.afterTokens,
|
|
440
|
-
compactTargetTokens: result.plan.targetTokens,
|
|
441
|
-
compactTargetRatio: result.plan.targetRatio,
|
|
442
|
-
compactDiagnosticsCount: result.diagnostics.length,
|
|
443
|
-
compactSourceMessageCount: prepareSource.sourceMessageCount,
|
|
349
|
+
percent: Math.min(100, Math.floor((afterTokens / request.safeInputBudget) * 100)),
|
|
350
|
+
rawPercent: Math.min(100, Math.floor((afterTokens / request.to.resolvedContextWindow) * 100)),
|
|
444
351
|
};
|
|
445
|
-
(
|
|
446
|
-
turnId: traceTurnId,
|
|
447
|
-
type: 'compact_prepare',
|
|
448
|
-
...traceDetails,
|
|
449
|
-
});
|
|
450
|
-
const checkpoint = (0, session_storage_1.commitSessionCompactCheckpoint)({
|
|
451
|
-
sessionId: session.id,
|
|
452
|
-
mode: 'manual',
|
|
453
|
-
modelId: request.to.id,
|
|
454
|
-
sourceMessageCount: prepareSource.sourceMessageCount,
|
|
455
|
-
transcriptStartMessageIndex: Math.max(0, prepareSource.sourceMessageCount - 20),
|
|
456
|
-
modelHistory: result.messages,
|
|
457
|
-
summary: {
|
|
458
|
-
text: result.summary,
|
|
459
|
-
generatedAt: result.summaryGeneratedAt,
|
|
460
|
-
source: result.summarySource,
|
|
461
|
-
},
|
|
462
|
-
beforeUsage: (0, model_context_1.createContextUsageSnapshot)({
|
|
463
|
-
modelId: request.from.id,
|
|
464
|
-
usedTokens: currentTokens,
|
|
465
|
-
source: 'estimated',
|
|
466
|
-
outputReserveTokens: request.from.resolvedMaxOutputTokens,
|
|
467
|
-
}),
|
|
468
|
-
afterUsage,
|
|
469
|
-
strategy: 'model-switch-semantic-v2',
|
|
470
|
-
harnessState: this.options.store.getSnapshot().harnessState,
|
|
471
|
-
prepareSource,
|
|
472
|
-
candidate: {
|
|
473
|
-
fingerprint: result.fingerprint,
|
|
474
|
-
beforeTokens: result.beforeTokens,
|
|
475
|
-
afterTokens: result.afterTokens,
|
|
476
|
-
plan: result.plan,
|
|
477
|
-
semanticSummary: result.semanticSummary,
|
|
478
|
-
diagnostics: result.diagnostics,
|
|
479
|
-
},
|
|
480
|
-
});
|
|
481
|
-
for (const type of [
|
|
482
|
-
'compact_validate',
|
|
483
|
-
'compact_commit',
|
|
484
|
-
'compact_boundary',
|
|
485
|
-
'compact_completed',
|
|
486
|
-
]) {
|
|
487
|
-
(0, session_storage_1.appendSessionTraceEvent)(session.id, {
|
|
488
|
-
turnId: traceTurnId,
|
|
489
|
-
type,
|
|
490
|
-
checkpointId: checkpoint.checkpointId,
|
|
491
|
-
success: true,
|
|
492
|
-
...traceDetails,
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
this.options.store.setState({ conversationHistory: checkpoint.modelHistory });
|
|
352
|
+
this.options.store.setState({ conversationHistory: history });
|
|
496
353
|
this.options.store.setContextUsage(afterUsage);
|
|
497
|
-
return
|
|
498
|
-
status: 'committed',
|
|
499
|
-
afterTokens: checkpoint.candidateReceipt.afterTokens,
|
|
500
|
-
candidateFingerprint: checkpoint.candidateReceipt.candidateFingerprint,
|
|
501
|
-
};
|
|
354
|
+
return receipt;
|
|
502
355
|
}
|
|
503
356
|
}
|
|
504
357
|
exports.SessionComposerControlServiceV1 = SessionComposerControlServiceV1;
|
|
@@ -510,10 +363,6 @@ function copySessionPreferences(target, source) {
|
|
|
510
363
|
delete target.effortPreference;
|
|
511
364
|
else
|
|
512
365
|
target.effortPreference = source.effortPreference;
|
|
513
|
-
if (source.toolConfirmationOverride === undefined)
|
|
514
|
-
delete target.toolConfirmationOverride;
|
|
515
|
-
else
|
|
516
|
-
target.toolConfirmationOverride = source.toolConfirmationOverride;
|
|
517
366
|
}
|
|
518
367
|
function restoreSessionObject(target, source) {
|
|
519
368
|
target.model = source.model;
|
|
@@ -521,16 +370,5 @@ function restoreSessionObject(target, source) {
|
|
|
521
370
|
delete target.effortPreference;
|
|
522
371
|
else
|
|
523
372
|
target.effortPreference = source.effortPreference;
|
|
524
|
-
if (source.toolConfirmationOverride === undefined)
|
|
525
|
-
delete target.toolConfirmationOverride;
|
|
526
|
-
else
|
|
527
|
-
target.toolConfirmationOverride = source.toolConfirmationOverride;
|
|
528
|
-
}
|
|
529
|
-
function providerCredentialAvailable(apiKey) {
|
|
530
|
-
if (!apiKey.trim())
|
|
531
|
-
return false;
|
|
532
|
-
if (!apiKey.startsWith('$'))
|
|
533
|
-
return true;
|
|
534
|
-
return Boolean(process.env[apiKey.slice(1)]?.trim());
|
|
535
373
|
}
|
|
536
374
|
//# sourceMappingURL=session-composer-control.js.map
|
|
@@ -7,6 +7,7 @@ export interface ModelSnapshotV1 {
|
|
|
7
7
|
readonly modelId: string;
|
|
8
8
|
readonly protocol: string;
|
|
9
9
|
readonly contextWindow: number;
|
|
10
|
+
readonly maxOutputTokens?: number;
|
|
10
11
|
}
|
|
11
12
|
export interface AuthoritySnapshotV1 {
|
|
12
13
|
readonly authorityId: string;
|
|
@@ -154,11 +155,13 @@ export interface BoundToolExecutionResultV1 {
|
|
|
154
155
|
readonly terminal: 'completed' | 'failed' | 'interrupted' | 'indeterminate';
|
|
155
156
|
readonly result: ToolResult;
|
|
156
157
|
readonly durationMs: number;
|
|
158
|
+
readonly verificationWorkspace?: string | null;
|
|
157
159
|
}
|
|
158
160
|
/** The only runtime primitive allowed to call a frozen concrete tool executor. */
|
|
159
161
|
export declare class ExecutionService {
|
|
160
162
|
private readonly workspaceMutations?;
|
|
161
|
-
|
|
163
|
+
private readonly captureVerificationWorkspace?;
|
|
164
|
+
constructor(workspaceMutations?: WorkspaceMutationCoordinatorV1 | undefined, captureVerificationWorkspace?: (() => string | null) | undefined);
|
|
162
165
|
run(request: BoundToolExecutionRequestV1): Promise<BoundToolExecutionResultV1>;
|
|
163
166
|
}
|
|
164
167
|
export interface StepSnapshotV1 {
|
|
@@ -5,6 +5,7 @@ exports.captureStepSnapshotV1 = captureStepSnapshotV1;
|
|
|
5
5
|
exports.createCapabilityPlanV1 = createCapabilityPlanV1;
|
|
6
6
|
exports.createAuthoritySnapshotV1 = createAuthoritySnapshotV1;
|
|
7
7
|
exports.createExecutionPolicySnapshotV1 = createExecutionPolicySnapshotV1;
|
|
8
|
+
const verification_command_1 = require("../framework/verification-command");
|
|
8
9
|
const tool_artifacts_1 = require("../core/tool-artifacts");
|
|
9
10
|
const canonical_1 = require("./protocol/canonical");
|
|
10
11
|
const runtime_protocol_v1_1 = require("./protocol/runtime-protocol-v1");
|
|
@@ -105,8 +106,9 @@ class ToolRouterSnapshotV1 {
|
|
|
105
106
|
exports.ToolRouterSnapshotV1 = ToolRouterSnapshotV1;
|
|
106
107
|
/** The only runtime primitive allowed to call a frozen concrete tool executor. */
|
|
107
108
|
class ExecutionService {
|
|
108
|
-
constructor(workspaceMutations) {
|
|
109
|
+
constructor(workspaceMutations, captureVerificationWorkspace) {
|
|
109
110
|
this.workspaceMutations = workspaceMutations;
|
|
111
|
+
this.captureVerificationWorkspace = captureVerificationWorkspace;
|
|
110
112
|
}
|
|
111
113
|
async run(request) {
|
|
112
114
|
const startedAt = Date.now();
|
|
@@ -147,6 +149,13 @@ class ExecutionService {
|
|
|
147
149
|
}, execute)
|
|
148
150
|
: await execute();
|
|
149
151
|
const presented = persistLargeToolOutput(request.context.cwd, request.toolName, result);
|
|
152
|
+
// Capture the completed check's actual workspace, after any
|
|
153
|
+
// test-generated files have been written and before committing its receipt.
|
|
154
|
+
const verificationWorkspace = descriptor?.executorId === 'builtin:exec_command:v1' &&
|
|
155
|
+
typeof request.args.command === 'string' &&
|
|
156
|
+
(0, verification_command_1.classifyDirectVerificationCommand)(request.args.command)
|
|
157
|
+
? this.captureVerificationWorkspace?.()
|
|
158
|
+
: undefined;
|
|
150
159
|
return {
|
|
151
160
|
terminal: timeoutController.signal.aborted
|
|
152
161
|
? 'interrupted'
|
|
@@ -155,6 +164,7 @@ class ExecutionService {
|
|
|
155
164
|
: 'failed',
|
|
156
165
|
result: presented,
|
|
157
166
|
durationMs: Date.now() - startedAt,
|
|
167
|
+
...(verificationWorkspace !== undefined ? { verificationWorkspace } : {}),
|
|
158
168
|
};
|
|
159
169
|
}
|
|
160
170
|
catch (error) {
|
|
@@ -286,16 +286,19 @@ class SubagentThreadRuntimeV1 {
|
|
|
286
286
|
}
|
|
287
287
|
const projection = store.loadProjection();
|
|
288
288
|
const turn = projection.turns[admission.turnId];
|
|
289
|
-
if (budget.failure)
|
|
290
|
-
throw budget.failure;
|
|
291
289
|
if (!turn || turn.status === 'active' || !turn.commit) {
|
|
290
|
+
if (budget.failure)
|
|
291
|
+
throw budget.failure;
|
|
292
292
|
throw new SubagentThreadRuntimeError('ORION_SUBAGENT_CHILD_COMMIT_MISSING', 'Child AgentLoop did not durably publish a terminal TurnCommitV1.');
|
|
293
293
|
}
|
|
294
294
|
const childCommit = (0, turn_commit_1.parseTurnCommitV1)(turn.commit.receipt);
|
|
295
295
|
assertIndependentStepSnapshots(parent.stepSnapshotDigest, childCommit, turn.status);
|
|
296
296
|
const usage = budget.snapshot();
|
|
297
|
-
const
|
|
298
|
-
const
|
|
297
|
+
const budgetFailure = turn.status === 'interrupted' ? undefined : budget.failure;
|
|
298
|
+
const stopDecision = childStopDecision(childCommit, turn.status, usage, budget.limits, parent, budgetFailure);
|
|
299
|
+
const summary = budgetFailure
|
|
300
|
+
? truncateUtf8(budgetFailure.message, this.options.maxSummaryBytes)
|
|
301
|
+
: boundedChildSummary(projection, admission.turnId, childCommit, this.options.maxSummaryBytes);
|
|
299
302
|
const evidenceItems = boundedEvidence(evidence.snapshot(), childCommit, this.options.maxEvidenceItems, this.options.maxEvidenceBytes);
|
|
300
303
|
const receipt = createSubagentThreadReceiptV1({
|
|
301
304
|
receiptId: (0, runtime_protocol_v1_1.createRuntimeId)(),
|
|
@@ -695,7 +698,7 @@ function assertIndependentStepSnapshots(parentStepSnapshotDigest, child, termina
|
|
|
695
698
|
throw new SubagentThreadRuntimeError('ORION_SUBAGENT_CHILD_SNAPSHOT_INVALID', 'Child StepSnapshotV1 aliases a parent snapshot digest.');
|
|
696
699
|
}
|
|
697
700
|
}
|
|
698
|
-
function childStopDecision(commit, terminal, usage, limits, parent) {
|
|
701
|
+
function childStopDecision(commit, terminal, usage, limits, parent, budgetFailure) {
|
|
699
702
|
const parsed = parseStopDecision(commit);
|
|
700
703
|
const status = terminal === 'interrupted' ? 'cancelled' : terminal === 'failed' ? 'failed' : 'completed';
|
|
701
704
|
const base = parsed ??
|
|
@@ -718,8 +721,27 @@ function childStopDecision(commit, terminal, usage, limits, parent) {
|
|
|
718
721
|
return (0, stop_decision_1.createStopDecision)({
|
|
719
722
|
...base,
|
|
720
723
|
scope: 'subagent',
|
|
724
|
+
...(budgetFailure
|
|
725
|
+
? {
|
|
726
|
+
status: 'stopped',
|
|
727
|
+
disposition: 'resume_allowed',
|
|
728
|
+
reason: { code: 'subagent_budget_exceeded', message: budgetFailure.message },
|
|
729
|
+
nextActions: [
|
|
730
|
+
{ kind: 'retry', label: 'Inspect the child budget before retrying.' },
|
|
731
|
+
],
|
|
732
|
+
}
|
|
733
|
+
: {}),
|
|
721
734
|
evidence: [
|
|
722
735
|
...base.evidence,
|
|
736
|
+
...(budgetFailure
|
|
737
|
+
? [
|
|
738
|
+
{
|
|
739
|
+
kind: 'resource_limit',
|
|
740
|
+
source: 'subagent-lease',
|
|
741
|
+
detail: budgetFailure.message,
|
|
742
|
+
},
|
|
743
|
+
]
|
|
744
|
+
: []),
|
|
723
745
|
{
|
|
724
746
|
kind: 'runtime',
|
|
725
747
|
source: 'subagent-thread-runtime',
|
|
@@ -169,7 +169,6 @@ function clampSubagentConfig(config) {
|
|
|
169
169
|
mode,
|
|
170
170
|
maxParallel: clamp(config.maxParallel, types_1.SUBAGENT_LIMITS.maxParallel),
|
|
171
171
|
maxTasksPerTurn: clamp(config.maxTasksPerTurn, types_1.SUBAGENT_LIMITS.maxTasksPerTurn),
|
|
172
|
-
maxTurnsPerTask: clamp(config.maxTurnsPerTask, types_1.SUBAGENT_LIMITS.maxTurnsPerTask),
|
|
173
172
|
maxModelRequestsPerTask: clamp(config.maxModelRequestsPerTask, types_1.SUBAGENT_LIMITS.maxModelRequestsPerTask),
|
|
174
173
|
maxModelRequestsPerTurn: clamp(config.maxModelRequestsPerTurn, types_1.SUBAGENT_LIMITS.maxModelRequestsPerTurn),
|
|
175
174
|
maxToolCallsPerTask: clamp(config.maxToolCallsPerTask, types_1.SUBAGENT_LIMITS.maxToolCallsPerTask),
|
|
@@ -281,10 +281,6 @@ class ProductionSubagentRuntimeV1 {
|
|
|
281
281
|
gateway,
|
|
282
282
|
loadBaseMessages: () => baseMessages.map(message => ({ ...message })),
|
|
283
283
|
toolContext: () => context,
|
|
284
|
-
loopBudget: {
|
|
285
|
-
maxLlmRequestsPerUserTurn: input.budget.limits.maxModelRequests,
|
|
286
|
-
maxToolCallsPerUserTurn: input.budget.limits.maxToolCalls,
|
|
287
|
-
},
|
|
288
284
|
commitTurn: commit => commitAgentLoopTurn(turnCommits, commit),
|
|
289
285
|
});
|
|
290
286
|
return new CommitCompletingChildRunnerV1(agentLoop, input, taskContext, turnCommits, baseMessages);
|
|
@@ -374,7 +370,7 @@ function commitAgentLoopTurn(commits, commit) {
|
|
|
374
370
|
}
|
|
375
371
|
function terminalFromAgentCommit(commit) {
|
|
376
372
|
const finishReason = commit.queryComplete.stats?.finishReason;
|
|
377
|
-
if (
|
|
373
|
+
if ((0, agent_loop_1.isFailedLoopStats)(commit.queryComplete.stats)) {
|
|
378
374
|
return { status: 'failed', error: commit.queryComplete.content || 'Child AgentLoop failed.' };
|
|
379
375
|
}
|
|
380
376
|
if (finishReason === 'cancelled') {
|
|
@@ -13,6 +13,7 @@ exports.createSubagentBundleForTurn = createSubagentBundleForTurn;
|
|
|
13
13
|
exports.createSubagentToolForTurn = createSubagentToolForTurn;
|
|
14
14
|
exports.deriveRootLlmConfig = deriveRootLlmConfig;
|
|
15
15
|
const model_registry_1 = require("../../services/model-registry");
|
|
16
|
+
const model_client_pool_1 = require("../../services/model-client-pool");
|
|
16
17
|
const budget_1 = require("./budget");
|
|
17
18
|
const provider_gate_1 = require("./provider-gate");
|
|
18
19
|
const supervisor_1 = require("./supervisor");
|
|
@@ -91,11 +92,8 @@ function deriveRootLlmConfig(config, selector) {
|
|
|
91
92
|
: undefined;
|
|
92
93
|
const provider = profile ? registry?.providers.get(profile.provider) : undefined;
|
|
93
94
|
if (profile && provider) {
|
|
94
|
-
const apiKey = provider.apiKey.startsWith('$')
|
|
95
|
-
? (process.env[provider.apiKey.slice(1)] ?? '')
|
|
96
|
-
: provider.apiKey;
|
|
97
95
|
return {
|
|
98
|
-
apiKey,
|
|
96
|
+
apiKey: (0, model_client_pool_1.resolveProviderCredential)(provider.apiKey).apiKey,
|
|
99
97
|
baseUrl: provider.baseUrl,
|
|
100
98
|
model: profile.model,
|
|
101
99
|
fallbackModel: registry?.fallbackProfile?.provider === profile.provider
|
|
@@ -28,7 +28,6 @@ export interface SubagentConfig {
|
|
|
28
28
|
/** Maximum packets accepted in a single `subtask` call. */
|
|
29
29
|
maxTasksPerTurn: number;
|
|
30
30
|
/** @deprecated Compatibility input; child execution is enforced by request/tool reservations. */
|
|
31
|
-
maxTurnsPerTask: number;
|
|
32
31
|
/** Maximum model requests a single child may spend. */
|
|
33
32
|
maxModelRequestsPerTask: number;
|
|
34
33
|
/** Aggregate model requests allowed across all children in one batch. */
|
|
@@ -51,10 +50,6 @@ export declare const SUBAGENT_LIMITS: {
|
|
|
51
50
|
readonly min: 1;
|
|
52
51
|
readonly max: 3;
|
|
53
52
|
};
|
|
54
|
-
readonly maxTurnsPerTask: {
|
|
55
|
-
readonly min: 1;
|
|
56
|
-
readonly max: 12;
|
|
57
|
-
};
|
|
58
53
|
readonly maxModelRequestsPerTask: {
|
|
59
54
|
readonly min: 1;
|
|
60
55
|
readonly max: 24;
|
|
@@ -16,7 +16,6 @@ exports.DEFAULT_SUBAGENT_CONFIG = {
|
|
|
16
16
|
mode: 'auto',
|
|
17
17
|
maxParallel: 3,
|
|
18
18
|
maxTasksPerTurn: 3,
|
|
19
|
-
maxTurnsPerTask: 6,
|
|
20
19
|
maxModelRequestsPerTask: 6,
|
|
21
20
|
maxModelRequestsPerTurn: 12,
|
|
22
21
|
maxToolCallsPerTask: 24,
|
|
@@ -27,7 +26,6 @@ exports.DEFAULT_SUBAGENT_CONFIG = {
|
|
|
27
26
|
exports.SUBAGENT_LIMITS = {
|
|
28
27
|
maxParallel: { min: 1, max: 3 },
|
|
29
28
|
maxTasksPerTurn: { min: 1, max: 3 },
|
|
30
|
-
maxTurnsPerTask: { min: 1, max: 12 },
|
|
31
29
|
maxModelRequestsPerTask: { min: 1, max: 24 },
|
|
32
30
|
maxModelRequestsPerTurn: { min: 1, max: 48 },
|
|
33
31
|
maxToolCallsPerTask: { min: 1, max: 96 },
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type LocalVerificationReceipt } from '../framework/verification-command';
|
|
2
|
+
import type { HarnessProgressState, HarnessState } from '../harness/types';
|
|
3
|
+
import type { Message } from '../services/llm';
|
|
4
|
+
import type { GoalRuntimePersistedStateV2 } from './goal-runtime-coordinator';
|
|
5
|
+
import type { ToolBindingDescriptorV1 } from './step-snapshot';
|
|
6
|
+
import { type TaskContextService, type TaskContextServiceOptions } from './task-context-service';
|
|
7
|
+
import type { ThreadEventStore } from './thread-event-store';
|
|
8
|
+
import type { ToolInvocationReceiptV1 } from './tool-gateway';
|
|
9
|
+
import { type TurnCommitV1 } from './turn-commit';
|
|
10
|
+
interface TaskRecoverySeedV1 {
|
|
11
|
+
readonly priorCommitDigest: string | null;
|
|
12
|
+
readonly cwd: string;
|
|
13
|
+
readonly revision: number;
|
|
14
|
+
readonly state: HarnessState;
|
|
15
|
+
readonly progressAtAdmission: HarnessProgressState;
|
|
16
|
+
}
|
|
17
|
+
/** Runtime-supplied intent data. Never stores the write body or arbitrary tool arguments. */
|
|
18
|
+
export interface TaskToolRecoveryBindingV1 {
|
|
19
|
+
readonly version: 1;
|
|
20
|
+
readonly seedDigest: string;
|
|
21
|
+
readonly seed?: TaskRecoverySeedV1;
|
|
22
|
+
readonly taskContractId: string | null;
|
|
23
|
+
readonly taskEpoch: number;
|
|
24
|
+
readonly activeTodoId?: string;
|
|
25
|
+
readonly readOnly: boolean;
|
|
26
|
+
readonly workspaceWrite?: true;
|
|
27
|
+
readonly args: Readonly<{
|
|
28
|
+
path?: string;
|
|
29
|
+
command?: string;
|
|
30
|
+
cwd?: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createTaskRecoveryBinder(taskContext: TaskContextService, previousCommitDigest: () => string | undefined, progressAtAdmission: HarnessProgressState): (input: {
|
|
34
|
+
readonly descriptor?: ToolBindingDescriptorV1;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly args: Record<string, unknown>;
|
|
37
|
+
readonly cwd: string;
|
|
38
|
+
readonly activeTodoId?: string;
|
|
39
|
+
}) => TaskToolRecoveryBindingV1 | undefined;
|
|
40
|
+
/** Derive evidence from the executor's committed outcome, not its display text. */
|
|
41
|
+
export declare function projectTaskToolEvidence(receipt: ToolInvocationReceiptV1, args: Readonly<Record<string, unknown>>, cwd: string): {
|
|
42
|
+
changedFile?: string;
|
|
43
|
+
verification?: LocalVerificationReceipt;
|
|
44
|
+
};
|
|
45
|
+
export declare function recordTaskTodoToolReceipt(taskContext: TaskContextService, todo: string | undefined, receipt: ToolInvocationReceiptV1, { changedFile, verification }: ReturnType<typeof projectTaskToolEvidence>): void;
|
|
46
|
+
/** Restore already-made effects. This never dispatches a model request or reexecutes a tool. */
|
|
47
|
+
export declare function recoverInterruptedTaskContext(input: {
|
|
48
|
+
readonly store: ThreadEventStore;
|
|
49
|
+
readonly previousCommit?: TurnCommitV1;
|
|
50
|
+
readonly taskOptions: TaskContextServiceOptions;
|
|
51
|
+
readonly loadImportedHistory?: () => readonly Message[];
|
|
52
|
+
readonly restoreGoalState: () => GoalRuntimePersistedStateV2 | undefined;
|
|
53
|
+
}): TurnCommitV1 | undefined;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=task-context-recovery.d.ts.map
|