open-multi-agent-kit 0.80.7 → 0.90.0
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 +5 -27
- package/README.md +81 -38
- package/dist/agents/jailbreak/index.d.ts +7 -0
- package/dist/agents/jailbreak/index.d.ts.map +1 -0
- package/dist/agents/jailbreak/index.js +7 -0
- package/dist/agents/jailbreak/index.js.map +1 -0
- package/dist/agents/jailbreak/subagent-f.d.ts +44 -0
- package/dist/agents/jailbreak/subagent-f.d.ts.map +1 -0
- package/dist/agents/jailbreak/subagent-f.js +60 -0
- package/dist/agents/jailbreak/subagent-f.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/register-bedrock.js +2 -2
- package/dist/bun/register-bedrock.js.map +1 -1
- package/dist/ci/verify-reporter.d.ts +22 -0
- package/dist/ci/verify-reporter.d.ts.map +1 -0
- package/dist/ci/verify-reporter.js +50 -0
- package/dist/ci/verify-reporter.js.map +1 -0
- package/dist/cli/args.d.ts +4 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +8 -0
- package/dist/cli/args.js.map +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/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/jailbreak-args.d.ts +26 -0
- package/dist/cli/jailbreak-args.d.ts.map +1 -0
- package/dist/cli/jailbreak-args.js +86 -0
- package/dist/cli/jailbreak-args.js.map +1 -0
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/commands/doctor-provider.d.ts +19 -0
- package/dist/commands/doctor-provider.d.ts.map +1 -0
- package/dist/commands/doctor-provider.js +123 -0
- package/dist/commands/doctor-provider.js.map +1 -0
- package/dist/commands/jailbreak.d.ts +49 -0
- package/dist/commands/jailbreak.d.ts.map +1 -0
- package/dist/commands/jailbreak.js +201 -0
- package/dist/commands/jailbreak.js.map +1 -0
- package/dist/config.d.ts +9 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +33 -52
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -2
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +16 -27
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +185 -89
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +3 -6
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +7 -7
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/automation/index.d.ts +359 -0
- package/dist/core/automation/index.d.ts.map +1 -0
- package/dist/core/automation/index.js +665 -0
- package/dist/core/automation/index.js.map +1 -0
- package/dist/core/bash-executor.d.ts +1 -0
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +1 -0
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/browser-use.d.ts +53 -0
- package/dist/core/browser-use.d.ts.map +1 -0
- package/dist/core/browser-use.js +108 -0
- package/dist/core/browser-use.js.map +1 -0
- package/dist/core/command-safety-parser.d.ts +77 -0
- package/dist/core/command-safety-parser.d.ts.map +1 -0
- package/dist/core/command-safety-parser.js +763 -0
- package/dist/core/command-safety-parser.js.map +1 -0
- package/dist/core/command-safety.d.ts.map +1 -1
- package/dist/core/command-safety.js +106 -3
- package/dist/core/command-safety.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +5 -21
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -101
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +21 -656
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +2 -2
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/compactor.d.ts +42 -0
- package/dist/core/compactor.d.ts.map +1 -0
- package/dist/core/compactor.js +131 -0
- package/dist/core/compactor.js.map +1 -0
- package/dist/core/context-budget-compressors.d.ts +50 -0
- package/dist/core/context-budget-compressors.d.ts.map +1 -0
- package/dist/core/context-budget-compressors.js +166 -0
- package/dist/core/context-budget-compressors.js.map +1 -0
- package/dist/core/context-budget-governor-v2.d.ts +7 -0
- package/dist/core/context-budget-governor-v2.d.ts.map +1 -0
- package/dist/core/context-budget-governor-v2.js +7 -0
- package/dist/core/context-budget-governor-v2.js.map +1 -0
- package/dist/core/context-budget-governor.d.ts +67 -0
- package/dist/core/context-budget-governor.d.ts.map +1 -0
- package/dist/core/context-budget-governor.js +224 -0
- package/dist/core/context-budget-governor.js.map +1 -0
- package/dist/core/context-budget-headroom-candidates.d.ts +3 -0
- package/dist/core/context-budget-headroom-candidates.d.ts.map +1 -0
- package/dist/core/context-budget-headroom-candidates.js +85 -0
- package/dist/core/context-budget-headroom-candidates.js.map +1 -0
- package/dist/core/context-budget-headroom-types.d.ts +67 -0
- package/dist/core/context-budget-headroom-types.d.ts.map +1 -0
- package/dist/core/context-budget-headroom-types.js +46 -0
- package/dist/core/context-budget-headroom-types.js.map +1 -0
- package/dist/core/context-budget-headroom.d.ts +5 -0
- package/dist/core/context-budget-headroom.d.ts.map +1 -0
- package/dist/core/context-budget-headroom.js +123 -0
- package/dist/core/context-budget-headroom.js.map +1 -0
- package/dist/core/context-budget-relevance.d.ts +46 -0
- package/dist/core/context-budget-relevance.d.ts.map +1 -0
- package/dist/core/context-budget-relevance.js +329 -0
- package/dist/core/context-budget-relevance.js.map +1 -0
- package/dist/core/context-budget-system-prompt-items.d.ts +19 -0
- package/dist/core/context-budget-system-prompt-items.d.ts.map +1 -0
- package/dist/core/context-budget-system-prompt-items.js +143 -0
- package/dist/core/context-budget-system-prompt-items.js.map +1 -0
- package/dist/core/context-budget-system-prompt.d.ts +31 -0
- package/dist/core/context-budget-system-prompt.d.ts.map +1 -0
- package/dist/core/context-budget-system-prompt.js +87 -0
- package/dist/core/context-budget-system-prompt.js.map +1 -0
- package/dist/core/context-budget-token-counter.d.ts +34 -0
- package/dist/core/context-budget-token-counter.d.ts.map +1 -0
- package/dist/core/context-budget-token-counter.js +315 -0
- package/dist/core/context-budget-token-counter.js.map +1 -0
- package/dist/core/context-budget-v2-coverage.d.ts +5 -0
- package/dist/core/context-budget-v2-coverage.d.ts.map +1 -0
- package/dist/core/context-budget-v2-coverage.js +58 -0
- package/dist/core/context-budget-v2-coverage.js.map +1 -0
- package/dist/core/context-budget-v2-plan-hash.d.ts +12 -0
- package/dist/core/context-budget-v2-plan-hash.d.ts.map +1 -0
- package/dist/core/context-budget-v2-plan-hash.js +38 -0
- package/dist/core/context-budget-v2-plan-hash.js.map +1 -0
- package/dist/core/context-budget-v2-planner.d.ts +3 -0
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -0
- package/dist/core/context-budget-v2-planner.js +143 -0
- package/dist/core/context-budget-v2-planner.js.map +1 -0
- package/dist/core/context-budget-v2-scoring.d.ts +14 -0
- package/dist/core/context-budget-v2-scoring.d.ts.map +1 -0
- package/dist/core/context-budget-v2-scoring.js +114 -0
- package/dist/core/context-budget-v2-scoring.js.map +1 -0
- package/dist/core/context-budget-v2-selection.d.ts +32 -0
- package/dist/core/context-budget-v2-selection.d.ts.map +1 -0
- package/dist/core/context-budget-v2-selection.js +158 -0
- package/dist/core/context-budget-v2-selection.js.map +1 -0
- package/dist/core/context-budget-v2-tiers.d.ts +15 -0
- package/dist/core/context-budget-v2-tiers.d.ts.map +1 -0
- package/dist/core/context-budget-v2-tiers.js +68 -0
- package/dist/core/context-budget-v2-tiers.js.map +1 -0
- package/dist/core/context-budget-v2-types.d.ts +92 -0
- package/dist/core/context-budget-v2-types.d.ts.map +1 -0
- package/dist/core/context-budget-v2-types.js +24 -0
- package/dist/core/context-budget-v2-types.js.map +1 -0
- package/dist/core/defaults.d.ts +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/diagnostics.d.ts +6 -0
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/domain-confidence.d.ts +9 -0
- package/dist/core/domain-confidence.d.ts.map +1 -0
- package/dist/core/domain-confidence.js +39 -0
- package/dist/core/domain-confidence.js.map +1 -0
- package/dist/core/domain-dispatch.d.ts +44 -0
- package/dist/core/domain-dispatch.d.ts.map +1 -0
- package/dist/core/domain-dispatch.js +118 -0
- package/dist/core/domain-dispatch.js.map +1 -0
- package/dist/core/domain-loadouts.d.ts +76 -0
- package/dist/core/domain-loadouts.d.ts.map +1 -0
- package/dist/core/domain-loadouts.js +981 -0
- package/dist/core/domain-loadouts.js.map +1 -0
- package/dist/core/domain-registry.d.ts +7 -0
- package/dist/core/domain-registry.d.ts.map +1 -0
- package/dist/core/domain-registry.js +11 -0
- package/dist/core/domain-registry.js.map +1 -0
- package/dist/core/domain-router.d.ts +16 -0
- package/dist/core/domain-router.d.ts.map +1 -0
- package/dist/core/domain-router.js +24 -0
- package/dist/core/domain-router.js.map +1 -0
- package/dist/core/domain-score.d.ts +13 -0
- package/dist/core/domain-score.d.ts.map +1 -0
- package/dist/core/domain-score.js +48 -0
- package/dist/core/domain-score.js.map +1 -0
- package/dist/core/domain-trigger-match.d.ts +14 -0
- package/dist/core/domain-trigger-match.d.ts.map +1 -0
- package/dist/core/domain-trigger-match.js +51 -0
- package/dist/core/domain-trigger-match.js.map +1 -0
- package/dist/core/domain-types.d.ts +30 -0
- package/dist/core/domain-types.d.ts.map +1 -0
- package/dist/core/domain-types.js +2 -0
- package/dist/core/domain-types.js.map +1 -0
- package/dist/core/exact-cache-policy.d.ts +8 -0
- package/dist/core/exact-cache-policy.d.ts.map +1 -1
- package/dist/core/exact-cache-policy.js +9 -0
- package/dist/core/exact-cache-policy.js.map +1 -1
- package/dist/core/exec.d.ts +0 -2
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +0 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/index.d.ts +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.js +1 -3
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/builtin/command-safety-gate.d.ts +3 -0
- package/dist/core/extensions/builtin/command-safety-gate.d.ts.map +1 -1
- package/dist/core/extensions/builtin/command-safety-gate.js +15 -3
- package/dist/core/extensions/builtin/command-safety-gate.js.map +1 -1
- package/dist/core/extensions/builtin/todo-checklist.d.ts +20 -0
- package/dist/core/extensions/builtin/todo-checklist.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todo-checklist.js +73 -0
- package/dist/core/extensions/builtin/todo-checklist.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 +57 -92
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -3
- 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 +7 -35
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +3 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +4 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/headroom.d.ts +45 -0
- package/dist/core/headroom.d.ts.map +1 -0
- package/dist/core/headroom.js +171 -0
- package/dist/core/headroom.js.map +1 -0
- package/dist/core/hook-inventory.d.ts +4 -2
- package/dist/core/hook-inventory.d.ts.map +1 -1
- package/dist/core/hook-inventory.js +80 -11
- package/dist/core/hook-inventory.js.map +1 -1
- package/dist/core/hooks/fail-closed.d.ts +4 -1
- package/dist/core/hooks/fail-closed.d.ts.map +1 -1
- package/dist/core/hooks/fail-closed.js +79 -5
- package/dist/core/hooks/fail-closed.js.map +1 -1
- package/dist/core/hooks/index.d.ts +2 -2
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/index.js +1 -1
- package/dist/core/hooks/index.js.map +1 -1
- package/dist/core/hooks/types.d.ts +9 -0
- package/dist/core/hooks/types.d.ts.map +1 -1
- package/dist/core/hooks/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -14
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -31
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/lean-ctx.d.ts +99 -0
- package/dist/core/lean-ctx.d.ts.map +1 -0
- package/dist/core/lean-ctx.js +225 -0
- package/dist/core/lean-ctx.js.map +1 -0
- package/dist/core/loadout-compose.d.ts +53 -0
- package/dist/core/loadout-compose.d.ts.map +1 -0
- package/dist/core/loadout-compose.js +172 -0
- package/dist/core/loadout-compose.js.map +1 -0
- package/dist/core/loadout-policy-bridge.d.ts +22 -0
- package/dist/core/loadout-policy-bridge.d.ts.map +1 -0
- package/dist/core/loadout-policy-bridge.js +52 -0
- package/dist/core/loadout-policy-bridge.js.map +1 -0
- package/dist/core/loadout-runtime.d.ts +22 -0
- package/dist/core/loadout-runtime.d.ts.map +1 -1
- package/dist/core/loadout-runtime.js +41 -5
- package/dist/core/loadout-runtime.js.map +1 -1
- package/dist/core/loadout-safety.d.ts +55 -0
- package/dist/core/loadout-safety.d.ts.map +1 -0
- package/dist/core/loadout-safety.js +213 -0
- package/dist/core/loadout-safety.js.map +1 -0
- package/dist/core/loadouts.d.ts +4 -2
- package/dist/core/loadouts.d.ts.map +1 -1
- package/dist/core/loadouts.js +116 -5
- package/dist/core/loadouts.js.map +1 -1
- package/dist/core/loop-gates.d.ts +48 -0
- package/dist/core/loop-gates.d.ts.map +1 -0
- package/dist/core/loop-gates.js +352 -0
- package/dist/core/loop-gates.js.map +1 -0
- package/dist/core/loop-registry.d.ts +77 -0
- package/dist/core/loop-registry.d.ts.map +1 -0
- package/dist/core/loop-registry.js +831 -0
- package/dist/core/loop-registry.js.map +1 -0
- package/dist/core/loop-types.d.ts +194 -0
- package/dist/core/loop-types.d.ts.map +1 -0
- package/dist/core/loop-types.js +2 -0
- package/dist/core/loop-types.js.map +1 -0
- package/dist/core/mcp-inventory.d.ts +7 -0
- package/dist/core/mcp-inventory.d.ts.map +1 -1
- package/dist/core/mcp-inventory.js +5 -1
- package/dist/core/mcp-inventory.js.map +1 -1
- package/dist/core/mcp-presets.d.ts +43 -2
- package/dist/core/mcp-presets.d.ts.map +1 -1
- package/dist/core/mcp-presets.js +298 -2
- package/dist/core/mcp-presets.js.map +1 -1
- package/dist/core/messages.d.ts +3 -3
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/metrics-sampler.d.ts +11 -0
- package/dist/core/metrics-sampler.d.ts.map +1 -1
- package/dist/core/metrics-sampler.js +52 -13
- package/dist/core/metrics-sampler.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -2
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +18 -41
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-gallery-identity.d.ts +7 -0
- package/dist/core/package-gallery-identity.d.ts.map +1 -0
- package/dist/core/package-gallery-identity.js +31 -0
- package/dist/core/package-gallery-identity.js.map +1 -0
- package/dist/core/package-gallery-install.d.ts +6 -0
- package/dist/core/package-gallery-install.d.ts.map +1 -0
- package/dist/core/package-gallery-install.js +59 -0
- package/dist/core/package-gallery-install.js.map +1 -0
- package/dist/core/package-gallery-manifest.d.ts +13 -0
- package/dist/core/package-gallery-manifest.d.ts.map +1 -0
- package/dist/core/package-gallery-manifest.js +183 -0
- package/dist/core/package-gallery-manifest.js.map +1 -0
- package/dist/core/package-gallery-trial.d.ts +4 -0
- package/dist/core/package-gallery-trial.d.ts.map +1 -0
- package/dist/core/package-gallery-trial.js +55 -0
- package/dist/core/package-gallery-trial.js.map +1 -0
- package/dist/core/package-gallery-types.d.ts +71 -0
- package/dist/core/package-gallery-types.d.ts.map +1 -0
- package/dist/core/package-gallery-types.js +2 -0
- package/dist/core/package-gallery-types.js.map +1 -0
- package/dist/core/package-gallery.d.ts +5 -123
- package/dist/core/package-gallery.d.ts.map +1 -1
- package/dist/core/package-gallery.js +5 -391
- package/dist/core/package-gallery.js.map +1 -1
- package/dist/core/package-manager.d.ts +0 -69
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +69 -367
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-procurement.d.ts +4 -4
- package/dist/core/package-procurement.d.ts.map +1 -1
- package/dist/core/package-procurement.js +29 -17
- package/dist/core/package-procurement.js.map +1 -1
- package/dist/core/pi-package-intake-candidates.d.ts +21 -0
- package/dist/core/pi-package-intake-candidates.d.ts.map +1 -0
- package/dist/core/pi-package-intake-candidates.js +109 -0
- package/dist/core/pi-package-intake-candidates.js.map +1 -0
- package/dist/core/pi-package-intake.d.ts +43 -0
- package/dist/core/pi-package-intake.d.ts.map +1 -0
- package/dist/core/pi-package-intake.js +122 -0
- package/dist/core/pi-package-intake.js.map +1 -0
- package/dist/core/provider-attribution.d.ts +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/read-anchors.d.ts +1 -1
- package/dist/core/read-anchors.d.ts.map +1 -1
- package/dist/core/read-anchors.js +1 -1
- package/dist/core/read-anchors.js.map +1 -1
- package/dist/core/recovery-checkpoint.d.ts +2 -2
- package/dist/core/recovery-checkpoint.d.ts.map +1 -1
- package/dist/core/recovery-checkpoint.js +2 -2
- package/dist/core/recovery-checkpoint.js.map +1 -1
- 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 +2 -30
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +12 -20
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +67 -90
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sandbox-policy-v2.d.ts +49 -0
- package/dist/core/sandbox-policy-v2.d.ts.map +1 -0
- package/dist/core/sandbox-policy-v2.js +368 -0
- package/dist/core/sandbox-policy-v2.js.map +1 -0
- package/dist/core/sdk.d.ts +10 -78
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +97 -139
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/semantic-cache-policy.d.ts +7 -1
- package/dist/core/semantic-cache-policy.d.ts.map +1 -1
- package/dist/core/semantic-cache-policy.js +8 -0
- package/dist/core/semantic-cache-policy.js.map +1 -1
- package/dist/core/session-manager.d.ts +2 -4
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +5 -6
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -18
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +2 -48
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +5 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +149 -36
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-orchestration.d.ts +73 -0
- package/dist/core/subagent-orchestration.d.ts.map +1 -0
- package/dist/core/subagent-orchestration.js +408 -0
- package/dist/core/subagent-orchestration.js.map +1 -0
- package/dist/core/system-prompt.d.ts +5 -4
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +57 -36
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +0 -4
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +0 -4
- package/dist/core/timings.js.map +1 -1
- package/dist/core/todo-runtime-state.d.ts +5 -0
- package/dist/core/todo-runtime-state.d.ts.map +1 -0
- package/dist/core/todo-runtime-state.js +12 -0
- package/dist/core/todo-runtime-state.js.map +1 -0
- package/dist/core/todo-state.d.ts +53 -0
- package/dist/core/todo-state.d.ts.map +1 -0
- package/dist/core/todo-state.js +87 -0
- package/dist/core/todo-state.js.map +1 -0
- package/dist/core/token-optimizer.d.ts +58 -0
- package/dist/core/token-optimizer.d.ts.map +1 -0
- package/dist/core/token-optimizer.js +179 -0
- package/dist/core/token-optimizer.js.map +1 -0
- package/dist/core/tools/bash.d.ts +8 -9
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +9 -8
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts +3 -14
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -25
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +1 -4
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -4
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +1 -4
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -5
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -2
- 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 +1 -4
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +1 -4
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +2 -14
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -28
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/write.d.ts +2 -4
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +4 -4
- package/dist/core/tools/write.js.map +1 -1
- package/dist/encoding/index.d.ts +6 -0
- package/dist/encoding/index.d.ts.map +1 -0
- package/dist/encoding/index.js +6 -0
- package/dist/encoding/index.js.map +1 -0
- package/dist/encoding/l4-encoder.d.ts +96 -0
- package/dist/encoding/l4-encoder.d.ts.map +1 -0
- package/dist/encoding/l4-encoder.js +474 -0
- package/dist/encoding/l4-encoder.js.map +1 -0
- package/dist/fuzzing/index.d.ts +6 -0
- package/dist/fuzzing/index.d.ts.map +1 -0
- package/dist/fuzzing/index.js +6 -0
- package/dist/fuzzing/index.js.map +1 -0
- package/dist/fuzzing/mutation-engine.d.ts +93 -0
- package/dist/fuzzing/mutation-engine.d.ts.map +1 -0
- package/dist/fuzzing/mutation-engine.js +244 -0
- package/dist/fuzzing/mutation-engine.js.map +1 -0
- package/dist/guardrails/audit-logger.d.ts +4 -0
- package/dist/guardrails/audit-logger.d.ts.map +1 -0
- package/dist/guardrails/audit-logger.js +28 -0
- package/dist/guardrails/audit-logger.js.map +1 -0
- package/dist/guardrails/evidence-system.d.ts +61 -0
- package/dist/guardrails/evidence-system.d.ts.map +1 -0
- package/dist/guardrails/evidence-system.js +302 -0
- package/dist/guardrails/evidence-system.js.map +1 -0
- package/dist/guardrails/freedomd-adapter.d.ts +16 -0
- package/dist/guardrails/freedomd-adapter.d.ts.map +1 -0
- package/dist/guardrails/freedomd-adapter.js +87 -0
- package/dist/guardrails/freedomd-adapter.js.map +1 -0
- package/dist/index.d.ts +5 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -17
- package/dist/index.js.map +1 -1
- package/dist/jailbreak-extension.d.ts +48 -0
- package/dist/jailbreak-extension.d.ts.map +1 -0
- package/dist/jailbreak-extension.js +47 -0
- package/dist/jailbreak-extension.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +0 -37
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +6 -414
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +1 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +1 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-box.d.ts +15 -0
- package/dist/modes/interactive/components/control-panel-box.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-box.js +55 -0
- package/dist/modes/interactive/components/control-panel-box.js.map +1 -0
- package/dist/modes/interactive/components/control-panel-gradient-motion.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient-motion.js +2 -36
- package/dist/modes/interactive/components/control-panel-gradient-motion.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient.d.ts +1 -0
- package/dist/modes/interactive/components/control-panel-gradient.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel-gradient.js +6 -5
- package/dist/modes/interactive/components/control-panel-gradient.js.map +1 -1
- package/dist/modes/interactive/components/control-panel-layout.d.ts +30 -0
- package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-layout.js +197 -0
- package/dist/modes/interactive/components/control-panel-layout.js.map +1 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +6 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.js +29 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -0
- package/dist/modes/interactive/components/control-panel.d.ts +9 -31
- package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel.js +49 -168
- package/dist/modes/interactive/components/control-panel.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +14 -22
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts +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 +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/extension-input.d.ts +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +1 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +1 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +7 -9
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +0 -2
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +0 -2
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +2 -2
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +2 -2
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +13 -47
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +118 -193
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +1 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +1 -2
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +2 -11
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +8 -7
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +48 -7
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/todo-checklist.d.ts +31 -0
- package/dist/modes/interactive/components/todo-checklist.d.ts.map +1 -0
- package/dist/modes/interactive/components/todo-checklist.js +121 -0
- package/dist/modes/interactive/components/todo-checklist.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +1 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -8
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +80 -232
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/omk-control-grid-dark.json +65 -77
- package/dist/modes/interactive/theme/omk-neon-control.json +90 -0
- package/dist/modes/interactive/theme/rust-forge.json +14 -24
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +25 -45
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +2 -2
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +0 -4
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +7 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/lrl-bypass.d.ts +40 -0
- package/dist/modules/lrl-bypass.d.ts.map +1 -0
- package/dist/modules/lrl-bypass.js +84 -0
- package/dist/modules/lrl-bypass.js.map +1 -0
- package/dist/modules/lrl-deps.d.ts +38 -0
- package/dist/modules/lrl-deps.d.ts.map +1 -0
- package/dist/modules/lrl-deps.js +128 -0
- package/dist/modules/lrl-deps.js.map +1 -0
- package/dist/multiturn/easl-chain.d.ts +113 -0
- package/dist/multiturn/easl-chain.d.ts.map +1 -0
- package/dist/multiturn/easl-chain.js +351 -0
- package/dist/multiturn/easl-chain.js.map +1 -0
- package/dist/multiturn/index.d.ts +6 -0
- package/dist/multiturn/index.d.ts.map +1 -0
- package/dist/multiturn/index.js +6 -0
- package/dist/multiturn/index.js.map +1 -0
- package/dist/orchestration/lane-grant-auditor.d.ts +4 -0
- package/dist/orchestration/lane-grant-auditor.d.ts.map +1 -0
- package/dist/orchestration/lane-grant-auditor.js +87 -0
- package/dist/orchestration/lane-grant-auditor.js.map +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +48 -113
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/routing/fallback-router.d.ts +123 -0
- package/dist/routing/fallback-router.d.ts.map +1 -0
- package/dist/routing/fallback-router.js +355 -0
- package/dist/routing/fallback-router.js.map +1 -0
- package/dist/routing/index.d.ts +6 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +6 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/types/evidence.d.ts +117 -0
- package/dist/types/evidence.d.ts.map +1 -0
- package/dist/types/evidence.js +8 -0
- package/dist/types/evidence.js.map +1 -0
- package/dist/types/guardrails.d.ts +61 -0
- package/dist/types/guardrails.d.ts.map +1 -0
- package/dist/types/guardrails.js +9 -0
- package/dist/types/guardrails.js.map +1 -0
- package/dist/types/jailbreak.d.ts +246 -0
- package/dist/types/jailbreak.d.ts.map +1 -0
- package/dist/types/jailbreak.js +8 -0
- package/dist/types/jailbreak.js.map +1 -0
- package/dist/types/lane-grant.d.ts +58 -0
- package/dist/types/lane-grant.d.ts.map +1 -0
- package/dist/types/lane-grant.js +9 -0
- package/dist/types/lane-grant.js.map +1 -0
- package/dist/utils/jailbreak/common.d.ts +63 -0
- package/dist/utils/jailbreak/common.d.ts.map +1 -0
- package/dist/utils/jailbreak/common.js +130 -0
- package/dist/utils/jailbreak/common.js.map +1 -0
- package/dist/utils/jailbreak/index.d.ts +7 -0
- package/dist/utils/jailbreak/index.d.ts.map +1 -0
- package/dist/utils/jailbreak/index.js +7 -0
- package/dist/utils/jailbreak/index.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/compaction.md +8 -21
- package/docs/custom-provider.md +2 -2
- package/docs/development.md +1 -1
- package/docs/extensions.md +11 -11
- package/docs/loadout-domains/README.md +70 -0
- package/docs/loadout-domains/ai-agent-ops.md +94 -0
- package/docs/loadout-domains/backend-api.md +116 -0
- package/docs/loadout-domains/data-science.md +100 -0
- package/docs/loadout-domains/devops-infra.md +85 -0
- package/docs/loadout-domains/docs-writing.md +92 -0
- package/docs/loadout-domains/frontend-ui.md +128 -0
- package/docs/loadout-domains/general.md +62 -0
- package/docs/loadout-domains/mobile.md +84 -0
- package/docs/loadout-domains/qa-testing.md +87 -0
- package/docs/loadout-domains/research.md +80 -0
- package/docs/loadout-domains/security-audit.md +97 -0
- package/docs/packages.md +7 -48
- package/docs/prompt-templates.md +0 -2
- package/docs/providers.md +12 -0
- package/docs/sdk.md +3 -3
- package/docs/security.md +145 -0
- package/docs/session-format.md +1 -1
- package/docs/themes.md +8 -7
- package/docs/tui.md +14 -14
- package/docs/usage.md +6 -16
- package/examples/extensions/README.md +2 -2
- package/examples/extensions/aside-computer-use/README.md +114 -0
- package/examples/extensions/aside-computer-use/action-scoring.ts +122 -0
- package/examples/extensions/aside-computer-use/assertions.ts +380 -0
- package/examples/extensions/aside-computer-use/controller.ts +491 -0
- package/examples/extensions/aside-computer-use/evidence.ts +229 -0
- package/examples/extensions/aside-computer-use/golden-trace.ts +141 -0
- package/examples/extensions/aside-computer-use/index.ts +76 -0
- package/examples/extensions/aside-computer-use/mcp-client.ts +381 -0
- package/examples/extensions/aside-computer-use/observation-snapshot.ts +121 -0
- package/examples/extensions/aside-computer-use/package.json +16 -0
- package/examples/extensions/aside-computer-use/policy.ts +257 -0
- package/examples/extensions/aside-computer-use/risk-authorize.ts +200 -0
- package/examples/extensions/aside-computer-use/risk-classifier.ts +205 -0
- package/examples/extensions/aside-computer-use/schema-fingerprint.ts +80 -0
- package/examples/extensions/aside-computer-use/session-binding.ts +161 -0
- package/examples/extensions/aside-computer-use/tools.ts +449 -0
- package/examples/extensions/aside-computer-use/types.ts +217 -0
- package/examples/extensions/aside-computer-use/url-origin.ts +132 -0
- package/examples/extensions/bash-spawn-hook.ts +1 -1
- package/examples/extensions/border-status-editor.ts +2 -2
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/custom-compaction.ts +1 -1
- package/examples/extensions/custom-footer.ts +2 -2
- package/examples/extensions/custom-header.ts +8 -8
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- 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 +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
- package/examples/extensions/doom-overlay/README.md +1 -2
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +4 -4
- package/examples/extensions/doom-overlay/doom/doomgeneric_omk.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +2 -2
- package/examples/extensions/doom-overlay/doom-keys.ts +1 -1
- package/examples/extensions/git-merge-and-resolve.ts +1 -1
- package/examples/extensions/github-issue-autocomplete.ts +1 -6
- package/examples/extensions/gondolin/index.ts +1 -1
- 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 +1 -1
- package/examples/extensions/inline-bash.ts +1 -1
- package/examples/extensions/input-transform-streaming.ts +1 -1
- package/examples/extensions/input-transform.ts +2 -2
- package/examples/extensions/mac-system-theme.ts +1 -1
- package/examples/extensions/message-renderer.ts +1 -1
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +7 -7
- package/examples/extensions/overlay-test.ts +1 -1
- package/examples/extensions/plan-mode/index.ts +3 -3
- package/examples/extensions/preset.ts +4 -4
- package/examples/extensions/provider-payload.ts +6 -3
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/question.ts +1 -1
- package/examples/extensions/questionnaire.ts +1 -1
- package/examples/extensions/rpc-demo.ts +1 -1
- package/examples/extensions/sandbox/index.ts +2 -2
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/shutdown-command.ts +5 -5
- package/examples/extensions/snake.ts +1 -1
- package/examples/extensions/space-invaders.ts +1 -1
- package/examples/extensions/structured-output.ts +1 -1
- package/examples/extensions/subagent/agents.ts +2 -2
- package/examples/extensions/subagent/index.ts +19 -51
- package/examples/extensions/summarize.ts +2 -2
- package/examples/extensions/tic-tac-toe.ts +2 -2
- package/examples/extensions/todo.ts +2 -2
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/extensions/tools.ts +1 -1
- package/examples/extensions/truncated-tool.ts +1 -1
- 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 +3 -3
- package/examples/rpc-extension-ui.ts +1 -9
- package/examples/sdk/02-custom-model.ts +1 -1
- package/examples/sdk/07-context-files.ts +0 -2
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +1805 -0
- package/package.json +10 -32
- package/dist/core/compaction/pruner-policy.d.ts +0 -84
- package/dist/core/compaction/pruner-policy.d.ts.map +0 -1
- package/dist/core/compaction/pruner-policy.js +0 -273
- package/dist/core/compaction/pruner-policy.js.map +0 -1
- package/dist/core/context-graph-identity-resolution.d.ts +0 -114
- package/dist/core/context-graph-identity-resolution.d.ts.map +0 -1
- package/dist/core/context-graph-identity-resolution.js +0 -127
- package/dist/core/context-graph-identity-resolution.js.map +0 -1
- package/dist/core/context-graph-memory-store.d.ts +0 -153
- package/dist/core/context-graph-memory-store.d.ts.map +0 -1
- package/dist/core/context-graph-memory-store.js +0 -377
- package/dist/core/context-graph-memory-store.js.map +0 -1
- package/dist/core/context-graph-ontology-generation.d.ts +0 -104
- package/dist/core/context-graph-ontology-generation.d.ts.map +0 -1
- package/dist/core/context-graph-ontology-generation.js +0 -135
- package/dist/core/context-graph-ontology-generation.js.map +0 -1
- package/dist/core/context-graph-ontology-registry.d.ts +0 -766
- package/dist/core/context-graph-ontology-registry.d.ts.map +0 -1
- package/dist/core/context-graph-ontology-registry.js +0 -1133
- package/dist/core/context-graph-ontology-registry.js.map +0 -1
- package/dist/core/context-graph-policy.d.ts +0 -68
- package/dist/core/context-graph-policy.d.ts.map +0 -1
- package/dist/core/context-graph-policy.js +0 -221
- package/dist/core/context-graph-policy.js.map +0 -1
- package/dist/core/context-graph-reasoning.d.ts +0 -130
- package/dist/core/context-graph-reasoning.d.ts.map +0 -1
- package/dist/core/context-graph-reasoning.js +0 -442
- package/dist/core/context-graph-reasoning.js.map +0 -1
- package/dist/core/context-graph-retrieval.d.ts +0 -120
- package/dist/core/context-graph-retrieval.d.ts.map +0 -1
- package/dist/core/context-graph-retrieval.js +0 -288
- package/dist/core/context-graph-retrieval.js.map +0 -1
- package/dist/core/contract-verification.d.ts +0 -78
- package/dist/core/contract-verification.d.ts.map +0 -1
- package/dist/core/contract-verification.js +0 -110
- package/dist/core/contract-verification.js.map +0 -1
- package/dist/core/freedom/banner.d.ts +0 -14
- package/dist/core/freedom/banner.d.ts.map +0 -1
- package/dist/core/freedom/banner.js +0 -22
- package/dist/core/freedom/banner.js.map +0 -1
- package/dist/core/freedom/config.d.ts +0 -27
- package/dist/core/freedom/config.d.ts.map +0 -1
- package/dist/core/freedom/config.js +0 -216
- package/dist/core/freedom/config.js.map +0 -1
- package/dist/core/freedom/index.d.ts +0 -23
- package/dist/core/freedom/index.d.ts.map +0 -1
- package/dist/core/freedom/index.js +0 -19
- package/dist/core/freedom/index.js.map +0 -1
- package/dist/core/freedom/policy.d.ts +0 -42
- package/dist/core/freedom/policy.d.ts.map +0 -1
- package/dist/core/freedom/policy.js +0 -47
- package/dist/core/freedom/policy.js.map +0 -1
- package/dist/core/freedom/safety-floor.d.ts +0 -73
- package/dist/core/freedom/safety-floor.d.ts.map +0 -1
- package/dist/core/freedom/safety-floor.js +0 -275
- package/dist/core/freedom/safety-floor.js.map +0 -1
- package/dist/core/harness-control-events.d.ts +0 -91
- package/dist/core/harness-control-events.d.ts.map +0 -1
- package/dist/core/harness-control-events.js +0 -514
- package/dist/core/harness-control-events.js.map +0 -1
- package/dist/core/harness-control-replay.d.ts +0 -31
- package/dist/core/harness-control-replay.d.ts.map +0 -1
- package/dist/core/harness-control-replay.js +0 -187
- package/dist/core/harness-control-replay.js.map +0 -1
- package/dist/core/headroom-middleware.d.ts +0 -35
- package/dist/core/headroom-middleware.d.ts.map +0 -1
- package/dist/core/headroom-middleware.js +0 -166
- package/dist/core/headroom-middleware.js.map +0 -1
- package/dist/core/lean-context-middleware.d.ts +0 -12
- package/dist/core/lean-context-middleware.d.ts.map +0 -1
- package/dist/core/lean-context-middleware.js +0 -87
- package/dist/core/lean-context-middleware.js.map +0 -1
- package/dist/core/lean-context-policy.d.ts +0 -45
- package/dist/core/lean-context-policy.d.ts.map +0 -1
- package/dist/core/lean-context-policy.js +0 -108
- package/dist/core/lean-context-policy.js.map +0 -1
- package/dist/core/native-adoption-benchmark.d.ts +0 -166
- package/dist/core/native-adoption-benchmark.d.ts.map +0 -1
- package/dist/core/native-adoption-benchmark.js +0 -624
- package/dist/core/native-adoption-benchmark.js.map +0 -1
- package/dist/core/observability-trace.d.ts +0 -80
- package/dist/core/observability-trace.d.ts.map +0 -1
- package/dist/core/observability-trace.js +0 -140
- package/dist/core/observability-trace.js.map +0 -1
- package/dist/core/orchestration/checkpoint.d.ts +0 -83
- package/dist/core/orchestration/checkpoint.d.ts.map +0 -1
- package/dist/core/orchestration/checkpoint.js +0 -152
- package/dist/core/orchestration/checkpoint.js.map +0 -1
- package/dist/core/orchestration/errors.d.ts +0 -74
- package/dist/core/orchestration/errors.d.ts.map +0 -1
- package/dist/core/orchestration/errors.js +0 -52
- package/dist/core/orchestration/errors.js.map +0 -1
- package/dist/core/orchestration/merge-queue.d.ts +0 -121
- package/dist/core/orchestration/merge-queue.d.ts.map +0 -1
- package/dist/core/orchestration/merge-queue.js +0 -149
- package/dist/core/orchestration/merge-queue.js.map +0 -1
- package/dist/core/orchestration/recovery.d.ts +0 -106
- package/dist/core/orchestration/recovery.d.ts.map +0 -1
- package/dist/core/orchestration/recovery.js +0 -110
- package/dist/core/orchestration/recovery.js.map +0 -1
- package/dist/core/orchestration/replay-ledger.d.ts +0 -76
- package/dist/core/orchestration/replay-ledger.d.ts.map +0 -1
- package/dist/core/orchestration/replay-ledger.js +0 -395
- package/dist/core/orchestration/replay-ledger.js.map +0 -1
- package/dist/core/orchestration/scheduler-state.d.ts +0 -78
- package/dist/core/orchestration/scheduler-state.d.ts.map +0 -1
- package/dist/core/orchestration/scheduler-state.js +0 -185
- package/dist/core/orchestration/scheduler-state.js.map +0 -1
- package/dist/core/orchestration/scheduler-store.d.ts +0 -309
- package/dist/core/orchestration/scheduler-store.d.ts.map +0 -1
- package/dist/core/orchestration/scheduler-store.js +0 -368
- package/dist/core/orchestration/scheduler-store.js.map +0 -1
- package/dist/core/orchestration/sqlite-scheduler-store.d.ts +0 -57
- package/dist/core/orchestration/sqlite-scheduler-store.d.ts.map +0 -1
- package/dist/core/orchestration/sqlite-scheduler-store.js +0 -528
- package/dist/core/orchestration/sqlite-scheduler-store.js.map +0 -1
- package/dist/core/orchestration/transaction-coordinator.d.ts +0 -217
- package/dist/core/orchestration/transaction-coordinator.d.ts.map +0 -1
- package/dist/core/orchestration/transaction-coordinator.js +0 -281
- package/dist/core/orchestration/transaction-coordinator.js.map +0 -1
- package/dist/core/orchestration/verification-contract.d.ts +0 -197
- package/dist/core/orchestration/verification-contract.d.ts.map +0 -1
- package/dist/core/orchestration/verification-contract.js +0 -145
- package/dist/core/orchestration/verification-contract.js.map +0 -1
- package/dist/core/package-composition.d.ts +0 -68
- package/dist/core/package-composition.d.ts.map +0 -1
- package/dist/core/package-composition.js +0 -304
- package/dist/core/package-composition.js.map +0 -1
- package/dist/core/package-trial-runtime.d.ts +0 -75
- package/dist/core/package-trial-runtime.d.ts.map +0 -1
- package/dist/core/package-trial-runtime.js +0 -73
- package/dist/core/package-trial-runtime.js.map +0 -1
- package/dist/core/package-trial-sandbox.d.ts +0 -27
- package/dist/core/package-trial-sandbox.d.ts.map +0 -1
- package/dist/core/package-trial-sandbox.js +0 -102
- package/dist/core/package-trial-sandbox.js.map +0 -1
- package/dist/core/policy-overlays-runtime.d.ts +0 -141
- package/dist/core/policy-overlays-runtime.d.ts.map +0 -1
- package/dist/core/policy-overlays-runtime.js +0 -720
- package/dist/core/policy-overlays-runtime.js.map +0 -1
- package/dist/core/read-anchor-registry.d.ts +0 -27
- package/dist/core/read-anchor-registry.d.ts.map +0 -1
- package/dist/core/read-anchor-registry.js +0 -103
- package/dist/core/read-anchor-registry.js.map +0 -1
- package/dist/core/read-content-cache.d.ts +0 -22
- package/dist/core/read-content-cache.d.ts.map +0 -1
- package/dist/core/read-content-cache.js +0 -79
- package/dist/core/read-content-cache.js.map +0 -1
- package/dist/core/session-digest.d.ts +0 -57
- package/dist/core/session-digest.d.ts.map +0 -1
- package/dist/core/session-digest.js +0 -193
- package/dist/core/session-digest.js.map +0 -1
- package/dist/core/spec-kit/compiler.d.ts +0 -67
- package/dist/core/spec-kit/compiler.d.ts.map +0 -1
- package/dist/core/spec-kit/compiler.js +0 -268
- package/dist/core/spec-kit/compiler.js.map +0 -1
- package/dist/core/transaction-coordinator.d.ts +0 -30
- package/dist/core/transaction-coordinator.d.ts.map +0 -1
- package/dist/core/transaction-coordinator.js +0 -173
- package/dist/core/transaction-coordinator.js.map +0 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts +0 -30
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/mcp-selector.js +0 -155
- package/dist/modes/interactive/components/mcp-selector.js.map +0 -1
- package/dist/modes/interactive/components/model-selector-state.d.ts +0 -101
- package/dist/modes/interactive/components/model-selector-state.d.ts.map +0 -1
- package/dist/modes/interactive/components/model-selector-state.js +0 -261
- package/dist/modes/interactive/components/model-selector-state.js.map +0 -1
- package/dist/modes/interactive/components/skills-selector.d.ts +0 -32
- package/dist/modes/interactive/components/skills-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/skills-selector.js +0 -130
- package/dist/modes/interactive/components/skills-selector.js.map +0 -1
- package/dist/modes/interactive/theme/omk-blackboard.json +0 -91
- package/dist/modes/interactive/theme/omk-freedom-grid.json +0 -91
- package/dist/modes/interactive/theme/omk-neon-ops.json +0 -90
- package/dist/modes/interactive/theme/omk-slate-light.json +0 -91
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
- package/node_modules/@earendil-works/omk-agent-core/README.md +0 -488
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts +0 -24
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js +0 -553
- package/node_modules/@earendil-works/omk-agent-core/dist/agent-loop.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts +0 -118
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.js +0 -402
- package/node_modules/@earendil-works/omk-agent-core/dist/agent.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts +0 -95
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js +0 -996
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/agent-harness.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts +0 -53
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js +0 -175
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/branch-summarization.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts +0 -117
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js +0 -568
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/compaction.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts +0 -25
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js +0 -131
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/compaction/utils.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts +0 -51
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js +0 -510
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/env/nodejs.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts +0 -51
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js +0 -102
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/messages.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts +0 -48
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js +0 -230
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/prompt-templates.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts +0 -26
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js +0 -101
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-repo.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts +0 -36
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js +0 -273
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/jsonl-storage.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts +0 -18
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js +0 -42
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-repo.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts +0 -25
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js +0 -114
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/memory-storage.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts +0 -11
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js +0 -39
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/repo-utils.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts +0 -33
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js +0 -210
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/session.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts +0 -2
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js +0 -50
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/session/uuid.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts +0 -44
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js +0 -311
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/skills.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts +0 -3
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js +0 -30
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/system-prompt.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts +0 -616
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js +0 -94
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/types.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts +0 -14
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js +0 -126
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/shell-output.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts +0 -70
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js +0 -297
- package/node_modules/@earendil-works/omk-agent-core/dist/harness/utils/truncate.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts +0 -20
- package/node_modules/@earendil-works/omk-agent-core/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/index.js +0 -25
- package/node_modules/@earendil-works/omk-agent-core/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts +0 -3
- package/node_modules/@earendil-works/omk-agent-core/dist/node.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/node.js +0 -3
- package/node_modules/@earendil-works/omk-agent-core/dist/node.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts +0 -69
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js +0 -278
- package/node_modules/@earendil-works/omk-agent-core/dist/proxy.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts +0 -393
- package/node_modules/@earendil-works/omk-agent-core/dist/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/dist/types.js +0 -2
- package/node_modules/@earendil-works/omk-agent-core/dist/types.js.map +0 -1
- package/node_modules/@earendil-works/omk-agent-core/package.json +0 -60
- package/node_modules/@earendil-works/omk-ai/README.md +0 -1389
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts +0 -20
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.js +0 -44
- package/node_modules/@earendil-works/omk-ai/dist/api-registry.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts +0 -5
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js +0 -6
- package/node_modules/@earendil-works/omk-ai/dist/bedrock-provider.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts +0 -3
- package/node_modules/@earendil-works/omk-ai/dist/cli.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/cli.js +0 -130
- package/node_modules/@earendil-works/omk-ai/dist/cli.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts +0 -20
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js +0 -199
- package/node_modules/@earendil-works/omk-ai/dist/env-api-keys.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts +0 -10
- package/node_modules/@earendil-works/omk-ai/dist/image-models.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts +0 -515
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js +0 -517
- package/node_modules/@earendil-works/omk-ai/dist/image-models.generated.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/image-models.js +0 -23
- package/node_modules/@earendil-works/omk-ai/dist/image-models.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts +0 -14
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js +0 -22
- package/node_modules/@earendil-works/omk-ai/dist/images-api-registry.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/images.d.ts +0 -4
- package/node_modules/@earendil-works/omk-ai/dist/images.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/images.js +0 -16
- package/node_modules/@earendil-works/omk-ai/dist/images.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/index.d.ts +0 -33
- package/node_modules/@earendil-works/omk-ai/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/index.js +0 -21
- package/node_modules/@earendil-works/omk-ai/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/models.d.ts +0 -18
- package/node_modules/@earendil-works/omk-ai/dist/models.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts +0 -18762
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.js +0 -17197
- package/node_modules/@earendil-works/omk-ai/dist/models.generated.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/models.js +0 -78
- package/node_modules/@earendil-works/omk-ai/dist/models.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts +0 -2
- package/node_modules/@earendil-works/omk-ai/dist/oauth.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/oauth.js +0 -2
- package/node_modules/@earendil-works/omk-ai/dist/oauth.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts +0 -39
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.js +0 -170
- package/node_modules/@earendil-works/omk-ai/dist/provider-network.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts +0 -38
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js +0 -826
- package/node_modules/@earendil-works/omk-ai/dist/providers/amazon-bedrock.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts +0 -77
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js +0 -1123
- package/node_modules/@earendil-works/omk-ai/dist/providers/anthropic.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts +0 -15
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js +0 -221
- package/node_modules/@earendil-works/omk-ai/dist/providers/azure-openai-responses.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts +0 -13
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js +0 -26
- package/node_modules/@earendil-works/omk-ai/dist/providers/cloudflare.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts +0 -56
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js +0 -368
- package/node_modules/@earendil-works/omk-ai/dist/providers/faux.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts +0 -8
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js +0 -29
- package/node_modules/@earendil-works/omk-ai/dist/providers/github-copilot-headers.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts +0 -70
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js +0 -331
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-shared.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts +0 -15
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js +0 -442
- package/node_modules/@earendil-works/omk-ai/dist/providers/google-vertex.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts +0 -13
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.js +0 -402
- package/node_modules/@earendil-works/omk-ai/dist/providers/google.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts +0 -3
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js +0 -128
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/openrouter.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts +0 -4
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js +0 -34
- package/node_modules/@earendil-works/omk-ai/dist/providers/images/register-builtins.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts +0 -25
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js +0 -534
- package/node_modules/@earendil-works/omk-ai/dist/providers/mistral.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts +0 -30
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js +0 -1171
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-codex-responses.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts +0 -19
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js +0 -977
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-completions.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts +0 -11
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js +0 -22
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-prompt-cache.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts +0 -18
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js +0 -496
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses-shared.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts +0 -13
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js +0 -233
- package/node_modules/@earendil-works/omk-ai/dist/providers/openai-responses.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts +0 -35
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js +0 -254
- package/node_modules/@earendil-works/omk-ai/dist/providers/register-builtins.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts +0 -8
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js +0 -42
- package/node_modules/@earendil-works/omk-ai/dist/providers/simple-options.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts +0 -13
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js +0 -82
- package/node_modules/@earendil-works/omk-ai/dist/providers/tool-schema.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts +0 -8
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js +0 -184
- package/node_modules/@earendil-works/omk-ai/dist/providers/transform-messages.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts +0 -4
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.js +0 -22
- package/node_modules/@earendil-works/omk-ai/dist/session-resources.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts +0 -8
- package/node_modules/@earendil-works/omk-ai/dist/stream.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/stream.js +0 -77
- package/node_modules/@earendil-works/omk-ai/dist/stream.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/types.d.ts +0 -570
- package/node_modules/@earendil-works/omk-ai/dist/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/types.js +0 -2
- package/node_modules/@earendil-works/omk-ai/dist/types.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts +0 -6
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js +0 -34
- package/node_modules/@earendil-works/omk-ai/dist/utils/abort-signals.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts +0 -19
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js +0 -25
- package/node_modules/@earendil-works/omk-ai/dist/utils/diagnostics.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts +0 -21
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js +0 -81
- package/node_modules/@earendil-works/omk-ai/dist/utils/event-stream.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts +0 -3
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js +0 -14
- package/node_modules/@earendil-works/omk-ai/dist/utils/hash.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts +0 -2
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js +0 -8
- package/node_modules/@earendil-works/omk-ai/dist/utils/headers.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts +0 -16
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js +0 -113
- package/node_modules/@earendil-works/omk-ai/dist/utils/json-parse.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts +0 -10
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js +0 -97
- package/node_modules/@earendil-works/omk-ai/dist/utils/node-http-proxy.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts +0 -25
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js +0 -335
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/anthropic.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts +0 -21
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js +0 -56
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/device-code.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts +0 -30
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js +0 -280
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/github-copilot.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts +0 -58
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js +0 -122
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/index.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts +0 -3
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js +0 -105
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/oauth-page.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts +0 -43
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js +0 -487
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/openai-codex.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts +0 -13
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js +0 -31
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/pkce.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts +0 -64
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js +0 -2
- package/node_modules/@earendil-works/omk-ai/dist/utils/oauth/types.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts +0 -57
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js +0 -154
- package/node_modules/@earendil-works/omk-ai/dist/utils/overflow.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts +0 -22
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js +0 -26
- package/node_modules/@earendil-works/omk-ai/dist/utils/sanitize-unicode.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts +0 -17
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js +0 -21
- package/node_modules/@earendil-works/omk-ai/dist/utils/typebox-helpers.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts +0 -18
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js +0 -281
- package/node_modules/@earendil-works/omk-ai/dist/utils/validation.js.map +0 -1
- package/node_modules/@earendil-works/omk-ai/package.json +0 -106
- package/node_modules/@earendil-works/omk-tui/README.md +0 -791
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts +0 -54
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js +0 -632
- package/node_modules/@earendil-works/omk-tui/dist/autocomplete.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts +0 -22
- package/node_modules/@earendil-works/omk-tui/dist/components/box.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/box.js +0 -104
- package/node_modules/@earendil-works/omk-tui/dist/components/box.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts +0 -22
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js +0 -35
- package/node_modules/@earendil-works/omk-tui/dist/components/cancellable-loader.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts +0 -249
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.js +0 -1857
- package/node_modules/@earendil-works/omk-tui/dist/components/editor.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts +0 -28
- package/node_modules/@earendil-works/omk-tui/dist/components/image.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/image.js +0 -89
- package/node_modules/@earendil-works/omk-tui/dist/components/image.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts +0 -37
- package/node_modules/@earendil-works/omk-tui/dist/components/input.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/input.js +0 -378
- package/node_modules/@earendil-works/omk-tui/dist/components/input.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts +0 -31
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.js +0 -69
- package/node_modules/@earendil-works/omk-tui/dist/components/loader.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts +0 -96
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js +0 -644
- package/node_modules/@earendil-works/omk-tui/dist/components/markdown.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts +0 -50
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js +0 -159
- package/node_modules/@earendil-works/omk-tui/dist/components/select-list.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts +0 -50
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js +0 -185
- package/node_modules/@earendil-works/omk-tui/dist/components/settings-list.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts +0 -12
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js +0 -23
- package/node_modules/@earendil-works/omk-tui/dist/components/spacer.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts +0 -19
- package/node_modules/@earendil-works/omk-tui/dist/components/text.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/text.js +0 -89
- package/node_modules/@earendil-works/omk-tui/dist/components/text.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts +0 -13
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js +0 -51
- package/node_modules/@earendil-works/omk-tui/dist/components/truncated-text.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts +0 -39
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.js +0 -2
- package/node_modules/@earendil-works/omk-tui/dist/editor-component.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts +0 -16
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js +0 -110
- package/node_modules/@earendil-works/omk-tui/dist/fuzzy.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/index.d.ts +0 -23
- package/node_modules/@earendil-works/omk-tui/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/index.js +0 -32
- package/node_modules/@earendil-works/omk-tui/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts +0 -212
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.js +0 -252
- package/node_modules/@earendil-works/omk-tui/dist/keybindings.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts +0 -184
- package/node_modules/@earendil-works/omk-tui/dist/keys.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/keys.js +0 -1173
- package/node_modules/@earendil-works/omk-tui/dist/keys.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts +0 -28
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js +0 -44
- package/node_modules/@earendil-works/omk-tui/dist/kill-ring.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts +0 -3
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js +0 -53
- package/node_modules/@earendil-works/omk-tui/dist/native-modifiers.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts +0 -50
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js +0 -361
- package/node_modules/@earendil-works/omk-tui/dist/stdin-buffer.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts +0 -90
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js +0 -366
- package/node_modules/@earendil-works/omk-tui/dist/terminal-image.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts +0 -113
- package/node_modules/@earendil-works/omk-tui/dist/terminal.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/terminal.js +0 -472
- package/node_modules/@earendil-works/omk-tui/dist/terminal.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts +0 -242
- package/node_modules/@earendil-works/omk-tui/dist/tui.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/tui.js +0 -1221
- package/node_modules/@earendil-works/omk-tui/dist/tui.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts +0 -17
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js +0 -25
- package/node_modules/@earendil-works/omk-tui/dist/undo-stack.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts +0 -84
- package/node_modules/@earendil-works/omk-tui/dist/utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/utils.js +0 -1032
- package/node_modules/@earendil-works/omk-tui/dist/utils.js.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts +0 -25
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.d.ts.map +0 -1
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js +0 -96
- package/node_modules/@earendil-works/omk-tui/dist/word-navigation.js.map +0 -1
- 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 +0 -47
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { deriveRepresentationCandidates } from "./context-budget-headroom-candidates.js";
|
|
2
|
+
import { DEFAULT_HEADROOM_QUALITY_POLICY, fullTextTokens, } from "./context-budget-headroom-types.js";
|
|
3
|
+
const PRIORITY_WEIGHT = {
|
|
4
|
+
hard: 1_000_000,
|
|
5
|
+
high: 120,
|
|
6
|
+
medium: 60,
|
|
7
|
+
low: 15,
|
|
8
|
+
};
|
|
9
|
+
const FIDELITY_BONUS = {
|
|
10
|
+
exact: 6,
|
|
11
|
+
bounded: 3,
|
|
12
|
+
reversible: 4,
|
|
13
|
+
lossy: 0,
|
|
14
|
+
};
|
|
15
|
+
export function chooseHeadroomRepresentation(item, budget, policy = DEFAULT_HEADROOM_QUALITY_POLICY) {
|
|
16
|
+
const candidates = item.representations ?? deriveRepresentationCandidates(item, policy);
|
|
17
|
+
const full = fullTextTokens(item);
|
|
18
|
+
const tierOver = budget.tierUsedTokens >= budget.tierCeilingTokens;
|
|
19
|
+
const globalTight = budget.remainingGlobalTokens < full;
|
|
20
|
+
const tight = tierOver || globalTight;
|
|
21
|
+
if (item.priority === "hard" || item.required) {
|
|
22
|
+
const fullCandidate = candidates.find((candidate) => candidate.kind === "full");
|
|
23
|
+
if (fullCandidate) {
|
|
24
|
+
return fullCandidate;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let best;
|
|
28
|
+
let bestScore = Number.NEGATIVE_INFINITY;
|
|
29
|
+
for (const candidate of candidates) {
|
|
30
|
+
if (isMoreExpensiveThanFull(candidate, full)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (candidate.kind !== "omit" && candidate.estimatedTokens > budget.remainingGlobalTokens) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const score = representationPreference(candidate, item, policy, tight);
|
|
37
|
+
if (score > bestScore ||
|
|
38
|
+
(score === bestScore && best !== undefined && compareCandidatesForChoice(candidate, best) < 0)) {
|
|
39
|
+
best = candidate;
|
|
40
|
+
bestScore = score;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return best ?? candidates.find((candidate) => candidate.kind === "omit") ?? omitCandidate(item);
|
|
44
|
+
}
|
|
45
|
+
function omitCandidate(item) {
|
|
46
|
+
return {
|
|
47
|
+
kind: "omit",
|
|
48
|
+
text: "",
|
|
49
|
+
estimatedTokens: 0,
|
|
50
|
+
fidelity: "lossy",
|
|
51
|
+
sourceRef: item.sourceRef,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function isMoreExpensiveThanFull(candidate, fullTokens) {
|
|
55
|
+
return candidate.kind !== "full" && candidate.kind !== "omit" && candidate.estimatedTokens >= fullTokens;
|
|
56
|
+
}
|
|
57
|
+
function representationPreference(candidate, item, policy, tight) {
|
|
58
|
+
const priority = PRIORITY_WEIGHT[item.priority];
|
|
59
|
+
const cost = candidate.estimatedTokens;
|
|
60
|
+
const fidelity = FIDELITY_BONUS[candidate.fidelity];
|
|
61
|
+
const retrievable = item.sourceRef?.retrievable === true;
|
|
62
|
+
switch (candidate.kind) {
|
|
63
|
+
case "full": {
|
|
64
|
+
let score = priority + fidelity - cost * 0.05;
|
|
65
|
+
if (tight)
|
|
66
|
+
score -= 50;
|
|
67
|
+
if (isHistoryLike(item) && (item.ageTurns ?? 0) >= policy.summaryMaxAgeTurns) {
|
|
68
|
+
score -= 40;
|
|
69
|
+
}
|
|
70
|
+
return score;
|
|
71
|
+
}
|
|
72
|
+
case "pointer": {
|
|
73
|
+
if (!policy.preferPointerForRetrievable || !retrievable) {
|
|
74
|
+
return Number.NEGATIVE_INFINITY;
|
|
75
|
+
}
|
|
76
|
+
let score = 40 + fidelity - cost * 0.2;
|
|
77
|
+
if (tight)
|
|
78
|
+
score += 20;
|
|
79
|
+
return score;
|
|
80
|
+
}
|
|
81
|
+
case "summary": {
|
|
82
|
+
const base = isHistoryLike(item) ? 30 : 10;
|
|
83
|
+
let score = base + ageBonus(item) + fidelity - cost * 0.3;
|
|
84
|
+
if (tight)
|
|
85
|
+
score += 15;
|
|
86
|
+
return score;
|
|
87
|
+
}
|
|
88
|
+
case "headroom-compressed": {
|
|
89
|
+
if (!retrievable) {
|
|
90
|
+
return Number.NEGATIVE_INFINITY;
|
|
91
|
+
}
|
|
92
|
+
const large = fullTextTokens(item) > policy.headroomThresholdTokens ? 35 : 5;
|
|
93
|
+
let score = large + 10 + fidelity - cost * 0.5;
|
|
94
|
+
if (tight)
|
|
95
|
+
score += 18;
|
|
96
|
+
return score;
|
|
97
|
+
}
|
|
98
|
+
case "omit": {
|
|
99
|
+
if (!policy.allowOmit) {
|
|
100
|
+
return Number.NEGATIVE_INFINITY;
|
|
101
|
+
}
|
|
102
|
+
if (tight && item.priority === "low" && retrievable) {
|
|
103
|
+
return 12;
|
|
104
|
+
}
|
|
105
|
+
return Number.NEGATIVE_INFINITY;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function ageBonus(item) {
|
|
110
|
+
return Math.min(20, (item.ageTurns ?? 0) * 3);
|
|
111
|
+
}
|
|
112
|
+
function isHistoryLike(item) {
|
|
113
|
+
return item.tier === "history" || item.tier === "evidence" || item.tier === "scratch";
|
|
114
|
+
}
|
|
115
|
+
function compareCandidatesForChoice(a, b) {
|
|
116
|
+
if (a.estimatedTokens !== b.estimatedTokens) {
|
|
117
|
+
return a.estimatedTokens - b.estimatedTokens;
|
|
118
|
+
}
|
|
119
|
+
return a.kind.localeCompare(b.kind);
|
|
120
|
+
}
|
|
121
|
+
export { deriveRepresentationCandidates } from "./context-budget-headroom-candidates.js";
|
|
122
|
+
export { DEFAULT_HEADROOM_QUALITY_POLICY, estimatePointerTokens, fnv1aHex, fullTextTokens, getHeadroomRuntimeStatus, heuristicTokenCount, } from "./context-budget-headroom-types.js";
|
|
123
|
+
//# sourceMappingURL=context-budget-headroom.js.map
|
|
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AAC,CAAC,eAAe,EAAE,CAAC;QAC7C,OAAO,CAAC,CAAC,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;IAC9C,CAAC;IACD,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAAA,CACpC;AAED,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EASN,+BAA+B,EAC/B,qBAAqB,EACrB,QAAQ,EACR,cAAc,EACd,wBAAwB,EAGxB,mBAAmB,GAEnB,MAAM,oCAAoC,CAAC","sourcesContent":["import { deriveRepresentationCandidates } from \"./context-budget-headroom-candidates.ts\";\nimport {\n\ttype ContextBudgetItemV2,\n\ttype ContextBudgetPriorityV2,\n\ttype ContextRepresentationCandidateV2,\n\tDEFAULT_HEADROOM_QUALITY_POLICY,\n\tfullTextTokens,\n\ttype HeadroomQualityPolicyV2,\n\ttype RepresentationBudgetContext,\n} from \"./context-budget-headroom-types.ts\";\n\nconst PRIORITY_WEIGHT: Record<ContextBudgetPriorityV2, number> = {\n\thard: 1_000_000,\n\thigh: 120,\n\tmedium: 60,\n\tlow: 15,\n};\n\nconst FIDELITY_BONUS: Record<ContextRepresentationCandidateV2[\"fidelity\"], number> = {\n\texact: 6,\n\tbounded: 3,\n\treversible: 4,\n\tlossy: 0,\n};\n\nexport function chooseHeadroomRepresentation(\n\titem: ContextBudgetItemV2,\n\tbudget: RepresentationBudgetContext,\n\tpolicy: HeadroomQualityPolicyV2 = DEFAULT_HEADROOM_QUALITY_POLICY,\n): ContextRepresentationCandidateV2 {\n\tconst candidates = item.representations ?? deriveRepresentationCandidates(item, policy);\n\tconst full = fullTextTokens(item);\n\tconst tierOver = budget.tierUsedTokens >= budget.tierCeilingTokens;\n\tconst globalTight = budget.remainingGlobalTokens < full;\n\tconst tight = tierOver || globalTight;\n\n\tif (item.priority === \"hard\" || item.required) {\n\t\tconst fullCandidate = candidates.find((candidate) => candidate.kind === \"full\");\n\t\tif (fullCandidate) {\n\t\t\treturn fullCandidate;\n\t\t}\n\t}\n\n\tlet best: ContextRepresentationCandidateV2 | undefined;\n\tlet bestScore = Number.NEGATIVE_INFINITY;\n\tfor (const candidate of candidates) {\n\t\tif (isMoreExpensiveThanFull(candidate, full)) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (candidate.kind !== \"omit\" && candidate.estimatedTokens > budget.remainingGlobalTokens) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst score = representationPreference(candidate, item, policy, tight);\n\t\tif (\n\t\t\tscore > bestScore ||\n\t\t\t(score === bestScore && best !== undefined && compareCandidatesForChoice(candidate, best) < 0)\n\t\t) {\n\t\t\tbest = candidate;\n\t\t\tbestScore = score;\n\t\t}\n\t}\n\treturn best ?? candidates.find((candidate) => candidate.kind === \"omit\") ?? omitCandidate(item);\n}\n\nfunction omitCandidate(item: ContextBudgetItemV2): ContextRepresentationCandidateV2 {\n\treturn {\n\t\tkind: \"omit\",\n\t\ttext: \"\",\n\t\testimatedTokens: 0,\n\t\tfidelity: \"lossy\",\n\t\tsourceRef: item.sourceRef,\n\t};\n}\n\nfunction isMoreExpensiveThanFull(candidate: ContextRepresentationCandidateV2, fullTokens: number): boolean {\n\treturn candidate.kind !== \"full\" && candidate.kind !== \"omit\" && candidate.estimatedTokens >= fullTokens;\n}\n\nfunction representationPreference(\n\tcandidate: ContextRepresentationCandidateV2,\n\titem: ContextBudgetItemV2,\n\tpolicy: HeadroomQualityPolicyV2,\n\ttight: boolean,\n): number {\n\tconst priority = PRIORITY_WEIGHT[item.priority];\n\tconst cost = candidate.estimatedTokens;\n\tconst fidelity = FIDELITY_BONUS[candidate.fidelity];\n\tconst retrievable = item.sourceRef?.retrievable === true;\n\n\tswitch (candidate.kind) {\n\t\tcase \"full\": {\n\t\t\tlet score = priority + fidelity - cost * 0.05;\n\t\t\tif (tight) score -= 50;\n\t\t\tif (isHistoryLike(item) && (item.ageTurns ?? 0) >= policy.summaryMaxAgeTurns) {\n\t\t\t\tscore -= 40;\n\t\t\t}\n\t\t\treturn score;\n\t\t}\n\t\tcase \"pointer\": {\n\t\t\tif (!policy.preferPointerForRetrievable || !retrievable) {\n\t\t\t\treturn Number.NEGATIVE_INFINITY;\n\t\t\t}\n\t\t\tlet score = 40 + fidelity - cost * 0.2;\n\t\t\tif (tight) score += 20;\n\t\t\treturn score;\n\t\t}\n\t\tcase \"summary\": {\n\t\t\tconst base = isHistoryLike(item) ? 30 : 10;\n\t\t\tlet score = base + ageBonus(item) + fidelity - cost * 0.3;\n\t\t\tif (tight) score += 15;\n\t\t\treturn score;\n\t\t}\n\t\tcase \"headroom-compressed\": {\n\t\t\tif (!retrievable) {\n\t\t\t\treturn Number.NEGATIVE_INFINITY;\n\t\t\t}\n\t\t\tconst large = fullTextTokens(item) > policy.headroomThresholdTokens ? 35 : 5;\n\t\t\tlet score = large + 10 + fidelity - cost * 0.5;\n\t\t\tif (tight) score += 18;\n\t\t\treturn score;\n\t\t}\n\t\tcase \"omit\": {\n\t\t\tif (!policy.allowOmit) {\n\t\t\t\treturn Number.NEGATIVE_INFINITY;\n\t\t\t}\n\t\t\tif (tight && item.priority === \"low\" && retrievable) {\n\t\t\t\treturn 12;\n\t\t\t}\n\t\t\treturn Number.NEGATIVE_INFINITY;\n\t\t}\n\t}\n}\n\nfunction ageBonus(item: ContextBudgetItemV2): number {\n\treturn Math.min(20, (item.ageTurns ?? 0) * 3);\n}\n\nfunction isHistoryLike(item: ContextBudgetItemV2): boolean {\n\treturn item.tier === \"history\" || item.tier === \"evidence\" || item.tier === \"scratch\";\n}\n\nfunction compareCandidatesForChoice(a: ContextRepresentationCandidateV2, b: ContextRepresentationCandidateV2): number {\n\tif (a.estimatedTokens !== b.estimatedTokens) {\n\t\treturn a.estimatedTokens - b.estimatedTokens;\n\t}\n\treturn a.kind.localeCompare(b.kind);\n}\n\nexport { deriveRepresentationCandidates } from \"./context-budget-headroom-candidates.ts\";\nexport {\n\ttype ContextBudgetItemV2,\n\ttype ContextBudgetPriorityV2,\n\ttype ContextBudgetTierV2,\n\ttype ContextEvidenceKindV2,\n\ttype ContextRepresentationCandidateV2,\n\ttype ContextRepresentationFidelityV2,\n\ttype ContextRepresentationKindV2,\n\ttype ContextSourceRefV2,\n\tDEFAULT_HEADROOM_QUALITY_POLICY,\n\testimatePointerTokens,\n\tfnv1aHex,\n\tfullTextTokens,\n\tgetHeadroomRuntimeStatus,\n\ttype HeadroomQualityPolicyV2,\n\ttype HeadroomRuntimeStatusV2,\n\theuristicTokenCount,\n\ttype RepresentationBudgetContext,\n} from \"./context-budget-headroom-types.ts\";\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query-aware relevance scoring for context budget items.
|
|
3
|
+
*
|
|
4
|
+
* Replaces heuristic proxies (description length, isGlobal hardcoding)
|
|
5
|
+
* with token-based coverage scoring that measures semantic overlap
|
|
6
|
+
* between the current query context and each resource item.
|
|
7
|
+
*
|
|
8
|
+
* Design: Coverage-based IR (not Jaccard) — avoids penalizing long
|
|
9
|
+
* descriptions whose large union would dilute the score.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Tokenize text for relevance scoring.
|
|
13
|
+
*
|
|
14
|
+
* 1. Lowercase
|
|
15
|
+
* 2. Split: Latin words via regex, Korean syllable groups via regex
|
|
16
|
+
* 3. Remove stop words
|
|
17
|
+
* 4. Remove short Latin tokens (<=2 chars)
|
|
18
|
+
* 5. Deduplicate
|
|
19
|
+
*/
|
|
20
|
+
export declare function tokenizeForRelevance(text: string): readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Score skill relevance against a query context.
|
|
23
|
+
*
|
|
24
|
+
* - queryContext undefined or empty -> 0.3 (neutral)
|
|
25
|
+
* - Coverage of query tokens against skill name+description
|
|
26
|
+
* - Name tokens weighted 3x
|
|
27
|
+
* - Name substring match bonus: +0.2 (capped at 1.0)
|
|
28
|
+
*/
|
|
29
|
+
export declare function scoreSkillRelevance(skill: {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly description: string;
|
|
32
|
+
}, queryContext: string | undefined): number;
|
|
33
|
+
/**
|
|
34
|
+
* Score context file relevance against a query context.
|
|
35
|
+
*
|
|
36
|
+
* - queryContext undefined -> isGlobal ? 0.9 : 0.6
|
|
37
|
+
* - Coverage of query tokens against path segments + content sample
|
|
38
|
+
* - Path tokens weighted 2x
|
|
39
|
+
* - isGlobal bonus: +0.1
|
|
40
|
+
*/
|
|
41
|
+
export declare function scoreContextFileRelevance(contextFile: {
|
|
42
|
+
readonly path: string;
|
|
43
|
+
readonly content: string;
|
|
44
|
+
readonly isGlobal: boolean;
|
|
45
|
+
}, queryContext: string | undefined): number;
|
|
46
|
+
//# sourceMappingURL=context-budget-relevance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-budget-relevance.d.ts","sourceRoot":"","sources":["../../src/core/context-budget-relevance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyJH;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAmCpE;AAkED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAC9D,YAAY,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,CA2BR;AAYD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACxC,WAAW,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAC5F,YAAY,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,CAkCR","sourcesContent":["/**\n * Query-aware relevance scoring for context budget items.\n *\n * Replaces heuristic proxies (description length, isGlobal hardcoding)\n * with token-based coverage scoring that measures semantic overlap\n * between the current query context and each resource item.\n *\n * Design: Coverage-based IR (not Jaccard) — avoids penalizing long\n * descriptions whose large union would dilute the score.\n */\n\n// ---------------------------------------------------------------------------\n// Stop words — English + common Korean particles\n// ---------------------------------------------------------------------------\n\nconst STOP_WORDS: ReadonlySet<string> = new Set([\n\t// English common stop words\n\t\"the\",\n\t\"a\",\n\t\"an\",\n\t\"is\",\n\t\"are\",\n\t\"was\",\n\t\"were\",\n\t\"be\",\n\t\"been\",\n\t\"being\",\n\t\"have\",\n\t\"has\",\n\t\"had\",\n\t\"do\",\n\t\"does\",\n\t\"did\",\n\t\"will\",\n\t\"would\",\n\t\"could\",\n\t\"should\",\n\t\"may\",\n\t\"might\",\n\t\"shall\",\n\t\"can\",\n\t\"to\",\n\t\"of\",\n\t\"in\",\n\t\"on\",\n\t\"for\",\n\t\"and\",\n\t\"or\",\n\t\"with\",\n\t\"how\",\n\t\"i\",\n\t\"you\",\n\t\"he\",\n\t\"she\",\n\t\"it\",\n\t\"we\",\n\t\"they\",\n\t\"me\",\n\t\"him\",\n\t\"her\",\n\t\"us\",\n\t\"them\",\n\t\"my\",\n\t\"your\",\n\t\"his\",\n\t\"its\",\n\t\"our\",\n\t\"their\",\n\t\"this\",\n\t\"that\",\n\t\"these\",\n\t\"those\",\n\t\"what\",\n\t\"which\",\n\t\"who\",\n\t\"whom\",\n\t\"where\",\n\t\"when\",\n\t\"why\",\n\t\"not\",\n\t\"no\",\n\t\"nor\",\n\t\"so\",\n\t\"if\",\n\t\"then\",\n\t\"than\",\n\t\"too\",\n\t\"very\",\n\t\"just\",\n\t\"about\",\n\t\"above\",\n\t\"after\",\n\t\"again\",\n\t\"all\",\n\t\"also\",\n\t\"am\",\n\t\"any\",\n\t\"because\",\n\t\"before\",\n\t\"between\",\n\t\"both\",\n\t\"but\",\n\t\"by\",\n\t\"from\",\n\t\"into\",\n\t\"more\",\n\t\"most\",\n\t\"other\",\n\t\"out\",\n\t\"over\",\n\t\"own\",\n\t\"same\",\n\t\"some\",\n\t\"such\",\n\t\"there\",\n\t\"up\",\n\t\"down\",\n\t\"here\",\n\t\"at\",\n\t\"as\",\n\t\"while\",\n\t\"through\",\n\t\"during\",\n\t\"each\",\n\t\"few\",\n\t\"further\",\n\t\"once\",\n\t\"only\",\n\t\"until\",\n\t// Korean particles (조사)\n\t\"은\",\n\t\"는\",\n\t\"이\",\n\t\"가\",\n\t\"을\",\n\t\"를\",\n\t\"에\",\n\t\"의\",\n\t\"와\",\n\t\"과\",\n\t\"도\",\n\t\"로\",\n\t\"으로\",\n\t\"에서\",\n\t\"까지\",\n\t\"부터\",\n\t\"만\",\n\t\"라도\",\n\t\"나\",\n\t\"이며\",\n\t\"이고\",\n\t\"이나\",\n\t\"라\",\n\t\"이다\",\n\t\"하다\",\n\t\"된\",\n]);\n\n// ---------------------------------------------------------------------------\n// Tokenizer\n// ---------------------------------------------------------------------------\n\n/**\n * Tokenize text for relevance scoring.\n *\n * 1. Lowercase\n * 2. Split: Latin words via regex, Korean syllable groups via regex\n * 3. Remove stop words\n * 4. Remove short Latin tokens (<=2 chars)\n * 5. Deduplicate\n */\nexport function tokenizeForRelevance(text: string): readonly string[] {\n\tconst lower = text.toLowerCase();\n\tconst raw = lower.match(/[\\uac00-\\ud7a3]+|[a-z0-9]+/g);\n\tif (!raw) {\n\t\treturn [];\n\t}\n\n\tconst seen = new Set<string>();\n\tconst tokens: string[] = [];\n\n\tfor (const token of raw) {\n\t\t// Skip stop words\n\t\tif (STOP_WORDS.has(token)) {\n\t\t\tcontinue;\n\t\t}\n\t\t// For Latin tokens, skip very short ones (<=2 chars)\n\t\tif (/^[a-z0-9]+$/.test(token) && token.length <= 2) {\n\t\t\tcontinue;\n\t\t}\n\t\t// For Korean, keep 2+ syllable groups\n\t\tif (/^[\\uac00-\\ud7a3]+$/.test(token)) {\n\t\t\tif (token.length >= 2 && !seen.has(token)) {\n\t\t\t\tseen.add(token);\n\t\t\t\ttokens.push(token);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\t// Deduplicate\n\t\tif (!seen.has(token)) {\n\t\t\tseen.add(token);\n\t\t\ttokens.push(token);\n\t\t}\n\t}\n\n\treturn tokens;\n}\n\n// ---------------------------------------------------------------------------\n// Coverage scoring\n// ---------------------------------------------------------------------------\n\n/**\n * Compute coverage: fraction of query tokens found in the item token set.\n * Optional per-token weights boost high-value matches (name, path).\n */\nfunction computeCoverage(\n\tqueryTokens: readonly string[],\n\titemTokenSet: ReadonlySet<string>,\n\titemTokenWeights?: ReadonlyMap<string, number>,\n): number {\n\tif (queryTokens.length === 0) {\n\t\treturn 0;\n\t}\n\n\tlet matchWeight = 0;\n\tfor (const qt of queryTokens) {\n\t\tif (itemTokenSet.has(qt)) {\n\t\t\tmatchWeight += itemTokenWeights?.get(qt) ?? 1;\n\t\t}\n\t}\n\n\t// Normalize: each query token contributes at most 1 to the numerator\n\treturn Math.min(1, matchWeight / queryTokens.length);\n}\n\n/**\n * Build a token set with optional high-weight tokens.\n */\nfunction buildWeightedTokenSet(\n\tbaseText: string,\n\thighWeightText: string | undefined,\n\tweight: number,\n): { tokens: Set<string>; weights: Map<string, number> } {\n\tconst baseTokens = tokenizeForRelevance(baseText);\n\tconst highTokens = highWeightText ? tokenizeForRelevance(highWeightText) : [];\n\n\tconst tokenSet = new Set<string>();\n\tconst weights = new Map<string, number>();\n\n\tfor (const t of baseTokens) {\n\t\ttokenSet.add(t);\n\t\tif (!weights.has(t)) {\n\t\t\tweights.set(t, 1);\n\t\t}\n\t}\n\tfor (const t of highTokens) {\n\t\ttokenSet.add(t);\n\t\tweights.set(t, Math.max(weights.get(t) ?? 0, weight));\n\t}\n\n\treturn { tokens: tokenSet, weights };\n}\n\n// ---------------------------------------------------------------------------\n// Skill relevance\n// ---------------------------------------------------------------------------\n\nconst SKILL_NEUTRAL_SCORE = 0.3;\nconst NAME_MATCH_BONUS = 0.2;\nconst NAME_TOKEN_WEIGHT = 3;\n\n/**\n * Score skill relevance against a query context.\n *\n * - queryContext undefined or empty -> 0.3 (neutral)\n * - Coverage of query tokens against skill name+description\n * - Name tokens weighted 3x\n * - Name substring match bonus: +0.2 (capped at 1.0)\n */\nexport function scoreSkillRelevance(\n\tskill: { readonly name: string; readonly description: string },\n\tqueryContext: string | undefined,\n): number {\n\tif (!queryContext || queryContext.trim() === \"\") {\n\t\treturn SKILL_NEUTRAL_SCORE;\n\t}\n\n\tconst queryTokens = tokenizeForRelevance(queryContext);\n\tif (queryTokens.length === 0) {\n\t\treturn SKILL_NEUTRAL_SCORE;\n\t}\n\n\t// Build skill token set: description is base, name tokens get 3x weight\n\tconst { tokens: skillTokenSet, weights: skillWeights } = buildWeightedTokenSet(\n\t\tskill.description,\n\t\tskill.name,\n\t\tNAME_TOKEN_WEIGHT,\n\t);\n\n\tlet score = computeCoverage(queryTokens, skillTokenSet, skillWeights);\n\n\t// Name substring bonus: if skill.name appears in query text (or vice versa)\n\tconst queryLower = queryContext.toLowerCase();\n\tconst nameLower = skill.name.toLowerCase();\n\tif (queryLower.includes(nameLower) || nameLower.includes(queryLower.trim())) {\n\t\tscore = Math.min(1, score + NAME_MATCH_BONUS);\n\t}\n\n\treturn clamp01(score);\n}\n\n// ---------------------------------------------------------------------------\n// Context file relevance\n// ---------------------------------------------------------------------------\n\nconst CONTEXT_NEUTRAL_GLOBAL = 0.9;\nconst CONTEXT_NEUTRAL_LOCAL = 0.6;\nconst PATH_TOKEN_WEIGHT = 2;\nconst GLOBAL_BONUS = 0.1;\nconst CONTENT_SAMPLE_CHARS = 2000;\n\n/**\n * Score context file relevance against a query context.\n *\n * - queryContext undefined -> isGlobal ? 0.9 : 0.6\n * - Coverage of query tokens against path segments + content sample\n * - Path tokens weighted 2x\n * - isGlobal bonus: +0.1\n */\nexport function scoreContextFileRelevance(\n\tcontextFile: { readonly path: string; readonly content: string; readonly isGlobal: boolean },\n\tqueryContext: string | undefined,\n): number {\n\tif (!queryContext || queryContext.trim() === \"\") {\n\t\treturn contextFile.isGlobal ? CONTEXT_NEUTRAL_GLOBAL : CONTEXT_NEUTRAL_LOCAL;\n\t}\n\n\tconst queryTokens = tokenizeForRelevance(queryContext);\n\tif (queryTokens.length === 0) {\n\t\treturn contextFile.isGlobal ? CONTEXT_NEUTRAL_GLOBAL : CONTEXT_NEUTRAL_LOCAL;\n\t}\n\n\t// Path segments as high-weight text\n\tconst pathText = extractPathSegments(contextFile.path);\n\n\t// Content sample for performance\n\tconst contentSample =\n\t\tcontextFile.content.length > CONTENT_SAMPLE_CHARS\n\t\t\t? contextFile.content.slice(0, CONTENT_SAMPLE_CHARS)\n\t\t\t: contextFile.content;\n\n\t// Build token set: content is base, path tokens get 2x weight\n\tconst { tokens: fileTokenSet, weights: fileWeights } = buildWeightedTokenSet(\n\t\tcontentSample,\n\t\tpathText,\n\t\tPATH_TOKEN_WEIGHT,\n\t);\n\n\tlet score = computeCoverage(queryTokens, fileTokenSet, fileWeights);\n\n\t// Global file bonus\n\tif (contextFile.isGlobal) {\n\t\tscore = Math.min(1, score + GLOBAL_BONUS);\n\t}\n\n\treturn clamp01(score);\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Extract meaningful segments from a file path for token matching.\n */\nfunction extractPathSegments(path: string): string {\n\treturn path\n\t\t.toLowerCase()\n\t\t.split(/[/\\\\._-]+/)\n\t\t.filter((seg) => seg.length > 0)\n\t\t.join(\" \");\n}\n\nfunction clamp01(value: number): number {\n\treturn Math.max(0, Math.min(1, value));\n}\n"]}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query-aware relevance scoring for context budget items.
|
|
3
|
+
*
|
|
4
|
+
* Replaces heuristic proxies (description length, isGlobal hardcoding)
|
|
5
|
+
* with token-based coverage scoring that measures semantic overlap
|
|
6
|
+
* between the current query context and each resource item.
|
|
7
|
+
*
|
|
8
|
+
* Design: Coverage-based IR (not Jaccard) — avoids penalizing long
|
|
9
|
+
* descriptions whose large union would dilute the score.
|
|
10
|
+
*/
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Stop words — English + common Korean particles
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const STOP_WORDS = new Set([
|
|
15
|
+
// English common stop words
|
|
16
|
+
"the",
|
|
17
|
+
"a",
|
|
18
|
+
"an",
|
|
19
|
+
"is",
|
|
20
|
+
"are",
|
|
21
|
+
"was",
|
|
22
|
+
"were",
|
|
23
|
+
"be",
|
|
24
|
+
"been",
|
|
25
|
+
"being",
|
|
26
|
+
"have",
|
|
27
|
+
"has",
|
|
28
|
+
"had",
|
|
29
|
+
"do",
|
|
30
|
+
"does",
|
|
31
|
+
"did",
|
|
32
|
+
"will",
|
|
33
|
+
"would",
|
|
34
|
+
"could",
|
|
35
|
+
"should",
|
|
36
|
+
"may",
|
|
37
|
+
"might",
|
|
38
|
+
"shall",
|
|
39
|
+
"can",
|
|
40
|
+
"to",
|
|
41
|
+
"of",
|
|
42
|
+
"in",
|
|
43
|
+
"on",
|
|
44
|
+
"for",
|
|
45
|
+
"and",
|
|
46
|
+
"or",
|
|
47
|
+
"with",
|
|
48
|
+
"how",
|
|
49
|
+
"i",
|
|
50
|
+
"you",
|
|
51
|
+
"he",
|
|
52
|
+
"she",
|
|
53
|
+
"it",
|
|
54
|
+
"we",
|
|
55
|
+
"they",
|
|
56
|
+
"me",
|
|
57
|
+
"him",
|
|
58
|
+
"her",
|
|
59
|
+
"us",
|
|
60
|
+
"them",
|
|
61
|
+
"my",
|
|
62
|
+
"your",
|
|
63
|
+
"his",
|
|
64
|
+
"its",
|
|
65
|
+
"our",
|
|
66
|
+
"their",
|
|
67
|
+
"this",
|
|
68
|
+
"that",
|
|
69
|
+
"these",
|
|
70
|
+
"those",
|
|
71
|
+
"what",
|
|
72
|
+
"which",
|
|
73
|
+
"who",
|
|
74
|
+
"whom",
|
|
75
|
+
"where",
|
|
76
|
+
"when",
|
|
77
|
+
"why",
|
|
78
|
+
"not",
|
|
79
|
+
"no",
|
|
80
|
+
"nor",
|
|
81
|
+
"so",
|
|
82
|
+
"if",
|
|
83
|
+
"then",
|
|
84
|
+
"than",
|
|
85
|
+
"too",
|
|
86
|
+
"very",
|
|
87
|
+
"just",
|
|
88
|
+
"about",
|
|
89
|
+
"above",
|
|
90
|
+
"after",
|
|
91
|
+
"again",
|
|
92
|
+
"all",
|
|
93
|
+
"also",
|
|
94
|
+
"am",
|
|
95
|
+
"any",
|
|
96
|
+
"because",
|
|
97
|
+
"before",
|
|
98
|
+
"between",
|
|
99
|
+
"both",
|
|
100
|
+
"but",
|
|
101
|
+
"by",
|
|
102
|
+
"from",
|
|
103
|
+
"into",
|
|
104
|
+
"more",
|
|
105
|
+
"most",
|
|
106
|
+
"other",
|
|
107
|
+
"out",
|
|
108
|
+
"over",
|
|
109
|
+
"own",
|
|
110
|
+
"same",
|
|
111
|
+
"some",
|
|
112
|
+
"such",
|
|
113
|
+
"there",
|
|
114
|
+
"up",
|
|
115
|
+
"down",
|
|
116
|
+
"here",
|
|
117
|
+
"at",
|
|
118
|
+
"as",
|
|
119
|
+
"while",
|
|
120
|
+
"through",
|
|
121
|
+
"during",
|
|
122
|
+
"each",
|
|
123
|
+
"few",
|
|
124
|
+
"further",
|
|
125
|
+
"once",
|
|
126
|
+
"only",
|
|
127
|
+
"until",
|
|
128
|
+
// Korean particles (조사)
|
|
129
|
+
"은",
|
|
130
|
+
"는",
|
|
131
|
+
"이",
|
|
132
|
+
"가",
|
|
133
|
+
"을",
|
|
134
|
+
"를",
|
|
135
|
+
"에",
|
|
136
|
+
"의",
|
|
137
|
+
"와",
|
|
138
|
+
"과",
|
|
139
|
+
"도",
|
|
140
|
+
"로",
|
|
141
|
+
"으로",
|
|
142
|
+
"에서",
|
|
143
|
+
"까지",
|
|
144
|
+
"부터",
|
|
145
|
+
"만",
|
|
146
|
+
"라도",
|
|
147
|
+
"나",
|
|
148
|
+
"이며",
|
|
149
|
+
"이고",
|
|
150
|
+
"이나",
|
|
151
|
+
"라",
|
|
152
|
+
"이다",
|
|
153
|
+
"하다",
|
|
154
|
+
"된",
|
|
155
|
+
]);
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
// Tokenizer
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
/**
|
|
160
|
+
* Tokenize text for relevance scoring.
|
|
161
|
+
*
|
|
162
|
+
* 1. Lowercase
|
|
163
|
+
* 2. Split: Latin words via regex, Korean syllable groups via regex
|
|
164
|
+
* 3. Remove stop words
|
|
165
|
+
* 4. Remove short Latin tokens (<=2 chars)
|
|
166
|
+
* 5. Deduplicate
|
|
167
|
+
*/
|
|
168
|
+
export function tokenizeForRelevance(text) {
|
|
169
|
+
const lower = text.toLowerCase();
|
|
170
|
+
const raw = lower.match(/[\uac00-\ud7a3]+|[a-z0-9]+/g);
|
|
171
|
+
if (!raw) {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
const seen = new Set();
|
|
175
|
+
const tokens = [];
|
|
176
|
+
for (const token of raw) {
|
|
177
|
+
// Skip stop words
|
|
178
|
+
if (STOP_WORDS.has(token)) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
// For Latin tokens, skip very short ones (<=2 chars)
|
|
182
|
+
if (/^[a-z0-9]+$/.test(token) && token.length <= 2) {
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
// For Korean, keep 2+ syllable groups
|
|
186
|
+
if (/^[\uac00-\ud7a3]+$/.test(token)) {
|
|
187
|
+
if (token.length >= 2 && !seen.has(token)) {
|
|
188
|
+
seen.add(token);
|
|
189
|
+
tokens.push(token);
|
|
190
|
+
}
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
// Deduplicate
|
|
194
|
+
if (!seen.has(token)) {
|
|
195
|
+
seen.add(token);
|
|
196
|
+
tokens.push(token);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return tokens;
|
|
200
|
+
}
|
|
201
|
+
// ---------------------------------------------------------------------------
|
|
202
|
+
// Coverage scoring
|
|
203
|
+
// ---------------------------------------------------------------------------
|
|
204
|
+
/**
|
|
205
|
+
* Compute coverage: fraction of query tokens found in the item token set.
|
|
206
|
+
* Optional per-token weights boost high-value matches (name, path).
|
|
207
|
+
*/
|
|
208
|
+
function computeCoverage(queryTokens, itemTokenSet, itemTokenWeights) {
|
|
209
|
+
if (queryTokens.length === 0) {
|
|
210
|
+
return 0;
|
|
211
|
+
}
|
|
212
|
+
let matchWeight = 0;
|
|
213
|
+
for (const qt of queryTokens) {
|
|
214
|
+
if (itemTokenSet.has(qt)) {
|
|
215
|
+
matchWeight += itemTokenWeights?.get(qt) ?? 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Normalize: each query token contributes at most 1 to the numerator
|
|
219
|
+
return Math.min(1, matchWeight / queryTokens.length);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Build a token set with optional high-weight tokens.
|
|
223
|
+
*/
|
|
224
|
+
function buildWeightedTokenSet(baseText, highWeightText, weight) {
|
|
225
|
+
const baseTokens = tokenizeForRelevance(baseText);
|
|
226
|
+
const highTokens = highWeightText ? tokenizeForRelevance(highWeightText) : [];
|
|
227
|
+
const tokenSet = new Set();
|
|
228
|
+
const weights = new Map();
|
|
229
|
+
for (const t of baseTokens) {
|
|
230
|
+
tokenSet.add(t);
|
|
231
|
+
if (!weights.has(t)) {
|
|
232
|
+
weights.set(t, 1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
for (const t of highTokens) {
|
|
236
|
+
tokenSet.add(t);
|
|
237
|
+
weights.set(t, Math.max(weights.get(t) ?? 0, weight));
|
|
238
|
+
}
|
|
239
|
+
return { tokens: tokenSet, weights };
|
|
240
|
+
}
|
|
241
|
+
// ---------------------------------------------------------------------------
|
|
242
|
+
// Skill relevance
|
|
243
|
+
// ---------------------------------------------------------------------------
|
|
244
|
+
const SKILL_NEUTRAL_SCORE = 0.3;
|
|
245
|
+
const NAME_MATCH_BONUS = 0.2;
|
|
246
|
+
const NAME_TOKEN_WEIGHT = 3;
|
|
247
|
+
/**
|
|
248
|
+
* Score skill relevance against a query context.
|
|
249
|
+
*
|
|
250
|
+
* - queryContext undefined or empty -> 0.3 (neutral)
|
|
251
|
+
* - Coverage of query tokens against skill name+description
|
|
252
|
+
* - Name tokens weighted 3x
|
|
253
|
+
* - Name substring match bonus: +0.2 (capped at 1.0)
|
|
254
|
+
*/
|
|
255
|
+
export function scoreSkillRelevance(skill, queryContext) {
|
|
256
|
+
if (!queryContext || queryContext.trim() === "") {
|
|
257
|
+
return SKILL_NEUTRAL_SCORE;
|
|
258
|
+
}
|
|
259
|
+
const queryTokens = tokenizeForRelevance(queryContext);
|
|
260
|
+
if (queryTokens.length === 0) {
|
|
261
|
+
return SKILL_NEUTRAL_SCORE;
|
|
262
|
+
}
|
|
263
|
+
// Build skill token set: description is base, name tokens get 3x weight
|
|
264
|
+
const { tokens: skillTokenSet, weights: skillWeights } = buildWeightedTokenSet(skill.description, skill.name, NAME_TOKEN_WEIGHT);
|
|
265
|
+
let score = computeCoverage(queryTokens, skillTokenSet, skillWeights);
|
|
266
|
+
// Name substring bonus: if skill.name appears in query text (or vice versa)
|
|
267
|
+
const queryLower = queryContext.toLowerCase();
|
|
268
|
+
const nameLower = skill.name.toLowerCase();
|
|
269
|
+
if (queryLower.includes(nameLower) || nameLower.includes(queryLower.trim())) {
|
|
270
|
+
score = Math.min(1, score + NAME_MATCH_BONUS);
|
|
271
|
+
}
|
|
272
|
+
return clamp01(score);
|
|
273
|
+
}
|
|
274
|
+
// ---------------------------------------------------------------------------
|
|
275
|
+
// Context file relevance
|
|
276
|
+
// ---------------------------------------------------------------------------
|
|
277
|
+
const CONTEXT_NEUTRAL_GLOBAL = 0.9;
|
|
278
|
+
const CONTEXT_NEUTRAL_LOCAL = 0.6;
|
|
279
|
+
const PATH_TOKEN_WEIGHT = 2;
|
|
280
|
+
const GLOBAL_BONUS = 0.1;
|
|
281
|
+
const CONTENT_SAMPLE_CHARS = 2000;
|
|
282
|
+
/**
|
|
283
|
+
* Score context file relevance against a query context.
|
|
284
|
+
*
|
|
285
|
+
* - queryContext undefined -> isGlobal ? 0.9 : 0.6
|
|
286
|
+
* - Coverage of query tokens against path segments + content sample
|
|
287
|
+
* - Path tokens weighted 2x
|
|
288
|
+
* - isGlobal bonus: +0.1
|
|
289
|
+
*/
|
|
290
|
+
export function scoreContextFileRelevance(contextFile, queryContext) {
|
|
291
|
+
if (!queryContext || queryContext.trim() === "") {
|
|
292
|
+
return contextFile.isGlobal ? CONTEXT_NEUTRAL_GLOBAL : CONTEXT_NEUTRAL_LOCAL;
|
|
293
|
+
}
|
|
294
|
+
const queryTokens = tokenizeForRelevance(queryContext);
|
|
295
|
+
if (queryTokens.length === 0) {
|
|
296
|
+
return contextFile.isGlobal ? CONTEXT_NEUTRAL_GLOBAL : CONTEXT_NEUTRAL_LOCAL;
|
|
297
|
+
}
|
|
298
|
+
// Path segments as high-weight text
|
|
299
|
+
const pathText = extractPathSegments(contextFile.path);
|
|
300
|
+
// Content sample for performance
|
|
301
|
+
const contentSample = contextFile.content.length > CONTENT_SAMPLE_CHARS
|
|
302
|
+
? contextFile.content.slice(0, CONTENT_SAMPLE_CHARS)
|
|
303
|
+
: contextFile.content;
|
|
304
|
+
// Build token set: content is base, path tokens get 2x weight
|
|
305
|
+
const { tokens: fileTokenSet, weights: fileWeights } = buildWeightedTokenSet(contentSample, pathText, PATH_TOKEN_WEIGHT);
|
|
306
|
+
let score = computeCoverage(queryTokens, fileTokenSet, fileWeights);
|
|
307
|
+
// Global file bonus
|
|
308
|
+
if (contextFile.isGlobal) {
|
|
309
|
+
score = Math.min(1, score + GLOBAL_BONUS);
|
|
310
|
+
}
|
|
311
|
+
return clamp01(score);
|
|
312
|
+
}
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// Helpers
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
/**
|
|
317
|
+
* Extract meaningful segments from a file path for token matching.
|
|
318
|
+
*/
|
|
319
|
+
function extractPathSegments(path) {
|
|
320
|
+
return path
|
|
321
|
+
.toLowerCase()
|
|
322
|
+
.split(/[/\\._-]+/)
|
|
323
|
+
.filter((seg) => seg.length > 0)
|
|
324
|
+
.join(" ");
|
|
325
|
+
}
|
|
326
|
+
function clamp01(value) {
|
|
327
|
+
return Math.max(0, Math.min(1, value));
|
|
328
|
+
}
|
|
329
|
+
//# sourceMappingURL=context-budget-relevance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-budget-relevance.js","sourceRoot":"","sources":["../../src/core/context-budget-relevance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8EAA8E;AAC9E,mDAAiD;AACjD,8EAA8E;AAE9E,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC;IAC/C,4BAA4B;IAC5B,KAAK;IACL,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,KAAK;IACL,GAAG;IACH,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IAC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C;IAC3C,CAAC;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CACtB;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;GAEG;AACH,SAAS,mBAAmB,CAAC,IAAY,EAAU;IAClD,OAAO,IAAI;SACT,WAAW,EAAE;SACb,KAAK,CAAC,WAAW,CAAC;SAClB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SAC/B,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,CACZ;AAED,SAAS,OAAO,CAAC,KAAa,EAAU;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAAA,CACvC","sourcesContent":["/**\n * Query-aware relevance scoring for context budget items.\n *\n * Replaces heuristic proxies (description length, isGlobal hardcoding)\n * with token-based coverage scoring that measures semantic overlap\n * between the current query context and each resource item.\n *\n * Design: Coverage-based IR (not Jaccard) — avoids penalizing long\n * descriptions whose large union would dilute the score.\n */\n\n// ---------------------------------------------------------------------------\n// Stop words — English + common Korean particles\n// ---------------------------------------------------------------------------\n\nconst STOP_WORDS: ReadonlySet<string> = new Set([\n\t// English common stop words\n\t\"the\",\n\t\"a\",\n\t\"an\",\n\t\"is\",\n\t\"are\",\n\t\"was\",\n\t\"were\",\n\t\"be\",\n\t\"been\",\n\t\"being\",\n\t\"have\",\n\t\"has\",\n\t\"had\",\n\t\"do\",\n\t\"does\",\n\t\"did\",\n\t\"will\",\n\t\"would\",\n\t\"could\",\n\t\"should\",\n\t\"may\",\n\t\"might\",\n\t\"shall\",\n\t\"can\",\n\t\"to\",\n\t\"of\",\n\t\"in\",\n\t\"on\",\n\t\"for\",\n\t\"and\",\n\t\"or\",\n\t\"with\",\n\t\"how\",\n\t\"i\",\n\t\"you\",\n\t\"he\",\n\t\"she\",\n\t\"it\",\n\t\"we\",\n\t\"they\",\n\t\"me\",\n\t\"him\",\n\t\"her\",\n\t\"us\",\n\t\"them\",\n\t\"my\",\n\t\"your\",\n\t\"his\",\n\t\"its\",\n\t\"our\",\n\t\"their\",\n\t\"this\",\n\t\"that\",\n\t\"these\",\n\t\"those\",\n\t\"what\",\n\t\"which\",\n\t\"who\",\n\t\"whom\",\n\t\"where\",\n\t\"when\",\n\t\"why\",\n\t\"not\",\n\t\"no\",\n\t\"nor\",\n\t\"so\",\n\t\"if\",\n\t\"then\",\n\t\"than\",\n\t\"too\",\n\t\"very\",\n\t\"just\",\n\t\"about\",\n\t\"above\",\n\t\"after\",\n\t\"again\",\n\t\"all\",\n\t\"also\",\n\t\"am\",\n\t\"any\",\n\t\"because\",\n\t\"before\",\n\t\"between\",\n\t\"both\",\n\t\"but\",\n\t\"by\",\n\t\"from\",\n\t\"into\",\n\t\"more\",\n\t\"most\",\n\t\"other\",\n\t\"out\",\n\t\"over\",\n\t\"own\",\n\t\"same\",\n\t\"some\",\n\t\"such\",\n\t\"there\",\n\t\"up\",\n\t\"down\",\n\t\"here\",\n\t\"at\",\n\t\"as\",\n\t\"while\",\n\t\"through\",\n\t\"during\",\n\t\"each\",\n\t\"few\",\n\t\"further\",\n\t\"once\",\n\t\"only\",\n\t\"until\",\n\t// Korean particles (조사)\n\t\"은\",\n\t\"는\",\n\t\"이\",\n\t\"가\",\n\t\"을\",\n\t\"를\",\n\t\"에\",\n\t\"의\",\n\t\"와\",\n\t\"과\",\n\t\"도\",\n\t\"로\",\n\t\"으로\",\n\t\"에서\",\n\t\"까지\",\n\t\"부터\",\n\t\"만\",\n\t\"라도\",\n\t\"나\",\n\t\"이며\",\n\t\"이고\",\n\t\"이나\",\n\t\"라\",\n\t\"이다\",\n\t\"하다\",\n\t\"된\",\n]);\n\n// ---------------------------------------------------------------------------\n// Tokenizer\n// ---------------------------------------------------------------------------\n\n/**\n * Tokenize text for relevance scoring.\n *\n * 1. Lowercase\n * 2. Split: Latin words via regex, Korean syllable groups via regex\n * 3. Remove stop words\n * 4. Remove short Latin tokens (<=2 chars)\n * 5. Deduplicate\n */\nexport function tokenizeForRelevance(text: string): readonly string[] {\n\tconst lower = text.toLowerCase();\n\tconst raw = lower.match(/[\\uac00-\\ud7a3]+|[a-z0-9]+/g);\n\tif (!raw) {\n\t\treturn [];\n\t}\n\n\tconst seen = new Set<string>();\n\tconst tokens: string[] = [];\n\n\tfor (const token of raw) {\n\t\t// Skip stop words\n\t\tif (STOP_WORDS.has(token)) {\n\t\t\tcontinue;\n\t\t}\n\t\t// For Latin tokens, skip very short ones (<=2 chars)\n\t\tif (/^[a-z0-9]+$/.test(token) && token.length <= 2) {\n\t\t\tcontinue;\n\t\t}\n\t\t// For Korean, keep 2+ syllable groups\n\t\tif (/^[\\uac00-\\ud7a3]+$/.test(token)) {\n\t\t\tif (token.length >= 2 && !seen.has(token)) {\n\t\t\t\tseen.add(token);\n\t\t\t\ttokens.push(token);\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\t// Deduplicate\n\t\tif (!seen.has(token)) {\n\t\t\tseen.add(token);\n\t\t\ttokens.push(token);\n\t\t}\n\t}\n\n\treturn tokens;\n}\n\n// ---------------------------------------------------------------------------\n// Coverage scoring\n// ---------------------------------------------------------------------------\n\n/**\n * Compute coverage: fraction of query tokens found in the item token set.\n * Optional per-token weights boost high-value matches (name, path).\n */\nfunction computeCoverage(\n\tqueryTokens: readonly string[],\n\titemTokenSet: ReadonlySet<string>,\n\titemTokenWeights?: ReadonlyMap<string, number>,\n): number {\n\tif (queryTokens.length === 0) {\n\t\treturn 0;\n\t}\n\n\tlet matchWeight = 0;\n\tfor (const qt of queryTokens) {\n\t\tif (itemTokenSet.has(qt)) {\n\t\t\tmatchWeight += itemTokenWeights?.get(qt) ?? 1;\n\t\t}\n\t}\n\n\t// Normalize: each query token contributes at most 1 to the numerator\n\treturn Math.min(1, matchWeight / queryTokens.length);\n}\n\n/**\n * Build a token set with optional high-weight tokens.\n */\nfunction buildWeightedTokenSet(\n\tbaseText: string,\n\thighWeightText: string | undefined,\n\tweight: number,\n): { tokens: Set<string>; weights: Map<string, number> } {\n\tconst baseTokens = tokenizeForRelevance(baseText);\n\tconst highTokens = highWeightText ? tokenizeForRelevance(highWeightText) : [];\n\n\tconst tokenSet = new Set<string>();\n\tconst weights = new Map<string, number>();\n\n\tfor (const t of baseTokens) {\n\t\ttokenSet.add(t);\n\t\tif (!weights.has(t)) {\n\t\t\tweights.set(t, 1);\n\t\t}\n\t}\n\tfor (const t of highTokens) {\n\t\ttokenSet.add(t);\n\t\tweights.set(t, Math.max(weights.get(t) ?? 0, weight));\n\t}\n\n\treturn { tokens: tokenSet, weights };\n}\n\n// ---------------------------------------------------------------------------\n// Skill relevance\n// ---------------------------------------------------------------------------\n\nconst SKILL_NEUTRAL_SCORE = 0.3;\nconst NAME_MATCH_BONUS = 0.2;\nconst NAME_TOKEN_WEIGHT = 3;\n\n/**\n * Score skill relevance against a query context.\n *\n * - queryContext undefined or empty -> 0.3 (neutral)\n * - Coverage of query tokens against skill name+description\n * - Name tokens weighted 3x\n * - Name substring match bonus: +0.2 (capped at 1.0)\n */\nexport function scoreSkillRelevance(\n\tskill: { readonly name: string; readonly description: string },\n\tqueryContext: string | undefined,\n): number {\n\tif (!queryContext || queryContext.trim() === \"\") {\n\t\treturn SKILL_NEUTRAL_SCORE;\n\t}\n\n\tconst queryTokens = tokenizeForRelevance(queryContext);\n\tif (queryTokens.length === 0) {\n\t\treturn SKILL_NEUTRAL_SCORE;\n\t}\n\n\t// Build skill token set: description is base, name tokens get 3x weight\n\tconst { tokens: skillTokenSet, weights: skillWeights } = buildWeightedTokenSet(\n\t\tskill.description,\n\t\tskill.name,\n\t\tNAME_TOKEN_WEIGHT,\n\t);\n\n\tlet score = computeCoverage(queryTokens, skillTokenSet, skillWeights);\n\n\t// Name substring bonus: if skill.name appears in query text (or vice versa)\n\tconst queryLower = queryContext.toLowerCase();\n\tconst nameLower = skill.name.toLowerCase();\n\tif (queryLower.includes(nameLower) || nameLower.includes(queryLower.trim())) {\n\t\tscore = Math.min(1, score + NAME_MATCH_BONUS);\n\t}\n\n\treturn clamp01(score);\n}\n\n// ---------------------------------------------------------------------------\n// Context file relevance\n// ---------------------------------------------------------------------------\n\nconst CONTEXT_NEUTRAL_GLOBAL = 0.9;\nconst CONTEXT_NEUTRAL_LOCAL = 0.6;\nconst PATH_TOKEN_WEIGHT = 2;\nconst GLOBAL_BONUS = 0.1;\nconst CONTENT_SAMPLE_CHARS = 2000;\n\n/**\n * Score context file relevance against a query context.\n *\n * - queryContext undefined -> isGlobal ? 0.9 : 0.6\n * - Coverage of query tokens against path segments + content sample\n * - Path tokens weighted 2x\n * - isGlobal bonus: +0.1\n */\nexport function scoreContextFileRelevance(\n\tcontextFile: { readonly path: string; readonly content: string; readonly isGlobal: boolean },\n\tqueryContext: string | undefined,\n): number {\n\tif (!queryContext || queryContext.trim() === \"\") {\n\t\treturn contextFile.isGlobal ? CONTEXT_NEUTRAL_GLOBAL : CONTEXT_NEUTRAL_LOCAL;\n\t}\n\n\tconst queryTokens = tokenizeForRelevance(queryContext);\n\tif (queryTokens.length === 0) {\n\t\treturn contextFile.isGlobal ? CONTEXT_NEUTRAL_GLOBAL : CONTEXT_NEUTRAL_LOCAL;\n\t}\n\n\t// Path segments as high-weight text\n\tconst pathText = extractPathSegments(contextFile.path);\n\n\t// Content sample for performance\n\tconst contentSample =\n\t\tcontextFile.content.length > CONTENT_SAMPLE_CHARS\n\t\t\t? contextFile.content.slice(0, CONTENT_SAMPLE_CHARS)\n\t\t\t: contextFile.content;\n\n\t// Build token set: content is base, path tokens get 2x weight\n\tconst { tokens: fileTokenSet, weights: fileWeights } = buildWeightedTokenSet(\n\t\tcontentSample,\n\t\tpathText,\n\t\tPATH_TOKEN_WEIGHT,\n\t);\n\n\tlet score = computeCoverage(queryTokens, fileTokenSet, fileWeights);\n\n\t// Global file bonus\n\tif (contextFile.isGlobal) {\n\t\tscore = Math.min(1, score + GLOBAL_BONUS);\n\t}\n\n\treturn clamp01(score);\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Extract meaningful segments from a file path for token matching.\n */\nfunction extractPathSegments(path: string): string {\n\treturn path\n\t\t.toLowerCase()\n\t\t.split(/[/\\\\._-]+/)\n\t\t.filter((seg) => seg.length > 0)\n\t\t.join(\" \");\n}\n\nfunction clamp01(value: number): number {\n\treturn Math.max(0, Math.min(1, value));\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ContextBudgetItemV2 } from "./context-budget-governor-v2.ts";
|
|
2
|
+
import type { ContextFile } from "./resource-loader.ts";
|
|
3
|
+
import type { Skill } from "./skills.ts";
|
|
4
|
+
interface SystemPromptBudgetItemInput {
|
|
5
|
+
readonly contextFiles: readonly ContextFile[];
|
|
6
|
+
readonly skills: readonly Skill[];
|
|
7
|
+
readonly includeSkills: boolean;
|
|
8
|
+
readonly options: {
|
|
9
|
+
readonly activeSkillNames?: readonly string[];
|
|
10
|
+
readonly includeSkillInventory?: boolean;
|
|
11
|
+
readonly includeFullContextFiles?: boolean;
|
|
12
|
+
readonly maxInactiveSkills?: number;
|
|
13
|
+
readonly queryContext?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function createSystemPromptBudgetItems(input: SystemPromptBudgetItemInput, resourceBudget: number): ContextBudgetItemV2[];
|
|
17
|
+
export declare function escapeXml(str: string): string;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=context-budget-system-prompt-items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-budget-system-prompt-items.d.ts","sourceRoot":"","sources":["../../src/core/context-budget-system-prompt-items.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAY,MAAM,iCAAiC,CAAC;AAErF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,UAAU,2BAA2B;IACpC,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE;QACjB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC9C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;QACzC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;QAC3C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;CACF;AAQD,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,2BAA2B,EAClC,cAAc,EAAE,MAAM,GACpB,mBAAmB,EAAE,CAkBvB;AAwID,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO7C","sourcesContent":["import { type ContextBudgetItemV2, fnv1aHex } from \"./context-budget-governor-v2.ts\";\nimport { scoreContextFileRelevance, scoreSkillRelevance } from \"./context-budget-relevance.ts\";\nimport type { ContextFile } from \"./resource-loader.ts\";\nimport type { Skill } from \"./skills.ts\";\n\ninterface SystemPromptBudgetItemInput {\n\treadonly contextFiles: readonly ContextFile[];\n\treadonly skills: readonly Skill[];\n\treadonly includeSkills: boolean;\n\treadonly options: {\n\t\treadonly activeSkillNames?: readonly string[];\n\t\treadonly includeSkillInventory?: boolean;\n\t\treadonly includeFullContextFiles?: boolean;\n\t\treadonly maxInactiveSkills?: number;\n\t\treadonly queryContext?: string;\n\t};\n}\n\nconst CONTEXT_EXCERPT_CHARS = 1200;\nconst MIN_EXCERPT_CHARS = 400;\nconst MAX_EXCERPT_CHARS = 3000;\nconst MAX_INACTIVE_SKILLS = 15;\nconst CONTEXT_FULL_BUDGET_RATIO = 0.5;\n\nexport function createSystemPromptBudgetItems(\n\tinput: SystemPromptBudgetItemInput,\n\tresourceBudget: number,\n): ContextBudgetItemV2[] {\n\tconst items: ContextBudgetItemV2[] = [];\n\tconst contextFullCount = input.options.includeFullContextFiles !== false ? input.contextFiles.length : 0;\n\tconst excerptChars = computeExcerptChars(resourceBudget, contextFullCount);\n\n\tfor (const contextFile of input.contextFiles) {\n\t\tconst queryScore = scoreContextFileRelevance(\n\t\t\t{ path: contextFile.path, content: contextFile.content, isGlobal: contextFile.isGlobal ?? false },\n\t\t\tinput.options.queryContext,\n\t\t);\n\t\tpushContextItems(items, contextFile, queryScore, excerptChars, input.options.includeFullContextFiles !== false);\n\t}\n\n\tconst visibleSkills = input.skills.filter((skill) => !skill.disableModelInvocation);\n\tif (input.includeSkills && input.options.includeSkillInventory !== false && visibleSkills.length > 0) {\n\t\tpushSkillItems(items, visibleSkills, input.options);\n\t}\n\treturn items;\n}\n\nfunction pushContextItems(\n\titems: ContextBudgetItemV2[],\n\tcontextFile: ContextFile,\n\tqueryScore: number,\n\texcerptChars: number,\n\tincludeFullContextFiles: boolean,\n): void {\n\tconst scope = contextFile.isGlobal ? \"parent\" : \"project\";\n\tconst tagName = contextFile.isGlobal ? \"parent_instructions\" : \"project_instructions\";\n\titems.push({\n\t\tid: `context-pointer:${contextFile.path}`,\n\t\ttier: contextFile.isGlobal ? \"system\" : \"current-files\",\n\t\tpriority: contextFile.isGlobal ? \"hard\" : \"high\",\n\t\trelevance: (contextFile.isGlobal ? 1 : 0.8) * 0.4 + queryScore * 0.6,\n\t\ttext: renderContextPointer(contextFile, scope),\n\t});\n\tif (!includeFullContextFiles) return;\n\titems.push({\n\t\tid: `context-full:${contextFile.path}`,\n\t\ttier: contextFile.isGlobal ? \"system\" : \"current-files\",\n\t\tpriority: contextFile.isGlobal ? \"high\" : \"medium\",\n\t\trelevance: (contextFile.isGlobal ? 0.9 : 0.6) * 0.4 + queryScore * 0.6,\n\t\tredundancyKey: contextFile.path,\n\t\tsourceRef: {\n\t\t\turi: `file://${contextFile.path}`,\n\t\t\tcontentHash: fnv1aHex(contextFile.content),\n\t\t\tretrievable: true,\n\t\t},\n\t\ttext: renderContextFull(contextFile, tagName, excerptChars),\n\t});\n}\n\nfunction pushSkillItems(\n\titems: ContextBudgetItemV2[],\n\tvisibleSkills: readonly Skill[],\n\toptions: SystemPromptBudgetItemInput[\"options\"],\n): void {\n\titems.push({ id: \"skill-header\", tier: \"skills\", priority: \"hard\", text: renderSkillHeader() });\n\tconst activeSkillNames = new Set(options.activeSkillNames ?? []);\n\tconst maxInactive = options.maxInactiveSkills ?? MAX_INACTIVE_SKILLS;\n\tfor (const skill of visibleSkills.filter((skill) => activeSkillNames.has(skill.name))) {\n\t\titems.push(renderSkillBudgetItem(skill, \"hard\", 1));\n\t}\n\n\tconst sortedInactive = visibleSkills\n\t\t.filter((skill) => !activeSkillNames.has(skill.name))\n\t\t.sort((a, b) => scoreSkillRelevance(b, options.queryContext) - scoreSkillRelevance(a, options.queryContext));\n\tfor (const skill of sortedInactive.slice(0, maxInactive)) {\n\t\titems.push(renderSkillBudgetItem(skill, \"low\", Math.max(0.25, scoreSkillRelevance(skill, options.queryContext))));\n\t}\n\titems.push({ id: \"skill-footer\", tier: \"skills\", priority: \"hard\", text: \"</available_skills>\" });\n\n\tconst omittedInactiveCount = sortedInactive.length - Math.min(sortedInactive.length, maxInactive);\n\tif (omittedInactiveCount > 0) {\n\t\titems.push({\n\t\t\tid: \"skill-omitted-summary\",\n\t\t\ttier: \"skills\",\n\t\t\tpriority: \"low\",\n\t\t\trelevance: 0.1,\n\t\t\ttext: `<!-- ${omittedInactiveCount} additional skills available. Use 'read' to load a specific skill file when a task matches. -->`,\n\t\t});\n\t}\n}\n\nfunction renderSkillBudgetItem(skill: Skill, priority: \"hard\" | \"low\", relevance: number): ContextBudgetItemV2 {\n\treturn {\n\t\tid: `skill:${skill.name}`,\n\t\ttier: \"skills\",\n\t\tpriority,\n\t\trelevance,\n\t\tredundancyKey: skill.name,\n\t\ttext: renderSkillEntry(skill),\n\t};\n}\n\nfunction computeExcerptChars(resourceBudget: number, contextFullCount: number): number {\n\tif (contextFullCount <= 0) {\n\t\treturn CONTEXT_EXCERPT_CHARS;\n\t}\n\tconst allocatedTokens = Math.floor(resourceBudget * CONTEXT_FULL_BUDGET_RATIO) / contextFullCount;\n\tconst estimatedChars = Math.floor(allocatedTokens * 4);\n\treturn Math.max(MIN_EXCERPT_CHARS, Math.min(MAX_EXCERPT_CHARS, estimatedChars));\n}\n\nfunction renderContextPointer(contextFile: ContextFile, scope: string): string {\n\tconst marker = contextFile.containsJailbreak ? \" sanitized=true\" : \"\";\n\treturn `<context_file_pointer scope=\"${escapeXml(scope)}\" path=\"${escapeXml(contextFile.path)}\"${marker} chars=\"${contextFile.content.length}\" />`;\n}\n\nfunction renderContextFull(contextFile: ContextFile, tagName: string, excerptChars = CONTEXT_EXCERPT_CHARS): string {\n\tconst content =\n\t\tcontextFile.content.length > excerptChars\n\t\t\t? boundedExcerpt(contextFile.content, excerptChars)\n\t\t\t: contextFile.content;\n\tconst truncated = content.length < contextFile.content.length ? \" truncated=true\" : \"\";\n\treturn `<${tagName} path=\"${escapeXml(contextFile.path)}\"${truncated}>\\n${content}\\n</${tagName}>`;\n}\n\nfunction boundedExcerpt(content: string, excerptChars = CONTEXT_EXCERPT_CHARS): string {\n\tconst headChars = Math.floor(excerptChars * 0.7);\n\tconst tailChars = excerptChars - headChars;\n\tlet head = content.slice(0, headChars);\n\tconst lastSpace = head.search(/\\s+\\S*$/);\n\tif (lastSpace > headChars * 0.5) {\n\t\thead = head.slice(0, lastSpace);\n\t}\n\tlet tail = content.slice(-tailChars);\n\tconst firstSpace = tail.search(/\\S+\\s+/);\n\tif (firstSpace > 0 && firstSpace < tailChars * 0.5) {\n\t\ttail = tail.slice(firstSpace).trimStart();\n\t}\n\treturn `${head}\\n\\n[...context-budget excerpt omitted ${content.length - excerptChars} chars...]\\n\\n${tail}`;\n}\n\nfunction renderSkillHeader(): string {\n\treturn [\n\t\t\"\\n\\nThe following skills provide specialized instructions for specific tasks.\",\n\t\t\"Use the read tool to load a skill's file when the task matches its description.\",\n\t\t\"When a skill file references a relative path, resolve it against the skill directory (parent of SKILL.md / dirname of the path) and use that absolute path in tool commands.\",\n\t\t\"\",\n\t\t\"<available_skills>\",\n\t].join(\"\\n\");\n}\n\nfunction renderSkillEntry(skill: Skill): string {\n\treturn [\n\t\t\" <skill>\",\n\t\t` <name>${escapeXml(skill.name)}</name>`,\n\t\t` <description>${escapeXml(skill.description)}</description>`,\n\t\t` <location>${escapeXml(skill.filePath)}</location>`,\n\t\t\" </skill>\",\n\t].join(\"\\n\");\n}\n\nexport function escapeXml(str: string): string {\n\treturn str\n\t\t.replace(/&/g, \"&\")\n\t\t.replace(/</g, \"<\")\n\t\t.replace(/>/g, \">\")\n\t\t.replace(/\"/g, \""\")\n\t\t.replace(/'/g, \"'\");\n}\n"]}
|