@handy_wote/pi-coding-agent 0.81.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 +5107 -0
- package/README.md +694 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +36 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +57 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +381 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +16 -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 +70 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.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 +95 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/session-picker.d.ts +10 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +36 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +20 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +184 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +98 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +459 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +306 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +85 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +133 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +642 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2684 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-storage.d.ts +56 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +232 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/cache-stats.d.ts +49 -0
- package/dist/core/cache-stats.d.ts.map +1 -0
- package/dist/core/cache-stats.js +101 -0
- package/dist/core/cache-stats.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +98 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +246 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +137 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +637 -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 +38 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +142 -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 +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.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 +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +226 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -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 +78 -0
- package/dist/core/extensions/index.d.ts +12 -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 +23 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +586 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +171 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +953 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1259 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +45 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +41 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +338 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +91 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +390 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +296 -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-metadata.d.ts +30 -0
- package/dist/core/model-metadata.d.ts.map +1 -0
- package/dist/core/model-metadata.js +139 -0
- package/dist/core/model-metadata.js.map +1 -0
- package/dist/core/model-registry.d.ts +48 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +105 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +121 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +534 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/model-runtime.d.ts +84 -0
- package/dist/core/model-runtime.d.ts.map +1 -0
- package/dist/core/model-runtime.js +453 -0
- package/dist/core/model-runtime.js.map +1 -0
- package/dist/core/models-store.d.ts +17 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +45 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +210 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2135 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/profile-runtime.d.ts +4 -0
- package/dist/core/profile-runtime.d.ts.map +1 -0
- package/dist/core/profile-runtime.js +57 -0
- package/dist/core/profile-runtime.js.map +1 -0
- package/dist/core/profiles-store.d.ts +17 -0
- package/dist/core/profiles-store.d.ts.map +1 -0
- package/dist/core/profiles-store.js +100 -0
- package/dist/core/profiles-store.js.map +1 -0
- package/dist/core/profiles-types.d.ts +31 -0
- package/dist/core/profiles-types.d.ts.map +1 -0
- package/dist/core/profiles-types.js +4 -0
- package/dist/core/profiles-types.js.map +1 -0
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +59 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +54 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +236 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +72 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/radius.d.ts +2 -0
- package/dist/core/radius.d.ts.map +1 -0
- package/dist/core/radius.js +2 -0
- package/dist/core/radius.js.map +1 -0
- package/dist/core/resource-loader.d.ts +206 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +817 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +106 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +269 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +356 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1338 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +297 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +902 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +387 -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 +25 -0
- package/dist/core/slash-commands.js.map +1 -0
- 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 +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +110 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +68 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +361 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +424 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +51 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +284 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +35 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +305 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +304 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +40 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +112 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +167 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +276 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +65 -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 +34 -0
- package/dist/core/tools/tool-definition-wrapper.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 +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +26 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +197 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +202 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/core/usage-totals.d.ts +19 -0
- package/dist/core/usage-totals.d.ts.map +1 -0
- package/dist/core/usage-totals.js +52 -0
- package/dist/core/usage-totals.js.map +1 -0
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +3 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/llama/client.d.ts.map +1 -0
- package/dist/extensions/llama/client.js +302 -0
- package/dist/extensions/llama/client.js.map +1 -0
- package/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/llama/huggingface.d.ts.map +1 -0
- package/dist/extensions/llama/huggingface.js +141 -0
- package/dist/extensions/llama/huggingface.js.map +1 -0
- package/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/llama/index.d.ts.map +1 -0
- package/dist/extensions/llama/index.js +208 -0
- package/dist/extensions/llama/index.js.map +1 -0
- package/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/llama/provider.d.ts.map +1 -0
- package/dist/extensions/llama/provider.js +102 -0
- package/dist/extensions/llama/provider.js.map +1 -0
- package/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/llama/ui.d.ts.map +1 -0
- package/dist/extensions/llama/ui.js +416 -0
- package/dist/extensions/llama/ui.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +706 -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 +281 -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/assets/clankolas.png +0 -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 +22 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +141 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +175 -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 +54 -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 +102 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +761 -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-entry.d.ts +19 -0
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-entry.js +52 -0
- package/dist/modes/interactive/components/custom-entry.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/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/entity-list-theme.d.ts +3 -0
- package/dist/modes/interactive/components/entity-list-theme.d.ts.map +1 -0
- package/dist/modes/interactive/components/entity-list-theme.js +17 -0
- package/dist/modes/interactive/components/entity-list-theme.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +128 -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 +22 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +61 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +24 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +92 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +222 -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 +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +50 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +240 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +36 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +222 -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 +779 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +593 -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 +39 -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/status-indicator.d.ts +28 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/status-indicator.js +60 -0
- package/dist/modes/interactive/components/status-indicator.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 +63 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +317 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1245 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +21 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +72 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +16 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +53 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +42 -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 +391 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +4996 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/modes/interactive/model-search.d.ts.map +1 -0
- package/dist/modes/interactive/model-search.js +15 -0
- package/dist/modes/interactive/model-search.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +87 -0
- package/dist/modes/interactive/theme/light.json +86 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +102 -0
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +340 -0
- package/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1063 -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 +132 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +488 -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 +639 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +457 -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/package-manager-cli.d.ts +8 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +775 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/rpc-entry.d.ts +3 -0
- package/dist/rpc-entry.d.ts.map +1 -0
- package/dist/rpc-entry.js +10 -0
- package/dist/rpc-entry.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +22 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +165 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +106 -0
- package/dist/utils/child-process.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 +245 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +130 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.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/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +195 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/image-convert.d.ts +10 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +45 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +124 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +16 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +97 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +110 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +31 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +92 -0
- package/dist/utils/paths.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/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +5 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +31 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +202 -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/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.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 +328 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +15 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +59 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +401 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +763 -0
- package/docs/development.md +71 -0
- package/docs/docs.json +156 -0
- package/docs/extensions.md +2953 -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/index.md +83 -0
- package/docs/json.md +86 -0
- package/docs/keybindings.md +198 -0
- package/docs/llama-cpp.md +99 -0
- package/docs/models.md +540 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +96 -0
- package/docs/providers.md +301 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +1559 -0
- package/docs/sdk.md +1186 -0
- package/docs/security.md +59 -0
- package/docs/session-format.md +436 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +319 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +231 -0
- package/docs/terminal-setup.md +142 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +297 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +942 -0
- package/docs/usage.md +311 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +213 -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/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -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 +129 -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 +404 -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/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/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -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/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/kimi-deferred-tools.ts +61 -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 +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +390 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +122 -0
- package/examples/extensions/question.ts +278 -0
- package/examples/extensions/questionnaire.ts +440 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -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 +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -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 +126 -0
- package/examples/extensions/subagent/index.ts +1015 -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 +207 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +50 -0
- package/examples/sdk/03-custom-prompt.ts +70 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +42 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +72 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +140 -0
- package/npm-shrinkwrap.json +1824 -0
- package/package.json +100 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension loader - loads TypeScript extension modules using jiti.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import { createRequire } from "node:module";
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import * as _bundledPiAgentCore from "@handy_wote/pi-agent-core";
|
|
10
|
+
import * as _bundledPiAiCompat from "@handy_wote/pi-ai/compat";
|
|
11
|
+
import * as _bundledPiAiOauth from "@handy_wote/pi-ai/oauth";
|
|
12
|
+
import * as _bundledPiAiProviders from "@handy_wote/pi-ai/providers/all";
|
|
13
|
+
import * as _bundledPiTui from "@handy_wote/pi-tui";
|
|
14
|
+
import { createJiti } from "jiti/static";
|
|
15
|
+
// Static imports of packages that extensions may use.
|
|
16
|
+
// These MUST be static so Bun bundles them into the compiled binary.
|
|
17
|
+
// The virtualModules option then makes them available to extensions.
|
|
18
|
+
import * as _bundledTypebox from "typebox";
|
|
19
|
+
import * as _bundledTypeboxCompile from "typebox/compile";
|
|
20
|
+
import * as _bundledTypeboxValue from "typebox/value";
|
|
21
|
+
import { CONFIG_DIR_NAME, getAgentDir, isBunBinary } from "../../config.js";
|
|
22
|
+
// NOTE: This import works because loader.ts exports are NOT re-exported from index.ts,
|
|
23
|
+
// avoiding a circular dependency. Extensions can import from @handy_wote/pi-coding-agent.
|
|
24
|
+
import * as _bundledPiCodingAgent from "../../index.js";
|
|
25
|
+
import { resolvePath } from "../../utils/paths.js";
|
|
26
|
+
import { createEventBus } from "../event-bus.js";
|
|
27
|
+
import { execCommand } from "../exec.js";
|
|
28
|
+
import { createSyntheticSourceInfo } from "../source-info.js";
|
|
29
|
+
import { time } from "../timings.js";
|
|
30
|
+
/** Modules available to extensions via virtualModules (for compiled Bun binary) */
|
|
31
|
+
const VIRTUAL_MODULES = {
|
|
32
|
+
typebox: _bundledTypebox,
|
|
33
|
+
"typebox/compile": _bundledTypeboxCompile,
|
|
34
|
+
"typebox/value": _bundledTypeboxValue,
|
|
35
|
+
"@sinclair/typebox": _bundledTypebox,
|
|
36
|
+
"@sinclair/typebox/compile": _bundledTypeboxCompile,
|
|
37
|
+
"@sinclair/typebox/value": _bundledTypeboxValue,
|
|
38
|
+
"@handy_wote/pi-agent-core": _bundledPiAgentCore,
|
|
39
|
+
"@handy_wote/pi-tui": _bundledPiTui,
|
|
40
|
+
// Extensions resolve the pi-ai root to the compat entrypoint (a strict
|
|
41
|
+
// superset of the core entrypoint): existing extensions using the old
|
|
42
|
+
// global API keep working at runtime until compat is removed.
|
|
43
|
+
"@handy_wote/pi-ai": _bundledPiAiCompat,
|
|
44
|
+
"@handy_wote/pi-ai/compat": _bundledPiAiCompat,
|
|
45
|
+
"@handy_wote/pi-ai/oauth": _bundledPiAiOauth,
|
|
46
|
+
"@handy_wote/pi-ai/providers/all": _bundledPiAiProviders,
|
|
47
|
+
"@handy_wote/pi-coding-agent": _bundledPiCodingAgent,
|
|
48
|
+
"@earendil-works/pi-agent-core": _bundledPiAgentCore,
|
|
49
|
+
"@earendil-works/pi-tui": _bundledPiTui,
|
|
50
|
+
"@earendil-works/pi-ai": _bundledPiAiCompat,
|
|
51
|
+
"@earendil-works/pi-ai/compat": _bundledPiAiCompat,
|
|
52
|
+
"@earendil-works/pi-ai/oauth": _bundledPiAiOauth,
|
|
53
|
+
"@earendil-works/pi-ai/providers/all": _bundledPiAiProviders,
|
|
54
|
+
"@earendil-works/pi-coding-agent": _bundledPiCodingAgent,
|
|
55
|
+
"@mariozechner/pi-agent-core": _bundledPiAgentCore,
|
|
56
|
+
"@mariozechner/pi-tui": _bundledPiTui,
|
|
57
|
+
"@mariozechner/pi-ai": _bundledPiAiCompat,
|
|
58
|
+
"@mariozechner/pi-ai/compat": _bundledPiAiCompat,
|
|
59
|
+
"@mariozechner/pi-ai/oauth": _bundledPiAiOauth,
|
|
60
|
+
"@mariozechner/pi-ai/providers/all": _bundledPiAiProviders,
|
|
61
|
+
"@mariozechner/pi-coding-agent": _bundledPiCodingAgent,
|
|
62
|
+
};
|
|
63
|
+
const require = createRequire(import.meta.url);
|
|
64
|
+
/**
|
|
65
|
+
* Get aliases for jiti (used in Node.js/development mode).
|
|
66
|
+
* In Bun binary mode, virtualModules is used instead.
|
|
67
|
+
*/
|
|
68
|
+
let _aliases = null;
|
|
69
|
+
function getAliases() {
|
|
70
|
+
if (_aliases)
|
|
71
|
+
return _aliases;
|
|
72
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
73
|
+
const resolveFirstExisting = (paths) => paths.find((entry) => fs.existsSync(entry));
|
|
74
|
+
const packageIndex = resolveFirstExisting([
|
|
75
|
+
path.resolve(__dirname, "../..", "index.js"),
|
|
76
|
+
path.resolve(__dirname, "../..", "index.ts"),
|
|
77
|
+
]) ?? path.resolve(__dirname, "../..", "index.js");
|
|
78
|
+
const typeboxEntry = require.resolve("typebox");
|
|
79
|
+
const typeboxCompileEntry = require.resolve("typebox/compile");
|
|
80
|
+
const typeboxValueEntry = require.resolve("typebox/value");
|
|
81
|
+
const packagesRoot = path.resolve(__dirname, "../../../../");
|
|
82
|
+
const resolveWorkspaceOrImport = (workspaceRelativePaths, specifier) => {
|
|
83
|
+
for (const workspaceRelativePath of workspaceRelativePaths) {
|
|
84
|
+
const workspacePath = path.join(packagesRoot, workspaceRelativePath);
|
|
85
|
+
if (fs.existsSync(workspacePath)) {
|
|
86
|
+
return workspacePath;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return fileURLToPath(import.meta.resolve(specifier));
|
|
90
|
+
};
|
|
91
|
+
const piCodingAgentEntry = packageIndex;
|
|
92
|
+
const piAgentCoreEntry = resolveWorkspaceOrImport(["agent/dist/index.js", "agent/src/index.ts"], "@handy_wote/pi-agent-core");
|
|
93
|
+
const piTuiEntry = resolveWorkspaceOrImport(["tui/dist/index.js", "tui/src/index.ts"], "@handy_wote/pi-tui");
|
|
94
|
+
// Extensions resolve the pi-ai root to the compat entrypoint (a strict
|
|
95
|
+
// superset of the core entrypoint): existing extensions using the old
|
|
96
|
+
// global API keep working at runtime until compat is removed.
|
|
97
|
+
const piAiCompatEntry = resolveWorkspaceOrImport(["ai/dist/compat.js", "ai/src/compat.ts"], "@handy_wote/pi-ai/compat");
|
|
98
|
+
const piAiOauthEntry = resolveWorkspaceOrImport(["ai/dist/oauth.js", "ai/src/oauth.ts"], "@handy_wote/pi-ai/oauth");
|
|
99
|
+
const piAiProvidersEntry = resolveWorkspaceOrImport(["ai/dist/providers/all.js", "ai/src/providers/all.ts"], "@handy_wote/pi-ai/providers/all");
|
|
100
|
+
const piAiApiEntry = path.join(path.dirname(piAiCompatEntry), "api");
|
|
101
|
+
const piAiModelsEntry = path.join(path.dirname(piAiCompatEntry), `models${path.extname(piAiCompatEntry)}`);
|
|
102
|
+
_aliases = {
|
|
103
|
+
"@handy_wote/pi-coding-agent": piCodingAgentEntry,
|
|
104
|
+
"@handy_wote/pi-agent-core": piAgentCoreEntry,
|
|
105
|
+
"@handy_wote/pi-tui": piTuiEntry,
|
|
106
|
+
"@handy_wote/pi-ai/api": piAiApiEntry,
|
|
107
|
+
"@handy_wote/pi-ai/providers/all": piAiProvidersEntry,
|
|
108
|
+
"@handy_wote/pi-ai/compat": piAiCompatEntry,
|
|
109
|
+
"@handy_wote/pi-ai/models": piAiModelsEntry,
|
|
110
|
+
"@handy_wote/pi-ai/oauth": piAiOauthEntry,
|
|
111
|
+
"@handy_wote/pi-ai": piAiCompatEntry,
|
|
112
|
+
"@earendil-works/pi-coding-agent": piCodingAgentEntry,
|
|
113
|
+
"@earendil-works/pi-agent-core": piAgentCoreEntry,
|
|
114
|
+
"@earendil-works/pi-tui": piTuiEntry,
|
|
115
|
+
"@earendil-works/pi-ai/api": piAiApiEntry,
|
|
116
|
+
"@earendil-works/pi-ai/providers/all": piAiProvidersEntry,
|
|
117
|
+
"@earendil-works/pi-ai/compat": piAiCompatEntry,
|
|
118
|
+
"@earendil-works/pi-ai/models": piAiModelsEntry,
|
|
119
|
+
"@earendil-works/pi-ai/oauth": piAiOauthEntry,
|
|
120
|
+
"@earendil-works/pi-ai": piAiCompatEntry,
|
|
121
|
+
"@mariozechner/pi-coding-agent": piCodingAgentEntry,
|
|
122
|
+
"@mariozechner/pi-agent-core": piAgentCoreEntry,
|
|
123
|
+
"@mariozechner/pi-tui": piTuiEntry,
|
|
124
|
+
"@mariozechner/pi-ai/api": piAiApiEntry,
|
|
125
|
+
"@mariozechner/pi-ai/providers/all": piAiProvidersEntry,
|
|
126
|
+
"@mariozechner/pi-ai/compat": piAiCompatEntry,
|
|
127
|
+
"@mariozechner/pi-ai/models": piAiModelsEntry,
|
|
128
|
+
"@mariozechner/pi-ai/oauth": piAiOauthEntry,
|
|
129
|
+
"@mariozechner/pi-ai": piAiCompatEntry,
|
|
130
|
+
typebox: typeboxEntry,
|
|
131
|
+
"typebox/compile": typeboxCompileEntry,
|
|
132
|
+
"typebox/value": typeboxValueEntry,
|
|
133
|
+
"@sinclair/typebox": typeboxEntry,
|
|
134
|
+
"@sinclair/typebox/compile": typeboxCompileEntry,
|
|
135
|
+
"@sinclair/typebox/value": typeboxValueEntry,
|
|
136
|
+
};
|
|
137
|
+
return _aliases;
|
|
138
|
+
}
|
|
139
|
+
let extensionCacheCwd;
|
|
140
|
+
let extensionCacheGeneration = 0;
|
|
141
|
+
const extensionCache = new Map();
|
|
142
|
+
export function clearExtensionCache() {
|
|
143
|
+
extensionCache.clear();
|
|
144
|
+
extensionCacheCwd = undefined;
|
|
145
|
+
extensionCacheGeneration++;
|
|
146
|
+
}
|
|
147
|
+
function useExtensionCacheCwd(cwd) {
|
|
148
|
+
const resolvedCwd = resolvePath(cwd);
|
|
149
|
+
if (extensionCacheCwd !== undefined && extensionCacheCwd !== resolvedCwd) {
|
|
150
|
+
clearExtensionCache();
|
|
151
|
+
}
|
|
152
|
+
extensionCacheCwd = resolvedCwd;
|
|
153
|
+
return { cwd: resolvedCwd, generation: extensionCacheGeneration };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a runtime with throwing stubs for action methods.
|
|
157
|
+
* Runner.bindCore() replaces these with real implementations.
|
|
158
|
+
*/
|
|
159
|
+
export function createExtensionRuntime() {
|
|
160
|
+
const notInitialized = () => {
|
|
161
|
+
throw new Error("Extension runtime not initialized. Action methods cannot be called during extension loading.");
|
|
162
|
+
};
|
|
163
|
+
const state = {};
|
|
164
|
+
const assertActive = () => {
|
|
165
|
+
if (state.staleMessage) {
|
|
166
|
+
throw new Error(state.staleMessage);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const runtime = {
|
|
170
|
+
sendMessage: notInitialized,
|
|
171
|
+
sendUserMessage: notInitialized,
|
|
172
|
+
appendEntry: notInitialized,
|
|
173
|
+
setSessionName: notInitialized,
|
|
174
|
+
getSessionName: notInitialized,
|
|
175
|
+
setLabel: notInitialized,
|
|
176
|
+
getActiveTools: notInitialized,
|
|
177
|
+
getAllTools: notInitialized,
|
|
178
|
+
setActiveTools: notInitialized,
|
|
179
|
+
// registerTool() is valid during extension load; refresh is only needed post-bind.
|
|
180
|
+
refreshTools: () => { },
|
|
181
|
+
getCommands: notInitialized,
|
|
182
|
+
setModel: () => Promise.reject(new Error("Extension runtime not initialized")),
|
|
183
|
+
getThinkingLevel: notInitialized,
|
|
184
|
+
setThinkingLevel: notInitialized,
|
|
185
|
+
flagValues: new Map(),
|
|
186
|
+
pendingProviderRegistrations: [],
|
|
187
|
+
pendingNativeProviderRegistrations: [],
|
|
188
|
+
assertActive,
|
|
189
|
+
invalidate: (message) => {
|
|
190
|
+
state.staleMessage ??=
|
|
191
|
+
message ??
|
|
192
|
+
"This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload().";
|
|
193
|
+
},
|
|
194
|
+
// Pre-bind: queue registrations so bindCore() can flush them once the
|
|
195
|
+
// model registry is available. bindCore() replaces both with direct calls.
|
|
196
|
+
registerProvider: (name, config, extensionPath = "<unknown>") => {
|
|
197
|
+
runtime.pendingProviderRegistrations.push({ name, config, extensionPath });
|
|
198
|
+
},
|
|
199
|
+
registerNativeProvider: (provider, extensionPath = "<unknown>") => {
|
|
200
|
+
runtime.pendingNativeProviderRegistrations.push({ provider, extensionPath });
|
|
201
|
+
},
|
|
202
|
+
unregisterProvider: (name) => {
|
|
203
|
+
runtime.pendingProviderRegistrations = runtime.pendingProviderRegistrations.filter((r) => r.name !== name);
|
|
204
|
+
runtime.pendingNativeProviderRegistrations = runtime.pendingNativeProviderRegistrations.filter((r) => r.provider.id !== name);
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
return runtime;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Create the ExtensionAPI for an extension.
|
|
211
|
+
* Registration methods write to the extension object.
|
|
212
|
+
* Action methods delegate to the shared runtime.
|
|
213
|
+
*/
|
|
214
|
+
function createExtensionAPI(extension, runtime, cwd, eventBus) {
|
|
215
|
+
const api = {
|
|
216
|
+
// Registration methods - write to extension
|
|
217
|
+
on(event, handler) {
|
|
218
|
+
runtime.assertActive();
|
|
219
|
+
const list = extension.handlers.get(event) ?? [];
|
|
220
|
+
list.push(handler);
|
|
221
|
+
extension.handlers.set(event, list);
|
|
222
|
+
},
|
|
223
|
+
registerTool(tool) {
|
|
224
|
+
runtime.assertActive();
|
|
225
|
+
extension.tools.set(tool.name, {
|
|
226
|
+
definition: tool,
|
|
227
|
+
sourceInfo: extension.sourceInfo,
|
|
228
|
+
});
|
|
229
|
+
runtime.refreshTools();
|
|
230
|
+
},
|
|
231
|
+
registerCommand(name, options) {
|
|
232
|
+
runtime.assertActive();
|
|
233
|
+
extension.commands.set(name, {
|
|
234
|
+
name,
|
|
235
|
+
sourceInfo: extension.sourceInfo,
|
|
236
|
+
...options,
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
registerShortcut(shortcut, options) {
|
|
240
|
+
runtime.assertActive();
|
|
241
|
+
extension.shortcuts.set(shortcut, { shortcut, extensionPath: extension.path, ...options });
|
|
242
|
+
},
|
|
243
|
+
registerFlag(name, options) {
|
|
244
|
+
runtime.assertActive();
|
|
245
|
+
extension.flags.set(name, { name, extensionPath: extension.path, ...options });
|
|
246
|
+
if (options.default !== undefined && !runtime.flagValues.has(name)) {
|
|
247
|
+
runtime.flagValues.set(name, options.default);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
registerMessageRenderer(customType, renderer) {
|
|
251
|
+
runtime.assertActive();
|
|
252
|
+
extension.messageRenderers.set(customType, renderer);
|
|
253
|
+
},
|
|
254
|
+
registerEntryRenderer(customType, renderer) {
|
|
255
|
+
runtime.assertActive();
|
|
256
|
+
extension.entryRenderers ??= new Map();
|
|
257
|
+
extension.entryRenderers.set(customType, renderer);
|
|
258
|
+
},
|
|
259
|
+
// Flag access - checks extension registered it, reads from runtime
|
|
260
|
+
getFlag(name) {
|
|
261
|
+
runtime.assertActive();
|
|
262
|
+
if (!extension.flags.has(name))
|
|
263
|
+
return undefined;
|
|
264
|
+
return runtime.flagValues.get(name);
|
|
265
|
+
},
|
|
266
|
+
// Action methods - delegate to shared runtime
|
|
267
|
+
sendMessage(message, options) {
|
|
268
|
+
runtime.assertActive();
|
|
269
|
+
runtime.sendMessage(message, options);
|
|
270
|
+
},
|
|
271
|
+
sendUserMessage(content, options) {
|
|
272
|
+
runtime.assertActive();
|
|
273
|
+
runtime.sendUserMessage(content, options);
|
|
274
|
+
},
|
|
275
|
+
appendEntry(customType, data) {
|
|
276
|
+
runtime.assertActive();
|
|
277
|
+
runtime.appendEntry(customType, data);
|
|
278
|
+
},
|
|
279
|
+
setSessionName(name) {
|
|
280
|
+
runtime.assertActive();
|
|
281
|
+
runtime.setSessionName(name);
|
|
282
|
+
},
|
|
283
|
+
getSessionName() {
|
|
284
|
+
runtime.assertActive();
|
|
285
|
+
return runtime.getSessionName();
|
|
286
|
+
},
|
|
287
|
+
setLabel(entryId, label) {
|
|
288
|
+
runtime.assertActive();
|
|
289
|
+
runtime.setLabel(entryId, label);
|
|
290
|
+
},
|
|
291
|
+
exec(command, args, options) {
|
|
292
|
+
runtime.assertActive();
|
|
293
|
+
return execCommand(command, args, options?.cwd ?? cwd, options);
|
|
294
|
+
},
|
|
295
|
+
getActiveTools() {
|
|
296
|
+
runtime.assertActive();
|
|
297
|
+
return runtime.getActiveTools();
|
|
298
|
+
},
|
|
299
|
+
getAllTools() {
|
|
300
|
+
runtime.assertActive();
|
|
301
|
+
return runtime.getAllTools();
|
|
302
|
+
},
|
|
303
|
+
setActiveTools(toolNames) {
|
|
304
|
+
runtime.assertActive();
|
|
305
|
+
runtime.setActiveTools(toolNames);
|
|
306
|
+
},
|
|
307
|
+
getCommands() {
|
|
308
|
+
runtime.assertActive();
|
|
309
|
+
return runtime.getCommands();
|
|
310
|
+
},
|
|
311
|
+
setModel(model) {
|
|
312
|
+
runtime.assertActive();
|
|
313
|
+
return runtime.setModel(model);
|
|
314
|
+
},
|
|
315
|
+
getThinkingLevel() {
|
|
316
|
+
runtime.assertActive();
|
|
317
|
+
return runtime.getThinkingLevel();
|
|
318
|
+
},
|
|
319
|
+
setThinkingLevel(level) {
|
|
320
|
+
runtime.assertActive();
|
|
321
|
+
runtime.setThinkingLevel(level);
|
|
322
|
+
},
|
|
323
|
+
registerProvider(providerOrName, config) {
|
|
324
|
+
runtime.assertActive();
|
|
325
|
+
if (typeof providerOrName === "string") {
|
|
326
|
+
if (!config)
|
|
327
|
+
throw new Error("Provider config is required when registering by name");
|
|
328
|
+
runtime.registerProvider(providerOrName, config, extension.path);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
runtime.registerNativeProvider(providerOrName, extension.path);
|
|
332
|
+
},
|
|
333
|
+
unregisterProvider(name) {
|
|
334
|
+
runtime.assertActive();
|
|
335
|
+
runtime.unregisterProvider(name, extension.path);
|
|
336
|
+
},
|
|
337
|
+
events: eventBus,
|
|
338
|
+
};
|
|
339
|
+
return api;
|
|
340
|
+
}
|
|
341
|
+
function isCurrentCacheToken(cacheToken) {
|
|
342
|
+
return (cacheToken !== undefined &&
|
|
343
|
+
extensionCacheCwd === cacheToken.cwd &&
|
|
344
|
+
extensionCacheGeneration === cacheToken.generation);
|
|
345
|
+
}
|
|
346
|
+
async function loadExtensionModule(extensionPath, cacheToken) {
|
|
347
|
+
if (isCurrentCacheToken(cacheToken)) {
|
|
348
|
+
const cachedFactory = extensionCache.get(extensionPath);
|
|
349
|
+
if (cachedFactory) {
|
|
350
|
+
return cachedFactory;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const jiti = createJiti(import.meta.url, {
|
|
354
|
+
moduleCache: false,
|
|
355
|
+
// In Bun binary: use virtualModules for bundled packages (no filesystem resolution)
|
|
356
|
+
// Also disable tryNative so jiti handles ALL imports (not just the entry point)
|
|
357
|
+
// In Node.js/dev: use aliases to resolve to node_modules paths
|
|
358
|
+
...(isBunBinary ? { virtualModules: VIRTUAL_MODULES, tryNative: false } : { alias: getAliases() }),
|
|
359
|
+
});
|
|
360
|
+
const module = await jiti.import(extensionPath, { default: true });
|
|
361
|
+
const factory = module;
|
|
362
|
+
if (typeof factory !== "function") {
|
|
363
|
+
return undefined;
|
|
364
|
+
}
|
|
365
|
+
if (isCurrentCacheToken(cacheToken)) {
|
|
366
|
+
extensionCache.set(extensionPath, factory);
|
|
367
|
+
}
|
|
368
|
+
return factory;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Create an Extension object with empty collections.
|
|
372
|
+
*/
|
|
373
|
+
function createExtension(extensionPath, resolvedPath) {
|
|
374
|
+
const source = extensionPath.startsWith("<") && extensionPath.endsWith(">")
|
|
375
|
+
? extensionPath.slice(1, -1).split(":")[0] || "temporary"
|
|
376
|
+
: "local";
|
|
377
|
+
const baseDir = extensionPath.startsWith("<") ? undefined : path.dirname(resolvedPath);
|
|
378
|
+
return {
|
|
379
|
+
path: extensionPath,
|
|
380
|
+
resolvedPath,
|
|
381
|
+
sourceInfo: createSyntheticSourceInfo(extensionPath, { source, baseDir }),
|
|
382
|
+
handlers: new Map(),
|
|
383
|
+
tools: new Map(),
|
|
384
|
+
messageRenderers: new Map(),
|
|
385
|
+
entryRenderers: new Map(),
|
|
386
|
+
commands: new Map(),
|
|
387
|
+
flags: new Map(),
|
|
388
|
+
shortcuts: new Map(),
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
async function loadExtension(extensionPath, cwd, eventBus, runtime, cacheToken) {
|
|
392
|
+
const resolvedPath = resolvePath(extensionPath, cwd, { normalizeUnicodeSpaces: true });
|
|
393
|
+
try {
|
|
394
|
+
const factory = await loadExtensionModule(resolvedPath, cacheToken);
|
|
395
|
+
time(`${extensionPath} module import`, "extensions");
|
|
396
|
+
if (!factory) {
|
|
397
|
+
return { extension: null, error: `Extension does not export a valid factory function: ${extensionPath}` };
|
|
398
|
+
}
|
|
399
|
+
const extension = createExtension(extensionPath, resolvedPath);
|
|
400
|
+
const api = createExtensionAPI(extension, runtime, cwd, eventBus);
|
|
401
|
+
await factory(api);
|
|
402
|
+
time(`${extensionPath} factory`, "extensions");
|
|
403
|
+
return { extension, error: null };
|
|
404
|
+
}
|
|
405
|
+
catch (err) {
|
|
406
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
407
|
+
return { extension: null, error: `Failed to load extension: ${message}` };
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Create an Extension from an inline factory function.
|
|
412
|
+
*/
|
|
413
|
+
export async function loadExtensionFromFactory(factory, cwd, eventBus, runtime, extensionPath = "<inline>") {
|
|
414
|
+
const extension = createExtension(extensionPath, extensionPath);
|
|
415
|
+
const resolvedCwd = resolvePath(cwd);
|
|
416
|
+
const api = createExtensionAPI(extension, runtime, resolvedCwd, eventBus);
|
|
417
|
+
await factory(api);
|
|
418
|
+
time(`${extensionPath} factory`, "extensions");
|
|
419
|
+
return extension;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Load extensions from paths.
|
|
423
|
+
*/
|
|
424
|
+
async function loadExtensionsInternal(paths, cwd, eventBus, runtime, useCache = false) {
|
|
425
|
+
const extensions = [];
|
|
426
|
+
const errors = [];
|
|
427
|
+
const cacheToken = useCache ? useExtensionCacheCwd(cwd) : undefined;
|
|
428
|
+
const resolvedCwd = cacheToken?.cwd ?? resolvePath(cwd);
|
|
429
|
+
const resolvedEventBus = eventBus ?? createEventBus();
|
|
430
|
+
const resolvedRuntime = runtime ?? createExtensionRuntime();
|
|
431
|
+
for (const extPath of paths) {
|
|
432
|
+
const { extension, error } = await loadExtension(extPath, resolvedCwd, resolvedEventBus, resolvedRuntime, cacheToken);
|
|
433
|
+
if (error) {
|
|
434
|
+
errors.push({ path: extPath, error });
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
if (extension) {
|
|
438
|
+
extensions.push(extension);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
extensions,
|
|
443
|
+
errors,
|
|
444
|
+
runtime: resolvedRuntime,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
export async function loadExtensions(paths, cwd, eventBus, runtime) {
|
|
448
|
+
return loadExtensionsInternal(paths, cwd, eventBus, runtime);
|
|
449
|
+
}
|
|
450
|
+
export async function loadExtensionsCached(paths, cwd, eventBus, runtime) {
|
|
451
|
+
return loadExtensionsInternal(paths, cwd, eventBus, runtime, true);
|
|
452
|
+
}
|
|
453
|
+
function readPiManifest(packageJsonPath) {
|
|
454
|
+
try {
|
|
455
|
+
const content = fs.readFileSync(packageJsonPath, "utf-8");
|
|
456
|
+
const pkg = JSON.parse(content);
|
|
457
|
+
if (pkg.pi && typeof pkg.pi === "object") {
|
|
458
|
+
return pkg.pi;
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
}
|
|
462
|
+
catch {
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function isExtensionFile(name) {
|
|
467
|
+
return name.endsWith(".ts") || name.endsWith(".js");
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Resolve extension entry points from a directory.
|
|
471
|
+
*
|
|
472
|
+
* Checks for:
|
|
473
|
+
* 1. package.json with "pi.extensions" field -> returns declared paths
|
|
474
|
+
* 2. index.ts or index.js -> returns the index file
|
|
475
|
+
*
|
|
476
|
+
* Returns resolved paths or null if no entry points found.
|
|
477
|
+
*/
|
|
478
|
+
function resolveExtensionEntries(dir) {
|
|
479
|
+
// Check for package.json with "pi" field first
|
|
480
|
+
const packageJsonPath = path.join(dir, "package.json");
|
|
481
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
482
|
+
const manifest = readPiManifest(packageJsonPath);
|
|
483
|
+
if (manifest?.extensions?.length) {
|
|
484
|
+
const entries = [];
|
|
485
|
+
for (const extPath of manifest.extensions) {
|
|
486
|
+
const resolvedExtPath = path.resolve(dir, extPath);
|
|
487
|
+
if (fs.existsSync(resolvedExtPath)) {
|
|
488
|
+
entries.push(resolvedExtPath);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (entries.length > 0) {
|
|
492
|
+
return entries;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
// Check for index.ts or index.js
|
|
497
|
+
const indexTs = path.join(dir, "index.ts");
|
|
498
|
+
const indexJs = path.join(dir, "index.js");
|
|
499
|
+
if (fs.existsSync(indexTs)) {
|
|
500
|
+
return [indexTs];
|
|
501
|
+
}
|
|
502
|
+
if (fs.existsSync(indexJs)) {
|
|
503
|
+
return [indexJs];
|
|
504
|
+
}
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Discover extensions in a directory.
|
|
509
|
+
*
|
|
510
|
+
* Discovery rules:
|
|
511
|
+
* 1. Direct files: `extensions/*.ts` or `*.js` → load
|
|
512
|
+
* 2. Subdirectory with index: `extensions/* /index.ts` or `index.js` → load
|
|
513
|
+
* 3. Subdirectory with package.json: `extensions/* /package.json` with "pi" field → load what it declares
|
|
514
|
+
*
|
|
515
|
+
* No recursion beyond one level. Complex packages must use package.json manifest.
|
|
516
|
+
*/
|
|
517
|
+
function discoverExtensionsInDir(dir) {
|
|
518
|
+
if (!fs.existsSync(dir)) {
|
|
519
|
+
return [];
|
|
520
|
+
}
|
|
521
|
+
const discovered = [];
|
|
522
|
+
try {
|
|
523
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
524
|
+
for (const entry of entries) {
|
|
525
|
+
const entryPath = path.join(dir, entry.name);
|
|
526
|
+
// 1. Direct files: *.ts or *.js
|
|
527
|
+
if ((entry.isFile() || entry.isSymbolicLink()) && isExtensionFile(entry.name)) {
|
|
528
|
+
discovered.push(entryPath);
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
// 2 & 3. Subdirectories
|
|
532
|
+
if (entry.isDirectory() || entry.isSymbolicLink()) {
|
|
533
|
+
const entries = resolveExtensionEntries(entryPath);
|
|
534
|
+
if (entries) {
|
|
535
|
+
discovered.push(...entries);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
catch {
|
|
541
|
+
return [];
|
|
542
|
+
}
|
|
543
|
+
return discovered;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Discover and load extensions from standard locations.
|
|
547
|
+
*/
|
|
548
|
+
export async function discoverAndLoadExtensions(configuredPaths, cwd, agentDir = getAgentDir(), eventBus) {
|
|
549
|
+
const resolvedCwd = resolvePath(cwd);
|
|
550
|
+
const resolvedAgentDir = resolvePath(agentDir);
|
|
551
|
+
const allPaths = [];
|
|
552
|
+
const seen = new Set();
|
|
553
|
+
const addPaths = (paths) => {
|
|
554
|
+
for (const p of paths) {
|
|
555
|
+
const resolved = path.resolve(p);
|
|
556
|
+
if (!seen.has(resolved)) {
|
|
557
|
+
seen.add(resolved);
|
|
558
|
+
allPaths.push(p);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
// 1. Project-local extensions: cwd/${CONFIG_DIR_NAME}/extensions/
|
|
563
|
+
const localExtDir = path.join(resolvedCwd, CONFIG_DIR_NAME, "extensions");
|
|
564
|
+
addPaths(discoverExtensionsInDir(localExtDir));
|
|
565
|
+
// 2. Global extensions: agentDir/extensions/
|
|
566
|
+
const globalExtDir = path.join(resolvedAgentDir, "extensions");
|
|
567
|
+
addPaths(discoverExtensionsInDir(globalExtDir));
|
|
568
|
+
// 3. Explicitly configured paths
|
|
569
|
+
for (const p of configuredPaths) {
|
|
570
|
+
const resolved = resolvePath(p, resolvedCwd, { normalizeUnicodeSpaces: true });
|
|
571
|
+
if (fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()) {
|
|
572
|
+
// Check for package.json with pi manifest or index.ts
|
|
573
|
+
const entries = resolveExtensionEntries(resolved);
|
|
574
|
+
if (entries) {
|
|
575
|
+
addPaths(entries);
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
// No explicit entries - discover individual files in directory
|
|
579
|
+
addPaths(discoverExtensionsInDir(resolved));
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
addPaths([resolved]);
|
|
583
|
+
}
|
|
584
|
+
return loadExtensions(allPaths, resolvedCwd, eventBus);
|
|
585
|
+
}
|
|
586
|
+
//# sourceMappingURL=loader.js.map
|