open-multi-agent-kit 0.80.6 → 0.80.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -1
- package/README.md +22 -14
- package/dist/cli/config-selector.d.ts +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -8
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +45 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +197 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +5 -5
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/command-safety.d.ts +11 -0
- package/dist/core/command-safety.d.ts.map +1 -0
- package/dist/core/command-safety.js +528 -0
- package/dist/core/command-safety.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +14 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +18 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +80 -42
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/pruner-policy.d.ts +84 -0
- package/dist/core/compaction/pruner-policy.d.ts.map +1 -0
- package/dist/core/compaction/pruner-policy.js +273 -0
- package/dist/core/compaction/pruner-policy.js.map +1 -0
- package/dist/core/context-graph-identity-resolution.d.ts +114 -0
- package/dist/core/context-graph-identity-resolution.d.ts.map +1 -0
- package/dist/core/context-graph-identity-resolution.js +127 -0
- package/dist/core/context-graph-identity-resolution.js.map +1 -0
- package/dist/core/context-graph-memory-store.d.ts +153 -0
- package/dist/core/context-graph-memory-store.d.ts.map +1 -0
- package/dist/core/context-graph-memory-store.js +377 -0
- package/dist/core/context-graph-memory-store.js.map +1 -0
- package/dist/core/context-graph-ontology-generation.d.ts +104 -0
- package/dist/core/context-graph-ontology-generation.d.ts.map +1 -0
- package/dist/core/context-graph-ontology-generation.js +135 -0
- package/dist/core/context-graph-ontology-generation.js.map +1 -0
- package/dist/core/context-graph-ontology-registry.d.ts +766 -0
- package/dist/core/context-graph-ontology-registry.d.ts.map +1 -0
- package/dist/core/context-graph-ontology-registry.js +1133 -0
- package/dist/core/context-graph-ontology-registry.js.map +1 -0
- package/dist/core/context-graph-policy.d.ts +68 -0
- package/dist/core/context-graph-policy.d.ts.map +1 -0
- package/dist/core/context-graph-policy.js +221 -0
- package/dist/core/context-graph-policy.js.map +1 -0
- package/dist/core/context-graph-reasoning.d.ts +130 -0
- package/dist/core/context-graph-reasoning.d.ts.map +1 -0
- package/dist/core/context-graph-reasoning.js +442 -0
- package/dist/core/context-graph-reasoning.js.map +1 -0
- package/dist/core/context-graph-retrieval.d.ts +120 -0
- package/dist/core/context-graph-retrieval.d.ts.map +1 -0
- package/dist/core/context-graph-retrieval.js +288 -0
- package/dist/core/context-graph-retrieval.js.map +1 -0
- package/dist/core/contract-verification.d.ts +78 -0
- package/dist/core/contract-verification.d.ts.map +1 -0
- package/dist/core/contract-verification.js +110 -0
- package/dist/core/contract-verification.js.map +1 -0
- package/dist/core/exact-cache-policy.d.ts +100 -0
- package/dist/core/exact-cache-policy.d.ts.map +1 -0
- package/dist/core/exact-cache-policy.js +175 -0
- package/dist/core/exact-cache-policy.js.map +1 -0
- package/dist/core/exec.d.ts +2 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +1 -0
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/template.js +2 -2
- package/dist/core/extensions/builtin/command-safety-gate.d.ts +77 -0
- package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -0
- package/dist/core/extensions/builtin/command-safety-gate.js +147 -0
- package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +4 -4
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +94 -56
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +38 -10
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/freedom/banner.d.ts +14 -0
- package/dist/core/freedom/banner.d.ts.map +1 -0
- package/dist/core/freedom/banner.js +22 -0
- package/dist/core/freedom/banner.js.map +1 -0
- package/dist/core/freedom/config.d.ts +27 -0
- package/dist/core/freedom/config.d.ts.map +1 -0
- package/dist/core/freedom/config.js +216 -0
- package/dist/core/freedom/config.js.map +1 -0
- package/dist/core/freedom/index.d.ts +23 -0
- package/dist/core/freedom/index.d.ts.map +1 -0
- package/dist/core/freedom/index.js +19 -0
- package/dist/core/freedom/index.js.map +1 -0
- package/dist/core/freedom/policy.d.ts +42 -0
- package/dist/core/freedom/policy.d.ts.map +1 -0
- package/dist/core/freedom/policy.js +47 -0
- package/dist/core/freedom/policy.js.map +1 -0
- package/dist/core/freedom/safety-floor.d.ts +73 -0
- package/dist/core/freedom/safety-floor.d.ts.map +1 -0
- package/dist/core/freedom/safety-floor.js +275 -0
- package/dist/core/freedom/safety-floor.js.map +1 -0
- package/dist/core/harness-control-events.d.ts +13 -1
- package/dist/core/harness-control-events.d.ts.map +1 -1
- package/dist/core/harness-control-events.js +216 -41
- package/dist/core/harness-control-events.js.map +1 -1
- package/dist/core/harness-control-replay.d.ts +7 -2
- package/dist/core/harness-control-replay.d.ts.map +1 -1
- package/dist/core/harness-control-replay.js +36 -4
- package/dist/core/harness-control-replay.js.map +1 -1
- package/dist/core/headroom-middleware.d.ts +35 -0
- package/dist/core/headroom-middleware.d.ts.map +1 -0
- package/dist/core/headroom-middleware.js +166 -0
- package/dist/core/headroom-middleware.js.map +1 -0
- package/dist/core/hook-inventory.d.ts +23 -0
- package/dist/core/hook-inventory.d.ts.map +1 -0
- package/dist/core/hook-inventory.js +50 -0
- package/dist/core/hook-inventory.js.map +1 -0
- package/dist/core/lean-context-middleware.d.ts +12 -0
- package/dist/core/lean-context-middleware.d.ts.map +1 -0
- package/dist/core/lean-context-middleware.js +87 -0
- package/dist/core/lean-context-middleware.js.map +1 -0
- package/dist/core/lean-context-policy.d.ts +45 -0
- package/dist/core/lean-context-policy.d.ts.map +1 -0
- package/dist/core/lean-context-policy.js +108 -0
- package/dist/core/lean-context-policy.js.map +1 -0
- package/dist/core/loadout-access-policy.d.ts +41 -0
- package/dist/core/loadout-access-policy.d.ts.map +1 -0
- package/dist/core/loadout-access-policy.js +182 -0
- package/dist/core/loadout-access-policy.js.map +1 -0
- package/dist/core/loadout-runtime.d.ts +84 -0
- package/dist/core/loadout-runtime.d.ts.map +1 -0
- package/dist/core/loadout-runtime.js +157 -0
- package/dist/core/loadout-runtime.js.map +1 -0
- package/dist/core/loadouts.d.ts +147 -0
- package/dist/core/loadouts.d.ts.map +1 -0
- package/dist/core/loadouts.js +442 -0
- package/dist/core/loadouts.js.map +1 -0
- package/dist/core/mcp-inventory.d.ts +34 -0
- package/dist/core/mcp-inventory.d.ts.map +1 -1
- package/dist/core/mcp-inventory.js +53 -1
- package/dist/core/mcp-inventory.js.map +1 -1
- package/dist/core/mcp-presets.d.ts +57 -0
- package/dist/core/mcp-presets.d.ts.map +1 -0
- package/dist/core/mcp-presets.js +81 -0
- package/dist/core/mcp-presets.js.map +1 -0
- package/dist/core/model-registry.d.ts +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +40 -17
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/native-adoption-benchmark.d.ts +166 -0
- package/dist/core/native-adoption-benchmark.d.ts.map +1 -0
- package/dist/core/native-adoption-benchmark.js +624 -0
- package/dist/core/native-adoption-benchmark.js.map +1 -0
- package/dist/core/observability-trace.d.ts +80 -0
- package/dist/core/observability-trace.d.ts.map +1 -0
- package/dist/core/observability-trace.js +140 -0
- package/dist/core/observability-trace.js.map +1 -0
- package/dist/core/orchestration/checkpoint.d.ts +83 -0
- package/dist/core/orchestration/checkpoint.d.ts.map +1 -0
- package/dist/core/orchestration/checkpoint.js +152 -0
- package/dist/core/orchestration/checkpoint.js.map +1 -0
- package/dist/core/orchestration/errors.d.ts +74 -0
- package/dist/core/orchestration/errors.d.ts.map +1 -0
- package/dist/core/orchestration/errors.js +52 -0
- package/dist/core/orchestration/errors.js.map +1 -0
- package/dist/core/orchestration/merge-queue.d.ts +121 -0
- package/dist/core/orchestration/merge-queue.d.ts.map +1 -0
- package/dist/core/orchestration/merge-queue.js +149 -0
- package/dist/core/orchestration/merge-queue.js.map +1 -0
- package/dist/core/orchestration/recovery.d.ts +106 -0
- package/dist/core/orchestration/recovery.d.ts.map +1 -0
- package/dist/core/orchestration/recovery.js +110 -0
- package/dist/core/orchestration/recovery.js.map +1 -0
- package/dist/core/orchestration/replay-ledger.d.ts +76 -0
- package/dist/core/orchestration/replay-ledger.d.ts.map +1 -0
- package/dist/core/orchestration/replay-ledger.js +395 -0
- package/dist/core/orchestration/replay-ledger.js.map +1 -0
- package/dist/core/orchestration/scheduler-state.d.ts +78 -0
- package/dist/core/orchestration/scheduler-state.d.ts.map +1 -0
- package/dist/core/orchestration/scheduler-state.js +185 -0
- package/dist/core/orchestration/scheduler-state.js.map +1 -0
- package/dist/core/orchestration/scheduler-store.d.ts +309 -0
- package/dist/core/orchestration/scheduler-store.d.ts.map +1 -0
- package/dist/core/orchestration/scheduler-store.js +368 -0
- package/dist/core/orchestration/scheduler-store.js.map +1 -0
- package/dist/core/orchestration/sqlite-scheduler-store.d.ts +57 -0
- package/dist/core/orchestration/sqlite-scheduler-store.d.ts.map +1 -0
- package/dist/core/orchestration/sqlite-scheduler-store.js +528 -0
- package/dist/core/orchestration/sqlite-scheduler-store.js.map +1 -0
- package/dist/core/orchestration/transaction-coordinator.d.ts +217 -0
- package/dist/core/orchestration/transaction-coordinator.d.ts.map +1 -0
- package/dist/core/orchestration/transaction-coordinator.js +281 -0
- package/dist/core/orchestration/transaction-coordinator.js.map +1 -0
- package/dist/core/orchestration/verification-contract.d.ts +197 -0
- package/dist/core/orchestration/verification-contract.d.ts.map +1 -0
- package/dist/core/orchestration/verification-contract.js +145 -0
- package/dist/core/orchestration/verification-contract.js.map +1 -0
- package/dist/core/package-composition.d.ts +68 -0
- package/dist/core/package-composition.d.ts.map +1 -0
- package/dist/core/package-composition.js +304 -0
- package/dist/core/package-composition.js.map +1 -0
- package/dist/core/package-gallery.d.ts +124 -0
- package/dist/core/package-gallery.d.ts.map +1 -0
- package/dist/core/package-gallery.js +392 -0
- package/dist/core/package-gallery.js.map +1 -0
- package/dist/core/package-manager.d.ts +69 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +367 -69
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-procurement.d.ts +268 -0
- package/dist/core/package-procurement.d.ts.map +1 -0
- package/dist/core/package-procurement.js +697 -0
- package/dist/core/package-procurement.js.map +1 -0
- package/dist/core/package-trial-runtime.d.ts +75 -0
- package/dist/core/package-trial-runtime.d.ts.map +1 -0
- package/dist/core/package-trial-runtime.js +73 -0
- package/dist/core/package-trial-runtime.js.map +1 -0
- package/dist/core/package-trial-sandbox.d.ts +27 -0
- package/dist/core/package-trial-sandbox.d.ts.map +1 -0
- package/dist/core/package-trial-sandbox.js +102 -0
- package/dist/core/package-trial-sandbox.js.map +1 -0
- package/dist/core/policy-overlays-runtime.d.ts +141 -0
- package/dist/core/policy-overlays-runtime.d.ts.map +1 -0
- package/dist/core/policy-overlays-runtime.js +720 -0
- package/dist/core/policy-overlays-runtime.js.map +1 -0
- package/dist/core/read-anchor-registry.d.ts +27 -0
- package/dist/core/read-anchor-registry.d.ts.map +1 -0
- package/dist/core/read-anchor-registry.js +103 -0
- package/dist/core/read-anchor-registry.js.map +1 -0
- package/dist/core/read-anchors.d.ts +110 -0
- package/dist/core/read-anchors.d.ts.map +1 -0
- package/dist/core/read-anchors.js +193 -0
- package/dist/core/read-anchors.js.map +1 -0
- package/dist/core/read-content-cache.d.ts +22 -0
- package/dist/core/read-content-cache.d.ts.map +1 -0
- package/dist/core/read-content-cache.js +79 -0
- package/dist/core/read-content-cache.js.map +1 -0
- package/dist/core/recovery-checkpoint.d.ts +196 -0
- package/dist/core/recovery-checkpoint.d.ts.map +1 -0
- package/dist/core/recovery-checkpoint.js +382 -0
- package/dist/core/recovery-checkpoint.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +30 -2
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +23 -21
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +93 -15
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sandbox/backend.d.ts +25 -0
- package/dist/core/sandbox/backend.d.ts.map +1 -0
- package/dist/core/sandbox/backend.js +150 -0
- package/dist/core/sandbox/backend.js.map +1 -0
- package/dist/core/sandbox/env.d.ts +6 -0
- package/dist/core/sandbox/env.d.ts.map +1 -0
- package/dist/core/sandbox/env.js +46 -0
- package/dist/core/sandbox/env.js.map +1 -0
- package/dist/core/sandbox/path-resolver.d.ts +4 -0
- package/dist/core/sandbox/path-resolver.d.ts.map +1 -0
- package/dist/core/sandbox/path-resolver.js +44 -0
- package/dist/core/sandbox/path-resolver.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +87 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +280 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/spawn.d.ts +20 -0
- package/dist/core/sandbox/spawn.d.ts.map +1 -0
- package/dist/core/sandbox/spawn.js +80 -0
- package/dist/core/sandbox/spawn.js.map +1 -0
- package/dist/core/sdk.d.ts +83 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +143 -55
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/semantic-cache-policy.d.ts +45 -0
- package/dist/core/semantic-cache-policy.d.ts.map +1 -0
- package/dist/core/semantic-cache-policy.js +220 -0
- package/dist/core/semantic-cache-policy.js.map +1 -0
- package/dist/core/session-digest.d.ts +57 -0
- package/dist/core/session-digest.d.ts.map +1 -0
- package/dist/core/session-digest.js +193 -0
- package/dist/core/session-digest.js.map +1 -0
- package/dist/core/session-manager.d.ts +2 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +5 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +14 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +43 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +25 -7
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.d.ts +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +2 -2
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +28 -3
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +53 -10
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +12 -0
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +24 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +3 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +3 -0
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +3 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +4 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +3 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +3 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +1 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +29 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts +3 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +3 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +19 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -6
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts +28 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.js +146 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient.d.ts +27 -0
- package/dist/modes/interactive/components/control-panel-gradient.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient.js +127 -0
- package/dist/modes/interactive/components/control-panel-gradient.js.map +1 -0
- package/dist/modes/interactive/components/control-panel.d.ts +28 -1
- package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel.js +153 -3
- package/dist/modes/interactive/components/control-panel.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js +1 -1
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -0
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts +2 -0
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.js +18 -1
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector-state.d.ts +101 -0
- package/dist/modes/interactive/components/model-selector-state.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector-state.js +261 -0
- package/dist/modes/interactive/components/model-selector-state.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +44 -10
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +163 -110
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +10 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +61 -13
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/omk-blackboard.json +91 -0
- package/dist/modes/interactive/theme/omk-freedom-grid.json +91 -0
- package/dist/modes/interactive/theme/omk-neon-ops.json +90 -0
- package/dist/modes/interactive/theme/omk-slate-light.json +91 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +14 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +2 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +114 -49
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/omk-user-agent.d.ts +2 -0
- package/dist/utils/omk-user-agent.d.ts.map +1 -0
- package/dist/utils/{pi-user-agent.js → omk-user-agent.js} +2 -2
- package/dist/utils/omk-user-agent.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +5 -5
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +8 -11
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/packages.md +47 -6
- package/docs/prompt-templates.md +2 -0
- package/docs/usage.md +16 -6
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +11 -11
- package/examples/extensions/auto-commit-on-exit.ts +6 -6
- package/examples/extensions/bash-spawn-hook.ts +4 -4
- package/examples/extensions/bookmark.ts +5 -5
- package/examples/extensions/border-status-editor.ts +7 -7
- package/examples/extensions/built-in-tool-renderer.ts +6 -6
- package/examples/extensions/claude-rules.ts +4 -4
- package/examples/extensions/commands.ts +5 -5
- package/examples/extensions/confirm-destructive.ts +3 -3
- package/examples/extensions/custom-compaction.ts +3 -3
- package/examples/extensions/custom-footer.ts +2 -2
- package/examples/extensions/custom-header.ts +5 -5
- package/examples/extensions/custom-provider-anthropic/index.ts +4 -4
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +3 -3
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/dirty-repo-guard.ts +7 -7
- package/examples/extensions/doom-overlay/README.md +3 -3
- package/examples/extensions/doom-overlay/doom/build.sh +2 -2
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +1 -1
- package/examples/extensions/doom-overlay/index.ts +3 -3
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-resources/index.ts +2 -2
- package/examples/extensions/dynamic-tools.ts +4 -4
- package/examples/extensions/event-bus.ts +8 -8
- package/examples/extensions/file-trigger.ts +3 -3
- package/examples/extensions/git-checkpoint.ts +7 -7
- package/examples/extensions/git-merge-and-resolve.ts +14 -14
- package/examples/extensions/github-issue-autocomplete.ts +6 -6
- package/examples/extensions/gondolin/index.ts +16 -16
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/handoff.ts +2 -2
- package/examples/extensions/hello.ts +2 -2
- package/examples/extensions/hidden-thinking-label.ts +4 -4
- package/examples/extensions/inline-bash.ts +5 -5
- package/examples/extensions/input-transform-streaming.ts +5 -5
- package/examples/extensions/input-transform.ts +5 -5
- package/examples/extensions/interactive-shell.ts +3 -3
- package/examples/extensions/mac-system-theme.ts +5 -5
- package/examples/extensions/message-renderer.ts +4 -4
- package/examples/extensions/minimal-mode.ts +9 -9
- package/examples/extensions/modal-editor.ts +3 -3
- package/examples/extensions/model-status.ts +3 -3
- package/examples/extensions/notify.ts +5 -5
- package/examples/extensions/overlay-qa-tests.ts +20 -20
- package/examples/extensions/overlay-test.ts +3 -3
- package/examples/extensions/permission-gate.ts +2 -2
- package/examples/extensions/pirate.ts +4 -4
- package/examples/extensions/plan-mode/index.ts +22 -22
- package/examples/extensions/preset.ts +30 -30
- package/examples/extensions/prompt-customizer.ts +3 -3
- package/examples/extensions/protected-paths.ts +2 -2
- package/examples/extensions/provider-payload.ts +5 -5
- package/examples/extensions/qna.ts +2 -2
- package/examples/extensions/question.ts +2 -2
- package/examples/extensions/questionnaire.ts +2 -2
- package/examples/extensions/rainbow-editor.ts +3 -3
- package/examples/extensions/reload-runtime.ts +4 -4
- package/examples/extensions/rpc-demo.ts +10 -10
- package/examples/extensions/sandbox/index.ts +17 -17
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/send-user-message.ts +13 -13
- package/examples/extensions/session-name.ts +4 -4
- package/examples/extensions/shutdown-command.ts +10 -10
- package/examples/extensions/snake.ts +3 -3
- package/examples/extensions/space-invaders.ts +3 -3
- package/examples/extensions/ssh.ts +12 -12
- package/examples/extensions/status-line.ts +4 -4
- package/examples/extensions/structured-output.ts +2 -2
- package/examples/extensions/subagent/README.md +13 -13
- package/examples/extensions/subagent/agents.ts +2 -2
- package/examples/extensions/subagent/index.ts +53 -21
- package/examples/extensions/summarize.ts +2 -2
- package/examples/extensions/system-prompt-header.ts +3 -3
- package/examples/extensions/tic-tac-toe.ts +15 -15
- package/examples/extensions/timed-confirm.ts +4 -4
- package/examples/extensions/titlebar-spinner.ts +9 -9
- package/examples/extensions/todo.ts +5 -5
- package/examples/extensions/tool-override.ts +5 -5
- package/examples/extensions/tools.ts +10 -10
- package/examples/extensions/trigger-compact.ts +3 -3
- package/examples/extensions/truncated-tool.ts +3 -3
- package/examples/extensions/widget-placement.ts +2 -2
- package/examples/extensions/with-deps/index.ts +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/working-indicator.ts +7 -7
- package/examples/extensions/working-message-test.ts +3 -3
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/05-tools.ts +1 -1
- package/examples/sdk/06-extensions.ts +11 -11
- package/examples/sdk/07-context-files.ts +2 -0
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
- package/examples/sdk/README.md +2 -2
- package/node_modules/@earendil-works/omk-agent-core/README.md +488 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts +24 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js +553 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts +118 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.js +402 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts +95 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js +996 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts +53 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js +175 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts +117 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js +568 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts +25 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js +131 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts +51 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js +510 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts +51 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js +102 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts +48 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js +230 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts +26 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js +101 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts +36 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js +273 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts +18 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js +42 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts +25 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js +114 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts +11 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js +39 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts +33 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js +210 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts +2 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js +50 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts +44 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js +311 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts +3 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js +30 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts +616 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js +94 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts +14 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js +126 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts +70 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js +297 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts +20 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.js +25 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts +3 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.js +3 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/node.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts +69 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js +278 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts +393 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.js +2 -0
- package/node_modules/@earendil-works/omk-agent-core/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-agent-core/package.json +60 -0
- package/node_modules/@earendil-works/omk-ai/README.md +1389 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts +20 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.js +44 -0
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts +5 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js +6 -0
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.js +130 -0
- package/node_modules/@earendil-works/omk-ai/dist/cli.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts +20 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js +199 -0
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts +10 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts +515 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js +517 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.js +23 -0
- package/node_modules/@earendil-works/omk-ai/dist/image-models.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts +14 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.d.ts +4 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.js +16 -0
- package/node_modules/@earendil-works/omk-ai/dist/images.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.d.ts +33 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.js +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.d.ts +18 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts +18762 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.js +17197 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.js +78 -0
- package/node_modules/@earendil-works/omk-ai/dist/models.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.js +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/oauth.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts +39 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.js +170 -0
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts +38 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js +826 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts +77 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js +1123 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts +15 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js +221 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js +26 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts +56 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js +368 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js +29 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts +70 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js +331 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts +15 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js +442 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.js +402 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js +128 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts +4 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js +34 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts +25 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js +534 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts +30 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js +1171 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts +19 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js +977 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts +11 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts +18 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js +496 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js +233 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts +35 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js +254 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js +42 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js +82 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js +184 -0
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts +4 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.js +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.js +77 -0
- package/node_modules/@earendil-works/omk-ai/dist/stream.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.d.ts +570 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.js +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts +6 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js +34 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts +19 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js +25 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js +81 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js +14 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js +8 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts +16 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js +113 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts +10 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js +97 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts +25 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js +335 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js +56 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts +30 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js +280 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts +58 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js +122 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts +3 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js +105 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts +43 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js +487 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts +13 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js +31 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts +64 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js +2 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts +57 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js +154 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts +22 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js +26 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts +17 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js +21 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts +18 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js +281 -0
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js.map +1 -0
- package/node_modules/@earendil-works/omk-ai/package.json +106 -0
- package/node_modules/@earendil-works/omk-tui/README.md +791 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts +54 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js +632 -0
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts +22 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.js +104 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/box.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts +22 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js +35 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts +249 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.js +1857 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts +28 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.js +89 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/image.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts +37 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.js +378 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/input.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts +31 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.js +69 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts +96 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js +644 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts +50 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js +159 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts +50 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js +185 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts +12 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js +23 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts +19 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.js +89 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/text.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts +13 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js +51 -0
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts +39 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.js +2 -0
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts +16 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js +110 -0
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.d.ts +23 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.js +32 -0
- package/node_modules/@earendil-works/omk-tui/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts +212 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.js +252 -0
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts +184 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.js +1173 -0
- package/node_modules/@earendil-works/omk-tui/dist/keys.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts +28 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js +44 -0
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts +3 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js +53 -0
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts +50 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js +361 -0
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts +90 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js +366 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts +113 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.js +472 -0
- package/node_modules/@earendil-works/omk-tui/dist/terminal.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts +242 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.js +1221 -0
- package/node_modules/@earendil-works/omk-tui/dist/tui.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts +17 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js +25 -0
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts +84 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.js +1032 -0
- package/node_modules/@earendil-works/omk-tui/dist/utils.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts +25 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts.map +1 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js +96 -0
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js.map +1 -0
- package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/omk-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/omk-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/omk-tui/package.json +47 -0
- package/package.json +22 -6
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js.map +0 -1
|
@@ -0,0 +1,996 @@
|
|
|
1
|
+
import { streamSimple, } from "@earendil-works/omk-ai";
|
|
2
|
+
import { runAgentLoop } from "../agent-loop.js";
|
|
3
|
+
import { collectEntriesForBranchSummary, generateBranchSummary } from "./compaction/branch-summarization.js";
|
|
4
|
+
import { compact, DEFAULT_COMPACTION_SETTINGS, prepareCompaction } from "./compaction/compaction.js";
|
|
5
|
+
import { convertToLlm } from "./messages.js";
|
|
6
|
+
import { formatPromptTemplateInvocation } from "./prompt-templates.js";
|
|
7
|
+
import { formatSkillInvocation } from "./skills.js";
|
|
8
|
+
import { AgentHarnessError, BranchSummaryError, CompactionError, SessionError, toError } from "./types.js";
|
|
9
|
+
function createUserMessage(text, images) {
|
|
10
|
+
const content = [{ type: "text", text }];
|
|
11
|
+
if (images)
|
|
12
|
+
content.push(...images);
|
|
13
|
+
return { role: "user", content, timestamp: Date.now() };
|
|
14
|
+
}
|
|
15
|
+
function createFailureMessage(model, error, aborted) {
|
|
16
|
+
return {
|
|
17
|
+
role: "assistant",
|
|
18
|
+
content: [{ type: "text", text: "" }],
|
|
19
|
+
api: model.api,
|
|
20
|
+
provider: model.provider,
|
|
21
|
+
model: model.id,
|
|
22
|
+
stopReason: aborted ? "aborted" : "error",
|
|
23
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
24
|
+
timestamp: Date.now(),
|
|
25
|
+
usage: {
|
|
26
|
+
input: 0,
|
|
27
|
+
output: 0,
|
|
28
|
+
cacheRead: 0,
|
|
29
|
+
cacheWrite: 0,
|
|
30
|
+
totalTokens: 0,
|
|
31
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function cloneStreamOptions(streamOptions) {
|
|
36
|
+
return {
|
|
37
|
+
...streamOptions,
|
|
38
|
+
headers: streamOptions?.headers ? { ...streamOptions.headers } : undefined,
|
|
39
|
+
metadata: streamOptions?.metadata ? { ...streamOptions.metadata } : undefined,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function mergeHeaders(...headers) {
|
|
43
|
+
const merged = {};
|
|
44
|
+
let hasHeaders = false;
|
|
45
|
+
for (const entry of headers) {
|
|
46
|
+
if (!entry)
|
|
47
|
+
continue;
|
|
48
|
+
Object.assign(merged, entry);
|
|
49
|
+
hasHeaders = true;
|
|
50
|
+
}
|
|
51
|
+
return hasHeaders ? merged : undefined;
|
|
52
|
+
}
|
|
53
|
+
function findDuplicateNames(names) {
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
const duplicates = new Set();
|
|
56
|
+
for (const name of names) {
|
|
57
|
+
if (seen.has(name))
|
|
58
|
+
duplicates.add(name);
|
|
59
|
+
seen.add(name);
|
|
60
|
+
}
|
|
61
|
+
return [...duplicates];
|
|
62
|
+
}
|
|
63
|
+
function applyStreamOptionsPatch(base, patch) {
|
|
64
|
+
const result = cloneStreamOptions(base);
|
|
65
|
+
if (!patch)
|
|
66
|
+
return result;
|
|
67
|
+
if (Object.hasOwn(patch, "transport"))
|
|
68
|
+
result.transport = patch.transport;
|
|
69
|
+
if (Object.hasOwn(patch, "timeoutMs"))
|
|
70
|
+
result.timeoutMs = patch.timeoutMs;
|
|
71
|
+
if (Object.hasOwn(patch, "maxRetries"))
|
|
72
|
+
result.maxRetries = patch.maxRetries;
|
|
73
|
+
if (Object.hasOwn(patch, "maxRetryDelayMs"))
|
|
74
|
+
result.maxRetryDelayMs = patch.maxRetryDelayMs;
|
|
75
|
+
if (Object.hasOwn(patch, "cacheRetention"))
|
|
76
|
+
result.cacheRetention = patch.cacheRetention;
|
|
77
|
+
if (Object.hasOwn(patch, "headers")) {
|
|
78
|
+
if (patch.headers === undefined) {
|
|
79
|
+
result.headers = undefined;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const headers = { ...(result.headers ?? {}) };
|
|
83
|
+
for (const [key, value] of Object.entries(patch.headers)) {
|
|
84
|
+
if (value === undefined)
|
|
85
|
+
delete headers[key];
|
|
86
|
+
else
|
|
87
|
+
headers[key] = value;
|
|
88
|
+
}
|
|
89
|
+
result.headers = Object.keys(headers).length > 0 ? headers : undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (Object.hasOwn(patch, "metadata")) {
|
|
93
|
+
if (patch.metadata === undefined) {
|
|
94
|
+
result.metadata = undefined;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const metadata = { ...(result.metadata ?? {}) };
|
|
98
|
+
for (const [key, value] of Object.entries(patch.metadata)) {
|
|
99
|
+
if (value === undefined)
|
|
100
|
+
delete metadata[key];
|
|
101
|
+
else
|
|
102
|
+
metadata[key] = value;
|
|
103
|
+
}
|
|
104
|
+
result.metadata = Object.keys(metadata).length > 0 ? metadata : undefined;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return result;
|
|
108
|
+
}
|
|
109
|
+
const SUBSCRIBER_EVENT_TYPE = "*";
|
|
110
|
+
function normalizeHarnessError(error, fallbackCode) {
|
|
111
|
+
if (error instanceof AgentHarnessError)
|
|
112
|
+
return error;
|
|
113
|
+
const cause = toError(error);
|
|
114
|
+
if (cause instanceof SessionError)
|
|
115
|
+
return new AgentHarnessError("session", cause.message, cause);
|
|
116
|
+
if (cause instanceof CompactionError)
|
|
117
|
+
return new AgentHarnessError("compaction", cause.message, cause);
|
|
118
|
+
if (cause instanceof BranchSummaryError)
|
|
119
|
+
return new AgentHarnessError("branch_summary", cause.message, cause);
|
|
120
|
+
return new AgentHarnessError(fallbackCode, cause.message, cause);
|
|
121
|
+
}
|
|
122
|
+
function normalizeHookError(error) {
|
|
123
|
+
return normalizeHarnessError(error, "hook");
|
|
124
|
+
}
|
|
125
|
+
export class AgentHarness {
|
|
126
|
+
env;
|
|
127
|
+
session;
|
|
128
|
+
phase = "idle";
|
|
129
|
+
runAbortController;
|
|
130
|
+
runPromise;
|
|
131
|
+
pendingSessionWrites = [];
|
|
132
|
+
model;
|
|
133
|
+
thinkingLevel;
|
|
134
|
+
systemPrompt;
|
|
135
|
+
streamOptions;
|
|
136
|
+
getApiKeyAndHeaders;
|
|
137
|
+
resources;
|
|
138
|
+
tools = new Map();
|
|
139
|
+
activeToolNames;
|
|
140
|
+
steerQueue = [];
|
|
141
|
+
steeringQueueMode;
|
|
142
|
+
followUpQueue = [];
|
|
143
|
+
followUpQueueMode;
|
|
144
|
+
nextTurnQueue = [];
|
|
145
|
+
handlers = new Map();
|
|
146
|
+
constructor(options) {
|
|
147
|
+
this.env = options.env;
|
|
148
|
+
this.session = options.session;
|
|
149
|
+
this.resources = options.resources ?? {};
|
|
150
|
+
this.streamOptions = cloneStreamOptions(options.streamOptions);
|
|
151
|
+
this.systemPrompt = options.systemPrompt;
|
|
152
|
+
this.getApiKeyAndHeaders = options.getApiKeyAndHeaders;
|
|
153
|
+
this.validateUniqueNames((options.tools ?? []).map((tool) => tool.name), "Duplicate tool name(s)");
|
|
154
|
+
for (const tool of options.tools ?? []) {
|
|
155
|
+
this.tools.set(tool.name, tool);
|
|
156
|
+
}
|
|
157
|
+
this.model = options.model;
|
|
158
|
+
this.thinkingLevel = options.thinkingLevel ?? "off";
|
|
159
|
+
this.activeToolNames = options.activeToolNames
|
|
160
|
+
? [...options.activeToolNames]
|
|
161
|
+
: (options.tools ?? []).map((tool) => tool.name);
|
|
162
|
+
this.validateUniqueNames(this.activeToolNames, "Duplicate active tool name(s)");
|
|
163
|
+
this.validateToolNames(this.activeToolNames);
|
|
164
|
+
this.steeringQueueMode = options.steeringMode ?? "one-at-a-time";
|
|
165
|
+
this.followUpQueueMode = options.followUpMode ?? "one-at-a-time";
|
|
166
|
+
}
|
|
167
|
+
getHandlers(type) {
|
|
168
|
+
return this.handlers.get(type);
|
|
169
|
+
}
|
|
170
|
+
async emitOwn(event, signal) {
|
|
171
|
+
for (const listener of this.getHandlers(SUBSCRIBER_EVENT_TYPE) ?? []) {
|
|
172
|
+
try {
|
|
173
|
+
await listener(event, signal);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
throw normalizeHookError(error);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async emitAny(event, signal) {
|
|
181
|
+
for (const listener of this.getHandlers(SUBSCRIBER_EVENT_TYPE) ?? []) {
|
|
182
|
+
try {
|
|
183
|
+
await listener(event, signal);
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
throw normalizeHookError(error);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async emitHook(event) {
|
|
191
|
+
const handlers = this.getHandlers(event.type);
|
|
192
|
+
if (!handlers || handlers.size === 0)
|
|
193
|
+
return undefined;
|
|
194
|
+
let lastResult;
|
|
195
|
+
for (const handler of handlers) {
|
|
196
|
+
try {
|
|
197
|
+
const result = await handler(event);
|
|
198
|
+
if (result !== undefined) {
|
|
199
|
+
lastResult = result;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
throw normalizeHookError(error);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return lastResult;
|
|
207
|
+
}
|
|
208
|
+
async emitBeforeProviderRequest(model, sessionId, streamOptions) {
|
|
209
|
+
const handlers = this.getHandlers("before_provider_request");
|
|
210
|
+
let current = cloneStreamOptions(streamOptions);
|
|
211
|
+
if (!handlers || handlers.size === 0)
|
|
212
|
+
return current;
|
|
213
|
+
for (const handler of handlers) {
|
|
214
|
+
try {
|
|
215
|
+
const result = await handler({
|
|
216
|
+
type: "before_provider_request",
|
|
217
|
+
model,
|
|
218
|
+
sessionId,
|
|
219
|
+
streamOptions: cloneStreamOptions(current),
|
|
220
|
+
});
|
|
221
|
+
if (result?.streamOptions) {
|
|
222
|
+
current = applyStreamOptionsPatch(current, result.streamOptions);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
throw normalizeHookError(error);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return current;
|
|
230
|
+
}
|
|
231
|
+
async emitBeforeProviderPayload(model, payload) {
|
|
232
|
+
const handlers = this.getHandlers("before_provider_payload");
|
|
233
|
+
let current = payload;
|
|
234
|
+
if (!handlers || handlers.size === 0)
|
|
235
|
+
return current;
|
|
236
|
+
for (const handler of handlers) {
|
|
237
|
+
try {
|
|
238
|
+
const result = await handler({ type: "before_provider_payload", model, payload: current });
|
|
239
|
+
if (result !== undefined) {
|
|
240
|
+
current = result.payload;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
throw normalizeHookError(error);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return current;
|
|
248
|
+
}
|
|
249
|
+
async emitQueueUpdate() {
|
|
250
|
+
await this.emitOwn({
|
|
251
|
+
type: "queue_update",
|
|
252
|
+
steer: [...this.steerQueue],
|
|
253
|
+
followUp: [...this.followUpQueue],
|
|
254
|
+
nextTurn: [...this.nextTurnQueue],
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
startRunPromise() {
|
|
258
|
+
let finish = () => { };
|
|
259
|
+
const runPromise = new Promise((resolve) => {
|
|
260
|
+
finish = resolve;
|
|
261
|
+
});
|
|
262
|
+
this.runPromise = runPromise;
|
|
263
|
+
return {
|
|
264
|
+
runPromise,
|
|
265
|
+
finishRunPromise: () => {
|
|
266
|
+
// A settled/agent_end listener may have started a new run while this
|
|
267
|
+
// one was still unwinding; only clear state still owned by this run.
|
|
268
|
+
if (this.runPromise === runPromise) {
|
|
269
|
+
this.runPromise = undefined;
|
|
270
|
+
}
|
|
271
|
+
finish();
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
async createTurnState() {
|
|
276
|
+
const context = await this.session.buildContext();
|
|
277
|
+
const resources = this.getResources();
|
|
278
|
+
const sessionMetadata = await this.session.getMetadata();
|
|
279
|
+
const tools = [...this.tools.values()];
|
|
280
|
+
const activeTools = this.activeToolNames
|
|
281
|
+
.map((name) => this.tools.get(name))
|
|
282
|
+
.filter((tool) => tool !== undefined);
|
|
283
|
+
let systemPrompt = "You are a helpful assistant.";
|
|
284
|
+
if (typeof this.systemPrompt === "string") {
|
|
285
|
+
systemPrompt = this.systemPrompt;
|
|
286
|
+
}
|
|
287
|
+
else if (this.systemPrompt) {
|
|
288
|
+
systemPrompt = await this.systemPrompt({
|
|
289
|
+
env: this.env,
|
|
290
|
+
session: this.session,
|
|
291
|
+
model: this.model,
|
|
292
|
+
thinkingLevel: this.thinkingLevel,
|
|
293
|
+
activeTools,
|
|
294
|
+
resources,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
messages: context.messages,
|
|
299
|
+
resources,
|
|
300
|
+
streamOptions: cloneStreamOptions(this.streamOptions),
|
|
301
|
+
sessionId: sessionMetadata.id,
|
|
302
|
+
systemPrompt,
|
|
303
|
+
model: this.model,
|
|
304
|
+
thinkingLevel: this.thinkingLevel,
|
|
305
|
+
tools,
|
|
306
|
+
activeTools,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
createContext(turnState, systemPrompt) {
|
|
310
|
+
return {
|
|
311
|
+
systemPrompt: systemPrompt ?? turnState.systemPrompt,
|
|
312
|
+
messages: turnState.messages.slice(),
|
|
313
|
+
tools: turnState.activeTools.slice(),
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
createStreamFn(getTurnState) {
|
|
317
|
+
return async (model, context, streamOptions) => {
|
|
318
|
+
const turnState = getTurnState();
|
|
319
|
+
const auth = await this.getApiKeyAndHeaders?.(model);
|
|
320
|
+
const snapshotOptions = {
|
|
321
|
+
...turnState.streamOptions,
|
|
322
|
+
headers: mergeHeaders(turnState.streamOptions.headers, auth?.headers),
|
|
323
|
+
};
|
|
324
|
+
const requestOptions = await this.emitBeforeProviderRequest(model, turnState.sessionId, snapshotOptions);
|
|
325
|
+
return streamSimple(model, context, {
|
|
326
|
+
cacheRetention: requestOptions.cacheRetention,
|
|
327
|
+
headers: requestOptions.headers,
|
|
328
|
+
maxRetries: requestOptions.maxRetries,
|
|
329
|
+
maxRetryDelayMs: requestOptions.maxRetryDelayMs,
|
|
330
|
+
metadata: requestOptions.metadata,
|
|
331
|
+
onPayload: async (payload) => await this.emitBeforeProviderPayload(model, payload),
|
|
332
|
+
onResponse: async (response) => {
|
|
333
|
+
const headers = { ...response.headers };
|
|
334
|
+
await this.emitOwn({ type: "after_provider_response", status: response.status, headers }, streamOptions?.signal);
|
|
335
|
+
},
|
|
336
|
+
reasoning: streamOptions?.reasoning,
|
|
337
|
+
signal: streamOptions?.signal,
|
|
338
|
+
sessionId: turnState.sessionId,
|
|
339
|
+
timeoutMs: requestOptions.timeoutMs,
|
|
340
|
+
transport: requestOptions.transport,
|
|
341
|
+
apiKey: auth?.apiKey,
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
async drainQueuedMessages(queue, mode) {
|
|
346
|
+
const messages = mode === "all" ? queue.splice(0) : queue.splice(0, 1);
|
|
347
|
+
if (messages.length === 0)
|
|
348
|
+
return messages;
|
|
349
|
+
try {
|
|
350
|
+
await this.emitQueueUpdate();
|
|
351
|
+
return messages;
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
queue.unshift(...messages);
|
|
355
|
+
throw normalizeHookError(error);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
createLoopConfig(getTurnState, setTurnState) {
|
|
359
|
+
const turnState = getTurnState();
|
|
360
|
+
return {
|
|
361
|
+
model: turnState.model,
|
|
362
|
+
reasoning: turnState.thinkingLevel === "off" ? undefined : turnState.thinkingLevel,
|
|
363
|
+
convertToLlm,
|
|
364
|
+
transformContext: async (messages) => {
|
|
365
|
+
const result = await this.emitHook({ type: "context", messages: [...messages] });
|
|
366
|
+
return result?.messages ?? messages;
|
|
367
|
+
},
|
|
368
|
+
beforeToolCall: async ({ toolCall, args }) => {
|
|
369
|
+
const result = await this.emitHook({
|
|
370
|
+
type: "tool_call",
|
|
371
|
+
toolCallId: toolCall.id,
|
|
372
|
+
toolName: toolCall.name,
|
|
373
|
+
input: args,
|
|
374
|
+
});
|
|
375
|
+
return result ? { block: result.block, reason: result.reason } : undefined;
|
|
376
|
+
},
|
|
377
|
+
afterToolCall: async ({ toolCall, args, result, isError }) => {
|
|
378
|
+
const patch = await this.emitHook({
|
|
379
|
+
type: "tool_result",
|
|
380
|
+
toolCallId: toolCall.id,
|
|
381
|
+
toolName: toolCall.name,
|
|
382
|
+
input: args,
|
|
383
|
+
content: result.content,
|
|
384
|
+
details: result.details,
|
|
385
|
+
isError,
|
|
386
|
+
});
|
|
387
|
+
return patch
|
|
388
|
+
? { content: patch.content, details: patch.details, isError: patch.isError, terminate: patch.terminate }
|
|
389
|
+
: undefined;
|
|
390
|
+
},
|
|
391
|
+
prepareNextTurn: async () => {
|
|
392
|
+
await this.flushPendingSessionWrites();
|
|
393
|
+
const nextTurnState = await this.createTurnState();
|
|
394
|
+
setTurnState(nextTurnState);
|
|
395
|
+
return {
|
|
396
|
+
context: this.createContext(nextTurnState),
|
|
397
|
+
model: nextTurnState.model,
|
|
398
|
+
thinkingLevel: nextTurnState.thinkingLevel,
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
getSteeringMessages: async () => this.drainQueuedMessages(this.steerQueue, this.steeringQueueMode),
|
|
402
|
+
getFollowUpMessages: async () => this.drainQueuedMessages(this.followUpQueue, this.followUpQueueMode),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
validateUniqueNames(names, message) {
|
|
406
|
+
const duplicates = findDuplicateNames(names);
|
|
407
|
+
if (duplicates.length > 0)
|
|
408
|
+
throw new AgentHarnessError("invalid_argument", `${message}: ${duplicates.join(", ")}`);
|
|
409
|
+
}
|
|
410
|
+
validateToolNames(toolNames, tools = this.tools) {
|
|
411
|
+
this.validateUniqueNames(toolNames, "Duplicate active tool name(s)");
|
|
412
|
+
const missing = toolNames.filter((name) => !tools.has(name));
|
|
413
|
+
if (missing.length > 0)
|
|
414
|
+
throw new AgentHarnessError("invalid_argument", `Unknown tool(s): ${missing.join(", ")}`);
|
|
415
|
+
}
|
|
416
|
+
async flushPendingSessionWrites() {
|
|
417
|
+
while (this.pendingSessionWrites.length > 0) {
|
|
418
|
+
const write = this.pendingSessionWrites[0];
|
|
419
|
+
if (write.type === "message") {
|
|
420
|
+
await this.session.appendMessage(write.message);
|
|
421
|
+
}
|
|
422
|
+
else if (write.type === "model_change") {
|
|
423
|
+
await this.session.appendModelChange(write.provider, write.modelId);
|
|
424
|
+
}
|
|
425
|
+
else if (write.type === "thinking_level_change") {
|
|
426
|
+
await this.session.appendThinkingLevelChange(write.thinkingLevel);
|
|
427
|
+
}
|
|
428
|
+
else if (write.type === "active_tools_change") {
|
|
429
|
+
await this.session.appendActiveToolsChange(write.activeToolNames);
|
|
430
|
+
}
|
|
431
|
+
else if (write.type === "custom") {
|
|
432
|
+
await this.session.appendCustomEntry(write.customType, write.data);
|
|
433
|
+
}
|
|
434
|
+
else if (write.type === "custom_message") {
|
|
435
|
+
await this.session.appendCustomMessageEntry(write.customType, write.content, write.display, write.details);
|
|
436
|
+
}
|
|
437
|
+
else if (write.type === "label") {
|
|
438
|
+
await this.session.appendLabel(write.targetId, write.label);
|
|
439
|
+
}
|
|
440
|
+
else if (write.type === "session_info") {
|
|
441
|
+
await this.session.appendSessionName(write.name ?? "");
|
|
442
|
+
}
|
|
443
|
+
else if (write.type === "leaf") {
|
|
444
|
+
await this.session.getStorage().setLeafId(write.targetId);
|
|
445
|
+
}
|
|
446
|
+
this.pendingSessionWrites.shift();
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
async handleAgentEvent(event, signal) {
|
|
450
|
+
if (event.type === "message_end") {
|
|
451
|
+
await this.session.appendMessage(event.message);
|
|
452
|
+
await this.emitAny(event, signal);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (event.type === "turn_end") {
|
|
456
|
+
let eventError;
|
|
457
|
+
try {
|
|
458
|
+
await this.emitAny(event, signal);
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
eventError = error;
|
|
462
|
+
}
|
|
463
|
+
const hadPendingMutations = this.pendingSessionWrites.length > 0;
|
|
464
|
+
await this.flushPendingSessionWrites();
|
|
465
|
+
if (eventError)
|
|
466
|
+
throw eventError;
|
|
467
|
+
await this.emitOwn({ type: "save_point", hadPendingMutations });
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (event.type === "agent_end") {
|
|
471
|
+
// Finish this run's cleanup before flipping to "idle": listeners observing
|
|
472
|
+
// agent_end/settled may start the next prompt() immediately, and that run
|
|
473
|
+
// must not inherit state still owned by the run that just completed.
|
|
474
|
+
await this.flushPendingSessionWrites();
|
|
475
|
+
if (this.runAbortController && this.runAbortController.signal === signal) {
|
|
476
|
+
this.runAbortController = undefined;
|
|
477
|
+
}
|
|
478
|
+
this.phase = "idle";
|
|
479
|
+
await this.emitAny(event, signal);
|
|
480
|
+
await this.emitOwn({ type: "settled", nextTurnCount: this.nextTurnQueue.length }, signal);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
await this.emitAny(event, signal);
|
|
484
|
+
}
|
|
485
|
+
async emitRunFailure(model, error, aborted, signal, completedMessages) {
|
|
486
|
+
const failureMessage = createFailureMessage(model, error, aborted);
|
|
487
|
+
const messages = [...completedMessages, failureMessage];
|
|
488
|
+
await this.handleAgentEvent({ type: "message_start", message: failureMessage }, signal);
|
|
489
|
+
await this.handleAgentEvent({ type: "message_end", message: failureMessage }, signal);
|
|
490
|
+
await this.handleAgentEvent({ type: "turn_end", message: failureMessage, toolResults: [] }, signal);
|
|
491
|
+
await this.handleAgentEvent({ type: "agent_end", messages }, signal);
|
|
492
|
+
return messages;
|
|
493
|
+
}
|
|
494
|
+
async executeTurn(turnState, text, options) {
|
|
495
|
+
let activeTurnState = turnState;
|
|
496
|
+
let messages = [createUserMessage(text, options?.images)];
|
|
497
|
+
if (this.nextTurnQueue.length > 0) {
|
|
498
|
+
const queuedMessages = this.nextTurnQueue.splice(0);
|
|
499
|
+
try {
|
|
500
|
+
await this.emitQueueUpdate();
|
|
501
|
+
}
|
|
502
|
+
catch (error) {
|
|
503
|
+
this.nextTurnQueue.unshift(...queuedMessages);
|
|
504
|
+
throw normalizeHookError(error);
|
|
505
|
+
}
|
|
506
|
+
messages = [...queuedMessages, messages[0]];
|
|
507
|
+
}
|
|
508
|
+
const beforeResult = await this.emitHook({
|
|
509
|
+
type: "before_agent_start",
|
|
510
|
+
prompt: text,
|
|
511
|
+
images: options?.images,
|
|
512
|
+
systemPrompt: turnState.systemPrompt,
|
|
513
|
+
resources: turnState.resources,
|
|
514
|
+
});
|
|
515
|
+
if (beforeResult?.messages)
|
|
516
|
+
messages = [...messages, ...beforeResult.messages];
|
|
517
|
+
const abortController = new AbortController();
|
|
518
|
+
const getTurnState = () => activeTurnState;
|
|
519
|
+
const setTurnState = (nextTurnState) => {
|
|
520
|
+
activeTurnState = nextTurnState;
|
|
521
|
+
};
|
|
522
|
+
this.runAbortController = abortController;
|
|
523
|
+
const completedMessages = [];
|
|
524
|
+
const runResultPromise = (async () => {
|
|
525
|
+
try {
|
|
526
|
+
return await runAgentLoop(messages, this.createContext(turnState, beforeResult?.systemPrompt), this.createLoopConfig(getTurnState, setTurnState), async (event) => {
|
|
527
|
+
if (event.type === "message_end")
|
|
528
|
+
completedMessages.push(event.message);
|
|
529
|
+
await this.handleAgentEvent(event, abortController.signal);
|
|
530
|
+
}, abortController.signal, this.createStreamFn(getTurnState));
|
|
531
|
+
}
|
|
532
|
+
catch (error) {
|
|
533
|
+
try {
|
|
534
|
+
return await this.emitRunFailure(activeTurnState.model, error, abortController.signal.aborted, abortController.signal, completedMessages);
|
|
535
|
+
}
|
|
536
|
+
catch (failureError) {
|
|
537
|
+
const cause = new AggregateError([toError(error), toError(failureError)], "Agent run failed and failure reporting failed");
|
|
538
|
+
throw new AgentHarnessError("unknown", cause.message, cause);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
})();
|
|
542
|
+
try {
|
|
543
|
+
const newMessages = await runResultPromise;
|
|
544
|
+
for (let i = newMessages.length - 1; i >= 0; i--) {
|
|
545
|
+
const message = newMessages[i];
|
|
546
|
+
if (message.role === "assistant") {
|
|
547
|
+
return message;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
throw new AgentHarnessError("invalid_state", "AgentHarness prompt completed without an assistant message");
|
|
551
|
+
}
|
|
552
|
+
finally {
|
|
553
|
+
try {
|
|
554
|
+
await this.flushPendingSessionWrites();
|
|
555
|
+
}
|
|
556
|
+
finally {
|
|
557
|
+
// Ownership check: a re-entrant run started from a settled/agent_end
|
|
558
|
+
// listener may have installed its own controller already.
|
|
559
|
+
if (this.runAbortController === abortController) {
|
|
560
|
+
this.runAbortController = undefined;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
async prompt(text, options) {
|
|
566
|
+
if (this.phase !== "idle")
|
|
567
|
+
throw new AgentHarnessError("busy", "AgentHarness is busy");
|
|
568
|
+
this.phase = "turn";
|
|
569
|
+
const { runPromise, finishRunPromise } = this.startRunPromise();
|
|
570
|
+
try {
|
|
571
|
+
const turnState = await this.createTurnState();
|
|
572
|
+
return await this.executeTurn(turnState, text, options);
|
|
573
|
+
}
|
|
574
|
+
catch (error) {
|
|
575
|
+
// Only reset the phase if this call still owns the run; a listener may
|
|
576
|
+
// have started the next run while this one was unwinding.
|
|
577
|
+
if (this.runPromise === runPromise)
|
|
578
|
+
this.phase = "idle";
|
|
579
|
+
throw normalizeHarnessError(error, "unknown");
|
|
580
|
+
}
|
|
581
|
+
finally {
|
|
582
|
+
finishRunPromise();
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
async skill(name, additionalInstructions) {
|
|
586
|
+
if (this.phase !== "idle")
|
|
587
|
+
throw new AgentHarnessError("busy", "AgentHarness is busy");
|
|
588
|
+
this.phase = "turn";
|
|
589
|
+
const { runPromise, finishRunPromise } = this.startRunPromise();
|
|
590
|
+
try {
|
|
591
|
+
const turnState = await this.createTurnState();
|
|
592
|
+
const skill = (turnState.resources.skills ?? []).find((candidate) => candidate.name === name);
|
|
593
|
+
if (!skill)
|
|
594
|
+
throw new AgentHarnessError("invalid_argument", `Unknown skill: ${name}`);
|
|
595
|
+
return await this.executeTurn(turnState, formatSkillInvocation(skill, additionalInstructions));
|
|
596
|
+
}
|
|
597
|
+
catch (error) {
|
|
598
|
+
if (this.runPromise === runPromise)
|
|
599
|
+
this.phase = "idle";
|
|
600
|
+
throw normalizeHarnessError(error, "unknown");
|
|
601
|
+
}
|
|
602
|
+
finally {
|
|
603
|
+
finishRunPromise();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
async promptFromTemplate(name, args = []) {
|
|
607
|
+
if (this.phase !== "idle")
|
|
608
|
+
throw new AgentHarnessError("busy", "AgentHarness is busy");
|
|
609
|
+
this.phase = "turn";
|
|
610
|
+
const { runPromise, finishRunPromise } = this.startRunPromise();
|
|
611
|
+
try {
|
|
612
|
+
const turnState = await this.createTurnState();
|
|
613
|
+
const template = (turnState.resources.promptTemplates ?? []).find((candidate) => candidate.name === name);
|
|
614
|
+
if (!template)
|
|
615
|
+
throw new AgentHarnessError("invalid_argument", `Unknown prompt template: ${name}`);
|
|
616
|
+
return await this.executeTurn(turnState, formatPromptTemplateInvocation(template, args));
|
|
617
|
+
}
|
|
618
|
+
catch (error) {
|
|
619
|
+
if (this.runPromise === runPromise)
|
|
620
|
+
this.phase = "idle";
|
|
621
|
+
throw normalizeHarnessError(error, "unknown");
|
|
622
|
+
}
|
|
623
|
+
finally {
|
|
624
|
+
finishRunPromise();
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
async steer(text, options) {
|
|
628
|
+
if (this.phase === "idle")
|
|
629
|
+
throw new AgentHarnessError("invalid_state", "Cannot steer while idle");
|
|
630
|
+
this.steerQueue.push(createUserMessage(text, options?.images));
|
|
631
|
+
await this.emitQueueUpdate();
|
|
632
|
+
}
|
|
633
|
+
async followUp(text, options) {
|
|
634
|
+
if (this.phase === "idle")
|
|
635
|
+
throw new AgentHarnessError("invalid_state", "Cannot follow up while idle");
|
|
636
|
+
this.followUpQueue.push(createUserMessage(text, options?.images));
|
|
637
|
+
await this.emitQueueUpdate();
|
|
638
|
+
}
|
|
639
|
+
async nextTurn(text, options) {
|
|
640
|
+
this.nextTurnQueue.push(createUserMessage(text, options?.images));
|
|
641
|
+
await this.emitQueueUpdate();
|
|
642
|
+
}
|
|
643
|
+
async appendMessage(message) {
|
|
644
|
+
try {
|
|
645
|
+
if (this.phase === "idle") {
|
|
646
|
+
await this.session.appendMessage(message);
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
this.pendingSessionWrites.push({ type: "message", message });
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
catch (error) {
|
|
653
|
+
throw normalizeHarnessError(error, "session");
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
async compact(customInstructions) {
|
|
657
|
+
if (this.phase !== "idle")
|
|
658
|
+
throw new AgentHarnessError("busy", "compact() requires idle harness");
|
|
659
|
+
this.phase = "compaction";
|
|
660
|
+
try {
|
|
661
|
+
const model = this.model;
|
|
662
|
+
if (!model)
|
|
663
|
+
throw new AgentHarnessError("invalid_state", "No model set for compaction");
|
|
664
|
+
const auth = await this.getApiKeyAndHeaders?.(model);
|
|
665
|
+
if (!auth)
|
|
666
|
+
throw new AgentHarnessError("auth", "No auth available for compaction");
|
|
667
|
+
const branchEntries = await this.session.getBranch();
|
|
668
|
+
const preparationResult = prepareCompaction(branchEntries, DEFAULT_COMPACTION_SETTINGS);
|
|
669
|
+
if (!preparationResult.ok)
|
|
670
|
+
throw preparationResult.error;
|
|
671
|
+
const preparation = preparationResult.value;
|
|
672
|
+
if (!preparation)
|
|
673
|
+
throw new AgentHarnessError("compaction", "Nothing to compact");
|
|
674
|
+
const hookResult = await this.emitHook({
|
|
675
|
+
type: "session_before_compact",
|
|
676
|
+
preparation,
|
|
677
|
+
branchEntries,
|
|
678
|
+
customInstructions,
|
|
679
|
+
signal: new AbortController().signal,
|
|
680
|
+
});
|
|
681
|
+
if (hookResult?.cancel)
|
|
682
|
+
throw new AgentHarnessError("compaction", "Compaction cancelled");
|
|
683
|
+
const provided = hookResult?.compaction;
|
|
684
|
+
const compactResult = provided
|
|
685
|
+
? { ok: true, value: provided }
|
|
686
|
+
: await compact(preparation, model, auth.apiKey, auth.headers, customInstructions, undefined, this.thinkingLevel);
|
|
687
|
+
if (!compactResult.ok)
|
|
688
|
+
throw compactResult.error;
|
|
689
|
+
const result = compactResult.value;
|
|
690
|
+
const entryId = await this.session.appendCompaction(result.summary, result.firstKeptEntryId, result.tokensBefore, result.details, provided !== undefined);
|
|
691
|
+
const entry = await this.session.getEntry(entryId);
|
|
692
|
+
if (entry?.type === "compaction") {
|
|
693
|
+
await this.emitOwn({ type: "session_compact", compactionEntry: entry, fromHook: provided !== undefined });
|
|
694
|
+
}
|
|
695
|
+
return result;
|
|
696
|
+
}
|
|
697
|
+
catch (error) {
|
|
698
|
+
throw normalizeHarnessError(error, "compaction");
|
|
699
|
+
}
|
|
700
|
+
finally {
|
|
701
|
+
this.phase = "idle";
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
async navigateTree(targetId, options) {
|
|
705
|
+
if (this.phase !== "idle")
|
|
706
|
+
throw new AgentHarnessError("busy", "navigateTree() requires idle harness");
|
|
707
|
+
this.phase = "branch_summary";
|
|
708
|
+
try {
|
|
709
|
+
const oldLeafId = await this.session.getLeafId();
|
|
710
|
+
if (oldLeafId === targetId)
|
|
711
|
+
return { cancelled: false };
|
|
712
|
+
const targetEntry = await this.session.getEntry(targetId);
|
|
713
|
+
if (!targetEntry)
|
|
714
|
+
throw new AgentHarnessError("invalid_argument", `Entry ${targetId} not found`);
|
|
715
|
+
const { entries, commonAncestorId } = await collectEntriesForBranchSummary(this.session, oldLeafId, targetId);
|
|
716
|
+
const preparation = {
|
|
717
|
+
targetId,
|
|
718
|
+
oldLeafId,
|
|
719
|
+
commonAncestorId,
|
|
720
|
+
entriesToSummarize: entries,
|
|
721
|
+
userWantsSummary: options?.summarize ?? false,
|
|
722
|
+
customInstructions: options?.customInstructions,
|
|
723
|
+
replaceInstructions: options?.replaceInstructions,
|
|
724
|
+
label: options?.label,
|
|
725
|
+
};
|
|
726
|
+
const signal = new AbortController().signal;
|
|
727
|
+
const hookResult = await this.emitHook({ type: "session_before_tree", preparation, signal });
|
|
728
|
+
if (hookResult?.cancel)
|
|
729
|
+
return { cancelled: true };
|
|
730
|
+
let summaryEntry;
|
|
731
|
+
let summaryText = hookResult?.summary?.summary;
|
|
732
|
+
let summaryDetails = hookResult?.summary?.details;
|
|
733
|
+
if (!summaryText && options?.summarize && entries.length > 0) {
|
|
734
|
+
const model = this.model;
|
|
735
|
+
if (!model)
|
|
736
|
+
throw new AgentHarnessError("invalid_state", "No model set for branch summary");
|
|
737
|
+
const auth = await this.getApiKeyAndHeaders?.(model);
|
|
738
|
+
if (!auth)
|
|
739
|
+
throw new AgentHarnessError("auth", "No auth available for branch summary");
|
|
740
|
+
const branchSummary = await generateBranchSummary(entries, {
|
|
741
|
+
model,
|
|
742
|
+
apiKey: auth.apiKey,
|
|
743
|
+
headers: auth.headers,
|
|
744
|
+
signal: new AbortController().signal,
|
|
745
|
+
customInstructions: hookResult?.customInstructions ?? options?.customInstructions,
|
|
746
|
+
replaceInstructions: hookResult?.replaceInstructions ?? options?.replaceInstructions,
|
|
747
|
+
});
|
|
748
|
+
if (!branchSummary.ok) {
|
|
749
|
+
if (branchSummary.error.code === "aborted")
|
|
750
|
+
return { cancelled: true };
|
|
751
|
+
throw new AgentHarnessError("branch_summary", branchSummary.error.message, branchSummary.error);
|
|
752
|
+
}
|
|
753
|
+
summaryText = branchSummary.value.summary;
|
|
754
|
+
summaryDetails = {
|
|
755
|
+
readFiles: branchSummary.value.readFiles,
|
|
756
|
+
modifiedFiles: branchSummary.value.modifiedFiles,
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
let editorText;
|
|
760
|
+
let newLeafId;
|
|
761
|
+
if (targetEntry.type === "message" && targetEntry.message.role === "user") {
|
|
762
|
+
newLeafId = targetEntry.parentId;
|
|
763
|
+
const content = targetEntry.message.content;
|
|
764
|
+
editorText =
|
|
765
|
+
typeof content === "string"
|
|
766
|
+
? content
|
|
767
|
+
: content
|
|
768
|
+
.filter((c) => c.type === "text")
|
|
769
|
+
.map((c) => c.text)
|
|
770
|
+
.join("");
|
|
771
|
+
}
|
|
772
|
+
else if (targetEntry.type === "custom_message") {
|
|
773
|
+
newLeafId = targetEntry.parentId;
|
|
774
|
+
editorText =
|
|
775
|
+
typeof targetEntry.content === "string"
|
|
776
|
+
? targetEntry.content
|
|
777
|
+
: targetEntry.content
|
|
778
|
+
.filter((c) => c.type === "text")
|
|
779
|
+
.map((c) => c.text)
|
|
780
|
+
.join("");
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
newLeafId = targetId;
|
|
784
|
+
}
|
|
785
|
+
const summaryId = await this.session.moveTo(newLeafId, summaryText
|
|
786
|
+
? { summary: summaryText, details: summaryDetails, fromHook: hookResult?.summary !== undefined }
|
|
787
|
+
: undefined);
|
|
788
|
+
if (summaryId) {
|
|
789
|
+
const entry = await this.session.getEntry(summaryId);
|
|
790
|
+
if (entry?.type === "branch_summary")
|
|
791
|
+
summaryEntry = entry;
|
|
792
|
+
}
|
|
793
|
+
await this.emitOwn({
|
|
794
|
+
type: "session_tree",
|
|
795
|
+
newLeafId: await this.session.getLeafId(),
|
|
796
|
+
oldLeafId,
|
|
797
|
+
summaryEntry,
|
|
798
|
+
fromHook: hookResult?.summary !== undefined,
|
|
799
|
+
});
|
|
800
|
+
return { cancelled: false, editorText, summaryEntry };
|
|
801
|
+
}
|
|
802
|
+
catch (error) {
|
|
803
|
+
throw normalizeHarnessError(error, "branch_summary");
|
|
804
|
+
}
|
|
805
|
+
finally {
|
|
806
|
+
this.phase = "idle";
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
getModel() {
|
|
810
|
+
return this.model;
|
|
811
|
+
}
|
|
812
|
+
async setModel(model) {
|
|
813
|
+
try {
|
|
814
|
+
const previousModel = this.model;
|
|
815
|
+
if (this.phase === "idle") {
|
|
816
|
+
await this.session.appendModelChange(model.provider, model.id);
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
this.pendingSessionWrites.push({ type: "model_change", provider: model.provider, modelId: model.id });
|
|
820
|
+
}
|
|
821
|
+
this.model = model;
|
|
822
|
+
await this.emitOwn({ type: "model_update", model, previousModel, source: "set" });
|
|
823
|
+
}
|
|
824
|
+
catch (error) {
|
|
825
|
+
throw normalizeHarnessError(error, "session");
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
getThinkingLevel() {
|
|
829
|
+
return this.thinkingLevel;
|
|
830
|
+
}
|
|
831
|
+
async setThinkingLevel(level) {
|
|
832
|
+
try {
|
|
833
|
+
const previousLevel = this.thinkingLevel;
|
|
834
|
+
if (this.phase === "idle") {
|
|
835
|
+
await this.session.appendThinkingLevelChange(level);
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
this.pendingSessionWrites.push({ type: "thinking_level_change", thinkingLevel: level });
|
|
839
|
+
}
|
|
840
|
+
this.thinkingLevel = level;
|
|
841
|
+
await this.emitOwn({ type: "thinking_level_update", level, previousLevel });
|
|
842
|
+
}
|
|
843
|
+
catch (error) {
|
|
844
|
+
throw normalizeHarnessError(error, "session");
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
getTools() {
|
|
848
|
+
return [...this.tools.values()];
|
|
849
|
+
}
|
|
850
|
+
async setTools(tools, activeToolNames) {
|
|
851
|
+
try {
|
|
852
|
+
this.validateUniqueNames(tools.map((tool) => tool.name), "Duplicate tool name(s)");
|
|
853
|
+
const nextTools = new Map(tools.map((tool) => [tool.name, tool]));
|
|
854
|
+
const nextActiveToolNames = activeToolNames ? [...activeToolNames] : this.activeToolNames;
|
|
855
|
+
this.validateToolNames(nextActiveToolNames, nextTools);
|
|
856
|
+
const previousToolNames = [...this.tools.keys()];
|
|
857
|
+
const previousActiveToolNames = [...this.activeToolNames];
|
|
858
|
+
if (this.phase === "idle") {
|
|
859
|
+
await this.session.appendActiveToolsChange(nextActiveToolNames);
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
this.pendingSessionWrites.push({ type: "active_tools_change", activeToolNames: [...nextActiveToolNames] });
|
|
863
|
+
}
|
|
864
|
+
this.tools = nextTools;
|
|
865
|
+
this.activeToolNames = [...nextActiveToolNames];
|
|
866
|
+
await this.emitOwn({
|
|
867
|
+
type: "tools_update",
|
|
868
|
+
toolNames: [...this.tools.keys()],
|
|
869
|
+
previousToolNames,
|
|
870
|
+
activeToolNames: [...this.activeToolNames],
|
|
871
|
+
previousActiveToolNames,
|
|
872
|
+
source: "set",
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
catch (error) {
|
|
876
|
+
throw normalizeHarnessError(error, "invalid_argument");
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
getActiveTools() {
|
|
880
|
+
return this.activeToolNames.map((name) => this.tools.get(name));
|
|
881
|
+
}
|
|
882
|
+
async setActiveTools(toolNames) {
|
|
883
|
+
try {
|
|
884
|
+
this.validateToolNames(toolNames);
|
|
885
|
+
const previousToolNames = [...this.tools.keys()];
|
|
886
|
+
const previousActiveToolNames = [...this.activeToolNames];
|
|
887
|
+
if (this.phase === "idle") {
|
|
888
|
+
await this.session.appendActiveToolsChange(toolNames);
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
this.pendingSessionWrites.push({ type: "active_tools_change", activeToolNames: [...toolNames] });
|
|
892
|
+
}
|
|
893
|
+
this.activeToolNames = [...toolNames];
|
|
894
|
+
await this.emitOwn({
|
|
895
|
+
type: "tools_update",
|
|
896
|
+
toolNames: [...this.tools.keys()],
|
|
897
|
+
previousToolNames,
|
|
898
|
+
activeToolNames: [...this.activeToolNames],
|
|
899
|
+
previousActiveToolNames,
|
|
900
|
+
source: "set",
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
catch (error) {
|
|
904
|
+
throw normalizeHarnessError(error, "invalid_argument");
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
getSteeringMode() {
|
|
908
|
+
return this.steeringQueueMode;
|
|
909
|
+
}
|
|
910
|
+
async setSteeringMode(mode) {
|
|
911
|
+
this.steeringQueueMode = mode;
|
|
912
|
+
}
|
|
913
|
+
getFollowUpMode() {
|
|
914
|
+
return this.followUpQueueMode;
|
|
915
|
+
}
|
|
916
|
+
async setFollowUpMode(mode) {
|
|
917
|
+
this.followUpQueueMode = mode;
|
|
918
|
+
}
|
|
919
|
+
getResources() {
|
|
920
|
+
return {
|
|
921
|
+
skills: this.resources.skills?.slice(),
|
|
922
|
+
promptTemplates: this.resources.promptTemplates?.slice(),
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
async setResources(resources) {
|
|
926
|
+
const previousResources = this.getResources();
|
|
927
|
+
this.resources = {
|
|
928
|
+
skills: resources.skills?.slice(),
|
|
929
|
+
promptTemplates: resources.promptTemplates?.slice(),
|
|
930
|
+
};
|
|
931
|
+
await this.emitOwn({ type: "resources_update", resources: this.getResources(), previousResources });
|
|
932
|
+
}
|
|
933
|
+
getStreamOptions() {
|
|
934
|
+
return cloneStreamOptions(this.streamOptions);
|
|
935
|
+
}
|
|
936
|
+
async setStreamOptions(streamOptions) {
|
|
937
|
+
this.streamOptions = cloneStreamOptions(streamOptions);
|
|
938
|
+
}
|
|
939
|
+
async abort() {
|
|
940
|
+
const clearedSteer = [...this.steerQueue];
|
|
941
|
+
const clearedFollowUp = [...this.followUpQueue];
|
|
942
|
+
this.steerQueue = [];
|
|
943
|
+
this.followUpQueue = [];
|
|
944
|
+
this.runAbortController?.abort();
|
|
945
|
+
const errors = [];
|
|
946
|
+
try {
|
|
947
|
+
await this.emitQueueUpdate();
|
|
948
|
+
}
|
|
949
|
+
catch (error) {
|
|
950
|
+
errors.push(toError(error));
|
|
951
|
+
}
|
|
952
|
+
try {
|
|
953
|
+
await this.waitForIdle();
|
|
954
|
+
}
|
|
955
|
+
catch (error) {
|
|
956
|
+
errors.push(toError(error));
|
|
957
|
+
}
|
|
958
|
+
try {
|
|
959
|
+
await this.emitOwn({ type: "abort", clearedSteer, clearedFollowUp });
|
|
960
|
+
}
|
|
961
|
+
catch (error) {
|
|
962
|
+
errors.push(toError(error));
|
|
963
|
+
}
|
|
964
|
+
if (errors.length > 0) {
|
|
965
|
+
const cause = errors.length === 1 ? errors[0] : new AggregateError(errors, "Abort completed with errors");
|
|
966
|
+
throw normalizeHarnessError(cause, "hook");
|
|
967
|
+
}
|
|
968
|
+
return { clearedSteer, clearedFollowUp };
|
|
969
|
+
}
|
|
970
|
+
async waitForIdle() {
|
|
971
|
+
// Runs can chain: a settled listener may start the next prompt() before the
|
|
972
|
+
// previous run's promise resolves, so keep waiting until no run is active.
|
|
973
|
+
while (this.runPromise) {
|
|
974
|
+
await this.runPromise;
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
subscribe(listener) {
|
|
978
|
+
let handlers = this.handlers.get(SUBSCRIBER_EVENT_TYPE);
|
|
979
|
+
if (!handlers) {
|
|
980
|
+
handlers = new Set();
|
|
981
|
+
this.handlers.set(SUBSCRIBER_EVENT_TYPE, handlers);
|
|
982
|
+
}
|
|
983
|
+
handlers.add(listener);
|
|
984
|
+
return () => handlers.delete(listener);
|
|
985
|
+
}
|
|
986
|
+
on(type, handler) {
|
|
987
|
+
let handlers = this.handlers.get(type);
|
|
988
|
+
if (!handlers) {
|
|
989
|
+
handlers = new Set();
|
|
990
|
+
this.handlers.set(type, handlers);
|
|
991
|
+
}
|
|
992
|
+
handlers.add(handler);
|
|
993
|
+
return () => handlers.delete(handler);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
//# sourceMappingURL=agent-harness.js.map
|