dal-code 1.0.24 → 1.0.25
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 +18 -0
- package/dal-docs/README.md +96 -0
- package/dal-docs/extensions.md +98 -0
- package/dal-docs/keybindings.md +40 -0
- package/dal-docs/packages.md +62 -0
- package/dal-docs/prompt-templates.md +42 -0
- package/dal-docs/settings.md +86 -0
- package/dal-docs/skills.md +65 -0
- package/dal-docs/themes.md +44 -0
- package/dist/cli/args.d.ts +56 -0
- package/dist/config.d.ts +63 -0
- package/dist/config.js +1 -1
- package/dist/core/agent-session-runtime.d.ts +74 -0
- package/dist/core/agent-session-services.d.ts +48 -0
- package/dist/core/agent-session.d.ts +409 -0
- package/dist/core/agent-session.js +5 -5
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/bash-executor.d.ts +13 -0
- package/dist/core/cache-warmer.d.ts +60 -0
- package/dist/core/compaction/branch-summarization.d.ts +43 -0
- package/dist/core/compaction/compaction.d.ts +62 -0
- package/dist/core/compaction/index.d.ts +3 -0
- package/dist/core/compaction/utils.d.ts +16 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/exec.d.ts +12 -0
- package/dist/core/extensions/index.d.ts +8 -0
- package/dist/core/extensions/loader.d.ts +13 -0
- package/dist/core/extensions/runner.d.ts +165 -0
- package/dist/core/extensions/types.d.ts +1000 -0
- package/dist/core/extensions/wrapper.d.ts +5 -0
- package/dist/core/footer-data-provider.d.ts +46 -0
- package/dist/core/keybindings.d.ts +525 -0
- package/dist/core/messages.d.ts +50 -0
- package/dist/core/model-config.d.ts +1212 -0
- package/dist/core/model-registry.d.ts +41 -0
- package/dist/core/model-resolver.d.ts +67 -0
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-runtime.d.ts +101 -0
- package/dist/core/model-runtime.js +2 -2
- package/dist/core/package-manager.d.ts +213 -0
- package/dist/core/package-manager.js +2 -2
- package/dist/core/project-map.d.ts +18 -0
- package/dist/core/prompt-templates.d.ts +24 -0
- package/dist/core/provider-composer.d.ts +55 -0
- package/dist/core/remote-catalog-provider.js +1 -1
- package/dist/core/resolve-config-value.d.ts +11 -0
- package/dist/core/resource-loader.d.ts +220 -0
- package/dist/core/resource-loader.js +1 -1
- package/dist/core/sdk.d.ts +40 -0
- package/dist/core/session-manager.d.ts +208 -0
- package/dist/core/settings-manager.d.ts +348 -0
- package/dist/core/settings-manager.js +1 -1
- package/dist/core/skills.d.ts +33 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/system-prompt.d.ts +39 -0
- package/dist/core/system-prompt.js +15 -11
- package/dist/core/tools/bash.d.ts +75 -0
- package/dist/core/tools/bash.js +14 -14
- package/dist/core/tools/edit-diff.d.ts +44 -0
- package/dist/core/tools/edit.d.ts +48 -0
- package/dist/core/tools/file-mutation-queue.d.ts +1 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/grep.d.ts +34 -0
- package/dist/core/tools/index.d.ts +42 -0
- package/dist/core/tools/index.js +1 -1
- package/dist/core/tools/ls.d.ts +33 -0
- package/dist/core/tools/powershell.d.ts +17 -0
- package/dist/core/tools/read.d.ts +33 -0
- package/dist/core/tools/read.js +2 -2
- package/dist/core/tools/renderers/bash.d.ts +3 -0
- package/dist/core/tools/renderers/edit.d.ts +15 -0
- package/dist/core/tools/renderers/find.d.ts +2 -0
- package/dist/core/tools/renderers/grep.d.ts +2 -0
- package/dist/core/tools/renderers/index.d.ts +13 -0
- package/dist/core/tools/renderers/ls.d.ts +2 -0
- package/dist/core/tools/renderers/read.d.ts +3 -0
- package/dist/core/tools/renderers/read.js +8 -8
- package/dist/core/tools/renderers/write.d.ts +2 -0
- package/dist/core/tools/truncate.d.ts +27 -0
- package/dist/core/tools/write.d.ts +24 -0
- package/dist/core/trust-manager.d.ts +28 -0
- package/dist/core/trust-manager.js +2 -2
- package/dist/dal/child-env.d.ts +12 -0
- package/dist/dal/child-env.js +1 -0
- package/dist/dal/hooks/activity.d.ts +17 -0
- package/dist/dal/hooks/activity.js +1 -0
- package/dist/dal/hooks/config.d.ts +47 -0
- package/dist/dal/hooks/config.js +1 -0
- package/dist/dal/hooks/events.d.ts +43 -0
- package/dist/dal/hooks/events.js +4 -0
- package/dist/dal/hooks/extension.d.ts +3 -0
- package/dist/dal/hooks/extension.js +4 -0
- package/dist/dal/hooks/index.d.ts +5 -0
- package/dist/dal/hooks/index.js +1 -0
- package/dist/dal/hooks/runner.d.ts +57 -0
- package/dist/dal/hooks/runner.js +1 -0
- package/dist/dal/safety-net.js +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +1 -1
- package/dist/main.d.ts +9 -0
- package/dist/main.js +2 -2
- package/dist/modes/acp/acp-mode.d.ts +2 -0
- package/dist/modes/index.d.ts +7 -0
- package/dist/modes/interactive/components/armin.d.ts +30 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +26 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +22 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +14 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +11 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +11 -0
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-message.d.ts +17 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +17 -0
- package/dist/modes/interactive/components/diff.d.ts +4 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +12 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-input.d.ts +21 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +22 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +23 -0
- package/dist/modes/interactive/components/footer.d.ts +18 -0
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/index.d.ts +33 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +9 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +27 -0
- package/dist/modes/interactive/components/model-selector.d.ts +81 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +29 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +39 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +20 -0
- package/dist/modes/interactive/components/session-selector.d.ts +88 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +92 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +6 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +11 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +44 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +7 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +19 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +76 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +65 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +22 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +23 -0
- package/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode.d.ts +326 -0
- package/dist/modes/interactive/theme/theme-json.d.ts +257 -0
- package/dist/modes/interactive/theme/theme.d.ts +106 -0
- package/dist/modes/interactive/tui-renderer.d.ts +18 -0
- package/dist/modes/json-event.d.ts +26 -0
- package/dist/modes/print-mode.d.ts +9 -0
- package/dist/modes/rpc/rpc-client.d.ts +119 -0
- package/dist/modes/rpc/rpc-client.js +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -0
- package/dist/modes/rpc/rpc-types.d.ts +483 -0
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/src/ask-user.js +12 -0
- package/dist/node_modules/@dalcode/dal-bridge/src/client.js +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -4
- package/dist/node_modules/@dalcode/dal-guard/src/hooks.js +1 -0
- package/dist/node_modules/@dalcode/dal-guard/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-lsp/src/client.js +3 -3
- package/dist/node_modules/@dalcode/dal-mcp/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/config.d.ts +9 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/http-client.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.d.ts +22 -0
- package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.js +2 -2
- package/dist/node_modules/@dalcode/dal-mcp/src/types.d.ts +30 -0
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-office/src/extract/csv.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/index.d.ts +11 -0
- package/dist/node_modules/@dalcode/dal-office/src/index.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/paths.d.ts +3 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/chart.js +1 -1
- package/dist/node_modules/@dalcode/dal-office/src/render/docx.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.d.ts +40 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/pptx.js +2 -2
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.d.ts +19 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/thumbnails.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.d.ts +14 -0
- package/dist/node_modules/@dalcode/dal-office/src/scratchpad.d.ts +16 -0
- package/dist/node_modules/@dalcode/dal-office/src/themes.d.ts +13 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/docx-edit.js +10 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/edit-shared.js +1 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/pptx-edit.js +9 -0
- package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.js +4 -2
- package/dist/node_modules/@dalcode/dal-office/src/tools/xlsx-edit.js +5 -0
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +2 -2
- package/dist/node_modules/@dalcode/dal-plugins/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-rewind/src/core.d.ts +61 -0
- package/dist/node_modules/@dalcode/dal-router/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +50 -0
- package/dist/node_modules/@dalcode/dal-router/src/jev.d.ts +51 -0
- package/dist/node_modules/@dalcode/dal-router/src/pool.d.ts +6 -0
- package/dist/node_modules/@dalcode/dal-router/src/router.d.ts +32 -0
- package/dist/node_modules/@dalcode/dal-router/src/runtime.d.ts +37 -0
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-skills/src/discover.js +4 -4
- package/dist/node_modules/@dalcode/dal-skills/src/index.js +9 -9
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-subagent/src/index.js +10 -10
- package/dist/node_modules/@dalcode/dal-subagent/src/process-runner.js +3 -3
- package/dist/node_modules/@dalcode/dal-telemetry/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-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-workflow/src/plan-mode.js +1 -1
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/index.js +3 -3
- package/dist/node_modules/@dalcode/deepailab/src/model-defaults.js +1 -1
- package/dist/node_modules/@earendil-works/chord/dist/api.d.ts +21 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.d.ts +127 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.d.ts +8 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.d.ts +2 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.d.ts +16 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.d.ts +32 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.d.ts +59 -0
- package/dist/node_modules/@earendil-works/chord/dist/state/draft.d.ts +13 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.d.ts +188 -0
- package/dist/node_modules/@earendil-works/chord/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +80 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +711 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts +44 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts +80 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +50 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.d.ts +132 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.d.ts +56 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.d.ts +94 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.d.ts +99 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.d.ts +52 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +33 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +37 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +36 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +46 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +75 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +473 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.d.ts +94 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.d.ts +1495 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +185 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +27 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/stream-fn.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +150 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.lazy.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts +12 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts +14 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/lazy.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +85 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.lazy.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/context.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/helpers.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +127 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/cli.js +0 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +47 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +829 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-api-registry.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.d.ts +37 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/images.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/index.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/legacy-api-aliases.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/model-catalog.d.ts +16 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +21 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.d.ts +97 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +84 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts +18 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/baseten.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.d.ts +3 -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/azure-openai-responses.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.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/deepseek.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +100 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/google.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/images/register-builtins.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/meta.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/radius.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/together.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/session-resources.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +502 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.d.ts +63 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/json-parse.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +16 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/text.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/transcript.d.ts +29 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/typebox-helpers.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/uuid.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts +3 -0
- 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-coding-agent/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/index.d.ts +1 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/index.js +1 -0
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +15 -0
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/package.json +5 -5
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/index.d.ts +200 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/memory.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/dist/noop.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +55 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +151 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +43 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +28 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/mouse-region.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +61 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +52 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +50 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +35 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/index.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +329 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +101 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/latex.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +41 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/native-platform.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-colors.d.ts +9 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +82 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +76 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +138 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui-main-screen.d.ts +32 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +252 -0
- package/dist/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/package-manager-cli.js +32 -32
- package/dist/sdk/index.d.ts +14 -0
- package/dist/sdk/index.js +1 -0
- package/dist/sdk/mcp.d.ts +8 -0
- package/dist/sdk/mcp.js +1 -0
- package/dist/sdk/office.d.ts +1 -0
- package/dist/sdk/office.js +1 -0
- package/dist/sdk/rewind.d.ts +1 -0
- package/dist/sdk/rewind.js +1 -0
- package/dist/sdk/router.d.ts +6 -0
- package/dist/sdk/router.js +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/image-convert.d.ts +5 -0
- package/dist/utils/image-resize-core.d.ts +16 -0
- package/dist/utils/image-resize.d.ts +4 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/shell.d.ts +20 -0
- package/dist/utils/shell.js +3 -3
- package/dist/utils/version-check.d.ts +20 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/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 +2 -2
- package/package.json +22 -1
- package/dist/bun/register-bedrock.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/session-handle.js +0 -1
- package/dist/node_modules/@earendil-works/pi-client/dist/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.js +0 -16
- package/dist/node_modules/@earendil-works/pi-server/dist/config.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.js +0 -2
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.js +0 -2
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.js +0 -3
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.js +0 -4
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.js +0 -1
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.js +0 -1
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.js +0 -7
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.js +0 -36
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.js +0 -25
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.js +0 -2
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.js +0 -7
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.js +0 -20
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.js +0 -26
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.js +0 -9
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.js +0 -1
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.js +0 -10
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.js +0 -29
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.js +0 -14
- package/dist/server/create-harness.js +0 -1
- package/dist/utils/clipboard-native.js +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { type Static, Type } from "typebox";
|
|
3
|
+
import { type ShellConfig } from "../../utils/shell.ts";
|
|
4
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
5
|
+
import { type TruncationResult } from "./truncate.ts";
|
|
6
|
+
declare const bashSchema: Type.TObject<{
|
|
7
|
+
command: Type.TString;
|
|
8
|
+
description: Type.TString;
|
|
9
|
+
timeout: Type.TOptional<Type.TNumber>;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const bashToolSystemPromptContribution: {
|
|
12
|
+
readonly snippet: "Execute bash commands (ls, grep, find, etc.)";
|
|
13
|
+
readonly guidelines: readonly [
|
|
14
|
+
"You can inspect PI_* environment variables for current model and session details."
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
export type BashToolInput = Static<typeof bashSchema>;
|
|
18
|
+
export interface BashToolDetails {
|
|
19
|
+
truncation?: TruncationResult;
|
|
20
|
+
fullOutputPath?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface BashOperations {
|
|
23
|
+
exec: (command: string, cwd: string, options: {
|
|
24
|
+
onData: (data: Buffer) => void;
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
timeout?: number;
|
|
27
|
+
env?: NodeJS.ProcessEnv;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
exitCode: number | null;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export declare function createLocalShellOperations(shellName: string, resolveShellConfig: () => ShellConfig): BashOperations;
|
|
33
|
+
export declare function createLocalBashOperations(options?: {
|
|
34
|
+
shellPath?: string;
|
|
35
|
+
}): BashOperations;
|
|
36
|
+
export interface ShellExecutionRequest {
|
|
37
|
+
readonly toolName: string;
|
|
38
|
+
readonly command: string;
|
|
39
|
+
readonly cwd: string;
|
|
40
|
+
readonly sessionFile?: string;
|
|
41
|
+
}
|
|
42
|
+
export type ShellExecutionGuard = (request: ShellExecutionRequest) => Promise<string | undefined> | string | undefined;
|
|
43
|
+
export declare function registerShellExecutionGuard(guard: ShellExecutionGuard): () => void;
|
|
44
|
+
export interface BashSpawnContext {
|
|
45
|
+
command: string;
|
|
46
|
+
cwd: string;
|
|
47
|
+
env: NodeJS.ProcessEnv;
|
|
48
|
+
}
|
|
49
|
+
export type BashSpawnHook = (context: BashSpawnContext) => BashSpawnContext;
|
|
50
|
+
export interface BashToolOptions {
|
|
51
|
+
operations?: BashOperations;
|
|
52
|
+
commandPrefix?: string;
|
|
53
|
+
shellPath?: string;
|
|
54
|
+
exposeSessionEnvironment?: boolean;
|
|
55
|
+
spawnHook?: BashSpawnHook;
|
|
56
|
+
}
|
|
57
|
+
export type BashRenderState = {
|
|
58
|
+
startedAt: number | undefined;
|
|
59
|
+
endedAt: number | undefined;
|
|
60
|
+
interval: NodeJS.Timeout | undefined;
|
|
61
|
+
};
|
|
62
|
+
export interface ShellToolConfig {
|
|
63
|
+
name: string;
|
|
64
|
+
label: string;
|
|
65
|
+
shellName: string;
|
|
66
|
+
prompt: string;
|
|
67
|
+
promptSnippet: string;
|
|
68
|
+
promptGuidelines?: readonly string[];
|
|
69
|
+
tempFilePrefix: string;
|
|
70
|
+
readOnlyCommand?: (command: unknown) => boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare function createShellToolDefinition(cwd: string, config: ShellToolConfig, options?: BashToolOptions): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState>;
|
|
73
|
+
export declare function createBashToolDefinition(cwd: string, options?: BashToolOptions): ToolDefinition<typeof bashSchema, BashToolDetails | undefined, BashRenderState>;
|
|
74
|
+
export declare function createBashTool(cwd: string, options?: BashToolOptions): AgentTool<typeof bashSchema>;
|
|
75
|
+
export {};
|
package/dist/core/tools/bash.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
Cannot execute ${
|
|
3
|
-
${h.fg("muted",` \u23BF ${
|
|
1
|
+
var Z=Object.defineProperty;var u=(t,n)=>Z(t,"name",{value:n,configurable:!0});import{constants as ee}from"node:fs";import{access as te}from"node:fs/promises";import{constants as ne}from"node:os";import{Container as ie,Text as _,truncateToWidth as oe}from"@earendil-works/pi-tui";import{spawn as re}from"child_process";import{Type as I}from"typebox";import{fill as C,t as $}from"../../dal/i18n.js";import{keyHint as se}from"../../modes/interactive/components/keybinding-hints.js";import{truncateToVisualLines as ae}from"../../modes/interactive/components/visual-truncate.js";import{theme as h}from"../../modes/interactive/theme/theme.js";import{waitForChildProcess as de}from"../../utils/child-process.js";import{getShellConfig as ue,getShellEnv as U,killProcessTree as V,trackDetachedChildPid as le,untrackDetachedChildPid as ce}from"../../utils/shell.js";import{isReadOnlyBashCommand as me}from"./bash-read-only.js";import{OutputAccumulator as fe}from"./output-accumulator.js";import{countOutputLines as pe,formatCollapsedSummary as he,getTextOutput as j,invalidArgText as we,str as X,truncateDisplay as Se}from"./render-utils.js";import{wrapToolDefinition as Ee}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as R,DEFAULT_MAX_LINES as $e,formatSize as F}from"./truncate.js";const z=2147483647,Oe=z/1e3,K=12e4;function Te(t){if(t===void 0)return K;if(!Number.isFinite(t)||t<=0)throw new Error("Invalid timeout: must be a finite number of seconds");const n=t*1e3;if(n>z)throw new Error(`Invalid timeout: maximum is ${Oe} seconds`);return n}u(Te,"resolveTimeoutMs");const xe=I.Object({command:I.String({description:"Shell command to execute"}),description:I.String({description:`One short line, in the user's language, saying what this command does and why \u2014 shown in place of the command itself. Describe the intent, not the syntax: "Find hardcoded key names", not "run grep with --exclude-dir". 3-10 words.`}),timeout:I.Optional(I.Number({description:"Timeout in seconds. Defaults to 120; raise it for genuinely long-running commands."}))}),Y={snippet:"Execute bash commands (ls, grep, find, etc.)",guidelines:["You can inspect PI_* environment variables for current model and session details."]};function Pe(t,n){return{exec:u(async(i,o,{onData:l,signal:r,timeout:E,env:s})=>{const a=Te(E);if(r?.aborted)throw new Error("aborted");const f=n();try{await te(o,ee.F_OK)}catch{throw new Error(`Working directory does not exist: ${o}
|
|
2
|
+
Cannot execute ${t} commands.`)}const m=f.commandTransport==="stdin",e=re(f.shell,m?f.args:[...f.args,i],{cwd:o,detached:process.platform!=="win32",env:s??U(),stdio:[m?"pipe":"ignore","pipe","pipe"],windowsHide:!0});m&&(e.stdin?.on("error",()=>{}),e.stdin?.end(i)),e.pid&&le(e.pid);let c=!1,p;const T=u(()=>{e.pid&&V(e.pid)},"onAbort");try{a!==void 0&&(p=setTimeout(()=>{c=!0,e.pid&&V(e.pid)},a)),e.stdout?.on("data",l),e.stderr?.on("data",l),r&&(r.aborted?T():r.addEventListener("abort",T,{once:!0}));const x=await de(e);if(r?.aborted)throw new Error("aborted");if(c)throw new Error(`timeout:${(a??K)/1e3}`);const S=e.signalCode;return{exitCode:x??(S?128+(ne.signals[S]??0):1)}}finally{e.pid&&ce(e.pid),p&&clearTimeout(p),r&&r.removeEventListener("abort",T)}},"exec")}}u(Pe,"createLocalShellOperations");function ge(t){return Pe("bash",()=>ue(t?.shellPath))}u(ge,"createLocalBashOperations");const B=new Set;function Ze(t){return B.add(t),()=>{B.delete(t)}}u(Ze,"registerShellExecutionGuard");async function Ce(t){for(const n of B){let i;try{i=await n(t)}catch(o){return`Command refused: the safety check could not run (${o instanceof Error?o.message:String(o)}).`}if(i!==void 0)return i}}u(Ce,"shellExecutionRefusal");function Le(t,n,i,o,l){const r={...U()};if(delete r.PI_SESSION_ID,delete r.PI_SESSION_FILE,delete r.PI_PROVIDER,delete r.PI_MODEL,delete r.PI_REASONING_LEVEL,o&&l){const s=l.model;r.PI_SESSION_ID=l.sessionManager.getSessionId();const a=l.sessionManager.getSessionFile();a&&(r.PI_SESSION_FILE=a),s&&(r.PI_PROVIDER=s.provider,r.PI_MODEL=s.id),l.thinkingLevel&&(r.PI_REASONING_LEVEL=l.thinkingLevel)}const E={command:t,cwd:n,env:r};return i?i(E):E}u(Le,"resolveSpawnContext");const ye=5,_e=100;class Ie extends ie{static{u(this,"BashResultRenderComponent")}state={cachedWidth:void 0,cachedLines:void 0,cachedSkipped:void 0}}function q(t){const n=t/1e3;if(n<60)return`${n.toFixed(1)}s`;const i=Math.floor(n),o=Math.floor(i/60),l=i%60;return o<60?`${o}m ${l}s`:`${Math.floor(o/60)}h ${o%60}m ${l}s`}u(q,"formatDuration");function be(t,n,i=!1){const o=X(t?.command),l=X(t?.description)?.trim(),r=t?.timeout,E=r?h.fg("muted",C($(" (\u8D85\u65F6 {seconds} \u79D2)"),{seconds:r})):"";if(l){const a=h.fg("toolTitle",h.bold(l))+E;return!i||!o?a:`${a}
|
|
3
|
+
${h.fg("muted",` \u23BF ${n} ${o.trim()}`)}`}const s=o===null?we(h):o?h.fg("dim",Se(o.replace(/\s+/g," ").trim(),42)):h.fg("dim","\u2026");return`${h.fg("toolTitle",h.bold(n))} ${s}${E}`}u(be,"formatShellCall");function ve(t,n,i,o,l,r,E){const s=t.state;if(t.clear(),!i.expanded&&!E){const e=j(n,o),c=pe(e),p=[];if(c>0&&p.push(C($("{count} \u884C"),{count:c})),l!==void 0){const S=(r??Date.now())-l;if(i.isPartial||S>=100){const b=i.isPartial?$("\u5DF2\u8FD0\u884C"):$("\u8017\u65F6");p.push(`${b} ${q(S)}`)}}const T=he(h,p);T&&t.addChild(new _(T,0,0));return}let a=j(n,o).trim();const f=n.details?.truncation,m=n.details?.fullOutputPath;if(!i.isPartial&&f?.truncated&&m&&a.endsWith("]")){const e=a.lastIndexOf(`
|
|
4
4
|
|
|
5
|
-
[`);
|
|
6
|
-
`).map(
|
|
7
|
-
`);i.expanded?
|
|
8
|
-
${
|
|
9
|
-
${h.fg("warning",`[${
|
|
10
|
-
${h.fg("muted",`${
|
|
11
|
-
${a}`:a
|
|
5
|
+
[`);e!==-1&&a.slice(e).includes(m)&&(a=a.slice(0,e).trimEnd())}if(a){const e=a.split(`
|
|
6
|
+
`).map(c=>h.fg("toolOutput",c)).join(`
|
|
7
|
+
`);i.expanded?t.addChild(new _(`
|
|
8
|
+
${e}`,0,0)):t.addChild({render:u(c=>{if(s.cachedLines===void 0||s.cachedWidth!==c){const p=ae(e,ye,c);s.cachedLines=p.visualLines,s.cachedSkipped=p.skippedCount,s.cachedWidth=c}if(s.cachedSkipped&&s.cachedSkipped>0){const p=h.fg("muted",C($("... (\u524D\u9762\u8FD8\u6709 {count} \u884C\uFF0C"),{count:s.cachedSkipped}))+` ${se("app.tools.expand",$("\u5373\u53EF\u5C55\u5F00"))}${h.fg("muted",")")}`;return["",oe(p,c,"..."),...s.cachedLines??[]]}return["",...s.cachedLines??[]]},"render"),invalidate:u(()=>{s.cachedWidth=void 0,s.cachedLines=void 0,s.cachedSkipped=void 0},"invalidate")})}if(f?.truncated||m){const e=[];m&&e.push(C($("\u5B8C\u6574\u8F93\u51FA\uFF1A{path}"),{path:m})),f?.truncated&&(f.truncatedBy==="lines"?e.push(C($("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A {shown}/{total} \u884C"),{shown:f.outputLines,total:f.totalLines})):e.push(C($("\u5DF2\u622A\u65AD\uFF1A\u663E\u793A\u4E86 {shown} \u884C\uFF08\u4E0A\u9650 {limit}\uFF09"),{shown:f.outputLines,limit:F(f.maxBytes??R)}))),t.addChild(new _(`
|
|
9
|
+
${h.fg("warning",`[${e.join(". ")}]`)}`,0,0))}if(l!==void 0){const c=(r??Date.now())-l;if(i.isPartial||c>=100){const p=i.isPartial?$("\u5DF2\u8FD0\u884C"):$("\u8017\u65F6");t.addChild(new _(`
|
|
10
|
+
${h.fg("muted",`${p} ${q(c)}`)}`,0,0))}}}u(ve,"rebuildBashResultRenderComponent");function De(t,n,i){const o=i?.operations??ge({shellPath:i?.shellPath}),l=i?.commandPrefix,r=i?.exposeSessionEnvironment??!0,E=i?.spawnHook;return{name:n.name,label:n.label,description:`Execute a ${n.shellName} command in the current working directory. Returns stdout and stderr. Output is truncated to last ${$e} lines or ${R/1024}KB (whichever is hit first). If truncated, full output is saved to a temp file. Optionally provide a timeout in seconds.`,promptSnippet:n.promptSnippet,promptGuidelines:r&&n.promptGuidelines?[...n.promptGuidelines]:void 0,executionMode:"sequential",executionModeFor:n.readOnlyCommand&&!l?s=>n.readOnlyCommand?.(s?.command)?"parallel":void 0:void 0,parameters:xe,constrainedSampling:{type:"json_schema",strict:"prefer"},async execute(s,{command:a,timeout:f},m,e,c){e&&e({content:[],details:void 0});const p=await Ce({toolName:n.name,command:a,cwd:c?.cwd||t,sessionFile:c?.sessionManager?.getSessionFile()});if(p!==void 0)throw new Error(p);const T=l?`${l}
|
|
11
|
+
${a}`:a,x=Le(T,c?.cwd||t,E,r,c),S=new fe({tempFilePrefix:n.tempFilePrefix});let b=!0,L,M=!1,G=0;const A=u(()=>{if(!e||!M)return;M=!1,G=Date.now();const d=S.snapshot({persistIfTruncated:!0});e({content:[{type:"text",text:d.content||""}],details:{truncation:d.truncation.truncated?d.truncation:void 0,fullOutputPath:d.fullOutputPath}})},"emitOutputUpdate"),k=u(()=>{L&&(clearTimeout(L),L=void 0)},"clearUpdateTimer"),J=u(()=>{if(!e)return;M=!0;const d=_e-(Date.now()-G);if(d<=0){k(),A();return}L??=setTimeout(()=>{L=void 0,A()},d)},"scheduleOutputUpdate"),Q=u(d=>{b&&(S.append(d),J())},"handleData"),W=u(async()=>{b=!1,S.finish(),k(),A();const d=S.snapshot({persistIfTruncated:!0});return await S.closeTempFile(),d},"finishOutput"),H=u((d,y="(no output)")=>{const w=d.truncation;let P=d.content||y,O;if(w.truncated){O={truncation:w,fullOutputPath:d.fullOutputPath};const D=w.totalLines-w.outputLines+1,g=w.totalLines;if(w.lastLinePartial){const N=F(S.getLastLineBytes());P+=`
|
|
12
12
|
|
|
13
|
-
[Showing last ${
|
|
13
|
+
[Showing last ${F(w.outputBytes)} of line ${g} (line is ${N}). Full output: ${d.fullOutputPath}]`}else w.truncatedBy==="lines"?P+=`
|
|
14
14
|
|
|
15
|
-
[Showing lines ${
|
|
15
|
+
[Showing lines ${D}-${g} of ${w.totalLines}. Full output: ${d.fullOutputPath}]`:P+=`
|
|
16
16
|
|
|
17
|
-
[Showing lines ${
|
|
17
|
+
[Showing lines ${D}-${g} of ${w.totalLines} (${F(R)} limit). Full output: ${d.fullOutputPath}]`}return{text:P,details:O}},"formatOutput"),v=u((d,y)=>`${d?`${d}
|
|
18
18
|
|
|
19
|
-
`:""}${
|
|
19
|
+
`:""}${y}`,"appendStatus");try{let d;try{d=(await o.exec(x.command,x.cwd,{onData:Q,signal:m,timeout:f,env:x.env})).exitCode}catch(O){const D=await W(),{text:g}=H(D,"");if(O instanceof Error&&O.message==="aborted")throw new Error(v(g,"Command aborted"));if(O instanceof Error&&O.message.startsWith("timeout:")){const N=O.message.split(":")[1];throw new Error(v(g,`Command timed out after ${N} seconds`))}throw O}const y=await W(),{text:w,details:P}=H(y);if(d===null)throw new Error(v(w,"Command terminated without an exit code"));if(d!==0)throw new Error(v(w,`Command exited with code ${d}`));return{content:[{type:"text",text:w}],details:P}}finally{k()}},renderCall(s,a,f){const m=f.state;f.executionStarted&&m.startedAt===void 0&&(m.startedAt=Date.now(),m.endedAt=void 0);const e=f.lastComponent??new _("",0,0);return e.setText(be(s,n.prompt,f.expanded===!0)),e},renderResult(s,a,f,m){const e=m.state;e.startedAt!==void 0&&a.isPartial&&!e.interval&&(e.interval=setInterval(()=>m.invalidate(),1e3)),(!a.isPartial||m.isError)&&(e.endedAt??=Date.now(),e.interval&&(clearInterval(e.interval),e.interval=void 0));const c=m.lastComponent??new Ie;return ve(c,s,a,m.showImages,e.startedAt,e.endedAt,m.isError),c.invalidate(),c}}}u(De,"createShellToolDefinition");const Fe={name:"bash",label:"bash",shellName:"bash",prompt:"$",promptSnippet:Y.snippet,promptGuidelines:Y.guidelines,tempFilePrefix:"pi-bash",readOnlyCommand:me};function Me(t,n){return De(t,Fe,n)}u(Me,"createBashToolDefinition");function et(t,n){const i=Me(t,n),o=Ee(i);return Object.assign(o,{promptSnippet:i.promptSnippet,promptGuidelines:i.promptGuidelines}),o}u(et,"createBashTool");export{Y as bashToolSystemPromptContribution,et as createBashTool,Me as createBashToolDefinition,ge as createLocalBashOperations,Pe as createLocalShellOperations,De as createShellToolDefinition,Ze as registerShellExecutionGuard};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare function detectLineEnding(content: string): "\r\n" | "\n";
|
|
2
|
+
export declare function normalizeToLF(text: string): string;
|
|
3
|
+
export declare function restoreLineEndings(text: string, ending: "\r\n" | "\n"): string;
|
|
4
|
+
export declare function normalizeForFuzzyMatch(text: string): string;
|
|
5
|
+
interface MatchedEdit {
|
|
6
|
+
editIndex: number;
|
|
7
|
+
matchIndex: number;
|
|
8
|
+
matchLength: number;
|
|
9
|
+
newText: string;
|
|
10
|
+
}
|
|
11
|
+
type TextReplacement = Pick<MatchedEdit, "matchIndex" | "matchLength" | "newText">;
|
|
12
|
+
export declare function applyReplacementsPreservingUnchangedLines(originalContent: string, baseContent: string, replacements: TextReplacement[]): string;
|
|
13
|
+
export interface FuzzyMatchResult {
|
|
14
|
+
found: boolean;
|
|
15
|
+
index: number;
|
|
16
|
+
matchLength: number;
|
|
17
|
+
usedFuzzyMatch: boolean;
|
|
18
|
+
contentForReplacement: string;
|
|
19
|
+
}
|
|
20
|
+
export interface Edit {
|
|
21
|
+
oldText: string;
|
|
22
|
+
newText: string;
|
|
23
|
+
}
|
|
24
|
+
export interface AppliedEditsResult {
|
|
25
|
+
baseContent: string;
|
|
26
|
+
newContent: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function fuzzyFindText(content: string, oldText: string): FuzzyMatchResult;
|
|
29
|
+
export declare function applyEditsToNormalizedContent(normalizedContent: string, edits: Edit[], path: string): AppliedEditsResult;
|
|
30
|
+
export declare function generateUnifiedPatch(path: string, oldContent: string, newContent: string, contextLines?: number): string;
|
|
31
|
+
export declare function generateDiffString(oldContent: string, newContent: string, contextLines?: number): {
|
|
32
|
+
diff: string;
|
|
33
|
+
firstChangedLine: number | undefined;
|
|
34
|
+
};
|
|
35
|
+
export interface EditDiffResult {
|
|
36
|
+
diff: string;
|
|
37
|
+
firstChangedLine: number | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface EditDiffError {
|
|
40
|
+
error: string;
|
|
41
|
+
}
|
|
42
|
+
export declare function computeEditsDiff(path: string, edits: Edit[], cwd: string): Promise<EditDiffResult | EditDiffError>;
|
|
43
|
+
export declare function computeEditDiff(path: string, oldText: string, newText: string, cwd: string): Promise<EditDiffResult | EditDiffError>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { Box } from "@earendil-works/pi-tui";
|
|
3
|
+
import { type Static, Type } from "typebox";
|
|
4
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
5
|
+
import { type EditDiffError, type EditDiffResult } from "./edit-diff.ts";
|
|
6
|
+
type EditPreview = EditDiffResult | EditDiffError;
|
|
7
|
+
type EditRenderState = {
|
|
8
|
+
callComponent?: EditCallRenderComponent;
|
|
9
|
+
};
|
|
10
|
+
declare const editSchema: Type.TObject<{
|
|
11
|
+
path: Type.TString;
|
|
12
|
+
edits: Type.TArray<Type.TObject<{
|
|
13
|
+
oldText: Type.TString;
|
|
14
|
+
newText: Type.TString;
|
|
15
|
+
}>>;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const editToolSystemPromptContribution: {
|
|
18
|
+
readonly snippet: "Make precise file edits with exact text replacement, including multiple disjoint edits in one call";
|
|
19
|
+
readonly guidelines: readonly [
|
|
20
|
+
"Use edit for precise changes (edits[].oldText must match exactly)",
|
|
21
|
+
"When changing multiple separate locations in one file, use one edit call with multiple entries in edits[] instead of multiple edit calls",
|
|
22
|
+
"Each edits[].oldText is matched against the original file, not after earlier edits are applied. Do not emit overlapping or nested edits. Merge nearby changes into one edit.",
|
|
23
|
+
"Keep edits[].oldText as small as possible while still being unique in the file. Do not pad with large unchanged regions."
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
export type EditToolInput = Static<typeof editSchema>;
|
|
27
|
+
export interface EditToolDetails {
|
|
28
|
+
diff: string;
|
|
29
|
+
patch: string;
|
|
30
|
+
firstChangedLine?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface EditOperations {
|
|
33
|
+
readFile: (absolutePath: string) => Promise<Buffer>;
|
|
34
|
+
writeFile: (absolutePath: string, content: string) => Promise<void>;
|
|
35
|
+
access: (absolutePath: string) => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface EditToolOptions {
|
|
38
|
+
operations?: EditOperations;
|
|
39
|
+
}
|
|
40
|
+
type EditCallRenderComponent = Box & {
|
|
41
|
+
preview?: EditPreview;
|
|
42
|
+
previewArgsKey?: string;
|
|
43
|
+
previewPending?: boolean;
|
|
44
|
+
settledError?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export declare function createEditToolDefinition(cwd: string, options?: EditToolOptions): ToolDefinition<typeof editSchema, EditToolDetails | undefined, EditRenderState>;
|
|
47
|
+
export declare function createEditTool(cwd: string, options?: EditToolOptions): AgentTool<typeof editSchema>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withFileMutationQueue<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { type Static, Type } from "typebox";
|
|
4
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
5
|
+
import { type TruncationResult } from "./truncate.ts";
|
|
6
|
+
export declare function relativizeFindResultPath(resultPath: string, searchPath: string, pathModule?: path.PlatformPath): string;
|
|
7
|
+
declare const findSchema: Type.TObject<{
|
|
8
|
+
pattern: Type.TString;
|
|
9
|
+
path: Type.TOptional<Type.TString>;
|
|
10
|
+
limit: Type.TOptional<Type.TNumber>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const findToolSystemPromptContribution: {
|
|
13
|
+
readonly snippet: "Find files by glob pattern (respects .gitignore)";
|
|
14
|
+
readonly guidelines: readonly [
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
export type FindToolInput = Static<typeof findSchema>;
|
|
18
|
+
export interface FindToolDetails {
|
|
19
|
+
truncation?: TruncationResult;
|
|
20
|
+
resultLimitReached?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface FindOperations {
|
|
23
|
+
exists: (absolutePath: string) => Promise<boolean> | boolean;
|
|
24
|
+
glob: (pattern: string, cwd: string, options: {
|
|
25
|
+
ignore: string[];
|
|
26
|
+
limit: number;
|
|
27
|
+
}) => Promise<string[]> | string[];
|
|
28
|
+
}
|
|
29
|
+
export interface FindToolOptions {
|
|
30
|
+
operations?: FindOperations;
|
|
31
|
+
}
|
|
32
|
+
export declare function createFindToolDefinition(cwd: string, options?: FindToolOptions): ToolDefinition<typeof findSchema, FindToolDetails | undefined>;
|
|
33
|
+
export declare function createFindTool(cwd: string, options?: FindToolOptions): AgentTool<typeof findSchema>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { type Static, Type } from "typebox";
|
|
3
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
4
|
+
import { type TruncationResult } from "./truncate.ts";
|
|
5
|
+
declare const grepSchema: Type.TObject<{
|
|
6
|
+
pattern: Type.TString;
|
|
7
|
+
path: Type.TOptional<Type.TString>;
|
|
8
|
+
glob: Type.TOptional<Type.TString>;
|
|
9
|
+
ignoreCase: Type.TOptional<Type.TBoolean>;
|
|
10
|
+
literal: Type.TOptional<Type.TBoolean>;
|
|
11
|
+
context: Type.TOptional<Type.TNumber>;
|
|
12
|
+
limit: Type.TOptional<Type.TNumber>;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const grepToolSystemPromptContribution: {
|
|
15
|
+
readonly snippet: "Search file contents for patterns (respects .gitignore)";
|
|
16
|
+
readonly guidelines: readonly [
|
|
17
|
+
];
|
|
18
|
+
};
|
|
19
|
+
export type GrepToolInput = Static<typeof grepSchema>;
|
|
20
|
+
export interface GrepToolDetails {
|
|
21
|
+
truncation?: TruncationResult;
|
|
22
|
+
matchLimitReached?: number;
|
|
23
|
+
linesTruncated?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface GrepOperations {
|
|
26
|
+
isDirectory: (absolutePath: string) => Promise<boolean> | boolean;
|
|
27
|
+
readFile: (absolutePath: string) => Promise<string> | string;
|
|
28
|
+
}
|
|
29
|
+
export interface GrepToolOptions {
|
|
30
|
+
operations?: GrepOperations;
|
|
31
|
+
}
|
|
32
|
+
export declare function createGrepToolDefinition(cwd: string, options?: GrepToolOptions): ToolDefinition<typeof grepSchema, GrepToolDetails | undefined>;
|
|
33
|
+
export declare function createGrepTool(cwd: string, options?: GrepToolOptions): AgentTool<typeof grepSchema>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashTool, createBashToolDefinition, createLocalBashOperations, registerShellExecutionGuard, type ShellExecutionGuard, type ShellExecutionRequest, } from "./bash.ts";
|
|
2
|
+
export { createEditTool, createEditToolDefinition, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, } from "./edit.ts";
|
|
3
|
+
export { withFileMutationQueue } from "./file-mutation-queue.ts";
|
|
4
|
+
export { createFindTool, createFindToolDefinition, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, } from "./find.ts";
|
|
5
|
+
export { createGrepTool, createGrepToolDefinition, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, } from "./grep.ts";
|
|
6
|
+
export { createLsTool, createLsToolDefinition, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, } from "./ls.ts";
|
|
7
|
+
export { createLocalPowerShellOperations, createPowerShellTool, createPowerShellToolDefinition, type PowerShellOperations, type PowerShellSpawnContext, type PowerShellSpawnHook, type PowerShellToolDetails, type PowerShellToolInput, type PowerShellToolOptions, } from "./powershell.ts";
|
|
8
|
+
export { createReadTool, createReadToolDefinition, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, } from "./read.ts";
|
|
9
|
+
export { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, } from "./truncate.ts";
|
|
10
|
+
export { createWriteTool, createWriteToolDefinition, type WriteOperations, type WriteToolInput, type WriteToolOptions, } from "./write.ts";
|
|
11
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
12
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
13
|
+
import { type BashToolOptions } from "./bash.ts";
|
|
14
|
+
import { type EditToolOptions } from "./edit.ts";
|
|
15
|
+
import { type FindToolOptions } from "./find.ts";
|
|
16
|
+
import { type GrepToolOptions } from "./grep.ts";
|
|
17
|
+
import { type LsToolOptions } from "./ls.ts";
|
|
18
|
+
import { type PowerShellToolOptions } from "./powershell.ts";
|
|
19
|
+
import { type ReadToolOptions } from "./read.ts";
|
|
20
|
+
import { type WriteToolOptions } from "./write.ts";
|
|
21
|
+
export type Tool = AgentTool<any>;
|
|
22
|
+
export type ToolDef = ToolDefinition<any, any>;
|
|
23
|
+
export type ToolName = "read" | "bash" | "powershell" | "edit" | "write" | "grep" | "find" | "ls";
|
|
24
|
+
export declare const allToolNames: Set<ToolName>;
|
|
25
|
+
export interface ToolsOptions {
|
|
26
|
+
read?: ReadToolOptions;
|
|
27
|
+
bash?: BashToolOptions;
|
|
28
|
+
powershell?: PowerShellToolOptions;
|
|
29
|
+
write?: WriteToolOptions;
|
|
30
|
+
edit?: EditToolOptions;
|
|
31
|
+
grep?: GrepToolOptions;
|
|
32
|
+
find?: FindToolOptions;
|
|
33
|
+
ls?: LsToolOptions;
|
|
34
|
+
}
|
|
35
|
+
export declare function createToolDefinition(toolName: ToolName, cwd: string, options?: ToolsOptions): ToolDef;
|
|
36
|
+
export declare function createTool(toolName: ToolName, cwd: string, options?: ToolsOptions): Tool;
|
|
37
|
+
export declare function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[];
|
|
38
|
+
export declare function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[];
|
|
39
|
+
export declare function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName, ToolDef>;
|
|
40
|
+
export declare function createCodingTools(cwd: string, options?: ToolsOptions): Tool[];
|
|
41
|
+
export declare function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[];
|
|
42
|
+
export declare function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool>;
|
package/dist/core/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var b=Object.defineProperty;var a=(r,e)=>b(r,"name",{value:e,configurable:!0});import{createBashTool as H,createBashToolDefinition as I,createLocalBashOperations as Q}from"./bash.js";import{createEditTool as
|
|
1
|
+
var b=Object.defineProperty;var a=(r,e)=>b(r,"name",{value:e,configurable:!0});import{createBashTool as H,createBashToolDefinition as I,createLocalBashOperations as Q,registerShellExecutionGuard as Y}from"./bash.js";import{createEditTool as q,createEditToolDefinition as v}from"./edit.js";import{withFileMutationQueue as K}from"./file-mutation-queue.js";import{createFindTool as V,createFindToolDefinition as Z}from"./find.js";import{createGrepTool as ee,createGrepToolDefinition as re}from"./grep.js";import{createLsTool as ae,createLsToolDefinition as oe}from"./ls.js";import{createLocalPowerShellOperations as ie,createPowerShellTool as ne,createPowerShellToolDefinition as fe}from"./powershell.js";import{createReadTool as ue,createReadToolDefinition as he}from"./read.js";import{DEFAULT_MAX_BYTES as se,DEFAULT_MAX_LINES as me,formatSize as De,truncateHead as xe,truncateLine as de,truncateTail as ge}from"./truncate.js";import{createWriteTool as be,createWriteToolDefinition as Ee}from"./write.js";import{createBashTool as i,createBashToolDefinition as n}from"./bash.js";import{createEditTool as f,createEditToolDefinition as T}from"./edit.js";import{createFindTool as u,createFindToolDefinition as h}from"./find.js";import{createGrepTool as c,createGrepToolDefinition as s}from"./grep.js";import{createLsTool as m,createLsToolDefinition as D}from"./ls.js";import{createPowerShellTool as g,createPowerShellToolDefinition as p}from"./powershell.js";import{createReadTool as o,createReadToolDefinition as l}from"./read.js";import{createWriteTool as x,createWriteToolDefinition as d}from"./write.js";const O=new Set(["read","bash","powershell","edit","write","grep","find","ls"]);function U(r,e,t){switch(r){case"read":return l(e,t?.read);case"bash":return n(e,t?.bash);case"powershell":return p(e,t?.powershell);case"edit":return T(e,t?.edit);case"write":return d(e,t?.write);case"grep":return s(e,t?.grep);case"find":return h(e,t?.find);case"ls":return D(e,t?.ls);default:throw new Error(`Unknown tool name: ${r}`)}}a(U,"createToolDefinition");function W(r,e,t){switch(r){case"read":return o(e,t?.read);case"bash":return i(e,t?.bash);case"powershell":return g(e,t?.powershell);case"edit":return f(e,t?.edit);case"write":return x(e,t?.write);case"grep":return c(e,t?.grep);case"find":return u(e,t?.find);case"ls":return m(e,t?.ls);default:throw new Error(`Unknown tool name: ${r}`)}}a(W,"createTool");function _(r,e){return[l(r,e?.read),n(r,e?.bash),T(r,e?.edit),d(r,e?.write)]}a(_,"createCodingToolDefinitions");function M(r,e){return[l(r,e?.read),s(r,e?.grep),h(r,e?.find),D(r,e?.ls)]}a(M,"createReadOnlyToolDefinitions");function k(r,e){return{read:l(r,e?.read),bash:n(r,e?.bash),powershell:p(r,e?.powershell),edit:T(r,e?.edit),write:d(r,e?.write),grep:s(r,e?.grep),find:h(r,e?.find),ls:D(r,e?.ls)}}a(k,"createAllToolDefinitions");function y(r,e){return[o(r,e?.read),i(r,e?.bash),f(r,e?.edit),x(r,e?.write)]}a(y,"createCodingTools");function C(r,e){return[o(r,e?.read),c(r,e?.grep),u(r,e?.find),m(r,e?.ls)]}a(C,"createReadOnlyTools");function X(r,e){return{read:o(r,e?.read),bash:i(r,e?.bash),powershell:g(r,e?.powershell),edit:f(r,e?.edit),write:x(r,e?.write),grep:c(r,e?.grep),find:u(r,e?.find),ls:m(r,e?.ls)}}a(X,"createAllTools");export{se as DEFAULT_MAX_BYTES,me as DEFAULT_MAX_LINES,O as allToolNames,k as createAllToolDefinitions,X as createAllTools,H as createBashTool,I as createBashToolDefinition,_ as createCodingToolDefinitions,y as createCodingTools,q as createEditTool,v as createEditToolDefinition,V as createFindTool,Z as createFindToolDefinition,ee as createGrepTool,re as createGrepToolDefinition,Q as createLocalBashOperations,ie as createLocalPowerShellOperations,ae as createLsTool,oe as createLsToolDefinition,ne as createPowerShellTool,fe as createPowerShellToolDefinition,M as createReadOnlyToolDefinitions,C as createReadOnlyTools,ue as createReadTool,he as createReadToolDefinition,W as createTool,U as createToolDefinition,be as createWriteTool,Ee as createWriteToolDefinition,De as formatSize,Y as registerShellExecutionGuard,xe as truncateHead,de as truncateLine,ge as truncateTail,K as withFileMutationQueue};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { type Static, Type } from "typebox";
|
|
3
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
4
|
+
import { type TruncationResult } from "./truncate.ts";
|
|
5
|
+
declare const lsSchema: Type.TObject<{
|
|
6
|
+
path: Type.TOptional<Type.TString>;
|
|
7
|
+
limit: Type.TOptional<Type.TNumber>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const lsToolSystemPromptContribution: {
|
|
10
|
+
readonly snippet: "List directory contents";
|
|
11
|
+
readonly guidelines: readonly [
|
|
12
|
+
];
|
|
13
|
+
};
|
|
14
|
+
export type LsToolInput = Static<typeof lsSchema>;
|
|
15
|
+
export interface LsToolDetails {
|
|
16
|
+
truncation?: TruncationResult;
|
|
17
|
+
entryLimitReached?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface LsOperations {
|
|
20
|
+
exists: (absolutePath: string) => Promise<boolean> | boolean;
|
|
21
|
+
stat: (absolutePath: string) => Promise<{
|
|
22
|
+
isDirectory: () => boolean;
|
|
23
|
+
}> | {
|
|
24
|
+
isDirectory: () => boolean;
|
|
25
|
+
};
|
|
26
|
+
readdir: (absolutePath: string) => Promise<string[]> | string[];
|
|
27
|
+
}
|
|
28
|
+
export interface LsToolOptions {
|
|
29
|
+
operations?: LsOperations;
|
|
30
|
+
}
|
|
31
|
+
export declare function createLsToolDefinition(cwd: string, options?: LsToolOptions): ToolDefinition<typeof lsSchema, LsToolDetails | undefined>;
|
|
32
|
+
export declare function createLsTool(cwd: string, options?: LsToolOptions): AgentTool<typeof lsSchema>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, type createBashTool, createShellToolDefinition } from "./bash.ts";
|
|
2
|
+
export declare const powershellToolSystemPromptContribution: {
|
|
3
|
+
readonly snippet: "Execute PowerShell commands";
|
|
4
|
+
readonly guidelines: readonly [
|
|
5
|
+
"You can inspect PI_* environment variables for current model and session details."
|
|
6
|
+
];
|
|
7
|
+
};
|
|
8
|
+
export type PowerShellOperations = BashOperations;
|
|
9
|
+
export type PowerShellSpawnContext = BashSpawnContext;
|
|
10
|
+
export type PowerShellSpawnHook = BashSpawnHook;
|
|
11
|
+
export type PowerShellToolDetails = BashToolDetails;
|
|
12
|
+
export type PowerShellToolInput = BashToolInput;
|
|
13
|
+
export interface PowerShellToolOptions extends Pick<BashToolOptions, "operations" | "exposeSessionEnvironment" | "spawnHook"> {
|
|
14
|
+
}
|
|
15
|
+
export declare function createLocalPowerShellOperations(): PowerShellOperations;
|
|
16
|
+
export declare function createPowerShellToolDefinition(cwd: string, options?: PowerShellToolOptions): ReturnType<typeof createShellToolDefinition>;
|
|
17
|
+
export declare function createPowerShellTool(cwd: string, options?: PowerShellToolOptions): ReturnType<typeof createBashTool>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { ModelImageResizeOptions } from "@earendil-works/pi-ai";
|
|
3
|
+
import { type Static, Type } from "typebox";
|
|
4
|
+
import type { ToolDefinition } from "../extensions/types.ts";
|
|
5
|
+
import { type TruncationResult } from "./truncate.ts";
|
|
6
|
+
declare const readSchema: Type.TObject<{
|
|
7
|
+
path: Type.TString;
|
|
8
|
+
offset: Type.TOptional<Type.TNumber>;
|
|
9
|
+
limit: Type.TOptional<Type.TNumber>;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const readToolSystemPromptContribution: {
|
|
12
|
+
readonly snippet: "Read file contents";
|
|
13
|
+
readonly guidelines: readonly [
|
|
14
|
+
"Use read to examine files instead of cat or sed."
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
export type ReadToolInput = Static<typeof readSchema>;
|
|
18
|
+
export interface ReadToolDetails {
|
|
19
|
+
truncation?: TruncationResult;
|
|
20
|
+
}
|
|
21
|
+
export interface ReadOperations {
|
|
22
|
+
readFile: (absolutePath: string) => Promise<Buffer>;
|
|
23
|
+
access: (absolutePath: string) => Promise<void>;
|
|
24
|
+
detectImageMimeType?: (absolutePath: string) => Promise<string | null | undefined>;
|
|
25
|
+
}
|
|
26
|
+
export interface ReadToolOptions {
|
|
27
|
+
autoResizeImages?: boolean;
|
|
28
|
+
resizeOptions?: ModelImageResizeOptions;
|
|
29
|
+
operations?: ReadOperations;
|
|
30
|
+
}
|
|
31
|
+
export declare function createReadToolDefinition(cwd: string, options?: ReadToolOptions): ToolDefinition<typeof readSchema, ReadToolDetails | undefined>;
|
|
32
|
+
export declare function createReadTool(cwd: string, options?: ReadToolOptions): AgentTool<typeof readSchema>;
|
|
33
|
+
export {};
|
package/dist/core/tools/read.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var q=Object.defineProperty;var r=(e,t)=>q(e,"name",{value:t,configurable:!0});import{basename as j,dirname as
|
|
1
|
+
var q=Object.defineProperty;var r=(e,t)=>q(e,"name",{value:t,configurable:!0});import{basename as j,dirname as W,isAbsolute as Y,relative as J,resolve as G,sep as K}from"node:path";import{Text as H}from"@earendil-works/pi-tui";import{constants as Q}from"fs";import{access as Z,readFile as ee}from"fs/promises";import{Type as T}from"typebox";import{getReadmePath as te}from"../../config.js";import{fill as I,t as S}from"../../dal/i18n.js";import{keyHint as ne}from"../../modes/interactive/components/keybinding-hints.js";import{getLanguageFromPath as ie,highlightCode as oe}from"../../modes/interactive/theme/theme.js";import{processImage as se}from"../../utils/image-process.js";import{detectSupportedImageMimeTypeFromFile as re}from"../../utils/mime.js";import{formatPathRelativeToCwdOrAbsolute as ae}from"../../utils/paths.js";import{resolveReadPathAsync as le,resolveToCwd as fe}from"./path-utils.js";import{getTextOutput as de,renderToolPath as ce,replaceTabs as F,str as N}from"./render-utils.js";import{wrapToolDefinition as me}from"./tool-definition-wrapper.js";import{DEFAULT_MAX_BYTES as y,DEFAULT_MAX_LINES as V,formatSize as O,truncateHead as ue}from"./truncate.js";const pe=T.Object({path:T.String({description:"Path to the file to read (relative or absolute)"}),offset:T.Optional(T.Number({description:"Line number to start reading from (1-indexed)"})),limit:T.Optional(T.Number({description:"Maximum number of lines to read"}))}),X={snippet:"Read file contents",guidelines:["Use read to examine files instead of cat or sed."]},ge=new Set(["AGENTS.override.md","AGENTS.md","AGENTS.MD","CLAUDE.md","CLAUDE.MD"]),he={readFile:r(e=>ee(e),"readFile"),access:r(e=>Z(e,Q.R_OK),"access"),detectImageMimeType:re};function k(e,t){if(e?.offset===void 0&&e?.limit===void 0)return"";const n=e.offset??1,i=e.limit!==void 0?n+e.limit-1:"";return t.fg("warning",`:${n}${i?`-${i}`:""}`)}r(k,"formatReadLineRange");function $e(e,t,n){const i=ce(N(e?.file_path??e?.path),t,n);return`${t.fg("toolTitle",t.bold("read"))} ${i}${k(e,t)}`}r($e,"formatReadCall");function be(e){let t=e.length;for(;t>0&&e[t-1]==="";)t--;return e.slice(0,t)}r(be,"trimTrailingEmptyLines");function Le(e){if(!(!e||e.input.includes("image")))return"[Current model does not support images. The image will be omitted from this request.]"}r(Le,"getNonVisionImageNote");function we(e){return e.split(K).join("/")}r(we,"toPosixPath");function xe(e){const t=W(te()),n=J(G(t),G(e));if(n===""||n===".."||n.startsWith(`..${K}`)||Y(n))return;const i=we(n);if(i==="README.md"||i.startsWith("docs/")||i.startsWith("dal-docs/")||i.startsWith("examples/"))return{kind:"docs",label:i}}r(xe,"getPiDocsClassification");function Te(e,t){const n=N(e?.file_path??e?.path);if(!n)return;const i=fe(n,t),d=j(i);if(d==="SKILL.md")return{kind:"skill",label:j(W(i))||d};const c=xe(i);if(c)return c;if(ge.has(d))return{kind:"resource",label:ae(i,t)}}r(Te,"getCompactReadClassification");function ye(e,t,n){return e.kind==="skill"?n.fg("customMessageLabel","\x1B[1m[skill]\x1B[22m ")+n.fg("customMessageText",e.label)+k(t,n):n.fg("toolTitle",n.bold(`read ${e.kind}`))+" "+n.fg("accent",e.label)+k(t,n)}r(ye,"formatCompactReadCall");function Re(e,t,n,i,d,c,m){if(!n.expanded&&!m)return"";const f=N(e?.file_path??e?.path),a=de(t,d),l=!m&&f?ie(f):void 0,U=l?oe(F(a),l):a.split(`
|
|
2
2
|
`),L=be(U),P=n.expanded?L.length:10,R=L.slice(0,P),$=L.length-P;let g=`
|
|
3
3
|
${R.map(x=>l?F(x):i.fg("toolOutput",F(x))).join(`
|
|
4
4
|
`)}`;$>0&&(g+=`${i.fg("muted",`
|
|
@@ -19,4 +19,4 @@ ${M}`),A=[{type:"text",text:s}]}}else{const s=(await d.readFile(o)).toString("ut
|
|
|
19
19
|
|
|
20
20
|
[Showing lines ${C}-${p} of ${B} (${O(y)} limit). Use offset=${v} to continue.]`,_={truncation:h}}else if(E!==void 0&&u+E<s.length){const p=s.length-(u+E),v=u+E+1;w=`${h.content}
|
|
21
21
|
|
|
22
|
-
[${p} more lines in file. Use offset=${v} to continue.]`}else w=h.content;A=[{type:"text",text:w}]}if($)return;l?.removeEventListener("abort",g),P({content:A,details:_})}catch(o){l?.removeEventListener("abort",g),$||R(o)}})()})},renderCall(c,m,f){const a=f.lastComponent??new H("",0,0),l=f.expanded?void 0:Te(c,f.cwd);return a.setText(l?ye(l,c,m):$e(c,m,f.cwd)),a},renderResult(c,m,f,a){const l=a.lastComponent??new H("",0,0);return l.setText(Re(a.args,c,m,f,a.showImages,a.cwd,a.isError)),l}}}r(Ce,"createReadToolDefinition");function
|
|
22
|
+
[${p} more lines in file. Use offset=${v} to continue.]`}else w=h.content;A=[{type:"text",text:w}]}if($)return;l?.removeEventListener("abort",g),P({content:A,details:_})}catch(o){l?.removeEventListener("abort",g),$||R(o)}})()})},renderCall(c,m,f){const a=f.lastComponent??new H("",0,0),l=f.expanded?void 0:Te(c,f.cwd);return a.setText(l?ye(l,c,m):$e(c,m,f.cwd)),a},renderResult(c,m,f,a){const l=a.lastComponent??new H("",0,0);return l.setText(Re(a.args,c,m,f,a.showImages,a.cwd,a.isError)),l}}}r(Ce,"createReadToolDefinition");function We(e,t){return me(Ce(e,t))}r(We,"createReadTool");export{We as createReadTool,Ce as createReadToolDefinition,X as readToolSystemPromptContribution};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Box } from "@earendil-works/pi-tui";
|
|
2
|
+
import type { ToolDefinition } from "../../extensions/types.ts";
|
|
3
|
+
import { type EditDiffError, type EditDiffResult } from "../edit-diff.ts";
|
|
4
|
+
type EditPreview = EditDiffResult | EditDiffError;
|
|
5
|
+
export type EditRenderState = {
|
|
6
|
+
callComponent?: EditCallRenderComponent;
|
|
7
|
+
};
|
|
8
|
+
type EditCallRenderComponent = Box & {
|
|
9
|
+
preview?: EditPreview;
|
|
10
|
+
previewArgsKey?: string;
|
|
11
|
+
previewPending?: boolean;
|
|
12
|
+
settledError?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const editRenderers: Pick<ToolDefinition<any, any>, "renderCall" | "renderResult">;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolDefinition } from "../../extensions/types.ts";
|
|
2
|
+
import type { ToolName } from "../index.ts";
|
|
3
|
+
import { createShellRenderers } from "./bash.ts";
|
|
4
|
+
import { editRenderers } from "./edit.ts";
|
|
5
|
+
import { findRenderers } from "./find.ts";
|
|
6
|
+
import { grepRenderers } from "./grep.ts";
|
|
7
|
+
import { lsRenderers } from "./ls.ts";
|
|
8
|
+
import { readRenderers } from "./read.ts";
|
|
9
|
+
import { writeRenderers } from "./write.ts";
|
|
10
|
+
export type ToolRenderers = Pick<ToolDefinition<any, any>, "renderShell" | "renderCall" | "renderResult">;
|
|
11
|
+
export { createShellRenderers, editRenderers, findRenderers, grepRenderers, lsRenderers, readRenderers, writeRenderers, };
|
|
12
|
+
export declare function createAllToolRenderers(): Record<ToolName, ToolRenderers>;
|
|
13
|
+
export declare function withBuiltInRenderers<TDefinition extends ToolRenderers>(toolName: string, definition: TDefinition | undefined): TDefinition | ToolRenderers | undefined;
|