@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
|
@@ -6,6 +6,7 @@ exports.createStaticApprovalDecisionV1 = createStaticApprovalDecisionV1;
|
|
|
6
6
|
exports.createSandboxPreparationV1 = createSandboxPreparationV1;
|
|
7
7
|
const canonical_1 = require("./protocol/canonical");
|
|
8
8
|
const runtime_protocol_v1_1 = require("./protocol/runtime-protocol-v1");
|
|
9
|
+
const tool_transcript_entry_1 = require("./tool-transcript-entry");
|
|
9
10
|
class ToolGatewayError extends Error {
|
|
10
11
|
constructor(code, message, invocationId) {
|
|
11
12
|
super(message);
|
|
@@ -75,6 +76,13 @@ class ToolGateway {
|
|
|
75
76
|
result: failure(`Tool is not direct in this StepSnapshot: ${invocation.toolName}`),
|
|
76
77
|
});
|
|
77
78
|
}
|
|
79
|
+
if (invocation.prerequisiteFailure) {
|
|
80
|
+
return this.commitTerminal(invocation, intent, {
|
|
81
|
+
terminal: 'failed',
|
|
82
|
+
terminalPhase: 'policy',
|
|
83
|
+
result: failure(invocation.prerequisiteFailure),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
78
86
|
let policy;
|
|
79
87
|
try {
|
|
80
88
|
policy = validatePolicyDecision(await this.services.policy.decide({
|
|
@@ -102,6 +110,7 @@ class ToolGateway {
|
|
|
102
110
|
if (policy.behavior === 'ask') {
|
|
103
111
|
try {
|
|
104
112
|
approval = validateApprovalDecision(await this.services.approval.decide({
|
|
113
|
+
invocationId: invocation.invocationId,
|
|
105
114
|
snapshot: invocation.snapshot,
|
|
106
115
|
descriptor,
|
|
107
116
|
args: invocation.args,
|
|
@@ -188,6 +197,7 @@ class ToolGateway {
|
|
|
188
197
|
terminalPhase: 'execute',
|
|
189
198
|
result: executed.result,
|
|
190
199
|
durationMs: executed.durationMs,
|
|
200
|
+
verificationWorkspace: executed.verificationWorkspace,
|
|
191
201
|
});
|
|
192
202
|
}
|
|
193
203
|
async commitTerminal(invocation, intent, outcome) {
|
|
@@ -213,6 +223,9 @@ class ToolGateway {
|
|
|
213
223
|
success: outcome.terminal === 'completed' && outcome.result.success,
|
|
214
224
|
result: structuredClone(outcome.result),
|
|
215
225
|
outputDigest: (0, canonical_1.digestRuntimeValue)(outcome.result),
|
|
226
|
+
...(outcome.verificationWorkspace !== undefined
|
|
227
|
+
? { verificationWorkspace: outcome.verificationWorkspace }
|
|
228
|
+
: {}),
|
|
216
229
|
startedAt: intent.startedAt,
|
|
217
230
|
finishedAt,
|
|
218
231
|
durationMs: outcome.durationMs ?? Math.max(0, finishedAt - intent.startedAt),
|
|
@@ -274,10 +287,19 @@ function computeRequestDigest(invocation) {
|
|
|
274
287
|
toolName: invocation.toolName,
|
|
275
288
|
snapshotDigest: invocation.snapshot.digest,
|
|
276
289
|
argsDigest: (0, canonical_1.digestRuntimeValue)(invocation.args),
|
|
290
|
+
...(invocation.taskRecovery
|
|
291
|
+
? { taskRecoveryDigest: (0, canonical_1.digestRuntimeValue)(invocation.taskRecovery) }
|
|
292
|
+
: {}),
|
|
293
|
+
...(invocation.prerequisiteFailure
|
|
294
|
+
? { prerequisiteFailure: invocation.prerequisiteFailure }
|
|
295
|
+
: {}),
|
|
277
296
|
});
|
|
278
297
|
}
|
|
279
298
|
function createIntent(invocation, startedAt) {
|
|
280
299
|
const requestDigest = computeRequestDigest(invocation);
|
|
300
|
+
const displayCommand = invocation.toolName === 'exec_command'
|
|
301
|
+
? (0, tool_transcript_entry_1.toolCommandForDisplay)(invocation.args.command)
|
|
302
|
+
: undefined;
|
|
281
303
|
const content = {
|
|
282
304
|
version: 1,
|
|
283
305
|
invocationId: invocation.invocationId,
|
|
@@ -289,6 +311,8 @@ function createIntent(invocation, startedAt) {
|
|
|
289
311
|
snapshotDigest: invocation.snapshot.digest,
|
|
290
312
|
argsDigest: (0, canonical_1.digestRuntimeValue)(invocation.args),
|
|
291
313
|
requestDigest,
|
|
314
|
+
...(displayCommand ? { displayCommand } : {}),
|
|
315
|
+
...(invocation.taskRecovery ? { taskRecovery: invocation.taskRecovery } : {}),
|
|
292
316
|
startedAt,
|
|
293
317
|
};
|
|
294
318
|
return deepFreeze({ ...content, digest: (0, canonical_1.digestRuntimeValue)(content) });
|
|
@@ -73,6 +73,10 @@ function validateDurableToolInvocationReceiptV1(input) {
|
|
|
73
73
|
!isSha256(parsed.executionPolicyDigest) ||
|
|
74
74
|
!isSha256(parsed.intentDigest) ||
|
|
75
75
|
!isSha256(parsed.outputDigest) ||
|
|
76
|
+
(parsed.verificationWorkspace !== undefined &&
|
|
77
|
+
(parsed.toolName !== 'exec_command' ||
|
|
78
|
+
parsed.terminalPhase !== 'execute' ||
|
|
79
|
+
(parsed.verificationWorkspace !== null && !isSha256(parsed.verificationWorkspace)))) ||
|
|
76
80
|
!validToolResult(parsed.result) ||
|
|
77
81
|
(0, canonical_1.digestRuntimeValue)(parsed.result) !== parsed.outputDigest ||
|
|
78
82
|
parsed.success !== (parsed.terminal === 'completed' && parsed.result.success) ||
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TranscriptAppendEntry } from './ui-events';
|
|
2
|
+
/** Bounded display text only. Credential-bearing invocations retain the tool name. */
|
|
3
|
+
export declare function toolCommandForDisplay(command: unknown): string | undefined;
|
|
4
|
+
/** Read the optional display label in a durable intent; older records have none. */
|
|
5
|
+
export declare function toolCommandFromIntent(intent: string | undefined): string | undefined;
|
|
6
|
+
export declare function isToolTranscriptItem(kind: string): boolean;
|
|
7
|
+
/** A bounded transcript row. Tool details and output stay on their existing surfaces. */
|
|
8
|
+
export declare function toolTranscriptEntry(input: {
|
|
9
|
+
callId: string;
|
|
10
|
+
sequence: number;
|
|
11
|
+
name: string;
|
|
12
|
+
success: boolean;
|
|
13
|
+
command?: string;
|
|
14
|
+
output?: string;
|
|
15
|
+
}): TranscriptAppendEntry;
|
|
16
|
+
//# sourceMappingURL=tool-transcript-entry.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolCommandForDisplay = toolCommandForDisplay;
|
|
4
|
+
exports.toolCommandFromIntent = toolCommandFromIntent;
|
|
5
|
+
exports.isToolTranscriptItem = isToolTranscriptItem;
|
|
6
|
+
exports.toolTranscriptEntry = toolTranscriptEntry;
|
|
7
|
+
const redaction_1 = require("../services/redaction");
|
|
8
|
+
const style_1 = require("../tui-core/style");
|
|
9
|
+
const SENSITIVE_COMMAND_ARGUMENT = /(?:^|\s)--(?:password|passphrase|token|api[-_]?key|secret|authorization|cookie|credentials?)(?:[=\s]|$)/iu;
|
|
10
|
+
/** Bounded display text only. Credential-bearing invocations retain the tool name. */
|
|
11
|
+
function toolCommandForDisplay(command) {
|
|
12
|
+
if (typeof command !== 'string')
|
|
13
|
+
return undefined;
|
|
14
|
+
const clean = (0, style_1.sanitizeTerminalText)(command).replace(/\n/gu, ' ⏎ ').trim();
|
|
15
|
+
if (!clean ||
|
|
16
|
+
SENSITIVE_COMMAND_ARGUMENT.test(clean) ||
|
|
17
|
+
(0, redaction_1.redactTraceText)(clean) !== clean ||
|
|
18
|
+
clean.split(/[\s"'<>|;]+/u).some(redaction_1.isSensitiveFilePath)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return clipDisplayText(clean, 160);
|
|
22
|
+
}
|
|
23
|
+
/** Read the optional display label in a durable intent; older records have none. */
|
|
24
|
+
function toolCommandFromIntent(intent) {
|
|
25
|
+
if (!intent)
|
|
26
|
+
return undefined;
|
|
27
|
+
try {
|
|
28
|
+
const record = JSON.parse(intent);
|
|
29
|
+
return record?.toolName === 'exec_command'
|
|
30
|
+
? toolCommandForDisplay(record.displayCommand)
|
|
31
|
+
: undefined;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function isToolTranscriptItem(kind) {
|
|
38
|
+
return kind === 'command' || kind === 'file_change' || kind === 'mcp';
|
|
39
|
+
}
|
|
40
|
+
/** A bounded transcript row. Tool details and output stay on their existing surfaces. */
|
|
41
|
+
function toolTranscriptEntry(input) {
|
|
42
|
+
const name = /^[A-Za-z0-9_.:/-]{1,120}$/u.test(input.name) ? input.name : 'tool';
|
|
43
|
+
const command = toolCommandForDisplay(input.command);
|
|
44
|
+
const lines = command && input.output
|
|
45
|
+
? (0, style_1.sanitizeTerminalText)((0, redaction_1.redactTraceText)(input.output))
|
|
46
|
+
.split('\n')
|
|
47
|
+
.filter(line => line.trim())
|
|
48
|
+
: [];
|
|
49
|
+
// Prefer the final lines, where test runners usually print their verdict.
|
|
50
|
+
const body = lines
|
|
51
|
+
.slice(-2)
|
|
52
|
+
.map(line => clipDisplayText(line, 120))
|
|
53
|
+
.join('\n');
|
|
54
|
+
return {
|
|
55
|
+
role: 'tool',
|
|
56
|
+
title: name,
|
|
57
|
+
content: `${input.success ? 'Completed' : 'Failed'} ${name}`,
|
|
58
|
+
toolActivity: {
|
|
59
|
+
name,
|
|
60
|
+
state: input.success ? 'success' : 'error',
|
|
61
|
+
detail: '',
|
|
62
|
+
...(command ? { command } : {}),
|
|
63
|
+
body,
|
|
64
|
+
callId: input.callId,
|
|
65
|
+
seq: input.sequence,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function clipDisplayText(text, limit) {
|
|
70
|
+
const characters = [...text];
|
|
71
|
+
return characters.length > limit ? `${characters.slice(0, limit - 1).join('')}…` : text;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=tool-transcript-entry.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Message } from '../services/llm';
|
|
2
2
|
import type { HarnessState } from '../harness/types';
|
|
3
3
|
import type { StopDecision } from '../framework/stop-decision';
|
|
4
|
-
import { ThreadEventStore } from './thread-event-store';
|
|
4
|
+
import { ThreadEventStore, type AppendRuntimeEventV1 } from './thread-event-store';
|
|
5
5
|
export type TurnCommitTerminalV1 = {
|
|
6
6
|
readonly status: 'completed';
|
|
7
7
|
readonly outcome?: string;
|
|
@@ -96,6 +96,9 @@ export declare class ThreadTurnCommitJournalV1 {
|
|
|
96
96
|
constructor(store: ThreadEventStore, clock?: () => number);
|
|
97
97
|
commit(input: ThreadTurnCommitInputV1): TurnCommitV1;
|
|
98
98
|
}
|
|
99
|
+
export declare function turnCommitEventV1(commit: TurnCommitV1): AppendRuntimeEventV1<Extract<import('./protocol/runtime-protocol-v1').RuntimeEventV1, {
|
|
100
|
+
type: 'turn.committed';
|
|
101
|
+
}>>;
|
|
99
102
|
export declare function createTurnCommitV1(input: Omit<TurnCommitV1, 'version' | 'terminal' | 'history' | 'historyDigest' | 'taskContext' | 'taskContextDigest' | 'goalState' | 'goalStateDigest' | 'compactPointer' | 'compactPointerDigest' | 'stopDecision' | 'stopDecisionDigest' | 'planReceipt' | 'planReceiptDigest' | 'digest'> & Pick<ThreadTurnCommitInputV1, 'history' | 'taskContextState' | 'goalState' | 'compactPointer' | 'stopDecision' | 'plan' | 'terminal'>): TurnCommitV1;
|
|
100
103
|
export declare function parseTurnCommitV1(receipt: string): TurnCommitV1;
|
|
101
104
|
export declare function createPlanReceiptV1(input: Omit<PlanReceiptV1, 'version' | 'planDigest' | 'digest'>): PlanReceiptV1;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ThreadTurnCommitJournalV1 = exports.TurnCommitError = void 0;
|
|
4
|
+
exports.turnCommitEventV1 = turnCommitEventV1;
|
|
4
5
|
exports.createTurnCommitV1 = createTurnCommitV1;
|
|
5
6
|
exports.parseTurnCommitV1 = parseTurnCommitV1;
|
|
6
7
|
exports.createPlanReceiptV1 = createPlanReceiptV1;
|
|
@@ -74,25 +75,28 @@ class ThreadTurnCommitJournalV1 {
|
|
|
74
75
|
return existing;
|
|
75
76
|
throw new TurnCommitError('ORION_TURN_COMMIT_CONFLICT', `Turn ${input.turnId} already has a different durable commit`);
|
|
76
77
|
}
|
|
77
|
-
this.store.appendDurable(
|
|
78
|
-
turnId: input.turnId,
|
|
79
|
-
payload: {
|
|
80
|
-
type: 'turn.committed',
|
|
81
|
-
data: {
|
|
82
|
-
commitId: commit.commitId,
|
|
83
|
-
terminal: commit.terminal,
|
|
84
|
-
digest: commit.digest,
|
|
85
|
-
receipt: (0, canonical_1.canonicalRuntimeJson)(commit),
|
|
86
|
-
...(commit.outcome === undefined ? {} : { outcome: commit.outcome }),
|
|
87
|
-
...(commit.error === undefined ? {} : { error: commit.error }),
|
|
88
|
-
...(commit.reason === undefined ? {} : { reason: commit.reason }),
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
});
|
|
78
|
+
this.store.appendDurable(turnCommitEventV1(commit));
|
|
92
79
|
return commit;
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
82
|
exports.ThreadTurnCommitJournalV1 = ThreadTurnCommitJournalV1;
|
|
83
|
+
function turnCommitEventV1(commit) {
|
|
84
|
+
return {
|
|
85
|
+
turnId: commit.turnId,
|
|
86
|
+
payload: {
|
|
87
|
+
type: 'turn.committed',
|
|
88
|
+
data: {
|
|
89
|
+
commitId: commit.commitId,
|
|
90
|
+
terminal: commit.terminal,
|
|
91
|
+
digest: commit.digest,
|
|
92
|
+
receipt: (0, canonical_1.canonicalRuntimeJson)(commit),
|
|
93
|
+
...(commit.outcome === undefined ? {} : { outcome: commit.outcome }),
|
|
94
|
+
...(commit.error === undefined ? {} : { error: commit.error }),
|
|
95
|
+
...(commit.reason === undefined ? {} : { reason: commit.reason }),
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
96
100
|
function createTurnCommitV1(input) {
|
|
97
101
|
const history = (0, canonical_1.canonicalRuntimeJson)(input.history);
|
|
98
102
|
const taskContext = (0, canonical_1.canonicalRuntimeJson)(input.taskContextState);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { FollowupQueueStore } from './followup-queue-store';
|
|
1
2
|
import type { Store } from '../framework/store';
|
|
2
3
|
import type { LoopContinuationAction, LoopStats } from '../framework/query';
|
|
4
|
+
import type { StopNextAction } from '../framework/stop-decision';
|
|
3
5
|
import type { LLMService } from '../services/llm';
|
|
4
6
|
import type { CompactCoordinator } from '../services/compact';
|
|
5
7
|
import type { ModelCoordinator } from './model-coordinator';
|
|
@@ -94,8 +96,9 @@ export interface TranscriptEntry {
|
|
|
94
96
|
}
|
|
95
97
|
export interface LoopBudgetStopView {
|
|
96
98
|
schemaVersion: 1;
|
|
97
|
-
kind: 'llm_request_limit' | 'tool_call_limit' | 'provider_preflight_limit' | 'other';
|
|
99
|
+
kind: 'llm_request_limit' | 'tool_call_limit' | 'goal_token_budget' | 'goal_time_budget' | 'provider_preflight_limit' | 'other';
|
|
98
100
|
reason: string;
|
|
101
|
+
reasonCode?: string;
|
|
99
102
|
recoverable: true;
|
|
100
103
|
statePreserved: true;
|
|
101
104
|
source?: LoopStats['loopBudgetSource'];
|
|
@@ -107,12 +110,18 @@ export interface LoopBudgetStopView {
|
|
|
107
110
|
current: number;
|
|
108
111
|
maximum?: number;
|
|
109
112
|
};
|
|
113
|
+
modelVisibleToolBytes?: {
|
|
114
|
+
current: number;
|
|
115
|
+
maximum?: number;
|
|
116
|
+
};
|
|
117
|
+
baseLlmRequestLimit?: number;
|
|
110
118
|
stopPoint?: {
|
|
111
119
|
tool: string;
|
|
112
120
|
summary?: string;
|
|
113
121
|
success?: boolean;
|
|
114
122
|
};
|
|
115
123
|
actions: LoopContinuationAction[];
|
|
124
|
+
nextActions?: StopNextAction[];
|
|
116
125
|
}
|
|
117
126
|
export interface TranscriptAppendEntry extends Omit<TranscriptEntry, 'id'> {
|
|
118
127
|
live?: boolean;
|
|
@@ -179,6 +188,8 @@ export interface RuntimeToolStartedEvent {
|
|
|
179
188
|
callId: string;
|
|
180
189
|
name: string;
|
|
181
190
|
args: Record<string, unknown>;
|
|
191
|
+
/** Bounded, terminal-safe command label. */
|
|
192
|
+
command?: string;
|
|
182
193
|
/** Monotonic tool invocation sequence across the session (1-based). */
|
|
183
194
|
sequence: number;
|
|
184
195
|
batchCount?: number;
|
|
@@ -188,6 +199,8 @@ export interface RuntimeToolFinishedEvent {
|
|
|
188
199
|
callId: string;
|
|
189
200
|
name: string;
|
|
190
201
|
args: Record<string, unknown>;
|
|
202
|
+
/** Bounded, terminal-safe command label. */
|
|
203
|
+
command?: string;
|
|
191
204
|
success: boolean;
|
|
192
205
|
skipped?: boolean;
|
|
193
206
|
duration: number;
|
|
@@ -279,6 +292,7 @@ export interface OrionCodeUiRuntime extends RuntimeSessionAccessors {
|
|
|
279
292
|
store: Store;
|
|
280
293
|
llm: LLMService | null;
|
|
281
294
|
compactCoordinator?: CompactCoordinator;
|
|
295
|
+
followupQueueStore?: FollowupQueueStore;
|
|
282
296
|
modelCoordinator?: ModelCoordinator;
|
|
283
297
|
/** Sole Session-scoped mode/model/effort/permission control authority. */
|
|
284
298
|
sessionComposerControls?: SessionComposerControlServiceV1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type EditPreviewRequest, type ErrorLayer, type LoopBudgetStopView, type ResolvedUiRendererCapabilities, type RuntimeLoopStats, type RuntimeSessionRestoredEvent, type SessionPickerRequest, type StructuredToolActivity, type ToolPermissionRequest, type TranscriptEntry, type TranscriptRole, type UiRendererCapabilities } from './ui-events';
|
|
2
2
|
import type { CommandCategory, SlashCommand } from '../commands/types';
|
|
3
3
|
import type { ContextUsageSnapshot } from '../services/model-context';
|
|
4
|
+
import type { BackgroundCompactStatus } from '../services/compact/background-candidate';
|
|
4
5
|
import type { EffortLevel, EffortPreference } from '../services/effort';
|
|
5
|
-
import type { ToolPermissionScope } from '../services/tool-allowlist';
|
|
6
6
|
import type { ResearchLifecycleEvent, ResearchLifecycleSummary, ResearchStage } from './subagents/research-renderer';
|
|
7
7
|
export type BudgetStopLocale = 'en' | 'zh-CN';
|
|
8
8
|
/** Build the renderer-neutral recovery card for a recoverable loop-budget stop. */
|
|
@@ -130,6 +130,7 @@ export interface StatusSnapshot {
|
|
|
130
130
|
};
|
|
131
131
|
costUsd?: number;
|
|
132
132
|
context?: ContextUsageSnapshot;
|
|
133
|
+
backgroundCompact?: BackgroundCompactStatus;
|
|
133
134
|
runningState?: string;
|
|
134
135
|
permissionMode?: string;
|
|
135
136
|
loop?: Pick<RuntimeLoopStats, 'llmRequests' | 'toolCalls' | 'finishReason' | 'budgetExceededReason' | 'localFastPathUsed'>;
|
|
@@ -141,6 +142,7 @@ export interface StatusSnapshot {
|
|
|
141
142
|
};
|
|
142
143
|
}
|
|
143
144
|
export declare function contextUsageStatusText(usage: ContextUsageSnapshot | null | undefined): string;
|
|
145
|
+
export declare function backgroundCompactStatusText(status?: BackgroundCompactStatus): string;
|
|
144
146
|
export interface RuntimeCapabilityTool {
|
|
145
147
|
name: string;
|
|
146
148
|
}
|
|
@@ -229,13 +231,13 @@ export interface FilePickerItem {
|
|
|
229
231
|
description: string;
|
|
230
232
|
isDirectory: boolean;
|
|
231
233
|
}
|
|
232
|
-
export type PermissionDecisionValue = 'allow-once' | '
|
|
234
|
+
export type PermissionDecisionValue = 'allow-once' | 'deny';
|
|
233
235
|
export interface PermissionDecisionItem {
|
|
234
236
|
value: PermissionDecisionValue;
|
|
235
237
|
label: string;
|
|
236
238
|
description: string;
|
|
237
239
|
approved: boolean;
|
|
238
|
-
scope:
|
|
240
|
+
scope: 'once';
|
|
239
241
|
}
|
|
240
242
|
export interface EditPreviewPickerItem {
|
|
241
243
|
candidate: EditPreviewRequest['candidates'][number];
|
|
@@ -322,8 +324,6 @@ export interface PermissionPromptState {
|
|
|
322
324
|
risk: PermissionRiskState;
|
|
323
325
|
options: {
|
|
324
326
|
once: string;
|
|
325
|
-
project: string;
|
|
326
|
-
global: string;
|
|
327
327
|
deny: string;
|
|
328
328
|
};
|
|
329
329
|
}
|
|
@@ -386,6 +386,7 @@ export declare function createStatusSnapshot(input?: {
|
|
|
386
386
|
tokens?: StatusSnapshot['tokens'];
|
|
387
387
|
costUsd?: number;
|
|
388
388
|
context?: ContextUsageSnapshot;
|
|
389
|
+
backgroundCompact?: BackgroundCompactStatus;
|
|
389
390
|
runningState?: string;
|
|
390
391
|
permissionMode?: string;
|
|
391
392
|
loop?: StatusSnapshot['loop'];
|
|
@@ -11,6 +11,7 @@ exports.projectResearchLifecycleEvent = projectResearchLifecycleEvent;
|
|
|
11
11
|
exports.formatResearchLifecycleEvent = formatResearchLifecycleEvent;
|
|
12
12
|
exports.researchProjectionLabel = researchProjectionLabel;
|
|
13
13
|
exports.contextUsageStatusText = contextUsageStatusText;
|
|
14
|
+
exports.backgroundCompactStatusText = backgroundCompactStatusText;
|
|
14
15
|
exports.rendererStatus = rendererStatus;
|
|
15
16
|
exports.rendererCapabilityLabels = rendererCapabilityLabels;
|
|
16
17
|
exports.createRuntimeCapabilitySummary = createRuntimeCapabilitySummary;
|
|
@@ -40,18 +41,22 @@ const ui_events_1 = require("./ui-events");
|
|
|
40
41
|
const format_1 = require("../services/format");
|
|
41
42
|
const verification_profile_1 = require("../services/verification-profile");
|
|
42
43
|
const style_1 = require("../tui-core/style");
|
|
44
|
+
const BUDGET_STOP_KINDS = new Map([
|
|
45
|
+
['llm_request_budget', 'llm_request_limit'],
|
|
46
|
+
['budget_paused_compact_pending', 'llm_request_limit'],
|
|
47
|
+
['request_safety_limit', 'llm_request_limit'],
|
|
48
|
+
['tool_call_budget', 'tool_call_limit'],
|
|
49
|
+
['goal_token_budget', 'goal_token_budget'],
|
|
50
|
+
['goal_time_budget', 'goal_time_budget'],
|
|
51
|
+
['provider_preflight_budget', 'provider_preflight_limit'],
|
|
52
|
+
]);
|
|
43
53
|
/** Build the renderer-neutral recovery card for a recoverable loop-budget stop. */
|
|
44
54
|
function createLoopBudgetStopView(stats) {
|
|
45
|
-
const
|
|
55
|
+
const decision = stats.stopDecision;
|
|
56
|
+
const reasonCode = decision?.reason.code ?? stats.budgetStopCode;
|
|
57
|
+
const reason = (0, style_1.sanitizeTerminalText)(decision?.reason.message ?? stats.budgetExceededReason ?? 'Execution budget reached', 1)
|
|
46
58
|
.replace(/\s+/gu, ' ')
|
|
47
59
|
.trim();
|
|
48
|
-
const kind = /LLM request budget/iu.test(reason)
|
|
49
|
-
? 'llm_request_limit'
|
|
50
|
-
: /tool call budget/iu.test(reason)
|
|
51
|
-
? 'tool_call_limit'
|
|
52
|
-
: /preflight|provider/iu.test(reason)
|
|
53
|
-
? 'provider_preflight_limit'
|
|
54
|
-
: 'other';
|
|
55
60
|
const tool = stats.lastToolName
|
|
56
61
|
? (0, style_1.sanitizeTerminalText)(stats.lastToolName, 1).replace(/\s+/gu, ' ').trim()
|
|
57
62
|
: '';
|
|
@@ -60,22 +65,17 @@ function createLoopBudgetStopView(stats) {
|
|
|
60
65
|
: '';
|
|
61
66
|
return {
|
|
62
67
|
schemaVersion: 1,
|
|
63
|
-
kind,
|
|
68
|
+
kind: BUDGET_STOP_KINDS.get(reasonCode ?? '') ?? 'other',
|
|
64
69
|
reason,
|
|
70
|
+
...(reasonCode ? { reasonCode } : {}),
|
|
65
71
|
recoverable: true,
|
|
66
72
|
statePreserved: true,
|
|
67
73
|
source: stats.loopBudgetSource,
|
|
68
|
-
llmRequests: {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
toolCalls: {
|
|
75
|
-
current: stats.toolCalls,
|
|
76
|
-
...(typeof stats.loopBudgetMaxToolCalls === 'number'
|
|
77
|
-
? { maximum: stats.loopBudgetMaxToolCalls }
|
|
78
|
-
: {}),
|
|
74
|
+
llmRequests: { current: decision?.resources.llmRequests?.used ?? stats.llmRequests },
|
|
75
|
+
toolCalls: { current: decision?.resources.toolCalls?.used ?? stats.toolCalls },
|
|
76
|
+
modelVisibleToolBytes: {
|
|
77
|
+
current: stats.modelVisibleToolBytes,
|
|
78
|
+
maximum: stats.loopBudgetMaxModelVisibleBytes,
|
|
79
79
|
},
|
|
80
80
|
...(tool
|
|
81
81
|
? {
|
|
@@ -88,9 +88,8 @@ function createLoopBudgetStopView(stats) {
|
|
|
88
88
|
},
|
|
89
89
|
}
|
|
90
90
|
: {}),
|
|
91
|
-
actions: stats.continuationActions
|
|
92
|
-
|
|
93
|
-
: ['reply_continue', 'narrow_instruction', 'inspect_loop_stats', 'raise_budget'],
|
|
91
|
+
actions: [...(stats.continuationActions ?? [])],
|
|
92
|
+
...(decision ? { nextActions: [...decision.nextActions] } : {}),
|
|
94
93
|
};
|
|
95
94
|
}
|
|
96
95
|
/** Select Chinese only when the current user instruction contains Han characters. */
|
|
@@ -99,29 +98,52 @@ function budgetStopLocaleForInput(input) {
|
|
|
99
98
|
}
|
|
100
99
|
/** Format every recovery action explicitly; no renderer may hide it in collapsed details. */
|
|
101
100
|
function formatLoopBudgetStopView(view, locale = 'en') {
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
const chinese = locale === 'zh-CN';
|
|
102
|
+
const goal = view.kind === 'goal_token_budget' || view.kind === 'goal_time_budget';
|
|
103
|
+
const heading = goal
|
|
104
|
+
? chinese
|
|
105
|
+
? 'Goal 已暂停'
|
|
106
|
+
: 'Goal paused'
|
|
107
|
+
: chinese
|
|
108
|
+
? '本轮已暂停'
|
|
109
|
+
: 'Turn paused';
|
|
110
|
+
const usage = chinese
|
|
111
|
+
? `${view.llmRequests.current} 次模型请求,${view.toolCalls.current} 次工具调用`
|
|
112
|
+
: `${view.llmRequests.current} model requests, ${view.toolCalls.current} tool calls`;
|
|
113
|
+
const lines = [`${heading} · ${usage}`, view.reason];
|
|
114
|
+
const visibleToolBytes = view.modelVisibleToolBytes;
|
|
115
|
+
if (visibleToolBytes) {
|
|
116
|
+
const shown = (0, format_1.formatBytes)(visibleToolBytes.current);
|
|
117
|
+
const allowance = visibleToolBytes.maximum === undefined ? '' : ` / ${(0, format_1.formatBytes)(visibleToolBytes.maximum)}`;
|
|
118
|
+
lines.push(`${chinese ? '模型可见工具输出' : 'Model-visible tool output'} ${shown}${allowance}`);
|
|
119
|
+
}
|
|
120
|
+
if (view.stopPoint) {
|
|
121
|
+
const { tool, summary } = view.stopPoint;
|
|
122
|
+
lines.push(`${chinese ? '停止位置' : 'Stopped after'} · ${tool}${summary ? ` — ${summary}` : ''}`);
|
|
123
|
+
}
|
|
124
|
+
const actions = view.nextActions?.map(action => {
|
|
125
|
+
const command = action.command ? ` · \`${action.command}\`` : '';
|
|
126
|
+
return `${action.label}${command}`;
|
|
127
|
+
}) ?? [
|
|
128
|
+
...(view.actions.includes('reply_continue') && !goal
|
|
129
|
+
? [
|
|
130
|
+
chinese
|
|
131
|
+
? '回复 `继续`,按同一目标接着执行。'
|
|
132
|
+
: 'Reply `继续` to continue the same objective.',
|
|
133
|
+
]
|
|
134
|
+
: []),
|
|
135
|
+
...(view.actions.includes('narrow_instruction')
|
|
136
|
+
? [chinese ? '给出一个更具体的下一步。' : 'Give a smaller, concrete next step.']
|
|
137
|
+
: []),
|
|
138
|
+
...(view.actions.includes('inspect_loop_stats')
|
|
139
|
+
? [
|
|
140
|
+
chinese
|
|
141
|
+
? '运行 `/usage` 查看请求与工具用量。'
|
|
142
|
+
: 'Run `/usage` to inspect request and tool usage.',
|
|
143
|
+
]
|
|
144
|
+
: []),
|
|
121
145
|
];
|
|
122
|
-
|
|
123
|
-
lines.push(`Stopped after: ${stopPoint}`);
|
|
124
|
-
lines.push('Next:', '• Reply `继续` to continue the same objective.', '• Or give a smaller, concrete next step.', '• Run `/usage` to inspect request and tool usage.', '• For intentional long work, raise `agentLoop.budget` in orion.json.');
|
|
146
|
+
lines.push(...actions.map(action => `• ${action}`));
|
|
125
147
|
return lines.join('\n');
|
|
126
148
|
}
|
|
127
149
|
/**
|
|
@@ -285,6 +307,16 @@ function contextUsageStatusText(usage) {
|
|
|
285
307
|
}
|
|
286
308
|
return label;
|
|
287
309
|
}
|
|
310
|
+
function backgroundCompactStatusText(status) {
|
|
311
|
+
if (status?.state === 'preparing') {
|
|
312
|
+
if (!status.summaryAttempts)
|
|
313
|
+
return 'Preparing compact';
|
|
314
|
+
return status.summaryResponses === undefined
|
|
315
|
+
? 'Compacting history'
|
|
316
|
+
: `Compacting history ${status.summaryResponses}/${status.summaryAttempts}`;
|
|
317
|
+
}
|
|
318
|
+
return status?.state === 'ready' ? 'Compact ready' : '';
|
|
319
|
+
}
|
|
288
320
|
const COMMAND_CATEGORY_LABELS = {
|
|
289
321
|
workflow: 'Workflow',
|
|
290
322
|
session: 'Session',
|
|
@@ -615,20 +647,6 @@ function createPermissionDecisionPickerState(request) {
|
|
|
615
647
|
approved: true,
|
|
616
648
|
scope: 'once',
|
|
617
649
|
},
|
|
618
|
-
{
|
|
619
|
-
value: 'allow-project',
|
|
620
|
-
label: 'Always allow in this project',
|
|
621
|
-
description: `Persist allow:${request.name} for this project`,
|
|
622
|
-
approved: true,
|
|
623
|
-
scope: 'project',
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
value: 'allow-global',
|
|
627
|
-
label: 'Always allow on this machine',
|
|
628
|
-
description: `Persist allow:${request.name} for all projects`,
|
|
629
|
-
approved: true,
|
|
630
|
-
scope: 'global',
|
|
631
|
-
},
|
|
632
650
|
{
|
|
633
651
|
value: 'deny',
|
|
634
652
|
label: `Deny ${request.name}`,
|
|
@@ -809,8 +827,6 @@ function createPermissionPromptState(request, cwd) {
|
|
|
809
827
|
},
|
|
810
828
|
options: {
|
|
811
829
|
once: '1=once',
|
|
812
|
-
project: '2=project',
|
|
813
|
-
global: '3=global',
|
|
814
830
|
deny: 'n=no',
|
|
815
831
|
},
|
|
816
832
|
};
|
|
@@ -867,6 +883,7 @@ function createStatusSnapshot(input = {}) {
|
|
|
867
883
|
tokens: input.tokens,
|
|
868
884
|
costUsd: input.costUsd,
|
|
869
885
|
context: input.context,
|
|
886
|
+
...(input.backgroundCompact ? { backgroundCompact: input.backgroundCompact } : {}),
|
|
870
887
|
runningState: input.runningState,
|
|
871
888
|
permissionMode: input.permissionMode,
|
|
872
889
|
loop: input.loop,
|
|
@@ -41,7 +41,6 @@ class WorkspaceRuntimeKernelV1 {
|
|
|
41
41
|
})),
|
|
42
42
|
internalDefaultModel: 'gpt-4o',
|
|
43
43
|
modelDefaultEffort: 'auto',
|
|
44
|
-
internalToolConfirmation: 'allow',
|
|
45
44
|
runtimeIdle: () => this.runtimeIdle(),
|
|
46
45
|
runtimePrepare: context => this.prepareParticipants(context),
|
|
47
46
|
runtimeApply: context => this.applyParticipants(context),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observe file identities at verification boundaries without reading file contents.
|
|
3
|
+
* Git supplies the tracked and nonignored file scope when available. Other projects
|
|
4
|
+
* use the same filesystem walk without a Git filter.
|
|
5
|
+
*/
|
|
6
|
+
export declare function captureVerificationWorkspace(workspace: string, runtimeDirectories: readonly string[]): string | null;
|
|
7
|
+
//# sourceMappingURL=workspace-verification.d.ts.map
|