@eminent337/aery 0.67.68 → 0.74.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 +418 -5
- package/README.md +67 -37
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +9 -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 +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +53 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +341 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/capabilities.d.ts +61 -0
- package/dist/cli/capabilities.d.ts.map +1 -0
- package/dist/cli/capabilities.js +155 -0
- package/dist/cli/capabilities.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/doctor.d.ts +32 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +133 -0
- package/dist/cli/doctor.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 +83 -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 +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +20 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +92 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +399 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +117 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +300 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +117 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +595 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2521 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +6 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +32 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +142 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +441 -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/compaction/branch-summarization.d.ts +88 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +243 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +615 -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 +153 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/custom-openai-compatible.d.ts +14 -0
- package/dist/core/custom-openai-compatible.d.ts.map +1 -0
- package/dist/core/custom-openai-compatible.js +128 -0
- package/dist/core/custom-openai-compatible.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/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 +224 -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 +1834 -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 +6 -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 +24 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +491 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +159 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +824 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1173 -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 +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +52 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +310 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +353 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +295 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/messages.d.ts +77 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +123 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +152 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +783 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +110 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +497 -0
- package/dist/core/model-resolver.js.map +1 -0
- 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 +198 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +1975 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +52 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +250 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +33 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/provider-setup-check.d.ts +14 -0
- package/dist/core/provider-setup-check.d.ts.map +1 -0
- package/dist/core/provider-setup-check.js +22 -0
- package/dist/core/provider-setup-check.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +23 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +126 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +194 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +727 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +107 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +282 -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 +333 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1109 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +261 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +782 -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 +404 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +27 -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 +120 -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 +8 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +31 -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 +335 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +85 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +338 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +49 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +324 -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 +37 -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 +298 -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 +169 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +50 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +178 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +8 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +289 -0
- package/dist/core/tools/read.js.map +1 -0
- 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 +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 +205 -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 +213 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -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 +583 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +61 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +456 -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 +20 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +121 -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 +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +503 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +70 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +79 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/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/extension-editor.d.ts +20 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +111 -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 +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +83 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +27 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +201 -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/login-dialog.d.ts +46 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +162 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +278 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +31 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +290 -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 +96 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +861 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +67 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +375 -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/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 +50 -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 +51 -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 +295 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +89 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1093 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +10 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +29 -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 +369 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +4612 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/aery.json +84 -0
- package/dist/modes/interactive/theme/catppuccin-mocha.json +81 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/dracula.json +81 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/nord.json +81 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +81 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +973 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/interactive/theme/tokyo-night.json +81 -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 +131 -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 +224 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +410 -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 +601 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +419 -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 +5 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +516 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/utils/aery-user-agent.d.ts +2 -0
- package/dist/utils/aery-user-agent.d.ts.map +1 -0
- package/dist/utils/aery-user-agent.js +5 -0
- package/dist/utils/aery-user-agent.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 +21 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +12 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +86 -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 +8 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +117 -0
- package/dist/utils/clipboard.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 +163 -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 +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +39 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize.d.ts +36 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +137 -0
- package/dist/utils/image-resize.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 +69 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/paths.d.ts +16 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +50 -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 +30 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +190 -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 +325 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/uuid.d.ts +2 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +40 -0
- package/dist/utils/uuid.js.map +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +77 -0
- package/dist/utils/version-check.js.map +1 -0
- package/docs/compaction.md +17 -17
- package/docs/custom-provider.md +42 -33
- package/docs/development.md +4 -4
- package/docs/docs.json +148 -0
- package/docs/extensions.md +308 -80
- 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 +70 -0
- package/docs/json.md +4 -4
- package/docs/keybindings.md +2 -2
- package/docs/models.md +84 -5
- package/docs/packages.md +15 -10
- package/docs/prompt-templates.md +2 -2
- package/docs/providers.md +68 -20
- package/docs/quickstart.md +142 -0
- package/docs/rpc.md +6 -6
- package/docs/sdk.md +58 -78
- package/docs/{session.md → session-format.md} +8 -8
- package/docs/sessions.md +137 -0
- package/docs/settings.md +49 -17
- package/docs/shell-aliases.md +1 -1
- package/docs/skills.md +4 -4
- package/docs/terminal-setup.md +2 -2
- package/docs/termux.md +6 -6
- package/docs/themes.md +6 -6
- package/docs/tmux.md +0 -0
- package/docs/tui.md +22 -22
- package/docs/usage.md +277 -0
- package/docs/windows.md +1 -1
- package/examples/README.md +0 -0
- package/examples/extensions/README.md +6 -6
- package/examples/extensions/antigravity-image-gen.ts +18 -18
- package/examples/extensions/auto-commit-on-exit.ts +1 -1
- package/examples/extensions/bash-spawn-hook.ts +3 -3
- package/examples/extensions/bookmark.ts +1 -1
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +3 -3
- package/examples/extensions/claude-rules.ts +2 -2
- package/examples/extensions/commands.ts +2 -2
- package/examples/extensions/confirm-destructive.ts +1 -1
- package/examples/extensions/custom-compaction.ts +3 -3
- package/examples/extensions/custom-footer.ts +3 -3
- package/examples/extensions/custom-header.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/index.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
- package/examples/extensions/custom-provider-qwen-cli/index.ts +3 -3
- package/examples/extensions/custom-provider-qwen-cli/package.json +2 -2
- package/examples/extensions/dirty-repo-guard.ts +1 -1
- package/examples/extensions/doom-overlay/README.md +0 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +0 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -0
- package/examples/extensions/doom-overlay/doom-component.ts +2 -2
- package/examples/extensions/doom-overlay/doom-engine.ts +0 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +1 -1
- package/examples/extensions/doom-overlay/index.ts +1 -1
- package/examples/extensions/doom-overlay/wad-finder.ts +0 -0
- package/examples/extensions/dynamic-resources/SKILL.md +0 -0
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-resources/dynamic.md +0 -0
- package/examples/extensions/dynamic-resources/index.ts +1 -1
- package/examples/extensions/dynamic-tools.ts +3 -3
- package/examples/extensions/event-bus.ts +1 -1
- package/examples/extensions/file-trigger.ts +1 -1
- package/examples/extensions/git-checkpoint.ts +1 -1
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/handoff.ts +52 -14
- package/examples/extensions/hello.ts +2 -2
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/inline-bash.ts +1 -1
- package/examples/extensions/input-transform.ts +1 -1
- package/examples/extensions/interactive-shell.ts +1 -1
- package/examples/extensions/mac-system-theme.ts +1 -1
- package/examples/extensions/message-renderer.ts +2 -2
- package/examples/extensions/minimal-mode.ts +3 -3
- package/examples/extensions/modal-editor.ts +2 -2
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/notify.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +3 -3
- package/examples/extensions/overlay-test.ts +2 -2
- package/examples/extensions/permission-gate.ts +1 -1
- package/examples/extensions/pirate.ts +2 -2
- package/examples/extensions/plan-mode/README.md +0 -0
- package/examples/extensions/plan-mode/index.ts +4 -4
- package/examples/extensions/plan-mode/utils.ts +0 -0
- package/examples/extensions/preset.ts +15 -9
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +1 -1
- package/examples/extensions/provider-payload.ts +2 -2
- package/examples/extensions/qna.ts +3 -3
- package/examples/extensions/question.ts +3 -3
- package/examples/extensions/questionnaire.ts +3 -3
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/reload-runtime.ts +2 -2
- package/examples/extensions/rpc-demo.ts +1 -1
- package/examples/extensions/sandbox/index.ts +8 -8
- package/examples/extensions/sandbox/package-lock.json +7 -7
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/send-user-message.ts +1 -1
- package/examples/extensions/session-name.ts +1 -1
- package/examples/extensions/shutdown-command.ts +2 -2
- package/examples/extensions/snake.ts +2 -2
- package/examples/extensions/space-invaders.ts +2 -2
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/status-line.ts +1 -1
- package/examples/extensions/stitch.ts +168 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +11 -11
- package/examples/extensions/subagent/agents/aery-agent.md +22 -0
- package/examples/extensions/subagent/agents/aery-ai.md +25 -0
- package/examples/extensions/subagent/agents/aery-core.md +19 -0
- package/examples/extensions/subagent/agents/aery-mom.md +25 -0
- package/examples/extensions/subagent/agents/aery-pods.md +24 -0
- package/examples/extensions/subagent/agents/aery-review.md +22 -0
- package/examples/extensions/subagent/agents/aery-tui.md +24 -0
- package/examples/extensions/subagent/agents/planner.md +0 -0
- package/examples/extensions/subagent/agents/reviewer.md +0 -0
- package/examples/extensions/subagent/agents/scout.md +0 -0
- package/examples/extensions/subagent/agents/worker.md +0 -0
- package/examples/extensions/subagent/agents.ts +2 -2
- package/examples/extensions/subagent/index.ts +9 -9
- package/examples/extensions/subagent/prompts/implement-and-review.md +0 -0
- package/examples/extensions/subagent/prompts/implement.md +0 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +0 -0
- package/examples/extensions/summarize.ts +4 -4
- package/examples/extensions/system-prompt-header.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +4 -4
- package/examples/extensions/timed-confirm.ts +1 -1
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/todo.ts +4 -4
- package/examples/extensions/tool-override.ts +3 -3
- package/examples/extensions/tools.ts +4 -4
- package/examples/extensions/trigger-compact.ts +1 -1
- package/examples/extensions/truncated-tool.ts +4 -4
- package/examples/extensions/widget-placement.ts +1 -1
- package/examples/extensions/with-deps/index.ts +2 -2
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +2 -2
- package/examples/extensions/working-indicator.ts +1 -1
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +1 -1
- package/examples/sdk/01-minimal.ts +16 -12
- package/examples/sdk/02-custom-model.ts +14 -10
- package/examples/sdk/03-custom-prompt.ts +26 -18
- package/examples/sdk/04-skills.ts +4 -4
- package/examples/sdk/05-tools.ts +9 -5
- package/examples/sdk/06-extensions.ts +15 -11
- package/examples/sdk/07-context-files.ts +3 -3
- package/examples/sdk/08-prompt-templates.ts +4 -4
- package/examples/sdk/09-api-keys-and-oauth.ts +11 -7
- package/examples/sdk/10-settings.ts +5 -5
- package/examples/sdk/11-sessions.ts +5 -1
- package/examples/sdk/12-full-control.ts +13 -9
- package/examples/sdk/13-session-runtime.ts +1 -1
- package/examples/sdk/README.md +8 -11
- package/package.json +95 -101
- package/docs/tree.md +0 -233
package/docs/extensions.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Extensions are TypeScript modules that extend pi's behavior. They can subscribe to lifecycle events, register custom tools callable by the LLM, add commands, and more.
|
|
6
6
|
|
|
7
|
-
> **Placement for /reload:** Put extensions in `~/.
|
|
7
|
+
> **Placement for /reload:** Put extensions in `~/.aery/agent/extensions/` (global) or `.aery/extensions/` (project-local) for auto-discovery. Use `pi -e ./path.ts` only for quick tests. Extensions in auto-discovered locations can be hot-reloaded with `/reload`.
|
|
8
8
|
|
|
9
9
|
**Key capabilities:**
|
|
10
10
|
- **Custom tools** - Register tools the LLM can call via `pi.registerTool()`
|
|
@@ -40,6 +40,7 @@ See [examples/extensions/](../examples/extensions/) for working implementations.
|
|
|
40
40
|
- [Resource Events](#resource-events)
|
|
41
41
|
- [Session Events](#session-events)
|
|
42
42
|
- [Agent Events](#agent-events)
|
|
43
|
+
- [Model Events](#model-events)
|
|
43
44
|
- [Tool Events](#tool-events)
|
|
44
45
|
- [ExtensionContext](#extensioncontext)
|
|
45
46
|
- [ExtensionCommandContext](#extensioncommandcontext)
|
|
@@ -53,11 +54,11 @@ See [examples/extensions/](../examples/extensions/) for working implementations.
|
|
|
53
54
|
|
|
54
55
|
## Quick Start
|
|
55
56
|
|
|
56
|
-
Create `~/.
|
|
57
|
+
Create `~/.aery/agent/extensions/my-extension.ts`:
|
|
57
58
|
|
|
58
59
|
```typescript
|
|
59
|
-
import type { ExtensionAPI } from "@
|
|
60
|
-
import { Type } from "
|
|
60
|
+
import type { ExtensionAPI } from "@eminent337/aery";
|
|
61
|
+
import { Type } from "typebox";
|
|
61
62
|
|
|
62
63
|
export default function (pi: ExtensionAPI) {
|
|
63
64
|
// React to events
|
|
@@ -112,10 +113,10 @@ Extensions are auto-discovered from:
|
|
|
112
113
|
|
|
113
114
|
| Location | Scope |
|
|
114
115
|
|----------|-------|
|
|
115
|
-
| `~/.
|
|
116
|
-
| `~/.
|
|
117
|
-
| `.
|
|
118
|
-
| `.
|
|
116
|
+
| `~/.aery/agent/extensions/*.ts` | Global (all projects) |
|
|
117
|
+
| `~/.aery/agent/extensions/*/index.ts` | Global (subdirectory) |
|
|
118
|
+
| `.aery/extensions/*.ts` | Project-local |
|
|
119
|
+
| `.aery/extensions/*/index.ts` | Project-local (subdirectory) |
|
|
119
120
|
|
|
120
121
|
Additional paths via `settings.json`:
|
|
121
122
|
|
|
@@ -138,14 +139,14 @@ To share extensions via npm or git as pi packages, see [packages.md](packages.md
|
|
|
138
139
|
|
|
139
140
|
| Package | Purpose |
|
|
140
141
|
|---------|---------|
|
|
141
|
-
| `@
|
|
142
|
-
|
|
|
143
|
-
| `@
|
|
144
|
-
| `@
|
|
142
|
+
| `@eminent337/aery` | Extension types (`ExtensionAPI`, `ExtensionContext`, events) |
|
|
143
|
+
| `typebox` | Schema definitions for tool parameters |
|
|
144
|
+
| `@eminent337/aery-ai` | AI utilities (`StringEnum` for Google-compatible enums) |
|
|
145
|
+
| `@eminent337/aery-tui` | TUI components for custom rendering |
|
|
145
146
|
|
|
146
147
|
npm dependencies work too. Add a `package.json` next to your extension (or in a parent directory), run `npm install`, and imports from `node_modules/` are resolved automatically.
|
|
147
148
|
|
|
148
|
-
For distributed pi packages installed with `pi install` (npm or git), runtime deps must be in `dependencies`. Package installation uses production installs (`npm install --omit=dev`), so `devDependencies` are not available at runtime.
|
|
149
|
+
For distributed pi packages installed with `pi install` (npm or git), runtime deps must be in `dependencies`. Package installation uses production installs (`npm install --omit=dev`) by default, so `devDependencies` are not available at runtime; when `npmCommand` is configured, git packages use plain `install` for compatibility with wrappers.
|
|
149
150
|
|
|
150
151
|
Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
151
152
|
|
|
@@ -154,7 +155,7 @@ Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
|
154
155
|
An extension exports a default factory function that receives `ExtensionAPI`. The factory can be synchronous or asynchronous:
|
|
155
156
|
|
|
156
157
|
```typescript
|
|
157
|
-
import type { ExtensionAPI } from "@
|
|
158
|
+
import type { ExtensionAPI } from "@eminent337/aery";
|
|
158
159
|
|
|
159
160
|
export default function (pi: ExtensionAPI) {
|
|
160
161
|
// Subscribe to events
|
|
@@ -183,7 +184,7 @@ If the factory returns a `Promise`, pi awaits it before continuing startup. That
|
|
|
183
184
|
Use an async factory for one-time startup work such as fetching remote configuration or dynamically discovering available models.
|
|
184
185
|
|
|
185
186
|
```typescript
|
|
186
|
-
import type { ExtensionAPI } from "@
|
|
187
|
+
import type { ExtensionAPI } from "@eminent337/aery";
|
|
187
188
|
|
|
188
189
|
export default async function (pi: ExtensionAPI) {
|
|
189
190
|
const response = await fetch("http://localhost:1234/v1/models");
|
|
@@ -220,14 +221,14 @@ This pattern makes the fetched models available during normal startup and to `pi
|
|
|
220
221
|
**Single file** - simplest, for small extensions:
|
|
221
222
|
|
|
222
223
|
```
|
|
223
|
-
~/.
|
|
224
|
+
~/.aery/agent/extensions/
|
|
224
225
|
└── my-extension.ts
|
|
225
226
|
```
|
|
226
227
|
|
|
227
228
|
**Directory with index.ts** - for multi-file extensions:
|
|
228
229
|
|
|
229
230
|
```
|
|
230
|
-
~/.
|
|
231
|
+
~/.aery/agent/extensions/
|
|
231
232
|
└── my-extension/
|
|
232
233
|
├── index.ts # Entry point (exports default function)
|
|
233
234
|
├── tools.ts # Helper module
|
|
@@ -237,7 +238,7 @@ This pattern makes the fetched models available during normal startup and to `pi
|
|
|
237
238
|
**Package with dependencies** - for extensions that need npm packages:
|
|
238
239
|
|
|
239
240
|
```
|
|
240
|
-
~/.
|
|
241
|
+
~/.aery/agent/extensions/
|
|
241
242
|
└── my-extension/
|
|
242
243
|
├── package.json # Declares dependencies and entry points
|
|
243
244
|
├── package-lock.json
|
|
@@ -323,8 +324,12 @@ user sends another prompt ◄─────────────────
|
|
|
323
324
|
└─► session_tree
|
|
324
325
|
|
|
325
326
|
/model or Ctrl+P (model selection/cycling)
|
|
327
|
+
├─► thinking_level_select (if model change changes/clamps thinking level)
|
|
326
328
|
└─► model_select
|
|
327
329
|
|
|
330
|
+
thinking level changes (settings, keybinding, pi.setThinkingLevel())
|
|
331
|
+
└─► thinking_level_select
|
|
332
|
+
|
|
328
333
|
exit (Ctrl+C, Ctrl+D, SIGHUP, SIGTERM)
|
|
329
334
|
└─► session_shutdown
|
|
330
335
|
```
|
|
@@ -350,7 +355,7 @@ pi.on("resources_discover", async (event, _ctx) => {
|
|
|
350
355
|
|
|
351
356
|
### Session Events
|
|
352
357
|
|
|
353
|
-
See [
|
|
358
|
+
See [Session Format](session-format.md) for session storage internals and the SessionManager API.
|
|
354
359
|
|
|
355
360
|
#### session_start
|
|
356
361
|
|
|
@@ -429,7 +434,7 @@ pi.on("session_compact", async (event, ctx) => {
|
|
|
429
434
|
|
|
430
435
|
#### session_before_tree / session_tree
|
|
431
436
|
|
|
432
|
-
Fired on `/tree` navigation. See [
|
|
437
|
+
Fired on `/tree` navigation. See [Sessions](sessions.md) for tree navigation concepts.
|
|
433
438
|
|
|
434
439
|
```typescript
|
|
435
440
|
pi.on("session_before_tree", async (event, ctx) => {
|
|
@@ -446,10 +451,12 @@ pi.on("session_tree", async (event, ctx) => {
|
|
|
446
451
|
|
|
447
452
|
#### session_shutdown
|
|
448
453
|
|
|
449
|
-
Fired
|
|
454
|
+
Fired before an extension runtime is torn down.
|
|
450
455
|
|
|
451
456
|
```typescript
|
|
452
|
-
pi.on("session_shutdown", async (
|
|
457
|
+
pi.on("session_shutdown", async (event, ctx) => {
|
|
458
|
+
// event.reason - "quit" | "reload" | "new" | "resume" | "fork"
|
|
459
|
+
// event.targetSessionFile - destination session for session replacement flows
|
|
453
460
|
// Cleanup, save state, etc.
|
|
454
461
|
});
|
|
455
462
|
```
|
|
@@ -464,7 +471,17 @@ Fired after user submits prompt, before agent loop. Can inject a message and/or
|
|
|
464
471
|
pi.on("before_agent_start", async (event, ctx) => {
|
|
465
472
|
// event.prompt - user's prompt text
|
|
466
473
|
// event.images - attached images (if any)
|
|
467
|
-
// event.systemPrompt - current system prompt
|
|
474
|
+
// event.systemPrompt - current chained system prompt for this handler
|
|
475
|
+
// (includes changes from earlier before_agent_start handlers)
|
|
476
|
+
// event.systemPromptOptions - structured options used to build the system prompt
|
|
477
|
+
// .customPrompt - any custom system prompt (from --system-prompt, SYSTEM.md, or custom templates)
|
|
478
|
+
// .selectedTools - tools currently active in the prompt
|
|
479
|
+
// .toolSnippets - one-line descriptions for each tool
|
|
480
|
+
// .promptGuidelines - custom guideline bullets
|
|
481
|
+
// .appendSystemPrompt - text from --append-system-prompt flags
|
|
482
|
+
// .cwd - working directory
|
|
483
|
+
// .contextFiles - AGENTS.md files and other loaded context files
|
|
484
|
+
// .skills - loaded skills
|
|
468
485
|
|
|
469
486
|
return {
|
|
470
487
|
// Inject a persistent message (stored in session, sent to LLM)
|
|
@@ -479,6 +496,10 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
479
496
|
});
|
|
480
497
|
```
|
|
481
498
|
|
|
499
|
+
The `systemPromptOptions` field gives extensions access to the same structured data Pi uses to build the system prompt. This lets you inspect what Pi has loaded — custom prompts, guidelines, tool snippets, context files, skills — without re-discovering resources or re-parsing flags. Use it when your extension needs to make deep, informed changes to the system prompt while respecting user-provided configuration.
|
|
500
|
+
|
|
501
|
+
Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
|
|
502
|
+
|
|
482
503
|
#### agent_start / agent_end
|
|
483
504
|
|
|
484
505
|
Fired once per user prompt.
|
|
@@ -511,6 +532,7 @@ Fired for message lifecycle updates.
|
|
|
511
532
|
|
|
512
533
|
- `message_start` and `message_end` fire for user, assistant, and toolResult messages.
|
|
513
534
|
- `message_update` fires for assistant streaming updates.
|
|
535
|
+
- `message_end` handlers can return `{ message }` to replace the finalized message. The replacement must keep the same `role`.
|
|
514
536
|
|
|
515
537
|
```typescript
|
|
516
538
|
pi.on("message_start", async (event, ctx) => {
|
|
@@ -523,7 +545,20 @@ pi.on("message_update", async (event, ctx) => {
|
|
|
523
545
|
});
|
|
524
546
|
|
|
525
547
|
pi.on("message_end", async (event, ctx) => {
|
|
526
|
-
|
|
548
|
+
if (event.message.role !== "assistant") return;
|
|
549
|
+
|
|
550
|
+
return {
|
|
551
|
+
message: {
|
|
552
|
+
...event.message,
|
|
553
|
+
usage: {
|
|
554
|
+
...event.message.usage,
|
|
555
|
+
cost: {
|
|
556
|
+
...event.message.usage.cost,
|
|
557
|
+
total: 0.123,
|
|
558
|
+
},
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
};
|
|
527
562
|
});
|
|
528
563
|
```
|
|
529
564
|
|
|
@@ -534,7 +569,8 @@ Fired for tool execution lifecycle updates.
|
|
|
534
569
|
In parallel tool mode:
|
|
535
570
|
- `tool_execution_start` is emitted in assistant source order during the preflight phase
|
|
536
571
|
- `tool_execution_update` events may interleave across tools
|
|
537
|
-
- `tool_execution_end` is emitted in
|
|
572
|
+
- `tool_execution_end` is emitted in tool completion order after each tool is finalized
|
|
573
|
+
- final `toolResult` message events are still emitted later in assistant source order
|
|
538
574
|
|
|
539
575
|
```typescript
|
|
540
576
|
pi.on("tool_execution_start", async (event, ctx) => {
|
|
@@ -552,7 +588,7 @@ pi.on("tool_execution_end", async (event, ctx) => {
|
|
|
552
588
|
|
|
553
589
|
#### context
|
|
554
590
|
|
|
555
|
-
Fired before each LLM call. Modify messages non-destructively. See [
|
|
591
|
+
Fired before each LLM call. Modify messages non-destructively. See [Session Format](session-format.md) for message types.
|
|
556
592
|
|
|
557
593
|
```typescript
|
|
558
594
|
pi.on("context", async (event, ctx) => {
|
|
@@ -566,6 +602,8 @@ pi.on("context", async (event, ctx) => {
|
|
|
566
602
|
|
|
567
603
|
Fired after the provider-specific payload is built, right before the request is sent. Handlers run in extension load order. Returning `undefined` keeps the payload unchanged. Returning any other value replaces the payload for later handlers and for the actual request.
|
|
568
604
|
|
|
605
|
+
This hook can rewrite provider-level system instructions or remove them entirely. Those payload-level changes are not reflected by `ctx.getSystemPrompt()`, which reports Pi's system prompt string rather than the final serialized provider payload.
|
|
606
|
+
|
|
569
607
|
```typescript
|
|
570
608
|
pi.on("before_provider_request", (event, ctx) => {
|
|
571
609
|
console.log(JSON.stringify(event.payload, null, 2));
|
|
@@ -616,6 +654,21 @@ pi.on("model_select", async (event, ctx) => {
|
|
|
616
654
|
|
|
617
655
|
Use this to update UI elements (status bars, footers) or perform model-specific initialization when the active model changes.
|
|
618
656
|
|
|
657
|
+
#### thinking_level_select
|
|
658
|
+
|
|
659
|
+
Fired when the thinking level changes. This is notification-only; handler return values are ignored.
|
|
660
|
+
|
|
661
|
+
```typescript
|
|
662
|
+
pi.on("thinking_level_select", async (event, ctx) => {
|
|
663
|
+
// event.level - newly selected thinking level
|
|
664
|
+
// event.previousLevel - previous thinking level
|
|
665
|
+
|
|
666
|
+
ctx.ui.setStatus("thinking", `thinking: ${event.level}`);
|
|
667
|
+
});
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Use this to update extension UI when `pi.setThinkingLevel()`, model changes, or built-in thinking-level controls change the active thinking level.
|
|
671
|
+
|
|
619
672
|
### Tool Events
|
|
620
673
|
|
|
621
674
|
#### tool_call
|
|
@@ -635,7 +688,7 @@ Behavior guarantees:
|
|
|
635
688
|
- Return values from `tool_call` only control blocking via `{ block: true, reason?: string }`
|
|
636
689
|
|
|
637
690
|
```typescript
|
|
638
|
-
import { isToolCallEventType } from "@
|
|
691
|
+
import { isToolCallEventType } from "@eminent337/aery";
|
|
639
692
|
|
|
640
693
|
pi.on("tool_call", async (event, ctx) => {
|
|
641
694
|
// event.toolName - "bash", "read", "write", "edit", etc.
|
|
@@ -671,7 +724,7 @@ export type MyToolInput = Static<typeof myToolSchema>;
|
|
|
671
724
|
Use `isToolCallEventType` with explicit type parameters:
|
|
672
725
|
|
|
673
726
|
```typescript
|
|
674
|
-
import { isToolCallEventType } from "@
|
|
727
|
+
import { isToolCallEventType } from "@eminent337/aery";
|
|
675
728
|
import type { MyToolInput } from "my-extension";
|
|
676
729
|
|
|
677
730
|
pi.on("tool_call", (event) => {
|
|
@@ -685,6 +738,8 @@ pi.on("tool_call", (event) => {
|
|
|
685
738
|
|
|
686
739
|
Fired after tool execution finishes and before `tool_execution_end` plus the final tool result message events are emitted. **Can modify result.**
|
|
687
740
|
|
|
741
|
+
In parallel tool mode, `tool_result` and `tool_execution_end` may interleave in tool completion order, while final `toolResult` message events are still emitted later in assistant source order.
|
|
742
|
+
|
|
688
743
|
`tool_result` handlers chain like middleware:
|
|
689
744
|
- Handlers run in extension load order
|
|
690
745
|
- Each handler sees the latest result after previous handler changes
|
|
@@ -693,7 +748,7 @@ Fired after tool execution finishes and before `tool_execution_end` plus the fin
|
|
|
693
748
|
Use `ctx.signal` for nested async work inside the handler. This lets Esc cancel model calls, `fetch()`, and other abort-aware operations started by the extension.
|
|
694
749
|
|
|
695
750
|
```typescript
|
|
696
|
-
import { isBashToolResult } from "@
|
|
751
|
+
import { isBashToolResult } from "@eminent337/aery";
|
|
697
752
|
|
|
698
753
|
pi.on("tool_result", async (event, ctx) => {
|
|
699
754
|
// event.toolName, event.toolCallId, event.input
|
|
@@ -721,7 +776,7 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
721
776
|
Fired when user executes `!` or `!!` commands. **Can intercept.**
|
|
722
777
|
|
|
723
778
|
```typescript
|
|
724
|
-
import { createLocalBashOperations } from "@
|
|
779
|
+
import { createLocalBashOperations } from "@eminent337/aery";
|
|
725
780
|
|
|
726
781
|
pi.on("user_bash", (event, ctx) => {
|
|
727
782
|
// event.command - the bash command
|
|
@@ -812,7 +867,7 @@ Current working directory.
|
|
|
812
867
|
|
|
813
868
|
### ctx.sessionManager
|
|
814
869
|
|
|
815
|
-
Read-only access to session state. See [
|
|
870
|
+
Read-only access to session state. See [Session Format](session-format.md) for the full SessionManager API and entry types.
|
|
816
871
|
|
|
817
872
|
For `tool_call`, this state is synchronized through the current assistant message before handlers run. In parallel tool execution mode it is still not guaranteed to include sibling tool results from the same assistant message.
|
|
818
873
|
|
|
@@ -902,7 +957,12 @@ ctx.compact({
|
|
|
902
957
|
|
|
903
958
|
### ctx.getSystemPrompt()
|
|
904
959
|
|
|
905
|
-
Returns
|
|
960
|
+
Returns Pi's current system prompt string.
|
|
961
|
+
|
|
962
|
+
- During `before_agent_start`, this reflects chained system-prompt changes made so far for the current turn.
|
|
963
|
+
- It does not include later `context` message mutations.
|
|
964
|
+
- It does not include `before_provider_request` payload rewrites.
|
|
965
|
+
- If later-loaded extensions run after yours, they can still change what is ultimately sent.
|
|
906
966
|
|
|
907
967
|
```typescript
|
|
908
968
|
pi.on("before_agent_start", (event, ctx) => {
|
|
@@ -933,8 +993,11 @@ pi.registerCommand("my-cmd", {
|
|
|
933
993
|
Create a new session:
|
|
934
994
|
|
|
935
995
|
```typescript
|
|
996
|
+
const parentSession = ctx.sessionManager.getSessionFile();
|
|
997
|
+
const kickoff = "Continue in the replacement session";
|
|
998
|
+
|
|
936
999
|
const result = await ctx.newSession({
|
|
937
|
-
parentSession
|
|
1000
|
+
parentSession,
|
|
938
1001
|
setup: async (sm) => {
|
|
939
1002
|
sm.appendMessage({
|
|
940
1003
|
role: "user",
|
|
@@ -942,6 +1005,10 @@ const result = await ctx.newSession({
|
|
|
942
1005
|
timestamp: Date.now(),
|
|
943
1006
|
});
|
|
944
1007
|
},
|
|
1008
|
+
withSession: async (ctx) => {
|
|
1009
|
+
// Use only the replacement-session ctx here.
|
|
1010
|
+
await ctx.sendUserMessage(kickoff);
|
|
1011
|
+
},
|
|
945
1012
|
});
|
|
946
1013
|
|
|
947
1014
|
if (result.cancelled) {
|
|
@@ -949,25 +1016,36 @@ if (result.cancelled) {
|
|
|
949
1016
|
}
|
|
950
1017
|
```
|
|
951
1018
|
|
|
1019
|
+
Options:
|
|
1020
|
+
- `parentSession`: parent session file to record in the new session header
|
|
1021
|
+
- `setup`: mutate the new session's `SessionManager` before `withSession` runs
|
|
1022
|
+
- `withSession`: run post-switch work against a fresh replacement-session context. Do not use captured old `pi` / command `ctx`; see [Session replacement lifecycle and footguns](#session-replacement-lifecycle-and-footguns).
|
|
1023
|
+
|
|
952
1024
|
### ctx.fork(entryId, options?)
|
|
953
1025
|
|
|
954
1026
|
Fork from a specific entry, creating a new session file:
|
|
955
1027
|
|
|
956
1028
|
```typescript
|
|
957
|
-
const result = await ctx.fork("entry-id-123"
|
|
958
|
-
|
|
959
|
-
|
|
1029
|
+
const result = await ctx.fork("entry-id-123", {
|
|
1030
|
+
withSession: async (ctx) => {
|
|
1031
|
+
// Use only the replacement-session ctx here.
|
|
1032
|
+
ctx.ui.notify("Now in the forked session", "info");
|
|
1033
|
+
},
|
|
1034
|
+
});
|
|
1035
|
+
if (result.cancelled) {
|
|
1036
|
+
// An extension cancelled the fork
|
|
960
1037
|
}
|
|
961
1038
|
|
|
962
1039
|
const cloneResult = await ctx.fork("entry-id-456", { position: "at" });
|
|
963
|
-
if (
|
|
964
|
-
//
|
|
1040
|
+
if (cloneResult.cancelled) {
|
|
1041
|
+
// An extension cancelled the clone
|
|
965
1042
|
}
|
|
966
1043
|
```
|
|
967
1044
|
|
|
968
1045
|
Options:
|
|
969
1046
|
- `position`: `"before"` (default) forks before the selected user message, restoring that prompt into the editor
|
|
970
1047
|
- `position`: `"at"` duplicates the active path through the selected entry without restoring editor text
|
|
1048
|
+
- `withSession`: run post-switch work against a fresh replacement-session context. Do not use captured old `pi` / command `ctx`; see [Session replacement lifecycle and footguns](#session-replacement-lifecycle-and-footguns).
|
|
971
1049
|
|
|
972
1050
|
### ctx.navigateTree(targetId, options?)
|
|
973
1051
|
|
|
@@ -988,21 +1066,28 @@ Options:
|
|
|
988
1066
|
- `replaceInstructions`: If true, `customInstructions` replaces the default prompt instead of being appended
|
|
989
1067
|
- `label`: Label to attach to the branch summary entry (or target entry if not summarizing)
|
|
990
1068
|
|
|
991
|
-
### ctx.switchSession(sessionPath)
|
|
1069
|
+
### ctx.switchSession(sessionPath, options?)
|
|
992
1070
|
|
|
993
1071
|
Switch to a different session file:
|
|
994
1072
|
|
|
995
1073
|
```typescript
|
|
996
|
-
const result = await ctx.switchSession("/path/to/session.jsonl"
|
|
1074
|
+
const result = await ctx.switchSession("/path/to/session.jsonl", {
|
|
1075
|
+
withSession: async (ctx) => {
|
|
1076
|
+
await ctx.sendUserMessage("Resume work in the replacement session");
|
|
1077
|
+
},
|
|
1078
|
+
});
|
|
997
1079
|
if (result.cancelled) {
|
|
998
1080
|
// An extension cancelled the switch via session_before_switch
|
|
999
1081
|
}
|
|
1000
1082
|
```
|
|
1001
1083
|
|
|
1084
|
+
Options:
|
|
1085
|
+
- `withSession`: run post-switch work against a fresh replacement-session context. Do not use captured old `pi` / command `ctx`; see [Session replacement lifecycle and footguns](#session-replacement-lifecycle-and-footguns).
|
|
1086
|
+
|
|
1002
1087
|
To discover available sessions, use the static `SessionManager.list()` or `SessionManager.listAll()` methods:
|
|
1003
1088
|
|
|
1004
1089
|
```typescript
|
|
1005
|
-
import { SessionManager } from "@
|
|
1090
|
+
import { SessionManager } from "@eminent337/aery";
|
|
1006
1091
|
|
|
1007
1092
|
pi.registerCommand("switch", {
|
|
1008
1093
|
description: "Switch to another session",
|
|
@@ -1014,12 +1099,59 @@ pi.registerCommand("switch", {
|
|
|
1014
1099
|
sessions.map(s => s.file),
|
|
1015
1100
|
);
|
|
1016
1101
|
if (choice) {
|
|
1017
|
-
await ctx.switchSession(choice
|
|
1102
|
+
await ctx.switchSession(choice, {
|
|
1103
|
+
withSession: async (ctx) => {
|
|
1104
|
+
ctx.ui.notify("Switched session", "info");
|
|
1105
|
+
},
|
|
1106
|
+
});
|
|
1018
1107
|
}
|
|
1019
1108
|
},
|
|
1020
1109
|
});
|
|
1021
1110
|
```
|
|
1022
1111
|
|
|
1112
|
+
### Session replacement lifecycle and footguns
|
|
1113
|
+
|
|
1114
|
+
`withSession` receives a fresh `ReplacedSessionContext`, which extends `ExtensionCommandContext` with async `sendMessage()` and `sendUserMessage()` helpers bound to the replacement session.
|
|
1115
|
+
|
|
1116
|
+
Lifecycle and footguns:
|
|
1117
|
+
- `withSession` runs only after the old session has emitted `session_shutdown`, the old runtime has been torn down, the replacement session has been rebound, and the new extension instance has already received `session_start`.
|
|
1118
|
+
- The callback still executes in the original closure, not inside the new extension instance. That means your old extension instance may already have run its shutdown cleanup before `withSession` starts.
|
|
1119
|
+
- Captured old `pi` / old command `ctx` session-bound objects are stale after replacement and will throw if used. Use only the `ctx` passed to `withSession` for session-bound work.
|
|
1120
|
+
- Previously extracted raw objects are still your responsibility. For example, if you capture `const sm = ctx.sessionManager` before replacement, `sm` is still the old `SessionManager` object. Do not reuse it after replacement.
|
|
1121
|
+
- Code in `withSession` should assume any state invalidated by your `session_shutdown` handler is already gone. Only capture plain data that survives shutdown cleanly, such as strings, ids, and serialized config.
|
|
1122
|
+
|
|
1123
|
+
Safe pattern:
|
|
1124
|
+
|
|
1125
|
+
```typescript
|
|
1126
|
+
pi.registerCommand("handoff", {
|
|
1127
|
+
handler: async (_args, ctx) => {
|
|
1128
|
+
const kickoff = "Continue from the replacement session";
|
|
1129
|
+
await ctx.newSession({
|
|
1130
|
+
withSession: async (ctx) => {
|
|
1131
|
+
await ctx.sendUserMessage(kickoff);
|
|
1132
|
+
},
|
|
1133
|
+
});
|
|
1134
|
+
},
|
|
1135
|
+
});
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1138
|
+
Unsafe pattern:
|
|
1139
|
+
|
|
1140
|
+
```typescript
|
|
1141
|
+
pi.registerCommand("handoff", {
|
|
1142
|
+
handler: async (_args, ctx) => {
|
|
1143
|
+
const oldSessionManager = ctx.sessionManager;
|
|
1144
|
+
await ctx.newSession({
|
|
1145
|
+
withSession: async (_ctx) => {
|
|
1146
|
+
// stale old objects: do not do this
|
|
1147
|
+
oldSessionManager.getSessionFile();
|
|
1148
|
+
pi.sendUserMessage("wrong");
|
|
1149
|
+
},
|
|
1150
|
+
});
|
|
1151
|
+
},
|
|
1152
|
+
});
|
|
1153
|
+
```
|
|
1154
|
+
|
|
1023
1155
|
### ctx.reload()
|
|
1024
1156
|
|
|
1025
1157
|
Run the same reload flow as `/reload`.
|
|
@@ -1049,8 +1181,8 @@ Tools run with `ExtensionContext`, so they cannot call `ctx.reload()` directly.
|
|
|
1049
1181
|
Example tool the LLM can call to trigger reload:
|
|
1050
1182
|
|
|
1051
1183
|
```typescript
|
|
1052
|
-
import type { ExtensionAPI } from "@
|
|
1053
|
-
import { Type } from "
|
|
1184
|
+
import type { ExtensionAPI } from "@eminent337/aery";
|
|
1185
|
+
import { Type } from "typebox";
|
|
1054
1186
|
|
|
1055
1187
|
export default function (pi: ExtensionAPI) {
|
|
1056
1188
|
pi.registerCommand("reload-runtime", {
|
|
@@ -1092,18 +1224,20 @@ Use `pi.setActiveTools()` to enable or disable tools (including dynamically adde
|
|
|
1092
1224
|
|
|
1093
1225
|
Use `promptSnippet` to opt a custom tool into a one-line entry in `Available tools`, and `promptGuidelines` to append tool-specific bullets to the default `Guidelines` section when the tool is active.
|
|
1094
1226
|
|
|
1227
|
+
**Important:** `promptGuidelines` bullets are appended flat to the `Guidelines` section with no tool name prefix. Each guideline must name the tool it refers to — avoid "Use this tool when..." because the LLM cannot tell which tool "this" means. Write "Use my_tool when..." instead.
|
|
1228
|
+
|
|
1095
1229
|
See [dynamic-tools.ts](../examples/extensions/dynamic-tools.ts) for a full example.
|
|
1096
1230
|
|
|
1097
1231
|
```typescript
|
|
1098
|
-
import { Type } from "
|
|
1099
|
-
import { StringEnum } from "@
|
|
1232
|
+
import { Type } from "typebox";
|
|
1233
|
+
import { StringEnum } from "@eminent337/aery-ai";
|
|
1100
1234
|
|
|
1101
1235
|
pi.registerTool({
|
|
1102
1236
|
name: "my_tool",
|
|
1103
1237
|
label: "My Tool",
|
|
1104
1238
|
description: "What this tool does",
|
|
1105
1239
|
promptSnippet: "Summarize or transform text according to action",
|
|
1106
|
-
promptGuidelines: ["Use
|
|
1240
|
+
promptGuidelines: ["Use my_tool when the user asks to summarize previously generated text."],
|
|
1107
1241
|
parameters: Type.Object({
|
|
1108
1242
|
action: StringEnum(["list", "add"] as const),
|
|
1109
1243
|
text: Type.Optional(Type.String()),
|
|
@@ -1254,7 +1388,7 @@ pi.registerCommand("stats", {
|
|
|
1254
1388
|
Optional: add argument auto-completion for `/command ...`:
|
|
1255
1389
|
|
|
1256
1390
|
```typescript
|
|
1257
|
-
import type { AutocompleteItem } from "@
|
|
1391
|
+
import type { AutocompleteItem } from "@eminent337/aery-tui";
|
|
1258
1392
|
|
|
1259
1393
|
pi.registerCommand("deploy", {
|
|
1260
1394
|
description: "Deploy to an environment",
|
|
@@ -1332,7 +1466,7 @@ pi.registerFlag("plan", {
|
|
|
1332
1466
|
});
|
|
1333
1467
|
|
|
1334
1468
|
// Check value
|
|
1335
|
-
if (pi.getFlag("
|
|
1469
|
+
if (pi.getFlag("plan")) {
|
|
1336
1470
|
// Plan mode enabled
|
|
1337
1471
|
}
|
|
1338
1472
|
```
|
|
@@ -1388,7 +1522,7 @@ if (model) {
|
|
|
1388
1522
|
|
|
1389
1523
|
### pi.getThinkingLevel() / pi.setThinkingLevel(level)
|
|
1390
1524
|
|
|
1391
|
-
Get or set the thinking level. Level is clamped to model capabilities (non-reasoning models always use "off").
|
|
1525
|
+
Get or set the thinking level. Level is clamped to model capabilities (non-reasoning models always use "off"). Changes emit `thinking_level_select`.
|
|
1392
1526
|
|
|
1393
1527
|
```typescript
|
|
1394
1528
|
const current = pi.getThinkingLevel(); // "off" | "minimal" | "low" | "medium" | "high" | "xhigh"
|
|
@@ -1415,6 +1549,7 @@ If you need to discover models from a remote endpoint, prefer an async extension
|
|
|
1415
1549
|
```typescript
|
|
1416
1550
|
// Register a new provider with custom models
|
|
1417
1551
|
pi.registerProvider("my-proxy", {
|
|
1552
|
+
name: "My Proxy",
|
|
1418
1553
|
baseUrl: "https://proxy.example.com",
|
|
1419
1554
|
apiKey: "PROXY_API_KEY", // env var name or literal
|
|
1420
1555
|
api: "anthropic-messages",
|
|
@@ -1461,12 +1596,13 @@ pi.registerProvider("corporate-ai", {
|
|
|
1461
1596
|
```
|
|
1462
1597
|
|
|
1463
1598
|
**Config options:**
|
|
1599
|
+
- `name` - Display name for the provider in UI such as `/login`.
|
|
1464
1600
|
- `baseUrl` - API endpoint URL. Required when defining models.
|
|
1465
1601
|
- `apiKey` - API key or environment variable name. Required when defining models (unless `oauth` provided).
|
|
1466
1602
|
- `api` - API type: `"anthropic-messages"`, `"openai-completions"`, `"openai-responses"`, etc.
|
|
1467
1603
|
- `headers` - Custom headers to include in requests.
|
|
1468
1604
|
- `authHeader` - If true, adds `Authorization: Bearer` header automatically.
|
|
1469
|
-
- `models` - Array of model definitions. If provided, replaces all existing models for this provider.
|
|
1605
|
+
- `models` - Array of model definitions. If provided, replaces all existing models for this provider. Model definitions can set `baseUrl` to override the provider endpoint for that model.
|
|
1470
1606
|
- `oauth` - OAuth provider config for `/login` support. When provided, the provider appears in the login menu.
|
|
1471
1607
|
- `streamSimple` - Custom streaming implementation for non-standard APIs.
|
|
1472
1608
|
|
|
@@ -1529,6 +1665,8 @@ Use `promptSnippet` for a short one-line entry in the `Available tools` section
|
|
|
1529
1665
|
|
|
1530
1666
|
Use `promptGuidelines` to add tool-specific bullets to the default system prompt `Guidelines` section. These bullets are included only while the tool is active (for example, after `pi.setActiveTools([...])`).
|
|
1531
1667
|
|
|
1668
|
+
**Important:** `promptGuidelines` bullets are appended flat to the `Guidelines` section with no tool name prefix or grouping. Each guideline must name the tool it refers to — avoid "Use this tool when..." because the LLM cannot tell which tool "this" means. Write "Use my_tool when..." instead.
|
|
1669
|
+
|
|
1532
1670
|
Note: Some models are idiots and include the @ prefix in tool path arguments. Built-in tools strip a leading @ before resolving paths. If your custom tool accepts a path, normalize a leading @ as well.
|
|
1533
1671
|
|
|
1534
1672
|
If your custom tool mutates files, use `withFileMutationQueue()` so it participates in the same per-file queue as built-in `edit` and `write`. This matters because tool calls run in parallel by default. Without the queue, two tools can read the same old file contents, compute different updates, and then whichever write lands last overwrites the other.
|
|
@@ -1540,7 +1678,7 @@ Pass the real target file path to `withFileMutationQueue()`, not the raw user ar
|
|
|
1540
1678
|
Queue the entire mutation window on that target path. That includes read-modify-write logic, not just the final write.
|
|
1541
1679
|
|
|
1542
1680
|
```typescript
|
|
1543
|
-
import { withFileMutationQueue } from "@
|
|
1681
|
+
import { withFileMutationQueue } from "@eminent337/aery";
|
|
1544
1682
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
1545
1683
|
import { dirname, resolve } from "node:path";
|
|
1546
1684
|
|
|
@@ -1564,9 +1702,9 @@ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
|
1564
1702
|
### Tool Definition
|
|
1565
1703
|
|
|
1566
1704
|
```typescript
|
|
1567
|
-
import { Type } from "
|
|
1568
|
-
import { StringEnum } from "@
|
|
1569
|
-
import { Text } from "@
|
|
1705
|
+
import { Type } from "typebox";
|
|
1706
|
+
import { StringEnum } from "@eminent337/aery-ai";
|
|
1707
|
+
import { Text } from "@eminent337/aery-tui";
|
|
1570
1708
|
|
|
1571
1709
|
pi.registerTool({
|
|
1572
1710
|
name: "my_tool",
|
|
@@ -1574,7 +1712,7 @@ pi.registerTool({
|
|
|
1574
1712
|
description: "What this tool does (shown to LLM)",
|
|
1575
1713
|
promptSnippet: "List or add items in the project todo list",
|
|
1576
1714
|
promptGuidelines: [
|
|
1577
|
-
"Use
|
|
1715
|
+
"Use my_tool for todo planning instead of direct file edits when the user asks for a task list."
|
|
1578
1716
|
],
|
|
1579
1717
|
parameters: Type.Object({
|
|
1580
1718
|
action: StringEnum(["list", "add"] as const), // Use StringEnum for Google compatibility
|
|
@@ -1608,6 +1746,9 @@ pi.registerTool({
|
|
|
1608
1746
|
return {
|
|
1609
1747
|
content: [{ type: "text", text: "Done" }], // Sent to LLM
|
|
1610
1748
|
details: { data: result }, // For rendering & state
|
|
1749
|
+
// Optional: stop after this tool batch when every finalized tool result
|
|
1750
|
+
// in the batch also returns terminate: true.
|
|
1751
|
+
terminate: true,
|
|
1611
1752
|
};
|
|
1612
1753
|
},
|
|
1613
1754
|
|
|
@@ -1619,6 +1760,8 @@ pi.registerTool({
|
|
|
1619
1760
|
|
|
1620
1761
|
**Signaling errors:** To mark a tool execution as failed (sets `isError: true` on the result and reports it to the LLM), throw an error from `execute`. Returning a value never sets the error flag regardless of what properties you include in the return object.
|
|
1621
1762
|
|
|
1763
|
+
**Early termination:** Return `terminate: true` from `execute()` to hint that the automatic follow-up LLM call should be skipped after the current tool batch. This only takes effect when every finalized tool result in that batch is terminating. See [examples/extensions/structured-output.ts](../examples/extensions/structured-output.ts) for a minimal example where the agent ends on a final structured-output tool call.
|
|
1764
|
+
|
|
1622
1765
|
```typescript
|
|
1623
1766
|
// Correct: throw to signal an error
|
|
1624
1767
|
async execute(toolCallId, params) {
|
|
@@ -1629,7 +1772,7 @@ async execute(toolCallId, params) {
|
|
|
1629
1772
|
}
|
|
1630
1773
|
```
|
|
1631
1774
|
|
|
1632
|
-
**Important:** Use `StringEnum` from `@
|
|
1775
|
+
**Important:** Use `StringEnum` from `@eminent337/aery-ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1633
1776
|
|
|
1634
1777
|
**Argument preparation:** `prepareArguments(args)` is optional. If defined, it runs before schema validation and before `execute()`. Use it to mimic an older accepted input shape when pi resumes an older session whose stored tool call arguments no longer match the current schema. Return the object you want validated against `parameters`. Keep the public schema strict. Do not add deprecated compatibility fields to `parameters` just to keep old resumed sessions working.
|
|
1635
1778
|
|
|
@@ -1687,10 +1830,10 @@ Extensions can override built-in tools (`read`, `bash`, `edit`, `write`, `grep`,
|
|
|
1687
1830
|
pi -e ./tool-override.ts
|
|
1688
1831
|
```
|
|
1689
1832
|
|
|
1690
|
-
Alternatively, use `--no-tools` to start without any built-in tools:
|
|
1833
|
+
Alternatively, use `--no-builtin-tools` to start without any built-in tools while keeping extension tools enabled:
|
|
1691
1834
|
```bash
|
|
1692
1835
|
# No built-in tools, only extension tools
|
|
1693
|
-
pi --no-tools -e ./my-extension.ts
|
|
1836
|
+
pi --no-builtin-tools -e ./my-extension.ts
|
|
1694
1837
|
```
|
|
1695
1838
|
|
|
1696
1839
|
See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.ts) for a complete example that overrides `read` with logging and access control.
|
|
@@ -1702,20 +1845,20 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
1702
1845
|
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
|
|
1703
1846
|
|
|
1704
1847
|
Built-in tool implementations:
|
|
1705
|
-
- [read.ts](https://github.com/
|
|
1706
|
-
- [bash.ts](https://github.com/
|
|
1707
|
-
- [edit.ts](https://github.com/
|
|
1708
|
-
- [write.ts](https://github.com/
|
|
1709
|
-
- [grep.ts](https://github.com/
|
|
1710
|
-
- [find.ts](https://github.com/
|
|
1711
|
-
- [ls.ts](https://github.com/
|
|
1848
|
+
- [read.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
1849
|
+
- [bash.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
1850
|
+
- [edit.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
1851
|
+
- [write.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
1852
|
+
- [grep.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
1853
|
+
- [find.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
1854
|
+
- [ls.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
1712
1855
|
|
|
1713
1856
|
### Remote Execution
|
|
1714
1857
|
|
|
1715
1858
|
Built-in tools support pluggable operations for delegating to remote systems (SSH, containers, etc.):
|
|
1716
1859
|
|
|
1717
1860
|
```typescript
|
|
1718
|
-
import { createReadTool, createBashTool, type ReadOperations } from "@
|
|
1861
|
+
import { createReadTool, createBashTool, type ReadOperations } from "@eminent337/aery";
|
|
1719
1862
|
|
|
1720
1863
|
// Create tool with custom operations
|
|
1721
1864
|
const remoteRead = createReadTool(cwd, {
|
|
@@ -1746,7 +1889,7 @@ For `user_bash`, extensions can reuse pi's local shell backend via `createLocalB
|
|
|
1746
1889
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
1747
1890
|
|
|
1748
1891
|
```typescript
|
|
1749
|
-
import { createBashTool } from "@
|
|
1892
|
+
import { createBashTool } from "@eminent337/aery";
|
|
1750
1893
|
|
|
1751
1894
|
const bashTool = createBashTool(cwd, {
|
|
1752
1895
|
spawnHook: ({ command, cwd, env }) => ({
|
|
@@ -1776,7 +1919,7 @@ import {
|
|
|
1776
1919
|
formatSize, // Human-readable size (e.g., "50KB", "1.5MB")
|
|
1777
1920
|
DEFAULT_MAX_BYTES, // 50KB
|
|
1778
1921
|
DEFAULT_MAX_LINES, // 2000
|
|
1779
|
-
} from "@
|
|
1922
|
+
} from "@eminent337/aery";
|
|
1780
1923
|
|
|
1781
1924
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
1782
1925
|
const output = await runCommand();
|
|
@@ -1831,7 +1974,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1831
1974
|
|
|
1832
1975
|
### Custom Rendering
|
|
1833
1976
|
|
|
1834
|
-
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/
|
|
1977
|
+
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/eminent337/aery/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how tool rows are composed.
|
|
1835
1978
|
|
|
1836
1979
|
By default, tool output is wrapped in a `Box` that handles padding and background. A defined `renderCall` or `renderResult` must return a `Component`. If a slot renderer is not defined, `tool-execution.ts` uses fallback rendering for that slot.
|
|
1837
1980
|
|
|
@@ -1867,7 +2010,7 @@ Use `context.state` for cross-slot shared state. Keep slot-local caches on the r
|
|
|
1867
2010
|
Renders the tool call or header:
|
|
1868
2011
|
|
|
1869
2012
|
```typescript
|
|
1870
|
-
import { Text } from "@
|
|
2013
|
+
import { Text } from "@eminent337/aery-tui";
|
|
1871
2014
|
|
|
1872
2015
|
renderCall(args, theme, context) {
|
|
1873
2016
|
const text = (context.lastComponent as Text | undefined) ?? new Text("", 0, 0);
|
|
@@ -1912,7 +2055,7 @@ If a slot intentionally has no visible content, return an empty `Component` such
|
|
|
1912
2055
|
Use `keyHint()` to display keybinding hints that respect the active keybinding configuration:
|
|
1913
2056
|
|
|
1914
2057
|
```typescript
|
|
1915
|
-
import { keyHint } from "@
|
|
2058
|
+
import { keyHint } from "@eminent337/aery";
|
|
1916
2059
|
|
|
1917
2060
|
renderResult(result, { expanded }, theme, context) {
|
|
1918
2061
|
let text = theme.fg("success", "✓ Done");
|
|
@@ -1963,8 +2106,9 @@ Extensions can interact with users via `ctx.ui` methods and customize how messag
|
|
|
1963
2106
|
- Async operations with cancel (BorderedLoader)
|
|
1964
2107
|
- Settings toggles (SettingsList)
|
|
1965
2108
|
- Status indicators (setStatus)
|
|
1966
|
-
- Working message and indicator during streaming (`setWorkingMessage`, `setWorkingIndicator`)
|
|
2109
|
+
- Working message, visibility, and indicator during streaming (`setWorkingMessage`, `setWorkingVisible`, `setWorkingIndicator`)
|
|
1967
2110
|
- Widgets above/below editor (setWidget)
|
|
2111
|
+
- Autocomplete providers layered on top of built-in slash/path completion (addAutocompleteProvider)
|
|
1968
2112
|
- Custom footers (setFooter)
|
|
1969
2113
|
|
|
1970
2114
|
### Dialogs
|
|
@@ -2044,9 +2188,11 @@ See [examples/extensions/timed-confirm.ts](../examples/extensions/timed-confirm.
|
|
|
2044
2188
|
ctx.ui.setStatus("my-ext", "Processing...");
|
|
2045
2189
|
ctx.ui.setStatus("my-ext", undefined); // Clear
|
|
2046
2190
|
|
|
2047
|
-
// Working
|
|
2191
|
+
// Working loader (shown during streaming)
|
|
2048
2192
|
ctx.ui.setWorkingMessage("Thinking deeply...");
|
|
2049
2193
|
ctx.ui.setWorkingMessage(); // Restore default
|
|
2194
|
+
ctx.ui.setWorkingVisible(false); // Hide the built-in working loader row entirely
|
|
2195
|
+
ctx.ui.setWorkingVisible(true); // Show the built-in working loader row
|
|
2050
2196
|
|
|
2051
2197
|
// Working indicator (shown during streaming)
|
|
2052
2198
|
ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] }); // Static dot
|
|
@@ -2086,6 +2232,28 @@ const current = ctx.ui.getEditorText();
|
|
|
2086
2232
|
// Paste into editor (triggers paste handling, including collapse for large content)
|
|
2087
2233
|
ctx.ui.pasteToEditor("pasted content");
|
|
2088
2234
|
|
|
2235
|
+
// Stack custom autocomplete behavior on top of the built-in provider
|
|
2236
|
+
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2237
|
+
async getSuggestions(lines, line, col, options) {
|
|
2238
|
+
const beforeCursor = (lines[line] ?? "").slice(0, col);
|
|
2239
|
+
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
2240
|
+
if (!match) {
|
|
2241
|
+
return current.getSuggestions(lines, line, col, options);
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
return {
|
|
2245
|
+
prefix: `#${match[1] ?? ""}`,
|
|
2246
|
+
items: [{ value: "#2983", label: "#2983", description: "Extension API for autocomplete" }],
|
|
2247
|
+
};
|
|
2248
|
+
},
|
|
2249
|
+
applyCompletion(lines, line, col, item, prefix) {
|
|
2250
|
+
return current.applyCompletion(lines, line, col, item, prefix);
|
|
2251
|
+
},
|
|
2252
|
+
shouldTriggerFileCompletion(lines, line, col) {
|
|
2253
|
+
return current.shouldTriggerFileCompletion?.(lines, line, col) ?? true;
|
|
2254
|
+
},
|
|
2255
|
+
}));
|
|
2256
|
+
|
|
2089
2257
|
// Tool output expansion
|
|
2090
2258
|
const wasExpanded = ctx.ui.getToolsExpanded();
|
|
2091
2259
|
ctx.ui.setToolsExpanded(true);
|
|
@@ -2093,6 +2261,10 @@ ctx.ui.setToolsExpanded(wasExpanded);
|
|
|
2093
2261
|
|
|
2094
2262
|
// Custom editor (vim mode, emacs mode, etc.)
|
|
2095
2263
|
ctx.ui.setEditorComponent((tui, theme, keybindings) => new VimEditor(tui, theme, keybindings));
|
|
2264
|
+
const currentEditor = ctx.ui.getEditorComponent();
|
|
2265
|
+
ctx.ui.setEditorComponent((tui, theme, keybindings) =>
|
|
2266
|
+
new WrappedEditor(tui, theme, keybindings, currentEditor?.(tui, theme, keybindings))
|
|
2267
|
+
);
|
|
2096
2268
|
ctx.ui.setEditorComponent(undefined); // Restore default editor
|
|
2097
2269
|
|
|
2098
2270
|
// Theme management (see themes.md for creating themes)
|
|
@@ -2108,12 +2280,56 @@ ctx.ui.theme.fg("accent", "styled text"); // Access current theme
|
|
|
2108
2280
|
|
|
2109
2281
|
Custom working-indicator frames are rendered verbatim. If you want colors, add them to the frame strings yourself, for example with `ctx.ui.theme.fg(...)`.
|
|
2110
2282
|
|
|
2283
|
+
### Autocomplete Providers
|
|
2284
|
+
|
|
2285
|
+
Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider.
|
|
2286
|
+
|
|
2287
|
+
Typical pattern:
|
|
2288
|
+
|
|
2289
|
+
- inspect the text before the cursor
|
|
2290
|
+
- return your own suggestions when your extension-specific syntax matches
|
|
2291
|
+
- otherwise delegate to `current.getSuggestions(...)`
|
|
2292
|
+
- delegate `applyCompletion(...)` unless you need custom insertion behavior
|
|
2293
|
+
|
|
2294
|
+
```typescript
|
|
2295
|
+
pi.on("session_start", (_event, ctx) => {
|
|
2296
|
+
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2297
|
+
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
2298
|
+
const line = lines[cursorLine] ?? "";
|
|
2299
|
+
const beforeCursor = line.slice(0, cursorCol);
|
|
2300
|
+
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
2301
|
+
if (!match) {
|
|
2302
|
+
return current.getSuggestions(lines, cursorLine, cursorCol, options);
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
return {
|
|
2306
|
+
prefix: `#${match[1] ?? ""}`,
|
|
2307
|
+
items: [
|
|
2308
|
+
{ value: "#2983", label: "#2983", description: "Extension API for registering custom @ autocomplete providers" },
|
|
2309
|
+
{ value: "#2753", label: "#2753", description: "Reload stale resource settings" },
|
|
2310
|
+
],
|
|
2311
|
+
};
|
|
2312
|
+
},
|
|
2313
|
+
|
|
2314
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
2315
|
+
return current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
|
|
2316
|
+
},
|
|
2317
|
+
|
|
2318
|
+
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
2319
|
+
return current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
|
|
2320
|
+
},
|
|
2321
|
+
}));
|
|
2322
|
+
});
|
|
2323
|
+
```
|
|
2324
|
+
|
|
2325
|
+
See [github-issue-autocomplete.ts](../examples/extensions/github-issue-autocomplete.ts) for a complete example that preloads the latest open GitHub issues with `gh issue list` and filters them locally for fast `#...` completion. It requires GitHub CLI (`gh`) and a GitHub repository checkout.
|
|
2326
|
+
|
|
2111
2327
|
### Custom Components
|
|
2112
2328
|
|
|
2113
2329
|
For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
|
|
2114
2330
|
|
|
2115
2331
|
```typescript
|
|
2116
|
-
import { Text, Component } from "@
|
|
2332
|
+
import { Text, Component } from "@eminent337/aery-tui";
|
|
2117
2333
|
|
|
2118
2334
|
const result = await ctx.ui.custom<boolean>((tui, theme, keybindings, done) => {
|
|
2119
2335
|
const text = new Text("Press Enter to confirm, Escape to cancel", 1, 1);
|
|
@@ -2171,8 +2387,8 @@ See [tui.md](tui.md) for the full `OverlayOptions` API and [overlay-qa-tests.ts]
|
|
|
2171
2387
|
Replace the main input editor with a custom implementation (vim mode, emacs mode, etc.):
|
|
2172
2388
|
|
|
2173
2389
|
```typescript
|
|
2174
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
2175
|
-
import { matchesKey } from "@
|
|
2390
|
+
import { CustomEditor, type ExtensionAPI } from "@eminent337/aery";
|
|
2391
|
+
import { matchesKey } from "@eminent337/aery-tui";
|
|
2176
2392
|
|
|
2177
2393
|
class VimEditor extends CustomEditor {
|
|
2178
2394
|
private mode: "normal" | "insert" = "insert";
|
|
@@ -2203,8 +2419,18 @@ export default function (pi: ExtensionAPI) {
|
|
|
2203
2419
|
- Extend `CustomEditor` (not base `Editor`) to get app keybindings (escape to abort, ctrl+d, model switching)
|
|
2204
2420
|
- Call `super.handleInput(data)` for keys you don't handle
|
|
2205
2421
|
- Factory receives `theme` and `keybindings` from the app
|
|
2422
|
+
- Use `ctx.ui.getEditorComponent()` before `setEditorComponent()` to wrap the previously configured custom editor
|
|
2206
2423
|
- Pass `undefined` to restore default: `ctx.ui.setEditorComponent(undefined)`
|
|
2207
2424
|
|
|
2425
|
+
To compose with another extension that already replaced the editor, capture the previous factory before setting yours:
|
|
2426
|
+
|
|
2427
|
+
```typescript
|
|
2428
|
+
const previous = ctx.ui.getEditorComponent();
|
|
2429
|
+
ctx.ui.setEditorComponent((tui, theme, keybindings) =>
|
|
2430
|
+
new MyEditor(tui, theme, keybindings, { base: previous?.(tui, theme, keybindings) })
|
|
2431
|
+
);
|
|
2432
|
+
```
|
|
2433
|
+
|
|
2208
2434
|
See [tui.md](tui.md) Pattern 7 for a complete example with mode indicator.
|
|
2209
2435
|
|
|
2210
2436
|
### Message Rendering
|
|
@@ -2212,7 +2438,7 @@ See [tui.md](tui.md) Pattern 7 for a complete example with mode indicator.
|
|
|
2212
2438
|
Register a custom renderer for messages with your `customType`:
|
|
2213
2439
|
|
|
2214
2440
|
```typescript
|
|
2215
|
-
import { Text } from "@
|
|
2441
|
+
import { Text } from "@eminent337/aery-tui";
|
|
2216
2442
|
|
|
2217
2443
|
pi.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
2218
2444
|
const { expanded } = options;
|
|
@@ -2261,7 +2487,7 @@ theme.strikethrough(text)
|
|
|
2261
2487
|
For syntax highlighting in custom tool renderers:
|
|
2262
2488
|
|
|
2263
2489
|
```typescript
|
|
2264
|
-
import { highlightCode, getLanguageFromPath } from "@
|
|
2490
|
+
import { highlightCode, getLanguageFromPath } from "@eminent337/aery";
|
|
2265
2491
|
|
|
2266
2492
|
// Highlight code with explicit language
|
|
2267
2493
|
const highlighted = highlightCode("const x = 1;", "typescript", theme);
|
|
@@ -2300,6 +2526,7 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2300
2526
|
| `questionnaire.ts` | Multi-step wizard tool | `registerTool`, `ui.custom` |
|
|
2301
2527
|
| `todo.ts` | Stateful tool with persistence | `registerTool`, `appendEntry`, `renderResult`, session events |
|
|
2302
2528
|
| `dynamic-tools.ts` | Register tools after startup and during commands | `registerTool`, `session_start`, `registerCommand` |
|
|
2529
|
+
| `structured-output.ts` | Final structured-output tool with `terminate: true` | `registerTool`, terminating tool results |
|
|
2303
2530
|
| `truncated-tool.ts` | Output truncation example | `registerTool`, `truncateHead` |
|
|
2304
2531
|
| `tool-override.ts` | Override built-in read tool | `registerTool` (same name as built-in) |
|
|
2305
2532
|
| **Commands** |||
|
|
@@ -2320,6 +2547,7 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2320
2547
|
| `provider-payload.ts` | Inspect payloads and provider response headers | `on("before_provider_request")`, `on("after_provider_response")` |
|
|
2321
2548
|
| `system-prompt-header.ts` | Display system prompt info | `on("agent_start")`, `getSystemPrompt` |
|
|
2322
2549
|
| `claude-rules.ts` | Load rules from files | `on("session_start")`, `on("before_agent_start")` |
|
|
2550
|
+
| `prompt-customizer.ts` | Add context-aware tool guidance using `systemPromptOptions` | `on("before_agent_start")`, `BuildSystemPromptOptions` |
|
|
2323
2551
|
| `file-trigger.ts` | File watcher triggers messages | `sendMessage` |
|
|
2324
2552
|
| **Compaction & Sessions** |||
|
|
2325
2553
|
| `custom-compaction.ts` | Custom compaction summary | `on("session_before_compact")` |
|
|
@@ -2329,6 +2557,7 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2329
2557
|
| **UI Components** |||
|
|
2330
2558
|
| `status-line.ts` | Footer status indicator | `setStatus`, session events |
|
|
2331
2559
|
| `working-indicator.ts` | Customize the streaming working indicator | `setWorkingIndicator`, `registerCommand` |
|
|
2560
|
+
| `github-issue-autocomplete.ts` | Add `#1234` issue completions on top of built-in autocomplete by preloading recent open issues from `gh issue list` | `addAutocompleteProvider`, `on("session_start")`, `exec` |
|
|
2332
2561
|
| `custom-footer.ts` | Replace footer entirely | `registerCommand`, `setFooter` |
|
|
2333
2562
|
| `custom-header.ts` | Replace startup header | `on("session_start")`, `setHeader` |
|
|
2334
2563
|
| `modal-editor.ts` | Vim-style modal editor | `setEditorComponent`, `CustomEditor` |
|
|
@@ -2362,7 +2591,6 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2362
2591
|
| `session-name.ts` | Name sessions for selector | `setSessionName`, `getSessionName` |
|
|
2363
2592
|
| `bookmark.ts` | Bookmark entries for /tree | `setLabel` |
|
|
2364
2593
|
| **Misc** |||
|
|
2365
|
-
| `antigravity-image-gen.ts` | Image generation tool | `registerTool`, Google Antigravity |
|
|
2366
2594
|
| `inline-bash.ts` | Inline bash in tool calls | `on("tool_call")` |
|
|
2367
2595
|
| `bash-spawn-hook.ts` | Adjust bash command, cwd, and env before execution | `createBashTool`, `spawnHook` |
|
|
2368
2596
|
| `with-deps/` | Extension with npm dependencies | Package structure with `package.json` |
|