@orion-agents/orion-code 0.3.66 → 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 +81 -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 +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 -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 +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-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,406 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Orion Code - Brand Migration Tool
|
|
4
|
-
*
|
|
5
|
-
* One-time migration from OpenHorse → Orion Code.
|
|
6
|
-
* Invoked via: orion migrate openhorse [--dry-run] [--include-env] [--include-project-files]
|
|
7
|
-
*
|
|
8
|
-
* Runs before LLM/config initialization. Copies ~/.openhorse → ~/.orion-code
|
|
9
|
-
* with filename and config-key transformations.
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.migrateBrand = migrateBrand;
|
|
13
|
-
exports.migrateProjectFiles = migrateProjectFiles;
|
|
14
|
-
exports.getMigrationHelp = getMigrationHelp;
|
|
15
|
-
const fs_1 = require("fs");
|
|
16
|
-
const path_1 = require("path");
|
|
17
|
-
const os_1 = require("os");
|
|
18
|
-
const crypto_1 = require("crypto");
|
|
19
|
-
const errors_1 = require("../utils/errors");
|
|
20
|
-
const vector_store_1 = require("../memory/vector-store");
|
|
21
|
-
// ── Constants ─────────────────────────────────────────────────────────────────
|
|
22
|
-
const SOURCE_BRAND = 'openhorse';
|
|
23
|
-
const TARGET_BRAND = 'orion-code';
|
|
24
|
-
const SOURCE_DIR = '.openhorse';
|
|
25
|
-
const TARGET_DIR = '.orion-code';
|
|
26
|
-
/** Files that are renamed during migration. */
|
|
27
|
-
const RENAME_MAP = {
|
|
28
|
-
'openhorse.json': 'orion.json',
|
|
29
|
-
'OPENHORSE.md': 'ORION.md',
|
|
30
|
-
'OPENHORSE.local.md': 'ORION.local.md',
|
|
31
|
-
};
|
|
32
|
-
/** Project-level file renames (relative to project root). */
|
|
33
|
-
const PROJECT_RENAME_MAP = [
|
|
34
|
-
{ from: '.openhorse', to: '.orion-code' },
|
|
35
|
-
{ from: '.openhorse.yaml', to: '.orion-code.yaml' },
|
|
36
|
-
{ from: '.openhorse.yml', to: '.orion-code.yml' },
|
|
37
|
-
{ from: '.openhorse.json', to: '.orion-code.json' },
|
|
38
|
-
{ from: 'openhorse.yaml', to: 'orion-code.yaml' },
|
|
39
|
-
{ from: 'openhorse.yml', to: 'orion-code.yml' },
|
|
40
|
-
{ from: 'openhorse.json', to: 'orion-code.json' },
|
|
41
|
-
{ from: 'OPENHORSE.md', to: 'ORION.md' },
|
|
42
|
-
{ from: 'OPENHORSE.local.md', to: 'ORION.local.md' },
|
|
43
|
-
];
|
|
44
|
-
/** Subdirectories whose contents are copied verbatim. */
|
|
45
|
-
const VERBATIM_DIRS = new Set(['projects', 'skills', 'cost', 'cache', 'backups', 'migration-logs']);
|
|
46
|
-
/** Directories whose parent is renamed (e.g. backups → backups/openhorse). */
|
|
47
|
-
const NESTED_DIRS = {
|
|
48
|
-
backups: 'openhorse',
|
|
49
|
-
'migration-logs': 'openhorse',
|
|
50
|
-
};
|
|
51
|
-
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
52
|
-
function sha256(content) {
|
|
53
|
-
return (0, crypto_1.createHash)('sha256').update(content).digest('hex');
|
|
54
|
-
}
|
|
55
|
-
function treeHash(dir) {
|
|
56
|
-
const hashes = [];
|
|
57
|
-
const walk = (d) => {
|
|
58
|
-
const entries = (0, fs_1.readdirSync)(d, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
59
|
-
for (const entry of entries) {
|
|
60
|
-
const fullPath = (0, path_1.join)(d, entry.name);
|
|
61
|
-
if (entry.isDirectory()) {
|
|
62
|
-
walk(fullPath);
|
|
63
|
-
}
|
|
64
|
-
else if (entry.isFile()) {
|
|
65
|
-
hashes.push(`${fullPath}:${sha256((0, fs_1.readFileSync)(fullPath))}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
if ((0, fs_1.existsSync)(dir))
|
|
70
|
-
walk(dir);
|
|
71
|
-
return sha256(hashes.sort().join('\n'));
|
|
72
|
-
}
|
|
73
|
-
function inventorySource(sourceRoot) {
|
|
74
|
-
let fileCount = 0;
|
|
75
|
-
let totalBytes = 0;
|
|
76
|
-
const walk = (d) => {
|
|
77
|
-
if (!(0, fs_1.existsSync)(d))
|
|
78
|
-
return;
|
|
79
|
-
const entries = (0, fs_1.readdirSync)(d, { withFileTypes: true });
|
|
80
|
-
for (const entry of entries) {
|
|
81
|
-
const fullPath = (0, path_1.join)(d, entry.name);
|
|
82
|
-
if (entry.isDirectory()) {
|
|
83
|
-
walk(fullPath);
|
|
84
|
-
}
|
|
85
|
-
else if (entry.isFile()) {
|
|
86
|
-
fileCount++;
|
|
87
|
-
totalBytes += (0, fs_1.statSync)(fullPath).size;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
walk(sourceRoot);
|
|
92
|
-
return { fileCount, totalBytes, treeSha256: treeHash(sourceRoot) };
|
|
93
|
-
}
|
|
94
|
-
function ensureDir(dir) {
|
|
95
|
-
if (!(0, fs_1.existsSync)(dir)) {
|
|
96
|
-
(0, fs_1.mkdirSync)(dir, { recursive: true, mode: 0o700 });
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function copyFileSafe(src, dest, mode) {
|
|
100
|
-
const content = (0, fs_1.readFileSync)(src);
|
|
101
|
-
(0, fs_1.writeFileSync)(dest, content, { mode: mode ?? 0o600 });
|
|
102
|
-
}
|
|
103
|
-
function copyDirRecursive(srcDir, destDir) {
|
|
104
|
-
const mappings = [];
|
|
105
|
-
ensureDir(destDir);
|
|
106
|
-
const entries = (0, fs_1.readdirSync)(srcDir, { withFileTypes: true });
|
|
107
|
-
for (const entry of entries) {
|
|
108
|
-
const srcPath = (0, path_1.join)(srcDir, entry.name);
|
|
109
|
-
const destPath = (0, path_1.join)(destDir, entry.name);
|
|
110
|
-
if (entry.isDirectory()) {
|
|
111
|
-
mappings.push(...copyDirRecursive(srcPath, destPath));
|
|
112
|
-
}
|
|
113
|
-
else if (entry.isFile()) {
|
|
114
|
-
copyFileSafe(srcPath, destPath);
|
|
115
|
-
mappings.push({ from: srcPath, to: destPath });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return mappings;
|
|
119
|
-
}
|
|
120
|
-
// ── Config key remapping ─────────────────────────────────────────────────────
|
|
121
|
-
function remapConfigKeys(content) {
|
|
122
|
-
try {
|
|
123
|
-
const config = JSON.parse(content);
|
|
124
|
-
// Remap known fields
|
|
125
|
-
const remapped = {};
|
|
126
|
-
for (const [key, value] of Object.entries(config)) {
|
|
127
|
-
remapped[key] = value;
|
|
128
|
-
}
|
|
129
|
-
return JSON.stringify(remapped, null, 2);
|
|
130
|
-
}
|
|
131
|
-
catch {
|
|
132
|
-
return content;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function verifySqlite(path) {
|
|
136
|
-
let db;
|
|
137
|
-
try {
|
|
138
|
-
db = (0, vector_store_1.openBetterSqlite3)(path, { readonly: true });
|
|
139
|
-
const result = db.pragma('integrity_check');
|
|
140
|
-
return result?.[0]?.integrity_check === 'ok' ? { status: 'verified' } : { status: 'invalid' };
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
// ABI/module failures are environmental and actionable, not evidence that
|
|
144
|
-
// the user's vector database failed its integrity check. Migration itself
|
|
145
|
-
// is byte-for-byte and does not require the native module, so preserve the
|
|
146
|
-
// data and record that verification could not run on this machine.
|
|
147
|
-
if ((0, vector_store_1.isNativeVectorDatabaseUnavailableError)(error)) {
|
|
148
|
-
return { status: 'unavailable', reason: (0, errors_1.errorMessage)(error) };
|
|
149
|
-
}
|
|
150
|
-
return { status: 'invalid' };
|
|
151
|
-
}
|
|
152
|
-
finally {
|
|
153
|
-
db?.close();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// ── Core migration ───────────────────────────────────────────────────────────
|
|
157
|
-
function migrateBrand(options = {}) {
|
|
158
|
-
const home = options.home ?? (0, os_1.homedir)();
|
|
159
|
-
const sourceRoot = (0, path_1.join)(home, SOURCE_DIR);
|
|
160
|
-
const targetRoot = (0, path_1.join)(home, TARGET_DIR);
|
|
161
|
-
const manifest = {
|
|
162
|
-
version: 1,
|
|
163
|
-
migrationId: `mig-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
164
|
-
sourceBrand: SOURCE_BRAND,
|
|
165
|
-
targetBrand: TARGET_BRAND,
|
|
166
|
-
createdAt: new Date().toISOString(),
|
|
167
|
-
dryRun: options.dryRun ?? false,
|
|
168
|
-
sourceRoot,
|
|
169
|
-
targetRoot,
|
|
170
|
-
sourceSnapshot: { fileCount: 0, totalBytes: 0, treeSha256: '' },
|
|
171
|
-
renamedFiles: [],
|
|
172
|
-
copiedFiles: 0,
|
|
173
|
-
skippedFiles: [],
|
|
174
|
-
conflicts: [],
|
|
175
|
-
warnings: [],
|
|
176
|
-
verified: false,
|
|
177
|
-
};
|
|
178
|
-
// ── Pre-flight checks ────────────────────────────────────────────────────
|
|
179
|
-
if (!(0, fs_1.existsSync)(sourceRoot)) {
|
|
180
|
-
manifest.warnings.push(`Source directory ${sourceRoot} does not exist. Nothing to migrate.`);
|
|
181
|
-
return { success: true, manifest };
|
|
182
|
-
}
|
|
183
|
-
manifest.sourceSnapshot = inventorySource(sourceRoot);
|
|
184
|
-
if ((0, fs_1.existsSync)(targetRoot) && (0, fs_1.readdirSync)(targetRoot).length > 0) {
|
|
185
|
-
manifest.conflicts.push({
|
|
186
|
-
path: targetRoot,
|
|
187
|
-
reason: 'Target directory already exists and is non-empty. Remove it or move it aside before migrating.',
|
|
188
|
-
});
|
|
189
|
-
return { success: false, manifest };
|
|
190
|
-
}
|
|
191
|
-
// ── Stage migration ──────────────────────────────────────────────────────
|
|
192
|
-
const stagingRoot = (0, path_1.join)(home, `.orion-code-staging-${manifest.migrationId}`);
|
|
193
|
-
try {
|
|
194
|
-
// Issue #48: dry-run must never touch the real target directory. Always
|
|
195
|
-
// stage into a temporary directory; the real migration renames staging →
|
|
196
|
-
// target (step 6). A dry run writes into staging and then discards it, so
|
|
197
|
-
// the target stays untouched and a later real run is not blocked by a
|
|
198
|
-
// spurious "target already exists" conflict.
|
|
199
|
-
ensureDir(stagingRoot);
|
|
200
|
-
const writeDest = stagingRoot;
|
|
201
|
-
// 1. Copy and rename config files
|
|
202
|
-
const configMappings = migrateConfigFiles(sourceRoot, writeDest, options, manifest);
|
|
203
|
-
manifest.renamedFiles.push(...configMappings);
|
|
204
|
-
manifest.copiedFiles += configMappings.length;
|
|
205
|
-
// 2. Copy verbatim directories
|
|
206
|
-
for (const dir of VERBATIM_DIRS) {
|
|
207
|
-
const srcDir = (0, path_1.join)(sourceRoot, dir);
|
|
208
|
-
if (!(0, fs_1.existsSync)(srcDir))
|
|
209
|
-
continue;
|
|
210
|
-
const destDir = (0, path_1.join)(writeDest, dir);
|
|
211
|
-
const mappings = copyDirRecursive(srcDir, destDir);
|
|
212
|
-
manifest.renamedFiles.push(...mappings);
|
|
213
|
-
manifest.copiedFiles += mappings.length;
|
|
214
|
-
}
|
|
215
|
-
// 3. Handle nested directories (backups → backups/openhorse, etc.)
|
|
216
|
-
for (const [dir, nestedName] of Object.entries(NESTED_DIRS)) {
|
|
217
|
-
const srcDir = (0, path_1.join)(sourceRoot, dir);
|
|
218
|
-
if (!(0, fs_1.existsSync)(srcDir))
|
|
219
|
-
continue;
|
|
220
|
-
const destDir = (0, path_1.join)(writeDest, dir, nestedName);
|
|
221
|
-
const mappings = copyDirRecursive(srcDir, destDir);
|
|
222
|
-
manifest.renamedFiles.push(...mappings);
|
|
223
|
-
manifest.copiedFiles += mappings.length;
|
|
224
|
-
}
|
|
225
|
-
// 4. Copy uncategorized files verbatim.
|
|
226
|
-
//
|
|
227
|
-
// Only list entries that an *earlier* step already handled. `settings.json`,
|
|
228
|
-
// `usage.json`, `history.jsonl`, `mcp.json` and `vector.db` used to be listed
|
|
229
|
-
// here, but no handler ever claimed them: they are root-level files, absent
|
|
230
|
-
// from RENAME_MAP / VERBATIM_DIRS / NESTED_DIRS. So they were "too known to
|
|
231
|
-
// auto-copy, unknown to every handler" and were silently dropped — taking
|
|
232
|
-
// the user's MCP servers, usage ledger, chat history and vector memory index
|
|
233
|
-
// with them, while the migration still reported success. Leaving them out of
|
|
234
|
-
// this set lets the loop below copy them verbatim, which is what the help
|
|
235
|
-
// text at the bottom of this file has always promised.
|
|
236
|
-
const knownPaths = new Set([
|
|
237
|
-
...Object.keys(RENAME_MAP),
|
|
238
|
-
...VERBATIM_DIRS,
|
|
239
|
-
...Object.keys(NESTED_DIRS),
|
|
240
|
-
]);
|
|
241
|
-
if ((0, fs_1.existsSync)(sourceRoot)) {
|
|
242
|
-
for (const entry of (0, fs_1.readdirSync)(sourceRoot, { withFileTypes: true })) {
|
|
243
|
-
if (entry.isDirectory())
|
|
244
|
-
continue;
|
|
245
|
-
if (knownPaths.has(entry.name))
|
|
246
|
-
continue;
|
|
247
|
-
const srcPath = (0, path_1.join)(sourceRoot, entry.name);
|
|
248
|
-
const destPath = (0, path_1.join)(writeDest, entry.name);
|
|
249
|
-
copyFileSafe(srcPath, destPath);
|
|
250
|
-
manifest.renamedFiles.push({ from: srcPath, to: destPath });
|
|
251
|
-
manifest.copiedFiles++;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// 5. Validate SQLite if present
|
|
255
|
-
const vectorSrc = (0, path_1.join)(sourceRoot, 'vector.db');
|
|
256
|
-
if ((0, fs_1.existsSync)(vectorSrc)) {
|
|
257
|
-
const verification = verifySqlite(vectorSrc);
|
|
258
|
-
if (verification.status === 'invalid') {
|
|
259
|
-
manifest.warnings.push('vector.db integrity check failed. The file was copied but may be corrupted.');
|
|
260
|
-
}
|
|
261
|
-
else if (verification.status === 'unavailable') {
|
|
262
|
-
manifest.warnings.push(`vector.db was copied verbatim, but integrity verification was skipped because the native SQLite verifier is unavailable. ${verification.reason}`);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// 6. Verify output
|
|
266
|
-
if (!options.dryRun) {
|
|
267
|
-
const outputSnapshot = inventorySource(stagingRoot);
|
|
268
|
-
manifest.outputSnapshot = outputSnapshot;
|
|
269
|
-
// Compare file count and byte count
|
|
270
|
-
if (outputSnapshot.fileCount !== manifest.sourceSnapshot.fileCount) {
|
|
271
|
-
manifest.warnings.push(`File count mismatch: source=${manifest.sourceSnapshot.fileCount} vs staging=${outputSnapshot.fileCount}`);
|
|
272
|
-
}
|
|
273
|
-
// Atomic rename: staging → target
|
|
274
|
-
(0, fs_1.renameSync)(stagingRoot, targetRoot);
|
|
275
|
-
manifest.verified = true;
|
|
276
|
-
}
|
|
277
|
-
// ── Write manifest ─────────────────────────────────────────────────────
|
|
278
|
-
if (!options.dryRun) {
|
|
279
|
-
manifest.completedAt = new Date().toISOString();
|
|
280
|
-
const manifestDir = (0, path_1.join)(targetRoot, 'migration-logs', 'openhorse');
|
|
281
|
-
ensureDir(manifestDir);
|
|
282
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(manifestDir, `migration-${manifest.migrationId}.json`), JSON.stringify(manifest, null, 2), { mode: 0o600 });
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
// Issue #48: a dry run only staged into `stagingRoot` for preview. Discard
|
|
286
|
-
// it so no real files are left behind and the target stays untouched.
|
|
287
|
-
try {
|
|
288
|
-
if ((0, fs_1.existsSync)(stagingRoot)) {
|
|
289
|
-
(0, fs_1.rmSync)(stagingRoot, { recursive: true, force: true });
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
catch (cleanupErr) {
|
|
293
|
-
manifest.warnings.push(`Failed to clean up dry-run staging directory ${stagingRoot}: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}`);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return { success: true, manifest };
|
|
297
|
-
}
|
|
298
|
-
catch (err) {
|
|
299
|
-
// Clean up staging on failure
|
|
300
|
-
manifest.warnings.push(`Migration failed: ${(0, errors_1.errorMessage)(err)}`);
|
|
301
|
-
try {
|
|
302
|
-
if ((0, fs_1.existsSync)(stagingRoot)) {
|
|
303
|
-
(0, fs_1.rmSync)(stagingRoot, { recursive: true, force: true });
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
catch (cleanupErr) {
|
|
307
|
-
manifest.warnings.push(`Failed to clean up staging directory ${stagingRoot}: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}`);
|
|
308
|
-
}
|
|
309
|
-
return { success: false, manifest };
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function migrateConfigFiles(sourceRoot, destRoot, options, _manifest) {
|
|
313
|
-
const mappings = [];
|
|
314
|
-
for (const [srcName, destName] of Object.entries(RENAME_MAP)) {
|
|
315
|
-
const srcPath = (0, path_1.join)(sourceRoot, srcName);
|
|
316
|
-
if (!(0, fs_1.existsSync)(srcPath))
|
|
317
|
-
continue;
|
|
318
|
-
const destPath = (0, path_1.join)(destRoot, destName);
|
|
319
|
-
if (!options.dryRun) {
|
|
320
|
-
ensureDir(destRoot);
|
|
321
|
-
let content = (0, fs_1.readFileSync)(srcPath);
|
|
322
|
-
// Remap config keys in orion.json
|
|
323
|
-
if (srcName === 'openhorse.json') {
|
|
324
|
-
content = Buffer.from(remapConfigKeys(content.toString('utf8')), 'utf8');
|
|
325
|
-
}
|
|
326
|
-
(0, fs_1.writeFileSync)(destPath, content, { mode: 0o600 });
|
|
327
|
-
}
|
|
328
|
-
mappings.push({ from: srcPath, to: destPath });
|
|
329
|
-
}
|
|
330
|
-
return mappings;
|
|
331
|
-
}
|
|
332
|
-
// ── Project file migration ───────────────────────────────────────────────────
|
|
333
|
-
function migrateProjectFiles(projectPath, options = {}) {
|
|
334
|
-
const renamed = [];
|
|
335
|
-
const conflicts = [];
|
|
336
|
-
const warnings = [];
|
|
337
|
-
const resolved = (0, path_1.resolve)(projectPath);
|
|
338
|
-
if (!(0, fs_1.existsSync)(resolved)) {
|
|
339
|
-
return {
|
|
340
|
-
success: false,
|
|
341
|
-
renamed,
|
|
342
|
-
conflicts,
|
|
343
|
-
warnings: [`Project path ${resolved} does not exist.`],
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
for (const { from, to } of PROJECT_RENAME_MAP) {
|
|
347
|
-
const srcPath = (0, path_1.join)(resolved, from);
|
|
348
|
-
const destPath = (0, path_1.join)(resolved, to);
|
|
349
|
-
if (!(0, fs_1.existsSync)(srcPath))
|
|
350
|
-
continue;
|
|
351
|
-
if ((0, fs_1.existsSync)(destPath)) {
|
|
352
|
-
conflicts.push({ from: srcPath, to: destPath, reason: 'Target already exists' });
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
if (!options.dryRun) {
|
|
356
|
-
try {
|
|
357
|
-
(0, fs_1.renameSync)(srcPath, destPath);
|
|
358
|
-
}
|
|
359
|
-
catch (err) {
|
|
360
|
-
warnings.push(`Failed to rename ${from} → ${to}: ${(0, errors_1.errorMessage)(err)}`);
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
renamed.push({ from: srcPath, to: destPath });
|
|
365
|
-
}
|
|
366
|
-
return { success: conflicts.length === 0, renamed, conflicts, warnings };
|
|
367
|
-
}
|
|
368
|
-
// ── Help text ────────────────────────────────────────────────────────────────
|
|
369
|
-
function getMigrationHelp() {
|
|
370
|
-
return `orion migrate openhorse — Migrate OpenHorse data to Orion Code
|
|
371
|
-
|
|
372
|
-
USAGE
|
|
373
|
-
orion migrate openhorse [flags]
|
|
374
|
-
|
|
375
|
-
FLAGS
|
|
376
|
-
--dry-run Preview migration without writing files (default)
|
|
377
|
-
--yes Execute the migration after reviewing the preview
|
|
378
|
-
--include-project-files Rename .openhorse/ → .orion-code/ in project dirs
|
|
379
|
-
|
|
380
|
-
Note: environment variables are no longer migrated. Configure Orion Code via
|
|
381
|
-
~/.orion-code/orion.json (see docs/orion.example.json).
|
|
382
|
-
|
|
383
|
-
DESCRIPTION
|
|
384
|
-
Copies ~/.openhorse → ~/.orion-code with filename and config-key
|
|
385
|
-
transformations. The source directory is left unchanged.
|
|
386
|
-
|
|
387
|
-
Migration is preview-only unless --yes is provided.
|
|
388
|
-
|
|
389
|
-
Migration covers:
|
|
390
|
-
- openhorse.json → orion.json (with config key remapping)
|
|
391
|
-
- OPENHORSE.md → ORION.md
|
|
392
|
-
- OPENHORSE.local.md → ORION.local.md
|
|
393
|
-
- settings.json, usage.json, history.jsonl, mcp.json
|
|
394
|
-
- projects/, skills/, cost/, cache/
|
|
395
|
-
- backups/ → backups/openhorse/
|
|
396
|
-
- migration-logs/ → migration-logs/openhorse/
|
|
397
|
-
- vector.db (with SQLite integrity check)
|
|
398
|
-
|
|
399
|
-
The target directory must not already exist. Migration is atomic —
|
|
400
|
-
files are staged and then renamed in one operation.
|
|
401
|
-
|
|
402
|
-
Project file migration (--include-project-files) renames:
|
|
403
|
-
${PROJECT_RENAME_MAP.map(r => ` ${r.from} → ${r.to}`).join('\n ')}
|
|
404
|
-
`;
|
|
405
|
-
}
|
|
406
|
-
//# sourceMappingURL=migrate.js.map
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orion Code - Migration Types
|
|
3
|
-
*/
|
|
4
|
-
export interface BrandMigrationManifestV1 {
|
|
5
|
-
version: 1;
|
|
6
|
-
migrationId: string;
|
|
7
|
-
sourceBrand: 'openhorse';
|
|
8
|
-
targetBrand: 'orion-code';
|
|
9
|
-
createdAt: string;
|
|
10
|
-
completedAt?: string;
|
|
11
|
-
dryRun: boolean;
|
|
12
|
-
sourceRoot: string;
|
|
13
|
-
targetRoot: string;
|
|
14
|
-
sourceSnapshot: {
|
|
15
|
-
fileCount: number;
|
|
16
|
-
totalBytes: number;
|
|
17
|
-
treeSha256: string;
|
|
18
|
-
};
|
|
19
|
-
outputSnapshot?: {
|
|
20
|
-
fileCount: number;
|
|
21
|
-
totalBytes: number;
|
|
22
|
-
treeSha256: string;
|
|
23
|
-
};
|
|
24
|
-
renamedFiles: Array<{
|
|
25
|
-
from: string;
|
|
26
|
-
to: string;
|
|
27
|
-
}>;
|
|
28
|
-
copiedFiles: number;
|
|
29
|
-
skippedFiles: Array<{
|
|
30
|
-
path: string;
|
|
31
|
-
reason: string;
|
|
32
|
-
}>;
|
|
33
|
-
conflicts: Array<{
|
|
34
|
-
path: string;
|
|
35
|
-
reason: string;
|
|
36
|
-
}>;
|
|
37
|
-
warnings: string[];
|
|
38
|
-
verified: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface MigrationOptions {
|
|
41
|
-
dryRun?: boolean;
|
|
42
|
-
includeProjectFiles?: boolean;
|
|
43
|
-
/** Override home directory for testing. */
|
|
44
|
-
home?: string;
|
|
45
|
-
}
|
|
46
|
-
export interface MigrationResult {
|
|
47
|
-
success: boolean;
|
|
48
|
-
manifest: BrandMigrationManifestV1;
|
|
49
|
-
}
|
|
50
|
-
export interface FileMapping {
|
|
51
|
-
from: string;
|
|
52
|
-
to: string;
|
|
53
|
-
reason?: string;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/migration/types.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orion Code - scoped tool allowlist rule engine.
|
|
3
|
-
*
|
|
4
|
-
* Contract (v0.1.3-2 §1.3 / P1-B / P1-E)
|
|
5
|
-
* ======================================
|
|
6
|
-
*
|
|
7
|
-
* Scope
|
|
8
|
-
* -----
|
|
9
|
-
* Project rules live in `ProjectConfig.allowedTools`; machine-wide rules live in
|
|
10
|
-
* `GlobalConfig.allowedTools`. Both are evaluated for a project and the most
|
|
11
|
-
* restrictive matching effect wins. Project rules win ties for clearer audit
|
|
12
|
-
* attribution.
|
|
13
|
-
*
|
|
14
|
-
* Grammar
|
|
15
|
-
* -------
|
|
16
|
-
* rule := [effect ":"] tool [ "(" pattern ")" ]
|
|
17
|
-
* effect := "allow" | "ask" | "deny" (default: "allow")
|
|
18
|
-
* tool := exact tool name (e.g. `exec_command`, `write_file`) or `*`
|
|
19
|
-
* pattern := glob over the tool's canonical subject; `*` = any run of chars,
|
|
20
|
-
* `?` = exactly one char. Everything else is literal.
|
|
21
|
-
*
|
|
22
|
-
* Tool names are the *real* runtime names (`exec_command`, `read_file`,
|
|
23
|
-
* `write_file`, `edit_file`, `web_fetch`, ...). There is no `Bash(...)` alias.
|
|
24
|
-
*
|
|
25
|
-
* Canonical subject
|
|
26
|
-
* -----------------
|
|
27
|
-
* The subject is the first non-empty string argument found in
|
|
28
|
-
* {@link SUBJECT_ARG_KEYS} order, with runs of whitespace collapsed. For
|
|
29
|
-
* `exec_command` that is the command line, for file tools the path, for web
|
|
30
|
-
* tools the URL. A rule without a pattern matches any subject.
|
|
31
|
-
*
|
|
32
|
-
* Precedence (most restrictive wins, order in the array is irrelevant)
|
|
33
|
-
* -------------------------------------------------------------------
|
|
34
|
-
* deny > ask > allow
|
|
35
|
-
*
|
|
36
|
-
* A rule with a pattern whose subject cannot be determined matches only for the
|
|
37
|
-
* restrictive effects (`deny`, `ask`); `allow` fails closed and does not match.
|
|
38
|
-
*
|
|
39
|
-
* Safety envelope (enforced by the scheduler, documented here)
|
|
40
|
-
* -----------------------------------------------------------
|
|
41
|
-
* `allow` is an explicit durable user approval and skips later interactive
|
|
42
|
-
* confirmations for that tool. It can never override `checkPermissions() ===
|
|
43
|
-
* 'deny'` or an explicit `ask`/`deny` rule. Agent modes do not remove tools;
|
|
44
|
-
* PLAN inherits the current permission policy and AUTO supplies its own grant.
|
|
45
|
-
*
|
|
46
|
-
* Compatibility
|
|
47
|
-
* -------------
|
|
48
|
-
* Unparseable entries are ignored and reported through `invalid` so callers can
|
|
49
|
-
* surface them; a malformed rule never becomes a silent allow. Configs written
|
|
50
|
-
* before this engine existed contain plain tool names, which keep their natural
|
|
51
|
-
* meaning ("auto-approve this tool").
|
|
52
|
-
*/
|
|
53
|
-
/** Effect of a matched allowlist rule. */
|
|
54
|
-
export type AllowlistEffect = 'allow' | 'ask' | 'deny';
|
|
55
|
-
/** Scope selected by an interactive permission decision. */
|
|
56
|
-
export type ToolPermissionScope = 'once' | 'project' | 'global';
|
|
57
|
-
export declare function isToolPermissionScope(value: unknown): value is ToolPermissionScope;
|
|
58
|
-
/** A parsed allowlist rule. */
|
|
59
|
-
export interface AllowlistRule {
|
|
60
|
-
/** Original source text, used verbatim in user-facing reasons. */
|
|
61
|
-
source: string;
|
|
62
|
-
effect: AllowlistEffect;
|
|
63
|
-
/** Tool name, or `*` for any tool. */
|
|
64
|
-
tool: string;
|
|
65
|
-
/** Raw subject glob, undefined when the rule has no `(...)` part. */
|
|
66
|
-
pattern?: string;
|
|
67
|
-
}
|
|
68
|
-
/** Result of evaluating a tool call against the rule set. */
|
|
69
|
-
export interface ToolAllowlistMatch {
|
|
70
|
-
effect: AllowlistEffect;
|
|
71
|
-
/** The winning rule's source text (for audit/UI reasons). */
|
|
72
|
-
rule: string;
|
|
73
|
-
/** Present for config-backed evaluations; omitted by pure rule evaluators. */
|
|
74
|
-
scope?: Exclude<ToolPermissionScope, 'once'>;
|
|
75
|
-
}
|
|
76
|
-
/** Injected into the tool scheduler; pure, no I/O. */
|
|
77
|
-
export type ToolAllowlistEvaluator = (toolName: string, args: Record<string, unknown>) => ToolAllowlistMatch | undefined;
|
|
78
|
-
export interface ParsedAllowlist {
|
|
79
|
-
rules: AllowlistRule[];
|
|
80
|
-
/** Entries that could not be parsed, verbatim. */
|
|
81
|
-
invalid: string[];
|
|
82
|
-
}
|
|
83
|
-
/** Argument keys probed, in order, to derive a rule-matching subject. */
|
|
84
|
-
export declare const SUBJECT_ARG_KEYS: readonly ["command", "file_path", "path", "url", "pattern", "query"];
|
|
85
|
-
/** Parse raw `allowedTools` entries. Invalid entries are reported, never applied. */
|
|
86
|
-
export declare function parseAllowlistRules(entries: readonly string[] | undefined): ParsedAllowlist;
|
|
87
|
-
/** Derive the canonical subject a pattern is matched against. */
|
|
88
|
-
export declare function describeAllowlistSubject(_toolName: string, args: Record<string, unknown> | undefined): string | undefined;
|
|
89
|
-
/**
|
|
90
|
-
* Evaluate a tool call against parsed rules.
|
|
91
|
-
* Returns the most restrictive matching rule, or undefined when nothing matched.
|
|
92
|
-
*/
|
|
93
|
-
export declare function matchAllowlistRules(rules: readonly AllowlistRule[], toolName: string, args: Record<string, unknown>): ToolAllowlistMatch | undefined;
|
|
94
|
-
/** Build a pure evaluator from parsed rules. Returns undefined when there is nothing to enforce. */
|
|
95
|
-
export declare function createAllowlistEvaluator(rules: readonly AllowlistRule[]): ToolAllowlistEvaluator | undefined;
|
|
96
|
-
export interface ResolvedToolAllowlist extends ParsedAllowlist {
|
|
97
|
-
evaluator?: ToolAllowlistEvaluator;
|
|
98
|
-
global: ParsedAllowlist;
|
|
99
|
-
project: ParsedAllowlist;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Load and compile the allowlist for a project path.
|
|
103
|
-
* Missing/empty configuration yields no evaluator, i.e. unchanged behaviour.
|
|
104
|
-
*/
|
|
105
|
-
export declare function resolveProjectToolAllowlist(projectPath: string): ResolvedToolAllowlist;
|
|
106
|
-
/** Alias with scope-neutral naming for new callers. */
|
|
107
|
-
export declare const resolveToolAllowlist: typeof resolveProjectToolAllowlist;
|
|
108
|
-
/** Persist an explicit interactive approval before the waiting tool is resumed. */
|
|
109
|
-
export declare function grantToolPermission(scope: Exclude<ToolPermissionScope, 'once'>, projectPath: string, toolName: string): void;
|
|
110
|
-
//# sourceMappingURL=tool-allowlist.d.ts.map
|