@orion-agents/orion-code 0.3.65 → 0.4.3
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 +128 -2
- package/README.md +78 -361
- package/README.zh-CN.md +71 -263
- package/bin/orion +4 -1
- package/dist/acp/session-updates.d.ts +34 -0
- package/dist/acp/session-updates.js +162 -0
- package/dist/acp/sessions.d.ts +32 -0
- package/dist/acp/sessions.js +315 -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 +5 -1
- package/dist/commands/diagnostic-command-handlers.js +20 -6
- 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 +0 -18
- 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/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/framework/loop-budget-contract.d.ts +7 -2
- package/dist/framework/loop-budget-contract.js +4 -1
- package/dist/framework/loop-progress.d.ts +22 -0
- package/dist/framework/loop-progress.js +79 -0
- package/dist/framework/prompt.d.ts +0 -2
- package/dist/framework/prompt.js +9 -27
- package/dist/framework/query.d.ts +27 -20
- package/dist/framework/query.js +453 -153
- 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 +31 -12
- package/dist/harness/context-harness.js +491 -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/intent.js +21 -0
- package/dist/harness/ledger.d.ts +6 -11
- package/dist/harness/ledger.js +39 -9
- package/dist/harness/progress-controller.d.ts +12 -7
- package/dist/harness/progress-controller.js +66 -21
- package/dist/harness/state.js +9 -1
- package/dist/harness/task-checklist.d.ts +16 -0
- package/dist/harness/task-checklist.js +95 -0
- package/dist/harness/types.d.ts +73 -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 +38 -0
- package/dist/print-ui/event-stream.js +187 -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 +11 -2
- package/dist/runtime/agent-loop.js +165 -25
- package/dist/runtime/agent-runtime-controller.d.ts +13 -3
- package/dist/runtime/agent-runtime-controller.js +347 -183
- 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 +11 -1
- package/dist/runtime/goal-lifecycle-v2.js +85 -15
- package/dist/runtime/goal-runtime-coordinator.d.ts +10 -1
- package/dist/runtime/goal-runtime-coordinator.js +81 -24
- package/dist/runtime/loop-budget.js +7 -5
- 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 +135 -39
- 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 +128 -52
- package/dist/runtime/release-receipts.d.ts +24 -124
- package/dist/runtime/release-receipts.js +129 -683
- 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 +351 -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 +1 -0
- package/dist/runtime/subagents/policy.js +0 -1
- package/dist/runtime/subagents/production.js +1 -1
- 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 +342 -0
- package/dist/runtime/task-context-service.d.ts +16 -10
- package/dist/runtime/task-context-service.js +35 -4
- package/dist/runtime/thread-admission.d.ts +1 -1
- package/dist/runtime/thread-admission.js +12 -6
- 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 +7 -0
- package/dist/runtime/thread-runtime.js +43 -0
- 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 +88 -11
- package/dist/runtime/tool-gateway.d.ts +7 -0
- package/dist/runtime/tool-gateway.js +20 -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 +12 -0
- package/dist/runtime/ui-view-model.d.ts +6 -5
- package/dist/runtime/ui-view-model.js +33 -19
- package/dist/runtime/workspace-runtime-kernel.js +0 -1
- 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 +30 -45
- 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 -56
- package/dist/services/global-config.js +213 -183
- package/dist/services/llm.d.ts +40 -4
- package/dist/services/llm.js +164 -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 +7 -0
- package/dist/services/provider-diagnostics.js +9 -10
- 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 +2 -0
- package/dist/tools/core/write-file.js +5 -0
- 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 +76 -31
- 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 +22 -27
- 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 +562 -0
- package/docs/orion.example.yaml +42 -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-iBYj9ZRf.js +0 -1
- package/dist/web-client/assets/GitPanel-D33R_bZr.js +0 -4
- package/dist/web-client/assets/ReviewPanel-C_0upsDk.js +0 -6
- package/dist/web-client/assets/TerminalPanel-C7A8dMNf.js +0 -23
- package/dist/web-client/assets/TerminalPanel-DLuoa74B.css +0 -1
- package/dist/web-client/assets/index-BaOxrwGB.css +0 -1
- package/dist/web-client/assets/index-CqCgJ2ov.js +0 -20
- package/dist/web-client/assets/useAutoNotice-C1qM-_Sg.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,299 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Orion Code - scoped tool allowlist rule engine.
|
|
4
|
-
*
|
|
5
|
-
* Contract (v0.1.3-2 §1.3 / P1-B / P1-E)
|
|
6
|
-
* ======================================
|
|
7
|
-
*
|
|
8
|
-
* Scope
|
|
9
|
-
* -----
|
|
10
|
-
* Project rules live in `ProjectConfig.allowedTools`; machine-wide rules live in
|
|
11
|
-
* `GlobalConfig.allowedTools`. Both are evaluated for a project and the most
|
|
12
|
-
* restrictive matching effect wins. Project rules win ties for clearer audit
|
|
13
|
-
* attribution.
|
|
14
|
-
*
|
|
15
|
-
* Grammar
|
|
16
|
-
* -------
|
|
17
|
-
* rule := [effect ":"] tool [ "(" pattern ")" ]
|
|
18
|
-
* effect := "allow" | "ask" | "deny" (default: "allow")
|
|
19
|
-
* tool := exact tool name (e.g. `exec_command`, `write_file`) or `*`
|
|
20
|
-
* pattern := glob over the tool's canonical subject; `*` = any run of chars,
|
|
21
|
-
* `?` = exactly one char. Everything else is literal.
|
|
22
|
-
*
|
|
23
|
-
* Tool names are the *real* runtime names (`exec_command`, `read_file`,
|
|
24
|
-
* `write_file`, `edit_file`, `web_fetch`, ...). There is no `Bash(...)` alias.
|
|
25
|
-
*
|
|
26
|
-
* Canonical subject
|
|
27
|
-
* -----------------
|
|
28
|
-
* The subject is the first non-empty string argument found in
|
|
29
|
-
* {@link SUBJECT_ARG_KEYS} order, with runs of whitespace collapsed. For
|
|
30
|
-
* `exec_command` that is the command line, for file tools the path, for web
|
|
31
|
-
* tools the URL. A rule without a pattern matches any subject.
|
|
32
|
-
*
|
|
33
|
-
* Precedence (most restrictive wins, order in the array is irrelevant)
|
|
34
|
-
* -------------------------------------------------------------------
|
|
35
|
-
* deny > ask > allow
|
|
36
|
-
*
|
|
37
|
-
* A rule with a pattern whose subject cannot be determined matches only for the
|
|
38
|
-
* restrictive effects (`deny`, `ask`); `allow` fails closed and does not match.
|
|
39
|
-
*
|
|
40
|
-
* Safety envelope (enforced by the scheduler, documented here)
|
|
41
|
-
* -----------------------------------------------------------
|
|
42
|
-
* `allow` is an explicit durable user approval and skips later interactive
|
|
43
|
-
* confirmations for that tool. It can never override `checkPermissions() ===
|
|
44
|
-
* 'deny'` or an explicit `ask`/`deny` rule. Agent modes do not remove tools;
|
|
45
|
-
* PLAN inherits the current permission policy and AUTO supplies its own grant.
|
|
46
|
-
*
|
|
47
|
-
* Compatibility
|
|
48
|
-
* -------------
|
|
49
|
-
* Unparseable entries are ignored and reported through `invalid` so callers can
|
|
50
|
-
* surface them; a malformed rule never becomes a silent allow. Configs written
|
|
51
|
-
* before this engine existed contain plain tool names, which keep their natural
|
|
52
|
-
* meaning ("auto-approve this tool").
|
|
53
|
-
*/
|
|
54
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.resolveToolAllowlist = exports.SUBJECT_ARG_KEYS = void 0;
|
|
56
|
-
exports.isToolPermissionScope = isToolPermissionScope;
|
|
57
|
-
exports.parseAllowlistRules = parseAllowlistRules;
|
|
58
|
-
exports.describeAllowlistSubject = describeAllowlistSubject;
|
|
59
|
-
exports.matchAllowlistRules = matchAllowlistRules;
|
|
60
|
-
exports.createAllowlistEvaluator = createAllowlistEvaluator;
|
|
61
|
-
exports.resolveProjectToolAllowlist = resolveProjectToolAllowlist;
|
|
62
|
-
exports.grantToolPermission = grantToolPermission;
|
|
63
|
-
const global_config_1 = require("./global-config");
|
|
64
|
-
function isToolPermissionScope(value) {
|
|
65
|
-
return value === 'once' || value === 'project' || value === 'global';
|
|
66
|
-
}
|
|
67
|
-
// ============================================================================
|
|
68
|
-
// Parsing
|
|
69
|
-
// ============================================================================
|
|
70
|
-
const EFFECT_PREFIX = /^(allow|ask|deny)\s*:\s*/i;
|
|
71
|
-
const TOOL_NAME_RE = /^[A-Za-z0-9_*][A-Za-z0-9_.-]*$/;
|
|
72
|
-
const EFFECT_RANK = { allow: 0, ask: 1, deny: 2 };
|
|
73
|
-
/** Argument keys probed, in order, to derive a rule-matching subject. */
|
|
74
|
-
exports.SUBJECT_ARG_KEYS = [
|
|
75
|
-
'command',
|
|
76
|
-
'file_path',
|
|
77
|
-
'path',
|
|
78
|
-
'url',
|
|
79
|
-
'pattern',
|
|
80
|
-
'query',
|
|
81
|
-
];
|
|
82
|
-
/**
|
|
83
|
-
* Anchored glob match implemented without regular expressions.
|
|
84
|
-
*
|
|
85
|
-
* A compiled `^...$` RegExp built from a `*`-heavy glob is a catastrophic
|
|
86
|
-
* backtracking (ReDoS) hazard: patterns come from user configuration while
|
|
87
|
-
* subjects come from model-produced tool arguments, so neither side is a
|
|
88
|
-
* trusted constant. The two-pointer algorithm below keeps a single backtrack
|
|
89
|
-
* anchor for the most recent `*`, which bounds the work at
|
|
90
|
-
* O(pattern x subject) with O(1) extra state and no recursion.
|
|
91
|
-
*
|
|
92
|
-
* Comparison walks code points, so an astral character counts as exactly one
|
|
93
|
-
* `?`. `*` spans any run of characters including newlines.
|
|
94
|
-
*/
|
|
95
|
-
function globMatches(pattern, subject) {
|
|
96
|
-
const p = Array.from(pattern);
|
|
97
|
-
const s = Array.from(subject);
|
|
98
|
-
let pi = 0;
|
|
99
|
-
let si = 0;
|
|
100
|
-
let starPi = -1;
|
|
101
|
-
let starSi = 0;
|
|
102
|
-
while (si < s.length) {
|
|
103
|
-
const token = pi < p.length ? p[pi] : undefined;
|
|
104
|
-
if (token === '*') {
|
|
105
|
-
starPi = pi;
|
|
106
|
-
starSi = si;
|
|
107
|
-
pi += 1;
|
|
108
|
-
}
|
|
109
|
-
else if (token === '?' || (token !== undefined && token === s[si])) {
|
|
110
|
-
pi += 1;
|
|
111
|
-
si += 1;
|
|
112
|
-
}
|
|
113
|
-
else if (starPi >= 0) {
|
|
114
|
-
// Let the most recent `*` swallow one more character and retry.
|
|
115
|
-
starSi += 1;
|
|
116
|
-
si = starSi;
|
|
117
|
-
pi = starPi + 1;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
while (pi < p.length && p[pi] === '*')
|
|
124
|
-
pi += 1;
|
|
125
|
-
return pi === p.length;
|
|
126
|
-
}
|
|
127
|
-
function parseAllowlistRule(entry) {
|
|
128
|
-
const source = entry.trim();
|
|
129
|
-
if (!source || source.startsWith('#'))
|
|
130
|
-
return undefined;
|
|
131
|
-
let rest = source;
|
|
132
|
-
let effect = 'allow';
|
|
133
|
-
const prefix = rest.match(EFFECT_PREFIX);
|
|
134
|
-
if (prefix) {
|
|
135
|
-
effect = prefix[1].toLowerCase();
|
|
136
|
-
rest = rest.slice(prefix[0].length).trim();
|
|
137
|
-
}
|
|
138
|
-
if (!rest)
|
|
139
|
-
return undefined;
|
|
140
|
-
let tool = rest;
|
|
141
|
-
let pattern;
|
|
142
|
-
const open = rest.indexOf('(');
|
|
143
|
-
if (open >= 0) {
|
|
144
|
-
if (!rest.endsWith(')'))
|
|
145
|
-
return undefined;
|
|
146
|
-
tool = rest.slice(0, open).trim();
|
|
147
|
-
pattern = rest.slice(open + 1, -1).trim();
|
|
148
|
-
// `tool()` is meaningless: an empty glob would only match an empty subject
|
|
149
|
-
// and is far more likely to be a typo than an intentional rule.
|
|
150
|
-
if (!pattern)
|
|
151
|
-
return undefined;
|
|
152
|
-
}
|
|
153
|
-
if (!TOOL_NAME_RE.test(tool))
|
|
154
|
-
return undefined;
|
|
155
|
-
if (tool.includes('*') && tool !== '*')
|
|
156
|
-
return undefined;
|
|
157
|
-
return { source, effect, tool, pattern };
|
|
158
|
-
}
|
|
159
|
-
/** Parse raw `allowedTools` entries. Invalid entries are reported, never applied. */
|
|
160
|
-
function parseAllowlistRules(entries) {
|
|
161
|
-
const rules = [];
|
|
162
|
-
const invalid = [];
|
|
163
|
-
if (!entries)
|
|
164
|
-
return { rules, invalid };
|
|
165
|
-
for (const entry of entries) {
|
|
166
|
-
if (typeof entry !== 'string') {
|
|
167
|
-
invalid.push(String(entry));
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
const trimmed = entry.trim();
|
|
171
|
-
if (!trimmed || trimmed.startsWith('#'))
|
|
172
|
-
continue;
|
|
173
|
-
const rule = parseAllowlistRule(entry);
|
|
174
|
-
if (rule) {
|
|
175
|
-
rules.push(rule);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
invalid.push(trimmed);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return { rules, invalid };
|
|
182
|
-
}
|
|
183
|
-
// ============================================================================
|
|
184
|
-
// Matching
|
|
185
|
-
// ============================================================================
|
|
186
|
-
/** Derive the canonical subject a pattern is matched against. */
|
|
187
|
-
function describeAllowlistSubject(_toolName, args) {
|
|
188
|
-
if (!args)
|
|
189
|
-
return undefined;
|
|
190
|
-
for (const key of exports.SUBJECT_ARG_KEYS) {
|
|
191
|
-
const value = args[key];
|
|
192
|
-
if (typeof value === 'string') {
|
|
193
|
-
const normalized = value.replace(/\s+/g, ' ').trim();
|
|
194
|
-
if (normalized)
|
|
195
|
-
return normalized;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return undefined;
|
|
199
|
-
}
|
|
200
|
-
function ruleMatches(rule, toolName, subject) {
|
|
201
|
-
if (rule.tool !== '*' && rule.tool !== toolName)
|
|
202
|
-
return false;
|
|
203
|
-
if (rule.pattern === undefined)
|
|
204
|
-
return true;
|
|
205
|
-
if (subject === undefined) {
|
|
206
|
-
// Unknown subject: restrictive rules still apply (fail closed), permissive
|
|
207
|
-
// ones do not (never auto-approve something we could not inspect).
|
|
208
|
-
return rule.effect !== 'allow';
|
|
209
|
-
}
|
|
210
|
-
return globMatches(rule.pattern, subject);
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Evaluate a tool call against parsed rules.
|
|
214
|
-
* Returns the most restrictive matching rule, or undefined when nothing matched.
|
|
215
|
-
*/
|
|
216
|
-
function matchAllowlistRules(rules, toolName, args) {
|
|
217
|
-
if (rules.length === 0)
|
|
218
|
-
return undefined;
|
|
219
|
-
const subject = describeAllowlistSubject(toolName, args);
|
|
220
|
-
let winner;
|
|
221
|
-
for (const rule of rules) {
|
|
222
|
-
if (!ruleMatches(rule, toolName, subject))
|
|
223
|
-
continue;
|
|
224
|
-
if (!winner || EFFECT_RANK[rule.effect] > EFFECT_RANK[winner.effect]) {
|
|
225
|
-
winner = rule;
|
|
226
|
-
if (winner.effect === 'deny')
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return winner ? { effect: winner.effect, rule: winner.source } : undefined;
|
|
231
|
-
}
|
|
232
|
-
/** Build a pure evaluator from parsed rules. Returns undefined when there is nothing to enforce. */
|
|
233
|
-
function createAllowlistEvaluator(rules) {
|
|
234
|
-
if (rules.length === 0)
|
|
235
|
-
return undefined;
|
|
236
|
-
const frozen = [...rules];
|
|
237
|
-
return (toolName, args) => matchAllowlistRules(frozen, toolName, args ?? {});
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Load and compile the allowlist for a project path.
|
|
241
|
-
* Missing/empty configuration yields no evaluator, i.e. unchanged behaviour.
|
|
242
|
-
*/
|
|
243
|
-
function resolveProjectToolAllowlist(projectPath) {
|
|
244
|
-
let globalEntries;
|
|
245
|
-
let projectEntries;
|
|
246
|
-
try {
|
|
247
|
-
const config = (0, global_config_1.loadGlobalConfig)();
|
|
248
|
-
globalEntries = config.allowedTools;
|
|
249
|
-
projectEntries = config.projects?.[projectPath]?.allowedTools;
|
|
250
|
-
}
|
|
251
|
-
catch {
|
|
252
|
-
globalEntries = undefined;
|
|
253
|
-
projectEntries = undefined;
|
|
254
|
-
}
|
|
255
|
-
const global = parseAllowlistRules(globalEntries);
|
|
256
|
-
const project = parseAllowlistRules(projectEntries);
|
|
257
|
-
const rules = [...global.rules, ...project.rules];
|
|
258
|
-
const invalid = [...global.invalid, ...project.invalid];
|
|
259
|
-
const globalEvaluator = createAllowlistEvaluator(global.rules);
|
|
260
|
-
const projectEvaluator = createAllowlistEvaluator(project.rules);
|
|
261
|
-
const evaluator = globalEvaluator || projectEvaluator
|
|
262
|
-
? (toolName, args) => {
|
|
263
|
-
const globalMatch = globalEvaluator?.(toolName, args);
|
|
264
|
-
const projectMatch = projectEvaluator?.(toolName, args);
|
|
265
|
-
if (!globalMatch)
|
|
266
|
-
return projectMatch ? { ...projectMatch, scope: 'project' } : undefined;
|
|
267
|
-
if (!projectMatch)
|
|
268
|
-
return { ...globalMatch, scope: 'global' };
|
|
269
|
-
return EFFECT_RANK[projectMatch.effect] >= EFFECT_RANK[globalMatch.effect]
|
|
270
|
-
? { ...projectMatch, scope: 'project' }
|
|
271
|
-
: { ...globalMatch, scope: 'global' };
|
|
272
|
-
}
|
|
273
|
-
: undefined;
|
|
274
|
-
return { rules, invalid, global, project, evaluator };
|
|
275
|
-
}
|
|
276
|
-
/** Alias with scope-neutral naming for new callers. */
|
|
277
|
-
exports.resolveToolAllowlist = resolveProjectToolAllowlist;
|
|
278
|
-
function appendToolGrant(entries, toolName) {
|
|
279
|
-
if (!TOOL_NAME_RE.test(toolName) || toolName === '*' || toolName.includes('*')) {
|
|
280
|
-
throw new Error(`Cannot persist permission for invalid tool name: ${toolName}`);
|
|
281
|
-
}
|
|
282
|
-
const parsed = parseAllowlistRules(entries);
|
|
283
|
-
const alreadyGranted = parsed.rules.some(rule => rule.effect === 'allow' && rule.tool === toolName && rule.pattern === undefined);
|
|
284
|
-
return alreadyGranted ? [...(entries ?? [])] : [...(entries ?? []), `allow:${toolName}`];
|
|
285
|
-
}
|
|
286
|
-
/** Persist an explicit interactive approval before the waiting tool is resumed. */
|
|
287
|
-
function grantToolPermission(scope, projectPath, toolName) {
|
|
288
|
-
if (scope === 'global') {
|
|
289
|
-
const config = (0, global_config_1.loadGlobalConfig)();
|
|
290
|
-
(0, global_config_1.updateGlobalConfig)({ allowedTools: appendToolGrant(config.allowedTools, toolName) });
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
const project = (0, global_config_1.getProjectConfig)(projectPath);
|
|
294
|
-
(0, global_config_1.saveProjectConfig)(projectPath, {
|
|
295
|
-
...project,
|
|
296
|
-
allowedTools: appendToolGrant(project.allowedTools, toolName),
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
//# sourceMappingURL=tool-allowlist.js.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* orion code - YAML Config Loader
|
|
3
|
-
*
|
|
4
|
-
* 支持 YAML 和 JSON 配置文件加载
|
|
5
|
-
*/
|
|
6
|
-
export interface YAMLConfig {
|
|
7
|
-
orion?: {
|
|
8
|
-
version?: string;
|
|
9
|
-
model?: {
|
|
10
|
-
provider?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
fallback?: string;
|
|
13
|
-
};
|
|
14
|
-
memory?: {
|
|
15
|
-
vector_enabled?: boolean;
|
|
16
|
-
embedding_provider?: string;
|
|
17
|
-
embedding_model?: string;
|
|
18
|
-
};
|
|
19
|
-
mcp?: {
|
|
20
|
-
servers?: Record<string, MCPServerConfig>;
|
|
21
|
-
};
|
|
22
|
-
skills?: {
|
|
23
|
-
auto_enable?: string[];
|
|
24
|
-
custom_path?: string;
|
|
25
|
-
};
|
|
26
|
-
agents?: {
|
|
27
|
-
max_workers?: number;
|
|
28
|
-
timeout?: number;
|
|
29
|
-
};
|
|
30
|
-
cli?: {
|
|
31
|
-
theme?: string;
|
|
32
|
-
show_costs?: boolean;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface MCPServerConfig {
|
|
37
|
-
command: string;
|
|
38
|
-
args?: string[];
|
|
39
|
-
env?: Record<string, string>;
|
|
40
|
-
}
|
|
41
|
-
export declare class YAMLConfigLoader {
|
|
42
|
-
/** Load project config */
|
|
43
|
-
loadProjectConfig(projectPath?: string): YAMLConfig | null;
|
|
44
|
-
/** Load global config */
|
|
45
|
-
loadGlobalConfig(): YAMLConfig | null;
|
|
46
|
-
/** Load config from file */
|
|
47
|
-
private loadFile;
|
|
48
|
-
/** Merge configs with priority */
|
|
49
|
-
mergeConfigs(project: YAMLConfig | null, global: YAMLConfig | null): YAMLConfig;
|
|
50
|
-
/** Load all configs with priority */
|
|
51
|
-
loadAll(): YAMLConfig;
|
|
52
|
-
/** Generate config template */
|
|
53
|
-
generateTemplate(): string;
|
|
54
|
-
}
|
|
55
|
-
export declare function getYAMLConfigLoader(): YAMLConfigLoader;
|
|
56
|
-
export declare function resetYAMLConfigLoader(): void;
|
|
57
|
-
//# sourceMappingURL=yaml-config.d.ts.map
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* orion code - YAML Config Loader
|
|
4
|
-
*
|
|
5
|
-
* 支持 YAML 和 JSON 配置文件加载
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.YAMLConfigLoader = void 0;
|
|
9
|
-
exports.getYAMLConfigLoader = getYAMLConfigLoader;
|
|
10
|
-
exports.resetYAMLConfigLoader = resetYAMLConfigLoader;
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
|
-
const path_1 = require("path");
|
|
13
|
-
const js_yaml_1 = require("js-yaml");
|
|
14
|
-
const config_dir_1 = require("./config-dir");
|
|
15
|
-
const errors_1 = require("../utils/errors");
|
|
16
|
-
const version_1 = require("../product/version");
|
|
17
|
-
// ============================================================================
|
|
18
|
-
// Config File Locations
|
|
19
|
-
// ============================================================================
|
|
20
|
-
const CONFIG_FILES = [
|
|
21
|
-
'.orion-code.yaml',
|
|
22
|
-
'.orion-code.yml',
|
|
23
|
-
'.orion-code.json',
|
|
24
|
-
'orion-code.yaml',
|
|
25
|
-
'orion-code.yml',
|
|
26
|
-
'orion.json',
|
|
27
|
-
];
|
|
28
|
-
const GLOBAL_CONFIG_FILE = 'orion-code.yaml';
|
|
29
|
-
// ============================================================================
|
|
30
|
-
// YAML Config Loader
|
|
31
|
-
// ============================================================================
|
|
32
|
-
class YAMLConfigLoader {
|
|
33
|
-
/** Load project config */
|
|
34
|
-
loadProjectConfig(projectPath) {
|
|
35
|
-
const cwd = projectPath || process.cwd();
|
|
36
|
-
for (const filename of CONFIG_FILES) {
|
|
37
|
-
const filePath = (0, path_1.join)(cwd, filename);
|
|
38
|
-
if ((0, fs_1.existsSync)(filePath)) {
|
|
39
|
-
return this.loadFile(filePath);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
/** Load global config */
|
|
45
|
-
loadGlobalConfig() {
|
|
46
|
-
const configHome = (0, config_dir_1.getConfigHome)();
|
|
47
|
-
// Try YAML first
|
|
48
|
-
const yamlPath = (0, path_1.join)(configHome, GLOBAL_CONFIG_FILE);
|
|
49
|
-
if ((0, fs_1.existsSync)(yamlPath)) {
|
|
50
|
-
return this.loadFile(yamlPath);
|
|
51
|
-
}
|
|
52
|
-
// Try JSON as fallback
|
|
53
|
-
const jsonPath = (0, path_1.join)(configHome, 'orion.json');
|
|
54
|
-
if ((0, fs_1.existsSync)(jsonPath)) {
|
|
55
|
-
return this.loadFile(jsonPath);
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
/** Load config from file */
|
|
60
|
-
loadFile(filePath) {
|
|
61
|
-
try {
|
|
62
|
-
const content = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
63
|
-
if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) {
|
|
64
|
-
return (0, js_yaml_1.load)(content);
|
|
65
|
-
}
|
|
66
|
-
// JSON format
|
|
67
|
-
return JSON.parse(content);
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
console.warn(`[YAMLConfig] Failed to load ${filePath}: ${(0, errors_1.errorMessage)(err)}`);
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/** Merge configs with priority */
|
|
75
|
-
mergeConfigs(project, global) {
|
|
76
|
-
const merged = {
|
|
77
|
-
orion: {},
|
|
78
|
-
};
|
|
79
|
-
// Global config (lower priority)
|
|
80
|
-
if (global?.orion) {
|
|
81
|
-
merged.orion = { ...global.orion };
|
|
82
|
-
}
|
|
83
|
-
// Project config (higher priority, overrides global)
|
|
84
|
-
if (project?.orion) {
|
|
85
|
-
merged.orion = {
|
|
86
|
-
...merged.orion,
|
|
87
|
-
...project.orion,
|
|
88
|
-
// Deep merge nested objects
|
|
89
|
-
model: {
|
|
90
|
-
...merged.orion?.model,
|
|
91
|
-
...project.orion?.model,
|
|
92
|
-
},
|
|
93
|
-
memory: {
|
|
94
|
-
...merged.orion?.memory,
|
|
95
|
-
...project.orion?.memory,
|
|
96
|
-
},
|
|
97
|
-
mcp: {
|
|
98
|
-
...merged.orion?.mcp,
|
|
99
|
-
servers: {
|
|
100
|
-
...merged.orion?.mcp?.servers,
|
|
101
|
-
...project.orion?.mcp?.servers,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
skills: {
|
|
105
|
-
...merged.orion?.skills,
|
|
106
|
-
...project.orion?.skills,
|
|
107
|
-
},
|
|
108
|
-
agents: {
|
|
109
|
-
...merged.orion?.agents,
|
|
110
|
-
...project.orion?.agents,
|
|
111
|
-
},
|
|
112
|
-
cli: {
|
|
113
|
-
...merged.orion?.cli,
|
|
114
|
-
...project.orion?.cli,
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return merged;
|
|
119
|
-
}
|
|
120
|
-
/** Load all configs with priority */
|
|
121
|
-
loadAll() {
|
|
122
|
-
const global = this.loadGlobalConfig();
|
|
123
|
-
const project = this.loadProjectConfig();
|
|
124
|
-
return this.mergeConfigs(project, global);
|
|
125
|
-
}
|
|
126
|
-
/** Generate config template */
|
|
127
|
-
generateTemplate() {
|
|
128
|
-
const template = `# Orion Code Configuration
|
|
129
|
-
orion:
|
|
130
|
-
version: "${version_1.PACKAGE_VERSION}"
|
|
131
|
-
|
|
132
|
-
model:
|
|
133
|
-
provider: openai
|
|
134
|
-
name: gpt-4o
|
|
135
|
-
fallback: gpt-3.5-turbo
|
|
136
|
-
|
|
137
|
-
memory:
|
|
138
|
-
vector_enabled: true
|
|
139
|
-
embedding_provider: ollama # or openai
|
|
140
|
-
embedding_model: nomic-embed-text
|
|
141
|
-
|
|
142
|
-
mcp:
|
|
143
|
-
servers:
|
|
144
|
-
filesystem:
|
|
145
|
-
command: mcp-server-filesystem
|
|
146
|
-
args: ["--root", "./"]
|
|
147
|
-
|
|
148
|
-
skills:
|
|
149
|
-
auto_enable:
|
|
150
|
-
- code-review
|
|
151
|
-
- security-check
|
|
152
|
-
|
|
153
|
-
agents:
|
|
154
|
-
max_workers: 3
|
|
155
|
-
timeout: 60000
|
|
156
|
-
|
|
157
|
-
cli:
|
|
158
|
-
theme: dark
|
|
159
|
-
show_costs: false
|
|
160
|
-
`;
|
|
161
|
-
return template;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
exports.YAMLConfigLoader = YAMLConfigLoader;
|
|
165
|
-
// ============================================================================
|
|
166
|
-
// Factory
|
|
167
|
-
// ============================================================================
|
|
168
|
-
let defaultLoader = null;
|
|
169
|
-
function getYAMLConfigLoader() {
|
|
170
|
-
if (!defaultLoader) {
|
|
171
|
-
defaultLoader = new YAMLConfigLoader();
|
|
172
|
-
}
|
|
173
|
-
return defaultLoader;
|
|
174
|
-
}
|
|
175
|
-
function resetYAMLConfigLoader() {
|
|
176
|
-
defaultLoader = null;
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=yaml-config.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI option parsing for `orion web` (extracted from the CLI entry so the
|
|
3
|
-
* grammar has a unit-testable surface — issue #218 regression coverage).
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* M42 (Orion Nebula) — the local Web Workbench host binds this by default so
|
|
7
|
-
* `orion web` never collides with common dev-tool ports.
|
|
8
|
-
*/
|
|
9
|
-
export declare const DEFAULT_WEB_PORT = 4242;
|
|
10
|
-
export interface WebCliOptions {
|
|
11
|
-
readonly port: number;
|
|
12
|
-
readonly open: boolean;
|
|
13
|
-
readonly cwd: string;
|
|
14
|
-
readonly background: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare function parseWebCliOptions(args: readonly string[]): WebCliOptions;
|
|
17
|
-
//# sourceMappingURL=cli-options.d.ts.map
|
package/dist/web/cli-options.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CLI option parsing for `orion web` (extracted from the CLI entry so the
|
|
4
|
-
* grammar has a unit-testable surface — issue #218 regression coverage).
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DEFAULT_WEB_PORT = void 0;
|
|
8
|
-
exports.parseWebCliOptions = parseWebCliOptions;
|
|
9
|
-
/**
|
|
10
|
-
* M42 (Orion Nebula) — the local Web Workbench host binds this by default so
|
|
11
|
-
* `orion web` never collides with common dev-tool ports.
|
|
12
|
-
*/
|
|
13
|
-
exports.DEFAULT_WEB_PORT = 4242;
|
|
14
|
-
function parseWebCliOptions(args) {
|
|
15
|
-
let port = exports.DEFAULT_WEB_PORT;
|
|
16
|
-
let open = true;
|
|
17
|
-
let cwd = process.cwd();
|
|
18
|
-
let background = false;
|
|
19
|
-
for (let index = 0; index < args.length; index++) {
|
|
20
|
-
const argument = args[index];
|
|
21
|
-
if (argument === '--background' || argument === '--daemon') {
|
|
22
|
-
background = true;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (argument === '--no-open') {
|
|
26
|
-
open = false;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (argument === '--port' || argument.startsWith('--port=')) {
|
|
30
|
-
const portValue = argument === '--port' ? args[++index] : argument.slice('--port='.length);
|
|
31
|
-
if (!portValue || !/^\d+$/u.test(portValue)) {
|
|
32
|
-
throw new Error('--port must be an integer from 0 through 65535.');
|
|
33
|
-
}
|
|
34
|
-
port = Number(portValue);
|
|
35
|
-
if (!Number.isSafeInteger(port) || port < 0 || port > 65535) {
|
|
36
|
-
throw new Error('--port must be an integer from 0 through 65535.');
|
|
37
|
-
}
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (argument === '--cwd' || argument.startsWith('--cwd=')) {
|
|
41
|
-
const cwdValue = argument === '--cwd' ? args[++index] : argument.slice('--cwd='.length);
|
|
42
|
-
if (!cwdValue?.trim())
|
|
43
|
-
throw new Error('--cwd requires a directory path.');
|
|
44
|
-
cwd = cwdValue;
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
throw new Error(`Unknown orion web option: ${argument}`);
|
|
48
|
-
}
|
|
49
|
-
return { port, open, cwd, background };
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=cli-options.js.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { type CodeReviewResultV1, type ReviewRunStateV1, type ReviewSelectorV1 } from '../services/code-review/contract';
|
|
2
|
-
import { runCodeReview, type ReviewModelAdapterV1 } from '../services/code-review/runner';
|
|
3
|
-
export interface WebCodeReviewRunRecordV1 {
|
|
4
|
-
readonly runId: string;
|
|
5
|
-
readonly selector: ReviewSelectorV1;
|
|
6
|
-
readonly status: ReviewRunStateV1 | 'running';
|
|
7
|
-
readonly startedAt: number;
|
|
8
|
-
readonly endedAt: number | null;
|
|
9
|
-
/** Repository revision captured at admission; compared against the current
|
|
10
|
-
* value on read to mark a stored receipt stale. */
|
|
11
|
-
readonly repositoryRevisionAtAdmission: string;
|
|
12
|
-
/** fileKey -> path mapping captured with the frozen snapshot, so findings
|
|
13
|
-
* can be anchored to a diff without changing the receipt contract. */
|
|
14
|
-
readonly files: ReadonlyArray<{
|
|
15
|
-
readonly fileKey: string;
|
|
16
|
-
readonly path: string;
|
|
17
|
-
}>;
|
|
18
|
-
/** Present only for finished runs whose receipt passed digest re-verification. */
|
|
19
|
-
readonly result: CodeReviewResultV1 | null;
|
|
20
|
-
readonly failure: {
|
|
21
|
-
readonly kind: string;
|
|
22
|
-
readonly message: string;
|
|
23
|
-
} | null;
|
|
24
|
-
/** Recomputed on read: true when the repository changed since admission. */
|
|
25
|
-
readonly stale: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface WebCodeReviewRunServiceOptionsV1 {
|
|
28
|
-
/** Returns the review model adapter, or null when the Host has no model. */
|
|
29
|
-
readonly adapterProvider: () => ReviewModelAdapterV1 | null;
|
|
30
|
-
/** Workspace root used for the review snapshot; read at start time. */
|
|
31
|
-
readonly cwdProvider: () => string;
|
|
32
|
-
/** Current repository revision, sampled on every read for staleness. */
|
|
33
|
-
readonly repositoryRevisionProvider: () => Promise<string>;
|
|
34
|
-
/** Injectable runner (tests use fakes); defaults to the shared runner. */
|
|
35
|
-
readonly runReview?: typeof runCodeReview;
|
|
36
|
-
readonly now?: () => number;
|
|
37
|
-
/** Bounded receipt history; oldest finished records are evicted first. */
|
|
38
|
-
readonly maxRuns?: number;
|
|
39
|
-
}
|
|
40
|
-
export declare class WebCodeReviewRunServiceV1 {
|
|
41
|
-
private readonly records;
|
|
42
|
-
private readonly inflight;
|
|
43
|
-
private readonly adapterProvider;
|
|
44
|
-
private readonly cwdProvider;
|
|
45
|
-
private readonly repositoryRevisionProvider;
|
|
46
|
-
private readonly runReview;
|
|
47
|
-
private readonly now;
|
|
48
|
-
private readonly maxRuns;
|
|
49
|
-
constructor(options: WebCodeReviewRunServiceOptionsV1);
|
|
50
|
-
/** Admission is synchronous and fast: validate, record, return. The model
|
|
51
|
-
* completion continues in the background. */
|
|
52
|
-
start(selector: ReviewSelectorV1): Promise<{
|
|
53
|
-
readonly runId: string;
|
|
54
|
-
readonly status: 'running';
|
|
55
|
-
}>;
|
|
56
|
-
/** Cancels a running review; finished or unknown runs are a no-op. */
|
|
57
|
-
cancel(runId: string): void;
|
|
58
|
-
list(): Promise<readonly WebCodeReviewRunRecordV1[]>;
|
|
59
|
-
get(runId: string): Promise<WebCodeReviewRunRecordV1>;
|
|
60
|
-
private execute;
|
|
61
|
-
private evictFinished;
|
|
62
|
-
private present;
|
|
63
|
-
}
|
|
64
|
-
/** v0.3.29 — validates the JSON selector accepted by `POST /review/run`.
|
|
65
|
-
* Mirrors the CLI selector contract: worktree scope, base ref scope, optional
|
|
66
|
-
* path filters. Unknown shapes are typed 400s, never guesses. */
|
|
67
|
-
export declare function parseWebReviewSelectorV1(value: unknown): ReviewSelectorV1;
|
|
68
|
-
//# sourceMappingURL=code-review-run-service.d.ts.map
|