@punch-bot/cli 0.85.1 → 1.3.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 +609 -3
- package/README.md +82 -174
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.js.map +1 -1
- package/dist/bun/runtime-setup.d.ts.map +1 -1
- package/dist/bun/runtime-setup.js +4 -1
- package/dist/bun/runtime-setup.js.map +1 -1
- package/dist/bun/sandbox-env-setup.d.ts.map +1 -1
- package/dist/bundle/chunks/anthropic-messages-BUUFZMRE.js +6 -0
- package/dist/bundle/chunks/anthropic.js +2 -2
- package/dist/bundle/chunks/azure-openai-responses-WZ4GZHD2.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +10 -2
- package/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
- package/dist/bundle/chunks/chunk-2M76JOVH.js +8 -0
- package/dist/bundle/chunks/chunk-6C5VKHGV.js +50 -0
- package/dist/bundle/chunks/chunk-6WNF4BLC.js +2 -0
- package/dist/bundle/chunks/chunk-6YKFJ7FQ.js +1188 -0
- package/dist/bundle/chunks/chunk-BYHXHV4K.js +11 -0
- package/dist/bundle/chunks/chunk-F5ZABL6Z.js +20 -0
- package/dist/bundle/chunks/chunk-HACVPRBJ.js +11 -0
- package/dist/bundle/chunks/chunk-ITZNWD4K.js +2 -0
- package/dist/bundle/chunks/chunk-J7I2NFJ7.js +82 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -0
- package/dist/bundle/chunks/chunk-OWCYH5W2.js +2 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/{chunk-TRDNDS6A.js → chunk-PYGXRV27.js} +5 -2
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/{chunk-XDUWOHPL.js → chunk-S3GGRYIO.js} +2 -2
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/chunk-WUIPA42N.js +14 -0
- package/dist/bundle/chunks/chunk-XIX7LUWI.js +2 -0
- package/dist/bundle/chunks/{chunk-3DNTDXPG.js → chunk-YGGF2ZM6.js} +3 -3
- package/dist/bundle/chunks/chunk-YWHGLBPB.js +2 -0
- package/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
- package/dist/bundle/chunks/cli-QAQLORRY.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-UTBL2KOF.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +478 -0
- package/dist/bundle/chunks/execute-2Z6BN5R3.js +499 -0
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-S2KXX5PQ.js +2 -0
- package/dist/bundle/chunks/google-vertex-LQOUTFJN.js +2 -0
- package/dist/bundle/chunks/image-resize-worker.js +1 -1
- package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
- package/dist/bundle/chunks/{lib-HGQMNYVT.js → lib-TEDK3E5I.js} +2 -2
- package/dist/bundle/chunks/llama-cpp-classify-FYN623RH.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-VNJYBSRF.js +5 -0
- package/dist/bundle/chunks/node-N5BSDOA5.js +16 -0
- package/dist/bundle/chunks/{node-4PXJTSWH.js → node-TWVVAGPO.js} +1 -1
- package/dist/bundle/chunks/openai-chatgpt.js +75 -0
- package/dist/bundle/chunks/openai-codex-responses-E6BLZPYJ.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +2 -2
- package/dist/bundle/chunks/openai-completions-LUDIAWSG.js +7 -0
- package/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
- package/dist/bundle/chunks/openai-responses-IOCBEIVC.js +3 -0
- package/dist/bundle/chunks/{openrouter-images-N4XVVFSD.js → openrouter-images-YU24TD7D.js} +1 -1
- package/dist/bundle/chunks/openrouter.js +2 -2
- package/dist/bundle/chunks/{pi-messages-ZRYGTSON.js → pi-messages-V27DSLVC.js} +2 -2
- package/dist/bundle/chunks/radius.js +2 -2
- package/dist/bundle/chunks/runtime-R6O72Q4R.js +2 -0
- package/dist/bundle/chunks/typesafe-system-one-ZSK3RN4B.js +2 -0
- package/dist/bundle/chunks/virtual-modules-GZVZPCK3.js +2 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +4 -2
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +1 -2
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +73 -53
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +4 -4
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/transport-address.d.ts +21 -0
- package/dist/cli/experimental/transport-address.d.ts.map +1 -0
- package/dist/cli/experimental/transport-address.js +89 -0
- package/dist/cli/experimental/transport-address.js.map +1 -0
- package/dist/cli/file-processor.d.ts +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js +5 -35
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/config.d.ts +30 -11
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +72 -21
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +4 -3
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +37 -27
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +13 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +270 -22
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1174 -410
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +20 -13
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +42 -52
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bug-report-upload.d.ts +12 -0
- package/dist/core/bug-report-upload.d.ts.map +1 -0
- package/dist/core/bug-report-upload.js +22 -0
- package/dist/core/bug-report-upload.js.map +1 -0
- package/dist/core/bug-report.d.ts +184 -0
- package/dist/core/bug-report.d.ts.map +1 -0
- package/dist/core/bug-report.js +292 -0
- package/dist/core/bug-report.js.map +1 -0
- package/dist/core/cache-stats.d.ts.map +1 -1
- package/dist/core/cache-stats.js +12 -1
- package/dist/core/cache-stats.js.map +1 -1
- package/dist/core/cache-warmer.d.ts +103 -0
- package/dist/core/cache-warmer.d.ts.map +1 -0
- package/dist/core/cache-warmer.js +356 -0
- package/dist/core/cache-warmer.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +5 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +164 -88
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/utils.d.ts +8 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +32 -26
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/crash-log.d.ts +27 -0
- package/dist/core/crash-log.d.ts.map +1 -0
- package/dist/core/crash-log.js +140 -0
- package/dist/core/crash-log.js.map +1 -0
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/delivery.d.ts.map +1 -1
- package/dist/core/delivery.js.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.css +10 -0
- package/dist/core/export-html/template.js +93 -34
- package/dist/core/export-html/tool-renderer.d.ts +5 -11
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +8 -99
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/jiti-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-loader.js +4 -0
- package/dist/core/extensions/jiti-loader.js.map +1 -0
- package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
- package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-static-loader.js +4 -0
- package/dist/core/extensions/jiti-static-loader.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +102 -74
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +44 -14
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +297 -169
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +482 -238
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/virtual-modules.js +35 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +2 -2
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +3 -22
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +13 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +13 -4
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/mcp-servers.d.ts +139 -0
- package/dist/core/mcp-servers.d.ts.map +1 -0
- package/dist/core/mcp-servers.js +232 -0
- package/dist/core/mcp-servers.js.map +1 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +1 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/{modes/interactive → core}/model-catalog-refresh.d.ts +2 -2
- package/dist/core/model-catalog-refresh.d.ts.map +1 -0
- package/dist/{modes/interactive → core}/model-catalog-refresh.js +2 -2
- package/dist/core/model-catalog-refresh.js.map +1 -0
- package/dist/core/model-config.d.ts +886 -80
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +33 -148
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +15 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +29 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +61 -46
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +338 -363
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +51 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +211 -44
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/model-suffix-variants.d.ts +14 -0
- package/dist/core/model-suffix-variants.d.ts.map +1 -0
- package/dist/core/model-suffix-variants.js +27 -0
- package/dist/core/model-suffix-variants.js.map +1 -0
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/nested-tool-calls.d.ts +103 -0
- package/dist/core/nested-tool-calls.d.ts.map +1 -0
- package/dist/core/nested-tool-calls.js +179 -0
- package/dist/core/nested-tool-calls.js.map +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts +4 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +62 -15
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts.map +1 -1
- package/dist/core/pi-manifest.js.map +1 -1
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +2 -1
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +6 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +68 -37
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.d.ts.map +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/provider-composer.d.ts +42 -20
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +126 -40
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/radius.d.ts +5 -0
- package/dist/core/radius.d.ts.map +1 -1
- package/dist/core/radius.js +8 -0
- package/dist/core/radius.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +19 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +102 -34
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +11 -2
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +170 -42
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts +14 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +108 -52
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-export.d.ts +6 -2
- package/dist/core/session-export.d.ts.map +1 -1
- package/dist/core/session-export.js +14 -13
- package/dist/core/session-export.js.map +1 -1
- package/dist/core/session-manager.d.ts +72 -13
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +277 -124
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +65 -0
- package/dist/core/settings-defaults.d.ts.map +1 -0
- package/dist/core/settings-defaults.js +66 -0
- package/dist/core/settings-defaults.js.map +1 -0
- package/dist/core/settings-diagnostics.d.ts.map +1 -1
- package/dist/core/settings-diagnostics.js.map +1 -1
- package/dist/core/settings-manager.d.ts +41 -126
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +165 -52
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +224 -0
- package/dist/core/settings-schema.d.ts.map +1 -0
- package/dist/core/settings-schema.js +285 -0
- package/dist/core/settings-schema.js.map +1 -0
- package/dist/core/skills.d.ts +4 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +3 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/source-info.d.ts +8 -0
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js +16 -0
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts +55 -6
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +128 -93
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts +2 -0
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js +45 -0
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/theme/dark.json +78 -0
- package/dist/core/theme/light.json +78 -0
- package/dist/core/theme/system-theme.d.ts +54 -0
- package/dist/core/theme/system-theme.d.ts.map +1 -0
- package/dist/core/theme/system-theme.js +547 -0
- package/dist/core/theme/system-theme.js.map +1 -0
- package/dist/core/theme/theme-schema.d.ts +28 -0
- package/dist/core/theme/theme-schema.d.ts.map +1 -0
- package/dist/core/theme/theme-schema.js +105 -0
- package/dist/core/theme/theme-schema.js.map +1 -0
- package/dist/core/theme/theme-tokens.d.ts +257 -0
- package/dist/core/theme/theme-tokens.d.ts.map +1 -0
- package/dist/core/theme/theme-tokens.js +94 -0
- package/dist/core/theme/theme-tokens.js.map +1 -0
- package/dist/core/theme/theme.d.ts +162 -0
- package/dist/core/theme/theme.d.ts.map +1 -0
- package/dist/{modes/interactive → core}/theme/theme.js +265 -402
- package/dist/core/theme/theme.js.map +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +14 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +43 -6
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -2
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +0 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +0 -2
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +0 -2
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +0 -2
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +11 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +40 -10
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/read.d.ts +17 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +23 -4
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +3 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +14 -0
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +29 -0
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +0 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +1 -0
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/core/usage-totals.d.ts +3 -1
- package/dist/core/usage-totals.d.ts.map +1 -1
- package/dist/core/usage-totals.js +28 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/core/virtual-models.d.ts +117 -0
- package/dist/core/virtual-models.d.ts.map +1 -0
- package/dist/core/virtual-models.js +124 -0
- package/dist/core/virtual-models.js.map +1 -0
- package/dist/extensions/browser/index.d.ts.map +1 -1
- package/dist/extensions/browser/index.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts +16 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.js +665 -0
- package/dist/extensions/codemode/execute.js.map +1 -0
- package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
- package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
- package/dist/extensions/codemode/execute.lazy.js +3 -0
- package/dist/extensions/codemode/execute.lazy.js.map +1 -0
- package/dist/extensions/codemode/index.d.ts +21 -0
- package/dist/extensions/codemode/index.d.ts.map +1 -0
- package/dist/extensions/codemode/index.js +33 -0
- package/dist/extensions/codemode/index.js.map +1 -0
- package/dist/extensions/codemode/tool.d.ts +124 -0
- package/dist/extensions/codemode/tool.d.ts.map +1 -0
- package/dist/extensions/codemode/tool.js +286 -0
- package/dist/extensions/codemode/tool.js.map +1 -0
- package/dist/extensions/codemode/worker.d.ts +7 -0
- package/dist/extensions/codemode/worker.d.ts.map +1 -0
- package/dist/extensions/codemode/worker.js +7 -0
- package/dist/extensions/codemode/worker.js.map +1 -0
- package/dist/extensions/context-pruning/compress_context.d.ts.map +1 -1
- package/dist/extensions/context-pruning/compress_context.js +1 -3
- package/dist/extensions/context-pruning/compress_context.js.map +1 -1
- package/dist/extensions/context-pruning/context-pruning-state.d.ts.map +1 -1
- package/dist/extensions/context-pruning/context-pruning-state.js.map +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +6 -2
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -3
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/huggingface.d.ts.map +1 -1
- package/dist/extensions/llama/huggingface.js.map +1 -1
- package/dist/extensions/llama/index.d.ts.map +1 -1
- package/dist/extensions/llama/index.js +0 -4
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +103 -13
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts +3 -2
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +106 -364
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/cli.d.ts +21 -0
- package/dist/extensions/mcp/cli.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.js +494 -0
- package/dist/extensions/mcp/cli.js.map +1 -0
- package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
- package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/cli.lazy.js +3 -0
- package/dist/extensions/mcp/cli.lazy.js.map +1 -0
- package/dist/extensions/mcp/config.d.ts +84 -0
- package/dist/extensions/mcp/config.d.ts.map +1 -0
- package/dist/extensions/mcp/config.js +196 -0
- package/dist/extensions/mcp/config.js.map +1 -0
- package/dist/extensions/mcp/index.d.ts +71 -2
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +839 -131
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/log.d.ts +16 -0
- package/dist/extensions/mcp/log.d.ts.map +1 -0
- package/dist/extensions/mcp/log.js +66 -0
- package/dist/extensions/mcp/log.js.map +1 -0
- package/dist/extensions/mcp/oauth.d.ts +102 -0
- package/dist/extensions/mcp/oauth.d.ts.map +1 -0
- package/dist/extensions/mcp/oauth.js +428 -0
- package/dist/extensions/mcp/oauth.js.map +1 -0
- package/dist/extensions/mcp/resources.d.ts +36 -0
- package/dist/extensions/mcp/resources.d.ts.map +1 -0
- package/dist/extensions/mcp/resources.js +261 -0
- package/dist/extensions/mcp/resources.js.map +1 -0
- package/dist/extensions/mcp/runtime.d.ts +98 -0
- package/dist/extensions/mcp/runtime.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.js +378 -0
- package/dist/extensions/mcp/runtime.js.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
- package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
- package/dist/extensions/mcp/runtime.lazy.js +3 -0
- package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
- package/dist/extensions/mcp/tools.d.ts +84 -0
- package/dist/extensions/mcp/tools.d.ts.map +1 -0
- package/dist/extensions/mcp/tools.js +263 -0
- package/dist/extensions/mcp/tools.js.map +1 -0
- package/dist/extensions/punch/a2a-listen.d.ts +9 -0
- package/dist/extensions/punch/a2a-listen.d.ts.map +1 -0
- package/dist/extensions/punch/a2a-listen.js +88 -0
- package/dist/extensions/punch/a2a-listen.js.map +1 -0
- package/dist/extensions/punch/a2a.d.ts +12 -0
- package/dist/extensions/punch/a2a.d.ts.map +1 -0
- package/dist/extensions/punch/a2a.js +106 -0
- package/dist/extensions/punch/a2a.js.map +1 -0
- package/dist/extensions/punch/auth.d.ts +2 -1
- package/dist/extensions/punch/auth.d.ts.map +1 -1
- package/dist/extensions/punch/auth.js +5 -1
- package/dist/extensions/punch/auth.js.map +1 -1
- package/dist/extensions/punch/collabs.d.ts.map +1 -1
- package/dist/extensions/punch/collabs.js.map +1 -1
- package/dist/extensions/punch/index.d.ts.map +1 -1
- package/dist/extensions/punch/index.js +11 -15
- package/dist/extensions/punch/index.js.map +1 -1
- package/dist/extensions/punch/routines.d.ts +1 -3
- package/dist/extensions/punch/routines.d.ts.map +1 -1
- package/dist/extensions/punch/routines.js +1 -121
- package/dist/extensions/punch/routines.js.map +1 -1
- package/dist/extensions/punch/server.d.ts +3 -0
- package/dist/extensions/punch/server.d.ts.map +1 -1
- package/dist/extensions/punch/server.js +41 -3
- package/dist/extensions/punch/server.js.map +1 -1
- package/dist/extensions/punch/timezone.d.ts.map +1 -1
- package/dist/extensions/punch/timezone.js.map +1 -1
- package/dist/extensions/punch/todo-store.d.ts +15 -0
- package/dist/extensions/punch/todo-store.d.ts.map +1 -0
- package/dist/extensions/punch/todo-store.js +208 -0
- package/dist/extensions/punch/todo-store.js.map +1 -0
- package/dist/extensions/punch/todos.d.ts +7 -3
- package/dist/extensions/punch/todos.d.ts.map +1 -1
- package/dist/extensions/punch/todos.js +40 -17
- package/dist/extensions/punch/todos.js.map +1 -1
- package/dist/extensions/report-progress/index.d.ts.map +1 -1
- package/dist/extensions/report-progress/index.js.map +1 -1
- package/dist/extensions/subagent/agents.d.ts.map +1 -1
- package/dist/extensions/subagent/agents.js.map +1 -1
- package/dist/extensions/subagent/index.d.ts.map +1 -1
- package/dist/extensions/subagent/index.js +0 -372
- package/dist/extensions/subagent/index.js.map +1 -1
- package/dist/extensions/tool-search/index.d.ts +12 -0
- package/dist/extensions/tool-search/index.d.ts.map +1 -0
- package/dist/extensions/tool-search/index.js +15 -0
- package/dist/extensions/tool-search/index.js.map +1 -0
- package/dist/extensions/tool-search/tool.d.ts +71 -0
- package/dist/extensions/tool-search/tool.d.ts.map +1 -0
- package/dist/extensions/tool-search/tool.js +187 -0
- package/dist/extensions/tool-search/tool.js.map +1 -0
- package/dist/extensions/webfetch/index.d.ts.map +1 -1
- package/dist/extensions/webfetch/index.js.map +1 -1
- package/dist/extensions/websearch/index.d.ts.map +1 -1
- package/dist/extensions/websearch/index.js.map +1 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +140 -173
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +0 -20
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +0 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js +0 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +4 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +10 -6
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +19 -8
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +30 -48
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +21 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +43 -43
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/rpc-entry.d.ts.map +1 -1
- package/dist/rpc-entry.js.map +1 -1
- package/dist/server/a2a/harness-runner.d.ts.map +1 -1
- package/dist/server/a2a/harness-runner.js.map +1 -1
- package/dist/server/a2a/run-server.d.ts.map +1 -1
- package/dist/server/a2a/run-server.js.map +1 -1
- package/dist/utils/abort.d.ts.map +1 -1
- package/dist/utils/abort.js.map +1 -1
- package/dist/utils/ansi.d.ts +8 -0
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +30 -11
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +5 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-command.d.ts.map +1 -1
- package/dist/utils/clipboard-command.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +15 -41
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +96 -38
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/colors.d.ts +73 -0
- package/dist/utils/colors.d.ts.map +1 -0
- package/dist/utils/colors.js +273 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/deprecation.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/fuzzy.d.ts +16 -0
- package/dist/utils/fuzzy.d.ts.map +1 -0
- package/dist/utils/fuzzy.js +111 -0
- package/dist/utils/fuzzy.js.map +1 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/html.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts +12 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js +5 -0
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js +3 -2
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +9 -10
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/management-http.d.ts.map +1 -1
- package/dist/utils/management-http.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/oklab.d.ts +43 -0
- package/dist/utils/oklab.d.ts.map +1 -0
- package/dist/utils/oklab.js +210 -0
- package/dist/utils/oklab.js.map +1 -0
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/output-files.d.ts +15 -0
- package/dist/utils/output-files.d.ts.map +1 -0
- package/dist/utils/output-files.js +30 -0
- package/dist/utils/output-files.js.map +1 -0
- package/dist/utils/paths.d.ts +3 -3
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +5 -4
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/shell.d.ts +1 -3
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +3 -30
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +8 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/text.js.map +1 -1
- package/dist/utils/tool-result-images.d.ts +3 -1
- package/dist/utils/tool-result-images.d.ts.map +1 -1
- package/dist/utils/tool-result-images.js +4 -1
- package/dist/utils/tool-result-images.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/dist/utils/wsl.d.ts +3 -0
- package/dist/utils/wsl.d.ts.map +1 -0
- package/dist/utils/wsl.js +15 -0
- package/dist/utils/wsl.js.map +1 -0
- package/dist/utils/zip.d.ts +7 -0
- package/dist/utils/zip.d.ts.map +1 -0
- package/dist/utils/zip.js +60 -0
- package/dist/utils/zip.js.map +1 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +333 -0
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +47 -28
- package/docs/configuration.md +47 -0
- package/docs/containerization.md +109 -82
- package/docs/custom-provider.md +109 -713
- package/docs/docs.json +152 -96
- package/docs/environment-variables.md +18 -3
- package/docs/extensions.md +284 -604
- package/docs/how-pi-works.md +49 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/index.md +24 -69
- package/docs/json.md +193 -65
- package/docs/keybindings.md +58 -103
- package/docs/llama-cpp.md +24 -4
- package/docs/mcp.md +272 -0
- package/docs/message-types.md +279 -0
- package/docs/models.md +124 -489
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +67 -166
- package/docs/prompt-templates.md +31 -68
- package/docs/providers.md +158 -228
- package/docs/punch-todos.md +24 -0
- package/docs/quickstart.md +61 -106
- package/docs/rpc-commands.md +888 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +131 -1554
- package/docs/sdk.md +79 -1158
- package/docs/security.md +72 -32
- package/docs/session-format.md +58 -215
- package/docs/sessions.md +35 -114
- package/docs/settings.md +98 -326
- package/docs/shell-aliases.md +85 -5
- package/docs/skills.md +51 -190
- package/docs/slash-commands.md +60 -0
- package/docs/subagents.md +2 -0
- package/docs/terminal-setup.md +7 -182
- package/docs/termux.md +74 -83
- package/docs/themes.md +89 -273
- package/docs/tmux.md +31 -39
- package/docs/tui.md +74 -910
- package/docs/usage.md +52 -129
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +45 -17
- package/examples/README.md +13 -5
- package/examples/extensions/README.md +4 -30
- package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +17 -17
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
- package/examples/extensions/debug-provider.ts +69 -0
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +5 -5
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/prompt-customizer.ts +19 -67
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +20 -20
- package/examples/rpc-client.ts +35 -0
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/examples/sdk/README.md +3 -2
- package/npm-shrinkwrap.json +2425 -0
- package/package.json +30 -29
- package/schemas/models.schema.json +1157 -0
- package/schemas/settings.schema.json +734 -0
- package/schemas/theme.schema.json +365 -0
- package/src/extensions/punch/sqlite-bun.mjs +1 -0
- package/src/extensions/punch/sqlite-driver.d.mts +15 -0
- package/src/extensions/punch/sqlite-node.mjs +1 -0
- package/dist/bundle/chunks/anthropic-messages-ASRU76PT.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-UGF6LMEX.js +0 -2
- package/dist/bundle/chunks/chunk-5PRUVL6W.js +0 -1770
- package/dist/bundle/chunks/chunk-6R7UI4IY.js +0 -2
- package/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
- package/dist/bundle/chunks/chunk-CHB3CEFP.js +0 -2
- package/dist/bundle/chunks/chunk-ELBMWBDG.js +0 -11
- package/dist/bundle/chunks/chunk-GMWCTUPB.js +0 -2
- package/dist/bundle/chunks/chunk-GTBU4EAF.js +0 -2
- package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
- package/dist/bundle/chunks/chunk-UIWY7TU5.js +0 -42
- package/dist/bundle/chunks/chunk-XNGRGP62.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-VCD2PGIY.js +0 -2
- package/dist/bundle/chunks/google-vertex-L6U34ZRC.js +0 -2
- package/dist/bundle/chunks/mistral-conversations-IXWQ2YKN.js +0 -5
- package/dist/bundle/chunks/node-5YXRXMVN.js +0 -16
- package/dist/bundle/chunks/openai-codex-responses-P7HKQLIT.js +0 -10
- package/dist/bundle/chunks/openai-completions-O7BFLP3U.js +0 -7
- package/dist/bundle/chunks/openai-responses-QAKWAYVG.js +0 -2
- package/dist/cli/config-selector.d.ts +0 -16
- package/dist/cli/config-selector.d.ts.map +0 -1
- package/dist/cli/config-selector.js +0 -32
- package/dist/cli/config-selector.js.map +0 -1
- package/dist/cli/session-picker.d.ts +0 -10
- package/dist/cli/session-picker.d.ts.map +0 -1
- package/dist/cli/session-picker.js +0 -36
- package/dist/cli/session-picker.js.map +0 -1
- package/dist/cli/startup-ui.d.ts +0 -20
- package/dist/cli/startup-ui.d.ts.map +0 -1
- package/dist/cli/startup-ui.js +0 -185
- package/dist/cli/startup-ui.js.map +0 -1
- package/dist/core/keybindings.d.ts +0 -428
- package/dist/core/keybindings.d.ts.map +0 -1
- package/dist/core/keybindings.js +0 -321
- package/dist/core/keybindings.js.map +0 -1
- package/dist/core/tools/render-utils.d.ts +0 -24
- package/dist/core/tools/render-utils.d.ts.map +0 -1
- package/dist/core/tools/render-utils.js +0 -65
- package/dist/core/tools/render-utils.js.map +0 -1
- package/dist/core/tools/renderers/bash.d.ts +0 -12
- package/dist/core/tools/renderers/bash.d.ts.map +0 -1
- package/dist/core/tools/renderers/bash.js +0 -130
- package/dist/core/tools/renderers/bash.js.map +0 -1
- package/dist/core/tools/renderers/edit.d.ts +0 -23
- package/dist/core/tools/renderers/edit.d.ts.map +0 -1
- package/dist/core/tools/renderers/edit.js +0 -167
- package/dist/core/tools/renderers/edit.js.map +0 -1
- package/dist/core/tools/renderers/find.d.ts +0 -10
- package/dist/core/tools/renderers/find.d.ts.map +0 -1
- package/dist/core/tools/renderers/find.js +0 -64
- package/dist/core/tools/renderers/find.js.map +0 -1
- package/dist/core/tools/renderers/grep.d.ts +0 -10
- package/dist/core/tools/renderers/grep.d.ts.map +0 -1
- package/dist/core/tools/renderers/grep.js +0 -69
- package/dist/core/tools/renderers/grep.js.map +0 -1
- package/dist/core/tools/renderers/index.d.ts +0 -28
- package/dist/core/tools/renderers/index.d.ts.map +0 -1
- package/dist/core/tools/renderers/index.js +0 -47
- package/dist/core/tools/renderers/index.js.map +0 -1
- package/dist/core/tools/renderers/ls.d.ts +0 -10
- package/dist/core/tools/renderers/ls.d.ts.map +0 -1
- package/dist/core/tools/renderers/ls.js +0 -58
- package/dist/core/tools/renderers/ls.js.map +0 -1
- package/dist/core/tools/renderers/read.d.ts +0 -11
- package/dist/core/tools/renderers/read.d.ts.map +0 -1
- package/dist/core/tools/renderers/read.js +0 -129
- package/dist/core/tools/renderers/read.js.map +0 -1
- package/dist/core/tools/renderers/write.d.ts +0 -10
- package/dist/core/tools/renderers/write.d.ts.map +0 -1
- package/dist/core/tools/renderers/write.js +0 -153
- package/dist/core/tools/renderers/write.js.map +0 -1
- package/dist/extensions/mcp/mcp-client.d.ts +0 -31
- package/dist/extensions/mcp/mcp-client.d.ts.map +0 -1
- package/dist/extensions/mcp/mcp-client.js +0 -149
- package/dist/extensions/mcp/mcp-client.js.map +0 -1
- package/dist/extensions/mcp/mcp-config.d.ts +0 -47
- package/dist/extensions/mcp/mcp-config.d.ts.map +0 -1
- package/dist/extensions/mcp/mcp-config.js +0 -281
- package/dist/extensions/mcp/mcp-config.js.map +0 -1
- package/dist/extensions/mcp/mcp-transport.d.ts +0 -65
- package/dist/extensions/mcp/mcp-transport.d.ts.map +0 -1
- package/dist/extensions/mcp/mcp-transport.js +0 -278
- package/dist/extensions/mcp/mcp-transport.js.map +0 -1
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/chat-viewport.d.ts +0 -20
- package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
- package/dist/modes/interactive/chat-viewport.js +0 -28
- package/dist/modes/interactive/chat-viewport.js.map +0 -1
- package/dist/modes/interactive/components/armin.d.ts +0 -34
- package/dist/modes/interactive/components/armin.d.ts.map +0 -1
- package/dist/modes/interactive/components/armin.js +0 -333
- package/dist/modes/interactive/components/armin.js.map +0 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
- package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/assistant-message.js +0 -158
- package/dist/modes/interactive/components/assistant-message.js.map +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
- package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/bash-execution.js +0 -175
- package/dist/modes/interactive/components/bash-execution.js.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -54
- package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/branch-summary-message.js +0 -44
- package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
- package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
- package/dist/modes/interactive/components/config-selector.d.ts +0 -102
- package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/config-selector.js +0 -761
- package/dist/modes/interactive/components/config-selector.js.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -33
- package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
- package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-editor.js +0 -115
- package/dist/modes/interactive/components/custom-editor.js.map +0 -1
- package/dist/modes/interactive/components/custom-entry.d.ts +0 -19
- package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-entry.js +0 -52
- package/dist/modes/interactive/components/custom-entry.js.map +0 -1
- package/dist/modes/interactive/components/custom-message.d.ts +0 -22
- package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/custom-message.js +0 -87
- package/dist/modes/interactive/components/custom-message.js.map +0 -1
- package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
- package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
- package/dist/modes/interactive/components/daxnuts.js +0 -140
- package/dist/modes/interactive/components/daxnuts.js.map +0 -1
- package/dist/modes/interactive/components/diff.d.ts +0 -12
- package/dist/modes/interactive/components/diff.d.ts.map +0 -1
- package/dist/modes/interactive/components/diff.js +0 -133
- package/dist/modes/interactive/components/diff.js.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -21
- package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
- package/dist/modes/interactive/components/earendil-announcement.js +0 -40
- package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +0 -21
- package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-editor.js +0 -98
- package/dist/modes/interactive/components/extension-editor.js.map +0 -1
- package/dist/modes/interactive/components/extension-input.d.ts +0 -23
- package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-input.js +0 -61
- package/dist/modes/interactive/components/extension-input.js.map +0 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +0 -26
- package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/extension-selector.js +0 -83
- package/dist/modes/interactive/components/extension-selector.js.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
- package/dist/modes/interactive/components/first-time-setup.js +0 -103
- package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -32
- package/dist/modes/interactive/components/footer.d.ts.map +0 -1
- package/dist/modes/interactive/components/footer.js +0 -222
- package/dist/modes/interactive/components/footer.js.map +0 -1
- package/dist/modes/interactive/components/index.d.ts +0 -34
- package/dist/modes/interactive/components/index.d.ts.map +0 -1
- package/dist/modes/interactive/components/index.js +0 -35
- package/dist/modes/interactive/components/index.js.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
- package/dist/modes/interactive/components/keybinding-hints.js +0 -36
- package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
- package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
- package/dist/modes/interactive/components/login-dialog.js +0 -188
- package/dist/modes/interactive/components/login-dialog.js.map +0 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
- package/dist/modes/interactive/components/markdown-transform.js +0 -19
- package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
- package/dist/modes/interactive/components/mermaid.d.ts +0 -11
- package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
- package/dist/modes/interactive/components/mermaid.js +0 -75
- package/dist/modes/interactive/components/mermaid.js.map +0 -1
- package/dist/modes/interactive/components/model-selector.d.ts +0 -60
- package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/model-selector.js +0 -361
- package/dist/modes/interactive/components/model-selector.js.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/oauth-selector.js +0 -163
- package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
- package/dist/modes/interactive/components/question-selector.d.ts +0 -24
- package/dist/modes/interactive/components/question-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/question-selector.js +0 -158
- package/dist/modes/interactive/components/question-selector.js.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
- package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector-search.js +0 -155
- package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
- package/dist/modes/interactive/components/session-selector.d.ts +0 -95
- package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/session-selector.js +0 -867
- package/dist/modes/interactive/components/session-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +0 -92
- package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-selector.js +0 -709
- package/dist/modes/interactive/components/settings-selector.js.map +0 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
- package/dist/modes/interactive/components/settings-submenu.js +0 -165
- package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -39
- package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
- package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
- package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
- package/dist/modes/interactive/components/status-indicator.js +0 -67
- package/dist/modes/interactive/components/status-indicator.js.map +0 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
- package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -50
- package/dist/modes/interactive/components/theme-selector.js.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -109
- package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -80
- package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
- package/dist/modes/interactive/components/tool-execution.js +0 -328
- package/dist/modes/interactive/components/tool-execution.js.map +0 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
- package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/tree-selector.js +0 -1245
- package/dist/modes/interactive/components/tree-selector.js.map +0 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
- package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/trust-selector.js +0 -91
- package/dist/modes/interactive/components/trust-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message-selector.js +0 -114
- package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
- package/dist/modes/interactive/components/user-message.d.ts +0 -16
- package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/user-message.js +0 -49
- package/dist/modes/interactive/components/user-message.js.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
- package/dist/modes/interactive/components/visual-truncate.js +0 -33
- package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
- package/dist/modes/interactive/external-editor.d.ts +0 -12
- package/dist/modes/interactive/external-editor.d.ts.map +0 -1
- package/dist/modes/interactive/external-editor.js +0 -38
- package/dist/modes/interactive/external-editor.js.map +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -443
- package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/modes/interactive/interactive-mode.js +0 -5604
- package/dist/modes/interactive/interactive-mode.js.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
- package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
- package/dist/modes/interactive/model-search.d.ts +0 -12
- package/dist/modes/interactive/model-search.d.ts.map +0 -1
- package/dist/modes/interactive/model-search.js +0 -15
- package/dist/modes/interactive/model-search.js.map +0 -1
- package/dist/modes/interactive/session-share.d.ts +0 -16
- package/dist/modes/interactive/session-share.d.ts.map +0 -1
- package/dist/modes/interactive/session-share.js +0 -184
- package/dist/modes/interactive/session-share.js.map +0 -1
- package/dist/modes/interactive/theme/dark.json +0 -91
- package/dist/modes/interactive/theme/light.json +0 -90
- package/dist/modes/interactive/theme/theme-controller.d.ts +0 -41
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-controller.js +0 -130
- package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
- package/dist/modes/interactive/theme/theme-json.d.ts +0 -84
- package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -130
- package/dist/modes/interactive/theme/theme-json.js.map +0 -1
- package/dist/modes/interactive/theme/theme-schema.json +0 -356
- package/dist/modes/interactive/theme/theme.d.ts +0 -131
- package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
- package/dist/modes/interactive/theme/theme.js.map +0 -1
- package/dist/modes/interactive/tui-renderer.d.ts +0 -21
- package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
- package/dist/modes/interactive/tui-renderer.js +0 -66
- package/dist/modes/interactive/tui-renderer.js.map +0 -1
- package/docs/development.md +0 -90
- package/examples/extensions/border-status-editor.ts +0 -145
- package/examples/extensions/built-in-tool-renderer.ts +0 -249
- package/examples/extensions/custom-footer.ts +0 -64
- package/examples/extensions/custom-header.ts +0 -73
- package/examples/extensions/doom-overlay/README.md +0 -46
- package/examples/extensions/doom-overlay/doom/build/doom.js +0 -21
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +0 -152
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
- package/examples/extensions/doom-overlay/doom-component.ts +0 -132
- package/examples/extensions/doom-overlay/doom-engine.ts +0 -173
- package/examples/extensions/doom-overlay/doom-keys.ts +0 -104
- package/examples/extensions/doom-overlay/index.ts +0 -74
- package/examples/extensions/doom-overlay/wad-finder.ts +0 -55
- package/examples/extensions/entry-renderer.ts +0 -41
- package/examples/extensions/github-issue-autocomplete.ts +0 -185
- package/examples/extensions/handoff.ts +0 -190
- package/examples/extensions/interactive-shell.ts +0 -196
- package/examples/extensions/kimi-deferred-tools.ts +0 -61
- package/examples/extensions/message-renderer.ts +0 -59
- package/examples/extensions/minimal-mode.ts +0 -426
- package/examples/extensions/modal-editor.ts +0 -85
- package/examples/extensions/overlay-qa-tests.ts +0 -1450
- package/examples/extensions/overlay-test.ts +0 -153
- package/examples/extensions/plan-mode/README.md +0 -66
- package/examples/extensions/plan-mode/index.ts +0 -390
- package/examples/extensions/plan-mode/utils.ts +0 -168
- package/examples/extensions/preset.ts +0 -436
- package/examples/extensions/qna.ts +0 -118
- package/examples/extensions/question.ts +0 -278
- package/examples/extensions/questionnaire.ts +0 -440
- package/examples/extensions/rainbow-editor.ts +0 -88
- package/examples/extensions/snake.ts +0 -343
- package/examples/extensions/space-invaders.ts +0 -560
- package/examples/extensions/structured-output.ts +0 -65
- package/examples/extensions/summarize.ts +0 -199
- package/examples/extensions/tic-tac-toe.ts +0 -1008
- package/examples/extensions/todo.ts +0 -297
- package/examples/extensions/tools.ts +0 -146
- package/examples/extensions/truncated-tool.ts +0 -195
- package/examples/plugins/pi-example-plugin/README.md +0 -38
- package/examples/plugins/pi-example-plugin/package.json +0 -10
- package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
- package/examples/plugins/pi-example-plugin/src/session.ts +0 -23
- package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
- package/examples/rpc-extension-ui.ts +0 -641
- /package/dist/bundle/chunks/{chunk-PATAL4PO.js → chunk-7ZC4UXSL.js} +0 -0
package/docs/extensions.md
CHANGED
|
@@ -294,7 +294,8 @@ user sends prompt ────────────────────
|
|
|
294
294
|
│ ┌─── turn (repeats while LLM calls tools) ───┐ │
|
|
295
295
|
│ │ │ │
|
|
296
296
|
│ ├─► turn_start │ │
|
|
297
|
-
│ ├─► context (can modify messages)
|
|
297
|
+
│ ├─► context (can modify conversation messages) │
|
|
298
|
+
│ ├─► context_with_system (can modify the full transcript)
|
|
298
299
|
│ ├─► before_provider_headers (can mutate headers) |
|
|
299
300
|
│ ├─► before_provider_request (can inspect or replace payload)
|
|
300
301
|
│ ├─► after_provider_response (status + headers, before stream consume)
|
|
@@ -307,9 +308,13 @@ user sends prompt ────────────────────
|
|
|
307
308
|
│ │ └─► tool_execution_end │ │
|
|
308
309
|
│ │ │ │
|
|
309
310
|
│ └─► turn_end │ │
|
|
311
|
+
│ └─► threshold compaction before a naturally required next turn
|
|
310
312
|
│ │
|
|
311
313
|
├─► agent_end │
|
|
312
|
-
|
|
314
|
+
├─► retry backoff or final-attempt recovery (when selected)
|
|
315
|
+
│ └─► fresh agent_start on successful recovery │
|
|
316
|
+
├─► agent_before_settle (can append entries and continue)│
|
|
317
|
+
└─► agent_settled (final, notification only) │
|
|
313
318
|
│
|
|
314
319
|
user sends another prompt ◄────────────────────────────────┘
|
|
315
320
|
|
|
@@ -538,10 +543,13 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
538
543
|
// event.systemPrompt - current chained system prompt for this handler
|
|
539
544
|
// (includes changes from earlier before_agent_start handlers)
|
|
540
545
|
// event.systemPromptOptions - structured options used to build the system prompt
|
|
541
|
-
// .customPrompt -
|
|
546
|
+
// .customPrompt - exact prompt prefix from --system-prompt, SYSTEM.md, or custom templates
|
|
547
|
+
// .forceSystemPrompt - optional exact replacement for the complete prompt
|
|
542
548
|
// .selectedTools - tools currently active in the prompt
|
|
543
549
|
// .toolSnippets - one-line descriptions for each tool
|
|
544
|
-
// .
|
|
550
|
+
// .toolGuidelines - guideline bullets keyed by tool name
|
|
551
|
+
// .promptGuidelines - additional custom guideline bullets
|
|
552
|
+
// .sections - custom XML-wrapped sections keyed by tag name
|
|
545
553
|
// .appendSystemPrompt - text from --append-system-prompt flags
|
|
546
554
|
// .cwd - working directory
|
|
547
555
|
// .contextFiles - AGENTS.md files and other loaded context files
|
|
@@ -560,13 +568,13 @@ pi.on("before_agent_start", async (event, ctx) => {
|
|
|
560
568
|
});
|
|
561
569
|
```
|
|
562
570
|
|
|
563
|
-
The `systemPromptOptions` field gives extensions access to the same structured data Pi uses to build the system prompt.
|
|
571
|
+
The `systemPromptOptions` field gives extensions access to the same structured data Pi uses to build the system prompt. Collections are mutable. Prefer changing `sections`, `selectedTools`, or `promptGuidelines`: Pi diffs the resulting prompt sections against what the model already has and appends one system message patching only the changed sections. Returning `systemPrompt`, or setting `forceSystemPrompt`, replaces the whole prompt for the run: every provider receives the forced text as its leading system prompt (a cache miss when it changes), and the session transcript keeps recording the structured sections. Tool selection changes update both the prompt contributions and executable provider tools; calling `pi.setActiveTools()` inside the handler has the same effect as editing `selectedTools`. Models that accept system messages mid-conversation receive the patch in place and keep their cached prefix; other models get the replayed prompt as their system prompt, which is a cache miss once per change.
|
|
564
572
|
|
|
565
573
|
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.
|
|
566
574
|
|
|
567
|
-
#### agent_start / agent_end / agent_settled
|
|
575
|
+
#### agent_start / agent_end / agent_before_settle / agent_settled
|
|
568
576
|
|
|
569
|
-
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Pi may still auto-retry, auto-compact and retry, or continue with queued follow-up messages.
|
|
577
|
+
`agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Pi may still auto-retry, auto-compact and retry, or continue with queued follow-up messages. `agent_before_settle` is the final actionable boundary: it can append session entries and request one continuation. `agent_settled` is final and notification-only; use it for status integrations that need to know Pi will not continue running automatically.
|
|
570
578
|
|
|
571
579
|
```typescript
|
|
572
580
|
pi.on("agent_start", async (_event, ctx) => {});
|
|
@@ -575,11 +583,28 @@ pi.on("agent_end", async (event, ctx) => {
|
|
|
575
583
|
// event.messages - messages from this low-level run
|
|
576
584
|
});
|
|
577
585
|
|
|
586
|
+
let addedReviewReminder = false;
|
|
587
|
+
pi.on("agent_before_settle", async (event, ctx) => {
|
|
588
|
+
if (addedReviewReminder) return;
|
|
589
|
+
addedReviewReminder = true;
|
|
590
|
+
return {
|
|
591
|
+
entries: [...event.entries, {
|
|
592
|
+
type: "custom_message",
|
|
593
|
+
customType: "review-reminder",
|
|
594
|
+
content: "Review the final diff before replying.",
|
|
595
|
+
display: false,
|
|
596
|
+
}],
|
|
597
|
+
continue: true,
|
|
598
|
+
};
|
|
599
|
+
});
|
|
600
|
+
|
|
578
601
|
pi.on("agent_settled", async (_event, ctx) => {
|
|
579
|
-
// ctx.isIdle() is true here
|
|
602
|
+
// ctx.isIdle() is true; runs requested here start after all settled handlers finish.
|
|
580
603
|
});
|
|
581
604
|
```
|
|
582
605
|
|
|
606
|
+
If the run is aborted while `agent_before_settle` handlers are running, valid returned entries are still committed, but requested continuation is suppressed. Work requested from `agent_settled` is deferred until every settled handler completes, so notification dispatch is non-reentrant.
|
|
607
|
+
|
|
583
608
|
#### ui_prompt_start / ui_prompt_end
|
|
584
609
|
|
|
585
610
|
Notification-only lifecycle events for blocking user-facing extension UI prompts. They fire around `ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`, `ctx.ui.editor()`, and `ctx.ui.custom()` so host/status integrations can report "waiting for user" instead of just "running".
|
|
@@ -607,11 +632,34 @@ pi.on("turn_start", async (event, ctx) => {
|
|
|
607
632
|
// event.turnIndex, event.timestamp
|
|
608
633
|
});
|
|
609
634
|
|
|
635
|
+
let replacedResponse = false;
|
|
610
636
|
pi.on("turn_end", async (event, ctx) => {
|
|
611
637
|
// event.turnIndex, event.message, event.toolResults
|
|
638
|
+
// event.entries contains the structural entries proposed so far.
|
|
639
|
+
if (replacedResponse || event.outcome !== "completed" || event.toolResults.length > 0) return;
|
|
640
|
+
replacedResponse = true;
|
|
641
|
+
return {
|
|
642
|
+
entries: [
|
|
643
|
+
...event.entries,
|
|
644
|
+
{ type: "context_edit", targetId: event.messageEntryId, replacement: null },
|
|
645
|
+
{
|
|
646
|
+
type: "custom_message",
|
|
647
|
+
customType: "replacement-instruction",
|
|
648
|
+
content: "Answer again using the persisted user request.",
|
|
649
|
+
display: false,
|
|
650
|
+
},
|
|
651
|
+
],
|
|
652
|
+
continue: true,
|
|
653
|
+
};
|
|
612
654
|
});
|
|
613
655
|
```
|
|
614
656
|
|
|
657
|
+
`turn_end` runs after the assistant and tool-result messages have been persisted and before the low-level `turn_end` event. Retry backoff and final-attempt recovery still happen after `agent_end`, preserving their existing lifecycle and queue ordering; `agent_before_settle` sees the repaired projection after that work completes. Boundary handlers run in extension load and registration order. Each handler sees prior proposals in `event.entries` and sees `event.context` rebuilt from them. Returning `entries` or `continue` replaces only that field; omitted fields preserve the current proposal. Allowed draft entry types are `custom`, `custom_message`, `context_edit`, and `compaction`. The complete proposal is validated before it is appended in list order after all handlers finish; a handler error is reported and later handlers still run. Validation prevents partially applied semantic errors, but persistence is not transactional.
|
|
658
|
+
|
|
659
|
+
`continue: true` ensures one next provider request for that boundary invocation. If tool results, steering, or a follow-up already cause that request, they satisfy the decision and no additional request is made; otherwise Pi makes one context-only request. Error and aborted responses remain hard exits. `continue: false` never suppresses natural work. Guard continuation conditions: an unconditional `continue: true` is evaluated again after the next response and can create an endless loop. A `custom_message` draft contributes a user-role model message but is extension-authored: it does not run human input hooks, slash commands, skills, or prompt templates.
|
|
660
|
+
|
|
661
|
+
Host integrations that construct `TurnEndEvent` values must now provide `messageEntryId`, `toolResultEntryIds`, `outcome`, `entries`, `continue`, and `context`. `ExtensionEvent` exhaustive switches must also handle `agent_before_settle`. `ExtensionRunner.emit()` excludes actionable turn boundaries; dispatch `turn_end` and `agent_before_settle` through `emitBoundary(baseEvent, buildContext)` so handlers receive chained previews. Other dedicated runner methods still return results for events such as `session_before_*`.
|
|
662
|
+
|
|
615
663
|
#### message_start / message_update / message_end
|
|
616
664
|
|
|
617
665
|
Fired for message lifecycle updates.
|
|
@@ -678,12 +726,31 @@ Fired before each LLM call. Modify messages non-destructively. See [Session Form
|
|
|
678
726
|
|
|
679
727
|
```typescript
|
|
680
728
|
pi.on("context", async (event, ctx) => {
|
|
681
|
-
// event.messages - deep copy, safe to modify
|
|
729
|
+
// event.messages - deep copy without system messages, safe to modify
|
|
682
730
|
const filtered = event.messages.filter(m => !shouldPrune(m));
|
|
683
731
|
return { messages: filtered };
|
|
684
732
|
});
|
|
685
733
|
```
|
|
686
734
|
|
|
735
|
+
`event.messages` holds the conversation without system messages. The prompt and tool declarations belong to Pi and are not part of this hook: when the handler returns a changed list, Pi replays the current prompt sections and tool declarations into one leading system message ahead of the returned messages. Filtering, windowing, or slicing from a compaction summary therefore cannot drop the prompt or the tools. An unchanged list keeps mid-conversation system messages in place, so models that accept them retain their cached prefix. System messages a handler adds are kept after Pi's head. To change the prompt or the tool set durably, use [`before_agent_start`](#before_agent_start) or `pi.setActiveTools()`; to edit system messages for one request, use [`context_with_system`](#context_with_system).
|
|
736
|
+
|
|
737
|
+
#### context_with_system
|
|
738
|
+
|
|
739
|
+
Fired before each LLM call, after every `context` handler has run and Pi has restored the prompt and tool state. `event.messages` is the full transcript, including the leading system message and any mid-conversation prompt or tool patches (see [Session Format](session-format.md#sessionmessageentry)). The returned messages are sent as they are: this hook owns the prompt and tool declarations for the request.
|
|
740
|
+
|
|
741
|
+
```typescript
|
|
742
|
+
import { getCurrentSystemMessage } from "@punch-bot/ai";
|
|
743
|
+
|
|
744
|
+
pi.on("context_with_system", async (event, ctx) => {
|
|
745
|
+
const cut = findCutIndex(event.messages);
|
|
746
|
+
// Fold the dropped prefix so its prompt and tool state survives as the new head.
|
|
747
|
+
const head = getCurrentSystemMessage(event.messages.slice(0, cut));
|
|
748
|
+
return { messages: head ? [head, ...event.messages.slice(cut)] : event.messages.slice(cut) };
|
|
749
|
+
});
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
Rules: keep a system message at index 0 (providers read the prompt and initial tool declarations there; Pi reports an error if a handler drops it). Removing a system message removes the tool declarations and section patches it carries. Check your output with `getCurrentSystemPrompt()` and `getCurrentTools()` from `@punch-bot/ai`. Handlers run in extension load order; a `systemPrompt` forced from `before_agent_start` is still projected onto the request afterwards.
|
|
753
|
+
|
|
687
754
|
#### before_provider_headers
|
|
688
755
|
|
|
689
756
|
Fired after the outgoing HTTP headers are assembled. Use it to add, override, or remove request headers.
|
|
@@ -735,6 +802,25 @@ pi.on("after_provider_response", (event, ctx) => {
|
|
|
735
802
|
|
|
736
803
|
Header availability depends on provider and transport. Providers that abstract HTTP responses may not expose headers.
|
|
737
804
|
|
|
805
|
+
#### cache_warming_decision
|
|
806
|
+
|
|
807
|
+
Fired before each prompt-cache refresh with pi's decision filled in. The event carries only pi's cost estimates; use `ctx.model`, `ctx.isIdle()`, and `ctx.getContextUsage()` for everything else.
|
|
808
|
+
|
|
809
|
+
```typescript
|
|
810
|
+
pi.on("cache_warming_decision", (event, ctx) => {
|
|
811
|
+
// event.warmCost: price of this refresh
|
|
812
|
+
// event.missCost: extra price of the next request if the entry is lost
|
|
813
|
+
// event.continuationProbability: pi's estimate that a request arrives in time
|
|
814
|
+
// event.action: "warm" | "stop", pi's decision
|
|
815
|
+
|
|
816
|
+
if (ctx.model?.provider === "my-provider") {
|
|
817
|
+
return { action: "stop" };
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
Return `{ action: "warm" }` or `{ action: "stop" }` to override; the last handler that returns an action wins. `"stop"` ends warming until the next real request.
|
|
823
|
+
|
|
738
824
|
### Model Events
|
|
739
825
|
|
|
740
826
|
#### model_select
|
|
@@ -906,6 +992,8 @@ pi.on("user_bash", (event, ctx) => {
|
|
|
906
992
|
});
|
|
907
993
|
```
|
|
908
994
|
|
|
995
|
+
Returning `undefined` continues to the next handler, then local execution if none handles the event. A valid result stops propagation: `operations` executes the command through the supplied backend, while `result` records the completed command without executing it.
|
|
996
|
+
|
|
909
997
|
### Input Events
|
|
910
998
|
|
|
911
999
|
#### input
|
|
@@ -1125,7 +1213,7 @@ const options = ctx.getSystemPromptOptions();
|
|
|
1125
1213
|
const contextPaths = options.contextFiles?.map((file) => file.path) ?? [];
|
|
1126
1214
|
```
|
|
1127
1215
|
|
|
1128
|
-
This has the same shape and mutability as `before_agent_start` `event.systemPromptOptions`: custom prompt, active tools, tool snippets,
|
|
1216
|
+
This has the same shape and mutability as `before_agent_start` `event.systemPromptOptions`: custom or forced prompt, active tools, tool snippets, per-tool and custom rules, custom sections, appended prompt text, cwd, loaded context files, and loaded skills. It may include full context file contents, so treat it as sensitive extension-local data and avoid exposing it through command lists, logs, or autocomplete metadata.
|
|
1129
1217
|
|
|
1130
1218
|
This reports the current base prompt inputs. It does not include per-turn `before_agent_start` chained system-prompt changes, later `context` event message mutations, or `before_provider_request` payload rewrites.
|
|
1131
1219
|
|
|
@@ -1366,7 +1454,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
1366
1454
|
|
|
1367
1455
|
### pi.on(event, handler)
|
|
1368
1456
|
|
|
1369
|
-
Subscribe to events. See [Events](#events) for event types and return values.
|
|
1457
|
+
Subscribe to events. Returns an unsubscribe function that removes only that registration. See [Events](#events) for event types and return values.
|
|
1458
|
+
|
|
1459
|
+
```typescript
|
|
1460
|
+
const unsubscribe = pi.on("agent_end", async (event) => {
|
|
1461
|
+
unsubscribe();
|
|
1462
|
+
await updateIntegration(event.messages);
|
|
1463
|
+
});
|
|
1464
|
+
```
|
|
1465
|
+
|
|
1466
|
+
Handlers run in extension load order, then registration order within each extension. Adding or removing a handler does not affect a dispatch already in progress.
|
|
1370
1467
|
|
|
1371
1468
|
### pi.registerTool(definition)
|
|
1372
1469
|
|
|
@@ -1600,27 +1697,6 @@ mode and would not execute if sent via `prompt`.
|
|
|
1600
1697
|
|
|
1601
1698
|
Register a custom TUI renderer for custom messages with your `customType`. Custom messages are created with `pi.sendMessage()` and participate in LLM context. See [Custom UI](#custom-ui).
|
|
1602
1699
|
|
|
1603
|
-
### pi.registerMarkdownTransformer(transformer)
|
|
1604
|
-
|
|
1605
|
-
Register a transformer for the Markdown in normal user text, assistant text, and thinking blocks. Transformers run in extension load order, and each transformer receives the Markdown returned by the previous transformer. After the chain finishes, Pi renders the transformed content with its built-in renderer.
|
|
1606
|
-
|
|
1607
|
-
The transformer receives the Markdown string and a context with:
|
|
1608
|
-
|
|
1609
|
-
- `messageType` — `"user"`, `"assistant"`, or `"assistant-thinking"`
|
|
1610
|
-
- `isStreaming` — `true` for partial assistant updates; `false` for user, finalized assistant, and restored messages
|
|
1611
|
-
- `availableWidth` — exact terminal columns available for the transformed Markdown content
|
|
1612
|
-
|
|
1613
|
-
Return the transformed Markdown:
|
|
1614
|
-
|
|
1615
|
-
```typescript
|
|
1616
|
-
pi.registerMarkdownTransformer((markdown, { messageType, isStreaming }) => {
|
|
1617
|
-
if (isStreaming || messageType === "assistant-thinking") return markdown;
|
|
1618
|
-
return markdown.replaceAll("-->", "→");
|
|
1619
|
-
});
|
|
1620
|
-
```
|
|
1621
|
-
|
|
1622
|
-
If a transformer throws, Pi keeps the Markdown produced so far and continues with the next transformer. The hook is display-only: the original message remains unchanged in the session and model context. It runs for new user messages, assistant streaming updates, restored session messages, and terminal width changes, so transformers should remain synchronous and inexpensive.
|
|
1623
|
-
|
|
1624
1700
|
### pi.registerEntryRenderer(customType, renderer)
|
|
1625
1701
|
|
|
1626
1702
|
Register a custom TUI renderer for custom entries with your `customType`. Custom entries are created with `pi.appendEntry()` and do not participate in LLM context.
|
|
@@ -2364,670 +2440,274 @@ Custom editors and `ctx.ui.custom()` components receive `keybindings: Keybinding
|
|
|
2364
2440
|
|
|
2365
2441
|
#### Fallback
|
|
2366
2442
|
|
|
2367
|
-
|
|
2368
|
-
- `renderCall`: Shows the tool name
|
|
2369
|
-
- `renderResult`: Shows raw text from `content`
|
|
2370
|
-
|
|
2371
|
-
### Dynamic Tool Loading
|
|
2372
|
-
|
|
2373
|
-
Extensions can register many tools while keeping only a small initial set active. A tool can then add more tools with `pi.setActiveTools()` during execution. Pi detects purely additive changes, records the newly available tool names on that tool result, and applies the updated active set before the next model request.
|
|
2374
|
-
|
|
2375
|
-
This works with every model. Models with native deferred-loading support preserve the stable prompt prefix and load the new definitions at the tool-result position. Other models use the fallback described below.
|
|
2376
|
-
|
|
2377
|
-
The lifecycle is:
|
|
2443
|
+
Extensions are TypeScript modules that add executable behavior to Pi. Use one when a workflow needs tools, commands, event handlers, model providers, session state, or terminal UI rather than instructions alone.
|
|
2378
2444
|
|
|
2379
|
-
|
|
2380
|
-
2. Keep loader tools, such as `search_tools`, active and leave searchable tools inactive.
|
|
2381
|
-
3. During loader execution, call `pi.setActiveTools([...currentTools, ...matchingTools])`. The change must be additive: do not remove currently active tools in the same call.
|
|
2382
|
-
4. Pi records which tools were added on the loader's tool result.
|
|
2383
|
-
5. Before the next model response, Pi exposes the added definitions using native deferred loading when supported, or the normal active tool list otherwise.
|
|
2445
|
+
An extension runs inside the Pi process with the same operating-system permissions. It can inspect prompts, tool calls, files, credentials, and session history, so load extensions only from sources you trust.
|
|
2384
2446
|
|
|
2385
|
-
|
|
2447
|
+
Typical extensions add an agent tool, protect paths, confirm dangerous commands, react to session events, modify context, expose a command, or display persistent status.
|
|
2386
2448
|
|
|
2387
|
-
|
|
2449
|
+
<a id="quick-start"></a>
|
|
2450
|
+
<a id="writing-an-extension"></a>
|
|
2451
|
+
<a id="create-an-extension"></a>
|
|
2388
2452
|
|
|
2389
|
-
|
|
2390
|
-
- **Models:** Sonnet, Opus, Fable version 4.5 or newer (without Haiku)
|
|
2391
|
-
- **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
|
|
2392
|
-
- **Fireworks Messages API**
|
|
2393
|
-
- **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
|
|
2394
|
-
- **Loader names:** Use `ToolSearch` or `tool_search` for prefix deferral. Other loader names still work, but Fireworks includes the loaded schemas in the initial tool prefix, losing the cache benefit.
|
|
2395
|
-
- This does not change API routing: Fireworks GLM models and Kimi K3 use Chat Completions, not Messages.
|
|
2396
|
-
- **OpenAI**
|
|
2397
|
-
- **Models:** `gpt-5.4` and newer family
|
|
2398
|
-
- **Native representation:** Pi adds completed client `tool_search_call` and `tool_search_output` items at the load point.
|
|
2453
|
+
## Create and load an extension
|
|
2399
2454
|
|
|
2400
|
-
|
|
2455
|
+
An extension exports a default factory that receives `ExtensionAPI`. The factory registers capabilities for the current extension runtime.
|
|
2401
2456
|
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
For all other models and providers, dynamic activation still works: Pi sends the complete current active tool list normally on the next request. The model can call the newly activated tools, but adding their definitions may invalidate the provider's cached prompt prefix.
|
|
2405
|
-
|
|
2406
|
-
Pi also uses this safe fallback when the active set is not purely additive, such as replacing one group of tools with another. Tool removals therefore work, but they do not use deferred loading.
|
|
2407
|
-
|
|
2408
|
-
For the best cache behavior, keep the loader tool active for the whole session and add tools instead of replacing the active set. Also note that activating a tool with `promptSnippet` or `promptGuidelines` rebuilds the system prompt; that system-prompt change can invalidate the prefix even when the provider supports deferred schemas. Lazily loaded tools should usually rely on their tool `description` and omit active-only prompt metadata.
|
|
2409
|
-
|
|
2410
|
-
#### Search tool example
|
|
2411
|
-
|
|
2412
|
-
The following extension registers two searchable tools, removes them from the initial active set, and keeps only `search_tools` as their loader. The example uses simple keyword matching, but the search implementation could use BM25, embeddings, a remote catalog, or project-specific routing.
|
|
2457
|
+
Create `~/.pi/agent/extensions/hello.ts`:
|
|
2413
2458
|
|
|
2414
2459
|
```typescript
|
|
2415
2460
|
import type { ExtensionAPI } from "@punch-bot/cli";
|
|
2416
|
-
import { Type } from "typebox";
|
|
2417
|
-
|
|
2418
|
-
const SEARCHABLE_TOOL_NAMES = new Set(["lookup_weather", "search_issues"]);
|
|
2419
2461
|
|
|
2420
2462
|
export default function (pi: ExtensionAPI) {
|
|
2421
|
-
pi.
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
parameters: Type.Object({ city: Type.String() }),
|
|
2426
|
-
async execute(_toolCallId, params) {
|
|
2427
|
-
return {
|
|
2428
|
-
content: [{ type: "text", text: `Weather for ${params.city}: sunny` }],
|
|
2429
|
-
details: {},
|
|
2430
|
-
};
|
|
2463
|
+
pi.registerCommand("hello", {
|
|
2464
|
+
description: "Show a greeting",
|
|
2465
|
+
handler: async (name, ctx) => {
|
|
2466
|
+
ctx.ui.notify(`Hello, ${name || "world"}!`, "info");
|
|
2431
2467
|
},
|
|
2432
2468
|
});
|
|
2469
|
+
}
|
|
2470
|
+
```
|
|
2433
2471
|
|
|
2434
|
-
|
|
2435
|
-
name: "search_issues",
|
|
2436
|
-
label: "Search Issues",
|
|
2437
|
-
description: "Search project issues by keyword",
|
|
2438
|
-
parameters: Type.Object({ query: Type.String() }),
|
|
2439
|
-
async execute(_toolCallId, params) {
|
|
2440
|
-
return {
|
|
2441
|
-
content: [{ type: "text", text: `No open issues matching ${params.query}` }],
|
|
2442
|
-
details: {},
|
|
2443
|
-
};
|
|
2444
|
-
},
|
|
2445
|
-
});
|
|
2472
|
+
Start Pi and run `/hello`. During development, load a file directly:
|
|
2446
2473
|
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
description: "Search for and enable tools relevant to a task",
|
|
2451
|
-
promptSnippet: "Search for additional tools when the active tools cannot perform the task",
|
|
2452
|
-
promptGuidelines: [
|
|
2453
|
-
"Use search_tools when a task requires a capability that is not currently available.",
|
|
2454
|
-
],
|
|
2455
|
-
parameters: Type.Object({
|
|
2456
|
-
query: Type.String({ description: "Capability or task to search for" }),
|
|
2457
|
-
limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 10 })),
|
|
2458
|
-
}),
|
|
2459
|
-
async execute(_toolCallId, params) {
|
|
2460
|
-
const terms = params.query.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
2461
|
-
const matches = pi.getAllTools()
|
|
2462
|
-
.filter((tool) => SEARCHABLE_TOOL_NAMES.has(tool.name))
|
|
2463
|
-
.map((tool) => ({
|
|
2464
|
-
tool,
|
|
2465
|
-
score: terms.reduce(
|
|
2466
|
-
(score, term) =>
|
|
2467
|
-
score + (`${tool.name} ${tool.description}`.toLowerCase().includes(term) ? 1 : 0),
|
|
2468
|
-
0,
|
|
2469
|
-
),
|
|
2470
|
-
}))
|
|
2471
|
-
.filter((match) => match.score > 0)
|
|
2472
|
-
.sort((a, b) => b.score - a.score)
|
|
2473
|
-
.slice(0, params.limit ?? 3)
|
|
2474
|
-
.map((match) => match.tool.name);
|
|
2475
|
-
|
|
2476
|
-
if (matches.length === 0) {
|
|
2477
|
-
return {
|
|
2478
|
-
content: [{ type: "text", text: `No tools found for: ${params.query}` }],
|
|
2479
|
-
details: { matches: [] },
|
|
2480
|
-
};
|
|
2481
|
-
}
|
|
2474
|
+
```bash
|
|
2475
|
+
pi --extension ./hello.ts
|
|
2476
|
+
```
|
|
2482
2477
|
|
|
2483
|
-
|
|
2484
|
-
const added = matches.filter((name) => !active.includes(name));
|
|
2485
|
-
pi.setActiveTools([...new Set([...active, ...added])]);
|
|
2478
|
+
Pi uses `jiti`, so local TypeScript extensions do not need a separate compilation step. Use [Pi packages](packages.md) for distributed extensions and dependencies.
|
|
2486
2479
|
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
text: added.length > 0
|
|
2491
|
-
? `Loaded tools: ${added.join(", ")}`
|
|
2492
|
-
: `Matching tools already active: ${matches.join(", ")}`,
|
|
2493
|
-
}],
|
|
2494
|
-
details: { matches, added },
|
|
2495
|
-
};
|
|
2496
|
-
},
|
|
2497
|
-
});
|
|
2480
|
+
<a id="extension-locations"></a>
|
|
2481
|
+
<a id="available-imports"></a>
|
|
2482
|
+
<a id="choose-where-it-loads"></a>
|
|
2498
2483
|
|
|
2499
|
-
|
|
2500
|
-
// Keep searchable tools registered but initially inactive. Preserve built-ins
|
|
2501
|
-
// and tools owned by other extensions, and keep the loader itself active.
|
|
2502
|
-
const initialTools = pi.getActiveTools().filter(
|
|
2503
|
-
(name) => !SEARCHABLE_TOOL_NAMES.has(name),
|
|
2504
|
-
);
|
|
2505
|
-
pi.setActiveTools([...new Set([...initialTools, "search_tools"])]);
|
|
2506
|
-
});
|
|
2507
|
-
}
|
|
2508
|
-
```
|
|
2484
|
+
## Add it to Pi
|
|
2509
2485
|
|
|
2510
|
-
|
|
2486
|
+
Place the extension in your user or project extensions directory. Pi loads direct TypeScript or JavaScript files and subdirectories containing an `index.ts` or `index.js` entry point.
|
|
2511
2487
|
|
|
2512
|
-
|
|
2488
|
+
Use a single file for a small extension and a directory for a multi-file implementation. Put npm dependencies in a nearby `package.json`. See [Configuration](configuration.md) for conventional locations and [Settings](settings.md#resources) for additional paths.
|
|
2513
2489
|
|
|
2514
|
-
|
|
2490
|
+
Reload replaces the extension runtime, so code after `await ctx.reload()` must not reuse state from the old runtime. Only personal and explicit command-line extensions can participate in the `project_trust` event that runs before project extensions load.
|
|
2515
2491
|
|
|
2516
|
-
|
|
2517
|
-
- Selection dialogs (SelectList)
|
|
2518
|
-
- Async operations with cancel (BorderedLoader)
|
|
2519
|
-
- Settings toggles (SettingsList)
|
|
2520
|
-
- Status indicators (setStatus)
|
|
2521
|
-
- Working message, visibility, and indicator during streaming (`setWorkingMessage`, `setWorkingVisible`, `setWorkingIndicator`)
|
|
2522
|
-
- Widgets above/below editor (setWidget)
|
|
2523
|
-
- Autocomplete providers layered on top of built-in slash/path completion (addAutocompleteProvider)
|
|
2524
|
-
- Custom footers (setFooter)
|
|
2492
|
+
<a id="understand-the-lifecycle"></a>
|
|
2525
2493
|
|
|
2526
|
-
|
|
2494
|
+
## Respect the runtime lifecycle
|
|
2527
2495
|
|
|
2528
|
-
|
|
2529
|
-
// Select from options
|
|
2530
|
-
const choice = await ctx.ui.select("Pick one:", ["A", "B", "C"]);
|
|
2496
|
+
The factory can be synchronous or asynchronous. Pi waits for an asynchronous factory before startup continues, allowing it to fetch configuration or register providers needed during startup.
|
|
2531
2497
|
|
|
2532
|
-
|
|
2533
|
-
|
|
2498
|
+
Do not start processes, sockets, watchers, or timers in the factory because some invocations load extensions without starting a session.
|
|
2499
|
+
Start long-lived resources from `session_start` or from the command or tool that needs them.
|
|
2500
|
+
Close session-scoped resources from an idempotent `session_shutdown` handler.
|
|
2534
2501
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2502
|
+
A run proceeds from input and `before_agent_start`, through model, message, and tool events, to `agent_end`.
|
|
2503
|
+
Pi counts as busy while a run starts, including the compaction check and `before_agent_start`, so messages sent meanwhile go into the starting run.
|
|
2504
|
+
Automatic retries, recovery, compaction, or queued work can continue afterward.
|
|
2505
|
+
<a id="agent_start--agent_end--agent_before_settle--agent_settled"></a>
|
|
2537
2506
|
|
|
2538
|
-
|
|
2539
|
-
|
|
2507
|
+
`agent_before_settle` is the final actionable boundary: it can append entries and request one continuation.
|
|
2508
|
+
`agent_settled` is final and notification-only; use it when an integration needs to know Pi will not continue automatically.
|
|
2540
2509
|
|
|
2541
|
-
|
|
2542
|
-
ctx.ui.notify("Done!", "info"); // "info" | "warning" | "error"
|
|
2543
|
-
```
|
|
2510
|
+
<a id="extensionapi-methods"></a>
|
|
2544
2511
|
|
|
2545
|
-
|
|
2512
|
+
## Choose an integration point
|
|
2546
2513
|
|
|
2547
|
-
|
|
2514
|
+
| Capability | Main API |
|
|
2515
|
+
|---|---|
|
|
2516
|
+
| Observe or modify lifecycle behavior | `pi.on()` |
|
|
2517
|
+
| Add a model-callable operation | `pi.registerTool()` |
|
|
2518
|
+
| Add a `/` command | `pi.registerCommand()` |
|
|
2519
|
+
| Add a shortcut or CLI flag | `pi.registerShortcut()` or `pi.registerFlag()` |
|
|
2520
|
+
| Send user or custom messages | `pi.sendUserMessage()` or `pi.sendMessage()` |
|
|
2521
|
+
| Persist non-context session data | `pi.appendEntry()` |
|
|
2522
|
+
| Change active tools, model, or thinking level | Session control methods on `pi` |
|
|
2523
|
+
| Add a model provider | `pi.registerProvider()` |
|
|
2524
|
+
| Add an MCP server | `pi.registerMcpServer()` |
|
|
2525
|
+
| Route each request to a model | [`pi.registerVirtualModel()`](virtual-models.md) |
|
|
2526
|
+
| Add terminal rendering | Renderer registration and `ctx.ui` |
|
|
2527
|
+
| Communicate with another extension | `pi.events` |
|
|
2548
2528
|
|
|
2549
|
-
|
|
2550
|
-
// Dialog shows "Title (5s)" → "Title (4s)" → ... → auto-dismisses at 0
|
|
2551
|
-
const confirmed = await ctx.ui.confirm(
|
|
2552
|
-
"Timed Confirmation",
|
|
2553
|
-
"This dialog will auto-cancel in 5 seconds. Confirm?",
|
|
2554
|
-
{ timeout: 5000 }
|
|
2555
|
-
);
|
|
2529
|
+
Use the exported declarations in [`extensions/types.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/extensions/types.ts) for exact event, context, tool, and result types.
|
|
2556
2530
|
|
|
2557
|
-
|
|
2558
|
-
// User confirmed
|
|
2559
|
-
} else {
|
|
2560
|
-
// User cancelled or timed out
|
|
2561
|
-
}
|
|
2562
|
-
```
|
|
2531
|
+
## Follow the extension contracts
|
|
2563
2532
|
|
|
2564
|
-
|
|
2565
|
-
-
|
|
2566
|
-
- `confirm()` returns `false`
|
|
2567
|
-
- `input()` returns `undefined`
|
|
2533
|
+
<a id="events"></a>
|
|
2534
|
+
<a id="work-with-events"></a>
|
|
2568
2535
|
|
|
2569
|
-
|
|
2536
|
+
### Events and concurrency
|
|
2570
2537
|
|
|
2571
|
-
|
|
2538
|
+
Handlers run in extension load and registration order. `pi.on()` returns a function that unsubscribes that registration; changes do not affect a dispatch already in progress.
|
|
2539
|
+
Some events notify; others transform data, replace results, or cancel an operation.
|
|
2540
|
+
Use each event’s declared result type rather than assuming every return value has an effect.
|
|
2572
2541
|
|
|
2573
|
-
|
|
2574
|
-
const controller = new AbortController();
|
|
2575
|
-
const timeoutId = setTimeout(() => controller.abort(), 5000);
|
|
2542
|
+
Events cover resource discovery, sessions, agent and message lifecycle, providers, tools, and raw input.
|
|
2576
2543
|
|
|
2577
|
-
|
|
2578
|
-
"Timed Confirmation",
|
|
2579
|
-
"This dialog will auto-cancel in 5 seconds. Confirm?",
|
|
2580
|
-
{ signal: controller.signal }
|
|
2581
|
-
);
|
|
2544
|
+
`before_agent_start` exposes both the current prompt and its structured `systemPromptOptions`. `event.messageType` says what started the run: `"user"` for a prompt or `pi.sendUserMessage()`, with `prompt` and `images`; `"custom"` for `pi.sendMessage(..., { triggerTurn: true })`, with the starting `message` and no `prompt`. A returned `message` is added to either kind of run; check `messageType` to skip runs started by custom messages. Prefer changing prompt sections, selected tools, or guidelines so Pi can append a transcript delta. Returning `systemPrompt`, or setting `forceSystemPrompt`, replaces the whole prompt for that run while the transcript continues recording the structured sections. Providers receive the forced text as their leading system prompt.
|
|
2582
2545
|
|
|
2583
|
-
|
|
2546
|
+
`message_end` can replace a finalized message while preserving its role. `tool_call` can mutate input or block execution. `tool_result` handlers compose, with each handler seeing prior changes.
|
|
2584
2547
|
|
|
2585
|
-
|
|
2586
|
-
// User confirmed
|
|
2587
|
-
} else if (controller.signal.aborted) {
|
|
2588
|
-
// Dialog timed out
|
|
2589
|
-
} else {
|
|
2590
|
-
// User cancelled (pressed Escape or selected "No")
|
|
2591
|
-
}
|
|
2592
|
-
```
|
|
2548
|
+
<a id="provider_stream_event"></a>
|
|
2593
2549
|
|
|
2594
|
-
|
|
2550
|
+
`provider_stream_event` fires for each parsed provider stream event before Pi normalizes it. The event identifies the provider, API, and model; `event.data` is the earliest structured value available to Pi, not necessarily the original HTTP bytes or SSE frame. Treat it as read-only because mutation can affect normalization. The event is notification-only and is not persisted.
|
|
2595
2551
|
|
|
2596
|
-
|
|
2552
|
+
Handlers are awaited in stream order, so slow handlers delay stream consumption. Handler errors are reported without changing the provider response. See [`debug-provider.ts`](../examples/extensions/debug-provider.ts) for an opt-in viewer that groups raw events by assistant message.
|
|
2597
2553
|
|
|
2598
|
-
|
|
2599
|
-
// Status in footer (persistent until cleared)
|
|
2600
|
-
ctx.ui.setStatus("my-ext", "Processing...");
|
|
2601
|
-
ctx.ui.setStatus("my-ext", undefined); // Clear
|
|
2554
|
+
<a id="context_with_system"></a>
|
|
2602
2555
|
|
|
2603
|
-
|
|
2604
|
-
ctx.ui.setWorkingMessage("Thinking deeply...");
|
|
2605
|
-
ctx.ui.setWorkingMessage(); // Restore default
|
|
2606
|
-
ctx.ui.setWorkingVisible(false); // Hide the built-in working loader row entirely
|
|
2607
|
-
ctx.ui.setWorkingVisible(true); // Show the built-in working loader row
|
|
2556
|
+
`context` transforms conversation messages without prompt and tool system messages; Pi restores that state afterward. Use `context_with_system` only when a request-local transformation must own the complete transcript, and keep a system message at index zero.
|
|
2608
2557
|
|
|
2609
|
-
|
|
2610
|
-
ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] }); // Static dot
|
|
2611
|
-
ctx.ui.setWorkingIndicator({
|
|
2612
|
-
frames: [
|
|
2613
|
-
ctx.ui.theme.fg("dim", "·"),
|
|
2614
|
-
ctx.ui.theme.fg("muted", "•"),
|
|
2615
|
-
ctx.ui.theme.fg("accent", "●"),
|
|
2616
|
-
ctx.ui.theme.fg("muted", "•"),
|
|
2617
|
-
],
|
|
2618
|
-
intervalMs: 120,
|
|
2619
|
-
});
|
|
2620
|
-
ctx.ui.setWorkingIndicator({ frames: [] }); // Hide indicator
|
|
2621
|
-
ctx.ui.setWorkingIndicator(); // Restore default spinner
|
|
2622
|
-
|
|
2623
|
-
// Widget above editor (default)
|
|
2624
|
-
ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"]);
|
|
2625
|
-
// Widget below editor
|
|
2626
|
-
ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"], { placement: "belowEditor" });
|
|
2627
|
-
ctx.ui.setWidget("my-widget", (tui, theme) => new Text(theme.fg("accent", "Custom"), 0, 0));
|
|
2628
|
-
ctx.ui.setWidget("my-widget", undefined); // Clear
|
|
2629
|
-
|
|
2630
|
-
// Custom footer (replaces built-in footer entirely)
|
|
2631
|
-
ctx.ui.setFooter((tui, theme) => ({
|
|
2632
|
-
render(width) { return [theme.fg("dim", "Custom footer")]; },
|
|
2633
|
-
invalidate() {},
|
|
2634
|
-
}));
|
|
2635
|
-
ctx.ui.setFooter(undefined); // Restore built-in footer
|
|
2636
|
-
|
|
2637
|
-
// Terminal title
|
|
2638
|
-
ctx.ui.setTitle("pi - my-project");
|
|
2639
|
-
|
|
2640
|
-
// Editor text
|
|
2641
|
-
ctx.ui.setEditorText("Prefill text");
|
|
2642
|
-
const current = ctx.ui.getEditorText();
|
|
2643
|
-
|
|
2644
|
-
// Paste into editor (triggers paste handling, including collapse for large content)
|
|
2645
|
-
ctx.ui.pasteToEditor("pasted content");
|
|
2646
|
-
|
|
2647
|
-
// Stack custom autocomplete behavior on top of the built-in provider
|
|
2648
|
-
ctx.ui.addAutocompleteProvider((current) => ({
|
|
2649
|
-
triggerCharacters: ["#"],
|
|
2650
|
-
async getSuggestions(lines, line, col, options) {
|
|
2651
|
-
const beforeCursor = (lines[line] ?? "").slice(0, col);
|
|
2652
|
-
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
2653
|
-
if (!match) {
|
|
2654
|
-
return current.getSuggestions(lines, line, col, options);
|
|
2655
|
-
}
|
|
2558
|
+
`turn_end` and `agent_before_settle` are actionable boundaries. Their handlers can chain proposed `custom`, `custom_message`, `context_edit`, or `compaction` entries and return `continue: true` for one next model request. Guard continuation conditions because an unconditional continuation can loop. Use the exported event declarations for the complete validation and ordering contract.
|
|
2656
2559
|
|
|
2657
|
-
|
|
2658
|
-
prefix: `#${match[1] ?? ""}`,
|
|
2659
|
-
items: [{ value: "#2983", label: "#2983", description: "Extension API for autocomplete" }],
|
|
2660
|
-
};
|
|
2661
|
-
},
|
|
2662
|
-
applyCompletion(lines, line, col, item, prefix) {
|
|
2663
|
-
return current.applyCompletion(lines, line, col, item, prefix);
|
|
2664
|
-
},
|
|
2665
|
-
shouldTriggerFileCompletion(lines, line, col) {
|
|
2666
|
-
return current.shouldTriggerFileCompletion?.(lines, line, col) ?? true;
|
|
2667
|
-
},
|
|
2668
|
-
}));
|
|
2669
|
-
|
|
2670
|
-
// Tool output expansion
|
|
2671
|
-
const wasExpanded = ctx.ui.getToolsExpanded();
|
|
2672
|
-
ctx.ui.setToolsExpanded(true);
|
|
2673
|
-
ctx.ui.setToolsExpanded(wasExpanded);
|
|
2674
|
-
|
|
2675
|
-
// Custom editor (vim mode, emacs mode, etc.)
|
|
2676
|
-
ctx.ui.setEditorComponent((tui, theme, keybindings) => new VimEditor(tui, theme, keybindings));
|
|
2677
|
-
const currentEditor = ctx.ui.getEditorComponent();
|
|
2678
|
-
ctx.ui.setEditorComponent((tui, theme, keybindings) =>
|
|
2679
|
-
new WrappedEditor(tui, theme, keybindings, currentEditor?.(tui, theme, keybindings))
|
|
2680
|
-
);
|
|
2681
|
-
ctx.ui.setEditorComponent(undefined); // Restore default editor
|
|
2682
|
-
|
|
2683
|
-
// Theme management (see themes.md for creating themes)
|
|
2684
|
-
const themes = ctx.ui.getAllThemes(); // [{ name: "dark", path: "/..." | undefined }, ...]
|
|
2685
|
-
const lightTheme = ctx.ui.getTheme("light"); // Load without switching
|
|
2686
|
-
const result = ctx.ui.setTheme("light"); // Switch by name
|
|
2687
|
-
if (!result.success) {
|
|
2688
|
-
ctx.ui.notify(`Failed: ${result.error}`, "error");
|
|
2689
|
-
}
|
|
2690
|
-
ctx.ui.setTheme(lightTheme!); // Or switch by Theme object
|
|
2691
|
-
ctx.ui.theme.fg("accent", "styled text"); // Access current theme
|
|
2692
|
-
```
|
|
2560
|
+
<a id="cache_warming_decision"></a>
|
|
2693
2561
|
|
|
2694
|
-
|
|
2562
|
+
`cache_warming_decision` can override an idle prompt-cache refresh with `{ action: "warm" }` or `{ action: "stop" }`. The last handler that returns an action wins.
|
|
2695
2563
|
|
|
2696
|
-
|
|
2564
|
+
Tool calls from one assistant message can run in parallel.
|
|
2565
|
+
Do not assume a sibling call or result exists when another tool event runs.
|
|
2566
|
+
Use `ctx.signal` for nested work owned by an active turn; commands and idle session events often have no operation signal.
|
|
2697
2567
|
|
|
2698
|
-
|
|
2568
|
+
A `user_bash` handler that returns `undefined` passes the command to the next handler and then to local execution if no handler handles it. Returning `operations` or `result` stops propagation. A handler failure blocks the command rather than falling through to local execution.
|
|
2699
2569
|
|
|
2700
|
-
|
|
2570
|
+
<a id="custom-tools"></a>
|
|
2571
|
+
<a id="register-tools"></a>
|
|
2701
2572
|
|
|
2702
|
-
|
|
2703
|
-
- return your own suggestions when your extension-specific syntax matches
|
|
2704
|
-
- otherwise delegate to `current.getSuggestions(...)`
|
|
2705
|
-
- delegate `applyCompletion(...)` unless you need custom insertion behavior
|
|
2573
|
+
### Tools
|
|
2706
2574
|
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
triggerCharacters: ["#"],
|
|
2711
|
-
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
2712
|
-
const line = lines[cursorLine] ?? "";
|
|
2713
|
-
const beforeCursor = line.slice(0, cursorCol);
|
|
2714
|
-
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
2715
|
-
if (!match) {
|
|
2716
|
-
return current.getSuggestions(lines, cursorLine, cursorCol, options);
|
|
2717
|
-
}
|
|
2575
|
+
A custom tool defines a name, model-facing description, TypeBox parameter schema, and `execute()` function.
|
|
2576
|
+
Its result requires model-facing `content` and a `details` field for rendering or state reconstruction.
|
|
2577
|
+
Use `details: undefined` when there are no structured details. If the tool makes nested model calls, include their `usage` in the result so session totals remain accurate.
|
|
2718
2578
|
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
{ value: "#2983", label: "#2983", description: "Extension API for registering custom @ autocomplete providers" },
|
|
2723
|
-
{ value: "#2753", label: "#2753", description: "Reload stale resource settings" },
|
|
2724
|
-
],
|
|
2725
|
-
};
|
|
2726
|
-
},
|
|
2579
|
+
Throw from `execute()` to produce a failed tool result.
|
|
2580
|
+
Returning an object does not mark it as an error.
|
|
2581
|
+
Return `terminate: true` only when the agent should skip its automatic follow-up after every completed tool in that batch agrees to terminate.
|
|
2727
2582
|
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2583
|
+
Use sequential execution when tools share mutable in-memory state.
|
|
2584
|
+
File-mutating tools should wrap the complete read-modify-write operation with `withFileMutationQueue()`.
|
|
2585
|
+
Truncate large model-facing results and tell the model where to read the complete output.
|
|
2731
2586
|
|
|
2732
|
-
|
|
2733
|
-
return current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
|
|
2734
|
-
},
|
|
2735
|
-
}));
|
|
2736
|
-
});
|
|
2737
|
-
```
|
|
2587
|
+
Declare `outputSchema` and return a matching `structuredContent` when the result is data. The model still receives `content`; programmatic callers such as codemode scripts receive `structuredContent` instead of the text. Tools without `outputSchema` are passed to scripts as their text content. To report a failure that still carries data, return the result with `isError: true` instead of throwing: the model sees an error, and scripts still receive `structuredContent`.
|
|
2738
2588
|
|
|
2739
|
-
|
|
2589
|
+
A tool can run other tools with `ctx.executeTool(name, args, { signal, onUpdate })`. Nested calls go through argument validation and the `tool_call` and `tool_result` handlers like model-issued calls, and emit `tool_execution_start`, `tool_execution_update`, and `tool_execution_end`; all of these events carry `parentToolCallId`, and their `toolCallId` is assigned by pi as `<parent id>/<n>`. These ids do not appear as tool calls or tool results in the transcript. Nested calls do not add transcript entries: their results only reach the calling tool, which reports them itself, for example through `onUpdate` and `details`. The session keeps a bounded record of them (name, arguments, status, duration, error; never results) as `nestedCalls` on the calling tool's result message. It is used for compaction file lists and shown in HTML exports. Arguments over 8 KiB per call or 32 KiB per tool result are omitted, at most 256 calls are kept, and `complete: false` marks a record that lost anything. The `usage` of nested results, at every depth, is added to the calling tool's result `usage`, so a tool reports only its own usage, not that of the tools it called. `ctx.tools` lists the tools `ctx.executeTool()` can call. `tool_result` handlers that redact `content` should also replace `structuredContent`; replacing only `content` drops it.
|
|
2740
2590
|
|
|
2741
|
-
|
|
2591
|
+
See [`hello.ts`](../examples/extensions/hello.ts), [`todo.ts`](../examples/extensions/todo.ts), [`dynamic-tools.ts`](../examples/extensions/dynamic-tools.ts), and [`truncated-tool.ts`](../examples/extensions/truncated-tool.ts).
|
|
2742
2592
|
|
|
2743
|
-
|
|
2593
|
+
### Tool exposure
|
|
2744
2594
|
|
|
2745
|
-
|
|
2746
|
-
import { Text, Component } from "@punch-bot/tui";
|
|
2595
|
+
`exposure` controls how the model reaches a tool. "Callable" means callable from other tools through `ctx.executeTool()` (`ctx.tools`), as the `codemode` tool's scripts do:
|
|
2747
2596
|
|
|
2748
|
-
|
|
2749
|
-
|
|
2597
|
+
- `direct` (default): declared to the model while active, and callable while active.
|
|
2598
|
+
- `model-only`: declared to the model while active, never callable. Use it for tools that orchestrate other tools or ask the user.
|
|
2599
|
+
- `codemode`: callable whenever registered, and listed by the `codemode` tool. Not declared to the model unless activated explicitly.
|
|
2600
|
+
- `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
|
|
2601
|
+
- `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
|
|
2750
2602
|
|
|
2751
|
-
|
|
2752
|
-
if (key === "return") done(true);
|
|
2753
|
-
if (key === "escape") done(false);
|
|
2754
|
-
return true;
|
|
2755
|
-
};
|
|
2603
|
+
`namespace: { name, aliases, description, instructions }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading with its `description`. `instructions` holds longer usage guidance; it is not listed, and codemode scripts read it with `describeNamespace(name)`. `aliases` are other names scripts may look the namespace up by, for example the server name `docs` for `mcp__docs`; a name and the same name as a script identifier (`my-docs`, `my_docs`) match alike.
|
|
2756
2604
|
|
|
2757
|
-
|
|
2758
|
-
});
|
|
2605
|
+
Registering a `direct` or `model-only` tool activates it; the other exposures are not activated on registration. The active set (`pi.getActiveTools()`, `pi.setActiveTools()`) is the set of tools declared to the model. `pi.getAllTools()` reports each tool's `exposure`, `namespace`, `annotations`, and `reachesTools`.
|
|
2759
2606
|
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2607
|
+
`annotations` are hints about what a tool does, with the meaning of MCP tool annotations: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. MCP tools carry the hints their server declares. Missing hints take the MCP defaults: a tool is not read-only, and may be destructive and reach an open world. The hints are not verified, but a permission extension can use them to decide which calls to confirm. This confirms the calls Codex asks approval for:
|
|
2608
|
+
|
|
2609
|
+
```typescript
|
|
2610
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
2611
|
+
const hints = pi.getAllTools().find((tool) => tool.name === event.toolName)?.annotations;
|
|
2612
|
+
const needsApproval =
|
|
2613
|
+
hints?.destructiveHint === true ||
|
|
2614
|
+
(!hints?.readOnlyHint && ((hints?.destructiveHint ?? true) || (hints?.openWorldHint ?? true)));
|
|
2615
|
+
if (needsApproval && !(await ctx.ui.confirm("Allow tool call?", event.toolName))) {
|
|
2616
|
+
return { block: true, reason: `${event.toolName} was not approved` };
|
|
2617
|
+
}
|
|
2618
|
+
});
|
|
2763
2619
|
```
|
|
2764
2620
|
|
|
2765
|
-
The
|
|
2766
|
-
- `tui` - TUI instance (for screen dimensions, focus management)
|
|
2767
|
-
- `theme` - Current theme for styling
|
|
2768
|
-
- `keybindings` - App keybinding manager (for checking shortcuts)
|
|
2769
|
-
- `done(value)` - Call to close component and return value
|
|
2621
|
+
A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure, namespace, and prompt guidelines. It returns replacement `descriptions` for declared tools (including its own) and `hiddenDeclarations`: active tools whose declarations requests leave out while they stay active and callable. The default system prompt leaves hidden tools out of its tool list and rules, and names no tool in the skills hint when the file reader is hidden, so the orchestrating tool should present their guidelines itself. `codemode` uses only this hook, `exposure`, `reachesTools`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
|
|
2770
2622
|
|
|
2771
|
-
|
|
2623
|
+
A tool that reaches other tools declares which ones a call may reach with `reachesTools(input)`: `"all"`, or the words of the input that may name them, where a word refers to every tool or namespace whose name it contains. `codemode` returns `"all"` for scripts that search or list tools and the words of the script otherwise; `tool_search` always returns `"all"`. Extensions that register tools late use it from their `tool_call` handler to finish registering the tools a call needs before it runs, as the MCP extension does for servers that are still connecting. The MCP extension also activates `codemode` or `tool_search` for MCP tools only when the tool of that name declares `reachesTools`.
|
|
2772
2624
|
|
|
2773
|
-
|
|
2625
|
+
### Activate tools dynamically
|
|
2774
2626
|
|
|
2775
|
-
|
|
2627
|
+
Register every tool first, keep optional tools inactive, and use `pi.setActiveTools()` from a loader tool to select the desired active tools. Names must already be registered; unknown names are ignored.
|
|
2776
2628
|
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
{ overlay: true }
|
|
2781
|
-
);
|
|
2782
|
-
```
|
|
2629
|
+
Pi records the initial prompt and tool set in the transcript's first system message, then appends tool and prompt changes before the next model request. Providers that cannot represent the transition receive a complete transcript checkpoint, which can invalidate the cached prefix.
|
|
2630
|
+
|
|
2631
|
+
### MCP servers
|
|
2783
2632
|
|
|
2784
|
-
|
|
2633
|
+
`pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `description`, `enabled`, and `timeout`.
|
|
2785
2634
|
|
|
2786
2635
|
```typescript
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
{
|
|
2790
|
-
overlay: true,
|
|
2791
|
-
overlayOptions: { anchor: "top-right", width: "50%", margin: 2 },
|
|
2792
|
-
onHandle: (handle) => {
|
|
2793
|
-
handle.focus(); // focus this overlay and bring it to the visual front
|
|
2794
|
-
// handle.unfocus({ target: editorComponent }); // release input to a specific component
|
|
2795
|
-
// handle.setHidden(true/false); // toggle visibility
|
|
2796
|
-
// handle.hide(); // permanently remove
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
);
|
|
2636
|
+
pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira", exposure: "codemode" });
|
|
2637
|
+
pi.unregisterMcpServer("jira");
|
|
2800
2638
|
```
|
|
2801
2639
|
|
|
2802
|
-
|
|
2640
|
+
Servers registered while the extension loads connect when the session starts, together with the `mcp.json` servers; servers registered later connect right away, and `pi.unregisterMcpServer()` closes the connection and makes the server's tools unreachable. Registrations are not saved: register again on every load, for example based on the extension's own settings. A server in `mcp.json` with the same name takes precedence, and `/mcp` shows the override. Registering the same name again replaces the extension's earlier registration; names registered by another extension, invalid names, and invalid configs throw.
|
|
2803
2641
|
|
|
2804
|
-
|
|
2642
|
+
The built-in MCP support connects registered servers. When nothing does, because another extension replaced it (see [MCP](mcp.md#other-mcp-extensions)), each registration is reported as an extension error. Other MCP extensions can connect registered servers too: read them with `pi.getMcpServers()` on `session_start` and handle the `mcp_servers_change` event for later changes.
|
|
2805
2643
|
|
|
2806
|
-
|
|
2644
|
+
<a id="extensioncontext"></a>
|
|
2645
|
+
<a id="extensioncommandcontext"></a>
|
|
2646
|
+
<a id="use-extension-context"></a>
|
|
2807
2647
|
|
|
2808
|
-
|
|
2648
|
+
### Context and session changes
|
|
2809
2649
|
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
import { matchesKey } from "@punch-bot/tui";
|
|
2650
|
+
`ExtensionContext` provides the working directory, mode, UI, session manager, model runtime, abort signal, context usage, and controls for compaction and shutdown.
|
|
2651
|
+
Use `ctx.modelRegistry.streamSimple()` for provider-neutral nested model calls.
|
|
2813
2652
|
|
|
2814
|
-
|
|
2815
|
-
|
|
2653
|
+
Command handlers receive `ExtensionCommandContext`, which adds operations for waiting until idle, reloading, tree navigation, and session replacement.
|
|
2654
|
+
These operations are command-only because calling them from lifecycle handlers can deadlock the runtime.
|
|
2816
2655
|
|
|
2817
|
-
|
|
2818
|
-
if (matchesKey(data, "escape") && this.mode === "insert") {
|
|
2819
|
-
this.mode = "normal";
|
|
2820
|
-
return;
|
|
2821
|
-
}
|
|
2822
|
-
if (this.mode === "normal" && data === "i") {
|
|
2823
|
-
this.mode = "insert";
|
|
2824
|
-
return;
|
|
2825
|
-
}
|
|
2826
|
-
super.handleInput(data); // App keybindings + text editing
|
|
2827
|
-
}
|
|
2828
|
-
}
|
|
2656
|
+
Session replacement invalidates the old context. Capture only plain data before switching, then use the fresh context supplied to `withSession` for session-bound work.
|
|
2829
2657
|
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
ctx.ui.setEditorComponent((tui, theme, keybindings) =>
|
|
2833
|
-
new VimEditor(tui, theme, keybindings)
|
|
2834
|
-
);
|
|
2835
|
-
});
|
|
2836
|
-
}
|
|
2837
|
-
```
|
|
2658
|
+
<a id="state-management"></a>
|
|
2659
|
+
<a id="persist-state"></a>
|
|
2838
2660
|
|
|
2839
|
-
|
|
2840
|
-
- Extend `CustomEditor` (not base `Editor`) to get app keybindings (escape to abort, ctrl+d, model switching)
|
|
2841
|
-
- Call `super.handleInput(data)` for keys you don't handle
|
|
2842
|
-
- Custom editors keep the standalone working row by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to use the built-in editor-border spinner instead.
|
|
2843
|
-
- Factory receives `tui`, `theme`, and `keybindings` from the app
|
|
2844
|
-
- Use `ctx.ui.getEditorComponent()` before `setEditorComponent()` to wrap the previously configured custom editor
|
|
2845
|
-
- Pass `undefined` to restore default: `ctx.ui.setEditorComponent(undefined)`
|
|
2661
|
+
### State
|
|
2846
2662
|
|
|
2847
|
-
|
|
2663
|
+
Choose storage based on how state participates in the conversation:
|
|
2848
2664
|
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
)
|
|
2854
|
-
|
|
2665
|
+
| State | Storage |
|
|
2666
|
+
|---|---|
|
|
2667
|
+
| Tool state that follows the active branch | Tool-result `details` |
|
|
2668
|
+
| Durable data excluded from model context | `pi.appendEntry()` |
|
|
2669
|
+
| Custom content stored and sent to the model | `pi.sendMessage()` |
|
|
2670
|
+
| Data outside one session | External storage |
|
|
2855
2671
|
|
|
2856
|
-
|
|
2672
|
+
Reconstruct branch-sensitive state from `ctx.sessionManager.getBranch()` during `session_start`.
|
|
2673
|
+
Do not rebuild it from every file entry because abandoned branches represent alternative histories.
|
|
2674
|
+
Register an entry or message renderer when custom stored content should appear in the transcript.
|
|
2857
2675
|
|
|
2858
|
-
|
|
2676
|
+
<a id="custom-ui"></a>
|
|
2677
|
+
<a id="mode-behavior"></a>
|
|
2678
|
+
<a id="interact-with-the-user"></a>
|
|
2679
|
+
<a id="account-for-each-mode"></a>
|
|
2859
2680
|
|
|
2860
|
-
|
|
2681
|
+
### UI and modes
|
|
2861
2682
|
|
|
2862
|
-
|
|
2863
|
-
|
|
2683
|
+
`ctx.ui` provides dialogs, notifications, status text, widgets, titles, editor access, and custom components.
|
|
2684
|
+
Use `ctx.ui.custom()` only when the interaction needs its own rendering and input.
|
|
2685
|
+
See [Terminal UI](tui.md) for component, focus, overlay, theme, and performance guidance.
|
|
2864
2686
|
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2687
|
+
Extensions load in interactive, RPC, JSON, and print modes.
|
|
2688
|
+
Interactive mode provides the complete terminal UI.
|
|
2689
|
+
RPC can forward supported dialogs and notifications through the [RPC Extension UI protocol](rpc-extension-ui.md), but not custom terminal components; JSON and print modes have no UI.
|
|
2690
|
+
Guard terminal-only behavior with `ctx.mode === "tui"` and use `ctx.hasUI` for interactions supported by interactive and RPC clients.
|
|
2869
2691
|
|
|
2870
|
-
|
|
2871
|
-
text += "\n" + theme.fg("dim", JSON.stringify(message.details, null, 2));
|
|
2872
|
-
}
|
|
2692
|
+
Keep tool and event behavior independent from rendering so non-interactive modes remain functional.
|
|
2873
2693
|
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
```
|
|
2694
|
+
<a id="error-handling"></a>
|
|
2695
|
+
<a id="handle-errors-and-shutdown"></a>
|
|
2877
2696
|
|
|
2878
|
-
|
|
2697
|
+
### Errors and cleanup
|
|
2879
2698
|
|
|
2880
|
-
|
|
2881
|
-
pi.sendMessage({
|
|
2882
|
-
customType: "my-extension", // Matches registerMessageRenderer
|
|
2883
|
-
content: "Status update",
|
|
2884
|
-
display: true, // Show in TUI
|
|
2885
|
-
details: { ... }, // Available in renderer
|
|
2886
|
-
});
|
|
2887
|
-
```
|
|
2699
|
+
Pi reports handler errors and continues where possible. A `tool_call` handler failure blocks the tool as a fail-safe; a tool execution failure becomes an error result for the model.
|
|
2888
2700
|
|
|
2889
|
-
|
|
2701
|
+
Release resources in `session_shutdown` even when normal operation attempted cleanup.
|
|
2702
|
+
Keep cleanup idempotent because cancellation, reload, session replacement, and process exit can converge on the same path.
|
|
2703
|
+
Use `ctx.shutdown()` to request an orderly process shutdown.
|
|
2890
2704
|
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2705
|
+
<a id="examples-reference"></a>
|
|
2706
|
+
<a id="use-examples-as-the-implementation-reference"></a>
|
|
2707
|
+
|
|
2708
|
+
## Examples and reference
|
|
2709
|
+
|
|
2710
|
+
The checked [extension examples](../examples/extensions/) cover tools, lifecycle events, commands, flags, shortcuts, state, rendering, providers, OAuth, remote execution, and terminal components.
|
|
2711
|
+
Start with the smallest example matching your integration point.
|
|
2895
2712
|
|
|
2896
|
-
|
|
2897
|
-
```
|
|
2898
|
-
|
|
2899
|
-
### Theme Colors
|
|
2900
|
-
|
|
2901
|
-
All render functions receive a `theme` object. See [themes.md](themes.md) for creating custom themes and the full color palette.
|
|
2902
|
-
|
|
2903
|
-
```typescript
|
|
2904
|
-
// Foreground colors
|
|
2905
|
-
theme.fg("toolTitle", text) // Tool names
|
|
2906
|
-
theme.fg("accent", text) // Highlights
|
|
2907
|
-
theme.fg("success", text) // Success (green)
|
|
2908
|
-
theme.fg("error", text) // Errors (red)
|
|
2909
|
-
theme.fg("warning", text) // Warnings (yellow)
|
|
2910
|
-
theme.fg("muted", text) // Secondary text
|
|
2911
|
-
theme.fg("dim", text) // Tertiary text
|
|
2912
|
-
|
|
2913
|
-
// Text styles
|
|
2914
|
-
theme.bold(text)
|
|
2915
|
-
theme.italic(text)
|
|
2916
|
-
theme.strikethrough(text)
|
|
2917
|
-
```
|
|
2918
|
-
|
|
2919
|
-
For syntax highlighting in custom tool renderers:
|
|
2920
|
-
|
|
2921
|
-
```typescript
|
|
2922
|
-
import { highlightCode, getLanguageFromPath } from "@punch-bot/cli";
|
|
2923
|
-
|
|
2924
|
-
// Highlight code with explicit language
|
|
2925
|
-
const highlighted = highlightCode("const x = 1;", "typescript", theme);
|
|
2926
|
-
|
|
2927
|
-
// Auto-detect language from file path
|
|
2928
|
-
const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
|
|
2929
|
-
const highlighted = highlightCode(code, lang, theme);
|
|
2930
|
-
```
|
|
2931
|
-
|
|
2932
|
-
## Error Handling
|
|
2933
|
-
|
|
2934
|
-
- Extension errors are logged, agent continues
|
|
2935
|
-
- `tool_call` errors block the tool (fail-safe)
|
|
2936
|
-
- Tool `execute` errors must be signaled by throwing; the thrown error is caught, reported to the LLM with `isError: true`, and execution continues
|
|
2937
|
-
|
|
2938
|
-
## Mode Behavior
|
|
2939
|
-
|
|
2940
|
-
| Mode | `ctx.mode` | `ctx.hasUI` | Notes |
|
|
2941
|
-
|------|------------|-------------|-------|
|
|
2942
|
-
| Interactive | `"tui"` | `true` | Full TUI with terminal rendering |
|
|
2943
|
-
| RPC (`--mode rpc`) | `"rpc"` | `true` | Dialogs and notifications via JSON protocol; `custom()` returns `undefined`. See [rpc.md](rpc.md) |
|
|
2944
|
-
| JSON (`--mode json`) | `"json"` | `false` | Event stream to stdout; UI methods are no-ops |
|
|
2945
|
-
| Print (`-p`) | `"print"` | `false` | Extensions run but can't prompt |
|
|
2946
|
-
|
|
2947
|
-
Use `ctx.mode === "tui"` before TUI-specific features (`custom()`, component factories, terminal input). Use `ctx.hasUI` before dialog and notification methods that work in both TUI and RPC modes.
|
|
2948
|
-
|
|
2949
|
-
## Examples Reference
|
|
2950
|
-
|
|
2951
|
-
All examples in [examples/extensions/](../examples/extensions/).
|
|
2952
|
-
|
|
2953
|
-
| Example | Description | Key APIs |
|
|
2954
|
-
|---------|-------------|----------|
|
|
2955
|
-
| **Tools** |||
|
|
2956
|
-
| `hello.ts` | Minimal tool registration | `registerTool` |
|
|
2957
|
-
| `question.ts` | Tool with user interaction | `registerTool`, `ui.select` |
|
|
2958
|
-
| `questionnaire.ts` | Multi-step wizard tool | `registerTool`, `ui.custom` |
|
|
2959
|
-
| `todo.ts` | Stateful tool with persistence | `registerTool`, `appendEntry`, `renderResult`, session events |
|
|
2960
|
-
| `dynamic-tools.ts` | Register tools after startup and during commands | `registerTool`, `session_start`, `registerCommand` |
|
|
2961
|
-
| `structured-output.ts` | Final structured-output tool with `terminate: true` | `registerTool`, terminating tool results |
|
|
2962
|
-
| `truncated-tool.ts` | Output truncation example | `registerTool`, `truncateHead` |
|
|
2963
|
-
| `tool-override.ts` | Override built-in read tool | `registerTool` (same name as built-in) |
|
|
2964
|
-
| **Commands** |||
|
|
2965
|
-
| `pirate.ts` | Modify system prompt per-turn | `registerCommand`, `before_agent_start` |
|
|
2966
|
-
| `summarize.ts` | Conversation summary command | `registerCommand`, `ui.custom` |
|
|
2967
|
-
| `handoff.ts` | Cross-provider model handoff | `registerCommand`, `ui.editor`, `ui.custom` |
|
|
2968
|
-
| `qna.ts` | Q&A with custom UI | `registerCommand`, `ui.custom`, `setEditorText` |
|
|
2969
|
-
| `send-user-message.ts` | Inject user messages | `registerCommand`, `sendUserMessage` |
|
|
2970
|
-
| `reload-runtime.ts` | Reload command and LLM tool handoff | `registerCommand`, `ctx.reload()`, `sendUserMessage` |
|
|
2971
|
-
| `shutdown-command.ts` | Graceful shutdown command | `registerCommand`, `shutdown()` |
|
|
2972
|
-
| **Events & Gates** |||
|
|
2973
|
-
| `permission-gate.ts` | Block dangerous commands | `on("tool_call")`, `ui.confirm` |
|
|
2974
|
-
| `project-trust.ts` | Decide or defer project trust from a user/global or CLI extension | `on("project_trust")`, trust UI, required trust result |
|
|
2975
|
-
| `protected-paths.ts` | Block writes to specific paths | `on("tool_call")` |
|
|
2976
|
-
| `confirm-destructive.ts` | Confirm session changes | `on("session_before_switch")`, `on("session_before_fork")` |
|
|
2977
|
-
| `dirty-repo-guard.ts` | Warn on dirty git repo | `on("session_before_*")`, `exec` |
|
|
2978
|
-
| `input-transform.ts` | Transform user input | `on("input")` |
|
|
2979
|
-
| `input-transform-streaming.ts` | Streaming-aware input transform | `on("input")`, `streamingBehavior` |
|
|
2980
|
-
| `model-status.ts` | React to model changes | `on("model_select")`, `setStatus` |
|
|
2981
|
-
| `provider-payload.ts` | Inspect payloads and provider response headers | `on("before_provider_request")`, `on("after_provider_response")` |
|
|
2982
|
-
| `system-prompt-header.ts` | Display system prompt info | `on("agent_start")`, `getSystemPrompt` |
|
|
2983
|
-
| `claude-rules.ts` | Load rules from files | `on("session_start")`, `on("before_agent_start")` |
|
|
2984
|
-
| `prompt-customizer.ts` | Add context-aware tool guidance using `systemPromptOptions` | `on("before_agent_start")`, `BuildSystemPromptOptions` |
|
|
2985
|
-
| `file-trigger.ts` | File watcher triggers messages | `sendMessage` |
|
|
2986
|
-
| **Compaction & Sessions** |||
|
|
2987
|
-
| `custom-compaction.ts` | Custom compaction summary | `on("session_before_compact")` |
|
|
2988
|
-
| `trigger-compact.ts` | Trigger compaction manually | `compact()` |
|
|
2989
|
-
| `git-checkpoint.ts` | Git stash on turns | `on("turn_start")`, `on("session_before_fork")`, `exec` |
|
|
2990
|
-
| `git-merge-and-resolve.ts` | Fetch, merge, and resolve conflicts | `on("agent_end")`, `exec`, `sendUserMessage` |
|
|
2991
|
-
| `auto-commit-on-exit.ts` | Commit on shutdown | `on("session_shutdown")`, `exec` |
|
|
2992
|
-
| **UI Components** |||
|
|
2993
|
-
| `status-line.ts` | Footer status indicator | `setStatus`, session events |
|
|
2994
|
-
| `working-indicator.ts` | Customize the streaming working indicator | `setWorkingIndicator`, `registerCommand` |
|
|
2995
|
-
| `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` |
|
|
2996
|
-
| `custom-footer.ts` | Replace footer entirely | `registerCommand`, `setFooter` |
|
|
2997
|
-
| `custom-header.ts` | Replace startup header | `on("session_start")`, `setHeader` |
|
|
2998
|
-
| `modal-editor.ts` | Vim-style modal editor | `setEditorComponent`, `CustomEditor` |
|
|
2999
|
-
| `rainbow-editor.ts` | Custom editor styling | `setEditorComponent` |
|
|
3000
|
-
| `widget-placement.ts` | Widget above/below editor | `setWidget` |
|
|
3001
|
-
| `overlay-test.ts` | Overlay components | `ui.custom` with overlay options |
|
|
3002
|
-
| `overlay-qa-tests.ts` | Comprehensive overlay tests | `ui.custom`, all overlay options |
|
|
3003
|
-
| `notify.ts` | Simple notifications | `ui.notify` |
|
|
3004
|
-
| `timed-confirm.ts` | Dialogs with timeout | `ui.confirm` with timeout/signal |
|
|
3005
|
-
| `mac-system-theme.ts` | Auto-switch theme | `setTheme`, `exec` |
|
|
3006
|
-
| **Complex Extensions** |||
|
|
3007
|
-
| `plan-mode/` | Full plan mode implementation | All event types, `registerCommand`, `registerShortcut`, `registerFlag`, `setStatus`, `setWidget`, `sendMessage`, `setActiveTools` |
|
|
3008
|
-
| `preset.ts` | Saveable presets (model, tools, thinking) | `registerCommand`, `registerShortcut`, `registerFlag`, `setModel`, `setActiveTools`, `setThinkingLevel`, `appendEntry` |
|
|
3009
|
-
| `tools.ts` | Toggle tools on/off UI | `registerCommand`, `setActiveTools`, `SettingsList`, session events |
|
|
3010
|
-
| **Remote & Sandbox** |||
|
|
3011
|
-
| `ssh.ts` | SSH remote execution | `registerFlag`, `on("user_bash")`, `on("before_agent_start")`, tool operations |
|
|
3012
|
-
| `interactive-shell.ts` | Persistent shell session | `on("user_bash")` |
|
|
3013
|
-
| `sandbox/` | Sandboxed tool execution | Tool operations |
|
|
3014
|
-
| `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM | Tool operations, built-in tool overrides, `on("user_bash")` |
|
|
3015
|
-
| `subagent/` | Spawn sub-agents | `registerTool`, `exec` |
|
|
3016
|
-
| **Games** |||
|
|
3017
|
-
| `snake.ts` | Snake game | `registerCommand`, `ui.custom`, keyboard handling |
|
|
3018
|
-
| `space-invaders.ts` | Space Invaders game | `registerCommand`, `ui.custom` |
|
|
3019
|
-
| `doom-overlay/` | Doom in overlay | `ui.custom` with overlay |
|
|
3020
|
-
| **Providers** |||
|
|
3021
|
-
| `custom-provider-anthropic/` | Custom Anthropic proxy | `registerProvider` |
|
|
3022
|
-
| `custom-provider-gitlab-duo/` | GitLab Duo integration | `registerProvider` with OAuth |
|
|
3023
|
-
| **Messages & Communication** |||
|
|
3024
|
-
| `message-renderer.ts` | Custom message rendering | `registerMessageRenderer`, `sendMessage` |
|
|
3025
|
-
| `entry-renderer.ts` | TUI-only custom entry rendering | `registerEntryRenderer`, `appendEntry` |
|
|
3026
|
-
| `event-bus.ts` | Inter-extension events | `pi.events` |
|
|
3027
|
-
| **Session Metadata** |||
|
|
3028
|
-
| `session-name.ts` | Name sessions for selector | `setSessionName`, `getSessionName` |
|
|
3029
|
-
| `bookmark.ts` | Bookmark entries for /tree | `setLabel` |
|
|
3030
|
-
| **Misc** |||
|
|
3031
|
-
| `inline-bash.ts` | Inline bash in tool calls | `on("tool_call")` |
|
|
3032
|
-
| `bash-spawn-hook.ts` | Adjust bash command, cwd, and env before execution | `createBashTool`, `spawnHook` |
|
|
3033
|
-
| `with-deps/` | Extension with npm dependencies | Package structure with `package.json` |
|
|
2713
|
+
Use [Custom Providers](custom-provider.md) for model-service integrations, [Terminal UI](tui.md) for custom components, and [Pi Packages](packages.md) to install or distribute extensions with other resources.
|