@draht/coding-agent 2026.7.30 → 2026.10.4-2
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 +606 -0
- package/README.md +46 -2
- package/agents/debugger.md +12 -1
- package/agents/git-committer.md +1 -0
- package/agents/implementer.md +20 -0
- package/agents/investigator.md +75 -0
- package/agents/reviewer.md +7 -0
- package/agents/spec-reviewer.md +66 -0
- package/agents/verifier.md +4 -3
- package/bin/draht-tools.cjs +472 -41
- package/dist/agents/debugger.md +12 -1
- package/dist/agents/git-committer.md +1 -0
- package/dist/agents/implementer.md +20 -0
- package/dist/agents/investigator.md +75 -0
- package/dist/agents/reviewer.md +7 -0
- package/dist/agents/spec-reviewer.md +66 -0
- package/dist/agents/verifier.md +4 -3
- package/dist/bun/cli.d.ts +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +6 -3
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/sandbox-env-setup.d.ts +2 -0
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
- package/dist/bun/sandbox-env-setup.js +4 -0
- package/dist/bun/sandbox-env-setup.js.map +1 -0
- package/dist/bundle/chunks/anthropic-messages-GAKYXF65.js +6 -0
- package/dist/bundle/chunks/anthropic.js +75 -0
- package/dist/bundle/chunks/azure-openai-responses-ZIXMK6JO.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +79 -0
- package/dist/bundle/chunks/chunk-2E5VODES.js +2 -0
- package/dist/bundle/chunks/chunk-2FBJKY7F.js +2 -0
- package/dist/bundle/chunks/chunk-2N4I6WXC.js +2 -0
- package/dist/bundle/chunks/chunk-5VZWYVZB.js +82 -0
- package/dist/bundle/chunks/chunk-63BK6WK2.js +2 -0
- package/dist/bundle/chunks/chunk-6MSE6LZ3.js +6 -0
- package/dist/bundle/chunks/chunk-6ZJKIMU7.js +2 -0
- package/dist/bundle/chunks/chunk-736QBNUZ.js +12 -0
- package/dist/bundle/chunks/chunk-BXSHCX3G.js +11 -0
- package/dist/bundle/chunks/chunk-CEJJ5XF2.js +170 -0
- package/dist/bundle/chunks/chunk-COF5JT7R.js +4 -0
- package/dist/bundle/chunks/chunk-D6TMD5Q2.js +44 -0
- package/dist/bundle/chunks/chunk-DPE4ALPU.js +146 -0
- package/dist/bundle/chunks/chunk-EBVYI75P.js +2 -0
- package/dist/bundle/chunks/chunk-GVXA72ZA.js +2 -0
- package/dist/bundle/chunks/chunk-H6FT43VC.js +137 -0
- package/dist/bundle/chunks/chunk-HJ72RANT.js +2 -0
- package/dist/bundle/chunks/chunk-HTJ3L72O.js +2 -0
- package/dist/bundle/chunks/chunk-HZ2UHMBT.js +2 -0
- package/dist/bundle/chunks/chunk-I5OKY6RH.js +11 -0
- package/dist/bundle/chunks/chunk-IWTUBX6V.js +4 -0
- package/dist/bundle/chunks/chunk-KPO5375S.js +2 -0
- package/dist/bundle/chunks/chunk-KVH4HR57.js +31 -0
- package/dist/bundle/chunks/chunk-LDAOC5RB.js +18 -0
- package/dist/bundle/chunks/chunk-ON6XU6AG.js +2 -0
- package/dist/bundle/chunks/chunk-QMN7OD6G.js +2 -0
- package/dist/bundle/chunks/chunk-RZKPFWMH.js +42 -0
- package/dist/bundle/chunks/chunk-SDRCE6OP.js +2 -0
- package/dist/bundle/chunks/chunk-SVNWI7EV.js +8 -0
- package/dist/bundle/chunks/chunk-TIA2T6EO.js +3 -0
- package/dist/bundle/chunks/chunk-VOFPZOUQ.js +1472 -0
- package/dist/bundle/chunks/chunk-XBUEMKIY.js +2 -0
- package/dist/bundle/chunks/chunk-XOGEYN4Q.js +2 -0
- package/dist/bundle/chunks/chunk-ZZD35WKM.js +2 -0
- package/dist/bundle/chunks/cli-SR5QBZH4.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +315 -0
- package/dist/bundle/chunks/execute-VCYDHEYA.js +328 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-antigravity.js +75 -0
- package/dist/bundle/chunks/google-gemini-cli.js +75 -0
- package/dist/bundle/chunks/google-generative-ai-RPUPQ6PM.js +2 -0
- package/dist/bundle/chunks/google-vertex-EZES5QVQ.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-O2PVUIOI.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-RKXLMQV2.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-XOG5PI3Y.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-EJ5XMSQL.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-AOYGU43Y.js +5 -0
- package/dist/bundle/chunks/multipart-parser-AZP5BX2W.js +3 -0
- package/dist/bundle/chunks/node-C2JGH2OB.js +2 -0
- package/dist/bundle/chunks/node-LQ52KV6B.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-M2Y77JEQ.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +75 -0
- package/dist/bundle/chunks/openai-completions-A4OKYOYV.js +7 -0
- package/dist/bundle/chunks/openai-responses-6IXV53T3.js +3 -0
- package/dist/bundle/chunks/opencode-go.js +2 -0
- package/dist/bundle/chunks/openrouter-images-LYV4NKFM.js +2 -0
- package/dist/bundle/chunks/openrouter.js +75 -0
- package/dist/bundle/chunks/pi-messages-KKMEUT3Z.js +8 -0
- package/dist/bundle/chunks/radius.js +75 -0
- package/dist/bundle/chunks/runtime-6YJPGSP7.js +2 -0
- package/dist/bundle/chunks/settings-manager-D2EG7WDO.js +2 -0
- package/dist/bundle/chunks/src-TIBHS42X.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +2 -0
- package/dist/bundle/chunks/virtual-modules-CBOAFAFT.js +2 -0
- package/dist/bundle/chunks/xai.js +75 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/cli/args.d.ts +14 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +140 -22
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/attach-mode.d.ts +61 -0
- package/dist/cli/attach-mode.d.ts.map +1 -1
- package/dist/cli/attach-mode.js +243 -5
- package/dist/cli/attach-mode.js.map +1 -1
- package/dist/cli/auth-check.d.ts +19 -0
- package/dist/cli/auth-check.d.ts.map +1 -0
- package/dist/cli/auth-check.js +50 -0
- package/dist/cli/auth-check.js.map +1 -0
- package/dist/cli/auth-command.d.ts +24 -0
- package/dist/cli/auth-command.d.ts.map +1 -0
- package/dist/cli/auth-command.js +103 -0
- package/dist/cli/auth-command.js.map +1 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +3 -2
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/credential-print.d.ts +6 -4
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +47 -34
- package/dist/cli/credential-print.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 +2 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/list-models.d.ts +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +2 -2
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +12 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +2 -2
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +42 -33
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli.js +3 -12
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +29 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +73 -10
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +17 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +98 -32
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +15 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +266 -49
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1503 -597
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +25 -9
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +245 -45
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bug-report-upload.d.ts +11 -0
- package/dist/core/bug-report-upload.d.ts.map +1 -0
- package/dist/core/bug-report-upload.js +20 -0
- package/dist/core/bug-report-upload.js.map +1 -0
- package/dist/core/bug-report.d.ts +176 -0
- package/dist/core/bug-report.d.ts.map +1 -0
- package/dist/core/bug-report.js +292 -0
- package/dist/core/bug-report.js.map +1 -0
- package/dist/core/builtins/checkpoints.d.ts +20 -0
- package/dist/core/builtins/checkpoints.d.ts.map +1 -0
- package/dist/core/builtins/checkpoints.js +161 -0
- package/dist/core/builtins/checkpoints.js.map +1 -0
- package/dist/core/builtins/duet.d.ts +26 -0
- package/dist/core/builtins/duet.d.ts.map +1 -0
- package/dist/core/builtins/duet.js +660 -0
- package/dist/core/builtins/duet.js.map +1 -0
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +7 -1
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/builtins/subagent.d.ts +24 -4
- package/dist/core/builtins/subagent.d.ts.map +1 -1
- package/dist/core/builtins/subagent.js +278 -35
- package/dist/core/builtins/subagent.js.map +1 -1
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +12 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +103 -0
- package/dist/core/cache-warmer.d.ts.map +1 -0
- package/dist/core/cache-warmer.js +356 -0
- package/dist/core/cache-warmer.js.map +1 -0
- package/dist/core/checkpoints/checkpoint-cli.d.ts +17 -0
- package/dist/core/checkpoints/checkpoint-cli.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-cli.js +78 -0
- package/dist/core/checkpoints/checkpoint-cli.js.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts +298 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.js +901 -0
- package/dist/core/checkpoints/checkpoint-manager.js.map +1 -0
- package/dist/core/checkpoints/rewind.d.ts +143 -0
- package/dist/core/checkpoints/rewind.d.ts.map +1 -0
- package/dist/core/checkpoints/rewind.js +247 -0
- package/dist/core/checkpoints/rewind.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +11 -6
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +14 -6
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +221 -122
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +2 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +25 -18
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/crash-log.d.ts +27 -0
- package/dist/core/crash-log.d.ts.map +1 -0
- package/dist/core/crash-log.js +140 -0
- package/dist/core/crash-log.js.map +1 -0
- package/dist/core/defaults.d.ts +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js +9 -0
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/experimental.js +1 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/template.css +10 -0
- package/dist/core/export-html/template.js +72 -18
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/jiti-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-loader.js +5 -0
- package/dist/core/extensions/jiti-loader.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +298 -96
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +59 -9
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +410 -103
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +701 -85
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +3 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +37 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +2 -2
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +3 -22
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.js +19 -18
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +7 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +88 -13
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +34 -7
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +119 -0
- package/dist/core/mcp-servers.d.ts.map +1 -0
- package/dist/core/mcp-servers.js +191 -0
- package/dist/core/mcp-servers.js.map +1 -0
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +202 -20
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +53 -18
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +21 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +47 -10
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +7 -5
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +62 -23
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +80 -15
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +466 -120
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts +12 -7
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +87 -18
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/multi-agent/fsm.js +8 -3
- package/dist/core/multi-agent/fsm.js.map +1 -1
- package/dist/core/multi-agent/mailbox.js +1 -3
- package/dist/core/multi-agent/mailbox.js.map +1 -1
- package/dist/core/multi-agent/permission-gate.d.ts +5 -2
- package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
- package/dist/core/multi-agent/permission-gate.js +601 -37
- package/dist/core/multi-agent/permission-gate.js.map +1 -1
- package/dist/core/multi-agent/task-board.js +2 -4
- package/dist/core/multi-agent/task-board.js.map +1 -1
- package/dist/core/multi-agent/worktree.d.ts +2 -0
- package/dist/core/multi-agent/worktree.d.ts.map +1 -1
- package/dist/core/multi-agent/worktree.js +3 -5
- package/dist/core/multi-agent/worktree.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +102 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -0
- package/dist/core/nested-tool-calls.js +178 -0
- package/dist/core/nested-tool-calls.js.map +1 -0
- package/dist/core/package-manager.d.ts +16 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +162 -69
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permission-relay/index.d.ts +19 -0
- package/dist/core/permission-relay/index.d.ts.map +1 -0
- package/dist/core/permission-relay/index.js +49 -0
- package/dist/core/permission-relay/index.js.map +1 -0
- package/dist/core/permission-relay/relay-ui-context.d.ts +39 -0
- package/dist/core/permission-relay/relay-ui-context.d.ts.map +1 -0
- package/dist/core/permission-relay/relay-ui-context.js +788 -0
- package/dist/core/permission-relay/relay-ui-context.js.map +1 -0
- package/dist/core/permission-relay/types.d.ts +222 -0
- package/dist/core/permission-relay/types.d.ts.map +1 -0
- package/dist/core/permission-relay/types.js +15 -0
- package/dist/core/permission-relay/types.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +14 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +36 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +6 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +63 -37
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.js +5 -5
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-composer.d.ts +44 -20
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +151 -51
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +13 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +19 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +10 -3
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +105 -81
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +28 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +319 -65
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +5 -5
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +13 -9
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sandbox/bash-operations.d.ts +149 -0
- package/dist/core/sandbox/bash-operations.d.ts.map +1 -0
- package/dist/core/sandbox/bash-operations.js +163 -0
- package/dist/core/sandbox/bash-operations.js.map +1 -0
- package/dist/core/sandbox/env.d.ts +83 -0
- package/dist/core/sandbox/env.d.ts.map +1 -0
- package/dist/core/sandbox/env.js +123 -0
- package/dist/core/sandbox/env.js.map +1 -0
- package/dist/core/sandbox/executor.d.ts +104 -0
- package/dist/core/sandbox/executor.d.ts.map +1 -0
- package/dist/core/sandbox/executor.js +93 -0
- package/dist/core/sandbox/executor.js.map +1 -0
- package/dist/core/sandbox/index.d.ts +36 -0
- package/dist/core/sandbox/index.d.ts.map +1 -0
- package/dist/core/sandbox/index.js +36 -0
- package/dist/core/sandbox/index.js.map +1 -0
- package/dist/core/sandbox/linux.d.ts +121 -0
- package/dist/core/sandbox/linux.d.ts.map +1 -0
- package/dist/core/sandbox/linux.js +260 -0
- package/dist/core/sandbox/linux.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +142 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +297 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/real-path.d.ts +112 -0
- package/dist/core/sandbox/real-path.d.ts.map +1 -0
- package/dist/core/sandbox/real-path.js +158 -0
- package/dist/core/sandbox/real-path.js.map +1 -0
- package/dist/core/sandbox/seatbelt-profile.d.ts +95 -0
- package/dist/core/sandbox/seatbelt-profile.d.ts.map +1 -0
- package/dist/core/sandbox/seatbelt-profile.js +239 -0
- package/dist/core/sandbox/seatbelt-profile.js.map +1 -0
- package/dist/core/sandbox/seatbelt.d.ts +95 -0
- package/dist/core/sandbox/seatbelt.d.ts.map +1 -0
- package/dist/core/sandbox/seatbelt.js +154 -0
- package/dist/core/sandbox/seatbelt.js.map +1 -0
- package/dist/core/sandbox/self-test.d.ts +109 -0
- package/dist/core/sandbox/self-test.d.ts.map +1 -0
- package/dist/core/sandbox/self-test.js +369 -0
- package/dist/core/sandbox/self-test.js.map +1 -0
- package/dist/core/sandbox/spawn.d.ts +33 -0
- package/dist/core/sandbox/spawn.d.ts.map +1 -0
- package/dist/core/sandbox/spawn.js +87 -0
- package/dist/core/sandbox/spawn.js.map +1 -0
- package/dist/core/sdk.d.ts +7 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +103 -53
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.js +1 -0
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-export.d.ts +8 -0
- package/dist/core/session-export.d.ts.map +1 -0
- package/dist/core/session-export.js +33 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-manager.d.ts +134 -15
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +366 -149
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-diagnostics.d.ts +9 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -0
- package/dist/core/settings-diagnostics.js +21 -0
- package/dist/core/settings-diagnostics.js.map +1 -0
- package/dist/core/settings-manager.d.ts +105 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +274 -40
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +3 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +70 -39
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +4 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/soak/soak-log.d.ts +298 -0
- package/dist/core/soak/soak-log.d.ts.map +1 -0
- package/dist/core/soak/soak-log.js +666 -0
- package/dist/core/soak/soak-log.js.map +1 -0
- package/dist/core/soak/soak-reader.d.ts +60 -0
- package/dist/core/soak/soak-reader.d.ts.map +1 -0
- package/dist/core/soak/soak-reader.js +106 -0
- package/dist/core/soak/soak-reader.js.map +1 -0
- package/dist/core/socket-server/discovery.d.ts +78 -1
- package/dist/core/socket-server/discovery.d.ts.map +1 -1
- package/dist/core/socket-server/discovery.js +356 -37
- package/dist/core/socket-server/discovery.js.map +1 -1
- package/dist/core/socket-server/index.d.ts +10 -4
- package/dist/core/socket-server/index.d.ts.map +1 -1
- package/dist/core/socket-server/index.js +6 -3
- package/dist/core/socket-server/index.js.map +1 -1
- package/dist/core/socket-server/permission-delivery.d.ts +125 -0
- package/dist/core/socket-server/permission-delivery.d.ts.map +1 -0
- package/dist/core/socket-server/permission-delivery.js +152 -0
- package/dist/core/socket-server/permission-delivery.js.map +1 -0
- package/dist/core/socket-server/permission-registry.d.ts +301 -0
- package/dist/core/socket-server/permission-registry.d.ts.map +1 -0
- package/dist/core/socket-server/permission-registry.js +410 -0
- package/dist/core/socket-server/permission-registry.js.map +1 -0
- package/dist/core/socket-server/permission-relay.d.ts +81 -0
- package/dist/core/socket-server/permission-relay.d.ts.map +1 -0
- package/dist/core/socket-server/permission-relay.js +528 -0
- package/dist/core/socket-server/permission-relay.js.map +1 -0
- package/dist/core/socket-server/safe-text.d.ts +83 -0
- package/dist/core/socket-server/safe-text.d.ts.map +1 -0
- package/dist/core/socket-server/safe-text.js +277 -0
- package/dist/core/socket-server/safe-text.js.map +1 -0
- package/dist/core/socket-server/session-integration.d.ts +65 -2
- package/dist/core/socket-server/session-integration.d.ts.map +1 -1
- package/dist/core/socket-server/session-integration.js +434 -32
- package/dist/core/socket-server/session-integration.js.map +1 -1
- package/dist/core/socket-server/socket-client.d.ts +21 -2
- package/dist/core/socket-server/socket-client.d.ts.map +1 -1
- package/dist/core/socket-server/socket-client.js +52 -1
- package/dist/core/socket-server/socket-client.js.map +1 -1
- package/dist/core/socket-server/socket-server.d.ts +152 -1
- package/dist/core/socket-server/socket-server.d.ts.map +1 -1
- package/dist/core/socket-server/socket-server.js +786 -26
- package/dist/core/socket-server/socket-server.js.map +1 -1
- package/dist/core/socket-server/types.d.ts +108 -3
- package/dist/core/socket-server/types.d.ts.map +1 -1
- package/dist/core/socket-server/types.js +13 -1
- package/dist/core/socket-server/types.js.map +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +16 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts +49 -6
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +126 -90
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +32 -2
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +83 -141
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +0 -5
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +2 -5
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +5 -12
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +36 -173
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +7 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +22 -76
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +4 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +10 -62
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +4 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +18 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +4 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +9 -50
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +54 -12
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/powershell.d.ts +16 -0
- package/dist/core/tools/powershell.d.ts.map +1 -0
- package/dist/core/tools/powershell.js +39 -0
- package/dist/core/tools/powershell.js.map +1 -0
- package/dist/core/tools/read.d.ts +8 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +16 -123
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +6 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +26 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts +12 -0
- package/dist/core/tools/renderers/bash.d.ts.map +1 -0
- package/dist/core/tools/renderers/bash.js +117 -0
- package/dist/core/tools/renderers/bash.js.map +1 -0
- package/dist/core/tools/renderers/edit.d.ts +23 -0
- package/dist/core/tools/renderers/edit.d.ts.map +1 -0
- package/dist/core/tools/renderers/edit.js +167 -0
- package/dist/core/tools/renderers/edit.js.map +1 -0
- package/dist/core/tools/renderers/find.d.ts +10 -0
- package/dist/core/tools/renderers/find.d.ts.map +1 -0
- package/dist/core/tools/renderers/find.js +64 -0
- package/dist/core/tools/renderers/find.js.map +1 -0
- package/dist/core/tools/renderers/grep.d.ts +10 -0
- package/dist/core/tools/renderers/grep.d.ts.map +1 -0
- package/dist/core/tools/renderers/grep.js +69 -0
- package/dist/core/tools/renderers/grep.js.map +1 -0
- package/dist/core/tools/renderers/index.d.ts +28 -0
- package/dist/core/tools/renderers/index.d.ts.map +1 -0
- package/dist/core/tools/renderers/index.js +47 -0
- package/dist/core/tools/renderers/index.js.map +1 -0
- package/dist/core/tools/renderers/ls.d.ts +10 -0
- package/dist/core/tools/renderers/ls.d.ts.map +1 -0
- package/dist/core/tools/renderers/ls.js +58 -0
- package/dist/core/tools/renderers/ls.js.map +1 -0
- package/dist/core/tools/renderers/read.d.ts +11 -0
- package/dist/core/tools/renderers/read.d.ts.map +1 -0
- package/dist/core/tools/renderers/read.js +130 -0
- package/dist/core/tools/renderers/read.js.map +1 -0
- package/dist/core/tools/renderers/write.d.ts +10 -0
- package/dist/core/tools/renderers/write.d.ts.map +1 -0
- package/dist/core/tools/renderers/write.js +153 -0
- package/dist/core/tools/renderers/write.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +3 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +14 -0
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +29 -0
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts +4 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +12 -147
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +6 -4
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +59 -22
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts +3 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +28 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/core/virtual-models.d.ts +117 -0
- package/dist/core/virtual-models.d.ts.map +1 -0
- package/dist/core/virtual-models.js +124 -0
- package/dist/core/virtual-models.js.map +1 -0
- package/dist/experimental/micro/api.d.ts +81 -0
- package/dist/experimental/micro/api.d.ts.map +1 -0
- package/dist/experimental/micro/api.js +2 -0
- package/dist/experimental/micro/api.js.map +1 -0
- package/dist/experimental/micro/main.d.ts +3 -0
- package/dist/experimental/micro/main.d.ts.map +1 -0
- package/dist/experimental/micro/main.js +21 -0
- package/dist/experimental/micro/main.js.map +1 -0
- package/dist/experimental/micro/models.d.ts +11 -0
- package/dist/experimental/micro/models.d.ts.map +1 -0
- package/dist/experimental/micro/models.js +95 -0
- package/dist/experimental/micro/models.js.map +1 -0
- package/dist/experimental/micro/runtime.d.ts +12 -0
- package/dist/experimental/micro/runtime.d.ts.map +1 -0
- package/dist/experimental/micro/runtime.js +465 -0
- package/dist/experimental/micro/runtime.js.map +1 -0
- package/dist/experimental/micro/sessions.d.ts +10 -0
- package/dist/experimental/micro/sessions.d.ts.map +1 -0
- package/dist/experimental/micro/sessions.js +41 -0
- package/dist/experimental/micro/sessions.js.map +1 -0
- package/dist/experimental/micro/tools.d.ts +10 -0
- package/dist/experimental/micro/tools.d.ts.map +1 -0
- package/dist/experimental/micro/tools.js +96 -0
- package/dist/experimental/micro/tools.js.map +1 -0
- package/dist/experimental/micro/tui.d.ts +3 -0
- package/dist/experimental/micro/tui.d.ts.map +1 -0
- package/dist/experimental/micro/tui.js +510 -0
- package/dist/experimental/micro/tui.js.map +1 -0
- package/dist/experimental/mini/main.d.ts +7 -0
- package/dist/experimental/mini/main.d.ts.map +1 -0
- package/dist/experimental/mini/main.js +21 -0
- package/dist/experimental/mini/main.js.map +1 -0
- package/dist/experimental/mini/server/entry.d.ts +3 -0
- package/dist/experimental/mini/server/entry.d.ts.map +1 -0
- package/dist/experimental/mini/server/entry.js +11 -0
- package/dist/experimental/mini/server/entry.js.map +1 -0
- package/dist/experimental/mini/server/run.d.ts +13 -0
- package/dist/experimental/mini/server/run.d.ts.map +1 -0
- package/dist/experimental/mini/server/run.js +150 -0
- package/dist/experimental/mini/server/run.js.map +1 -0
- package/dist/experimental/mini/shared/protocol.d.ts +127 -0
- package/dist/experimental/mini/shared/protocol.d.ts.map +1 -0
- package/dist/experimental/mini/shared/protocol.js +13 -0
- package/dist/experimental/mini/shared/protocol.js.map +1 -0
- package/dist/experimental/mini/shared/rpc.d.ts +49 -0
- package/dist/experimental/mini/shared/rpc.d.ts.map +1 -0
- package/dist/experimental/mini/shared/rpc.js +171 -0
- package/dist/experimental/mini/shared/rpc.js.map +1 -0
- package/dist/experimental/mini/shared/transport.d.ts +35 -0
- package/dist/experimental/mini/shared/transport.d.ts.map +1 -0
- package/dist/experimental/mini/shared/transport.js +94 -0
- package/dist/experimental/mini/shared/transport.js.map +1 -0
- package/dist/experimental/mini/tui/run.d.ts +9 -0
- package/dist/experimental/mini/tui/run.d.ts.map +1 -0
- package/dist/experimental/mini/tui/run.js +62 -0
- package/dist/experimental/mini/tui/run.js.map +1 -0
- package/dist/experimental/mini/tui/session.d.ts +26 -0
- package/dist/experimental/mini/tui/session.d.ts.map +1 -0
- package/dist/experimental/mini/tui/session.js +94 -0
- package/dist/experimental/mini/tui/session.js.map +1 -0
- package/dist/experimental/mini/tui/view.d.ts +10 -0
- package/dist/experimental/mini/tui/view.d.ts.map +1 -0
- package/dist/experimental/mini/tui/view.js +461 -0
- package/dist/experimental/mini/tui/view.js.map +1 -0
- package/dist/experimental/mini/worker/entry.d.ts +3 -0
- package/dist/experimental/mini/worker/entry.d.ts.map +1 -0
- package/dist/experimental/mini/worker/entry.js +10 -0
- package/dist/experimental/mini/worker/entry.js.map +1 -0
- package/dist/experimental/mini/worker/lane-service.d.ts +44 -0
- package/dist/experimental/mini/worker/lane-service.d.ts.map +1 -0
- package/dist/experimental/mini/worker/lane-service.js +97 -0
- package/dist/experimental/mini/worker/lane-service.js.map +1 -0
- package/dist/experimental/mini/worker/models-service.d.ts +19 -0
- package/dist/experimental/mini/worker/models-service.d.ts.map +1 -0
- package/dist/experimental/mini/worker/models-service.js +136 -0
- package/dist/experimental/mini/worker/models-service.js.map +1 -0
- package/dist/experimental/mini/worker/run.d.ts +14 -0
- package/dist/experimental/mini/worker/run.d.ts.map +1 -0
- package/dist/experimental/mini/worker/run.js +88 -0
- package/dist/experimental/mini/worker/run.js.map +1 -0
- package/dist/extensions/codemode/execute.d.ts +16 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.js +429 -0
- package/dist/extensions/codemode/execute.js.map +1 -0
- package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
- package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.lazy.js +3 -0
- package/dist/extensions/codemode/execute.lazy.js.map +1 -0
- package/dist/extensions/codemode/index.d.ts +21 -0
- package/dist/extensions/codemode/index.d.ts.map +1 -0
- package/dist/extensions/codemode/index.js +31 -0
- package/dist/extensions/codemode/index.js.map +1 -0
- package/dist/extensions/codemode/renderer.d.ts +12 -0
- package/dist/extensions/codemode/renderer.d.ts.map +1 -0
- package/dist/extensions/codemode/renderer.js +137 -0
- package/dist/extensions/codemode/renderer.js.map +1 -0
- package/dist/extensions/codemode/tool.d.ts +123 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -0
- package/dist/extensions/codemode/tool.js +315 -0
- package/dist/extensions/codemode/tool.js.map +1 -0
- package/dist/extensions/codemode/worker.d.ts +7 -0
- package/dist/extensions/codemode/worker.d.ts.map +1 -0
- package/dist/extensions/codemode/worker.js +7 -0
- package/dist/extensions/codemode/worker.js.map +1 -0
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +13 -1
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +8 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +13 -0
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/huggingface.js +2 -0
- package/dist/extensions/llama/huggingface.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +13 -2
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +4 -2
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +121 -15
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.js +28 -12
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +21 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.js +500 -0
- package/dist/extensions/mcp/cli.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
- package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +3 -0
- package/dist/extensions/mcp/cli.lazy.js.map +1 -0
- package/dist/extensions/mcp/config.d.ts +72 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -0
- package/dist/extensions/mcp/config.js +158 -0
- package/dist/extensions/mcp/config.js.map +1 -0
- package/dist/extensions/mcp/index.d.ts +76 -0
- package/dist/extensions/mcp/index.d.ts.map +1 -0
- package/dist/extensions/mcp/index.js +1055 -0
- package/dist/extensions/mcp/index.js.map +1 -0
- package/dist/extensions/mcp/log.d.ts +16 -0
- package/dist/extensions/mcp/log.d.ts.map +1 -0
- package/dist/extensions/mcp/log.js +66 -0
- package/dist/extensions/mcp/log.js.map +1 -0
- package/dist/extensions/mcp/oauth.d.ts +96 -0
- package/dist/extensions/mcp/oauth.d.ts.map +1 -0
- package/dist/extensions/mcp/oauth.js +333 -0
- package/dist/extensions/mcp/oauth.js.map +1 -0
- package/dist/extensions/mcp/resources.d.ts +43 -0
- package/dist/extensions/mcp/resources.d.ts.map +1 -0
- package/dist/extensions/mcp/resources.js +262 -0
- package/dist/extensions/mcp/resources.js.map +1 -0
- package/dist/extensions/mcp/runtime.d.ts +98 -0
- package/dist/extensions/mcp/runtime.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.js +394 -0
- package/dist/extensions/mcp/runtime.js.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.js +3 -0
- package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
- package/dist/extensions/mcp/tools.d.ts +84 -0
- package/dist/extensions/mcp/tools.d.ts.map +1 -0
- package/dist/extensions/mcp/tools.js +251 -0
- package/dist/extensions/mcp/tools.js.map +1 -0
- package/dist/extensions/mcp/ui.d.ts +60 -0
- package/dist/extensions/mcp/ui.d.ts.map +1 -0
- package/dist/extensions/mcp/ui.js +174 -0
- package/dist/extensions/mcp/ui.js.map +1 -0
- package/dist/extensions/stub-provider/index.d.ts +9 -0
- package/dist/extensions/stub-provider/index.d.ts.map +1 -0
- package/dist/extensions/stub-provider/index.js +13 -0
- package/dist/extensions/stub-provider/index.js.map +1 -0
- package/dist/extensions/stub-provider/provider.d.ts +77 -0
- package/dist/extensions/stub-provider/provider.d.ts.map +1 -0
- package/dist/extensions/stub-provider/provider.js +194 -0
- package/dist/extensions/stub-provider/provider.js.map +1 -0
- package/dist/extensions/tool-search/index.d.ts +12 -0
- package/dist/extensions/tool-search/index.d.ts.map +1 -0
- package/dist/extensions/tool-search/index.js +15 -0
- package/dist/extensions/tool-search/index.js.map +1 -0
- package/dist/extensions/tool-search/tool.d.ts +73 -0
- package/dist/extensions/tool-search/tool.d.ts.map +1 -0
- package/dist/extensions/tool-search/tool.js +189 -0
- package/dist/extensions/tool-search/tool.js.map +1 -0
- package/dist/hooks/gsd/draht-quality-gate.js +3 -3
- package/dist/index.d.ts +20 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +4 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +365 -96
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +1 -1
- package/dist/migrations.js +7 -6
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +1 -0
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts +19 -0
- package/dist/modes/interactive/bug-report.d.ts.map +1 -0
- package/dist/modes/interactive/bug-report.js +211 -0
- package/dist/modes/interactive/bug-report.js.map +1 -0
- package/dist/modes/interactive/chat-viewport.d.ts +20 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/chat-viewport.js +28 -0
- package/dist/modes/interactive/chat-viewport.js.map +1 -0
- package/dist/modes/interactive/components/armin.js +10 -6
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +38 -15
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +9 -4
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +3 -0
- 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 +15 -6
- 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 +15 -6
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +38 -10
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +5 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +54 -2
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +4 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +7 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js +8 -6
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +1 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +14 -3
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +2 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +14 -2
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +50 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +218 -6
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +4 -4
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +12 -4
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +51 -6
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +9 -3
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +11 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +75 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +10 -4
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +101 -40
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +11 -3
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +4 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +60 -32
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +5 -5
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +138 -80
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +25 -4
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +240 -67
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-submenu.js +165 -0
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +1 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +14 -5
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +12 -3
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +2 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +17 -0
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
- package/dist/modes/interactive/components/themed-text.js +29 -0
- package/dist/modes/interactive/components/themed-text.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +76 -18
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +88 -53
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +20 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +65 -23
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +8 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +6 -3
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +3 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +12 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +27 -3
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +39 -6
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +166 -8
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1690 -599
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +34 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/session-share.d.ts +23 -0
- package/dist/modes/interactive/session-share.d.ts.map +1 -0
- package/dist/modes/interactive/session-share.js +130 -0
- package/dist/modes/interactive/session-share.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +54 -63
- package/dist/modes/interactive/theme/light.json +52 -60
- package/dist/modes/interactive/theme/system-theme.d.ts +54 -0
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/system-theme.js +535 -0
- package/dist/modes/interactive/theme/system-theme.js.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +59 -7
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +164 -51
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +85 -0
- package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-json.js +132 -0
- package/dist/modes/interactive/theme/theme-json.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +24 -3
- package/dist/modes/interactive/theme/theme.d.ts +80 -42
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +274 -417
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/tui-renderer.d.ts +22 -0
- package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
- package/dist/modes/interactive/tui-renderer.js +67 -0
- package/dist/modes/interactive/tui-renderer.js.map +1 -0
- package/dist/modes/json-event.d.ts +34 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +29 -0
- package/dist/modes/json-event.js.map +1 -0
- 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 +12 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +17 -9
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +27 -15
- 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 +179 -19
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +90 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +1 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +217 -63
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/commands/atomic-commit.md +1 -12
- package/dist/prompts/commands/brainstorm.md +12 -15
- package/dist/prompts/commands/create-verification-skill.md +108 -0
- package/dist/prompts/commands/discuss-phase.md +3 -14
- package/dist/prompts/commands/execute-phase.md +3 -11
- package/dist/prompts/commands/fix.md +41 -18
- package/dist/prompts/commands/grill.md +66 -0
- package/dist/prompts/commands/init-project.md +5 -15
- package/dist/prompts/commands/map-codebase.md +1 -13
- package/dist/prompts/commands/new-project.md +5 -15
- package/dist/prompts/commands/next-milestone.md +1 -13
- package/dist/prompts/commands/orchestrate.md +1 -1
- package/dist/prompts/commands/pause-work.md +1 -13
- package/dist/prompts/commands/plan-phase.md +3 -11
- package/dist/prompts/commands/progress.md +0 -13
- package/dist/prompts/commands/quick.md +3 -11
- package/dist/prompts/commands/resolve-conflicts.md +71 -0
- package/dist/prompts/commands/resume-work.md +0 -13
- package/dist/prompts/commands/review.md +6 -13
- package/dist/prompts/commands/triage.md +159 -0
- package/dist/prompts/commands/verify-work.md +5 -14
- package/dist/prompts/commands/why.md +139 -0
- package/dist/rpc-entry.js +1 -0
- package/dist/rpc-entry.js.map +1 -1
- package/dist/skills/atomic-reasoning/SKILL.md +115 -0
- package/dist/skills/blast-radius/SKILL.md +56 -0
- package/dist/skills/epistemics/SKILL.md +99 -0
- package/dist/skills/explainers/SKILL.md +65 -0
- package/dist/skills/hexagon-animation/SKILL.md +49 -0
- package/dist/skills/hexagon-animation/generate.mjs +81 -0
- package/dist/skills/hexagon-animation/template.html +361 -0
- package/dist/skills/typescript-discipline/SKILL.md +50 -0
- package/dist/skills/typescript-discipline/references/patterns.md +294 -0
- package/dist/skills/unslop/SKILL.md +119 -0
- package/dist/utils/abort.d.ts +5 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +48 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/canonical-path.d.ts +28 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +90 -0
- package/dist/utils/canonical-path.js.map +1 -0
- package/dist/utils/changelog.js +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts +13 -2
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +26 -9
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts +7 -0
- package/dist/utils/clipboard-command.d.ts.map +1 -0
- package/dist/utils/clipboard-command.js +45 -0
- package/dist/utils/clipboard-command.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +60 -91
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts +3 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +123 -108
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/draht-user-agent.d.ts +2 -0
- package/dist/utils/draht-user-agent.d.ts.map +1 -0
- package/dist/utils/draht-user-agent.js +5 -0
- package/dist/utils/draht-user-agent.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +2 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +2 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/management-http.d.ts +25 -0
- package/dist/utils/management-http.d.ts.map +1 -0
- package/dist/utils/management-http.js +54 -0
- package/dist/utils/management-http.js.map +1 -0
- package/dist/utils/mime.js +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -10
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +23 -14
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts +2 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts +4 -3
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +26 -39
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +62 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts +8 -0
- package/dist/utils/text.d.ts.map +1 -0
- package/dist/utils/text.js +9 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/tool-result-images.d.ts +21 -0
- package/dist/utils/tool-result-images.d.ts.map +1 -0
- package/dist/utils/tool-result-images.js +48 -0
- package/dist/utils/tool-result-images.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +11 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +56 -41
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts +4 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +30 -9
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/dist/utils/zip.d.ts +7 -0
- package/dist/utils/zip.d.ts.map +1 -0
- package/dist/utils/zip.js +60 -0
- package/dist/utils/zip.js.map +1 -0
- package/docs/attachable-sessions.md +79 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +374 -0
- package/docs/compaction.md +107 -45
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +100 -66
- package/docs/custom-provider.md +109 -707
- package/docs/docs.json +155 -95
- package/docs/duet.md +42 -0
- package/docs/environment-variables.md +30 -17
- package/docs/extensions.md +169 -2811
- package/docs/how-pi-works.md +53 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/index.md +25 -69
- package/docs/json.md +198 -57
- package/docs/keybindings.md +89 -92
- package/docs/llama-cpp.md +23 -8
- package/docs/mcp.md +231 -0
- package/docs/message-types.md +261 -0
- package/docs/models.md +94 -478
- package/docs/packages.md +68 -164
- package/docs/prompt-templates.md +31 -68
- package/docs/providers.md +118 -215
- package/docs/quickstart.md +56 -109
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +186 -1494
- package/docs/sdk.md +79 -1127
- package/docs/security.md +77 -33
- package/docs/session-format.md +98 -222
- package/docs/sessions.md +36 -113
- package/docs/settings.md +125 -251
- package/docs/shell-aliases.md +85 -5
- package/docs/skills.md +52 -188
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +132 -61
- package/docs/termux.md +74 -84
- package/docs/themes.md +91 -252
- package/docs/tmux.md +31 -39
- package/docs/tui.md +74 -891
- package/docs/usage.md +54 -255
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +57 -7
- package/examples/extensions/antigravity-image-gen.ts +9 -9
- package/examples/extensions/bash-spawn-hook.ts +1 -1
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/built-in-tool-renderer.ts +16 -40
- package/examples/extensions/custom-compaction.ts +1 -16
- package/examples/extensions/custom-provider-anthropic/index.ts +20 -13
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +4 -3
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
- package/examples/extensions/dynamic-resources/dynamic.json +3 -1
- package/examples/extensions/git-checkpoint.ts +2 -2
- package/examples/extensions/handoff.ts +2 -11
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/minimal-mode.ts +24 -96
- package/examples/extensions/notify.ts +3 -1
- package/examples/extensions/overlay-qa-tests.ts +3 -3
- package/examples/extensions/prompt-customizer.ts +19 -67
- package/examples/extensions/qna.ts +3 -7
- package/examples/extensions/subagent/agents.ts +40 -9
- package/examples/extensions/subagent/index.ts +27 -4
- package/examples/extensions/summarize.ts +7 -18
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/rpc-client.ts +35 -0
- package/examples/rpc-extension-ui.ts +38 -9
- package/examples/sdk/02-custom-model.ts +1 -2
- package/examples/sdk/06-extensions.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/hooks/gsd/draht-quality-gate.js +3 -3
- package/package.json +28 -32
- package/prompts/commands/atomic-commit.md +1 -12
- package/prompts/commands/brainstorm.md +12 -15
- package/prompts/commands/create-verification-skill.md +108 -0
- package/prompts/commands/discuss-phase.md +3 -14
- package/prompts/commands/execute-phase.md +3 -11
- package/prompts/commands/fix.md +41 -18
- package/prompts/commands/grill.md +66 -0
- package/prompts/commands/init-project.md +5 -15
- package/prompts/commands/map-codebase.md +1 -13
- package/prompts/commands/new-project.md +5 -15
- package/prompts/commands/next-milestone.md +1 -13
- package/prompts/commands/orchestrate.md +1 -1
- package/prompts/commands/pause-work.md +1 -13
- package/prompts/commands/plan-phase.md +3 -11
- package/prompts/commands/progress.md +0 -13
- package/prompts/commands/quick.md +3 -11
- package/prompts/commands/resolve-conflicts.md +71 -0
- package/prompts/commands/resume-work.md +0 -13
- package/prompts/commands/review.md +6 -13
- package/prompts/commands/triage.md +159 -0
- package/prompts/commands/verify-work.md +5 -14
- package/prompts/commands/why.md +139 -0
- package/skills/atomic-reasoning/SKILL.md +115 -0
- package/skills/blast-radius/SKILL.md +56 -0
- package/skills/epistemics/SKILL.md +99 -0
- package/skills/explainers/SKILL.md +65 -0
- package/skills/hexagon-animation/SKILL.md +49 -0
- package/skills/hexagon-animation/generate.mjs +81 -0
- package/skills/hexagon-animation/template.html +361 -0
- package/skills/typescript-discipline/SKILL.md +50 -0
- package/skills/typescript-discipline/references/patterns.md +294 -0
- package/skills/unslop/SKILL.md +119 -0
- package/dist/prompts/agents/build.md +0 -86
- package/dist/prompts/agents/plan.md +0 -79
- package/dist/prompts/agents/verify.md +0 -69
- package/dist/utils/clipboard-native.d.ts +0 -11
- package/dist/utils/clipboard-native.d.ts.map +0 -1
- package/dist/utils/clipboard-native.js +0 -20
- package/dist/utils/clipboard-native.js.map +0 -1
- package/dist/utils/pi-user-agent.d.ts +0 -2
- package/dist/utils/pi-user-agent.d.ts.map +0 -1
- package/dist/utils/pi-user-agent.js +0 -5
- package/dist/utils/pi-user-agent.js.map +0 -1
- package/docs/development.md +0 -71
- package/docs/tree.md +0 -231
- package/examples/extensions/kimi-deferred-tools.ts +0 -61
- package/prompts/agents/build.md +0 -86
- package/prompts/agents/plan.md +0 -79
- package/prompts/agents/verify.md +0 -69
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* macOS Seatbelt backend (R44-SBX.1) -- `sandbox-exec -p <generated profile>`.
|
|
3
|
+
*
|
|
4
|
+
* This is the platform this machine can and does exercise for real: every claim
|
|
5
|
+
* in `seatbelt-profile.ts`'s doc comment was measured here, and the tests in
|
|
6
|
+
* `test/sandbox-backend.test.ts` run against the actual `/usr/bin/sandbox-exec`,
|
|
7
|
+
* not a stub.
|
|
8
|
+
*
|
|
9
|
+
* ## Flow
|
|
10
|
+
*
|
|
11
|
+
* 1. Render the policy to SBPL (`buildSeatbeltProfile`).
|
|
12
|
+
* 2. `sandbox-exec -p <profile> <shell> -c <command>` with a constructed env.
|
|
13
|
+
*
|
|
14
|
+
* There is no step where the profile touches the filesystem, and that is the
|
|
15
|
+
* point. This backend used to stage the SBPL at
|
|
16
|
+
* `mkdtemp(os.tmpdir())/policy.sb` and pass `-f <path>` -- but `os.tmpdir()` is
|
|
17
|
+
* in the write allowlist of *every* production policy (R44-SBX.2), so the file
|
|
18
|
+
* describing the sandbox sat inside the sandbox's own writable area. A confined
|
|
19
|
+
* command could therefore watch that directory and overwrite the profile of a
|
|
20
|
+
* later command with `(allow default)`; a reviewer demonstrated the write
|
|
21
|
+
* succeeding. Passing the profile inline through `-p` removes the artifact
|
|
22
|
+
* rather than trying to protect it: there is no path to race, no directory to
|
|
23
|
+
* watch, and no window between write and read.
|
|
24
|
+
*
|
|
25
|
+
* The profile is visible in the wrapper's argv, which is a disclosure of the
|
|
26
|
+
* policy (which directories are writable), never of a secret -- and a sandboxed
|
|
27
|
+
* process cannot read another process's argv anyway, since the profile denies
|
|
28
|
+
* `process-info*` against other processes.
|
|
29
|
+
*
|
|
30
|
+
* Regenerating per invocation rather than caching by policy hash is deliberate
|
|
31
|
+
* for v1: the policy is resolved per invocation anyway (R44-SBX.2). Profile
|
|
32
|
+
* generation is string building; Phase 46 owns the spawn-overhead budget and can
|
|
33
|
+
* revisit with numbers.
|
|
34
|
+
*
|
|
35
|
+
* ## `status()` and `exec()`
|
|
36
|
+
*
|
|
37
|
+
* `status()` runs the R44-SBX.4 self-test once and memoises the *promise*, so
|
|
38
|
+
* concurrent callers share one probe. `exec()` awaits that same status first and
|
|
39
|
+
* throws `SandboxUnavailableError` when it is not `available` -- **before**
|
|
40
|
+
* spawning anything. That ordering is the whole failure posture: a backend that
|
|
41
|
+
* cannot prove confinement does not run the command in a weaker sandbox and does
|
|
42
|
+
* not run it bare, it does not run it.
|
|
43
|
+
*
|
|
44
|
+
* ## `sandbox-exec` is deprecated
|
|
45
|
+
*
|
|
46
|
+
* It has carried a deprecation warning for years and still ships on every macOS;
|
|
47
|
+
* Chrome, Claude Code and Codex all depend on it. The risk is handled by
|
|
48
|
+
* structure rather than by hope: if Apple removes it, `existsSync` fails or the
|
|
49
|
+
* self-test fails, and this backend reports `unavailable`. Deprecation therefore
|
|
50
|
+
* degrades us to today's permission-gate behaviour (Phase 45), never to silently
|
|
51
|
+
* unconfined execution.
|
|
52
|
+
*/
|
|
53
|
+
import { existsSync } from "node:fs";
|
|
54
|
+
import { getShellConfig } from "../../utils/shell.js";
|
|
55
|
+
import { buildSandboxEnv } from "./env.js";
|
|
56
|
+
import { SandboxUnavailableError, } from "./executor.js";
|
|
57
|
+
import { buildSeatbeltProfile } from "./seatbelt-profile.js";
|
|
58
|
+
import { runSandboxSelfTest } from "./self-test.js";
|
|
59
|
+
import { spawnSandboxedProcess } from "./spawn.js";
|
|
60
|
+
export const DEFAULT_SANDBOX_EXEC_BIN = "/usr/bin/sandbox-exec";
|
|
61
|
+
/**
|
|
62
|
+
* Ceiling on the inline profile, well under the 1 MiB `ARG_MAX` this machine
|
|
63
|
+
* reports. A policy that renders larger than this is not one we hand to `execve`
|
|
64
|
+
* and hope: an `E2BIG` from the wrapper would surface as an opaque spawn failure,
|
|
65
|
+
* whereas refusing here surfaces as `unavailable`, which is the outcome every
|
|
66
|
+
* other "cannot confine" case in this module already produces.
|
|
67
|
+
*/
|
|
68
|
+
export const MAX_INLINE_PROFILE_BYTES = 256 * 1024;
|
|
69
|
+
/**
|
|
70
|
+
* Builds the wrapper argv.
|
|
71
|
+
*
|
|
72
|
+
* Exported so a test can assert the shape directly: the profile travels as the
|
|
73
|
+
* `-p` operand and **no element is a path to a profile file**, which is the
|
|
74
|
+
* invariant that keeps a sandboxed command from tampering with the profile of a
|
|
75
|
+
* later one.
|
|
76
|
+
*/
|
|
77
|
+
export function buildSandboxExecArgs(profile, shell, shellArgs, command) {
|
|
78
|
+
return ["-p", profile, shell, ...shellArgs, command];
|
|
79
|
+
}
|
|
80
|
+
export function createSeatbeltSandboxExecutor(options = {}) {
|
|
81
|
+
const sandboxExecBin = options.sandboxExecBin ?? DEFAULT_SANDBOX_EXEC_BIN;
|
|
82
|
+
const buildProfile = options.buildProfile ?? buildSeatbeltProfile;
|
|
83
|
+
/**
|
|
84
|
+
* Runs one command confined by `policy`. Used by both `exec` and the
|
|
85
|
+
* self-test, so the probe cannot pass through a path production does not use.
|
|
86
|
+
*/
|
|
87
|
+
const runConfined = async (command, cwd, policy, execOptions) => {
|
|
88
|
+
if (!existsSync(sandboxExecBin)) {
|
|
89
|
+
throw new SandboxUnavailableError(`macOS sandbox-exec not found at ${JSON.stringify(sandboxExecBin)} -- refusing to run the command unconfined`);
|
|
90
|
+
}
|
|
91
|
+
let profile;
|
|
92
|
+
try {
|
|
93
|
+
profile = buildProfile(policy);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
// A policy this backend cannot render exactly is a policy it cannot
|
|
97
|
+
// enforce. Surfacing it as `SandboxUnavailableError` (rather than letting
|
|
98
|
+
// a `SandboxProfileError` escape) keeps every "could not confine" outcome
|
|
99
|
+
// one type at the call site -- and, as everywhere else here, the command
|
|
100
|
+
// has not been spawned at this point and will not be.
|
|
101
|
+
throw new SandboxUnavailableError(`cannot generate a sandbox profile for this policy: ${err instanceof Error ? err.message : String(err)}`);
|
|
102
|
+
}
|
|
103
|
+
const profileBytes = Buffer.byteLength(profile, "utf8");
|
|
104
|
+
if (profileBytes > MAX_INLINE_PROFILE_BYTES) {
|
|
105
|
+
throw new SandboxUnavailableError(`the sandbox profile for this policy is ${profileBytes} bytes, over the ${MAX_INLINE_PROFILE_BYTES}-byte limit for passing it inline -- refusing to run the command unconfined`);
|
|
106
|
+
}
|
|
107
|
+
const shell = getShellConfig(options.shellPath);
|
|
108
|
+
return await spawnSandboxedProcess(sandboxExecBin, buildSandboxExecArgs(profile, shell.shell, shell.args, command), {
|
|
109
|
+
cwd,
|
|
110
|
+
env: buildSandboxEnv({
|
|
111
|
+
source: execOptions.env,
|
|
112
|
+
extraAllowedNames: options.extraAllowedEnvVars,
|
|
113
|
+
}),
|
|
114
|
+
onData: execOptions.onData,
|
|
115
|
+
signal: execOptions.signal,
|
|
116
|
+
timeout: execOptions.timeout,
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
let statusPromise;
|
|
120
|
+
const status = () => {
|
|
121
|
+
statusPromise ??= runSandboxSelfTest({
|
|
122
|
+
backendName: "seatbelt",
|
|
123
|
+
timeoutSeconds: options.selfTestTimeoutSeconds,
|
|
124
|
+
run: async (command, cwd, policy, timeoutSeconds) => {
|
|
125
|
+
let output = "";
|
|
126
|
+
const result = await runConfined(command, cwd, policy, {
|
|
127
|
+
onData: (data) => {
|
|
128
|
+
output += data.toString();
|
|
129
|
+
},
|
|
130
|
+
timeout: timeoutSeconds,
|
|
131
|
+
});
|
|
132
|
+
return { exitCode: result.exitCode, output };
|
|
133
|
+
},
|
|
134
|
+
// A throwing `runConfined` (missing binary, unrenderable policy) is a
|
|
135
|
+
// failed self-test like any other; `runSandboxSelfTest` catches it and
|
|
136
|
+
// turns it into a reason.
|
|
137
|
+
}).catch((err) => ({
|
|
138
|
+
available: false,
|
|
139
|
+
reason: `seatbelt sandbox self-test failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
140
|
+
}));
|
|
141
|
+
return statusPromise;
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
name: "seatbelt",
|
|
145
|
+
status,
|
|
146
|
+
exec: async (command, cwd, policy, execOptions) => {
|
|
147
|
+
const current = await status();
|
|
148
|
+
if (!current.available)
|
|
149
|
+
throw new SandboxUnavailableError(current.reason);
|
|
150
|
+
return runConfined(command, cwd, policy, execOptions);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=seatbelt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seatbelt.js","sourceRoot":"","sources":["../../../src/core/sandbox/seatbelt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAKN,uBAAuB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,GAAG,IAAI,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CACnC,OAAe,EACf,KAAa,EACb,SAA4B,EAC5B,OAAe;IAEf,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAwBD,MAAM,UAAU,6BAA6B,CAAC,OAAO,GAA2B,EAAE;IACjF,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,wBAAwB,CAAC;IAC1E,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,oBAAoB,CAAC;IAElE;;;OAGG;IACH,MAAM,WAAW,GAAG,KAAK,EACxB,OAAe,EACf,GAAW,EACX,MAAqB,EACrB,WAA+B,EACF,EAAE;QAC/B,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,uBAAuB,CAChC,mCAAmC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,4CAA4C,CAC7G,CAAC;QACH,CAAC;QACD,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACJ,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,oEAAoE;YACpE,0EAA0E;YAC1E,0EAA0E;YAC1E,yEAAyE;YACzE,sDAAsD;YACtD,MAAM,IAAI,uBAAuB,CAChC,sDAAsD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACxG,CAAC;QACH,CAAC;QACD,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACxD,IAAI,YAAY,GAAG,wBAAwB,EAAE,CAAC;YAC7C,MAAM,IAAI,uBAAuB,CAChC,0CAA0C,YAAY,oBAAoB,wBAAwB,6EAA6E,CAC/K,CAAC;QACH,CAAC;QACD,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChD,OAAO,MAAM,qBAAqB,CACjC,cAAc,EACd,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/D;YACC,GAAG;YACH,GAAG,EAAE,eAAe,CAAC;gBACpB,MAAM,EAAE,WAAW,CAAC,GAAG;gBACvB,iBAAiB,EAAE,OAAO,CAAC,mBAAmB;aAC9C,CAAC;YACF,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,OAAO,EAAE,WAAW,CAAC,OAAO;SAC5B,CACD,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,aAAiD,CAAC;IACtD,MAAM,MAAM,GAAG,GAA2B,EAAE;QAC3C,aAAa,KAAK,kBAAkB,CAAC;YACpC,WAAW,EAAE,UAAU;YACvB,cAAc,EAAE,OAAO,CAAC,sBAAsB;YAC9C,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE;gBACnD,IAAI,MAAM,GAAG,EAAE,CAAC;gBAChB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE;oBACtD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;wBAChB,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAC3B,CAAC;oBACD,OAAO,EAAE,cAAc;iBACvB,CAAC,CAAC;gBACH,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;YAC9C,CAAC;YACD,sEAAsE;YACtE,uEAAuE;YACvE,0BAA0B;SAC1B,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAClB,SAAS,EAAE,KAAc;YACzB,MAAM,EAAE,sCAAsC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;SAChG,CAAC,CAAC,CAAC;QACJ,OAAO,aAAa,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO;QACN,IAAI,EAAE,UAAU;QAChB,MAAM;QACN,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE;YACjD,MAAM,OAAO,GAAG,MAAM,MAAM,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,SAAS;gBAAE,MAAM,IAAI,uBAAuB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1E,OAAO,WAAW,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;QACvD,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["/**\n * macOS Seatbelt backend (R44-SBX.1) -- `sandbox-exec -p <generated profile>`.\n *\n * This is the platform this machine can and does exercise for real: every claim\n * in `seatbelt-profile.ts`'s doc comment was measured here, and the tests in\n * `test/sandbox-backend.test.ts` run against the actual `/usr/bin/sandbox-exec`,\n * not a stub.\n *\n * ## Flow\n *\n * 1. Render the policy to SBPL (`buildSeatbeltProfile`).\n * 2. `sandbox-exec -p <profile> <shell> -c <command>` with a constructed env.\n *\n * There is no step where the profile touches the filesystem, and that is the\n * point. This backend used to stage the SBPL at\n * `mkdtemp(os.tmpdir())/policy.sb` and pass `-f <path>` -- but `os.tmpdir()` is\n * in the write allowlist of *every* production policy (R44-SBX.2), so the file\n * describing the sandbox sat inside the sandbox's own writable area. A confined\n * command could therefore watch that directory and overwrite the profile of a\n * later command with `(allow default)`; a reviewer demonstrated the write\n * succeeding. Passing the profile inline through `-p` removes the artifact\n * rather than trying to protect it: there is no path to race, no directory to\n * watch, and no window between write and read.\n *\n * The profile is visible in the wrapper's argv, which is a disclosure of the\n * policy (which directories are writable), never of a secret -- and a sandboxed\n * process cannot read another process's argv anyway, since the profile denies\n * `process-info*` against other processes.\n *\n * Regenerating per invocation rather than caching by policy hash is deliberate\n * for v1: the policy is resolved per invocation anyway (R44-SBX.2). Profile\n * generation is string building; Phase 46 owns the spawn-overhead budget and can\n * revisit with numbers.\n *\n * ## `status()` and `exec()`\n *\n * `status()` runs the R44-SBX.4 self-test once and memoises the *promise*, so\n * concurrent callers share one probe. `exec()` awaits that same status first and\n * throws `SandboxUnavailableError` when it is not `available` -- **before**\n * spawning anything. That ordering is the whole failure posture: a backend that\n * cannot prove confinement does not run the command in a weaker sandbox and does\n * not run it bare, it does not run it.\n *\n * ## `sandbox-exec` is deprecated\n *\n * It has carried a deprecation warning for years and still ships on every macOS;\n * Chrome, Claude Code and Codex all depend on it. The risk is handled by\n * structure rather than by hope: if Apple removes it, `existsSync` fails or the\n * self-test fails, and this backend reports `unavailable`. Deprecation therefore\n * degrades us to today's permission-gate behaviour (Phase 45), never to silently\n * unconfined execution.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { getShellConfig } from \"../../utils/shell.ts\";\nimport { buildSandboxEnv } from \"./env.ts\";\nimport {\n\ttype SandboxExecOptions,\n\ttype SandboxExecResult,\n\ttype SandboxExecutor,\n\ttype SandboxStatus,\n\tSandboxUnavailableError,\n} from \"./executor.ts\";\nimport type { SandboxPolicy } from \"./policy.ts\";\nimport { buildSeatbeltProfile } from \"./seatbelt-profile.ts\";\nimport { runSandboxSelfTest } from \"./self-test.ts\";\nimport { spawnSandboxedProcess } from \"./spawn.ts\";\n\nexport const DEFAULT_SANDBOX_EXEC_BIN = \"/usr/bin/sandbox-exec\";\n\n/**\n * Ceiling on the inline profile, well under the 1 MiB `ARG_MAX` this machine\n * reports. A policy that renders larger than this is not one we hand to `execve`\n * and hope: an `E2BIG` from the wrapper would surface as an opaque spawn failure,\n * whereas refusing here surfaces as `unavailable`, which is the outcome every\n * other \"cannot confine\" case in this module already produces.\n */\nexport const MAX_INLINE_PROFILE_BYTES = 256 * 1024;\n\n/**\n * Builds the wrapper argv.\n *\n * Exported so a test can assert the shape directly: the profile travels as the\n * `-p` operand and **no element is a path to a profile file**, which is the\n * invariant that keeps a sandboxed command from tampering with the profile of a\n * later one.\n */\nexport function buildSandboxExecArgs(\n\tprofile: string,\n\tshell: string,\n\tshellArgs: readonly string[],\n\tcommand: string,\n): string[] {\n\treturn [\"-p\", profile, shell, ...shellArgs, command];\n}\n\nexport interface SeatbeltSandboxOptions {\n\t/**\n\t * Path to `sandbox-exec`. Overridable chiefly as a test injection point for\n\t * proving fail-closed behaviour -- point it at a nonexistent path and the\n\t * backend must report `unavailable`, not fall back to a bare spawn. Same role\n\t * the equivalent option plays in `packages/rlm/src/sandbox.ts`.\n\t */\n\tsandboxExecBin?: string;\n\t/** Explicit shell path from settings; defaults to `getShellConfig()`'s resolution. */\n\tshellPath?: string;\n\t/**\n\t * Profile generator override. Exists so tests can hand the backend a\n\t * deliberately broken or deliberately permissive profile and assert the\n\t * self-test catches both. Production never sets it.\n\t */\n\tbuildProfile?: (policy: SandboxPolicy) => string;\n\t/** Extra environment variable names to admit (Phase 45 wires this to settings). */\n\textraAllowedEnvVars?: readonly string[];\n\t/** Seconds allowed for the self-test probe. Defaults to the self-test's own default. */\n\tselfTestTimeoutSeconds?: number;\n}\n\nexport function createSeatbeltSandboxExecutor(options: SeatbeltSandboxOptions = {}): SandboxExecutor {\n\tconst sandboxExecBin = options.sandboxExecBin ?? DEFAULT_SANDBOX_EXEC_BIN;\n\tconst buildProfile = options.buildProfile ?? buildSeatbeltProfile;\n\n\t/**\n\t * Runs one command confined by `policy`. Used by both `exec` and the\n\t * self-test, so the probe cannot pass through a path production does not use.\n\t */\n\tconst runConfined = async (\n\t\tcommand: string,\n\t\tcwd: string,\n\t\tpolicy: SandboxPolicy,\n\t\texecOptions: SandboxExecOptions,\n\t): Promise<SandboxExecResult> => {\n\t\tif (!existsSync(sandboxExecBin)) {\n\t\t\tthrow new SandboxUnavailableError(\n\t\t\t\t`macOS sandbox-exec not found at ${JSON.stringify(sandboxExecBin)} -- refusing to run the command unconfined`,\n\t\t\t);\n\t\t}\n\t\tlet profile: string;\n\t\ttry {\n\t\t\tprofile = buildProfile(policy);\n\t\t} catch (err) {\n\t\t\t// A policy this backend cannot render exactly is a policy it cannot\n\t\t\t// enforce. Surfacing it as `SandboxUnavailableError` (rather than letting\n\t\t\t// a `SandboxProfileError` escape) keeps every \"could not confine\" outcome\n\t\t\t// one type at the call site -- and, as everywhere else here, the command\n\t\t\t// has not been spawned at this point and will not be.\n\t\t\tthrow new SandboxUnavailableError(\n\t\t\t\t`cannot generate a sandbox profile for this policy: ${err instanceof Error ? err.message : String(err)}`,\n\t\t\t);\n\t\t}\n\t\tconst profileBytes = Buffer.byteLength(profile, \"utf8\");\n\t\tif (profileBytes > MAX_INLINE_PROFILE_BYTES) {\n\t\t\tthrow new SandboxUnavailableError(\n\t\t\t\t`the sandbox profile for this policy is ${profileBytes} bytes, over the ${MAX_INLINE_PROFILE_BYTES}-byte limit for passing it inline -- refusing to run the command unconfined`,\n\t\t\t);\n\t\t}\n\t\tconst shell = getShellConfig(options.shellPath);\n\t\treturn await spawnSandboxedProcess(\n\t\t\tsandboxExecBin,\n\t\t\tbuildSandboxExecArgs(profile, shell.shell, shell.args, command),\n\t\t\t{\n\t\t\t\tcwd,\n\t\t\t\tenv: buildSandboxEnv({\n\t\t\t\t\tsource: execOptions.env,\n\t\t\t\t\textraAllowedNames: options.extraAllowedEnvVars,\n\t\t\t\t}),\n\t\t\t\tonData: execOptions.onData,\n\t\t\t\tsignal: execOptions.signal,\n\t\t\t\ttimeout: execOptions.timeout,\n\t\t\t},\n\t\t);\n\t};\n\n\tlet statusPromise: Promise<SandboxStatus> | undefined;\n\tconst status = (): Promise<SandboxStatus> => {\n\t\tstatusPromise ??= runSandboxSelfTest({\n\t\t\tbackendName: \"seatbelt\",\n\t\t\ttimeoutSeconds: options.selfTestTimeoutSeconds,\n\t\t\trun: async (command, cwd, policy, timeoutSeconds) => {\n\t\t\t\tlet output = \"\";\n\t\t\t\tconst result = await runConfined(command, cwd, policy, {\n\t\t\t\t\tonData: (data) => {\n\t\t\t\t\t\toutput += data.toString();\n\t\t\t\t\t},\n\t\t\t\t\ttimeout: timeoutSeconds,\n\t\t\t\t});\n\t\t\t\treturn { exitCode: result.exitCode, output };\n\t\t\t},\n\t\t\t// A throwing `runConfined` (missing binary, unrenderable policy) is a\n\t\t\t// failed self-test like any other; `runSandboxSelfTest` catches it and\n\t\t\t// turns it into a reason.\n\t\t}).catch((err) => ({\n\t\t\tavailable: false as const,\n\t\t\treason: `seatbelt sandbox self-test failed: ${err instanceof Error ? err.message : String(err)}`,\n\t\t}));\n\t\treturn statusPromise;\n\t};\n\n\treturn {\n\t\tname: \"seatbelt\",\n\t\tstatus,\n\t\texec: async (command, cwd, policy, execOptions) => {\n\t\t\tconst current = await status();\n\t\t\tif (!current.available) throw new SandboxUnavailableError(current.reason);\n\t\t\treturn runConfined(command, cwd, policy, execOptions);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup self-test (R44-SBX.4) -- the only thing that may report `available`.
|
|
3
|
+
*
|
|
4
|
+
* Phase 28 established the pattern: prove the sandbox holds before trusting it
|
|
5
|
+
* (`packages/rlm/src/session.ts` sends a `self_test` message and refuses the
|
|
6
|
+
* session unless the driver reports network and file reads actually blocked).
|
|
7
|
+
* This is the same idea applied to a shell backend, with one addition that
|
|
8
|
+
* turned out to matter more than the original probe.
|
|
9
|
+
*
|
|
10
|
+
* ## Why the probe is two-sided
|
|
11
|
+
*
|
|
12
|
+
* The obvious self-test -- "try to write outside the allowlist, expect failure"
|
|
13
|
+
* -- passes for the *worst possible* backend. Measured on macOS: a profile with
|
|
14
|
+
* a syntax error makes `sandbox-exec` exit 65 **without ever running the
|
|
15
|
+
* command**. The write does not happen, no file appears, and a one-sided probe
|
|
16
|
+
* concludes "confined" about a backend that cannot confine anything. It would
|
|
17
|
+
* then report `available`, and every downstream permission decision would
|
|
18
|
+
* inherit that lie -- precisely the failure this requirement exists to prevent.
|
|
19
|
+
*
|
|
20
|
+
* So every probe carries a positive control as well as a negative one:
|
|
21
|
+
*
|
|
22
|
+
* | control | probe | proves |
|
|
23
|
+
* |----------|----------------------------------|---------------------------------|
|
|
24
|
+
* | positive | write *inside* the allowlist | the sandbox ran the command |
|
|
25
|
+
* | negative | write *outside* the allowlist | writes are actually confined |
|
|
26
|
+
* | positive | loopback connect, network **on** | the network probe can connect |
|
|
27
|
+
* | negative | loopback connect, network **off**| the network is actually cut |
|
|
28
|
+
* | negative | exec a setuid-root binary | privileges cannot be acquired |
|
|
29
|
+
*
|
|
30
|
+
* A broken profile fails the positive controls. An over-permissive profile
|
|
31
|
+
* (`(allow default)` and nothing else) fails the negative ones. Both answer
|
|
32
|
+
* `unavailable`. There is no third outcome.
|
|
33
|
+
*
|
|
34
|
+
* ## The privilege-escalation probe, and what it is actually worth
|
|
35
|
+
*
|
|
36
|
+
* `SandboxPolicy.allowPrivilegeEscalation` is typed as the literal `false`
|
|
37
|
+
* precisely because it is an invariant no caller may widen -- yet the self-test
|
|
38
|
+
* used to grant `available` without testing it at all, and `linux.ts` leans on
|
|
39
|
+
* this self-test as its entire safety argument. So the probe now attempts the
|
|
40
|
+
* escalation from inside the throwaway sandbox and reports two facts:
|
|
41
|
+
*
|
|
42
|
+
* - **`privilegeEscalation`** -- it locates a setuid-root binary on the host
|
|
43
|
+
* (`sudo`, then `su`) and executes it. Three outcomes matter:
|
|
44
|
+
* `escalated:*` (it acquired uid 0 -- an outright failure), `exec-refused:*`
|
|
45
|
+
* (the kernel refused to `exec` a setuid binary from inside the sandbox), and
|
|
46
|
+
* `ran:*` (it executed but did not acquire privileges).
|
|
47
|
+
* - **`noNewPrivs`** -- on Linux, `NoNewPrivs` from `/proc/self/status`. `1` is
|
|
48
|
+
* the kernel's own guarantee that no `exec` can gain privileges, which is
|
|
49
|
+
* exactly the mechanism `linux.ts` claims bubblewrap gives it (and that
|
|
50
|
+
* Landlock requires); `not-linux` elsewhere.
|
|
51
|
+
*
|
|
52
|
+
* The verdict is fail-closed and requires *evidence*, not absence of failure:
|
|
53
|
+
* `escalated:*` and `NoNewPrivs: 0` are failures, and a pass needs either
|
|
54
|
+
* `exec-refused:*` or `NoNewPrivs: 1`. A bare `ran:*` is deliberately **not**
|
|
55
|
+
* enough -- on a host where the user simply has no `sudo` rights, an entirely
|
|
56
|
+
* unconfined process produces the same `ran:*`, which is the one-sided-probe
|
|
57
|
+
* mistake this module already refuses to make elsewhere.
|
|
58
|
+
*
|
|
59
|
+
* Measured on macOS 25.5: `exec` of `/usr/bin/sudo` from inside *any* seatbelt
|
|
60
|
+
* sandbox fails `EPERM` (`exec-refused:EPERM`), while the same `exec` outside
|
|
61
|
+
* one succeeds -- so on darwin the negative control has a real positive control
|
|
62
|
+
* behind it. On Linux under bubblewrap the evidence is `NoNewPrivs: 1`; the
|
|
63
|
+
* `unshare` fallback establishes neither and therefore reports `unavailable`,
|
|
64
|
+
* which is the fail-closed reading of an invariant that backend cannot show it
|
|
65
|
+
* holds.
|
|
66
|
+
*
|
|
67
|
+
* ## Evidence comes from outside the sandbox
|
|
68
|
+
*
|
|
69
|
+
* The probe reports what it observed, but the probe runs inside the thing under
|
|
70
|
+
* test, so its word alone is not evidence. Every negative control is confirmed
|
|
71
|
+
* from the parent: the file the probe was told to create must not exist on disk
|
|
72
|
+
* afterwards, and the loopback listener -- a real server in this process -- must
|
|
73
|
+
* not have accepted a connection. A backend that lets a write through but
|
|
74
|
+
* garbles its own stderr still fails.
|
|
75
|
+
*
|
|
76
|
+
* ## Why network is probed even for a network-on session
|
|
77
|
+
*
|
|
78
|
+
* The self-test runs once per backend instance and covers both axes, so the
|
|
79
|
+
* cached answer is valid for any policy the session later uses. If network-off
|
|
80
|
+
* enforcement is broken while write confinement works, the backend reports
|
|
81
|
+
* `unavailable` even for sessions that would have run with network on. That is
|
|
82
|
+
* deliberately conservative: `available` is a claim about the backend, and half
|
|
83
|
+
* a backend is not one.
|
|
84
|
+
*/
|
|
85
|
+
import type { SandboxStatus } from "./executor.ts";
|
|
86
|
+
import { type SandboxPolicy } from "./policy.ts";
|
|
87
|
+
/**
|
|
88
|
+
* Runs one command through the backend under test and returns its exit code and
|
|
89
|
+
* combined output. Backends pass their own `exec` here so the self-test and
|
|
90
|
+
* production execution cannot drift apart.
|
|
91
|
+
*/
|
|
92
|
+
export type SandboxSelfTestRunner = (command: string, cwd: string, policy: SandboxPolicy, timeoutSeconds: number) => Promise<{
|
|
93
|
+
exitCode: number | null;
|
|
94
|
+
output: string;
|
|
95
|
+
}>;
|
|
96
|
+
export interface SandboxSelfTestOptions {
|
|
97
|
+
/** Backend name, used only to make the failure reason say who failed. */
|
|
98
|
+
backendName: string;
|
|
99
|
+
run: SandboxSelfTestRunner;
|
|
100
|
+
/** Seconds. Defaults to 30. */
|
|
101
|
+
timeoutSeconds?: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Runs the self-test in a throwaway sandbox and returns the status the backend
|
|
105
|
+
* may report. Never throws: any error is itself a failed self-test, and a
|
|
106
|
+
* self-test that blew up is not one that passed.
|
|
107
|
+
*/
|
|
108
|
+
export declare function runSandboxSelfTest(options: SandboxSelfTestOptions): Promise<SandboxStatus>;
|
|
109
|
+
//# sourceMappingURL=self-test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self-test.d.ts","sourceRoot":"","sources":["../../../src/core/sandbox/self-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAA0B,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AA2HzE;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,CACnC,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,MAAM,KAClB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACtC,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,qBAAqB,CAAC;IAC3B,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AA8DD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,aAAa,CAAC,CA8IhG"}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup self-test (R44-SBX.4) -- the only thing that may report `available`.
|
|
3
|
+
*
|
|
4
|
+
* Phase 28 established the pattern: prove the sandbox holds before trusting it
|
|
5
|
+
* (`packages/rlm/src/session.ts` sends a `self_test` message and refuses the
|
|
6
|
+
* session unless the driver reports network and file reads actually blocked).
|
|
7
|
+
* This is the same idea applied to a shell backend, with one addition that
|
|
8
|
+
* turned out to matter more than the original probe.
|
|
9
|
+
*
|
|
10
|
+
* ## Why the probe is two-sided
|
|
11
|
+
*
|
|
12
|
+
* The obvious self-test -- "try to write outside the allowlist, expect failure"
|
|
13
|
+
* -- passes for the *worst possible* backend. Measured on macOS: a profile with
|
|
14
|
+
* a syntax error makes `sandbox-exec` exit 65 **without ever running the
|
|
15
|
+
* command**. The write does not happen, no file appears, and a one-sided probe
|
|
16
|
+
* concludes "confined" about a backend that cannot confine anything. It would
|
|
17
|
+
* then report `available`, and every downstream permission decision would
|
|
18
|
+
* inherit that lie -- precisely the failure this requirement exists to prevent.
|
|
19
|
+
*
|
|
20
|
+
* So every probe carries a positive control as well as a negative one:
|
|
21
|
+
*
|
|
22
|
+
* | control | probe | proves |
|
|
23
|
+
* |----------|----------------------------------|---------------------------------|
|
|
24
|
+
* | positive | write *inside* the allowlist | the sandbox ran the command |
|
|
25
|
+
* | negative | write *outside* the allowlist | writes are actually confined |
|
|
26
|
+
* | positive | loopback connect, network **on** | the network probe can connect |
|
|
27
|
+
* | negative | loopback connect, network **off**| the network is actually cut |
|
|
28
|
+
* | negative | exec a setuid-root binary | privileges cannot be acquired |
|
|
29
|
+
*
|
|
30
|
+
* A broken profile fails the positive controls. An over-permissive profile
|
|
31
|
+
* (`(allow default)` and nothing else) fails the negative ones. Both answer
|
|
32
|
+
* `unavailable`. There is no third outcome.
|
|
33
|
+
*
|
|
34
|
+
* ## The privilege-escalation probe, and what it is actually worth
|
|
35
|
+
*
|
|
36
|
+
* `SandboxPolicy.allowPrivilegeEscalation` is typed as the literal `false`
|
|
37
|
+
* precisely because it is an invariant no caller may widen -- yet the self-test
|
|
38
|
+
* used to grant `available` without testing it at all, and `linux.ts` leans on
|
|
39
|
+
* this self-test as its entire safety argument. So the probe now attempts the
|
|
40
|
+
* escalation from inside the throwaway sandbox and reports two facts:
|
|
41
|
+
*
|
|
42
|
+
* - **`privilegeEscalation`** -- it locates a setuid-root binary on the host
|
|
43
|
+
* (`sudo`, then `su`) and executes it. Three outcomes matter:
|
|
44
|
+
* `escalated:*` (it acquired uid 0 -- an outright failure), `exec-refused:*`
|
|
45
|
+
* (the kernel refused to `exec` a setuid binary from inside the sandbox), and
|
|
46
|
+
* `ran:*` (it executed but did not acquire privileges).
|
|
47
|
+
* - **`noNewPrivs`** -- on Linux, `NoNewPrivs` from `/proc/self/status`. `1` is
|
|
48
|
+
* the kernel's own guarantee that no `exec` can gain privileges, which is
|
|
49
|
+
* exactly the mechanism `linux.ts` claims bubblewrap gives it (and that
|
|
50
|
+
* Landlock requires); `not-linux` elsewhere.
|
|
51
|
+
*
|
|
52
|
+
* The verdict is fail-closed and requires *evidence*, not absence of failure:
|
|
53
|
+
* `escalated:*` and `NoNewPrivs: 0` are failures, and a pass needs either
|
|
54
|
+
* `exec-refused:*` or `NoNewPrivs: 1`. A bare `ran:*` is deliberately **not**
|
|
55
|
+
* enough -- on a host where the user simply has no `sudo` rights, an entirely
|
|
56
|
+
* unconfined process produces the same `ran:*`, which is the one-sided-probe
|
|
57
|
+
* mistake this module already refuses to make elsewhere.
|
|
58
|
+
*
|
|
59
|
+
* Measured on macOS 25.5: `exec` of `/usr/bin/sudo` from inside *any* seatbelt
|
|
60
|
+
* sandbox fails `EPERM` (`exec-refused:EPERM`), while the same `exec` outside
|
|
61
|
+
* one succeeds -- so on darwin the negative control has a real positive control
|
|
62
|
+
* behind it. On Linux under bubblewrap the evidence is `NoNewPrivs: 1`; the
|
|
63
|
+
* `unshare` fallback establishes neither and therefore reports `unavailable`,
|
|
64
|
+
* which is the fail-closed reading of an invariant that backend cannot show it
|
|
65
|
+
* holds.
|
|
66
|
+
*
|
|
67
|
+
* ## Evidence comes from outside the sandbox
|
|
68
|
+
*
|
|
69
|
+
* The probe reports what it observed, but the probe runs inside the thing under
|
|
70
|
+
* test, so its word alone is not evidence. Every negative control is confirmed
|
|
71
|
+
* from the parent: the file the probe was told to create must not exist on disk
|
|
72
|
+
* afterwards, and the loopback listener -- a real server in this process -- must
|
|
73
|
+
* not have accepted a connection. A backend that lets a write through but
|
|
74
|
+
* garbles its own stderr still fails.
|
|
75
|
+
*
|
|
76
|
+
* ## Why network is probed even for a network-on session
|
|
77
|
+
*
|
|
78
|
+
* The self-test runs once per backend instance and covers both axes, so the
|
|
79
|
+
* cached answer is valid for any policy the session later uses. If network-off
|
|
80
|
+
* enforcement is broken while write confinement works, the backend reports
|
|
81
|
+
* `unavailable` even for sessions that would have run with network on. That is
|
|
82
|
+
* deliberately conservative: `available` is a claim about the backend, and half
|
|
83
|
+
* a backend is not one.
|
|
84
|
+
*/
|
|
85
|
+
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
86
|
+
import { createServer } from "node:net";
|
|
87
|
+
import { tmpdir } from "node:os";
|
|
88
|
+
import { join } from "node:path";
|
|
89
|
+
import { SANDBOX_POLICY_VERSION } from "./policy.js";
|
|
90
|
+
import { resolveRealPath } from "./real-path.js";
|
|
91
|
+
/** Prefixes the probe's single result line so it survives interleaved tool output. */
|
|
92
|
+
const PROBE_MARKER = "__DRAHT_SANDBOX_PROBE__";
|
|
93
|
+
const PROBE_CONNECT_TIMEOUT_MS = 3_000;
|
|
94
|
+
/** Seconds. Generous: a cold `sandbox-exec` + node start on a loaded machine is still far under this. */
|
|
95
|
+
const DEFAULT_PROBE_TIMEOUT_SECONDS = 30;
|
|
96
|
+
/**
|
|
97
|
+
* The probe. Written to disk outside the writable area (so reaching it also
|
|
98
|
+
* exercises read allow-all) and run through the backend's real `exec` path --
|
|
99
|
+
* same wrapper, same profile generation, same env -- because a self-test that
|
|
100
|
+
* takes a different path than production tests a different thing.
|
|
101
|
+
*
|
|
102
|
+
* Node rather than shell built-ins: `process.execPath` is guaranteed present and
|
|
103
|
+
* its behaviour does not vary with which `sh` the host resolved, so a "blocked"
|
|
104
|
+
* verdict is never really "this shell has no `/dev/tcp`".
|
|
105
|
+
*/
|
|
106
|
+
const PROBE_SOURCE = `import { writeFileSync, readFileSync, statSync } from "node:fs";
|
|
107
|
+
import { spawnSync } from "node:child_process";
|
|
108
|
+
import { connect } from "node:net";
|
|
109
|
+
|
|
110
|
+
const config = JSON.parse(readFileSync(process.argv[2], "utf8"));
|
|
111
|
+
const result = {
|
|
112
|
+
insideWrite: "not-attempted",
|
|
113
|
+
outsideWrite: "not-attempted",
|
|
114
|
+
loopback: "not-attempted",
|
|
115
|
+
privilegeEscalation: "not-attempted",
|
|
116
|
+
noNewPrivs: "not-attempted",
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function attempt(file) {
|
|
120
|
+
try {
|
|
121
|
+
writeFileSync(file, "probe");
|
|
122
|
+
return "wrote";
|
|
123
|
+
} catch (err) {
|
|
124
|
+
return "blocked:" + (err.code ?? err.message);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Binaries whose whole purpose is to run as another user. Only ones we can invoke harmlessly. */
|
|
129
|
+
const SETUID_CANDIDATES = ["/usr/bin/sudo", "/bin/sudo", "/usr/local/bin/sudo", "/usr/bin/su", "/bin/su"];
|
|
130
|
+
|
|
131
|
+
function findSetuidRoot() {
|
|
132
|
+
const found = [];
|
|
133
|
+
for (const path of SETUID_CANDIDATES) {
|
|
134
|
+
try {
|
|
135
|
+
const stat = statSync(path);
|
|
136
|
+
if (stat.uid === 0 && (stat.mode & 0o4000) !== 0) found.push(path);
|
|
137
|
+
} catch {}
|
|
138
|
+
}
|
|
139
|
+
return found;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function attemptEscalation() {
|
|
143
|
+
const found = findSetuidRoot();
|
|
144
|
+
if (found.length === 0) return "no-setuid-root-binary";
|
|
145
|
+
const sudo = found.find((path) => path.endsWith("/sudo"));
|
|
146
|
+
const bin = sudo ?? found[0];
|
|
147
|
+
// -n never prompts, so this cannot hang on a password. A printed uid of 0 means
|
|
148
|
+
// the escalation actually happened, which is the thing being detected.
|
|
149
|
+
const args = sudo ? ["-n", "id", "-u"] : ["--version"];
|
|
150
|
+
let run;
|
|
151
|
+
try {
|
|
152
|
+
run = spawnSync(bin, args, { encoding: "utf8", timeout: 5000, stdio: ["ignore", "pipe", "pipe"] });
|
|
153
|
+
} catch (err) {
|
|
154
|
+
return "attempt-failed:" + (err.code ?? err.message);
|
|
155
|
+
}
|
|
156
|
+
if (run.error) {
|
|
157
|
+
const code = run.error.code ?? run.error.message;
|
|
158
|
+
// EPERM/EACCES at exec time is the sandbox refusing to run a setuid binary.
|
|
159
|
+
if (code === "EPERM" || code === "EACCES") return "exec-refused:" + code;
|
|
160
|
+
return "attempt-failed:" + code;
|
|
161
|
+
}
|
|
162
|
+
if (sudo && run.status === 0 && (run.stdout ?? "").trim() === "0") return "escalated:euid=0";
|
|
163
|
+
return "ran:" + bin + ":exit=" + run.status;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function readNoNewPrivs() {
|
|
167
|
+
if (process.platform !== "linux") return "not-linux";
|
|
168
|
+
try {
|
|
169
|
+
const match = /^NoNewPrivs:\\s*(\\d+)/m.exec(readFileSync("/proc/self/status", "utf8"));
|
|
170
|
+
return match ? match[1] : "unreported";
|
|
171
|
+
} catch (err) {
|
|
172
|
+
return "unreadable:" + (err.code ?? err.message);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
result.insideWrite = attempt(config.insideFile);
|
|
177
|
+
result.outsideWrite = attempt(config.outsideFile);
|
|
178
|
+
result.privilegeEscalation = attemptEscalation();
|
|
179
|
+
result.noNewPrivs = readNoNewPrivs();
|
|
180
|
+
|
|
181
|
+
result.loopback = await new Promise((resolve) => {
|
|
182
|
+
const socket = connect({ host: "127.0.0.1", port: config.loopbackPort });
|
|
183
|
+
let settled = false;
|
|
184
|
+
const finish = (value) => {
|
|
185
|
+
if (settled) return;
|
|
186
|
+
settled = true;
|
|
187
|
+
socket.destroy();
|
|
188
|
+
resolve(value);
|
|
189
|
+
};
|
|
190
|
+
socket.setTimeout(config.connectTimeoutMs, () => finish("blocked:ETIMEDOUT"));
|
|
191
|
+
socket.once("connect", () => finish("connected"));
|
|
192
|
+
socket.once("error", (err) => finish("blocked:" + (err.code ?? err.message)));
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
process.stdout.write("\\n" + config.marker + JSON.stringify(result) + "\\n");
|
|
196
|
+
`;
|
|
197
|
+
/** Single-quoted shell word: the only character needing care inside `'...'` is `'` itself. */
|
|
198
|
+
function shellQuote(value) {
|
|
199
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
200
|
+
}
|
|
201
|
+
function probePolicy(writeRoot, network) {
|
|
202
|
+
return Object.freeze({
|
|
203
|
+
version: SANDBOX_POLICY_VERSION,
|
|
204
|
+
writePaths: Object.freeze([writeRoot]),
|
|
205
|
+
read: "allow-all",
|
|
206
|
+
network,
|
|
207
|
+
allowPrivilegeEscalation: false,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function parseReport(output) {
|
|
211
|
+
const index = output.lastIndexOf(PROBE_MARKER);
|
|
212
|
+
if (index === -1)
|
|
213
|
+
return null;
|
|
214
|
+
const line = output.slice(index + PROBE_MARKER.length).split("\n", 1)[0];
|
|
215
|
+
try {
|
|
216
|
+
const parsed = JSON.parse(line ?? "");
|
|
217
|
+
if (parsed && typeof parsed === "object")
|
|
218
|
+
return parsed;
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function unavailable(backendName, detail) {
|
|
226
|
+
return { available: false, reason: `${backendName} sandbox self-test failed: ${detail}` };
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The `allowPrivilegeEscalation: false` invariant, checked against what the probe
|
|
230
|
+
* actually observed. Returns the failure detail, or `null` when the invariant is
|
|
231
|
+
* demonstrated. See the module doc for why `ran:*` on its own is not evidence.
|
|
232
|
+
*/
|
|
233
|
+
function privilegeEscalationFailure(report) {
|
|
234
|
+
const escalation = report.privilegeEscalation;
|
|
235
|
+
const noNewPrivs = report.noNewPrivs;
|
|
236
|
+
if (escalation === undefined || noNewPrivs === undefined || escalation === "not-attempted") {
|
|
237
|
+
// Positive control for this probe: an older or garbled probe that never ran
|
|
238
|
+
// the escalation attempt must not be read as "escalation is impossible".
|
|
239
|
+
return `the probe did not report a privilege-escalation attempt (privilegeEscalation: ${JSON.stringify(escalation)}), so the allowPrivilegeEscalation invariant was not tested`;
|
|
240
|
+
}
|
|
241
|
+
if (escalation.startsWith("escalated")) {
|
|
242
|
+
return `a setuid-root binary acquired privileges inside the sandbox (${escalation}), so the allowPrivilegeEscalation invariant does not hold`;
|
|
243
|
+
}
|
|
244
|
+
if (noNewPrivs === "0") {
|
|
245
|
+
return "the kernel reports NoNewPrivs: 0 inside the sandbox, so an exec can still gain privileges through a setuid binary";
|
|
246
|
+
}
|
|
247
|
+
const proven = escalation.startsWith("exec-refused:") || noNewPrivs === "1";
|
|
248
|
+
if (!proven) {
|
|
249
|
+
return `the allowPrivilegeEscalation invariant could not be demonstrated (escalation probe: ${escalation}, NoNewPrivs: ${noNewPrivs}) -- the sandbox neither refused to exec a setuid-root binary nor set PR_SET_NO_NEW_PRIVS, so a host that merely lacks sudo rights would look identical`;
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Runs the self-test in a throwaway sandbox and returns the status the backend
|
|
255
|
+
* may report. Never throws: any error is itself a failed self-test, and a
|
|
256
|
+
* self-test that blew up is not one that passed.
|
|
257
|
+
*/
|
|
258
|
+
export async function runSandboxSelfTest(options) {
|
|
259
|
+
const { backendName } = options;
|
|
260
|
+
const timeoutSeconds = options.timeoutSeconds ?? DEFAULT_PROBE_TIMEOUT_SECONDS;
|
|
261
|
+
let root;
|
|
262
|
+
let server;
|
|
263
|
+
try {
|
|
264
|
+
const created = mkdtempSync(join(tmpdir(), "draht-sandbox-selftest-"));
|
|
265
|
+
// Real-path the throwaway root for the same reason R44-SBX.3 real-paths
|
|
266
|
+
// policy paths: on macOS `os.tmpdir()` is `/var/folders/...`, a symlink to
|
|
267
|
+
// `/private/var/folders/...`, and the kernel matches the resolved vnode. An
|
|
268
|
+
// unresolved root here makes the *positive* control fail -- which is how
|
|
269
|
+
// this was found, and a good argument for having a positive control.
|
|
270
|
+
const resolvedRoot = resolveRealPath(created, { base: created });
|
|
271
|
+
if (!resolvedRoot.ok) {
|
|
272
|
+
rmSync(created, { recursive: true, force: true });
|
|
273
|
+
return unavailable(backendName, `could not resolve the throwaway probe directory: ${resolvedRoot.reason}`);
|
|
274
|
+
}
|
|
275
|
+
root = resolvedRoot.path;
|
|
276
|
+
const inside = join(root, "inside");
|
|
277
|
+
const outside = join(root, "outside");
|
|
278
|
+
mkdirSync(inside);
|
|
279
|
+
mkdirSync(outside);
|
|
280
|
+
let accepted = 0;
|
|
281
|
+
server = createServer((socket) => {
|
|
282
|
+
accepted += 1;
|
|
283
|
+
socket.destroy();
|
|
284
|
+
});
|
|
285
|
+
const listening = server;
|
|
286
|
+
await new Promise((resolve, reject) => {
|
|
287
|
+
listening.once("error", reject);
|
|
288
|
+
listening.listen(0, "127.0.0.1", resolve);
|
|
289
|
+
});
|
|
290
|
+
const address = listening.address();
|
|
291
|
+
const port = typeof address === "object" && address !== null ? address.port : 0;
|
|
292
|
+
if (port === 0)
|
|
293
|
+
return unavailable(backendName, "could not open a loopback listener for the network probe");
|
|
294
|
+
const probeRoot = root;
|
|
295
|
+
const probeScript = join(probeRoot, "probe.mjs");
|
|
296
|
+
writeFileSync(probeScript, PROBE_SOURCE, { mode: 0o600 });
|
|
297
|
+
/** One phase: writes a fresh config, runs the probe, returns what actually happened. */
|
|
298
|
+
const runPhase = async (phase) => {
|
|
299
|
+
const insideFile = join(inside, `${phase}.txt`);
|
|
300
|
+
const outsideFile = join(outside, `${phase}.txt`);
|
|
301
|
+
const configFile = join(probeRoot, `${phase}.json`);
|
|
302
|
+
writeFileSync(configFile, JSON.stringify({
|
|
303
|
+
insideFile,
|
|
304
|
+
outsideFile,
|
|
305
|
+
loopbackPort: port,
|
|
306
|
+
connectTimeoutMs: PROBE_CONNECT_TIMEOUT_MS,
|
|
307
|
+
marker: PROBE_MARKER,
|
|
308
|
+
}), { mode: 0o600 });
|
|
309
|
+
const connectionsBefore = accepted;
|
|
310
|
+
const command = `${shellQuote(process.execPath)} ${shellQuote(probeScript)} ${shellQuote(configFile)}`;
|
|
311
|
+
const { output } = await options.run(command, inside, probePolicy(inside, phase === "network-off" ? "off" : "on"), timeoutSeconds);
|
|
312
|
+
const report = parseReport(output);
|
|
313
|
+
if (!report) {
|
|
314
|
+
// No marker line means the probe never ran to completion. A broken
|
|
315
|
+
// profile lands here (sandbox-exec exits before exec'ing anything) --
|
|
316
|
+
// the single most important case not to mistake for confinement.
|
|
317
|
+
return unavailable(backendName, `the ${phase} probe never reported a result, so the sandbox could not be shown to run commands at all (output: ${JSON.stringify(output.slice(-400))})`);
|
|
318
|
+
}
|
|
319
|
+
return { report, outsideFile, connectionsBefore };
|
|
320
|
+
};
|
|
321
|
+
// --- Phase 1: network on. Positive controls plus the write negative control.
|
|
322
|
+
const first = await runPhase("network-on");
|
|
323
|
+
if ("available" in first)
|
|
324
|
+
return first;
|
|
325
|
+
if (first.report.insideWrite !== "wrote") {
|
|
326
|
+
return unavailable(backendName, `a write inside the allowlist was rejected (${first.report.insideWrite}) -- the profile does not grant the access the policy describes`);
|
|
327
|
+
}
|
|
328
|
+
if (first.report.outsideWrite === "wrote" || existsSync(first.outsideFile)) {
|
|
329
|
+
return unavailable(backendName, `a write outside the allowlist succeeded (${first.report.outsideWrite}), so the sandbox does not confine writes`);
|
|
330
|
+
}
|
|
331
|
+
if (first.report.loopback !== "connected") {
|
|
332
|
+
return unavailable(backendName, `the loopback probe could not connect with network allowed (${first.report.loopback}), so network confinement cannot be demonstrated either way`);
|
|
333
|
+
}
|
|
334
|
+
if (accepted === first.connectionsBefore) {
|
|
335
|
+
return unavailable(backendName, "the loopback listener saw no connection with network allowed, so the network probe proves nothing");
|
|
336
|
+
}
|
|
337
|
+
const escalationFailure = privilegeEscalationFailure(first.report);
|
|
338
|
+
if (escalationFailure)
|
|
339
|
+
return unavailable(backendName, escalationFailure);
|
|
340
|
+
// --- Phase 2: network off. The network negative control.
|
|
341
|
+
const second = await runPhase("network-off");
|
|
342
|
+
if ("available" in second)
|
|
343
|
+
return second;
|
|
344
|
+
if (second.report.outsideWrite === "wrote" || existsSync(second.outsideFile)) {
|
|
345
|
+
return unavailable(backendName, "a write outside the allowlist succeeded with network off");
|
|
346
|
+
}
|
|
347
|
+
if (second.report.loopback === "connected") {
|
|
348
|
+
return unavailable(backendName, "a loopback connection succeeded while the policy had network off");
|
|
349
|
+
}
|
|
350
|
+
if (accepted !== second.connectionsBefore) {
|
|
351
|
+
return unavailable(backendName, "the loopback listener accepted a connection while the policy had network off, so the network denial does not hold");
|
|
352
|
+
}
|
|
353
|
+
const escalationFailureOff = privilegeEscalationFailure(second.report);
|
|
354
|
+
if (escalationFailureOff)
|
|
355
|
+
return unavailable(backendName, `${escalationFailureOff} (with network off)`);
|
|
356
|
+
return { available: true };
|
|
357
|
+
}
|
|
358
|
+
catch (err) {
|
|
359
|
+
return unavailable(backendName, `the self-test itself failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
360
|
+
}
|
|
361
|
+
finally {
|
|
362
|
+
const openServer = server;
|
|
363
|
+
if (openServer)
|
|
364
|
+
await new Promise((resolve) => openServer.close(() => resolve()));
|
|
365
|
+
if (root)
|
|
366
|
+
rmSync(root, { recursive: true, force: true });
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=self-test.js.map
|