@selesai/code 0.10.2 → 0.12.0
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 +34 -0
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli.js +0 -0
- package/dist/core/agent-session.d.ts +12 -1
- package/dist/core/agent-session.js +77 -9
- package/dist/core/compaction/branch-summarization.js +34 -33
- package/dist/core/compaction/compaction.d.ts +5 -0
- package/dist/core/compaction/compaction.js +100 -85
- package/dist/core/compaction/utils.js +2 -2
- package/dist/core/export-html/template.css +1066 -1066
- package/dist/core/export-html/template.html +55 -55
- package/dist/core/export-html/template.js +1864 -1864
- package/dist/core/export-html/vendor/highlight.min.js +1212 -1212
- package/dist/core/export-html/vendor/marked.min.js +78 -78
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/runner.d.ts +5 -0
- package/dist/core/extensions/runner.js +48 -1
- package/dist/core/extensions/types.d.ts +18 -1
- package/dist/core/llama/client.d.ts +6 -0
- package/dist/core/llama/client.js +7 -0
- package/dist/core/llama/provider.d.ts +3 -1
- package/dist/core/llama/provider.js +28 -6
- package/dist/core/messages.js +7 -7
- package/dist/core/session-manager.js +4 -2
- package/dist/core/settings-manager.d.ts +8 -1
- package/dist/core/settings-manager.js +17 -0
- package/dist/defaults/models.json +32 -9
- package/dist/defaults/settings.json +0 -3
- package/dist/extensions/auto-session-name.test.ts +157 -0
- package/dist/extensions/auto-session-name.ts +96 -0
- package/dist/extensions/context-compaction-reminder.test.ts +82 -82
- package/dist/extensions/context-compaction-reminder.ts +28 -28
- package/dist/extensions/cost-reconcile.test.ts +76 -0
- package/dist/extensions/cost-reconcile.ts +278 -0
- package/dist/extensions/enable-readonly-tools.test.ts +11 -0
- package/dist/extensions/enable-readonly-tools.ts +7 -3
- package/dist/extensions/package.json +3 -0
- package/dist/extensions/pi-intercom/LICENSE +21 -21
- package/dist/extensions/pi-intercom/broker/client.test.ts +83 -83
- package/dist/extensions/pi-intercom/broker/framing.test.ts +114 -114
- package/dist/extensions/pi-intercom/broker/paths.ts +134 -134
- package/dist/extensions/pi-intercom/broker/runtime-claim.test.ts +34 -34
- package/dist/extensions/pi-intercom/broker/runtime-claim.ts +21 -21
- package/dist/extensions/pi-intercom/cwd.test.ts +40 -40
- package/dist/extensions/pi-intercom/cwd.ts +31 -31
- package/dist/extensions/pi-intercom/format-context.test.ts +31 -31
- package/dist/extensions/pi-intercom/format-context.ts +32 -32
- package/dist/extensions/pi-intercom/test/overlay-width.test.ts +66 -66
- package/dist/extensions/pi-intercom/ui/compose.ts +143 -143
- package/dist/extensions/pi-intercom/ui/session-list.ts +166 -166
- package/dist/extensions/pi-rewind-hook/README.md +245 -245
- package/dist/extensions/pi-rewind-hook/index.ts +1445 -1445
- package/dist/extensions/pi-rewind-hook/package.json +29 -29
- package/dist/extensions/pi-subagents/install.mjs +0 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/bun/restore-sandbox-env.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/args.d.ts +57 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/config-selector.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/file-processor.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/initial-message.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/list-models.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/project-trust.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/session-picker.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli/startup-ui.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/cli.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/config.d.ts +96 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-runtime.d.ts +119 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session-services.d.ts +85 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/agent-session.d.ts +620 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-guidance.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/auth-storage.d.ts +56 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/bash-executor.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/cache-stats.d.ts +49 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/branch-summarization.d.ts +93 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/compaction.d.ts +128 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/index.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/compaction/utils.d.ts +38 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/defaults.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/diagnostics.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/event-bus.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/exec.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/experimental.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/index.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/index.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/loader.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/runner.d.ts +171 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/types.d.ts +1261 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/index.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/keybindings.d.ts +358 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/messages.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-config.d.ts +512 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-registry.d.ts +43 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-resolver.d.ts +121 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/model-runtime.d.ts +82 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/models-store.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/output-guard.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/package-manager.d.ts +210 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/project-trust.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/prompt-templates.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-attribution.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/provider-composer.d.ts +55 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/radius.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/resource-loader.d.ts +206 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/runtime-credentials.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/sdk.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-cwd.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/session-manager.d.ts +356 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/settings-manager.d.ts +297 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/skills.d.ts +60 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/slash-commands.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/source-info.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/system-prompt.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/telemetry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/timings.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/bash.d.ts +68 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit-diff.d.ts +106 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/edit.d.ts +51 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/find.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/grep.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/index.d.ts +40 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/ls.d.ts +37 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/read.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/render-utils.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/truncate.d.ts +70 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/tools/write.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/trust-manager.d.ts +36 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/core/usage-totals.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/client.d.ts +61 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/huggingface.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/index.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/provider.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/extensions/llama/ui.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/index.d.ts +35 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/main.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/migrations.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/index.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/config-selector.d.ts +102 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-entry.d.ts +19 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-editor.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/extension-selector.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/footer.d.ts +32 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/index.d.ts +34 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/model-selector.d.ts +54 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/status-indicator.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tool-execution.d.ts +63 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/tree-selector.d.ts +94 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/user-message.d.ts +14 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/model-search.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme-controller.d.ts +29 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/interactive/theme/theme.d.ts +120 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/print-mode.d.ts +28 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-client.d.ts +246 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/modes/rpc/rpc-types.d.ts +457 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/package-manager-cli.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/rpc-entry.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/ansi.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/changelog.d.ts +22 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/child-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/clipboard.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/deprecation.d.ts +4 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/frontmatter.d.ts +8 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/fs-watch.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/git.d.ts +26 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/html.d.ts +7 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-convert.d.ts +10 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-process.d.ts +18 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/image-resize.d.ts +16 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/json.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/mime.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/open-browser.d.ts +9 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/paths.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/photon.d.ts +21 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/shell.d.ts +31 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/sleep.d.ts +5 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/tools-manager.d.ts +3 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/version-check.d.ts +15 -0
- package/dist/extensions/pi-subagents/test/fixtures/pi-coding-agent-shim/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/extensions/pi-tool-display/CHANGELOG.md +329 -0
- package/dist/extensions/pi-tool-display/LICENSE +21 -0
- package/dist/extensions/pi-tool-display/README.md +417 -0
- package/dist/extensions/pi-tool-display/config/config.example.json +40 -0
- package/dist/extensions/pi-tool-display/index.ts +3 -0
- package/dist/extensions/pi-tool-display/package-lock.json +2555 -0
- package/dist/extensions/pi-tool-display/package.json +86 -0
- package/dist/extensions/pi-tool-display/src/agent-dir.ts +35 -0
- package/dist/extensions/pi-tool-display/src/ansi-utils.ts +116 -0
- package/dist/extensions/pi-tool-display/src/bash-display.ts +213 -0
- package/dist/extensions/pi-tool-display/src/capabilities.ts +88 -0
- package/dist/extensions/pi-tool-display/src/config-modal.ts +541 -0
- package/dist/extensions/pi-tool-display/src/config-store.ts +304 -0
- package/dist/extensions/pi-tool-display/src/debug-logger.ts +150 -0
- package/dist/extensions/pi-tool-display/src/diff-presentation.ts +72 -0
- package/dist/extensions/pi-tool-display/src/diff-renderer.ts +2517 -0
- package/dist/extensions/pi-tool-display/src/disposable.ts +34 -0
- package/dist/extensions/pi-tool-display/src/extension-lifecycle.ts +14 -0
- package/dist/extensions/pi-tool-display/src/index.ts +109 -0
- package/dist/extensions/pi-tool-display/src/line-width-safety.ts +93 -0
- package/dist/extensions/pi-tool-display/src/modal-icons.ts +57 -0
- package/dist/extensions/pi-tool-display/src/pending-diff-preview.ts +370 -0
- package/dist/extensions/pi-tool-display/src/presets.ts +117 -0
- package/dist/extensions/pi-tool-display/src/render-utils.ts +186 -0
- package/dist/extensions/pi-tool-display/src/settings-inspector-modal.ts +475 -0
- package/dist/extensions/pi-tool-display/src/thinking-label.ts +343 -0
- package/dist/extensions/pi-tool-display/src/tool-call-box.ts +181 -0
- package/dist/extensions/pi-tool-display/src/tool-metadata.ts +139 -0
- package/dist/extensions/pi-tool-display/src/tool-overrides.ts +2168 -0
- package/dist/extensions/pi-tool-display/src/types.ts +109 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-markdown.ts +64 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-native.ts +66 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-patch.ts +72 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-renderer.ts +419 -0
- package/dist/extensions/pi-tool-display/src/user-message-box-utils.ts +106 -0
- package/dist/extensions/pi-tool-display/src/write-display-utils.ts +31 -0
- package/dist/extensions/pi-tool-display/src/zellij-modal.ts +1027 -0
- package/dist/extensions/pi-tool-display/tests/active-backlog-red.test.ts +65 -0
- package/dist/extensions/pi-tool-display/tests/ansi-utils.test.ts +345 -0
- package/dist/extensions/pi-tool-display/tests/bash-display.test.ts +442 -0
- package/dist/extensions/pi-tool-display/tests/capabilities-edge.test.ts +360 -0
- package/dist/extensions/pi-tool-display/tests/capabilities.test.ts +54 -0
- package/dist/extensions/pi-tool-display/tests/config-modal.test.ts +360 -0
- package/dist/extensions/pi-tool-display/tests/config-store.test.ts +87 -0
- package/dist/extensions/pi-tool-display/tests/custom-tool-overrides.test.ts +415 -0
- package/dist/extensions/pi-tool-display/tests/debug-logger-edge.test.ts +630 -0
- package/dist/extensions/pi-tool-display/tests/debug-logger.test.ts +62 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-ansi.test.ts +55 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-edge.test.ts +886 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-numbering.test.ts +135 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-width.test.ts +454 -0
- package/dist/extensions/pi-tool-display/tests/diff-renderer-wrap.test.ts +169 -0
- package/dist/extensions/pi-tool-display/tests/index-integration.test.ts +354 -0
- package/dist/extensions/pi-tool-display/tests/pending-diff-preview.test.ts +79 -0
- package/dist/extensions/pi-tool-display/tests/presets-edge.test.ts +229 -0
- package/dist/extensions/pi-tool-display/tests/presets.test.ts +26 -0
- package/dist/extensions/pi-tool-display/tests/reload-behavior.test.ts +1241 -0
- package/dist/extensions/pi-tool-display/tests/render-utils.test.ts +710 -0
- package/dist/extensions/pi-tool-display/tests/settings-inspector.test.ts +450 -0
- package/dist/extensions/pi-tool-display/tests/thinking-label-edge.test.ts +904 -0
- package/dist/extensions/pi-tool-display/tests/thinking-label.test.ts +72 -0
- package/dist/extensions/pi-tool-display/tests/tool-call-box.test.ts +105 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-config.test.ts +613 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-mcp.test.ts +499 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-registration.test.ts +315 -0
- package/dist/extensions/pi-tool-display/tests/tool-overrides-write-meta.test.ts +68 -0
- package/dist/extensions/pi-tool-display/tests/tool-ui-utils.test.ts +413 -0
- package/dist/extensions/pi-tool-display/tests/user-message-box-performance-red.test.ts +176 -0
- package/dist/extensions/pi-tool-display/tests/user-message-box.test.ts +908 -0
- package/dist/extensions/pi-tool-display/tests/zellij-modal.test.ts +848 -0
- package/dist/extensions/pi-tool-display/tool-display-api-consumer.d.ts +30 -0
- package/dist/extensions/pi-tool-display/tool-display-api-consumer.js +40 -0
- package/dist/extensions/pi-web-agent/package.json +31 -31
- package/dist/extensions/pi-web-agent/src/backends/config.ts +205 -205
- package/dist/extensions/pi-web-agent/src/backends/doctor.ts +136 -136
- package/dist/extensions/pi-web-agent/src/backends/factory.ts +152 -152
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +25 -25
- package/dist/extensions/pi-web-agent/src/cache/ttl-cache.ts +28 -28
- package/dist/extensions/pi-web-agent/src/changelog-notice.ts +136 -136
- package/dist/extensions/pi-web-agent/src/commands/web-agent-config.ts +946 -946
- package/dist/extensions/pi-web-agent/src/extension.ts +126 -126
- package/dist/extensions/pi-web-agent/src/extract/readability.ts +118 -118
- package/dist/extensions/pi-web-agent/src/fetch/browser-resolution.ts +199 -199
- package/dist/extensions/pi-web-agent/src/fetch/firecrawl-fetch.ts +100 -100
- package/dist/extensions/pi-web-agent/src/fetch/headless-fetch.ts +117 -117
- package/dist/extensions/pi-web-agent/src/fetch/http-fetch.ts +67 -67
- package/dist/extensions/pi-web-agent/src/orchestration/answer-synthesizer.ts +60 -60
- package/dist/extensions/pi-web-agent/src/orchestration/candidate-selector.ts +50 -50
- package/dist/extensions/pi-web-agent/src/orchestration/direct-url.ts +52 -52
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-quality.ts +105 -105
- package/dist/extensions/pi-web-agent/src/orchestration/evidence-ranker.ts +45 -45
- package/dist/extensions/pi-web-agent/src/orchestration/index.ts +28 -28
- package/dist/extensions/pi-web-agent/src/orchestration/query-planner.ts +47 -47
- package/dist/extensions/pi-web-agent/src/orchestration/research-orchestrator.ts +376 -376
- package/dist/extensions/pi-web-agent/src/orchestration/research-types.ts +64 -64
- package/dist/extensions/pi-web-agent/src/orchestration/research-worker.ts +181 -181
- package/dist/extensions/pi-web-agent/src/orchestration/source-profile.ts +101 -101
- package/dist/extensions/pi-web-agent/src/orchestration/stop-decider.ts +81 -81
- package/dist/extensions/pi-web-agent/src/presentation/config-store.ts +210 -210
- package/dist/extensions/pi-web-agent/src/presentation/config.ts +75 -75
- package/dist/extensions/pi-web-agent/src/presentation/explore-presentation.ts +61 -61
- package/dist/extensions/pi-web-agent/src/presentation/fetch-presentation.ts +54 -54
- package/dist/extensions/pi-web-agent/src/presentation/search-presentation.ts +41 -41
- package/dist/extensions/pi-web-agent/src/presentation/select-view.ts +20 -20
- package/dist/extensions/pi-web-agent/src/presentation/types.ts +63 -63
- package/dist/extensions/pi-web-agent/src/search/brave.ts +114 -114
- package/dist/extensions/pi-web-agent/src/search/duckduckgo.ts +72 -72
- package/dist/extensions/pi-web-agent/src/search/searxng.ts +96 -96
- package/dist/extensions/pi-web-agent/src/tools/web-explore.ts +71 -71
- package/dist/extensions/pi-web-agent/src/tools/web-fetch-headless.ts +31 -31
- package/dist/extensions/pi-web-agent/src/tools/web-fetch.ts +31 -31
- package/dist/extensions/pi-web-agent/src/tools/web-search.ts +157 -157
- package/dist/extensions/pi-web-agent/src/types.ts +88 -88
- package/dist/extensions/pi-zentui/extensions/zentui/format.ts +46 -1
- package/dist/extensions/pi-zentui/extensions/zentui/index.ts +10 -0
- package/dist/extensions/pi-zentui/extensions/zentui/user-message-styles.ts +1 -1
- package/dist/extensions/pi-zentui/test/extension-compliance.test.ts +3 -3
- package/dist/extensions/pi-zentui/test/format.test.ts +50 -2
- package/dist/extensions/ponytail/package.json +8 -8
- package/dist/extensions/question/constants.ts +30 -30
- package/dist/extensions/question/helpers.ts +58 -58
- package/dist/extensions/question/navigation.ts +14 -14
- package/dist/extensions/question/package.json +19 -19
- package/dist/extensions/question/selection-mode.ts +46 -46
- package/dist/extensions/question/shortcuts.ts +44 -44
- package/dist/extensions/question/types.ts +132 -132
- package/dist/extensions/test-resolve-hook-impl.mjs +6 -6
- package/dist/extensions/test-resolve-hook.mjs +6 -6
- package/dist/extensions/tokenin-onboarding.ts +112 -2
- package/dist/extensions/web-agent-onboarding.ts +222 -222
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/main.js +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.js +72 -42
- package/dist/modes/rpc/rpc-client.d.ts +7 -0
- package/dist/modes/rpc/rpc-client.js +7 -0
- package/dist/modes/rpc/rpc-mode.js +3 -0
- package/dist/modes/rpc/rpc-types.d.ts +12 -0
- package/dist/package-manager-cli.js +71 -71
- package/dist/rpc-entry.js +0 -0
- package/dist/skills/improve-codebase/REFERENCE.md +78 -78
- package/dist/utils/shell.js +6 -4
- package/docs/compaction.md +396 -396
- package/docs/containerization.md +111 -111
- package/docs/development.md +71 -71
- package/docs/docs.json +164 -164
- package/docs/environment-variables.md +86 -86
- package/docs/index.md +83 -83
- package/docs/json.md +82 -82
- package/docs/models.md +502 -502
- package/docs/packages.md +227 -227
- package/docs/plans/subagent-delegation/phase-0-correctness.md +264 -264
- package/docs/plans/subagent-delegation/phase-1-behavioral-contract.md +485 -485
- package/docs/plans/subagent-delegation/phase-2-context-controls.md +281 -281
- package/docs/plans/subagent-delegation/phase-3-advisory-routing.md +361 -361
- package/docs/plans/subagent-delegation/phase-4-optional-enforcement.md +380 -380
- package/docs/prompt-templates.md +95 -95
- package/docs/providers.md +293 -293
- package/docs/security.md +59 -59
- package/docs/session-format.md +414 -414
- package/docs/sessions.md +145 -145
- package/docs/settings.md +4 -0
- package/docs/shared-host-extensions.md +109 -109
- package/docs/shell-aliases.md +13 -13
- package/docs/skills.md +231 -231
- package/docs/terminal-setup.md +142 -142
- package/docs/termux.md +127 -127
- package/docs/themes.md +295 -295
- package/docs/tmux.md +63 -63
- package/docs/tui.md +927 -927
- package/docs/windows.md +17 -17
- package/examples/README.md +25 -25
- package/examples/extensions/README.md +211 -211
- package/examples/extensions/auto-commit-on-exit.ts +49 -49
- package/examples/extensions/bash-spawn-hook.ts +30 -30
- package/examples/extensions/bookmark.ts +50 -50
- package/examples/extensions/border-status-editor.ts +150 -150
- package/examples/extensions/built-in-tool-renderer.ts +249 -249
- package/examples/extensions/claude-rules.ts +86 -86
- package/examples/extensions/commands.ts +72 -72
- package/examples/extensions/confirm-destructive.ts +59 -59
- package/examples/extensions/custom-compaction.ts +130 -130
- package/examples/extensions/custom-footer.ts +64 -64
- package/examples/extensions/custom-header.ts +73 -73
- package/examples/extensions/custom-provider-anthropic/index.ts +610 -610
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -24
- package/examples/extensions/custom-provider-anthropic/package.json +19 -19
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +404 -404
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -16
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -82
- package/examples/extensions/dirty-repo-guard.ts +56 -56
- package/examples/extensions/doom-overlay/README.md +46 -46
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -21
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -152
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -72
- package/examples/extensions/doom-overlay/doom-component.ts +132 -132
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -173
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -104
- package/examples/extensions/doom-overlay/index.ts +74 -74
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -51
- package/examples/extensions/dynamic-resources/SKILL.md +8 -8
- package/examples/extensions/dynamic-resources/dynamic.json +79 -79
- package/examples/extensions/dynamic-resources/dynamic.md +5 -5
- package/examples/extensions/dynamic-resources/index.ts +15 -15
- package/examples/extensions/dynamic-tools.ts +74 -74
- package/examples/extensions/event-bus.ts +43 -43
- package/examples/extensions/file-trigger.ts +41 -41
- package/examples/extensions/git-checkpoint.ts +53 -53
- package/examples/extensions/git-merge-and-resolve.ts +115 -115
- package/examples/extensions/github-issue-autocomplete.ts +185 -185
- package/examples/extensions/gondolin/index.ts +531 -531
- package/examples/extensions/gondolin/package-lock.json +185 -185
- package/examples/extensions/gondolin/package.json +19 -19
- package/examples/extensions/handoff.ts +199 -199
- package/examples/extensions/hello.ts +26 -26
- package/examples/extensions/hidden-thinking-label.ts +53 -53
- package/examples/extensions/inline-bash.ts +94 -94
- package/examples/extensions/input-transform-streaming.ts +39 -39
- package/examples/extensions/input-transform.ts +43 -43
- package/examples/extensions/interactive-shell.ts +196 -196
- package/examples/extensions/mac-system-theme.ts +47 -47
- package/examples/extensions/message-renderer.ts +59 -59
- package/examples/extensions/minimal-mode.ts +426 -426
- package/examples/extensions/modal-editor.ts +85 -85
- package/examples/extensions/model-status.ts +31 -31
- package/examples/extensions/notify.ts +55 -55
- package/examples/extensions/overlay-qa-tests.ts +1450 -1450
- package/examples/extensions/overlay-test.ts +153 -153
- package/examples/extensions/permission-gate.ts +34 -34
- package/examples/extensions/pirate.ts +47 -47
- package/examples/extensions/plan-mode/README.md +66 -66
- package/examples/extensions/plan-mode/index.ts +390 -390
- package/examples/extensions/plan-mode/utils.ts +168 -168
- package/examples/extensions/preset.ts +436 -436
- package/examples/extensions/project-trust.ts +64 -64
- package/examples/extensions/prompt-customizer.ts +97 -97
- package/examples/extensions/protected-paths.ts +30 -30
- package/examples/extensions/provider-payload.ts +18 -18
- package/examples/extensions/qna.ts +122 -122
- package/examples/extensions/question.ts +285 -285
- package/examples/extensions/questionnaire.ts +448 -448
- package/examples/extensions/rainbow-editor.ts +88 -88
- package/examples/extensions/reload-runtime.ts +37 -37
- package/examples/extensions/rpc-demo.ts +118 -118
- package/examples/extensions/sandbox/index.ts +321 -321
- package/examples/extensions/sandbox/package-lock.json +92 -92
- package/examples/extensions/sandbox/package.json +19 -19
- package/examples/extensions/send-user-message.ts +97 -97
- package/examples/extensions/session-name.ts +27 -27
- package/examples/extensions/shutdown-command.ts +63 -63
- package/examples/extensions/snake.ts +343 -343
- package/examples/extensions/space-invaders.ts +560 -560
- package/examples/extensions/ssh.ts +220 -220
- package/examples/extensions/status-line.ts +32 -32
- package/examples/extensions/structured-output.ts +65 -65
- package/examples/extensions/subagent/README.md +175 -175
- package/examples/extensions/subagent/agents/planner.md +37 -37
- package/examples/extensions/subagent/agents/reviewer.md +35 -35
- package/examples/extensions/subagent/agents/scout.md +50 -50
- package/examples/extensions/subagent/agents/worker.md +24 -24
- package/examples/extensions/subagent/agents.ts +126 -126
- package/examples/extensions/subagent/index.ts +1015 -1015
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -10
- package/examples/extensions/subagent/prompts/implement.md +10 -10
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -9
- package/examples/extensions/summarize.ts +209 -209
- package/examples/extensions/system-prompt-header.ts +17 -17
- package/examples/extensions/tic-tac-toe.ts +1008 -1008
- package/examples/extensions/timed-confirm.ts +70 -70
- package/examples/extensions/titlebar-spinner.ts +58 -58
- package/examples/extensions/todo.ts +297 -297
- package/examples/extensions/tool-override.ts +144 -144
- package/examples/extensions/tools.ts +146 -146
- package/examples/extensions/trigger-compact.ts +50 -50
- package/examples/extensions/truncated-tool.ts +195 -195
- package/examples/extensions/widget-placement.ts +9 -9
- package/examples/extensions/with-deps/index.ts +32 -32
- package/examples/extensions/with-deps/package-lock.json +31 -31
- package/examples/extensions/with-deps/package.json +22 -22
- package/examples/extensions/working-indicator.ts +123 -123
- package/examples/extensions/working-message-test.ts +25 -25
- package/examples/rpc-extension-ui.ts +632 -632
- package/examples/sdk/01-minimal.ts +26 -26
- package/examples/sdk/02-custom-model.ts +53 -53
- package/examples/sdk/03-custom-prompt.ts +75 -75
- package/examples/sdk/04-skills.ts +55 -55
- package/examples/sdk/05-tools.ts +48 -48
- package/examples/sdk/06-extensions.ts +99 -99
- package/examples/sdk/07-context-files.ts +47 -47
- package/examples/sdk/08-prompt-templates.ts +51 -51
- package/examples/sdk/09-api-keys-and-oauth.ts +52 -52
- package/examples/sdk/10-settings.ts +53 -53
- package/examples/sdk/11-sessions.ts +52 -52
- package/examples/sdk/12-full-control.ts +79 -79
- package/examples/sdk/13-session-runtime.ts +67 -67
- package/examples/sdk/README.md +144 -144
- package/package.json +6 -6
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@selesai/code";
|
|
2
|
-
|
|
3
|
-
export const CONTEXT_COMPACTION_REMINDER_THRESHOLD = 128_000;
|
|
4
|
-
export const CONTEXT_COMPACTION_REMINDER_MESSAGE =
|
|
5
|
-
`Conversation context has reached ${CONTEXT_COMPACTION_REMINDER_THRESHOLD.toLocaleString()} tokens. Run /handoff-new to summarize into a new chat, or enable Auto Handoff in Settings to do this automatically. Bigger context windows eat up tokens quickly and degrade AI quality.`;
|
|
6
|
-
|
|
7
|
-
export default function contextCompactionReminderExtension(pi: ExtensionAPI): void {
|
|
8
|
-
let reminderShown = false;
|
|
9
|
-
|
|
10
|
-
pi.on("session_compact", () => {
|
|
11
|
-
reminderShown = false;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
pi.on("agent_settled", (_event, ctx) => {
|
|
15
|
-
const tokens = ctx.getContextUsage()?.tokens;
|
|
16
|
-
if (tokens === undefined || tokens === null) return;
|
|
17
|
-
|
|
18
|
-
if (tokens < CONTEXT_COMPACTION_REMINDER_THRESHOLD) {
|
|
19
|
-
reminderShown = false;
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!reminderShown) {
|
|
24
|
-
ctx.ui.notify(CONTEXT_COMPACTION_REMINDER_MESSAGE, "warning");
|
|
25
|
-
reminderShown = true;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
1
|
+
import type { ExtensionAPI } from "@selesai/code";
|
|
2
|
+
|
|
3
|
+
export const CONTEXT_COMPACTION_REMINDER_THRESHOLD = 128_000;
|
|
4
|
+
export const CONTEXT_COMPACTION_REMINDER_MESSAGE =
|
|
5
|
+
`Conversation context has reached ${CONTEXT_COMPACTION_REMINDER_THRESHOLD.toLocaleString()} tokens. Run /handoff-new to summarize into a new chat, or enable Auto Handoff in Settings to do this automatically. Bigger context windows eat up tokens quickly and degrade AI quality.`;
|
|
6
|
+
|
|
7
|
+
export default function contextCompactionReminderExtension(pi: ExtensionAPI): void {
|
|
8
|
+
let reminderShown = false;
|
|
9
|
+
|
|
10
|
+
pi.on("session_compact", () => {
|
|
11
|
+
reminderShown = false;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
pi.on("agent_settled", (_event, ctx) => {
|
|
15
|
+
const tokens = ctx.getContextUsage()?.tokens;
|
|
16
|
+
if (tokens === undefined || tokens === null) return;
|
|
17
|
+
|
|
18
|
+
if (tokens < CONTEXT_COMPACTION_REMINDER_THRESHOLD) {
|
|
19
|
+
reminderShown = false;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!reminderShown) {
|
|
24
|
+
ctx.ui.notify(CONTEXT_COMPACTION_REMINDER_MESSAGE, "warning");
|
|
25
|
+
reminderShown = true;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { extractCosts, parseCostHeader } from "./cost-reconcile.ts";
|
|
3
|
+
|
|
4
|
+
describe("parseCostHeader", () => {
|
|
5
|
+
it("parses LiteLLM scientific-notation cost", () => {
|
|
6
|
+
expect(parseCostHeader("4.45284e-06")).toBe(4.45284e-6);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("parses plain decimal cost", () => {
|
|
10
|
+
expect(parseCostHeader("0.00123")).toBe(0.00123);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("rejects null, garbage, and negatives", () => {
|
|
14
|
+
expect(parseCostHeader(null)).toBeUndefined();
|
|
15
|
+
expect(parseCostHeader("abc")).toBeUndefined();
|
|
16
|
+
expect(parseCostHeader("-1")).toBeUndefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
describe("extractCosts", () => {
|
|
21
|
+
it("reads OpenRouter chat-completions usage cost from a final SSE chunk", () => {
|
|
22
|
+
const body =
|
|
23
|
+
'Data: {"id":"gen-abc","provider":"OpenAI"}\n\n' +
|
|
24
|
+
'data: {"id":"gen-abc","usage":{"prompt_tokens":10,"cost":0.0123},"choices":[]}\n\n' +
|
|
25
|
+
"data: [DONE]\n\n";
|
|
26
|
+
const { ids, cost } = extractCosts(body);
|
|
27
|
+
expect(ids).toContain("gen-abc");
|
|
28
|
+
expect(cost).toBe(0.0123);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("reads OpenRouter native total_cost from a JSON body", () => {
|
|
32
|
+
const { ids, cost } = extractCosts(
|
|
33
|
+
'{"id":"gen-xyz","total_cost":0.05152,"usage":{"total_tokens":330}}',
|
|
34
|
+
);
|
|
35
|
+
expect(ids).toEqual(["gen-xyz"]);
|
|
36
|
+
expect(cost).toBe(0.05152);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("reads object-shaped cost {total} payloads", () => {
|
|
40
|
+
const { cost } = extractCosts('{"id":"gen-obj","cost":{"input":0.01,"total":0.0456}}');
|
|
41
|
+
expect(cost).toBe(0.0456);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("keeps the last cost when multiple chunks carry usage", () => {
|
|
45
|
+
const body =
|
|
46
|
+
'data: {"id":"gen-1","usage":{"cost":0.01}}\n\ndata: {"id":"gen-1","usage":{"cost":0.02}}\n\n';
|
|
47
|
+
const { cost } = extractCosts(body);
|
|
48
|
+
expect(cost).toBe(0.02);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("returns no cost when the payload has none", () => {
|
|
52
|
+
const { ids, cost } = extractCosts('data: {"id":"resp-1","delta":"hi"}\n\n');
|
|
53
|
+
expect(ids).toContain("resp-1");
|
|
54
|
+
expect(cost).toBeUndefined();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("ignores negative or non-finite costs", () => {
|
|
58
|
+
const { cost } = extractCosts('{"id":"gen-neg","cost":-1}');
|
|
59
|
+
expect(cost).toBeUndefined();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("extracts ids from anthropic-style message_start without cost", () => {
|
|
63
|
+
const body =
|
|
64
|
+
'event: message_start\ndata: {"type":"message_start","message":{"id":"msg_01ABC","usage":{}}}\n\n' +
|
|
65
|
+
'event: message_delta\ndata: {"type":"message_delta","usage":{"output_tokens":15}}\n\n';
|
|
66
|
+
const { ids, cost } = extractCosts(body);
|
|
67
|
+
expect(ids).toContain("msg_01ABC");
|
|
68
|
+
expect(cost).toBeUndefined();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("caps captured ids", () => {
|
|
72
|
+
const body = Array.from({ length: 100 }, (_, i) => `{"id":"id-${i}"}`).join("\n");
|
|
73
|
+
const { ids } = extractCosts(body);
|
|
74
|
+
expect(ids.length).toBe(50);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cost Reconcile — records the real billed cost the provider reports in its
|
|
3
|
+
* own response payload, for any provider that includes one.
|
|
4
|
+
*
|
|
5
|
+
* pi-ai reads token counts from provider payloads but discards any
|
|
6
|
+
* provider-reported `cost` field, recomputing cost from the local rate card.
|
|
7
|
+
* For gateways (OpenRouter etc.) and custom catalog entries that bill with
|
|
8
|
+
* their own tokenizers or dated pricing, the estimate diverges from the bill.
|
|
9
|
+
*
|
|
10
|
+
* Extensions cannot hook the response body through the event API
|
|
11
|
+
* (`after_provider_response` exposes only status/headers), but provider SDKs
|
|
12
|
+
* fall back to `globalThis.fetch`. This extension installs a tee-wrapping
|
|
13
|
+
* fetch once per process: LLM API responses are scanned for a
|
|
14
|
+
* provider-reported cost (LiteLLM `x-litellm-response-cost` header,
|
|
15
|
+
* OpenRouter `usage.cost`, `total_cost`, plus object-shaped `cost.total`)
|
|
16
|
+
* and its response id, then recorded as a custom session entry on
|
|
17
|
+
* `message_end`.
|
|
18
|
+
*
|
|
19
|
+
* Providers whose payloads carry no cost (first-party OpenAI/Anthropic due to
|
|
20
|
+
* their usage APIs) simply record nothing — their rate-card estimate matches
|
|
21
|
+
* their bill anyway when catalog prices are configured.
|
|
22
|
+
*
|
|
23
|
+
* The zentui footer prefers reconciled entries over the rate-card total when
|
|
24
|
+
* both exist for the same response id.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ExtensionAPI } from "@selesai/code";
|
|
28
|
+
|
|
29
|
+
const ENTRY_TYPE = "cost-reconcile";
|
|
30
|
+
const ENTRY_VERSION = 1 as const;
|
|
31
|
+
|
|
32
|
+
// Guard against pathological bodies; real usage chunks arrive well under 1MB.
|
|
33
|
+
const MAX_CAPTURE_BYTES = 4 * 1024 * 1024;
|
|
34
|
+
// Only LLM API paths are tee'd and scanned; unrelated fetches (web fetch tool,
|
|
35
|
+
// model catalog refreshes) pass through untouched.
|
|
36
|
+
const LLM_PATH_RE = /(\/chat\/completions|\/responses|\/messages\b|:streamGenerateContent)/;
|
|
37
|
+
const MAX_CAPTURED_IDS = 50;
|
|
38
|
+
const MAX_PENDING_LOOKUPS = 200;
|
|
39
|
+
const MAX_SESSION_ENTRIES = 2_000;
|
|
40
|
+
|
|
41
|
+
type ReconcileEntry = {
|
|
42
|
+
version: typeof ENTRY_VERSION;
|
|
43
|
+
provider: string;
|
|
44
|
+
model: string;
|
|
45
|
+
responseId: string;
|
|
46
|
+
/** Provider-reported billed cost in USD. */
|
|
47
|
+
cost: number;
|
|
48
|
+
reconciledAt: number;
|
|
49
|
+
source: "payload";
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Scan a captured SSE/JSON body for provider-reported cost and response ids.
|
|
54
|
+
* Exported for tests.
|
|
55
|
+
*
|
|
56
|
+
* In streams, usage lands in the final chunk, so the LAST cost match wins.
|
|
57
|
+
*/
|
|
58
|
+
type MessageInfo = {
|
|
59
|
+
provider: string;
|
|
60
|
+
model: string;
|
|
61
|
+
responseId: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Process-wide capture state. The fetch patch is installed once per process
|
|
65
|
+
// and must not capture session-bound `pi`; per-session message_end handlers
|
|
66
|
+
// read these maps and write entries through their own session's appendEntry.
|
|
67
|
+
const processCaptured = new Map<string, number>();
|
|
68
|
+
const processWaiting = new Map<
|
|
69
|
+
string,
|
|
70
|
+
{ info: MessageInfo; write: (info: MessageInfo, cost: number) => void }
|
|
71
|
+
>();
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Scan a captured SSE/JSON body for provider-reported cost and response ids.
|
|
75
|
+
* Pure function; exported for tests.
|
|
76
|
+
*
|
|
77
|
+
* In streams, usage lands in the final chunk, so the LAST cost match wins.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Parse a LiteLLM `x-litellm-response-cost` header value (a USD float,
|
|
81
|
+
* possibly in scientific notation). Exported for tests.
|
|
82
|
+
*/
|
|
83
|
+
export function parseCostHeader(value: string | null): number | undefined {
|
|
84
|
+
if (value === null) return undefined;
|
|
85
|
+
const cost = Number(value);
|
|
86
|
+
return Number.isFinite(cost) && cost >= 0 ? cost : undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function extractCosts(
|
|
90
|
+
text: string,
|
|
91
|
+
): { ids: string[]; cost?: number } {
|
|
92
|
+
const ids = new Set<string>();
|
|
93
|
+
for (const match of text.matchAll(/"id"\s*:\s*"([^"]{1,200})"/g)) {
|
|
94
|
+
ids.add(match[1]);
|
|
95
|
+
if (ids.size >= MAX_CAPTURED_IDS) break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// OpenRouter native API uses `total_cost`; chat-completions streams use
|
|
99
|
+
// `cost` (number or `{total}`); gateways behind the responses API have
|
|
100
|
+
// been observed with object-shaped cost too.
|
|
101
|
+
let cost: number | undefined;
|
|
102
|
+
for (const match of text.matchAll(
|
|
103
|
+
/"total_cost"\s*:\s*(-?[\d.eE+]+)|"cost"\s*:\s*(-?[\d.eE+]+)|"cost"\s*:\s*\{[^}]*?"total"\s*:\s*(-?[\d.eE+]+)/g,
|
|
104
|
+
)) {
|
|
105
|
+
const value = Number(match[1] ?? match[2] ?? match[3]);
|
|
106
|
+
if (Number.isFinite(value) && value >= 0) cost = value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return { ids: [...ids], cost };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isLlmUrl(input: unknown): boolean {
|
|
113
|
+
try {
|
|
114
|
+
const url =
|
|
115
|
+
typeof input === "string"
|
|
116
|
+
? input
|
|
117
|
+
: input instanceof URL
|
|
118
|
+
? input.href
|
|
119
|
+
: input instanceof Request
|
|
120
|
+
? input.url
|
|
121
|
+
: undefined;
|
|
122
|
+
if (!url) return false;
|
|
123
|
+
if (!/^https?:/i.test(url)) return false;
|
|
124
|
+
return LLM_PATH_RE.test(url);
|
|
125
|
+
} catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Install the capture fetch once per process, across extension reloads. */
|
|
131
|
+
const FETCH_PATCHED = Symbol.for("selesai.cost-reconcile.fetch-patched");
|
|
132
|
+
|
|
133
|
+
export default function costReconcileExtension(pi: ExtensionAPI): void {
|
|
134
|
+
/** Response ids already written to this session's file. */
|
|
135
|
+
const seen = new Set<string>();
|
|
136
|
+
let entriesWritten = 0;
|
|
137
|
+
|
|
138
|
+
const writeEntry = (info: MessageInfo, cost: number): void => {
|
|
139
|
+
if (seen.has(info.responseId) || entriesWritten >= MAX_SESSION_ENTRIES) return;
|
|
140
|
+
seen.add(info.responseId);
|
|
141
|
+
entriesWritten += 1;
|
|
142
|
+
const entry: ReconcileEntry = {
|
|
143
|
+
version: ENTRY_VERSION,
|
|
144
|
+
provider: info.provider,
|
|
145
|
+
model: info.model,
|
|
146
|
+
responseId: info.responseId,
|
|
147
|
+
cost,
|
|
148
|
+
reconciledAt: Date.now(),
|
|
149
|
+
source: "payload",
|
|
150
|
+
};
|
|
151
|
+
try {
|
|
152
|
+
pi.appendEntry(ENTRY_TYPE, entry);
|
|
153
|
+
} catch {
|
|
154
|
+
// transcript persistence failure must not break the session
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const finishCapture = (rawBody: string, headerCost?: number): void => {
|
|
159
|
+
// ponytail: one naive regex pass over the whole body; a streaming
|
|
160
|
+
// parser only matters if bodies grow past the 4MB cap.
|
|
161
|
+
const { ids, cost } = extractCosts(rawBody);
|
|
162
|
+
// LiteLLM's header is the amount the gateway billed; prefer it over
|
|
163
|
+
// any cost the upstream payload reports.
|
|
164
|
+
const effectiveCost = headerCost ?? cost;
|
|
165
|
+
if (effectiveCost === undefined) return;
|
|
166
|
+
for (const responseId of ids) {
|
|
167
|
+
processCaptured.set(responseId, effectiveCost);
|
|
168
|
+
const waiting = processWaiting.get(responseId);
|
|
169
|
+
if (waiting) {
|
|
170
|
+
processWaiting.delete(responseId);
|
|
171
|
+
waiting.write(waiting.info, effectiveCost);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (processCaptured.size > 500) {
|
|
175
|
+
for (const key of [...processCaptured.keys()].slice(0, processCaptured.size - 500))
|
|
176
|
+
processCaptured.delete(key);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
pi.on("session_start", (_event, ctx) => {
|
|
181
|
+
try {
|
|
182
|
+
const entries =
|
|
183
|
+
(
|
|
184
|
+
ctx.sessionManager as {
|
|
185
|
+
getEntries?: () => readonly { type?: string; customType?: string; data?: ReconcileEntry }[];
|
|
186
|
+
}
|
|
187
|
+
).getEntries?.() ?? [];
|
|
188
|
+
for (const entry of entries) {
|
|
189
|
+
if (entry?.type !== "custom" || entry?.customType !== ENTRY_TYPE) continue;
|
|
190
|
+
const responseId = entry?.data?.responseId;
|
|
191
|
+
if (typeof responseId === "string") seen.add(responseId);
|
|
192
|
+
}
|
|
193
|
+
} catch {
|
|
194
|
+
// best effort only
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const globalFetch = globalThis as typeof globalThis & { [FETCH_PATCHED]?: boolean };
|
|
198
|
+
if (globalFetch[FETCH_PATCHED]) return;
|
|
199
|
+
globalFetch[FETCH_PATCHED] = true;
|
|
200
|
+
const realFetch = globalThis.fetch.bind(globalThis);
|
|
201
|
+
globalThis.fetch = async (input, init) => {
|
|
202
|
+
const response = await realFetch(input as Parameters<typeof realFetch>[0], init);
|
|
203
|
+
try {
|
|
204
|
+
if (!isLlmUrl(input)) return response;
|
|
205
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
206
|
+
if (!contentType.includes("json") && !contentType.includes("event-stream")) return response;
|
|
207
|
+
if (!response.body) return response;
|
|
208
|
+
const headerCost = parseCostHeader(response.headers.get("x-litellm-response-cost"));
|
|
209
|
+
const [main, tee] = response.body.tee();
|
|
210
|
+
void (async () => {
|
|
211
|
+
let raw = "";
|
|
212
|
+
try {
|
|
213
|
+
const reader = tee.getReader();
|
|
214
|
+
const decoder = new TextDecoder();
|
|
215
|
+
for (;;) {
|
|
216
|
+
const { done, value } = await reader.read();
|
|
217
|
+
if (done) break;
|
|
218
|
+
raw += decoder.decode(value, { stream: true });
|
|
219
|
+
if (raw.length > MAX_CAPTURE_BYTES) break;
|
|
220
|
+
}
|
|
221
|
+
} catch {
|
|
222
|
+
// capture is best-effort; the main branch is unaffected
|
|
223
|
+
}
|
|
224
|
+
finishCapture(raw, headerCost);
|
|
225
|
+
})();
|
|
226
|
+
// Preserve response identity as seen by the SDK: body swapped, rest identical.
|
|
227
|
+
return new Response(main, {
|
|
228
|
+
status: response.status,
|
|
229
|
+
statusText: response.statusText,
|
|
230
|
+
headers: response.headers,
|
|
231
|
+
});
|
|
232
|
+
} catch {
|
|
233
|
+
return response;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
pi.on("message_end", (event) => {
|
|
239
|
+
const message = event.message as
|
|
240
|
+
| {
|
|
241
|
+
role?: string;
|
|
242
|
+
provider?: string;
|
|
243
|
+
model?: string;
|
|
244
|
+
responseId?: string;
|
|
245
|
+
stopReason?: string;
|
|
246
|
+
}
|
|
247
|
+
| undefined;
|
|
248
|
+
if (!message || message.role !== "assistant") return;
|
|
249
|
+
if (message.stopReason === "error" || message.stopReason === "aborted") return;
|
|
250
|
+
const responseId = message.responseId;
|
|
251
|
+
if (typeof responseId !== "string" || responseId.length === 0) return;
|
|
252
|
+
|
|
253
|
+
const info: MessageInfo = {
|
|
254
|
+
provider: message.provider ?? "",
|
|
255
|
+
model: message.responseModel ?? message.model ?? "",
|
|
256
|
+
responseId,
|
|
257
|
+
};
|
|
258
|
+
const cost = processCaptured.get(responseId);
|
|
259
|
+
if (cost !== undefined) {
|
|
260
|
+
writeEntry(info, cost);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
// The tee branch may finish after message_end; remember the message so
|
|
264
|
+
// the capture can match it on completion and write via this session.
|
|
265
|
+
if (!seen.has(responseId) && !processWaiting.has(responseId)) {
|
|
266
|
+
waitingLimitGuard();
|
|
267
|
+
processWaiting.set(responseId, { info, write: writeEntry });
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Trim oldest waiting entries so unclaimed captures cannot grow unbounded.
|
|
273
|
+
function waitingLimitGuard(): void {
|
|
274
|
+
if (processWaiting.size >= MAX_PENDING_LOOKUPS) {
|
|
275
|
+
for (const key of [...processWaiting.keys()].slice(0, processWaiting.size - MAX_PENDING_LOOKUPS + 1))
|
|
276
|
+
processWaiting.delete(key);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -22,6 +22,7 @@ function setup() {
|
|
|
22
22
|
handler = registeredHandler;
|
|
23
23
|
}),
|
|
24
24
|
registerTool: vi.fn((tool: { name: string }) => active.add(tool.name)),
|
|
25
|
+
getAllTools: vi.fn(() => [...active].map((name) => ({ name }))),
|
|
25
26
|
};
|
|
26
27
|
enableReadonlyTools(pi as any);
|
|
27
28
|
return { active, handler, pi };
|
|
@@ -49,4 +50,14 @@ describe("enable-readonly-tools", () => {
|
|
|
49
50
|
expect(pi.registerTool).toHaveBeenCalledTimes(3);
|
|
50
51
|
expect(createGrepToolDefinition).toHaveBeenCalledWith("/project");
|
|
51
52
|
});
|
|
53
|
+
|
|
54
|
+
it("does not replace a display extension's existing readonly renderers", () => {
|
|
55
|
+
const { active, handler, pi } = setup();
|
|
56
|
+
active.add("grep");
|
|
57
|
+
active.add("find");
|
|
58
|
+
active.add("ls");
|
|
59
|
+
|
|
60
|
+
handler({ toolName: "read", isError: false }, { cwd: "/project" });
|
|
61
|
+
expect(pi.registerTool).not.toHaveBeenCalled();
|
|
62
|
+
});
|
|
52
63
|
});
|
|
@@ -13,8 +13,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
13
13
|
pi.on("tool_execution_end", (event, ctx) => {
|
|
14
14
|
if (enabled || event.isError || !bootstrapTools.has(event.toolName)) return;
|
|
15
15
|
enabled = true;
|
|
16
|
-
|
|
17
|
-
pi.
|
|
18
|
-
|
|
16
|
+
|
|
17
|
+
// pi-tool-display may already own these renderer definitions. Re-registering
|
|
18
|
+
// Pi's plain built-ins here silently discarded its boxed grep/find/ls views.
|
|
19
|
+
const active = new Set(pi.getAllTools().map((tool) => tool.name));
|
|
20
|
+
if (!active.has("grep")) pi.registerTool(createGrepToolDefinition(ctx.cwd));
|
|
21
|
+
if (!active.has("find")) pi.registerTool(createFindToolDefinition(ctx.cwd));
|
|
22
|
+
if (!active.has("ls")) pi.registerTool(createLsToolDefinition(ctx.cwd));
|
|
19
23
|
});
|
|
20
24
|
}
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
"pi": {
|
|
7
7
|
"extensions": [
|
|
8
8
|
"./agent-browser.ts",
|
|
9
|
+
"./auto-session-name.ts",
|
|
9
10
|
"./copy-turn.ts",
|
|
10
11
|
"./context-compaction-reminder.ts",
|
|
12
|
+
"./cost-reconcile.ts",
|
|
11
13
|
"./enable-readonly-tools.ts",
|
|
12
14
|
"./pi-intercom/index.ts",
|
|
13
15
|
"./ponytail/index.js",
|
|
@@ -20,6 +22,7 @@
|
|
|
20
22
|
"./tokenin-onboarding.ts",
|
|
21
23
|
"./undo.ts",
|
|
22
24
|
"./pi-subagents",
|
|
25
|
+
"./pi-tool-display",
|
|
23
26
|
"./pi-web-agent",
|
|
24
27
|
"./web-agent-onboarding.ts",
|
|
25
28
|
"./tps.ts",
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Nico Bailon
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nico Bailon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|