open-multi-agent-kit 0.80.6 → 0.80.7
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 +11 -1
- package/README.md +22 -14
- package/dist/cli/config-selector.d.ts +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -8
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +45 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +197 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +5 -5
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/command-safety.d.ts +11 -0
- package/dist/core/command-safety.d.ts.map +1 -0
- package/dist/core/command-safety.js +528 -0
- package/dist/core/command-safety.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +14 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +18 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +80 -42
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/pruner-policy.d.ts +84 -0
- package/dist/core/compaction/pruner-policy.d.ts.map +1 -0
- package/dist/core/compaction/pruner-policy.js +273 -0
- package/dist/core/compaction/pruner-policy.js.map +1 -0
- package/dist/core/context-graph-identity-resolution.d.ts +114 -0
- package/dist/core/context-graph-identity-resolution.d.ts.map +1 -0
- package/dist/core/context-graph-identity-resolution.js +127 -0
- package/dist/core/context-graph-identity-resolution.js.map +1 -0
- package/dist/core/context-graph-memory-store.d.ts +153 -0
- package/dist/core/context-graph-memory-store.d.ts.map +1 -0
- package/dist/core/context-graph-memory-store.js +377 -0
- package/dist/core/context-graph-memory-store.js.map +1 -0
- package/dist/core/context-graph-ontology-generation.d.ts +104 -0
- package/dist/core/context-graph-ontology-generation.d.ts.map +1 -0
- package/dist/core/context-graph-ontology-generation.js +135 -0
- package/dist/core/context-graph-ontology-generation.js.map +1 -0
- package/dist/core/context-graph-ontology-registry.d.ts +766 -0
- package/dist/core/context-graph-ontology-registry.d.ts.map +1 -0
- package/dist/core/context-graph-ontology-registry.js +1133 -0
- package/dist/core/context-graph-ontology-registry.js.map +1 -0
- package/dist/core/context-graph-policy.d.ts +68 -0
- package/dist/core/context-graph-policy.d.ts.map +1 -0
- package/dist/core/context-graph-policy.js +221 -0
- package/dist/core/context-graph-policy.js.map +1 -0
- package/dist/core/context-graph-reasoning.d.ts +130 -0
- package/dist/core/context-graph-reasoning.d.ts.map +1 -0
- package/dist/core/context-graph-reasoning.js +442 -0
- package/dist/core/context-graph-reasoning.js.map +1 -0
- package/dist/core/context-graph-retrieval.d.ts +120 -0
- package/dist/core/context-graph-retrieval.d.ts.map +1 -0
- package/dist/core/context-graph-retrieval.js +288 -0
- package/dist/core/context-graph-retrieval.js.map +1 -0
- package/dist/core/contract-verification.d.ts +78 -0
- package/dist/core/contract-verification.d.ts.map +1 -0
- package/dist/core/contract-verification.js +110 -0
- package/dist/core/contract-verification.js.map +1 -0
- package/dist/core/exact-cache-policy.d.ts +100 -0
- package/dist/core/exact-cache-policy.d.ts.map +1 -0
- package/dist/core/exact-cache-policy.js +175 -0
- package/dist/core/exact-cache-policy.js.map +1 -0
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +1 -0
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/template.js +2 -2
- package/dist/core/extensions/builtin/command-safety-gate.d.ts +77 -0
- package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -0
- package/dist/core/extensions/builtin/command-safety-gate.js +147 -0
- package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +4 -4
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +94 -56
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +38 -10
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/freedom/banner.d.ts +14 -0
- package/dist/core/freedom/banner.d.ts.map +1 -0
- package/dist/core/freedom/banner.js +22 -0
- package/dist/core/freedom/banner.js.map +1 -0
- package/dist/core/freedom/config.d.ts +27 -0
- package/dist/core/freedom/config.d.ts.map +1 -0
- package/dist/core/freedom/config.js +216 -0
- package/dist/core/freedom/config.js.map +1 -0
- package/dist/core/freedom/index.d.ts +23 -0
- package/dist/core/freedom/index.d.ts.map +1 -0
- package/dist/core/freedom/index.js +19 -0
- package/dist/core/freedom/index.js.map +1 -0
- package/dist/core/freedom/policy.d.ts +42 -0
- package/dist/core/freedom/policy.d.ts.map +1 -0
- package/dist/core/freedom/policy.js +47 -0
- package/dist/core/freedom/policy.js.map +1 -0
- package/dist/core/freedom/safety-floor.d.ts +73 -0
- package/dist/core/freedom/safety-floor.d.ts.map +1 -0
- package/dist/core/freedom/safety-floor.js +275 -0
- package/dist/core/freedom/safety-floor.js.map +1 -0
- package/dist/core/harness-control-events.d.ts +13 -1
- package/dist/core/harness-control-events.d.ts.map +1 -1
- package/dist/core/harness-control-events.js +216 -41
- package/dist/core/harness-control-events.js.map +1 -1
- package/dist/core/harness-control-replay.d.ts +7 -2
- package/dist/core/harness-control-replay.d.ts.map +1 -1
- package/dist/core/harness-control-replay.js +36 -4
- package/dist/core/harness-control-replay.js.map +1 -1
- package/dist/core/headroom-middleware.d.ts +35 -0
- package/dist/core/headroom-middleware.d.ts.map +1 -0
- package/dist/core/headroom-middleware.js +166 -0
- package/dist/core/headroom-middleware.js.map +1 -0
- package/dist/core/hook-inventory.d.ts +23 -0
- package/dist/core/hook-inventory.d.ts.map +1 -0
- package/dist/core/hook-inventory.js +50 -0
- package/dist/core/hook-inventory.js.map +1 -0
- package/dist/core/lean-context-middleware.d.ts +12 -0
- package/dist/core/lean-context-middleware.d.ts.map +1 -0
- package/dist/core/lean-context-middleware.js +87 -0
- package/dist/core/lean-context-middleware.js.map +1 -0
- package/dist/core/lean-context-policy.d.ts +45 -0
- package/dist/core/lean-context-policy.d.ts.map +1 -0
- package/dist/core/lean-context-policy.js +108 -0
- package/dist/core/lean-context-policy.js.map +1 -0
- package/dist/core/loadout-access-policy.d.ts +41 -0
- package/dist/core/loadout-access-policy.d.ts.map +1 -0
- package/dist/core/loadout-access-policy.js +182 -0
- package/dist/core/loadout-access-policy.js.map +1 -0
- package/dist/core/loadout-runtime.d.ts +84 -0
- package/dist/core/loadout-runtime.d.ts.map +1 -0
- package/dist/core/loadout-runtime.js +157 -0
- package/dist/core/loadout-runtime.js.map +1 -0
- package/dist/core/loadouts.d.ts +147 -0
- package/dist/core/loadouts.d.ts.map +1 -0
- package/dist/core/loadouts.js +442 -0
- package/dist/core/loadouts.js.map +1 -0
- package/dist/core/mcp-inventory.d.ts +34 -0
- package/dist/core/mcp-inventory.d.ts.map +1 -1
- package/dist/core/mcp-inventory.js +53 -1
- package/dist/core/mcp-inventory.js.map +1 -1
- package/dist/core/mcp-presets.d.ts +57 -0
- package/dist/core/mcp-presets.d.ts.map +1 -0
- package/dist/core/mcp-presets.js +81 -0
- package/dist/core/mcp-presets.js.map +1 -0
- package/dist/core/model-registry.d.ts +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +40 -17
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/native-adoption-benchmark.d.ts +166 -0
- package/dist/core/native-adoption-benchmark.d.ts.map +1 -0
- package/dist/core/native-adoption-benchmark.js +624 -0
- package/dist/core/native-adoption-benchmark.js.map +1 -0
- package/dist/core/observability-trace.d.ts +80 -0
- package/dist/core/observability-trace.d.ts.map +1 -0
- package/dist/core/observability-trace.js +140 -0
- package/dist/core/observability-trace.js.map +1 -0
- package/dist/core/orchestration/checkpoint.d.ts +83 -0
- package/dist/core/orchestration/checkpoint.d.ts.map +1 -0
- package/dist/core/orchestration/checkpoint.js +152 -0
- package/dist/core/orchestration/checkpoint.js.map +1 -0
- package/dist/core/orchestration/errors.d.ts +74 -0
- package/dist/core/orchestration/errors.d.ts.map +1 -0
- package/dist/core/orchestration/errors.js +52 -0
- package/dist/core/orchestration/errors.js.map +1 -0
- package/dist/core/orchestration/merge-queue.d.ts +121 -0
- package/dist/core/orchestration/merge-queue.d.ts.map +1 -0
- package/dist/core/orchestration/merge-queue.js +149 -0
- package/dist/core/orchestration/merge-queue.js.map +1 -0
- package/dist/core/orchestration/recovery.d.ts +106 -0
- package/dist/core/orchestration/recovery.d.ts.map +1 -0
- package/dist/core/orchestration/recovery.js +110 -0
- package/dist/core/orchestration/recovery.js.map +1 -0
- package/dist/core/orchestration/replay-ledger.d.ts +76 -0
- package/dist/core/orchestration/replay-ledger.d.ts.map +1 -0
- package/dist/core/orchestration/replay-ledger.js +395 -0
- package/dist/core/orchestration/replay-ledger.js.map +1 -0
- package/dist/core/orchestration/scheduler-state.d.ts +78 -0
- package/dist/core/orchestration/scheduler-state.d.ts.map +1 -0
- package/dist/core/orchestration/scheduler-state.js +185 -0
- package/dist/core/orchestration/scheduler-state.js.map +1 -0
- package/dist/core/orchestration/scheduler-store.d.ts +309 -0
- package/dist/core/orchestration/scheduler-store.d.ts.map +1 -0
- package/dist/core/orchestration/scheduler-store.js +368 -0
- package/dist/core/orchestration/scheduler-store.js.map +1 -0
- package/dist/core/orchestration/sqlite-scheduler-store.d.ts +57 -0
- package/dist/core/orchestration/sqlite-scheduler-store.d.ts.map +1 -0
- package/dist/core/orchestration/sqlite-scheduler-store.js +528 -0
- package/dist/core/orchestration/sqlite-scheduler-store.js.map +1 -0
- package/dist/core/orchestration/transaction-coordinator.d.ts +217 -0
- package/dist/core/orchestration/transaction-coordinator.d.ts.map +1 -0
- package/dist/core/orchestration/transaction-coordinator.js +281 -0
- package/dist/core/orchestration/transaction-coordinator.js.map +1 -0
- package/dist/core/orchestration/verification-contract.d.ts +197 -0
- package/dist/core/orchestration/verification-contract.d.ts.map +1 -0
- package/dist/core/orchestration/verification-contract.js +145 -0
- package/dist/core/orchestration/verification-contract.js.map +1 -0
- package/dist/core/package-composition.d.ts +68 -0
- package/dist/core/package-composition.d.ts.map +1 -0
- package/dist/core/package-composition.js +304 -0
- package/dist/core/package-composition.js.map +1 -0
- package/dist/core/package-gallery.d.ts +124 -0
- package/dist/core/package-gallery.d.ts.map +1 -0
- package/dist/core/package-gallery.js +392 -0
- package/dist/core/package-gallery.js.map +1 -0
- package/dist/core/package-manager.d.ts +69 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +367 -69
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-procurement.d.ts +268 -0
- package/dist/core/package-procurement.d.ts.map +1 -0
- package/dist/core/package-procurement.js +697 -0
- package/dist/core/package-procurement.js.map +1 -0
- package/dist/core/package-trial-runtime.d.ts +75 -0
- package/dist/core/package-trial-runtime.d.ts.map +1 -0
- package/dist/core/package-trial-runtime.js +73 -0
- package/dist/core/package-trial-runtime.js.map +1 -0
- package/dist/core/package-trial-sandbox.d.ts +27 -0
- package/dist/core/package-trial-sandbox.d.ts.map +1 -0
- package/dist/core/package-trial-sandbox.js +102 -0
- package/dist/core/package-trial-sandbox.js.map +1 -0
- package/dist/core/policy-overlays-runtime.d.ts +141 -0
- package/dist/core/policy-overlays-runtime.d.ts.map +1 -0
- package/dist/core/policy-overlays-runtime.js +720 -0
- package/dist/core/policy-overlays-runtime.js.map +1 -0
- package/dist/core/read-anchor-registry.d.ts +27 -0
- package/dist/core/read-anchor-registry.d.ts.map +1 -0
- package/dist/core/read-anchor-registry.js +103 -0
- package/dist/core/read-anchor-registry.js.map +1 -0
- package/dist/core/read-anchors.d.ts +110 -0
- package/dist/core/read-anchors.d.ts.map +1 -0
- package/dist/core/read-anchors.js +193 -0
- package/dist/core/read-anchors.js.map +1 -0
- package/dist/core/read-content-cache.d.ts +22 -0
- package/dist/core/read-content-cache.d.ts.map +1 -0
- package/dist/core/read-content-cache.js +79 -0
- package/dist/core/read-content-cache.js.map +1 -0
- package/dist/core/recovery-checkpoint.d.ts +196 -0
- package/dist/core/recovery-checkpoint.d.ts.map +1 -0
- package/dist/core/recovery-checkpoint.js +382 -0
- package/dist/core/recovery-checkpoint.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +30 -2
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +23 -21
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +93 -15
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sandbox/backend.d.ts +25 -0
- package/dist/core/sandbox/backend.d.ts.map +1 -0
- package/dist/core/sandbox/backend.js +150 -0
- package/dist/core/sandbox/backend.js.map +1 -0
- package/dist/core/sandbox/env.d.ts +6 -0
- package/dist/core/sandbox/env.d.ts.map +1 -0
- package/dist/core/sandbox/env.js +46 -0
- package/dist/core/sandbox/env.js.map +1 -0
- package/dist/core/sandbox/path-resolver.d.ts +4 -0
- package/dist/core/sandbox/path-resolver.d.ts.map +1 -0
- package/dist/core/sandbox/path-resolver.js +44 -0
- package/dist/core/sandbox/path-resolver.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +87 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +280 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/spawn.d.ts +20 -0
- package/dist/core/sandbox/spawn.d.ts.map +1 -0
- package/dist/core/sandbox/spawn.js +80 -0
- package/dist/core/sandbox/spawn.js.map +1 -0
- package/dist/core/sdk.d.ts +83 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +143 -55
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/semantic-cache-policy.d.ts +45 -0
- package/dist/core/semantic-cache-policy.d.ts.map +1 -0
- package/dist/core/semantic-cache-policy.js +220 -0
- package/dist/core/semantic-cache-policy.js.map +1 -0
- package/dist/core/session-digest.d.ts +57 -0
- package/dist/core/session-digest.d.ts.map +1 -0
- package/dist/core/session-digest.js +193 -0
- package/dist/core/session-digest.js.map +1 -0
- package/dist/core/session-manager.d.ts +2 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +5 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +14 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +43 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +25 -7
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.d.ts +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +2 -2
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +28 -3
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +53 -10
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +12 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +24 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +3 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +3 -0
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +3 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +3 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +3 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +29 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts +3 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +3 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +19 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -6
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts +28 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.js +146 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient.d.ts +27 -0
- package/dist/modes/interactive/components/control-panel-gradient.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient.js +127 -0
- package/dist/modes/interactive/components/control-panel-gradient.js.map +1 -0
- package/dist/modes/interactive/components/control-panel.d.ts +28 -1
- package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel.js +153 -3
- package/dist/modes/interactive/components/control-panel.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -0
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts +2 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.js +18 -1
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector-state.d.ts +101 -0
- package/dist/modes/interactive/components/model-selector-state.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector-state.js +261 -0
- package/dist/modes/interactive/components/model-selector-state.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +44 -10
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +163 -110
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +10 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +61 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/omk-blackboard.json +91 -0
- package/dist/modes/interactive/theme/omk-freedom-grid.json +91 -0
- package/dist/modes/interactive/theme/omk-neon-ops.json +90 -0
- package/dist/modes/interactive/theme/omk-slate-light.json +91 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +14 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +114 -49
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/omk-user-agent.d.ts +2 -0
- package/dist/utils/omk-user-agent.d.ts.map +1 -0
- package/dist/utils/{pi-user-agent.js → omk-user-agent.js} +2 -2
- package/dist/utils/omk-user-agent.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +5 -5
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +8 -11
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/packages.md +47 -6
- package/docs/prompt-templates.md +2 -0
- package/docs/usage.md +16 -6
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +11 -11
- package/examples/extensions/auto-commit-on-exit.ts +6 -6
- package/examples/extensions/bash-spawn-hook.ts +4 -4
- package/examples/extensions/bookmark.ts +5 -5
- package/examples/extensions/border-status-editor.ts +7 -7
- package/examples/extensions/built-in-tool-renderer.ts +6 -6
- package/examples/extensions/claude-rules.ts +4 -4
- package/examples/extensions/commands.ts +5 -5
- package/examples/extensions/confirm-destructive.ts +3 -3
- package/examples/extensions/custom-compaction.ts +3 -3
- package/examples/extensions/custom-footer.ts +2 -2
- package/examples/extensions/custom-header.ts +5 -5
- package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +3 -3
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/dirty-repo-guard.ts +7 -7
- package/examples/extensions/doom-overlay/README.md +3 -3
- package/examples/extensions/doom-overlay/doom/build.sh +2 -2
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +1 -1
- package/examples/extensions/doom-overlay/index.ts +3 -3
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-resources/index.ts +2 -2
- package/examples/extensions/dynamic-tools.ts +4 -4
- package/examples/extensions/event-bus.ts +8 -8
- package/examples/extensions/file-trigger.ts +3 -3
- package/examples/extensions/git-checkpoint.ts +7 -7
- package/examples/extensions/git-merge-and-resolve.ts +14 -14
- package/examples/extensions/github-issue-autocomplete.ts +6 -6
- package/examples/extensions/gondolin/index.ts +16 -16
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/handoff.ts +2 -2
- package/examples/extensions/hello.ts +2 -2
- package/examples/extensions/hidden-thinking-label.ts +4 -4
- package/examples/extensions/inline-bash.ts +5 -5
- package/examples/extensions/input-transform-streaming.ts +5 -5
- package/examples/extensions/input-transform.ts +5 -5
- package/examples/extensions/interactive-shell.ts +3 -3
- package/examples/extensions/mac-system-theme.ts +5 -5
- package/examples/extensions/message-renderer.ts +4 -4
- package/examples/extensions/minimal-mode.ts +9 -9
- package/examples/extensions/modal-editor.ts +3 -3
- package/examples/extensions/model-status.ts +3 -3
- package/examples/extensions/notify.ts +5 -5
- package/examples/extensions/overlay-qa-tests.ts +20 -20
- package/examples/extensions/overlay-test.ts +3 -3
- package/examples/extensions/permission-gate.ts +2 -2
- package/examples/extensions/pirate.ts +4 -4
- package/examples/extensions/plan-mode/index.ts +22 -22
- package/examples/extensions/preset.ts +30 -30
- package/examples/extensions/prompt-customizer.ts +3 -3
- package/examples/extensions/protected-paths.ts +2 -2
- package/examples/extensions/provider-payload.ts +5 -5
- package/examples/extensions/qna.ts +2 -2
- package/examples/extensions/question.ts +2 -2
- package/examples/extensions/questionnaire.ts +2 -2
- package/examples/extensions/rainbow-editor.ts +3 -3
- package/examples/extensions/reload-runtime.ts +4 -4
- package/examples/extensions/rpc-demo.ts +10 -10
- package/examples/extensions/sandbox/index.ts +17 -17
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/send-user-message.ts +13 -13
- package/examples/extensions/session-name.ts +4 -4
- package/examples/extensions/shutdown-command.ts +10 -10
- package/examples/extensions/snake.ts +3 -3
- package/examples/extensions/space-invaders.ts +3 -3
- package/examples/extensions/ssh.ts +12 -12
- package/examples/extensions/status-line.ts +4 -4
- package/examples/extensions/structured-output.ts +2 -2
- package/examples/extensions/subagent/README.md +13 -13
- package/examples/extensions/subagent/agents.ts +2 -2
- package/examples/extensions/subagent/index.ts +53 -21
- package/examples/extensions/summarize.ts +2 -2
- package/examples/extensions/system-prompt-header.ts +3 -3
- package/examples/extensions/tic-tac-toe.ts +15 -15
- package/examples/extensions/timed-confirm.ts +4 -4
- package/examples/extensions/titlebar-spinner.ts +9 -9
- package/examples/extensions/todo.ts +5 -5
- package/examples/extensions/tool-override.ts +5 -5
- package/examples/extensions/tools.ts +10 -10
- package/examples/extensions/trigger-compact.ts +3 -3
- package/examples/extensions/truncated-tool.ts +3 -3
- package/examples/extensions/widget-placement.ts +2 -2
- package/examples/extensions/with-deps/index.ts +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/working-indicator.ts +7 -7
- package/examples/extensions/working-message-test.ts +3 -3
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/05-tools.ts +1 -1
- package/examples/sdk/06-extensions.ts +11 -11
- package/examples/sdk/07-context-files.ts +2 -0
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
- package/examples/sdk/README.md +2 -2
- package/node_modules/@earendil-works/omk-agent-core/README.md +488 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts +24 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js +553 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts +118 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.js +402 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts +95 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js +996 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js +175 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts +117 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js +568 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts +25 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js +131 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts +51 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js +510 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts +51 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js +102 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts +48 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js +230 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js +101 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts +36 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js +273 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js +42 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js +114 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js +39 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts +33 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js +210 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts +2 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js +50 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts +44 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js +311 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts +3 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js +30 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts +616 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js +94 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js +126 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts +70 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js +297 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts +20 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.js +25 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts +3 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.js +3 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts +69 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js +278 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts +393 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.js +2 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/package.json +60 -0
- package/node_modules/@earendil-works/omk-ai/README.md +1389 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts +20 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.js +44 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts +5 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js +6 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.js +130 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts +20 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js +199 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts +10 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts +515 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js +517 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.js +23 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts +14 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.d.ts +4 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.js +16 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.d.ts +33 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.js +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.d.ts +18 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts +18762 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.js +17197 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.js +78 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.js +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts +39 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.js +170 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts +38 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js +826 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts +77 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js +1123 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts +15 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js +221 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js +26 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts +56 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js +368 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js +29 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts +70 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js +331 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts +15 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js +442 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.js +402 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js +128 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts +4 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js +34 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts +25 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js +534 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts +30 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js +1171 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts +19 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js +977 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts +11 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts +18 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js +496 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js +233 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts +35 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js +254 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js +42 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js +82 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js +184 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts +4 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.js +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.js +77 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.d.ts +570 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.js +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts +6 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js +34 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts +19 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js +25 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js +81 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js +14 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts +16 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js +113 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts +10 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js +97 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts +25 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js +335 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js +56 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js +280 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts +58 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js +122 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js +105 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts +43 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js +487 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js +31 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts +64 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts +57 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js +154 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js +26 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts +17 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts +18 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js +281 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/package.json +106 -0
- package/node_modules/@earendil-works/omk-tui/README.md +791 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts +54 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js +632 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts +22 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.js +104 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts +22 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js +35 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts +249 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.js +1857 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts +28 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.js +89 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts +37 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.js +378 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts +31 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.js +69 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts +96 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js +644 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts +50 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js +159 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts +50 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js +185 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts +12 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js +23 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts +19 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.js +89 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts +13 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js +51 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts +39 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.js +2 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts +16 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js +110 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.d.ts +23 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.js +32 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts +212 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.js +252 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts +184 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.js +1173 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts +28 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js +44 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts +3 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js +53 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts +50 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js +361 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts +90 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js +366 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts +113 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.js +472 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts +242 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.js +1221 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts +17 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js +25 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts +84 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.js +1032 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts +25 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js +96 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/omk-tui/package.json +47 -0
- package/package.json +22 -6
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js.map +0 -1
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAqB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAwB,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACpG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AAY,EAAE,CAAC;QACf,MAAM,eAAe,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;SAAM,CAAC;QACP,YAAY,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE;YAC5C,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;YAChC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,cAAc;YACd,aAAa;SACb,CAAC,CAAC;QACH,gBAAgB,EAAE,CAAC;QACnB,aAAa,EAAE,CAAC;QAChB,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC7B,CAAC;QACD,OAAO;IACR,CAAC;AAAA,CACD","sourcesContent":["/**\n * Main entry point for the coding agent CLI.\n *\n * This file handles CLI argument parsing and translates them into\n * createAgentSession() options. The SDK does the heavy lifting.\n */\n\nimport { createInterface } from \"node:readline\";\nimport { type ImageContent, modelsAreEqual } from \"@earendil-works/omk-ai\";\nimport { ProcessTerminal, setKeybindings, TUI } from \"@earendil-works/omk-tui\";\nimport chalk from \"chalk\";\nimport { type Args, type Mode, parseArgs, printHelp } from \"./cli/args.ts\";\nimport { processFileArguments } from \"./cli/file-processor.ts\";\nimport { buildInitialMessage } from \"./cli/initial-message.ts\";\nimport { listModels } from \"./cli/list-models.ts\";\nimport { selectSession } from \"./cli/session-picker.ts\";\nimport { ENV_SESSION_DIR, expandTildePath, getAgentDir, getPackageDir, VERSION } from \"./config.ts\";\nimport { type CreateAgentSessionRuntimeFactory, createAgentSessionRuntime } from \"./core/agent-session-runtime.ts\";\nimport {\n\ttype AgentSessionRuntimeDiagnostic,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionServices,\n} from \"./core/agent-session-services.ts\";\nimport { formatNoModelsAvailableMessage } from \"./core/auth-guidance.ts\";\nimport { AuthStorage } from \"./core/auth-storage.ts\";\nimport { exportFromFile } from \"./core/export-html/index.ts\";\nimport type { ExtensionFactory } from \"./core/extensions/types.ts\";\nimport { configureHttpDispatcher } from \"./core/http-dispatcher.ts\";\nimport { KeybindingsManager } from \"./core/keybindings.ts\";\nimport type { ModelRegistry } from \"./core/model-registry.ts\";\nimport { resolveCliModel, resolveModelScope, type ScopedModel } from \"./core/model-resolver.ts\";\nimport { restoreStdout, takeOverStdout } from \"./core/output-guard.ts\";\nimport type { CreateAgentSessionOptions } from \"./core/sdk.ts\";\nimport {\n\tformatMissingSessionCwdPrompt,\n\tgetMissingSessionCwdIssue,\n\tMissingSessionCwdError,\n\ttype SessionCwdIssue,\n} from \"./core/session-cwd.ts\";\nimport { assertValidSessionId, SessionManager } from \"./core/session-manager.ts\";\nimport { SettingsManager } from \"./core/settings-manager.ts\";\nimport { printTimings, resetTimings, time } from \"./core/timings.ts\";\nimport { runMigrations, showDeprecationWarnings } from \"./migrations.ts\";\nimport { InteractiveMode, runPrintMode, runRpcMode } from \"./modes/index.ts\";\nimport { ExtensionSelectorComponent } from \"./modes/interactive/components/extension-selector.ts\";\nimport { initTheme, stopThemeWatcher } from \"./modes/interactive/theme/theme.ts\";\nimport { handleConfigCommand, handlePackageCommand } from \"./package-manager-cli.ts\";\nimport { isLocalPath, normalizePath, resolvePath } from \"./utils/paths.ts\";\nimport { cleanupWindowsSelfUpdateQuarantine } from \"./utils/windows-self-update.ts\";\n\n/**\n * Read all content from piped stdin.\n * Returns undefined if stdin is a TTY (interactive terminal).\n */\nasync function readPipedStdin(): Promise<string | undefined> {\n\t// If stdin is a TTY, we're running interactively - don't read stdin\n\tif (process.stdin.isTTY) {\n\t\treturn undefined;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tlet data = \"\";\n\t\tprocess.stdin.setEncoding(\"utf8\");\n\t\tprocess.stdin.on(\"data\", (chunk) => {\n\t\t\tdata += chunk;\n\t\t});\n\t\tprocess.stdin.on(\"end\", () => {\n\t\t\tresolve(data.trim() || undefined);\n\t\t});\n\t\tprocess.stdin.resume();\n\t});\n}\n\nfunction collectSettingsDiagnostics(\n\tsettingsManager: SettingsManager,\n\tcontext: string,\n): AgentSessionRuntimeDiagnostic[] {\n\treturn settingsManager.drainErrors().map(({ scope, error }) => ({\n\t\ttype: \"warning\",\n\t\tmessage: `(${context}, ${scope} settings) ${error.message}`,\n\t}));\n}\n\nfunction reportDiagnostics(diagnostics: readonly AgentSessionRuntimeDiagnostic[]): void {\n\tfor (const diagnostic of diagnostics) {\n\t\tconst color = diagnostic.type === \"error\" ? chalk.red : diagnostic.type === \"warning\" ? chalk.yellow : chalk.dim;\n\t\tconst prefix = diagnostic.type === \"error\" ? \"Error: \" : diagnostic.type === \"warning\" ? \"Warning: \" : \"\";\n\t\tconsole.error(color(`${prefix}${diagnostic.message}`));\n\t}\n}\n\nfunction isTruthyEnvFlag(value: string | undefined): boolean {\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\ntype AppMode = \"interactive\" | \"print\" | \"json\" | \"rpc\";\n\nfunction resolveAppMode(parsed: Args, stdinIsTTY: boolean): AppMode {\n\tif (parsed.mode === \"rpc\") {\n\t\treturn \"rpc\";\n\t}\n\tif (parsed.mode === \"json\") {\n\t\treturn \"json\";\n\t}\n\tif (parsed.print || !stdinIsTTY) {\n\t\treturn \"print\";\n\t}\n\treturn \"interactive\";\n}\n\nfunction toPrintOutputMode(appMode: AppMode): Exclude<Mode, \"rpc\"> {\n\treturn appMode === \"json\" ? \"json\" : \"text\";\n}\n\nasync function prepareInitialMessage(\n\tparsed: Args,\n\tautoResizeImages: boolean,\n\tstdinContent?: string,\n): Promise<{\n\tinitialMessage?: string;\n\tinitialImages?: ImageContent[];\n}> {\n\tif (parsed.fileArgs.length === 0) {\n\t\treturn buildInitialMessage({ parsed, stdinContent });\n\t}\n\n\tconst { text, images } = await processFileArguments(parsed.fileArgs, { autoResizeImages });\n\treturn buildInitialMessage({\n\t\tparsed,\n\t\tfileText: text,\n\t\tfileImages: images,\n\t\tstdinContent,\n\t});\n}\n\n/** Result from resolving a session argument */\ntype ResolvedSession =\n\t| { type: \"path\"; path: string } // Direct file path\n\t| { type: \"local\"; path: string } // Found in current project\n\t| { type: \"global\"; path: string; cwd: string } // Found in different project\n\t| { type: \"not_found\"; arg: string }; // Not found anywhere\n\n/**\n * Resolve a session argument to a file path.\n * If it looks like a path, use as-is. Otherwise try to match as session ID prefix.\n */\nasync function findLocalSessionByExactId(\n\tsessionId: string,\n\tcwd: string,\n\tsessionDir?: string,\n): Promise<{ type: \"local\"; path: string } | undefined> {\n\tconst localSessions = await SessionManager.list(cwd, sessionDir);\n\tconst localMatch = localSessions.find((s) => s.id === sessionId);\n\treturn localMatch ? { type: \"local\", path: localMatch.path } : undefined;\n}\n\nasync function resolveSessionPath(sessionArg: string, cwd: string, sessionDir?: string): Promise<ResolvedSession> {\n\t// If it looks like a file path, resolve it before handing it to the session manager.\n\tif (sessionArg.includes(\"/\") || sessionArg.includes(\"\\\\\") || sessionArg.endsWith(\".jsonl\")) {\n\t\treturn { type: \"path\", path: resolvePath(sessionArg, cwd) };\n\t}\n\n\t// Try to match as session ID in current project first\n\tconst localSessions = await SessionManager.list(cwd, sessionDir);\n\tconst localMatch =\n\t\tlocalSessions.find((s) => s.id === sessionArg) ?? localSessions.find((s) => s.id.startsWith(sessionArg));\n\n\tif (localMatch) {\n\t\treturn { type: \"local\", path: localMatch.path };\n\t}\n\n\t// Try global search across all projects\n\tconst allSessions = await SessionManager.listAll(sessionDir);\n\tconst globalMatch =\n\t\tallSessions.find((s) => s.id === sessionArg) ?? allSessions.find((s) => s.id.startsWith(sessionArg));\n\n\tif (globalMatch) {\n\t\treturn { type: \"global\", path: globalMatch.path, cwd: globalMatch.cwd };\n\t}\n\n\t// Not found anywhere\n\treturn { type: \"not_found\", arg: sessionArg };\n}\n\n/** Prompt user for yes/no confirmation */\nasync function promptConfirm(message: string): Promise<boolean> {\n\treturn new Promise((resolve) => {\n\t\tconst rl = createInterface({\n\t\t\tinput: process.stdin,\n\t\t\toutput: process.stdout,\n\t\t});\n\t\trl.question(`${message} [y/N] `, (answer) => {\n\t\t\trl.close();\n\t\t\tresolve(answer.toLowerCase() === \"y\" || answer.toLowerCase() === \"yes\");\n\t\t});\n\t});\n}\n\nfunction validateForkFlags(parsed: Args): void {\n\tif (!parsed.fork) return;\n\n\tconst conflictingFlags = [\n\t\tparsed.session ? \"--session\" : undefined,\n\t\tparsed.continue ? \"--continue\" : undefined,\n\t\tparsed.resume ? \"--resume\" : undefined,\n\t\tparsed.noSession ? \"--no-session\" : undefined,\n\t].filter((flag): flag is string => flag !== undefined);\n\n\tif (conflictingFlags.length > 0) {\n\t\tconsole.error(chalk.red(`Error: --fork cannot be combined with ${conflictingFlags.join(\", \")}`));\n\t\tprocess.exit(1);\n\t}\n}\n\nfunction validateSessionIdFlags(parsed: Args): void {\n\tif (parsed.sessionId === undefined) return;\n\n\tconst conflictingFlags = [\n\t\tparsed.session ? \"--session\" : undefined,\n\t\tparsed.continue ? \"--continue\" : undefined,\n\t\tparsed.resume ? \"--resume\" : undefined,\n\t\tparsed.noSession ? \"--no-session\" : undefined,\n\t].filter((flag): flag is string => flag !== undefined);\n\n\tif (conflictingFlags.length > 0) {\n\t\tconsole.error(chalk.red(`Error: --session-id cannot be combined with ${conflictingFlags.join(\", \")}`));\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\tassertValidSessionId(parsed.sessionId);\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exit(1);\n\t}\n}\n\nfunction forkSessionOrExit(sourcePath: string, cwd: string, sessionDir?: string, sessionId?: string): SessionManager {\n\ttry {\n\t\treturn SessionManager.forkFrom(sourcePath, cwd, sessionDir, { id: sessionId });\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exit(1);\n\t}\n}\n\nasync function createSessionManager(\n\tparsed: Args,\n\tcwd: string,\n\tsessionDir: string | undefined,\n\tsettingsManager: SettingsManager,\n): Promise<SessionManager> {\n\tif (parsed.noSession || parsed.help || parsed.listModels !== undefined) {\n\t\treturn SessionManager.inMemory(cwd);\n\t}\n\n\tif (parsed.fork) {\n\t\tif (parsed.sessionId) {\n\t\t\tconst existingTarget = await findLocalSessionByExactId(parsed.sessionId, cwd, sessionDir);\n\t\t\tif (existingTarget) {\n\t\t\t\tconsole.error(chalk.red(`Session already exists with id '${parsed.sessionId}'`));\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\tconst resolved = await resolveSessionPath(parsed.fork, cwd, sessionDir);\n\n\t\tswitch (resolved.type) {\n\t\t\tcase \"path\":\n\t\t\tcase \"local\":\n\t\t\tcase \"global\":\n\t\t\t\treturn forkSessionOrExit(resolved.path, cwd, sessionDir, parsed.sessionId);\n\n\t\t\tcase \"not_found\":\n\t\t\t\tconsole.error(chalk.red(`No session found matching '${resolved.arg}'`));\n\t\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tif (parsed.session) {\n\t\tconst resolved = await resolveSessionPath(parsed.session, cwd, sessionDir);\n\n\t\tswitch (resolved.type) {\n\t\t\tcase \"path\":\n\t\t\tcase \"local\":\n\t\t\t\treturn SessionManager.open(resolved.path, sessionDir);\n\n\t\t\tcase \"global\": {\n\t\t\t\tconsole.log(chalk.yellow(`Session found in different project: ${resolved.cwd}`));\n\t\t\t\tconst shouldFork = await promptConfirm(\"Fork this session into current directory?\");\n\t\t\t\tif (!shouldFork) {\n\t\t\t\t\tconsole.log(chalk.dim(\"Aborted.\"));\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t\treturn forkSessionOrExit(resolved.path, cwd, sessionDir);\n\t\t\t}\n\n\t\t\tcase \"not_found\":\n\t\t\t\tconsole.error(chalk.red(`No session found matching '${resolved.arg}'`));\n\t\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tif (parsed.resume) {\n\t\tinitTheme(settingsManager.getTheme(), true);\n\t\ttry {\n\t\t\tconst selectedPath = await selectSession(\n\t\t\t\t(onProgress) => SessionManager.list(cwd, sessionDir, onProgress),\n\t\t\t\t(onProgress) => SessionManager.listAll(sessionDir, onProgress),\n\t\t\t);\n\t\t\tif (!selectedPath) {\n\t\t\t\tconsole.log(chalk.dim(\"No session selected\"));\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\treturn SessionManager.open(selectedPath, sessionDir);\n\t\t} finally {\n\t\t\tstopThemeWatcher();\n\t\t}\n\t}\n\n\tif (parsed.continue) {\n\t\treturn SessionManager.continueRecent(cwd, sessionDir);\n\t}\n\n\tif (parsed.sessionId) {\n\t\tconst existingSession = await findLocalSessionByExactId(parsed.sessionId, cwd, sessionDir);\n\t\tif (existingSession) {\n\t\t\treturn SessionManager.open(existingSession.path, sessionDir);\n\t\t}\n\t}\n\n\treturn SessionManager.create(cwd, sessionDir, { id: parsed.sessionId });\n}\n\nfunction buildSessionOptions(\n\tparsed: Args,\n\tscopedModels: ScopedModel[],\n\thasExistingSession: boolean,\n\tmodelRegistry: ModelRegistry,\n\tsettingsManager: SettingsManager,\n): {\n\toptions: CreateAgentSessionOptions;\n\tcliThinkingFromModel: boolean;\n\tdiagnostics: AgentSessionRuntimeDiagnostic[];\n} {\n\tconst options: CreateAgentSessionOptions = {};\n\tconst diagnostics: AgentSessionRuntimeDiagnostic[] = [];\n\tlet cliThinkingFromModel = false;\n\n\t// Model from CLI\n\t// - supports --provider <name> --model <pattern>\n\t// - supports --model <provider>/<pattern>\n\tif (parsed.model) {\n\t\tconst resolved = resolveCliModel({\n\t\t\tcliProvider: parsed.provider,\n\t\t\tcliModel: parsed.model,\n\t\t\tmodelRegistry,\n\t\t});\n\t\tif (resolved.warning) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: resolved.warning });\n\t\t}\n\t\tif (resolved.error) {\n\t\t\tdiagnostics.push({ type: \"error\", message: resolved.error });\n\t\t}\n\t\tif (resolved.model) {\n\t\t\toptions.model = resolved.model;\n\t\t\t// Allow \"--model <pattern>:<thinking>\" as a shorthand.\n\t\t\t// Explicit --thinking still takes precedence (applied later).\n\t\t\tif (!parsed.thinking && resolved.thinkingLevel) {\n\t\t\t\toptions.thinkingLevel = resolved.thinkingLevel;\n\t\t\t\tcliThinkingFromModel = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!options.model && scopedModels.length > 0 && !hasExistingSession) {\n\t\t// Check if saved default is in scoped models - use it if so, otherwise first scoped model\n\t\tconst savedProvider = settingsManager.getDefaultProvider();\n\t\tconst savedModelId = settingsManager.getDefaultModel();\n\t\tconst savedModel = savedProvider && savedModelId ? modelRegistry.find(savedProvider, savedModelId) : undefined;\n\t\tconst savedInScope = savedModel ? scopedModels.find((sm) => modelsAreEqual(sm.model, savedModel)) : undefined;\n\n\t\tif (savedInScope) {\n\t\t\toptions.model = savedInScope.model;\n\t\t\t// Use thinking level from scoped model config if explicitly set\n\t\t\tif (!parsed.thinking && savedInScope.thinkingLevel) {\n\t\t\t\toptions.thinkingLevel = savedInScope.thinkingLevel;\n\t\t\t}\n\t\t} else {\n\t\t\toptions.model = scopedModels[0].model;\n\t\t\t// Use thinking level from first scoped model if explicitly set\n\t\t\tif (!parsed.thinking && scopedModels[0].thinkingLevel) {\n\t\t\t\toptions.thinkingLevel = scopedModels[0].thinkingLevel;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Thinking level from CLI (takes precedence over scoped model thinking levels set above)\n\tif (parsed.thinking) {\n\t\toptions.thinkingLevel = parsed.thinking;\n\t}\n\n\t// Scoped models for Ctrl+P cycling\n\t// Keep thinking level undefined when not explicitly set in the model pattern.\n\t// Undefined means \"inherit current session thinking level\" during cycling.\n\tif (scopedModels.length > 0) {\n\t\toptions.scopedModels = scopedModels.map((sm) => ({\n\t\t\tmodel: sm.model,\n\t\t\tthinkingLevel: sm.thinkingLevel,\n\t\t}));\n\t}\n\n\t// API key from CLI - set in authStorage\n\t// (handled by caller before createAgentSession)\n\n\t// Tools\n\tif (parsed.noTools) {\n\t\toptions.noTools = \"all\";\n\t} else if (parsed.noBuiltinTools) {\n\t\toptions.noTools = \"builtin\";\n\t}\n\tif (parsed.tools) {\n\t\toptions.tools = [...parsed.tools];\n\t}\n\tif (parsed.excludeTools) {\n\t\toptions.excludeTools = [...parsed.excludeTools];\n\t}\n\n\treturn { options, cliThinkingFromModel, diagnostics };\n}\n\nfunction resolveCliPaths(cwd: string, paths: string[] | undefined): string[] | undefined {\n\treturn paths?.map((value) => (isLocalPath(value) ? resolvePath(value, cwd) : value));\n}\n\nasync function promptForMissingSessionCwd(\n\tissue: SessionCwdIssue,\n\tsettingsManager: SettingsManager,\n): Promise<string | undefined> {\n\tinitTheme(settingsManager.getTheme());\n\tsetKeybindings(KeybindingsManager.create());\n\n\treturn new Promise((resolve) => {\n\t\tconst ui = new TUI(new ProcessTerminal(), settingsManager.getShowHardwareCursor());\n\t\tui.setClearOnShrink(settingsManager.getClearOnShrink());\n\n\t\tlet settled = false;\n\t\tconst finish = (result: string | undefined) => {\n\t\t\tif (settled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsettled = true;\n\t\t\tui.stop();\n\t\t\tresolve(result);\n\t\t};\n\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tformatMissingSessionCwdPrompt(issue),\n\t\t\t[\"Continue\", \"Cancel\"],\n\t\t\t(option) => finish(option === \"Continue\" ? issue.fallbackCwd : undefined),\n\t\t\t() => finish(undefined),\n\t\t\t{ tui: ui },\n\t\t);\n\t\tui.addChild(selector);\n\t\tui.setFocus(selector);\n\t\tui.start();\n\t});\n}\n\nexport interface MainOptions {\n\textensionFactories?: ExtensionFactory[];\n}\n\nexport async function main(args: string[], options?: MainOptions) {\n\tresetTimings();\n\tconst offlineMode = args.includes(\"--offline\") || isTruthyEnvFlag(process.env.OMK_OFFLINE ?? process.env.PI_OFFLINE);\n\tif (offlineMode) {\n\t\tprocess.env.OMK_OFFLINE = \"1\";\n\t\tprocess.env.PI_OFFLINE = \"1\";\n\t\tprocess.env.OMK_SKIP_VERSION_CHECK = \"1\";\n\t\tprocess.env.PI_SKIP_VERSION_CHECK = \"1\";\n\t}\n\n\tif (process.platform === \"win32\") {\n\t\tcleanupWindowsSelfUpdateQuarantine(getPackageDir());\n\t}\n\n\tif (await handlePackageCommand(args)) {\n\t\treturn;\n\t}\n\n\tif (await handleConfigCommand(args)) {\n\t\treturn;\n\t}\n\n\tconst parsed = parseArgs(args);\n\tif (parsed.diagnostics.length > 0) {\n\t\tfor (const d of parsed.diagnostics) {\n\t\t\tconst color = d.type === \"error\" ? chalk.red : chalk.yellow;\n\t\t\tconsole.error(color(`${d.type === \"error\" ? \"Error\" : \"Warning\"}: ${d.message}`));\n\t\t}\n\t\tif (parsed.diagnostics.some((d) => d.type === \"error\")) {\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\ttime(\"parseArgs\");\n\tlet appMode = resolveAppMode(parsed, process.stdin.isTTY);\n\tconst shouldTakeOverStdout = appMode !== \"interactive\";\n\tif (shouldTakeOverStdout) {\n\t\ttakeOverStdout();\n\t}\n\n\tif (parsed.version) {\n\t\tconsole.log(VERSION);\n\t\tprocess.exit(0);\n\t}\n\n\tif (parsed.export) {\n\t\tlet result: string;\n\t\ttry {\n\t\t\tconst outputPath = parsed.messages.length > 0 ? parsed.messages[0] : undefined;\n\t\t\tresult = await exportFromFile(parsed.export, outputPath);\n\t\t} catch (error: unknown) {\n\t\t\tconst message = error instanceof Error ? error.message : \"Failed to export session\";\n\t\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tconsole.log(`Exported to: ${result}`);\n\t\tprocess.exit(0);\n\t}\n\n\tif (parsed.mode === \"rpc\" && parsed.fileArgs.length > 0) {\n\t\tconsole.error(chalk.red(\"Error: @file arguments are not supported in RPC mode\"));\n\t\tprocess.exit(1);\n\t}\n\n\tvalidateForkFlags(parsed);\n\tvalidateSessionIdFlags(parsed);\n\n\t// Run migrations (pass cwd for project-local migrations)\n\tconst { migratedAuthProviders: migratedProviders, deprecationWarnings } = runMigrations(process.cwd());\n\ttime(\"runMigrations\");\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst startupSettingsManager = SettingsManager.create(cwd, agentDir);\n\treportDiagnostics(collectSettingsDiagnostics(startupSettingsManager, \"startup session lookup\"));\n\n\t// Decide the final runtime cwd before creating cwd-bound runtime services.\n\t// --session and --resume may select a session from another project, so project-local\n\t// settings, resources, provider registrations, and models must be resolved only after\n\t// the target session cwd is known. The startup-cwd settings manager is used only for\n\t// sessionDir lookup during session selection.\n\tconst envSessionDir = process.env[ENV_SESSION_DIR] ?? process.env.PI_CODING_AGENT_SESSION_DIR;\n\tconst sessionDir =\n\t\t(parsed.sessionDir ? normalizePath(parsed.sessionDir) : undefined) ??\n\t\t(envSessionDir ? expandTildePath(envSessionDir) : undefined) ??\n\t\tstartupSettingsManager.getSessionDir();\n\tlet sessionManager = await createSessionManager(parsed, cwd, sessionDir, startupSettingsManager);\n\tconst missingSessionCwdIssue = getMissingSessionCwdIssue(sessionManager, cwd);\n\tif (missingSessionCwdIssue) {\n\t\tif (appMode === \"interactive\") {\n\t\t\tconst selectedCwd = await promptForMissingSessionCwd(missingSessionCwdIssue, startupSettingsManager);\n\t\t\tif (!selectedCwd) {\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tsessionManager = SessionManager.open(missingSessionCwdIssue.sessionFile!, sessionDir, selectedCwd);\n\t\t} else {\n\t\t\tconsole.error(chalk.red(new MissingSessionCwdError(missingSessionCwdIssue).message));\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\tif (parsed.name !== undefined) {\n\t\tconst name = parsed.name.trim();\n\t\tif (!name) {\n\t\t\tconsole.error(chalk.red(\"Error: --name requires a non-empty value\"));\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tsessionManager.appendSessionInfo(name);\n\t}\n\ttime(\"createSessionManager\");\n\n\tconst resolvedExtensionPaths = resolveCliPaths(cwd, parsed.extensions);\n\tconst resolvedSkillPaths = resolveCliPaths(cwd, parsed.skills);\n\tconst resolvedPromptTemplatePaths = resolveCliPaths(cwd, parsed.promptTemplates);\n\tconst resolvedThemePaths = resolveCliPaths(cwd, parsed.themes);\n\tconst authStorage = AuthStorage.create();\n\tconst createRuntime: CreateAgentSessionRuntimeFactory = async ({\n\t\tcwd,\n\t\tagentDir,\n\t\tsessionManager,\n\t\tsessionStartEvent,\n\t}) => {\n\t\tconst services = await createAgentSessionServices({\n\t\t\tcwd,\n\t\t\tagentDir,\n\t\t\tauthStorage,\n\t\t\textensionFlagValues: parsed.unknownFlags,\n\t\t\tresourceLoaderOptions: {\n\t\t\t\tadditionalExtensionPaths: resolvedExtensionPaths,\n\t\t\t\tadditionalSkillPaths: resolvedSkillPaths,\n\t\t\t\tadditionalPromptTemplatePaths: resolvedPromptTemplatePaths,\n\t\t\t\tadditionalThemePaths: resolvedThemePaths,\n\t\t\t\tnoExtensions: parsed.noExtensions,\n\t\t\t\tnoSkills: parsed.noSkills,\n\t\t\t\tnoPromptTemplates: parsed.noPromptTemplates,\n\t\t\t\tnoThemes: parsed.noThemes,\n\t\t\t\tnoContextFiles: parsed.noContextFiles,\n\t\t\t\tsystemPrompt: parsed.systemPrompt,\n\t\t\t\tappendSystemPrompt: parsed.appendSystemPrompt,\n\t\t\t\textensionFactories: options?.extensionFactories,\n\t\t\t},\n\t\t});\n\t\tconst { settingsManager, modelRegistry, resourceLoader } = services;\n\t\tconst diagnostics: AgentSessionRuntimeDiagnostic[] = [\n\t\t\t...services.diagnostics,\n\t\t\t...collectSettingsDiagnostics(settingsManager, \"runtime creation\"),\n\t\t\t...resourceLoader.getExtensions().errors.map(({ path, error }) => ({\n\t\t\t\ttype: \"error\" as const,\n\t\t\t\tmessage: `Failed to load extension \"${path}\": ${error}`,\n\t\t\t})),\n\t\t];\n\n\t\tconst modelPatterns = parsed.models ?? settingsManager.getEnabledModels();\n\t\tconst scopedModels =\n\t\t\tmodelPatterns && modelPatterns.length > 0 ? await resolveModelScope(modelPatterns, modelRegistry) : [];\n\t\tconst {\n\t\t\toptions: sessionOptions,\n\t\t\tcliThinkingFromModel,\n\t\t\tdiagnostics: sessionOptionDiagnostics,\n\t\t} = buildSessionOptions(\n\t\t\tparsed,\n\t\t\tscopedModels,\n\t\t\tsessionManager.buildSessionContext().messages.length > 0,\n\t\t\tmodelRegistry,\n\t\t\tsettingsManager,\n\t\t);\n\t\tdiagnostics.push(...sessionOptionDiagnostics);\n\n\t\tif (parsed.apiKey) {\n\t\t\tif (!sessionOptions.model) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tmessage: \"--api-key requires a model to be specified via --model, --provider/--model, or --models\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tauthStorage.setRuntimeApiKey(sessionOptions.model.provider, parsed.apiKey);\n\t\t\t}\n\t\t}\n\n\t\tconst created = await createAgentSessionFromServices({\n\t\t\tservices,\n\t\t\tsessionManager,\n\t\t\tsessionStartEvent,\n\t\t\tmodel: sessionOptions.model,\n\t\t\tthinkingLevel: sessionOptions.thinkingLevel,\n\t\t\tscopedModels: sessionOptions.scopedModels,\n\t\t\ttools: sessionOptions.tools,\n\t\t\texcludeTools: sessionOptions.excludeTools,\n\t\t\tnoTools: sessionOptions.noTools,\n\t\t\tcustomTools: sessionOptions.customTools,\n\t\t});\n\t\tconst cliThinkingOverride = parsed.thinking !== undefined || cliThinkingFromModel;\n\t\tif (created.session.model && cliThinkingOverride) {\n\t\t\tcreated.session.setThinkingLevel(created.session.thinkingLevel);\n\t\t}\n\n\t\treturn {\n\t\t\t...created,\n\t\t\tservices,\n\t\t\tdiagnostics,\n\t\t};\n\t};\n\ttime(\"createRuntime\");\n\tconst runtime = await createAgentSessionRuntime(createRuntime, {\n\t\tcwd: sessionManager.getCwd(),\n\t\tagentDir,\n\t\tsessionManager,\n\t});\n\ttime(\"createAgentSessionRuntime\");\n\tconst { services, session, modelFallbackMessage } = runtime;\n\tconst { settingsManager, modelRegistry, resourceLoader } = services;\n\tconfigureHttpDispatcher(settingsManager.getHttpIdleTimeoutMs());\n\n\tif (parsed.help) {\n\t\tconst extensionFlags = resourceLoader\n\t\t\t.getExtensions()\n\t\t\t.extensions.flatMap((extension) => Array.from(extension.flags.values()));\n\t\tprintHelp(extensionFlags);\n\t\tprocess.exit(0);\n\t}\n\n\tif (parsed.listModels !== undefined) {\n\t\tconst searchPattern = typeof parsed.listModels === \"string\" ? parsed.listModels : undefined;\n\t\tawait listModels(modelRegistry, searchPattern);\n\t\tprocess.exit(0);\n\t}\n\n\t// Read piped stdin content (if any) - skip for RPC mode which uses stdin for JSON-RPC\n\tlet stdinContent: string | undefined;\n\tif (appMode !== \"rpc\") {\n\t\tstdinContent = await readPipedStdin();\n\t\tif (stdinContent !== undefined && appMode === \"interactive\") {\n\t\t\tappMode = \"print\";\n\t\t}\n\t}\n\ttime(\"readPipedStdin\");\n\n\tconst { initialMessage, initialImages } = await prepareInitialMessage(\n\t\tparsed,\n\t\tsettingsManager.getImageAutoResize(),\n\t\tstdinContent,\n\t);\n\ttime(\"prepareInitialMessage\");\n\tinitTheme(settingsManager.getTheme(), appMode === \"interactive\");\n\ttime(\"initTheme\");\n\n\t// Show deprecation warnings in interactive mode\n\tif (appMode === \"interactive\" && deprecationWarnings.length > 0) {\n\t\tawait showDeprecationWarnings(deprecationWarnings);\n\t}\n\n\ttime(\"resolveModelScope\");\n\treportDiagnostics(runtime.diagnostics);\n\tif (runtime.diagnostics.some((diagnostic) => diagnostic.type === \"error\")) {\n\t\tprocess.exit(1);\n\t}\n\ttime(\"createAgentSession\");\n\n\tif (appMode !== \"interactive\" && !session.model) {\n\t\tconsole.error(chalk.red(formatNoModelsAvailableMessage()));\n\t\tprocess.exit(1);\n\t}\n\n\tconst startupBenchmark = isTruthyEnvFlag(process.env.PI_STARTUP_BENCHMARK);\n\tif (startupBenchmark && appMode !== \"interactive\") {\n\t\tconsole.error(chalk.red(\"Error: PI_STARTUP_BENCHMARK only supports interactive mode\"));\n\t\tprocess.exit(1);\n\t}\n\n\tif (appMode === \"rpc\") {\n\t\tprintTimings();\n\t\tawait runRpcMode(runtime);\n\t} else if (appMode === \"interactive\") {\n\t\tconst interactiveMode = new InteractiveMode(runtime, {\n\t\t\tmigratedProviders,\n\t\t\tmodelFallbackMessage,\n\t\t\tinitialMessage,\n\t\t\tinitialImages,\n\t\t\tinitialMessages: parsed.messages,\n\t\t\tverbose: parsed.verbose,\n\t\t});\n\t\tif (startupBenchmark) {\n\t\t\tawait interactiveMode.init();\n\t\t\ttime(\"interactiveMode.init\");\n\t\t\tprintTimings();\n\t\t\tinteractiveMode.stop();\n\t\t\tstopThemeWatcher();\n\t\t\tif (process.stdout.writableLength > 0) {\n\t\t\t\tawait new Promise<void>((resolve) => process.stdout.once(\"drain\", resolve));\n\t\t\t}\n\t\t\tif (process.stderr.writableLength > 0) {\n\t\t\t\tawait new Promise<void>((resolve) => process.stderr.once(\"drain\", resolve));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tprintTimings();\n\t\tawait interactiveMode.run();\n\t} else {\n\t\tprintTimings();\n\t\tconst exitCode = await runPrintMode(runtime, {\n\t\t\tmode: toPrintOutputMode(appMode),\n\t\t\tmessages: parsed.messages,\n\t\t\tinitialMessage,\n\t\t\tinitialImages,\n\t\t});\n\t\tstopThemeWatcher();\n\t\trestoreStdout();\n\t\tif (exitCode !== 0) {\n\t\t\tprocess.exitCode = exitCode;\n\t\t}\n\t\treturn;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAqB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,cAAc,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CAAC,CAAC;YAC7E,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,CAAC,cAAc,GAAG,CAAC,EAAE,CAAC;gBACvC,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,OAAO;QACR,CAAC;QAED,YAAY,EAAE,CAAC;QACf,MAAM,eAAe,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC;SAAM,CAAC;QACP,YAAY,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE;YAC5C,IAAI,EAAE,iBAAiB,CAAC,OAAO,CAAC;YAChC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,cAAc;YACd,aAAa;SACb,CAAC,CAAC;QACH,gBAAgB,EAAE,CAAC;QACnB,aAAa,EAAE,CAAC;QAChB,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC7B,CAAC;QACD,OAAO;IACR,CAAC;AAAA,CACD","sourcesContent":["/**\n * Main entry point for the coding agent CLI.\n *\n * This file handles CLI argument parsing and translates them into\n * createAgentSession() options. The SDK does the heavy lifting.\n */\n\nimport { createInterface } from \"node:readline\";\nimport { type ImageContent, modelsAreEqual } from \"@earendil-works/omk-ai\";\nimport { ProcessTerminal, setKeybindings, TUI } from \"@earendil-works/omk-tui\";\nimport chalk from \"chalk\";\nimport { type Args, type Mode, parseArgs, printHelp } from \"./cli/args.ts\";\nimport { processFileArguments } from \"./cli/file-processor.ts\";\nimport { buildInitialMessage } from \"./cli/initial-message.ts\";\nimport { listModels } from \"./cli/list-models.ts\";\nimport { selectSession } from \"./cli/session-picker.ts\";\nimport { ENV_SESSION_DIR, expandTildePath, getAgentDir, getPackageDir, VERSION } from \"./config.ts\";\nimport { type CreateAgentSessionRuntimeFactory, createAgentSessionRuntime } from \"./core/agent-session-runtime.ts\";\nimport {\n\ttype AgentSessionRuntimeDiagnostic,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionServices,\n} from \"./core/agent-session-services.ts\";\nimport { formatNoModelsAvailableMessage } from \"./core/auth-guidance.ts\";\nimport { AuthStorage } from \"./core/auth-storage.ts\";\nimport { exportFromFile } from \"./core/export-html/index.ts\";\nimport type { ExtensionFactory } from \"./core/extensions/types.ts\";\nimport { configureHttpDispatcher } from \"./core/http-dispatcher.ts\";\nimport { KeybindingsManager } from \"./core/keybindings.ts\";\nimport type { ModelRegistry } from \"./core/model-registry.ts\";\nimport { resolveCliModel, resolveModelScope, type ScopedModel } from \"./core/model-resolver.ts\";\nimport { restoreStdout, takeOverStdout } from \"./core/output-guard.ts\";\nimport type { CreateAgentSessionOptions } from \"./core/sdk.ts\";\nimport {\n\tformatMissingSessionCwdPrompt,\n\tgetMissingSessionCwdIssue,\n\tMissingSessionCwdError,\n\ttype SessionCwdIssue,\n} from \"./core/session-cwd.ts\";\nimport { assertValidSessionId, SessionManager } from \"./core/session-manager.ts\";\nimport { SettingsManager } from \"./core/settings-manager.ts\";\nimport { printTimings, resetTimings, time } from \"./core/timings.ts\";\nimport { runMigrations, showDeprecationWarnings } from \"./migrations.ts\";\nimport { InteractiveMode, runPrintMode, runRpcMode } from \"./modes/index.ts\";\nimport { ExtensionSelectorComponent } from \"./modes/interactive/components/extension-selector.ts\";\nimport { initTheme, stopThemeWatcher } from \"./modes/interactive/theme/theme.ts\";\nimport { handleConfigCommand, handlePackageCommand } from \"./package-manager-cli.ts\";\nimport { isLocalPath, normalizePath, resolvePath } from \"./utils/paths.ts\";\nimport { cleanupWindowsSelfUpdateQuarantine } from \"./utils/windows-self-update.ts\";\n\n/**\n * Read all content from piped stdin.\n * Returns undefined if stdin is a TTY (interactive terminal).\n */\nasync function readPipedStdin(): Promise<string | undefined> {\n\t// If stdin is a TTY, we're running interactively - don't read stdin\n\tif (process.stdin.isTTY) {\n\t\treturn undefined;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tlet data = \"\";\n\t\tprocess.stdin.setEncoding(\"utf8\");\n\t\tprocess.stdin.on(\"data\", (chunk) => {\n\t\t\tdata += chunk;\n\t\t});\n\t\tprocess.stdin.on(\"end\", () => {\n\t\t\tresolve(data.trim() || undefined);\n\t\t});\n\t\tprocess.stdin.resume();\n\t});\n}\n\nfunction collectSettingsDiagnostics(\n\tsettingsManager: SettingsManager,\n\tcontext: string,\n): AgentSessionRuntimeDiagnostic[] {\n\treturn settingsManager.drainErrors().map(({ scope, error }) => ({\n\t\ttype: \"warning\",\n\t\tmessage: `(${context}, ${scope} settings) ${error.message}`,\n\t}));\n}\n\nfunction reportDiagnostics(diagnostics: readonly AgentSessionRuntimeDiagnostic[]): void {\n\tfor (const diagnostic of diagnostics) {\n\t\tconst color = diagnostic.type === \"error\" ? chalk.red : diagnostic.type === \"warning\" ? chalk.yellow : chalk.dim;\n\t\tconst prefix = diagnostic.type === \"error\" ? \"Error: \" : diagnostic.type === \"warning\" ? \"Warning: \" : \"\";\n\t\tconsole.error(color(`${prefix}${diagnostic.message}`));\n\t}\n}\n\nfunction isTruthyEnvFlag(value: string | undefined): boolean {\n\tif (!value) return false;\n\treturn value === \"1\" || value.toLowerCase() === \"true\" || value.toLowerCase() === \"yes\";\n}\n\ntype AppMode = \"interactive\" | \"print\" | \"json\" | \"rpc\";\n\nfunction resolveAppMode(parsed: Args, stdinIsTTY: boolean): AppMode {\n\tif (parsed.mode === \"rpc\") {\n\t\treturn \"rpc\";\n\t}\n\tif (parsed.mode === \"json\") {\n\t\treturn \"json\";\n\t}\n\tif (parsed.print || !stdinIsTTY) {\n\t\treturn \"print\";\n\t}\n\treturn \"interactive\";\n}\n\nfunction toPrintOutputMode(appMode: AppMode): Exclude<Mode, \"rpc\"> {\n\treturn appMode === \"json\" ? \"json\" : \"text\";\n}\n\nasync function prepareInitialMessage(\n\tparsed: Args,\n\tautoResizeImages: boolean,\n\tstdinContent?: string,\n): Promise<{\n\tinitialMessage?: string;\n\tinitialImages?: ImageContent[];\n}> {\n\tif (parsed.fileArgs.length === 0) {\n\t\treturn buildInitialMessage({ parsed, stdinContent });\n\t}\n\n\tconst { text, images } = await processFileArguments(parsed.fileArgs, { autoResizeImages });\n\treturn buildInitialMessage({\n\t\tparsed,\n\t\tfileText: text,\n\t\tfileImages: images,\n\t\tstdinContent,\n\t});\n}\n\n/** Result from resolving a session argument */\ntype ResolvedSession =\n\t| { type: \"path\"; path: string } // Direct file path\n\t| { type: \"local\"; path: string } // Found in current project\n\t| { type: \"global\"; path: string; cwd: string } // Found in different project\n\t| { type: \"not_found\"; arg: string }; // Not found anywhere\n\n/**\n * Resolve a session argument to a file path.\n * If it looks like a path, use as-is. Otherwise try to match as session ID prefix.\n */\nasync function findLocalSessionByExactId(\n\tsessionId: string,\n\tcwd: string,\n\tsessionDir?: string,\n): Promise<{ type: \"local\"; path: string } | undefined> {\n\tconst localSessions = await SessionManager.list(cwd, sessionDir);\n\tconst localMatch = localSessions.find((s) => s.id === sessionId);\n\treturn localMatch ? { type: \"local\", path: localMatch.path } : undefined;\n}\n\nasync function resolveSessionPath(sessionArg: string, cwd: string, sessionDir?: string): Promise<ResolvedSession> {\n\t// If it looks like a file path, resolve it before handing it to the session manager.\n\tif (sessionArg.includes(\"/\") || sessionArg.includes(\"\\\\\") || sessionArg.endsWith(\".jsonl\")) {\n\t\treturn { type: \"path\", path: resolvePath(sessionArg, cwd) };\n\t}\n\n\t// Try to match as session ID in current project first\n\tconst localSessions = await SessionManager.list(cwd, sessionDir);\n\tconst localMatch =\n\t\tlocalSessions.find((s) => s.id === sessionArg) ?? localSessions.find((s) => s.id.startsWith(sessionArg));\n\n\tif (localMatch) {\n\t\treturn { type: \"local\", path: localMatch.path };\n\t}\n\n\t// Try global search across all projects\n\tconst allSessions = await SessionManager.listAll(sessionDir);\n\tconst globalMatch =\n\t\tallSessions.find((s) => s.id === sessionArg) ?? allSessions.find((s) => s.id.startsWith(sessionArg));\n\n\tif (globalMatch) {\n\t\treturn { type: \"global\", path: globalMatch.path, cwd: globalMatch.cwd };\n\t}\n\n\t// Not found anywhere\n\treturn { type: \"not_found\", arg: sessionArg };\n}\n\n/** Prompt user for yes/no confirmation */\nasync function promptConfirm(message: string): Promise<boolean> {\n\treturn new Promise((resolve) => {\n\t\tconst rl = createInterface({\n\t\t\tinput: process.stdin,\n\t\t\toutput: process.stdout,\n\t\t});\n\t\trl.question(`${message} [y/N] `, (answer) => {\n\t\t\trl.close();\n\t\t\tresolve(answer.toLowerCase() === \"y\" || answer.toLowerCase() === \"yes\");\n\t\t});\n\t});\n}\n\nfunction validateForkFlags(parsed: Args): void {\n\tif (!parsed.fork) return;\n\n\tconst conflictingFlags = [\n\t\tparsed.session ? \"--session\" : undefined,\n\t\tparsed.continue ? \"--continue\" : undefined,\n\t\tparsed.resume ? \"--resume\" : undefined,\n\t\tparsed.noSession ? \"--no-session\" : undefined,\n\t].filter((flag): flag is string => flag !== undefined);\n\n\tif (conflictingFlags.length > 0) {\n\t\tconsole.error(chalk.red(`Error: --fork cannot be combined with ${conflictingFlags.join(\", \")}`));\n\t\tprocess.exit(1);\n\t}\n}\n\nfunction validateSessionIdFlags(parsed: Args): void {\n\tif (parsed.sessionId === undefined) return;\n\n\tconst conflictingFlags = [\n\t\tparsed.session ? \"--session\" : undefined,\n\t\tparsed.continue ? \"--continue\" : undefined,\n\t\tparsed.resume ? \"--resume\" : undefined,\n\t\tparsed.noSession ? \"--no-session\" : undefined,\n\t].filter((flag): flag is string => flag !== undefined);\n\n\tif (conflictingFlags.length > 0) {\n\t\tconsole.error(chalk.red(`Error: --session-id cannot be combined with ${conflictingFlags.join(\", \")}`));\n\t\tprocess.exit(1);\n\t}\n\n\ttry {\n\t\tassertValidSessionId(parsed.sessionId);\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exit(1);\n\t}\n}\n\nfunction forkSessionOrExit(sourcePath: string, cwd: string, sessionDir?: string, sessionId?: string): SessionManager {\n\ttry {\n\t\treturn SessionManager.forkFrom(sourcePath, cwd, sessionDir, { id: sessionId });\n\t} catch (error: unknown) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\tprocess.exit(1);\n\t}\n}\n\nasync function createSessionManager(\n\tparsed: Args,\n\tcwd: string,\n\tsessionDir: string | undefined,\n\tsettingsManager: SettingsManager,\n): Promise<SessionManager> {\n\tif (parsed.noSession || parsed.help || parsed.listModels !== undefined) {\n\t\treturn SessionManager.inMemory(cwd);\n\t}\n\n\tif (parsed.fork) {\n\t\tif (parsed.sessionId) {\n\t\t\tconst existingTarget = await findLocalSessionByExactId(parsed.sessionId, cwd, sessionDir);\n\t\t\tif (existingTarget) {\n\t\t\t\tconsole.error(chalk.red(`Session already exists with id '${parsed.sessionId}'`));\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}\n\n\t\tconst resolved = await resolveSessionPath(parsed.fork, cwd, sessionDir);\n\n\t\tswitch (resolved.type) {\n\t\t\tcase \"path\":\n\t\t\tcase \"local\":\n\t\t\tcase \"global\":\n\t\t\t\treturn forkSessionOrExit(resolved.path, cwd, sessionDir, parsed.sessionId);\n\n\t\t\tcase \"not_found\":\n\t\t\t\tconsole.error(chalk.red(`No session found matching '${resolved.arg}'`));\n\t\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tif (parsed.session) {\n\t\tconst resolved = await resolveSessionPath(parsed.session, cwd, sessionDir);\n\n\t\tswitch (resolved.type) {\n\t\t\tcase \"path\":\n\t\t\tcase \"local\":\n\t\t\t\treturn SessionManager.open(resolved.path, sessionDir);\n\n\t\t\tcase \"global\": {\n\t\t\t\tconsole.log(chalk.yellow(`Session found in different project: ${resolved.cwd}`));\n\t\t\t\tconst shouldFork = await promptConfirm(\"Fork this session into current directory?\");\n\t\t\t\tif (!shouldFork) {\n\t\t\t\t\tconsole.log(chalk.dim(\"Aborted.\"));\n\t\t\t\t\tprocess.exit(0);\n\t\t\t\t}\n\t\t\t\treturn forkSessionOrExit(resolved.path, cwd, sessionDir);\n\t\t\t}\n\n\t\t\tcase \"not_found\":\n\t\t\t\tconsole.error(chalk.red(`No session found matching '${resolved.arg}'`));\n\t\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tif (parsed.resume) {\n\t\tinitTheme(settingsManager.getTheme(), true);\n\t\ttry {\n\t\t\tconst selectedPath = await selectSession(\n\t\t\t\t(onProgress) => SessionManager.list(cwd, sessionDir, onProgress),\n\t\t\t\t(onProgress) => SessionManager.listAll(sessionDir, onProgress),\n\t\t\t);\n\t\t\tif (!selectedPath) {\n\t\t\t\tconsole.log(chalk.dim(\"No session selected\"));\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\treturn SessionManager.open(selectedPath, sessionDir);\n\t\t} finally {\n\t\t\tstopThemeWatcher();\n\t\t}\n\t}\n\n\tif (parsed.continue) {\n\t\treturn SessionManager.continueRecent(cwd, sessionDir);\n\t}\n\n\tif (parsed.sessionId) {\n\t\tconst existingSession = await findLocalSessionByExactId(parsed.sessionId, cwd, sessionDir);\n\t\tif (existingSession) {\n\t\t\treturn SessionManager.open(existingSession.path, sessionDir);\n\t\t}\n\t}\n\n\treturn SessionManager.create(cwd, sessionDir, { id: parsed.sessionId });\n}\n\nfunction buildSessionOptions(\n\tparsed: Args,\n\tscopedModels: ScopedModel[],\n\thasExistingSession: boolean,\n\tmodelRegistry: ModelRegistry,\n\tsettingsManager: SettingsManager,\n): {\n\toptions: CreateAgentSessionOptions;\n\tcliThinkingFromModel: boolean;\n\tdiagnostics: AgentSessionRuntimeDiagnostic[];\n} {\n\tconst options: CreateAgentSessionOptions = {};\n\tconst diagnostics: AgentSessionRuntimeDiagnostic[] = [];\n\tlet cliThinkingFromModel = false;\n\n\t// Model from CLI\n\t// - supports --provider <name> --model <pattern>\n\t// - supports --model <provider>/<pattern>\n\tif (parsed.model) {\n\t\tconst resolved = resolveCliModel({\n\t\t\tcliProvider: parsed.provider,\n\t\t\tcliModel: parsed.model,\n\t\t\tmodelRegistry,\n\t\t});\n\t\tif (resolved.warning) {\n\t\t\tdiagnostics.push({ type: \"warning\", message: resolved.warning });\n\t\t}\n\t\tif (resolved.error) {\n\t\t\tdiagnostics.push({ type: \"error\", message: resolved.error });\n\t\t}\n\t\tif (resolved.model) {\n\t\t\toptions.model = resolved.model;\n\t\t\t// Allow \"--model <pattern>:<thinking>\" as a shorthand.\n\t\t\t// Explicit --thinking still takes precedence (applied later).\n\t\t\tif (!parsed.thinking && resolved.thinkingLevel) {\n\t\t\t\toptions.thinkingLevel = resolved.thinkingLevel;\n\t\t\t\tcliThinkingFromModel = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!options.model && scopedModels.length > 0 && !hasExistingSession) {\n\t\t// Check if saved default is in scoped models - use it if so, otherwise first scoped model\n\t\tconst savedProvider = settingsManager.getDefaultProvider();\n\t\tconst savedModelId = settingsManager.getDefaultModel();\n\t\tconst savedModel = savedProvider && savedModelId ? modelRegistry.find(savedProvider, savedModelId) : undefined;\n\t\tconst savedInScope = savedModel ? scopedModels.find((sm) => modelsAreEqual(sm.model, savedModel)) : undefined;\n\n\t\tif (savedInScope) {\n\t\t\toptions.model = savedInScope.model;\n\t\t\t// Use thinking level from scoped model config if explicitly set\n\t\t\tif (!parsed.thinking && savedInScope.thinkingLevel) {\n\t\t\t\toptions.thinkingLevel = savedInScope.thinkingLevel;\n\t\t\t}\n\t\t} else {\n\t\t\toptions.model = scopedModels[0].model;\n\t\t\t// Use thinking level from first scoped model if explicitly set\n\t\t\tif (!parsed.thinking && scopedModels[0].thinkingLevel) {\n\t\t\t\toptions.thinkingLevel = scopedModels[0].thinkingLevel;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Thinking level from CLI (takes precedence over scoped model thinking levels set above)\n\tif (parsed.thinking) {\n\t\toptions.thinkingLevel = parsed.thinking;\n\t}\n\n\t// Scoped models for Ctrl+P cycling\n\t// Keep thinking level undefined when not explicitly set in the model pattern.\n\t// Undefined means \"inherit current session thinking level\" during cycling.\n\tif (scopedModels.length > 0) {\n\t\toptions.scopedModels = scopedModels.map((sm) => ({\n\t\t\tmodel: sm.model,\n\t\t\tthinkingLevel: sm.thinkingLevel,\n\t\t}));\n\t}\n\n\t// API key from CLI - set in authStorage\n\t// (handled by caller before createAgentSession)\n\n\t// Tools\n\tif (parsed.noTools) {\n\t\toptions.noTools = \"all\";\n\t} else if (parsed.noBuiltinTools) {\n\t\toptions.noTools = \"builtin\";\n\t}\n\tif (parsed.tools) {\n\t\toptions.tools = [...parsed.tools];\n\t}\n\tif (parsed.excludeTools) {\n\t\toptions.excludeTools = [...parsed.excludeTools];\n\t}\n\n\treturn { options, cliThinkingFromModel, diagnostics };\n}\n\nfunction resolveCliPaths(cwd: string, paths: string[] | undefined): string[] | undefined {\n\treturn paths?.map((value) => (isLocalPath(value) ? resolvePath(value, cwd) : value));\n}\n\nasync function promptForMissingSessionCwd(\n\tissue: SessionCwdIssue,\n\tsettingsManager: SettingsManager,\n): Promise<string | undefined> {\n\tinitTheme(settingsManager.getTheme());\n\tsetKeybindings(KeybindingsManager.create());\n\n\treturn new Promise((resolve) => {\n\t\tconst ui = new TUI(new ProcessTerminal(), settingsManager.getShowHardwareCursor());\n\t\tui.setClearOnShrink(settingsManager.getClearOnShrink());\n\n\t\tlet settled = false;\n\t\tconst finish = (result: string | undefined) => {\n\t\t\tif (settled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsettled = true;\n\t\t\tui.stop();\n\t\t\tresolve(result);\n\t\t};\n\n\t\tconst selector = new ExtensionSelectorComponent(\n\t\t\tformatMissingSessionCwdPrompt(issue),\n\t\t\t[\"Continue\", \"Cancel\"],\n\t\t\t(option) => finish(option === \"Continue\" ? issue.fallbackCwd : undefined),\n\t\t\t() => finish(undefined),\n\t\t\t{ tui: ui },\n\t\t);\n\t\tui.addChild(selector);\n\t\tui.setFocus(selector);\n\t\tui.start();\n\t});\n}\n\nexport interface MainOptions {\n\textensionFactories?: ExtensionFactory[];\n}\n\nexport async function main(args: string[], options?: MainOptions) {\n\tresetTimings();\n\tconst offlineMode = args.includes(\"--offline\") || isTruthyEnvFlag(process.env.OMK_OFFLINE);\n\tif (offlineMode) {\n\t\tprocess.env.OMK_OFFLINE = \"1\";\n\t\tprocess.env.OMK_SKIP_VERSION_CHECK = \"1\";\n\t}\n\n\tif (process.platform === \"win32\") {\n\t\tcleanupWindowsSelfUpdateQuarantine(getPackageDir());\n\t}\n\n\tif (await handlePackageCommand(args)) {\n\t\treturn;\n\t}\n\n\tif (await handleConfigCommand(args)) {\n\t\treturn;\n\t}\n\n\tconst parsed = parseArgs(args);\n\tif (parsed.diagnostics.length > 0) {\n\t\tfor (const d of parsed.diagnostics) {\n\t\t\tconst color = d.type === \"error\" ? chalk.red : chalk.yellow;\n\t\t\tconsole.error(color(`${d.type === \"error\" ? \"Error\" : \"Warning\"}: ${d.message}`));\n\t\t}\n\t\tif (parsed.diagnostics.some((d) => d.type === \"error\")) {\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\ttime(\"parseArgs\");\n\tlet appMode = resolveAppMode(parsed, process.stdin.isTTY);\n\tconst shouldTakeOverStdout = appMode !== \"interactive\";\n\tif (shouldTakeOverStdout) {\n\t\ttakeOverStdout();\n\t}\n\n\tif (parsed.version) {\n\t\tconsole.log(VERSION);\n\t\tprocess.exit(0);\n\t}\n\n\tif (parsed.export) {\n\t\tlet result: string;\n\t\ttry {\n\t\t\tconst outputPath = parsed.messages.length > 0 ? parsed.messages[0] : undefined;\n\t\t\tresult = await exportFromFile(parsed.export, outputPath);\n\t\t} catch (error: unknown) {\n\t\t\tconst message = error instanceof Error ? error.message : \"Failed to export session\";\n\t\t\tconsole.error(chalk.red(`Error: ${message}`));\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tconsole.log(`Exported to: ${result}`);\n\t\tprocess.exit(0);\n\t}\n\n\tif (parsed.mode === \"rpc\" && parsed.fileArgs.length > 0) {\n\t\tconsole.error(chalk.red(\"Error: @file arguments are not supported in RPC mode\"));\n\t\tprocess.exit(1);\n\t}\n\n\tvalidateForkFlags(parsed);\n\tvalidateSessionIdFlags(parsed);\n\n\t// Run migrations (pass cwd for project-local migrations)\n\tconst { migratedAuthProviders: migratedProviders, deprecationWarnings } = runMigrations(process.cwd());\n\ttime(\"runMigrations\");\n\n\tconst cwd = process.cwd();\n\tconst agentDir = getAgentDir();\n\tconst startupSettingsManager = SettingsManager.create(cwd, agentDir);\n\treportDiagnostics(collectSettingsDiagnostics(startupSettingsManager, \"startup session lookup\"));\n\n\t// Decide the final runtime cwd before creating cwd-bound runtime services.\n\t// --session and --resume may select a session from another project, so project-local\n\t// settings, resources, provider registrations, and models must be resolved only after\n\t// the target session cwd is known. The startup-cwd settings manager is used only for\n\t// sessionDir lookup during session selection.\n\tconst envSessionDir = process.env[ENV_SESSION_DIR];\n\tconst sessionDir =\n\t\t(parsed.sessionDir ? normalizePath(parsed.sessionDir) : undefined) ??\n\t\t(envSessionDir ? expandTildePath(envSessionDir) : undefined) ??\n\t\tstartupSettingsManager.getSessionDir();\n\tlet sessionManager = await createSessionManager(parsed, cwd, sessionDir, startupSettingsManager);\n\tconst missingSessionCwdIssue = getMissingSessionCwdIssue(sessionManager, cwd);\n\tif (missingSessionCwdIssue) {\n\t\tif (appMode === \"interactive\") {\n\t\t\tconst selectedCwd = await promptForMissingSessionCwd(missingSessionCwdIssue, startupSettingsManager);\n\t\t\tif (!selectedCwd) {\n\t\t\t\tprocess.exit(0);\n\t\t\t}\n\t\t\tsessionManager = SessionManager.open(missingSessionCwdIssue.sessionFile!, sessionDir, selectedCwd);\n\t\t} else {\n\t\t\tconsole.error(chalk.red(new MissingSessionCwdError(missingSessionCwdIssue).message));\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\tif (parsed.name !== undefined) {\n\t\tconst name = parsed.name.trim();\n\t\tif (!name) {\n\t\t\tconsole.error(chalk.red(\"Error: --name requires a non-empty value\"));\n\t\t\tprocess.exit(1);\n\t\t}\n\t\tsessionManager.appendSessionInfo(name);\n\t}\n\ttime(\"createSessionManager\");\n\n\tconst resolvedExtensionPaths = resolveCliPaths(cwd, parsed.extensions);\n\tconst resolvedSkillPaths = resolveCliPaths(cwd, parsed.skills);\n\tconst resolvedPromptTemplatePaths = resolveCliPaths(cwd, parsed.promptTemplates);\n\tconst resolvedThemePaths = resolveCliPaths(cwd, parsed.themes);\n\tconst authStorage = AuthStorage.create();\n\tconst createRuntime: CreateAgentSessionRuntimeFactory = async ({\n\t\tcwd,\n\t\tagentDir,\n\t\tsessionManager,\n\t\tsessionStartEvent,\n\t}) => {\n\t\tconst services = await createAgentSessionServices({\n\t\t\tcwd,\n\t\t\tagentDir,\n\t\t\tauthStorage,\n\t\t\textensionFlagValues: parsed.unknownFlags,\n\t\t\tresourceLoaderOptions: {\n\t\t\t\tadditionalExtensionPaths: resolvedExtensionPaths,\n\t\t\t\tadditionalSkillPaths: resolvedSkillPaths,\n\t\t\t\tadditionalPromptTemplatePaths: resolvedPromptTemplatePaths,\n\t\t\t\tadditionalThemePaths: resolvedThemePaths,\n\t\t\t\tnoExtensions: parsed.noExtensions,\n\t\t\t\tnoSkills: parsed.noSkills,\n\t\t\t\tnoPromptTemplates: parsed.noPromptTemplates,\n\t\t\t\tnoThemes: parsed.noThemes,\n\t\t\t\tnoContextFiles: parsed.noContextFiles,\n\t\t\t\tsystemPrompt: parsed.systemPrompt,\n\t\t\t\tappendSystemPrompt: parsed.appendSystemPrompt,\n\t\t\t\textensionFactories: options?.extensionFactories,\n\t\t\t},\n\t\t});\n\t\tconst { settingsManager, modelRegistry, resourceLoader } = services;\n\t\tconst diagnostics: AgentSessionRuntimeDiagnostic[] = [\n\t\t\t...services.diagnostics,\n\t\t\t...collectSettingsDiagnostics(settingsManager, \"runtime creation\"),\n\t\t\t...resourceLoader.getExtensions().errors.map(({ path, error }) => ({\n\t\t\t\ttype: \"error\" as const,\n\t\t\t\tmessage: `Failed to load extension \"${path}\": ${error}`,\n\t\t\t})),\n\t\t];\n\n\t\tconst modelPatterns = parsed.models ?? settingsManager.getEnabledModels();\n\t\tconst scopedModels =\n\t\t\tmodelPatterns && modelPatterns.length > 0 ? await resolveModelScope(modelPatterns, modelRegistry) : [];\n\t\tconst {\n\t\t\toptions: sessionOptions,\n\t\t\tcliThinkingFromModel,\n\t\t\tdiagnostics: sessionOptionDiagnostics,\n\t\t} = buildSessionOptions(\n\t\t\tparsed,\n\t\t\tscopedModels,\n\t\t\tsessionManager.buildSessionContext().messages.length > 0,\n\t\t\tmodelRegistry,\n\t\t\tsettingsManager,\n\t\t);\n\t\tdiagnostics.push(...sessionOptionDiagnostics);\n\n\t\tif (parsed.apiKey) {\n\t\t\tif (!sessionOptions.model) {\n\t\t\t\tdiagnostics.push({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\tmessage: \"--api-key requires a model to be specified via --model, --provider/--model, or --models\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tauthStorage.setRuntimeApiKey(sessionOptions.model.provider, parsed.apiKey);\n\t\t\t}\n\t\t}\n\n\t\tconst created = await createAgentSessionFromServices({\n\t\t\tservices,\n\t\t\tsessionManager,\n\t\t\tsessionStartEvent,\n\t\t\tmodel: sessionOptions.model,\n\t\t\tthinkingLevel: sessionOptions.thinkingLevel,\n\t\t\tscopedModels: sessionOptions.scopedModels,\n\t\t\ttools: sessionOptions.tools,\n\t\t\texcludeTools: sessionOptions.excludeTools,\n\t\t\tnoTools: sessionOptions.noTools,\n\t\t\tcustomTools: sessionOptions.customTools,\n\t\t});\n\t\tconst cliThinkingOverride = parsed.thinking !== undefined || cliThinkingFromModel;\n\t\tif (created.session.model && cliThinkingOverride) {\n\t\t\tcreated.session.setThinkingLevel(created.session.thinkingLevel);\n\t\t}\n\n\t\treturn {\n\t\t\t...created,\n\t\t\tservices,\n\t\t\tdiagnostics,\n\t\t};\n\t};\n\ttime(\"createRuntime\");\n\tconst runtime = await createAgentSessionRuntime(createRuntime, {\n\t\tcwd: sessionManager.getCwd(),\n\t\tagentDir,\n\t\tsessionManager,\n\t});\n\ttime(\"createAgentSessionRuntime\");\n\tconst { services, session, modelFallbackMessage } = runtime;\n\tconst { settingsManager, modelRegistry, resourceLoader } = services;\n\tconfigureHttpDispatcher(settingsManager.getHttpIdleTimeoutMs());\n\n\tif (parsed.help) {\n\t\tconst extensionFlags = resourceLoader\n\t\t\t.getExtensions()\n\t\t\t.extensions.flatMap((extension) => Array.from(extension.flags.values()));\n\t\tprintHelp(extensionFlags);\n\t\tprocess.exit(0);\n\t}\n\n\tif (parsed.listModels !== undefined) {\n\t\tconst searchPattern = typeof parsed.listModels === \"string\" ? parsed.listModels : undefined;\n\t\tawait listModels(modelRegistry, searchPattern);\n\t\tprocess.exit(0);\n\t}\n\n\t// Read piped stdin content (if any) - skip for RPC mode which uses stdin for JSON-RPC\n\tlet stdinContent: string | undefined;\n\tif (appMode !== \"rpc\") {\n\t\tstdinContent = await readPipedStdin();\n\t\tif (stdinContent !== undefined && appMode === \"interactive\") {\n\t\t\tappMode = \"print\";\n\t\t}\n\t}\n\ttime(\"readPipedStdin\");\n\n\tconst { initialMessage, initialImages } = await prepareInitialMessage(\n\t\tparsed,\n\t\tsettingsManager.getImageAutoResize(),\n\t\tstdinContent,\n\t);\n\ttime(\"prepareInitialMessage\");\n\tinitTheme(settingsManager.getTheme(), appMode === \"interactive\");\n\ttime(\"initTheme\");\n\n\t// Show deprecation warnings in interactive mode\n\tif (appMode === \"interactive\" && deprecationWarnings.length > 0) {\n\t\tawait showDeprecationWarnings(deprecationWarnings);\n\t}\n\n\ttime(\"resolveModelScope\");\n\treportDiagnostics(runtime.diagnostics);\n\tif (runtime.diagnostics.some((diagnostic) => diagnostic.type === \"error\")) {\n\t\tprocess.exit(1);\n\t}\n\ttime(\"createAgentSession\");\n\n\tif (appMode !== \"interactive\" && !session.model) {\n\t\tconsole.error(chalk.red(formatNoModelsAvailableMessage()));\n\t\tprocess.exit(1);\n\t}\n\n\tconst startupBenchmark = isTruthyEnvFlag(process.env.OMK_STARTUP_BENCHMARK);\n\tif (startupBenchmark && appMode !== \"interactive\") {\n\t\tconsole.error(chalk.red(\"Error: OMK_STARTUP_BENCHMARK only supports interactive mode\"));\n\t\tprocess.exit(1);\n\t}\n\n\tif (appMode === \"rpc\") {\n\t\tprintTimings();\n\t\tawait runRpcMode(runtime);\n\t} else if (appMode === \"interactive\") {\n\t\tconst interactiveMode = new InteractiveMode(runtime, {\n\t\t\tmigratedProviders,\n\t\t\tmodelFallbackMessage,\n\t\t\tinitialMessage,\n\t\t\tinitialImages,\n\t\t\tinitialMessages: parsed.messages,\n\t\t\tverbose: parsed.verbose,\n\t\t});\n\t\tif (startupBenchmark) {\n\t\t\tawait interactiveMode.init();\n\t\t\ttime(\"interactiveMode.init\");\n\t\t\tprintTimings();\n\t\t\tinteractiveMode.stop();\n\t\t\tstopThemeWatcher();\n\t\t\tif (process.stdout.writableLength > 0) {\n\t\t\t\tawait new Promise<void>((resolve) => process.stdout.once(\"drain\", resolve));\n\t\t\t}\n\t\t\tif (process.stderr.writableLength > 0) {\n\t\t\t\tawait new Promise<void>((resolve) => process.stderr.once(\"drain\", resolve));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tprintTimings();\n\t\tawait interactiveMode.run();\n\t} else {\n\t\tprintTimings();\n\t\tconst exitCode = await runPrintMode(runtime, {\n\t\t\tmode: toPrintOutputMode(appMode),\n\t\t\tmessages: parsed.messages,\n\t\t\tinitialMessage,\n\t\t\tinitialImages,\n\t\t});\n\t\tstopThemeWatcher();\n\t\trestoreStdout();\n\t\tif (exitCode !== 0) {\n\t\t\tprocess.exitCode = exitCode;\n\t\t}\n\t\treturn;\n\t}\n}\n"]}
|
package/dist/migrations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","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CAAC;CACpC;AAiPD,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,MAAM,GAAG,8BAA8B,EAAE,CAIhG;AAiFD,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,CA6ChF;AAED,wBAAgB,2BAA2B,CAC1C,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,sBAA0D,GAC9D,sBAAsB,CAiGxB;AA2DD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB/E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG;IAC3C,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAQA","sourcesContent":["/**\n * One-time migrations that run on startup.\n */\n\nimport { createHash } from \"node:crypto\";\nimport chalk from \"chalk\";\nimport {\n\tchmodSync,\n\texistsSync,\n\tlstatSync,\n\tmkdirSync,\n\treaddirSync,\n\treadFileSync,\n\trealpathSync,\n\trenameSync,\n\trmSync,\n\twriteFileSync,\n} from \"fs\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir, getBinDir } from \"./config.ts\";\nimport { recordHarnessControlEvent } from \"./core/harness-control-events.ts\";\nimport { migrateKeybindingsConfig } from \"./core/keybindings.ts\";\nimport { isLegacyEnvVarNameConfigValue } from \"./core/resolve-config-value.ts\";\nimport { runHarnessControlTransactionSync } from \"./core/transaction-coordinator.ts\";\nimport { stripJsonComments } from \"./utils/json.ts\";\n\nconst MIGRATION_GUIDE_URL =\n\t\"https://github.com/dmae97/open-multi-agent-kit/blob/main/packages/coding-agent/CHANGELOG.md#extensions-migration\";\nconst EXTENSIONS_DOC_URL =\n\t\"https://github.com/dmae97/open-multi-agent-kit/blob/main/packages/coding-agent/docs/extensions.md\";\n\n/**\n * Migrate legacy oauth.json and settings.json apiKeys to auth.json.\n *\n * @returns Array of provider names that were migrated\n */\nexport function migrateAuthToAuthJson(): string[] {\n\tconst agentDir = getAgentDir();\n\tconst authPath = join(agentDir, \"auth.json\");\n\tconst oauthPath = join(agentDir, \"oauth.json\");\n\tconst settingsPath = join(agentDir, \"settings.json\");\n\n\t// Skip if auth.json already exists\n\tif (existsSync(authPath)) return [];\n\n\tconst migrated: Record<string, unknown> = {};\n\tconst providers: string[] = [];\n\n\t// Migrate oauth.json\n\tif (existsSync(oauthPath)) {\n\t\ttry {\n\t\t\tconst oauth = JSON.parse(readFileSync(oauthPath, \"utf-8\"));\n\t\t\tfor (const [provider, cred] of Object.entries(oauth)) {\n\t\t\t\tmigrated[provider] = { type: \"oauth\", ...(cred as object) };\n\t\t\t\tproviders.push(provider);\n\t\t\t}\n\t\t\trenameSync(oauthPath, `${oauthPath}.migrated`);\n\t\t} catch {\n\t\t\t// Skip on error\n\t\t}\n\t}\n\n\t// Migrate settings.json apiKeys\n\tif (existsSync(settingsPath)) {\n\t\ttry {\n\t\t\tconst content = readFileSync(settingsPath, \"utf-8\");\n\t\t\tconst settings = JSON.parse(content);\n\t\t\tif (settings.apiKeys && typeof settings.apiKeys === \"object\") {\n\t\t\t\tfor (const [provider, key] of Object.entries(settings.apiKeys)) {\n\t\t\t\t\tif (!migrated[provider] && typeof key === \"string\") {\n\t\t\t\t\t\tmigrated[provider] = { type: \"api_key\", key };\n\t\t\t\t\t\tproviders.push(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdelete settings.apiKeys;\n\t\t\t\twriteFileSync(settingsPath, JSON.stringify(settings, null, 2));\n\t\t\t}\n\t\t} catch {\n\t\t\t// Skip on error\n\t\t}\n\t}\n\n\tif (Object.keys(migrated).length > 0) {\n\t\tmkdirSync(dirname(authPath), { recursive: true });\n\t\twriteFileSync(authPath, JSON.stringify(migrated, null, 2), { mode: 0o600 });\n\t}\n\n\treturn providers;\n}\n\ninterface ConfigValueMigration {\n\tlocation: string;\n\tfrom: string;\n\tto: string;\n}\n\nfunction migrateLegacyEnvVarString(value: string): string | undefined {\n\treturn isLegacyEnvVarNameConfigValue(value) ? `$${value}` : undefined;\n}\n\nfunction migrateStringProperty(\n\trecord: Record<string, unknown>,\n\tkey: string,\n\tlocation: string,\n\tmigrations: ConfigValueMigration[],\n): boolean {\n\tconst value = record[key];\n\tif (typeof value !== \"string\") return false;\n\tconst migrated = migrateLegacyEnvVarString(value);\n\tif (migrated === undefined) return false;\n\trecord[key] = migrated;\n\tmigrations.push({ location, from: value, to: migrated });\n\treturn true;\n}\n\nfunction migrateHeadersConfig(headers: unknown, location: string, migrations: ConfigValueMigration[]): boolean {\n\tif (typeof headers !== \"object\" || headers === null || Array.isArray(headers)) return false;\n\tconst headerRecord = headers as Record<string, unknown>;\n\tlet migrated = false;\n\tfor (const [key, value] of Object.entries(headerRecord)) {\n\t\tif (typeof value !== \"string\") continue;\n\t\tconst migratedValue = migrateLegacyEnvVarString(value);\n\t\tif (migratedValue === undefined) continue;\n\t\theaderRecord[key] = migratedValue;\n\t\tmigrations.push({ location: `${location}[${JSON.stringify(key)}]`, from: value, to: migratedValue });\n\t\tmigrated = true;\n\t}\n\treturn migrated;\n}\n\nfunction migrateAuthJsonConfigValues(agentDir: string): ConfigValueMigration[] {\n\tconst authPath = join(agentDir, \"auth.json\");\n\tif (!existsSync(authPath)) return [];\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(authPath, \"utf-8\")) as unknown;\n\t\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return [];\n\t\tconst authData = parsed as Record<string, unknown>;\n\n\t\tconst migrations: ConfigValueMigration[] = [];\n\t\tfor (const [provider, credential] of Object.entries(authData)) {\n\t\t\tif (typeof credential !== \"object\" || credential === null || Array.isArray(credential)) continue;\n\t\t\tconst credentialRecord = credential as Record<string, unknown>;\n\t\t\tif (credentialRecord.type !== \"api_key\") continue;\n\t\t\tmigrateStringProperty(credentialRecord, \"key\", `auth.json[${JSON.stringify(provider)}].key`, migrations);\n\t\t}\n\n\t\tif (migrations.length === 0) return [];\n\t\twriteFileSync(authPath, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf-8\");\n\t\tchmodSync(authPath, 0o600);\n\t\treturn migrations;\n\t} catch {\n\t\treturn [];\n\t}\n}\n\nfunction migrateModelsJsonConfigValues(agentDir: string): ConfigValueMigration[] {\n\tconst modelsPath = join(agentDir, \"models.json\");\n\tif (!existsSync(modelsPath)) return [];\n\n\tconst parsed = JSON.parse(stripJsonComments(readFileSync(modelsPath, \"utf-8\"))) as unknown;\n\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return [];\n\tconst modelsData = parsed as Record<string, unknown>;\n\tconst providers = modelsData.providers;\n\tif (typeof providers !== \"object\" || providers === null || Array.isArray(providers)) return [];\n\n\tconst migrations: ConfigValueMigration[] = [];\n\tfor (const [provider, providerConfig] of Object.entries(providers)) {\n\t\tif (typeof providerConfig !== \"object\" || providerConfig === null || Array.isArray(providerConfig)) continue;\n\t\tconst providerRecord = providerConfig as Record<string, unknown>;\n\t\tconst providerLocation = `models.json.providers[${JSON.stringify(provider)}]`;\n\t\tmigrateStringProperty(providerRecord, \"apiKey\", `${providerLocation}.apiKey`, migrations);\n\t\tmigrateHeadersConfig(providerRecord.headers, `${providerLocation}.headers`, migrations);\n\n\t\tif (Array.isArray(providerRecord.models)) {\n\t\t\tfor (let index = 0; index < providerRecord.models.length; index++) {\n\t\t\t\tconst modelConfig = providerRecord.models[index];\n\t\t\t\tif (typeof modelConfig !== \"object\" || modelConfig === null || Array.isArray(modelConfig)) continue;\n\t\t\t\tconst modelRecord = modelConfig as Record<string, unknown>;\n\t\t\t\tconst modelKey = typeof modelRecord.id === \"string\" ? JSON.stringify(modelRecord.id) : String(index);\n\t\t\t\tmigrateHeadersConfig(modelRecord.headers, `${providerLocation}.models[${modelKey}].headers`, migrations);\n\t\t\t}\n\t\t}\n\n\t\tconst modelOverrides = providerRecord.modelOverrides;\n\t\tif (typeof modelOverrides === \"object\" && modelOverrides !== null && !Array.isArray(modelOverrides)) {\n\t\t\tfor (const [modelId, modelOverride] of Object.entries(modelOverrides)) {\n\t\t\t\tif (typeof modelOverride !== \"object\" || modelOverride === null || Array.isArray(modelOverride)) continue;\n\t\t\t\tconst modelOverrideRecord = modelOverride as Record<string, unknown>;\n\t\t\t\tmigrateHeadersConfig(\n\t\t\t\t\tmodelOverrideRecord.headers,\n\t\t\t\t\t`${providerLocation}.modelOverrides[${JSON.stringify(modelId)}].headers`,\n\t\t\t\t\tmigrations,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (migrations.length === 0) return [];\n\twriteFileSync(modelsPath, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf-8\");\n\treturn migrations;\n}\n\nfunction migrateExplicitEnvVarConfigValues(): void {\n\tconst agentDir = getAgentDir();\n\tconst migrations = [...migrateAuthJsonConfigValues(agentDir), ...migrateModelsJsonConfigValues(agentDir)];\n\tif (migrations.length === 0) return;\n\n\tconst details = migrations.map((migration) => ` - ${migration.location}: ${migration.from} -> ${migration.to}`);\n\tconsole.log(\n\t\tchalk.yellow(\n\t\t\t[\n\t\t\t\t\"Warning: Migrated API key/header environment references to explicit $ENV_VAR syntax. Plain strings will be treated as literals.\",\n\t\t\t\t...details,\n\t\t\t].join(\"\\n\"),\n\t\t),\n\t);\n}\n\n/**\n * Migrate sessions from ~/.omk/agent/*.jsonl to proper session directories.\n *\n * Bug in v0.30.0: Sessions were saved to ~/.omk/agent/ instead of\n * ~/.omk/agent/sessions/<encoded-cwd>/. This migration moves them\n * to the correct location based on the cwd in their session header.\n *\n * See: https://github.com/dmae97/open-multi-agent-kit/issues/320\n */\nexport function migrateSessionsFromAgentRoot(): void {\n\tconst agentDir = getAgentDir();\n\n\t// Find all .jsonl files directly in agentDir (not in subdirectories)\n\tlet files: string[];\n\ttry {\n\t\tfiles = readdirSync(agentDir)\n\t\t\t.filter((f) => f.endsWith(\".jsonl\"))\n\t\t\t.map((f) => join(agentDir, f));\n\t} catch {\n\t\treturn;\n\t}\n\n\tif (files.length === 0) return;\n\n\tfor (const file of files) {\n\t\ttry {\n\t\t\t// Read first line to get session header\n\t\t\tconst content = readFileSync(file, \"utf8\");\n\t\t\tconst firstLine = content.split(\"\\n\")[0];\n\t\t\tif (!firstLine?.trim()) continue;\n\n\t\t\tconst header = JSON.parse(firstLine);\n\t\t\tif (header.type !== \"session\" || !header.cwd) continue;\n\n\t\t\tconst cwd: string = header.cwd;\n\n\t\t\t// Compute the correct session directory (same encoding as session-manager.ts)\n\t\t\tconst safePath = `--${cwd.replace(/^[/\\\\]/, \"\").replace(/[/\\\\:]/g, \"-\")}--`;\n\t\t\tconst correctDir = join(agentDir, \"sessions\", safePath);\n\n\t\t\t// Create directory if needed\n\t\t\tif (!existsSync(correctDir)) {\n\t\t\t\tmkdirSync(correctDir, { recursive: true });\n\t\t\t}\n\n\t\t\t// Move the file\n\t\t\tconst fileName = file.split(\"/\").pop() || file.split(\"\\\\\").pop();\n\t\t\tconst newPath = join(correctDir, fileName!);\n\n\t\t\tif (existsSync(newPath)) continue; // Skip if target exists\n\n\t\t\trenameSync(file, newPath);\n\t\t} catch {\n\t\t\t// Skip files that can't be migrated\n\t\t}\n\t}\n}\n\n/**\n * Migrate commands/ to prompts/ if needed.\n * Works for both regular directories and symlinks.\n */\nfunction migrateCommandsToPrompts(baseDir: string, label: string): boolean {\n\tconst commandsDir = join(baseDir, \"commands\");\n\tconst promptsDir = join(baseDir, \"prompts\");\n\n\tif (existsSync(commandsDir) && !existsSync(promptsDir)) {\n\t\ttry {\n\t\t\trenameSync(commandsDir, promptsDir);\n\t\t\tconsole.log(chalk.green(`Migrated ${label} commands/ → prompts/`));\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tconsole.log(\n\t\t\t\tchalk.yellow(\n\t\t\t\t\t`Warning: Could not migrate ${label} commands/ to prompts/: ${err instanceof Error ? err.message : err}`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction migrateKeybindingsConfigFile(): void {\n\tconst configPath = join(getAgentDir(), \"keybindings.json\");\n\tif (!existsSync(configPath)) return;\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(configPath, \"utf-8\")) as unknown;\n\t\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n\t\t\treturn;\n\t\t}\n\t\tconst { config, migrated } = migrateKeybindingsConfig(parsed as Record<string, unknown>);\n\t\tif (!migrated) return;\n\t\twriteFileSync(configPath, `${JSON.stringify(config, null, 2)}\\n`, \"utf-8\");\n\t} catch {\n\t\t// Ignore malformed files during migration\n\t}\n}\n\n/**\n * Move fd/rg binaries from tools/ to bin/ if they exist.\n */\nfunction migrateToolsToBin(): void {\n\tconst agentDir = getAgentDir();\n\tconst toolsDir = join(agentDir, \"tools\");\n\tconst binDir = getBinDir();\n\n\tif (!existsSync(toolsDir)) return;\n\n\tconst binaries = [\"fd\", \"rg\", \"fd.exe\", \"rg.exe\"];\n\tlet movedAny = false;\n\n\tfor (const bin of binaries) {\n\t\tconst oldPath = join(toolsDir, bin);\n\t\tconst newPath = join(binDir, bin);\n\n\t\tif (existsSync(oldPath)) {\n\t\t\tif (!existsSync(binDir)) {\n\t\t\t\tmkdirSync(binDir, { recursive: true });\n\t\t\t}\n\t\t\tif (!existsSync(newPath)) {\n\t\t\t\ttry {\n\t\t\t\t\trenameSync(oldPath, newPath);\n\t\t\t\t\tmovedAny = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore errors\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Target exists, just delete the old one\n\t\t\t\ttry {\n\t\t\t\t\trmSync?.(oldPath, { force: true });\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (movedAny) {\n\t\tconsole.log(chalk.green(`Migrated managed binaries tools/ → bin/`));\n\t}\n}\n\n/**\n * Check for deprecated hooks/ and tools/ directories.\n * Note: tools/ may contain fd/rg binaries extracted by pi, so only warn if it has other files.\n */\nconst EXTENSION_SOURCE_EXTENSIONS = new Set([\".ts\", \".js\", \".mts\", \".cts\", \".mjs\", \".cjs\", \".tsx\", \".jsx\"]);\nconst LEGACY_MANIFEST_FIELDS = [\"hooks\", \"customTools\", \"extensions\"] as const;\nconst MAX_LEGACY_EXTENSION_SCAN_DEPTH = 8;\n\nexport type LegacyExtensionClassification = \"legacy\" | \"not-legacy\" | \"unknown\";\n\nexport interface ExtensionDeprecationDiagnostic {\n\tcode: \"LEGACY_EXTENSION_ENTRYPOINT\" | \"LEGACY_EXTENSION_UNKNOWN\";\n\tscope: \"global\" | \"project\";\n\tpath: string;\n\tclassification: LegacyExtensionClassification;\n\tconfidence: number;\n\tevidence: string[];\n\trecommendedAction: \"move-to-extensions\" | \"inspect-manifest\";\n}\n\nexport interface ExtensionMigrationAction {\n\taction: \"move\";\n\tscope: \"global\" | \"project\";\n\tfrom: string;\n\tto: string;\n\tstatus: \"ready\" | \"blocked\" | \"applied\" | \"rolled_back\" | \"in_doubt\";\n\treason: string;\n\tblocker?: string;\n\tsourceStatHash?: string;\n\tsourceContentHash?: string;\n\trecoveryJournalPath?: string;\n\tsourceStat?: {\n\t\tisDirectory: boolean;\n\t\tsize: number;\n\t\tmtimeMs: number;\n\t\tmode: number;\n\t};\n}\n\nexport interface ExtensionMigrationPlan {\n\tdiagnostics: ExtensionDeprecationDiagnostic[];\n\tactions: ExtensionMigrationAction[];\n}\n\nfunction extensionName(name: string): string {\n\tconst dotIndex = name.lastIndexOf(\".\");\n\treturn dotIndex >= 0 ? name.slice(dotIndex) : \"\";\n}\n\nfunction isExtensionSourceFile(name: string): boolean {\n\treturn EXTENSION_SOURCE_EXTENSIONS.has(extensionName(name));\n}\n\nfunction isObjectRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction manifestEntrypointReferencesSource(value: unknown): boolean {\n\tif (typeof value === \"string\") return isExtensionSourceFile(value);\n\tif (Array.isArray(value)) return value.some((entry) => manifestEntrypointReferencesSource(entry));\n\tif (isObjectRecord(value)) return Object.values(value).some((entry) => manifestEntrypointReferencesSource(entry));\n\treturn false;\n}\n\nfunction inspectLegacyExtensionManifest(\n\tdir: string,\n\tscope: \"global\" | \"project\",\n): ExtensionDeprecationDiagnostic | undefined {\n\tconst packageJsonPath = join(dir, \"package.json\");\n\tif (!existsSync(packageJsonPath)) return undefined;\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as unknown;\n\t\tif (!isObjectRecord(parsed)) return undefined;\n\t\tconst manifests = [parsed.pi, parsed.omk].filter(isObjectRecord);\n\t\tconst hasLegacyManifestArray = manifests.some((manifest) =>\n\t\t\tLEGACY_MANIFEST_FIELDS.some((field) => Array.isArray(manifest[field])),\n\t\t);\n\t\tconst hasManifestEntrypoint = [parsed.main, parsed.module, parsed.exports].some(\n\t\t\tmanifestEntrypointReferencesSource,\n\t\t);\n\t\tif (!hasLegacyManifestArray && !hasManifestEntrypoint) return undefined;\n\t\treturn {\n\t\t\tcode: \"LEGACY_EXTENSION_ENTRYPOINT\",\n\t\t\tscope,\n\t\t\tpath: packageJsonPath,\n\t\t\tclassification: \"legacy\",\n\t\t\tconfidence: hasLegacyManifestArray ? 0.96 : 0.82,\n\t\t\tevidence: [hasLegacyManifestArray ? \"manifest legacy array\" : \"manifest entrypoint\"],\n\t\t\trecommendedAction: \"move-to-extensions\",\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tcode: \"LEGACY_EXTENSION_UNKNOWN\",\n\t\t\tscope,\n\t\t\tpath: packageJsonPath,\n\t\t\tclassification: \"unknown\",\n\t\t\tconfidence: 0.5,\n\t\t\tevidence: [\"package.json parse failed\"],\n\t\t\trecommendedAction: \"inspect-manifest\",\n\t\t};\n\t}\n}\n\nfunction isPathWithin(parent: string, child: string): boolean {\n\tconst resolvedParent = resolve(parent);\n\tconst resolvedChild = resolve(child);\n\treturn resolvedChild === resolvedParent || resolvedChild.startsWith(`${resolvedParent}${sep}`);\n}\n\nfunction addLegacySourceDiagnostic(\n\tdiagnostics: ExtensionDeprecationDiagnostic[],\n\tscope: \"global\" | \"project\",\n\tentryPath: string,\n\tevidence: string,\n): void {\n\tdiagnostics.push({\n\t\tcode: \"LEGACY_EXTENSION_ENTRYPOINT\",\n\t\tscope,\n\t\tpath: entryPath,\n\t\tclassification: \"legacy\",\n\t\tconfidence: 0.98,\n\t\tevidence: [evidence],\n\t\trecommendedAction: \"move-to-extensions\",\n\t});\n}\n\nfunction addUnknownExtensionDiagnostic(\n\tdiagnostics: ExtensionDeprecationDiagnostic[],\n\tscope: \"global\" | \"project\",\n\tentryPath: string,\n\tevidence: string,\n\tconfidence = 0.4,\n): void {\n\tdiagnostics.push({\n\t\tcode: \"LEGACY_EXTENSION_UNKNOWN\",\n\t\tscope,\n\t\tpath: entryPath,\n\t\tclassification: \"unknown\",\n\t\tconfidence,\n\t\tevidence: [evidence],\n\t\trecommendedAction: \"inspect-manifest\",\n\t});\n}\n\nfunction collectLegacyExtensionDiagnostics(\n\tentryPath: string,\n\thooksRealPath: string,\n\tscope: \"global\" | \"project\",\n\tdepth: number,\n\tvisitedRealPaths: Set<string>,\n\tdiagnostics: ExtensionDeprecationDiagnostic[],\n): void {\n\tif (depth > MAX_LEGACY_EXTENSION_SCAN_DEPTH) {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"maximum scan depth exceeded\");\n\t\treturn;\n\t}\n\n\tlet currentPath = entryPath;\n\tlet stats: ReturnType<typeof lstatSync>;\n\ttry {\n\t\tstats = lstatSync(currentPath);\n\t\tif (stats.isSymbolicLink()) {\n\t\t\tconst targetPath = realpathSync(currentPath);\n\t\t\tif (!isPathWithin(hooksRealPath, targetPath)) {\n\t\t\t\taddUnknownExtensionDiagnostic(\n\t\t\t\t\tdiagnostics,\n\t\t\t\t\tscope,\n\t\t\t\t\tcurrentPath,\n\t\t\t\t\t\"symlink target outside hooks directory\",\n\t\t\t\t\t0.6,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcurrentPath = targetPath;\n\t\t\tstats = lstatSync(currentPath);\n\t\t}\n\t} catch {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"path stat failed\");\n\t\treturn;\n\t}\n\n\tif (stats.isFile()) {\n\t\tif (isExtensionSourceFile(entryPath) || isExtensionSourceFile(currentPath)) {\n\t\t\taddLegacySourceDiagnostic(diagnostics, scope, entryPath, basename(entryPath));\n\t\t}\n\t\treturn;\n\t}\n\n\tif (!stats.isDirectory()) return;\n\n\tlet directoryRealPath: string;\n\ttry {\n\t\tdirectoryRealPath = realpathSync(currentPath);\n\t} catch {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"directory realpath failed\");\n\t\treturn;\n\t}\n\tif (visitedRealPaths.has(directoryRealPath)) return;\n\tvisitedRealPaths.add(directoryRealPath);\n\n\tconst manifestDiagnostic = inspectLegacyExtensionManifest(currentPath, scope);\n\tif (manifestDiagnostic) diagnostics.push({ ...manifestDiagnostic, path: join(entryPath, \"package.json\") });\n\n\tlet entries: Array<{ name: string }>;\n\ttry {\n\t\tentries = readdirSync(currentPath, { withFileTypes: true });\n\t} catch {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"directory read failed\");\n\t\treturn;\n\t}\n\n\tfor (const entry of entries) {\n\t\tif (entry.name.startsWith(\".\")) continue;\n\t\tcollectLegacyExtensionDiagnostics(\n\t\t\tjoin(entryPath, entry.name),\n\t\t\thooksRealPath,\n\t\t\tscope,\n\t\t\tdepth + 1,\n\t\t\tvisitedRealPaths,\n\t\t\tdiagnostics,\n\t\t);\n\t}\n}\n\nfunction getLegacyExtensionDiagnosticsForHooksDir(\n\thooksDir: string,\n\tscope: \"global\" | \"project\",\n): ExtensionDeprecationDiagnostic[] {\n\tif (!existsSync(hooksDir)) return [];\n\n\ttry {\n\t\tconst hooksRealPath = realpathSync(hooksDir);\n\t\tconst diagnostics: ExtensionDeprecationDiagnostic[] = [];\n\t\tconst visitedRealPaths = new Set<string>();\n\t\tfor (const entry of readdirSync(hooksDir, { withFileTypes: true })) {\n\t\t\tif (entry.name.startsWith(\".\")) continue;\n\t\t\tcollectLegacyExtensionDiagnostics(\n\t\t\t\tjoin(hooksDir, entry.name),\n\t\t\t\thooksRealPath,\n\t\t\t\tscope,\n\t\t\t\t1,\n\t\t\t\tvisitedRealPaths,\n\t\t\t\tdiagnostics,\n\t\t\t);\n\t\t}\n\t\treturn diagnostics;\n\t} catch {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcode: \"LEGACY_EXTENSION_UNKNOWN\",\n\t\t\t\tscope,\n\t\t\t\tpath: hooksDir,\n\t\t\t\tclassification: \"unknown\",\n\t\t\t\tconfidence: 0.4,\n\t\t\t\tevidence: [\"directory read failed\"],\n\t\t\t\trecommendedAction: \"inspect-manifest\",\n\t\t\t},\n\t\t];\n\t}\n}\n\nfunction getExtensionDeprecationScanTargets(cwd: string): Array<{\n\tscope: \"global\" | \"project\";\n\thooksDir: string;\n\textensionsDir: string;\n}> {\n\tconst agentDir = getAgentDir();\n\tconst projectDir = join(cwd, CONFIG_DIR_NAME);\n\treturn [\n\t\t{\n\t\t\tscope: \"global\",\n\t\t\thooksDir: join(agentDir, \"hooks\"),\n\t\t\textensionsDir: join(agentDir, \"extensions\"),\n\t\t},\n\t\t{\n\t\t\tscope: \"project\",\n\t\t\thooksDir: join(projectDir, \"hooks\"),\n\t\t\textensionsDir: join(projectDir, \"extensions\"),\n\t\t},\n\t];\n}\n\nexport function getExtensionDeprecationDiagnostics(cwd: string): ExtensionDeprecationDiagnostic[] {\n\treturn getExtensionDeprecationScanTargets(cwd).flatMap((target) =>\n\t\tgetLegacyExtensionDiagnosticsForHooksDir(target.hooksDir, target.scope),\n\t);\n}\n\nfunction getMigrationSourcePath(diagnostic: ExtensionDeprecationDiagnostic): string {\n\tconst name = basename(diagnostic.path);\n\tif (name === \"package.json\" || /^index\\.[cm]?[tj]sx?$/.test(name)) {\n\t\treturn dirname(diagnostic.path);\n\t}\n\treturn diagnostic.path;\n}\n\nfunction createMigrationSourceStat(path: string): ExtensionMigrationAction[\"sourceStat\"] | undefined {\n\ttry {\n\t\tconst stats = lstatSync(path);\n\t\treturn {\n\t\t\tisDirectory: stats.isDirectory(),\n\t\t\tsize: stats.size,\n\t\t\tmtimeMs: stats.mtimeMs,\n\t\t\tmode: stats.mode,\n\t\t};\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction createMigrationSourceStatTree(path: string, depth = 0): unknown {\n\tconst sourceStat = createMigrationSourceStat(path);\n\tif (!sourceStat) return undefined;\n\tif (!sourceStat.isDirectory || depth >= MAX_LEGACY_EXTENSION_SCAN_DEPTH) {\n\t\treturn { name: basename(path), sourceStat };\n\t}\n\tconst children = readdirSync(path)\n\t\t.filter((entry) => !entry.startsWith(\".\"))\n\t\t.sort()\n\t\t.map((entry) => createMigrationSourceStatTree(join(path, entry), depth + 1));\n\treturn { name: basename(path), sourceStat, children };\n}\n\nfunction createMigrationSourceContentTree(path: string, depth = 0): unknown {\n\tconst sourceStat = createMigrationSourceStat(path);\n\tif (!sourceStat) return undefined;\n\tif (!sourceStat.isDirectory) {\n\t\ttry {\n\t\t\treturn {\n\t\t\t\tname: basename(path),\n\t\t\t\ttype: \"file\",\n\t\t\t\tsha256: createHash(\"sha256\").update(readFileSync(path)).digest(\"hex\"),\n\t\t\t};\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\tif (depth >= MAX_LEGACY_EXTENSION_SCAN_DEPTH) return { name: basename(path), type: \"directory\", truncated: true };\n\tconst children = readdirSync(path)\n\t\t.filter((entry) => !entry.startsWith(\".\"))\n\t\t.sort()\n\t\t.map((entry) => createMigrationSourceContentTree(join(path, entry), depth + 1));\n\treturn { name: basename(path), type: \"directory\", children };\n}\n\nfunction hashMigrationSourceStat(path: string): string | undefined {\n\tconst tree = createMigrationSourceStatTree(path);\n\tif (!tree) return undefined;\n\treturn createHash(\"sha256\").update(JSON.stringify(tree)).digest(\"hex\");\n}\n\nfunction hashMigrationSourceContent(path: string): string | undefined {\n\tconst tree = createMigrationSourceContentTree(path);\n\tif (!tree) return undefined;\n\treturn createHash(\"sha256\").update(JSON.stringify(tree)).digest(\"hex\");\n}\n\nfunction addMigrationSourceStat(action: ExtensionMigrationAction): ExtensionMigrationAction {\n\tconst sourceStat = createMigrationSourceStat(action.from);\n\treturn {\n\t\t...action,\n\t\tsourceStat,\n\t\tsourceStatHash: hashMigrationSourceStat(action.from),\n\t\tsourceContentHash: hashMigrationSourceContent(action.from),\n\t};\n}\n\nexport function createExtensionMigrationPlan(cwd: string): ExtensionMigrationPlan {\n\tconst diagnostics = getExtensionDeprecationDiagnostics(cwd);\n\tconst targets = getExtensionDeprecationScanTargets(cwd);\n\tconst actions: ExtensionMigrationAction[] = [];\n\tconst seenSources = new Set<string>();\n\n\tfor (const diagnostic of diagnostics) {\n\t\tif (diagnostic.classification !== \"legacy\") continue;\n\t\tconst target = targets.find((candidate) => candidate.scope === diagnostic.scope);\n\t\tif (!target) continue;\n\t\tconst sourcePath = getMigrationSourcePath(diagnostic);\n\t\tif (!isPathWithin(target.hooksDir, sourcePath)) continue;\n\t\tif ([...seenSources].some((seenSource) => isPathWithin(seenSource, sourcePath))) continue;\n\t\tfor (const seenSource of [...seenSources]) {\n\t\t\tif (isPathWithin(sourcePath, seenSource)) {\n\t\t\t\tseenSources.delete(seenSource);\n\t\t\t\tconst actionIndex = actions.findIndex((action) => action.from === seenSource);\n\t\t\t\tif (actionIndex >= 0) actions.splice(actionIndex, 1);\n\t\t\t}\n\t\t}\n\t\tseenSources.add(sourcePath);\n\t\tconst relativeSource = relative(target.hooksDir, sourcePath);\n\t\tconst destinationPath = join(target.extensionsDir, relativeSource);\n\t\tconst destinationExists = existsSync(destinationPath);\n\t\tactions.push(\n\t\t\taddMigrationSourceStat({\n\t\t\t\taction: \"move\",\n\t\t\t\tscope: diagnostic.scope,\n\t\t\t\tfrom: sourcePath,\n\t\t\t\tto: destinationPath,\n\t\t\t\tstatus: destinationExists ? \"blocked\" : \"ready\",\n\t\t\t\treason: diagnostic.evidence.join(\", \"),\n\t\t\t\tblocker: destinationExists ? \"target already exists\" : undefined,\n\t\t\t}),\n\t\t);\n\t}\n\n\trecordHarnessControlEvent(\"extension.migration.plan\", \"completed\", {\n\t\tdiagnostics: diagnostics.length,\n\t\tlegacyDiagnostics: diagnostics.filter((diagnostic) => diagnostic.classification === \"legacy\").length,\n\t\tunknownDiagnostics: diagnostics.filter((diagnostic) => diagnostic.classification === \"unknown\").length,\n\t\tactions: actions.length,\n\t\tblockedActions: actions.filter((action) => action.status === \"blocked\").length,\n\t});\n\treturn { diagnostics, actions };\n}\n\nexport function applyExtensionMigrationPlan(\n\tcwd: string,\n\tplan: ExtensionMigrationPlan = createExtensionMigrationPlan(cwd),\n): ExtensionMigrationPlan {\n\tconst readyActions = plan.actions.filter((action) => action.status === \"ready\");\n\tconst preflightBlocked = plan.actions.filter((action) => action.status !== \"ready\");\n\tif (preflightBlocked.length > 0) {\n\t\trecordHarnessControlEvent(\"extension.migration.apply\", \"blocked\", {\n\t\t\tactions: plan.actions.length,\n\t\t\tblockedActions: preflightBlocked.length,\n\t\t\treason: \"preflight blocked actions present\",\n\t\t});\n\t\treturn plan;\n\t}\n\n\tconst appliedMoves: Array<{ from: string; to: string }> = [];\n\tlet appliedPlan: ExtensionMigrationPlan = plan;\n\tconst transaction = runHarnessControlTransactionSync({\n\t\tkind: \"extension.migration.apply\",\n\t\tdata: {\n\t\t\tactions: plan.actions.length,\n\t\t\treadyActions: readyActions.length,\n\t\t\tcwd,\n\t\t},\n\t\tbeforeState: plan.actions.map((action) => ({\n\t\t\tfrom: action.from,\n\t\t\tto: action.to,\n\t\t\tstatus: action.status,\n\t\t\tsourceStatHash: action.sourceStatHash,\n\t\t\tsourceContentHash: action.sourceContentHash,\n\t\t})),\n\t\tafterState: () =>\n\t\t\tappliedPlan.actions.map((action) => ({ from: action.from, to: action.to, status: action.status })),\n\t\tcommit: () => {\n\t\t\tfor (const action of readyActions) {\n\t\t\t\tif (!existsSync(action.from)) throw new Error(`source missing: ${action.from}`);\n\t\t\t\tif (existsSync(action.to)) throw new Error(`target already exists: ${action.to}`);\n\t\t\t\tconst currentContentHash = hashMigrationSourceContent(action.from);\n\t\t\t\tif (action.sourceContentHash && currentContentHash !== action.sourceContentHash) {\n\t\t\t\t\tthrow new Error(`source content changed before migration: ${action.from}`);\n\t\t\t\t}\n\t\t\t\tconst currentHash = hashMigrationSourceStat(action.from);\n\t\t\t\tif (action.sourceStatHash && currentHash !== action.sourceStatHash) {\n\t\t\t\t\tthrow new Error(`source changed before migration: ${action.from}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const action of readyActions) {\n\t\t\t\tmkdirSync(dirname(action.to), { recursive: true });\n\t\t\t\trenameSync(action.from, action.to);\n\t\t\t\tappliedMoves.push({ from: action.from, to: action.to });\n\t\t\t}\n\t\t\tappliedPlan = {\n\t\t\t\tdiagnostics: plan.diagnostics,\n\t\t\t\tactions: plan.actions.map((action) =>\n\t\t\t\t\taction.status === \"ready\" ? { ...action, status: \"applied\" as const } : action,\n\t\t\t\t),\n\t\t\t};\n\t\t\treturn appliedPlan;\n\t\t},\n\t\trollback: () => {\n\t\t\tfor (const move of [...appliedMoves].reverse()) {\n\t\t\t\tif (existsSync(move.to) && !existsSync(move.from)) {\n\t\t\t\t\tmkdirSync(dirname(move.from), { recursive: true });\n\t\t\t\t\trenameSync(move.to, move.from);\n\t\t\t\t}\n\t\t\t}\n\t\t\tappliedPlan = {\n\t\t\t\tdiagnostics: plan.diagnostics,\n\t\t\t\tactions: plan.actions.map((action) =>\n\t\t\t\t\taction.status === \"ready\" ? { ...action, status: \"rolled_back\" as const } : action,\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t});\n\n\tif (transaction.status === \"completed\") return appliedPlan;\n\tconst recoveryJournalPath =\n\t\ttransaction.status === \"in_doubt\" ? join(cwd, \".omk\", \"runs\", \"extension-migration-recovery.json\") : undefined;\n\tif (recoveryJournalPath) {\n\t\tmkdirSync(dirname(recoveryJournalPath), { recursive: true });\n\t\twriteFileSync(\n\t\t\trecoveryJournalPath,\n\t\t\t`${JSON.stringify({ status: \"in_doubt\", appliedMoves, error: String(transaction.error) }, null, 2)}\\n`,\n\t\t\t\"utf-8\",\n\t\t);\n\t}\n\treturn {\n\t\tdiagnostics: plan.diagnostics,\n\t\tactions: plan.actions.map((action) =>\n\t\t\taction.status === \"ready\"\n\t\t\t\t? {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\tstatus: transaction.status === \"in_doubt\" ? \"in_doubt\" : \"blocked\",\n\t\t\t\t\t\tblocker: transaction.error instanceof Error ? transaction.error.message : String(transaction.error),\n\t\t\t\t\t\trecoveryJournalPath,\n\t\t\t\t\t}\n\t\t\t\t: action,\n\t\t),\n\t};\n}\n\nfunction checkDeprecatedExtensionDirs(baseDir: string, label: string): string[] {\n\tconst hooksDir = join(baseDir, \"hooks\");\n\tconst toolsDir = join(baseDir, \"tools\");\n\tconst warnings: string[] = [];\n\tconst scope = label === \"Global\" ? \"global\" : \"project\";\n\n\tif (\n\t\tgetLegacyExtensionDiagnosticsForHooksDir(hooksDir, scope).some(\n\t\t\t(diagnostic) => diagnostic.classification === \"legacy\",\n\t\t)\n\t) {\n\t\twarnings.push(`${label} hooks/ directory found. Hooks have been renamed to extensions.`);\n\t}\n\n\tif (existsSync(toolsDir)) {\n\t\t// Check if tools/ contains anything other than fd/rg (which are auto-extracted binaries)\n\t\ttry {\n\t\t\tconst entries = readdirSync(toolsDir);\n\t\t\tconst customTools = entries.filter((e) => {\n\t\t\t\tconst lower = e.toLowerCase();\n\t\t\t\treturn (\n\t\t\t\t\tlower !== \"fd\" && lower !== \"rg\" && lower !== \"fd.exe\" && lower !== \"rg.exe\" && !e.startsWith(\".\") // Ignore .DS_Store and other hidden files\n\t\t\t\t);\n\t\t\t});\n\t\t\tif (customTools.length > 0) {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`${label} tools/ directory contains custom tools. Custom tools have been merged into extensions.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore read errors\n\t\t}\n\t}\n\n\treturn warnings;\n}\n\n/**\n * Run extension system migrations (commands→prompts) and collect warnings about deprecated directories.\n */\nfunction migrateExtensionSystem(cwd: string): string[] {\n\tconst agentDir = getAgentDir();\n\tconst projectDir = join(cwd, CONFIG_DIR_NAME);\n\n\t// Migrate commands/ to prompts/\n\tmigrateCommandsToPrompts(agentDir, \"Global\");\n\tmigrateCommandsToPrompts(projectDir, \"Project\");\n\n\t// Check for deprecated directories\n\tconst warnings = [\n\t\t...checkDeprecatedExtensionDirs(agentDir, \"Global\"),\n\t\t...checkDeprecatedExtensionDirs(projectDir, \"Project\"),\n\t];\n\n\treturn warnings;\n}\n\n/**\n * Print deprecation warnings and wait for keypress.\n */\nexport async function showDeprecationWarnings(warnings: string[]): Promise<void> {\n\tif (warnings.length === 0) return;\n\n\tfor (const warning of warnings) {\n\t\tconsole.log(chalk.yellow(`Warning: ${warning}`));\n\t}\n\tconsole.log(chalk.yellow(`\\nMove your extensions to the extensions/ directory.`));\n\tconsole.log(chalk.yellow(`Migration guide: ${MIGRATION_GUIDE_URL}`));\n\tconsole.log(chalk.yellow(`Documentation: ${EXTENSIONS_DOC_URL}`));\n\tconsole.log(chalk.dim(`\\nPress any key to continue...`));\n\n\tawait new Promise<void>((resolve) => {\n\t\tprocess.stdin.setRawMode?.(true);\n\t\tprocess.stdin.resume();\n\t\tprocess.stdin.once(\"data\", () => {\n\t\t\tprocess.stdin.setRawMode?.(false);\n\t\t\tprocess.stdin.pause();\n\t\t\tresolve();\n\t\t});\n\t});\n\tconsole.log();\n}\n\n/**\n * Run all migrations. Called once on startup.\n *\n * @returns Object with migration results and deprecation warnings\n */\nexport function runMigrations(cwd: string): {\n\tmigratedAuthProviders: string[];\n\tdeprecationWarnings: string[];\n} {\n\tconst migratedAuthProviders = migrateAuthToAuthJson();\n\tmigrateExplicitEnvVarConfigValues();\n\tmigrateSessionsFromAgentRoot();\n\tmigrateToolsToBin();\n\tmigrateKeybindingsConfigFile();\n\tconst deprecationWarnings = migrateExtensionSystem(cwd);\n\treturn { migratedAuthProviders, deprecationWarnings };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../src/migrations.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6BH;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAoDhD;AAmID;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CA+CnD;AA+FD,MAAM,MAAM,6BAA6B,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;AAEhF,MAAM,WAAW,8BAA8B;IAC9C,IAAI,EAAE,6BAA6B,GAAG,0BAA0B,CAAC;IACjE,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,6BAA6B,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,oBAAoB,GAAG,kBAAkB,CAAC;CAC7D;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE;QACZ,WAAW,EAAE,OAAO,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;CACF;AAED,MAAM,WAAW,sBAAsB;IACtC,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC9C,OAAO,EAAE,wBAAwB,EAAE,CAAC;CACpC;AAiPD,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,MAAM,GAAG,8BAA8B,EAAE,CAIhG;AAiFD,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,sBAAsB,CA6ChF;AAED,wBAAgB,2BAA2B,CAC1C,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,sBAA0D,GAC9D,sBAAsB,CAiGxB;AA2DD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB/E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG;IAC3C,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAQA","sourcesContent":["/**\n * One-time migrations that run on startup.\n */\n\nimport { createHash } from \"node:crypto\";\nimport chalk from \"chalk\";\nimport {\n\tchmodSync,\n\texistsSync,\n\tlstatSync,\n\tmkdirSync,\n\treaddirSync,\n\treadFileSync,\n\trealpathSync,\n\trenameSync,\n\trmSync,\n\twriteFileSync,\n} from \"fs\";\nimport { basename, dirname, join, relative, resolve, sep } from \"path\";\nimport { CONFIG_DIR_NAME, getAgentDir, getBinDir } from \"./config.ts\";\nimport { recordHarnessControlEvent } from \"./core/harness-control-events.ts\";\nimport { migrateKeybindingsConfig } from \"./core/keybindings.ts\";\nimport { isLegacyEnvVarNameConfigValue } from \"./core/resolve-config-value.ts\";\nimport { runHarnessControlTransactionSync } from \"./core/transaction-coordinator.ts\";\nimport { stripJsonComments } from \"./utils/json.ts\";\n\nconst MIGRATION_GUIDE_URL =\n\t\"https://github.com/dmae97/open-multi-agent-kit/blob/main/packages/coding-agent/CHANGELOG.md#extensions-migration\";\nconst EXTENSIONS_DOC_URL =\n\t\"https://github.com/dmae97/open-multi-agent-kit/blob/main/packages/coding-agent/docs/extensions.md\";\n\n/**\n * Migrate legacy oauth.json and settings.json apiKeys to auth.json.\n *\n * @returns Array of provider names that were migrated\n */\nexport function migrateAuthToAuthJson(): string[] {\n\tconst agentDir = getAgentDir();\n\tconst authPath = join(agentDir, \"auth.json\");\n\tconst oauthPath = join(agentDir, \"oauth.json\");\n\tconst settingsPath = join(agentDir, \"settings.json\");\n\n\t// Skip if auth.json already exists\n\tif (existsSync(authPath)) return [];\n\n\tconst migrated: Record<string, unknown> = {};\n\tconst providers: string[] = [];\n\n\t// Migrate oauth.json\n\tif (existsSync(oauthPath)) {\n\t\ttry {\n\t\t\tconst oauth = JSON.parse(readFileSync(oauthPath, \"utf-8\"));\n\t\t\tfor (const [provider, cred] of Object.entries(oauth)) {\n\t\t\t\tmigrated[provider] = { type: \"oauth\", ...(cred as object) };\n\t\t\t\tproviders.push(provider);\n\t\t\t}\n\t\t\trenameSync(oauthPath, `${oauthPath}.migrated`);\n\t\t} catch {\n\t\t\t// Skip on error\n\t\t}\n\t}\n\n\t// Migrate settings.json apiKeys\n\tif (existsSync(settingsPath)) {\n\t\ttry {\n\t\t\tconst content = readFileSync(settingsPath, \"utf-8\");\n\t\t\tconst settings = JSON.parse(content);\n\t\t\tif (settings.apiKeys && typeof settings.apiKeys === \"object\") {\n\t\t\t\tfor (const [provider, key] of Object.entries(settings.apiKeys)) {\n\t\t\t\t\tif (!migrated[provider] && typeof key === \"string\") {\n\t\t\t\t\t\tmigrated[provider] = { type: \"api_key\", key };\n\t\t\t\t\t\tproviders.push(provider);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdelete settings.apiKeys;\n\t\t\t\twriteFileSync(settingsPath, JSON.stringify(settings, null, 2));\n\t\t\t}\n\t\t} catch {\n\t\t\t// Skip on error\n\t\t}\n\t}\n\n\tif (Object.keys(migrated).length > 0) {\n\t\tmkdirSync(dirname(authPath), { recursive: true });\n\t\twriteFileSync(authPath, JSON.stringify(migrated, null, 2), { mode: 0o600 });\n\t}\n\n\treturn providers;\n}\n\ninterface ConfigValueMigration {\n\tlocation: string;\n\tfrom: string;\n\tto: string;\n}\n\nfunction migrateLegacyEnvVarString(value: string): string | undefined {\n\treturn isLegacyEnvVarNameConfigValue(value) ? `$${value}` : undefined;\n}\n\nfunction migrateStringProperty(\n\trecord: Record<string, unknown>,\n\tkey: string,\n\tlocation: string,\n\tmigrations: ConfigValueMigration[],\n): boolean {\n\tconst value = record[key];\n\tif (typeof value !== \"string\") return false;\n\tconst migrated = migrateLegacyEnvVarString(value);\n\tif (migrated === undefined) return false;\n\trecord[key] = migrated;\n\tmigrations.push({ location, from: value, to: migrated });\n\treturn true;\n}\n\nfunction migrateHeadersConfig(headers: unknown, location: string, migrations: ConfigValueMigration[]): boolean {\n\tif (typeof headers !== \"object\" || headers === null || Array.isArray(headers)) return false;\n\tconst headerRecord = headers as Record<string, unknown>;\n\tlet migrated = false;\n\tfor (const [key, value] of Object.entries(headerRecord)) {\n\t\tif (typeof value !== \"string\") continue;\n\t\tconst migratedValue = migrateLegacyEnvVarString(value);\n\t\tif (migratedValue === undefined) continue;\n\t\theaderRecord[key] = migratedValue;\n\t\tmigrations.push({ location: `${location}[${JSON.stringify(key)}]`, from: value, to: migratedValue });\n\t\tmigrated = true;\n\t}\n\treturn migrated;\n}\n\nfunction migrateAuthJsonConfigValues(agentDir: string): ConfigValueMigration[] {\n\tconst authPath = join(agentDir, \"auth.json\");\n\tif (!existsSync(authPath)) return [];\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(authPath, \"utf-8\")) as unknown;\n\t\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return [];\n\t\tconst authData = parsed as Record<string, unknown>;\n\n\t\tconst migrations: ConfigValueMigration[] = [];\n\t\tfor (const [provider, credential] of Object.entries(authData)) {\n\t\t\tif (typeof credential !== \"object\" || credential === null || Array.isArray(credential)) continue;\n\t\t\tconst credentialRecord = credential as Record<string, unknown>;\n\t\t\tif (credentialRecord.type !== \"api_key\") continue;\n\t\t\tmigrateStringProperty(credentialRecord, \"key\", `auth.json[${JSON.stringify(provider)}].key`, migrations);\n\t\t}\n\n\t\tif (migrations.length === 0) return [];\n\t\twriteFileSync(authPath, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf-8\");\n\t\tchmodSync(authPath, 0o600);\n\t\treturn migrations;\n\t} catch {\n\t\treturn [];\n\t}\n}\n\nfunction migrateModelsJsonConfigValues(agentDir: string): ConfigValueMigration[] {\n\tconst modelsPath = join(agentDir, \"models.json\");\n\tif (!existsSync(modelsPath)) return [];\n\n\tconst parsed = JSON.parse(stripJsonComments(readFileSync(modelsPath, \"utf-8\"))) as unknown;\n\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return [];\n\tconst modelsData = parsed as Record<string, unknown>;\n\tconst providers = modelsData.providers;\n\tif (typeof providers !== \"object\" || providers === null || Array.isArray(providers)) return [];\n\n\tconst migrations: ConfigValueMigration[] = [];\n\tfor (const [provider, providerConfig] of Object.entries(providers)) {\n\t\tif (typeof providerConfig !== \"object\" || providerConfig === null || Array.isArray(providerConfig)) continue;\n\t\tconst providerRecord = providerConfig as Record<string, unknown>;\n\t\tconst providerLocation = `models.json.providers[${JSON.stringify(provider)}]`;\n\t\tmigrateStringProperty(providerRecord, \"apiKey\", `${providerLocation}.apiKey`, migrations);\n\t\tmigrateHeadersConfig(providerRecord.headers, `${providerLocation}.headers`, migrations);\n\n\t\tif (Array.isArray(providerRecord.models)) {\n\t\t\tfor (let index = 0; index < providerRecord.models.length; index++) {\n\t\t\t\tconst modelConfig = providerRecord.models[index];\n\t\t\t\tif (typeof modelConfig !== \"object\" || modelConfig === null || Array.isArray(modelConfig)) continue;\n\t\t\t\tconst modelRecord = modelConfig as Record<string, unknown>;\n\t\t\t\tconst modelKey = typeof modelRecord.id === \"string\" ? JSON.stringify(modelRecord.id) : String(index);\n\t\t\t\tmigrateHeadersConfig(modelRecord.headers, `${providerLocation}.models[${modelKey}].headers`, migrations);\n\t\t\t}\n\t\t}\n\n\t\tconst modelOverrides = providerRecord.modelOverrides;\n\t\tif (typeof modelOverrides === \"object\" && modelOverrides !== null && !Array.isArray(modelOverrides)) {\n\t\t\tfor (const [modelId, modelOverride] of Object.entries(modelOverrides)) {\n\t\t\t\tif (typeof modelOverride !== \"object\" || modelOverride === null || Array.isArray(modelOverride)) continue;\n\t\t\t\tconst modelOverrideRecord = modelOverride as Record<string, unknown>;\n\t\t\t\tmigrateHeadersConfig(\n\t\t\t\t\tmodelOverrideRecord.headers,\n\t\t\t\t\t`${providerLocation}.modelOverrides[${JSON.stringify(modelId)}].headers`,\n\t\t\t\t\tmigrations,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (migrations.length === 0) return [];\n\twriteFileSync(modelsPath, `${JSON.stringify(parsed, null, 2)}\\n`, \"utf-8\");\n\treturn migrations;\n}\n\nfunction migrateExplicitEnvVarConfigValues(): void {\n\tconst agentDir = getAgentDir();\n\tconst migrations = [...migrateAuthJsonConfigValues(agentDir), ...migrateModelsJsonConfigValues(agentDir)];\n\tif (migrations.length === 0) return;\n\n\tconst details = migrations.map((migration) => ` - ${migration.location}: ${migration.from} -> ${migration.to}`);\n\tconsole.log(\n\t\tchalk.yellow(\n\t\t\t[\n\t\t\t\t\"Warning: Migrated API key/header environment references to explicit $ENV_VAR syntax. Plain strings will be treated as literals.\",\n\t\t\t\t...details,\n\t\t\t].join(\"\\n\"),\n\t\t),\n\t);\n}\n\n/**\n * Migrate sessions from ~/.omk/agent/*.jsonl to proper session directories.\n *\n * Bug in v0.30.0: Sessions were saved to ~/.omk/agent/ instead of\n * ~/.omk/agent/sessions/<encoded-cwd>/. This migration moves them\n * to the correct location based on the cwd in their session header.\n *\n * See: https://github.com/dmae97/open-multi-agent-kit/issues/320\n */\nexport function migrateSessionsFromAgentRoot(): void {\n\tconst agentDir = getAgentDir();\n\n\t// Find all .jsonl files directly in agentDir (not in subdirectories)\n\tlet files: string[];\n\ttry {\n\t\tfiles = readdirSync(agentDir)\n\t\t\t.filter((f) => f.endsWith(\".jsonl\"))\n\t\t\t.map((f) => join(agentDir, f));\n\t} catch {\n\t\treturn;\n\t}\n\n\tif (files.length === 0) return;\n\n\tfor (const file of files) {\n\t\ttry {\n\t\t\t// Read first line to get session header\n\t\t\tconst content = readFileSync(file, \"utf8\");\n\t\t\tconst firstLine = content.split(\"\\n\")[0];\n\t\t\tif (!firstLine?.trim()) continue;\n\n\t\t\tconst header = JSON.parse(firstLine);\n\t\t\tif (header.type !== \"session\" || !header.cwd) continue;\n\n\t\t\tconst cwd: string = header.cwd;\n\n\t\t\t// Compute the correct session directory (same encoding as session-manager.ts)\n\t\t\tconst safePath = `--${cwd.replace(/^[/\\\\]/, \"\").replace(/[/\\\\:]/g, \"-\")}--`;\n\t\t\tconst correctDir = join(agentDir, \"sessions\", safePath);\n\n\t\t\t// Create directory if needed\n\t\t\tif (!existsSync(correctDir)) {\n\t\t\t\tmkdirSync(correctDir, { recursive: true });\n\t\t\t}\n\n\t\t\t// Move the file\n\t\t\tconst fileName = file.split(\"/\").pop() || file.split(\"\\\\\").pop();\n\t\t\tconst newPath = join(correctDir, fileName!);\n\n\t\t\tif (existsSync(newPath)) continue; // Skip if target exists\n\n\t\t\trenameSync(file, newPath);\n\t\t} catch {\n\t\t\t// Skip files that can't be migrated\n\t\t}\n\t}\n}\n\n/**\n * Migrate commands/ to prompts/ if needed.\n * Works for both regular directories and symlinks.\n */\nfunction migrateCommandsToPrompts(baseDir: string, label: string): boolean {\n\tconst commandsDir = join(baseDir, \"commands\");\n\tconst promptsDir = join(baseDir, \"prompts\");\n\n\tif (existsSync(commandsDir) && !existsSync(promptsDir)) {\n\t\ttry {\n\t\t\trenameSync(commandsDir, promptsDir);\n\t\t\tconsole.log(chalk.green(`Migrated ${label} commands/ → prompts/`));\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tconsole.log(\n\t\t\t\tchalk.yellow(\n\t\t\t\t\t`Warning: Could not migrate ${label} commands/ to prompts/: ${err instanceof Error ? err.message : err}`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction migrateKeybindingsConfigFile(): void {\n\tconst configPath = join(getAgentDir(), \"keybindings.json\");\n\tif (!existsSync(configPath)) return;\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(configPath, \"utf-8\")) as unknown;\n\t\tif (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n\t\t\treturn;\n\t\t}\n\t\tconst { config, migrated } = migrateKeybindingsConfig(parsed as Record<string, unknown>);\n\t\tif (!migrated) return;\n\t\twriteFileSync(configPath, `${JSON.stringify(config, null, 2)}\\n`, \"utf-8\");\n\t} catch {\n\t\t// Ignore malformed files during migration\n\t}\n}\n\n/**\n * Move fd/rg binaries from tools/ to bin/ if they exist.\n */\nfunction migrateToolsToBin(): void {\n\tconst agentDir = getAgentDir();\n\tconst toolsDir = join(agentDir, \"tools\");\n\tconst binDir = getBinDir();\n\n\tif (!existsSync(toolsDir)) return;\n\n\tconst binaries = [\"fd\", \"rg\", \"fd.exe\", \"rg.exe\"];\n\tlet movedAny = false;\n\n\tfor (const bin of binaries) {\n\t\tconst oldPath = join(toolsDir, bin);\n\t\tconst newPath = join(binDir, bin);\n\n\t\tif (existsSync(oldPath)) {\n\t\t\tif (!existsSync(binDir)) {\n\t\t\t\tmkdirSync(binDir, { recursive: true });\n\t\t\t}\n\t\t\tif (!existsSync(newPath)) {\n\t\t\t\ttry {\n\t\t\t\t\trenameSync(oldPath, newPath);\n\t\t\t\t\tmovedAny = true;\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore errors\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Target exists, just delete the old one\n\t\t\t\ttry {\n\t\t\t\t\trmSync?.(oldPath, { force: true });\n\t\t\t\t} catch {\n\t\t\t\t\t// Ignore\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (movedAny) {\n\t\tconsole.log(chalk.green(`Migrated managed binaries tools/ → bin/`));\n\t}\n}\n\n/**\n * Check for deprecated hooks/ and tools/ directories.\n * Note: tools/ may contain fd/rg binaries extracted by OMK, so only warn if it has other files.\n */\nconst EXTENSION_SOURCE_EXTENSIONS = new Set([\".ts\", \".js\", \".mts\", \".cts\", \".mjs\", \".cjs\", \".tsx\", \".jsx\"]);\nconst LEGACY_MANIFEST_FIELDS = [\"hooks\", \"customTools\", \"extensions\"] as const;\nconst MAX_LEGACY_EXTENSION_SCAN_DEPTH = 8;\n\nexport type LegacyExtensionClassification = \"legacy\" | \"not-legacy\" | \"unknown\";\n\nexport interface ExtensionDeprecationDiagnostic {\n\tcode: \"LEGACY_EXTENSION_ENTRYPOINT\" | \"LEGACY_EXTENSION_UNKNOWN\";\n\tscope: \"global\" | \"project\";\n\tpath: string;\n\tclassification: LegacyExtensionClassification;\n\tconfidence: number;\n\tevidence: string[];\n\trecommendedAction: \"move-to-extensions\" | \"inspect-manifest\";\n}\n\nexport interface ExtensionMigrationAction {\n\taction: \"move\";\n\tscope: \"global\" | \"project\";\n\tfrom: string;\n\tto: string;\n\tstatus: \"ready\" | \"blocked\" | \"applied\" | \"rolled_back\" | \"in_doubt\";\n\treason: string;\n\tblocker?: string;\n\tsourceStatHash?: string;\n\tsourceContentHash?: string;\n\trecoveryJournalPath?: string;\n\tsourceStat?: {\n\t\tisDirectory: boolean;\n\t\tsize: number;\n\t\tmtimeMs: number;\n\t\tmode: number;\n\t};\n}\n\nexport interface ExtensionMigrationPlan {\n\tdiagnostics: ExtensionDeprecationDiagnostic[];\n\tactions: ExtensionMigrationAction[];\n}\n\nfunction extensionName(name: string): string {\n\tconst dotIndex = name.lastIndexOf(\".\");\n\treturn dotIndex >= 0 ? name.slice(dotIndex) : \"\";\n}\n\nfunction isExtensionSourceFile(name: string): boolean {\n\treturn EXTENSION_SOURCE_EXTENSIONS.has(extensionName(name));\n}\n\nfunction isObjectRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction manifestEntrypointReferencesSource(value: unknown): boolean {\n\tif (typeof value === \"string\") return isExtensionSourceFile(value);\n\tif (Array.isArray(value)) return value.some((entry) => manifestEntrypointReferencesSource(entry));\n\tif (isObjectRecord(value)) return Object.values(value).some((entry) => manifestEntrypointReferencesSource(entry));\n\treturn false;\n}\n\nfunction inspectLegacyExtensionManifest(\n\tdir: string,\n\tscope: \"global\" | \"project\",\n): ExtensionDeprecationDiagnostic | undefined {\n\tconst packageJsonPath = join(dir, \"package.json\");\n\tif (!existsSync(packageJsonPath)) return undefined;\n\n\ttry {\n\t\tconst parsed = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as unknown;\n\t\tif (!isObjectRecord(parsed)) return undefined;\n\t\tconst manifests = [parsed.pi, parsed.omk].filter(isObjectRecord);\n\t\tconst hasLegacyManifestArray = manifests.some((manifest) =>\n\t\t\tLEGACY_MANIFEST_FIELDS.some((field) => Array.isArray(manifest[field])),\n\t\t);\n\t\tconst hasManifestEntrypoint = [parsed.main, parsed.module, parsed.exports].some(\n\t\t\tmanifestEntrypointReferencesSource,\n\t\t);\n\t\tif (!hasLegacyManifestArray && !hasManifestEntrypoint) return undefined;\n\t\treturn {\n\t\t\tcode: \"LEGACY_EXTENSION_ENTRYPOINT\",\n\t\t\tscope,\n\t\t\tpath: packageJsonPath,\n\t\t\tclassification: \"legacy\",\n\t\t\tconfidence: hasLegacyManifestArray ? 0.96 : 0.82,\n\t\t\tevidence: [hasLegacyManifestArray ? \"manifest legacy array\" : \"manifest entrypoint\"],\n\t\t\trecommendedAction: \"move-to-extensions\",\n\t\t};\n\t} catch {\n\t\treturn {\n\t\t\tcode: \"LEGACY_EXTENSION_UNKNOWN\",\n\t\t\tscope,\n\t\t\tpath: packageJsonPath,\n\t\t\tclassification: \"unknown\",\n\t\t\tconfidence: 0.5,\n\t\t\tevidence: [\"package.json parse failed\"],\n\t\t\trecommendedAction: \"inspect-manifest\",\n\t\t};\n\t}\n}\n\nfunction isPathWithin(parent: string, child: string): boolean {\n\tconst resolvedParent = resolve(parent);\n\tconst resolvedChild = resolve(child);\n\treturn resolvedChild === resolvedParent || resolvedChild.startsWith(`${resolvedParent}${sep}`);\n}\n\nfunction addLegacySourceDiagnostic(\n\tdiagnostics: ExtensionDeprecationDiagnostic[],\n\tscope: \"global\" | \"project\",\n\tentryPath: string,\n\tevidence: string,\n): void {\n\tdiagnostics.push({\n\t\tcode: \"LEGACY_EXTENSION_ENTRYPOINT\",\n\t\tscope,\n\t\tpath: entryPath,\n\t\tclassification: \"legacy\",\n\t\tconfidence: 0.98,\n\t\tevidence: [evidence],\n\t\trecommendedAction: \"move-to-extensions\",\n\t});\n}\n\nfunction addUnknownExtensionDiagnostic(\n\tdiagnostics: ExtensionDeprecationDiagnostic[],\n\tscope: \"global\" | \"project\",\n\tentryPath: string,\n\tevidence: string,\n\tconfidence = 0.4,\n): void {\n\tdiagnostics.push({\n\t\tcode: \"LEGACY_EXTENSION_UNKNOWN\",\n\t\tscope,\n\t\tpath: entryPath,\n\t\tclassification: \"unknown\",\n\t\tconfidence,\n\t\tevidence: [evidence],\n\t\trecommendedAction: \"inspect-manifest\",\n\t});\n}\n\nfunction collectLegacyExtensionDiagnostics(\n\tentryPath: string,\n\thooksRealPath: string,\n\tscope: \"global\" | \"project\",\n\tdepth: number,\n\tvisitedRealPaths: Set<string>,\n\tdiagnostics: ExtensionDeprecationDiagnostic[],\n): void {\n\tif (depth > MAX_LEGACY_EXTENSION_SCAN_DEPTH) {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"maximum scan depth exceeded\");\n\t\treturn;\n\t}\n\n\tlet currentPath = entryPath;\n\tlet stats: ReturnType<typeof lstatSync>;\n\ttry {\n\t\tstats = lstatSync(currentPath);\n\t\tif (stats.isSymbolicLink()) {\n\t\t\tconst targetPath = realpathSync(currentPath);\n\t\t\tif (!isPathWithin(hooksRealPath, targetPath)) {\n\t\t\t\taddUnknownExtensionDiagnostic(\n\t\t\t\t\tdiagnostics,\n\t\t\t\t\tscope,\n\t\t\t\t\tcurrentPath,\n\t\t\t\t\t\"symlink target outside hooks directory\",\n\t\t\t\t\t0.6,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcurrentPath = targetPath;\n\t\t\tstats = lstatSync(currentPath);\n\t\t}\n\t} catch {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"path stat failed\");\n\t\treturn;\n\t}\n\n\tif (stats.isFile()) {\n\t\tif (isExtensionSourceFile(entryPath) || isExtensionSourceFile(currentPath)) {\n\t\t\taddLegacySourceDiagnostic(diagnostics, scope, entryPath, basename(entryPath));\n\t\t}\n\t\treturn;\n\t}\n\n\tif (!stats.isDirectory()) return;\n\n\tlet directoryRealPath: string;\n\ttry {\n\t\tdirectoryRealPath = realpathSync(currentPath);\n\t} catch {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"directory realpath failed\");\n\t\treturn;\n\t}\n\tif (visitedRealPaths.has(directoryRealPath)) return;\n\tvisitedRealPaths.add(directoryRealPath);\n\n\tconst manifestDiagnostic = inspectLegacyExtensionManifest(currentPath, scope);\n\tif (manifestDiagnostic) diagnostics.push({ ...manifestDiagnostic, path: join(entryPath, \"package.json\") });\n\n\tlet entries: Array<{ name: string }>;\n\ttry {\n\t\tentries = readdirSync(currentPath, { withFileTypes: true });\n\t} catch {\n\t\taddUnknownExtensionDiagnostic(diagnostics, scope, entryPath, \"directory read failed\");\n\t\treturn;\n\t}\n\n\tfor (const entry of entries) {\n\t\tif (entry.name.startsWith(\".\")) continue;\n\t\tcollectLegacyExtensionDiagnostics(\n\t\t\tjoin(entryPath, entry.name),\n\t\t\thooksRealPath,\n\t\t\tscope,\n\t\t\tdepth + 1,\n\t\t\tvisitedRealPaths,\n\t\t\tdiagnostics,\n\t\t);\n\t}\n}\n\nfunction getLegacyExtensionDiagnosticsForHooksDir(\n\thooksDir: string,\n\tscope: \"global\" | \"project\",\n): ExtensionDeprecationDiagnostic[] {\n\tif (!existsSync(hooksDir)) return [];\n\n\ttry {\n\t\tconst hooksRealPath = realpathSync(hooksDir);\n\t\tconst diagnostics: ExtensionDeprecationDiagnostic[] = [];\n\t\tconst visitedRealPaths = new Set<string>();\n\t\tfor (const entry of readdirSync(hooksDir, { withFileTypes: true })) {\n\t\t\tif (entry.name.startsWith(\".\")) continue;\n\t\t\tcollectLegacyExtensionDiagnostics(\n\t\t\t\tjoin(hooksDir, entry.name),\n\t\t\t\thooksRealPath,\n\t\t\t\tscope,\n\t\t\t\t1,\n\t\t\t\tvisitedRealPaths,\n\t\t\t\tdiagnostics,\n\t\t\t);\n\t\t}\n\t\treturn diagnostics;\n\t} catch {\n\t\treturn [\n\t\t\t{\n\t\t\t\tcode: \"LEGACY_EXTENSION_UNKNOWN\",\n\t\t\t\tscope,\n\t\t\t\tpath: hooksDir,\n\t\t\t\tclassification: \"unknown\",\n\t\t\t\tconfidence: 0.4,\n\t\t\t\tevidence: [\"directory read failed\"],\n\t\t\t\trecommendedAction: \"inspect-manifest\",\n\t\t\t},\n\t\t];\n\t}\n}\n\nfunction getExtensionDeprecationScanTargets(cwd: string): Array<{\n\tscope: \"global\" | \"project\";\n\thooksDir: string;\n\textensionsDir: string;\n}> {\n\tconst agentDir = getAgentDir();\n\tconst projectDir = join(cwd, CONFIG_DIR_NAME);\n\treturn [\n\t\t{\n\t\t\tscope: \"global\",\n\t\t\thooksDir: join(agentDir, \"hooks\"),\n\t\t\textensionsDir: join(agentDir, \"extensions\"),\n\t\t},\n\t\t{\n\t\t\tscope: \"project\",\n\t\t\thooksDir: join(projectDir, \"hooks\"),\n\t\t\textensionsDir: join(projectDir, \"extensions\"),\n\t\t},\n\t];\n}\n\nexport function getExtensionDeprecationDiagnostics(cwd: string): ExtensionDeprecationDiagnostic[] {\n\treturn getExtensionDeprecationScanTargets(cwd).flatMap((target) =>\n\t\tgetLegacyExtensionDiagnosticsForHooksDir(target.hooksDir, target.scope),\n\t);\n}\n\nfunction getMigrationSourcePath(diagnostic: ExtensionDeprecationDiagnostic): string {\n\tconst name = basename(diagnostic.path);\n\tif (name === \"package.json\" || /^index\\.[cm]?[tj]sx?$/.test(name)) {\n\t\treturn dirname(diagnostic.path);\n\t}\n\treturn diagnostic.path;\n}\n\nfunction createMigrationSourceStat(path: string): ExtensionMigrationAction[\"sourceStat\"] | undefined {\n\ttry {\n\t\tconst stats = lstatSync(path);\n\t\treturn {\n\t\t\tisDirectory: stats.isDirectory(),\n\t\t\tsize: stats.size,\n\t\t\tmtimeMs: stats.mtimeMs,\n\t\t\tmode: stats.mode,\n\t\t};\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction createMigrationSourceStatTree(path: string, depth = 0): unknown {\n\tconst sourceStat = createMigrationSourceStat(path);\n\tif (!sourceStat) return undefined;\n\tif (!sourceStat.isDirectory || depth >= MAX_LEGACY_EXTENSION_SCAN_DEPTH) {\n\t\treturn { name: basename(path), sourceStat };\n\t}\n\tconst children = readdirSync(path)\n\t\t.filter((entry) => !entry.startsWith(\".\"))\n\t\t.sort()\n\t\t.map((entry) => createMigrationSourceStatTree(join(path, entry), depth + 1));\n\treturn { name: basename(path), sourceStat, children };\n}\n\nfunction createMigrationSourceContentTree(path: string, depth = 0): unknown {\n\tconst sourceStat = createMigrationSourceStat(path);\n\tif (!sourceStat) return undefined;\n\tif (!sourceStat.isDirectory) {\n\t\ttry {\n\t\t\treturn {\n\t\t\t\tname: basename(path),\n\t\t\t\ttype: \"file\",\n\t\t\t\tsha256: createHash(\"sha256\").update(readFileSync(path)).digest(\"hex\"),\n\t\t\t};\n\t\t} catch {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\tif (depth >= MAX_LEGACY_EXTENSION_SCAN_DEPTH) return { name: basename(path), type: \"directory\", truncated: true };\n\tconst children = readdirSync(path)\n\t\t.filter((entry) => !entry.startsWith(\".\"))\n\t\t.sort()\n\t\t.map((entry) => createMigrationSourceContentTree(join(path, entry), depth + 1));\n\treturn { name: basename(path), type: \"directory\", children };\n}\n\nfunction hashMigrationSourceStat(path: string): string | undefined {\n\tconst tree = createMigrationSourceStatTree(path);\n\tif (!tree) return undefined;\n\treturn createHash(\"sha256\").update(JSON.stringify(tree)).digest(\"hex\");\n}\n\nfunction hashMigrationSourceContent(path: string): string | undefined {\n\tconst tree = createMigrationSourceContentTree(path);\n\tif (!tree) return undefined;\n\treturn createHash(\"sha256\").update(JSON.stringify(tree)).digest(\"hex\");\n}\n\nfunction addMigrationSourceStat(action: ExtensionMigrationAction): ExtensionMigrationAction {\n\tconst sourceStat = createMigrationSourceStat(action.from);\n\treturn {\n\t\t...action,\n\t\tsourceStat,\n\t\tsourceStatHash: hashMigrationSourceStat(action.from),\n\t\tsourceContentHash: hashMigrationSourceContent(action.from),\n\t};\n}\n\nexport function createExtensionMigrationPlan(cwd: string): ExtensionMigrationPlan {\n\tconst diagnostics = getExtensionDeprecationDiagnostics(cwd);\n\tconst targets = getExtensionDeprecationScanTargets(cwd);\n\tconst actions: ExtensionMigrationAction[] = [];\n\tconst seenSources = new Set<string>();\n\n\tfor (const diagnostic of diagnostics) {\n\t\tif (diagnostic.classification !== \"legacy\") continue;\n\t\tconst target = targets.find((candidate) => candidate.scope === diagnostic.scope);\n\t\tif (!target) continue;\n\t\tconst sourcePath = getMigrationSourcePath(diagnostic);\n\t\tif (!isPathWithin(target.hooksDir, sourcePath)) continue;\n\t\tif ([...seenSources].some((seenSource) => isPathWithin(seenSource, sourcePath))) continue;\n\t\tfor (const seenSource of [...seenSources]) {\n\t\t\tif (isPathWithin(sourcePath, seenSource)) {\n\t\t\t\tseenSources.delete(seenSource);\n\t\t\t\tconst actionIndex = actions.findIndex((action) => action.from === seenSource);\n\t\t\t\tif (actionIndex >= 0) actions.splice(actionIndex, 1);\n\t\t\t}\n\t\t}\n\t\tseenSources.add(sourcePath);\n\t\tconst relativeSource = relative(target.hooksDir, sourcePath);\n\t\tconst destinationPath = join(target.extensionsDir, relativeSource);\n\t\tconst destinationExists = existsSync(destinationPath);\n\t\tactions.push(\n\t\t\taddMigrationSourceStat({\n\t\t\t\taction: \"move\",\n\t\t\t\tscope: diagnostic.scope,\n\t\t\t\tfrom: sourcePath,\n\t\t\t\tto: destinationPath,\n\t\t\t\tstatus: destinationExists ? \"blocked\" : \"ready\",\n\t\t\t\treason: diagnostic.evidence.join(\", \"),\n\t\t\t\tblocker: destinationExists ? \"target already exists\" : undefined,\n\t\t\t}),\n\t\t);\n\t}\n\n\trecordHarnessControlEvent(\"extension.migration.plan\", \"completed\", {\n\t\tdiagnostics: diagnostics.length,\n\t\tlegacyDiagnostics: diagnostics.filter((diagnostic) => diagnostic.classification === \"legacy\").length,\n\t\tunknownDiagnostics: diagnostics.filter((diagnostic) => diagnostic.classification === \"unknown\").length,\n\t\tactions: actions.length,\n\t\tblockedActions: actions.filter((action) => action.status === \"blocked\").length,\n\t});\n\treturn { diagnostics, actions };\n}\n\nexport function applyExtensionMigrationPlan(\n\tcwd: string,\n\tplan: ExtensionMigrationPlan = createExtensionMigrationPlan(cwd),\n): ExtensionMigrationPlan {\n\tconst readyActions = plan.actions.filter((action) => action.status === \"ready\");\n\tconst preflightBlocked = plan.actions.filter((action) => action.status !== \"ready\");\n\tif (preflightBlocked.length > 0) {\n\t\trecordHarnessControlEvent(\"extension.migration.apply\", \"blocked\", {\n\t\t\tactions: plan.actions.length,\n\t\t\tblockedActions: preflightBlocked.length,\n\t\t\treason: \"preflight blocked actions present\",\n\t\t});\n\t\treturn plan;\n\t}\n\n\tconst appliedMoves: Array<{ from: string; to: string }> = [];\n\tlet appliedPlan: ExtensionMigrationPlan = plan;\n\tconst transaction = runHarnessControlTransactionSync({\n\t\tkind: \"extension.migration.apply\",\n\t\tdata: {\n\t\t\tactions: plan.actions.length,\n\t\t\treadyActions: readyActions.length,\n\t\t\tcwd,\n\t\t},\n\t\tbeforeState: plan.actions.map((action) => ({\n\t\t\tfrom: action.from,\n\t\t\tto: action.to,\n\t\t\tstatus: action.status,\n\t\t\tsourceStatHash: action.sourceStatHash,\n\t\t\tsourceContentHash: action.sourceContentHash,\n\t\t})),\n\t\tafterState: () =>\n\t\t\tappliedPlan.actions.map((action) => ({ from: action.from, to: action.to, status: action.status })),\n\t\tcommit: () => {\n\t\t\tfor (const action of readyActions) {\n\t\t\t\tif (!existsSync(action.from)) throw new Error(`source missing: ${action.from}`);\n\t\t\t\tif (existsSync(action.to)) throw new Error(`target already exists: ${action.to}`);\n\t\t\t\tconst currentContentHash = hashMigrationSourceContent(action.from);\n\t\t\t\tif (action.sourceContentHash && currentContentHash !== action.sourceContentHash) {\n\t\t\t\t\tthrow new Error(`source content changed before migration: ${action.from}`);\n\t\t\t\t}\n\t\t\t\tconst currentHash = hashMigrationSourceStat(action.from);\n\t\t\t\tif (action.sourceStatHash && currentHash !== action.sourceStatHash) {\n\t\t\t\t\tthrow new Error(`source changed before migration: ${action.from}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const action of readyActions) {\n\t\t\t\tmkdirSync(dirname(action.to), { recursive: true });\n\t\t\t\trenameSync(action.from, action.to);\n\t\t\t\tappliedMoves.push({ from: action.from, to: action.to });\n\t\t\t}\n\t\t\tappliedPlan = {\n\t\t\t\tdiagnostics: plan.diagnostics,\n\t\t\t\tactions: plan.actions.map((action) =>\n\t\t\t\t\taction.status === \"ready\" ? { ...action, status: \"applied\" as const } : action,\n\t\t\t\t),\n\t\t\t};\n\t\t\treturn appliedPlan;\n\t\t},\n\t\trollback: () => {\n\t\t\tfor (const move of [...appliedMoves].reverse()) {\n\t\t\t\tif (existsSync(move.to) && !existsSync(move.from)) {\n\t\t\t\t\tmkdirSync(dirname(move.from), { recursive: true });\n\t\t\t\t\trenameSync(move.to, move.from);\n\t\t\t\t}\n\t\t\t}\n\t\t\tappliedPlan = {\n\t\t\t\tdiagnostics: plan.diagnostics,\n\t\t\t\tactions: plan.actions.map((action) =>\n\t\t\t\t\taction.status === \"ready\" ? { ...action, status: \"rolled_back\" as const } : action,\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t});\n\n\tif (transaction.status === \"completed\") return appliedPlan;\n\tconst recoveryJournalPath =\n\t\ttransaction.status === \"in_doubt\" ? join(cwd, \".omk\", \"runs\", \"extension-migration-recovery.json\") : undefined;\n\tif (recoveryJournalPath) {\n\t\tmkdirSync(dirname(recoveryJournalPath), { recursive: true });\n\t\twriteFileSync(\n\t\t\trecoveryJournalPath,\n\t\t\t`${JSON.stringify({ status: \"in_doubt\", appliedMoves, error: String(transaction.error) }, null, 2)}\\n`,\n\t\t\t\"utf-8\",\n\t\t);\n\t}\n\treturn {\n\t\tdiagnostics: plan.diagnostics,\n\t\tactions: plan.actions.map((action) =>\n\t\t\taction.status === \"ready\"\n\t\t\t\t? {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\tstatus: transaction.status === \"in_doubt\" ? \"in_doubt\" : \"blocked\",\n\t\t\t\t\t\tblocker: transaction.error instanceof Error ? transaction.error.message : String(transaction.error),\n\t\t\t\t\t\trecoveryJournalPath,\n\t\t\t\t\t}\n\t\t\t\t: action,\n\t\t),\n\t};\n}\n\nfunction checkDeprecatedExtensionDirs(baseDir: string, label: string): string[] {\n\tconst hooksDir = join(baseDir, \"hooks\");\n\tconst toolsDir = join(baseDir, \"tools\");\n\tconst warnings: string[] = [];\n\tconst scope = label === \"Global\" ? \"global\" : \"project\";\n\n\tif (\n\t\tgetLegacyExtensionDiagnosticsForHooksDir(hooksDir, scope).some(\n\t\t\t(diagnostic) => diagnostic.classification === \"legacy\",\n\t\t)\n\t) {\n\t\twarnings.push(`${label} hooks/ directory found. Hooks have been renamed to extensions.`);\n\t}\n\n\tif (existsSync(toolsDir)) {\n\t\t// Check if tools/ contains anything other than fd/rg (which are auto-extracted binaries)\n\t\ttry {\n\t\t\tconst entries = readdirSync(toolsDir);\n\t\t\tconst customTools = entries.filter((e) => {\n\t\t\t\tconst lower = e.toLowerCase();\n\t\t\t\treturn (\n\t\t\t\t\tlower !== \"fd\" && lower !== \"rg\" && lower !== \"fd.exe\" && lower !== \"rg.exe\" && !e.startsWith(\".\") // Ignore .DS_Store and other hidden files\n\t\t\t\t);\n\t\t\t});\n\t\t\tif (customTools.length > 0) {\n\t\t\t\twarnings.push(\n\t\t\t\t\t`${label} tools/ directory contains custom tools. Custom tools have been merged into extensions.`,\n\t\t\t\t);\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore read errors\n\t\t}\n\t}\n\n\treturn warnings;\n}\n\n/**\n * Run extension system migrations (commands→prompts) and collect warnings about deprecated directories.\n */\nfunction migrateExtensionSystem(cwd: string): string[] {\n\tconst agentDir = getAgentDir();\n\tconst projectDir = join(cwd, CONFIG_DIR_NAME);\n\n\t// Migrate commands/ to prompts/\n\tmigrateCommandsToPrompts(agentDir, \"Global\");\n\tmigrateCommandsToPrompts(projectDir, \"Project\");\n\n\t// Check for deprecated directories\n\tconst warnings = [\n\t\t...checkDeprecatedExtensionDirs(agentDir, \"Global\"),\n\t\t...checkDeprecatedExtensionDirs(projectDir, \"Project\"),\n\t];\n\n\treturn warnings;\n}\n\n/**\n * Print deprecation warnings and wait for keypress.\n */\nexport async function showDeprecationWarnings(warnings: string[]): Promise<void> {\n\tif (warnings.length === 0) return;\n\n\tfor (const warning of warnings) {\n\t\tconsole.log(chalk.yellow(`Warning: ${warning}`));\n\t}\n\tconsole.log(chalk.yellow(`\\nMove your extensions to the extensions/ directory.`));\n\tconsole.log(chalk.yellow(`Migration guide: ${MIGRATION_GUIDE_URL}`));\n\tconsole.log(chalk.yellow(`Documentation: ${EXTENSIONS_DOC_URL}`));\n\tconsole.log(chalk.dim(`\\nPress any key to continue...`));\n\n\tawait new Promise<void>((resolve) => {\n\t\tprocess.stdin.setRawMode?.(true);\n\t\tprocess.stdin.resume();\n\t\tprocess.stdin.once(\"data\", () => {\n\t\t\tprocess.stdin.setRawMode?.(false);\n\t\t\tprocess.stdin.pause();\n\t\t\tresolve();\n\t\t});\n\t});\n\tconsole.log();\n}\n\n/**\n * Run all migrations. Called once on startup.\n *\n * @returns Object with migration results and deprecation warnings\n */\nexport function runMigrations(cwd: string): {\n\tmigratedAuthProviders: string[];\n\tdeprecationWarnings: string[];\n} {\n\tconst migratedAuthProviders = migrateAuthToAuthJson();\n\tmigrateExplicitEnvVarConfigValues();\n\tmigrateSessionsFromAgentRoot();\n\tmigrateToolsToBin();\n\tmigrateKeybindingsConfigFile();\n\tconst deprecationWarnings = migrateExtensionSystem(cwd);\n\treturn { migratedAuthProviders, deprecationWarnings };\n}\n"]}
|
package/dist/migrations.js
CHANGED
|
@@ -316,7 +316,7 @@ function migrateToolsToBin() {
|
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
318
318
|
* Check for deprecated hooks/ and tools/ directories.
|
|
319
|
-
* Note: tools/ may contain fd/rg binaries extracted by
|
|
319
|
+
* Note: tools/ may contain fd/rg binaries extracted by OMK, so only warn if it has other files.
|
|
320
320
|
*/
|
|
321
321
|
const EXTENSION_SOURCE_EXTENSIONS = new Set([".ts", ".js", ".mts", ".cts", ".mjs", ".cjs", ".tsx", ".jsx"]);
|
|
322
322
|
const LEGACY_MANIFEST_FIELDS = ["hooks", "customTools", "extensions"];
|