@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
package/docs/rpc.md
ADDED
|
@@ -0,0 +1,1311 @@
|
|
|
1
|
+
# RPC Mode
|
|
2
|
+
|
|
3
|
+
RPC mode enables headless operation of the coding agent via a JSON protocol over stdin/stdout. This is useful for embedding the agent in other applications, IDEs, or custom UIs.
|
|
4
|
+
|
|
5
|
+
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@mariozechner/pi-coding-agent` instead of spawning a subprocess. See [`src/core/agent-session.ts`](../src/core/agent-session.ts) for the API. For a subprocess-based TypeScript client, see [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts).
|
|
6
|
+
|
|
7
|
+
## Starting RPC Mode
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi --mode rpc [options]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Common options:
|
|
14
|
+
- `--provider <name>`: Set the LLM provider (anthropic, openai, google, etc.)
|
|
15
|
+
- `--model <id>`: Set the model ID
|
|
16
|
+
- `--no-session`: Disable session persistence
|
|
17
|
+
- `--session-dir <path>`: Custom session storage directory
|
|
18
|
+
|
|
19
|
+
## Protocol Overview
|
|
20
|
+
|
|
21
|
+
- **Commands**: JSON objects sent to stdin, one per line
|
|
22
|
+
- **Responses**: JSON objects with `type: "response"` indicating command success/failure
|
|
23
|
+
- **Events**: Agent events streamed to stdout as JSON lines
|
|
24
|
+
|
|
25
|
+
All commands support an optional `id` field for request/response correlation. If provided, the corresponding response will include the same `id`.
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
### Prompting
|
|
30
|
+
|
|
31
|
+
#### prompt
|
|
32
|
+
|
|
33
|
+
Send a user prompt to the agent. Returns immediately; events stream asynchronously.
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{"id": "req-1", "type": "prompt", "message": "Hello, world!"}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
With images:
|
|
40
|
+
```json
|
|
41
|
+
{"type": "prompt", "message": "What's in this image?", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**During streaming**: If the agent is already streaming, you must specify `streamingBehavior` to queue the message:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{"type": "prompt", "message": "New instruction", "streamingBehavior": "steer"}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- `"steer"`: Interrupt the agent mid-run. Message is delivered after current tool execution, remaining tools are skipped.
|
|
51
|
+
- `"followUp"`: Wait until the agent finishes. Message is delivered only when agent stops.
|
|
52
|
+
|
|
53
|
+
If the agent is streaming and no `streamingBehavior` is specified, the command returns an error.
|
|
54
|
+
|
|
55
|
+
**Extension commands**: If the message is an extension command (e.g., `/mycommand`), it executes immediately even during streaming. Extension commands manage their own LLM interaction via `pi.sendMessage()`.
|
|
56
|
+
|
|
57
|
+
**Input expansion**: Skill commands (`/skill:name`) and prompt templates (`/template`) are expanded before sending/queueing.
|
|
58
|
+
|
|
59
|
+
Response:
|
|
60
|
+
```json
|
|
61
|
+
{"id": "req-1", "type": "response", "command": "prompt", "success": true}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `images` field is optional. Each image uses `ImageContent` format: `{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}`.
|
|
65
|
+
|
|
66
|
+
#### steer
|
|
67
|
+
|
|
68
|
+
Queue a steering message to interrupt the agent mid-run. Delivered after current tool execution, remaining tools are skipped. Skill commands and prompt templates are expanded. Extension commands are not allowed (use `prompt` instead).
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{"type": "steer", "message": "Stop and do this instead"}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
With images:
|
|
75
|
+
```json
|
|
76
|
+
{"type": "steer", "message": "Look at this instead", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
|
|
80
|
+
|
|
81
|
+
Response:
|
|
82
|
+
```json
|
|
83
|
+
{"type": "response", "command": "steer", "success": true}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
See [set_steering_mode](#set_steering_mode) for controlling how steering messages are processed.
|
|
87
|
+
|
|
88
|
+
#### follow_up
|
|
89
|
+
|
|
90
|
+
Queue a follow-up message to be processed after the agent finishes. Delivered only when agent has no more tool calls or steering messages. Skill commands and prompt templates are expanded. Extension commands are not allowed (use `prompt` instead).
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{"type": "follow_up", "message": "After you're done, also do this"}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
With images:
|
|
97
|
+
```json
|
|
98
|
+
{"type": "follow_up", "message": "Also check this image", "images": [{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}]}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The `images` field is optional. Each image uses `ImageContent` format (same as `prompt`).
|
|
102
|
+
|
|
103
|
+
Response:
|
|
104
|
+
```json
|
|
105
|
+
{"type": "response", "command": "follow_up", "success": true}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
See [set_follow_up_mode](#set_follow_up_mode) for controlling how follow-up messages are processed.
|
|
109
|
+
|
|
110
|
+
#### abort
|
|
111
|
+
|
|
112
|
+
Abort the current agent operation.
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{"type": "abort"}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Response:
|
|
119
|
+
```json
|
|
120
|
+
{"type": "response", "command": "abort", "success": true}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### new_session
|
|
124
|
+
|
|
125
|
+
Start a fresh session. Can be cancelled by a `session_before_switch` extension event handler.
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{"type": "new_session"}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
With optional parent session tracking:
|
|
132
|
+
```json
|
|
133
|
+
{"type": "new_session", "parentSession": "/path/to/parent-session.jsonl"}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Response:
|
|
137
|
+
```json
|
|
138
|
+
{"type": "response", "command": "new_session", "success": true, "data": {"cancelled": false}}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
If an extension cancelled:
|
|
142
|
+
```json
|
|
143
|
+
{"type": "response", "command": "new_session", "success": true, "data": {"cancelled": true}}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### State
|
|
147
|
+
|
|
148
|
+
#### get_state
|
|
149
|
+
|
|
150
|
+
Get current session state.
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{"type": "get_state"}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Response:
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"type": "response",
|
|
160
|
+
"command": "get_state",
|
|
161
|
+
"success": true,
|
|
162
|
+
"data": {
|
|
163
|
+
"model": {...},
|
|
164
|
+
"thinkingLevel": "medium",
|
|
165
|
+
"isStreaming": false,
|
|
166
|
+
"isCompacting": false,
|
|
167
|
+
"steeringMode": "all",
|
|
168
|
+
"followUpMode": "one-at-a-time",
|
|
169
|
+
"sessionFile": "/path/to/session.jsonl",
|
|
170
|
+
"sessionId": "abc123",
|
|
171
|
+
"sessionName": "my-feature-work",
|
|
172
|
+
"autoCompactionEnabled": true,
|
|
173
|
+
"messageCount": 5,
|
|
174
|
+
"pendingMessageCount": 0
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The `model` field is a full [Model](#model) object or `null`. The `sessionName` field is the display name set via `set_session_name`, or omitted if not set.
|
|
180
|
+
|
|
181
|
+
#### get_messages
|
|
182
|
+
|
|
183
|
+
Get all messages in the conversation.
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{"type": "get_messages"}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Response:
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"type": "response",
|
|
193
|
+
"command": "get_messages",
|
|
194
|
+
"success": true,
|
|
195
|
+
"data": {"messages": [...]}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Messages are `AgentMessage` objects (see [Message Types](#message-types)).
|
|
200
|
+
|
|
201
|
+
### Model
|
|
202
|
+
|
|
203
|
+
#### set_model
|
|
204
|
+
|
|
205
|
+
Switch to a specific model.
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{"type": "set_model", "provider": "anthropic", "modelId": "claude-sonnet-4-20250514"}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Response contains the full [Model](#model) object:
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"type": "response",
|
|
215
|
+
"command": "set_model",
|
|
216
|
+
"success": true,
|
|
217
|
+
"data": {...}
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### cycle_model
|
|
222
|
+
|
|
223
|
+
Cycle to the next available model. Returns `null` data if only one model available.
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{"type": "cycle_model"}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Response:
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"type": "response",
|
|
233
|
+
"command": "cycle_model",
|
|
234
|
+
"success": true,
|
|
235
|
+
"data": {
|
|
236
|
+
"model": {...},
|
|
237
|
+
"thinkingLevel": "medium",
|
|
238
|
+
"isScoped": false
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
The `model` field is a full [Model](#model) object.
|
|
244
|
+
|
|
245
|
+
#### get_available_models
|
|
246
|
+
|
|
247
|
+
List all configured models.
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
{"type": "get_available_models"}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Response contains an array of full [Model](#model) objects:
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"type": "response",
|
|
257
|
+
"command": "get_available_models",
|
|
258
|
+
"success": true,
|
|
259
|
+
"data": {
|
|
260
|
+
"models": [...]
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Thinking
|
|
266
|
+
|
|
267
|
+
#### set_thinking_level
|
|
268
|
+
|
|
269
|
+
Set the reasoning/thinking level for models that support it.
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{"type": "set_thinking_level", "level": "high"}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Levels: `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`
|
|
276
|
+
|
|
277
|
+
Note: `"xhigh"` is only supported by OpenAI codex-max models.
|
|
278
|
+
|
|
279
|
+
Response:
|
|
280
|
+
```json
|
|
281
|
+
{"type": "response", "command": "set_thinking_level", "success": true}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
#### cycle_thinking_level
|
|
285
|
+
|
|
286
|
+
Cycle through available thinking levels. Returns `null` data if model doesn't support thinking.
|
|
287
|
+
|
|
288
|
+
```json
|
|
289
|
+
{"type": "cycle_thinking_level"}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Response:
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"type": "response",
|
|
296
|
+
"command": "cycle_thinking_level",
|
|
297
|
+
"success": true,
|
|
298
|
+
"data": {"level": "high"}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Queue Modes
|
|
303
|
+
|
|
304
|
+
#### set_steering_mode
|
|
305
|
+
|
|
306
|
+
Control how steering messages (from `steer`) are delivered.
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{"type": "set_steering_mode", "mode": "one-at-a-time"}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Modes:
|
|
313
|
+
- `"all"`: Deliver all steering messages at the next interruption point
|
|
314
|
+
- `"one-at-a-time"`: Deliver one steering message per interruption (default)
|
|
315
|
+
|
|
316
|
+
Response:
|
|
317
|
+
```json
|
|
318
|
+
{"type": "response", "command": "set_steering_mode", "success": true}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### set_follow_up_mode
|
|
322
|
+
|
|
323
|
+
Control how follow-up messages (from `follow_up`) are delivered.
|
|
324
|
+
|
|
325
|
+
```json
|
|
326
|
+
{"type": "set_follow_up_mode", "mode": "one-at-a-time"}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Modes:
|
|
330
|
+
- `"all"`: Deliver all follow-up messages when agent finishes
|
|
331
|
+
- `"one-at-a-time"`: Deliver one follow-up message per agent completion (default)
|
|
332
|
+
|
|
333
|
+
Response:
|
|
334
|
+
```json
|
|
335
|
+
{"type": "response", "command": "set_follow_up_mode", "success": true}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Compaction
|
|
339
|
+
|
|
340
|
+
#### compact
|
|
341
|
+
|
|
342
|
+
Manually compact conversation context to reduce token usage.
|
|
343
|
+
|
|
344
|
+
```json
|
|
345
|
+
{"type": "compact"}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
With custom instructions:
|
|
349
|
+
```json
|
|
350
|
+
{"type": "compact", "customInstructions": "Focus on code changes"}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Response:
|
|
354
|
+
```json
|
|
355
|
+
{
|
|
356
|
+
"type": "response",
|
|
357
|
+
"command": "compact",
|
|
358
|
+
"success": true,
|
|
359
|
+
"data": {
|
|
360
|
+
"summary": "Summary of conversation...",
|
|
361
|
+
"firstKeptEntryId": "abc123",
|
|
362
|
+
"tokensBefore": 150000,
|
|
363
|
+
"details": {}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
#### set_auto_compaction
|
|
369
|
+
|
|
370
|
+
Enable or disable automatic compaction when context is nearly full.
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{"type": "set_auto_compaction", "enabled": true}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Response:
|
|
377
|
+
```json
|
|
378
|
+
{"type": "response", "command": "set_auto_compaction", "success": true}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Retry
|
|
382
|
+
|
|
383
|
+
#### set_auto_retry
|
|
384
|
+
|
|
385
|
+
Enable or disable automatic retry on transient errors (overloaded, rate limit, 5xx).
|
|
386
|
+
|
|
387
|
+
```json
|
|
388
|
+
{"type": "set_auto_retry", "enabled": true}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Response:
|
|
392
|
+
```json
|
|
393
|
+
{"type": "response", "command": "set_auto_retry", "success": true}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
#### abort_retry
|
|
397
|
+
|
|
398
|
+
Abort an in-progress retry (cancel the delay and stop retrying).
|
|
399
|
+
|
|
400
|
+
```json
|
|
401
|
+
{"type": "abort_retry"}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Response:
|
|
405
|
+
```json
|
|
406
|
+
{"type": "response", "command": "abort_retry", "success": true}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Bash
|
|
410
|
+
|
|
411
|
+
#### bash
|
|
412
|
+
|
|
413
|
+
Execute a shell command and add output to conversation context.
|
|
414
|
+
|
|
415
|
+
```json
|
|
416
|
+
{"type": "bash", "command": "ls -la"}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Response:
|
|
420
|
+
```json
|
|
421
|
+
{
|
|
422
|
+
"type": "response",
|
|
423
|
+
"command": "bash",
|
|
424
|
+
"success": true,
|
|
425
|
+
"data": {
|
|
426
|
+
"output": "total 48\ndrwxr-xr-x ...",
|
|
427
|
+
"exitCode": 0,
|
|
428
|
+
"cancelled": false,
|
|
429
|
+
"truncated": false
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
If output was truncated, includes `fullOutputPath`:
|
|
435
|
+
```json
|
|
436
|
+
{
|
|
437
|
+
"type": "response",
|
|
438
|
+
"command": "bash",
|
|
439
|
+
"success": true,
|
|
440
|
+
"data": {
|
|
441
|
+
"output": "truncated output...",
|
|
442
|
+
"exitCode": 0,
|
|
443
|
+
"cancelled": false,
|
|
444
|
+
"truncated": true,
|
|
445
|
+
"fullOutputPath": "/tmp/pi-bash-abc123.log"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**How bash results reach the LLM:**
|
|
451
|
+
|
|
452
|
+
The `bash` command executes immediately and returns a `BashResult`. Internally, a `BashExecutionMessage` is created and stored in the agent's message state. This message does NOT emit an event.
|
|
453
|
+
|
|
454
|
+
When the next `prompt` command is sent, all messages (including `BashExecutionMessage`) are transformed before being sent to the LLM. The `BashExecutionMessage` is converted to a `UserMessage` with this format:
|
|
455
|
+
|
|
456
|
+
```
|
|
457
|
+
Ran `ls -la`
|
|
458
|
+
\`\`\`
|
|
459
|
+
total 48
|
|
460
|
+
drwxr-xr-x ...
|
|
461
|
+
\`\`\`
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
This means:
|
|
465
|
+
1. Bash output is included in the LLM context on the **next prompt**, not immediately
|
|
466
|
+
2. Multiple bash commands can be executed before a prompt; all outputs will be included
|
|
467
|
+
3. No event is emitted for the `BashExecutionMessage` itself
|
|
468
|
+
|
|
469
|
+
#### abort_bash
|
|
470
|
+
|
|
471
|
+
Abort a running bash command.
|
|
472
|
+
|
|
473
|
+
```json
|
|
474
|
+
{"type": "abort_bash"}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Response:
|
|
478
|
+
```json
|
|
479
|
+
{"type": "response", "command": "abort_bash", "success": true}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Session
|
|
483
|
+
|
|
484
|
+
#### get_session_stats
|
|
485
|
+
|
|
486
|
+
Get token usage and cost statistics.
|
|
487
|
+
|
|
488
|
+
```json
|
|
489
|
+
{"type": "get_session_stats"}
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
Response:
|
|
493
|
+
```json
|
|
494
|
+
{
|
|
495
|
+
"type": "response",
|
|
496
|
+
"command": "get_session_stats",
|
|
497
|
+
"success": true,
|
|
498
|
+
"data": {
|
|
499
|
+
"sessionFile": "/path/to/session.jsonl",
|
|
500
|
+
"sessionId": "abc123",
|
|
501
|
+
"userMessages": 5,
|
|
502
|
+
"assistantMessages": 5,
|
|
503
|
+
"toolCalls": 12,
|
|
504
|
+
"toolResults": 12,
|
|
505
|
+
"totalMessages": 22,
|
|
506
|
+
"tokens": {
|
|
507
|
+
"input": 50000,
|
|
508
|
+
"output": 10000,
|
|
509
|
+
"cacheRead": 40000,
|
|
510
|
+
"cacheWrite": 5000,
|
|
511
|
+
"total": 105000
|
|
512
|
+
},
|
|
513
|
+
"cost": 0.45
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
#### export_html
|
|
519
|
+
|
|
520
|
+
Export session to an HTML file.
|
|
521
|
+
|
|
522
|
+
```json
|
|
523
|
+
{"type": "export_html"}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
With custom path:
|
|
527
|
+
```json
|
|
528
|
+
{"type": "export_html", "outputPath": "/tmp/session.html"}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Response:
|
|
532
|
+
```json
|
|
533
|
+
{
|
|
534
|
+
"type": "response",
|
|
535
|
+
"command": "export_html",
|
|
536
|
+
"success": true,
|
|
537
|
+
"data": {"path": "/tmp/session.html"}
|
|
538
|
+
}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
#### switch_session
|
|
542
|
+
|
|
543
|
+
Load a different session file. Can be cancelled by a `session_before_switch` extension event handler.
|
|
544
|
+
|
|
545
|
+
```json
|
|
546
|
+
{"type": "switch_session", "sessionPath": "/path/to/session.jsonl"}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
Response:
|
|
550
|
+
```json
|
|
551
|
+
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": false}}
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
If an extension cancelled the switch:
|
|
555
|
+
```json
|
|
556
|
+
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": true}}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
#### fork
|
|
560
|
+
|
|
561
|
+
Create a new fork from a previous user message. Can be cancelled by a `session_before_fork` extension event handler. Returns the text of the message being forked from.
|
|
562
|
+
|
|
563
|
+
```json
|
|
564
|
+
{"type": "fork", "entryId": "abc123"}
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Response:
|
|
568
|
+
```json
|
|
569
|
+
{
|
|
570
|
+
"type": "response",
|
|
571
|
+
"command": "fork",
|
|
572
|
+
"success": true,
|
|
573
|
+
"data": {"text": "The original prompt text...", "cancelled": false}
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
If an extension cancelled the fork:
|
|
578
|
+
```json
|
|
579
|
+
{
|
|
580
|
+
"type": "response",
|
|
581
|
+
"command": "fork",
|
|
582
|
+
"success": true,
|
|
583
|
+
"data": {"text": "The original prompt text...", "cancelled": true}
|
|
584
|
+
}
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
#### get_fork_messages
|
|
588
|
+
|
|
589
|
+
Get user messages available for forking.
|
|
590
|
+
|
|
591
|
+
```json
|
|
592
|
+
{"type": "get_fork_messages"}
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
Response:
|
|
596
|
+
```json
|
|
597
|
+
{
|
|
598
|
+
"type": "response",
|
|
599
|
+
"command": "get_fork_messages",
|
|
600
|
+
"success": true,
|
|
601
|
+
"data": {
|
|
602
|
+
"messages": [
|
|
603
|
+
{"entryId": "abc123", "text": "First prompt..."},
|
|
604
|
+
{"entryId": "def456", "text": "Second prompt..."}
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
#### get_last_assistant_text
|
|
611
|
+
|
|
612
|
+
Get the text content of the last assistant message.
|
|
613
|
+
|
|
614
|
+
```json
|
|
615
|
+
{"type": "get_last_assistant_text"}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
Response:
|
|
619
|
+
```json
|
|
620
|
+
{
|
|
621
|
+
"type": "response",
|
|
622
|
+
"command": "get_last_assistant_text",
|
|
623
|
+
"success": true,
|
|
624
|
+
"data": {"text": "The assistant's response..."}
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
Returns `{"text": null}` if no assistant messages exist.
|
|
629
|
+
|
|
630
|
+
#### set_session_name
|
|
631
|
+
|
|
632
|
+
Set a display name for the current session. The name appears in session listings and helps identify sessions.
|
|
633
|
+
|
|
634
|
+
```json
|
|
635
|
+
{"type": "set_session_name", "name": "my-feature-work"}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
Response:
|
|
639
|
+
```json
|
|
640
|
+
{
|
|
641
|
+
"type": "response",
|
|
642
|
+
"command": "set_session_name",
|
|
643
|
+
"success": true
|
|
644
|
+
}
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
The current session name is available via `get_state` in the `sessionName` field.
|
|
648
|
+
|
|
649
|
+
### Commands
|
|
650
|
+
|
|
651
|
+
#### get_commands
|
|
652
|
+
|
|
653
|
+
Get available commands (extension commands, prompt templates, and skills). These can be invoked via the `prompt` command by prefixing with `/`.
|
|
654
|
+
|
|
655
|
+
```json
|
|
656
|
+
{"type": "get_commands"}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
Response:
|
|
660
|
+
```json
|
|
661
|
+
{
|
|
662
|
+
"type": "response",
|
|
663
|
+
"command": "get_commands",
|
|
664
|
+
"success": true,
|
|
665
|
+
"data": {
|
|
666
|
+
"commands": [
|
|
667
|
+
{"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.pi/agent/extensions/session.ts"},
|
|
668
|
+
{"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"},
|
|
669
|
+
{"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.pi/agent/skills/brave-search/SKILL.md"}
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
Each command has:
|
|
676
|
+
- `name`: Command name (invoke with `/name`)
|
|
677
|
+
- `description`: Human-readable description (optional for extension commands)
|
|
678
|
+
- `source`: What kind of command:
|
|
679
|
+
- `"extension"`: Registered via `pi.registerCommand()` in an extension
|
|
680
|
+
- `"prompt"`: Loaded from a prompt template `.md` file
|
|
681
|
+
- `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
|
|
682
|
+
- `location`: Where it was loaded from (optional, not present for extensions):
|
|
683
|
+
- `"user"`: User-level (`~/.pi/agent/`)
|
|
684
|
+
- `"project"`: Project-level (`./.pi/agent/`)
|
|
685
|
+
- `"path"`: Explicit path via CLI or settings
|
|
686
|
+
- `path`: Absolute file path to the command source (optional)
|
|
687
|
+
|
|
688
|
+
**Note**: Built-in TUI commands (`/settings`, `/hotkeys`, etc.) are not included. They are handled only in interactive mode and would not execute if sent via `prompt`.
|
|
689
|
+
|
|
690
|
+
## Events
|
|
691
|
+
|
|
692
|
+
Events are streamed to stdout as JSON lines during agent operation. Events do NOT include an `id` field (only responses do).
|
|
693
|
+
|
|
694
|
+
### Event Types
|
|
695
|
+
|
|
696
|
+
| Event | Description |
|
|
697
|
+
|-------|-------------|
|
|
698
|
+
| `agent_start` | Agent begins processing |
|
|
699
|
+
| `agent_end` | Agent completes (includes all generated messages) |
|
|
700
|
+
| `turn_start` | New turn begins |
|
|
701
|
+
| `turn_end` | Turn completes (includes assistant message and tool results) |
|
|
702
|
+
| `message_start` | Message begins |
|
|
703
|
+
| `message_update` | Streaming update (text/thinking/toolcall deltas) |
|
|
704
|
+
| `message_end` | Message completes |
|
|
705
|
+
| `tool_execution_start` | Tool begins execution |
|
|
706
|
+
| `tool_execution_update` | Tool execution progress (streaming output) |
|
|
707
|
+
| `tool_execution_end` | Tool completes |
|
|
708
|
+
| `auto_compaction_start` | Auto-compaction begins |
|
|
709
|
+
| `auto_compaction_end` | Auto-compaction completes |
|
|
710
|
+
| `auto_retry_start` | Auto-retry begins (after transient error) |
|
|
711
|
+
| `auto_retry_end` | Auto-retry completes (success or final failure) |
|
|
712
|
+
| `extension_error` | Extension threw an error |
|
|
713
|
+
|
|
714
|
+
### agent_start
|
|
715
|
+
|
|
716
|
+
Emitted when the agent begins processing a prompt.
|
|
717
|
+
|
|
718
|
+
```json
|
|
719
|
+
{"type": "agent_start"}
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
### agent_end
|
|
723
|
+
|
|
724
|
+
Emitted when the agent completes. Contains all messages generated during this run.
|
|
725
|
+
|
|
726
|
+
```json
|
|
727
|
+
{
|
|
728
|
+
"type": "agent_end",
|
|
729
|
+
"messages": [...]
|
|
730
|
+
}
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### turn_start / turn_end
|
|
734
|
+
|
|
735
|
+
A turn consists of one assistant response plus any resulting tool calls and results.
|
|
736
|
+
|
|
737
|
+
```json
|
|
738
|
+
{"type": "turn_start"}
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
```json
|
|
742
|
+
{
|
|
743
|
+
"type": "turn_end",
|
|
744
|
+
"message": {...},
|
|
745
|
+
"toolResults": [...]
|
|
746
|
+
}
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
### message_start / message_end
|
|
750
|
+
|
|
751
|
+
Emitted when a message begins and completes. The `message` field contains an `AgentMessage`.
|
|
752
|
+
|
|
753
|
+
```json
|
|
754
|
+
{"type": "message_start", "message": {...}}
|
|
755
|
+
{"type": "message_end", "message": {...}}
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
### message_update (Streaming)
|
|
759
|
+
|
|
760
|
+
Emitted during streaming of assistant messages. Contains both the partial message and a streaming delta event.
|
|
761
|
+
|
|
762
|
+
```json
|
|
763
|
+
{
|
|
764
|
+
"type": "message_update",
|
|
765
|
+
"message": {...},
|
|
766
|
+
"assistantMessageEvent": {
|
|
767
|
+
"type": "text_delta",
|
|
768
|
+
"contentIndex": 0,
|
|
769
|
+
"delta": "Hello ",
|
|
770
|
+
"partial": {...}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
The `assistantMessageEvent` field contains one of these delta types:
|
|
776
|
+
|
|
777
|
+
| Type | Description |
|
|
778
|
+
|------|-------------|
|
|
779
|
+
| `start` | Message generation started |
|
|
780
|
+
| `text_start` | Text content block started |
|
|
781
|
+
| `text_delta` | Text content chunk |
|
|
782
|
+
| `text_end` | Text content block ended |
|
|
783
|
+
| `thinking_start` | Thinking block started |
|
|
784
|
+
| `thinking_delta` | Thinking content chunk |
|
|
785
|
+
| `thinking_end` | Thinking block ended |
|
|
786
|
+
| `toolcall_start` | Tool call started |
|
|
787
|
+
| `toolcall_delta` | Tool call arguments chunk |
|
|
788
|
+
| `toolcall_end` | Tool call ended (includes full `toolCall` object) |
|
|
789
|
+
| `done` | Message complete (reason: `"stop"`, `"length"`, `"toolUse"`) |
|
|
790
|
+
| `error` | Error occurred (reason: `"aborted"`, `"error"`) |
|
|
791
|
+
|
|
792
|
+
Example streaming a text response:
|
|
793
|
+
```json
|
|
794
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_start","contentIndex":0,"partial":{...}}}
|
|
795
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello","partial":{...}}}
|
|
796
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":" world","partial":{...}}}
|
|
797
|
+
{"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world","partial":{...}}}
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
### tool_execution_start / tool_execution_update / tool_execution_end
|
|
801
|
+
|
|
802
|
+
Emitted when a tool begins, streams progress, and completes execution.
|
|
803
|
+
|
|
804
|
+
```json
|
|
805
|
+
{
|
|
806
|
+
"type": "tool_execution_start",
|
|
807
|
+
"toolCallId": "call_abc123",
|
|
808
|
+
"toolName": "bash",
|
|
809
|
+
"args": {"command": "ls -la"}
|
|
810
|
+
}
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
During execution, `tool_execution_update` events stream partial results (e.g., bash output as it arrives):
|
|
814
|
+
|
|
815
|
+
```json
|
|
816
|
+
{
|
|
817
|
+
"type": "tool_execution_update",
|
|
818
|
+
"toolCallId": "call_abc123",
|
|
819
|
+
"toolName": "bash",
|
|
820
|
+
"args": {"command": "ls -la"},
|
|
821
|
+
"partialResult": {
|
|
822
|
+
"content": [{"type": "text", "text": "partial output so far..."}],
|
|
823
|
+
"details": {"truncation": null, "fullOutputPath": null}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
When complete:
|
|
829
|
+
|
|
830
|
+
```json
|
|
831
|
+
{
|
|
832
|
+
"type": "tool_execution_end",
|
|
833
|
+
"toolCallId": "call_abc123",
|
|
834
|
+
"toolName": "bash",
|
|
835
|
+
"result": {
|
|
836
|
+
"content": [{"type": "text", "text": "total 48\n..."}],
|
|
837
|
+
"details": {...}
|
|
838
|
+
},
|
|
839
|
+
"isError": false
|
|
840
|
+
}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
Use `toolCallId` to correlate events. The `partialResult` in `tool_execution_update` contains the accumulated output so far (not just the delta), allowing clients to simply replace their display on each update.
|
|
844
|
+
|
|
845
|
+
### auto_compaction_start / auto_compaction_end
|
|
846
|
+
|
|
847
|
+
Emitted when automatic compaction runs (when context is nearly full).
|
|
848
|
+
|
|
849
|
+
```json
|
|
850
|
+
{"type": "auto_compaction_start", "reason": "threshold"}
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
The `reason` field is `"threshold"` (context getting large) or `"overflow"` (context exceeded limit).
|
|
854
|
+
|
|
855
|
+
```json
|
|
856
|
+
{
|
|
857
|
+
"type": "auto_compaction_end",
|
|
858
|
+
"result": {
|
|
859
|
+
"summary": "Summary of conversation...",
|
|
860
|
+
"firstKeptEntryId": "abc123",
|
|
861
|
+
"tokensBefore": 150000,
|
|
862
|
+
"details": {}
|
|
863
|
+
},
|
|
864
|
+
"aborted": false,
|
|
865
|
+
"willRetry": false
|
|
866
|
+
}
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
If `reason` was `"overflow"` and compaction succeeds, `willRetry` is `true` and the agent will automatically retry the prompt.
|
|
870
|
+
|
|
871
|
+
If compaction was aborted, `result` is `null` and `aborted` is `true`.
|
|
872
|
+
|
|
873
|
+
If compaction failed (e.g., API quota exceeded), `result` is `null`, `aborted` is `false`, and `errorMessage` contains the error description.
|
|
874
|
+
|
|
875
|
+
### auto_retry_start / auto_retry_end
|
|
876
|
+
|
|
877
|
+
Emitted when automatic retry is triggered after a transient error (overloaded, rate limit, 5xx).
|
|
878
|
+
|
|
879
|
+
```json
|
|
880
|
+
{
|
|
881
|
+
"type": "auto_retry_start",
|
|
882
|
+
"attempt": 1,
|
|
883
|
+
"maxAttempts": 3,
|
|
884
|
+
"delayMs": 2000,
|
|
885
|
+
"errorMessage": "529 {\"type\":\"error\",\"error\":{\"type\":\"overloaded_error\",\"message\":\"Overloaded\"}}"
|
|
886
|
+
}
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
```json
|
|
890
|
+
{
|
|
891
|
+
"type": "auto_retry_end",
|
|
892
|
+
"success": true,
|
|
893
|
+
"attempt": 2
|
|
894
|
+
}
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
On final failure (max retries exceeded):
|
|
898
|
+
```json
|
|
899
|
+
{
|
|
900
|
+
"type": "auto_retry_end",
|
|
901
|
+
"success": false,
|
|
902
|
+
"attempt": 3,
|
|
903
|
+
"finalError": "529 overloaded_error: Overloaded"
|
|
904
|
+
}
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
### extension_error
|
|
908
|
+
|
|
909
|
+
Emitted when an extension throws an error.
|
|
910
|
+
|
|
911
|
+
```json
|
|
912
|
+
{
|
|
913
|
+
"type": "extension_error",
|
|
914
|
+
"extensionPath": "/path/to/extension.ts",
|
|
915
|
+
"event": "tool_call",
|
|
916
|
+
"error": "Error message..."
|
|
917
|
+
}
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
## Extension UI Protocol
|
|
921
|
+
|
|
922
|
+
Extensions can request user interaction via `ctx.ui.select()`, `ctx.ui.confirm()`, etc. In RPC mode, these are translated into a request/response sub-protocol on top of the base command/event flow.
|
|
923
|
+
|
|
924
|
+
There are two categories of extension UI methods:
|
|
925
|
+
|
|
926
|
+
- **Dialog methods** (`select`, `confirm`, `input`, `editor`): emit an `extension_ui_request` on stdout and block until the client sends back an `extension_ui_response` on stdin with the matching `id`.
|
|
927
|
+
- **Fire-and-forget methods** (`notify`, `setStatus`, `setWidget`, `setTitle`, `set_editor_text`): emit an `extension_ui_request` on stdout but do not expect a response. The client can display the information or ignore it.
|
|
928
|
+
|
|
929
|
+
If a dialog method includes a `timeout` field, the agent-side will auto-resolve with a default value when the timeout expires. The client does not need to track timeouts.
|
|
930
|
+
|
|
931
|
+
Some `ExtensionUIContext` methods are not supported in RPC mode because they require direct TUI access:
|
|
932
|
+
- `custom()` returns `undefined`
|
|
933
|
+
- `setWorkingMessage()`, `setFooter()`, `setHeader()`, `setEditorComponent()`, `setToolsExpanded()` are no-ops
|
|
934
|
+
- `getEditorText()` returns `""`
|
|
935
|
+
- `getToolsExpanded()` returns `false`
|
|
936
|
+
|
|
937
|
+
### Extension UI Requests (stdout)
|
|
938
|
+
|
|
939
|
+
All requests have `type: "extension_ui_request"`, a unique `id`, and a `method` field.
|
|
940
|
+
|
|
941
|
+
#### select
|
|
942
|
+
|
|
943
|
+
Prompt the user to choose from a list. Dialog methods with a `timeout` field include the timeout in milliseconds; the agent auto-resolves with `undefined` if the client doesn't respond in time.
|
|
944
|
+
|
|
945
|
+
```json
|
|
946
|
+
{
|
|
947
|
+
"type": "extension_ui_request",
|
|
948
|
+
"id": "uuid-1",
|
|
949
|
+
"method": "select",
|
|
950
|
+
"title": "Allow dangerous command?",
|
|
951
|
+
"options": ["Allow", "Block"],
|
|
952
|
+
"timeout": 10000
|
|
953
|
+
}
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
Expected response: `extension_ui_response` with `value` (the selected option string) or `cancelled: true`.
|
|
957
|
+
|
|
958
|
+
#### confirm
|
|
959
|
+
|
|
960
|
+
Prompt the user for yes/no confirmation.
|
|
961
|
+
|
|
962
|
+
```json
|
|
963
|
+
{
|
|
964
|
+
"type": "extension_ui_request",
|
|
965
|
+
"id": "uuid-2",
|
|
966
|
+
"method": "confirm",
|
|
967
|
+
"title": "Clear session?",
|
|
968
|
+
"message": "All messages will be lost.",
|
|
969
|
+
"timeout": 5000
|
|
970
|
+
}
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
Expected response: `extension_ui_response` with `confirmed: true/false` or `cancelled: true`.
|
|
974
|
+
|
|
975
|
+
#### input
|
|
976
|
+
|
|
977
|
+
Prompt the user for free-form text.
|
|
978
|
+
|
|
979
|
+
```json
|
|
980
|
+
{
|
|
981
|
+
"type": "extension_ui_request",
|
|
982
|
+
"id": "uuid-3",
|
|
983
|
+
"method": "input",
|
|
984
|
+
"title": "Enter a value",
|
|
985
|
+
"placeholder": "type something..."
|
|
986
|
+
}
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
Expected response: `extension_ui_response` with `value` (the entered text) or `cancelled: true`.
|
|
990
|
+
|
|
991
|
+
#### editor
|
|
992
|
+
|
|
993
|
+
Open a multi-line text editor with optional prefilled content.
|
|
994
|
+
|
|
995
|
+
```json
|
|
996
|
+
{
|
|
997
|
+
"type": "extension_ui_request",
|
|
998
|
+
"id": "uuid-4",
|
|
999
|
+
"method": "editor",
|
|
1000
|
+
"title": "Edit some text",
|
|
1001
|
+
"prefill": "Line 1\nLine 2\nLine 3"
|
|
1002
|
+
}
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
Expected response: `extension_ui_response` with `value` (the edited text) or `cancelled: true`.
|
|
1006
|
+
|
|
1007
|
+
#### notify
|
|
1008
|
+
|
|
1009
|
+
Display a notification. Fire-and-forget, no response expected.
|
|
1010
|
+
|
|
1011
|
+
```json
|
|
1012
|
+
{
|
|
1013
|
+
"type": "extension_ui_request",
|
|
1014
|
+
"id": "uuid-5",
|
|
1015
|
+
"method": "notify",
|
|
1016
|
+
"message": "Command blocked by user",
|
|
1017
|
+
"notifyType": "warning"
|
|
1018
|
+
}
|
|
1019
|
+
```
|
|
1020
|
+
|
|
1021
|
+
The `notifyType` field is `"info"`, `"warning"`, or `"error"`. Defaults to `"info"` if omitted.
|
|
1022
|
+
|
|
1023
|
+
#### setStatus
|
|
1024
|
+
|
|
1025
|
+
Set or clear a status entry in the footer/status bar. Fire-and-forget.
|
|
1026
|
+
|
|
1027
|
+
```json
|
|
1028
|
+
{
|
|
1029
|
+
"type": "extension_ui_request",
|
|
1030
|
+
"id": "uuid-6",
|
|
1031
|
+
"method": "setStatus",
|
|
1032
|
+
"statusKey": "my-ext",
|
|
1033
|
+
"statusText": "Turn 3 running..."
|
|
1034
|
+
}
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
Send `statusText: undefined` (or omit it) to clear the status entry for that key.
|
|
1038
|
+
|
|
1039
|
+
#### setWidget
|
|
1040
|
+
|
|
1041
|
+
Set or clear a widget (block of text lines) displayed above or below the editor. Fire-and-forget.
|
|
1042
|
+
|
|
1043
|
+
```json
|
|
1044
|
+
{
|
|
1045
|
+
"type": "extension_ui_request",
|
|
1046
|
+
"id": "uuid-7",
|
|
1047
|
+
"method": "setWidget",
|
|
1048
|
+
"widgetKey": "my-ext",
|
|
1049
|
+
"widgetLines": ["--- My Widget ---", "Line 1", "Line 2"],
|
|
1050
|
+
"widgetPlacement": "aboveEditor"
|
|
1051
|
+
}
|
|
1052
|
+
```
|
|
1053
|
+
|
|
1054
|
+
Send `widgetLines: undefined` (or omit it) to clear the widget. The `widgetPlacement` field is `"aboveEditor"` (default) or `"belowEditor"`. Only string arrays are supported in RPC mode; component factories are ignored.
|
|
1055
|
+
|
|
1056
|
+
#### setTitle
|
|
1057
|
+
|
|
1058
|
+
Set the terminal window/tab title. Fire-and-forget.
|
|
1059
|
+
|
|
1060
|
+
```json
|
|
1061
|
+
{
|
|
1062
|
+
"type": "extension_ui_request",
|
|
1063
|
+
"id": "uuid-8",
|
|
1064
|
+
"method": "setTitle",
|
|
1065
|
+
"title": "pi - my project"
|
|
1066
|
+
}
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
#### set_editor_text
|
|
1070
|
+
|
|
1071
|
+
Set the text in the input editor. Fire-and-forget.
|
|
1072
|
+
|
|
1073
|
+
```json
|
|
1074
|
+
{
|
|
1075
|
+
"type": "extension_ui_request",
|
|
1076
|
+
"id": "uuid-9",
|
|
1077
|
+
"method": "set_editor_text",
|
|
1078
|
+
"text": "prefilled text for the user"
|
|
1079
|
+
}
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
### Extension UI Responses (stdin)
|
|
1083
|
+
|
|
1084
|
+
Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request.
|
|
1085
|
+
|
|
1086
|
+
#### Value response (select, input, editor)
|
|
1087
|
+
|
|
1088
|
+
```json
|
|
1089
|
+
{"type": "extension_ui_response", "id": "uuid-1", "value": "Allow"}
|
|
1090
|
+
```
|
|
1091
|
+
|
|
1092
|
+
#### Confirmation response (confirm)
|
|
1093
|
+
|
|
1094
|
+
```json
|
|
1095
|
+
{"type": "extension_ui_response", "id": "uuid-2", "confirmed": true}
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
#### Cancellation response (any dialog)
|
|
1099
|
+
|
|
1100
|
+
Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm).
|
|
1101
|
+
|
|
1102
|
+
```json
|
|
1103
|
+
{"type": "extension_ui_response", "id": "uuid-3", "cancelled": true}
|
|
1104
|
+
```
|
|
1105
|
+
|
|
1106
|
+
## Error Handling
|
|
1107
|
+
|
|
1108
|
+
Failed commands return a response with `success: false`:
|
|
1109
|
+
|
|
1110
|
+
```json
|
|
1111
|
+
{
|
|
1112
|
+
"type": "response",
|
|
1113
|
+
"command": "set_model",
|
|
1114
|
+
"success": false,
|
|
1115
|
+
"error": "Model not found: invalid/model"
|
|
1116
|
+
}
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
Parse errors:
|
|
1120
|
+
|
|
1121
|
+
```json
|
|
1122
|
+
{
|
|
1123
|
+
"type": "response",
|
|
1124
|
+
"command": "parse",
|
|
1125
|
+
"success": false,
|
|
1126
|
+
"error": "Failed to parse command: Unexpected token..."
|
|
1127
|
+
}
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
## Types
|
|
1131
|
+
|
|
1132
|
+
Source files:
|
|
1133
|
+
- [`packages/ai/src/types.ts`](../../ai/src/types.ts) - `Model`, `UserMessage`, `AssistantMessage`, `ToolResultMessage`
|
|
1134
|
+
- [`packages/agent/src/types.ts`](../../agent/src/types.ts) - `AgentMessage`, `AgentEvent`
|
|
1135
|
+
- [`src/core/messages.ts`](../src/core/messages.ts) - `BashExecutionMessage`
|
|
1136
|
+
- [`src/modes/rpc/rpc-types.ts`](../src/modes/rpc/rpc-types.ts) - RPC command/response types, extension UI request/response types
|
|
1137
|
+
|
|
1138
|
+
### Model
|
|
1139
|
+
|
|
1140
|
+
```json
|
|
1141
|
+
{
|
|
1142
|
+
"id": "claude-sonnet-4-20250514",
|
|
1143
|
+
"name": "Claude Sonnet 4",
|
|
1144
|
+
"api": "anthropic-messages",
|
|
1145
|
+
"provider": "anthropic",
|
|
1146
|
+
"baseUrl": "https://api.anthropic.com",
|
|
1147
|
+
"reasoning": true,
|
|
1148
|
+
"input": ["text", "image"],
|
|
1149
|
+
"contextWindow": 200000,
|
|
1150
|
+
"maxTokens": 16384,
|
|
1151
|
+
"cost": {
|
|
1152
|
+
"input": 3.0,
|
|
1153
|
+
"output": 15.0,
|
|
1154
|
+
"cacheRead": 0.3,
|
|
1155
|
+
"cacheWrite": 3.75
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
### UserMessage
|
|
1161
|
+
|
|
1162
|
+
```json
|
|
1163
|
+
{
|
|
1164
|
+
"role": "user",
|
|
1165
|
+
"content": "Hello!",
|
|
1166
|
+
"timestamp": 1733234567890,
|
|
1167
|
+
"attachments": []
|
|
1168
|
+
}
|
|
1169
|
+
```
|
|
1170
|
+
|
|
1171
|
+
The `content` field can be a string or an array of `TextContent`/`ImageContent` blocks.
|
|
1172
|
+
|
|
1173
|
+
### AssistantMessage
|
|
1174
|
+
|
|
1175
|
+
```json
|
|
1176
|
+
{
|
|
1177
|
+
"role": "assistant",
|
|
1178
|
+
"content": [
|
|
1179
|
+
{"type": "text", "text": "Hello! How can I help?"},
|
|
1180
|
+
{"type": "thinking", "thinking": "User is greeting me..."},
|
|
1181
|
+
{"type": "toolCall", "id": "call_123", "name": "bash", "arguments": {"command": "ls"}}
|
|
1182
|
+
],
|
|
1183
|
+
"api": "anthropic-messages",
|
|
1184
|
+
"provider": "anthropic",
|
|
1185
|
+
"model": "claude-sonnet-4-20250514",
|
|
1186
|
+
"usage": {
|
|
1187
|
+
"input": 100,
|
|
1188
|
+
"output": 50,
|
|
1189
|
+
"cacheRead": 0,
|
|
1190
|
+
"cacheWrite": 0,
|
|
1191
|
+
"cost": {"input": 0.0003, "output": 0.00075, "cacheRead": 0, "cacheWrite": 0, "total": 0.00105}
|
|
1192
|
+
},
|
|
1193
|
+
"stopReason": "stop",
|
|
1194
|
+
"timestamp": 1733234567890
|
|
1195
|
+
}
|
|
1196
|
+
```
|
|
1197
|
+
|
|
1198
|
+
Stop reasons: `"stop"`, `"length"`, `"toolUse"`, `"error"`, `"aborted"`
|
|
1199
|
+
|
|
1200
|
+
### ToolResultMessage
|
|
1201
|
+
|
|
1202
|
+
```json
|
|
1203
|
+
{
|
|
1204
|
+
"role": "toolResult",
|
|
1205
|
+
"toolCallId": "call_123",
|
|
1206
|
+
"toolName": "bash",
|
|
1207
|
+
"content": [{"type": "text", "text": "total 48\ndrwxr-xr-x ..."}],
|
|
1208
|
+
"isError": false,
|
|
1209
|
+
"timestamp": 1733234567890
|
|
1210
|
+
}
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
### BashExecutionMessage
|
|
1214
|
+
|
|
1215
|
+
Created by the `bash` RPC command (not by LLM tool calls):
|
|
1216
|
+
|
|
1217
|
+
```json
|
|
1218
|
+
{
|
|
1219
|
+
"role": "bashExecution",
|
|
1220
|
+
"command": "ls -la",
|
|
1221
|
+
"output": "total 48\ndrwxr-xr-x ...",
|
|
1222
|
+
"exitCode": 0,
|
|
1223
|
+
"cancelled": false,
|
|
1224
|
+
"truncated": false,
|
|
1225
|
+
"fullOutputPath": null,
|
|
1226
|
+
"timestamp": 1733234567890
|
|
1227
|
+
}
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
### Attachment
|
|
1231
|
+
|
|
1232
|
+
```json
|
|
1233
|
+
{
|
|
1234
|
+
"id": "img1",
|
|
1235
|
+
"type": "image",
|
|
1236
|
+
"fileName": "photo.jpg",
|
|
1237
|
+
"mimeType": "image/jpeg",
|
|
1238
|
+
"size": 102400,
|
|
1239
|
+
"content": "base64-encoded-data...",
|
|
1240
|
+
"extractedText": null,
|
|
1241
|
+
"preview": null
|
|
1242
|
+
}
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
## Example: Basic Client (Python)
|
|
1246
|
+
|
|
1247
|
+
```python
|
|
1248
|
+
import subprocess
|
|
1249
|
+
import json
|
|
1250
|
+
|
|
1251
|
+
proc = subprocess.Popen(
|
|
1252
|
+
["pi", "--mode", "rpc", "--no-session"],
|
|
1253
|
+
stdin=subprocess.PIPE,
|
|
1254
|
+
stdout=subprocess.PIPE,
|
|
1255
|
+
text=True
|
|
1256
|
+
)
|
|
1257
|
+
|
|
1258
|
+
def send(cmd):
|
|
1259
|
+
proc.stdin.write(json.dumps(cmd) + "\n")
|
|
1260
|
+
proc.stdin.flush()
|
|
1261
|
+
|
|
1262
|
+
def read_events():
|
|
1263
|
+
for line in proc.stdout:
|
|
1264
|
+
yield json.loads(line)
|
|
1265
|
+
|
|
1266
|
+
# Send prompt
|
|
1267
|
+
send({"type": "prompt", "message": "Hello!"})
|
|
1268
|
+
|
|
1269
|
+
# Process events
|
|
1270
|
+
for event in read_events():
|
|
1271
|
+
if event.get("type") == "message_update":
|
|
1272
|
+
delta = event.get("assistantMessageEvent", {})
|
|
1273
|
+
if delta.get("type") == "text_delta":
|
|
1274
|
+
print(delta["delta"], end="", flush=True)
|
|
1275
|
+
|
|
1276
|
+
if event.get("type") == "agent_end":
|
|
1277
|
+
print()
|
|
1278
|
+
break
|
|
1279
|
+
```
|
|
1280
|
+
|
|
1281
|
+
## Example: Interactive Client (Node.js)
|
|
1282
|
+
|
|
1283
|
+
See [`test/rpc-example.ts`](../test/rpc-example.ts) for a complete interactive example, or [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts) for a typed client implementation.
|
|
1284
|
+
|
|
1285
|
+
For a complete example of handling the extension UI protocol, see [`examples/rpc-extension-ui.ts`](../examples/rpc-extension-ui.ts) which pairs with the [`examples/extensions/rpc-demo.ts`](../examples/extensions/rpc-demo.ts) extension.
|
|
1286
|
+
|
|
1287
|
+
```javascript
|
|
1288
|
+
const { spawn } = require("child_process");
|
|
1289
|
+
const readline = require("readline");
|
|
1290
|
+
|
|
1291
|
+
const agent = spawn("pi", ["--mode", "rpc", "--no-session"]);
|
|
1292
|
+
|
|
1293
|
+
readline.createInterface({ input: agent.stdout }).on("line", (line) => {
|
|
1294
|
+
const event = JSON.parse(line);
|
|
1295
|
+
|
|
1296
|
+
if (event.type === "message_update") {
|
|
1297
|
+
const { assistantMessageEvent } = event;
|
|
1298
|
+
if (assistantMessageEvent.type === "text_delta") {
|
|
1299
|
+
process.stdout.write(assistantMessageEvent.delta);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
});
|
|
1303
|
+
|
|
1304
|
+
// Send prompt
|
|
1305
|
+
agent.stdin.write(JSON.stringify({ type: "prompt", message: "Hello" }) + "\n");
|
|
1306
|
+
|
|
1307
|
+
// Abort on Ctrl+C
|
|
1308
|
+
process.on("SIGINT", () => {
|
|
1309
|
+
agent.stdin.write(JSON.stringify({ type: "abort" }) + "\n");
|
|
1310
|
+
});
|
|
1311
|
+
```
|