open-multi-agent-kit 0.80.5 → 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 +31 -0
- 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 +5 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -23
- 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 +20 -5
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +99 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +655 -21
- 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 +91 -0
- package/dist/core/harness-control-events.d.ts.map +1 -0
- package/dist/core/harness-control-events.js +514 -0
- package/dist/core/harness-control-events.js.map +1 -0
- package/dist/core/harness-control-replay.d.ts +31 -0
- package/dist/core/harness-control-replay.d.ts.map +1 -0
- package/dist/core/harness-control-replay.js +187 -0
- package/dist/core/harness-control-replay.js.map +1 -0
- 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/keybindings.d.ts +12 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +31 -1
- package/dist/core/keybindings.js.map +1 -1
- 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 +74 -0
- package/dist/core/mcp-inventory.d.ts.map +1 -0
- package/dist/core/mcp-inventory.js +156 -0
- package/dist/core/mcp-inventory.js.map +1 -0
- 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 +17 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +47 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/spec-kit/compiler.d.ts +67 -0
- package/dist/core/spec-kit/compiler.d.ts.map +1 -0
- package/dist/core/spec-kit/compiler.js +268 -0
- package/dist/core/spec-kit/compiler.js.map +1 -0
- 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/core/transaction-coordinator.d.ts +30 -0
- package/dist/core/transaction-coordinator.d.ts.map +1 -0
- package/dist/core/transaction-coordinator.js +173 -0
- package/dist/core/transaction-coordinator.js.map +1 -0
- 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 +35 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +410 -4
- 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 +56 -0
- package/dist/modes/interactive/components/control-panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel.js +240 -0
- package/dist/modes/interactive/components/control-panel.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +21 -13
- package/dist/modes/interactive/components/custom-editor.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/index.d.ts +3 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +3 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts +30 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/mcp-selector.js +155 -0
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -0
- 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 +52 -9
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +212 -66
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +19 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +21 -8
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skills-selector.d.ts +32 -0
- package/dist/modes/interactive/components/skills-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/skills-selector.js +130 -0
- package/dist/modes/interactive/components/skills-selector.js.map +1 -0
- 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/components/thinking-selector.d.ts +7 -8
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +7 -48
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +399 -108
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/catppuccin-mocha.json +86 -0
- package/dist/modes/interactive/theme/dracula.json +86 -0
- package/dist/modes/interactive/theme/gruvbox-dark.json +86 -0
- package/dist/modes/interactive/theme/kanagawa-dragon.json +86 -0
- package/dist/modes/interactive/theme/omk-blackboard.json +91 -0
- package/dist/modes/interactive/theme/omk-control-panel.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 +55 -16
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/theme/tokyo-night-storm.json +86 -0
- 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/compaction.md +21 -8
- package/docs/packages.md +47 -6
- package/docs/prompt-templates.md +2 -0
- package/docs/quickstart.md +1 -1
- package/docs/themes.md +10 -2
- package/docs/usage.md +18 -7
- 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
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type HarnessControlEventStatus = "prepared" | "started" | "applying" | "verifying" | "completed" | "failed" | "blocked" | "rolled_back" | "in_doubt";
|
|
2
|
+
export type HarnessControlEventKind = "compaction.summary.generated" | "extension.migration.plan" | "extension.migration.apply" | "interactive.model_thinking.commit" | "interactive.theme.apply" | "keybinding.conflict" | "spec.compile" | "spec.verify" | "cli.contract.verify" | (string & {});
|
|
3
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export type JsonObject = {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
export interface HarnessControlArtifactManifestEntry {
|
|
10
|
+
path: string;
|
|
11
|
+
exists: boolean;
|
|
12
|
+
allowed: boolean;
|
|
13
|
+
sizeBytes?: number;
|
|
14
|
+
sha256?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface HarnessControlEvent {
|
|
18
|
+
schemaVersion: "omk.harness-control.event.v2";
|
|
19
|
+
eventId: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
operationId: string;
|
|
23
|
+
causationId: string | null;
|
|
24
|
+
correlationId: string;
|
|
25
|
+
sequence: number;
|
|
26
|
+
timestamp: string;
|
|
27
|
+
kind: HarnessControlEventKind;
|
|
28
|
+
status: HarnessControlEventStatus;
|
|
29
|
+
cwd: string;
|
|
30
|
+
beforeStateHash: string;
|
|
31
|
+
afterStateHash: string;
|
|
32
|
+
data: JsonObject;
|
|
33
|
+
dataHash: string;
|
|
34
|
+
artifacts: HarnessControlArtifactManifestEntry[];
|
|
35
|
+
previousEventHash: string;
|
|
36
|
+
eventHash: string;
|
|
37
|
+
}
|
|
38
|
+
export interface HarnessControlLedgerAnchor {
|
|
39
|
+
schemaVersion: "omk.harness-control.anchor.v1";
|
|
40
|
+
anchoredSequence: number;
|
|
41
|
+
anchoredEventHash: string;
|
|
42
|
+
rotatedFrom: string;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
}
|
|
45
|
+
export interface HarnessControlEventWriteResult {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
path?: string;
|
|
48
|
+
event?: HarnessControlEvent;
|
|
49
|
+
error?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface HarnessControlEventOptions {
|
|
52
|
+
cwd?: string;
|
|
53
|
+
logPath?: string;
|
|
54
|
+
now?: Date;
|
|
55
|
+
id?: string;
|
|
56
|
+
eventId?: string;
|
|
57
|
+
runId?: string;
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
operationId?: string;
|
|
60
|
+
causationId?: string | null;
|
|
61
|
+
correlationId?: string;
|
|
62
|
+
beforeState?: unknown;
|
|
63
|
+
afterState?: unknown;
|
|
64
|
+
artifactRefs?: string[];
|
|
65
|
+
allowedArtifactRoots?: string[];
|
|
66
|
+
lockTimeoutMs?: number;
|
|
67
|
+
maxLedgerBytes?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface HarnessControlLedgerQuarantineEntry {
|
|
70
|
+
lineNumber: number;
|
|
71
|
+
reason: string;
|
|
72
|
+
}
|
|
73
|
+
export interface HarnessControlLedgerVerificationResult {
|
|
74
|
+
ok: boolean;
|
|
75
|
+
events: HarnessControlEvent[];
|
|
76
|
+
errors: string[];
|
|
77
|
+
quarantinedLines: HarnessControlLedgerQuarantineEntry[];
|
|
78
|
+
}
|
|
79
|
+
interface PreviousEventState {
|
|
80
|
+
sequence: number;
|
|
81
|
+
eventHash: string;
|
|
82
|
+
}
|
|
83
|
+
export declare function sanitizeHarnessControlEventData(data: unknown): JsonObject;
|
|
84
|
+
export declare function canonicalJson(value: JsonValue): string;
|
|
85
|
+
export declare function hashCanonical(value: unknown): string;
|
|
86
|
+
export declare function resolveHarnessControlEventLogPath(options?: HarnessControlEventOptions): string | undefined;
|
|
87
|
+
export declare function createHarnessControlEvent(kind: HarnessControlEventKind, status: HarnessControlEventStatus, data?: unknown, options?: HarnessControlEventOptions, previous?: PreviousEventState): HarnessControlEvent;
|
|
88
|
+
export declare function recordHarnessControlEvent(kind: HarnessControlEventKind, status: HarnessControlEventStatus, data?: unknown, options?: HarnessControlEventOptions): HarnessControlEventWriteResult;
|
|
89
|
+
export declare function verifyHarnessControlLedger(logPath: string): HarnessControlLedgerVerificationResult;
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=harness-control-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-control-events.d.ts","sourceRoot":"","sources":["../../src/core/harness-control-events.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,yBAAyB,GAClC,UAAU,GACV,SAAS,GACT,UAAU,GACV,WAAW,GACX,WAAW,GACX,QAAQ,GACR,SAAS,GACT,aAAa,GACb,UAAU,CAAC;AAEd,MAAM,MAAM,uBAAuB,GAChC,8BAA8B,GAC9B,0BAA0B,GAC1B,2BAA2B,GAC3B,mCAAmC,GACnC,yBAAyB,GACzB,qBAAqB,GACrB,cAAc,GACd,aAAa,GACb,qBAAqB,GACrB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjB,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AACtG,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,mCAAmC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IACnC,aAAa,EAAE,8BAA8B,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,MAAM,EAAE,yBAAyB,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,mCAAmC,EAAE,CAAC;IACjD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IAC1C,aAAa,EAAE,+BAA+B,CAAC;IAC/C,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,8BAA8B;IAC9C,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mCAAmC;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sCAAsC;IACtD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB,EAAE,mCAAmC,EAAE,CAAC;CACxD;AAED,UAAU,kBAAkB;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AA6ED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAKzE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAYtD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIpD;AAmFD,wBAAgB,iCAAiC,CAAC,OAAO,GAAE,0BAA+B,GAAG,MAAM,GAAG,SAAS,CAM9G;AA6HD,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,uBAAuB,EAC7B,MAAM,EAAE,yBAAyB,EACjC,IAAI,GAAE,OAAY,EAClB,OAAO,GAAE,0BAA+B,EACxC,QAAQ,GAAE,kBAAmE,GAC3E,mBAAmB,CA2BrB;AAED,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,uBAAuB,EAC7B,MAAM,EAAE,yBAAyB,EACjC,IAAI,GAAE,OAAY,EAClB,OAAO,GAAE,0BAA+B,GACtC,8BAA8B,CAiChC;AAoFD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,sCAAsC,CAgElG","sourcesContent":["import { createHash, randomUUID } from \"node:crypto\";\nimport {\n\tchmodSync,\n\tcloseSync,\n\texistsSync,\n\tfsyncSync,\n\tlstatSync,\n\tmkdirSync,\n\topenSync,\n\treadFileSync,\n\trealpathSync,\n\trenameSync,\n\trmSync,\n\tstatSync,\n\twriteSync,\n} from \"node:fs\";\nimport { basename, dirname, join, resolve, sep } from \"node:path\";\n\nexport type HarnessControlEventStatus =\n\t| \"prepared\"\n\t| \"started\"\n\t| \"applying\"\n\t| \"verifying\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"blocked\"\n\t| \"rolled_back\"\n\t| \"in_doubt\";\n\nexport type HarnessControlEventKind =\n\t| \"compaction.summary.generated\"\n\t| \"extension.migration.plan\"\n\t| \"extension.migration.apply\"\n\t| \"interactive.model_thinking.commit\"\n\t| \"interactive.theme.apply\"\n\t| \"keybinding.conflict\"\n\t| \"spec.compile\"\n\t| \"spec.verify\"\n\t| \"cli.contract.verify\"\n\t| (string & {});\n\nexport type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };\nexport type JsonObject = { [key: string]: JsonValue };\n\nexport interface HarnessControlArtifactManifestEntry {\n\tpath: string;\n\texists: boolean;\n\tallowed: boolean;\n\tsizeBytes?: number;\n\tsha256?: string;\n\terror?: string;\n}\n\nexport interface HarnessControlEvent {\n\tschemaVersion: \"omk.harness-control.event.v2\";\n\teventId: string;\n\trunId: string;\n\tsessionId: string;\n\toperationId: string;\n\tcausationId: string | null;\n\tcorrelationId: string;\n\tsequence: number;\n\ttimestamp: string;\n\tkind: HarnessControlEventKind;\n\tstatus: HarnessControlEventStatus;\n\tcwd: string;\n\tbeforeStateHash: string;\n\tafterStateHash: string;\n\tdata: JsonObject;\n\tdataHash: string;\n\tartifacts: HarnessControlArtifactManifestEntry[];\n\tpreviousEventHash: string;\n\teventHash: string;\n}\n\nexport interface HarnessControlLedgerAnchor {\n\tschemaVersion: \"omk.harness-control.anchor.v1\";\n\tanchoredSequence: number;\n\tanchoredEventHash: string;\n\trotatedFrom: string;\n\ttimestamp: string;\n}\n\nexport interface HarnessControlEventWriteResult {\n\tok: boolean;\n\tpath?: string;\n\tevent?: HarnessControlEvent;\n\terror?: string;\n}\n\nexport interface HarnessControlEventOptions {\n\tcwd?: string;\n\tlogPath?: string;\n\tnow?: Date;\n\tid?: string;\n\teventId?: string;\n\trunId?: string;\n\tsessionId?: string;\n\toperationId?: string;\n\tcausationId?: string | null;\n\tcorrelationId?: string;\n\tbeforeState?: unknown;\n\tafterState?: unknown;\n\tartifactRefs?: string[];\n\tallowedArtifactRoots?: string[];\n\tlockTimeoutMs?: number;\n\tmaxLedgerBytes?: number;\n}\n\nexport interface HarnessControlLedgerQuarantineEntry {\n\tlineNumber: number;\n\treason: string;\n}\n\nexport interface HarnessControlLedgerVerificationResult {\n\tok: boolean;\n\tevents: HarnessControlEvent[];\n\terrors: string[];\n\tquarantinedLines: HarnessControlLedgerQuarantineEntry[];\n}\n\ninterface PreviousEventState {\n\tsequence: number;\n\teventHash: string;\n}\n\ninterface ParsedLedgerLine {\n\tschemaVersion?: string;\n\tsequence?: number;\n\teventHash?: string;\n\tanchoredSequence?: number;\n\tanchoredEventHash?: string;\n}\n\nconst MAX_EVENT_DEPTH = 6;\nconst MAX_EVENT_OBJECT_KEYS = 80;\nconst MAX_EVENT_ARRAY_ITEMS = 80;\nconst MAX_EVENT_STRING_LENGTH = 2000;\nconst REDACTED = \"[redacted]\";\nconst GENESIS_EVENT_HASH = \"0\".repeat(64);\nconst EVENT_SCHEMA_VERSION = \"omk.harness-control.event.v2\";\nconst ANCHOR_SCHEMA_VERSION = \"omk.harness-control.anchor.v1\";\nconst DEFAULT_RUN_ID = \"default-run\";\nconst DEFAULT_SESSION_ID = \"sessionless\";\nconst LOCK_STALE_MS = 30000;\n\nfunction isSensitiveKey(key: string): boolean {\n\treturn /(?:secret|token|api[_-]?key|authorization|password|credential|private[_-]?key)/i.test(key);\n}\n\nfunction redactSensitiveValue(value: string): string {\n\tlet redacted = value;\n\tredacted = redacted.replace(/Bearer\\s+[A-Za-z0-9._~+/=-]+/gi, `Bearer ${REDACTED}`);\n\tredacted = redacted.replace(/sk-(?:proj-|ant-)?[A-Za-z0-9_-]{16,}/g, REDACTED);\n\tredacted = redacted.replace(/\\beyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\b/g, REDACTED);\n\tredacted = redacted.replace(/-----BEGIN [^-]+PRIVATE KEY-----[\\s\\S]*?-----END [^-]+PRIVATE KEY-----/g, REDACTED);\n\tredacted = redacted.replace(/\\b[A-Fa-f0-9]{64,}\\b/g, REDACTED);\n\treturn redacted;\n}\n\nfunction truncateString(value: string): string {\n\tconst redacted = redactSensitiveValue(value);\n\tif (redacted.length <= MAX_EVENT_STRING_LENGTH) return redacted;\n\treturn `${redacted.slice(0, MAX_EVENT_STRING_LENGTH)}…[truncated]`;\n}\n\nfunction sanitizeValue(value: unknown, depth: number, seen: WeakSet<object>): JsonValue {\n\tif (value === null) return null;\n\tif (typeof value === \"string\") return truncateString(value);\n\tif (typeof value === \"number\") return Number.isFinite(value) ? value : String(value);\n\tif (typeof value === \"boolean\") return value;\n\tif (typeof value === \"bigint\") return value.toString();\n\tif (typeof value === \"undefined\" || typeof value === \"function\" || typeof value === \"symbol\") return String(value);\n\tif (depth >= MAX_EVENT_DEPTH) return \"[max-depth]\";\n\n\tif (Array.isArray(value)) {\n\t\treturn value.slice(0, MAX_EVENT_ARRAY_ITEMS).map((entry) => sanitizeValue(entry, depth + 1, seen));\n\t}\n\n\tif (value instanceof Date) return value.toISOString();\n\tif (value instanceof Error) {\n\t\treturn {\n\t\t\tname: value.name,\n\t\t\tmessage: truncateString(value.message),\n\t\t};\n\t}\n\n\tif (typeof value === \"object\") {\n\t\tif (seen.has(value)) return \"[circular]\";\n\t\tseen.add(value);\n\t\tconst result: JsonObject = {};\n\t\tfor (const [key, entry] of Object.entries(value).slice(0, MAX_EVENT_OBJECT_KEYS)) {\n\t\t\tresult[key] = isSensitiveKey(key) ? REDACTED : sanitizeValue(entry, depth + 1, seen);\n\t\t}\n\t\tseen.delete(value);\n\t\treturn result;\n\t}\n\n\treturn String(value);\n}\n\nexport function sanitizeHarnessControlEventData(data: unknown): JsonObject {\n\tconst sanitized = sanitizeValue(data ?? {}, 0, new WeakSet<object>());\n\treturn typeof sanitized === \"object\" && sanitized !== null && !Array.isArray(sanitized)\n\t\t? sanitized\n\t\t: { value: sanitized };\n}\n\nexport function canonicalJson(value: JsonValue): string {\n\tif (value === null) return \"null\";\n\tif (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n\t\treturn JSON.stringify(value);\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map((entry) => canonicalJson(entry)).join(\",\")}]`;\n\t}\n\treturn `{${Object.keys(value)\n\t\t.sort()\n\t\t.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key] ?? null)}`)\n\t\t.join(\",\")}}`;\n}\n\nexport function hashCanonical(value: unknown): string {\n\treturn createHash(\"sha256\")\n\t\t.update(canonicalJson(sanitizeValue(value, 0, new WeakSet<object>())))\n\t\t.digest(\"hex\");\n}\n\nfunction sha256Text(value: string): string {\n\treturn createHash(\"sha256\").update(value).digest(\"hex\");\n}\n\nfunction sha256File(path: string): string {\n\treturn createHash(\"sha256\").update(readFileSync(path)).digest(\"hex\");\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 isSensitivePath(path: string): boolean {\n\treturn /(?:^|[/\\\\])(?:\\.env[^/\\\\]*|auth\\.json|oauth\\.json|.*(?:secret|token|credential|private[_-]?key).*)$/i.test(\n\t\tpath,\n\t);\n}\n\nfunction defaultAllowedArtifactRoots(cwd: string, logPath: string): string[] {\n\treturn [cwd, dirname(logPath)];\n}\n\nfunction safeRealPath(target: string): string {\n\ttry {\n\t\treturn realpathSync(target);\n\t} catch {\n\t\treturn resolve(target);\n\t}\n}\n\nfunction createArtifactManifest(\n\tartifactRefs: string[] | undefined,\n\tcwd: string,\n\tlogPath: string,\n\tallowedArtifactRoots: string[] | undefined,\n): HarnessControlArtifactManifestEntry[] {\n\tif (!artifactRefs || artifactRefs.length === 0) return [];\n\tconst logicalRoots = (allowedArtifactRoots ?? defaultAllowedArtifactRoots(cwd, logPath)).map((root) =>\n\t\tresolve(root),\n\t);\n\tconst canonicalRoots = logicalRoots.map((root) => safeRealPath(root));\n\treturn artifactRefs.map((artifactPath) => {\n\t\tconst resolvedPath = resolve(cwd, artifactPath);\n\t\tconst allowed = logicalRoots.some((root) => isPathWithin(root, resolvedPath)) && !isSensitivePath(resolvedPath);\n\t\tif (!allowed) return { path: artifactPath, exists: existsSync(resolvedPath), allowed: false };\n\t\tif (!existsSync(resolvedPath)) return { path: artifactPath, exists: false, allowed: true };\n\t\ttry {\n\t\t\tconst linkStats = lstatSync(resolvedPath);\n\t\t\tconst realPath = realpathSync(resolvedPath);\n\t\t\tif (!canonicalRoots.some((root) => isPathWithin(root, realPath))) {\n\t\t\t\treturn {\n\t\t\t\t\tpath: artifactPath,\n\t\t\t\t\texists: true,\n\t\t\t\t\tallowed: false,\n\t\t\t\t\terror: linkStats.isSymbolicLink()\n\t\t\t\t\t\t? \"artifact symlink resolves outside allowed roots\"\n\t\t\t\t\t\t: \"artifact resolves outside allowed roots\",\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst stats = statSync(realPath);\n\t\t\tif (!stats.isFile()) return { path: artifactPath, exists: true, allowed: true, sizeBytes: stats.size };\n\t\t\treturn {\n\t\t\t\tpath: artifactPath,\n\t\t\t\texists: true,\n\t\t\t\tallowed: true,\n\t\t\t\tsizeBytes: stats.size,\n\t\t\t\tsha256: sha256File(realPath),\n\t\t\t};\n\t\t} catch (error) {\n\t\t\treturn {\n\t\t\t\tpath: artifactPath,\n\t\t\t\texists: existsSync(resolvedPath),\n\t\t\t\tallowed: true,\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t}\n\t});\n}\n\nexport function resolveHarnessControlEventLogPath(options: HarnessControlEventOptions = {}): string | undefined {\n\tif (process.env.OMK_HARNESS_CONTROL_EVENTS === \"0\") return undefined;\n\tif (options.logPath) return options.logPath;\n\tif (process.env.OMK_HARNESS_CONTROL_EVENT_LOG) return process.env.OMK_HARNESS_CONTROL_EVENT_LOG;\n\tconst runId = options.runId ?? DEFAULT_RUN_ID;\n\treturn join(options.cwd ?? process.cwd(), \".omk\", \"runs\", runId, \"harness-control\", \"events.jsonl\");\n}\n\nfunction eventHashInput(eventWithoutHash: Omit<HarnessControlEvent, \"eventHash\">): string {\n\treturn `${canonicalJson(eventWithoutHash as unknown as JsonObject)}${eventWithoutHash.previousEventHash}`;\n}\n\nfunction computeEventHash(eventWithoutHash: Omit<HarnessControlEvent, \"eventHash\">): string {\n\treturn sha256Text(eventHashInput(eventWithoutHash));\n}\n\nfunction readPreviousEventState(logPath: string): PreviousEventState {\n\tif (!existsSync(logPath)) return { sequence: 0, eventHash: GENESIS_EVENT_HASH };\n\tconst lines = readFileSync(logPath, \"utf-8\")\n\t\t.split(\"\\n\")\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line.length > 0);\n\tif (lines.length === 0) return { sequence: 0, eventHash: GENESIS_EVENT_HASH };\n\n\tlet parsed: ParsedLedgerLine;\n\ttry {\n\t\tparsed = JSON.parse(lines.at(-1)!) as ParsedLedgerLine;\n\t} catch {\n\t\tthrow new Error(\"Last harness ledger line is not valid JSON — ledger may be truncated or corrupted\");\n\t}\n\tif (parsed.schemaVersion === ANCHOR_SCHEMA_VERSION) {\n\t\tif (typeof parsed.anchoredSequence !== \"number\" || typeof parsed.anchoredEventHash !== \"string\") {\n\t\t\tthrow new Error(\"Previous harness ledger anchor is missing anchoredSequence or anchoredEventHash\");\n\t\t}\n\t\treturn { sequence: parsed.anchoredSequence, eventHash: parsed.anchoredEventHash };\n\t}\n\tif (parsed.schemaVersion !== EVENT_SCHEMA_VERSION) {\n\t\treturn { sequence: 0, eventHash: GENESIS_EVENT_HASH };\n\t}\n\tif (typeof parsed.sequence !== \"number\" || !Number.isInteger(parsed.sequence) || parsed.sequence < 0) {\n\t\tthrow new Error(\"Previous harness event has invalid or missing sequence\");\n\t}\n\tif (typeof parsed.eventHash !== \"string\" || !/^[a-f0-9]{64}$/.test(parsed.eventHash)) {\n\t\tthrow new Error(\"Previous harness event has invalid or missing eventHash\");\n\t}\n\treturn { sequence: parsed.sequence, eventHash: parsed.eventHash };\n}\n\nfunction acquireLock(lockPath: string, timeoutMs: number): number {\n\tconst start = Date.now();\n\twhile (true) {\n\t\ttry {\n\t\t\treturn openSync(lockPath, \"wx\", 0o600);\n\t\t} catch (error) {\n\t\t\tif (existsSync(lockPath)) {\n\t\t\t\ttry {\n\t\t\t\t\tconst stats = statSync(lockPath);\n\t\t\t\t\tif (Date.now() - stats.mtimeMs > LOCK_STALE_MS) rmSync(lockPath, { force: true });\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\tif (Date.now() - start >= timeoutMs) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction formatRotationTimestamp(date: Date): string {\n\treturn date.toISOString().replace(/[:.]/g, \"-\");\n}\n\nfunction fsyncDirectory(dirPath: string): void {\n\ttry {\n\t\tconst dirFd = openSync(dirPath, \"r\");\n\t\ttry {\n\t\t\tfsyncSync(dirFd);\n\t\t} finally {\n\t\t\tcloseSync(dirFd);\n\t\t}\n\t} catch {\n\t\t// Some platforms/filesystems do not support directory fsync; file fsync above is still mandatory.\n\t}\n}\n\nfunction enforcePrivateFilePermissions(filePath: string): void {\n\ttry {\n\t\tif (existsSync(filePath) && (statSync(filePath).mode & 0o777) !== 0o600) {\n\t\t\tchmodSync(filePath, 0o600);\n\t\t}\n\t} catch {\n\t\t/* best-effort permission enforcement */\n\t}\n}\n\nfunction rotateLedgerIfNeeded(path: string, maxLedgerBytes: number | undefined, now: Date): string | undefined {\n\tif (!Number.isFinite(maxLedgerBytes) || (maxLedgerBytes ?? 0) <= 0 || !existsSync(path)) return undefined;\n\tenforcePrivateFilePermissions(path);\n\tconst stats = statSync(path);\n\tif (stats.size < Math.floor(maxLedgerBytes ?? 0)) return undefined;\n\t// Capture the rotated segment's terminal state so the fresh segment continues\n\t// the global sequence and hash chain instead of restarting from genesis.\n\tconst anchorState = readPreviousEventState(path);\n\tconst rotatedPath = `${path}.${formatRotationTimestamp(now)}.rotated`;\n\trenameSync(path, rotatedPath);\n\tenforcePrivateFilePermissions(rotatedPath);\n\tfsyncDirectory(dirname(path));\n\tif (anchorState.sequence > 0) {\n\t\tconst anchor: HarnessControlLedgerAnchor = {\n\t\t\tschemaVersion: ANCHOR_SCHEMA_VERSION,\n\t\t\tanchoredSequence: anchorState.sequence,\n\t\t\tanchoredEventHash: anchorState.eventHash,\n\t\t\trotatedFrom: basename(rotatedPath),\n\t\t\ttimestamp: now.toISOString(),\n\t\t};\n\t\tappendJsonLineWithFsync(path, JSON.stringify(anchor));\n\t}\n\treturn rotatedPath;\n}\n\nfunction appendJsonLineWithFsync(path: string, line: string): void {\n\tconst fd = openSync(path, \"a\", 0o600);\n\ttry {\n\t\tenforcePrivateFilePermissions(path);\n\t\twriteSync(fd, `${line}\\n`, undefined, \"utf-8\");\n\t\tfsyncSync(fd);\n\t} finally {\n\t\tcloseSync(fd);\n\t}\n\tfsyncDirectory(dirname(path));\n}\n\nexport function createHarnessControlEvent(\n\tkind: HarnessControlEventKind,\n\tstatus: HarnessControlEventStatus,\n\tdata: unknown = {},\n\toptions: HarnessControlEventOptions = {},\n\tprevious: PreviousEventState = { sequence: 0, eventHash: GENESIS_EVENT_HASH },\n): HarnessControlEvent {\n\tconst eventId = options.eventId ?? options.id ?? randomUUID();\n\tconst operationId = options.operationId ?? eventId;\n\tconst logPath = resolveHarnessControlEventLogPath(options) ?? \"\";\n\tconst cwd = options.cwd ?? process.cwd();\n\tconst sanitizedData = sanitizeHarnessControlEventData(data);\n\tconst eventWithoutHash: Omit<HarnessControlEvent, \"eventHash\"> = {\n\t\tschemaVersion: \"omk.harness-control.event.v2\",\n\t\teventId,\n\t\trunId: options.runId ?? DEFAULT_RUN_ID,\n\t\tsessionId: options.sessionId ?? DEFAULT_SESSION_ID,\n\t\toperationId,\n\t\tcausationId: options.causationId ?? null,\n\t\tcorrelationId: options.correlationId ?? operationId,\n\t\tsequence: previous.sequence + 1,\n\t\ttimestamp: (options.now ?? new Date()).toISOString(),\n\t\tkind,\n\t\tstatus,\n\t\tcwd,\n\t\tbeforeStateHash: hashCanonical(options.beforeState ?? null),\n\t\tafterStateHash: hashCanonical(options.afterState ?? null),\n\t\tdata: sanitizedData,\n\t\tdataHash: hashCanonical(sanitizedData),\n\t\tartifacts: createArtifactManifest(options.artifactRefs, cwd, logPath, options.allowedArtifactRoots),\n\t\tpreviousEventHash: previous.eventHash,\n\t};\n\treturn { ...eventWithoutHash, eventHash: computeEventHash(eventWithoutHash) };\n}\n\nexport function recordHarnessControlEvent(\n\tkind: HarnessControlEventKind,\n\tstatus: HarnessControlEventStatus,\n\tdata: unknown = {},\n\toptions: HarnessControlEventOptions = {},\n): HarnessControlEventWriteResult {\n\tconst logPath = resolveHarnessControlEventLogPath(options);\n\tif (!logPath) return { ok: false, error: \"harness control event logging disabled\" };\n\tconst lockPath = `${logPath}.lock`;\n\tlet lockFd: number | undefined;\n\ttry {\n\t\tmkdirSync(dirname(logPath), { recursive: true, mode: 0o700 });\n\t\t// Re-apply directory permissions on platforms where umask\n\t\t// overrides the mode passed to mkdirSync.\n\t\ttry {\n\t\t\tconst dirStats = statSync(dirname(logPath));\n\t\t\tif ((dirStats.mode & 0o777) !== 0o700) {\n\t\t\t\tchmodSync(dirname(logPath), 0o700);\n\t\t\t}\n\t\t} catch {\n\t\t\t/* best-effort permission enforcement */\n\t\t}\n\t\tlockFd = acquireLock(lockPath, options.lockTimeoutMs ?? 1000);\n\t\trotateLedgerIfNeeded(logPath, options.maxLedgerBytes, options.now ?? new Date());\n\t\tconst previous = readPreviousEventState(logPath);\n\t\tconst event = createHarnessControlEvent(kind, status, data, options, previous);\n\t\tappendJsonLineWithFsync(logPath, JSON.stringify(event));\n\t\treturn { ok: true, path: logPath, event };\n\t} catch (error) {\n\t\treturn { ok: false, path: logPath, error: error instanceof Error ? error.message : String(error) };\n\t} finally {\n\t\tif (lockFd !== undefined) {\n\t\t\ttry {\n\t\t\t\tcloseSync(lockFd);\n\t\t\t} catch {}\n\t\t\trmSync(lockPath, { force: true });\n\t\t}\n\t}\n}\n\nfunction validateLedgerAnchor(anchor: ParsedLedgerLine): string | undefined {\n\tif (\n\t\ttypeof anchor.anchoredSequence !== \"number\" ||\n\t\t!Number.isInteger(anchor.anchoredSequence) ||\n\t\tanchor.anchoredSequence < 1\n\t) {\n\t\treturn \"ledger anchor has an invalid anchoredSequence\";\n\t}\n\tif (typeof anchor.anchoredEventHash !== \"string\" || !/^[a-f0-9]{64}$/.test(anchor.anchoredEventHash)) {\n\t\treturn \"ledger anchor has an invalid anchoredEventHash\";\n\t}\n\treturn undefined;\n}\n\nconst VALID_EVENT_STATUSES = new Set<string>([\n\t\"prepared\",\n\t\"started\",\n\t\"applying\",\n\t\"verifying\",\n\t\"completed\",\n\t\"failed\",\n\t\"blocked\",\n\t\"rolled_back\",\n\t\"in_doubt\",\n]);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction validateHarnessControlEventRecord(record: Record<string, unknown>): string | undefined {\n\tif (record.schemaVersion !== EVENT_SCHEMA_VERSION) return \"unsupported schemaVersion\";\n\tconst stringFields = [\n\t\t\"eventId\",\n\t\t\"runId\",\n\t\t\"sessionId\",\n\t\t\"operationId\",\n\t\t\"correlationId\",\n\t\t\"timestamp\",\n\t\t\"kind\",\n\t\t\"cwd\",\n\t\t\"beforeStateHash\",\n\t\t\"afterStateHash\",\n\t\t\"dataHash\",\n\t\t\"previousEventHash\",\n\t\t\"eventHash\",\n\t] as const;\n\tfor (const field of stringFields) {\n\t\tif (typeof record[field] !== \"string\") return `event is missing or has invalid ${field}`;\n\t}\n\tif (typeof record.sequence !== \"number\" || !Number.isInteger(record.sequence) || record.sequence < 1) {\n\t\treturn \"event has invalid sequence\";\n\t}\n\tif (typeof record.causationId !== \"string\" && record.causationId !== null) {\n\t\treturn \"event has invalid causationId\";\n\t}\n\tif (typeof record.status !== \"string\" || !VALID_EVENT_STATUSES.has(record.status)) {\n\t\treturn \"event has invalid status\";\n\t}\n\tif (typeof record.eventHash !== \"string\" || !/^[a-f0-9]{64}$/.test(record.eventHash)) {\n\t\treturn \"event has invalid eventHash\";\n\t}\n\tif (typeof record.previousEventHash !== \"string\" || !/^[a-f0-9]{64}$/.test(record.previousEventHash)) {\n\t\treturn \"event has invalid previousEventHash\";\n\t}\n\tif (!isRecord(record.data)) return \"event has invalid data\";\n\tif (!Array.isArray(record.artifacts)) return \"event has invalid artifacts\";\n\treturn undefined;\n}\n\nfunction validateEventHash(event: HarnessControlEvent): string | undefined {\n\tconst { eventHash: _eventHash, ...eventWithoutHash } = event;\n\tconst expectedEventHash = computeEventHash(eventWithoutHash);\n\tif (expectedEventHash !== event.eventHash) {\n\t\treturn `event ${event.eventId} hash mismatch`;\n\t}\n\tif (hashCanonical(event.data) !== event.dataHash) {\n\t\treturn `event ${event.eventId} dataHash mismatch`;\n\t}\n\treturn undefined;\n}\n\nexport function verifyHarnessControlLedger(logPath: string): HarnessControlLedgerVerificationResult {\n\tconst errors: string[] = [];\n\tconst events: HarnessControlEvent[] = [];\n\tconst quarantinedLines: HarnessControlLedgerQuarantineEntry[] = [];\n\tif (!existsSync(logPath)) return { ok: true, events, errors, quarantinedLines };\n\tconst lines = readFileSync(logPath, \"utf-8\")\n\t\t.split(\"\\n\")\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line.length > 0);\n\tlet previousSequence = 0;\n\tlet previousEventHash = GENESIS_EVENT_HASH;\n\n\tfunction quarantine(lineNumber: number, reason: string): void {\n\t\tquarantinedLines.push({ lineNumber, reason });\n\t\terrors.push(`line ${lineNumber}: quarantined — ${reason}`);\n\t}\n\n\tfor (let index = 0; index < lines.length; index++) {\n\t\tconst lineNumber = index + 1;\n\t\tlet parsed: Record<string, unknown>;\n\t\ttry {\n\t\t\tparsed = JSON.parse(lines[index]!) as Record<string, unknown>;\n\t\t} catch (error) {\n\t\t\tquarantine(lineNumber, error instanceof Error ? error.message : String(error));\n\t\t\tcontinue;\n\t\t}\n\t\tif (parsed.schemaVersion === ANCHOR_SCHEMA_VERSION) {\n\t\t\tif (index !== 0) {\n\t\t\t\tquarantine(lineNumber, \"ledger anchor must be the first line\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst anchorError = validateLedgerAnchor(parsed as ParsedLedgerLine);\n\t\t\tif (anchorError) {\n\t\t\t\tquarantine(lineNumber, anchorError);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpreviousSequence = parsed.anchoredSequence as number;\n\t\t\tpreviousEventHash = parsed.anchoredEventHash as string;\n\t\t\tcontinue;\n\t\t}\n\t\tconst shapeError = validateHarnessControlEventRecord(parsed);\n\t\tif (shapeError) {\n\t\t\tquarantine(lineNumber, shapeError);\n\t\t\tcontinue;\n\t\t}\n\t\tconst event = parsed as unknown as HarnessControlEvent;\n\t\tif (event.sequence !== previousSequence + 1) {\n\t\t\tquarantine(lineNumber, `sequence gap: expected ${previousSequence + 1}, got ${event.sequence}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (event.previousEventHash !== previousEventHash) {\n\t\t\tquarantine(lineNumber, \"previousEventHash mismatch\");\n\t\t\tcontinue;\n\t\t}\n\t\tconst hashError = validateEventHash(event);\n\t\tif (hashError) {\n\t\t\tquarantine(lineNumber, hashError);\n\t\t\tcontinue;\n\t\t}\n\t\tevents.push(event);\n\t\tpreviousSequence = event.sequence;\n\t\tpreviousEventHash = event.eventHash;\n\t}\n\treturn { ok: errors.length === 0, events, errors, quarantinedLines };\n}\n"]}
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { chmodSync, closeSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, rmSync, statSync, writeSync, } from "node:fs";
|
|
3
|
+
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
4
|
+
const MAX_EVENT_DEPTH = 6;
|
|
5
|
+
const MAX_EVENT_OBJECT_KEYS = 80;
|
|
6
|
+
const MAX_EVENT_ARRAY_ITEMS = 80;
|
|
7
|
+
const MAX_EVENT_STRING_LENGTH = 2000;
|
|
8
|
+
const REDACTED = "[redacted]";
|
|
9
|
+
const GENESIS_EVENT_HASH = "0".repeat(64);
|
|
10
|
+
const EVENT_SCHEMA_VERSION = "omk.harness-control.event.v2";
|
|
11
|
+
const ANCHOR_SCHEMA_VERSION = "omk.harness-control.anchor.v1";
|
|
12
|
+
const DEFAULT_RUN_ID = "default-run";
|
|
13
|
+
const DEFAULT_SESSION_ID = "sessionless";
|
|
14
|
+
const LOCK_STALE_MS = 30000;
|
|
15
|
+
function isSensitiveKey(key) {
|
|
16
|
+
return /(?:secret|token|api[_-]?key|authorization|password|credential|private[_-]?key)/i.test(key);
|
|
17
|
+
}
|
|
18
|
+
function redactSensitiveValue(value) {
|
|
19
|
+
let redacted = value;
|
|
20
|
+
redacted = redacted.replace(/Bearer\s+[A-Za-z0-9._~+/=-]+/gi, `Bearer ${REDACTED}`);
|
|
21
|
+
redacted = redacted.replace(/sk-(?:proj-|ant-)?[A-Za-z0-9_-]{16,}/g, REDACTED);
|
|
22
|
+
redacted = redacted.replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, REDACTED);
|
|
23
|
+
redacted = redacted.replace(/-----BEGIN [^-]+PRIVATE KEY-----[\s\S]*?-----END [^-]+PRIVATE KEY-----/g, REDACTED);
|
|
24
|
+
redacted = redacted.replace(/\b[A-Fa-f0-9]{64,}\b/g, REDACTED);
|
|
25
|
+
return redacted;
|
|
26
|
+
}
|
|
27
|
+
function truncateString(value) {
|
|
28
|
+
const redacted = redactSensitiveValue(value);
|
|
29
|
+
if (redacted.length <= MAX_EVENT_STRING_LENGTH)
|
|
30
|
+
return redacted;
|
|
31
|
+
return `${redacted.slice(0, MAX_EVENT_STRING_LENGTH)}…[truncated]`;
|
|
32
|
+
}
|
|
33
|
+
function sanitizeValue(value, depth, seen) {
|
|
34
|
+
if (value === null)
|
|
35
|
+
return null;
|
|
36
|
+
if (typeof value === "string")
|
|
37
|
+
return truncateString(value);
|
|
38
|
+
if (typeof value === "number")
|
|
39
|
+
return Number.isFinite(value) ? value : String(value);
|
|
40
|
+
if (typeof value === "boolean")
|
|
41
|
+
return value;
|
|
42
|
+
if (typeof value === "bigint")
|
|
43
|
+
return value.toString();
|
|
44
|
+
if (typeof value === "undefined" || typeof value === "function" || typeof value === "symbol")
|
|
45
|
+
return String(value);
|
|
46
|
+
if (depth >= MAX_EVENT_DEPTH)
|
|
47
|
+
return "[max-depth]";
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
return value.slice(0, MAX_EVENT_ARRAY_ITEMS).map((entry) => sanitizeValue(entry, depth + 1, seen));
|
|
50
|
+
}
|
|
51
|
+
if (value instanceof Date)
|
|
52
|
+
return value.toISOString();
|
|
53
|
+
if (value instanceof Error) {
|
|
54
|
+
return {
|
|
55
|
+
name: value.name,
|
|
56
|
+
message: truncateString(value.message),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (typeof value === "object") {
|
|
60
|
+
if (seen.has(value))
|
|
61
|
+
return "[circular]";
|
|
62
|
+
seen.add(value);
|
|
63
|
+
const result = {};
|
|
64
|
+
for (const [key, entry] of Object.entries(value).slice(0, MAX_EVENT_OBJECT_KEYS)) {
|
|
65
|
+
result[key] = isSensitiveKey(key) ? REDACTED : sanitizeValue(entry, depth + 1, seen);
|
|
66
|
+
}
|
|
67
|
+
seen.delete(value);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
return String(value);
|
|
71
|
+
}
|
|
72
|
+
export function sanitizeHarnessControlEventData(data) {
|
|
73
|
+
const sanitized = sanitizeValue(data ?? {}, 0, new WeakSet());
|
|
74
|
+
return typeof sanitized === "object" && sanitized !== null && !Array.isArray(sanitized)
|
|
75
|
+
? sanitized
|
|
76
|
+
: { value: sanitized };
|
|
77
|
+
}
|
|
78
|
+
export function canonicalJson(value) {
|
|
79
|
+
if (value === null)
|
|
80
|
+
return "null";
|
|
81
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
82
|
+
return JSON.stringify(value);
|
|
83
|
+
}
|
|
84
|
+
if (Array.isArray(value)) {
|
|
85
|
+
return `[${value.map((entry) => canonicalJson(entry)).join(",")}]`;
|
|
86
|
+
}
|
|
87
|
+
return `{${Object.keys(value)
|
|
88
|
+
.sort()
|
|
89
|
+
.map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key] ?? null)}`)
|
|
90
|
+
.join(",")}}`;
|
|
91
|
+
}
|
|
92
|
+
export function hashCanonical(value) {
|
|
93
|
+
return createHash("sha256")
|
|
94
|
+
.update(canonicalJson(sanitizeValue(value, 0, new WeakSet())))
|
|
95
|
+
.digest("hex");
|
|
96
|
+
}
|
|
97
|
+
function sha256Text(value) {
|
|
98
|
+
return createHash("sha256").update(value).digest("hex");
|
|
99
|
+
}
|
|
100
|
+
function sha256File(path) {
|
|
101
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
102
|
+
}
|
|
103
|
+
function isPathWithin(parent, child) {
|
|
104
|
+
const resolvedParent = resolve(parent);
|
|
105
|
+
const resolvedChild = resolve(child);
|
|
106
|
+
return resolvedChild === resolvedParent || resolvedChild.startsWith(`${resolvedParent}${sep}`);
|
|
107
|
+
}
|
|
108
|
+
function isSensitivePath(path) {
|
|
109
|
+
return /(?:^|[/\\])(?:\.env[^/\\]*|auth\.json|oauth\.json|.*(?:secret|token|credential|private[_-]?key).*)$/i.test(path);
|
|
110
|
+
}
|
|
111
|
+
function defaultAllowedArtifactRoots(cwd, logPath) {
|
|
112
|
+
return [cwd, dirname(logPath)];
|
|
113
|
+
}
|
|
114
|
+
function safeRealPath(target) {
|
|
115
|
+
try {
|
|
116
|
+
return realpathSync(target);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return resolve(target);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function createArtifactManifest(artifactRefs, cwd, logPath, allowedArtifactRoots) {
|
|
123
|
+
if (!artifactRefs || artifactRefs.length === 0)
|
|
124
|
+
return [];
|
|
125
|
+
const logicalRoots = (allowedArtifactRoots ?? defaultAllowedArtifactRoots(cwd, logPath)).map((root) => resolve(root));
|
|
126
|
+
const canonicalRoots = logicalRoots.map((root) => safeRealPath(root));
|
|
127
|
+
return artifactRefs.map((artifactPath) => {
|
|
128
|
+
const resolvedPath = resolve(cwd, artifactPath);
|
|
129
|
+
const allowed = logicalRoots.some((root) => isPathWithin(root, resolvedPath)) && !isSensitivePath(resolvedPath);
|
|
130
|
+
if (!allowed)
|
|
131
|
+
return { path: artifactPath, exists: existsSync(resolvedPath), allowed: false };
|
|
132
|
+
if (!existsSync(resolvedPath))
|
|
133
|
+
return { path: artifactPath, exists: false, allowed: true };
|
|
134
|
+
try {
|
|
135
|
+
const linkStats = lstatSync(resolvedPath);
|
|
136
|
+
const realPath = realpathSync(resolvedPath);
|
|
137
|
+
if (!canonicalRoots.some((root) => isPathWithin(root, realPath))) {
|
|
138
|
+
return {
|
|
139
|
+
path: artifactPath,
|
|
140
|
+
exists: true,
|
|
141
|
+
allowed: false,
|
|
142
|
+
error: linkStats.isSymbolicLink()
|
|
143
|
+
? "artifact symlink resolves outside allowed roots"
|
|
144
|
+
: "artifact resolves outside allowed roots",
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const stats = statSync(realPath);
|
|
148
|
+
if (!stats.isFile())
|
|
149
|
+
return { path: artifactPath, exists: true, allowed: true, sizeBytes: stats.size };
|
|
150
|
+
return {
|
|
151
|
+
path: artifactPath,
|
|
152
|
+
exists: true,
|
|
153
|
+
allowed: true,
|
|
154
|
+
sizeBytes: stats.size,
|
|
155
|
+
sha256: sha256File(realPath),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
return {
|
|
160
|
+
path: artifactPath,
|
|
161
|
+
exists: existsSync(resolvedPath),
|
|
162
|
+
allowed: true,
|
|
163
|
+
error: error instanceof Error ? error.message : String(error),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
export function resolveHarnessControlEventLogPath(options = {}) {
|
|
169
|
+
if (process.env.OMK_HARNESS_CONTROL_EVENTS === "0")
|
|
170
|
+
return undefined;
|
|
171
|
+
if (options.logPath)
|
|
172
|
+
return options.logPath;
|
|
173
|
+
if (process.env.OMK_HARNESS_CONTROL_EVENT_LOG)
|
|
174
|
+
return process.env.OMK_HARNESS_CONTROL_EVENT_LOG;
|
|
175
|
+
const runId = options.runId ?? DEFAULT_RUN_ID;
|
|
176
|
+
return join(options.cwd ?? process.cwd(), ".omk", "runs", runId, "harness-control", "events.jsonl");
|
|
177
|
+
}
|
|
178
|
+
function eventHashInput(eventWithoutHash) {
|
|
179
|
+
return `${canonicalJson(eventWithoutHash)}${eventWithoutHash.previousEventHash}`;
|
|
180
|
+
}
|
|
181
|
+
function computeEventHash(eventWithoutHash) {
|
|
182
|
+
return sha256Text(eventHashInput(eventWithoutHash));
|
|
183
|
+
}
|
|
184
|
+
function readPreviousEventState(logPath) {
|
|
185
|
+
if (!existsSync(logPath))
|
|
186
|
+
return { sequence: 0, eventHash: GENESIS_EVENT_HASH };
|
|
187
|
+
const lines = readFileSync(logPath, "utf-8")
|
|
188
|
+
.split("\n")
|
|
189
|
+
.map((line) => line.trim())
|
|
190
|
+
.filter((line) => line.length > 0);
|
|
191
|
+
if (lines.length === 0)
|
|
192
|
+
return { sequence: 0, eventHash: GENESIS_EVENT_HASH };
|
|
193
|
+
let parsed;
|
|
194
|
+
try {
|
|
195
|
+
parsed = JSON.parse(lines.at(-1));
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
throw new Error("Last harness ledger line is not valid JSON — ledger may be truncated or corrupted");
|
|
199
|
+
}
|
|
200
|
+
if (parsed.schemaVersion === ANCHOR_SCHEMA_VERSION) {
|
|
201
|
+
if (typeof parsed.anchoredSequence !== "number" || typeof parsed.anchoredEventHash !== "string") {
|
|
202
|
+
throw new Error("Previous harness ledger anchor is missing anchoredSequence or anchoredEventHash");
|
|
203
|
+
}
|
|
204
|
+
return { sequence: parsed.anchoredSequence, eventHash: parsed.anchoredEventHash };
|
|
205
|
+
}
|
|
206
|
+
if (parsed.schemaVersion !== EVENT_SCHEMA_VERSION) {
|
|
207
|
+
return { sequence: 0, eventHash: GENESIS_EVENT_HASH };
|
|
208
|
+
}
|
|
209
|
+
if (typeof parsed.sequence !== "number" || !Number.isInteger(parsed.sequence) || parsed.sequence < 0) {
|
|
210
|
+
throw new Error("Previous harness event has invalid or missing sequence");
|
|
211
|
+
}
|
|
212
|
+
if (typeof parsed.eventHash !== "string" || !/^[a-f0-9]{64}$/.test(parsed.eventHash)) {
|
|
213
|
+
throw new Error("Previous harness event has invalid or missing eventHash");
|
|
214
|
+
}
|
|
215
|
+
return { sequence: parsed.sequence, eventHash: parsed.eventHash };
|
|
216
|
+
}
|
|
217
|
+
function acquireLock(lockPath, timeoutMs) {
|
|
218
|
+
const start = Date.now();
|
|
219
|
+
while (true) {
|
|
220
|
+
try {
|
|
221
|
+
return openSync(lockPath, "wx", 0o600);
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
if (existsSync(lockPath)) {
|
|
225
|
+
try {
|
|
226
|
+
const stats = statSync(lockPath);
|
|
227
|
+
if (Date.now() - stats.mtimeMs > LOCK_STALE_MS)
|
|
228
|
+
rmSync(lockPath, { force: true });
|
|
229
|
+
}
|
|
230
|
+
catch { }
|
|
231
|
+
}
|
|
232
|
+
if (Date.now() - start >= timeoutMs) {
|
|
233
|
+
throw error;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function formatRotationTimestamp(date) {
|
|
239
|
+
return date.toISOString().replace(/[:.]/g, "-");
|
|
240
|
+
}
|
|
241
|
+
function fsyncDirectory(dirPath) {
|
|
242
|
+
try {
|
|
243
|
+
const dirFd = openSync(dirPath, "r");
|
|
244
|
+
try {
|
|
245
|
+
fsyncSync(dirFd);
|
|
246
|
+
}
|
|
247
|
+
finally {
|
|
248
|
+
closeSync(dirFd);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
// Some platforms/filesystems do not support directory fsync; file fsync above is still mandatory.
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function enforcePrivateFilePermissions(filePath) {
|
|
256
|
+
try {
|
|
257
|
+
if (existsSync(filePath) && (statSync(filePath).mode & 0o777) !== 0o600) {
|
|
258
|
+
chmodSync(filePath, 0o600);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
/* best-effort permission enforcement */
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function rotateLedgerIfNeeded(path, maxLedgerBytes, now) {
|
|
266
|
+
if (!Number.isFinite(maxLedgerBytes) || (maxLedgerBytes ?? 0) <= 0 || !existsSync(path))
|
|
267
|
+
return undefined;
|
|
268
|
+
enforcePrivateFilePermissions(path);
|
|
269
|
+
const stats = statSync(path);
|
|
270
|
+
if (stats.size < Math.floor(maxLedgerBytes ?? 0))
|
|
271
|
+
return undefined;
|
|
272
|
+
// Capture the rotated segment's terminal state so the fresh segment continues
|
|
273
|
+
// the global sequence and hash chain instead of restarting from genesis.
|
|
274
|
+
const anchorState = readPreviousEventState(path);
|
|
275
|
+
const rotatedPath = `${path}.${formatRotationTimestamp(now)}.rotated`;
|
|
276
|
+
renameSync(path, rotatedPath);
|
|
277
|
+
enforcePrivateFilePermissions(rotatedPath);
|
|
278
|
+
fsyncDirectory(dirname(path));
|
|
279
|
+
if (anchorState.sequence > 0) {
|
|
280
|
+
const anchor = {
|
|
281
|
+
schemaVersion: ANCHOR_SCHEMA_VERSION,
|
|
282
|
+
anchoredSequence: anchorState.sequence,
|
|
283
|
+
anchoredEventHash: anchorState.eventHash,
|
|
284
|
+
rotatedFrom: basename(rotatedPath),
|
|
285
|
+
timestamp: now.toISOString(),
|
|
286
|
+
};
|
|
287
|
+
appendJsonLineWithFsync(path, JSON.stringify(anchor));
|
|
288
|
+
}
|
|
289
|
+
return rotatedPath;
|
|
290
|
+
}
|
|
291
|
+
function appendJsonLineWithFsync(path, line) {
|
|
292
|
+
const fd = openSync(path, "a", 0o600);
|
|
293
|
+
try {
|
|
294
|
+
enforcePrivateFilePermissions(path);
|
|
295
|
+
writeSync(fd, `${line}\n`, undefined, "utf-8");
|
|
296
|
+
fsyncSync(fd);
|
|
297
|
+
}
|
|
298
|
+
finally {
|
|
299
|
+
closeSync(fd);
|
|
300
|
+
}
|
|
301
|
+
fsyncDirectory(dirname(path));
|
|
302
|
+
}
|
|
303
|
+
export function createHarnessControlEvent(kind, status, data = {}, options = {}, previous = { sequence: 0, eventHash: GENESIS_EVENT_HASH }) {
|
|
304
|
+
const eventId = options.eventId ?? options.id ?? randomUUID();
|
|
305
|
+
const operationId = options.operationId ?? eventId;
|
|
306
|
+
const logPath = resolveHarnessControlEventLogPath(options) ?? "";
|
|
307
|
+
const cwd = options.cwd ?? process.cwd();
|
|
308
|
+
const sanitizedData = sanitizeHarnessControlEventData(data);
|
|
309
|
+
const eventWithoutHash = {
|
|
310
|
+
schemaVersion: "omk.harness-control.event.v2",
|
|
311
|
+
eventId,
|
|
312
|
+
runId: options.runId ?? DEFAULT_RUN_ID,
|
|
313
|
+
sessionId: options.sessionId ?? DEFAULT_SESSION_ID,
|
|
314
|
+
operationId,
|
|
315
|
+
causationId: options.causationId ?? null,
|
|
316
|
+
correlationId: options.correlationId ?? operationId,
|
|
317
|
+
sequence: previous.sequence + 1,
|
|
318
|
+
timestamp: (options.now ?? new Date()).toISOString(),
|
|
319
|
+
kind,
|
|
320
|
+
status,
|
|
321
|
+
cwd,
|
|
322
|
+
beforeStateHash: hashCanonical(options.beforeState ?? null),
|
|
323
|
+
afterStateHash: hashCanonical(options.afterState ?? null),
|
|
324
|
+
data: sanitizedData,
|
|
325
|
+
dataHash: hashCanonical(sanitizedData),
|
|
326
|
+
artifacts: createArtifactManifest(options.artifactRefs, cwd, logPath, options.allowedArtifactRoots),
|
|
327
|
+
previousEventHash: previous.eventHash,
|
|
328
|
+
};
|
|
329
|
+
return { ...eventWithoutHash, eventHash: computeEventHash(eventWithoutHash) };
|
|
330
|
+
}
|
|
331
|
+
export function recordHarnessControlEvent(kind, status, data = {}, options = {}) {
|
|
332
|
+
const logPath = resolveHarnessControlEventLogPath(options);
|
|
333
|
+
if (!logPath)
|
|
334
|
+
return { ok: false, error: "harness control event logging disabled" };
|
|
335
|
+
const lockPath = `${logPath}.lock`;
|
|
336
|
+
let lockFd;
|
|
337
|
+
try {
|
|
338
|
+
mkdirSync(dirname(logPath), { recursive: true, mode: 0o700 });
|
|
339
|
+
// Re-apply directory permissions on platforms where umask
|
|
340
|
+
// overrides the mode passed to mkdirSync.
|
|
341
|
+
try {
|
|
342
|
+
const dirStats = statSync(dirname(logPath));
|
|
343
|
+
if ((dirStats.mode & 0o777) !== 0o700) {
|
|
344
|
+
chmodSync(dirname(logPath), 0o700);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch {
|
|
348
|
+
/* best-effort permission enforcement */
|
|
349
|
+
}
|
|
350
|
+
lockFd = acquireLock(lockPath, options.lockTimeoutMs ?? 1000);
|
|
351
|
+
rotateLedgerIfNeeded(logPath, options.maxLedgerBytes, options.now ?? new Date());
|
|
352
|
+
const previous = readPreviousEventState(logPath);
|
|
353
|
+
const event = createHarnessControlEvent(kind, status, data, options, previous);
|
|
354
|
+
appendJsonLineWithFsync(logPath, JSON.stringify(event));
|
|
355
|
+
return { ok: true, path: logPath, event };
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
return { ok: false, path: logPath, error: error instanceof Error ? error.message : String(error) };
|
|
359
|
+
}
|
|
360
|
+
finally {
|
|
361
|
+
if (lockFd !== undefined) {
|
|
362
|
+
try {
|
|
363
|
+
closeSync(lockFd);
|
|
364
|
+
}
|
|
365
|
+
catch { }
|
|
366
|
+
rmSync(lockPath, { force: true });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
function validateLedgerAnchor(anchor) {
|
|
371
|
+
if (typeof anchor.anchoredSequence !== "number" ||
|
|
372
|
+
!Number.isInteger(anchor.anchoredSequence) ||
|
|
373
|
+
anchor.anchoredSequence < 1) {
|
|
374
|
+
return "ledger anchor has an invalid anchoredSequence";
|
|
375
|
+
}
|
|
376
|
+
if (typeof anchor.anchoredEventHash !== "string" || !/^[a-f0-9]{64}$/.test(anchor.anchoredEventHash)) {
|
|
377
|
+
return "ledger anchor has an invalid anchoredEventHash";
|
|
378
|
+
}
|
|
379
|
+
return undefined;
|
|
380
|
+
}
|
|
381
|
+
const VALID_EVENT_STATUSES = new Set([
|
|
382
|
+
"prepared",
|
|
383
|
+
"started",
|
|
384
|
+
"applying",
|
|
385
|
+
"verifying",
|
|
386
|
+
"completed",
|
|
387
|
+
"failed",
|
|
388
|
+
"blocked",
|
|
389
|
+
"rolled_back",
|
|
390
|
+
"in_doubt",
|
|
391
|
+
]);
|
|
392
|
+
function isRecord(value) {
|
|
393
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
394
|
+
}
|
|
395
|
+
function validateHarnessControlEventRecord(record) {
|
|
396
|
+
if (record.schemaVersion !== EVENT_SCHEMA_VERSION)
|
|
397
|
+
return "unsupported schemaVersion";
|
|
398
|
+
const stringFields = [
|
|
399
|
+
"eventId",
|
|
400
|
+
"runId",
|
|
401
|
+
"sessionId",
|
|
402
|
+
"operationId",
|
|
403
|
+
"correlationId",
|
|
404
|
+
"timestamp",
|
|
405
|
+
"kind",
|
|
406
|
+
"cwd",
|
|
407
|
+
"beforeStateHash",
|
|
408
|
+
"afterStateHash",
|
|
409
|
+
"dataHash",
|
|
410
|
+
"previousEventHash",
|
|
411
|
+
"eventHash",
|
|
412
|
+
];
|
|
413
|
+
for (const field of stringFields) {
|
|
414
|
+
if (typeof record[field] !== "string")
|
|
415
|
+
return `event is missing or has invalid ${field}`;
|
|
416
|
+
}
|
|
417
|
+
if (typeof record.sequence !== "number" || !Number.isInteger(record.sequence) || record.sequence < 1) {
|
|
418
|
+
return "event has invalid sequence";
|
|
419
|
+
}
|
|
420
|
+
if (typeof record.causationId !== "string" && record.causationId !== null) {
|
|
421
|
+
return "event has invalid causationId";
|
|
422
|
+
}
|
|
423
|
+
if (typeof record.status !== "string" || !VALID_EVENT_STATUSES.has(record.status)) {
|
|
424
|
+
return "event has invalid status";
|
|
425
|
+
}
|
|
426
|
+
if (typeof record.eventHash !== "string" || !/^[a-f0-9]{64}$/.test(record.eventHash)) {
|
|
427
|
+
return "event has invalid eventHash";
|
|
428
|
+
}
|
|
429
|
+
if (typeof record.previousEventHash !== "string" || !/^[a-f0-9]{64}$/.test(record.previousEventHash)) {
|
|
430
|
+
return "event has invalid previousEventHash";
|
|
431
|
+
}
|
|
432
|
+
if (!isRecord(record.data))
|
|
433
|
+
return "event has invalid data";
|
|
434
|
+
if (!Array.isArray(record.artifacts))
|
|
435
|
+
return "event has invalid artifacts";
|
|
436
|
+
return undefined;
|
|
437
|
+
}
|
|
438
|
+
function validateEventHash(event) {
|
|
439
|
+
const { eventHash: _eventHash, ...eventWithoutHash } = event;
|
|
440
|
+
const expectedEventHash = computeEventHash(eventWithoutHash);
|
|
441
|
+
if (expectedEventHash !== event.eventHash) {
|
|
442
|
+
return `event ${event.eventId} hash mismatch`;
|
|
443
|
+
}
|
|
444
|
+
if (hashCanonical(event.data) !== event.dataHash) {
|
|
445
|
+
return `event ${event.eventId} dataHash mismatch`;
|
|
446
|
+
}
|
|
447
|
+
return undefined;
|
|
448
|
+
}
|
|
449
|
+
export function verifyHarnessControlLedger(logPath) {
|
|
450
|
+
const errors = [];
|
|
451
|
+
const events = [];
|
|
452
|
+
const quarantinedLines = [];
|
|
453
|
+
if (!existsSync(logPath))
|
|
454
|
+
return { ok: true, events, errors, quarantinedLines };
|
|
455
|
+
const lines = readFileSync(logPath, "utf-8")
|
|
456
|
+
.split("\n")
|
|
457
|
+
.map((line) => line.trim())
|
|
458
|
+
.filter((line) => line.length > 0);
|
|
459
|
+
let previousSequence = 0;
|
|
460
|
+
let previousEventHash = GENESIS_EVENT_HASH;
|
|
461
|
+
function quarantine(lineNumber, reason) {
|
|
462
|
+
quarantinedLines.push({ lineNumber, reason });
|
|
463
|
+
errors.push(`line ${lineNumber}: quarantined — ${reason}`);
|
|
464
|
+
}
|
|
465
|
+
for (let index = 0; index < lines.length; index++) {
|
|
466
|
+
const lineNumber = index + 1;
|
|
467
|
+
let parsed;
|
|
468
|
+
try {
|
|
469
|
+
parsed = JSON.parse(lines[index]);
|
|
470
|
+
}
|
|
471
|
+
catch (error) {
|
|
472
|
+
quarantine(lineNumber, error instanceof Error ? error.message : String(error));
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
if (parsed.schemaVersion === ANCHOR_SCHEMA_VERSION) {
|
|
476
|
+
if (index !== 0) {
|
|
477
|
+
quarantine(lineNumber, "ledger anchor must be the first line");
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
const anchorError = validateLedgerAnchor(parsed);
|
|
481
|
+
if (anchorError) {
|
|
482
|
+
quarantine(lineNumber, anchorError);
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
previousSequence = parsed.anchoredSequence;
|
|
486
|
+
previousEventHash = parsed.anchoredEventHash;
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
const shapeError = validateHarnessControlEventRecord(parsed);
|
|
490
|
+
if (shapeError) {
|
|
491
|
+
quarantine(lineNumber, shapeError);
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
const event = parsed;
|
|
495
|
+
if (event.sequence !== previousSequence + 1) {
|
|
496
|
+
quarantine(lineNumber, `sequence gap: expected ${previousSequence + 1}, got ${event.sequence}`);
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
if (event.previousEventHash !== previousEventHash) {
|
|
500
|
+
quarantine(lineNumber, "previousEventHash mismatch");
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
const hashError = validateEventHash(event);
|
|
504
|
+
if (hashError) {
|
|
505
|
+
quarantine(lineNumber, hashError);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
events.push(event);
|
|
509
|
+
previousSequence = event.sequence;
|
|
510
|
+
previousEventHash = event.eventHash;
|
|
511
|
+
}
|
|
512
|
+
return { ok: errors.length === 0, events, errors, quarantinedLines };
|
|
513
|
+
}
|
|
514
|
+
//# sourceMappingURL=harness-control-events.js.map
|