@draht/coding-agent 2026.10.20 → 2026.10.23
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 +138 -0
- package/agents/advisor.md +2 -2
- package/agents/architect.md +11 -33
- package/agents/debugger.md +13 -54
- package/agents/git-committer.md +18 -42
- package/agents/implementer.md +14 -36
- package/agents/investigator.md +12 -63
- package/agents/reviewer.md +16 -44
- package/agents/security-auditor.md +22 -56
- package/agents/spec-reviewer.md +13 -53
- package/agents/verifier.md +14 -33
- package/bin/drahtbank.mjs +4 -0
- package/dist/agents/advisor.md +2 -2
- package/dist/agents/architect.md +11 -33
- package/dist/agents/debugger.md +13 -54
- package/dist/agents/git-committer.md +18 -42
- package/dist/agents/implementer.md +14 -36
- package/dist/agents/investigator.md +12 -63
- package/dist/agents/reviewer.md +16 -44
- package/dist/agents/security-auditor.md +22 -56
- package/dist/agents/spec-reviewer.md +13 -53
- package/dist/agents/verifier.md +14 -33
- package/dist/bundle/chunks/anthropic-messages-VEMVBETR.js +6 -0
- package/dist/bundle/chunks/anthropic.js +1 -1
- package/dist/bundle/chunks/azure-openai-responses-EXUP6SLM.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +23 -20
- package/dist/bundle/chunks/chunk-2MJ6J5N2.js +6 -0
- package/dist/bundle/chunks/chunk-2RI4GIFP.js +166 -0
- package/dist/bundle/chunks/chunk-57PET6SW.js +82 -0
- package/dist/bundle/chunks/chunk-76YNMQ57.js +2 -0
- package/dist/bundle/chunks/chunk-AACPRSR2.js +9 -0
- package/dist/bundle/chunks/chunk-CHRFWNPF.js +1424 -0
- package/dist/bundle/chunks/chunk-CI37W6HM.js +2 -0
- package/dist/bundle/chunks/chunk-CMKX4CSI.js +6 -0
- package/dist/bundle/chunks/chunk-DHZBWXZK.js +16 -0
- package/dist/bundle/chunks/{chunk-D6TMD5Q2.js → chunk-DLVZ3EK7.js} +4 -4
- package/dist/bundle/chunks/chunk-DQ4G4IS4.js +20 -0
- package/dist/bundle/chunks/chunk-FXCTQRNN.js +2 -0
- package/dist/bundle/chunks/chunk-FXLM6UQV.js +2 -0
- package/dist/bundle/chunks/chunk-ITP6IDBA.js +20 -0
- package/dist/bundle/chunks/chunk-JRHPLIE5.js +11 -0
- package/dist/bundle/chunks/chunk-KINQOWAP.js +4 -0
- package/dist/bundle/chunks/{chunk-IWTUBX6V.js → chunk-LK54N67E.js} +5 -2
- package/dist/bundle/chunks/chunk-MBFTIGLS.js +2 -0
- package/dist/bundle/chunks/chunk-QG2WW2SA.js +2 -0
- package/dist/bundle/chunks/{chunk-KPO5375S.js → chunk-RCRGGYLW.js} +1 -1
- package/dist/bundle/chunks/chunk-RGI7SF5G.js +2 -0
- package/dist/bundle/chunks/{chunk-6ZJKIMU7.js → chunk-SYRVFGYE.js} +1 -1
- package/dist/bundle/chunks/chunk-UQSONZLL.js +479 -0
- package/dist/bundle/chunks/chunk-USCN7R2E.js +2 -0
- package/dist/bundle/chunks/chunk-XB4F3WGD.js +132 -0
- package/dist/bundle/chunks/chunk-YSIQCH4Z.js +2 -0
- package/dist/bundle/chunks/chunk-ZRPAOMVB.js +2 -0
- package/dist/bundle/chunks/{cli-PYJB6AQ3.js → cli-LGOE6EXL.js} +6 -6
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-47PK45EQ.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +188 -21
- package/dist/bundle/chunks/execute-ZVQ7ITER.js +31 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-PBPH45HB.js +2 -0
- package/dist/bundle/chunks/google-vertex-ZPCFQNU6.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-EJ5XMSQL.js → llama-cpp-classify-MWIQKGBR.js} +3 -3
- package/dist/bundle/chunks/mistral-conversations-7ODWQ37T.js +5 -0
- package/dist/bundle/chunks/node-BZAVEWJ3.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +1 -1
- package/dist/bundle/chunks/openai-codex-responses-7Y2SP2GS.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +1 -1
- package/dist/bundle/chunks/openai-completions-QNWYJ4H4.js +7 -0
- package/dist/bundle/chunks/openai-decisions-4PKBAPR3.js +5 -0
- package/dist/bundle/chunks/openai-responses-73WU3TQM.js +4 -0
- package/dist/bundle/chunks/opencode-go.js +1 -1
- package/dist/bundle/chunks/openrouter-images-IMWDSQ5F.js +2 -0
- package/dist/bundle/chunks/pi-messages-AMNZ7HKZ.js +8 -0
- package/dist/bundle/chunks/runtime-7BIFTREJ.js +3 -0
- package/dist/bundle/chunks/runtime-MZVF4MP6.js +2 -0
- package/dist/bundle/chunks/settings-manager-QF6DRH5C.js +2 -0
- package/dist/bundle/chunks/typesafe-system-one-AXQRIVVX.js +2 -0
- package/dist/bundle/chunks/virtual-modules-Z4F3ZUX3.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +2 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +30 -8
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/config.d.ts +18 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -6
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +65 -8
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +240 -102
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +20 -13
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +42 -52
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bug-report.d.ts +9 -1
- package/dist/core/bug-report.d.ts.map +1 -1
- package/dist/core/builtins/completion-checks.d.ts +3 -0
- package/dist/core/builtins/completion-checks.d.ts.map +1 -0
- package/dist/core/builtins/completion-checks.js +142 -0
- package/dist/core/builtins/completion-checks.js.map +1 -0
- package/dist/core/builtins/duet.d.ts.map +1 -1
- package/dist/core/builtins/duet.js +7 -5
- package/dist/core/builtins/duet.js.map +1 -1
- package/dist/core/builtins/git-safety.d.ts +3 -0
- package/dist/core/builtins/git-safety.d.ts.map +1 -0
- package/dist/core/builtins/git-safety.js +34 -0
- package/dist/core/builtins/git-safety.js.map +1 -0
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +4 -0
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/client-identity.d.ts +8 -0
- package/dist/core/client-identity.d.ts.map +1 -0
- package/dist/core/client-identity.js +15 -0
- package/dist/core/client-identity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +20 -15
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +6 -0
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +7 -8
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -0
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +23 -17
- package/dist/core/export-html/tool-renderer.d.ts +3 -3
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +5 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +30 -29
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +7 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +6 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +16 -4
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +61 -7
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +2 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/key-id-schema.d.ts +6 -0
- package/dist/core/key-id-schema.d.ts.map +1 -0
- package/dist/core/key-id-schema.js +16 -0
- package/dist/core/key-id-schema.js.map +1 -0
- package/dist/core/keybindings-schema.d.ts +4 -0
- package/dist/core/keybindings-schema.d.ts.map +1 -0
- package/dist/core/keybindings-schema.js +16 -0
- package/dist/core/keybindings-schema.js.map +1 -0
- package/dist/core/keybindings.d.ts +242 -75
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +30 -23
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +22 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +72 -11
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-config.d.ts +1623 -74
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +70 -184
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +4 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +56 -43
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +253 -358
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +19 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +1 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -1
- package/dist/core/nested-tool-calls.js +1 -0
- package/dist/core/nested-tool-calls.js.map +1 -1
- package/dist/core/package-manager.js +3 -3
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/polyphase/keyword.js +1 -1
- package/dist/core/polyphase/keyword.js.map +1 -1
- package/dist/core/polyphase/model-selection.d.ts.map +1 -1
- package/dist/core/polyphase/model-selection.js +15 -7
- package/dist/core/polyphase/model-selection.js.map +1 -1
- package/dist/core/polyphase/workflow/prelude.d.ts +2 -0
- package/dist/core/polyphase/workflow/prelude.d.ts.map +1 -1
- package/dist/core/polyphase/workflow/prelude.js +12 -16
- package/dist/core/polyphase/workflow/prelude.js.map +1 -1
- package/dist/core/polyphase/workflow/runtime.d.ts.map +1 -1
- package/dist/core/polyphase/workflow/runtime.js +2 -1
- package/dist/core/polyphase/workflow/runtime.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +2 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +7 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +13 -0
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +12 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +84 -24
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +7 -4
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +13 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +27 -15
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +65 -0
- package/dist/core/settings-defaults.d.ts.map +1 -0
- package/dist/core/settings-defaults.js +66 -0
- package/dist/core/settings-defaults.js.map +1 -0
- package/dist/core/settings-manager.d.ts +17 -178
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +86 -57
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +269 -0
- package/dist/core/settings-schema.d.ts.map +1 -0
- package/dist/core/settings-schema.js +318 -0
- package/dist/core/settings-schema.js.map +1 -0
- package/dist/core/skills.d.ts +4 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -5
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/grep.d.ts +8 -0
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +19 -7
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +2 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +2 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -10
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +6 -6
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +32 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +20 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +67 -0
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +7 -35
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/edit.d.ts.map +1 -1
- package/dist/core/tools/renderers/edit.js +5 -4
- package/dist/core/tools/renderers/edit.js.map +1 -1
- package/dist/core/tools/renderers/index.d.ts +2 -2
- package/dist/core/tools/renderers/index.d.ts.map +1 -1
- package/dist/core/tools/renderers/index.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +7 -11
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +391 -80
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +3 -1
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/renderer.d.ts +2 -2
- package/dist/extensions/codemode/renderer.d.ts.map +1 -1
- package/dist/extensions/codemode/renderer.js +9 -3
- package/dist/extensions/codemode/renderer.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +22 -21
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +96 -123
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +34 -11
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts.map +1 -1
- package/dist/extensions/mcp/cli.js +27 -33
- package/dist/extensions/mcp/cli.js.map +1 -1
- package/dist/extensions/mcp/config.d.ts +15 -3
- package/dist/extensions/mcp/config.d.ts.map +1 -1
- package/dist/extensions/mcp/config.js +49 -12
- package/dist/extensions/mcp/config.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +4 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +279 -129
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/oauth.d.ts +21 -11
- package/dist/extensions/mcp/oauth.d.ts.map +1 -1
- package/dist/extensions/mcp/oauth.js +166 -45
- package/dist/extensions/mcp/oauth.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +3 -10
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +4 -5
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +7 -7
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +31 -45
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +7 -5
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +87 -29
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/extensions/mcp/ui.d.ts +3 -3
- package/dist/extensions/mcp/ui.d.ts.map +1 -1
- package/dist/extensions/mcp/ui.js +18 -6
- package/dist/extensions/mcp/ui.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts +0 -2
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +2 -4
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/hooks/checks/checks-runtime.cjs +215 -0
- package/dist/hooks/checks/git-safety.cjs +198 -0
- package/dist/hooks/checks/git-safety.d.cts +1 -0
- package/dist/hooks/gsd/draht-post-task.js +78 -39
- package/dist/hooks/gsd/draht-quality-gate.js +210 -122
- package/dist/hooks/gsd/package.json +3 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/auth-url.d.ts +14 -0
- package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
- package/dist/modes/interactive/components/auth-url.js +37 -0
- package/dist/modes/interactive/components/auth-url.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +5 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +17 -14
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +5 -2
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +2 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +5 -2
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +3 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +8 -2
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +3 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +38 -10
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +24 -21
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/radius-login-selector.js +85 -0
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +9 -8
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +5 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +2 -2
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +12 -13
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +32 -45
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +2 -9
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +5 -4
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +43 -48
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +362 -278
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +34 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -0
- package/dist/modes/interactive/program-status-reporter.js +110 -0
- package/dist/modes/interactive/program-status-reporter.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/system-theme.d.ts +2 -1
- package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/system-theme.js +16 -5
- package/dist/modes/interactive/theme/system-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +28 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts +257 -0
- package/dist/modes/interactive/theme/theme-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/dist/modes/interactive/theme/theme-tokens.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +13 -16
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +22 -29
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +26 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/prompts/commands/atomic-commit.md +8 -6
- package/dist/prompts/commands/brainstorm.md +5 -149
- package/dist/prompts/commands/create-verification-skill.md +8 -48
- package/dist/prompts/commands/discuss-phase.md +6 -10
- package/dist/prompts/commands/execute-phase.md +18 -45
- package/dist/prompts/commands/fix.md +16 -128
- package/dist/prompts/commands/grill.md +6 -53
- package/dist/prompts/commands/init-project.md +13 -18
- package/dist/prompts/commands/map-codebase.md +3 -3
- package/dist/prompts/commands/new-project.md +12 -17
- package/dist/prompts/commands/next-milestone.md +4 -8
- package/dist/prompts/commands/orchestrate-loop.md +12 -12
- package/dist/prompts/commands/orchestrate.md +12 -11
- package/dist/prompts/commands/pause-work.md +1 -1
- package/dist/prompts/commands/plan-phase.md +15 -37
- package/dist/prompts/commands/quick.md +11 -64
- package/dist/prompts/commands/resolve-conflicts.md +2 -15
- package/dist/prompts/commands/triage.md +3 -14
- package/dist/prompts/commands/verify-work.md +15 -63
- package/dist/prompts/commands/why.md +18 -118
- package/dist/skills/atomic-reasoning/SKILL.md +6 -105
- package/dist/skills/blast-radius/SKILL.md +1 -1
- package/dist/skills/epistemics/SKILL.md +12 -87
- package/dist/skills/explainers/SKILL.md +1 -1
- package/dist/skills/typescript-discipline/SKILL.md +12 -42
- package/dist/skills/typescript-discipline/references/patterns.md +25 -266
- package/dist/skills/unslop/SKILL.md +14 -105
- package/dist/utils/ansi.d.ts +8 -0
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +30 -11
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js +3 -0
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +18 -12
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/draht-user-agent.d.ts +1 -0
- package/dist/utils/draht-user-agent.d.ts.map +1 -1
- package/dist/utils/draht-user-agent.js +3 -2
- package/dist/utils/draht-user-agent.js.map +1 -1
- package/dist/utils/image-convert.d.ts +12 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +45 -6
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts +12 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -0
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.js +3 -2
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +9 -10
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/output-files.d.ts +15 -0
- package/dist/utils/output-files.d.ts.map +1 -0
- package/dist/utils/output-files.js +30 -0
- package/dist/utils/output-files.js.map +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +43 -13
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +6 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +4 -3
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/cli-integration.md +1 -1
- package/docs/cli.md +30 -26
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +5 -5
- package/docs/containerization.md +1 -1
- package/docs/custom-provider.md +53 -1
- package/docs/docs.json +17 -1
- package/docs/drahtbank.md +163 -0
- package/docs/environment-variables.md +5 -2
- package/docs/extensions.md +143 -13
- package/docs/index.md +1 -1
- package/docs/json.md +3 -3
- package/docs/keybindings.md +9 -5
- package/docs/llama-cpp.md +9 -2
- package/docs/mcp.md +59 -3
- package/docs/message-types.md +22 -4
- package/docs/models-configuration.md +187 -0
- package/docs/models.md +67 -4
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/providers.md +70 -5
- package/docs/sdk.md +1 -1
- package/docs/settings.md +10 -8
- package/docs/terminal-setup.md +14 -0
- package/docs/themes.md +4 -2
- package/docs/tui.md +71 -1
- package/docs/usage.md +1 -1
- package/docs/windows.md +16 -2
- package/eval/drahtbank/adapters.d.mts +35 -0
- package/eval/drahtbank/adapters.mjs +192 -0
- package/eval/drahtbank/bank.d.mts +141 -0
- package/eval/drahtbank/bank.mjs +515 -0
- package/eval/drahtbank/cases-v2.d.mts +28 -0
- package/eval/drahtbank/cases-v2.mjs +164 -0
- package/eval/drahtbank/cases.d.mts +17 -0
- package/eval/drahtbank/cases.mjs +198 -0
- package/eval/drahtbank/cli.mjs +120 -0
- package/eval/drahtbank/grading-v2.d.mts +26 -0
- package/eval/drahtbank/grading-v2.mjs +227 -0
- package/eval/drahtbank/isolated-tools.ts +223 -0
- package/eval/drahtbank/isolation-worker.mjs +53 -0
- package/eval/drahtbank/isolation.d.mts +52 -0
- package/eval/drahtbank/isolation.mjs +345 -0
- package/eval/drahtbank/runtime-checks.d.mts +15 -0
- package/eval/drahtbank/runtime-checks.mjs +187 -0
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/minimal-mode.ts +4 -5
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +6 -2
- package/examples/extensions/subagent/index.ts +4 -6
- package/hooks/checks/checks-runtime.cjs +215 -0
- package/hooks/checks/git-safety.cjs +198 -0
- package/hooks/checks/git-safety.d.cts +1 -0
- package/hooks/gsd/draht-post-task.js +78 -39
- package/hooks/gsd/draht-quality-gate.js +210 -122
- package/hooks/gsd/package.json +3 -0
- package/package.json +21 -16
- package/prompts/commands/atomic-commit.md +8 -6
- package/prompts/commands/brainstorm.md +5 -149
- package/prompts/commands/create-verification-skill.md +8 -48
- package/prompts/commands/discuss-phase.md +6 -10
- package/prompts/commands/execute-phase.md +18 -45
- package/prompts/commands/fix.md +16 -128
- package/prompts/commands/grill.md +6 -53
- package/prompts/commands/init-project.md +13 -18
- package/prompts/commands/map-codebase.md +3 -3
- package/prompts/commands/new-project.md +12 -17
- package/prompts/commands/next-milestone.md +4 -8
- package/prompts/commands/orchestrate-loop.md +12 -12
- package/prompts/commands/orchestrate.md +12 -11
- package/prompts/commands/pause-work.md +1 -1
- package/prompts/commands/plan-phase.md +15 -37
- package/prompts/commands/quick.md +11 -64
- package/prompts/commands/resolve-conflicts.md +2 -15
- package/prompts/commands/triage.md +3 -14
- package/prompts/commands/verify-work.md +15 -63
- package/prompts/commands/why.md +18 -118
- package/schemas/keybindings.schema.json +433 -0
- package/schemas/models.schema.json +1190 -0
- package/schemas/settings.schema.json +849 -0
- package/schemas/theme.schema.json +365 -0
- package/skills/atomic-reasoning/SKILL.md +6 -105
- package/skills/blast-radius/SKILL.md +1 -1
- package/skills/epistemics/SKILL.md +12 -87
- package/skills/explainers/SKILL.md +1 -1
- package/skills/typescript-discipline/SKILL.md +12 -42
- package/skills/typescript-discipline/references/patterns.md +25 -266
- package/skills/unslop/SKILL.md +14 -105
- package/dist/bundle/chunks/anthropic-messages-GAKYXF65.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-ZIXMK6JO.js +0 -2
- package/dist/bundle/chunks/chunk-2E5VODES.js +0 -2
- package/dist/bundle/chunks/chunk-2VAF4XJI.js +0 -146
- package/dist/bundle/chunks/chunk-4TVQYRQY.js +0 -2
- package/dist/bundle/chunks/chunk-7TYCZN4Z.js +0 -137
- package/dist/bundle/chunks/chunk-BXSHCX3G.js +0 -11
- package/dist/bundle/chunks/chunk-GVXA72ZA.js +0 -2
- package/dist/bundle/chunks/chunk-I5OKY6RH.js +0 -11
- package/dist/bundle/chunks/chunk-KU5HAKZL.js +0 -4
- package/dist/bundle/chunks/chunk-MO3SCGBN.js +0 -18
- package/dist/bundle/chunks/chunk-N2QZNJT6.js +0 -65
- package/dist/bundle/chunks/chunk-PGJAHC3R.js +0 -107
- package/dist/bundle/chunks/chunk-QVFELZW2.js +0 -312
- package/dist/bundle/chunks/chunk-RZKPFWMH.js +0 -42
- package/dist/bundle/chunks/chunk-SDRCE6OP.js +0 -2
- package/dist/bundle/chunks/chunk-SVNWI7EV.js +0 -8
- package/dist/bundle/chunks/chunk-TOWVIJ2O.js +0 -1623
- package/dist/bundle/chunks/chunk-XBUEMKIY.js +0 -2
- package/dist/bundle/chunks/chunk-ZA4QNPJY.js +0 -82
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +0 -2
- package/dist/bundle/chunks/execute-6N7T7VLY.js +0 -18
- package/dist/bundle/chunks/google-generative-ai-RPUPQ6PM.js +0 -2
- package/dist/bundle/chunks/google-vertex-EZES5QVQ.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-AOYGU43Y.js +0 -5
- package/dist/bundle/chunks/node-LQ52KV6B.js +0 -16
- package/dist/bundle/chunks/openai-codex-responses-M2Y77JEQ.js +0 -10
- package/dist/bundle/chunks/openai-completions-A4OKYOYV.js +0 -7
- package/dist/bundle/chunks/openai-responses-6IXV53T3.js +0 -3
- package/dist/bundle/chunks/openrouter-images-LYV4NKFM.js +0 -2
- package/dist/bundle/chunks/pi-messages-KKMEUT3Z.js +0 -8
- package/dist/bundle/chunks/runtime-363BOYEO.js +0 -3
- package/dist/bundle/chunks/runtime-D3KV73AE.js +0 -2
- package/dist/bundle/chunks/settings-manager-GEOZJXFQ.js +0 -2
- package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +0 -2
- package/dist/bundle/chunks/virtual-modules-RLC4Y5MX.js +0 -2
- package/dist/core/provider-attribution.d.ts +0 -4
- package/dist/core/provider-attribution.d.ts.map +0 -1
- package/dist/core/provider-attribution.js +0 -72
- package/dist/core/provider-attribution.js.map +0 -1
- package/dist/experimental/micro/api.d.ts +0 -81
- package/dist/experimental/micro/api.d.ts.map +0 -1
- package/dist/experimental/micro/api.js +0 -2
- package/dist/experimental/micro/api.js.map +0 -1
- package/dist/experimental/micro/main.d.ts +0 -3
- package/dist/experimental/micro/main.d.ts.map +0 -1
- package/dist/experimental/micro/main.js +0 -21
- package/dist/experimental/micro/main.js.map +0 -1
- package/dist/experimental/micro/models.d.ts +0 -11
- package/dist/experimental/micro/models.d.ts.map +0 -1
- package/dist/experimental/micro/models.js +0 -95
- package/dist/experimental/micro/models.js.map +0 -1
- package/dist/experimental/micro/runtime.d.ts +0 -12
- package/dist/experimental/micro/runtime.d.ts.map +0 -1
- package/dist/experimental/micro/runtime.js +0 -465
- package/dist/experimental/micro/runtime.js.map +0 -1
- package/dist/experimental/micro/sessions.d.ts +0 -10
- package/dist/experimental/micro/sessions.d.ts.map +0 -1
- package/dist/experimental/micro/sessions.js +0 -41
- package/dist/experimental/micro/sessions.js.map +0 -1
- package/dist/experimental/micro/tools.d.ts +0 -10
- package/dist/experimental/micro/tools.d.ts.map +0 -1
- package/dist/experimental/micro/tools.js +0 -96
- package/dist/experimental/micro/tools.js.map +0 -1
- package/dist/experimental/micro/tui.d.ts +0 -3
- package/dist/experimental/micro/tui.d.ts.map +0 -1
- package/dist/experimental/micro/tui.js +0 -510
- package/dist/experimental/micro/tui.js.map +0 -1
- package/dist/experimental/mini/main.d.ts +0 -7
- package/dist/experimental/mini/main.d.ts.map +0 -1
- package/dist/experimental/mini/main.js +0 -21
- package/dist/experimental/mini/main.js.map +0 -1
- package/dist/experimental/mini/server/entry.d.ts +0 -3
- package/dist/experimental/mini/server/entry.d.ts.map +0 -1
- package/dist/experimental/mini/server/entry.js +0 -11
- package/dist/experimental/mini/server/entry.js.map +0 -1
- package/dist/experimental/mini/server/run.d.ts +0 -13
- package/dist/experimental/mini/server/run.d.ts.map +0 -1
- package/dist/experimental/mini/server/run.js +0 -150
- package/dist/experimental/mini/server/run.js.map +0 -1
- package/dist/experimental/mini/shared/protocol.d.ts +0 -127
- package/dist/experimental/mini/shared/protocol.d.ts.map +0 -1
- package/dist/experimental/mini/shared/protocol.js +0 -13
- package/dist/experimental/mini/shared/protocol.js.map +0 -1
- package/dist/experimental/mini/shared/rpc.d.ts +0 -49
- package/dist/experimental/mini/shared/rpc.d.ts.map +0 -1
- package/dist/experimental/mini/shared/rpc.js +0 -171
- package/dist/experimental/mini/shared/rpc.js.map +0 -1
- package/dist/experimental/mini/shared/transport.d.ts +0 -35
- package/dist/experimental/mini/shared/transport.d.ts.map +0 -1
- package/dist/experimental/mini/shared/transport.js +0 -94
- package/dist/experimental/mini/shared/transport.js.map +0 -1
- package/dist/experimental/mini/tui/run.d.ts +0 -9
- package/dist/experimental/mini/tui/run.d.ts.map +0 -1
- package/dist/experimental/mini/tui/run.js +0 -62
- package/dist/experimental/mini/tui/run.js.map +0 -1
- package/dist/experimental/mini/tui/session.d.ts +0 -26
- package/dist/experimental/mini/tui/session.d.ts.map +0 -1
- package/dist/experimental/mini/tui/session.js +0 -94
- package/dist/experimental/mini/tui/session.js.map +0 -1
- package/dist/experimental/mini/tui/view.d.ts +0 -10
- package/dist/experimental/mini/tui/view.d.ts.map +0 -1
- package/dist/experimental/mini/tui/view.js +0 -461
- package/dist/experimental/mini/tui/view.js.map +0 -1
- package/dist/experimental/mini/worker/entry.d.ts +0 -3
- package/dist/experimental/mini/worker/entry.d.ts.map +0 -1
- package/dist/experimental/mini/worker/entry.js +0 -10
- package/dist/experimental/mini/worker/entry.js.map +0 -1
- package/dist/experimental/mini/worker/lane-service.d.ts +0 -44
- package/dist/experimental/mini/worker/lane-service.d.ts.map +0 -1
- package/dist/experimental/mini/worker/lane-service.js +0 -97
- package/dist/experimental/mini/worker/lane-service.js.map +0 -1
- package/dist/experimental/mini/worker/models-service.d.ts +0 -19
- package/dist/experimental/mini/worker/models-service.d.ts.map +0 -1
- package/dist/experimental/mini/worker/models-service.js +0 -136
- package/dist/experimental/mini/worker/models-service.js.map +0 -1
- package/dist/experimental/mini/worker/run.d.ts +0 -14
- package/dist/experimental/mini/worker/run.d.ts.map +0 -1
- package/dist/experimental/mini/worker/run.js +0 -88
- package/dist/experimental/mini/worker/run.js.map +0 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -85
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -132
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/theme/theme-schema.json +0 -361
|
@@ -1,294 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Boundary and totality patterns
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Parse into a concrete value
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Brand primitives so they can't be mixed up. Validate once at creation; downstream code trusts the type.
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
type AgentId = string & { readonly __brand: "AgentId" };
|
|
11
|
-
|
|
12
|
-
function parseAgentId(input: string): AgentId {
|
|
13
|
-
if (!isUUID(input)) throw new Error(`Invalid agent id: ${input}`);
|
|
14
|
-
return input as AgentId;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function focusAgent(id: AgentId): void {
|
|
18
|
-
/* input is trusted */
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Match the `readonly __brand: 'X'` shape; don't invent a new convention.
|
|
23
|
-
|
|
24
|
-
## Discriminated unions
|
|
25
|
-
|
|
26
|
-
If a bug forces the question "wait, can this combination actually happen?", the type is too loose. Model variants with a literal discriminant: every variant shares the field name and each variant's value is unique, so impossible combos can't be represented.
|
|
27
|
-
|
|
28
|
-
```ts
|
|
29
|
-
// Don't. Boolean + optionals lets contradictory states exist.
|
|
30
|
-
type DiffState = { loading: boolean; diff?: GitDiff; error?: string };
|
|
31
|
-
|
|
32
|
-
// Do. Only valid states exist.
|
|
33
|
-
type DiffState =
|
|
34
|
-
| { kind: "loading" }
|
|
35
|
-
| { kind: "ready"; diff: GitDiff }
|
|
36
|
-
| { kind: "error"; error: string };
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Pick one discriminant name (`kind`, `type`, `tag`) per codebase and stick to it.
|
|
40
|
-
|
|
41
|
-
## Constructive modeling
|
|
42
|
-
|
|
43
|
-
Build the type from parts that are all legal instead of restricting a loose type with runtime checks. Adding is easier than subtracting.
|
|
44
|
-
|
|
45
|
-
Non-empty, via a variadic tuple:
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
type NonEmpty<T> = [T, ...T[]];
|
|
49
|
-
|
|
50
|
-
// Don't: T[] plus a length check every caller must repeat
|
|
51
|
-
function pickWinner(entries: string[]): string {
|
|
52
|
-
if (entries.length === 0) throw new Error("no entries");
|
|
53
|
-
return entries[Math.floor(Math.random() * entries.length)];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Do: an empty value of the type can't exist
|
|
57
|
-
function pickWinner(entries: NonEmpty<string>): string {
|
|
58
|
-
return entries[Math.floor(Math.random() * entries.length)];
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Where a plain `T[]` arrives, narrow once with a guard. The fact then travels in the type:
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
const isNonEmpty = <T>(arr: T[]): arr is NonEmpty<T> => arr.length > 0;
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Even length, as pairs — TypeScript has no refinement types (no `arr.length % 2 === 0` at the type level), and you don't need one:
|
|
69
|
-
|
|
70
|
-
```ts
|
|
71
|
-
type Pairs<T> = [T, T][];
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
A time range, as start plus duration:
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
// Don't: a comment holds the invariant
|
|
78
|
-
type TimeRange = { start: Date; end: Date }; // start <= end
|
|
79
|
-
|
|
80
|
-
// Do: a negative range can't be written; derive end when needed
|
|
81
|
-
type TimeRange = { start: Date; durationMs: number };
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Keep `durationMs` a plain number; brand it (per Branded types) only if a raw number could plausibly be passed where a duration is expected, not by reflex. A `Pairs<T>` is an even-length list under the interpretation you give it, the same way `{ start, durationMs }` is a range. Pick the representation that makes the bad state unconstructable, then expose the reading you need on top (`pairs.flat()`, a `rangeEnd()` helper).
|
|
85
|
-
|
|
86
|
-
## Simplest total type
|
|
87
|
-
|
|
88
|
-
Don't strengthen everything. Keep `T[]` while every operation on it is total:
|
|
89
|
-
|
|
90
|
-
```ts
|
|
91
|
-
const sum = (xs: number[]) => xs.reduce((a, b) => a + b, 0); // [] is 0, fine
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Strengthen when the loose type forces a lie at a use site. The tells are `!`, `arr[0] as T`, and a "should never happen" throw:
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
// Don't: partiality smuggled past the compiler
|
|
98
|
-
function newestSession(sessions: Session[]): Session {
|
|
99
|
-
return sessions.at(0)!;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Do: strengthen the input; the assertion disappears
|
|
103
|
-
function newestSession(sessions: NonEmpty<Session>): Session {
|
|
104
|
-
return sessions[0];
|
|
105
|
-
}
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Weakening the result to `Session | undefined` is the other total signature. Either way the empty case lands at the call site — the one place that knows what empty means.
|
|
109
|
-
|
|
110
|
-
## `unknown` over `any`
|
|
111
|
-
|
|
112
|
-
`any` disables type checking for everything it touches. External data is always `unknown`; narrow before use.
|
|
5
|
+
Construct the checked shape instead of casting partially checked external input:
|
|
113
6
|
|
|
114
7
|
```ts
|
|
115
|
-
|
|
116
|
-
function handle(input: any) {
|
|
117
|
-
return input.foo.bar;
|
|
118
|
-
}
|
|
8
|
+
type User = { id: string; active: boolean };
|
|
119
9
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
}
|
|
10
|
+
function parseUser(input: unknown): User {
|
|
11
|
+
if (typeof input !== "object" || input === null) throw new Error("expected user");
|
|
12
|
+
if (!("id" in input) || typeof input.id !== "string") throw new Error("expected id");
|
|
13
|
+
if (!("active" in input) || typeof input.active !== "boolean") throw new Error("expected active");
|
|
14
|
+
return { id: input.id, active: input.active };
|
|
125
15
|
}
|
|
126
16
|
```
|
|
127
17
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
## No `as` casts
|
|
18
|
+
Use the project's schema parser when available. Domain validation may be stricter than the TypeScript shape. A duration represented as `number` can still be negative, infinite, or NaN; validate those constraints before constructing a duration type when they matter.
|
|
131
19
|
|
|
132
|
-
|
|
20
|
+
## Strengthen only the needed operation
|
|
133
21
|
|
|
134
22
|
```ts
|
|
135
|
-
|
|
136
|
-
const user = data as User;
|
|
137
|
-
|
|
138
|
-
// Do. Earn the cast at the boundary; the checks narrow via typeof and `in`.
|
|
139
|
-
function parseUser(data: unknown): User {
|
|
140
|
-
if (typeof data !== "object" || data === null) {
|
|
141
|
-
throw new Error("expected object");
|
|
142
|
-
}
|
|
143
|
-
if (!("id" in data) || typeof data.id !== "string") {
|
|
144
|
-
throw new Error("expected string id");
|
|
145
|
-
}
|
|
146
|
-
// ... validate the remaining fields the same way
|
|
147
|
-
return data as User; // earned: every field was checked above
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
When refactoring an `as` out of existing code, identify why the compiler can't infer:
|
|
23
|
+
type NonEmpty<T> = readonly [T, ...T[]];
|
|
152
24
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
- Untyped boundary: add a parse function or schema.
|
|
156
|
-
- Genuinely inexpressible: use a branded type or `satisfies`.
|
|
157
|
-
|
|
158
|
-
## Narrowing hierarchy
|
|
159
|
-
|
|
160
|
-
From best to last-resort:
|
|
161
|
-
|
|
162
|
-
1. **Discriminated union switch / if.** The compiler narrows automatically.
|
|
163
|
-
2. **`in` operator.** `"key" in obj` narrows to the variants containing that key.
|
|
164
|
-
3. **`typeof` / `instanceof`.** For primitives and class instances.
|
|
165
|
-
4. **User-defined type guard.** When the above aren't enough.
|
|
166
|
-
5. **`as` cast.** Only after validation.
|
|
167
|
-
|
|
168
|
-
```ts
|
|
169
|
-
function area(s: Shape): number {
|
|
170
|
-
if ("radius" in s) return Math.PI * s.radius ** 2; // narrowed to circle
|
|
171
|
-
return s.width * s.height; // narrowed to rect
|
|
25
|
+
function first<T>(values: NonEmpty<T>): T {
|
|
26
|
+
return values[0];
|
|
172
27
|
}
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Type guards
|
|
176
28
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```ts
|
|
180
|
-
function isCircle(s: Shape): s is Shape & { kind: "circle" } {
|
|
181
|
-
return s.kind === "circle";
|
|
29
|
+
function sum(values: readonly number[]): number {
|
|
30
|
+
return values.reduce((total, value) => total + value, 0);
|
|
182
31
|
}
|
|
183
32
|
```
|
|
184
33
|
|
|
185
|
-
|
|
34
|
+
A `NonEmpty<T>` proves index zero exists. A random or computed index still needs bounds reasoning; a tuple does not make every numeric lookup safe. Returning `T | undefined` is appropriate when absence is part of the caller's contract.
|
|
186
35
|
|
|
187
36
|
## Exhaustiveness
|
|
188
37
|
|
|
189
|
-
In default arms, assign the discriminant to a `never`-typed local. The compiler errors if a new variant is added without handling.
|
|
190
|
-
|
|
191
38
|
```ts
|
|
192
|
-
|
|
193
|
-
function area(s: Shape): number {
|
|
194
|
-
switch (s.kind) {
|
|
195
|
-
case "circle":
|
|
196
|
-
return Math.PI * s.radius ** 2;
|
|
197
|
-
case "rect":
|
|
198
|
-
return s.width * s.height;
|
|
199
|
-
default: {
|
|
200
|
-
const _exhaustive: never = s;
|
|
201
|
-
return _exhaustive;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
39
|
+
type Result = { kind: "ok"; value: string } | { kind: "error"; message: string };
|
|
205
40
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
case "
|
|
210
|
-
drawCircle(s);
|
|
211
|
-
break;
|
|
212
|
-
case "rect":
|
|
213
|
-
drawRect(s);
|
|
214
|
-
break;
|
|
41
|
+
function describe(result: Result): string {
|
|
42
|
+
switch (result.kind) {
|
|
43
|
+
case "ok": return result.value;
|
|
44
|
+
case "error": return result.message;
|
|
215
45
|
default: {
|
|
216
|
-
const
|
|
217
|
-
|
|
46
|
+
const exhaustive: never = result;
|
|
47
|
+
return exhaustive;
|
|
218
48
|
}
|
|
219
49
|
}
|
|
220
50
|
}
|
|
221
51
|
```
|
|
222
52
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
## `satisfies` over `as`
|
|
226
|
-
|
|
227
|
-
`satisfies` validates without widening literal types.
|
|
228
|
-
|
|
229
|
-
```ts
|
|
230
|
-
// Don't. Widens, loses literal types.
|
|
231
|
-
const config = { theme: "dark", cols: 3 } as Config;
|
|
232
|
-
|
|
233
|
-
// Do. Validates AND preserves literal types.
|
|
234
|
-
const config = { theme: "dark", cols: 3 } satisfies Config;
|
|
235
|
-
// config.theme is "dark" (literal), not string
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Boundary validation
|
|
239
|
-
|
|
240
|
-
Validate once where data crosses in; trust types inside. Scattered validation is noisy, redundant, and gives a false sense of safety.
|
|
241
|
-
|
|
242
|
-
- **At boundaries** (CLI args, config files, env vars, network payloads, database rows): parse into a named domain type, return errors, handle defensively.
|
|
243
|
-
- **Inside the system:** typed data, error propagation, no re-validation. No redundant null checks deep in call chains when the boundary already validated.
|
|
244
|
-
- **Across the boundary:** expose domain concepts, not the wire format — don't re-export transport, storage, or framework types through the public surface.
|
|
245
|
-
- **Wire formats** (proto, JSON-RPC): parse with unknown fields ignored so forward-compatible changes don't break old clients. **Persisted JSON:** versioned blob with a try/catch around the parse.
|
|
246
|
-
- Keep business logic in pure functions the boundary shell calls: parse functions as pure transforms from raw bytes to typed state, so the logic tests without the framework.
|
|
247
|
-
|
|
248
|
-
## Schema-derived types
|
|
249
|
-
|
|
250
|
-
When a `.proto`, OpenAPI spec, GraphQL schema, or database migration already defines a shape, derive from the generated types instead of duplicating them.
|
|
251
|
-
|
|
252
|
-
```ts
|
|
253
|
-
// Don't. Duplicate shape, drifts when the schema changes.
|
|
254
|
-
type CheckSummary = {
|
|
255
|
-
totalCount: number;
|
|
256
|
-
checks: { name: string; status: string }[];
|
|
257
|
-
};
|
|
258
|
-
function renderChecks(s: CheckSummary) {
|
|
259
|
-
/* ... */
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// Do. Derive from the generated schema type.
|
|
263
|
-
import type { ChecksMessage } from "<generated module>";
|
|
264
|
-
function renderChecks(s: Pick<ChecksMessage, "totalCount" | "checks">) {
|
|
265
|
-
/* ... */
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Reach for `Pick`, `Omit`, `Parameters`, `ReturnType`, `Awaited`, `typeof` before writing a new interface.
|
|
270
|
-
|
|
271
|
-
## Object args
|
|
272
|
-
|
|
273
|
-
```ts
|
|
274
|
-
// Don't. Swap two args, still compiles.
|
|
275
|
-
openFile(uri, {
|
|
276
|
-
startLineNumber: 10,
|
|
277
|
-
startColumn: 1,
|
|
278
|
-
endLineNumber: 10,
|
|
279
|
-
endColumn: 1,
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// Do. Order-independent, self-documenting.
|
|
283
|
-
openFile({
|
|
284
|
-
uri,
|
|
285
|
-
selection: {
|
|
286
|
-
startLineNumber: 10,
|
|
287
|
-
startColumn: 1,
|
|
288
|
-
endLineNumber: 10,
|
|
289
|
-
endColumn: 1,
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
Skip on hot paths: per-frame render, tokenizers, parsers, anything in a tight loop where the allocation cost matters.
|
|
53
|
+
The `never` assignment makes a newly added unhandled variant a compile error. Match the repository's existing exhaustive-switch convention.
|
|
@@ -1,119 +1,28 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: unslop
|
|
3
|
-
description:
|
|
3
|
+
description: Edit requested prose for clarity, specificity, and the reader's register, including simplified technical instructions when requested.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Unslop
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Apply to prose you are writing or were asked to edit: documentation, reports, handoffs, specs, commit bodies, and client-facing text. Preserve meaning and the author's intended tone. Do not sweep unrelated repository text.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Exclude code, identifiers, code comments, quoted evidence, and user-authored text outside the request. Draht's prompt and skill corpus is outside this skill's scope. Keep fixed formats exact, including conventional commit subjects, `red:`/`green:`/`refactor:`, `STATUS:` lines, frontmatter, and verdict-first reports.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Lead with the concrete fact or action. Name actors, mechanisms, and evidence. Replace promotional claims, vague attribution, filler, repeated conclusions, and unnecessary jargon with specific information or remove them. Preserve established project terminology.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Use familiar words, active verbs, and stable names for the same concept. Vary sentence length when it improves readability. Use lists and headings for structure, not decoration. Keep uncertainty where the evidence requires it; editing for confidence must not turn an inference into a fact.
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Match the register: technical reports need commands, results, and limits; explanatory prose can express a supported opinion and a more personal voice. Do not add artificial warmth or invented anecdotes.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Procedures and simplified technical English
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
2. Rewrite. Preserve meaning and register.
|
|
22
|
-
3. Add voice back — register-aware (see Adding Voice).
|
|
23
|
-
4. Self-audit: ask "What makes this obviously AI generated?" and fix the remaining tells.
|
|
20
|
+
For runbooks, setup instructions, warnings, and requested STE-style text:
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
- Give one action per numbered step and put conditions before the action.
|
|
23
|
+
- Place warnings before the action they protect and explain the concrete consequence.
|
|
24
|
+
- Use consistent terminology and exact command/path/error text.
|
|
25
|
+
- Prefer short sentences; aim for 20 words in procedures and 25 in descriptions.
|
|
26
|
+
- Keep necessary articles and context so brevity does not make instructions ambiguous.
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Content
|
|
30
|
-
|
|
31
|
-
- **Puffery and promotional language.** "pivotal moment", "testament to", "evolving landscape", "groundbreaking", "vibrant", "renowned", "stunning". Cut it; state what happened.
|
|
32
|
-
- **Superficial -ing phrases.** "highlighting...", "ensuring...", "showcasing...", "fostering...". Delete, or expand into a real statement with a real source.
|
|
33
|
-
- **Vague attributions.** "Experts believe", "reports suggest", "some argue". Name the source or delete. In a report this means citing the command or file, not "tests suggest".
|
|
34
|
-
|
|
35
|
-
### Language
|
|
36
|
-
|
|
37
|
-
- **AI vocabulary** (English-calibrated): additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Use the plain word.
|
|
38
|
-
- **Fancy ways to say "is".** "serves as", "stands as", "boasts", "features". Say "is" or "has".
|
|
39
|
-
- **"Not just X, but Y."** State the point directly.
|
|
40
|
-
- **Rule of three.** Ideas forced into groups of three. Use the natural number.
|
|
41
|
-
- **Synonym cycling.** Protagonist, main character, central figure, hero in one paragraph. Pick one term and repeat it — repeating the established name is precision, not monotony.
|
|
42
|
-
- **False ranges.** "from X to Y" where X and Y sit on no meaningful scale. List the items directly.
|
|
43
|
-
|
|
44
|
-
### Style
|
|
45
|
-
|
|
46
|
-
- **Dash moderation.** An em dash is punctuation, not a tell. Three per paragraph is. Do not chain them, do not let dashes replace every comma and period; vary the connective.
|
|
47
|
-
- **Colon crutches.** A colon is for a list or an example, not a mid-sentence connector. Rewrite so the point stands on its own.
|
|
48
|
-
- **Boldface spam.** Don't bold every noun, proper name, or acronym.
|
|
49
|
-
- **Inline-header lists.** The tell is a bold label and colon restating the line. A bold lead-in ending in a period, naming the item, followed by genuinely new detail is fine.
|
|
50
|
-
- **Headings** (English-only rule): sentence case, not title case.
|
|
51
|
-
- **Decorative emojis.** Remove from headings and bullets.
|
|
52
|
-
- **Curly quotes.** Replace with straight quotes.
|
|
53
|
-
|
|
54
|
-
### Communication Artifacts
|
|
55
|
-
|
|
56
|
-
The group most relevant to reports and handoffs.
|
|
57
|
-
|
|
58
|
-
- **Chatbot phrases.** "I hope this helps!", "Let me know if...", "Certainly!", "Found the smoking gun!". Remove.
|
|
59
|
-
- **Cutoff disclaimers.** "While specific details are limited...". Find the fact or drop the sentence.
|
|
60
|
-
- **Sycophancy.** "Great question!", "You're absolutely right!". Respond directly.
|
|
61
|
-
|
|
62
|
-
### Filler
|
|
63
|
-
|
|
64
|
-
- **Filler phrases** (English-calibrated). "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted.
|
|
65
|
-
- **Hedging stacks.** "could potentially possibly be argued that it might" becomes "may".
|
|
66
|
-
- **Generic conclusions.** "The future looks bright." State the specific plan or fact, or end one sentence earlier.
|
|
67
|
-
|
|
68
|
-
### Jargon
|
|
69
|
-
|
|
70
|
-
- **Abstract metaphor nouns.** Substrate, wedge, vector, nexus, bedrock, modality, paradigm, north star, flywheel, endgame. These sound technical but hide a plainer concrete word: "substrate" becomes "base", "wedge in" becomes "add", "north star" / "flywheel" / "endgame" become the plain phrase. Pick the concrete word.
|
|
71
|
-
- **Carve-out.** A term defined in .planning/DOMAIN.md or established in the project's vocabulary is never slop — the ubiquitous-language rule wins over this list.
|
|
72
|
-
|
|
73
|
-
### Plain Speech
|
|
74
|
-
|
|
75
|
-
- **Name the mechanism, not the feeling.** "the database stays close at hand" names a feeling; "a column rename fails the build" names a mechanism. Restate every claim as a concrete instruction, fact, or number — or cut it. If the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it.
|
|
76
|
-
- **One idea per sentence.** If the reader has to backtrack to parse a sentence, split it or drop clauses.
|
|
77
|
-
- **Active voice with a named actor.** "queries are validated" becomes "the compiler validates queries". Passive is fine only when the actor is unknown or genuinely irrelevant.
|
|
78
|
-
- **Cut adverbs, or use the measured number.** "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong.
|
|
79
|
-
- **Prefer the plain word** (English-calibrated). "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if".
|
|
80
|
-
|
|
81
|
-
## Adding Voice
|
|
82
|
-
|
|
83
|
-
Removing patterns is half the job — voiceless prose is just as obviously machine-made. Register decides how much voice returns:
|
|
84
|
-
|
|
85
|
-
- **Docs and READMEs**: have opinions and react to facts instead of neutrally listing pros and cons; vary rhythm (short sentences, then longer ones that take their time); use "I" when it fits; be specific.
|
|
86
|
-
- **Reports, UAT reports, handoffs, client-facing text**: stay factual and concrete. Specificity is the voice there — name the file, the count, the command. No filler warmth, no manufactured mess.
|
|
87
|
-
|
|
88
|
-
## Controlled Register (STE-lite)
|
|
89
|
-
|
|
90
|
-
ASD-STE100 (Simplified Technical English) is a controlled language written for aircraft maintenance manuals. Its full rule set is strict. Going most of the way gives text that a tired or non-native reader can act on without rereading.
|
|
91
|
-
|
|
92
|
-
Use it for procedures, runbooks, setup and fix steps, warnings, and the "next steps" of a handoff. Also use it when the user asks for "STE", "ASD-STE100", "Simplified Technical English", or "make it easier to follow". Do not use it for docs and READMEs that need voice.
|
|
93
|
-
|
|
94
|
-
- **Sentence length.** At most 20 words in a procedure, at most 25 in a description.
|
|
95
|
-
- **One instruction per sentence.** Use the imperative: "Run `npm run check`." not "You should run the check."
|
|
96
|
-
- **Numbered steps, one action each.** Put the condition first: "If the check fails, read the first error."
|
|
97
|
-
- **Warnings before the step they protect.** Start with the instruction, then give the reason: "Do not delete `bun.lock`. The install is no longer reproducible."
|
|
98
|
-
- **One word, one meaning.** Pick one term for one thing and keep it. Terms from `.planning/DOMAIN.md` win.
|
|
99
|
-
- **Active voice, present tense** for descriptions.
|
|
100
|
-
- **Keep the articles.** "Open the file", not "Open file". Telegraphic style is not STE.
|
|
101
|
-
- **Paragraphs** have one topic and at most six sentences.
|
|
102
|
-
- **Technical names stay exact.** Commands, identifiers, paths, and error text are quoted verbatim even when they break the rules above.
|
|
103
|
-
|
|
104
|
-
STE is defined for English. For German text, apply the same limits by analogy: kurze Sätze, Imperativ in Anleitungen, ein Begriff pro Sache, Warnung vor dem Schritt.
|
|
105
|
-
|
|
106
|
-
## German Prose
|
|
107
|
-
|
|
108
|
-
The word lists above are English-calibrated. The discipline generalizes to German by category, not by translated catalog:
|
|
109
|
-
|
|
110
|
-
- **Füllwörter**: "im Grunde genommen", "quasi", "sozusagen" — streichen.
|
|
111
|
-
- **Werbesprache**: "innovativ", "ganzheitlich", "im heutigen digitalen Zeitalter", "spielt eine entscheidende Rolle" — sagen, was passiert ist.
|
|
112
|
-
- **Anglizismen-Slop**: "leveragen", "alignen" where a German word exists — use the German word.
|
|
113
|
-
- "nicht nur X, sondern auch Y" is the "not just X, but Y" tell verbatim: state the point directly.
|
|
114
|
-
- Style and format tells (dash chaining, bold spam, decorative emojis, curly quotes) and communication artifacts (chatbot phrases, disclaimers, sycophancy) are language-independent.
|
|
115
|
-
- The sentence-case-headings rule is English-only — German headings follow German orthography.
|
|
116
|
-
|
|
117
|
-
## Self-Audit
|
|
118
|
-
|
|
119
|
-
Before delivering, ask once more: "What makes this obviously AI generated?" Fix what you find.
|
|
28
|
+
These are practical readability guidelines, not a claim of certified ASD-STE100 compliance. Apply the same clarity principles to German while preserving German grammar and established technical terms.
|
package/dist/utils/ansi.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split streamed text into a part that is safe to pass to stripAnsi now and a trailing
|
|
3
|
+
* unfinished escape sequence that should be prepended to the next chunk.
|
|
4
|
+
*/
|
|
5
|
+
export declare function splitIncompleteAnsiSuffix(value: string): {
|
|
6
|
+
complete: string;
|
|
7
|
+
pending: string;
|
|
8
|
+
};
|
|
1
9
|
export declare function stripAnsi(value: string): string;
|
|
2
10
|
//# sourceMappingURL=ansi.d.ts.map
|
package/dist/utils/ansi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AAkDA;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAW9F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAc/C"}
|
package/dist/utils/ansi.js
CHANGED
|
@@ -25,17 +25,36 @@
|
|
|
25
25
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
* SOFTWARE.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
29
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
30
|
+
// OSC sequences: ESC ] ... ST
|
|
31
|
+
const OSC_START = "\\u001B\\]";
|
|
32
|
+
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :), then final byte
|
|
33
|
+
const CSI_START = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?";
|
|
34
|
+
const CSI_FINAL = "[\\dA-PR-TZcf-nq-uy=><~]";
|
|
35
|
+
// Complete sequences. OSC is non-greedy until the first ST.
|
|
36
|
+
const ansiRegex = new RegExp(`(?:${OSC_START}[\\s\\S]*?${ST})|${CSI_START}${CSI_FINAL}`, "g");
|
|
37
|
+
// Unfinished sequence at the end of the text: OSC without its ST (a trailing ESC may start ESC\),
|
|
38
|
+
// or CSI without its final byte.
|
|
39
|
+
const unfinishedAnsiAtEndRegex = new RegExp(`(?:${OSC_START}(?:[^\\u0007\\u009C\\u001B]|\\u001B(?!\\\\))*|${CSI_START})$`);
|
|
40
|
+
// Longest unfinished sequence held back while streaming. Longer ones are processed as-is.
|
|
41
|
+
const MAX_PENDING_ANSI_LENGTH = 256;
|
|
42
|
+
/**
|
|
43
|
+
* Split streamed text into a part that is safe to pass to stripAnsi now and a trailing
|
|
44
|
+
* unfinished escape sequence that should be prepended to the next chunk.
|
|
45
|
+
*/
|
|
46
|
+
export function splitIncompleteAnsiSuffix(value) {
|
|
47
|
+
if (!value.includes("\u001B") && !value.includes("\u009B")) {
|
|
48
|
+
return { complete: value, pending: "" };
|
|
49
|
+
}
|
|
50
|
+
const windowStart = Math.max(0, value.length - MAX_PENDING_ANSI_LENGTH);
|
|
51
|
+
const match = unfinishedAnsiAtEndRegex.exec(value.slice(windowStart));
|
|
52
|
+
if (!match) {
|
|
53
|
+
return { complete: value, pending: "" };
|
|
54
|
+
}
|
|
55
|
+
const splitAt = windowStart + match.index;
|
|
56
|
+
return { complete: value.slice(0, splitAt), pending: value.slice(splitAt) };
|
|
37
57
|
}
|
|
38
|
-
const regex = ansiRegex();
|
|
39
58
|
export function stripAnsi(value) {
|
|
40
59
|
if (typeof value !== "string") {
|
|
41
60
|
throw new TypeError(`Expected a \`string\`, got \`${typeof value}\``);
|
|
@@ -47,6 +66,6 @@ export function stripAnsi(value) {
|
|
|
47
66
|
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
48
67
|
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
49
68
|
// and doing it manually has a performance penalty.
|
|
50
|
-
return value.replace(
|
|
69
|
+
return value.replace(ansiRegex, "");
|
|
51
70
|
}
|
|
52
71
|
//# sourceMappingURL=ansi.js.map
|
package/dist/utils/ansi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,
|
|
1
|
+
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,4DAA4D;AAC5D,MAAM,EAAE,GAAG,oCAAoC,CAAC;AAEhD,8BAA8B;AAC9B,MAAM,SAAS,GAAG,YAAY,CAAC;AAE/B,uGAAuG;AACvG,MAAM,SAAS,GAAG,4DAA4D,CAAC;AAC/E,MAAM,SAAS,GAAG,0BAA0B,CAAC;AAE7C,4DAA4D;AAC5D,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,MAAM,SAAS,aAAa,EAAE,KAAK,SAAS,GAAG,SAAS,EAAE,EAAE,GAAG,CAAC,CAAC;AAE9F,kGAAkG;AAClG,iCAAiC;AACjC,MAAM,wBAAwB,GAAG,IAAI,MAAM,CAC1C,MAAM,SAAS,iDAAiD,SAAS,IAAI,CAC7E,CAAC;AAEF,0FAA0F;AAC1F,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAa;IACtD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,uBAAuB,CAAC,CAAC;IACxE,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1C,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAa;IACtC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,gCAAgC,OAAO,KAAK,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,sEAAsE;IACtE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACd,CAAC;IAED,2EAA2E;IAC3E,6EAA6E;IAC7E,mDAAmD;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACrC,CAAC","sourcesContent":["/*\n * Portions of this file are derived from:\n * - ansi-regex (https://github.com/chalk/ansi-regex)\n * - strip-ansi (https://github.com/chalk/strip-ansi)\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n// Valid string terminator sequences are BEL, ESC\\, and 0x9c\nconst ST = \"(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)\";\n\n// OSC sequences: ESC ] ... ST\nconst OSC_START = \"\\\\u001B\\\\]\";\n\n// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :), then final byte\nconst CSI_START = \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?\";\nconst CSI_FINAL = \"[\\\\dA-PR-TZcf-nq-uy=><~]\";\n\n// Complete sequences. OSC is non-greedy until the first ST.\nconst ansiRegex = new RegExp(`(?:${OSC_START}[\\\\s\\\\S]*?${ST})|${CSI_START}${CSI_FINAL}`, \"g\");\n\n// Unfinished sequence at the end of the text: OSC without its ST (a trailing ESC may start ESC\\),\n// or CSI without its final byte.\nconst unfinishedAnsiAtEndRegex = new RegExp(\n\t`(?:${OSC_START}(?:[^\\\\u0007\\\\u009C\\\\u001B]|\\\\u001B(?!\\\\\\\\))*|${CSI_START})$`,\n);\n\n// Longest unfinished sequence held back while streaming. Longer ones are processed as-is.\nconst MAX_PENDING_ANSI_LENGTH = 256;\n\n/**\n * Split streamed text into a part that is safe to pass to stripAnsi now and a trailing\n * unfinished escape sequence that should be prepended to the next chunk.\n */\nexport function splitIncompleteAnsiSuffix(value: string): { complete: string; pending: string } {\n\tif (!value.includes(\"\\u001B\") && !value.includes(\"\\u009B\")) {\n\t\treturn { complete: value, pending: \"\" };\n\t}\n\tconst windowStart = Math.max(0, value.length - MAX_PENDING_ANSI_LENGTH);\n\tconst match = unfinishedAnsiAtEndRegex.exec(value.slice(windowStart));\n\tif (!match) {\n\t\treturn { complete: value, pending: \"\" };\n\t}\n\tconst splitAt = windowStart + match.index;\n\treturn { complete: value.slice(0, splitAt), pending: value.slice(splitAt) };\n}\n\nexport function stripAnsi(value: string): string {\n\tif (typeof value !== \"string\") {\n\t\tthrow new TypeError(`Expected a \\`string\\`, got \\`${typeof value}\\``);\n\t}\n\n\t// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer\n\tif (!value.includes(\"\\u001B\") && !value.includes(\"\\u009B\")) {\n\t\treturn value;\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn value.replace(ansiRegex, \"\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard-command.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-command.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GACvE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"clipboard-command.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard-command.ts"],"names":[],"mappings":"AAEA,kFAAkF;AAClF,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GACvE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAuC7B"}
|
|
@@ -3,8 +3,11 @@ import { spawn } from "node:child_process";
|
|
|
3
3
|
export function runClipboardCommand(command, args, options) {
|
|
4
4
|
return new Promise((resolve) => {
|
|
5
5
|
// Clipboard writers can daemonize. Do not give them output pipes to retain.
|
|
6
|
+
// Detach on POSIX so the daemon leaves draht's process group and Ctrl+Z suspend
|
|
7
|
+
// (SIGTSTP to the group) does not stop the clipboard owner (#11179).
|
|
6
8
|
const child = spawn(command, args, {
|
|
7
9
|
stdio: ["pipe", options?.input === undefined ? "pipe" : "ignore", "ignore"],
|
|
10
|
+
detached: process.platform !== "win32",
|
|
8
11
|
windowsHide: true,
|
|
9
12
|
});
|
|
10
13
|
const chunks = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard-command.js","sourceRoot":"","sources":["../../src/utils/clipboard-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAClC,OAAe,EACf,IAAuB,EACvB,OAAyE;IAEzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,4EAA4E;QAC5E,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAClC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC;YAC3E,WAAW,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,MAA0B,EAAQ,EAAE;YACnD,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,GAAS,EAAE;YACxB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACtB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACxB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,SAAS,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC,CAAC;QAC5D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAC1B,IAAI,CAAC,OAAO;gBAAE,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YAC1C,IAAI,OAAO;gBAAE,OAAO;YACpB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;YACvB,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE,cAAc,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;gBAAE,KAAK,EAAE,CAAC;;gBAC/D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,gDAAgD;QACpF,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\n\n/** Undefined means the command failed; an empty buffer is a successful result. */\nexport function runClipboardCommand(\n\tcommand: string,\n\targs: readonly string[],\n\toptions?: { input?: string; timeoutMs?: number; maxBufferBytes?: number },\n): Promise<Buffer | undefined> {\n\treturn new Promise((resolve) => {\n\t\t// Clipboard writers can daemonize. Do not give them output pipes to retain.\n\t\tconst child = spawn(command, args, {\n\t\t\tstdio: [\"pipe\", options?.input === undefined ? \"pipe\" : \"ignore\", \"ignore\"],\n\t\t\twindowsHide: true,\n\t\t});\n\t\tconst chunks: Buffer[] = [];\n\t\tlet length = 0;\n\t\tlet settled = false;\n\t\tconst finish = (result: Buffer | undefined): void => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timer);\n\t\t\tresolve(result);\n\t\t};\n\t\tconst abort = (): void => {\n\t\t\tchild.kill(\"SIGKILL\");\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stdin?.destroy();\n\t\t\tfinish(undefined);\n\t\t};\n\t\tconst timer = setTimeout(abort, options?.timeoutMs ?? 3000);\n\t\tchild.on(\"error\", () => finish(undefined));\n\t\tchild.on(\"close\", (code) => {\n\t\t\tif (!settled) finish(code === 0 ? Buffer.concat(chunks, length) : undefined);\n\t\t});\n\t\tchild.stdout?.on(\"data\", (chunk: Buffer) => {\n\t\t\tif (settled) return;\n\t\t\tlength += chunk.length;\n\t\t\tif (length > (options?.maxBufferBytes ?? 50 * 1024 * 1024)) abort();\n\t\t\telse chunks.push(chunk);\n\t\t});\n\t\tchild.stdin?.on(\"error\", () => {}); // A writer may exit before consuming all input.\n\t\tchild.stdin?.end(options?.input);\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"clipboard-command.js","sourceRoot":"","sources":["../../src/utils/clipboard-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,kFAAkF;AAClF,MAAM,UAAU,mBAAmB,CAClC,OAAe,EACf,IAAuB,EACvB,OAAyE;IAEzE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,4EAA4E;QAC5E,gFAAgF;QAChF,qEAAqE;QACrE,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAClC,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC;YAC3E,QAAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;YACtC,WAAW,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,MAAM,GAAG,CAAC,MAA0B,EAAQ,EAAE;YACnD,IAAI,OAAO;gBAAE,OAAO;YACpB,OAAO,GAAG,IAAI,CAAC;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,GAAS,EAAE;YACxB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACtB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACxB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC;YACvB,MAAM,CAAC,SAAS,CAAC,CAAC;QACnB,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,IAAI,IAAI,CAAC,CAAC;QAC5D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YAC1B,IAAI,CAAC,OAAO;gBAAE,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YAC1C,IAAI,OAAO;gBAAE,OAAO;YACpB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;YACvB,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE,cAAc,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;gBAAE,KAAK,EAAE,CAAC;;gBAC/D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,CAAC,gDAAgD;QACpF,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\n\n/** Undefined means the command failed; an empty buffer is a successful result. */\nexport function runClipboardCommand(\n\tcommand: string,\n\targs: readonly string[],\n\toptions?: { input?: string; timeoutMs?: number; maxBufferBytes?: number },\n): Promise<Buffer | undefined> {\n\treturn new Promise((resolve) => {\n\t\t// Clipboard writers can daemonize. Do not give them output pipes to retain.\n\t\t// Detach on POSIX so the daemon leaves draht's process group and Ctrl+Z suspend\n\t\t// (SIGTSTP to the group) does not stop the clipboard owner (#11179).\n\t\tconst child = spawn(command, args, {\n\t\t\tstdio: [\"pipe\", options?.input === undefined ? \"pipe\" : \"ignore\", \"ignore\"],\n\t\t\tdetached: process.platform !== \"win32\",\n\t\t\twindowsHide: true,\n\t\t});\n\t\tconst chunks: Buffer[] = [];\n\t\tlet length = 0;\n\t\tlet settled = false;\n\t\tconst finish = (result: Buffer | undefined): void => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timer);\n\t\t\tresolve(result);\n\t\t};\n\t\tconst abort = (): void => {\n\t\t\tchild.kill(\"SIGKILL\");\n\t\t\tchild.stdout?.destroy();\n\t\t\tchild.stdin?.destroy();\n\t\t\tfinish(undefined);\n\t\t};\n\t\tconst timer = setTimeout(abort, options?.timeoutMs ?? 3000);\n\t\tchild.on(\"error\", () => finish(undefined));\n\t\tchild.on(\"close\", (code) => {\n\t\t\tif (!settled) finish(code === 0 ? Buffer.concat(chunks, length) : undefined);\n\t\t});\n\t\tchild.stdout?.on(\"data\", (chunk: Buffer) => {\n\t\t\tif (settled) return;\n\t\t\tlength += chunk.length;\n\t\t\tif (length > (options?.maxBufferBytes ?? 50 * 1024 * 1024)) abort();\n\t\t\telse chunks.push(chunk);\n\t\t});\n\t\tchild.stdin?.on(\"error\", () => {}); // A writer may exit before consuming all input.\n\t\tchild.stdin?.end(options?.input);\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAyDA,iDAAiD;AACjD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmBhE;AAED,8EAA8E;AAC9E,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAGvE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgEjE"}
|