@punch-bot/cli 0.85.1 → 1.2.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 +572 -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-DA6M7CRN.js +6 -0
- package/dist/bundle/chunks/anthropic.js +2 -2
- package/dist/bundle/chunks/azure-openai-responses-IJO5RNR3.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-5HTGPCR7.js +2 -0
- package/dist/bundle/chunks/chunk-5OD3Y36V.js +11 -0
- package/dist/bundle/chunks/chunk-6C5VKHGV.js +50 -0
- package/dist/bundle/chunks/chunk-F5ZABL6Z.js +20 -0
- package/dist/bundle/chunks/{chunk-3DNTDXPG.js → chunk-FJPXW4TE.js} +3 -3
- package/dist/bundle/chunks/chunk-FLX3SJDL.js +1156 -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-JHYQSLCR.js +2 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -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-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-JSIIVUNP.js +2 -0
- package/dist/bundle/chunks/google-vertex-BZ3ID54S.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-RMNTDYQK.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-O3P3UWDP.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +2 -2
- package/dist/bundle/chunks/openai-completions-G4BKSHGH.js +7 -0
- package/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
- package/dist/bundle/chunks/openai-responses-377V6EDU.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-FOSN3OT2.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.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 +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +14 -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 +19 -46
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +149 -359
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +47 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +205 -43
- package/dist/core/model-runtime.js.map +1 -1
- 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 +16 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +124 -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.map +1 -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 +9 -14
- 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.map +1 -1
- 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/todos.d.ts.map +1 -1
- 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 +139 -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 +6 -6
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +12 -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 +16 -46
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +10 -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 +148 -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/quickstart.md +61 -106
- package/docs/rpc-commands.md +860 -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 +20 -29
- package/schemas/models.schema.json +1157 -0
- package/schemas/settings.schema.json +734 -0
- package/schemas/theme.schema.json +365 -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/codemode.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Codemode
|
|
2
|
+
|
|
3
|
+
The `codemode` tool lets the model write a JavaScript script that calls pi's other tools and runs non-LLM models, such as classifiers and image models. Only the script's output reaches the model, so a script can run calls in parallel and filter large results before the model sees them. To turn it on, see [Enable codemode](cli.md#enable-codemode).
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
The tool input is raw JavaScript source, not JSON and not a markdown code fence. It runs as the body of an async function in a QuickJS sandbox, so top-level `await` and `return` work. The sandbox has no Node APIs, file system, network, or timers; scripts reach the outside world only through tools and `models`.
|
|
8
|
+
|
|
9
|
+
A script may start with an options line. It must be the first line; an options line anywhere else fails the call before the script runs:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
// @options: {"max_output_tokens": 2000, "timeout_ms": 60000}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `max_output_tokens` (default 10000) limits the output. Longer output keeps its start and end, and the full text is written to a temp file whose path is included in the result. A script fails when its output passes 16777216 characters of text and base64 image data or 100000 `text()`, `image()`, and `console` calls; write large data to a file with a tool instead.
|
|
16
|
+
- `timeout_ms` is a hard deadline for the whole script. It is unset by default. Image generation can take minutes, so do not set a short deadline for scripts that generate images.
|
|
17
|
+
|
|
18
|
+
The result starts with `Script completed` or `Script failed`, the wall time, and the output. Text and image items appear in order, each on its own line. When the output has more than one text item (from `text()` or `return`), each starts with a `==> text N/M <==` line. `console` calls follow in one `<console_output>` block with one line per call. A failed script keeps its partial output, followed by `Script error:` and the error. Tool calls are real: calls made before a failure are not undone. Calls still running when the script ends are cancelled, and unawaited promises are discarded.
|
|
19
|
+
|
|
20
|
+
## Globals
|
|
21
|
+
|
|
22
|
+
| Global | Purpose |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `tools.<name>(args)` | Call a tool. See [Call tools](#call-tools). |
|
|
25
|
+
| `text(value)` | Add a text item to the output. Strings are added as is, other values as JSON. |
|
|
26
|
+
| `image(value)` | Add an image to the output: a base64 `data:` URL, an `{ image_url }` object, or an image block `{ type: "image", data, mimeType }` such as those returned by MCP tools and `models.generateImages()`. Remote URLs are not supported. PNG, JPEG, GIF, and WebP are accepted. Each image is also saved to a temp file, and the result names the path before the image. |
|
|
27
|
+
| `console.log(...)` | Add a line to the `<console_output>` block after the other output. Arguments are joined with spaces; `info`, `warn`, `error`, and `debug` do the same. |
|
|
28
|
+
| `return value` | A top-level `return` adds the value like `text()`. |
|
|
29
|
+
| `exit()` | End the script successfully. |
|
|
30
|
+
| `store(key, value)` / `load(key)` | Keep small JSON values across `codemode` calls. See [Store values](#store-values). |
|
|
31
|
+
| `ALL_TOOLS` | Every callable tool as `{ name, description }`, including tools the description does not list. |
|
|
32
|
+
| `searchTools(query, { limit?, namespace? })` | Rank callable tools by relevance (BM25, default limit 8). Resolves to `{ name, description }[]`. |
|
|
33
|
+
| `describeTool(name)` | Resolves to a tool's description and TypeScript declaration, or `undefined`. |
|
|
34
|
+
| `describeNamespace(name)` | Resolves to `{ name, description?, instructions?, tools }` for a namespace such as an MCP server, or `undefined`. |
|
|
35
|
+
| `models` | List and run non-LLM models. See [Models](#models). |
|
|
36
|
+
|
|
37
|
+
## Call tools
|
|
38
|
+
|
|
39
|
+
Every tool the session can call is a method of `tools`, named by its identifier: characters that are not valid in a JavaScript identifier become `_`, so the MCP tool `mcp__dev-radius__search` is `tools.mcp__dev_radius__search`. Each method takes one object with the tool's arguments.
|
|
40
|
+
|
|
41
|
+
What a call resolves to depends on the tool:
|
|
42
|
+
|
|
43
|
+
- Tools with an output schema resolve to a structured value. `bash` resolves to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }`, also for non-zero exit codes. Its `output` is not limited to the 2000 lines or 50KB the model sees: it holds up to 1 MiB, and longer output keeps its first and last 512 KiB around an omission marker, with `truncated` set and the full output in `full_output_path`.
|
|
44
|
+
- MCP tools resolve to their `CallToolResult`, including `isError` and `structuredContent`.
|
|
45
|
+
- `read` resolves to the file's text, or for an image to an image block `{ type: "image", data, mimeType, note }` that `image()` shows. `data` is the base64 image the model would see and `note` the text that goes with it, such as resize hints.
|
|
46
|
+
- Other tools, such as `edit` and `write`, resolve to their text output.
|
|
47
|
+
|
|
48
|
+
A call that fails, is blocked, or gets invalid arguments rejects with an `Error` that carries the tool's error text. Use `Promise.allSettled()` to keep the results of the calls that succeed.
|
|
49
|
+
|
|
50
|
+
The `codemode` description lists tools with their TypeScript declarations, grouped by namespace (for example one MCP server). Tools with `deferred` exposure, which includes MCP tools with the default `codemode` exposure, are not listed, so the description stays the same while MCP servers connect. Listed declarations share a budget of 3000 estimated tokens (`codemode.inlineBudget` in [settings](settings.md#tools)). Scripts find the other tools with `searchTools()`, `describeTool()`, `describeNamespace()`, or by filtering `ALL_TOOLS`.
|
|
51
|
+
|
|
52
|
+
While `codemode` is active, `codemode.mode` in [settings](settings.md#tools) decides how the other tools are presented. With `on` (default) declared tools stay declared, and their descriptions say how to call them from scripts. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts. Tool declarations in the `codemode` description, `describeTool()`, and `ALL_TOOLS` carry the tools' prompt guidelines, since the system prompt rules only cover declared tools.
|
|
53
|
+
|
|
54
|
+
## Store values
|
|
55
|
+
|
|
56
|
+
`store(key, value)` keeps a JSON value under a string key for later `codemode` calls; storing `undefined` deletes the key. `load(key)` returns the value, or `undefined`. Writes are kept only when the script succeeds: each successful script that stores values appends a `codemode-store` custom entry to the session, so resumed sessions keep the values and each branch sees only the values written on its path.
|
|
57
|
+
|
|
58
|
+
The store is for small state such as IDs, cursors, or summaries. One value may have at most 262144 characters of JSON and all values together at most 1048576. Do not store image data; show images with `image()`, which also saves them to a temp file.
|
|
59
|
+
|
|
60
|
+
## Models
|
|
61
|
+
|
|
62
|
+
`models` reaches the model catalog and runs non-LLM models with the session's credentials: classifiers, which answer typed questions about JSON state and, for some models, images, and image models, which generate images. Chat models are listed but cannot be run from scripts. Which classifier and image models exist is described in [Use classifier models](models.md#use-classifier-models) and [Use image models](models.md#use-image-models).
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
type ModelType = "chat" | "image" | "classifier";
|
|
66
|
+
|
|
67
|
+
/** A catalog entry. `provider` and `id` identify it; other fields depend on the type. */
|
|
68
|
+
interface ModelInfo {
|
|
69
|
+
type?: ModelType;
|
|
70
|
+
provider: string;
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
api: string;
|
|
74
|
+
input: ("text" | "image")[];
|
|
75
|
+
contextWindow?: number;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare const models: {
|
|
80
|
+
/** Every known model of a type, optionally for one provider. */
|
|
81
|
+
getModelsOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
|
|
82
|
+
/** Models of a type whose provider has working credentials. */
|
|
83
|
+
getAvailableOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
|
|
84
|
+
/** One catalog entry, or undefined. */
|
|
85
|
+
getModelOfType(type: ModelType, provider: string, id: string): Promise<ModelInfo | undefined>;
|
|
86
|
+
/** Answer `context.questions` about `context.state`; answers are in `result.answers` by question ID. */
|
|
87
|
+
classify(model: ModelInfo, context: ClassifierContext): Promise<ClassifierResult>;
|
|
88
|
+
/** Generate images from `context.input` text and image blocks; show `result.output` blocks with image(). Can take minutes. */
|
|
89
|
+
generateImages(model: ModelInfo, context: ImagesContext): Promise<ImagesResult>;
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`classify()` and `generateImages()` use only the `provider` and `id` of `model`, so `{ provider, id }` works as well. They do not throw on provider errors: check `stopReason` and `errorMessage`. At most four such calls run at once per script; more calls wait for a free slot, so `Promise.all()` over many items is fine. Their usage is added to the `codemode` tool result and counts toward the session cost.
|
|
94
|
+
|
|
95
|
+
Model IDs differ between providers, for example `typesafe/jev-latest` and `openrouter/typesafe/jev-1.13`. Use `models.getAvailableOfType(type)` to find the IDs that work with the current credentials.
|
|
96
|
+
|
|
97
|
+
### Classify
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
interface ClassifierContext {
|
|
101
|
+
/** The data to classify. */
|
|
102
|
+
state: Record<string, unknown>;
|
|
103
|
+
/** Images judged together with `state`. Only models whose `input` includes "image" accept them. */
|
|
104
|
+
images?: { type: "image"; data: string; mimeType: string }[];
|
|
105
|
+
/** Questions by ID. One call answers all of them. */
|
|
106
|
+
questions: Record<string, ClassifierQuestion>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type ClassifierQuestion =
|
|
110
|
+
/** Pick one label. `criteria` maps each label to what it means. */
|
|
111
|
+
| { type: "choice"; instructions: string; criteria: Record<string, string> }
|
|
112
|
+
/** Score on an ordered scale. `criteria` describes each level, lowest first. */
|
|
113
|
+
| { type: "score"; instructions: string; criteria: string[] }
|
|
114
|
+
/** Yes or no. */
|
|
115
|
+
| { type: "bool"; instructions: string; criteria: { true: string; false: string } };
|
|
116
|
+
|
|
117
|
+
interface ClassifierResult {
|
|
118
|
+
provider: string;
|
|
119
|
+
model: string;
|
|
120
|
+
/** Answers by question ID. */
|
|
121
|
+
answers: Record<string, ClassifierAnswer>;
|
|
122
|
+
usage?: ModelUsage;
|
|
123
|
+
stopReason: "stop" | "error" | "aborted";
|
|
124
|
+
errorMessage?: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type ClassifierAnswer =
|
|
128
|
+
| { type: "choice"; choice: string; probabilities: Record<string, number>; confidence: number }
|
|
129
|
+
/** `score` is the expected level index, from 0 to `criteria.length - 1`. */
|
|
130
|
+
| { type: "score"; score: number; confidence: number }
|
|
131
|
+
/** Probability of `true`. */
|
|
132
|
+
| { type: "bool"; probability: number };
|
|
133
|
+
|
|
134
|
+
/** Token counts and cost in USD, when the service reports them. */
|
|
135
|
+
type ModelUsage = { input: number; output: number; totalTokens: number; cost: { total: number } };
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Classify several items by calling `classify()` once per item. This script sorts feedback messages, for example ones a tool returned earlier in the script:
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
const jev = await models.getModelOfType("classifier", "typesafe", "jev-latest");
|
|
142
|
+
const results = await Promise.all(
|
|
143
|
+
messages.map((message) =>
|
|
144
|
+
models.classify(jev, {
|
|
145
|
+
state: { message },
|
|
146
|
+
questions: {
|
|
147
|
+
sentiment: {
|
|
148
|
+
type: "choice",
|
|
149
|
+
instructions: "How does the user feel about the product?",
|
|
150
|
+
criteria: { positive: "Satisfied or happy", negative: "Unhappy or frustrated", neutral: "Neither" },
|
|
151
|
+
},
|
|
152
|
+
urgency: {
|
|
153
|
+
type: "score",
|
|
154
|
+
instructions: "How urgently does this need a reply?",
|
|
155
|
+
criteria: ["no reply needed", "reply this week", "reply today"],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
}),
|
|
159
|
+
),
|
|
160
|
+
);
|
|
161
|
+
return results.map((result, i) =>
|
|
162
|
+
result.stopReason === "stop"
|
|
163
|
+
? { message: messages[i], sentiment: result.answers.sentiment.choice, urgency: result.answers.urgency.score }
|
|
164
|
+
: { message: messages[i], error: result.errorMessage },
|
|
165
|
+
);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Classifiers whose `input` includes `"image"` also judge images. `tools.read()` returns an image file as an image block that `images` accepts. Other classifiers return an error result when `images` is not empty.
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
const luna = await models.getModelOfType("classifier", "openai", "gpt-6-luna");
|
|
172
|
+
const photo = await tools.read({ path: "screenshot.png" });
|
|
173
|
+
const result = await models.classify(luna, {
|
|
174
|
+
state: { task: "Settings page redesign" },
|
|
175
|
+
images: [photo],
|
|
176
|
+
questions: {
|
|
177
|
+
broken: {
|
|
178
|
+
type: "bool",
|
|
179
|
+
instructions: "Does the screenshot show a broken layout?",
|
|
180
|
+
criteria: { true: "Overlapping, cut-off, or misaligned elements", false: "Clean layout" },
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Generate images
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
interface ImagesContext {
|
|
190
|
+
/** The prompt as text blocks, plus image blocks to edit or use as references. */
|
|
191
|
+
input: (TextBlock | ImageBlock)[];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
interface ImagesResult {
|
|
195
|
+
provider: string;
|
|
196
|
+
model: string;
|
|
197
|
+
/** Generated images, and text blocks for models that also return text. */
|
|
198
|
+
output: (TextBlock | ImageBlock)[];
|
|
199
|
+
usage?: ModelUsage;
|
|
200
|
+
stopReason: "stop" | "error" | "aborted";
|
|
201
|
+
errorMessage?: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
type TextBlock = { type: "text"; text: string };
|
|
205
|
+
/** `data` is base64. */
|
|
206
|
+
type ImageBlock = { type: "image"; data: string; mimeType: string };
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Show generated images with `image(block)`. Do not print `data` with `text()`, `console`, or `return`: it is large and the model cannot read it as text. `image()` also saves each image to a temp file and puts its path in the result, so a later turn can copy or move the file.
|
|
210
|
+
|
|
211
|
+
```js
|
|
212
|
+
// @options: {"timeout_ms": 300000}
|
|
213
|
+
const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
|
|
214
|
+
const result = await models.generateImages(painter, {
|
|
215
|
+
input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
|
|
216
|
+
});
|
|
217
|
+
if (result.stopReason !== "stop") return result.errorMessage;
|
|
218
|
+
for (const block of result.output) {
|
|
219
|
+
if (block.type === "image") image(block);
|
|
220
|
+
else text(block.text);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Limits
|
|
225
|
+
|
|
226
|
+
- A script's VM has 256 MB of memory. Running out throws `InternalError: out of memory`; filter or aggregate large data instead of accumulating it.
|
|
227
|
+
- On Bun, stopping a script or reaching its deadline ends the call promptly, but a built-in that does not poll QuickJS's interrupt handler can keep computing in its worker until it returns.
|
|
228
|
+
- At most two codemode workers may be alive across all sessions in one pi process. A cancelled worker occupies its slot until it exits. At capacity, new scripts fail immediately without starting another worker; retry after an existing worker exits.
|
|
229
|
+
- A script that waits on a promise that can never settle (no tool call pending) fails immediately, since there are no timers.
|
|
230
|
+
- Scripts cannot start other `codemode` scripts.
|
package/docs/compaction.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Compaction
|
|
1
|
+
# Compaction Reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This reference describes automatic compaction, branch summarization, persisted entries, and extension hooks. For the user workflow, see [Sessions and Context](sessions.md#manage-conversation-context).
|
|
4
4
|
|
|
5
5
|
**Source files** ([pi](https://github.com/earendil-works/pi)):
|
|
6
6
|
- [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
|
|
@@ -20,7 +20,7 @@ Pi has two summarization mechanisms:
|
|
|
20
20
|
| Compaction | Context exceeds threshold, or `/compact` | Summarize old messages to free up context |
|
|
21
21
|
| Branch summarization | `/tree` navigation | Preserve context when switching branches |
|
|
22
22
|
|
|
23
|
-
Both use
|
|
23
|
+
Both use closely related structured formats and track file operations cumulatively. Summarization requests disable prompt-cache writes because these one-off prompts are unlikely to be reused.
|
|
24
24
|
|
|
25
25
|
## Compaction
|
|
26
26
|
|
|
@@ -34,14 +34,16 @@ contextTokens > contextWindow - reserveTokens
|
|
|
34
34
|
|
|
35
35
|
By default, `reserveTokens` is 16384 tokens (configurable in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`). This leaves room for the LLM's response.
|
|
36
36
|
|
|
37
|
-
During a multi-turn agent run, Pi checks
|
|
37
|
+
During a multi-turn agent run, Pi checks the canonical projected context after tools finish and their results are appended, before starting the next assistant response. If the threshold is crossed, Pi compacts during `prepareNextTurn`, then performs the existing catch-up steering poll before `turn_start`. It skips this between-turn check when the completed tool batch terminates the run and no queued message requires another response. Pi also checks before a new user prompt and performs final-attempt overflow recovery after the low-level run ends.
|
|
38
|
+
|
|
39
|
+
A provider context-overflow error or an early final `stopReason: "length"` can select one compact-and-retry recovery attempt. Length responses with tool calls retain their synthetic failed tool results and follow the ordinary tool/queue scheduler rather than forcing the run to end.
|
|
38
40
|
|
|
39
41
|
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
|
|
40
42
|
|
|
41
43
|
### How It Works
|
|
42
44
|
|
|
43
|
-
1. **Find cut point**: Walk backwards
|
|
44
|
-
2. **Extract messages**: Collect messages from the previous kept boundary (or session start) up to the cut point
|
|
45
|
+
1. **Find cut point**: Walk backwards through the finalized session projection, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`) is reached
|
|
46
|
+
2. **Extract messages**: Collect projected messages from the previous kept boundary (or session start) up to the cut point
|
|
45
47
|
3. **Generate summary**: Call LLM to summarize with structured format, passing the previous summary as iterative context when present
|
|
46
48
|
4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
|
|
47
49
|
5. **Rebuilds context**: Session rebuilds the context for the next request, using summary + messages from `firstKeptEntryId` onwards
|
|
@@ -78,16 +80,31 @@ What the LLM sees:
|
|
|
78
80
|
prompt from cmp messages from firstKeptEntryId
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. Pi also recalculates `tokensBefore` from the rebuilt session
|
|
83
|
+
On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. A retain-none compaction records its own ID as `firstKeptEntryId`; repeated compaction starts after that entry. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. Pi also recalculates `tokensBefore` from the rebuilt, context-edited session projection before writing the new `CompactionEntry`, so the token count reflects the actual pre-compaction context being replaced. Omitted raw entries remain stored but do not affect cut selection, summaries, checkpoints, or token estimates.
|
|
84
|
+
|
|
85
|
+
### Overflow and Length Recovery Ordering
|
|
86
|
+
|
|
87
|
+
Recovery preserves the existing lifecycle and queue order. The completed attempt remains visible to `turn_end` and `agent_end`; post-run recovery then repairs persisted model context before a fresh retry:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
persist final assistant response
|
|
91
|
+
→ extension/public turn_end
|
|
92
|
+
→ extension/public agent_end
|
|
93
|
+
→ append context_edit omissions for the selected attempt
|
|
94
|
+
→ for overflow/length: run session_before_compact and append compaction on success
|
|
95
|
+
→ start the retry as a fresh run
|
|
96
|
+
```
|
|
82
97
|
|
|
83
|
-
|
|
98
|
+
If recovery compaction fails or is cancelled, Pi keeps the omission edits, appends no compaction, and schedules no internal retry. Existing queued work remains governed by ordinary steering and follow-up rules. `agent_before_settle` sees the repaired projection after recovery processing. Raw transcript history, exports, billing totals, and history-search extensions can still inspect the omitted attempt.
|
|
84
99
|
|
|
85
|
-
|
|
100
|
+
### Split user-message spans
|
|
86
101
|
|
|
87
|
-
|
|
102
|
+
A user-message span starts with a user message and includes all turns until the next user message. Normally, compaction cuts at user-message boundaries.
|
|
103
|
+
|
|
104
|
+
When one user-message span exceeds `keepRecentTokens`, the cut point lands within that span at an assistant message. This is a split user-message span:
|
|
88
105
|
|
|
89
106
|
```
|
|
90
|
-
Split
|
|
107
|
+
Split user-message span (one span exceeds budget):
|
|
91
108
|
|
|
92
109
|
entry: 0 1 2 3 4 5 6 7 8
|
|
93
110
|
┌─────┬─────┬─────┬──────┬─────┬──────┬──────┬─────┬──────┐
|
|
@@ -100,13 +117,13 @@ Split turn (one huge turn exceeds budget):
|
|
|
100
117
|
└── kept (7-8)
|
|
101
118
|
|
|
102
119
|
isSplitTurn = true
|
|
103
|
-
messagesToSummarize = [] (no
|
|
120
|
+
messagesToSummarize = [] (no earlier user-message spans)
|
|
104
121
|
turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
|
|
105
122
|
```
|
|
106
123
|
|
|
107
|
-
For split
|
|
124
|
+
For split user-message spans, Pi generates two summaries and merges them:
|
|
108
125
|
1. **History summary**: Previous context (if any)
|
|
109
|
-
2. **
|
|
126
|
+
2. **User-message-span prefix summary**: The early part of the split user-message span
|
|
110
127
|
|
|
111
128
|
### Cut Point Rules
|
|
112
129
|
|
|
@@ -118,6 +135,8 @@ Valid cut points are:
|
|
|
118
135
|
|
|
119
136
|
Never cut at tool results (they must stay with their tool call).
|
|
120
137
|
|
|
138
|
+
Preparation advances the kept boundary into a context-invisible suffix only when that suffix contains an omitted assistant attempt and no unomitted context-producing entries. Recovery `context_edit` omissions satisfy this rule; intrinsically context-invisible metadata may coexist with them. Metadata alone and newly appended custom messages do not move the cut. A replacement edit affecting the candidate input or summarized prefix also blocks advancement because the omitted assistant answered the pre-edit input; replacements of suffix entries that are ultimately omitted remain safe. This allows an over-budget recovered input to be summarized while retaining the edits that keep the abandoned attempt omitted, without making bookkeeping change whether new model input is preserved verbatim.
|
|
139
|
+
|
|
121
140
|
### CompactionEntry Structure
|
|
122
141
|
|
|
123
142
|
Defined in [`session-manager.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/session-manager.ts):
|
|
@@ -126,8 +145,8 @@ Defined in [`session-manager.ts`](https://github.com/earendil-works/pi/blob/main
|
|
|
126
145
|
interface CompactionEntry<T = unknown> {
|
|
127
146
|
type: "compaction";
|
|
128
147
|
id: string;
|
|
129
|
-
parentId: string;
|
|
130
|
-
timestamp:
|
|
148
|
+
parentId: string | null;
|
|
149
|
+
timestamp: string;
|
|
131
150
|
summary: string;
|
|
132
151
|
firstKeptEntryId: string;
|
|
133
152
|
tokensBefore: number;
|
|
@@ -180,11 +199,9 @@ After navigation with summary:
|
|
|
180
199
|
|
|
181
200
|
### Cumulative File Tracking
|
|
182
201
|
|
|
183
|
-
|
|
184
|
-
- Tool calls in the messages being summarized
|
|
185
|
-
- Previous compaction or branch summary `details` (if any)
|
|
202
|
+
Default compaction and branch summarization track files cumulatively. Both extract file operations from tool calls in the messages being summarized. Compaction also carries file lists from the previous Pi-generated compaction. Branch summarization carries file lists from Pi-generated branch summaries in the entries it summarizes.
|
|
186
203
|
|
|
187
|
-
|
|
204
|
+
File tracking therefore accumulates across default compactions and nested default branch summaries. Pi does not automatically carry file lists from extension-generated summaries whose `fromHook` field is `true`; extensions manage their own `details` format.
|
|
188
205
|
|
|
189
206
|
### BranchSummaryEntry Structure
|
|
190
207
|
|
|
@@ -194,8 +211,8 @@ Defined in [`session-manager.ts`](https://github.com/earendil-works/pi/blob/main
|
|
|
194
211
|
interface BranchSummaryEntry<T = unknown> {
|
|
195
212
|
type: "branch_summary";
|
|
196
213
|
id: string;
|
|
197
|
-
parentId: string;
|
|
198
|
-
timestamp:
|
|
214
|
+
parentId: string | null;
|
|
215
|
+
timestamp: string;
|
|
199
216
|
summary: string;
|
|
200
217
|
fromId: string; // Entry we navigated from
|
|
201
218
|
usage?: Usage; // LLM usage that generated the summary
|
|
@@ -216,7 +233,9 @@ See [`collectEntriesForBranchSummary()`](https://github.com/earendil-works/pi/bl
|
|
|
216
233
|
|
|
217
234
|
## Summary Format
|
|
218
235
|
|
|
219
|
-
Both
|
|
236
|
+
Both formats include Goal, Constraints & Preferences, Progress, Key Decisions, and Next Steps. Compaction summaries also include Critical Context. Branch summaries stop after Next Steps. Pi appends file lists to either format when relevant.
|
|
237
|
+
|
|
238
|
+
Compaction summaries use this format:
|
|
220
239
|
|
|
221
240
|
```markdown
|
|
222
241
|
## Goal
|
|
@@ -260,7 +279,6 @@ Before summarization, messages are serialized to text via [`serializeConversatio
|
|
|
260
279
|
|
|
261
280
|
```
|
|
262
281
|
[User]: What they said
|
|
263
|
-
[Assistant thinking]: Internal reasoning
|
|
264
282
|
[Assistant]: Response text
|
|
265
283
|
[Assistant tool calls]: read(path="foo.ts"); edit(path="bar.ts", ...)
|
|
266
284
|
[Tool result]: Output from tool
|
|
@@ -268,6 +286,8 @@ Before summarization, messages are serialized to text via [`serializeConversatio
|
|
|
268
286
|
|
|
269
287
|
This prevents the model from treating it as a conversation to continue.
|
|
270
288
|
|
|
289
|
+
Thinking blocks are omitted. Providers return summaries of the real reasoning, and replayed thinking is often not part of the model's live context, so including it could make the summarization request larger than the context it summarizes.
|
|
290
|
+
|
|
271
291
|
Tool results are truncated to 2000 characters during serialization. Content beyond that limit is replaced with a marker indicating how many characters were truncated. This keeps summarization requests within reasonable token budgets, since tool results (especially from `read` and `bash`) are typically the largest contributors to context size.
|
|
272
292
|
|
|
273
293
|
## Custom Summarization via Extensions
|
|
@@ -283,7 +303,7 @@ pi.on("session_before_compact", async (event, ctx) => {
|
|
|
283
303
|
const { preparation, branchEntries, customInstructions, reason, willRetry, signal } = event;
|
|
284
304
|
|
|
285
305
|
// preparation.messagesToSummarize - messages to summarize
|
|
286
|
-
// preparation.turnPrefixMessages -
|
|
306
|
+
// preparation.turnPrefixMessages - user-message-span prefix (if isSplitTurn)
|
|
287
307
|
// preparation.previousSummary - previous compaction summary
|
|
288
308
|
// preparation.fileOps - extracted file operations
|
|
289
309
|
// preparation.tokensBefore - context tokens before compaction
|
|
@@ -327,7 +347,6 @@ pi.on("session_before_compact", async (event, ctx) => {
|
|
|
327
347
|
);
|
|
328
348
|
// Returns:
|
|
329
349
|
// [User]: message text
|
|
330
|
-
// [Assistant thinking]: thinking content
|
|
331
350
|
// [Assistant]: response text
|
|
332
351
|
// [Assistant tool calls]: read(path="..."); bash(command="...")
|
|
333
352
|
// [Tool result]: output text
|
|
@@ -357,7 +376,7 @@ pi.on("session_compact_failed", async (event, ctx) => {
|
|
|
357
376
|
const { reason, errorMessage, aborted, willRetry, fromExtension } = event;
|
|
358
377
|
// reason - "manual" (/compact), "threshold", or "overflow"
|
|
359
378
|
// errorMessage - present for non-abort failures
|
|
360
|
-
// aborted - true for
|
|
379
|
+
// aborted - true for canceled/aborted compactions
|
|
361
380
|
// willRetry - whether the aborted turn would have retried after compaction
|
|
362
381
|
// fromExtension - whether extension-provided compaction content was being used
|
|
363
382
|
});
|
|
@@ -441,4 +460,4 @@ Keys are exact, case-sensitive `provider/modelId` values, including any slashes
|
|
|
441
460
|
|
|
442
461
|
These resolved values are used for manual compaction, all automatic threshold checks, overflow recovery, and extension-visible `preparation.settings`. Model switches affect subsequent checks and compactions without changing ordinary settings. Compaction already in progress uses the model and settings captured for that operation. Branch summarization settings are unaffected.
|
|
443
462
|
|
|
444
|
-
Overrides work in both global and project settings. The files merge recursively before lookup, so a global model-specific value beats a project-wide fallback; a project must override that model entry to change it. See [
|
|
463
|
+
Overrides work in both global and project settings. The files merge recursively before lookup, so a global model-specific value beats a project-wide fallback; a project must override that model entry to change it. See [Settings](settings.md#per-model-compaction-overrides) for details.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Pi supports user-level and project configuration. User-level configuration lives in the agent directory, which defaults to `~/.pi/agent`. Project configuration lives in `.pi` under the working directory and loads after [project trust](security.md#understand-project-trust) is granted. The only exception is `sessionDir`, which Pi reads before resolving trust so it can locate sessions.
|
|
4
|
+
|
|
5
|
+
In interactive mode, use `/settings` to change common preferences. For other options, ask Pi to update the configuration or edit the relevant files directly. Run `/reload` after manually changing settings, keybindings, instructions, or resources.
|
|
6
|
+
|
|
7
|
+
## Agent directory
|
|
8
|
+
|
|
9
|
+
The agent directory is shown as `<agent-dir>` below. Set its location with the `PI_CODING_AGENT_DIR` environment variable or the SDK's [`agentDir`](sdk.md) option.
|
|
10
|
+
|
|
11
|
+
| Path | Responsibility |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `<agent-dir>/settings.json` | User-level [settings](settings.md), including preferences, defaults, resource paths, and Pi package declarations. |
|
|
14
|
+
| `<agent-dir>/keybindings.json` | Custom terminal UI and application [keybindings](keybindings.md). |
|
|
15
|
+
| `<agent-dir>/mcp.json` | [MCP servers](mcp.md) available in every project. |
|
|
16
|
+
| `<agent-dir>/models.json` | [Compatible endpoints, models, and model overrides](models.md#configure-a-compatible-endpoint). |
|
|
17
|
+
| `<agent-dir>/auth.json` | Saved API keys and OAuth credentials. |
|
|
18
|
+
| `<agent-dir>/AGENTS.override.md`, `AGENTS.md`, `AGENTS.MD`, `CLAUDE.md`, or `CLAUDE.MD` | User instructions applied across working directories. |
|
|
19
|
+
| `<agent-dir>/SYSTEM.md` | Replaces Pi’s default system prompt. |
|
|
20
|
+
| `<agent-dir>/APPEND_SYSTEM.md` | Adds instructions to Pi’s system prompt. |
|
|
21
|
+
| `<agent-dir>/extensions/` | User [extensions](extensions.md). |
|
|
22
|
+
| `<agent-dir>/skills/` | User [skills](skills.md) and supporting files. |
|
|
23
|
+
| `<agent-dir>/prompts/` | User [prompt templates](prompt-templates.md) exposed as slash commands. |
|
|
24
|
+
| `<agent-dir>/themes/` | User [theme](themes.md) files. |
|
|
25
|
+
|
|
26
|
+
## Project `.pi` directory
|
|
27
|
+
|
|
28
|
+
| Path | Responsibility |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `.pi/settings.json` | Project-level [settings](settings.md), resource paths, and Pi package declarations. |
|
|
31
|
+
| `.pi/mcp.json` | Project [MCP servers](mcp.md). |
|
|
32
|
+
| `.pi/SYSTEM.md` | Replaces the system prompt for the project. |
|
|
33
|
+
| `.pi/APPEND_SYSTEM.md` | Adds project-specific instructions to the system prompt. |
|
|
34
|
+
| `.pi/extensions/` | Project extensions. |
|
|
35
|
+
| `.pi/skills/` | Project skills and supporting files. |
|
|
36
|
+
| `.pi/prompts/` | Project prompt templates exposed as slash commands. |
|
|
37
|
+
| `.pi/themes/` | Project theme files. |
|
|
38
|
+
|
|
39
|
+
For `SYSTEM.md` and `APPEND_SYSTEM.md`, the trusted project file takes precedence over the corresponding agent-directory file. Files with the same name are not combined.
|
|
40
|
+
|
|
41
|
+
## Context files
|
|
42
|
+
|
|
43
|
+
Context files are separate from project `.pi` configuration. Pi loads them from the agent directory, the working directory, and its parent directories. A context file applies whenever Pi runs in its directory or anywhere below it.
|
|
44
|
+
|
|
45
|
+
An `AGENTS.override.md` replaces `AGENTS.md` or `CLAUDE.md` only in the same directory. It does not suppress context files from the agent directory or other directories.
|
|
46
|
+
|
|
47
|
+
Context-file discovery does not require project trust.
|