@hyperspaceng/neural-coding-agent 0.62.1 → 0.63.2
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 +143 -0
- package/README.md +10 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/register-bedrock.js +2 -2
- package/dist/bun/register-bedrock.js.map +1 -1
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +4 -0
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session.d.ts +21 -11
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +159 -101
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +5 -3
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +7 -4
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +4 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +3 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +5 -5
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +28 -27
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +2 -2
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/defaults.d.ts +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/defaults.js.map +1 -1
- package/dist/core/export-html/index.d.ts +3 -3
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +7 -6
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts +2 -2
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +41 -16
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +3 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +27 -17
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +7 -10
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +27 -38
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +56 -15
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +2 -8
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +3 -3
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts +19 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +85 -71
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +2 -2
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +5 -5
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +59 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +3 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +153 -29
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +2 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +30 -32
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +6 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +37 -5
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +6 -5
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +136 -108
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +4 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +15 -24
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +2 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +3 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +2 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +25 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts +2 -3
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -38
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +6 -0
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +20 -10
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +151 -59
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +23 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +150 -57
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +31 -7
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +179 -59
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +4 -4
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts +12 -5
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +76 -27
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +16 -5
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +83 -29
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +68 -22
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +50 -26
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts +10 -4
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +67 -13
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts +11 -4
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +110 -51
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +21 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +49 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +30 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/write.d.ts +10 -4
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +162 -27
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +57 -19
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts +1 -1
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +1 -1
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +1 -2
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +19 -6
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +1 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -1
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts +1 -1
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +1 -1
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +1 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +2 -2
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +2 -2
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +2 -2
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -2
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +1 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +1 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +2 -2
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +1 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +15 -41
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +121 -679
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +5 -13
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +175 -160
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +5 -2
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +15 -1
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +84 -78
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +2 -2
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +27 -20
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +5 -6
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/image-resize.d.ts +6 -6
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +45 -94
- package/dist/utils/image-resize.js.map +1 -1
- package/docs/development.md +3 -1
- package/docs/extensions.md +85 -34
- package/docs/models.md +6 -0
- package/docs/rpc.md +11 -2
- package/docs/settings.md +12 -0
- package/docs/skills.md +3 -2
- package/docs/tui.md +2 -2
- package/examples/extensions/built-in-tool-renderer.ts +8 -8
- package/examples/extensions/commands.ts +3 -3
- package/examples/extensions/custom-compaction.ts +17 -4
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +17 -17
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/custom-provider-qwen-cli/package.json +14 -14
- package/examples/extensions/handoff.ts +5 -2
- package/examples/extensions/minimal-mode.ts +14 -14
- package/examples/extensions/qna.ts +5 -2
- package/examples/extensions/question.ts +2 -2
- package/examples/extensions/questionnaire.ts +2 -2
- package/examples/extensions/subagent/index.ts +23 -3
- package/examples/extensions/summarize.ts +15 -4
- package/examples/extensions/todo.ts +2 -2
- package/examples/extensions/trigger-compact.ts +11 -1
- package/examples/extensions/truncated-tool.ts +2 -2
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/sdk/04-skills.ts +8 -2
- package/examples/sdk/08-prompt-templates.ts +2 -1
- package/examples/sdk/12-full-control.ts +0 -1
- package/package.json +5 -4
|
@@ -42,7 +42,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
42
42
|
return originalRead.execute(toolCallId, params, signal, onUpdate);
|
|
43
43
|
},
|
|
44
44
|
|
|
45
|
-
renderCall(args, theme) {
|
|
45
|
+
renderCall(args, theme, _context) {
|
|
46
46
|
let text = theme.fg("toolTitle", theme.bold("read "));
|
|
47
47
|
text += theme.fg("accent", args.path);
|
|
48
48
|
if (args.offset || args.limit) {
|
|
@@ -54,7 +54,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
54
54
|
return new Text(text, 0, 0);
|
|
55
55
|
},
|
|
56
56
|
|
|
57
|
-
renderResult(result, { expanded, isPartial }, theme) {
|
|
57
|
+
renderResult(result, { expanded, isPartial }, theme, _context) {
|
|
58
58
|
if (isPartial) return new Text(theme.fg("warning", "Reading..."), 0, 0);
|
|
59
59
|
|
|
60
60
|
const details = result.details as ReadToolDetails | undefined;
|
|
@@ -101,7 +101,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
101
101
|
return originalBash.execute(toolCallId, params, signal, onUpdate);
|
|
102
102
|
},
|
|
103
103
|
|
|
104
|
-
renderCall(args, theme) {
|
|
104
|
+
renderCall(args, theme, _context) {
|
|
105
105
|
let text = theme.fg("toolTitle", theme.bold("$ "));
|
|
106
106
|
const cmd = args.command.length > 80 ? `${args.command.slice(0, 77)}...` : args.command;
|
|
107
107
|
text += theme.fg("accent", cmd);
|
|
@@ -111,7 +111,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
111
111
|
return new Text(text, 0, 0);
|
|
112
112
|
},
|
|
113
113
|
|
|
114
|
-
renderResult(result, { expanded, isPartial }, theme) {
|
|
114
|
+
renderResult(result, { expanded, isPartial }, theme, _context) {
|
|
115
115
|
if (isPartial) return new Text(theme.fg("warning", "Running..."), 0, 0);
|
|
116
116
|
|
|
117
117
|
const details = result.details as BashToolDetails | undefined;
|
|
@@ -160,13 +160,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
160
160
|
return originalEdit.execute(toolCallId, params, signal, onUpdate);
|
|
161
161
|
},
|
|
162
162
|
|
|
163
|
-
renderCall(args, theme) {
|
|
163
|
+
renderCall(args, theme, _context) {
|
|
164
164
|
let text = theme.fg("toolTitle", theme.bold("edit "));
|
|
165
165
|
text += theme.fg("accent", args.path);
|
|
166
166
|
return new Text(text, 0, 0);
|
|
167
167
|
},
|
|
168
168
|
|
|
169
|
-
renderResult(result, { expanded, isPartial }, theme) {
|
|
169
|
+
renderResult(result, { expanded, isPartial }, theme, _context) {
|
|
170
170
|
if (isPartial) return new Text(theme.fg("warning", "Editing..."), 0, 0);
|
|
171
171
|
|
|
172
172
|
const details = result.details as EditToolDetails | undefined;
|
|
@@ -224,7 +224,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
224
224
|
return originalWrite.execute(toolCallId, params, signal, onUpdate);
|
|
225
225
|
},
|
|
226
226
|
|
|
227
|
-
renderCall(args, theme) {
|
|
227
|
+
renderCall(args, theme, _context) {
|
|
228
228
|
let text = theme.fg("toolTitle", theme.bold("write "));
|
|
229
229
|
text += theme.fg("accent", args.path);
|
|
230
230
|
const lineCount = args.content.split("\n").length;
|
|
@@ -232,7 +232,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
232
232
|
return new Text(text, 0, 0);
|
|
233
233
|
},
|
|
234
234
|
|
|
235
|
-
renderResult(result, { isPartial }, theme) {
|
|
235
|
+
renderResult(result, { isPartial }, theme, _context) {
|
|
236
236
|
if (isPartial) return new Text(theme.fg("warning", "Writing..."), 0, 0);
|
|
237
237
|
|
|
238
238
|
const content = result.content[0];
|
|
@@ -60,10 +60,10 @@ export default function commandsExtension(pi: ExtensionAPI) {
|
|
|
60
60
|
if (selected && !selected.startsWith("---")) {
|
|
61
61
|
const cmdName = selected.split(" - ")[0].slice(1); // Remove leading /
|
|
62
62
|
const cmd = commands.find((c) => c.name === cmdName);
|
|
63
|
-
if (cmd?.path) {
|
|
64
|
-
const showPath = await ctx.ui.confirm(cmd.name, `View source path?\n${cmd.path}`);
|
|
63
|
+
if (cmd?.sourceInfo.path) {
|
|
64
|
+
const showPath = await ctx.ui.confirm(cmd.name, `View source path?\n${cmd.sourceInfo.path}`);
|
|
65
65
|
if (showPath) {
|
|
66
|
-
ctx.ui.notify(cmd.path, "info");
|
|
66
|
+
ctx.ui.notify(cmd.sourceInfo.path, "info");
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -31,9 +31,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// Resolve
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
34
|
+
// Resolve request auth for the summarization model
|
|
35
|
+
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);
|
|
36
|
+
if (!auth.ok) {
|
|
37
|
+
ctx.ui.notify(`Compaction auth failed: ${auth.error}`, "warning");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (!auth.apiKey) {
|
|
37
41
|
ctx.ui.notify(`No API key for ${model.provider}, using default compaction`, "warning");
|
|
38
42
|
return;
|
|
39
43
|
}
|
|
@@ -83,7 +87,16 @@ ${conversationText}
|
|
|
83
87
|
|
|
84
88
|
try {
|
|
85
89
|
// Pass signal to honor abort requests (e.g., user cancels compaction)
|
|
86
|
-
const response = await complete(
|
|
90
|
+
const response = await complete(
|
|
91
|
+
model,
|
|
92
|
+
{ messages: summaryMessages },
|
|
93
|
+
{
|
|
94
|
+
apiKey: auth.apiKey,
|
|
95
|
+
headers: auth.headers,
|
|
96
|
+
maxTokens: 8192,
|
|
97
|
+
signal,
|
|
98
|
+
},
|
|
99
|
+
);
|
|
87
100
|
|
|
88
101
|
const summary = response.content
|
|
89
102
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.14.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "1.14.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
"name": "pi-extension-custom-provider-anthropic",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.14.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "echo 'nothing to clean'",
|
|
8
|
+
"build": "echo 'nothing to build'",
|
|
9
|
+
"check": "echo 'nothing to check'"
|
|
10
|
+
},
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./index.ts"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@anthropic-ai/sdk": "^0.52.0"
|
|
18
|
+
}
|
|
19
19
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "pi-extension-custom-provider-gitlab-duo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.14.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "echo 'nothing to clean'",
|
|
8
|
+
"build": "echo 'nothing to build'",
|
|
9
|
+
"check": "echo 'nothing to check'"
|
|
10
|
+
},
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./index.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
16
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "pi-extension-custom-provider-qwen-cli",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.13.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "echo 'nothing to clean'",
|
|
8
|
+
"build": "echo 'nothing to build'",
|
|
9
|
+
"check": "echo 'nothing to check'"
|
|
10
|
+
},
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./index.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
16
|
}
|
|
@@ -80,7 +80,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
80
80
|
loader.onAbort = () => done(null);
|
|
81
81
|
|
|
82
82
|
const doGenerate = async () => {
|
|
83
|
-
const
|
|
83
|
+
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
|
|
84
|
+
if (!auth.ok || !auth.apiKey) {
|
|
85
|
+
throw new Error(auth.ok ? `No API key for ${ctx.model!.provider}` : auth.error);
|
|
86
|
+
}
|
|
84
87
|
|
|
85
88
|
const userMessage: Message = {
|
|
86
89
|
role: "user",
|
|
@@ -96,7 +99,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
96
99
|
const response = await complete(
|
|
97
100
|
ctx.model!,
|
|
98
101
|
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
|
|
99
|
-
{ apiKey, signal: loader.signal },
|
|
102
|
+
{ apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
|
|
100
103
|
);
|
|
101
104
|
|
|
102
105
|
if (response.stopReason === "aborted") {
|
|
@@ -80,7 +80,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
80
80
|
return tools.read.execute(toolCallId, params, signal, onUpdate);
|
|
81
81
|
},
|
|
82
82
|
|
|
83
|
-
renderCall(args, theme) {
|
|
83
|
+
renderCall(args, theme, _context) {
|
|
84
84
|
const path = shortenPath(args.path || "");
|
|
85
85
|
let pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
86
86
|
|
|
@@ -94,7 +94,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
94
94
|
return new Text(`${theme.fg("toolTitle", theme.bold("read"))} ${pathDisplay}`, 0, 0);
|
|
95
95
|
},
|
|
96
96
|
|
|
97
|
-
renderResult(result, { expanded }, theme) {
|
|
97
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
98
98
|
// Minimal mode: show nothing in collapsed state
|
|
99
99
|
if (!expanded) {
|
|
100
100
|
return new Text("", 0, 0);
|
|
@@ -127,7 +127,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
127
127
|
return tools.bash.execute(toolCallId, params, signal, onUpdate);
|
|
128
128
|
},
|
|
129
129
|
|
|
130
|
-
renderCall(args, theme) {
|
|
130
|
+
renderCall(args, theme, _context) {
|
|
131
131
|
const command = args.command || "...";
|
|
132
132
|
const timeout = args.timeout as number | undefined;
|
|
133
133
|
const timeoutSuffix = timeout ? theme.fg("muted", ` (timeout ${timeout}s)`) : "";
|
|
@@ -135,7 +135,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
135
135
|
return new Text(theme.fg("toolTitle", theme.bold(`$ ${command}`)) + timeoutSuffix, 0, 0);
|
|
136
136
|
},
|
|
137
137
|
|
|
138
|
-
renderResult(result, { expanded }, theme) {
|
|
138
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
139
139
|
// Minimal mode: show nothing in collapsed state
|
|
140
140
|
if (!expanded) {
|
|
141
141
|
return new Text("", 0, 0);
|
|
@@ -176,7 +176,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
176
176
|
return tools.write.execute(toolCallId, params, signal, onUpdate);
|
|
177
177
|
},
|
|
178
178
|
|
|
179
|
-
renderCall(args, theme) {
|
|
179
|
+
renderCall(args, theme, _context) {
|
|
180
180
|
const path = shortenPath(args.path || "");
|
|
181
181
|
const pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
182
182
|
const lineCount = args.content ? args.content.split("\n").length : 0;
|
|
@@ -185,7 +185,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
185
185
|
return new Text(`${theme.fg("toolTitle", theme.bold("write"))} ${pathDisplay}${lineInfo}`, 0, 0);
|
|
186
186
|
},
|
|
187
187
|
|
|
188
|
-
renderResult(result, { expanded }, theme) {
|
|
188
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
189
189
|
// Minimal mode: show nothing (file was written)
|
|
190
190
|
if (!expanded) {
|
|
191
191
|
return new Text("", 0, 0);
|
|
@@ -218,14 +218,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
218
218
|
return tools.edit.execute(toolCallId, params, signal, onUpdate);
|
|
219
219
|
},
|
|
220
220
|
|
|
221
|
-
renderCall(args, theme) {
|
|
221
|
+
renderCall(args, theme, _context) {
|
|
222
222
|
const path = shortenPath(args.path || "");
|
|
223
223
|
const pathDisplay = path ? theme.fg("accent", path) : theme.fg("toolOutput", "...");
|
|
224
224
|
|
|
225
225
|
return new Text(`${theme.fg("toolTitle", theme.bold("edit"))} ${pathDisplay}`, 0, 0);
|
|
226
226
|
},
|
|
227
227
|
|
|
228
|
-
renderResult(result, { expanded }, theme) {
|
|
228
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
229
229
|
// Minimal mode: show nothing in collapsed state
|
|
230
230
|
if (!expanded) {
|
|
231
231
|
return new Text("", 0, 0);
|
|
@@ -263,7 +263,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
263
263
|
return tools.find.execute(toolCallId, params, signal, onUpdate);
|
|
264
264
|
},
|
|
265
265
|
|
|
266
|
-
renderCall(args, theme) {
|
|
266
|
+
renderCall(args, theme, _context) {
|
|
267
267
|
const pattern = args.pattern || "";
|
|
268
268
|
const path = shortenPath(args.path || ".");
|
|
269
269
|
const limit = args.limit;
|
|
@@ -277,7 +277,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
277
277
|
return new Text(text, 0, 0);
|
|
278
278
|
},
|
|
279
279
|
|
|
280
|
-
renderResult(result, { expanded }, theme) {
|
|
280
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
281
281
|
if (!expanded) {
|
|
282
282
|
// Minimal: just show count
|
|
283
283
|
const textContent = result.content.find((c) => c.type === "text");
|
|
@@ -321,7 +321,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
321
321
|
return tools.grep.execute(toolCallId, params, signal, onUpdate);
|
|
322
322
|
},
|
|
323
323
|
|
|
324
|
-
renderCall(args, theme) {
|
|
324
|
+
renderCall(args, theme, _context) {
|
|
325
325
|
const pattern = args.pattern || "";
|
|
326
326
|
const path = shortenPath(args.path || ".");
|
|
327
327
|
const glob = args.glob;
|
|
@@ -339,7 +339,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
339
339
|
return new Text(text, 0, 0);
|
|
340
340
|
},
|
|
341
341
|
|
|
342
|
-
renderResult(result, { expanded }, theme) {
|
|
342
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
343
343
|
if (!expanded) {
|
|
344
344
|
// Minimal: just show match count
|
|
345
345
|
const textContent = result.content.find((c) => c.type === "text");
|
|
@@ -383,7 +383,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
383
383
|
return tools.ls.execute(toolCallId, params, signal, onUpdate);
|
|
384
384
|
},
|
|
385
385
|
|
|
386
|
-
renderCall(args, theme) {
|
|
386
|
+
renderCall(args, theme, _context) {
|
|
387
387
|
const path = shortenPath(args.path || ".");
|
|
388
388
|
const limit = args.limit;
|
|
389
389
|
|
|
@@ -395,7 +395,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
395
395
|
return new Text(text, 0, 0);
|
|
396
396
|
},
|
|
397
397
|
|
|
398
|
-
renderResult(result, { expanded }, theme) {
|
|
398
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
399
399
|
if (!expanded) {
|
|
400
400
|
// Minimal: just show entry count
|
|
401
401
|
const textContent = result.content.find((c) => c.type === "text");
|
|
@@ -77,7 +77,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
77
77
|
|
|
78
78
|
// Do the work
|
|
79
79
|
const doExtract = async () => {
|
|
80
|
-
const
|
|
80
|
+
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
|
|
81
|
+
if (!auth.ok || !auth.apiKey) {
|
|
82
|
+
throw new Error(auth.ok ? `No API key for ${ctx.model!.provider}` : auth.error);
|
|
83
|
+
}
|
|
81
84
|
const userMessage: UserMessage = {
|
|
82
85
|
role: "user",
|
|
83
86
|
content: [{ type: "text", text: lastAssistantText! }],
|
|
@@ -87,7 +90,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
87
90
|
const response = await complete(
|
|
88
91
|
ctx.model!,
|
|
89
92
|
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
|
|
90
|
-
{ apiKey, signal: loader.signal },
|
|
93
|
+
{ apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
|
|
91
94
|
);
|
|
92
95
|
|
|
93
96
|
if (response.stopReason === "aborted") {
|
|
@@ -227,7 +227,7 @@ export default function question(pi: ExtensionAPI) {
|
|
|
227
227
|
};
|
|
228
228
|
},
|
|
229
229
|
|
|
230
|
-
renderCall(args, theme) {
|
|
230
|
+
renderCall(args, theme, _context) {
|
|
231
231
|
let text = theme.fg("toolTitle", theme.bold("question ")) + theme.fg("muted", args.question);
|
|
232
232
|
const opts = Array.isArray(args.options) ? args.options : [];
|
|
233
233
|
if (opts.length) {
|
|
@@ -238,7 +238,7 @@ export default function question(pi: ExtensionAPI) {
|
|
|
238
238
|
return new Text(text, 0, 0);
|
|
239
239
|
},
|
|
240
240
|
|
|
241
|
-
renderResult(result, _options, theme) {
|
|
241
|
+
renderResult(result, _options, theme, _context) {
|
|
242
242
|
const details = result.details as QuestionDetails | undefined;
|
|
243
243
|
if (!details) {
|
|
244
244
|
const text = result.content[0];
|
|
@@ -393,7 +393,7 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
393
393
|
};
|
|
394
394
|
},
|
|
395
395
|
|
|
396
|
-
renderCall(args, theme) {
|
|
396
|
+
renderCall(args, theme, _context) {
|
|
397
397
|
const qs = (args.questions as Question[]) || [];
|
|
398
398
|
const count = qs.length;
|
|
399
399
|
const labels = qs.map((q) => q.label || q.id).join(", ");
|
|
@@ -405,7 +405,7 @@ export default function questionnaire(pi: ExtensionAPI) {
|
|
|
405
405
|
return new Text(text, 0, 0);
|
|
406
406
|
},
|
|
407
407
|
|
|
408
|
-
renderResult(result, _options, theme) {
|
|
408
|
+
renderResult(result, _options, theme, _context) {
|
|
409
409
|
const details = result.details as QuestionnaireResult | undefined;
|
|
410
410
|
if (!details) {
|
|
411
411
|
const text = result.content[0];
|
|
@@ -217,6 +217,21 @@ async function writePromptToTempFile(agentName: string, prompt: string): Promise
|
|
|
217
217
|
return { dir: tmpDir, filePath };
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
function getPiInvocation(args: string[]): { command: string; args: string[] } {
|
|
221
|
+
const currentScript = process.argv[1];
|
|
222
|
+
if (currentScript && fs.existsSync(currentScript)) {
|
|
223
|
+
return { command: process.execPath, args: [currentScript, ...args] };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const execName = path.basename(process.execPath).toLowerCase();
|
|
227
|
+
const isGenericRuntime = /^(node|bun)(\.exe)?$/.test(execName);
|
|
228
|
+
if (!isGenericRuntime) {
|
|
229
|
+
return { command: process.execPath, args };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return { command: "pi", args };
|
|
233
|
+
}
|
|
234
|
+
|
|
220
235
|
type OnUpdateCallback = (partial: AgentToolResult<SubagentDetails>) => void;
|
|
221
236
|
|
|
222
237
|
async function runSingleAgent(
|
|
@@ -286,7 +301,12 @@ async function runSingleAgent(
|
|
|
286
301
|
let wasAborted = false;
|
|
287
302
|
|
|
288
303
|
const exitCode = await new Promise<number>((resolve) => {
|
|
289
|
-
const
|
|
304
|
+
const invocation = getPiInvocation(args);
|
|
305
|
+
const proc = spawn(invocation.command, invocation.args, {
|
|
306
|
+
cwd: cwd ?? defaultCwd,
|
|
307
|
+
shell: false,
|
|
308
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
309
|
+
});
|
|
290
310
|
let buffer = "";
|
|
291
311
|
|
|
292
312
|
const processLine = (line: string) => {
|
|
@@ -648,7 +668,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
648
668
|
};
|
|
649
669
|
},
|
|
650
670
|
|
|
651
|
-
renderCall(args, theme) {
|
|
671
|
+
renderCall(args, theme, _context) {
|
|
652
672
|
const scope: AgentScope = args.agentScope ?? "user";
|
|
653
673
|
if (args.chain && args.chain.length > 0) {
|
|
654
674
|
let text =
|
|
@@ -692,7 +712,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
692
712
|
return new Text(text, 0, 0);
|
|
693
713
|
},
|
|
694
714
|
|
|
695
|
-
renderResult(result, { expanded }, theme) {
|
|
715
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
696
716
|
const details = result.details as SubagentDetails | undefined;
|
|
697
717
|
if (!details || details.results.length === 0) {
|
|
698
718
|
const text = result.content[0];
|
|
@@ -165,12 +165,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
165
165
|
ctx.ui.notify("Model openai/gpt-5.2 not found", "warning");
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
const
|
|
169
|
-
if (!
|
|
168
|
+
const auth = model ? await ctx.modelRegistry.getApiKeyAndHeaders(model) : undefined;
|
|
169
|
+
if (auth && !auth.ok && ctx.hasUI) {
|
|
170
|
+
ctx.ui.notify(auth.error, "warning");
|
|
171
|
+
}
|
|
172
|
+
if (auth?.ok && !auth.apiKey && ctx.hasUI) {
|
|
170
173
|
ctx.ui.notify("No API key for openai/gpt-5.2", "warning");
|
|
171
174
|
}
|
|
172
175
|
|
|
173
|
-
if (!model || !apiKey) {
|
|
176
|
+
if (!model || !auth?.ok || !auth.apiKey) {
|
|
174
177
|
return;
|
|
175
178
|
}
|
|
176
179
|
|
|
@@ -182,7 +185,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
182
185
|
},
|
|
183
186
|
];
|
|
184
187
|
|
|
185
|
-
const response = await complete(
|
|
188
|
+
const response = await complete(
|
|
189
|
+
model,
|
|
190
|
+
{ messages: summaryMessages },
|
|
191
|
+
{
|
|
192
|
+
apiKey: auth.apiKey,
|
|
193
|
+
headers: auth.headers,
|
|
194
|
+
reasoningEffort: "high",
|
|
195
|
+
},
|
|
196
|
+
);
|
|
186
197
|
|
|
187
198
|
const summary = response.content
|
|
188
199
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
|
@@ -220,14 +220,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
|
|
223
|
-
renderCall(args, theme) {
|
|
223
|
+
renderCall(args, theme, _context) {
|
|
224
224
|
let text = theme.fg("toolTitle", theme.bold("todo ")) + theme.fg("muted", args.action);
|
|
225
225
|
if (args.text) text += ` ${theme.fg("dim", `"${args.text}"`)}`;
|
|
226
226
|
if (args.id !== undefined) text += ` ${theme.fg("accent", `#${args.id}`)}`;
|
|
227
227
|
return new Text(text, 0, 0);
|
|
228
228
|
},
|
|
229
229
|
|
|
230
|
-
renderResult(result, { expanded }, theme) {
|
|
230
|
+
renderResult(result, { expanded }, theme, _context) {
|
|
231
231
|
const details = result.details as TodoDetails | undefined;
|
|
232
232
|
if (!details) {
|
|
233
233
|
const text = result.content[0];
|
|
@@ -3,6 +3,8 @@ import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-age
|
|
|
3
3
|
const COMPACT_THRESHOLD_TOKENS = 100_000;
|
|
4
4
|
|
|
5
5
|
export default function (pi: ExtensionAPI) {
|
|
6
|
+
let previousTokens: number | null | undefined;
|
|
7
|
+
|
|
6
8
|
const triggerCompaction = (ctx: ExtensionContext, customInstructions?: string) => {
|
|
7
9
|
if (ctx.hasUI) {
|
|
8
10
|
ctx.ui.notify("Compaction started", "info");
|
|
@@ -24,7 +26,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
24
26
|
|
|
25
27
|
pi.on("turn_end", (_event, ctx) => {
|
|
26
28
|
const usage = ctx.getContextUsage();
|
|
27
|
-
|
|
29
|
+
const currentTokens = usage?.tokens ?? null;
|
|
30
|
+
if (currentTokens === null) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const crossedThreshold =
|
|
35
|
+
previousTokens !== undefined && previousTokens !== null && previousTokens <= COMPACT_THRESHOLD_TOKENS;
|
|
36
|
+
previousTokens = currentTokens;
|
|
37
|
+
if (!crossedThreshold || currentTokens <= COMPACT_THRESHOLD_TOKENS) {
|
|
28
38
|
return;
|
|
29
39
|
}
|
|
30
40
|
triggerCompaction(ctx);
|
|
@@ -135,7 +135,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
135
135
|
},
|
|
136
136
|
|
|
137
137
|
// Custom rendering of the tool call (shown before/during execution)
|
|
138
|
-
renderCall(args, theme) {
|
|
138
|
+
renderCall(args, theme, _context) {
|
|
139
139
|
let text = theme.fg("toolTitle", theme.bold("rg "));
|
|
140
140
|
text += theme.fg("accent", `"${args.pattern}"`);
|
|
141
141
|
if (args.path) {
|
|
@@ -148,7 +148,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
// Custom rendering of the tool result
|
|
151
|
-
renderResult(result, { expanded, isPartial }, theme) {
|
|
151
|
+
renderResult(result, { expanded, isPartial }, theme, _context) {
|
|
152
152
|
const details = result.details as RgDetails | undefined;
|
|
153
153
|
|
|
154
154
|
// Handle streaming/partial results
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.27.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "1.27.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
"name": "pi-extension-with-deps",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.27.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "echo 'nothing to clean'",
|
|
8
|
+
"build": "echo 'nothing to build'",
|
|
9
|
+
"check": "echo 'nothing to check'"
|
|
10
|
+
},
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./index.ts"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"ms": "^2.1.3"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/ms": "^2.1.0"
|
|
21
|
+
}
|
|
22
22
|
}
|