wotann 0.5.0 → 0.5.39
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/dist/agents/background-agent.d.ts.map +1 -1
- package/dist/agents/background-agent.js +2 -1
- package/dist/agents/background-agent.js.map +1 -1
- package/dist/agents/file-scope-policy.d.ts +116 -0
- package/dist/agents/file-scope-policy.d.ts.map +1 -0
- package/dist/agents/file-scope-policy.js +190 -0
- package/dist/agents/file-scope-policy.js.map +1 -0
- package/dist/agents/yaml-manifest.d.ts +125 -0
- package/dist/agents/yaml-manifest.d.ts.map +1 -0
- package/dist/agents/yaml-manifest.js +901 -0
- package/dist/agents/yaml-manifest.js.map +1 -0
- package/dist/auth/login.d.ts +3 -3
- package/dist/auth/login.d.ts.map +1 -1
- package/dist/auth/login.js +80 -23
- package/dist/auth/login.js.map +1 -1
- package/dist/autopilot/completion-oracle.d.ts.map +1 -1
- package/dist/autopilot/completion-oracle.js +3 -1
- package/dist/autopilot/completion-oracle.js.map +1 -1
- package/dist/autopilot/run-manifest.d.ts +90 -0
- package/dist/autopilot/run-manifest.d.ts.map +1 -0
- package/dist/autopilot/run-manifest.js +261 -0
- package/dist/autopilot/run-manifest.js.map +1 -0
- package/dist/browser/adaptive-selectors.d.ts +170 -0
- package/dist/browser/adaptive-selectors.d.ts.map +1 -0
- package/dist/browser/adaptive-selectors.js +317 -0
- package/dist/browser/adaptive-selectors.js.map +1 -0
- package/dist/browser/humanize-input.d.ts +76 -0
- package/dist/browser/humanize-input.d.ts.map +1 -0
- package/dist/browser/humanize-input.js +386 -0
- package/dist/browser/humanize-input.js.map +1 -0
- package/dist/channels/teams.d.ts +41 -19
- package/dist/channels/teams.d.ts.map +1 -1
- package/dist/channels/teams.js +121 -24
- package/dist/channels/teams.js.map +1 -1
- package/dist/channels/terminal-mention.d.ts.map +1 -1
- package/dist/channels/terminal-mention.js +4 -1
- package/dist/channels/terminal-mention.js.map +1 -1
- package/dist/cli/commands/blast-radius.d.ts +47 -0
- package/dist/cli/commands/blast-radius.d.ts.map +1 -0
- package/dist/cli/commands/blast-radius.js +123 -0
- package/dist/cli/commands/blast-radius.js.map +1 -0
- package/dist/cli/commands/evolve.d.ts +92 -0
- package/dist/cli/commands/evolve.d.ts.map +1 -0
- package/dist/cli/commands/evolve.js +336 -0
- package/dist/cli/commands/evolve.js.map +1 -0
- package/dist/cli/commands/learning.d.ts +54 -0
- package/dist/cli/commands/learning.d.ts.map +1 -0
- package/dist/cli/commands/learning.js +380 -0
- package/dist/cli/commands/learning.js.map +1 -0
- package/dist/cli/commands/persona.d.ts +42 -0
- package/dist/cli/commands/persona.d.ts.map +1 -0
- package/dist/cli/commands/persona.js +198 -0
- package/dist/cli/commands/persona.js.map +1 -0
- package/dist/cli/commands/stuck.d.ts.map +1 -1
- package/dist/cli/commands/stuck.js +5 -2
- package/dist/cli/commands/stuck.js.map +1 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +5 -2
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/orphan-wires/agent-manifest-cmd.d.ts +17 -0
- package/dist/cli/orphan-wires/agent-manifest-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/agent-manifest-cmd.js +99 -0
- package/dist/cli/orphan-wires/agent-manifest-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/arena-cmd.d.ts +26 -0
- package/dist/cli/orphan-wires/arena-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/arena-cmd.js +167 -0
- package/dist/cli/orphan-wires/arena-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/artifact-cmd.d.ts +17 -0
- package/dist/cli/orphan-wires/artifact-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/artifact-cmd.js +175 -0
- package/dist/cli/orphan-wires/artifact-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/demo-cmd.d.ts +25 -0
- package/dist/cli/orphan-wires/demo-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/demo-cmd.js +164 -0
- package/dist/cli/orphan-wires/demo-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/extras-cmd.d.ts +20 -0
- package/dist/cli/orphan-wires/extras-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/extras-cmd.js +289 -0
- package/dist/cli/orphan-wires/extras-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/harness-introspect-cmd.d.ts +15 -0
- package/dist/cli/orphan-wires/harness-introspect-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/harness-introspect-cmd.js +36 -0
- package/dist/cli/orphan-wires/harness-introspect-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/index.d.ts.map +1 -1
- package/dist/cli/orphan-wires/index.js +30 -0
- package/dist/cli/orphan-wires/index.js.map +1 -1
- package/dist/cli/orphan-wires/integrations-cmd.d.ts +38 -0
- package/dist/cli/orphan-wires/integrations-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/integrations-cmd.js +345 -0
- package/dist/cli/orphan-wires/integrations-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/mcp-scaffold-cmd.d.ts +18 -0
- package/dist/cli/orphan-wires/mcp-scaffold-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/mcp-scaffold-cmd.js +127 -0
- package/dist/cli/orphan-wires/mcp-scaffold-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/memory-consolidate-cmd.d.ts +21 -0
- package/dist/cli/orphan-wires/memory-consolidate-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/memory-consolidate-cmd.js +86 -0
- package/dist/cli/orphan-wires/memory-consolidate-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/patch-cmd.d.ts +29 -0
- package/dist/cli/orphan-wires/patch-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/patch-cmd.js +150 -0
- package/dist/cli/orphan-wires/patch-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/redteam-scan-cmd.d.ts +28 -0
- package/dist/cli/orphan-wires/redteam-scan-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/redteam-scan-cmd.js +169 -0
- package/dist/cli/orphan-wires/redteam-scan-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/scrape-adapt-cmd.d.ts +21 -0
- package/dist/cli/orphan-wires/scrape-adapt-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/scrape-adapt-cmd.js +70 -0
- package/dist/cli/orphan-wires/scrape-adapt-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/shell-tier-cmd.d.ts +20 -0
- package/dist/cli/orphan-wires/shell-tier-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/shell-tier-cmd.js +74 -0
- package/dist/cli/orphan-wires/shell-tier-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/sub-recipes-cmd.d.ts +18 -0
- package/dist/cli/orphan-wires/sub-recipes-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/sub-recipes-cmd.js +87 -0
- package/dist/cli/orphan-wires/sub-recipes-cmd.js.map +1 -0
- package/dist/cli/orphan-wires/webapp-test-cmd.d.ts +20 -0
- package/dist/cli/orphan-wires/webapp-test-cmd.d.ts.map +1 -0
- package/dist/cli/orphan-wires/webapp-test-cmd.js +115 -0
- package/dist/cli/orphan-wires/webapp-test-cmd.js.map +1 -0
- package/dist/cli/thin-client.d.ts +17 -10
- package/dist/cli/thin-client.d.ts.map +1 -1
- package/dist/cli/thin-client.js +108 -26
- package/dist/cli/thin-client.js.map +1 -1
- package/dist/computer-use/action-history-compactor.d.ts +92 -0
- package/dist/computer-use/action-history-compactor.d.ts.map +1 -0
- package/dist/computer-use/action-history-compactor.js +204 -0
- package/dist/computer-use/action-history-compactor.js.map +1 -0
- package/dist/computer-use/action-repertoire.d.ts +8 -0
- package/dist/computer-use/action-repertoire.d.ts.map +1 -1
- package/dist/computer-use/action-repertoire.js +19 -0
- package/dist/computer-use/action-repertoire.js.map +1 -1
- package/dist/computer-use/computer-agent.d.ts +232 -2
- package/dist/computer-use/computer-agent.d.ts.map +1 -1
- package/dist/computer-use/computer-agent.js +558 -19
- package/dist/computer-use/computer-agent.js.map +1 -1
- package/dist/computer-use/coordinate-scaling.d.ts +104 -0
- package/dist/computer-use/coordinate-scaling.d.ts.map +1 -0
- package/dist/computer-use/coordinate-scaling.js +175 -0
- package/dist/computer-use/coordinate-scaling.js.map +1 -0
- package/dist/computer-use/driver-contract.d.ts +158 -0
- package/dist/computer-use/driver-contract.d.ts.map +1 -0
- package/dist/computer-use/driver-contract.js +471 -0
- package/dist/computer-use/driver-contract.js.map +1 -0
- package/dist/computer-use/perception-engine.d.ts +39 -0
- package/dist/computer-use/perception-engine.d.ts.map +1 -1
- package/dist/computer-use/perception-engine.js +27 -27
- package/dist/computer-use/perception-engine.js.map +1 -1
- package/dist/computer-use/platform-bindings.d.ts.map +1 -1
- package/dist/computer-use/platform-bindings.js +216 -2
- package/dist/computer-use/platform-bindings.js.map +1 -1
- package/dist/computer-use/safe-execute.d.ts +86 -0
- package/dist/computer-use/safe-execute.d.ts.map +1 -0
- package/dist/computer-use/safe-execute.js +152 -0
- package/dist/computer-use/safe-execute.js.map +1 -0
- package/dist/context/branch-summarization.d.ts +97 -0
- package/dist/context/branch-summarization.d.ts.map +1 -0
- package/dist/context/branch-summarization.js +170 -0
- package/dist/context/branch-summarization.js.map +1 -0
- package/dist/context/compaction.d.ts +16 -1
- package/dist/context/compaction.d.ts.map +1 -1
- package/dist/context/compaction.js +50 -2
- package/dist/context/compaction.js.map +1 -1
- package/dist/context/inspector.d.ts +2 -2
- package/dist/context/inspector.d.ts.map +1 -1
- package/dist/context/inspector.js +4 -3
- package/dist/context/inspector.js.map +1 -1
- package/dist/core/agent-bridge.d.ts.map +1 -1
- package/dist/core/agent-bridge.js +200 -69
- package/dist/core/agent-bridge.js.map +1 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +7 -0
- package/dist/core/config.js.map +1 -1
- package/dist/core/mode-model-preference.d.ts +95 -0
- package/dist/core/mode-model-preference.d.ts.map +1 -0
- package/dist/core/mode-model-preference.js +170 -0
- package/dist/core/mode-model-preference.js.map +1 -0
- package/dist/core/prompt-override.d.ts.map +1 -1
- package/dist/core/prompt-override.js +1 -0
- package/dist/core/prompt-override.js.map +1 -1
- package/dist/core/runtime-intelligence.d.ts +11 -0
- package/dist/core/runtime-intelligence.d.ts.map +1 -1
- package/dist/core/runtime-intelligence.js +18 -3
- package/dist/core/runtime-intelligence.js.map +1 -1
- package/dist/core/runtime-tool-dispatch.js +1 -1
- package/dist/core/runtime-tool-dispatch.js.map +1 -1
- package/dist/core/runtime.d.ts +186 -13
- package/dist/core/runtime.d.ts.map +1 -1
- package/dist/core/runtime.js +717 -228
- package/dist/core/runtime.js.map +1 -1
- package/dist/core/session-rewind.d.ts +67 -0
- package/dist/core/session-rewind.d.ts.map +1 -0
- package/dist/core/session-rewind.js +120 -0
- package/dist/core/session-rewind.js.map +1 -0
- package/dist/core/types.d.ts +19 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/daemon/file-watcher.d.ts +84 -0
- package/dist/daemon/file-watcher.d.ts.map +1 -0
- package/dist/daemon/file-watcher.js +193 -0
- package/dist/daemon/file-watcher.js.map +1 -0
- package/dist/daemon/jsonl-mode.d.ts +11 -0
- package/dist/daemon/jsonl-mode.d.ts.map +1 -0
- package/dist/daemon/jsonl-mode.js +77 -0
- package/dist/daemon/jsonl-mode.js.map +1 -0
- package/dist/daemon/kairos-ipc.d.ts +4 -1
- package/dist/daemon/kairos-ipc.d.ts.map +1 -1
- package/dist/daemon/kairos-ipc.js +38 -22
- package/dist/daemon/kairos-ipc.js.map +1 -1
- package/dist/daemon/kairos-rpc.d.ts +5 -1
- package/dist/daemon/kairos-rpc.d.ts.map +1 -1
- package/dist/daemon/kairos-rpc.js +1262 -114
- package/dist/daemon/kairos-rpc.js.map +1 -1
- package/dist/daemon/kairos.d.ts +35 -4
- package/dist/daemon/kairos.d.ts.map +1 -1
- package/dist/daemon/kairos.js +204 -24
- package/dist/daemon/kairos.js.map +1 -1
- package/dist/daemon/rpc-handlers/intelligence-rpc.d.ts.map +1 -1
- package/dist/daemon/rpc-handlers/intelligence-rpc.js +15 -3
- package/dist/daemon/rpc-handlers/intelligence-rpc.js.map +1 -1
- package/dist/daemon/transport/jsonl.d.ts +7 -0
- package/dist/daemon/transport/jsonl.d.ts.map +1 -0
- package/dist/daemon/transport/jsonl.js +38 -0
- package/dist/daemon/transport/jsonl.js.map +1 -0
- package/dist/daemon/transport/socket-path.d.ts +28 -0
- package/dist/daemon/transport/socket-path.d.ts.map +1 -0
- package/dist/daemon/transport/socket-path.js +36 -0
- package/dist/daemon/transport/socket-path.js.map +1 -0
- package/dist/design/theme-presets.d.ts +77 -0
- package/dist/design/theme-presets.d.ts.map +1 -0
- package/dist/design/theme-presets.js +274 -0
- package/dist/design/theme-presets.js.map +1 -0
- package/dist/desktop/companion-server.d.ts +67 -4
- package/dist/desktop/companion-server.d.ts.map +1 -1
- package/dist/desktop/companion-server.js +617 -70
- package/dist/desktop/companion-server.js.map +1 -1
- package/dist/desktop/web-artifacts-builder.d.ts +108 -0
- package/dist/desktop/web-artifacts-builder.d.ts.map +1 -0
- package/dist/desktop/web-artifacts-builder.js +184 -0
- package/dist/desktop/web-artifacts-builder.js.map +1 -0
- package/dist/hooks/built-in.d.ts.map +1 -1
- package/dist/hooks/built-in.js +15 -10
- package/dist/hooks/built-in.js.map +1 -1
- package/dist/index.js +1301 -167
- package/dist/index.js.map +1 -1
- package/dist/integrations/integration-manifest.d.ts +140 -0
- package/dist/integrations/integration-manifest.d.ts.map +1 -0
- package/dist/integrations/integration-manifest.js +268 -0
- package/dist/integrations/integration-manifest.js.map +1 -0
- package/dist/intelligence/apply-patch-dsl.d.ts +112 -0
- package/dist/intelligence/apply-patch-dsl.d.ts.map +1 -0
- package/dist/intelligence/apply-patch-dsl.js +264 -0
- package/dist/intelligence/apply-patch-dsl.js.map +1 -0
- package/dist/intelligence/apply-patch-executor.d.ts +147 -0
- package/dist/intelligence/apply-patch-executor.d.ts.map +1 -0
- package/dist/intelligence/apply-patch-executor.js +418 -0
- package/dist/intelligence/apply-patch-executor.js.map +1 -0
- package/dist/intelligence/blast-radius.d.ts +67 -0
- package/dist/intelligence/blast-radius.d.ts.map +1 -0
- package/dist/intelligence/blast-radius.js +536 -0
- package/dist/intelligence/blast-radius.js.map +1 -0
- package/dist/intelligence/code-graph.d.ts +58 -7
- package/dist/intelligence/code-graph.d.ts.map +1 -1
- package/dist/intelligence/code-graph.js +347 -16
- package/dist/intelligence/code-graph.js.map +1 -1
- package/dist/intelligence/codebase-health.d.ts.map +1 -1
- package/dist/intelligence/codebase-health.js +4 -3
- package/dist/intelligence/codebase-health.js.map +1 -1
- package/dist/intelligence/codemaps.d.ts +30 -1
- package/dist/intelligence/codemaps.d.ts.map +1 -1
- package/dist/intelligence/codemaps.js +99 -16
- package/dist/intelligence/codemaps.js.map +1 -1
- package/dist/intelligence/consecutive-error-counter.d.ts +89 -0
- package/dist/intelligence/consecutive-error-counter.d.ts.map +1 -0
- package/dist/intelligence/consecutive-error-counter.js +151 -0
- package/dist/intelligence/consecutive-error-counter.js.map +1 -0
- package/dist/intelligence/eval-frameworks/redteam-plugin-catalog.d.ts +87 -0
- package/dist/intelligence/eval-frameworks/redteam-plugin-catalog.d.ts.map +1 -0
- package/dist/intelligence/eval-frameworks/redteam-plugin-catalog.js +882 -0
- package/dist/intelligence/eval-frameworks/redteam-plugin-catalog.js.map +1 -0
- package/dist/intelligence/extractors/mineru.d.ts +108 -0
- package/dist/intelligence/extractors/mineru.d.ts.map +1 -0
- package/dist/intelligence/extractors/mineru.js +352 -0
- package/dist/intelligence/extractors/mineru.js.map +1 -0
- package/dist/intelligence/harness-introspect.d.ts +124 -0
- package/dist/intelligence/harness-introspect.d.ts.map +1 -0
- package/dist/intelligence/harness-introspect.js +349 -0
- package/dist/intelligence/harness-introspect.js.map +1 -0
- package/dist/intelligence/multi-patch-voter.d.ts +59 -1
- package/dist/intelligence/multi-patch-voter.d.ts.map +1 -1
- package/dist/intelligence/multi-patch-voter.js +191 -27
- package/dist/intelligence/multi-patch-voter.js.map +1 -1
- package/dist/intelligence/multimodal-extract.d.ts +44 -0
- package/dist/intelligence/multimodal-extract.d.ts.map +1 -1
- package/dist/intelligence/multimodal-extract.js +40 -1
- package/dist/intelligence/multimodal-extract.js.map +1 -1
- package/dist/intelligence/research-loops/budgeted-research.d.ts +7 -0
- package/dist/intelligence/research-loops/budgeted-research.d.ts.map +1 -1
- package/dist/intelligence/research-loops/budgeted-research.js +18 -0
- package/dist/intelligence/research-loops/budgeted-research.js.map +1 -1
- package/dist/intelligence/research-loops/constraint-guided-explorer.d.ts +124 -0
- package/dist/intelligence/research-loops/constraint-guided-explorer.d.ts.map +1 -0
- package/dist/intelligence/research-loops/constraint-guided-explorer.js +177 -0
- package/dist/intelligence/research-loops/constraint-guided-explorer.js.map +1 -0
- package/dist/intelligence/research-loops/results-collector.d.ts +62 -0
- package/dist/intelligence/research-loops/results-collector.d.ts.map +1 -0
- package/dist/intelligence/research-loops/results-collector.js +128 -0
- package/dist/intelligence/research-loops/results-collector.js.map +1 -0
- package/dist/intelligence/research-loops/results-log.d.ts +94 -0
- package/dist/intelligence/research-loops/results-log.d.ts.map +1 -0
- package/dist/intelligence/research-loops/results-log.js +178 -0
- package/dist/intelligence/research-loops/results-log.js.map +1 -0
- package/dist/intelligence/research-loops/strategies/base-strategy.d.ts +111 -0
- package/dist/intelligence/research-loops/strategies/base-strategy.d.ts.map +1 -0
- package/dist/intelligence/research-loops/strategies/base-strategy.js +72 -0
- package/dist/intelligence/research-loops/strategies/base-strategy.js.map +1 -0
- package/dist/intelligence/research-loops/strategies/dual-confidence.d.ts +57 -0
- package/dist/intelligence/research-loops/strategies/dual-confidence.d.ts.map +1 -0
- package/dist/intelligence/research-loops/strategies/dual-confidence.js +172 -0
- package/dist/intelligence/research-loops/strategies/dual-confidence.js.map +1 -0
- package/dist/intelligence/research-loops/strategies/langgraph-agent.d.ts +68 -0
- package/dist/intelligence/research-loops/strategies/langgraph-agent.d.ts.map +1 -0
- package/dist/intelligence/research-loops/strategies/langgraph-agent.js +221 -0
- package/dist/intelligence/research-loops/strategies/langgraph-agent.js.map +1 -0
- package/dist/intelligence/research-loops/strategies/parallel-constrained.d.ts +42 -0
- package/dist/intelligence/research-loops/strategies/parallel-constrained.d.ts.map +1 -0
- package/dist/intelligence/research-loops/strategies/parallel-constrained.js +132 -0
- package/dist/intelligence/research-loops/strategies/parallel-constrained.js.map +1 -0
- package/dist/intelligence/research-loops/strategies/recursive-decomposition.d.ts +55 -0
- package/dist/intelligence/research-loops/strategies/recursive-decomposition.d.ts.map +1 -0
- package/dist/intelligence/research-loops/strategies/recursive-decomposition.js +187 -0
- package/dist/intelligence/research-loops/strategies/recursive-decomposition.js.map +1 -0
- package/dist/intelligence/research-loops/strategy-registry.d.ts +43 -0
- package/dist/intelligence/research-loops/strategy-registry.d.ts.map +1 -0
- package/dist/intelligence/research-loops/strategy-registry.js +62 -0
- package/dist/intelligence/research-loops/strategy-registry.js.map +1 -0
- package/dist/intelligence/research-strategies.d.ts +133 -0
- package/dist/intelligence/research-strategies.d.ts.map +1 -0
- package/dist/intelligence/research-strategies.js +204 -0
- package/dist/intelligence/research-strategies.js.map +1 -0
- package/dist/lib.d.ts +49 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +133 -0
- package/dist/lib.js.map +1 -1
- package/dist/loop/tool-description-reset.d.ts +113 -0
- package/dist/loop/tool-description-reset.d.ts.map +1 -0
- package/dist/loop/tool-description-reset.js +136 -0
- package/dist/loop/tool-description-reset.js.map +1 -0
- package/dist/lsp/server-registry.d.ts.map +1 -1
- package/dist/lsp/server-registry.js +2 -1
- package/dist/lsp/server-registry.js.map +1 -1
- package/dist/lsp/symbol-operations.d.ts.map +1 -1
- package/dist/lsp/symbol-operations.js +2 -1
- package/dist/lsp/symbol-operations.js.map +1 -1
- package/dist/marketplace/acp-agent-registry.d.ts.map +1 -1
- package/dist/marketplace/acp-agent-registry.js +2 -1
- package/dist/marketplace/acp-agent-registry.js.map +1 -1
- package/dist/marketplace/marketplace-source-git.d.ts +135 -0
- package/dist/marketplace/marketplace-source-git.d.ts.map +1 -0
- package/dist/marketplace/marketplace-source-git.js +211 -0
- package/dist/marketplace/marketplace-source-git.js.map +1 -0
- package/dist/marketplace/registry.d.ts +87 -0
- package/dist/marketplace/registry.d.ts.map +1 -1
- package/dist/marketplace/registry.js +113 -2
- package/dist/marketplace/registry.js.map +1 -1
- package/dist/mcp/chrome-devtools.d.ts +62 -2
- package/dist/mcp/chrome-devtools.d.ts.map +1 -1
- package/dist/mcp/chrome-devtools.js +183 -1
- package/dist/mcp/chrome-devtools.js.map +1 -1
- package/dist/mcp/health-probe.d.ts +1 -0
- package/dist/mcp/health-probe.d.ts.map +1 -1
- package/dist/mcp/health-probe.js +32 -1
- package/dist/mcp/health-probe.js.map +1 -1
- package/dist/mcp/mcp-scaffolder.d.ts +166 -0
- package/dist/mcp/mcp-scaffolder.d.ts.map +1 -0
- package/dist/mcp/mcp-scaffolder.js +526 -0
- package/dist/mcp/mcp-scaffolder.js.map +1 -0
- package/dist/mcp/mcp-server.d.ts.map +1 -1
- package/dist/mcp/mcp-server.js +55 -0
- package/dist/mcp/mcp-server.js.map +1 -1
- package/dist/mcp/memory-mcp.d.ts +163 -0
- package/dist/mcp/memory-mcp.d.ts.map +1 -0
- package/dist/mcp/memory-mcp.js +368 -0
- package/dist/mcp/memory-mcp.js.map +1 -0
- package/dist/mcp/tool-loader.d.ts.map +1 -1
- package/dist/mcp/tool-loader.js +13 -0
- package/dist/mcp/tool-loader.js.map +1 -1
- package/dist/meet/meeting-runtime.d.ts.map +1 -1
- package/dist/meet/meeting-runtime.js +3 -1
- package/dist/meet/meeting-runtime.js.map +1 -1
- package/dist/memory/incremental-indexer.d.ts.map +1 -1
- package/dist/memory/incremental-indexer.js +5 -1
- package/dist/memory/incremental-indexer.js.map +1 -1
- package/dist/memory/qmd-integration.d.ts.map +1 -1
- package/dist/memory/qmd-integration.js +47 -15
- package/dist/memory/qmd-integration.js.map +1 -1
- package/dist/memory/two-phase-consolidator.d.ts +118 -0
- package/dist/memory/two-phase-consolidator.d.ts.map +1 -0
- package/dist/memory/two-phase-consolidator.js +265 -0
- package/dist/memory/two-phase-consolidator.js.map +1 -0
- package/dist/middleware/doom-loop.d.ts +21 -0
- package/dist/middleware/doom-loop.d.ts.map +1 -1
- package/dist/middleware/doom-loop.js +49 -6
- package/dist/middleware/doom-loop.js.map +1 -1
- package/dist/middleware/loop-detection.d.ts +176 -6
- package/dist/middleware/loop-detection.d.ts.map +1 -1
- package/dist/middleware/loop-detection.js +341 -6
- package/dist/middleware/loop-detection.js.map +1 -1
- package/dist/middleware/pipeline.d.ts +9 -1
- package/dist/middleware/pipeline.d.ts.map +1 -1
- package/dist/middleware/pipeline.js +116 -1
- package/dist/middleware/pipeline.js.map +1 -1
- package/dist/middleware/tool-flow-gate.d.ts +20 -0
- package/dist/middleware/tool-flow-gate.d.ts.map +1 -1
- package/dist/middleware/tool-flow-gate.js +93 -0
- package/dist/middleware/tool-flow-gate.js.map +1 -1
- package/dist/mobile/ios-app.d.ts +18 -1
- package/dist/mobile/ios-app.d.ts.map +1 -1
- package/dist/mobile/ios-app.js +108 -8
- package/dist/mobile/ios-app.js.map +1 -1
- package/dist/orchestration/adversarial-cut.d.ts +85 -0
- package/dist/orchestration/adversarial-cut.d.ts.map +1 -0
- package/dist/orchestration/adversarial-cut.js +222 -0
- package/dist/orchestration/adversarial-cut.js.map +1 -0
- package/dist/orchestration/agent-kanban.d.ts +147 -0
- package/dist/orchestration/agent-kanban.d.ts.map +1 -0
- package/dist/orchestration/agent-kanban.js +414 -0
- package/dist/orchestration/agent-kanban.js.map +1 -0
- package/dist/orchestration/autonomous.d.ts +111 -0
- package/dist/orchestration/autonomous.d.ts.map +1 -1
- package/dist/orchestration/autonomous.js +183 -6
- package/dist/orchestration/autonomous.js.map +1 -1
- package/dist/orchestration/elo-tournament.d.ts +90 -0
- package/dist/orchestration/elo-tournament.d.ts.map +1 -0
- package/dist/orchestration/elo-tournament.js +203 -0
- package/dist/orchestration/elo-tournament.js.map +1 -0
- package/dist/orchestration/multi-model-arena.d.ts +138 -0
- package/dist/orchestration/multi-model-arena.d.ts.map +1 -0
- package/dist/orchestration/multi-model-arena.js +298 -0
- package/dist/orchestration/multi-model-arena.js.map +1 -0
- package/dist/orchestration/review-pipeline.d.ts +78 -0
- package/dist/orchestration/review-pipeline.d.ts.map +1 -0
- package/dist/orchestration/review-pipeline.js +202 -0
- package/dist/orchestration/review-pipeline.js.map +1 -0
- package/dist/orchestration/unified-state-thread.d.ts +186 -0
- package/dist/orchestration/unified-state-thread.d.ts.map +1 -0
- package/dist/orchestration/unified-state-thread.js +327 -0
- package/dist/orchestration/unified-state-thread.js.map +1 -0
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/plugins/manager.js +2 -1
- package/dist/plugins/manager.js.map +1 -1
- package/dist/prompt/engine.d.ts +7 -0
- package/dist/prompt/engine.d.ts.map +1 -1
- package/dist/prompt/engine.js.map +1 -1
- package/dist/prompt/modules/caveman.d.ts +51 -0
- package/dist/prompt/modules/caveman.d.ts.map +1 -0
- package/dist/prompt/modules/caveman.js +97 -0
- package/dist/prompt/modules/caveman.js.map +1 -0
- package/dist/prompt/modules/index.d.ts +1 -0
- package/dist/prompt/modules/index.d.ts.map +1 -1
- package/dist/prompt/modules/index.js +3 -0
- package/dist/prompt/modules/index.js.map +1 -1
- package/dist/providers/account-pool.d.ts.map +1 -1
- package/dist/providers/account-pool.js +1 -0
- package/dist/providers/account-pool.js.map +1 -1
- package/dist/providers/anthropic-adapter.d.ts.map +1 -1
- package/dist/providers/anthropic-adapter.js +33 -0
- package/dist/providers/anthropic-adapter.js.map +1 -1
- package/dist/providers/cloud-offload/config-loader.d.ts +20 -0
- package/dist/providers/cloud-offload/config-loader.d.ts.map +1 -0
- package/dist/providers/cloud-offload/config-loader.js +148 -0
- package/dist/providers/cloud-offload/config-loader.js.map +1 -0
- package/dist/providers/codex-adapter.d.ts.map +1 -1
- package/dist/providers/codex-adapter.js +136 -4
- package/dist/providers/codex-adapter.js.map +1 -1
- package/dist/providers/discovery.d.ts.map +1 -1
- package/dist/providers/discovery.js +20 -0
- package/dist/providers/discovery.js.map +1 -1
- package/dist/providers/effort-cascade.d.ts +113 -0
- package/dist/providers/effort-cascade.d.ts.map +1 -0
- package/dist/providers/effort-cascade.js +215 -0
- package/dist/providers/effort-cascade.js.map +1 -0
- package/dist/providers/fallback-chain.d.ts.map +1 -1
- package/dist/providers/fallback-chain.js +1 -0
- package/dist/providers/fallback-chain.js.map +1 -1
- package/dist/providers/health-check.d.ts.map +1 -1
- package/dist/providers/health-check.js +8 -0
- package/dist/providers/health-check.js.map +1 -1
- package/dist/providers/model-defaults.d.ts +1 -1
- package/dist/providers/model-defaults.d.ts.map +1 -1
- package/dist/providers/model-defaults.js +13 -1
- package/dist/providers/model-defaults.js.map +1 -1
- package/dist/providers/model-discovery.d.ts.map +1 -1
- package/dist/providers/model-discovery.js +1 -0
- package/dist/providers/model-discovery.js.map +1 -1
- package/dist/providers/ollama-adapter.d.ts.map +1 -1
- package/dist/providers/ollama-adapter.js +21 -1
- package/dist/providers/ollama-adapter.js.map +1 -1
- package/dist/providers/openai-compat-adapter.d.ts.map +1 -1
- package/dist/providers/openai-compat-adapter.js +25 -0
- package/dist/providers/openai-compat-adapter.js.map +1 -1
- package/dist/providers/preset-library.d.ts.map +1 -1
- package/dist/providers/preset-library.js +9 -0
- package/dist/providers/preset-library.js.map +1 -1
- package/dist/providers/provider-service.d.ts.map +1 -1
- package/dist/providers/provider-service.js +40 -1
- package/dist/providers/provider-service.js.map +1 -1
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +7 -0
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/sticky-rotation.d.ts +100 -0
- package/dist/providers/sticky-rotation.d.ts.map +1 -0
- package/dist/providers/sticky-rotation.js +134 -0
- package/dist/providers/sticky-rotation.js.map +1 -0
- package/dist/providers/tool-parsers/parsers.d.ts.map +1 -1
- package/dist/providers/tool-parsers/parsers.js +17 -4
- package/dist/providers/tool-parsers/parsers.js.map +1 -1
- package/dist/providers/types.d.ts +25 -0
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/recipes/final-output.d.ts +74 -0
- package/dist/recipes/final-output.d.ts.map +1 -0
- package/dist/recipes/final-output.js +232 -0
- package/dist/recipes/final-output.js.map +1 -0
- package/dist/recipes/recipe-loader.d.ts.map +1 -1
- package/dist/recipes/recipe-loader.js +29 -0
- package/dist/recipes/recipe-loader.js.map +1 -1
- package/dist/recipes/recipe-runtime.d.ts.map +1 -1
- package/dist/recipes/recipe-runtime.js +31 -0
- package/dist/recipes/recipe-runtime.js.map +1 -1
- package/dist/recipes/recipe-types.d.ts +28 -0
- package/dist/recipes/recipe-types.d.ts.map +1 -1
- package/dist/recipes/sop-crystallizer.d.ts +90 -0
- package/dist/recipes/sop-crystallizer.d.ts.map +1 -0
- package/dist/recipes/sop-crystallizer.js +238 -0
- package/dist/recipes/sop-crystallizer.js.map +1 -0
- package/dist/recipes/sub-recipe-orchestrator.d.ts +126 -0
- package/dist/recipes/sub-recipe-orchestrator.d.ts.map +1 -0
- package/dist/recipes/sub-recipe-orchestrator.js +225 -0
- package/dist/recipes/sub-recipe-orchestrator.js.map +1 -0
- package/dist/sandbox/extended-backends.d.ts.map +1 -1
- package/dist/sandbox/extended-backends.js +7 -2
- package/dist/sandbox/extended-backends.js.map +1 -1
- package/dist/sandbox/seatbelt-policy.d.ts +132 -0
- package/dist/sandbox/seatbelt-policy.d.ts.map +1 -0
- package/dist/sandbox/seatbelt-policy.js +562 -0
- package/dist/sandbox/seatbelt-policy.js.map +1 -0
- package/dist/sandbox/terminal-backends.d.ts.map +1 -1
- package/dist/sandbox/terminal-backends.js +3 -1
- package/dist/sandbox/terminal-backends.js.map +1 -1
- package/dist/security/auto-mode-ruleset.d.ts +142 -0
- package/dist/security/auto-mode-ruleset.d.ts.map +1 -0
- package/dist/security/auto-mode-ruleset.js +264 -0
- package/dist/security/auto-mode-ruleset.js.map +1 -0
- package/dist/security/bash-arity-policy.d.ts +70 -0
- package/dist/security/bash-arity-policy.d.ts.map +1 -0
- package/dist/security/bash-arity-policy.js +189 -0
- package/dist/security/bash-arity-policy.js.map +1 -0
- package/dist/security/command-sanitizer.d.ts.map +1 -1
- package/dist/security/command-sanitizer.js +24 -0
- package/dist/security/command-sanitizer.js.map +1 -1
- package/dist/security/credential-broker.d.ts +136 -0
- package/dist/security/credential-broker.d.ts.map +1 -0
- package/dist/security/credential-broker.js +284 -0
- package/dist/security/credential-broker.js.map +1 -0
- package/dist/security/invisible-text-sanitizer.d.ts +114 -0
- package/dist/security/invisible-text-sanitizer.d.ts.map +1 -0
- package/dist/security/invisible-text-sanitizer.js +221 -0
- package/dist/security/invisible-text-sanitizer.js.map +1 -0
- package/dist/security/osv-check.d.ts +174 -0
- package/dist/security/osv-check.d.ts.map +1 -0
- package/dist/security/osv-check.js +409 -0
- package/dist/security/osv-check.js.map +1 -0
- package/dist/security/process-hardening.d.ts +114 -0
- package/dist/security/process-hardening.d.ts.map +1 -0
- package/dist/security/process-hardening.js +132 -0
- package/dist/security/process-hardening.js.map +1 -0
- package/dist/security/shell-escalation-tiers.d.ts +73 -0
- package/dist/security/shell-escalation-tiers.d.ts.map +1 -0
- package/dist/security/shell-escalation-tiers.js +439 -0
- package/dist/security/shell-escalation-tiers.js.map +1 -0
- package/dist/session/fork.d.ts +100 -0
- package/dist/session/fork.d.ts.map +1 -0
- package/dist/session/fork.js +223 -0
- package/dist/session/fork.js.map +1 -0
- package/dist/skills/activation-telemetry.d.ts +154 -0
- package/dist/skills/activation-telemetry.d.ts.map +1 -0
- package/dist/skills/activation-telemetry.js +274 -0
- package/dist/skills/activation-telemetry.js.map +1 -0
- package/dist/skills/agentskills-registry.d.ts +12 -1
- package/dist/skills/agentskills-registry.d.ts.map +1 -1
- package/dist/skills/agentskills-registry.js +11 -0
- package/dist/skills/agentskills-registry.js.map +1 -1
- package/dist/skills/description-optimizer.d.ts +101 -0
- package/dist/skills/description-optimizer.d.ts.map +1 -0
- package/dist/skills/description-optimizer.js +304 -0
- package/dist/skills/description-optimizer.js.map +1 -0
- package/dist/skills/history-deduper.d.ts +109 -0
- package/dist/skills/history-deduper.d.ts.map +1 -0
- package/dist/skills/history-deduper.js +222 -0
- package/dist/skills/history-deduper.js.map +1 -0
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +2 -1
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/skill-source-adapter.d.ts +16 -0
- package/dist/skills/skill-source-adapter.d.ts.map +1 -1
- package/dist/skills/skill-source-adapter.js +0 -0
- package/dist/skills/skill-source-adapter.js.map +1 -1
- package/dist/skills/skill-standard.d.ts +29 -4
- package/dist/skills/skill-standard.d.ts.map +1 -1
- package/dist/skills/skill-standard.js +139 -66
- package/dist/skills/skill-standard.js.map +1 -1
- package/dist/skills/sop-completion-gate.d.ts +137 -0
- package/dist/skills/sop-completion-gate.d.ts.map +1 -0
- package/dist/skills/sop-completion-gate.js +159 -0
- package/dist/skills/sop-completion-gate.js.map +1 -0
- package/dist/skills/sop-template.d.ts +85 -0
- package/dist/skills/sop-template.d.ts.map +1 -0
- package/dist/skills/sop-template.js +106 -0
- package/dist/skills/sop-template.js.map +1 -0
- package/dist/skills/wotann-skills-registry.d.ts +1 -1
- package/dist/skills/wotann-skills-registry.d.ts.map +1 -1
- package/dist/skills/wotann-skills-registry.js +503 -0
- package/dist/skills/wotann-skills-registry.js.map +1 -1
- package/dist/snippets/prompt-corpus.d.ts +10 -0
- package/dist/snippets/prompt-corpus.d.ts.map +1 -0
- package/dist/snippets/prompt-corpus.js +158 -0
- package/dist/snippets/prompt-corpus.js.map +1 -0
- package/dist/snippets/snippet-store.d.ts +27 -0
- package/dist/snippets/snippet-store.d.ts.map +1 -1
- package/dist/snippets/snippet-store.js +109 -6
- package/dist/snippets/snippet-store.js.map +1 -1
- package/dist/storage/sqlite-node-backend.d.ts +47 -36
- package/dist/storage/sqlite-node-backend.d.ts.map +1 -1
- package/dist/storage/sqlite-node-backend.js +250 -94
- package/dist/storage/sqlite-node-backend.js.map +1 -1
- package/dist/testing/webapp-server-lifecycle.d.ts +74 -0
- package/dist/testing/webapp-server-lifecycle.d.ts.map +1 -0
- package/dist/testing/webapp-server-lifecycle.js +272 -0
- package/dist/testing/webapp-server-lifecycle.js.map +1 -0
- package/dist/tools/markitdown-bridge.d.ts +19 -0
- package/dist/tools/markitdown-bridge.d.ts.map +1 -1
- package/dist/tools/markitdown-bridge.js +167 -2
- package/dist/tools/markitdown-bridge.js.map +1 -1
- package/dist/tools/pdf-processor.d.ts.map +1 -1
- package/dist/tools/pdf-processor.js +7 -3
- package/dist/tools/pdf-processor.js.map +1 -1
- package/dist/tools/pptx-processor.d.ts +51 -0
- package/dist/tools/pptx-processor.d.ts.map +1 -0
- package/dist/tools/pptx-processor.js +334 -0
- package/dist/tools/pptx-processor.js.map +1 -0
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +1661 -149
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/agent-tools.d.ts +60 -0
- package/dist/ui/agent-tools.d.ts.map +1 -0
- package/dist/ui/agent-tools.js +468 -0
- package/dist/ui/agent-tools.js.map +1 -0
- package/dist/ui/alt-buffer-mode.d.ts +68 -0
- package/dist/ui/alt-buffer-mode.d.ts.map +1 -0
- package/dist/ui/alt-buffer-mode.js +114 -0
- package/dist/ui/alt-buffer-mode.js.map +1 -0
- package/dist/ui/alt-buffer.d.ts +57 -10
- package/dist/ui/alt-buffer.d.ts.map +1 -1
- package/dist/ui/alt-buffer.js +54 -12
- package/dist/ui/alt-buffer.js.map +1 -1
- package/dist/ui/components/AgentStatusPanel.d.ts.map +1 -1
- package/dist/ui/components/AgentStatusPanel.js +14 -6
- package/dist/ui/components/AgentStatusPanel.js.map +1 -1
- package/dist/ui/components/AuditLogPanel.js +3 -3
- package/dist/ui/components/AuditLogPanel.js.map +1 -1
- package/dist/ui/components/AutomationsPanel.js +3 -3
- package/dist/ui/components/AutomationsPanel.js.map +1 -1
- package/dist/ui/components/ChatView.d.ts +9 -1
- package/dist/ui/components/ChatView.d.ts.map +1 -1
- package/dist/ui/components/ChatView.js +503 -14
- package/dist/ui/components/ChatView.js.map +1 -1
- package/dist/ui/components/CommandPaletteCommands.d.ts +2 -0
- package/dist/ui/components/CommandPaletteCommands.d.ts.map +1 -1
- package/dist/ui/components/CommandPaletteCommands.js +18 -2
- package/dist/ui/components/CommandPaletteCommands.js.map +1 -1
- package/dist/ui/components/ContextHUD.d.ts.map +1 -1
- package/dist/ui/components/ContextHUD.js +3 -3
- package/dist/ui/components/ContextHUD.js.map +1 -1
- package/dist/ui/components/DispatchInbox.js +3 -3
- package/dist/ui/components/DispatchInbox.js.map +1 -1
- package/dist/ui/components/GdprPanel.d.ts.map +1 -1
- package/dist/ui/components/GdprPanel.js +2 -3
- package/dist/ui/components/GdprPanel.js.map +1 -1
- package/dist/ui/components/HistoryPicker.js +3 -3
- package/dist/ui/components/HistoryPicker.js.map +1 -1
- package/dist/ui/components/ModelPicker.d.ts +9 -6
- package/dist/ui/components/ModelPicker.d.ts.map +1 -1
- package/dist/ui/components/ModelPicker.js +12 -9
- package/dist/ui/components/ModelPicker.js.map +1 -1
- package/dist/ui/components/OptionPicker.js +3 -3
- package/dist/ui/components/OptionPicker.js.map +1 -1
- package/dist/ui/components/PermissionPrompt.js +3 -3
- package/dist/ui/components/PermissionPrompt.js.map +1 -1
- package/dist/ui/components/PromptInput.d.ts.map +1 -1
- package/dist/ui/components/PromptInput.js +65 -10
- package/dist/ui/components/PromptInput.js.map +1 -1
- package/dist/ui/components/ProviderSetupOverlay.d.ts +19 -0
- package/dist/ui/components/ProviderSetupOverlay.d.ts.map +1 -0
- package/dist/ui/components/ProviderSetupOverlay.js +124 -0
- package/dist/ui/components/ProviderSetupOverlay.js.map +1 -0
- package/dist/ui/components/StartupScreen.d.ts.map +1 -1
- package/dist/ui/components/StartupScreen.js +10 -1
- package/dist/ui/components/StartupScreen.js.map +1 -1
- package/dist/ui/components/StatusBar.d.ts.map +1 -1
- package/dist/ui/components/StatusBar.js +3 -3
- package/dist/ui/components/StatusBar.js.map +1 -1
- package/dist/ui/components/TrustPanel.js +3 -3
- package/dist/ui/components/TrustPanel.js.map +1 -1
- package/dist/ui/components/UnifiedStatusBar.d.ts.map +1 -1
- package/dist/ui/components/UnifiedStatusBar.js +76 -5
- package/dist/ui/components/UnifiedStatusBar.js.map +1 -1
- package/dist/ui/computer-action-parser.d.ts +6 -0
- package/dist/ui/computer-action-parser.d.ts.map +1 -0
- package/dist/ui/computer-action-parser.js +119 -0
- package/dist/ui/computer-action-parser.js.map +1 -0
- package/dist/ui/helpers.d.ts +1 -1
- package/dist/ui/helpers.d.ts.map +1 -1
- package/dist/ui/helpers.js +1 -1
- package/dist/ui/helpers.js.map +1 -1
- package/dist/ui/keybindings.d.ts +12 -2
- package/dist/ui/keybindings.d.ts.map +1 -1
- package/dist/ui/keybindings.js +36 -4
- package/dist/ui/keybindings.js.map +1 -1
- package/dist/ui/markdown-stream.d.ts +99 -0
- package/dist/ui/markdown-stream.d.ts.map +1 -0
- package/dist/ui/markdown-stream.js +314 -0
- package/dist/ui/markdown-stream.js.map +1 -0
- package/dist/ui/terminal-keyboard-protocol.d.ts +23 -0
- package/dist/ui/terminal-keyboard-protocol.d.ts.map +1 -0
- package/dist/ui/terminal-keyboard-protocol.js +72 -0
- package/dist/ui/terminal-keyboard-protocol.js.map +1 -0
- package/dist/ui/theme/context.d.ts +39 -0
- package/dist/ui/theme/context.d.ts.map +1 -0
- package/dist/ui/theme/context.js +42 -0
- package/dist/ui/theme/context.js.map +1 -0
- package/dist/utils/platform.d.ts +115 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +146 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/verification/auto-verify-policy.d.ts +107 -0
- package/dist/verification/auto-verify-policy.d.ts.map +1 -0
- package/dist/verification/auto-verify-policy.js +309 -0
- package/dist/verification/auto-verify-policy.js.map +1 -0
- package/package.json +4 -1
- package/skills/anthropic-finance/audit-spreadsheet.md +165 -0
- package/skills/anthropic-finance/clean-data-xls.md +59 -0
- package/skills/anthropic-finance/competitive-analysis.md +288 -0
- package/skills/anthropic-finance/compliance-rules-engine.md +56 -0
- package/skills/anthropic-finance/dd-checklist.md +126 -0
- package/skills/anthropic-finance/independent-recompute.md +47 -0
- package/skills/anthropic-finance/reconcile-root-cause.md +48 -0
- package/skills/anthropic-finance/roll-forward.md +42 -0
- package/skills/anthropic-finance/untrusted-doc-parse.md +57 -0
- package/skills/anthropic-finance/variance-commentary.md +43 -0
- package/skills/doubt-driven-development.md +95 -0
- package/skills/mattpocock/diagnose.md +126 -0
- package/skills/mattpocock/grill-with-docs.md +97 -0
- package/skills/mattpocock/improve-codebase-architecture.md +80 -0
- package/skills/mattpocock/prototype.md +39 -0
- package/skills/mattpocock/review.md +87 -0
- package/skills/mattpocock/tdd.md +118 -0
- package/skills/mattpocock/zoom-out.md +17 -0
- package/skills/scientific/citation-management/SKILL.md +1113 -0
- package/skills/scientific/citation-management/assets/bibtex_template.bib +264 -0
- package/skills/scientific/citation-management/assets/citation_checklist.md +386 -0
- package/skills/scientific/citation-management/references/bibtex_formatting.md +908 -0
- package/skills/scientific/citation-management/references/citation_validation.md +794 -0
- package/skills/scientific/citation-management/references/google_scholar_search.md +725 -0
- package/skills/scientific/citation-management/references/metadata_extraction.md +870 -0
- package/skills/scientific/citation-management/references/pubmed_search.md +839 -0
- package/skills/scientific/citation-management/scripts/doi_to_bibtex.py +204 -0
- package/skills/scientific/citation-management/scripts/extract_metadata.py +569 -0
- package/skills/scientific/citation-management/scripts/format_bibtex.py +349 -0
- package/skills/scientific/citation-management/scripts/generate_schematic.py +139 -0
- package/skills/scientific/citation-management/scripts/generate_schematic_ai.py +817 -0
- package/skills/scientific/citation-management/scripts/search_google_scholar.py +282 -0
- package/skills/scientific/citation-management/scripts/search_pubmed.py +398 -0
- package/skills/scientific/citation-management/scripts/validate_citations.py +497 -0
- package/skills/scientific/database-lookup/SKILL.md +480 -0
- package/skills/scientific/database-lookup/references/addgene.md +38 -0
- package/skills/scientific/database-lookup/references/alphafold.md +40 -0
- package/skills/scientific/database-lookup/references/alphavantage.md +261 -0
- package/skills/scientific/database-lookup/references/bea.md +409 -0
- package/skills/scientific/database-lookup/references/bindingdb.md +85 -0
- package/skills/scientific/database-lookup/references/biogrid.md +110 -0
- package/skills/scientific/database-lookup/references/bls.md +235 -0
- package/skills/scientific/database-lookup/references/brenda.md +71 -0
- package/skills/scientific/database-lookup/references/cbioportal.md +206 -0
- package/skills/scientific/database-lookup/references/census.md +251 -0
- package/skills/scientific/database-lookup/references/chebi.md +103 -0
- package/skills/scientific/database-lookup/references/chembl.md +80 -0
- package/skills/scientific/database-lookup/references/clinicaltrials.md +77 -0
- package/skills/scientific/database-lookup/references/clinpgx.md +64 -0
- package/skills/scientific/database-lookup/references/clinvar.md +91 -0
- package/skills/scientific/database-lookup/references/cod.md +121 -0
- package/skills/scientific/database-lookup/references/cosmic.md +59 -0
- package/skills/scientific/database-lookup/references/dailymed.md +65 -0
- package/skills/scientific/database-lookup/references/datacommons.md +237 -0
- package/skills/scientific/database-lookup/references/dbsnp.md +143 -0
- package/skills/scientific/database-lookup/references/disgenet.md +52 -0
- package/skills/scientific/database-lookup/references/drugbank.md +54 -0
- package/skills/scientific/database-lookup/references/ecb.md +191 -0
- package/skills/scientific/database-lookup/references/emdb.md +37 -0
- package/skills/scientific/database-lookup/references/ena.md +372 -0
- package/skills/scientific/database-lookup/references/encode.md +47 -0
- package/skills/scientific/database-lookup/references/ensembl.md +539 -0
- package/skills/scientific/database-lookup/references/epa.md +232 -0
- package/skills/scientific/database-lookup/references/eurostat.md +237 -0
- package/skills/scientific/database-lookup/references/fda.md +64 -0
- package/skills/scientific/database-lookup/references/federal-reserve.md +216 -0
- package/skills/scientific/database-lookup/references/fred.md +297 -0
- package/skills/scientific/database-lookup/references/gene-ontology.md +147 -0
- package/skills/scientific/database-lookup/references/geo.md +130 -0
- package/skills/scientific/database-lookup/references/gnomad.md +93 -0
- package/skills/scientific/database-lookup/references/gtex.md +136 -0
- package/skills/scientific/database-lookup/references/gwas-catalog.md +46 -0
- package/skills/scientific/database-lookup/references/hca.md +35 -0
- package/skills/scientific/database-lookup/references/hpo.md +48 -0
- package/skills/scientific/database-lookup/references/human-protein-atlas.md +57 -0
- package/skills/scientific/database-lookup/references/interpro.md +120 -0
- package/skills/scientific/database-lookup/references/jaspar.md +50 -0
- package/skills/scientific/database-lookup/references/kegg.md +78 -0
- package/skills/scientific/database-lookup/references/lincs-l1000.md +68 -0
- package/skills/scientific/database-lookup/references/materials-project.md +123 -0
- package/skills/scientific/database-lookup/references/metabolomics-workbench.md +98 -0
- package/skills/scientific/database-lookup/references/monarch.md +46 -0
- package/skills/scientific/database-lookup/references/mousemine.md +40 -0
- package/skills/scientific/database-lookup/references/nasa-exoplanet-archive.md +112 -0
- package/skills/scientific/database-lookup/references/nasa.md +121 -0
- package/skills/scientific/database-lookup/references/ncbi-gene.md +64 -0
- package/skills/scientific/database-lookup/references/ncbi-protein.md +104 -0
- package/skills/scientific/database-lookup/references/ncbi-taxonomy.md +121 -0
- package/skills/scientific/database-lookup/references/nist.md +105 -0
- package/skills/scientific/database-lookup/references/noaa.md +199 -0
- package/skills/scientific/database-lookup/references/omim.md +114 -0
- package/skills/scientific/database-lookup/references/opentargets.md +459 -0
- package/skills/scientific/database-lookup/references/openweathermap.md +255 -0
- package/skills/scientific/database-lookup/references/pdb.md +121 -0
- package/skills/scientific/database-lookup/references/pride.md +74 -0
- package/skills/scientific/database-lookup/references/pubchem.md +145 -0
- package/skills/scientific/database-lookup/references/quickgo.md +45 -0
- package/skills/scientific/database-lookup/references/reactome.md +140 -0
- package/skills/scientific/database-lookup/references/rummageo.md +32 -0
- package/skills/scientific/database-lookup/references/sdss.md +130 -0
- package/skills/scientific/database-lookup/references/sec-edgar.md +315 -0
- package/skills/scientific/database-lookup/references/simbad.md +131 -0
- package/skills/scientific/database-lookup/references/sra.md +149 -0
- package/skills/scientific/database-lookup/references/string.md +283 -0
- package/skills/scientific/database-lookup/references/tcga-gdc.md +58 -0
- package/skills/scientific/database-lookup/references/treasury.md +215 -0
- package/skills/scientific/database-lookup/references/ucsc-genome.md +135 -0
- package/skills/scientific/database-lookup/references/uniprot.md +283 -0
- package/skills/scientific/database-lookup/references/usgs.md +260 -0
- package/skills/scientific/database-lookup/references/uspto.md +130 -0
- package/skills/scientific/database-lookup/references/who.md +283 -0
- package/skills/scientific/database-lookup/references/worldbank.md +239 -0
- package/skills/scientific/database-lookup/references/zinc.md +202 -0
- package/skills/scientific/hypothesis-generation/SKILL.md +297 -0
- package/skills/scientific/hypothesis-generation/assets/FORMATTING_GUIDE.md +672 -0
- package/skills/scientific/hypothesis-generation/assets/hypothesis_generation.sty +307 -0
- package/skills/scientific/hypothesis-generation/assets/hypothesis_report_template.tex +572 -0
- package/skills/scientific/hypothesis-generation/references/experimental_design_patterns.md +329 -0
- package/skills/scientific/hypothesis-generation/references/hypothesis_quality_criteria.md +198 -0
- package/skills/scientific/hypothesis-generation/references/literature_search_strategies.md +622 -0
- package/skills/scientific/hypothesis-generation/scripts/generate_schematic.py +139 -0
- package/skills/scientific/hypothesis-generation/scripts/generate_schematic_ai.py +817 -0
- package/skills/scientific/literature-review/SKILL.md +699 -0
- package/skills/scientific/literature-review/assets/review_template.md +412 -0
- package/skills/scientific/literature-review/references/citation_styles.md +166 -0
- package/skills/scientific/literature-review/references/database_strategies.md +455 -0
- package/skills/scientific/literature-review/scripts/generate_pdf.py +176 -0
- package/skills/scientific/literature-review/scripts/generate_schematic.py +139 -0
- package/skills/scientific/literature-review/scripts/generate_schematic_ai.py +817 -0
- package/skills/scientific/literature-review/scripts/search_databases.py +303 -0
- package/skills/scientific/literature-review/scripts/verify_citations.py +222 -0
- package/skills/scientific/markdown-mermaid-writing/SKILL.md +327 -0
- package/skills/scientific/markdown-mermaid-writing/assets/examples/example-research-report.md +221 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/architecture.md +108 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/block.md +177 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/c4.md +136 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/class.md +246 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/complex_examples.md +384 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/er.md +222 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/flowchart.md +177 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/gantt.md +138 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/git_graph.md +74 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/kanban.md +107 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/mindmap.md +74 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/packet.md +55 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/pie.md +52 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/quadrant.md +66 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/radar.md +59 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/requirement.md +88 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/sankey.md +71 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/sequence.md +174 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/state.md +150 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/timeline.md +96 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/treemap.md +66 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/user_journey.md +108 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/xy_chart.md +53 -0
- package/skills/scientific/markdown-mermaid-writing/references/diagrams/zenuml.md +71 -0
- package/skills/scientific/markdown-mermaid-writing/references/markdown_style_guide.md +733 -0
- package/skills/scientific/markdown-mermaid-writing/references/mermaid_style_guide.md +458 -0
- package/skills/scientific/markdown-mermaid-writing/templates/decision_record.md +211 -0
- package/skills/scientific/markdown-mermaid-writing/templates/how_to_guide.md +275 -0
- package/skills/scientific/markdown-mermaid-writing/templates/issue.md +303 -0
- package/skills/scientific/markdown-mermaid-writing/templates/kanban.md +223 -0
- package/skills/scientific/markdown-mermaid-writing/templates/presentation.md +312 -0
- package/skills/scientific/markdown-mermaid-writing/templates/project_documentation.md +412 -0
- package/skills/scientific/markdown-mermaid-writing/templates/pull_request.md +319 -0
- package/skills/scientific/markdown-mermaid-writing/templates/research_paper.md +304 -0
- package/skills/scientific/markdown-mermaid-writing/templates/status_report.md +185 -0
- package/skills/scientific/paper-lookup/SKILL.md +193 -0
- package/skills/scientific/paper-lookup/references/arxiv.md +161 -0
- package/skills/scientific/paper-lookup/references/biorxiv.md +118 -0
- package/skills/scientific/paper-lookup/references/core.md +150 -0
- package/skills/scientific/paper-lookup/references/crossref.md +181 -0
- package/skills/scientific/paper-lookup/references/medrxiv.md +104 -0
- package/skills/scientific/paper-lookup/references/openalex.md +174 -0
- package/skills/scientific/paper-lookup/references/pmc.md +152 -0
- package/skills/scientific/paper-lookup/references/pubmed.md +124 -0
- package/skills/scientific/paper-lookup/references/semantic-scholar.md +203 -0
- package/skills/scientific/paper-lookup/references/unpaywall.md +127 -0
- package/skills/scientific/peer-review/SKILL.md +569 -0
- package/skills/scientific/peer-review/references/common_issues.md +552 -0
- package/skills/scientific/peer-review/references/reporting_standards.md +290 -0
- package/skills/scientific/peer-review/scripts/generate_schematic.py +139 -0
- package/skills/scientific/peer-review/scripts/generate_schematic_ai.py +817 -0
- package/skills/scientific/scholar-evaluation/SKILL.md +298 -0
- package/skills/scientific/scholar-evaluation/references/evaluation_framework.md +663 -0
- package/skills/scientific/scholar-evaluation/scripts/calculate_scores.py +378 -0
- package/skills/scientific/scholar-evaluation/scripts/generate_schematic.py +139 -0
- package/skills/scientific/scholar-evaluation/scripts/generate_schematic_ai.py +817 -0
- package/skills/scientific/scientific-brainstorming/SKILL.md +189 -0
- package/skills/scientific/scientific-brainstorming/references/brainstorming_methods.md +326 -0
- package/skills/scientific/scientific-critical-thinking/SKILL.md +570 -0
- package/skills/scientific/scientific-critical-thinking/references/common_biases.md +364 -0
- package/skills/scientific/scientific-critical-thinking/references/evidence_hierarchy.md +484 -0
- package/skills/scientific/scientific-critical-thinking/references/experimental_design.md +496 -0
- package/skills/scientific/scientific-critical-thinking/references/logical_fallacies.md +478 -0
- package/skills/scientific/scientific-critical-thinking/references/scientific_method.md +169 -0
- package/skills/scientific/scientific-critical-thinking/references/statistical_pitfalls.md +506 -0
- package/skills/scientific/scientific-critical-thinking/scripts/generate_schematic.py +139 -0
- package/skills/scientific/scientific-critical-thinking/scripts/generate_schematic_ai.py +817 -0
- package/skills/wotann-imports/incremental-implementation.md +241 -0
- package/skills/wotann-imports/security-threat-model.md +81 -0
- package/skills/wotann-imports/triage.md +103 -0
- package/dist/build/deploy-targets/coolify.d.ts +0 -148
- package/dist/build/deploy-targets/coolify.d.ts.map +0 -1
- package/dist/build/deploy-targets/coolify.js +0 -339
- package/dist/build/deploy-targets/coolify.js.map +0 -1
- package/dist/build/deploy-targets/dokploy.d.ts +0 -139
- package/dist/build/deploy-targets/dokploy.d.ts.map +0 -1
- package/dist/build/deploy-targets/dokploy.js +0 -339
- package/dist/build/deploy-targets/dokploy.js.map +0 -1
- package/dist/claude/hardening/error-handler.d.ts +0 -52
- package/dist/claude/hardening/error-handler.d.ts.map +0 -1
- package/dist/claude/hardening/error-handler.js +0 -158
- package/dist/claude/hardening/error-handler.js.map +0 -1
- package/dist/cli/onboarding.d.ts +0 -34
- package/dist/cli/onboarding.d.ts.map +0 -1
- package/dist/cli/onboarding.js +0 -150
- package/dist/cli/onboarding.js.map +0 -1
- package/dist/core/agent-profiles.d.ts +0 -65
- package/dist/core/agent-profiles.d.ts.map +0 -1
- package/dist/core/agent-profiles.js +0 -137
- package/dist/core/agent-profiles.js.map +0 -1
- package/dist/desktop/supabase-relay.d.ts +0 -86
- package/dist/desktop/supabase-relay.d.ts.map +0 -1
- package/dist/desktop/supabase-relay.js +0 -335
- package/dist/desktop/supabase-relay.js.map +0 -1
- package/dist/intelligence/kg-builder.d.ts +0 -181
- package/dist/intelligence/kg-builder.d.ts.map +0 -1
- package/dist/intelligence/kg-builder.js +0 -807
- package/dist/intelligence/kg-builder.js.map +0 -1
- package/dist/orchestration/jean-orchestrator.d.ts +0 -79
- package/dist/orchestration/jean-orchestrator.d.ts.map +0 -1
- package/dist/orchestration/jean-orchestrator.js +0 -253
- package/dist/orchestration/jean-orchestrator.js.map +0 -1
- package/dist/orchestration/jean-registries/command-registry.d.ts +0 -85
- package/dist/orchestration/jean-registries/command-registry.d.ts.map +0 -1
- package/dist/orchestration/jean-registries/command-registry.js +0 -120
- package/dist/orchestration/jean-registries/command-registry.js.map +0 -1
- package/dist/orchestration/jean-registries/event-registry.d.ts +0 -80
- package/dist/orchestration/jean-registries/event-registry.d.ts.map +0 -1
- package/dist/orchestration/jean-registries/event-registry.js +0 -147
- package/dist/orchestration/jean-registries/event-registry.js.map +0 -1
- package/dist/orchestration/jean-registries/process-registry.d.ts +0 -71
- package/dist/orchestration/jean-registries/process-registry.d.ts.map +0 -1
- package/dist/orchestration/jean-registries/process-registry.js +0 -104
- package/dist/orchestration/jean-registries/process-registry.js.map +0 -1
- package/dist/orchestration/jean-registries/result-registry.d.ts +0 -71
- package/dist/orchestration/jean-registries/result-registry.d.ts.map +0 -1
- package/dist/orchestration/jean-registries/result-registry.js +0 -97
- package/dist/orchestration/jean-registries/result-registry.js.map +0 -1
- package/dist/providers/bedrock-signer.d.ts +0 -23
- package/dist/providers/bedrock-signer.d.ts.map +0 -1
- package/dist/providers/bedrock-signer.js +0 -439
- package/dist/providers/bedrock-signer.js.map +0 -1
- package/dist/providers/harness-profiles.d.ts +0 -70
- package/dist/providers/harness-profiles.d.ts.map +0 -1
- package/dist/providers/harness-profiles.js +0 -210
- package/dist/providers/harness-profiles.js.map +0 -1
- package/dist/providers/vertex-oauth.d.ts +0 -21
- package/dist/providers/vertex-oauth.d.ts.map +0 -1
- package/dist/providers/vertex-oauth.js +0 -393
- package/dist/providers/vertex-oauth.js.map +0 -1
- package/dist/sandbox/backends/cloud-auth.d.ts +0 -50
- package/dist/sandbox/backends/cloud-auth.d.ts.map +0 -1
- package/dist/sandbox/backends/cloud-auth.js +0 -93
- package/dist/sandbox/backends/cloud-auth.js.map +0 -1
- package/dist/security/anti-distillation.d.ts +0 -46
- package/dist/security/anti-distillation.d.ts.map +0 -1
- package/dist/security/anti-distillation.js +0 -358
- package/dist/security/anti-distillation.js.map +0 -1
- package/dist/security/multi-encoding-decoder.d.ts +0 -47
- package/dist/security/multi-encoding-decoder.d.ts.map +0 -1
- package/dist/security/multi-encoding-decoder.js +0 -336
- package/dist/security/multi-encoding-decoder.js.map +0 -1
- package/dist/ui/accessibility.d.ts +0 -157
- package/dist/ui/accessibility.d.ts.map +0 -1
- package/dist/ui/accessibility.js +0 -232
- package/dist/ui/accessibility.js.map +0 -1
- package/dist/ui/animations.d.ts +0 -102
- package/dist/ui/animations.d.ts.map +0 -1
- package/dist/ui/animations.js +0 -277
- package/dist/ui/animations.js.map +0 -1
- package/dist/ui/components/Sparkline.d.ts +0 -81
- package/dist/ui/components/Sparkline.d.ts.map +0 -1
- package/dist/ui/components/Sparkline.js +0 -102
- package/dist/ui/components/Sparkline.js.map +0 -1
- package/dist/ui/input/mouse.d.ts +0 -139
- package/dist/ui/input/mouse.d.ts.map +0 -1
- package/dist/ui/input/mouse.js +0 -239
- package/dist/ui/input/mouse.js.map +0 -1
- package/dist/ui/sound.d.ts +0 -85
- package/dist/ui/sound.d.ts.map +0 -1
- package/dist/ui/sound.js +0 -126
- package/dist/ui/sound.js.map +0 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* credential-broker — Privileged credential-holder broker pattern.
|
|
3
|
+
*
|
|
4
|
+
* Port of the Codex `responses-api-proxy` pattern from
|
|
5
|
+
* openai/codex/codex-rs/responses-api-proxy.
|
|
6
|
+
*
|
|
7
|
+
* The motivation:
|
|
8
|
+
* When WOTANN runs autonomous loops or sandboxed tool execution,
|
|
9
|
+
* we want to MINIMIZE the surface that has API keys in memory. The
|
|
10
|
+
* broker pattern: a small privileged process holds the credentials,
|
|
11
|
+
* exposes a narrow proxy interface, and the unprivileged main loop
|
|
12
|
+
* asks the broker to "make this HTTP request" without ever seeing
|
|
13
|
+
* the actual key.
|
|
14
|
+
*
|
|
15
|
+
* The broker is in-process here (single Node runtime) rather than a
|
|
16
|
+
* separate OS process — but the same architectural separation applies:
|
|
17
|
+
* - Credentials enter via env-var read at boot, immediately moved
|
|
18
|
+
* into the broker, then ZEROED in the original holder.
|
|
19
|
+
* - All consumers acquire requests through `broker.request()`, never
|
|
20
|
+
* by reading secrets directly.
|
|
21
|
+
* - The broker stamps every outgoing request with the appropriate
|
|
22
|
+
* auth header derived from its private credential bag.
|
|
23
|
+
* - The broker tracks per-credential request counts + last-use ts
|
|
24
|
+
* for audit + rotation policies.
|
|
25
|
+
*
|
|
26
|
+
* Quality bars:
|
|
27
|
+
* - QB#1 immutable: Credential descriptors are readonly + frozen
|
|
28
|
+
* once minted; the broker exposes only requests, never the bag.
|
|
29
|
+
* - QB#3 honest: every method returns a tagged result; never throws.
|
|
30
|
+
* - QB#7 stateless contract: each broker INSTANCE owns one bag;
|
|
31
|
+
* no module-level credential state.
|
|
32
|
+
* - QB#11 sibling-site: composes with src/security/secret-scanner.ts
|
|
33
|
+
* for boot-time detection of accidentally-leaked secrets.
|
|
34
|
+
* - QB#19 zombie-free: every exported function has a runtime caller
|
|
35
|
+
* in the test file.
|
|
36
|
+
*
|
|
37
|
+
* Source: github.com/openai/codex/tree/main/codex-rs/responses-api-proxy
|
|
38
|
+
*/
|
|
39
|
+
const ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
40
|
+
function nowIso(now) {
|
|
41
|
+
return new Date(now()).toISOString();
|
|
42
|
+
}
|
|
43
|
+
function encodeBasic(username, password) {
|
|
44
|
+
// Base64 of "username:password" — Buffer is universal in Node.
|
|
45
|
+
return Buffer.from(`${username}:${password}`, "utf8").toString("base64");
|
|
46
|
+
}
|
|
47
|
+
export function createCredentialBroker(opts = {}) {
|
|
48
|
+
const now = opts.now ?? Date.now;
|
|
49
|
+
const bag = new Map();
|
|
50
|
+
let fetchImpl = (url, init) => fetch(url, init);
|
|
51
|
+
function validateId(id) {
|
|
52
|
+
if (typeof id !== "string" || !ID_PATTERN.test(id)) {
|
|
53
|
+
return { ok: false, error: `id must match ${ID_PATTERN.source}` };
|
|
54
|
+
}
|
|
55
|
+
if (bag.has(id)) {
|
|
56
|
+
return { ok: false, error: `credential id "${id}" already minted` };
|
|
57
|
+
}
|
|
58
|
+
return { ok: true };
|
|
59
|
+
}
|
|
60
|
+
function authHeader(entry) {
|
|
61
|
+
switch (entry.descriptor.kind) {
|
|
62
|
+
case "bearer":
|
|
63
|
+
return { name: "authorization", value: `Bearer ${entry.secret}` };
|
|
64
|
+
case "api-key":
|
|
65
|
+
return {
|
|
66
|
+
name: entry.descriptor.headerName ?? "x-api-key",
|
|
67
|
+
value: entry.secret,
|
|
68
|
+
};
|
|
69
|
+
case "basic": {
|
|
70
|
+
if (!entry.basicEncoded)
|
|
71
|
+
return null;
|
|
72
|
+
return { name: "authorization", value: `Basic ${entry.basicEncoded}` };
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
mintBearer({ id, token }) {
|
|
80
|
+
const v = validateId(id);
|
|
81
|
+
if (!v.ok)
|
|
82
|
+
return { ok: false, error: v.error ?? "invalid id" };
|
|
83
|
+
if (typeof token !== "string" || token.length === 0) {
|
|
84
|
+
return { ok: false, error: "token must be non-empty" };
|
|
85
|
+
}
|
|
86
|
+
const descriptor = Object.freeze({ id, kind: "bearer" });
|
|
87
|
+
const entry = {
|
|
88
|
+
descriptor,
|
|
89
|
+
secret: token,
|
|
90
|
+
count: 0,
|
|
91
|
+
lastUsedAt: null,
|
|
92
|
+
mintedAt: nowIso(now),
|
|
93
|
+
};
|
|
94
|
+
bag.set(id, entry);
|
|
95
|
+
return { ok: true, descriptor };
|
|
96
|
+
},
|
|
97
|
+
mintApiKey({ id, key, headerName }) {
|
|
98
|
+
const v = validateId(id);
|
|
99
|
+
if (!v.ok)
|
|
100
|
+
return { ok: false, error: v.error ?? "invalid id" };
|
|
101
|
+
if (typeof key !== "string" || key.length === 0) {
|
|
102
|
+
return { ok: false, error: "key must be non-empty" };
|
|
103
|
+
}
|
|
104
|
+
const descriptor = Object.freeze({
|
|
105
|
+
id,
|
|
106
|
+
kind: "api-key",
|
|
107
|
+
...(headerName ? { headerName } : {}),
|
|
108
|
+
});
|
|
109
|
+
const entry = {
|
|
110
|
+
descriptor,
|
|
111
|
+
secret: key,
|
|
112
|
+
count: 0,
|
|
113
|
+
lastUsedAt: null,
|
|
114
|
+
mintedAt: nowIso(now),
|
|
115
|
+
};
|
|
116
|
+
bag.set(id, entry);
|
|
117
|
+
return { ok: true, descriptor };
|
|
118
|
+
},
|
|
119
|
+
mintBasic({ id, username, password }) {
|
|
120
|
+
const v = validateId(id);
|
|
121
|
+
if (!v.ok)
|
|
122
|
+
return { ok: false, error: v.error ?? "invalid id" };
|
|
123
|
+
if (typeof username !== "string" || username.length === 0) {
|
|
124
|
+
return { ok: false, error: "username must be non-empty" };
|
|
125
|
+
}
|
|
126
|
+
if (typeof password !== "string" || password.length === 0) {
|
|
127
|
+
return { ok: false, error: "password must be non-empty" };
|
|
128
|
+
}
|
|
129
|
+
const descriptor = Object.freeze({
|
|
130
|
+
id,
|
|
131
|
+
kind: "basic",
|
|
132
|
+
username,
|
|
133
|
+
});
|
|
134
|
+
const entry = {
|
|
135
|
+
descriptor,
|
|
136
|
+
secret: password,
|
|
137
|
+
basicEncoded: encodeBasic(username, password),
|
|
138
|
+
count: 0,
|
|
139
|
+
lastUsedAt: null,
|
|
140
|
+
mintedAt: nowIso(now),
|
|
141
|
+
};
|
|
142
|
+
bag.set(id, entry);
|
|
143
|
+
return { ok: true, descriptor };
|
|
144
|
+
},
|
|
145
|
+
list() {
|
|
146
|
+
return Object.freeze([...bag.values()].map((e) => e.descriptor));
|
|
147
|
+
},
|
|
148
|
+
has(id) {
|
|
149
|
+
return bag.has(id);
|
|
150
|
+
},
|
|
151
|
+
revoke(id) {
|
|
152
|
+
return bag.delete(id);
|
|
153
|
+
},
|
|
154
|
+
audit() {
|
|
155
|
+
return Object.freeze([...bag.values()].map((e) => Object.freeze({
|
|
156
|
+
credentialId: e.descriptor.id,
|
|
157
|
+
requestCount: e.count,
|
|
158
|
+
lastUsedAt: e.lastUsedAt,
|
|
159
|
+
mintedAt: e.mintedAt,
|
|
160
|
+
})));
|
|
161
|
+
},
|
|
162
|
+
async request(req) {
|
|
163
|
+
const entry = bag.get(req.credentialId);
|
|
164
|
+
if (!entry) {
|
|
165
|
+
return Object.freeze({
|
|
166
|
+
ok: false,
|
|
167
|
+
error: `unknown credential id: ${req.credentialId}`,
|
|
168
|
+
code: "unknown-credential",
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
const auth = authHeader(entry);
|
|
172
|
+
const headers = {
|
|
173
|
+
...(req.headers ?? {}),
|
|
174
|
+
};
|
|
175
|
+
if (auth)
|
|
176
|
+
headers[auth.name] = auth.value;
|
|
177
|
+
const init = {
|
|
178
|
+
method: req.method ?? "GET",
|
|
179
|
+
headers,
|
|
180
|
+
...(req.body !== undefined ? { body: req.body } : {}),
|
|
181
|
+
};
|
|
182
|
+
let timer;
|
|
183
|
+
try {
|
|
184
|
+
let response;
|
|
185
|
+
if (req.timeoutMs && req.timeoutMs > 0) {
|
|
186
|
+
response = await Promise.race([
|
|
187
|
+
fetchImpl(req.url, init),
|
|
188
|
+
new Promise((_, reject) => {
|
|
189
|
+
timer = setTimeout(() => reject(new Error("timeout")), req.timeoutMs);
|
|
190
|
+
}),
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
response = await fetchImpl(req.url, init);
|
|
195
|
+
}
|
|
196
|
+
entry.count += 1;
|
|
197
|
+
entry.lastUsedAt = nowIso(now);
|
|
198
|
+
const bodyText = await response.text();
|
|
199
|
+
const respHeaders = {};
|
|
200
|
+
response.headers.forEach((v, k) => {
|
|
201
|
+
respHeaders[k.toLowerCase()] = v;
|
|
202
|
+
});
|
|
203
|
+
if (!response.ok) {
|
|
204
|
+
return Object.freeze({
|
|
205
|
+
ok: false,
|
|
206
|
+
error: `HTTP ${response.status}`,
|
|
207
|
+
code: "http-error",
|
|
208
|
+
status: response.status,
|
|
209
|
+
body: bodyText,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
return Object.freeze({
|
|
213
|
+
ok: true,
|
|
214
|
+
status: response.status,
|
|
215
|
+
headers: Object.freeze(respHeaders),
|
|
216
|
+
body: bodyText,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
221
|
+
if (msg === "timeout") {
|
|
222
|
+
return Object.freeze({
|
|
223
|
+
ok: false,
|
|
224
|
+
error: `request timeout after ${req.timeoutMs}ms`,
|
|
225
|
+
code: "timeout",
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return Object.freeze({
|
|
229
|
+
ok: false,
|
|
230
|
+
error: `transport: ${msg}`,
|
|
231
|
+
code: "transport",
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
finally {
|
|
235
|
+
if (timer)
|
|
236
|
+
clearTimeout(timer);
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
setFetchForTests(fn) {
|
|
240
|
+
fetchImpl = fn;
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
// ── Helpers ──────────────────────────────────────────────────────────
|
|
245
|
+
/**
|
|
246
|
+
* Boot-time helper: read a credential from process.env and immediately
|
|
247
|
+
* mint it into the broker, then OPTIONALLY zero the env var so a later
|
|
248
|
+
* compromise of the parent process can't read it. Default is to leave
|
|
249
|
+
* the env var alone (caller decides — some tools re-read env at runtime
|
|
250
|
+
* for hot-rotation scenarios).
|
|
251
|
+
*
|
|
252
|
+
* Returns the descriptor on success, or {ok:false, error} on missing
|
|
253
|
+
* env var or empty value.
|
|
254
|
+
*/
|
|
255
|
+
export function mintFromEnv(args) {
|
|
256
|
+
const value = process.env[args.envVar];
|
|
257
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
258
|
+
return { ok: false, error: `env var ${args.envVar} is missing or empty` };
|
|
259
|
+
}
|
|
260
|
+
let result;
|
|
261
|
+
if (args.kind === "bearer") {
|
|
262
|
+
result = args.broker.mintBearer({ id: args.id, token: value });
|
|
263
|
+
}
|
|
264
|
+
else if (args.kind === "api-key") {
|
|
265
|
+
const apiKeyArgs = {
|
|
266
|
+
id: args.id,
|
|
267
|
+
key: value,
|
|
268
|
+
};
|
|
269
|
+
if (args.headerName)
|
|
270
|
+
apiKeyArgs.headerName = args.headerName;
|
|
271
|
+
result = args.broker.mintApiKey(apiKeyArgs);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
return {
|
|
275
|
+
ok: false,
|
|
276
|
+
error: `mintFromEnv does not support kind: ${args.kind} (use mintBasic directly)`,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
if (result.ok && args.clearEnv) {
|
|
280
|
+
delete process.env[args.envVar];
|
|
281
|
+
}
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=credential-broker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-broker.js","s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M,sBAAsB,EAAE,CAAC;IAC5E,CAAC;IACD,IAAI,MAAkB,CAAC;IACvB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;SAAM,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,UAAU,GAAqD;YACnE,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,GAAG,EAAE,KAAK;SACX,CAAC;QACF,IAAI,IAAI,CAAC,UAAU;YAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7D,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,sCAAsC,IAAI,CAAC,IAAI,2BAA2B;SAClF,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAQ,OAAO,CAAC,GAA0C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* invisible-text-sanitizer — Strip / detect / report invisible-Unicode
|
|
3
|
+
* attacks before they reach any LLM.
|
|
4
|
+
*
|
|
5
|
+
* Complements src/security/prompt-injection-quarantine.ts (CaMeL XML
|
|
6
|
+
* wrapping + classifier) and src/security/hidden-text-detector.ts
|
|
7
|
+
* (existing detector). This module is the LOW-LEVEL TEXT-SHAPE filter
|
|
8
|
+
* that runs BEFORE the higher-level quarantine.
|
|
9
|
+
*
|
|
10
|
+
* Attack surface covered:
|
|
11
|
+
* 1. Unicode tag characters (U+E0000..U+E007F) — used to smuggle
|
|
12
|
+
* ASCII payloads invisibly to humans but readable to LLMs. Made
|
|
13
|
+
* famous by Riley Goodside's 2024 demonstrations.
|
|
14
|
+
* 2. Zero-width chars (U+200B..U+200D, U+FEFF) — split tokens to
|
|
15
|
+
* defeat keyword filters or hide instructions.
|
|
16
|
+
* 3. Bidirectional override (U+202A..U+202E, U+2066..U+2069) — RTL
|
|
17
|
+
* rendering tricks, "Trojan Source" attacks (Boucher & Anderson 2021).
|
|
18
|
+
* 4. Soft hyphen (U+00AD) — invisible word-break that defeats grep.
|
|
19
|
+
* 5. Variation selectors (U+FE00..U+FE0F, U+E0100..U+E01EF) — modify
|
|
20
|
+
* adjacent glyph rendering; can hide instructions.
|
|
21
|
+
* 6. Mongolian Vowel Separator (U+180E), Hangul Filler (U+115F,
|
|
22
|
+
* U+1160, U+3164, U+FFA0), Khmer Vowel Inherent Aq (U+17B4..U+17B5)
|
|
23
|
+
* — invisible/zero-width by spec.
|
|
24
|
+
* 7. Unicode line/paragraph separators (U+2028, U+2029) — newline
|
|
25
|
+
* smuggling that can break log parsers.
|
|
26
|
+
*
|
|
27
|
+
* Strategies:
|
|
28
|
+
* - sanitize(text) — return text with attack chars removed
|
|
29
|
+
* - inspect(text) — return structured report of found attacks
|
|
30
|
+
* - decodeTagSmuggling(s) — extract the hidden ASCII string from
|
|
31
|
+
* tag-character sequences (for forensic UI)
|
|
32
|
+
*
|
|
33
|
+
* The sanitizer is PURE: same input → same output. No side effects.
|
|
34
|
+
*
|
|
35
|
+
* Quality bars:
|
|
36
|
+
* - QB#1 immutable: input/output strings; report is readonly + frozen
|
|
37
|
+
* - QB#3 honest: returns structured reports; never throws
|
|
38
|
+
* - QB#7 stateless: pure functions throughout
|
|
39
|
+
* - QB#11 sibling-site: composes with prompt-injection-quarantine.ts
|
|
40
|
+
* (this is the pre-filter; that is the policy gate)
|
|
41
|
+
*
|
|
42
|
+
* Sources:
|
|
43
|
+
* - https://embracethered.com/blog/posts/2024/hiding-and-finding-text-with-unicode-tags/
|
|
44
|
+
* ("Hiding and finding text with Unicode Tags" — Wunderwuzzi)
|
|
45
|
+
* - https://trojansource.codes/ ("Trojan Source: Invisible Vulnerabilities")
|
|
46
|
+
* - https://www.unicode.org/reports/tr36/ (Unicode Security Considerations)
|
|
47
|
+
*/
|
|
48
|
+
export type AttackKind = "tag-character" | "zero-width" | "bidi-override" | "soft-hyphen" | "variation-selector" | "invisible-spec" | "line-paragraph-separator";
|
|
49
|
+
export interface AttackFinding {
|
|
50
|
+
readonly kind: AttackKind;
|
|
51
|
+
/** Codepoints (decimal) found, in order of first appearance. */
|
|
52
|
+
readonly codepoints: readonly number[];
|
|
53
|
+
/** Total occurrence count. */
|
|
54
|
+
readonly count: number;
|
|
55
|
+
/** First byte offset where this kind appears. */
|
|
56
|
+
readonly firstOffset: number;
|
|
57
|
+
}
|
|
58
|
+
export interface InspectionReport {
|
|
59
|
+
readonly hasAttack: boolean;
|
|
60
|
+
readonly findings: readonly AttackFinding[];
|
|
61
|
+
/** Total invisible chars stripped (sum across all findings). */
|
|
62
|
+
readonly totalCount: number;
|
|
63
|
+
/** Decoded ASCII payload if tag-character smuggling was found,
|
|
64
|
+
* else empty. Useful for forensic UI. */
|
|
65
|
+
readonly smuggledPayload: string;
|
|
66
|
+
}
|
|
67
|
+
export interface SanitizeOptions {
|
|
68
|
+
/**
|
|
69
|
+
* When true, replace each removed char with "�" (replacement
|
|
70
|
+
* char) rather than dropping silently. Useful when you want to show
|
|
71
|
+
* the user that something was redacted. Default false (drop).
|
|
72
|
+
*/
|
|
73
|
+
readonly markRedactions?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* When set, narrows the strip set to only these attack kinds. Default
|
|
76
|
+
* is all kinds.
|
|
77
|
+
*/
|
|
78
|
+
readonly only?: readonly AttackKind[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Inspect text without mutating it. Returns a structured report of
|
|
82
|
+
* every invisible-attack character class found. Always safe to call
|
|
83
|
+
* on user input — never throws.
|
|
84
|
+
*/
|
|
85
|
+
export declare function inspect(text: string): InspectionReport;
|
|
86
|
+
/**
|
|
87
|
+
* Extract the decoded ASCII payload from any tag-character smuggling
|
|
88
|
+
* present in `text`. Returns the empty string if no tag chars are
|
|
89
|
+
* present. Useful for showing the user EXACTLY what an attacker tried
|
|
90
|
+
* to slip past them.
|
|
91
|
+
*/
|
|
92
|
+
export declare function decodeTagSmuggling(text: string): string;
|
|
93
|
+
/**
|
|
94
|
+
* Return a NEW string with all invisible-attack characters removed.
|
|
95
|
+
* Pure: input is never mutated.
|
|
96
|
+
*/
|
|
97
|
+
export declare function sanitize(text: string, options?: SanitizeOptions): string;
|
|
98
|
+
/**
|
|
99
|
+
* Combined inspect + sanitize: returns BOTH the cleaned text AND the
|
|
100
|
+
* report of what was found. Saves callers from running the loop twice.
|
|
101
|
+
*/
|
|
102
|
+
export declare function sanitizeAndReport(text: string, options?: SanitizeOptions): {
|
|
103
|
+
readonly cleaned: string;
|
|
104
|
+
readonly report: InspectionReport;
|
|
105
|
+
};
|
|
106
|
+
export declare function hasInvisibleAttack(text: string): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Predicate: does the text contain ONLY tag-character smuggling
|
|
109
|
+
* (no other attack kinds)? Useful for distinguishing sneaky payloads
|
|
110
|
+
* from generic invisible noise (e.g. zero-width formatters used by
|
|
111
|
+
* some templating systems).
|
|
112
|
+
*/
|
|
113
|
+
export declare function isTagSmugglingOnly(text: string): boolean;
|
|
114
|
+
//# sourceMappingURL=invisible-text-sanitizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invisible-text-sanitizer.d.ts","sourceRoot":"","sources":["../../src/security/invisible-text-sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,MAAM,MAAM,UAAU,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E,CAKjE;AAID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIxD"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* invisible-text-sanitizer — Strip / detect / report invisible-Unicode
|
|
3
|
+
* attacks before they reach any LLM.
|
|
4
|
+
*
|
|
5
|
+
* Complements src/security/prompt-injection-quarantine.ts (CaMeL XML
|
|
6
|
+
* wrapping + classifier) and src/security/hidden-text-detector.ts
|
|
7
|
+
* (existing detector). This module is the LOW-LEVEL TEXT-SHAPE filter
|
|
8
|
+
* that runs BEFORE the higher-level quarantine.
|
|
9
|
+
*
|
|
10
|
+
* Attack surface covered:
|
|
11
|
+
* 1. Unicode tag characters (U+E0000..U+E007F) — used to smuggle
|
|
12
|
+
* ASCII payloads invisibly to humans but readable to LLMs. Made
|
|
13
|
+
* famous by Riley Goodside's 2024 demonstrations.
|
|
14
|
+
* 2. Zero-width chars (U+200B..U+200D, U+FEFF) — split tokens to
|
|
15
|
+
* defeat keyword filters or hide instructions.
|
|
16
|
+
* 3. Bidirectional override (U+202A..U+202E, U+2066..U+2069) — RTL
|
|
17
|
+
* rendering tricks, "Trojan Source" attacks (Boucher & Anderson 2021).
|
|
18
|
+
* 4. Soft hyphen (U+00AD) — invisible word-break that defeats grep.
|
|
19
|
+
* 5. Variation selectors (U+FE00..U+FE0F, U+E0100..U+E01EF) — modify
|
|
20
|
+
* adjacent glyph rendering; can hide instructions.
|
|
21
|
+
* 6. Mongolian Vowel Separator (U+180E), Hangul Filler (U+115F,
|
|
22
|
+
* U+1160, U+3164, U+FFA0), Khmer Vowel Inherent Aq (U+17B4..U+17B5)
|
|
23
|
+
* — invisible/zero-width by spec.
|
|
24
|
+
* 7. Unicode line/paragraph separators (U+2028, U+2029) — newline
|
|
25
|
+
* smuggling that can break log parsers.
|
|
26
|
+
*
|
|
27
|
+
* Strategies:
|
|
28
|
+
* - sanitize(text) — return text with attack chars removed
|
|
29
|
+
* - inspect(text) — return structured report of found attacks
|
|
30
|
+
* - decodeTagSmuggling(s) — extract the hidden ASCII string from
|
|
31
|
+
* tag-character sequences (for forensic UI)
|
|
32
|
+
*
|
|
33
|
+
* The sanitizer is PURE: same input → same output. No side effects.
|
|
34
|
+
*
|
|
35
|
+
* Quality bars:
|
|
36
|
+
* - QB#1 immutable: input/output strings; report is readonly + frozen
|
|
37
|
+
* - QB#3 honest: returns structured reports; never throws
|
|
38
|
+
* - QB#7 stateless: pure functions throughout
|
|
39
|
+
* - QB#11 sibling-site: composes with prompt-injection-quarantine.ts
|
|
40
|
+
* (this is the pre-filter; that is the policy gate)
|
|
41
|
+
*
|
|
42
|
+
* Sources:
|
|
43
|
+
* - https://embracethered.com/blog/posts/2024/hiding-and-finding-text-with-unicode-tags/
|
|
44
|
+
* ("Hiding and finding text with Unicode Tags" — Wunderwuzzi)
|
|
45
|
+
* - https://trojansource.codes/ ("Trojan Source: Invisible Vulnerabilities")
|
|
46
|
+
* - https://www.unicode.org/reports/tr36/ (Unicode Security Considerations)
|
|
47
|
+
*/
|
|
48
|
+
// ── Codepoint classifiers ────────────────────────────────────────────
|
|
49
|
+
function classify(cp) {
|
|
50
|
+
// Unicode tag characters (deprecated but renderable)
|
|
51
|
+
if (cp >= 0xe0000 && cp <= 0xe007f)
|
|
52
|
+
return "tag-character";
|
|
53
|
+
// Zero-width chars
|
|
54
|
+
if (cp === 0x200b || cp === 0x200c || cp === 0x200d || cp === 0xfeff)
|
|
55
|
+
return "zero-width";
|
|
56
|
+
// Bidi override
|
|
57
|
+
if (cp >= 0x202a && cp <= 0x202e)
|
|
58
|
+
return "bidi-override";
|
|
59
|
+
if (cp >= 0x2066 && cp <= 0x2069)
|
|
60
|
+
return "bidi-override";
|
|
61
|
+
// Soft hyphen
|
|
62
|
+
if (cp === 0x00ad)
|
|
63
|
+
return "soft-hyphen";
|
|
64
|
+
// Variation selectors
|
|
65
|
+
if (cp >= 0xfe00 && cp <= 0xfe0f)
|
|
66
|
+
return "variation-selector";
|
|
67
|
+
if (cp >= 0xe0100 && cp <= 0xe01ef)
|
|
68
|
+
return "variation-selector";
|
|
69
|
+
// Invisible-by-spec characters
|
|
70
|
+
if (cp === 0x180e)
|
|
71
|
+
return "invisible-spec"; // Mongolian Vowel Separator
|
|
72
|
+
if (cp === 0x115f || cp === 0x1160)
|
|
73
|
+
return "invisible-spec"; // Hangul fillers
|
|
74
|
+
if (cp === 0x3164)
|
|
75
|
+
return "invisible-spec"; // Hangul Filler
|
|
76
|
+
if (cp === 0xffa0)
|
|
77
|
+
return "invisible-spec"; // Halfwidth Hangul Filler
|
|
78
|
+
if (cp === 0x17b4 || cp === 0x17b5)
|
|
79
|
+
return "invisible-spec"; // Khmer Vowel Inherent Aq
|
|
80
|
+
// Line/paragraph separators
|
|
81
|
+
if (cp === 0x2028 || cp === 0x2029)
|
|
82
|
+
return "line-paragraph-separator";
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Inspect text without mutating it. Returns a structured report of
|
|
87
|
+
* every invisible-attack character class found. Always safe to call
|
|
88
|
+
* on user input — never throws.
|
|
89
|
+
*/
|
|
90
|
+
export function inspect(text) {
|
|
91
|
+
if (typeof text !== "string" || text.length === 0) {
|
|
92
|
+
return Object.freeze({
|
|
93
|
+
hasAttack: false,
|
|
94
|
+
findings: Object.freeze([]),
|
|
95
|
+
totalCount: 0,
|
|
96
|
+
smuggledPayload: "",
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const acc = new Map();
|
|
100
|
+
let totalCount = 0;
|
|
101
|
+
const tagChars = [];
|
|
102
|
+
let offset = 0;
|
|
103
|
+
for (const ch of text) {
|
|
104
|
+
const cp = ch.codePointAt(0);
|
|
105
|
+
if (cp === undefined) {
|
|
106
|
+
offset += ch.length;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const kind = classify(cp);
|
|
110
|
+
if (kind !== null) {
|
|
111
|
+
totalCount += 1;
|
|
112
|
+
let entry = acc.get(kind);
|
|
113
|
+
if (!entry) {
|
|
114
|
+
entry = { codepoints: new Set(), count: 0, firstOffset: offset };
|
|
115
|
+
acc.set(kind, entry);
|
|
116
|
+
}
|
|
117
|
+
entry.codepoints.add(cp);
|
|
118
|
+
entry.count += 1;
|
|
119
|
+
if (kind === "tag-character") {
|
|
120
|
+
tagChars.push(cp);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
offset += ch.length;
|
|
124
|
+
}
|
|
125
|
+
const findings = [];
|
|
126
|
+
for (const [kind, entry] of acc) {
|
|
127
|
+
findings.push(Object.freeze({
|
|
128
|
+
kind,
|
|
129
|
+
codepoints: Object.freeze([...entry.codepoints]),
|
|
130
|
+
count: entry.count,
|
|
131
|
+
firstOffset: entry.firstOffset,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
// Sort findings deterministically by first offset.
|
|
135
|
+
findings.sort((a, b) => a.firstOffset - b.firstOffset);
|
|
136
|
+
// Decode tag-character smuggling: tag chars in U+E0000..U+E007F
|
|
137
|
+
// map to ASCII via subtraction. So U+E0041 = 'A', U+E0061 = 'a',
|
|
138
|
+
// etc. The U+E0001 LANGUAGE TAG and U+E007F CANCEL TAG are framing.
|
|
139
|
+
let smuggledPayload = "";
|
|
140
|
+
for (const cp of tagChars) {
|
|
141
|
+
if (cp === 0xe0001 || cp === 0xe007f)
|
|
142
|
+
continue;
|
|
143
|
+
const ascii = cp - 0xe0000;
|
|
144
|
+
if (ascii >= 0x20 && ascii <= 0x7e) {
|
|
145
|
+
smuggledPayload += String.fromCharCode(ascii);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return Object.freeze({
|
|
149
|
+
hasAttack: findings.length > 0,
|
|
150
|
+
findings: Object.freeze(findings),
|
|
151
|
+
totalCount,
|
|
152
|
+
smuggledPayload,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
// ── Decode helper (forensic) ─────────────────────────────────────────
|
|
156
|
+
/**
|
|
157
|
+
* Extract the decoded ASCII payload from any tag-character smuggling
|
|
158
|
+
* present in `text`. Returns the empty string if no tag chars are
|
|
159
|
+
* present. Useful for showing the user EXACTLY what an attacker tried
|
|
160
|
+
* to slip past them.
|
|
161
|
+
*/
|
|
162
|
+
export function decodeTagSmuggling(text) {
|
|
163
|
+
return inspect(text).smuggledPayload;
|
|
164
|
+
}
|
|
165
|
+
// ── Sanitize ─────────────────────────────────────────────────────────
|
|
166
|
+
/**
|
|
167
|
+
* Return a NEW string with all invisible-attack characters removed.
|
|
168
|
+
* Pure: input is never mutated.
|
|
169
|
+
*/
|
|
170
|
+
export function sanitize(text, options = {}) {
|
|
171
|
+
if (typeof text !== "string" || text.length === 0)
|
|
172
|
+
return text;
|
|
173
|
+
const onlySet = options.only ? new Set(options.only) : null;
|
|
174
|
+
const replacement = options.markRedactions ? "�" : "";
|
|
175
|
+
let out = "";
|
|
176
|
+
for (const ch of text) {
|
|
177
|
+
const cp = ch.codePointAt(0);
|
|
178
|
+
if (cp === undefined) {
|
|
179
|
+
out += ch;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const kind = classify(cp);
|
|
183
|
+
if (kind === null) {
|
|
184
|
+
out += ch;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (onlySet && !onlySet.has(kind)) {
|
|
188
|
+
out += ch;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
out += replacement;
|
|
192
|
+
}
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Combined inspect + sanitize: returns BOTH the cleaned text AND the
|
|
197
|
+
* report of what was found. Saves callers from running the loop twice.
|
|
198
|
+
*/
|
|
199
|
+
export function sanitizeAndReport(text, options = {}) {
|
|
200
|
+
return {
|
|
201
|
+
cleaned: sanitize(text, options),
|
|
202
|
+
report: inspect(text),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
// ── Convenience predicates ───────────────────────────────────────────
|
|
206
|
+
export function hasInvisibleAttack(text) {
|
|
207
|
+
return inspect(text).hasAttack;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Predicate: does the text contain ONLY tag-character smuggling
|
|
211
|
+
* (no other attack kinds)? Useful for distinguishing sneaky payloads
|
|
212
|
+
* from generic invisible noise (e.g. zero-width formatters used by
|
|
213
|
+
* some templating systems).
|
|
214
|
+
*/
|
|
215
|
+
export function isTagSmugglingOnly(text) {
|
|
216
|
+
const r = inspect(text);
|
|
217
|
+
if (!r.hasAttack)
|
|
218
|
+
return false;
|
|
219
|
+
return r.findings.length === 1 && r.findings[0]?.kind === "tag-character";
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=invisible-text-sanitizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invisible-text-sanitizer.js","sourceRoot":"","sources":["../../src/security/invisible-text-sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AA+CH,wEAAwE;AAExE,SAAS,QAAQ,CAAC,EAAU;IAC1B,qDAAqD;IACrD,IAAI,EAAE,IAAI,OAAO,IAAI,EAAE,IAAI,OAAO;QAAE,OAAO,eAAe,CAAC;IAC3D,mBAAmB;IACnB,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,MAAM;QAAE,OAAO,YAAY,CAAC;IAC1F,gBAAgB;IAChB,IAAI,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,MAAM;QAAE,OAAO,eAAe,CAAC;IACzD,IAAI,EAAE,IAAI,MAAM,IAAI,EAAE,IAAI,MAAM;QAAE,OAAO,eAAe,CAAC;IACzD,cAAc;IACd,IAAI,EAAE,KAAK,MAAM;QAAE,OAAO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