@vandeepunk/pi-coding-agent 0.0.1
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 +2564 -0
- package/README.md +555 -0
- package/dist/cli/args.d.ts +47 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +286 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +79 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +92 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +34 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +11 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +68 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +203 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session.d.ts +574 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2260 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-storage.d.ts +102 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +282 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +47 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +212 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +86 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +607 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +35 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +138 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +71 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +34 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +222 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +909 -0
- package/dist/core/export-html/template.html +54 -0
- package/dist/core/export-html/template.js +1549 -0
- package/dist/core/export-html/tool-renderer.d.ts +35 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +57 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.d.ts +11 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +25 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +400 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +129 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +576 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +928 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +35 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +27 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +102 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +32 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +134 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +55 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +153 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +123 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +100 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +419 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +76 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +313 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/package-manager.d.ts +131 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +1290 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +50 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +251 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +17 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +59 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +184 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +673 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +90 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +234 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-manager.d.ts +323 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1091 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +187 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +552 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +58 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +310 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +21 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/system-prompt.d.ts +24 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +137 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +25 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +55 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +242 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +63 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +243 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +39 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +146 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/find.d.ts +39 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +206 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +45 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +239 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +73 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +61 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +40 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +118 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +8 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +39 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +166 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +205 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +29 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +78 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +623 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +261 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +333 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +16 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +91 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +35 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +162 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +51 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +479 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +70 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +79 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +17 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +102 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +24 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +78 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +26 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +220 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +32 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +33 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +41 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +61 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +42 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +145 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +266 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +97 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +270 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +851 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +53 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +277 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +35 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +46 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +47 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +70 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +621 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +68 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +934 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +113 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +8 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +16 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +313 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +3664 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +78 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +944 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +98 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +217 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +405 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +500 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +409 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/utils/changelog.d.ts +21 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +162 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +7 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +67 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/git.d.ts +2 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +6 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/image-convert.d.ts +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +35 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize.d.ts +36 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +181 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +26 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +26 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +186 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +201 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/docs/compaction.md +390 -0
- package/docs/custom-provider.md +539 -0
- package/docs/development.md +69 -0
- package/docs/extensions.md +1827 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/json.md +79 -0
- package/docs/keybindings.md +174 -0
- package/docs/models.md +254 -0
- package/docs/packages.md +191 -0
- package/docs/prompt-templates.md +67 -0
- package/docs/providers.md +168 -0
- package/docs/rpc.md +1311 -0
- package/docs/sdk.md +957 -0
- package/docs/session.md +412 -0
- package/docs/settings.md +221 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +227 -0
- package/docs/terminal-setup.md +70 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +295 -0
- package/docs/tree.md +219 -0
- package/docs/tui.md +887 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +202 -0
- package/examples/extensions/antigravity-image-gen.ts +413 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +114 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/custom-provider-qwen-cli/index.ts +345 -0
- package/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/handoff.ts +150 -0
- package/examples/extensions/hello.ts +25 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +881 -0
- package/examples/extensions/overlay-test.ts +150 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +340 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +398 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/qna.ts +119 -0
- package/examples/extensions/question.ts +264 -0
- package/examples/extensions/questionnaire.ts +427 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/rpc-demo.ts +124 -0
- package/examples/extensions/sandbox/index.ts +318 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +40 -0
- package/examples/extensions/subagent/README.md +172 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +127 -0
- package/examples/extensions/subagent/index.ts +963 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +195 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +299 -0
- package/examples/extensions/tool-override.ts +143 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +40 -0
- package/examples/extensions/truncated-tool.ts +192 -0
- package/examples/extensions/widget-placement.ts +17 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +22 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +55 -0
- package/examples/sdk/04-skills.ts +46 -0
- package/examples/sdk/05-tools.ts +56 -0
- package/examples/sdk/06-extensions.ts +88 -0
- package/examples/sdk/07-context-files.ts +40 -0
- package/examples/sdk/08-prompt-templates.ts +47 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/examples/sdk/10-settings.ts +38 -0
- package/examples/sdk/11-sessions.ts +48 -0
- package/examples/sdk/12-full-control.ts +82 -0
- package/examples/sdk/README.md +144 -0
- package/package.json +97 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Mode Example - Demonstrates a "minimal" tool display mode
|
|
3
|
+
*
|
|
4
|
+
* This extension overrides built-in tools to provide custom rendering:
|
|
5
|
+
* - Collapsed mode: Only shows the tool call (command/path), no output
|
|
6
|
+
* - Expanded mode: Shows full output like the built-in renderers
|
|
7
|
+
*
|
|
8
|
+
* This demonstrates how a "minimal mode" could work, where ctrl+o cycles through:
|
|
9
|
+
* - Standard: Shows truncated output (current default)
|
|
10
|
+
* - Expanded: Shows full output (current expanded)
|
|
11
|
+
* - Minimal: Shows only tool call, no output (this extension's collapsed mode)
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* pi -e ./minimal-mode.ts
|
|
15
|
+
*
|
|
16
|
+
* Then use ctrl+o to toggle between minimal (collapsed) and full (expanded) views.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
20
|
+
import {
|
|
21
|
+
createBashTool,
|
|
22
|
+
createEditTool,
|
|
23
|
+
createFindTool,
|
|
24
|
+
createGrepTool,
|
|
25
|
+
createLsTool,
|
|
26
|
+
createReadTool,
|
|
27
|
+
createWriteTool,
|
|
28
|
+
} from "@mariozechner/pi-coding-agent";
|
|
29
|
+
import { Text } from "@mariozechner/pi-tui";
|
|
30
|
+
import { homedir } from "os";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Shorten a path by replacing home directory with ~
|
|
34
|
+
*/
|
|
35
|
+
function shortenPath(path: string): string {
|
|
36
|
+
const home = homedir();
|
|
37
|
+
if (path.startsWith(home)) {
|
|
38
|
+
return `~${path.slice(home.length)}`;
|
|
39
|
+
}
|
|
40
|
+
return path;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Cache for built-in tools by cwd
|
|
44
|
+
const toolCache = new Map<string, ReturnType<typeof createBuiltInTools>>();
|
|
45
|
+
|
|
46
|
+
function createBuiltInTools(cwd: string) {
|
|
47
|
+
return {
|
|
48
|
+
read: createReadTool(cwd),
|
|
49
|
+
bash: createBashTool(cwd),
|
|
50
|
+
edit: createEditTool(cwd),
|
|
51
|
+
write: createWriteTool(cwd),
|
|
52
|
+
find: createFindTool(cwd),
|
|
53
|
+
grep: createGrepTool(cwd),
|
|
54
|
+
ls: createLsTool(cwd),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getBuiltInTools(cwd: string) {
|
|
59
|
+
let tools = toolCache.get(cwd);
|
|
60
|
+
if (!tools) {
|
|
61
|
+
tools = createBuiltInTools(cwd);
|
|
62
|
+
toolCache.set(cwd, tools);
|
|
63
|
+
}
|
|
64
|
+
return tools;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default function (pi: ExtensionAPI) {
|
|
68
|
+
// =========================================================================
|
|
69
|
+
// Read Tool
|
|
70
|
+
// =========================================================================
|
|
71
|
+
pi.registerTool({
|
|
72
|
+
name: "read",
|
|
73
|
+
label: "read",
|
|
74
|
+
description:
|
|
75
|
+
"Read the contents of a file. Supports text files and images (jpg, png, gif, webp). Images are sent as attachments. For text files, output is truncated to 2000 lines or 50KB (whichever is hit first). Use offset/limit for large files.",
|
|
76
|
+
parameters: getBuiltInTools(process.cwd()).read.parameters,
|
|
77
|
+
|
|
78
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
79
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
80
|
+
return tools.read.execute(toolCallId, params, signal, onUpdate);
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
renderCall(args, theme) {
|
|
84
|
+
const path = shortenPath(args.path || "");
|
|
85
|
+
let pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
86
|
+
|
|
87
|
+
// Show line range if specified
|
|
88
|
+
if (args.offset !== undefined || args.limit !== undefined) {
|
|
89
|
+
const startLine = args.offset ?? 1;
|
|
90
|
+
const endLine = args.limit !== undefined ? startLine + args.limit - 1 : "";
|
|
91
|
+
pathDisplay += theme.fg("warning", `:${startLine}${endLine ? `-${endLine}` : ""}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return new Text(`${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}`, 0, 0);
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
renderResult(result, { expanded }, theme) {
|
|
98
|
+
// Minimal mode: show nothing in collapsed state
|
|
99
|
+
if (!expanded) {
|
|
100
|
+
return new Text("", 0, 0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Expanded mode: show full output
|
|
104
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
105
|
+
if (!textContent || textContent.type !== "text") {
|
|
106
|
+
return new Text("", 0, 0);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const lines = textContent.text.split("\n");
|
|
110
|
+
const output = lines.map((line) => theme.fg("toolOutput", line)).join("\n");
|
|
111
|
+
return new Text(`\n${output}`, 0, 0);
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// =========================================================================
|
|
116
|
+
// Bash Tool
|
|
117
|
+
// =========================================================================
|
|
118
|
+
pi.registerTool({
|
|
119
|
+
name: "bash",
|
|
120
|
+
label: "bash",
|
|
121
|
+
description:
|
|
122
|
+
"Execute a bash command in the current working directory. Returns stdout and stderr. Output is truncated to last 2000 lines or 50KB (whichever is hit first).",
|
|
123
|
+
parameters: getBuiltInTools(process.cwd()).bash.parameters,
|
|
124
|
+
|
|
125
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
126
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
127
|
+
return tools.bash.execute(toolCallId, params, signal, onUpdate);
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
renderCall(args, theme) {
|
|
131
|
+
const command = args.command || "...";
|
|
132
|
+
const timeout = args.timeout as number | undefined;
|
|
133
|
+
const timeoutSuffix = timeout ? theme.fg("muted", ` (timeout ${timeout}s)`) : "";
|
|
134
|
+
|
|
135
|
+
return new Text(theme.fg("toolTitle", theme.bold(`$ ${command}`)) + timeoutSuffix, 0, 0);
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
renderResult(result, { expanded }, theme) {
|
|
139
|
+
// Minimal mode: show nothing in collapsed state
|
|
140
|
+
if (!expanded) {
|
|
141
|
+
return new Text("", 0, 0);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Expanded mode: show full output
|
|
145
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
146
|
+
if (!textContent || textContent.type !== "text") {
|
|
147
|
+
return new Text("", 0, 0);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const output = textContent.text
|
|
151
|
+
.trim()
|
|
152
|
+
.split("\n")
|
|
153
|
+
.map((line) => theme.fg("toolOutput", line))
|
|
154
|
+
.join("\n");
|
|
155
|
+
|
|
156
|
+
if (!output) {
|
|
157
|
+
return new Text("", 0, 0);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return new Text(`\n${output}`, 0, 0);
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
// =========================================================================
|
|
165
|
+
// Write Tool
|
|
166
|
+
// =========================================================================
|
|
167
|
+
pi.registerTool({
|
|
168
|
+
name: "write",
|
|
169
|
+
label: "write",
|
|
170
|
+
description:
|
|
171
|
+
"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",
|
|
172
|
+
parameters: getBuiltInTools(process.cwd()).write.parameters,
|
|
173
|
+
|
|
174
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
175
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
176
|
+
return tools.write.execute(toolCallId, params, signal, onUpdate);
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
renderCall(args, theme) {
|
|
180
|
+
const path = shortenPath(args.path || "");
|
|
181
|
+
const pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
182
|
+
const lineCount = args.content ? args.content.split("\n").length : 0;
|
|
183
|
+
const lineInfo = lineCount > 0 ? theme.fg("muted", ` (${lineCount} lines)`) : "";
|
|
184
|
+
|
|
185
|
+
return new Text(`${theme.fg("toolTitle", theme.bold("write"))} ${pathDisplay}${lineInfo}`, 0, 0);
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
renderResult(result, { expanded }, theme) {
|
|
189
|
+
// Minimal mode: show nothing (file was written)
|
|
190
|
+
if (!expanded) {
|
|
191
|
+
return new Text("", 0, 0);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Expanded mode: show error if any
|
|
195
|
+
if (result.content.some((c) => c.type === "text" && c.text)) {
|
|
196
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
197
|
+
if (textContent?.type === "text" && textContent.text) {
|
|
198
|
+
return new Text(`\n${theme.fg("error", textContent.text)}`, 0, 0);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return new Text("", 0, 0);
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// =========================================================================
|
|
207
|
+
// Edit Tool
|
|
208
|
+
// =========================================================================
|
|
209
|
+
pi.registerTool({
|
|
210
|
+
name: "edit",
|
|
211
|
+
label: "edit",
|
|
212
|
+
description:
|
|
213
|
+
"Edit a file by replacing exact text. The oldText must match exactly (including whitespace). Use this for precise, surgical edits.",
|
|
214
|
+
parameters: getBuiltInTools(process.cwd()).edit.parameters,
|
|
215
|
+
|
|
216
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
217
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
218
|
+
return tools.edit.execute(toolCallId, params, signal, onUpdate);
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
renderCall(args, theme) {
|
|
222
|
+
const path = shortenPath(args.path || "");
|
|
223
|
+
const pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
224
|
+
|
|
225
|
+
return new Text(`${theme.fg("toolTitle", theme.bold("edit"))} ${pathDisplay}`, 0, 0);
|
|
226
|
+
},
|
|
227
|
+
|
|
228
|
+
renderResult(result, { expanded }, theme) {
|
|
229
|
+
// Minimal mode: show nothing in collapsed state
|
|
230
|
+
if (!expanded) {
|
|
231
|
+
return new Text("", 0, 0);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Expanded mode: show diff or error
|
|
235
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
236
|
+
if (!textContent || textContent.type !== "text") {
|
|
237
|
+
return new Text("", 0, 0);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// For errors, show the error message
|
|
241
|
+
const text = textContent.text;
|
|
242
|
+
if (text.includes("Error") || text.includes("error")) {
|
|
243
|
+
return new Text(`\n${theme.fg("error", text)}`, 0, 0);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Otherwise show the text (would be nice to show actual diff here)
|
|
247
|
+
return new Text(`\n${theme.fg("toolOutput", text)}`, 0, 0);
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// =========================================================================
|
|
252
|
+
// Find Tool
|
|
253
|
+
// =========================================================================
|
|
254
|
+
pi.registerTool({
|
|
255
|
+
name: "find",
|
|
256
|
+
label: "find",
|
|
257
|
+
description:
|
|
258
|
+
"Find files by name pattern (glob). Searches recursively from the specified path. Output limited to 200 results.",
|
|
259
|
+
parameters: getBuiltInTools(process.cwd()).find.parameters,
|
|
260
|
+
|
|
261
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
262
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
263
|
+
return tools.find.execute(toolCallId, params, signal, onUpdate);
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
renderCall(args, theme) {
|
|
267
|
+
const pattern = args.pattern || "";
|
|
268
|
+
const path = shortenPath(args.path || ".");
|
|
269
|
+
const limit = args.limit;
|
|
270
|
+
|
|
271
|
+
let text = `${theme.fg("toolTitle", theme.bold("find"))} ${theme.fg("accent", pattern)}`;
|
|
272
|
+
text += theme.fg("toolOutput", ` in ${path}`);
|
|
273
|
+
if (limit !== undefined) {
|
|
274
|
+
text += theme.fg("toolOutput", ` (limit ${limit})`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return new Text(text, 0, 0);
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
renderResult(result, { expanded }, theme) {
|
|
281
|
+
if (!expanded) {
|
|
282
|
+
// Minimal: just show count
|
|
283
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
284
|
+
if (textContent?.type === "text") {
|
|
285
|
+
const count = textContent.text.trim().split("\n").filter(Boolean).length;
|
|
286
|
+
if (count > 0) {
|
|
287
|
+
return new Text(theme.fg("muted", ` → ${count} files`), 0, 0);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return new Text("", 0, 0);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Expanded: show full results
|
|
294
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
295
|
+
if (!textContent || textContent.type !== "text") {
|
|
296
|
+
return new Text("", 0, 0);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const output = textContent.text
|
|
300
|
+
.trim()
|
|
301
|
+
.split("\n")
|
|
302
|
+
.map((line) => theme.fg("toolOutput", line))
|
|
303
|
+
.join("\n");
|
|
304
|
+
|
|
305
|
+
return new Text(`\n${output}`, 0, 0);
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// =========================================================================
|
|
310
|
+
// Grep Tool
|
|
311
|
+
// =========================================================================
|
|
312
|
+
pi.registerTool({
|
|
313
|
+
name: "grep",
|
|
314
|
+
label: "grep",
|
|
315
|
+
description:
|
|
316
|
+
"Search file contents by regex pattern. Uses ripgrep for fast searching. Output limited to 200 matches.",
|
|
317
|
+
parameters: getBuiltInTools(process.cwd()).grep.parameters,
|
|
318
|
+
|
|
319
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
320
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
321
|
+
return tools.grep.execute(toolCallId, params, signal, onUpdate);
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
renderCall(args, theme) {
|
|
325
|
+
const pattern = args.pattern || "";
|
|
326
|
+
const path = shortenPath(args.path || ".");
|
|
327
|
+
const glob = args.glob;
|
|
328
|
+
const limit = args.limit;
|
|
329
|
+
|
|
330
|
+
let text = `${theme.fg("toolTitle", theme.bold("grep"))} ${theme.fg("accent", `/${pattern}/`)}`;
|
|
331
|
+
text += theme.fg("toolOutput", ` in ${path}`);
|
|
332
|
+
if (glob) {
|
|
333
|
+
text += theme.fg("toolOutput", ` (${glob})`);
|
|
334
|
+
}
|
|
335
|
+
if (limit !== undefined) {
|
|
336
|
+
text += theme.fg("toolOutput", ` limit ${limit}`);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return new Text(text, 0, 0);
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
renderResult(result, { expanded }, theme) {
|
|
343
|
+
if (!expanded) {
|
|
344
|
+
// Minimal: just show match count
|
|
345
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
346
|
+
if (textContent?.type === "text") {
|
|
347
|
+
const count = textContent.text.trim().split("\n").filter(Boolean).length;
|
|
348
|
+
if (count > 0) {
|
|
349
|
+
return new Text(theme.fg("muted", ` → ${count} matches`), 0, 0);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return new Text("", 0, 0);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Expanded: show full results
|
|
356
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
357
|
+
if (!textContent || textContent.type !== "text") {
|
|
358
|
+
return new Text("", 0, 0);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const output = textContent.text
|
|
362
|
+
.trim()
|
|
363
|
+
.split("\n")
|
|
364
|
+
.map((line) => theme.fg("toolOutput", line))
|
|
365
|
+
.join("\n");
|
|
366
|
+
|
|
367
|
+
return new Text(`\n${output}`, 0, 0);
|
|
368
|
+
},
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// =========================================================================
|
|
372
|
+
// Ls Tool
|
|
373
|
+
// =========================================================================
|
|
374
|
+
pi.registerTool({
|
|
375
|
+
name: "ls",
|
|
376
|
+
label: "ls",
|
|
377
|
+
description:
|
|
378
|
+
"List directory contents with file sizes. Shows files and directories with their sizes. Output limited to 500 entries.",
|
|
379
|
+
parameters: getBuiltInTools(process.cwd()).ls.parameters,
|
|
380
|
+
|
|
381
|
+
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
382
|
+
const tools = getBuiltInTools(ctx.cwd);
|
|
383
|
+
return tools.ls.execute(toolCallId, params, signal, onUpdate);
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
renderCall(args, theme) {
|
|
387
|
+
const path = shortenPath(args.path || ".");
|
|
388
|
+
const limit = args.limit;
|
|
389
|
+
|
|
390
|
+
let text = `${theme.fg("toolTitle", theme.bold("ls"))} ${theme.fg("accent", path)}`;
|
|
391
|
+
if (limit !== undefined) {
|
|
392
|
+
text += theme.fg("toolOutput", ` (limit ${limit})`);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return new Text(text, 0, 0);
|
|
396
|
+
},
|
|
397
|
+
|
|
398
|
+
renderResult(result, { expanded }, theme) {
|
|
399
|
+
if (!expanded) {
|
|
400
|
+
// Minimal: just show entry count
|
|
401
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
402
|
+
if (textContent?.type === "text") {
|
|
403
|
+
const count = textContent.text.trim().split("\n").filter(Boolean).length;
|
|
404
|
+
if (count > 0) {
|
|
405
|
+
return new Text(theme.fg("muted", ` → ${count} entries`), 0, 0);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return new Text("", 0, 0);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Expanded: show full listing
|
|
412
|
+
const textContent = result.content.find((c) => c.type === "text");
|
|
413
|
+
if (!textContent || textContent.type !== "text") {
|
|
414
|
+
return new Text("", 0, 0);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const output = textContent.text
|
|
418
|
+
.trim()
|
|
419
|
+
.split("\n")
|
|
420
|
+
.map((line) => theme.fg("toolOutput", line))
|
|
421
|
+
.join("\n");
|
|
422
|
+
|
|
423
|
+
return new Text(`\n${output}`, 0, 0);
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal Editor - vim-like modal editing example
|
|
3
|
+
*
|
|
4
|
+
* Usage: pi --extension ./examples/extensions/modal-editor.ts
|
|
5
|
+
*
|
|
6
|
+
* - Escape: insert → normal mode (in normal mode, aborts agent)
|
|
7
|
+
* - i: normal → insert mode
|
|
8
|
+
* - hjkl: navigation in normal mode
|
|
9
|
+
* - ctrl+c, ctrl+d, etc. work in both modes
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { CustomEditor, type ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
13
|
+
import { matchesKey, truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
|
|
14
|
+
|
|
15
|
+
// Normal mode key mappings: key -> escape sequence (or null for mode switch)
|
|
16
|
+
const NORMAL_KEYS: Record<string, string | null> = {
|
|
17
|
+
h: "\x1b[D", // left
|
|
18
|
+
j: "\x1b[B", // down
|
|
19
|
+
k: "\x1b[A", // up
|
|
20
|
+
l: "\x1b[C", // right
|
|
21
|
+
"0": "\x01", // line start
|
|
22
|
+
$: "\x05", // line end
|
|
23
|
+
x: "\x1b[3~", // delete char
|
|
24
|
+
i: null, // insert mode
|
|
25
|
+
a: null, // append (insert + right)
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
class ModalEditor extends CustomEditor {
|
|
29
|
+
private mode: "normal" | "insert" = "insert";
|
|
30
|
+
|
|
31
|
+
handleInput(data: string): void {
|
|
32
|
+
// Escape toggles to normal mode, or passes through for app handling
|
|
33
|
+
if (matchesKey(data, "escape")) {
|
|
34
|
+
if (this.mode === "insert") {
|
|
35
|
+
this.mode = "normal";
|
|
36
|
+
} else {
|
|
37
|
+
super.handleInput(data); // abort agent, etc.
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Insert mode: pass everything through
|
|
43
|
+
if (this.mode === "insert") {
|
|
44
|
+
super.handleInput(data);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Normal mode: check mapped keys
|
|
49
|
+
if (data in NORMAL_KEYS) {
|
|
50
|
+
const seq = NORMAL_KEYS[data];
|
|
51
|
+
if (data === "i") {
|
|
52
|
+
this.mode = "insert";
|
|
53
|
+
} else if (data === "a") {
|
|
54
|
+
this.mode = "insert";
|
|
55
|
+
super.handleInput("\x1b[C"); // move right first
|
|
56
|
+
} else if (seq) {
|
|
57
|
+
super.handleInput(seq);
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Pass control sequences (ctrl+c, etc.) to super, ignore printable chars
|
|
63
|
+
if (data.length === 1 && data.charCodeAt(0) >= 32) return;
|
|
64
|
+
super.handleInput(data);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
render(width: number): string[] {
|
|
68
|
+
const lines = super.render(width);
|
|
69
|
+
if (lines.length === 0) return lines;
|
|
70
|
+
|
|
71
|
+
// Add mode indicator to bottom border
|
|
72
|
+
const label = this.mode === "normal" ? " NORMAL " : " INSERT ";
|
|
73
|
+
const last = lines.length - 1;
|
|
74
|
+
if (visibleWidth(lines[last]!) >= label.length) {
|
|
75
|
+
lines[last] = truncateToWidth(lines[last]!, width - label.length, "") + label;
|
|
76
|
+
}
|
|
77
|
+
return lines;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default function (pi: ExtensionAPI) {
|
|
82
|
+
pi.on("session_start", (_event, ctx) => {
|
|
83
|
+
ctx.ui.setEditorComponent((tui, theme, kb) => new ModalEditor(tui, theme, kb));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model status extension - shows model changes in the status bar.
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the `model_select` hook which fires when the model changes
|
|
5
|
+
* via /model command, Ctrl+P cycling, or session restore.
|
|
6
|
+
*
|
|
7
|
+
* Usage: pi -e ./model-status.ts
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
11
|
+
|
|
12
|
+
export default function (pi: ExtensionAPI) {
|
|
13
|
+
pi.on("model_select", async (event, ctx) => {
|
|
14
|
+
const { model, previousModel, source } = event;
|
|
15
|
+
|
|
16
|
+
// Format model identifiers
|
|
17
|
+
const next = `${model.provider}/${model.id}`;
|
|
18
|
+
const prev = previousModel ? `${previousModel.provider}/${previousModel.id}` : "none";
|
|
19
|
+
|
|
20
|
+
// Show notification on change
|
|
21
|
+
if (source !== "restore") {
|
|
22
|
+
ctx.ui.notify(`Model: ${next}`, "info");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Update status bar with current model
|
|
26
|
+
ctx.ui.setStatus("model", `🤖 ${model.id}`);
|
|
27
|
+
|
|
28
|
+
// Log change details (visible in debug output)
|
|
29
|
+
console.log(`[model_select] ${prev} → ${next} (${source})`);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi Notify Extension
|
|
3
|
+
*
|
|
4
|
+
* Sends a native terminal notification when Pi agent is done and waiting for input.
|
|
5
|
+
* Supports multiple terminal protocols:
|
|
6
|
+
* - OSC 777: Ghostty, iTerm2, WezTerm, rxvt-unicode
|
|
7
|
+
* - OSC 99: Kitty
|
|
8
|
+
* - Windows toast: Windows Terminal (WSL)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
12
|
+
|
|
13
|
+
function windowsToastScript(title: string, body: string): string {
|
|
14
|
+
const type = "Windows.UI.Notifications";
|
|
15
|
+
const mgr = `[${type}.ToastNotificationManager, ${type}, ContentType = WindowsRuntime]`;
|
|
16
|
+
const template = `[${type}.ToastTemplateType]::ToastText01`;
|
|
17
|
+
const toast = `[${type}.ToastNotification]::new($xml)`;
|
|
18
|
+
return [
|
|
19
|
+
`${mgr} > $null`,
|
|
20
|
+
`$xml = [${type}.ToastNotificationManager]::GetTemplateContent(${template})`,
|
|
21
|
+
`$xml.GetElementsByTagName('text')[0].AppendChild($xml.CreateTextNode('${body}')) > $null`,
|
|
22
|
+
`[${type}.ToastNotificationManager]::CreateToastNotifier('${title}').Show(${toast})`,
|
|
23
|
+
].join("; ");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function notifyOSC777(title: string, body: string): void {
|
|
27
|
+
process.stdout.write(`\x1b]777;notify;${title};${body}\x07`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function notifyOSC99(title: string, body: string): void {
|
|
31
|
+
// Kitty OSC 99: i=notification id, d=0 means not done yet, p=body for second part
|
|
32
|
+
process.stdout.write(`\x1b]99;i=1:d=0;${title}\x1b\\`);
|
|
33
|
+
process.stdout.write(`\x1b]99;i=1:p=body;${body}\x1b\\`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function notifyWindows(title: string, body: string): void {
|
|
37
|
+
const { execFile } = require("child_process");
|
|
38
|
+
execFile("powershell.exe", ["-NoProfile", "-Command", windowsToastScript(title, body)]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function notify(title: string, body: string): void {
|
|
42
|
+
if (process.env.WT_SESSION) {
|
|
43
|
+
notifyWindows(title, body);
|
|
44
|
+
} else if (process.env.KITTY_WINDOW_ID) {
|
|
45
|
+
notifyOSC99(title, body);
|
|
46
|
+
} else {
|
|
47
|
+
notifyOSC777(title, body);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default function (pi: ExtensionAPI) {
|
|
52
|
+
pi.on("agent_end", async () => {
|
|
53
|
+
notify("Pi", "Ready for input");
|
|
54
|
+
});
|
|
55
|
+
}
|