dal-code 1.0.39 → 1.0.40
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 +82 -4
- package/NOTICE +224 -0
- package/dal-docs/examples/extensions/LICENSE +21 -0
- package/dal-docs/examples/extensions/README.md +64 -0
- package/dal-docs/examples/extensions/bookmark.ts +52 -0
- package/dal-docs/examples/extensions/claude-rules.ts +88 -0
- package/dal-docs/examples/extensions/commands.ts +74 -0
- package/dal-docs/examples/extensions/custom-footer.ts +66 -0
- package/dal-docs/examples/extensions/dirty-repo-guard.ts +58 -0
- package/dal-docs/examples/extensions/dynamic-tools.ts +76 -0
- package/dal-docs/examples/extensions/hello.ts +49 -0
- package/dal-docs/examples/extensions/inline-bash.ts +96 -0
- package/dal-docs/examples/extensions/permission-gate.ts +36 -0
- package/dal-docs/examples/extensions/protected-paths.ts +32 -0
- package/dal-docs/examples/extensions/session-name.ts +29 -0
- package/dal-docs/examples/extensions/status-line.ts +34 -0
- package/dal-docs/examples/extensions/structured-output.ts +67 -0
- package/dal-docs/examples/extensions/tool-override.ts +146 -0
- package/dal-docs/examples/extensions/trigger-compact.ts +59 -0
- package/dal-docs/examples/extensions/truncated-tool.ts +197 -0
- package/dal-docs/extensions.md +27 -0
- package/dist/cli/args.d.ts +3 -0
- package/dist/cli/args.js +17 -17
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session.js +6 -6
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/permission-surface.js +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +15 -1
- package/dist/core/model-registry.d.ts +1 -0
- package/dist/core/model-registry.js +1 -1
- package/dist/core/nested-tool-calls.js +2 -2
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/system-prompt.js +10 -9
- package/dist/core/tools/bash.js +13 -12
- package/dist/core/tools/path-utils.d.ts +5 -0
- package/dist/core/tools/process.d.ts +2 -0
- package/dist/core/tools/process.js +14 -13
- package/dist/dal/extension-compat.d.ts +62 -0
- package/dist/dal/extension-compat.js +4 -0
- package/dist/dal/hooks/extension.js +2 -2
- package/dist/dal/i18n.js +1 -1
- package/dist/dal/manifest.js +1 -1
- package/dist/dal/reviewed/endorsed-cli.js +1 -1
- package/dist/dal/reviewed/endorsed.js +1 -1
- package/dist/dal/reviewed/market-keys.js +1 -0
- package/dist/dal/reviewed/market.d.ts +64 -0
- package/dist/dal/reviewed/market.js +2 -0
- package/dist/extensions/mcp/runtime.d.ts +2 -1
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/extensions/mcp/runtime.lazy.d.ts +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1 -1
- package/dist/main.js +4 -4
- package/dist/modes/acp/acp-mode.js +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.js +14 -14
- package/dist/modes/print-mode.js +3 -3
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/node_modules/@dalcode/dal-advisor/LICENSE +45 -0
- package/dist/node_modules/@dalcode/dal-advisor/package.json +35 -0
- package/dist/node_modules/@dalcode/dal-advisor/src/index.js +22 -0
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/src/ask-user.js +1 -1
- package/dist/node_modules/@dalcode/dal-capabilities/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +38 -0
- package/dist/node_modules/@dalcode/dal-capabilities/src/catalogue.js +1 -0
- package/dist/node_modules/@dalcode/dal-capabilities/src/index.js +11 -0
- package/dist/node_modules/@dalcode/dal-capabilities/src/install.js +4 -0
- package/dist/node_modules/@dalcode/dal-capabilities/src/match.js +1 -0
- package/dist/node_modules/@dalcode/dal-capabilities/src/state.js +3 -0
- package/dist/node_modules/@dalcode/dal-compat/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-compat/package.json +32 -0
- package/dist/node_modules/@dalcode/dal-compat/src/claude-rules.js +3 -0
- package/dist/node_modules/@dalcode/dal-compat/src/index.js +7 -0
- package/dist/node_modules/@dalcode/dal-dap/LICENSE +47 -0
- package/dist/node_modules/@dalcode/dal-dap/package.json +38 -0
- package/dist/node_modules/@dalcode/dal-dap/src/adapters.js +1 -0
- package/dist/node_modules/@dalcode/dal-dap/src/client.js +5 -0
- package/dist/node_modules/@dalcode/dal-dap/src/index.js +9 -0
- package/dist/node_modules/@dalcode/dal-dap/src/install.js +2 -0
- package/dist/node_modules/@dalcode/dal-dap/src/session.js +2 -0
- package/dist/node_modules/@dalcode/dal-dap/src/types.js +0 -0
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +4 -3
- package/dist/node_modules/@dalcode/dal-goal/src/core.js +6 -6
- package/dist/node_modules/@dalcode/dal-goal/src/index.js +17 -7
- package/dist/node_modules/@dalcode/dal-goal/src/verify.js +26 -0
- package/dist/node_modules/@dalcode/dal-guard/package.json +6 -4
- package/dist/node_modules/@dalcode/dal-guard/src/credentials.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor-core.js +23 -0
- package/dist/node_modules/@dalcode/dal-guard/src/edit-anchor.js +4 -0
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/src/workspace.js +2 -2
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/LICENSE +209 -0
- package/dist/node_modules/@dalcode/dal-interactive/package.json +4 -3
- package/dist/node_modules/@dalcode/dal-interactive/src/btw.js +25 -0
- package/dist/node_modules/@dalcode/dal-interactive/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-learn/package.json +35 -0
- package/dist/node_modules/@dalcode/dal-learn/src/engine.js +8 -0
- package/dist/node_modules/@dalcode/dal-learn/src/extract.js +14 -0
- package/dist/node_modules/@dalcode/dal-learn/src/index.js +17 -0
- package/dist/node_modules/@dalcode/dal-learn/src/lessons.js +3 -0
- package/dist/node_modules/@dalcode/dal-learn/src/migrate.js +1 -0
- package/dist/node_modules/@dalcode/dal-learn/src/procedures.js +11 -0
- package/dist/node_modules/@dalcode/dal-learn/src/project-map.js +2 -0
- package/dist/node_modules/@dalcode/dal-learn/src/project.js +1 -0
- package/dist/node_modules/@dalcode/dal-learn/src/safety.js +2 -0
- package/dist/node_modules/@dalcode/dal-learn/src/signals.js +5 -0
- package/dist/node_modules/@dalcode/dal-learn/src/skill-actions.js +1 -0
- package/dist/node_modules/@dalcode/dal-learn/src/skill-evolution.js +16 -0
- package/dist/node_modules/@dalcode/dal-learn/src/store.js +2 -0
- package/dist/node_modules/@dalcode/dal-lsp/package.json +6 -4
- package/dist/node_modules/@dalcode/dal-lsp/src/client.js +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/src/config.js +1 -1
- package/dist/node_modules/@dalcode/dal-lsp/src/format.js +8 -7
- package/dist/node_modules/@dalcode/dal-lsp/src/index.js +11 -8
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/config.d.ts +1 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config.js +1 -1
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +32 -1
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.js +2 -1
- package/dist/node_modules/@dalcode/dal-mcp/src/index.js +16 -16
- package/dist/node_modules/@dalcode/dal-mcp/src/oauth.js +2 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +4 -2
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +9 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/types.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +6 -3
- package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/chart-theme.d.ts +13 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart-theme.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +4 -2
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +4 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/drawio-style.d.ts +4 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/drawio-style.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +52 -4
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +3 -2
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.d.ts +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +30 -1
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +35 -1
- package/dist/node_modules/@dalcode/dal-office/src/themes.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.js +3 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.js +3 -3
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -4
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +4 -4
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -5
- package/dist/node_modules/@dalcode/dal-plugins/src/index.js +11 -11
- package/dist/node_modules/@dalcode/dal-plugins/src/manage.js +8 -10
- package/dist/node_modules/@dalcode/dal-plugins/src/npm-hook.js +1 -1
- package/dist/node_modules/@dalcode/dal-plugins/src/registry.js +2 -2
- package/dist/node_modules/@dalcode/dal-recall/LICENSE +45 -0
- package/dist/node_modules/@dalcode/dal-recall/package.json +34 -0
- package/dist/node_modules/@dalcode/dal-recall/src/index-db.js +57 -0
- package/dist/node_modules/@dalcode/dal-recall/src/index.js +1 -0
- package/dist/node_modules/@dalcode/dal-recall/src/query.js +1 -0
- package/dist/node_modules/@dalcode/dal-recall/src/redact.js +1 -0
- package/dist/node_modules/@dalcode/dal-recall/src/sqlite.js +1 -0
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/src/commands.js +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +21 -8
- package/dist/node_modules/@dalcode/dal-rewind/src/core.js +8 -3
- package/dist/node_modules/@dalcode/dal-rewind/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-rewind/src/state.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -5
- package/dist/node_modules/@dalcode/dal-router/src/advisor.js +1 -0
- package/dist/node_modules/@dalcode/dal-router/src/assist.js +4 -2
- package/dist/node_modules/@dalcode/dal-router/src/commands.js +8 -8
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
- package/dist/node_modules/@dalcode/dal-router/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +2 -1
- package/dist/node_modules/@dalcode/dal-router/src/jev.js +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/services.js +1 -1
- package/dist/node_modules/@dalcode/dal-router/src/subagent.js +1 -1
- package/dist/node_modules/@dalcode/dal-skills/package.json +4 -3
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/browser-qa/SKILL.md +48 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/diagram-design/SKILL.md +81 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/poster-design/SKILL.md +50 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/print-design/SKILL.md +55 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/dashboard.html +177 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/diagram.html +39 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/echarts-dal.json +360 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/email/notice.html +46 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/landing.html +173 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mermaid-dal.json +140 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/mindmap.html +65 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/event-poster.html +40 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/poster.css +41 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/square-card.html +25 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/wechat-cover.html +29 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-card.html +35 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/posters/xhs-cover.html +26 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/letter.html +35 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/print.css +65 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/report.html +76 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/print/resume.html +72 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/render.mjs +18 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/visual-kit/tokens.css +264 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled/web-design/SKILL.md +73 -0
- package/dist/node_modules/@dalcode/dal-skills/src/bundled.js +1 -0
- package/dist/node_modules/@dalcode/dal-skills/src/catalog.js +2 -2
- package/dist/node_modules/@dalcode/dal-skills/src/index.js +16 -11
- package/dist/node_modules/@dalcode/dal-statusline/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-statusline/package.json +31 -0
- package/dist/node_modules/@dalcode/dal-statusline/src/index.js +3 -0
- package/dist/node_modules/@dalcode/dal-structured/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-structured/package.json +32 -0
- package/dist/node_modules/@dalcode/dal-structured/src/index.js +9 -0
- package/dist/node_modules/@dalcode/dal-subagent/LICENSE +24 -0
- package/dist/node_modules/@dalcode/dal-subagent/package.json +7 -6
- package/dist/node_modules/@dalcode/dal-subagent/src/background.js +13 -0
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +22 -14
- package/dist/node_modules/@dalcode/dal-subagent/src/inproc-runner.js +3 -0
- package/dist/node_modules/@dalcode/dal-subagent/src/pool.js +1 -0
- package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
- package/dist/node_modules/@dalcode/dal-subagent/src/tmux-runner.js +3 -0
- package/dist/node_modules/@dalcode/dal-subagent/src/worktree.js +2 -0
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/groups.js +1 -1
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair-hook.js +1 -0
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair.js +4 -0
- package/dist/node_modules/@dalcode/dal-usage/LICENSE +45 -0
- package/dist/node_modules/@dalcode/dal-usage/package.json +33 -0
- package/dist/node_modules/@dalcode/dal-usage/src/budget.d.ts +14 -0
- package/dist/node_modules/@dalcode/dal-usage/src/budget.js +3 -0
- package/dist/node_modules/@dalcode/dal-usage/src/data.d.ts +30 -0
- package/dist/node_modules/@dalcode/dal-usage/src/data.js +1 -0
- package/dist/node_modules/@dalcode/dal-usage/src/index.d.ts +12 -0
- package/dist/node_modules/@dalcode/dal-usage/src/index.js +2 -0
- package/dist/node_modules/@dalcode/dal-usage/src/report.d.ts +29 -0
- package/dist/node_modules/@dalcode/dal-usage/src/report.js +3 -0
- package/dist/node_modules/@dalcode/dal-web/package.json +6 -4
- package/dist/node_modules/@dalcode/dal-web/src/fetch.js +11 -5
- package/dist/node_modules/@dalcode/dal-web/src/index.js +2 -2
- package/dist/node_modules/@dalcode/dal-web/src/pdf.js +5 -0
- package/dist/node_modules/@dalcode/dal-workflow/LICENSE +24 -0
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/announce-check.js +1 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/check-in.js +1 -1
- package/dist/node_modules/@dalcode/dal-workflow/src/completion-check.js +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-workflow/src/lean-code.js +1 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/ledger.js +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/src/loop-guard.js +3 -0
- package/dist/node_modules/@dalcode/dal-workflow/src/shared.js +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/todo.js +4 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/verify-check.js +2 -0
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/radius.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +61 -61
- package/dist/sdk/office.d.ts +1 -1
- package/dist/sdk/office.js +1 -1
- package/dist/sdk/rewind.d.ts +1 -1
- package/dist/sdk/rewind.js +1 -1
- package/dist/sdk/usage.d.ts +8 -0
- package/dist/sdk/usage.js +1 -0
- package/dist/utils/open-browser.d.ts +1 -0
- package/dist/utils/tools-manager.js +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +57 -14
- package/package.json +9 -2
- package/dist/node_modules/@dalcode/dal-plugins/src/compat.js +0 -2
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Override Example - Demonstrates overriding built-in tools
|
|
3
|
+
*
|
|
4
|
+
* Extensions can register tools with the same name as built-in tools to replace them.
|
|
5
|
+
* This is useful for:
|
|
6
|
+
* - Adding logging or auditing to tool calls
|
|
7
|
+
* - Implementing access control or sandboxing
|
|
8
|
+
* - Routing tool calls to remote systems (e.g. over SSH)
|
|
9
|
+
* - Modifying tool behavior for specific workflows
|
|
10
|
+
*
|
|
11
|
+
* This example overrides the `read` tool to:
|
|
12
|
+
* 1. Log all file access to a log file
|
|
13
|
+
* 2. Block access to sensitive paths (e.g., .env files)
|
|
14
|
+
* 3. Delegate to the original read implementation for allowed files
|
|
15
|
+
*
|
|
16
|
+
* Since no custom renderCall/renderResult are provided, the built-in renderer
|
|
17
|
+
* is used automatically (syntax highlighting, line numbers, truncation warnings).
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* dal -e ./tool-override.ts
|
|
21
|
+
*
|
|
22
|
+
* Registers: commands read-log; tools read
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { TextContent } from "@earendil-works/pi-ai";
|
|
26
|
+
import { type ExtensionAPI, getAgentDir, withFileMutationQueue } from "@earendil-works/pi-coding-agent";
|
|
27
|
+
import { constants, readFileSync } from "fs";
|
|
28
|
+
import { access, appendFile, readFile } from "fs/promises";
|
|
29
|
+
import { join, resolve } from "path";
|
|
30
|
+
import { Type } from "typebox";
|
|
31
|
+
|
|
32
|
+
const LOG_FILE = join(getAgentDir(), "read-access.log");
|
|
33
|
+
|
|
34
|
+
// Paths that are blocked from reading
|
|
35
|
+
const BLOCKED_PATTERNS = [
|
|
36
|
+
/\.env$/,
|
|
37
|
+
/\.env\..+$/,
|
|
38
|
+
/secrets?\.(json|yaml|yml|toml)$/i,
|
|
39
|
+
/credentials?\.(json|yaml|yml|toml)$/i,
|
|
40
|
+
/\/\.ssh\//,
|
|
41
|
+
/\/\.aws\//,
|
|
42
|
+
/\/\.gnupg\//,
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
function isBlockedPath(path: string): boolean {
|
|
46
|
+
return BLOCKED_PATTERNS.some((pattern) => pattern.test(path));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function logAccess(path: string, allowed: boolean, reason?: string) {
|
|
50
|
+
const timestamp = new Date().toISOString();
|
|
51
|
+
const status = allowed ? "ALLOWED" : "BLOCKED";
|
|
52
|
+
const msg = reason ? ` (${reason})` : "";
|
|
53
|
+
const line = `[${timestamp}] ${status}: ${path}${msg}\n`;
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
await withFileMutationQueue(LOG_FILE, async () => {
|
|
57
|
+
await appendFile(LOG_FILE, line);
|
|
58
|
+
});
|
|
59
|
+
} catch {
|
|
60
|
+
// Ignore logging errors
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const readSchema = Type.Object({
|
|
65
|
+
path: Type.String({ description: "Path to the file to read (relative or absolute)" }),
|
|
66
|
+
offset: Type.Optional(Type.Number({ description: "Line number to start reading from (1-indexed)" })),
|
|
67
|
+
limit: Type.Optional(Type.Number({ description: "Maximum number of lines to read" })),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export default function (api: ExtensionAPI) {
|
|
71
|
+
api.registerTool({
|
|
72
|
+
name: "read", // Same name as built-in - this will override it
|
|
73
|
+
label: "read (audited)",
|
|
74
|
+
description:
|
|
75
|
+
"Read the contents of a file with access logging. Some sensitive paths (.env, secrets, credentials) are blocked.",
|
|
76
|
+
parameters: readSchema,
|
|
77
|
+
|
|
78
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
79
|
+
const { path, offset, limit } = params;
|
|
80
|
+
const absolutePath = resolve(ctx.cwd, path);
|
|
81
|
+
|
|
82
|
+
// Check if path is blocked
|
|
83
|
+
if (isBlockedPath(absolutePath)) {
|
|
84
|
+
await logAccess(absolutePath, false, "matches blocked pattern");
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: `Access denied: "${path}" matches a blocked pattern (sensitive file). This tool blocks access to .env files, secrets, credentials, and SSH/AWS/GPG directories.`,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
details: { blocked: true },
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Log allowed access
|
|
97
|
+
await logAccess(absolutePath, true);
|
|
98
|
+
|
|
99
|
+
// Perform the actual read (simplified implementation)
|
|
100
|
+
try {
|
|
101
|
+
await access(absolutePath, constants.R_OK);
|
|
102
|
+
const content = await readFile(absolutePath, "utf-8");
|
|
103
|
+
const lines = content.split("\n");
|
|
104
|
+
|
|
105
|
+
// Apply offset and limit
|
|
106
|
+
const startLine = offset ? Math.max(0, offset - 1) : 0;
|
|
107
|
+
const endLine = limit ? startLine + limit : lines.length;
|
|
108
|
+
const selectedLines = lines.slice(startLine, endLine);
|
|
109
|
+
|
|
110
|
+
// Basic truncation (50KB limit)
|
|
111
|
+
let text = selectedLines.join("\n");
|
|
112
|
+
const maxBytes = 50 * 1024;
|
|
113
|
+
if (Buffer.byteLength(text, "utf-8") > maxBytes) {
|
|
114
|
+
text = `${text.slice(0, maxBytes)}\n\n[Output truncated at 50KB]`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
content: [{ type: "text", text }] as TextContent[],
|
|
119
|
+
details: { lines: lines.length },
|
|
120
|
+
};
|
|
121
|
+
} catch (error: any) {
|
|
122
|
+
return {
|
|
123
|
+
content: [{ type: "text", text: `Error reading file: ${error.message}` }] as TextContent[],
|
|
124
|
+
details: { error: true },
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
// No renderCall/renderResult - uses built-in renderer automatically
|
|
130
|
+
// (syntax highlighting, line numbers, truncation warnings, etc.)
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Also register a command to view the access log
|
|
134
|
+
api.registerCommand("read-log", {
|
|
135
|
+
description: "View the file access log",
|
|
136
|
+
handler: async (_args, ctx) => {
|
|
137
|
+
try {
|
|
138
|
+
const log = readFileSync(LOG_FILE, "utf-8");
|
|
139
|
+
const lines = log.trim().split("\n").slice(-20); // Last 20 entries
|
|
140
|
+
ctx.ui.notify(`Recent file access:\n${lines.join("\n")}`, "info");
|
|
141
|
+
} catch {
|
|
142
|
+
ctx.ui.notify("No access log found", "info");
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger Compact Extension
|
|
3
|
+
*
|
|
4
|
+
* Compacts the conversation once context use crosses a threshold, and adds
|
|
5
|
+
* /trigger-compact [instructions] to compact on demand.
|
|
6
|
+
*
|
|
7
|
+
* Registers: commands trigger-compact; events turn_end
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
11
|
+
|
|
12
|
+
const COMPACT_THRESHOLD_TOKENS = 100_000;
|
|
13
|
+
|
|
14
|
+
export default function (api: ExtensionAPI) {
|
|
15
|
+
let previousTokens: number | null | undefined;
|
|
16
|
+
|
|
17
|
+
const triggerCompaction = (ctx: ExtensionContext, customInstructions?: string) => {
|
|
18
|
+
if (ctx.hasUI) {
|
|
19
|
+
ctx.ui.notify("Compaction started", "info");
|
|
20
|
+
}
|
|
21
|
+
ctx.compact({
|
|
22
|
+
customInstructions,
|
|
23
|
+
onComplete: () => {
|
|
24
|
+
if (ctx.hasUI) {
|
|
25
|
+
ctx.ui.notify("Compaction completed", "info");
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
onError: (error) => {
|
|
29
|
+
if (ctx.hasUI) {
|
|
30
|
+
ctx.ui.notify(`Compaction failed: ${error.message}`, "error");
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
api.on("turn_end", (_event, ctx) => {
|
|
37
|
+
const usage = ctx.getContextUsage();
|
|
38
|
+
const currentTokens = usage?.tokens ?? null;
|
|
39
|
+
if (currentTokens === null) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const crossedThreshold =
|
|
44
|
+
previousTokens !== undefined && previousTokens !== null && previousTokens <= COMPACT_THRESHOLD_TOKENS;
|
|
45
|
+
previousTokens = currentTokens;
|
|
46
|
+
if (!crossedThreshold || currentTokens <= COMPACT_THRESHOLD_TOKENS) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
triggerCompaction(ctx);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
api.registerCommand("trigger-compact", {
|
|
53
|
+
description: "Trigger compaction immediately",
|
|
54
|
+
handler: async (args, ctx) => {
|
|
55
|
+
const instructions = args.trim() || undefined;
|
|
56
|
+
triggerCompaction(ctx, instructions);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncated Tool Example - Demonstrates proper output truncation for custom tools
|
|
3
|
+
*
|
|
4
|
+
* Custom tools MUST truncate their output to avoid overwhelming the LLM context.
|
|
5
|
+
* The built-in limit is 50KB (~10k tokens) and 2000 lines, whichever is hit first.
|
|
6
|
+
*
|
|
7
|
+
* This example shows how to:
|
|
8
|
+
* 1. Use the built-in truncation utilities
|
|
9
|
+
* 2. Write full output to a temp file when truncated
|
|
10
|
+
* 3. Inform the LLM where to find the complete output
|
|
11
|
+
* 4. Custom rendering of tool calls and results
|
|
12
|
+
*
|
|
13
|
+
* The `rg` tool here wraps ripgrep with proper truncation. Compare this to the
|
|
14
|
+
* built-in `grep` tool for a more complete implementation.
|
|
15
|
+
*
|
|
16
|
+
* Registers: tools rg
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
20
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_MAX_BYTES,
|
|
23
|
+
DEFAULT_MAX_LINES,
|
|
24
|
+
formatSize,
|
|
25
|
+
type TruncationResult,
|
|
26
|
+
truncateHead,
|
|
27
|
+
withFileMutationQueue,
|
|
28
|
+
} from "@earendil-works/pi-coding-agent";
|
|
29
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
30
|
+
import { execSync } from "child_process";
|
|
31
|
+
import { tmpdir } from "os";
|
|
32
|
+
import { join } from "path";
|
|
33
|
+
import { Type } from "typebox";
|
|
34
|
+
|
|
35
|
+
const RgParams = Type.Object({
|
|
36
|
+
pattern: Type.String({ description: "Search pattern (regex)" }),
|
|
37
|
+
path: Type.Optional(Type.String({ description: "Directory to search (default: current directory)" })),
|
|
38
|
+
glob: Type.Optional(Type.String({ description: "File glob pattern, e.g. '*.ts'" })),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
interface RgDetails {
|
|
42
|
+
pattern: string;
|
|
43
|
+
path?: string;
|
|
44
|
+
glob?: string;
|
|
45
|
+
matchCount: number;
|
|
46
|
+
truncation?: TruncationResult;
|
|
47
|
+
fullOutputPath?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default function (api: ExtensionAPI) {
|
|
51
|
+
api.registerTool({
|
|
52
|
+
name: "rg",
|
|
53
|
+
label: "ripgrep",
|
|
54
|
+
// Document the truncation limits in the tool description so the LLM knows
|
|
55
|
+
description: `Search file contents using ripgrep. Output is truncated to ${DEFAULT_MAX_LINES} lines or ${formatSize(DEFAULT_MAX_BYTES)} (whichever is hit first). If truncated, full output is saved to a temp file.`,
|
|
56
|
+
parameters: RgParams,
|
|
57
|
+
|
|
58
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
59
|
+
const { pattern, path: searchPath, glob } = params;
|
|
60
|
+
|
|
61
|
+
// Build the ripgrep command
|
|
62
|
+
const args = ["rg", "--line-number", "--color=never"];
|
|
63
|
+
if (glob) args.push("--glob", glob);
|
|
64
|
+
args.push(pattern);
|
|
65
|
+
args.push(searchPath || ".");
|
|
66
|
+
|
|
67
|
+
let output: string;
|
|
68
|
+
try {
|
|
69
|
+
output = execSync(args.join(" "), {
|
|
70
|
+
cwd: ctx.cwd,
|
|
71
|
+
encoding: "utf-8",
|
|
72
|
+
maxBuffer: 100 * 1024 * 1024, // 100MB buffer to capture full output
|
|
73
|
+
});
|
|
74
|
+
} catch (err: any) {
|
|
75
|
+
// ripgrep exits with 1 when no matches found
|
|
76
|
+
if (err.status === 1) {
|
|
77
|
+
return {
|
|
78
|
+
content: [{ type: "text", text: "No matches found" }],
|
|
79
|
+
details: { pattern, path: searchPath, glob, matchCount: 0 } as RgDetails,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
throw new Error(`ripgrep failed: ${err.message}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!output.trim()) {
|
|
86
|
+
return {
|
|
87
|
+
content: [{ type: "text", text: "No matches found" }],
|
|
88
|
+
details: { pattern, path: searchPath, glob, matchCount: 0 } as RgDetails,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Apply truncation using built-in utilities
|
|
93
|
+
// truncateHead keeps the first N lines/bytes (good for search results)
|
|
94
|
+
// truncateTail keeps the last N lines/bytes (good for logs/command output)
|
|
95
|
+
const truncation = truncateHead(output, {
|
|
96
|
+
maxLines: DEFAULT_MAX_LINES,
|
|
97
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Count matches (each non-empty line with a match)
|
|
101
|
+
const matchCount = output.split("\n").filter((line) => line.trim()).length;
|
|
102
|
+
|
|
103
|
+
const details: RgDetails = {
|
|
104
|
+
pattern,
|
|
105
|
+
path: searchPath,
|
|
106
|
+
glob,
|
|
107
|
+
matchCount,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
let resultText = truncation.content;
|
|
111
|
+
|
|
112
|
+
if (truncation.truncated) {
|
|
113
|
+
// Save full output to a temp file so LLM can access it if needed
|
|
114
|
+
const tempDir = await mkdtemp(join(tmpdir(), "dal-rg-"));
|
|
115
|
+
const tempFile = join(tempDir, "output.txt");
|
|
116
|
+
await withFileMutationQueue(tempFile, async () => {
|
|
117
|
+
await writeFile(tempFile, output, "utf8");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
details.truncation = truncation;
|
|
121
|
+
details.fullOutputPath = tempFile;
|
|
122
|
+
|
|
123
|
+
// Add truncation notice - this helps the LLM understand the output is incomplete
|
|
124
|
+
const truncatedLines = truncation.totalLines - truncation.outputLines;
|
|
125
|
+
const truncatedBytes = truncation.totalBytes - truncation.outputBytes;
|
|
126
|
+
|
|
127
|
+
resultText += `\n\n[Output truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`;
|
|
128
|
+
resultText += ` (${formatSize(truncation.outputBytes)} of ${formatSize(truncation.totalBytes)}).`;
|
|
129
|
+
resultText += ` ${truncatedLines} lines (${formatSize(truncatedBytes)}) omitted.`;
|
|
130
|
+
resultText += ` Full output saved to: ${tempFile}]`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
content: [{ type: "text", text: resultText }],
|
|
135
|
+
details,
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
// Custom rendering of the tool call (shown before/during execution)
|
|
140
|
+
renderCall(args, theme, _context) {
|
|
141
|
+
let text = theme.fg("toolTitle", theme.bold("rg "));
|
|
142
|
+
text += theme.fg("accent", `"${args.pattern}"`);
|
|
143
|
+
if (args.path) {
|
|
144
|
+
text += theme.fg("muted", ` in ${args.path}`);
|
|
145
|
+
}
|
|
146
|
+
if (args.glob) {
|
|
147
|
+
text += theme.fg("dim", ` --glob ${args.glob}`);
|
|
148
|
+
}
|
|
149
|
+
return new Text(text, 0, 0);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
// Custom rendering of the tool result
|
|
153
|
+
renderResult(result, { expanded, isPartial }, theme, _context) {
|
|
154
|
+
const details = result.details as RgDetails | undefined;
|
|
155
|
+
|
|
156
|
+
// Handle streaming/partial results
|
|
157
|
+
if (isPartial) {
|
|
158
|
+
return new Text(theme.fg("warning", "Searching..."), 0, 0);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// No matches
|
|
162
|
+
if (!details || details.matchCount === 0) {
|
|
163
|
+
return new Text(theme.fg("dim", "No matches found"), 0, 0);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Build result display
|
|
167
|
+
let text = theme.fg("success", `${details.matchCount} matches`);
|
|
168
|
+
|
|
169
|
+
// Show truncation warning if applicable
|
|
170
|
+
if (details.truncation?.truncated) {
|
|
171
|
+
text += theme.fg("warning", " (truncated)");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// In expanded view, show the actual matches
|
|
175
|
+
if (expanded) {
|
|
176
|
+
const content = result.content[0];
|
|
177
|
+
if (content?.type === "text") {
|
|
178
|
+
// Show first 20 lines in expanded view, or all if fewer
|
|
179
|
+
const lines = content.text.split("\n").slice(0, 20);
|
|
180
|
+
for (const line of lines) {
|
|
181
|
+
text += `\n${theme.fg("dim", line)}`;
|
|
182
|
+
}
|
|
183
|
+
if (content.text.split("\n").length > 20) {
|
|
184
|
+
text += `\n${theme.fg("muted", "... (use read tool to see full output)")}`;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Show temp file path if truncated
|
|
189
|
+
if (details.fullOutputPath) {
|
|
190
|
+
text += `\n${theme.fg("dim", `Full output: ${details.fullOutputPath}`)}`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return new Text(text, 0, 0);
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
}
|
package/dal-docs/extensions.md
CHANGED
|
@@ -60,6 +60,33 @@ export default function (api: ExtensionAPI) {
|
|
|
60
60
|
|
|
61
61
|
Try it once without installing: `dal -e ./hello.ts`.
|
|
62
62
|
|
|
63
|
+
## Examples
|
|
64
|
+
|
|
65
|
+
[examples/extensions/](examples/extensions/README.md) has about fifteen small
|
|
66
|
+
extensions that load as is: tools (structured output, output truncation,
|
|
67
|
+
overriding `read`), commands, safety gates on `tool_call`, prompt and input
|
|
68
|
+
hooks, and footer/status UI. Start a new extension from the closest one.
|
|
69
|
+
|
|
70
|
+
## Writing one for the user
|
|
71
|
+
|
|
72
|
+
When the user asks for an extension:
|
|
73
|
+
|
|
74
|
+
1. Read this file and the examples index (`examples/extensions/README.md`
|
|
75
|
+
in this folder), then the closest example.
|
|
76
|
+
2. Save the new file as `~/.dal/agent/extensions/<name>.ts` (every project;
|
|
77
|
+
under `$DAL_CODING_AGENT_DIR/extensions` when that variable is set)
|
|
78
|
+
or `.dal/extensions/<name>.ts` in the project (this project only, loads
|
|
79
|
+
once the project is trusted). Ask which one if the user did not say.
|
|
80
|
+
3. Tell the user to run `/reload` (or start a new session) to load it, and
|
|
81
|
+
how to use what it adds.
|
|
82
|
+
|
|
83
|
+
Writing to `~/.dal/agent/extensions/` is outside the project, so the approval
|
|
84
|
+
gate asks first in the terminal UI; under `dal -p` it is refused unless
|
|
85
|
+
full-auto (`--yolo`) is on. Never write next to the login files in
|
|
86
|
+
`~/.dal/agent` (`auth.json` and the like). A command's reply should work in
|
|
87
|
+
both the UI and `dal -p`: `ctx.ui.notify` shows nothing under `dal -p`, so
|
|
88
|
+
send a displayed message there (see `hello.ts`).
|
|
89
|
+
|
|
63
90
|
## Imports
|
|
64
91
|
|
|
65
92
|
The engine keeps the import names of its open-source base, and resolves them
|
package/dist/cli/args.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface Args {
|
|
|
19
19
|
noSession?: boolean;
|
|
20
20
|
session?: string;
|
|
21
21
|
sessionId?: string;
|
|
22
|
+
newSession?: boolean;
|
|
22
23
|
fork?: string;
|
|
23
24
|
sessionDir?: string;
|
|
24
25
|
models?: string[];
|
|
@@ -49,6 +50,7 @@ export interface Args {
|
|
|
49
50
|
messages: string[];
|
|
50
51
|
fileArgs: string[];
|
|
51
52
|
unknownFlags: Map<string, boolean | string>;
|
|
53
|
+
unknownFlagMessageSlots?: Map<string, number>;
|
|
52
54
|
diagnostics: Array<{
|
|
53
55
|
type: "warning" | "error";
|
|
54
56
|
message: string;
|
|
@@ -57,4 +59,5 @@ export interface Args {
|
|
|
57
59
|
export declare function isValidThinkingLevel(level: string): level is ThinkingLevel;
|
|
58
60
|
export declare function normalizeSessionName(value: string): string | undefined;
|
|
59
61
|
export declare function parseArgs(args: string[]): Args;
|
|
62
|
+
export declare function reclaimBooleanFlagMessages(parsed: Args, booleanFlags: ReadonlySet<string>): void;
|
|
60
63
|
export declare function printHelp(extensionFlags?: ExtensionFlag[]): void;
|
package/dist/cli/args.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var P=Object.defineProperty;var
|
|
2
|
-
`)}
|
|
3
|
-
${
|
|
4
|
-
${
|
|
1
|
+
var P=Object.defineProperty;var d=(o,s)=>P(o,"name",{value:s,configurable:!0});import u from"chalk";import{APP_NAME as l,APP_TITLE as k,CONFIG_DIR_NAME as I,ENV_AGENT_DIR as g,ENV_SESSION_DIR as x}from"../config.js";import{isSandboxLevel as O,SANDBOX_LEVELS as N}from"../core/sandbox/policy.js";import{getToolListError as T}from"../core/settings-manager.js";import{fill as m,t as e}from"../dal/i18n.js";const _=["off","minimal","low","medium","high","xhigh","max"];function $(o){return _.includes(o)}d($,"isValidThinkingLevel");function C(o){const s=o.trim();return s.length>0?s:void 0}d(C,"normalizeSessionName");function w(o){const s={messages:[],fileArgs:[],unknownFlags:new Map,unknownFlagMessageSlots:new Map,diagnostics:[]};for(let n=0;n<o.length;n++){const t=o[n];if(t==="--"){for(const i of o.slice(n+1))i.startsWith("@")?s.fileArgs.push(i.slice(1)):s.messages.push(i);break}else if(t==="--help"||t==="-h")s.help=!0;else if(t==="--version"||t==="-v")s.version=!0;else if(t==="--mode"){const i=o[n+1];if(i===void 0||i.startsWith("-")){s.diagnostics.push({type:"error",message:e("--mode \u9700\u8981\u6307\u5B9A text\u3001json\u3001rpc \u6216 acp")});continue}if(n++,i!=="text"&&i!=="json"&&i!=="rpc"&&i!=="acp"){s.diagnostics.push({type:"error",message:m(e("\u65E0\u6548\u7684\u6A21\u5F0F\u300C{mode}\u300D\u3002\u53EF\u9009\u503C\uFF1Atext\u3001json\u3001rpc\u3001acp"),{mode:i})});continue}s.mode=i}else if(t==="--continue"||t==="-c")s.continue=!0;else if(t==="--resume"||t==="-r")s.resume=!0;else if(t==="--provider"&&n+1<o.length)s.provider=o[++n];else if(t==="--model"&&n+1<o.length)s.model=o[++n];else if(t==="--api-key"&&n+1<o.length)s.apiKey=o[++n];else if(t==="--system-prompt"&&n+1<o.length)s.systemPrompt=o[++n];else if(t==="--append-system-prompt"&&n+1<o.length)s.appendSystemPrompt=s.appendSystemPrompt??[],s.appendSystemPrompt.push(o[++n]);else if(t==="--name"||t==="-n")n+1<o.length?s.name=o[++n]:s.diagnostics.push({type:"error",message:e("--name \u9700\u8981\u4E00\u4E2A\u503C")});else if(t==="--no-session")s.noSession=!0;else if(t==="--session"&&n+1<o.length)s.session=o[++n];else if(t==="--session-id"&&n+1<o.length)s.sessionId=o[++n];else if(t==="--new-session-id"&&n+1<o.length)s.sessionId=o[++n],s.newSession=!0;else if(t==="--fork"&&n+1<o.length)s.fork=o[++n];else if(t==="--session-dir"&&n+1<o.length)s.sessionDir=o[++n];else if(t==="--models"&&n+1<o.length)s.models=o[++n].split(",").map(i=>i.trim()).filter(i=>i.length>0);else if(t==="--no-tools"||t==="-nt")s.noTools=!0;else if(t==="--no-builtin-tools"||t==="-nbt")s.noBuiltinTools=!0;else if((t==="--tools"||t==="-t")&&n+1<o.length){const i=o[++n].split(",").map(a=>a.trim()).filter(a=>a.length>0),p=T(i);p?s.diagnostics.push({type:"error",message:`${t}: ${p}`}):s.tools=i}else if((t==="--exclude-tools"||t==="-xt")&&n+1<o.length)s.excludeTools=o[++n].split(",").map(i=>i.trim()).filter(i=>i.length>0);else if(t==="--sandbox"){const i=o[n+1];O(i)?(s.sandbox=i,n++):(s.diagnostics.push({type:"error",message:m(e("--sandbox \u7684\u53D6\u503C\u65E0\u6548\uFF1A{value}\u3002\u53EF\u9009\u503C\uFF1A{values}"),{value:i??"",values:N.join(", ")})}),i!==void 0&&!i.startsWith("-")&&n++)}else if(t==="--sandbox-allow-domain"&&n+1<o.length)s.sandboxAllowDomains=[...s.sandboxAllowDomains??[],...o[++n].split(",").map(i=>i.trim()).filter(i=>i.length>0)];else if(t==="--thinking"&&n+1<o.length){const i=o[++n];$(i)?s.thinking=i:s.diagnostics.push({type:"warning",message:m(e("\u65E0\u6548\u7684\u601D\u8003\u6DF1\u5EA6\u300C{level}\u300D\u3002\u53EF\u9009\u503C\uFF1A{values}"),{level:i,values:_.join(", ")})})}else if(t==="--print"||t==="-p"){s.print=!0;const i=o[n+1];i!==void 0&&!i.startsWith("@")&&(!i.startsWith("-")||i.startsWith("---"))&&(s.messages.push(i),n++)}else if(t==="--export"&&n+1<o.length)s.export=o[++n];else if((t==="--extension"||t==="-e")&&n+1<o.length)s.extensions=s.extensions??[],s.extensions.push(o[++n]);else if(t==="--no-extensions"||t==="-ne")s.noExtensions=!0;else if(t==="--no-mcp")s.noMcp=!0;else if(t==="--skill"&&n+1<o.length)s.skills=s.skills??[],s.skills.push(o[++n]);else if(t==="--prompt-template"&&n+1<o.length)s.promptTemplates=s.promptTemplates??[],s.promptTemplates.push(o[++n]);else if(t==="--theme"&&n+1<o.length)s.themes=s.themes??[],s.themes.push(o[++n]);else if(t==="--use-theme"){const i=o[n+1];i===void 0||i.startsWith("-")?s.diagnostics.push({type:"error",message:e("--use-theme \u9700\u8981\u6307\u5B9A\u4E3B\u9898\u540D\u79F0")}):(s.useTheme=i,n++)}else if(t==="--no-skills"||t==="-ns")s.noSkills=!0;else if(t==="--no-prompt-templates"||t==="-np")s.noPromptTemplates=!0;else if(t==="--no-themes")s.noThemes=!0;else if(t==="--no-context-files"||t==="-nc")s.noContextFiles=!0;else if(t==="--list-models")n+1<o.length&&!o[n+1].startsWith("-")&&!o[n+1].startsWith("@")?s.listModels=o[++n]:s.listModels=!0;else if(t==="--tui-mode"){const i=o[n+1];i==="regular"||i==="fullscreen"?(s.tuiMode=i,n++):i===void 0||i.startsWith("-")?s.diagnostics.push({type:"error",message:e("--tui-mode \u9700\u8981\u6307\u5B9A regular \u6216 fullscreen")}):(n++,s.diagnostics.push({type:"error",message:m(e("\u65E0\u6548\u7684 TUI \u6A21\u5F0F\u300C{mode}\u300D\u3002\u53EF\u9009\u503C\uFF1Aregular\u3001fullscreen"),{mode:i})}))}else if(t==="--verbose")s.verbose=!0;else if(t==="--approve"||t==="-a")s.projectTrustOverride=!0;else if(t==="--no-approve"||t==="-na")s.projectTrustOverride=!1;else if(t==="--offline")s.offline=!0;else if(t.startsWith("@"))s.fileArgs.push(t.slice(1));else if(t.startsWith("--")){const i=t.indexOf("=");if(i!==-1)s.unknownFlags.set(t.slice(2,i),t.slice(i+1));else{const p=t.slice(2),a=o[n+1];a!==void 0&&!a.startsWith("-")&&!a.startsWith("@")?(s.unknownFlags.set(p,a),s.unknownFlagMessageSlots?.set(p,s.messages.length),n++):s.unknownFlags.set(p,!0)}}else t.startsWith("-")&&!t.startsWith("--")?s.diagnostics.push({type:"error",message:m(e("\u672A\u77E5\u9009\u9879\uFF1A{option}"),{option:t})}):t.startsWith("-")||s.messages.push(t)}return s}d(w,"parseArgs");function h(o,s,n=""){return o.map(([t,i])=>` ${t.padEnd(s)}${n}${i}`).join(`
|
|
2
|
+
`)}d(h,"helpRows");function r(o){return m(e("{name} \u7684 API key"),{name:o})}d(r,"apiKeyFor");function b(o,s){const n=[...o.unknownFlagMessageSlots??[]].filter(([i])=>s.has(i)&&typeof o.unknownFlags.get(i)=="string").sort((i,p)=>i[1]-p[1]);let t=0;for(const[i,p]of n)o.messages.splice(p+t,0,o.unknownFlags.get(i)),o.unknownFlags.set(i,!0),o.unknownFlagMessageSlots?.delete(i),t++}d(b,"reclaimBooleanFlagMessages");function L(o){const s=o&&o.length>0?`
|
|
3
|
+
${u.bold(e("\u6269\u5C55\u63D0\u4F9B\u7684\u547D\u4EE4\u884C\u9009\u9879\uFF1A"))}
|
|
4
|
+
${o.map(A=>{const c=A.type==="string"?" <value>":"",f=A.description??m(e("\u7531 {path} \u6CE8\u518C"),{path:A.extensionPath});return` --${A.name}${c}`.padEnd(30)+f}).join(`
|
|
5
5
|
`)}
|
|
6
|
-
`:"",n=h([[`${l} install <source> [-l]`,e("\u5B89\u88C5\u6269\u5C55\u6765\u6E90\uFF0C\u5E76\u5199\u5165\u8BBE\u7F6E")],[`${l} ext install <source> [-l]`,e("install \u7684\u522B\u540D\uFF08\u672C\u5730\u8DEF\u5F84\u6216 git \u5730\u5740\uFF09")],[`${l} remove <source> [-l]`,e("\u4ECE\u8BBE\u7F6E\u4E2D\u79FB\u9664\u6269\u5C55\u6765\u6E90")],[`${l} uninstall <source> [-l]`,e("remove \u7684\u522B\u540D")],[`${l} update [source|self]`,
|
|
6
|
+
`:"",n=h([[`${l} install <source> [-l]`,e("\u5B89\u88C5\u6269\u5C55\u6765\u6E90\uFF0C\u5E76\u5199\u5165\u8BBE\u7F6E")],[`${l} ext install <source> [-l]`,e("install \u7684\u522B\u540D\uFF08\u672C\u5730\u8DEF\u5F84\u6216 git \u5730\u5740\uFF09")],[`${l} remove <source> [-l]`,e("\u4ECE\u8BBE\u7F6E\u4E2D\u79FB\u9664\u6269\u5C55\u6765\u6E90")],[`${l} uninstall <source> [-l]`,e("remove \u7684\u522B\u540D")],[`${l} update [source|self]`,m(e("\u66F4\u65B0 {app}\u3001\u6269\u5C55\u6216\u6A21\u578B\u76EE\u5F55"),{app:l})],[`${l} list`,e("\u5217\u51FA\u8BBE\u7F6E\u4E2D\u5DF2\u5B89\u88C5\u7684\u6269\u5C55")],[`${l} config [-l]`,e("\u6253\u5F00 TUI \u542F\u7528\u6216\u505C\u7528\u5305\u91CC\u7684\u8D44\u6E90\uFF08Tab \u5207\u6362\u4F5C\u7528\u8303\u56F4\uFF09")],[`${l} auth <command>`,e("\u8F93\u51FA\u51ED\u636E\uFF0C\u6216\u68C0\u67E5\u63D0\u4F9B\u65B9\u662F\u5426\u5C31\u7EEA")],[`${l} mcp <command>`,e("\u68C0\u67E5 MCP \u670D\u52A1\u5668\uFF0C\u767B\u5F55\u6216\u9000\u51FA\u9700\u8981 OAuth \u7684\u670D\u52A1\u5668")],[`${l} <command> --help`,e("\u67E5\u770B install/remove/uninstall/update/list/config/auth/mcp \u7684\u5E2E\u52A9")]],l.length+27),t=h([["--provider <name>",e("\u5728\u54EA\u4E2A\u63D0\u4F9B\u65B9\u91CC\u67E5\u627E --model\uFF08\u9700\u8981\u540C\u65F6\u6307\u5B9A --model\uFF09")],["--model <pattern>",e("\u6A21\u578B\u540D\u79F0\u6216 ID\uFF08\u652F\u6301\u201Cprovider/id\u201D\uFF0C\u53EF\u52A0\u201C:<\u601D\u8003\u6DF1\u5EA6>\u201D\u540E\u7F00\uFF09")],["--api-key <key>",e("API key\uFF08\u9ED8\u8BA4\u8BFB\u53D6\u73AF\u5883\u53D8\u91CF\uFF09")],["--system-prompt <text>",e("\u7CFB\u7EDF\u63D0\u793A\u8BCD\uFF08\u9ED8\u8BA4\uFF1A\u7F16\u7A0B\u52A9\u624B\u63D0\u793A\u8BCD\uFF09")],["--append-system-prompt <text>",e("\u5728\u7CFB\u7EDF\u63D0\u793A\u8BCD\u540E\u8FFD\u52A0\u6587\u5B57\u6216\u6587\u4EF6\u5185\u5BB9\uFF08\u53EF\u591A\u6B21\u4F7F\u7528\uFF09")],["--mode <mode>",e("\u8F93\u51FA\u6A21\u5F0F\uFF1Atext\uFF08\u9ED8\u8BA4\uFF09\u3001json\u3001rpc \u6216 acp\uFF08Agent Client Protocol\uFF09")],["--print, -p",e("\u975E\u4EA4\u4E92\u6A21\u5F0F\uFF1A\u5904\u7406\u5B8C\u63D0\u793A\u8BCD\u540E\u9000\u51FA")],["--continue, -c",e("\u7EE7\u7EED\u4E0A\u4E00\u4E2A\u4F1A\u8BDD")],["--resume, -r",e("\u9009\u62E9\u8981\u6062\u590D\u7684\u4F1A\u8BDD")],["--session <path|id>",e("\u4F7F\u7528\u6307\u5B9A\u7684\u4F1A\u8BDD\u6587\u4EF6\uFF0C\u6216 UUID \u7684\u4E00\u90E8\u5206")],["--session-id <id>",e("\u4F7F\u7528\u7CBE\u786E\u7684\u9879\u76EE\u4F1A\u8BDD ID\uFF0C\u4E0D\u5B58\u5728\u65F6\u81EA\u52A8\u521B\u5EFA")],["--new-session-id <id>",e("\u7528\u8FD9\u4E2A ID \u65B0\u5EFA\u4F1A\u8BDD\uFF1B\u5DF2\u6709\u540C ID \u7684\u4F1A\u8BDD\u65F6\u62A5\u9519\u9000\u51FA")],["--fork <path|id>",e("\u628A\u6307\u5B9A\u7684\u4F1A\u8BDD\u6587\u4EF6\u6216 UUID \u5206\u53C9\u6210\u4E00\u4E2A\u65B0\u4F1A\u8BDD")],["--session-dir <dir>",e("\u4F1A\u8BDD\u5B58\u50A8\u548C\u67E5\u627E\u7684\u76EE\u5F55")],["--no-session",e("\u4E0D\u4FDD\u5B58\u4F1A\u8BDD\uFF08\u7528\u5B8C\u5373\u5F03\uFF09")],["--name, -n <name>",e("\u8BBE\u7F6E\u4F1A\u8BDD\u663E\u793A\u540D\u79F0")],["--models <patterns>",e("\u9017\u53F7\u5206\u9694\u7684\u6A21\u578B\u5217\u8868\uFF0C\u7528\u4E8E Ctrl+P \u8F6E\u6362")],["",e("\u652F\u6301\u901A\u914D\u7B26\uFF08anthropic/*\u3001*sonnet*\uFF09\u548C\u6A21\u7CCA\u5339\u914D")],["--no-tools, -nt",e("\u9ED8\u8BA4\u505C\u7528\u5168\u90E8\u5DE5\u5177\uFF08\u5185\u7F6E\u548C\u6269\u5C55\u7684\uFF09")],["--no-builtin-tools, -nbt",e("\u9ED8\u8BA4\u505C\u7528\u5185\u7F6E\u5DE5\u5177\uFF0C\u4FDD\u7559\u6269\u5C55\u548C\u81EA\u5B9A\u4E49\u5DE5\u5177")],["--tools, -t <tools>",e("\u9017\u53F7\u5206\u9694\u7684\u5DE5\u5177\u767D\u540D\u5355\uFF08\u53EF\u7528 * \u901A\u914D\uFF09\uFF0C\u53EA\u542F\u7528\u8FD9\u4E9B\u5DE5\u5177")],["",e("\u9664\u975E\u67D0\u9879\u4EE5 mcp__ \u5F00\u5934\uFF0C\u5426\u5219\u4FDD\u7559 MCP \u5DE5\u5177")],["",e("\u5168\u90E8\u5199\u6210 +\u540D\u79F0/-\u540D\u79F0 \u65F6\uFF0C\u53EA\u5728\u9ED8\u8BA4\u5DE5\u5177\u4E0A\u589E\u51CF")],["--exclude-tools, -xt <tools>",e("\u9017\u53F7\u5206\u9694\u7684\u5DE5\u5177\u9ED1\u540D\u5355\uFF08\u53EF\u7528 * \u901A\u914D\uFF09\uFF0C\u505C\u7528\u8FD9\u4E9B\u5DE5\u5177")],["",e("\u5BF9\u6240\u6709\u5DE5\u5177\u751F\u6548\uFF0C\u5305\u62EC MCP \u5DE5\u5177")],["--thinking <level>",e("\u8BBE\u7F6E\u601D\u8003\u6DF1\u5EA6\uFF1Aoff\u3001minimal\u3001low\u3001medium\u3001high\u3001xhigh\u3001max")],["--sandbox <level>",e("\u547D\u4EE4\u6C99\u7BB1\uFF1Aworkspace-write\uFF08\u9ED8\u8BA4\uFF09\u3001read-only \u6216 off")],["--sandbox-allow-domain <d>",e("\u6C99\u7BB1\u5185\u547D\u4EE4\u53EF\u8BBF\u95EE\u7684\u57DF\u540D\uFF08\u9017\u53F7\u5206\u9694\uFF0C\u53EF\u591A\u6B21\u4F7F\u7528\uFF09")],["--extension, -e <path>",e("\u52A0\u8F7D\u4E00\u4E2A\u6269\u5C55\u6587\u4EF6\u6216 builtin:<\u540D\u79F0>\uFF08\u53EF\u591A\u6B21\u4F7F\u7528\uFF09")],["--no-extensions, -ne",e("\u4E0D\u81EA\u52A8\u53D1\u73B0\u6269\u5C55\uFF0C\u4E5F\u4E0D\u52A0\u8F7D\u5185\u7F6E\u6269\u5C55\uFF08\u7528 -e \u660E\u786E\u6307\u5B9A\u7684\u4ECD\u4F1A\u52A0\u8F7D\uFF09")],["--no-mcp",e("\u505C\u7528\u5185\u7F6E MCP \u652F\u6301\uFF1A\u4E0D\u8FDE\u63A5\u4EFB\u4F55\u670D\u52A1\u5668\uFF0C\u4E5F\u6CA1\u6709 MCP \u5DE5\u5177")],["--skill <path>",e("\u52A0\u8F7D\u4E00\u4E2A\u6280\u80FD\u6587\u4EF6\u6216\u76EE\u5F55\uFF08\u53EF\u591A\u6B21\u4F7F\u7528\uFF09")],["--no-skills, -ns",e("\u4E0D\u53D1\u73B0\u3001\u4E0D\u52A0\u8F7D\u6280\u80FD")],["--prompt-template <path>",e("\u52A0\u8F7D\u4E00\u4E2A\u63D0\u793A\u8BCD\u6A21\u677F\u6587\u4EF6\u6216\u76EE\u5F55\uFF08\u53EF\u591A\u6B21\u4F7F\u7528\uFF09")],["--no-prompt-templates, -np",e("\u4E0D\u53D1\u73B0\u3001\u4E0D\u52A0\u8F7D\u63D0\u793A\u8BCD\u6A21\u677F")],["--theme <path>",e("\u52A0\u8F7D\u4E00\u4E2A\u4E3B\u9898\u6587\u4EF6\u6216\u76EE\u5F55\uFF08\u53EF\u591A\u6B21\u4F7F\u7528\uFF09")],["--use-theme <name[/name]>",e("\u8BBE\u7F6E\u672C\u6B21\u8FD0\u884C\u7684\u521D\u59CB\u754C\u9762\u4E3B\u9898")],["--no-themes",e("\u4E0D\u53D1\u73B0\u3001\u4E0D\u52A0\u8F7D\u4E3B\u9898")],["--no-context-files, -nc",e("\u4E0D\u53D1\u73B0\u3001\u4E0D\u52A0\u8F7D AGENTS.md \u548C CLAUDE.md")],["--export <file>",e("\u628A\u4F1A\u8BDD\u6587\u4EF6\u5BFC\u51FA\u4E3A HTML \u540E\u9000\u51FA")],["--list-models [search]",e("\u5217\u51FA\u53EF\u7528\u6A21\u578B\uFF08\u53EF\u52A0\u5173\u952E\u8BCD\u6A21\u7CCA\u641C\u7D22\uFF09")],["--verbose",e("\u542F\u52A8\u65F6\u663E\u793A\u8BE6\u7EC6\u4FE1\u606F\uFF08\u8986\u76D6 quietStartup \u8BBE\u7F6E\uFF09")],["--tui-mode <mode>",e("TUI \u6A21\u5F0F\uFF1Aregular\uFF08\u9ED8\u8BA4\uFF09\u6216 fullscreen")],["--approve, -a",e("\u672C\u6B21\u8FD0\u884C\u4FE1\u4EFB\u9879\u76EE\u5185\u7684\u672C\u5730\u6587\u4EF6")],["--no-approve, -na",e("\u672C\u6B21\u8FD0\u884C\u5FFD\u7565\u9879\u76EE\u5185\u7684\u672C\u5730\u6587\u4EF6")],["--offline",e("\u542F\u52A8\u65F6\u4E0D\u8FDB\u884C\u4EFB\u4F55\u8054\u7F51\u64CD\u4F5C\uFF08\u7B49\u540C\u4E8E PI_OFFLINE=1\uFF09")],["--",e("\u7ED3\u675F\u9009\u9879\u89E3\u6790\uFF0C\u540E\u9762\u7684\u53C2\u6570\u90FD\u5F53\u4F5C\u6D88\u606F\u6216\u6587\u4EF6")],["--help, -h",e("\u663E\u793A\u8FD9\u4EFD\u5E2E\u52A9")],["--version, -v",e("\u663E\u793A\u7248\u672C\u53F7")]],31),p=[[e("\u4E3A\u5916\u90E8\u5BA2\u6237\u7AEF\u8F93\u51FA\u63D0\u4F9B\u65B9\u7684 API key"),[`${l} auth print-api-key --provider openai`]],[e("\u4E3A\u5916\u90E8\u5BA2\u6237\u7AEF\u8F93\u51FA OAuth bearer token\uFF08\u8FC7\u671F\u4F1A\u81EA\u52A8\u5237\u65B0\uFF09"),[`${l} auth print-bearer-token --provider openai-codex`]],[e("\u4EA4\u4E92\u6A21\u5F0F"),[l]],[e("\u4EA4\u4E92\u6A21\u5F0F\uFF0C\u5E76\u5E26\u4E0A\u7B2C\u4E00\u6761\u63D0\u793A\u8BCD"),[`${l} "List all .ts files in src/"`]],[e("\u5728\u7B2C\u4E00\u6761\u6D88\u606F\u91CC\u9644\u4E0A\u6587\u4EF6"),[`${l} @prompt.md @image.png "What color is the sky?"`]],[e("\u975E\u4EA4\u4E92\u6A21\u5F0F\uFF08\u5904\u7406\u5B8C\u5373\u9000\u51FA\uFF09"),[`${l} -p "List all .ts files in src/"`]],[e("\u4EE5\u77ED\u6A2A\u7EBF\u5F00\u5934\u7684\u63D0\u793A\u8BCD"),[`${l} -p -- "- Summarize these points"`]],[e("\u591A\u6761\u6D88\u606F\uFF08\u4EA4\u4E92\u6A21\u5F0F\uFF09"),[`${l} "Read package.json" "What dependencies do we have?"`]],[e("\u7EE7\u7EED\u4E0A\u4E00\u4E2A\u4F1A\u8BDD"),[`${l} --continue "What did we discuss?"`]],[e("\u5F00\u59CB\u4E00\u4E2A\u5E26\u540D\u79F0\u7684\u4F1A\u8BDD"),[`${l} --name "Refactor auth module"`]],[e("\u6362\u7528\u5176\u4ED6\u6A21\u578B"),[`${l} --provider openai --model gpt-4o-mini "Help me refactor this code"`]],[e("\u6A21\u578B\u540D\u5E26\u63D0\u4F9B\u65B9\u524D\u7F00\uFF08\u65E0\u9700 --provider\uFF09"),[`${l} --model openai/gpt-4o "Help me refactor this code"`]],[e("\u7528\u7B80\u5199\u540C\u65F6\u6307\u5B9A\u6A21\u578B\u548C\u601D\u8003\u6DF1\u5EA6"),[`${l} --model sonnet:high "Solve this complex problem"`]],[e("\u53EA\u5728\u6307\u5B9A\u7684\u51E0\u4E2A\u6A21\u578B\u4E4B\u95F4\u8F6E\u6362"),[`${l} --models claude-sonnet,claude-haiku,gpt-4o`]],[e("\u7528\u901A\u914D\u7B26\u9650\u5B9A\u4E3A\u67D0\u4E2A\u63D0\u4F9B\u65B9"),[`${l} --models "github-copilot/*"`]],[e("\u8F6E\u6362\u6A21\u578B\u65F6\u56FA\u5B9A\u5404\u81EA\u7684\u601D\u8003\u6DF1\u5EA6"),[`${l} --models sonnet:high,haiku:low`]],[e("\u4EE5\u6307\u5B9A\u7684\u601D\u8003\u6DF1\u5EA6\u5F00\u59CB"),[`${l} --thinking high "Solve this complex problem"`]],[e("\u53EA\u8BFB\u6A21\u5F0F\uFF08\u4E0D\u53EF\u80FD\u4FEE\u6539\u6587\u4EF6\uFF09"),[`${l} --tools read,grep,find,ls -p "Review the code in src/"`]],[e("\u505C\u7528\u4E00\u4E2A\u5DE5\u5177\uFF0C\u5176\u4F59\u7167\u5E38\u53EF\u7528"),[`${l} --exclude-tools ask_question`]],[e("\u628A\u4F1A\u8BDD\u6587\u4EF6\u5BFC\u51FA\u4E3A HTML"),[`${l} --export ~/${I}/agent/sessions/--path--/session.jsonl`,`${l} --export session.jsonl output.html`]]].map(([A,c])=>[` # ${A}`,...c.map(f=>` ${f}`)].join(`
|
|
7
7
|
`)).join(`
|
|
8
8
|
|
|
9
|
-
`),
|
|
9
|
+
`),a=h([["ANTHROPIC_AUTH_TOKEN",e("Anthropic \u7684 bearer \u8BA4\u8BC1 token")],["ANTHROPIC_API_KEY",r("Anthropic Claude")],["ANTHROPIC_OAUTH_TOKEN",e("Anthropic \u7684 OAuth token\uFF08\u53EF\u4EE3\u66FF API key\uFF09")],["ANT_LING_API_KEY",r("Ant Ling")],["OPENAI_API_KEY",r("OpenAI GPT")],["AZURE_OPENAI_API_KEY",r("Azure OpenAI")],["AZURE_OPENAI_BASE_URL",e("Azure OpenAI / Cognitive Services \u7684 base URL\uFF08\u4F8B\u5982 https://{resource}.openai.azure.com\uFF09")],["AZURE_OPENAI_RESOURCE_NAME",e("Azure OpenAI \u7684\u8D44\u6E90\u540D\u79F0\uFF08\u53EF\u4EE3\u66FF base URL\uFF09")],["AZURE_OPENAI_API_VERSION",e("Azure OpenAI \u7684 API \u7248\u672C\uFF08\u9ED8\u8BA4\uFF1Av1\uFF09")],["AZURE_OPENAI_DEPLOYMENT_NAME_MAP",e("Azure OpenAI \u7684 model=deployment \u5BF9\u5E94\u8868\uFF08\u9017\u53F7\u5206\u9694\uFF09")],["DEEPSEEK_API_KEY",r("DeepSeek")],["NVIDIA_API_KEY",r("NVIDIA NIM")],["GEMINI_API_KEY",r("Google Gemini")],["GROQ_API_KEY",r("Groq")],["CEREBRAS_API_KEY",r("Cerebras")],["XAI_API_KEY",r("xAI Grok")],["FIREWORKS_API_KEY",r("Fireworks")],["TOGETHER_API_KEY",r("Together AI")],["BASETEN_API_KEY",r("Baseten")],["OPENROUTER_API_KEY",r("OpenRouter")],["AI_GATEWAY_API_KEY",r("Vercel AI Gateway")],["ZAI_API_KEY",e("ZAI Coding Plan \u7684 API key\uFF08\u56FD\u9645\u7248\uFF09")],["ZAI_CODING_CN_API_KEY",e("ZAI Coding Plan \u7684 API key\uFF08\u4E2D\u56FD\u533A\uFF09")],["MISTRAL_API_KEY",r("Mistral")],["MINIMAX_API_KEY",r("MiniMax")],["MOONSHOT_API_KEY",r("Moonshot AI")],["OPENCODE_API_KEY",r("OpenCode Zen/OpenCode Go")],["KIMI_API_KEY",r("Kimi For Coding")],["META_API_KEY",r("Meta Model")],["CLOUDFLARE_API_KEY",e("Cloudflare \u7684 API token\uFF08Workers AI \u548C AI Gateway \u901A\u7528\uFF09")],["CLOUDFLARE_ACCOUNT_ID",e("Cloudflare \u8D26\u53F7 ID\uFF08\u4E24\u8005\u90FD\u9700\u8981\uFF09")],["CLOUDFLARE_GATEWAY_ID",e("Cloudflare AI Gateway \u7684 slug\uFF08\u4F7F\u7528 AI Gateway \u65F6\u9700\u8981\uFF09")],["QWEN_TOKEN_PLAN_API_KEY",e("Qwen Token Plan \u7684 API key\uFF08\u56FD\u9645\u533A\uFF09")],["QWEN_TOKEN_PLAN_CN_API_KEY",e("Qwen Token Plan \u7684 API key\uFF08\u4E2D\u56FD\u533A\uFF09")],["XIAOMI_API_KEY",e("\u5C0F\u7C73 MiMo \u7684 API key\uFF08api.xiaomimimo.com \u8BA1\u8D39\uFF09")],["XIAOMI_TOKEN_PLAN_CN_API_KEY",e("\u5C0F\u7C73 MiMo Token Plan \u7684 API key\uFF08\u4E2D\u56FD\u533A\uFF09")],["XIAOMI_TOKEN_PLAN_AMS_API_KEY",e("\u5C0F\u7C73 MiMo Token Plan \u7684 API key\uFF08\u963F\u59C6\u65AF\u7279\u4E39\u533A\uFF09")],["XIAOMI_TOKEN_PLAN_SGP_API_KEY",e("\u5C0F\u7C73 MiMo Token Plan \u7684 API key\uFF08\u65B0\u52A0\u5761\u533A\uFF09")],["AWS_PROFILE",e("Amazon Bedrock \u4F7F\u7528\u7684 AWS profile")],["AWS_ACCESS_KEY_ID",e("Amazon Bedrock \u4F7F\u7528\u7684 AWS access key")],["AWS_SECRET_ACCESS_KEY",e("Amazon Bedrock \u4F7F\u7528\u7684 AWS secret key")],["AWS_BEARER_TOKEN_BEDROCK",e("Bedrock \u7684 API key\uFF08bearer token\uFF09")],["AWS_REGION",e("Amazon Bedrock \u4F7F\u7528\u7684 AWS \u533A\u57DF\uFF08\u4F8B\u5982 us-east-1\uFF09")],[g,m(e("\u914D\u7F6E\u76EE\u5F55\uFF08\u9ED8\u8BA4\uFF1A~/{dir}/agent\uFF09"),{dir:I})],[x,e("\u4F1A\u8BDD\u5B58\u50A8\u76EE\u5F55\uFF08\u4F1A\u88AB --session-dir \u8986\u76D6\uFF09")],["PI_PACKAGE_DIR",e("\u8986\u76D6\u5305\u76EE\u5F55\uFF08\u7528\u4E8E Nix/Guix store \u8DEF\u5F84\uFF09")],["PI_OFFLINE",e("\u8BBE\u4E3A 1/true/yes \u65F6\uFF0C\u542F\u52A8\u65F6\u4E0D\u8FDB\u884C\u4EFB\u4F55\u8054\u7F51\u64CD\u4F5C")],["PI_TELEMETRY",e("\u8BBE\u4E3A 1/true/yes \u6216 0/false/no \u65F6\uFF0C\u8986\u76D6\u5B89\u88C5\u7EDF\u8BA1\u8BBE\u7F6E")],["DAL_SHARE_VIEWER_URL",e("\u53EF\u9009\uFF1A/share \u4F7F\u7528\u7684\u81EA\u5B9A\u4E49\u67E5\u770B\u9875\u5730\u5740")]],32," - "),E=h([["read",e("\u8BFB\u53D6\u6587\u4EF6\u5185\u5BB9")],["bash",e("\u6267\u884C bash \u547D\u4EE4")],["powershell",e("\u5728 Windows \u4E0A\u6267\u884C PowerShell \u547D\u4EE4")],["edit",e("\u7528\u67E5\u627E\u66FF\u6362\u7684\u65B9\u5F0F\u7F16\u8F91\u6587\u4EF6")],["write",e("\u5199\u5165\u6587\u4EF6\uFF08\u65B0\u5EFA\u6216\u8986\u76D6\uFF09")],["grep",e("\u641C\u7D22\u6587\u4EF6\u5185\u5BB9\uFF08\u53EA\u8BFB\uFF0C\u9ED8\u8BA4\u5173\u95ED\uFF09")],["find",e("\u6309\u901A\u914D\u7B26\u67E5\u627E\u6587\u4EF6\uFF08\u53EA\u8BFB\uFF0C\u9ED8\u8BA4\u5173\u95ED\uFF09")],["ls",e("\u5217\u51FA\u76EE\u5F55\u5185\u5BB9\uFF08\u53EA\u8BFB\uFF0C\u9ED8\u8BA4\u5173\u95ED\uFF09")]],10," - ");console.log(`${u.bold(k)} (${l})
|
|
10
10
|
|
|
11
|
-
${
|
|
11
|
+
${u.bold(e("\u7528\u6CD5\uFF1A"))}
|
|
12
12
|
${l} [options] [--] [@files...] [messages...]
|
|
13
13
|
|
|
14
|
-
${
|
|
14
|
+
${u.bold(e("\u53EF\u7528\u547D\u4EE4\uFF1A"))}
|
|
15
15
|
${n}
|
|
16
16
|
|
|
17
|
-
${
|
|
18
|
-
${
|
|
17
|
+
${u.bold(e("\u9009\u9879\uFF1A"))}
|
|
18
|
+
${t}
|
|
19
19
|
|
|
20
|
-
${e("\u6269\u5C55\u8FD8\u53EF\u4EE5\u6CE8\u518C\u66F4\u591A\u9009\u9879\uFF08\u4F8B\u5982\u8BA1\u5212\u6A21\u5F0F\u6269\u5C55\u63D0\u4F9B\u7684 --plan\uFF09\u3002")}${
|
|
20
|
+
${e("\u6269\u5C55\u8FD8\u53EF\u4EE5\u6CE8\u518C\u66F4\u591A\u9009\u9879\uFF08\u4F8B\u5982\u8BA1\u5212\u6A21\u5F0F\u6269\u5C55\u63D0\u4F9B\u7684 --plan\uFF09\u3002")}${s}
|
|
21
21
|
|
|
22
|
-
${
|
|
23
|
-
${d}
|
|
24
|
-
|
|
25
|
-
${m.bold(e("\u73AF\u5883\u53D8\u91CF\uFF1A"))}
|
|
22
|
+
${u.bold(e("\u793A\u4F8B\uFF1A"))}
|
|
26
23
|
${p}
|
|
27
24
|
|
|
28
|
-
${
|
|
25
|
+
${u.bold(e("\u73AF\u5883\u53D8\u91CF\uFF1A"))}
|
|
26
|
+
${a}
|
|
27
|
+
|
|
28
|
+
${u.bold(e("\u5185\u7F6E\u5DE5\u5177\u540D\u79F0\uFF1A"))}
|
|
29
29
|
${E}
|
|
30
|
-
`)}
|
|
30
|
+
`)}d(L,"printHelp");export{$ as isValidThinkingLevel,C as normalizeSessionName,w as parseArgs,L as printHelp,b as reclaimBooleanFlagMessages};
|
package/dist/config.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare function getReadmePath(): string;
|
|
|
27
27
|
export declare function getDocsPath(): string;
|
|
28
28
|
export declare function getExamplesPath(): string;
|
|
29
29
|
export declare function getDalDocsPath(): string;
|
|
30
|
+
export declare function getDalExtensionExamplesPath(): string;
|
|
30
31
|
export declare function getOfficialExtensionsPath(): string;
|
|
31
32
|
export declare const OFFICIAL_EXTENSIONS_PACKAGE_NAME = "@deepailab/dal-official-extensions";
|
|
32
33
|
export declare function isOfficialExtensionsPackage(packageRoot: string): boolean;
|