@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,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AgentRuntimeController = exports.FollowupQueueConflictError = void 0;
|
|
4
4
|
const async_hooks_1 = require("async_hooks");
|
|
5
|
-
const crypto_1 = require("crypto");
|
|
6
5
|
const commands_1 = require("../commands");
|
|
7
6
|
const parser_1 = require("../commands/parser");
|
|
8
7
|
const target_command_1 = require("../commands/target-command");
|
|
@@ -10,10 +9,11 @@ const agent_runtime_protocol_1 = require("./agent-runtime-protocol");
|
|
|
10
9
|
const agent_status_1 = require("./agent-status");
|
|
11
10
|
const ui_events_1 = require("./ui-events");
|
|
12
11
|
const turn_controller_1 = require("./turn-controller");
|
|
13
|
-
const tool_allowlist_1 = require("../services/tool-allowlist");
|
|
14
12
|
const agent_mode_1 = require("../framework/agent-mode");
|
|
15
13
|
const redaction_1 = require("../services/redaction");
|
|
16
14
|
const style_1 = require("../tui-core/style");
|
|
15
|
+
const followup_queue_store_1 = require("./followup-queue-store");
|
|
16
|
+
const runtime_protocol_v1_1 = require("./protocol/runtime-protocol-v1");
|
|
17
17
|
/** Item-local queue CAS failure used by Web and renderer adapters. */
|
|
18
18
|
class FollowupQueueConflictError extends Error {
|
|
19
19
|
constructor(message) {
|
|
@@ -61,12 +61,14 @@ class AgentRuntimeController {
|
|
|
61
61
|
this.goalControlRuns = new Set();
|
|
62
62
|
this.activeGoalRuntimeTransitions = 0;
|
|
63
63
|
this.goalRuntimeActive = false;
|
|
64
|
+
this.goalEventRevision = 0;
|
|
64
65
|
this.settingsBoundarySynchronizations = 0;
|
|
65
66
|
this.stopping = false;
|
|
66
67
|
this.nextPermissionRequestId = 1;
|
|
67
68
|
this.queuedCommands = [];
|
|
68
69
|
this.followupQueue = [];
|
|
69
|
-
this.
|
|
70
|
+
this.followupsPaused = false;
|
|
71
|
+
this.compacting = false;
|
|
70
72
|
this.nextFollowupId = 1;
|
|
71
73
|
if (!options.events && !options.eventSink) {
|
|
72
74
|
throw new Error('AgentRuntimeController requires either events or eventSink');
|
|
@@ -79,10 +81,11 @@ class AgentRuntimeController {
|
|
|
79
81
|
this.observeGoalRuntimeEvent(event.event);
|
|
80
82
|
const result = downstream.emit(event);
|
|
81
83
|
if (event.type === 'session_restored') {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.
|
|
84
|
+
const warning = this.runner.compactRecoveryWarning?.(event.event.sessionId);
|
|
85
|
+
if (warning) {
|
|
86
|
+
this.emitAppend({ role: 'system', title: 'compact recovery', content: warning });
|
|
85
87
|
}
|
|
88
|
+
this.loadFollowupQueue(true);
|
|
86
89
|
}
|
|
87
90
|
return result;
|
|
88
91
|
},
|
|
@@ -106,10 +109,11 @@ class AgentRuntimeController {
|
|
|
106
109
|
replayHistoryOnRestore: false,
|
|
107
110
|
}) ??
|
|
108
111
|
createUnavailableRunner();
|
|
112
|
+
this.loadFollowupQueue();
|
|
109
113
|
this.emitAgentModeSnapshot();
|
|
110
114
|
}
|
|
111
115
|
hasActiveTurn() {
|
|
112
|
-
return this.turnController.hasActiveTurn();
|
|
116
|
+
return this.compacting || Boolean(this.activeReview) || this.turnController.hasActiveTurn();
|
|
113
117
|
}
|
|
114
118
|
getFollowupQueue() {
|
|
115
119
|
return Object.freeze(this.followupQueue.map(item => projectFollowupQueueItem(item)));
|
|
@@ -120,7 +124,7 @@ class AgentRuntimeController {
|
|
|
120
124
|
getFollowupQueueSnapshot() {
|
|
121
125
|
return Object.freeze({
|
|
122
126
|
items: Object.freeze(this.followupQueue.map(item => projectFollowupQueueItem(item))),
|
|
123
|
-
limit:
|
|
127
|
+
limit: followup_queue_store_1.FOLLOWUP_QUEUE_LIMIT,
|
|
124
128
|
});
|
|
125
129
|
}
|
|
126
130
|
editFollowupQueueItem(itemId, expectedRevision, text) {
|
|
@@ -132,13 +136,17 @@ class AgentRuntimeController {
|
|
|
132
136
|
throw new FollowupQueueConflictError('The queued message changed before it was edited.');
|
|
133
137
|
}
|
|
134
138
|
const current = this.followupQueue[index];
|
|
135
|
-
|
|
139
|
+
const resolvedText = `${next}${current.contextSuffix}`;
|
|
140
|
+
if (!this.checkFollowupSize(resolvedText))
|
|
141
|
+
return { type: 'command_ignored' };
|
|
142
|
+
const items = [...this.followupQueue];
|
|
143
|
+
items[index] = {
|
|
136
144
|
...current,
|
|
137
145
|
text: next,
|
|
138
|
-
resolvedText
|
|
146
|
+
resolvedText,
|
|
139
147
|
revision: current.revision + 1,
|
|
140
148
|
};
|
|
141
|
-
this.
|
|
149
|
+
this.saveFollowupQueue(items);
|
|
142
150
|
return { type: 'followup_queue_changed' };
|
|
143
151
|
}
|
|
144
152
|
moveFollowupQueueItem(itemId, expectedRevision, targetIndex) {
|
|
@@ -149,9 +157,10 @@ class AgentRuntimeController {
|
|
|
149
157
|
throw new FollowupQueueConflictError('The queued message changed before it was moved.');
|
|
150
158
|
}
|
|
151
159
|
const bounded = Math.max(0, Math.min(this.followupQueue.length - 1, targetIndex));
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
const items = [...this.followupQueue];
|
|
161
|
+
const [item] = items.splice(index, 1);
|
|
162
|
+
items.splice(bounded, 0, { ...item, revision: item.revision + 1 });
|
|
163
|
+
this.saveFollowupQueue(items);
|
|
155
164
|
return { type: 'followup_queue_changed' };
|
|
156
165
|
}
|
|
157
166
|
removeFollowupQueueItem(itemId, expectedRevision) {
|
|
@@ -159,8 +168,7 @@ class AgentRuntimeController {
|
|
|
159
168
|
if (index < 0 || this.followupQueue[index].revision !== expectedRevision) {
|
|
160
169
|
throw new FollowupQueueConflictError('The queued message changed before it was removed.');
|
|
161
170
|
}
|
|
162
|
-
this.followupQueue.
|
|
163
|
-
this.emitFollowupQueue();
|
|
171
|
+
this.saveFollowupQueue(this.followupQueue.filter(item => item.id !== itemId));
|
|
164
172
|
return { type: 'followup_queue_changed' };
|
|
165
173
|
}
|
|
166
174
|
/**
|
|
@@ -238,8 +246,6 @@ class AgentRuntimeController {
|
|
|
238
246
|
return { type: 'exit_intent_cleared' };
|
|
239
247
|
case 'goal_control':
|
|
240
248
|
return this.startGoalControl(input);
|
|
241
|
-
case 'permission_mode_change':
|
|
242
|
-
return this.applyPermissionModeChange(input.value);
|
|
243
249
|
case 'cycle_agent_mode':
|
|
244
250
|
return this.cycleAgentMode();
|
|
245
251
|
case 'set_agent_mode':
|
|
@@ -271,39 +277,133 @@ class AgentRuntimeController {
|
|
|
271
277
|
const text = input.trim();
|
|
272
278
|
if (!text)
|
|
273
279
|
return { type: 'empty' };
|
|
274
|
-
if (!this.
|
|
280
|
+
if (!this.hasActiveTurn()) {
|
|
275
281
|
this.emitStatus('Nothing is running; press Enter to submit this message now.');
|
|
276
282
|
return { type: 'command_ignored' };
|
|
277
283
|
}
|
|
278
|
-
|
|
279
|
-
|
|
284
|
+
this.loadFollowupQueue();
|
|
285
|
+
if (this.followupQueue.length >= followup_queue_store_1.FOLLOWUP_QUEUE_LIMIT) {
|
|
286
|
+
this.emitStatus(`Follow-up queue is full (${followup_queue_store_1.FOLLOWUP_QUEUE_LIMIT}).`);
|
|
280
287
|
return { type: 'followup_queue_full' };
|
|
281
288
|
}
|
|
282
289
|
const resolvedText = resolvedInput?.trim() || text;
|
|
290
|
+
if (!this.checkFollowupSize(resolvedText))
|
|
291
|
+
return { type: 'followup_queue_rejected' };
|
|
283
292
|
const contextSuffix = resolvedText.startsWith(text) ? resolvedText.slice(text.length) : '';
|
|
284
293
|
const item = {
|
|
285
|
-
id:
|
|
294
|
+
id: this.options.runtime.followupQueueStore
|
|
295
|
+
? (0, runtime_protocol_v1_1.createRuntimeId)()
|
|
296
|
+
: `followup-${this.nextFollowupId++}`,
|
|
286
297
|
text,
|
|
287
298
|
resolvedText,
|
|
288
299
|
contextSuffix,
|
|
289
300
|
queuedAt: Date.now(),
|
|
290
301
|
revision: 1,
|
|
291
302
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
303
|
+
try {
|
|
304
|
+
this.saveFollowupQueue([...this.followupQueue, item]);
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
this.reportFollowupFailure(error);
|
|
308
|
+
return { type: 'followup_queue_rejected' };
|
|
309
|
+
}
|
|
310
|
+
this.emitStatus(`Queued follow-up ${this.followupQueue.length}/${followup_queue_store_1.FOLLOWUP_QUEUE_LIMIT}.`);
|
|
295
311
|
return { type: 'followup_queued', itemId: item.id };
|
|
296
312
|
}
|
|
297
|
-
|
|
298
|
-
if (
|
|
299
|
-
|
|
313
|
+
checkFollowupSize(text) {
|
|
314
|
+
if (Buffer.byteLength(text, 'utf8') <= followup_queue_store_1.FOLLOWUP_INPUT_BYTES)
|
|
315
|
+
return true;
|
|
316
|
+
this.emitStatus('Follow-up input exceeds 256 KiB.');
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
loadFollowupQueue(force = false) {
|
|
320
|
+
const session = this.options.runtime.getSession();
|
|
321
|
+
if (!force && session?.id === this.followupSessionId)
|
|
322
|
+
return;
|
|
323
|
+
const hadItems = this.followupQueue.length > 0;
|
|
324
|
+
this.followupSessionId = session?.id;
|
|
325
|
+
this.followupQueue = [];
|
|
326
|
+
this.followupsPaused = false;
|
|
327
|
+
const store = this.options.runtime.followupQueueStore;
|
|
328
|
+
if (session && store) {
|
|
329
|
+
try {
|
|
330
|
+
const saved = store.load(session);
|
|
331
|
+
this.followupQueue = saved;
|
|
332
|
+
const admitted = this.runner.admittedFollowups?.(session.id, saved.map(item => item.id));
|
|
333
|
+
const remaining = admitted ? saved.filter(item => !admitted.has(item.id)) : saved;
|
|
334
|
+
if (remaining.length !== saved.length)
|
|
335
|
+
this.saveFollowupQueue(remaining);
|
|
336
|
+
this.followupsPaused = remaining.length > 0;
|
|
337
|
+
if (this.followupsPaused) {
|
|
338
|
+
const message = `Recovered ${remaining.length} queued follow-up(s). Use /queue resume to run or /queue clear to remove.`;
|
|
339
|
+
this.emitAppend({ role: 'system', title: 'follow-up recovery', content: message });
|
|
340
|
+
this.emitStatus(message);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
this.reportFollowupFailure(error);
|
|
345
|
+
}
|
|
300
346
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
347
|
+
if (hadItems || this.followupQueue.length > 0)
|
|
348
|
+
this.emitFollowupQueue();
|
|
349
|
+
}
|
|
350
|
+
saveFollowupQueue(next) {
|
|
351
|
+
const store = this.options.runtime.followupQueueStore;
|
|
352
|
+
if (store) {
|
|
353
|
+
const session = this.options.runtime.getSession();
|
|
354
|
+
if (!session || session.id !== this.followupSessionId) {
|
|
355
|
+
throw new Error('The session changed before the follow-up queue was saved.');
|
|
356
|
+
}
|
|
357
|
+
store.replace(session, this.followupQueue, next);
|
|
305
358
|
}
|
|
359
|
+
this.followupQueue = next;
|
|
360
|
+
if (next.length === 0)
|
|
361
|
+
this.followupsPaused = false;
|
|
306
362
|
this.emitFollowupQueue();
|
|
363
|
+
}
|
|
364
|
+
reportFollowupFailure(error) {
|
|
365
|
+
this.followupsPaused = true;
|
|
366
|
+
this.emitStatus(`Follow-up queue: ${error instanceof Error ? error.message : String(error)}`);
|
|
367
|
+
}
|
|
368
|
+
nextPendingFollowup() {
|
|
369
|
+
const sessionId = this.options.runtime.getSession()?.id;
|
|
370
|
+
const item = this.followupQueue[0];
|
|
371
|
+
if (this.followupsPaused || !item || sessionId !== this.followupSessionId)
|
|
372
|
+
return;
|
|
373
|
+
return {
|
|
374
|
+
id: item.id,
|
|
375
|
+
request: {
|
|
376
|
+
inputKind: 'user',
|
|
377
|
+
text: item.resolvedText,
|
|
378
|
+
sessionId: sessionId ?? 'pending-session',
|
|
379
|
+
persistAsUserMessage: true,
|
|
380
|
+
echoToTranscript: false,
|
|
381
|
+
alreadyEchoed: true,
|
|
382
|
+
generation: 0,
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
manageFollowupQueue(action, itemId) {
|
|
387
|
+
this.loadFollowupQueue();
|
|
388
|
+
if (action === 'resume') {
|
|
389
|
+
if (this.hasActiveTurn() || this.activeRun || this.goalRuntimeActive) {
|
|
390
|
+
this.emitStatus('Wait for the current work to finish before resuming the follow-up queue.');
|
|
391
|
+
return { type: 'command_ignored' };
|
|
392
|
+
}
|
|
393
|
+
this.followupsPaused = false;
|
|
394
|
+
const pending = this.nextPendingFollowup();
|
|
395
|
+
if (pending)
|
|
396
|
+
return this.submitTurnRequest(pending.request, pending.id);
|
|
397
|
+
}
|
|
398
|
+
else if (this.followupQueue.length > 0) {
|
|
399
|
+
try {
|
|
400
|
+
this.saveFollowupQueue(action === 'clear' ? [] : this.followupQueue.filter(item => item.id !== itemId));
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
this.reportFollowupFailure(error);
|
|
404
|
+
return { type: 'command_ignored' };
|
|
405
|
+
}
|
|
406
|
+
}
|
|
307
407
|
this.emitStatus(this.followupQueue.length > 0
|
|
308
408
|
? `${this.followupQueue.length} follow-up(s) queued.`
|
|
309
409
|
: 'Follow-up queue is empty.');
|
|
@@ -334,8 +434,14 @@ class AgentRuntimeController {
|
|
|
334
434
|
}
|
|
335
435
|
if (parsedInput.isCommand) {
|
|
336
436
|
const command = (0, commands_1.findCommand)(parsedInput.name);
|
|
337
|
-
|
|
338
|
-
|
|
437
|
+
const isReview = command.name === 'review';
|
|
438
|
+
if (isReview && (this.activeRun || this.goalControlRuns.size > 0 || this.goalRuntimeActive)) {
|
|
439
|
+
this.emitStatus('/review rejected: an agent operation is active.');
|
|
440
|
+
return { type: 'command_rejected_busy', commandId: command.id };
|
|
441
|
+
}
|
|
442
|
+
if (this.hasActiveTurn()) {
|
|
443
|
+
if (command.busyPolicy === 'reject-busy' ||
|
|
444
|
+
((this.compacting || this.activeReview) && command.busyPolicy !== 'immediate')) {
|
|
339
445
|
this.emitStatus(`/${command.name} rejected: an agent turn is active.`);
|
|
340
446
|
return { type: 'command_rejected_busy', commandId: command.id };
|
|
341
447
|
}
|
|
@@ -352,7 +458,9 @@ class AgentRuntimeController {
|
|
|
352
458
|
this.emitStatus(`Queued /${command.name}; it will apply after the active logical request.`);
|
|
353
459
|
return { type: 'command_queued', commandId: command.id };
|
|
354
460
|
}
|
|
355
|
-
const run =
|
|
461
|
+
const run = (isReview
|
|
462
|
+
? this.runTrackedReview(command, parsedInput.args)
|
|
463
|
+
: this.runCommand(command, parsedInput.args))
|
|
356
464
|
.catch(error => this.handleCommandError(command, error))
|
|
357
465
|
.finally(() => {
|
|
358
466
|
if (this.activeRun === run)
|
|
@@ -361,6 +469,8 @@ class AgentRuntimeController {
|
|
|
361
469
|
this.activeRun = run;
|
|
362
470
|
return { type: 'command_handled' };
|
|
363
471
|
}
|
|
472
|
+
if (this.compacting || this.activeReview)
|
|
473
|
+
return this.queueFollowup(submitted);
|
|
364
474
|
if (this.turnController.hasActiveTurn()) {
|
|
365
475
|
this.turnController.clearExitIntent();
|
|
366
476
|
this.turnController.requestRevision(submitted);
|
|
@@ -414,7 +524,27 @@ class AgentRuntimeController {
|
|
|
414
524
|
}
|
|
415
525
|
this.emitStatus(`/${name} acknowledged; active turn continues.`);
|
|
416
526
|
}
|
|
417
|
-
async
|
|
527
|
+
async runTrackedReview(command, args) {
|
|
528
|
+
const review = new AbortController();
|
|
529
|
+
this.activeReview = review;
|
|
530
|
+
this.options.runtime.store.setProcessing(true);
|
|
531
|
+
this.emitProcessing(true);
|
|
532
|
+
this.emitStatus('Review running…');
|
|
533
|
+
try {
|
|
534
|
+
await this.runCommand(command, args, review.signal);
|
|
535
|
+
}
|
|
536
|
+
finally {
|
|
537
|
+
this.activeReview = undefined;
|
|
538
|
+
this.options.runtime.store.setProcessing(false);
|
|
539
|
+
this.emitProcessing(false);
|
|
540
|
+
}
|
|
541
|
+
if (!this.stopping) {
|
|
542
|
+
const pending = this.nextPendingFollowup();
|
|
543
|
+
if (pending)
|
|
544
|
+
await this.runTurn(pending.request, pending.id);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
async runCommand(command, args, abortSignal) {
|
|
418
548
|
if (command.risk !== 'read-only')
|
|
419
549
|
await this.options.runtime.synchronizeSettings?.();
|
|
420
550
|
const renderer = this.options.uiRenderer ?? this.options.runtime.config.ui?.renderer ?? 'terminal';
|
|
@@ -428,7 +558,7 @@ class AgentRuntimeController {
|
|
|
428
558
|
});
|
|
429
559
|
return;
|
|
430
560
|
}
|
|
431
|
-
const context = this.createCommandContext();
|
|
561
|
+
const context = this.createCommandContext(abortSignal);
|
|
432
562
|
const { result, output } = await captureCommandOutput(() => command.execute(context, args));
|
|
433
563
|
const commandMeta = commandIdentity(command, result.success);
|
|
434
564
|
if (output) {
|
|
@@ -468,6 +598,11 @@ class AgentRuntimeController {
|
|
|
468
598
|
if (result.effortEvent) {
|
|
469
599
|
this.eventSink.emit({ type: 'effort_event', event: result.effortEvent });
|
|
470
600
|
}
|
|
601
|
+
if (command.name === 'compact' && !this.stopping) {
|
|
602
|
+
const pending = this.nextPendingFollowup();
|
|
603
|
+
if (pending)
|
|
604
|
+
await this.runTurn(pending.request, pending.id);
|
|
605
|
+
}
|
|
471
606
|
if (result.continueAsChat) {
|
|
472
607
|
const session = this.options.runtime.getSession() ?? this.options.runtime.ensureSession();
|
|
473
608
|
await this.runTurn({
|
|
@@ -480,13 +615,14 @@ class AgentRuntimeController {
|
|
|
480
615
|
});
|
|
481
616
|
}
|
|
482
617
|
}
|
|
483
|
-
createCommandContext() {
|
|
618
|
+
createCommandContext(abortSignal) {
|
|
484
619
|
const renderer = this.options.uiRenderer ?? this.options.runtime.config.ui?.renderer ?? 'terminal';
|
|
485
620
|
return {
|
|
486
621
|
cwd: this.options.runtime.cwd,
|
|
487
622
|
config: this.options.runtime.config,
|
|
488
623
|
store: this.options.runtime.store,
|
|
489
624
|
llm: this.options.runtime.llm,
|
|
625
|
+
abortSignal,
|
|
490
626
|
compactCoordinator: this.options.runtime.compactCoordinator,
|
|
491
627
|
modelCoordinator: this.options.runtime.modelCoordinator,
|
|
492
628
|
sessionComposerControls: this.options.runtime.sessionComposerControls,
|
|
@@ -515,22 +651,26 @@ class AgentRuntimeController {
|
|
|
515
651
|
uiCapabilities: (0, ui_events_1.resolveUiRendererCapabilities)(this.options.uiCapabilities, renderer),
|
|
516
652
|
agentModeLifecycle: this.agentModeLifecycle,
|
|
517
653
|
getHarnessDiagnostics: this.options.runtime.getHarnessDiagnostics,
|
|
654
|
+
getConversationTurnCount: () => {
|
|
655
|
+
const sessionId = this.options.runtime.getSession()?.id;
|
|
656
|
+
return sessionId ? this.runner.conversationTurnCount?.(sessionId) : undefined;
|
|
657
|
+
},
|
|
518
658
|
settingsCoordinator: this.options.runtime.settingsCoordinator,
|
|
519
659
|
describeSettings: this.options.runtime.describeSettings,
|
|
520
660
|
updateSettings: this.options.runtime.updateSettings,
|
|
521
|
-
compact: this.runner.compact ? input => this.
|
|
661
|
+
compact: this.runner.compact ? input => this.runTrackedCompact(input) : undefined,
|
|
522
662
|
reviewPlan: this.runner.reviewPlan ? input => this.runner.reviewPlan(input) : undefined,
|
|
523
663
|
getPlanReviewState: this.runner.planReviewState
|
|
524
664
|
? () => this.runner.planReviewState()
|
|
525
665
|
: undefined,
|
|
526
666
|
};
|
|
527
667
|
}
|
|
528
|
-
submitTurnRequest(request) {
|
|
529
|
-
if (this.
|
|
668
|
+
submitTurnRequest(request, followupId) {
|
|
669
|
+
if (this.hasActiveTurn())
|
|
530
670
|
return { type: 'command_ignored' };
|
|
531
671
|
if (!this.requestIsCurrent(request))
|
|
532
672
|
return { type: 'command_ignored' };
|
|
533
|
-
this.activeRun = this.runTurn(request)
|
|
673
|
+
this.activeRun = this.runTurn(request, followupId)
|
|
534
674
|
.catch(error => {
|
|
535
675
|
this.handleRunLoopError(error);
|
|
536
676
|
})
|
|
@@ -541,9 +681,14 @@ class AgentRuntimeController {
|
|
|
541
681
|
}
|
|
542
682
|
interrupt() {
|
|
543
683
|
const shouldExit = this.turnController.registerExitIntent();
|
|
544
|
-
if (this.
|
|
545
|
-
this.
|
|
546
|
-
|
|
684
|
+
if (this.hasActiveTurn() || this.goalControlRuns.size > 0) {
|
|
685
|
+
if (this.activeReview) {
|
|
686
|
+
this.activeReview.abort('user interrupted');
|
|
687
|
+
}
|
|
688
|
+
else {
|
|
689
|
+
this.turnController.interruptActiveTurn();
|
|
690
|
+
this.runner.interrupt?.('user interrupted');
|
|
691
|
+
}
|
|
547
692
|
if (shouldExit)
|
|
548
693
|
return { type: 'exit_requested' };
|
|
549
694
|
this.emitStatus(this.options.interruptedStatus ?? 'Interrupted. Press Ctrl+C again to exit.');
|
|
@@ -556,6 +701,7 @@ class AgentRuntimeController {
|
|
|
556
701
|
}
|
|
557
702
|
async stopActiveTurn() {
|
|
558
703
|
this.stopping = true;
|
|
704
|
+
this.activeReview?.abort('runtime stopping');
|
|
559
705
|
this.turnController.interruptActiveTurn();
|
|
560
706
|
this.runner.interrupt?.('runtime stopping');
|
|
561
707
|
this.rejectPendingPermissions();
|
|
@@ -567,10 +713,33 @@ class AgentRuntimeController {
|
|
|
567
713
|
await Promise.all([this.activeRun ?? Promise.resolve(), ...this.goalControlRuns]);
|
|
568
714
|
}
|
|
569
715
|
async compactContext() {
|
|
570
|
-
if (this.
|
|
716
|
+
if (this.hasActiveTurn() || !this.runner.compact) {
|
|
571
717
|
return { status: 'rejected', reason: 'runtime_busy' };
|
|
572
718
|
}
|
|
573
|
-
|
|
719
|
+
const result = await this.runTrackedCompact({});
|
|
720
|
+
const pending = this.nextPendingFollowup();
|
|
721
|
+
if (pending && !this.stopping)
|
|
722
|
+
this.submitTurnRequest(pending.request, pending.id);
|
|
723
|
+
return result;
|
|
724
|
+
}
|
|
725
|
+
async runTrackedCompact(input) {
|
|
726
|
+
if (this.hasActiveTurn() || !this.runner.compact) {
|
|
727
|
+
return { status: 'rejected', reason: 'runtime_busy' };
|
|
728
|
+
}
|
|
729
|
+
this.options.runtime.ensureSession();
|
|
730
|
+
this.loadFollowupQueue();
|
|
731
|
+
this.compacting = true;
|
|
732
|
+
try {
|
|
733
|
+
const result = await this.runner.compact(input);
|
|
734
|
+
if (result.status === 'interrupted' && this.followupQueue.length > 0) {
|
|
735
|
+
this.followupsPaused = true;
|
|
736
|
+
this.emitStatus('Compaction interrupted. Use /queue resume to run queued follow-ups.');
|
|
737
|
+
}
|
|
738
|
+
return result;
|
|
739
|
+
}
|
|
740
|
+
finally {
|
|
741
|
+
this.compacting = false;
|
|
742
|
+
}
|
|
574
743
|
}
|
|
575
744
|
canCompactContext() {
|
|
576
745
|
return Boolean(this.runner.compact);
|
|
@@ -583,12 +752,27 @@ class AgentRuntimeController {
|
|
|
583
752
|
throw new Error('Plan review is unavailable for this Runtime.');
|
|
584
753
|
return this.runner.reviewPlan(input);
|
|
585
754
|
}
|
|
586
|
-
async runTurn(firstRequest) {
|
|
755
|
+
async runTurn(firstRequest, firstFollowupId) {
|
|
587
756
|
let nextRequest = firstRequest;
|
|
757
|
+
let nextFollowupId = firstFollowupId;
|
|
588
758
|
while (nextRequest && !this.stopping) {
|
|
589
759
|
if (!this.requestIsCurrent(nextRequest))
|
|
590
760
|
break;
|
|
591
761
|
const request = nextRequest;
|
|
762
|
+
const followupId = nextFollowupId;
|
|
763
|
+
nextFollowupId = undefined;
|
|
764
|
+
let followupAdmitted = false;
|
|
765
|
+
const onFollowupAdmitted = () => {
|
|
766
|
+
if ((this.followupSessionId ?? 'pending-session') !== request.sessionId)
|
|
767
|
+
return;
|
|
768
|
+
try {
|
|
769
|
+
this.saveFollowupQueue(this.followupQueue.filter(item => item.id !== followupId));
|
|
770
|
+
followupAdmitted = true;
|
|
771
|
+
}
|
|
772
|
+
catch (error) {
|
|
773
|
+
this.reportFollowupFailure(error);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
592
776
|
const planCompletionBeforeRequest = this.agentModeLifecycle.completionRevision();
|
|
593
777
|
const nextInput = request.text?.trim() || 'Continue from the latest durable context.';
|
|
594
778
|
if ((this.options.echoSubmittedInput ?? true) &&
|
|
@@ -598,29 +782,46 @@ class AgentRuntimeController {
|
|
|
598
782
|
}
|
|
599
783
|
this.options.beforeTurn?.(nextInput);
|
|
600
784
|
const turn = this.turnController.beginTurn(nextInput);
|
|
785
|
+
let settingsReady = true;
|
|
601
786
|
try {
|
|
602
787
|
if (this.options.runtime.synchronizeSettings) {
|
|
603
|
-
await this.synchronizeSettingsAtLogicalBoundary();
|
|
788
|
+
settingsReady = await this.synchronizeSettingsAtLogicalBoundary();
|
|
789
|
+
if (!settingsReady)
|
|
790
|
+
break;
|
|
604
791
|
}
|
|
605
792
|
this.options.runtime.store.setProcessing(true);
|
|
606
793
|
this.emitProcessing(true);
|
|
607
794
|
const runningStatus = statusText(this.options.runningStatus, nextInput);
|
|
608
795
|
if (runningStatus)
|
|
609
796
|
this.emitStatus(runningStatus);
|
|
797
|
+
const durableFollowup = followupId && this.options.runtime.followupQueueStore;
|
|
798
|
+
const options = {
|
|
799
|
+
abortSignal: turn.abortSignal,
|
|
800
|
+
turnId: turn.id,
|
|
801
|
+
...(durableFollowup && {
|
|
802
|
+
followup: {
|
|
803
|
+
id: followupId,
|
|
804
|
+
sessionId: request.sessionId,
|
|
805
|
+
isPending: () => !this.stopping &&
|
|
806
|
+
this.requestIsCurrent(request) &&
|
|
807
|
+
this.followupQueue[0]?.id === followupId &&
|
|
808
|
+
this.followupQueue[0].resolvedText === request.text,
|
|
809
|
+
onAdmitted: onFollowupAdmitted,
|
|
810
|
+
},
|
|
811
|
+
}),
|
|
812
|
+
};
|
|
610
813
|
if (this.runner.runRequest) {
|
|
611
|
-
await this.runner.runRequest(request,
|
|
612
|
-
abortSignal: turn.abortSignal,
|
|
613
|
-
turnId: turn.id,
|
|
614
|
-
});
|
|
814
|
+
await this.runner.runRequest(request, options);
|
|
615
815
|
}
|
|
616
816
|
else {
|
|
617
817
|
await this.runner.runInput(nextInput, {
|
|
618
|
-
|
|
619
|
-
turnId: turn.id,
|
|
818
|
+
...options,
|
|
620
819
|
persistAsUserMessage: request.persistAsUserMessage,
|
|
621
820
|
inputKind: request.inputKind,
|
|
622
821
|
});
|
|
623
822
|
}
|
|
823
|
+
if (followupId && !durableFollowup)
|
|
824
|
+
onFollowupAdmitted();
|
|
624
825
|
}
|
|
625
826
|
catch (error) {
|
|
626
827
|
if (!turn.abortSignal.aborted) {
|
|
@@ -634,65 +835,68 @@ class AgentRuntimeController {
|
|
|
634
835
|
}
|
|
635
836
|
finally {
|
|
636
837
|
const revision = this.turnController.finishTurn(turn.id);
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
generation: 0,
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
else if (completedPlan) {
|
|
669
|
-
nextRequest = {
|
|
670
|
-
inputKind: 'plan_execution',
|
|
671
|
-
text: `Execute the saved plan now. Continue autonomously from the plan and verify the result.\n\n${completedPlan}`,
|
|
672
|
-
sessionId: this.options.runtime.getSession()?.id ?? request.sessionId,
|
|
673
|
-
persistAsUserMessage: false,
|
|
674
|
-
echoToTranscript: false,
|
|
675
|
-
generation: 0,
|
|
676
|
-
};
|
|
677
|
-
this.emitStatus('Plan saved · starting execution in the selected mode.');
|
|
678
|
-
}
|
|
679
|
-
else {
|
|
680
|
-
const queuedCommand = this.queuedCommands.shift();
|
|
681
|
-
const queuedFollowup = queuedCommand ? undefined : this.followupQueue.shift();
|
|
682
|
-
if (queuedFollowup)
|
|
683
|
-
this.emitFollowupQueue();
|
|
684
|
-
const queuedInput = queuedCommand ?? queuedFollowup?.resolvedText;
|
|
685
|
-
nextRequest = queuedInput
|
|
686
|
-
? {
|
|
687
|
-
inputKind: 'user',
|
|
688
|
-
text: queuedInput,
|
|
838
|
+
if (followupId && !followupAdmitted)
|
|
839
|
+
this.followupsPaused = true;
|
|
840
|
+
if (settingsReady) {
|
|
841
|
+
// Durable request runners commit and enqueue Plan execution at the Thread boundary.
|
|
842
|
+
// The legacy runInput path still needs the controller-owned compatibility follow-up.
|
|
843
|
+
const completedPlan = this.runner.runRequest
|
|
844
|
+
? undefined
|
|
845
|
+
: (this.agentModeLifecycle.completedPlanSince(planCompletionBeforeRequest) ??
|
|
846
|
+
undefined);
|
|
847
|
+
this.applyPendingAgentMode(Boolean(completedPlan));
|
|
848
|
+
try {
|
|
849
|
+
await this.options.runtime.sessionComposerControls?.applyPendingAtLogicalBoundary();
|
|
850
|
+
}
|
|
851
|
+
catch (error) {
|
|
852
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
853
|
+
this.emitAppend({
|
|
854
|
+
role: 'error',
|
|
855
|
+
title: 'composer controls',
|
|
856
|
+
content: `Deferred Composer control failed: ${message}`,
|
|
857
|
+
errorLayer: 'runtime',
|
|
858
|
+
});
|
|
859
|
+
this.emitStatus(`Composer control rollback: ${message}`);
|
|
860
|
+
}
|
|
861
|
+
if (revision?.trim()) {
|
|
862
|
+
this.emitStatus(this.options.restartingStatus ?? '根据补充调整方向中…');
|
|
863
|
+
nextRequest = {
|
|
864
|
+
inputKind: 'revision',
|
|
865
|
+
text: revision,
|
|
689
866
|
sessionId: this.options.runtime.getSession()?.id ?? request.sessionId,
|
|
690
867
|
persistAsUserMessage: true,
|
|
691
|
-
echoToTranscript:
|
|
868
|
+
echoToTranscript: true,
|
|
692
869
|
alreadyEchoed: true,
|
|
693
870
|
generation: 0,
|
|
694
|
-
}
|
|
695
|
-
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
else if (completedPlan) {
|
|
874
|
+
nextRequest = {
|
|
875
|
+
inputKind: 'plan_execution',
|
|
876
|
+
text: `Execute the saved plan now. Continue autonomously from the plan and verify the result.\n\n${completedPlan}`,
|
|
877
|
+
sessionId: this.options.runtime.getSession()?.id ?? request.sessionId,
|
|
878
|
+
persistAsUserMessage: false,
|
|
879
|
+
echoToTranscript: false,
|
|
880
|
+
generation: 0,
|
|
881
|
+
};
|
|
882
|
+
this.emitStatus('Plan saved · starting execution in the selected mode.');
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
const queuedCommand = this.queuedCommands.shift();
|
|
886
|
+
const pending = queuedCommand ? undefined : this.nextPendingFollowup();
|
|
887
|
+
nextFollowupId = pending?.id;
|
|
888
|
+
nextRequest = queuedCommand
|
|
889
|
+
? {
|
|
890
|
+
inputKind: 'user',
|
|
891
|
+
text: queuedCommand,
|
|
892
|
+
sessionId: request.sessionId,
|
|
893
|
+
persistAsUserMessage: true,
|
|
894
|
+
echoToTranscript: false,
|
|
895
|
+
alreadyEchoed: true,
|
|
896
|
+
generation: 0,
|
|
897
|
+
}
|
|
898
|
+
: pending?.request;
|
|
899
|
+
}
|
|
696
900
|
}
|
|
697
901
|
}
|
|
698
902
|
}
|
|
@@ -702,8 +906,12 @@ class AgentRuntimeController {
|
|
|
702
906
|
const readyStatus = typeof this.options.readyStatus === 'function'
|
|
703
907
|
? this.options.readyStatus()
|
|
704
908
|
: this.options.readyStatus;
|
|
705
|
-
if (
|
|
909
|
+
if (this.reportedInvalidConfigRevision) {
|
|
910
|
+
this.emitStatus('Configuration needs repair. Fix orion.yaml and retry.');
|
|
911
|
+
}
|
|
912
|
+
else if (readyStatus) {
|
|
706
913
|
this.emitStatus(readyStatus);
|
|
914
|
+
}
|
|
707
915
|
this.options.afterTurnLoop?.();
|
|
708
916
|
}
|
|
709
917
|
}
|
|
@@ -742,10 +950,25 @@ class AgentRuntimeController {
|
|
|
742
950
|
async synchronizeSettingsAtLogicalBoundary() {
|
|
743
951
|
const synchronize = this.options.runtime.synchronizeSettings;
|
|
744
952
|
if (!synchronize)
|
|
745
|
-
return;
|
|
953
|
+
return true;
|
|
746
954
|
this.settingsBoundarySynchronizations += 1;
|
|
747
955
|
try {
|
|
748
|
-
await synchronize();
|
|
956
|
+
const settings = await synchronize();
|
|
957
|
+
if (settings?.state !== 'invalid' ||
|
|
958
|
+
settings.diagnostic?.code !== 'settings_document_invalid') {
|
|
959
|
+
this.reportedInvalidConfigRevision = undefined;
|
|
960
|
+
return true;
|
|
961
|
+
}
|
|
962
|
+
if (this.reportedInvalidConfigRevision !== settings.revision) {
|
|
963
|
+
this.reportedInvalidConfigRevision = settings.revision;
|
|
964
|
+
this.emitAppend({
|
|
965
|
+
role: 'error',
|
|
966
|
+
title: 'configuration',
|
|
967
|
+
errorLayer: 'runtime',
|
|
968
|
+
content: `${(0, style_1.sanitizeTerminalText)(settings.diagnostic.message)}. Fix orion.yaml and retry.`,
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
return false;
|
|
749
972
|
}
|
|
750
973
|
finally {
|
|
751
974
|
this.settingsBoundarySynchronizations -= 1;
|
|
@@ -765,7 +988,7 @@ class AgentRuntimeController {
|
|
|
765
988
|
type: 'followup_queue_changed',
|
|
766
989
|
snapshot: {
|
|
767
990
|
items: this.followupQueue.map(item => projectFollowupQueueItem(item)),
|
|
768
|
-
limit:
|
|
991
|
+
limit: followup_queue_store_1.FOLLOWUP_QUEUE_LIMIT,
|
|
769
992
|
},
|
|
770
993
|
});
|
|
771
994
|
}
|
|
@@ -849,10 +1072,10 @@ class AgentRuntimeController {
|
|
|
849
1072
|
this.emitStatus(message);
|
|
850
1073
|
return { type: 'command_handled' };
|
|
851
1074
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
1075
|
+
const startsGoal = goalControl.action === 'create' || goalControl.action === 'resume';
|
|
1076
|
+
const requiresIdle = startsGoal || goalControl.action === 'budget';
|
|
1077
|
+
if ((this.hasActiveTurn() || this.goalControlRuns.size > 0 || this.goalRuntimeActive) &&
|
|
1078
|
+
requiresIdle) {
|
|
856
1079
|
const message = `/goal ${goalControl.action} is unavailable while Goal work is running; use /goal pause or /goal clear first.`;
|
|
857
1080
|
this.emitStatus(message);
|
|
858
1081
|
return { type: 'command_ignored' };
|
|
@@ -869,20 +1092,22 @@ class AgentRuntimeController {
|
|
|
869
1092
|
.then(async () => {
|
|
870
1093
|
if (interruptedRun)
|
|
871
1094
|
await interruptedRun.catch(() => undefined);
|
|
872
|
-
if (!
|
|
873
|
-
|
|
874
|
-
})
|
|
875
|
-
.then(async () => {
|
|
1095
|
+
if (requiresIdle && !(await this.synchronizeSettingsAtLogicalBoundary()))
|
|
1096
|
+
return;
|
|
876
1097
|
this.activeGoalRuntimeTransitions += 1;
|
|
1098
|
+
const goalEventRevision = this.goalEventRevision;
|
|
1099
|
+
let result;
|
|
877
1100
|
try {
|
|
878
|
-
|
|
1101
|
+
result = await this.runner.controlGoal(goalControl);
|
|
879
1102
|
}
|
|
880
1103
|
finally {
|
|
881
1104
|
this.activeGoalRuntimeTransitions -= 1;
|
|
882
1105
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1106
|
+
if (goalEventRevision === this.goalEventRevision &&
|
|
1107
|
+
result.accepted &&
|
|
1108
|
+
result.action !== 'status') {
|
|
1109
|
+
this.goalRuntimeActive = result.state?.status === 'active' || result.scheduleContinuation;
|
|
1110
|
+
}
|
|
886
1111
|
this.renderGoalControl(result);
|
|
887
1112
|
// Pause/clear must remain available while Goal work is active. Reconcile
|
|
888
1113
|
// pending runtime-sensitive edits only after that work has stopped.
|
|
@@ -910,17 +1135,13 @@ class AgentRuntimeController {
|
|
|
910
1135
|
});
|
|
911
1136
|
this.emitStatus(summary);
|
|
912
1137
|
}
|
|
913
|
-
observeGoalControlResult(result) {
|
|
914
|
-
if (!result.accepted)
|
|
915
|
-
return;
|
|
916
|
-
this.goalRuntimeActive =
|
|
917
|
-
(result.action === 'create' || result.action === 'resume') && result.scheduleContinuation;
|
|
918
|
-
}
|
|
919
1138
|
observeGoalRuntimeEvent(event) {
|
|
920
1139
|
if (event.type === 'goal_updated') {
|
|
1140
|
+
this.goalEventRevision += 1;
|
|
921
1141
|
this.goalRuntimeActive = event.goal.status === 'active';
|
|
922
1142
|
}
|
|
923
1143
|
else if (event.type === 'goal_cleared' || event.type === 'goal_completed') {
|
|
1144
|
+
this.goalEventRevision += 1;
|
|
924
1145
|
this.goalRuntimeActive = false;
|
|
925
1146
|
}
|
|
926
1147
|
}
|
|
@@ -928,71 +1149,17 @@ class AgentRuntimeController {
|
|
|
928
1149
|
const pending = this.pendingPermissions.get(requestId);
|
|
929
1150
|
if (!pending)
|
|
930
1151
|
return { type: 'permission_decision_ignored' };
|
|
931
|
-
if (
|
|
932
|
-
const reason = `
|
|
1152
|
+
if (scope !== 'once') {
|
|
1153
|
+
const reason = `Approval applies to one operation only. Received scope: ${String(scope)}`;
|
|
933
1154
|
pending.finish(false);
|
|
934
1155
|
this.emitStatus(`Permission denied: ${reason}`);
|
|
935
1156
|
return { type: 'permission_decision_failed', reason };
|
|
936
1157
|
}
|
|
937
|
-
if (approved && scope !== 'once') {
|
|
938
|
-
try {
|
|
939
|
-
(0, tool_allowlist_1.grantToolPermission)(scope, this.options.runtime.cwd, pending.request.name);
|
|
940
|
-
}
|
|
941
|
-
catch (error) {
|
|
942
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
943
|
-
pending.finish(false);
|
|
944
|
-
this.emitStatus(`Permission was not saved; ${pending.request.name} remains denied: ${reason}`);
|
|
945
|
-
return { type: 'permission_decision_failed', reason };
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
1158
|
pending.finish(approved);
|
|
949
|
-
if (approved)
|
|
950
|
-
|
|
951
|
-
? ' for all projects'
|
|
952
|
-
: scope === 'project'
|
|
953
|
-
? ' for this project'
|
|
954
|
-
: ' once';
|
|
955
|
-
this.emitStatus(`Allowed ${pending.request.name}${suffix}`);
|
|
956
|
-
}
|
|
1159
|
+
if (approved)
|
|
1160
|
+
this.emitStatus(`Allowed ${pending.request.name} once`);
|
|
957
1161
|
return { type: 'permission_decision_recorded' };
|
|
958
1162
|
}
|
|
959
|
-
applyPermissionModeChange(value) {
|
|
960
|
-
const allowed = ['allow', 'ask', 'deny'];
|
|
961
|
-
if (!allowed.includes(value))
|
|
962
|
-
return { type: 'permission_mode_invalid' };
|
|
963
|
-
if (this.activeRun ||
|
|
964
|
-
this.turnController.hasActiveTurn() ||
|
|
965
|
-
this.goalControlRuns.size > 0 ||
|
|
966
|
-
this.goalRuntimeActive) {
|
|
967
|
-
this.emitStatus('Tool confirmation was not changed: the runtime is busy.');
|
|
968
|
-
return { type: 'command_ignored' };
|
|
969
|
-
}
|
|
970
|
-
const describeSettings = this.options.runtime.describeSettings;
|
|
971
|
-
const updateSettings = this.options.runtime.updateSettings;
|
|
972
|
-
if (!describeSettings || !updateSettings) {
|
|
973
|
-
this.emitStatus('Tool confirmation was not changed: Settings are unavailable.');
|
|
974
|
-
return { type: 'command_ignored' };
|
|
975
|
-
}
|
|
976
|
-
const run = (async () => {
|
|
977
|
-
const before = describeSettings();
|
|
978
|
-
await updateSettings({
|
|
979
|
-
requestId: `runtime:permission-mode:${(0, crypto_1.randomUUID)()}`,
|
|
980
|
-
expectedRevision: before.revision,
|
|
981
|
-
operations: [{ op: 'set', key: 'permissions.toolConfirmation', value }],
|
|
982
|
-
});
|
|
983
|
-
this.emitStatus(`Tool confirmation → ${value}`);
|
|
984
|
-
})()
|
|
985
|
-
.catch(error => {
|
|
986
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
987
|
-
this.emitStatus(`Tool confirmation was not changed: ${reason}`);
|
|
988
|
-
})
|
|
989
|
-
.finally(() => {
|
|
990
|
-
if (this.activeRun === run)
|
|
991
|
-
this.activeRun = null;
|
|
992
|
-
});
|
|
993
|
-
this.activeRun = run;
|
|
994
|
-
return { type: 'started' };
|
|
995
|
-
}
|
|
996
1163
|
rejectPendingPermissions() {
|
|
997
1164
|
const pending = [...this.pendingPermissions.values()];
|
|
998
1165
|
this.pendingPermissions.clear();
|
|
@@ -1061,8 +1228,12 @@ function formatGoalRuntimeStatus(result) {
|
|
|
1061
1228
|
const objective = state.objective.length > 80 ? `${state.objective.slice(0, 77)}...` : state.objective;
|
|
1062
1229
|
return [
|
|
1063
1230
|
result.message,
|
|
1064
|
-
`Goal: [${state.status}] ${objective}`,
|
|
1065
|
-
`Progress: ${state.continuationCount} turns · ${state.tokensUsed}/${state.budget.maxTokens} tokens · ${state.elapsedMs}/${state.budget.maxElapsedMs}ms`,
|
|
1231
|
+
`Goal: [${state.status}] ${objective} (${state.goalId})`,
|
|
1232
|
+
`Progress: ${state.continuationCount} turns · ${state.tokensUsed}/${state.budget.maxTokens ?? 'unlimited'} tokens · ${state.elapsedMs}/${state.budget.maxElapsedMs ?? 'unlimited'} ms`,
|
|
1233
|
+
...(state.lastStopDecision ? [state.lastStopDecision.reason.message] : []),
|
|
1234
|
+
...(state.lastStopDecision?.evidenceRefs?.length
|
|
1235
|
+
? [`Evidence: ${state.lastStopDecision.evidenceRefs.join(', ')}`]
|
|
1236
|
+
: []),
|
|
1066
1237
|
].join('\n');
|
|
1067
1238
|
}
|
|
1068
1239
|
function normalizeGoalRuntimeControl(control) {
|
|
@@ -1073,6 +1244,9 @@ function normalizeGoalRuntimeControl(control) {
|
|
|
1073
1244
|
...(control.budget ? { budget: control.budget } : {}),
|
|
1074
1245
|
};
|
|
1075
1246
|
}
|
|
1247
|
+
if (control.action === 'budget') {
|
|
1248
|
+
return { action: 'budget', budget: { ...control.budget } };
|
|
1249
|
+
}
|
|
1076
1250
|
return { action: control.action };
|
|
1077
1251
|
}
|
|
1078
1252
|
function commandIdentity(command, success) {
|