@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
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebCodeReviewRunServiceV1 = void 0;
|
|
4
|
-
exports.parseWebReviewSelectorV1 = parseWebReviewSelectorV1;
|
|
5
|
-
/**
|
|
6
|
-
* v0.3.29 — Host-side shared code-review run service
|
|
7
|
-
* (docs/plan/v0.3.29-plan.md S1). The Web Host starts the same bounded
|
|
8
|
-
* single-pass review runner the CLI uses (v0.3.28 `runCodeReview`) against the
|
|
9
|
-
* active Workspace, keeps a bounded in-memory receipt history, and re-verifies
|
|
10
|
-
* every receipt digest plus repository revision freshness when results are
|
|
11
|
-
* read. No second review engine: receipts, budgets, validation and honest
|
|
12
|
-
* failure states come from the frozen `src/services/code-review` contract.
|
|
13
|
-
*
|
|
14
|
-
* Delivery model: `start()` validates admission and returns immediately; the
|
|
15
|
-
* model completion runs in the background and clients poll `list()`/`get()`.
|
|
16
|
-
* At most one run is in flight per Host (a second start is a typed 409), and
|
|
17
|
-
* a run may be cancelled to release the slot.
|
|
18
|
-
*/
|
|
19
|
-
const crypto_1 = require("crypto");
|
|
20
|
-
const contract_1 = require("../services/code-review/contract");
|
|
21
|
-
const runner_1 = require("../services/code-review/runner");
|
|
22
|
-
const errors_1 = require("./errors");
|
|
23
|
-
class WebCodeReviewRunServiceV1 {
|
|
24
|
-
constructor(options) {
|
|
25
|
-
this.records = new Map();
|
|
26
|
-
this.inflight = new Map();
|
|
27
|
-
this.adapterProvider = options.adapterProvider;
|
|
28
|
-
this.cwdProvider = options.cwdProvider;
|
|
29
|
-
this.repositoryRevisionProvider = options.repositoryRevisionProvider;
|
|
30
|
-
this.runReview = options.runReview ?? runner_1.runCodeReview;
|
|
31
|
-
this.now = options.now ?? Date.now;
|
|
32
|
-
this.maxRuns = Math.max(1, options.maxRuns ?? 20);
|
|
33
|
-
}
|
|
34
|
-
/** Admission is synchronous and fast: validate, record, return. The model
|
|
35
|
-
* completion continues in the background. */
|
|
36
|
-
async start(selector) {
|
|
37
|
-
if (this.inflight.size > 0) {
|
|
38
|
-
throw new errors_1.WebWorkbenchError(409, 'A code review is already running in this Host. Wait for it to finish or cancel it.', 'review_run_in_progress');
|
|
39
|
-
}
|
|
40
|
-
const adapter = this.adapterProvider();
|
|
41
|
-
if (!adapter) {
|
|
42
|
-
throw new errors_1.WebWorkbenchError(422, 'The Host has no configured model. Configure a model first, then retry the review.', 'review_no_model');
|
|
43
|
-
}
|
|
44
|
-
const runId = (0, crypto_1.randomUUID)();
|
|
45
|
-
const repositoryRevisionAtAdmission = await this.repositoryRevisionProvider();
|
|
46
|
-
const startedAt = this.now();
|
|
47
|
-
let capturedFiles = [];
|
|
48
|
-
this.records.set(runId, {
|
|
49
|
-
runId,
|
|
50
|
-
selector,
|
|
51
|
-
status: 'running',
|
|
52
|
-
startedAt,
|
|
53
|
-
endedAt: null,
|
|
54
|
-
repositoryRevisionAtAdmission,
|
|
55
|
-
files: capturedFiles,
|
|
56
|
-
result: null,
|
|
57
|
-
failure: null,
|
|
58
|
-
stale: false,
|
|
59
|
-
});
|
|
60
|
-
const abort = new AbortController();
|
|
61
|
-
this.inflight.set(runId, abort);
|
|
62
|
-
const cwd = this.cwdProvider();
|
|
63
|
-
void this.execute({
|
|
64
|
-
runId,
|
|
65
|
-
selector,
|
|
66
|
-
cwd,
|
|
67
|
-
adapter,
|
|
68
|
-
abort,
|
|
69
|
-
onSnapshot: snapshot => {
|
|
70
|
-
capturedFiles = Object.freeze(snapshot.files.map(file => ({ fileKey: file.fileKey, path: file.path })));
|
|
71
|
-
const record = this.records.get(runId);
|
|
72
|
-
if (record)
|
|
73
|
-
this.records.set(runId, { ...record, files: capturedFiles });
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
return Object.freeze({ runId, status: 'running' });
|
|
77
|
-
}
|
|
78
|
-
/** Cancels a running review; finished or unknown runs are a no-op. */
|
|
79
|
-
cancel(runId) {
|
|
80
|
-
this.inflight.get(runId)?.abort();
|
|
81
|
-
}
|
|
82
|
-
async list() {
|
|
83
|
-
const currentRevision = await this.repositoryRevisionProvider();
|
|
84
|
-
return [...this.records.values()]
|
|
85
|
-
.sort((left, right) => right.startedAt - left.startedAt)
|
|
86
|
-
.map(record => this.present(record, currentRevision));
|
|
87
|
-
}
|
|
88
|
-
async get(runId) {
|
|
89
|
-
const record = this.records.get(runId);
|
|
90
|
-
if (!record) {
|
|
91
|
-
throw new errors_1.WebWorkbenchError(404, 'Unknown review run.', 'review_run_not_found');
|
|
92
|
-
}
|
|
93
|
-
const currentRevision = await this.repositoryRevisionProvider();
|
|
94
|
-
return this.present(record, currentRevision);
|
|
95
|
-
}
|
|
96
|
-
async execute(input) {
|
|
97
|
-
const { runId, selector, cwd, adapter, abort, onSnapshot } = input;
|
|
98
|
-
const options = {
|
|
99
|
-
cwd,
|
|
100
|
-
selector,
|
|
101
|
-
adapter,
|
|
102
|
-
identity: {
|
|
103
|
-
workspaceIdentity: cwd,
|
|
104
|
-
// Web control-plane runs are their own session identity; they are not
|
|
105
|
-
// attributed to any chat Session actor.
|
|
106
|
-
sessionId: `web-host:${runId}`,
|
|
107
|
-
threadId: `web-host:${runId}`,
|
|
108
|
-
turnId: runId,
|
|
109
|
-
},
|
|
110
|
-
abortSignal: abort.signal,
|
|
111
|
-
...(onSnapshot ? { onSnapshotCaptured: onSnapshot } : {}),
|
|
112
|
-
};
|
|
113
|
-
let failure = null;
|
|
114
|
-
let result = null;
|
|
115
|
-
try {
|
|
116
|
-
const outcome = await this.runReview(options);
|
|
117
|
-
if (outcome.ok) {
|
|
118
|
-
result = outcome.result;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
failure = {
|
|
122
|
-
kind: outcome.failure.kind,
|
|
123
|
-
message: failureMessage(outcome.failure),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
failure = {
|
|
129
|
-
kind: 'model_error',
|
|
130
|
-
message: error instanceof Error ? error.message : String(error),
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
this.inflight.delete(runId);
|
|
134
|
-
const existing = this.records.get(runId);
|
|
135
|
-
if (!existing)
|
|
136
|
-
return;
|
|
137
|
-
const finished = {
|
|
138
|
-
...existing,
|
|
139
|
-
status: result ? result.state : failure?.kind === 'cancelled' ? 'cancelled' : 'failed',
|
|
140
|
-
endedAt: this.now(),
|
|
141
|
-
result,
|
|
142
|
-
failure,
|
|
143
|
-
};
|
|
144
|
-
this.records.set(runId, finished);
|
|
145
|
-
this.evictFinished();
|
|
146
|
-
}
|
|
147
|
-
evictFinished() {
|
|
148
|
-
const finished = [...this.records.values()]
|
|
149
|
-
.filter(record => record.status !== 'running')
|
|
150
|
-
.sort((left, right) => (left.endedAt ?? left.startedAt) - (right.endedAt ?? right.startedAt));
|
|
151
|
-
let excess = this.records.size - this.maxRuns;
|
|
152
|
-
for (const record of finished) {
|
|
153
|
-
if (excess <= 0)
|
|
154
|
-
break;
|
|
155
|
-
this.records.delete(record.runId);
|
|
156
|
-
excess -= 1;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
present(record, currentRevision) {
|
|
160
|
-
const stale = record.result !== null && record.repositoryRevisionAtAdmission !== currentRevision;
|
|
161
|
-
if (record.result && !(0, contract_1.verifyReceiptDigest)(record.result)) {
|
|
162
|
-
// A receipt that no longer verifies must never be presented as findings;
|
|
163
|
-
// surface it as a failed run with an honest message instead.
|
|
164
|
-
return {
|
|
165
|
-
...record,
|
|
166
|
-
status: 'failed',
|
|
167
|
-
stale,
|
|
168
|
-
result: null,
|
|
169
|
-
failure: {
|
|
170
|
-
kind: 'receipt_digest_mismatch',
|
|
171
|
-
message: 'The stored review receipt failed digest re-verification.',
|
|
172
|
-
},
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
return { ...record, stale };
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
exports.WebCodeReviewRunServiceV1 = WebCodeReviewRunServiceV1;
|
|
179
|
-
function failureMessage(failure) {
|
|
180
|
-
switch (failure.kind) {
|
|
181
|
-
case 'cancelled':
|
|
182
|
-
return 'Review cancelled.';
|
|
183
|
-
case 'budget':
|
|
184
|
-
return `Review budget rejected: ${failure.field ?? 'unknown'}`;
|
|
185
|
-
case 'snapshot':
|
|
186
|
-
return `Review scope error (${failure.code ?? 'unknown'}): ${failure.message ?? ''}`;
|
|
187
|
-
case 'model_error':
|
|
188
|
-
return `Review model call failed: ${failure.message ?? ''}`;
|
|
189
|
-
case 'unparsable_output':
|
|
190
|
-
return `Review output could not be parsed: ${failure.message ?? ''}`;
|
|
191
|
-
default:
|
|
192
|
-
return failure.message ?? 'Review failed.';
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/** v0.3.29 — validates the JSON selector accepted by `POST /review/run`.
|
|
196
|
-
* Mirrors the CLI selector contract: worktree scope, base ref scope, optional
|
|
197
|
-
* path filters. Unknown shapes are typed 400s, never guesses. */
|
|
198
|
-
function parseWebReviewSelectorV1(value) {
|
|
199
|
-
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
200
|
-
throw new errors_1.WebWorkbenchError(400, 'Review selector must be an object.', 'review_selector_invalid');
|
|
201
|
-
}
|
|
202
|
-
const record = value;
|
|
203
|
-
const keys = Object.keys(record).sort();
|
|
204
|
-
const allowed = record.kind === 'base' ? ['kind', 'paths', 'ref'] : ['kind', 'paths'];
|
|
205
|
-
if (keys.some(key => !allowed.includes(key))) {
|
|
206
|
-
throw new errors_1.WebWorkbenchError(400, `Review selector accepts only ${allowed.join(', ')}.`, 'review_selector_invalid');
|
|
207
|
-
}
|
|
208
|
-
const paths = parseSelectorPaths(record.paths);
|
|
209
|
-
if (record.kind === 'base') {
|
|
210
|
-
if (typeof record.ref !== 'string' || record.ref.trim() === '') {
|
|
211
|
-
throw new errors_1.WebWorkbenchError(400, 'Review selector base ref must be a non-empty string.', 'review_selector_invalid');
|
|
212
|
-
}
|
|
213
|
-
return Object.freeze({ kind: 'base', ref: record.ref, ...(paths ? { paths } : {}) });
|
|
214
|
-
}
|
|
215
|
-
if (record.kind === 'worktree') {
|
|
216
|
-
return Object.freeze({ kind: 'worktree', ...(paths ? { paths } : {}) });
|
|
217
|
-
}
|
|
218
|
-
throw new errors_1.WebWorkbenchError(400, 'Review selector kind must be "worktree" or "base".', 'review_selector_invalid');
|
|
219
|
-
}
|
|
220
|
-
function parseSelectorPaths(value) {
|
|
221
|
-
if (value === undefined)
|
|
222
|
-
return undefined;
|
|
223
|
-
if (!Array.isArray(value) || value.some(path => typeof path !== 'string' || path.trim() === '')) {
|
|
224
|
-
throw new errors_1.WebWorkbenchError(400, 'Review selector paths must be an array of non-empty strings.', 'review_selector_invalid');
|
|
225
|
-
}
|
|
226
|
-
return Object.freeze([...value]);
|
|
227
|
-
}
|
|
228
|
-
//# sourceMappingURL=code-review-run-service.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* v0.3.12 — Context text helpers shared by the controller when resolving
|
|
3
|
-
* version-bound references (file_range etc.). Pure and unit-tested.
|
|
4
|
-
*/
|
|
5
|
-
export interface ExtractedLines {
|
|
6
|
-
readonly text: string;
|
|
7
|
-
/** True when the requested range reached the end of the file before endLine. */
|
|
8
|
-
readonly clampedAtEnd: boolean;
|
|
9
|
-
}
|
|
10
|
-
/** Extract a 1-based inclusive line range. Never throws for out-of-range input. */
|
|
11
|
-
export declare function extractLineRange(content: string, startLine: number, endLine: number): ExtractedLines;
|
|
12
|
-
/** Soft per-reference byte budget for line content sent to the model context. */
|
|
13
|
-
export declare function enforceContextBudget(text: string, maxBytes: number): {
|
|
14
|
-
readonly text: string;
|
|
15
|
-
readonly truncated: boolean;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=context-text.d.ts.map
|
package/dist/web/context-text.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* v0.3.12 — Context text helpers shared by the controller when resolving
|
|
4
|
-
* version-bound references (file_range etc.). Pure and unit-tested.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.extractLineRange = extractLineRange;
|
|
8
|
-
exports.enforceContextBudget = enforceContextBudget;
|
|
9
|
-
/** Extract a 1-based inclusive line range. Never throws for out-of-range input. */
|
|
10
|
-
function extractLineRange(content, startLine, endLine) {
|
|
11
|
-
const start = Math.max(1, Math.trunc(startLine));
|
|
12
|
-
const end = Math.max(start, Math.trunc(endLine));
|
|
13
|
-
const lines = content.split('\n');
|
|
14
|
-
if (start > lines.length) {
|
|
15
|
-
return Object.freeze({ text: '', clampedAtEnd: true });
|
|
16
|
-
}
|
|
17
|
-
const last = Math.min(end, lines.length);
|
|
18
|
-
const slice = lines.slice(start - 1, last);
|
|
19
|
-
return Object.freeze({
|
|
20
|
-
text: slice.join('\n'),
|
|
21
|
-
clampedAtEnd: end > lines.length,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/** Soft per-reference byte budget for line content sent to the model context. */
|
|
25
|
-
function enforceContextBudget(text, maxBytes) {
|
|
26
|
-
if (Buffer.byteLength(text, 'utf8') <= maxBytes) {
|
|
27
|
-
return Object.freeze({ text, truncated: false });
|
|
28
|
-
}
|
|
29
|
-
let low = 0;
|
|
30
|
-
let high = text.length;
|
|
31
|
-
while (low < high) {
|
|
32
|
-
const mid = (low + high + 1) >>> 1;
|
|
33
|
-
if (Buffer.byteLength(text.slice(0, mid), 'utf8') <= maxBytes)
|
|
34
|
-
low = mid;
|
|
35
|
-
else
|
|
36
|
-
high = mid - 1;
|
|
37
|
-
}
|
|
38
|
-
return Object.freeze({ text: text.slice(0, low), truncated: true });
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=context-text.js.map
|
package/dist/web/errors.d.ts
DELETED
package/dist/web/errors.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebWorkbenchError = void 0;
|
|
4
|
-
class WebWorkbenchError extends Error {
|
|
5
|
-
constructor(status, message, code = status === 409 ? 'request_conflict' : 'web_workbench_error') {
|
|
6
|
-
super(message);
|
|
7
|
-
this.status = status;
|
|
8
|
-
this.code = code;
|
|
9
|
-
this.name = 'WebWorkbenchError';
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.WebWorkbenchError = WebWorkbenchError;
|
|
13
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/web/event-hub.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ServerResponse } from 'http';
|
|
2
|
-
import type { AgentRuntimeEvent } from '../runtime/agent-runtime-protocol';
|
|
3
|
-
import type { RuntimeEventEnvelopeV1 } from '../runtime/protocol/runtime-protocol-v1';
|
|
4
|
-
import { type WebEventEnvelopeV1, type WebWorkbenchEventV1 } from './protocol';
|
|
5
|
-
export interface WebEventHubOptions {
|
|
6
|
-
readonly maxEvents?: number;
|
|
7
|
-
readonly maxBytes?: number;
|
|
8
|
-
readonly now?: () => number;
|
|
9
|
-
}
|
|
10
|
-
/** Bounded fan-out and reconnect replay for browser consumers. */
|
|
11
|
-
export declare class WebEventHub {
|
|
12
|
-
private readonly retained;
|
|
13
|
-
private readonly clients;
|
|
14
|
-
private readonly transcriptContents;
|
|
15
|
-
private readonly maxEvents;
|
|
16
|
-
private readonly maxBytes;
|
|
17
|
-
private readonly now;
|
|
18
|
-
private nextCursor;
|
|
19
|
-
private retainedBytes;
|
|
20
|
-
private discardedDurableThrough;
|
|
21
|
-
private replayResetCount;
|
|
22
|
-
constructor(options?: WebEventHubOptions);
|
|
23
|
-
emitRuntime(event: AgentRuntimeEvent, context?: {
|
|
24
|
-
readonly sessionId?: string;
|
|
25
|
-
readonly threadId?: string;
|
|
26
|
-
}): WebEventEnvelopeV1;
|
|
27
|
-
emitThread(event: RuntimeEventEnvelopeV1, sessionId: string): WebEventEnvelopeV1;
|
|
28
|
-
emit(event: WebWorkbenchEventV1, durable?: boolean, context?: {
|
|
29
|
-
readonly sessionId?: string;
|
|
30
|
-
readonly threadId?: string;
|
|
31
|
-
}): WebEventEnvelopeV1;
|
|
32
|
-
attach(response: ServerResponse, cursor: number): () => void;
|
|
33
|
-
heartbeat(): void;
|
|
34
|
-
close(): void;
|
|
35
|
-
snapshot(): {
|
|
36
|
-
readonly earliest: number;
|
|
37
|
-
readonly latest: number;
|
|
38
|
-
readonly retained: number;
|
|
39
|
-
readonly replayResets: number;
|
|
40
|
-
};
|
|
41
|
-
private trim;
|
|
42
|
-
private compactRuntimeEvent;
|
|
43
|
-
private rememberTranscriptContent;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=event-hub.d.ts.map
|