open-multi-agent-kit 0.80.7 → 0.80.8
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 +4 -30
- package/README.md +80 -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 +7 -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/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 +45 -0
- package/dist/core/browser-use.d.ts.map +1 -0
- package/dist/core/browser-use.js +70 -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 +4 -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 +70 -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/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 +1 -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/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/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 +66 -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 +1 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +46 -5
- 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-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 +4 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -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 +23 -0
- package/dist/modes/interactive/components/control-panel-layout.d.ts.map +1 -0
- package/dist/modes/interactive/components/control-panel-layout.js +165 -0
- package/dist/modes/interactive/components/control-panel-layout.js.map +1 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.d.ts +5 -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 +20 -0
- package/dist/modes/interactive/components/control-panel-runtime-status.js.map +1 -0
- package/dist/modes/interactive/components/control-panel.d.ts +8 -31
- package/dist/modes/interactive/components/control-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/control-panel.js +38 -169
- 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 +1 -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 +74 -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 +22 -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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadout-runtime.js","sourceRoot":"","sources":["../../src/core/loadout-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAA4B,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAEN,mBAAmB,EAEnB,qBAAqB,EAOrB,sBAAsB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAqCtD,MAAM,UAAU,wBAAwB,CACvC,KAA0B,EAC1B,OAAwC,EAClB;IACtB,OAAO,yBAAyB,CAAC;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,OAAO;QACtC,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,QAAQ;QACxC,YAAY,EAAE,OAAO,CAAC,YAAY;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AAM,EAAE,OAAO,CAAC,YAAY;QAC5B,GAAG,EAAE,OAAO,CAAC,SAAS;QACtB,KAAK,EAAE,OAAO,CAAC,WAAW;QAC1B,QAAQ;QACR,cAAc;QACd,SAAS,EAAE,eAAe;KAC1B,CAAC;AAAA,CACF;AAED,SAAS,YAAY,CAAC,MAAyB,EAAY;IAC1D,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;SAC/B,IAAI,EAAE,CAAC;AAAA,CACT","sourcesContent":["/**\n * Loadout runtime wiring — pure algorithms.\n *\n * Converts the pure loadout decisions in `loadouts.ts` into runtime-ready\n * capability inventories, lane grants, and scheduler fields without mutating\n * `AgentSession`.\n */\n\nimport type { ToolDefinition } from \"./extensions/types.ts\";\nimport { type HookInventory, loadHookInventory } from \"./hook-inventory.ts\";\nimport { createLoadoutAccessPolicy, type LoadoutAccessPolicy } from \"./loadout-access-policy.ts\";\nimport {\n\ttype AppliedLoadout,\n\tapplyLoadoutProfile,\n\ttype CapabilityInventory,\n\tderiveSchedulerFields,\n\ttype LoadoutAuthority,\n\ttype LoadoutCommands,\n\ttype LoadoutProfile,\n\ttype LoadoutRole,\n\ttype NamedResource,\n\ttype SchedulerFields,\n\tvalidateLoadoutProfile,\n} from \"./loadouts.ts\";\nimport { loadMcpInventory } from \"./mcp-inventory.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\ninterface ExtensionRunnerLike {\n\tgetAllRegisteredTools(): Array<{ definition: { name: string }; sourceInfo: SourceInfo }>;\n}\n\n/**\n * Subset of `AgentSession` fields needed to build a capability inventory.\n * Callers (including `AgentSession` itself) can cast the session to this\n * interface because the fields are read-only for inventory construction.\n */\nexport interface LoadoutRuntimeSession {\n\t_baseToolDefinitions: Map<string, ToolDefinition>;\n\t_extensionRunner: ExtensionRunnerLike;\n\t_customTools: ToolDefinition[];\n}\n\nexport interface LoadoutRuntimeState {\n\tprofileName: string;\n\tauthority: LoadoutAuthority;\n\tactiveTools: string[];\n\tactiveSkills: string[];\n\tactiveMcp: string[];\n\tactiveHooks: string[];\n\tschedulerFields: SchedulerFields;\n\tblockers: string[];\n\twarnings: string[];\n}\n\nexport interface BuildLoadoutAccessPolicyOptions {\n\tcwd: string;\n\tblockedPaths?: readonly string[];\n\tcommands?: LoadoutCommands;\n}\n\nexport function buildLoadoutAccessPolicy(\n\tstate: LoadoutRuntimeState,\n\toptions: BuildLoadoutAccessPolicyOptions,\n): LoadoutAccessPolicy {\n\treturn createLoadoutAccessPolicy({\n\t\tcwd: options.cwd,\n\t\tactiveTools: state.activeTools,\n\t\treadSet: state.schedulerFields.readSet,\n\t\twriteSet: state.schedulerFields.writeSet,\n\t\tblockedPaths: options.blockedPaths,\n\t\tcommands: options.commands,\n\t});\n}\n\nexport interface SubagentLaneGrant {\n\tlaneId: string;\n\tagent: string;\n\ttask: string;\n\tscope: string;\n\tauthority: LoadoutAuthority;\n\tallowedPaths: string[];\n\tblockedPaths: string[];\n\tskills: string[];\n\tmcp: string[];\n\thooks: string[];\n\tcommands: LoadoutCommands;\n\tevidenceOutput?: string;\n\tscheduler: SchedulerFields;\n}\n\nexport function buildCapabilityInventory(\n\tsession: LoadoutRuntimeSession,\n\tresourceLoader: ResourceLoader,\n\tcwd: string,\n\thookInventory: HookInventory,\n): CapabilityInventory {\n\tconst tools: NamedResource[] = [];\n\n\tfor (const [name] of session._baseToolDefinitions) {\n\t\ttools.push({\n\t\t\tkind: \"tool\",\n\t\t\tname,\n\t\t\tsource: \"builtin\",\n\t\t\tscope: \"temporary\",\n\t\t\torigin: \"top-level\",\n\t\t});\n\t}\n\n\tfor (const registered of session._extensionRunner.getAllRegisteredTools()) {\n\t\tconst { sourceInfo } = registered;\n\t\ttools.push({\n\t\t\tkind: \"tool\",\n\t\t\tname: registered.definition.name,\n\t\t\tsource: sourceInfo.source,\n\t\t\tscope: sourceInfo.scope,\n\t\t\torigin: sourceInfo.origin,\n\t\t\tpath: sourceInfo.path,\n\t\t});\n\t}\n\n\tfor (const definition of session._customTools) {\n\t\ttools.push({\n\t\t\tkind: \"tool\",\n\t\t\tname: definition.name,\n\t\t\tsource: \"sdk\",\n\t\t\tscope: \"temporary\",\n\t\t\torigin: \"top-level\",\n\t\t});\n\t}\n\n\tconst skills: NamedResource[] = resourceLoader.getSkills().skills.map((skill) => ({\n\t\tkind: \"skill\",\n\t\tname: skill.name,\n\t\tsource: skill.sourceInfo.source,\n\t\tscope: skill.sourceInfo.scope,\n\t\torigin: skill.sourceInfo.origin,\n\t\tpath: skill.filePath,\n\t}));\n\n\tconst mcp: NamedResource[] = loadMcpInventory(cwd).entries.map((entry) => ({\n\t\tkind: \"mcp\",\n\t\tname: entry.name,\n\t\tsource: entry.source,\n\t\tscope: \"project\",\n\t\torigin: \"top-level\",\n\t}));\n\n\tconst hooks: NamedResource[] = hookInventory.hooks.map((descriptor) => ({\n\t\tkind: \"hook\",\n\t\tname: descriptor.name,\n\t\tsource: descriptor.scriptPath ?? \"builtin\",\n\t\tscope: \"builtin\",\n\t\torigin: \"top-level\",\n\t}));\n\n\treturn { tools, skills, mcp, hooks };\n}\n\nexport interface ApplyLoadoutToRuntimeRequest {\n\tprofile: LoadoutProfile;\n\trole: LoadoutRole;\n\tgrantAuthority?: LoadoutAuthority;\n\tassignedReadPaths?: readonly string[];\n\tassignedWritePaths?: readonly string[];\n}\n\nexport function applyLoadoutToRuntime(\n\tsession: LoadoutRuntimeSession,\n\tresourceLoader: ResourceLoader,\n\tcwd: string,\n\tagentDir: string,\n\trequest: ApplyLoadoutToRuntimeRequest,\n): LoadoutRuntimeState {\n\tconst validation = validateLoadoutProfile(request.profile);\n\tif (!validation.valid) {\n\t\treturn {\n\t\t\tprofileName: request.profile.name,\n\t\t\tauthority: request.profile.authority,\n\t\t\tactiveTools: [],\n\t\t\tactiveSkills: [],\n\t\t\tactiveMcp: [],\n\t\t\tactiveHooks: [],\n\t\t\tschedulerFields: { readSet: [], writeSet: [], parallelizable: true },\n\t\t\tblockers: validation.errors,\n\t\t\twarnings: [],\n\t\t};\n\t}\n\n\tconst hookInventory = loadHookInventory(agentDir);\n\tconst inventory = buildCapabilityInventory(session, resourceLoader, cwd, hookInventory);\n\tconst applied = applyLoadoutProfile(request.profile, inventory, { grantAuthority: request.grantAuthority });\n\tif (applied.blockers.length > 0) {\n\t\treturn {\n\t\t\tprofileName: applied.profileName,\n\t\t\tauthority: applied.authority,\n\t\t\tactiveTools: applied.activeTools,\n\t\t\tactiveSkills: applied.activeSkills,\n\t\t\tactiveMcp: applied.activeMcp,\n\t\t\tactiveHooks: applied.activeHooks,\n\t\t\tschedulerFields: { readSet: [], writeSet: [], parallelizable: true },\n\t\t\tblockers: applied.blockers,\n\t\t\twarnings: applied.warnings,\n\t\t};\n\t}\n\n\tconst schedulerFields = deriveSchedulerFields({\n\t\trole: request.role,\n\t\tassignedReadPaths: request.assignedReadPaths,\n\t\tassignedWritePaths: request.assignedWritePaths,\n\t});\n\n\treturn {\n\t\tprofileName: applied.profileName,\n\t\tauthority: applied.authority,\n\t\tactiveTools: applied.activeTools,\n\t\tactiveSkills: applied.activeSkills,\n\t\tactiveMcp: applied.activeMcp,\n\t\tactiveHooks: applied.activeHooks,\n\t\tschedulerFields,\n\t\tblockers: applied.blockers,\n\t\twarnings: applied.warnings,\n\t};\n}\n\nexport interface BuildSubagentLaneGrantOptions {\n\tallowedReadPaths?: readonly string[];\n\tallowedWritePaths?: readonly string[];\n\tevidenceOutputPattern?: string;\n\trunId?: string;\n\tprofile?: { commands?: LoadoutCommands };\n}\n\nexport function buildSubagentLaneGrant(\n\tnodeId: string,\n\trole: LoadoutRole,\n\ttask: string,\n\tapplied: AppliedLoadout,\n\tschedulerFields: SchedulerFields,\n\toptions: BuildSubagentLaneGrantOptions = {},\n): SubagentLaneGrant {\n\tconst allowedPaths = uniqueSorted([...(options.allowedReadPaths ?? []), ...(options.allowedWritePaths ?? [])]);\n\tconst blockedPaths = [\"**/.env*\", \"**/*secret*\", \"**/*key*\", \"**/.git/*\"];\n\n\tlet evidenceOutput: string | undefined;\n\tif (options.evidenceOutputPattern) {\n\t\tevidenceOutput = options.runId\n\t\t\t? options.evidenceOutputPattern.replace(\"<goal>\", options.runId)\n\t\t\t: options.evidenceOutputPattern;\n\t}\n\n\tconst commands = options.profile?.commands ?? { mode: \"none\" };\n\n\treturn {\n\t\tlaneId: nodeId,\n\t\tagent: `omk-${role}`,\n\t\ttask,\n\t\tscope: \"loadout-derived lane grant\",\n\t\tauthority: applied.authority,\n\t\tallowedPaths,\n\t\tblockedPaths,\n\t\tskills: applied.activeSkills,\n\t\tmcp: applied.activeMcp,\n\t\thooks: applied.activeHooks,\n\t\tcommands,\n\t\tevidenceOutput,\n\t\tscheduler: schedulerFields,\n\t};\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values)]\n\t\t.map((value) => value.trim())\n\t\t.filter((value) => value !== \"\")\n\t\t.sort();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"loadout-runtime.js","sourceRoot":"","sources":["../../src/core/loadout-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAA4B,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAEN,mBAAmB,EAEnB,qBAAqB,EAOrB,sBAAsB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAqCtD,MAAM,UAAU,wBAAwB,CACvC,KAA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,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,aAAa,EAAE,yBAAyB,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;QACrE,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAChD,UAAU,EAAE,YAAY,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAClD,cAAc;QACd,SAAS,EAAE,eAAe;KAC1B,CAAC;AAAA,CACF;AAED,SAAS,yBAAyB,CAAC,IAAiB,EAA8B;IACjF,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW;YACf,OAAO,SAAS,CAAC;QAClB,KAAK,UAAU;YACd,OAAO,MAAM,CAAC;QACf;YACC,OAAO,SAAS,CAAC;IACnB,CAAC;AAAA,CACD;AAED,SAAS,YAAY,CAAC,MAAyB,EAAY;IAC1D,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;SACzB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;SAC/B,IAAI,EAAE,CAAC;AAAA,CACT;AAED,SAAS,yBAAyB,CAAC,MAAmC,EAAsB;IAC3F,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAAA,CACnC","sourcesContent":["/**\n * Loadout runtime wiring — pure algorithms.\n *\n * Converts the pure loadout decisions in `loadouts.ts` into runtime-ready\n * capability inventories, lane grants, and scheduler fields without mutating\n * `AgentSession`.\n */\n\nimport path from \"node:path\";\nimport type { ToolDefinition } from \"./extensions/types.ts\";\nimport { type HookInventory, loadHookInventory } from \"./hook-inventory.ts\";\nimport { sanitizeHookPolicy } from \"./hooks/index.ts\";\nimport { createLoadoutAccessPolicy, type LoadoutAccessPolicy } from \"./loadout-access-policy.ts\";\nimport {\n\ttype AppliedLoadout,\n\tapplyLoadoutProfile,\n\ttype CapabilityInventory,\n\tderiveSchedulerFields,\n\ttype LoadoutAuthority,\n\ttype LoadoutCommands,\n\ttype LoadoutProfile,\n\ttype LoadoutRole,\n\ttype NamedResource,\n\ttype SchedulerFields,\n\tvalidateLoadoutProfile,\n} from \"./loadouts.ts\";\nimport { loadMcpInventory } from \"./mcp-inventory.ts\";\nimport type { ResourceLoader } from \"./resource-loader.ts\";\nimport type { SourceInfo } from \"./source-info.ts\";\n\ninterface ExtensionRunnerLike {\n\tgetAllRegisteredTools(): Array<{ definition: { name: string }; sourceInfo: SourceInfo }>;\n}\n\n/**\n * Subset of `AgentSession` fields needed to build a capability inventory.\n * Callers (including `AgentSession` itself) can cast the session to this\n * interface because the fields are read-only for inventory construction.\n */\nexport interface LoadoutRuntimeSession {\n\t_baseToolDefinitions: Map<string, ToolDefinition>;\n\t_extensionRunner: ExtensionRunnerLike;\n\t_customTools: ToolDefinition[];\n}\n\nexport interface LoadoutRuntimeState {\n\tprofileName: string;\n\tauthority: LoadoutAuthority;\n\tactiveTools: string[];\n\tactiveSkills: string[];\n\tactiveMcp: string[];\n\tactiveHooks: string[];\n\tschedulerFields: SchedulerFields;\n\tblockers: string[];\n\twarnings: string[];\n}\n\nexport interface BuildLoadoutAccessPolicyOptions {\n\tcwd: string;\n\tblockedPaths?: readonly string[];\n\tcommands?: LoadoutCommands;\n}\n\nexport function buildLoadoutAccessPolicy(\n\tstate: LoadoutRuntimeState,\n\toptions: BuildLoadoutAccessPolicyOptions,\n): LoadoutAccessPolicy {\n\treturn createLoadoutAccessPolicy({\n\t\tcwd: options.cwd,\n\t\tactiveTools: state.activeTools,\n\t\treadSet: state.schedulerFields.readSet,\n\t\twriteSet: state.schedulerFields.writeSet,\n\t\tblockedPaths: options.blockedPaths,\n\t\tcommands: options.commands,\n\t});\n}\n\nexport interface SubagentLaneGrant {\n\tlaneId: string;\n\tagent: string;\n\ttask: string;\n\tscope: string;\n\tauthority: LoadoutAuthority;\n\tallowedPaths: string[];\n\tblockedPaths: string[];\n\ttools: string[];\n\tskills: string[];\n\tmcp: string[];\n\thooks: string[];\n\tcommands: LoadoutCommands;\n\tcontextInheritance: LaneContextInheritanceMode;\n\tspawnReceipt?: LaneSpawnReceipt;\n\tevidenceGates: LaneEvidenceGate[];\n\tdependsOn: string[];\n\tacceptance: string[];\n\tevidenceOutput?: string;\n\tscheduler: SchedulerFields;\n}\n\nexport type LaneContextInheritanceMode = \"none\" | \"receipt\" | \"last-turn\" | \"bounded\" | \"full\";\n\nexport type LaneEvidenceGate = \"plan-reread\" | \"automated-verification\" | \"manual-qa\" | \"adversarial-qa\" | \"cleanup\";\n\nexport interface LaneSpawnReceipt {\n\twhyParallel: string;\n\twhyNotLocal: string;\n\tindependence: string;\n\texpectedReceiptShape: string;\n\tmaxInlineTokens: number;\n}\n\nexport function buildCapabilityInventory(\n\tsession: LoadoutRuntimeSession,\n\tresourceLoader: ResourceLoader,\n\tcwd: string,\n\thookInventory: HookInventory,\n): CapabilityInventory {\n\tconst tools: NamedResource[] = [];\n\n\tfor (const [name] of session._baseToolDefinitions) {\n\t\ttools.push({\n\t\t\tkind: \"tool\",\n\t\t\tname,\n\t\t\tsource: \"builtin\",\n\t\t\tscope: \"temporary\",\n\t\t\torigin: \"top-level\",\n\t\t});\n\t}\n\n\tfor (const registered of session._extensionRunner.getAllRegisteredTools()) {\n\t\tconst { sourceInfo } = registered;\n\t\ttools.push({\n\t\t\tkind: \"tool\",\n\t\t\tname: registered.definition.name,\n\t\t\tsource: sourceInfo.source,\n\t\t\tscope: sourceInfo.scope,\n\t\t\torigin: sourceInfo.origin,\n\t\t\tpath: sourceInfo.path,\n\t\t});\n\t}\n\n\tfor (const definition of session._customTools) {\n\t\ttools.push({\n\t\t\tkind: \"tool\",\n\t\t\tname: definition.name,\n\t\t\tsource: \"sdk\",\n\t\t\tscope: \"temporary\",\n\t\t\torigin: \"top-level\",\n\t\t});\n\t}\n\n\tconst skills: NamedResource[] = resourceLoader.getSkills().skills.map((skill) => ({\n\t\tkind: \"skill\",\n\t\tname: skill.name,\n\t\tsource: skill.sourceInfo.source,\n\t\tscope: skill.sourceInfo.scope,\n\t\torigin: skill.sourceInfo.origin,\n\t\tpath: skill.filePath,\n\t}));\n\n\tconst mcp: NamedResource[] = loadMcpInventory(cwd).entries.map((entry) => ({\n\t\tkind: \"mcp\",\n\t\tname: entry.name,\n\t\tsource: entry.source,\n\t\tscope: mcpInventoryScope(cwd, entry.source),\n\t\torigin: \"top-level\",\n\t\tpath: entry.source,\n\t}));\n\n\tconst hooks: NamedResource[] = hookInventory.hooks.map((descriptor) => ({\n\t\tkind: \"hook\",\n\t\tname: descriptor.name,\n\t\tsource: descriptor.builtin ? \"builtin\" : \"project\",\n\t\tscope: descriptor.builtin ? \"builtin\" : \"project\",\n\t\torigin: \"top-level\",\n\t\tpath: descriptor.scriptPath,\n\t\tpolicy: sanitizeHookPolicy(descriptor.policy),\n\t}));\n\n\treturn { tools, skills, mcp, hooks };\n}\n\nfunction mcpInventoryScope(cwd: string, sourcePath: string): \"project\" | \"user\" {\n\tconst relative = path.relative(cwd, sourcePath);\n\treturn relative !== \"\" && !relative.startsWith(\"..\") && !path.isAbsolute(relative) ? \"project\" : \"user\";\n}\n\nexport interface ApplyLoadoutToRuntimeRequest {\n\tprofile: LoadoutProfile;\n\trole: LoadoutRole;\n\tgrantAuthority?: LoadoutAuthority;\n\tassignedReadPaths?: readonly string[];\n\tassignedWritePaths?: readonly string[];\n}\n\nexport function applyLoadoutToRuntime(\n\tsession: LoadoutRuntimeSession,\n\tresourceLoader: ResourceLoader,\n\tcwd: string,\n\tagentDir: string,\n\trequest: ApplyLoadoutToRuntimeRequest,\n): LoadoutRuntimeState {\n\tconst validation = validateLoadoutProfile(request.profile);\n\tif (!validation.valid) {\n\t\treturn {\n\t\t\tprofileName: request.profile.name,\n\t\t\tauthority: request.profile.authority,\n\t\t\tactiveTools: [],\n\t\t\tactiveSkills: [],\n\t\t\tactiveMcp: [],\n\t\t\tactiveHooks: [],\n\t\t\tschedulerFields: { readSet: [], writeSet: [], parallelizable: true },\n\t\t\tblockers: validation.errors,\n\t\t\twarnings: [],\n\t\t};\n\t}\n\n\tconst hookInventory = loadHookInventory(agentDir);\n\tconst inventory = buildCapabilityInventory(session, resourceLoader, cwd, hookInventory);\n\tconst applied = applyLoadoutProfile(request.profile, inventory, { grantAuthority: request.grantAuthority });\n\tif (applied.blockers.length > 0) {\n\t\treturn {\n\t\t\tprofileName: applied.profileName,\n\t\t\tauthority: applied.authority,\n\t\t\tactiveTools: applied.activeTools,\n\t\t\tactiveSkills: applied.activeSkills,\n\t\t\tactiveMcp: applied.activeMcp,\n\t\t\tactiveHooks: applied.activeHooks,\n\t\t\tschedulerFields: { readSet: [], writeSet: [], parallelizable: true },\n\t\t\tblockers: applied.blockers,\n\t\t\twarnings: applied.warnings,\n\t\t};\n\t}\n\n\tconst schedulerFields = deriveSchedulerFields({\n\t\trole: request.role,\n\t\tassignedReadPaths: request.assignedReadPaths,\n\t\tassignedWritePaths: request.assignedWritePaths,\n\t});\n\n\treturn {\n\t\tprofileName: applied.profileName,\n\t\tauthority: applied.authority,\n\t\tactiveTools: applied.activeTools,\n\t\tactiveSkills: applied.activeSkills,\n\t\tactiveMcp: applied.activeMcp,\n\t\tactiveHooks: applied.activeHooks,\n\t\tschedulerFields,\n\t\tblockers: applied.blockers,\n\t\twarnings: applied.warnings,\n\t};\n}\n\nexport interface BuildSubagentLaneGrantOptions {\n\tallowedReadPaths?: readonly string[];\n\tallowedWritePaths?: readonly string[];\n\tblockedPaths?: readonly string[];\n\tevidenceOutputPattern?: string;\n\trunId?: string;\n\tprofile?: { commands?: LoadoutCommands };\n\tagentName?: string;\n\tcontextInheritance?: LaneContextInheritanceMode;\n\tspawnReceipt?: LaneSpawnReceipt;\n\tevidenceGates?: readonly LaneEvidenceGate[];\n\tdependsOn?: readonly string[];\n\tacceptance?: readonly string[];\n}\n\nexport function buildSubagentLaneGrant(\n\tnodeId: string,\n\trole: LoadoutRole,\n\ttask: string,\n\tapplied: AppliedLoadout,\n\tschedulerFields: SchedulerFields,\n\toptions: BuildSubagentLaneGrantOptions = {},\n): SubagentLaneGrant {\n\tconst allowedPaths = uniqueSorted([...(options.allowedReadPaths ?? []), ...(options.allowedWritePaths ?? [])]);\n\tconst blockedPaths = uniqueSorted([\n\t\t\"**/.env*\",\n\t\t\"**/*secret*\",\n\t\t\"**/*key*\",\n\t\t\"**/.git/*\",\n\t\t...(options.blockedPaths ?? []),\n\t]);\n\n\tlet evidenceOutput: string | undefined;\n\tif (options.evidenceOutputPattern) {\n\t\tevidenceOutput = options.runId\n\t\t\t? options.evidenceOutputPattern.replace(\"<goal>\", options.runId)\n\t\t\t: options.evidenceOutputPattern;\n\t}\n\n\tconst commands = options.profile?.commands ?? { mode: \"none\" };\n\n\treturn {\n\t\tlaneId: nodeId,\n\t\tagent: options.agentName ?? `omk-${role}`,\n\t\ttask,\n\t\tscope: \"loadout-derived lane grant\",\n\t\tauthority: applied.authority,\n\t\tallowedPaths,\n\t\tblockedPaths,\n\t\ttools: applied.activeTools,\n\t\tskills: applied.activeSkills,\n\t\tmcp: applied.activeMcp,\n\t\thooks: applied.activeHooks,\n\t\tcommands,\n\t\tcontextInheritance: options.contextInheritance ?? defaultContextInheritance(role),\n\t\t...(options.spawnReceipt ? { spawnReceipt: options.spawnReceipt } : {}),\n\t\tevidenceGates: uniqueSortedEvidenceGates(options.evidenceGates ?? []),\n\t\tdependsOn: uniqueSorted(options.dependsOn ?? []),\n\t\tacceptance: uniqueSorted(options.acceptance ?? []),\n\t\tevidenceOutput,\n\t\tscheduler: schedulerFields,\n\t};\n}\n\nfunction defaultContextInheritance(role: LoadoutRole): LaneContextInheritanceMode {\n\tswitch (role) {\n\t\tcase \"planner\":\n\t\tcase \"critic\":\n\t\tcase \"visual-qa\":\n\t\t\treturn \"receipt\";\n\t\tcase \"security\":\n\t\t\treturn \"none\";\n\t\tdefault:\n\t\t\treturn \"bounded\";\n\t}\n}\n\nfunction uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values)]\n\t\t.map((value) => value.trim())\n\t\t.filter((value) => value !== \"\")\n\t\t.sort();\n}\n\nfunction uniqueSortedEvidenceGates(values: readonly LaneEvidenceGate[]): LaneEvidenceGate[] {\n\treturn [...new Set(values)].sort();\n}\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared safety helpers for loadout composition and domain dispatch.
|
|
3
|
+
*
|
|
4
|
+
* This module is pure and I/O-free. It centralizes authority ordering,
|
|
5
|
+
* read-only downgrades, write-capability stripping, security hook forcing, and
|
|
6
|
+
* command-mode clamping so additive composition modules cannot accidentally
|
|
7
|
+
* widen lane authority.
|
|
8
|
+
*/
|
|
9
|
+
import type { CapabilityGate, CommandMode, LoadoutAuthority, LoadoutCommands, LoadoutRole, ResourceKind } from "./loadouts.ts";
|
|
10
|
+
export type CapabilityGateNameKind = "tool" | "skill" | "mcp" | "hook";
|
|
11
|
+
export interface StrippedCapability {
|
|
12
|
+
readonly kind: CapabilityGateNameKind;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly reason: string;
|
|
15
|
+
}
|
|
16
|
+
export interface StripNamesResult {
|
|
17
|
+
readonly names: readonly string[];
|
|
18
|
+
readonly stripped: readonly StrippedCapability[];
|
|
19
|
+
}
|
|
20
|
+
export interface McpDowngradeTrace {
|
|
21
|
+
readonly mcp: string;
|
|
22
|
+
readonly to: string;
|
|
23
|
+
}
|
|
24
|
+
export interface McpDowngradeResult {
|
|
25
|
+
readonly names: readonly string[];
|
|
26
|
+
readonly downgraded: readonly McpDowngradeTrace[];
|
|
27
|
+
}
|
|
28
|
+
export declare const SECURITY_HOOK_NAMES: readonly ["pre-shell-guard", "protect-secrets", "stop-verify"];
|
|
29
|
+
export declare const SECURITY_HOOKS: ReadonlySet<string>;
|
|
30
|
+
export declare const WRITE_TOOL_NAMES: readonly ["edit", "write"];
|
|
31
|
+
export declare const WRITE_TOOLS: ReadonlySet<string>;
|
|
32
|
+
export declare const MCP_READONLY_DOWNGRADE: Readonly<Record<string, string>>;
|
|
33
|
+
export declare const AUTHORITY_RANK: Readonly<Record<LoadoutAuthority, number>>;
|
|
34
|
+
export declare const COMMAND_MODE_RANK: Readonly<Record<CommandMode, number>>;
|
|
35
|
+
export declare const WRITE_SKILLS: ReadonlySet<string>;
|
|
36
|
+
export declare function authorityRank(authority: LoadoutAuthority): number;
|
|
37
|
+
export declare function minAuthority(...authorities: readonly (LoadoutAuthority | undefined)[]): LoadoutAuthority;
|
|
38
|
+
export declare function isReadOnlyAuthority(authority: LoadoutAuthority): boolean;
|
|
39
|
+
export declare function isWritingRole(role: LoadoutRole): boolean;
|
|
40
|
+
export declare function stripWriteToolsForAuthority(names: readonly string[], authority: LoadoutAuthority): StripNamesResult;
|
|
41
|
+
export declare function isWriteLikeSkillName(name: string): boolean;
|
|
42
|
+
export declare function stripWriteSkillsForAuthority(names: readonly string[], authority: LoadoutAuthority): StripNamesResult;
|
|
43
|
+
export declare function stripWriteToolsForReadOnlyAuthority(names: readonly string[]): readonly string[];
|
|
44
|
+
export declare function stripWriteSkillsForReadOnlyRole(names: readonly string[]): readonly string[];
|
|
45
|
+
export declare function downgradeMcpForAuthority(names: readonly string[], authority: LoadoutAuthority): McpDowngradeResult;
|
|
46
|
+
export declare function downgradeMcpForReadOnlyRole(names: readonly string[]): readonly string[];
|
|
47
|
+
export declare function forceSecurityHooks(names: readonly string[], forced?: readonly string[]): string[];
|
|
48
|
+
export declare function commandModeRank(mode: CommandMode): number;
|
|
49
|
+
export declare function clampCommandModeForAuthority(mode: CommandMode, authority: LoadoutAuthority): CommandMode;
|
|
50
|
+
export declare function selectSafestCommandMode(authority: LoadoutAuthority, ...modes: readonly (CommandMode | undefined)[]): LoadoutCommands;
|
|
51
|
+
export declare function capabilityGateNames(gate: CapabilityGate | undefined, group?: "allow" | "exclude" | "require"): string[];
|
|
52
|
+
export declare function unionCapabilityGateNames(group: "allow" | "exclude" | "require", ...gates: readonly (CapabilityGate | undefined)[]): string[];
|
|
53
|
+
export declare function namesToCapabilityGate(kind: Exclude<ResourceKind, "extension" | "prompt" | "theme" | "tool">, names: readonly string[]): CapabilityGate;
|
|
54
|
+
export declare function uniqueSorted(values: readonly string[]): string[];
|
|
55
|
+
//# sourceMappingURL=loadout-safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadout-safety.d.ts","sourceRoot":"","sources":["../../src/core/loadout-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvE,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAA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AE,CAEhE","sourcesContent":["/**\n * Shared safety helpers for loadout composition and domain dispatch.\n *\n * This module is pure and I/O-free. It centralizes authority ordering,\n * read-only downgrades, write-capability stripping, security hook forcing, and\n * command-mode clamping so additive composition modules cannot accidentally\n * widen lane authority.\n */\n\nimport type {\n\tCapabilityGate,\n\tCommandMode,\n\tLoadoutAuthority,\n\tLoadoutCommands,\n\tLoadoutRole,\n\tResourceKind,\n} from \"./loadouts.ts\";\n\nexport type CapabilityGateNameKind = \"tool\" | \"skill\" | \"mcp\" | \"hook\";\n\nexport interface StrippedCapability {\n\treadonly kind: CapabilityGateNameKind;\n\treadonly name: string;\n\treadonly reason: string;\n}\n\nexport interface StripNamesResult {\n\treadonly names: readonly string[];\n\treadonly stripped: readonly StrippedCapability[];\n}\n\nexport interface McpDowngradeTrace {\n\treadonly mcp: string;\n\treadonly to: string;\n}\n\nexport interface McpDowngradeResult {\n\treadonly names: readonly string[];\n\treadonly downgraded: readonly McpDowngradeTrace[];\n}\n\nexport const SECURITY_HOOK_NAMES = [\"pre-shell-guard\", \"protect-secrets\", \"stop-verify\"] as const;\nexport const SECURITY_HOOKS: ReadonlySet<string> = new Set(SECURITY_HOOK_NAMES);\n\nexport const WRITE_TOOL_NAMES = [\"edit\", \"write\"] as const;\nexport const WRITE_TOOLS: ReadonlySet<string> = new Set(WRITE_TOOL_NAMES);\n\nexport const MCP_READONLY_DOWNGRADE: Readonly<Record<string, string>> = {\n\tfilesystem: \"filesystem-readonly\",\n};\n\nexport const AUTHORITY_RANK: Readonly<Record<LoadoutAuthority, number>> = {\n\tadvisory: 0,\n\t\"read-only\": 1,\n\t\"review-only\": 1,\n\t\"security-review\": 2,\n\t\"execute-tests\": 3,\n\t\"write-scoped\": 4,\n};\n\nexport const COMMAND_MODE_RANK: Readonly<Record<CommandMode, number>> = {\n\tnone: 0,\n\t\"read-only-shell\": 1,\n\t\"tests-only\": 2,\n\t\"scoped-shell\": 3,\n};\n\nconst WRITING_ROLES: ReadonlySet<LoadoutRole> = new Set([\n\t\"coder\",\n\t\"tester\",\n\t\"security\",\n\t\"synthesizer\",\n\t\"package-maintainer\",\n]);\n\nconst READ_ONLY_SAFE_SKILLS: ReadonlySet<string> = new Set([\n\t\"analyze\",\n\t\"audit-context-building\",\n\t\"best-practice-research\",\n\t\"code-review\",\n\t\"contrast-checker\",\n\t\"differential-review\",\n\t\"fp-check\",\n\t\"literature-review\",\n\t\"security-review\",\n\t\"understand-chat\",\n\t\"use-of-color\",\n\t\"verification-before-completion\",\n\t\"web-design-guidelines\",\n]);\n\nconst WRITE_LIKE_SKILL_FRAGMENTS = [\n\t\"add-\",\n\t\"build\",\n\t\"clone\",\n\t\"commit\",\n\t\"create\",\n\t\"deploy\",\n\t\"edit\",\n\t\"fix\",\n\t\"frontend-ui-engineering\",\n\t\"generate\",\n\t\"implement\",\n\t\"land-and-deploy\",\n\t\"publish\",\n\t\"redesign\",\n\t\"ship\",\n\t\"tdd\",\n\t\"test-driven-development\",\n\t\"update\",\n\t\"visual-ralph\",\n\t\"write-\",\n] as const;\n\nexport const WRITE_SKILLS: ReadonlySet<string> = new Set(WRITE_LIKE_SKILL_FRAGMENTS);\n\nexport function authorityRank(authority: LoadoutAuthority): number {\n\treturn AUTHORITY_RANK[authority];\n}\n\nexport function minAuthority(...authorities: readonly (LoadoutAuthority | undefined)[]): LoadoutAuthority {\n\tconst present = authorities.filter((authority): authority is LoadoutAuthority => authority !== undefined);\n\tif (present.length === 0) return \"advisory\";\n\tlet lowest = present[0];\n\tfor (const authority of present.slice(1)) {\n\t\tif (authorityRank(authority) < authorityRank(lowest)) lowest = authority;\n\t}\n\treturn lowest;\n}\n\nexport function isReadOnlyAuthority(authority: LoadoutAuthority): boolean {\n\treturn authority === \"advisory\" || authority === \"read-only\" || authority === \"review-only\";\n}\n\nexport function isWritingRole(role: LoadoutRole): boolean {\n\treturn WRITING_ROLES.has(role);\n}\n\nexport function stripWriteToolsForAuthority(names: readonly string[], authority: LoadoutAuthority): StripNamesResult {\n\tif (!isReadOnlyAuthority(authority)) return { names: uniqueSorted(names), stripped: [] };\n\tconst stripped: StrippedCapability[] = [];\n\tconst kept: string[] = [];\n\tfor (const name of names) {\n\t\tif (WRITE_TOOLS.has(name)) {\n\t\t\tstripped.push({ kind: \"tool\", name, reason: \"read-only authority cannot activate write tools\" });\n\t\t\tcontinue;\n\t\t}\n\t\tkept.push(name);\n\t}\n\treturn { names: uniqueSorted(kept), stripped };\n}\n\nexport function isWriteLikeSkillName(name: string): boolean {\n\tconst lowerName = name.toLowerCase();\n\tif (READ_ONLY_SAFE_SKILLS.has(lowerName)) return false;\n\treturn WRITE_LIKE_SKILL_FRAGMENTS.some((fragment) => lowerName.includes(fragment));\n}\n\nexport function stripWriteSkillsForAuthority(names: readonly string[], authority: LoadoutAuthority): StripNamesResult {\n\tif (!isReadOnlyAuthority(authority)) return { names: uniqueSorted(names), stripped: [] };\n\tconst stripped: StrippedCapability[] = [];\n\tconst kept: string[] = [];\n\tfor (const name of names) {\n\t\tif (isWriteLikeSkillName(name)) {\n\t\t\tstripped.push({ kind: \"skill\", name, reason: \"read-only authority cannot activate write-like skills\" });\n\t\t\tcontinue;\n\t\t}\n\t\tkept.push(name);\n\t}\n\treturn { names: uniqueSorted(kept), stripped };\n}\n\nexport function stripWriteToolsForReadOnlyAuthority(names: readonly string[]): readonly string[] {\n\treturn stripWriteToolsForAuthority(names, \"read-only\").names;\n}\n\nexport function stripWriteSkillsForReadOnlyRole(names: readonly string[]): readonly string[] {\n\treturn stripWriteSkillsForAuthority(names, \"read-only\").names;\n}\n\nexport function downgradeMcpForAuthority(names: readonly string[], authority: LoadoutAuthority): McpDowngradeResult {\n\tif (!isReadOnlyAuthority(authority)) return { names: uniqueSorted(names), downgraded: [] };\n\tconst downgraded: McpDowngradeTrace[] = [];\n\tconst mapped = names.map((name) => {\n\t\tconst replacement = MCP_READONLY_DOWNGRADE[name];\n\t\tif (!replacement) return name;\n\t\tdowngraded.push({ mcp: name, to: replacement });\n\t\treturn replacement;\n\t});\n\treturn { names: uniqueSorted(mapped), downgraded: uniqueMcpDowngrades(downgraded) };\n}\n\nexport function downgradeMcpForReadOnlyRole(names: readonly string[]): readonly string[] {\n\treturn downgradeMcpForAuthority(names, \"read-only\").names;\n}\n\nexport function forceSecurityHooks(\n\tnames: readonly string[],\n\tforced: readonly string[] = SECURITY_HOOK_NAMES,\n): string[] {\n\treturn uniqueSorted([...names, ...forced]);\n}\n\nexport function commandModeRank(mode: CommandMode): number {\n\treturn COMMAND_MODE_RANK[mode];\n}\n\nexport function clampCommandModeForAuthority(mode: CommandMode, authority: LoadoutAuthority): CommandMode {\n\tif (authority === \"write-scoped\") return mode;\n\tif (authority === \"execute-tests\") {\n\t\treturn commandModeRank(mode) > commandModeRank(\"tests-only\") ? \"tests-only\" : mode;\n\t}\n\tif (commandModeRank(mode) > commandModeRank(\"read-only-shell\")) return \"read-only-shell\";\n\treturn mode;\n}\n\nexport function selectSafestCommandMode(\n\tauthority: LoadoutAuthority,\n\t...modes: readonly (CommandMode | undefined)[]\n): LoadoutCommands {\n\tconst normalized = modes.map((mode) => mode ?? \"none\");\n\tlet safest: CommandMode = \"scoped-shell\";\n\tfor (const mode of normalized) {\n\t\tif (commandModeRank(mode) < commandModeRank(safest)) safest = mode;\n\t}\n\treturn { mode: clampCommandModeForAuthority(safest, authority) };\n}\n\nexport function capabilityGateNames(\n\tgate: CapabilityGate | undefined,\n\tgroup: \"allow\" | \"exclude\" | \"require\" = \"allow\",\n): string[] {\n\tconst selectors = gate?.[group] ?? [];\n\tconst names: string[] = [];\n\tfor (const selector of selectors) {\n\t\tfor (const name of selector.names ?? []) names.push(name);\n\t}\n\treturn uniqueSorted(names);\n}\n\nexport function unionCapabilityGateNames(\n\tgroup: \"allow\" | \"exclude\" | \"require\",\n\t...gates: readonly (CapabilityGate | undefined)[]\n): string[] {\n\treturn uniqueSorted(gates.flatMap((gate) => capabilityGateNames(gate, group)));\n}\n\nexport function namesToCapabilityGate(\n\tkind: Exclude<ResourceKind, \"extension\" | \"prompt\" | \"theme\" | \"tool\">,\n\tnames: readonly string[],\n): CapabilityGate {\n\treturn { allow: [{ kind, names: uniqueSorted(names) }] };\n}\n\nexport function uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values.map((value) => value.trim()).filter((value) => value !== \"\"))].sort(compareString);\n}\n\nfunction uniqueMcpDowngrades(values: readonly McpDowngradeTrace[]): McpDowngradeTrace[] {\n\tconst seen = new Set<string>();\n\tconst result: McpDowngradeTrace[] = [];\n\tfor (const value of values) {\n\t\tconst key = `${value.mcp}\\0${value.to}`;\n\t\tif (seen.has(key)) continue;\n\t\tseen.add(key);\n\t\tresult.push(value);\n\t}\n\treturn result.sort((a, b) => compareString(a.mcp, b.mcp) || compareString(a.to, b.to));\n}\n\nfunction compareString(a: string, b: string): number {\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\n"]}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared safety helpers for loadout composition and domain dispatch.
|
|
3
|
+
*
|
|
4
|
+
* This module is pure and I/O-free. It centralizes authority ordering,
|
|
5
|
+
* read-only downgrades, write-capability stripping, security hook forcing, and
|
|
6
|
+
* command-mode clamping so additive composition modules cannot accidentally
|
|
7
|
+
* widen lane authority.
|
|
8
|
+
*/
|
|
9
|
+
export const SECURITY_HOOK_NAMES = ["pre-shell-guard", "protect-secrets", "stop-verify"];
|
|
10
|
+
export const SECURITY_HOOKS = new Set(SECURITY_HOOK_NAMES);
|
|
11
|
+
export const WRITE_TOOL_NAMES = ["edit", "write"];
|
|
12
|
+
export const WRITE_TOOLS = new Set(WRITE_TOOL_NAMES);
|
|
13
|
+
export const MCP_READONLY_DOWNGRADE = {
|
|
14
|
+
filesystem: "filesystem-readonly",
|
|
15
|
+
};
|
|
16
|
+
export const AUTHORITY_RANK = {
|
|
17
|
+
advisory: 0,
|
|
18
|
+
"read-only": 1,
|
|
19
|
+
"review-only": 1,
|
|
20
|
+
"security-review": 2,
|
|
21
|
+
"execute-tests": 3,
|
|
22
|
+
"write-scoped": 4,
|
|
23
|
+
};
|
|
24
|
+
export const COMMAND_MODE_RANK = {
|
|
25
|
+
none: 0,
|
|
26
|
+
"read-only-shell": 1,
|
|
27
|
+
"tests-only": 2,
|
|
28
|
+
"scoped-shell": 3,
|
|
29
|
+
};
|
|
30
|
+
const WRITING_ROLES = new Set([
|
|
31
|
+
"coder",
|
|
32
|
+
"tester",
|
|
33
|
+
"security",
|
|
34
|
+
"synthesizer",
|
|
35
|
+
"package-maintainer",
|
|
36
|
+
]);
|
|
37
|
+
const READ_ONLY_SAFE_SKILLS = new Set([
|
|
38
|
+
"analyze",
|
|
39
|
+
"audit-context-building",
|
|
40
|
+
"best-practice-research",
|
|
41
|
+
"code-review",
|
|
42
|
+
"contrast-checker",
|
|
43
|
+
"differential-review",
|
|
44
|
+
"fp-check",
|
|
45
|
+
"literature-review",
|
|
46
|
+
"security-review",
|
|
47
|
+
"understand-chat",
|
|
48
|
+
"use-of-color",
|
|
49
|
+
"verification-before-completion",
|
|
50
|
+
"web-design-guidelines",
|
|
51
|
+
]);
|
|
52
|
+
const WRITE_LIKE_SKILL_FRAGMENTS = [
|
|
53
|
+
"add-",
|
|
54
|
+
"build",
|
|
55
|
+
"clone",
|
|
56
|
+
"commit",
|
|
57
|
+
"create",
|
|
58
|
+
"deploy",
|
|
59
|
+
"edit",
|
|
60
|
+
"fix",
|
|
61
|
+
"frontend-ui-engineering",
|
|
62
|
+
"generate",
|
|
63
|
+
"implement",
|
|
64
|
+
"land-and-deploy",
|
|
65
|
+
"publish",
|
|
66
|
+
"redesign",
|
|
67
|
+
"ship",
|
|
68
|
+
"tdd",
|
|
69
|
+
"test-driven-development",
|
|
70
|
+
"update",
|
|
71
|
+
"visual-ralph",
|
|
72
|
+
"write-",
|
|
73
|
+
];
|
|
74
|
+
export const WRITE_SKILLS = new Set(WRITE_LIKE_SKILL_FRAGMENTS);
|
|
75
|
+
export function authorityRank(authority) {
|
|
76
|
+
return AUTHORITY_RANK[authority];
|
|
77
|
+
}
|
|
78
|
+
export function minAuthority(...authorities) {
|
|
79
|
+
const present = authorities.filter((authority) => authority !== undefined);
|
|
80
|
+
if (present.length === 0)
|
|
81
|
+
return "advisory";
|
|
82
|
+
let lowest = present[0];
|
|
83
|
+
for (const authority of present.slice(1)) {
|
|
84
|
+
if (authorityRank(authority) < authorityRank(lowest))
|
|
85
|
+
lowest = authority;
|
|
86
|
+
}
|
|
87
|
+
return lowest;
|
|
88
|
+
}
|
|
89
|
+
export function isReadOnlyAuthority(authority) {
|
|
90
|
+
return authority === "advisory" || authority === "read-only" || authority === "review-only";
|
|
91
|
+
}
|
|
92
|
+
export function isWritingRole(role) {
|
|
93
|
+
return WRITING_ROLES.has(role);
|
|
94
|
+
}
|
|
95
|
+
export function stripWriteToolsForAuthority(names, authority) {
|
|
96
|
+
if (!isReadOnlyAuthority(authority))
|
|
97
|
+
return { names: uniqueSorted(names), stripped: [] };
|
|
98
|
+
const stripped = [];
|
|
99
|
+
const kept = [];
|
|
100
|
+
for (const name of names) {
|
|
101
|
+
if (WRITE_TOOLS.has(name)) {
|
|
102
|
+
stripped.push({ kind: "tool", name, reason: "read-only authority cannot activate write tools" });
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
kept.push(name);
|
|
106
|
+
}
|
|
107
|
+
return { names: uniqueSorted(kept), stripped };
|
|
108
|
+
}
|
|
109
|
+
export function isWriteLikeSkillName(name) {
|
|
110
|
+
const lowerName = name.toLowerCase();
|
|
111
|
+
if (READ_ONLY_SAFE_SKILLS.has(lowerName))
|
|
112
|
+
return false;
|
|
113
|
+
return WRITE_LIKE_SKILL_FRAGMENTS.some((fragment) => lowerName.includes(fragment));
|
|
114
|
+
}
|
|
115
|
+
export function stripWriteSkillsForAuthority(names, authority) {
|
|
116
|
+
if (!isReadOnlyAuthority(authority))
|
|
117
|
+
return { names: uniqueSorted(names), stripped: [] };
|
|
118
|
+
const stripped = [];
|
|
119
|
+
const kept = [];
|
|
120
|
+
for (const name of names) {
|
|
121
|
+
if (isWriteLikeSkillName(name)) {
|
|
122
|
+
stripped.push({ kind: "skill", name, reason: "read-only authority cannot activate write-like skills" });
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
kept.push(name);
|
|
126
|
+
}
|
|
127
|
+
return { names: uniqueSorted(kept), stripped };
|
|
128
|
+
}
|
|
129
|
+
export function stripWriteToolsForReadOnlyAuthority(names) {
|
|
130
|
+
return stripWriteToolsForAuthority(names, "read-only").names;
|
|
131
|
+
}
|
|
132
|
+
export function stripWriteSkillsForReadOnlyRole(names) {
|
|
133
|
+
return stripWriteSkillsForAuthority(names, "read-only").names;
|
|
134
|
+
}
|
|
135
|
+
export function downgradeMcpForAuthority(names, authority) {
|
|
136
|
+
if (!isReadOnlyAuthority(authority))
|
|
137
|
+
return { names: uniqueSorted(names), downgraded: [] };
|
|
138
|
+
const downgraded = [];
|
|
139
|
+
const mapped = names.map((name) => {
|
|
140
|
+
const replacement = MCP_READONLY_DOWNGRADE[name];
|
|
141
|
+
if (!replacement)
|
|
142
|
+
return name;
|
|
143
|
+
downgraded.push({ mcp: name, to: replacement });
|
|
144
|
+
return replacement;
|
|
145
|
+
});
|
|
146
|
+
return { names: uniqueSorted(mapped), downgraded: uniqueMcpDowngrades(downgraded) };
|
|
147
|
+
}
|
|
148
|
+
export function downgradeMcpForReadOnlyRole(names) {
|
|
149
|
+
return downgradeMcpForAuthority(names, "read-only").names;
|
|
150
|
+
}
|
|
151
|
+
export function forceSecurityHooks(names, forced = SECURITY_HOOK_NAMES) {
|
|
152
|
+
return uniqueSorted([...names, ...forced]);
|
|
153
|
+
}
|
|
154
|
+
export function commandModeRank(mode) {
|
|
155
|
+
return COMMAND_MODE_RANK[mode];
|
|
156
|
+
}
|
|
157
|
+
export function clampCommandModeForAuthority(mode, authority) {
|
|
158
|
+
if (authority === "write-scoped")
|
|
159
|
+
return mode;
|
|
160
|
+
if (authority === "execute-tests") {
|
|
161
|
+
return commandModeRank(mode) > commandModeRank("tests-only") ? "tests-only" : mode;
|
|
162
|
+
}
|
|
163
|
+
if (commandModeRank(mode) > commandModeRank("read-only-shell"))
|
|
164
|
+
return "read-only-shell";
|
|
165
|
+
return mode;
|
|
166
|
+
}
|
|
167
|
+
export function selectSafestCommandMode(authority, ...modes) {
|
|
168
|
+
const normalized = modes.map((mode) => mode ?? "none");
|
|
169
|
+
let safest = "scoped-shell";
|
|
170
|
+
for (const mode of normalized) {
|
|
171
|
+
if (commandModeRank(mode) < commandModeRank(safest))
|
|
172
|
+
safest = mode;
|
|
173
|
+
}
|
|
174
|
+
return { mode: clampCommandModeForAuthority(safest, authority) };
|
|
175
|
+
}
|
|
176
|
+
export function capabilityGateNames(gate, group = "allow") {
|
|
177
|
+
const selectors = gate?.[group] ?? [];
|
|
178
|
+
const names = [];
|
|
179
|
+
for (const selector of selectors) {
|
|
180
|
+
for (const name of selector.names ?? [])
|
|
181
|
+
names.push(name);
|
|
182
|
+
}
|
|
183
|
+
return uniqueSorted(names);
|
|
184
|
+
}
|
|
185
|
+
export function unionCapabilityGateNames(group, ...gates) {
|
|
186
|
+
return uniqueSorted(gates.flatMap((gate) => capabilityGateNames(gate, group)));
|
|
187
|
+
}
|
|
188
|
+
export function namesToCapabilityGate(kind, names) {
|
|
189
|
+
return { allow: [{ kind, names: uniqueSorted(names) }] };
|
|
190
|
+
}
|
|
191
|
+
export function uniqueSorted(values) {
|
|
192
|
+
return [...new Set(values.map((value) => value.trim()).filter((value) => value !== ""))].sort(compareString);
|
|
193
|
+
}
|
|
194
|
+
function uniqueMcpDowngrades(values) {
|
|
195
|
+
const seen = new Set();
|
|
196
|
+
const result = [];
|
|
197
|
+
for (const value of values) {
|
|
198
|
+
const key = `${value.mcp}\0${value.to}`;
|
|
199
|
+
if (seen.has(key))
|
|
200
|
+
continue;
|
|
201
|
+
seen.add(key);
|
|
202
|
+
result.push(value);
|
|
203
|
+
}
|
|
204
|
+
return result.sort((a, b) => compareString(a.mcp, b.mcp) || compareString(a.to, b.to));
|
|
205
|
+
}
|
|
206
|
+
function compareString(a, b) {
|
|
207
|
+
if (a < b)
|
|
208
|
+
return -1;
|
|
209
|
+
if (a > b)
|
|
210
|
+
return 1;
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=loadout-safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadout-safety.js","sourceRoot":"","sources":["../../src/core/loadout-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkCH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,CAAU,CAAC;AAClG,MAAM,CAAC,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAC3D,MAAM,CAAC,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,sBAAsB,GAAqC;IACvE,UAAU,EAAE,qBAAqB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAA+C;IACzE,QAAQ,EAAE,CAAC;IACX,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,CAAC;IAChB,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC;IAClB,cAAc,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAA0C;IACvE,IAAI,EAAE,CAAC;IACP,iBAAiB,EAAE,CAAC;IACpB,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,aAAa,GAA6B,IAAI,GAAG,CAAC;IACvD,OAAO;IACP,QAAQ;IACR,UAAU;IACV,aAAa;IACb,oBAAoB;CACpB,CAAC,CAAC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,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAAA,CAC7G;AAED,SAAS,mBAAmB,CAAC,MAAoC,EAAuB;IACvF,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,EAAE,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAAA,CACvF;AAED,SAAS,aAAa,CAAC,CAAS,EAAE,CAAS,EAAU;IACpD,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC,CAAC;IACrB,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AAAA,CACT","sourcesContent":["/**\n * Shared safety helpers for loadout composition and domain dispatch.\n *\n * This module is pure and I/O-free. It centralizes authority ordering,\n * read-only downgrades, write-capability stripping, security hook forcing, and\n * command-mode clamping so additive composition modules cannot accidentally\n * widen lane authority.\n */\n\nimport type {\n\tCapabilityGate,\n\tCommandMode,\n\tLoadoutAuthority,\n\tLoadoutCommands,\n\tLoadoutRole,\n\tResourceKind,\n} from \"./loadouts.ts\";\n\nexport type CapabilityGateNameKind = \"tool\" | \"skill\" | \"mcp\" | \"hook\";\n\nexport interface StrippedCapability {\n\treadonly kind: CapabilityGateNameKind;\n\treadonly name: string;\n\treadonly reason: string;\n}\n\nexport interface StripNamesResult {\n\treadonly names: readonly string[];\n\treadonly stripped: readonly StrippedCapability[];\n}\n\nexport interface McpDowngradeTrace {\n\treadonly mcp: string;\n\treadonly to: string;\n}\n\nexport interface McpDowngradeResult {\n\treadonly names: readonly string[];\n\treadonly downgraded: readonly McpDowngradeTrace[];\n}\n\nexport const SECURITY_HOOK_NAMES = [\"pre-shell-guard\", \"protect-secrets\", \"stop-verify\"] as const;\nexport const SECURITY_HOOKS: ReadonlySet<string> = new Set(SECURITY_HOOK_NAMES);\n\nexport const WRITE_TOOL_NAMES = [\"edit\", \"write\"] as const;\nexport const WRITE_TOOLS: ReadonlySet<string> = new Set(WRITE_TOOL_NAMES);\n\nexport const MCP_READONLY_DOWNGRADE: Readonly<Record<string, string>> = {\n\tfilesystem: \"filesystem-readonly\",\n};\n\nexport const AUTHORITY_RANK: Readonly<Record<LoadoutAuthority, number>> = {\n\tadvisory: 0,\n\t\"read-only\": 1,\n\t\"review-only\": 1,\n\t\"security-review\": 2,\n\t\"execute-tests\": 3,\n\t\"write-scoped\": 4,\n};\n\nexport const COMMAND_MODE_RANK: Readonly<Record<CommandMode, number>> = {\n\tnone: 0,\n\t\"read-only-shell\": 1,\n\t\"tests-only\": 2,\n\t\"scoped-shell\": 3,\n};\n\nconst WRITING_ROLES: ReadonlySet<LoadoutRole> = new Set([\n\t\"coder\",\n\t\"tester\",\n\t\"security\",\n\t\"synthesizer\",\n\t\"package-maintainer\",\n]);\n\nconst READ_ONLY_SAFE_SKILLS: ReadonlySet<string> = new Set([\n\t\"analyze\",\n\t\"audit-context-building\",\n\t\"best-practice-research\",\n\t\"code-review\",\n\t\"contrast-checker\",\n\t\"differential-review\",\n\t\"fp-check\",\n\t\"literature-review\",\n\t\"security-review\",\n\t\"understand-chat\",\n\t\"use-of-color\",\n\t\"verification-before-completion\",\n\t\"web-design-guidelines\",\n]);\n\nconst WRITE_LIKE_SKILL_FRAGMENTS = [\n\t\"add-\",\n\t\"build\",\n\t\"clone\",\n\t\"commit\",\n\t\"create\",\n\t\"deploy\",\n\t\"edit\",\n\t\"fix\",\n\t\"frontend-ui-engineering\",\n\t\"generate\",\n\t\"implement\",\n\t\"land-and-deploy\",\n\t\"publish\",\n\t\"redesign\",\n\t\"ship\",\n\t\"tdd\",\n\t\"test-driven-development\",\n\t\"update\",\n\t\"visual-ralph\",\n\t\"write-\",\n] as const;\n\nexport const WRITE_SKILLS: ReadonlySet<string> = new Set(WRITE_LIKE_SKILL_FRAGMENTS);\n\nexport function authorityRank(authority: LoadoutAuthority): number {\n\treturn AUTHORITY_RANK[authority];\n}\n\nexport function minAuthority(...authorities: readonly (LoadoutAuthority | undefined)[]): LoadoutAuthority {\n\tconst present = authorities.filter((authority): authority is LoadoutAuthority => authority !== undefined);\n\tif (present.length === 0) return \"advisory\";\n\tlet lowest = present[0];\n\tfor (const authority of present.slice(1)) {\n\t\tif (authorityRank(authority) < authorityRank(lowest)) lowest = authority;\n\t}\n\treturn lowest;\n}\n\nexport function isReadOnlyAuthority(authority: LoadoutAuthority): boolean {\n\treturn authority === \"advisory\" || authority === \"read-only\" || authority === \"review-only\";\n}\n\nexport function isWritingRole(role: LoadoutRole): boolean {\n\treturn WRITING_ROLES.has(role);\n}\n\nexport function stripWriteToolsForAuthority(names: readonly string[], authority: LoadoutAuthority): StripNamesResult {\n\tif (!isReadOnlyAuthority(authority)) return { names: uniqueSorted(names), stripped: [] };\n\tconst stripped: StrippedCapability[] = [];\n\tconst kept: string[] = [];\n\tfor (const name of names) {\n\t\tif (WRITE_TOOLS.has(name)) {\n\t\t\tstripped.push({ kind: \"tool\", name, reason: \"read-only authority cannot activate write tools\" });\n\t\t\tcontinue;\n\t\t}\n\t\tkept.push(name);\n\t}\n\treturn { names: uniqueSorted(kept), stripped };\n}\n\nexport function isWriteLikeSkillName(name: string): boolean {\n\tconst lowerName = name.toLowerCase();\n\tif (READ_ONLY_SAFE_SKILLS.has(lowerName)) return false;\n\treturn WRITE_LIKE_SKILL_FRAGMENTS.some((fragment) => lowerName.includes(fragment));\n}\n\nexport function stripWriteSkillsForAuthority(names: readonly string[], authority: LoadoutAuthority): StripNamesResult {\n\tif (!isReadOnlyAuthority(authority)) return { names: uniqueSorted(names), stripped: [] };\n\tconst stripped: StrippedCapability[] = [];\n\tconst kept: string[] = [];\n\tfor (const name of names) {\n\t\tif (isWriteLikeSkillName(name)) {\n\t\t\tstripped.push({ kind: \"skill\", name, reason: \"read-only authority cannot activate write-like skills\" });\n\t\t\tcontinue;\n\t\t}\n\t\tkept.push(name);\n\t}\n\treturn { names: uniqueSorted(kept), stripped };\n}\n\nexport function stripWriteToolsForReadOnlyAuthority(names: readonly string[]): readonly string[] {\n\treturn stripWriteToolsForAuthority(names, \"read-only\").names;\n}\n\nexport function stripWriteSkillsForReadOnlyRole(names: readonly string[]): readonly string[] {\n\treturn stripWriteSkillsForAuthority(names, \"read-only\").names;\n}\n\nexport function downgradeMcpForAuthority(names: readonly string[], authority: LoadoutAuthority): McpDowngradeResult {\n\tif (!isReadOnlyAuthority(authority)) return { names: uniqueSorted(names), downgraded: [] };\n\tconst downgraded: McpDowngradeTrace[] = [];\n\tconst mapped = names.map((name) => {\n\t\tconst replacement = MCP_READONLY_DOWNGRADE[name];\n\t\tif (!replacement) return name;\n\t\tdowngraded.push({ mcp: name, to: replacement });\n\t\treturn replacement;\n\t});\n\treturn { names: uniqueSorted(mapped), downgraded: uniqueMcpDowngrades(downgraded) };\n}\n\nexport function downgradeMcpForReadOnlyRole(names: readonly string[]): readonly string[] {\n\treturn downgradeMcpForAuthority(names, \"read-only\").names;\n}\n\nexport function forceSecurityHooks(\n\tnames: readonly string[],\n\tforced: readonly string[] = SECURITY_HOOK_NAMES,\n): string[] {\n\treturn uniqueSorted([...names, ...forced]);\n}\n\nexport function commandModeRank(mode: CommandMode): number {\n\treturn COMMAND_MODE_RANK[mode];\n}\n\nexport function clampCommandModeForAuthority(mode: CommandMode, authority: LoadoutAuthority): CommandMode {\n\tif (authority === \"write-scoped\") return mode;\n\tif (authority === \"execute-tests\") {\n\t\treturn commandModeRank(mode) > commandModeRank(\"tests-only\") ? \"tests-only\" : mode;\n\t}\n\tif (commandModeRank(mode) > commandModeRank(\"read-only-shell\")) return \"read-only-shell\";\n\treturn mode;\n}\n\nexport function selectSafestCommandMode(\n\tauthority: LoadoutAuthority,\n\t...modes: readonly (CommandMode | undefined)[]\n): LoadoutCommands {\n\tconst normalized = modes.map((mode) => mode ?? \"none\");\n\tlet safest: CommandMode = \"scoped-shell\";\n\tfor (const mode of normalized) {\n\t\tif (commandModeRank(mode) < commandModeRank(safest)) safest = mode;\n\t}\n\treturn { mode: clampCommandModeForAuthority(safest, authority) };\n}\n\nexport function capabilityGateNames(\n\tgate: CapabilityGate | undefined,\n\tgroup: \"allow\" | \"exclude\" | \"require\" = \"allow\",\n): string[] {\n\tconst selectors = gate?.[group] ?? [];\n\tconst names: string[] = [];\n\tfor (const selector of selectors) {\n\t\tfor (const name of selector.names ?? []) names.push(name);\n\t}\n\treturn uniqueSorted(names);\n}\n\nexport function unionCapabilityGateNames(\n\tgroup: \"allow\" | \"exclude\" | \"require\",\n\t...gates: readonly (CapabilityGate | undefined)[]\n): string[] {\n\treturn uniqueSorted(gates.flatMap((gate) => capabilityGateNames(gate, group)));\n}\n\nexport function namesToCapabilityGate(\n\tkind: Exclude<ResourceKind, \"extension\" | \"prompt\" | \"theme\" | \"tool\">,\n\tnames: readonly string[],\n): CapabilityGate {\n\treturn { allow: [{ kind, names: uniqueSorted(names) }] };\n}\n\nexport function uniqueSorted(values: readonly string[]): string[] {\n\treturn [...new Set(values.map((value) => value.trim()).filter((value) => value !== \"\"))].sort(compareString);\n}\n\nfunction uniqueMcpDowngrades(values: readonly McpDowngradeTrace[]): McpDowngradeTrace[] {\n\tconst seen = new Set<string>();\n\tconst result: McpDowngradeTrace[] = [];\n\tfor (const value of values) {\n\t\tconst key = `${value.mcp}\\0${value.to}`;\n\t\tif (seen.has(key)) continue;\n\t\tseen.add(key);\n\t\tresult.push(value);\n\t}\n\treturn result.sort((a, b) => compareString(a.mcp, b.mcp) || compareString(a.to, b.to));\n}\n\nfunction compareString(a: string, b: string): number {\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\n"]}
|
package/dist/core/loadouts.d.ts
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* prompt construction, MCP runtime, scheduler admission) lives in sibling
|
|
9
9
|
* modules and consumes the decisions made here.
|
|
10
10
|
*
|
|
11
|
-
* Schema and presets follow
|
|
11
|
+
* Schema and presets follow the OMK package hardening loadout plan.
|
|
12
12
|
*
|
|
13
13
|
* Erasable TypeScript only (no enum/namespace/parameter properties).
|
|
14
14
|
*/
|
|
15
|
+
import type { HookPolicyMetadata } from "./hooks/index.ts";
|
|
15
16
|
export type LoadoutAuthority = "advisory" | "read-only" | "execute-tests" | "write-scoped" | "review-only" | "security-review";
|
|
16
|
-
export type LoadoutRole = "planner" | "explorer" | "coder" | "tester" | "reviewer" | "security" | "synthesizer" | "package-maintainer";
|
|
17
|
+
export type LoadoutRole = "planner" | "explorer" | "architect" | "coder" | "executor" | "tester" | "reviewer" | "critic" | "security" | "visual-qa" | "rhwp-doc" | "synthesizer" | "package-maintainer";
|
|
17
18
|
/** Resource kinds the loadout layer can describe. Only the last four are gated here. */
|
|
18
19
|
export type ResourceKind = "extension" | "skill" | "prompt" | "theme" | "tool" | "mcp" | "hook";
|
|
19
20
|
export type ResourceOrigin = "package" | "top-level";
|
|
@@ -28,6 +29,7 @@ export interface NamedResource {
|
|
|
28
29
|
/** Package-relative or absolute resource path, when meaningful (skills/prompts). */
|
|
29
30
|
path?: string;
|
|
30
31
|
origin?: ResourceOrigin;
|
|
32
|
+
policy?: HookPolicyMetadata;
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* A selector matches inventory resources by name and/or provenance criteria.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadouts.d.ts","sourceRoot":"","sources":["../../src/core/loadouts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,gBAAgB,GACzB,UAAU,GACV,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,iBAAiB,CAAC;AAErB,MAAM,MAAM,WAAW,GACpB,SAAS,GACT,UAAU,GACV,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,aAAa,GACb,oBAAoB,CAAC;AAExB,wFAAwF;AACxF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAChG,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,iBAAiB,GAAG,YAAY,GAAG,cAAc,CAAC;AACrF,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAEnF,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,IAAI,EA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;AAED,MAAM,WAAW,wBAAwB;IACxC,IAAI,EAAE,WAAW,CAAC;IAClB,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAsDD,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA2ErE,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAmB7D;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAElG;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,YAAY,CAWnE;AAED,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,mBAAmB,EAC9B,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,gBAAgB,CAAA;CAAO,GACjD,cAAc,CAuBhB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAwBjF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,GAAG,eAAe,CAMtF;AASD,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ5D","sourcesContent":["/**\n * Pure loadout / lane-profile algorithms for the OMK control plane.\n *\n * This module is I/O-free. It owns the loadout schema, built-in presets,\n * capability gating (allow/exclude/require selectors), profile validation, and\n * the derivation of scheduler read/write/parallelizable fields from a lane's\n * optional assigned paths. Runtime wiring (AgentSession tool registry, skill\n * prompt construction, MCP runtime, scheduler admission) lives in sibling\n * modules and consumes the decisions made here.\n *\n * Schema and presets follow `.omk/runs/omk-pi-package-hardening-plan/loadout.md`.\n *\n * Erasable TypeScript only (no enum/namespace/parameter properties).\n */\n\nexport type LoadoutAuthority =\n\t| \"advisory\"\n\t| \"read-only\"\n\t| \"execute-tests\"\n\t| \"write-scoped\"\n\t| \"review-only\"\n\t| \"security-review\";\n\nexport type LoadoutRole =\n\t| \"planner\"\n\t| \"explorer\"\n\t| \"coder\"\n\t| \"tester\"\n\t| \"reviewer\"\n\t| \"security\"\n\t| \"synthesizer\"\n\t| \"package-maintainer\";\n\n/** Resource kinds the loadout layer can describe. Only the last four are gated here. */\nexport type ResourceKind = \"extension\" | \"skill\" | \"prompt\" | \"theme\" | \"tool\" | \"mcp\" | \"hook\";\nexport type ResourceOrigin = \"package\" | \"top-level\";\nexport type SourceScope = \"user\" | \"project\" | \"temporary\" | \"builtin\";\nexport type CommandMode = \"none\" | \"read-only-shell\" | \"tests-only\" | \"scoped-shell\";\nexport type ToolDefaultMode = \"default-builtins\" | \"no-tools\" | \"no-builtin-tools\";\n\nexport interface NamedResource {\n\tkind: ResourceKind;\n\tname: string;\n\tsource?: string;\n\tscope?: SourceScope;\n\t/** Package-relative or absolute resource path, when meaningful (skills/prompts). */\n\tpath?: string;\n\torigin?: ResourceOrigin;\n}\n\n/**\n * A selector matches inventory resources by name and/or provenance criteria.\n * A resource matches when its kind equals `kind` and every defined criterion\n * matches (names is an OR over the listed names; paths/sources are OR over globs).\n */\nexport interface ResourceSelector {\n\tkind: ResourceKind;\n\tnames?: readonly string[];\n\t/** Glob patterns matched against `NamedResource.path`. */\n\tpaths?: readonly string[];\n\t/** Glob patterns matched against `NamedResource.source`. */\n\tsources?: readonly string[];\n\tscopes?: readonly SourceScope[];\n\torigins?: readonly ResourceOrigin[];\n\t/** Marker only; requirement is expressed by placement in `CapabilityGate.require`. */\n\trequired?: boolean;\n}\n\n/** Tool gating uses flat name arrays (mapped to SDK tools / setActiveTools). */\nexport interface ToolGate {\n\tallow?: readonly string[];\n\texclude?: readonly string[];\n\trequire?: readonly string[];\n\tdefaultMode?: ToolDefaultMode;\n}\n\n/** Skills / MCP / hooks gating uses selector arrays. */\nexport interface CapabilityGate {\n\tallow?: readonly ResourceSelector[];\n\texclude?: readonly ResourceSelector[];\n\trequire?: readonly ResourceSelector[];\n}\n\nexport interface LoadoutCommands {\n\tmode: CommandMode;\n\tallowPatterns?: readonly string[];\n\tblockPatterns?: readonly string[];\n}\n\nexport interface LoadoutEvidence {\n\trequired: boolean;\n\toutputPattern: string;\n}\n\nexport interface LoadoutProfile {\n\tschemaVersion: \"omk.loadout.v1\";\n\tname: string;\n\tdescription?: string;\n\tauthority: LoadoutAuthority;\n\ttools: ToolGate;\n\tskills?: CapabilityGate;\n\tmcp?: CapabilityGate;\n\thooks?: CapabilityGate;\n\tcommands?: LoadoutCommands;\n\tevidence?: LoadoutEvidence;\n}\n\nexport interface CapabilityInventory {\n\ttools: readonly NamedResource[];\n\tskills: readonly NamedResource[];\n\tmcp: readonly NamedResource[];\n\thooks: readonly NamedResource[];\n}\n\nexport interface LaneDefaults {\n\tloadout: string;\n\tauthority: LoadoutAuthority;\n\tparallelizable: boolean;\n\treadOnly: boolean;\n\twritesProductFiles: boolean;\n}\n\nexport interface AppliedLoadout {\n\tprofileName: string;\n\tauthority: LoadoutAuthority;\n\tactiveTools: string[];\n\tactiveSkills: string[];\n\tactiveMcp: string[];\n\tactiveHooks: string[];\n\tblockers: string[];\n\twarnings: string[];\n}\n\nexport interface LoadoutValidation {\n\tvalid: boolean;\n\terrors: string[];\n}\n\n/** A scheduler access entry; shape matches `AccessSetEntry` in the orchestration layer. */\nexport interface LoadoutAccessEntry {\n\tpath: string;\n\tsymbols?: readonly string[];\n}\n\nexport interface SchedulerFields {\n\treadSet: LoadoutAccessEntry[];\n\twriteSet: LoadoutAccessEntry[];\n\tparallelizable: boolean;\n}\n\nexport interface SchedulerDerivationInput {\n\trole: LoadoutRole;\n\tassignedReadPaths?: readonly string[];\n\tassignedWritePaths?: readonly string[];\n}\n\nconst AUTHORITY_RANK: Record<LoadoutAuthority, number> = {\n\tadvisory: 0,\n\t\"read-only\": 1,\n\t\"review-only\": 1,\n\t\"security-review\": 2,\n\t\"execute-tests\": 3,\n\t\"write-scoped\": 4,\n};\n\nconst KNOWN_RESOURCE_KINDS: ReadonlySet<ResourceKind> = new Set([\n\t\"extension\",\n\t\"skill\",\n\t\"prompt\",\n\t\"theme\",\n\t\"tool\",\n\t\"mcp\",\n\t\"hook\",\n]);\n\nconst KNOWN_COMMAND_MODES: ReadonlySet<CommandMode> = new Set([\n\t\"none\",\n\t\"read-only-shell\",\n\t\"tests-only\",\n\t\"scoped-shell\",\n]);\n\nconst KNOWN_TOOL_DEFAULT_MODES: ReadonlySet<ToolDefaultMode> = new Set([\n\t\"default-builtins\",\n\t\"no-tools\",\n\t\"no-builtin-tools\",\n]);\n\n/** Roles permitted to declare a non-empty writeSet during scheduler derivation. */\nconst WRITING_ROLES: ReadonlySet<LoadoutRole> = new Set([\n\t\"coder\",\n\t\"tester\",\n\t\"security\",\n\t\"synthesizer\",\n\t\"package-maintainer\",\n]);\n\nconst LOCKFILE_BASENAMES: ReadonlySet<string> = new Set([\n\t\"package-lock.json\",\n\t\"npm-shrinkwrap.json\",\n\t\"yarn.lock\",\n\t\"pnpm-lock.yaml\",\n]);\n\nfunction allowNames(kind: ResourceKind, names: readonly string[]): CapabilityGate {\n\treturn { allow: [{ kind, names }] };\n}\n\nexport const BUILTIN_LOADOUTS: Readonly<Record<string, LoadoutProfile>> = {\n\tinspect: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"inspect\",\n\t\tauthority: \"read-only\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\"] },\n\t\tskills: allowNames(\"skill\", [\"understand-chat\", \"analyze\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem-readonly\", \"memory\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\"]),\n\t},\n\tplan: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"plan\",\n\t\tauthority: \"advisory\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\"] },\n\t\tskills: allowNames(\"skill\", [\"adaptorch-route\", \"writing-plans\", \"ddd-software-architecture\"]),\n\t\tmcp: allowNames(\"mcp\", [\"memory\", \"adaptorch\"]),\n\t\thooks: allowNames(\"hook\", [\"session-context\", \"precompact-checkpoint\"]),\n\t},\n\tcode: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"code\",\n\t\tauthority: \"write-scoped\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"test-driven-development\", \"coding-standards\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\", \"context7\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"typecheck-after-edit\"]),\n\t\tcommands: { mode: \"scoped-shell\" },\n\t},\n\ttest: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"test\",\n\t\tauthority: \"execute-tests\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"verification-before-completion\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"stop-verify\"]),\n\t\tcommands: { mode: \"tests-only\" },\n\t},\n\treview: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"review\",\n\t\tauthority: \"review-only\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\"] },\n\t\tskills: allowNames(\"skill\", [\"code-review\", \"differential-review\"]),\n\t\tmcp: allowNames(\"mcp\", [\"memory\"]),\n\t\thooks: allowNames(\"hook\", [\"stop-verify\", \"subagent-stop-audit\"]),\n\t},\n\tsecurity: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"security\",\n\t\tauthority: \"security-review\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"security-review\", \"differential-review\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem-readonly\", \"memory\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"stop-verify\"]),\n\t\tcommands: { mode: \"read-only-shell\" },\n\t},\n\t\"package-maintainer\": {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"package-maintainer\",\n\t\tauthority: \"write-scoped\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"security-review\", \"verification-before-completion\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"npm-audit-summary\"]),\n\t\tcommands: { mode: \"scoped-shell\" },\n\t},\n\tnone: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"none\",\n\t\tauthority: \"advisory\",\n\t\ttools: { allow: [], defaultMode: \"no-tools\" },\n\t\tcommands: { mode: \"none\" },\n\t},\n};\n\nexport function inferLoadoutForRole(role: LoadoutRole): string {\n\tswitch (role) {\n\t\tcase \"planner\":\n\t\t\treturn \"plan\";\n\t\tcase \"explorer\":\n\t\t\treturn \"inspect\";\n\t\tcase \"coder\":\n\t\t\treturn \"code\";\n\t\tcase \"tester\":\n\t\t\treturn \"test\";\n\t\tcase \"reviewer\":\n\t\t\treturn \"review\";\n\t\tcase \"security\":\n\t\t\treturn \"security\";\n\t\tcase \"package-maintainer\":\n\t\t\treturn \"package-maintainer\";\n\t\tcase \"synthesizer\":\n\t\t\treturn \"plan\";\n\t}\n}\n\nexport function authorityWithinGrant(requested: LoadoutAuthority, grant: LoadoutAuthority): boolean {\n\treturn AUTHORITY_RANK[requested] <= AUTHORITY_RANK[grant];\n}\n\nexport function laneDefaultsForRole(role: LoadoutRole): LaneDefaults {\n\tconst loadout = inferLoadoutForRole(role);\n\tconst profile = BUILTIN_LOADOUTS[loadout];\n\treturn {\n\t\tloadout,\n\t\tauthority: profile.authority,\n\t\tparallelizable: profile.authority !== \"write-scoped\",\n\t\treadOnly:\n\t\t\tprofile.authority === \"read-only\" || profile.authority === \"review-only\" || profile.authority === \"advisory\",\n\t\twritesProductFiles: profile.authority === \"write-scoped\",\n\t};\n}\n\nexport function applyLoadoutProfile(\n\tprofile: LoadoutProfile,\n\tinventory: CapabilityInventory,\n\toptions: { grantAuthority?: LoadoutAuthority } = {},\n): AppliedLoadout {\n\tconst blockers: string[] = [];\n\tconst warnings: string[] = [];\n\t// Deterministic blocker order: authority, then tool/skill/mcp/hook requires.\n\tif (options.grantAuthority && !authorityWithinGrant(profile.authority, options.grantAuthority)) {\n\t\tblockers.push(`loadout authority ${profile.authority} exceeds grant ${options.grantAuthority}`);\n\t}\n\n\tconst activeTools = applyToolGate(profile.tools, inventory.tools, blockers, warnings);\n\tconst activeSkills = applyCapabilityGate(\"skill\", profile.skills, inventory.skills, blockers, warnings);\n\tconst activeMcp = applyCapabilityGate(\"mcp\", profile.mcp, inventory.mcp, blockers, warnings);\n\tconst activeHooks = applyCapabilityGate(\"hook\", profile.hooks, inventory.hooks, blockers, warnings);\n\n\treturn {\n\t\tprofileName: profile.name,\n\t\tauthority: profile.authority,\n\t\tactiveTools,\n\t\tactiveSkills,\n\t\tactiveMcp,\n\t\tactiveHooks,\n\t\tblockers,\n\t\twarnings,\n\t};\n}\n\n/**\n * Fail-closed structural validation of a loadout profile. Errors are returned\n * in a deterministic order: schemaVersion, name, authority, tools, skills, mcp,\n * hooks, commands.\n */\nexport function validateLoadoutProfile(profile: LoadoutProfile): LoadoutValidation {\n\tconst errors: string[] = [];\n\tif (profile.schemaVersion !== \"omk.loadout.v1\") {\n\t\terrors.push(`unknown schemaVersion: ${String(profile.schemaVersion)}`);\n\t}\n\tif (typeof profile.name !== \"string\" || profile.name.trim() === \"\") {\n\t\terrors.push(\"missing loadout name\");\n\t}\n\tif (!(profile.authority in AUTHORITY_RANK)) {\n\t\terrors.push(`unknown authority: ${String(profile.authority)}`);\n\t}\n\tvalidateToolGate(profile.tools, errors);\n\tvalidateCapabilityGate(\"skills\", \"skill\", profile.skills, errors);\n\tvalidateCapabilityGate(\"mcp\", \"mcp\", profile.mcp, errors);\n\tvalidateCapabilityGate(\"hooks\", \"hook\", profile.hooks, errors);\n\tif (profile.commands) {\n\t\tif (!KNOWN_COMMAND_MODES.has(profile.commands.mode)) {\n\t\t\terrors.push(`unknown command mode: ${String(profile.commands.mode)}`);\n\t\t} else if (profile.authority in AUTHORITY_RANK) {\n\t\t\tconst conflict = commandModeAuthorityConflict(profile.commands.mode, profile.authority);\n\t\t\tif (conflict) errors.push(conflict);\n\t\t}\n\t}\n\treturn { valid: errors.length === 0, errors };\n}\n\n/**\n * Derive scheduler readSet/writeSet/parallelizable from a lane role plus the\n * optional paths granted to that lane. Non-writing roles never produce a\n * writeSet. parallelizable is false when a write-scoped lane writes anything,\n * or when any write touches a lockfile, package config, snapshot, or git index.\n */\nexport function deriveSchedulerFields(input: SchedulerDerivationInput): SchedulerFields {\n\tconst defaults = laneDefaultsForRole(input.role);\n\tconst readSet = toAccessSet(input.assignedReadPaths);\n\tconst writeSet = WRITING_ROLES.has(input.role) ? toAccessSet(input.assignedWritePaths) : [];\n\tconst parallelizable = deriveParallelizable(defaults.authority, writeSet);\n\treturn { readSet, writeSet, parallelizable };\n}\n\nfunction deriveParallelizable(authority: LoadoutAuthority, writeSet: readonly LoadoutAccessEntry[]): boolean {\n\tif (writeSet.length === 0) return true;\n\tif (authority === \"write-scoped\") return false;\n\tif (writeSet.some((entry) => isSerializeTriggerPath(entry.path))) return false;\n\treturn true;\n}\n\n/** Lockfile, package config, snapshot, or git-index writes force serialization. */\nexport function isSerializeTriggerPath(path: string): boolean {\n\tconst normalized = path.replaceAll(\"\\\\\", \"/\");\n\tconst base = normalized.slice(normalized.lastIndexOf(\"/\") + 1);\n\tif (LOCKFILE_BASENAMES.has(base)) return true;\n\tif (base === \"package.json\") return true;\n\tif (base.endsWith(\".snap\")) return true;\n\tif (normalized === \".git/index\" || normalized.startsWith(\".git/\") || normalized.includes(\"/.git/\")) return true;\n\treturn false;\n}\n\nfunction toAccessSet(paths: readonly string[] | undefined): LoadoutAccessEntry[] {\n\tif (!paths) return [];\n\tconst seen = new Set<string>();\n\tconst entries: LoadoutAccessEntry[] = [];\n\tfor (const raw of paths) {\n\t\tconst path = raw.trim();\n\t\tif (path === \"\" || seen.has(path)) continue;\n\t\tseen.add(path);\n\t\tentries.push({ path });\n\t}\n\tentries.sort((a, b) => compareString(a.path, b.path));\n\treturn entries;\n}\n\nfunction resourceNames(resources: readonly NamedResource[]): Set<string> {\n\treturn new Set(resources.map((resource) => resource.name));\n}\n\nfunction applyToolGate(\n\tgate: ToolGate,\n\tresources: readonly NamedResource[],\n\tblockers: string[],\n\twarnings: string[],\n): string[] {\n\tconst available = resourceNames(resources);\n\tfor (const required of gate.require ?? []) {\n\t\tif (!available.has(required)) blockers.push(`missing required tool: ${required}`);\n\t}\n\tconst base = gate.defaultMode === \"no-tools\" ? [] : (gate.allow ?? resources.map((resource) => resource.name));\n\tconst excluded = new Set(gate.exclude ?? []);\n\tconst active: string[] = [];\n\tfor (const tool of base) {\n\t\tif (!available.has(tool)) {\n\t\t\twarnings.push(`optional tool not available: ${tool}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!excluded.has(tool)) active.push(tool);\n\t}\n\treturn [...new Set(active)].sort(compareString);\n}\n\nfunction applyCapabilityGate(\n\tkind: ResourceKind,\n\tgate: CapabilityGate | undefined,\n\tresources: readonly NamedResource[],\n\tblockers: string[],\n\twarnings: string[],\n): string[] {\n\tif (!gate) return [];\n\tconst active = new Set<string>();\n\n\t// require: every required selector must resolve, else a deterministic blocker.\n\tfor (const selector of gate.require ?? []) {\n\t\tresolveRequireSelector(kind, selector, resources, blockers, active);\n\t}\n\n\t// allow: union of matches; warn on named-but-missing optional capabilities.\n\tfor (const selector of gate.allow ?? []) {\n\t\tfor (const match of matchSelector(selector, resources)) active.add(match.name);\n\t\tfor (const name of selector.names ?? []) {\n\t\t\tif (!resources.some((resource) => resource.name === name && matchesCriteria(selector, resource))) {\n\t\t\t\twarnings.push(`optional ${kind} not available: ${name}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// exclude: applied last.\n\tconst excluded = new Set<string>();\n\tfor (const selector of gate.exclude ?? []) {\n\t\tfor (const match of matchSelector(selector, resources)) excluded.add(match.name);\n\t}\n\n\tconst result = [...active].filter((name) => !excluded.has(name));\n\treturn [...new Set(result)].sort(compareString);\n}\n\nfunction resolveRequireSelector(\n\tkind: ResourceKind,\n\tselector: ResourceSelector,\n\tresources: readonly NamedResource[],\n\tblockers: string[],\n\tactive: Set<string>,\n): void {\n\tif (selector.names && selector.names.length > 0) {\n\t\tfor (const name of selector.names) {\n\t\t\tconst matched = resources.some((resource) => resource.name === name && matchesCriteria(selector, resource));\n\t\t\tif (matched) active.add(name);\n\t\t\telse blockers.push(`missing required ${kind}: ${name}`);\n\t\t}\n\t\treturn;\n\t}\n\tconst matches = matchSelector(selector, resources);\n\tif (matches.length === 0) {\n\t\tblockers.push(`missing required ${kind}: ${describeSelector(selector)}`);\n\t\treturn;\n\t}\n\tfor (const match of matches) active.add(match.name);\n}\n\nfunction matchSelector(selector: ResourceSelector, resources: readonly NamedResource[]): NamedResource[] {\n\treturn resources.filter((resource) => {\n\t\tif (selector.names && !selector.names.includes(resource.name)) return false;\n\t\treturn matchesCriteria(selector, resource);\n\t});\n}\n\nfunction matchesCriteria(selector: ResourceSelector, resource: NamedResource): boolean {\n\tif (resource.kind !== selector.kind) return false;\n\tif (selector.scopes && (resource.scope === undefined || !selector.scopes.includes(resource.scope))) return false;\n\tif (selector.origins && (resource.origin === undefined || !selector.origins.includes(resource.origin))) return false;\n\tif (selector.sources && !selector.sources.some((glob) => globMatch(glob, resource.source ?? \"\"))) return false;\n\tif (selector.paths && !selector.paths.some((glob) => globMatch(glob, resource.path ?? \"\"))) return false;\n\treturn true;\n}\n\nfunction describeSelector(selector: ResourceSelector): string {\n\tconst parts: string[] = [`kind=${selector.kind}`];\n\tif (selector.paths) parts.push(`paths=${selector.paths.join(\",\")}`);\n\tif (selector.sources) parts.push(`sources=${selector.sources.join(\",\")}`);\n\tif (selector.scopes) parts.push(`scopes=${selector.scopes.join(\",\")}`);\n\tif (selector.origins) parts.push(`origins=${selector.origins.join(\",\")}`);\n\treturn parts.join(\" \");\n}\n\nfunction validateToolGate(gate: ToolGate | undefined, errors: string[]): void {\n\tif (!gate) {\n\t\terrors.push(\"missing tools gate\");\n\t\treturn;\n\t}\n\tif (gate.defaultMode !== undefined && !KNOWN_TOOL_DEFAULT_MODES.has(gate.defaultMode)) {\n\t\terrors.push(`unknown tool defaultMode: ${String(gate.defaultMode)}`);\n\t}\n}\n\nfunction validateCapabilityGate(\n\tgateName: string,\n\texpectedKind: ResourceKind,\n\tgate: CapabilityGate | undefined,\n\terrors: string[],\n): void {\n\tif (!gate) return;\n\tfor (const group of [\"allow\", \"exclude\", \"require\"] as const) {\n\t\tconst selectors = gate[group];\n\t\tif (!selectors) continue;\n\t\tfor (const selector of selectors) {\n\t\t\tif (!KNOWN_RESOURCE_KINDS.has(selector.kind)) {\n\t\t\t\terrors.push(`unknown resource kind in ${gateName}.${group}: ${String(selector.kind)}`);\n\t\t\t} else if (selector.kind !== expectedKind) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`mismatched selector kind in ${gateName}.${group}: expected ${expectedKind}, got ${selector.kind}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction commandModeAuthorityConflict(mode: CommandMode, authority: LoadoutAuthority): string | undefined {\n\tif (mode === \"scoped-shell\" && authority !== \"write-scoped\") {\n\t\treturn `command mode scoped-shell requires write-scoped authority, got ${authority}`;\n\t}\n\tif (mode === \"tests-only\" && authority !== \"execute-tests\" && authority !== \"write-scoped\") {\n\t\treturn `command mode tests-only requires execute-tests or write-scoped authority, got ${authority}`;\n\t}\n\treturn undefined;\n}\n\nfunction globMatch(glob: string, value: string): boolean {\n\treturn globToRegExp(glob).test(value);\n}\n\nfunction globToRegExp(glob: string): RegExp {\n\tlet pattern = \"\";\n\tfor (let index = 0; index < glob.length; index++) {\n\t\tconst char = glob[index];\n\t\tif (char === \"*\") {\n\t\t\tif (glob[index + 1] === \"*\") {\n\t\t\t\tpattern += \".*\";\n\t\t\t\tindex++;\n\t\t\t} else {\n\t\t\t\tpattern += \"[^/]*\";\n\t\t\t}\n\t\t} else if (char === \"?\") {\n\t\t\tpattern += \".\";\n\t\t} else {\n\t\t\tpattern += char.replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\t\t}\n\t}\n\treturn new RegExp(`^${pattern}$`);\n}\n\nfunction compareString(a: string, b: string): number {\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"loadouts.d.ts","sourceRoot":"","sources":["../../src/core/loadouts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GACzB,UAAU,GACV,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,iBAAiB,CAAC;AAErB,MAAM,MAAM,WAAW,GACpB,SAAS,GACT,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,UAAU,GACV,WAAW,GACX,UAAU,GACV,aAAa,GACb,oBAAoB,CAAC;AAExB,wFAAwF;AACxF,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAChG,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,CAAC;AACrD,MAAM,MAAM,WAAW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C,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAwBjF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,GAAG,eAAe,CAMtF;AASD,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ5D","sourcesContent":["/**\n * Pure loadout / lane-profile algorithms for the OMK control plane.\n *\n * This module is I/O-free. It owns the loadout schema, built-in presets,\n * capability gating (allow/exclude/require selectors), profile validation, and\n * the derivation of scheduler read/write/parallelizable fields from a lane's\n * optional assigned paths. Runtime wiring (AgentSession tool registry, skill\n * prompt construction, MCP runtime, scheduler admission) lives in sibling\n * modules and consumes the decisions made here.\n *\n * Schema and presets follow the OMK package hardening loadout plan.\n *\n * Erasable TypeScript only (no enum/namespace/parameter properties).\n */\n\nimport type { HookPolicyMetadata } from \"./hooks/index.ts\";\n\nexport type LoadoutAuthority =\n\t| \"advisory\"\n\t| \"read-only\"\n\t| \"execute-tests\"\n\t| \"write-scoped\"\n\t| \"review-only\"\n\t| \"security-review\";\n\nexport type LoadoutRole =\n\t| \"planner\"\n\t| \"explorer\"\n\t| \"architect\"\n\t| \"coder\"\n\t| \"executor\"\n\t| \"tester\"\n\t| \"reviewer\"\n\t| \"critic\"\n\t| \"security\"\n\t| \"visual-qa\"\n\t| \"rhwp-doc\"\n\t| \"synthesizer\"\n\t| \"package-maintainer\";\n\n/** Resource kinds the loadout layer can describe. Only the last four are gated here. */\nexport type ResourceKind = \"extension\" | \"skill\" | \"prompt\" | \"theme\" | \"tool\" | \"mcp\" | \"hook\";\nexport type ResourceOrigin = \"package\" | \"top-level\";\nexport type SourceScope = \"user\" | \"project\" | \"temporary\" | \"builtin\";\nexport type CommandMode = \"none\" | \"read-only-shell\" | \"tests-only\" | \"scoped-shell\";\nexport type ToolDefaultMode = \"default-builtins\" | \"no-tools\" | \"no-builtin-tools\";\n\nexport interface NamedResource {\n\tkind: ResourceKind;\n\tname: string;\n\tsource?: string;\n\tscope?: SourceScope;\n\t/** Package-relative or absolute resource path, when meaningful (skills/prompts). */\n\tpath?: string;\n\torigin?: ResourceOrigin;\n\tpolicy?: HookPolicyMetadata;\n}\n\n/**\n * A selector matches inventory resources by name and/or provenance criteria.\n * A resource matches when its kind equals `kind` and every defined criterion\n * matches (names is an OR over the listed names; paths/sources are OR over globs).\n */\nexport interface ResourceSelector {\n\tkind: ResourceKind;\n\tnames?: readonly string[];\n\t/** Glob patterns matched against `NamedResource.path`. */\n\tpaths?: readonly string[];\n\t/** Glob patterns matched against `NamedResource.source`. */\n\tsources?: readonly string[];\n\tscopes?: readonly SourceScope[];\n\torigins?: readonly ResourceOrigin[];\n\t/** Marker only; requirement is expressed by placement in `CapabilityGate.require`. */\n\trequired?: boolean;\n}\n\n/** Tool gating uses flat name arrays (mapped to SDK tools / setActiveTools). */\nexport interface ToolGate {\n\tallow?: readonly string[];\n\texclude?: readonly string[];\n\trequire?: readonly string[];\n\tdefaultMode?: ToolDefaultMode;\n}\n\n/** Skills / MCP / hooks gating uses selector arrays. */\nexport interface CapabilityGate {\n\tallow?: readonly ResourceSelector[];\n\texclude?: readonly ResourceSelector[];\n\trequire?: readonly ResourceSelector[];\n}\n\nexport interface LoadoutCommands {\n\tmode: CommandMode;\n\tallowPatterns?: readonly string[];\n\tblockPatterns?: readonly string[];\n}\n\nexport interface LoadoutEvidence {\n\trequired: boolean;\n\toutputPattern: string;\n}\n\nexport interface LoadoutProfile {\n\tschemaVersion: \"omk.loadout.v1\";\n\tname: string;\n\tdescription?: string;\n\tauthority: LoadoutAuthority;\n\ttools: ToolGate;\n\tskills?: CapabilityGate;\n\tmcp?: CapabilityGate;\n\thooks?: CapabilityGate;\n\tcommands?: LoadoutCommands;\n\tevidence?: LoadoutEvidence;\n}\n\nexport interface CapabilityInventory {\n\ttools: readonly NamedResource[];\n\tskills: readonly NamedResource[];\n\tmcp: readonly NamedResource[];\n\thooks: readonly NamedResource[];\n}\n\nexport interface LaneDefaults {\n\tloadout: string;\n\tauthority: LoadoutAuthority;\n\tparallelizable: boolean;\n\treadOnly: boolean;\n\twritesProductFiles: boolean;\n}\n\nexport interface AppliedLoadout {\n\tprofileName: string;\n\tauthority: LoadoutAuthority;\n\tactiveTools: string[];\n\tactiveSkills: string[];\n\tactiveMcp: string[];\n\tactiveHooks: string[];\n\tblockers: string[];\n\twarnings: string[];\n}\n\nexport interface LoadoutValidation {\n\tvalid: boolean;\n\terrors: string[];\n}\n\n/** A scheduler access entry; shape matches `AccessSetEntry` in the orchestration layer. */\nexport interface LoadoutAccessEntry {\n\tpath: string;\n\tsymbols?: readonly string[];\n}\n\nexport interface SchedulerFields {\n\treadSet: LoadoutAccessEntry[];\n\twriteSet: LoadoutAccessEntry[];\n\tparallelizable: boolean;\n}\n\nexport interface SchedulerDerivationInput {\n\trole: LoadoutRole;\n\tassignedReadPaths?: readonly string[];\n\tassignedWritePaths?: readonly string[];\n}\n\nconst AUTHORITY_RANK: Record<LoadoutAuthority, number> = {\n\tadvisory: 0,\n\t\"read-only\": 1,\n\t\"review-only\": 1,\n\t\"security-review\": 2,\n\t\"execute-tests\": 3,\n\t\"write-scoped\": 4,\n};\n\nconst KNOWN_RESOURCE_KINDS: ReadonlySet<ResourceKind> = new Set([\n\t\"extension\",\n\t\"skill\",\n\t\"prompt\",\n\t\"theme\",\n\t\"tool\",\n\t\"mcp\",\n\t\"hook\",\n]);\n\nconst KNOWN_COMMAND_MODES: ReadonlySet<CommandMode> = new Set([\n\t\"none\",\n\t\"read-only-shell\",\n\t\"tests-only\",\n\t\"scoped-shell\",\n]);\n\nconst KNOWN_TOOL_DEFAULT_MODES: ReadonlySet<ToolDefaultMode> = new Set([\n\t\"default-builtins\",\n\t\"no-tools\",\n\t\"no-builtin-tools\",\n]);\n\n/** Roles permitted to declare a non-empty writeSet during scheduler derivation. */\nconst WRITING_ROLES: ReadonlySet<LoadoutRole> = new Set([\n\t\"coder\",\n\t\"executor\",\n\t\"tester\",\n\t\"rhwp-doc\",\n\t\"synthesizer\",\n\t\"package-maintainer\",\n]);\n\nconst LOCKFILE_BASENAMES: ReadonlySet<string> = new Set([\n\t\"package-lock.json\",\n\t\"npm-shrinkwrap.json\",\n\t\"yarn.lock\",\n\t\"pnpm-lock.yaml\",\n]);\n\nfunction allowNames(kind: ResourceKind, names: readonly string[]): CapabilityGate {\n\treturn { allow: [{ kind, names }] };\n}\n\nexport const BUILTIN_LOADOUTS: Readonly<Record<string, LoadoutProfile>> = {\n\tinspect: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"inspect\",\n\t\tauthority: \"read-only\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\"] },\n\t\tskills: allowNames(\"skill\", [\"understand-chat\", \"analyze\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem-readonly\", \"memory\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\"]),\n\t},\n\tplan: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"plan\",\n\t\tauthority: \"advisory\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\"] },\n\t\tskills: allowNames(\"skill\", [\"adaptorch-route\", \"writing-plans\", \"ddd-software-architecture\"]),\n\t\tmcp: allowNames(\"mcp\", [\"memory\", \"adaptorch\"]),\n\t\thooks: allowNames(\"hook\", [\"session-context\", \"precompact-checkpoint\"]),\n\t},\n\tarchitect: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"architect\",\n\t\tauthority: \"review-only\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\", \"report_finding\"] },\n\t\tskills: allowNames(\"skill\", [\"ddd-software-architecture\", \"code-review\", \"security-review\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem-readonly\", \"memory\", \"context7\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"stop-verify\", \"subagent-stop-audit\"]),\n\t\tcommands: { mode: \"read-only-shell\" },\n\t\tevidence: { required: true, outputPattern: \".omk/runs/<goal>/architect.md\" },\n\t},\n\tcode: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"code\",\n\t\tauthority: \"write-scoped\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"test-driven-development\", \"coding-standards\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\", \"context7\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"typecheck-after-edit\"]),\n\t\tcommands: { mode: \"scoped-shell\" },\n\t},\n\texecutor: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"executor\",\n\t\tauthority: \"write-scoped\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"test-driven-development\", \"coding-standards\", \"verification-before-completion\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\", \"context7\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"typecheck-after-edit\", \"stop-verify\"]),\n\t\tcommands: { mode: \"scoped-shell\" },\n\t\tevidence: { required: true, outputPattern: \".omk/runs/<goal>/implementation.md\" },\n\t},\n\ttest: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"test\",\n\t\tauthority: \"execute-tests\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"verification-before-completion\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"stop-verify\"]),\n\t\tcommands: { mode: \"tests-only\" },\n\t},\n\treview: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"review\",\n\t\tauthority: \"review-only\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\"] },\n\t\tskills: allowNames(\"skill\", [\"code-review\", \"differential-review\"]),\n\t\tmcp: allowNames(\"mcp\", [\"memory\"]),\n\t\thooks: allowNames(\"hook\", [\"stop-verify\", \"subagent-stop-audit\"]),\n\t},\n\tcritic: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"critic\",\n\t\tauthority: \"review-only\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"code-review\", \"verification-before-completion\", \"scientific-critical-thinking\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem-readonly\", \"memory\", \"context7\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"stop-verify\", \"subagent-stop-audit\"]),\n\t\tcommands: { mode: \"read-only-shell\" },\n\t\tevidence: { required: true, outputPattern: \".omk/runs/<goal>/critic.md\" },\n\t},\n\tsecurity: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"security\",\n\t\tauthority: \"security-review\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\"security-review\", \"differential-review\"]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem-readonly\", \"memory\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"stop-verify\"]),\n\t\tcommands: { mode: \"read-only-shell\" },\n\t},\n\t\"visual-qa\": {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"visual-qa\",\n\t\tauthority: \"execute-tests\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\n\t\t\t\"clone-website\",\n\t\t\t\"visual-qa\",\n\t\t\t\"visual-diff\",\n\t\t\t\"visual-regression\",\n\t\t\t\"browser-qa\",\n\t\t\t\"web-quality-audit\",\n\t\t]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\", \"chrome-devtools\", \"playwright\", \"context7\"]),\n\t\thooks: allowNames(\"hook\", [\n\t\t\t\"component-spec-before-build\",\n\t\t\t\"visual-diff-after-edit\",\n\t\t\t\"typecheck-after-edit\",\n\t\t\t\"bounded-evidence\",\n\t\t\t\"protect-secrets\",\n\t\t\t\"stop-verify\",\n\t\t]),\n\t\tcommands: { mode: \"tests-only\" },\n\t\tevidence: { required: true, outputPattern: \".omk/runs/<goal>/visual-qa.md\" },\n\t},\n\t\"rhwp-doc\": {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"rhwp-doc\",\n\t\tauthority: \"write-scoped\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\n\t\t\t\"rhwp\",\n\t\t\t\"rhwp-doc\",\n\t\t\t\"document-extraction\",\n\t\t\t\"document-conversion\",\n\t\t\t\"technical-writing\",\n\t\t]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\", \"context7\", \"playwright\"]),\n\t\thooks: allowNames(\"hook\", [\n\t\t\t\"document-artifact-guard\",\n\t\t\t\"bounded-evidence\",\n\t\t\t\"pre-shell-guard\",\n\t\t\t\"protect-secrets\",\n\t\t\t\"stop-verify\",\n\t\t]),\n\t\tcommands: { mode: \"scoped-shell\" },\n\t\tevidence: { required: true, outputPattern: \".omk/runs/<goal>/rhwp-doc.md\" },\n\t},\n\t\"package-maintainer\": {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"package-maintainer\",\n\t\tauthority: \"write-scoped\",\n\t\ttools: { allow: [\"read\", \"grep\", \"find\", \"ls\", \"edit\", \"write\", \"bash\"] },\n\t\tskills: allowNames(\"skill\", [\n\t\t\t\"exact-pin\",\n\t\t\t\"no-lifecycle-scripts\",\n\t\t\t\"security-review\",\n\t\t\t\"verification-before-completion\",\n\t\t]),\n\t\tmcp: allowNames(\"mcp\", [\"filesystem\"]),\n\t\thooks: allowNames(\"hook\", [\"pre-shell-guard\", \"protect-secrets\", \"npm-audit-summary\", \"stop-verify\"]),\n\t\tcommands: {\n\t\t\tmode: \"scoped-shell\",\n\t\t\tallowPatterns: [\n\t\t\t\t\"npm install --ignore-scripts*\",\n\t\t\t\t\"npm ci --ignore-scripts*\",\n\t\t\t\t\"npm install --package-lock-only --ignore-scripts*\",\n\t\t\t\t\"node scripts/generate-coding-agent-shrinkwrap.mjs*\",\n\t\t\t],\n\t\t\tblockPatterns: [\n\t\t\t\t\"*@latest*\",\n\t\t\t\t\"npm install *--ignore-scripts=false*\",\n\t\t\t\t\"npm ci *--ignore-scripts=false*\",\n\t\t\t\t\"npm rebuild*\",\n\t\t\t],\n\t\t},\n\t},\n\tnone: {\n\t\tschemaVersion: \"omk.loadout.v1\",\n\t\tname: \"none\",\n\t\tauthority: \"advisory\",\n\t\ttools: { allow: [], defaultMode: \"no-tools\" },\n\t\tcommands: { mode: \"none\" },\n\t},\n};\n\nexport function inferLoadoutForRole(role: LoadoutRole): string {\n\tswitch (role) {\n\t\tcase \"planner\":\n\t\t\treturn \"plan\";\n\t\tcase \"explorer\":\n\t\t\treturn \"inspect\";\n\t\tcase \"architect\":\n\t\t\treturn \"architect\";\n\t\tcase \"coder\":\n\t\t\treturn \"code\";\n\t\tcase \"executor\":\n\t\t\treturn \"executor\";\n\t\tcase \"tester\":\n\t\t\treturn \"test\";\n\t\tcase \"reviewer\":\n\t\t\treturn \"review\";\n\t\tcase \"critic\":\n\t\t\treturn \"critic\";\n\t\tcase \"security\":\n\t\t\treturn \"security\";\n\t\tcase \"visual-qa\":\n\t\t\treturn \"visual-qa\";\n\t\tcase \"rhwp-doc\":\n\t\t\treturn \"rhwp-doc\";\n\t\tcase \"package-maintainer\":\n\t\t\treturn \"package-maintainer\";\n\t\tcase \"synthesizer\":\n\t\t\treturn \"plan\";\n\t}\n}\n\nexport function authorityWithinGrant(requested: LoadoutAuthority, grant: LoadoutAuthority): boolean {\n\treturn AUTHORITY_RANK[requested] <= AUTHORITY_RANK[grant];\n}\n\nexport function laneDefaultsForRole(role: LoadoutRole): LaneDefaults {\n\tconst loadout = inferLoadoutForRole(role);\n\tconst profile = BUILTIN_LOADOUTS[loadout];\n\treturn {\n\t\tloadout,\n\t\tauthority: profile.authority,\n\t\tparallelizable: profile.authority !== \"write-scoped\",\n\t\treadOnly:\n\t\t\tprofile.authority === \"read-only\" || profile.authority === \"review-only\" || profile.authority === \"advisory\",\n\t\twritesProductFiles: profile.authority === \"write-scoped\",\n\t};\n}\n\nexport function applyLoadoutProfile(\n\tprofile: LoadoutProfile,\n\tinventory: CapabilityInventory,\n\toptions: { grantAuthority?: LoadoutAuthority } = {},\n): AppliedLoadout {\n\tconst blockers: string[] = [];\n\tconst warnings: string[] = [];\n\t// Deterministic blocker order: authority, then tool/skill/mcp/hook requires.\n\tif (options.grantAuthority && !authorityWithinGrant(profile.authority, options.grantAuthority)) {\n\t\tblockers.push(`loadout authority ${profile.authority} exceeds grant ${options.grantAuthority}`);\n\t}\n\n\tconst activeTools = applyToolGate(profile.tools, inventory.tools, blockers, warnings);\n\tconst activeSkills = applyCapabilityGate(\"skill\", profile.skills, inventory.skills, blockers, warnings);\n\tconst activeMcp = applyCapabilityGate(\"mcp\", profile.mcp, inventory.mcp, blockers, warnings);\n\tconst activeHooks = applyCapabilityGate(\"hook\", profile.hooks, inventory.hooks, blockers, warnings);\n\n\treturn {\n\t\tprofileName: profile.name,\n\t\tauthority: profile.authority,\n\t\tactiveTools,\n\t\tactiveSkills,\n\t\tactiveMcp,\n\t\tactiveHooks,\n\t\tblockers,\n\t\twarnings,\n\t};\n}\n\n/**\n * Fail-closed structural validation of a loadout profile. Errors are returned\n * in a deterministic order: schemaVersion, name, authority, tools, skills, mcp,\n * hooks, commands.\n */\nexport function validateLoadoutProfile(profile: LoadoutProfile): LoadoutValidation {\n\tconst errors: string[] = [];\n\tif (profile.schemaVersion !== \"omk.loadout.v1\") {\n\t\terrors.push(`unknown schemaVersion: ${String(profile.schemaVersion)}`);\n\t}\n\tif (typeof profile.name !== \"string\" || profile.name.trim() === \"\") {\n\t\terrors.push(\"missing loadout name\");\n\t}\n\tif (!(profile.authority in AUTHORITY_RANK)) {\n\t\terrors.push(`unknown authority: ${String(profile.authority)}`);\n\t}\n\tvalidateToolGate(profile.tools, errors);\n\tvalidateCapabilityGate(\"skills\", \"skill\", profile.skills, errors);\n\tvalidateCapabilityGate(\"mcp\", \"mcp\", profile.mcp, errors);\n\tvalidateCapabilityGate(\"hooks\", \"hook\", profile.hooks, errors);\n\tif (profile.commands) {\n\t\tif (!KNOWN_COMMAND_MODES.has(profile.commands.mode)) {\n\t\t\terrors.push(`unknown command mode: ${String(profile.commands.mode)}`);\n\t\t} else if (profile.authority in AUTHORITY_RANK) {\n\t\t\tconst conflict = commandModeAuthorityConflict(profile.commands.mode, profile.authority);\n\t\t\tif (conflict) errors.push(conflict);\n\t\t}\n\t}\n\treturn { valid: errors.length === 0, errors };\n}\n\n/**\n * Derive scheduler readSet/writeSet/parallelizable from a lane role plus the\n * optional paths granted to that lane. Non-writing roles never produce a\n * writeSet. parallelizable is false when a write-scoped lane writes anything,\n * or when any write touches a lockfile, package config, snapshot, or git index.\n */\nexport function deriveSchedulerFields(input: SchedulerDerivationInput): SchedulerFields {\n\tconst defaults = laneDefaultsForRole(input.role);\n\tconst readSet = toAccessSet(input.assignedReadPaths);\n\tconst writeSet = WRITING_ROLES.has(input.role) ? toAccessSet(input.assignedWritePaths) : [];\n\tconst parallelizable = deriveParallelizable(defaults.authority, writeSet);\n\treturn { readSet, writeSet, parallelizable };\n}\n\nfunction deriveParallelizable(authority: LoadoutAuthority, writeSet: readonly LoadoutAccessEntry[]): boolean {\n\tif (writeSet.length === 0) return true;\n\tif (authority === \"write-scoped\") return false;\n\tif (writeSet.some((entry) => isSerializeTriggerPath(entry.path))) return false;\n\treturn true;\n}\n\n/** Lockfile, package config, snapshot, or git-index writes force serialization. */\nexport function isSerializeTriggerPath(path: string): boolean {\n\tconst normalized = path.replaceAll(\"\\\\\", \"/\");\n\tconst base = normalized.slice(normalized.lastIndexOf(\"/\") + 1);\n\tif (LOCKFILE_BASENAMES.has(base)) return true;\n\tif (base === \"package.json\") return true;\n\tif (base.endsWith(\".snap\")) return true;\n\tif (normalized === \".git/index\" || normalized.startsWith(\".git/\") || normalized.includes(\"/.git/\")) return true;\n\treturn false;\n}\n\nfunction toAccessSet(paths: readonly string[] | undefined): LoadoutAccessEntry[] {\n\tif (!paths) return [];\n\tconst seen = new Set<string>();\n\tconst entries: LoadoutAccessEntry[] = [];\n\tfor (const raw of paths) {\n\t\tconst path = raw.trim();\n\t\tif (path === \"\" || seen.has(path)) continue;\n\t\tseen.add(path);\n\t\tentries.push({ path });\n\t}\n\tentries.sort((a, b) => compareString(a.path, b.path));\n\treturn entries;\n}\n\nfunction resourceNames(resources: readonly NamedResource[]): Set<string> {\n\treturn new Set(resources.map((resource) => resource.name));\n}\n\nfunction applyToolGate(\n\tgate: ToolGate,\n\tresources: readonly NamedResource[],\n\tblockers: string[],\n\twarnings: string[],\n): string[] {\n\tconst available = resourceNames(resources);\n\tfor (const required of gate.require ?? []) {\n\t\tif (!available.has(required)) blockers.push(`missing required tool: ${required}`);\n\t}\n\tconst base = gate.defaultMode === \"no-tools\" ? [] : (gate.allow ?? resources.map((resource) => resource.name));\n\tconst excluded = new Set(gate.exclude ?? []);\n\tconst active: string[] = [];\n\tfor (const tool of base) {\n\t\tif (!available.has(tool)) {\n\t\t\twarnings.push(`optional tool not available: ${tool}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!excluded.has(tool)) active.push(tool);\n\t}\n\treturn [...new Set(active)].sort(compareString);\n}\n\nfunction applyCapabilityGate(\n\tkind: ResourceKind,\n\tgate: CapabilityGate | undefined,\n\tresources: readonly NamedResource[],\n\tblockers: string[],\n\twarnings: string[],\n): string[] {\n\tif (!gate) return [];\n\tconst active = new Set<string>();\n\n\t// require: every required selector must resolve, else a deterministic blocker.\n\tfor (const selector of gate.require ?? []) {\n\t\tresolveRequireSelector(kind, selector, resources, blockers, active);\n\t}\n\n\t// allow: union of matches; warn on named-but-missing optional capabilities.\n\tfor (const selector of gate.allow ?? []) {\n\t\tfor (const match of matchSelector(selector, resources)) active.add(match.name);\n\t\tfor (const name of selector.names ?? []) {\n\t\t\tif (!resources.some((resource) => resource.name === name && matchesCriteria(selector, resource))) {\n\t\t\t\twarnings.push(`optional ${kind} not available: ${name}`);\n\t\t\t}\n\t\t}\n\t}\n\n\t// exclude: applied last.\n\tconst excluded = new Set<string>();\n\tfor (const selector of gate.exclude ?? []) {\n\t\tfor (const match of matchSelector(selector, resources)) excluded.add(match.name);\n\t}\n\n\tconst result = [...active].filter((name) => !excluded.has(name));\n\treturn [...new Set(result)].sort(compareString);\n}\n\nfunction resolveRequireSelector(\n\tkind: ResourceKind,\n\tselector: ResourceSelector,\n\tresources: readonly NamedResource[],\n\tblockers: string[],\n\tactive: Set<string>,\n): void {\n\tif (selector.names && selector.names.length > 0) {\n\t\tfor (const name of selector.names) {\n\t\t\tconst matched = resources.some((resource) => resource.name === name && matchesCriteria(selector, resource));\n\t\t\tif (matched) active.add(name);\n\t\t\telse blockers.push(`missing required ${kind}: ${name}`);\n\t\t}\n\t\treturn;\n\t}\n\tconst matches = matchSelector(selector, resources);\n\tif (matches.length === 0) {\n\t\tblockers.push(`missing required ${kind}: ${describeSelector(selector)}`);\n\t\treturn;\n\t}\n\tfor (const match of matches) active.add(match.name);\n}\n\nfunction matchSelector(selector: ResourceSelector, resources: readonly NamedResource[]): NamedResource[] {\n\treturn resources.filter((resource) => {\n\t\tif (selector.names && !selector.names.includes(resource.name)) return false;\n\t\treturn matchesCriteria(selector, resource);\n\t});\n}\n\nfunction matchesCriteria(selector: ResourceSelector, resource: NamedResource): boolean {\n\tif (resource.kind !== selector.kind) return false;\n\tif (selector.scopes && (resource.scope === undefined || !selector.scopes.includes(resource.scope))) return false;\n\tif (selector.origins && (resource.origin === undefined || !selector.origins.includes(resource.origin))) return false;\n\tif (selector.sources && !selector.sources.some((glob) => globMatch(glob, resource.source ?? \"\"))) return false;\n\tif (selector.paths && !selector.paths.some((glob) => globMatch(glob, resource.path ?? \"\"))) return false;\n\treturn true;\n}\n\nfunction describeSelector(selector: ResourceSelector): string {\n\tconst parts: string[] = [`kind=${selector.kind}`];\n\tif (selector.paths) parts.push(`paths=${selector.paths.join(\",\")}`);\n\tif (selector.sources) parts.push(`sources=${selector.sources.join(\",\")}`);\n\tif (selector.scopes) parts.push(`scopes=${selector.scopes.join(\",\")}`);\n\tif (selector.origins) parts.push(`origins=${selector.origins.join(\",\")}`);\n\treturn parts.join(\" \");\n}\n\nfunction validateToolGate(gate: ToolGate | undefined, errors: string[]): void {\n\tif (!gate) {\n\t\terrors.push(\"missing tools gate\");\n\t\treturn;\n\t}\n\tif (gate.defaultMode !== undefined && !KNOWN_TOOL_DEFAULT_MODES.has(gate.defaultMode)) {\n\t\terrors.push(`unknown tool defaultMode: ${String(gate.defaultMode)}`);\n\t}\n}\n\nfunction validateCapabilityGate(\n\tgateName: string,\n\texpectedKind: ResourceKind,\n\tgate: CapabilityGate | undefined,\n\terrors: string[],\n): void {\n\tif (!gate) return;\n\tfor (const group of [\"allow\", \"exclude\", \"require\"] as const) {\n\t\tconst selectors = gate[group];\n\t\tif (!selectors) continue;\n\t\tfor (const selector of selectors) {\n\t\t\tif (!KNOWN_RESOURCE_KINDS.has(selector.kind)) {\n\t\t\t\terrors.push(`unknown resource kind in ${gateName}.${group}: ${String(selector.kind)}`);\n\t\t\t} else if (selector.kind !== expectedKind) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`mismatched selector kind in ${gateName}.${group}: expected ${expectedKind}, got ${selector.kind}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction commandModeAuthorityConflict(mode: CommandMode, authority: LoadoutAuthority): string | undefined {\n\tif (mode === \"scoped-shell\" && authority !== \"write-scoped\") {\n\t\treturn `command mode scoped-shell requires write-scoped authority, got ${authority}`;\n\t}\n\tif (mode === \"tests-only\" && authority !== \"execute-tests\" && authority !== \"write-scoped\") {\n\t\treturn `command mode tests-only requires execute-tests or write-scoped authority, got ${authority}`;\n\t}\n\treturn undefined;\n}\n\nfunction globMatch(glob: string, value: string): boolean {\n\treturn globToRegExp(glob).test(value);\n}\n\nfunction globToRegExp(glob: string): RegExp {\n\tlet pattern = \"\";\n\tfor (let index = 0; index < glob.length; index++) {\n\t\tconst char = glob[index];\n\t\tif (char === \"*\") {\n\t\t\tif (glob[index + 1] === \"*\") {\n\t\t\t\tpattern += \".*\";\n\t\t\t\tindex++;\n\t\t\t} else {\n\t\t\t\tpattern += \"[^/]*\";\n\t\t\t}\n\t\t} else if (char === \"?\") {\n\t\t\tpattern += \".\";\n\t\t} else {\n\t\t\tpattern += char.replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\t\t}\n\t}\n\treturn new RegExp(`^${pattern}$`);\n}\n\nfunction compareString(a: string, b: string): number {\n\tif (a < b) return -1;\n\tif (a > b) return 1;\n\treturn 0;\n}\n"]}
|