@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.
Files changed (1103) hide show
  1. package/CHANGELOG.md +572 -3
  2. package/README.md +82 -174
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  5. package/dist/bun/restore-sandbox-env.js.map +1 -1
  6. package/dist/bun/runtime-setup.d.ts.map +1 -1
  7. package/dist/bun/runtime-setup.js +4 -1
  8. package/dist/bun/runtime-setup.js.map +1 -1
  9. package/dist/bun/sandbox-env-setup.d.ts.map +1 -1
  10. package/dist/bundle/chunks/anthropic-messages-DA6M7CRN.js +6 -0
  11. package/dist/bundle/chunks/anthropic.js +2 -2
  12. package/dist/bundle/chunks/azure-openai-responses-IJO5RNR3.js +2 -0
  13. package/dist/bundle/chunks/bedrock-converse-stream.js +10 -2
  14. package/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
  15. package/dist/bundle/chunks/chunk-2M76JOVH.js +8 -0
  16. package/dist/bundle/chunks/chunk-5HTGPCR7.js +2 -0
  17. package/dist/bundle/chunks/chunk-5OD3Y36V.js +11 -0
  18. package/dist/bundle/chunks/chunk-6C5VKHGV.js +50 -0
  19. package/dist/bundle/chunks/chunk-F5ZABL6Z.js +20 -0
  20. package/dist/bundle/chunks/{chunk-3DNTDXPG.js → chunk-FJPXW4TE.js} +3 -3
  21. package/dist/bundle/chunks/chunk-FLX3SJDL.js +1156 -0
  22. package/dist/bundle/chunks/chunk-HACVPRBJ.js +11 -0
  23. package/dist/bundle/chunks/chunk-ITZNWD4K.js +2 -0
  24. package/dist/bundle/chunks/chunk-J7I2NFJ7.js +82 -0
  25. package/dist/bundle/chunks/chunk-JHYQSLCR.js +2 -0
  26. package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  27. package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -0
  28. package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
  29. package/dist/bundle/chunks/{chunk-TRDNDS6A.js → chunk-PYGXRV27.js} +5 -2
  30. package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  31. package/dist/bundle/chunks/{chunk-XDUWOHPL.js → chunk-S3GGRYIO.js} +2 -2
  32. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  33. package/dist/bundle/chunks/chunk-WUIPA42N.js +14 -0
  34. package/dist/bundle/chunks/chunk-XIX7LUWI.js +2 -0
  35. package/dist/bundle/chunks/chunk-YWHGLBPB.js +2 -0
  36. package/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
  37. package/dist/bundle/chunks/cli-QAQLORRY.js +51 -0
  38. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-UTBL2KOF.js +2 -0
  39. package/dist/bundle/chunks/codemode-worker.js +478 -0
  40. package/dist/bundle/chunks/execute-2Z6BN5R3.js +499 -0
  41. package/dist/bundle/chunks/github-copilot.js +1 -1
  42. package/dist/bundle/chunks/google-generative-ai-JSIIVUNP.js +2 -0
  43. package/dist/bundle/chunks/google-vertex-BZ3ID54S.js +2 -0
  44. package/dist/bundle/chunks/image-resize-worker.js +1 -1
  45. package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
  46. package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
  47. package/dist/bundle/chunks/{lib-HGQMNYVT.js → lib-TEDK3E5I.js} +2 -2
  48. package/dist/bundle/chunks/llama-cpp-classify-FYN623RH.js +22 -0
  49. package/dist/bundle/chunks/meta.js +2 -0
  50. package/dist/bundle/chunks/mistral-conversations-RMNTDYQK.js +5 -0
  51. package/dist/bundle/chunks/node-N5BSDOA5.js +16 -0
  52. package/dist/bundle/chunks/{node-4PXJTSWH.js → node-TWVVAGPO.js} +1 -1
  53. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  54. package/dist/bundle/chunks/openai-codex-responses-O3P3UWDP.js +10 -0
  55. package/dist/bundle/chunks/openai-codex.js +2 -2
  56. package/dist/bundle/chunks/openai-completions-G4BKSHGH.js +7 -0
  57. package/dist/bundle/chunks/openai-decisions-WVPMQ4JD.js +5 -0
  58. package/dist/bundle/chunks/openai-responses-377V6EDU.js +3 -0
  59. package/dist/bundle/chunks/{openrouter-images-N4XVVFSD.js → openrouter-images-YU24TD7D.js} +1 -1
  60. package/dist/bundle/chunks/openrouter.js +2 -2
  61. package/dist/bundle/chunks/{pi-messages-ZRYGTSON.js → pi-messages-V27DSLVC.js} +2 -2
  62. package/dist/bundle/chunks/radius.js +2 -2
  63. package/dist/bundle/chunks/runtime-R6O72Q4R.js +2 -0
  64. package/dist/bundle/chunks/typesafe-system-one-ZSK3RN4B.js +2 -0
  65. package/dist/bundle/chunks/virtual-modules-FOSN3OT2.js +2 -0
  66. package/dist/bundle/cli-runtime.js +3 -0
  67. package/dist/bundle/cli.js +4 -2
  68. package/dist/bundle/index.js +1 -1
  69. package/dist/bundle/rpc-entry.js +1 -1
  70. package/dist/cli/args.d.ts +1 -2
  71. package/dist/cli/args.d.ts.map +1 -1
  72. package/dist/cli/args.js +73 -53
  73. package/dist/cli/args.js.map +1 -1
  74. package/dist/cli/auth-check.d.ts.map +1 -1
  75. package/dist/cli/auth-check.js.map +1 -1
  76. package/dist/cli/auth-command.d.ts.map +1 -1
  77. package/dist/cli/auth-command.js.map +1 -1
  78. package/dist/cli/credential-print.d.ts.map +1 -1
  79. package/dist/cli/credential-print.js.map +1 -1
  80. package/dist/cli/experimental/transport-address.d.ts +21 -0
  81. package/dist/cli/experimental/transport-address.d.ts.map +1 -0
  82. package/dist/cli/experimental/transport-address.js +89 -0
  83. package/dist/cli/experimental/transport-address.js.map +1 -0
  84. package/dist/cli/file-processor.d.ts +1 -1
  85. package/dist/cli/file-processor.d.ts.map +1 -1
  86. package/dist/cli/file-processor.js.map +1 -1
  87. package/dist/cli/initial-message.d.ts +1 -1
  88. package/dist/cli/initial-message.d.ts.map +1 -1
  89. package/dist/cli/initial-message.js.map +1 -1
  90. package/dist/cli/list-models.d.ts.map +1 -1
  91. package/dist/cli/list-models.js +1 -1
  92. package/dist/cli/list-models.js.map +1 -1
  93. package/dist/cli/project-trust.d.ts.map +1 -1
  94. package/dist/cli/project-trust.js +5 -35
  95. package/dist/cli/project-trust.js.map +1 -1
  96. package/dist/cli/setup.d.ts.map +1 -1
  97. package/dist/cli/setup.js.map +1 -1
  98. package/dist/cli.d.ts.map +1 -1
  99. package/dist/config.d.ts +30 -11
  100. package/dist/config.d.ts.map +1 -1
  101. package/dist/config.js +72 -21
  102. package/dist/config.js.map +1 -1
  103. package/dist/core/agent-session-runtime.d.ts +4 -3
  104. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  105. package/dist/core/agent-session-runtime.js +37 -27
  106. package/dist/core/agent-session-runtime.js.map +1 -1
  107. package/dist/core/agent-session-services.d.ts +1 -0
  108. package/dist/core/agent-session-services.d.ts.map +1 -1
  109. package/dist/core/agent-session-services.js +14 -0
  110. package/dist/core/agent-session-services.js.map +1 -1
  111. package/dist/core/agent-session.d.ts +270 -22
  112. package/dist/core/agent-session.d.ts.map +1 -1
  113. package/dist/core/agent-session.js +1174 -410
  114. package/dist/core/agent-session.js.map +1 -1
  115. package/dist/core/auth-guidance.d.ts.map +1 -1
  116. package/dist/core/auth-guidance.js.map +1 -1
  117. package/dist/core/auth-storage.d.ts.map +1 -1
  118. package/dist/core/auth-storage.js +20 -13
  119. package/dist/core/auth-storage.js.map +1 -1
  120. package/dist/core/bash-executor.d.ts.map +1 -1
  121. package/dist/core/bash-executor.js +42 -52
  122. package/dist/core/bash-executor.js.map +1 -1
  123. package/dist/core/bug-report-upload.d.ts +12 -0
  124. package/dist/core/bug-report-upload.d.ts.map +1 -0
  125. package/dist/core/bug-report-upload.js +22 -0
  126. package/dist/core/bug-report-upload.js.map +1 -0
  127. package/dist/core/bug-report.d.ts +184 -0
  128. package/dist/core/bug-report.d.ts.map +1 -0
  129. package/dist/core/bug-report.js +292 -0
  130. package/dist/core/bug-report.js.map +1 -0
  131. package/dist/core/cache-stats.d.ts.map +1 -1
  132. package/dist/core/cache-stats.js +12 -1
  133. package/dist/core/cache-stats.js.map +1 -1
  134. package/dist/core/cache-warmer.d.ts +103 -0
  135. package/dist/core/cache-warmer.d.ts.map +1 -0
  136. package/dist/core/cache-warmer.js +356 -0
  137. package/dist/core/cache-warmer.js.map +1 -0
  138. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  139. package/dist/core/compaction/branch-summarization.js +2 -2
  140. package/dist/core/compaction/branch-summarization.js.map +1 -1
  141. package/dist/core/compaction/compaction.d.ts +5 -3
  142. package/dist/core/compaction/compaction.d.ts.map +1 -1
  143. package/dist/core/compaction/compaction.js +164 -88
  144. package/dist/core/compaction/compaction.js.map +1 -1
  145. package/dist/core/compaction/index.d.ts.map +1 -1
  146. package/dist/core/compaction/utils.d.ts +8 -1
  147. package/dist/core/compaction/utils.d.ts.map +1 -1
  148. package/dist/core/compaction/utils.js +32 -26
  149. package/dist/core/compaction/utils.js.map +1 -1
  150. package/dist/core/crash-log.d.ts +27 -0
  151. package/dist/core/crash-log.d.ts.map +1 -0
  152. package/dist/core/crash-log.js +140 -0
  153. package/dist/core/crash-log.js.map +1 -0
  154. package/dist/core/defaults.d.ts.map +1 -1
  155. package/dist/core/delivery.d.ts.map +1 -1
  156. package/dist/core/delivery.js.map +1 -1
  157. package/dist/core/diagnostics.d.ts.map +1 -1
  158. package/dist/core/event-bus.d.ts.map +1 -1
  159. package/dist/core/event-bus.js.map +1 -1
  160. package/dist/core/exec.d.ts.map +1 -1
  161. package/dist/core/exec.js.map +1 -1
  162. package/dist/core/experimental.d.ts.map +1 -1
  163. package/dist/core/experimental.js.map +1 -1
  164. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  165. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  166. package/dist/core/export-html/index.d.ts.map +1 -1
  167. package/dist/core/export-html/index.js +1 -1
  168. package/dist/core/export-html/index.js.map +1 -1
  169. package/dist/core/export-html/template.css +10 -0
  170. package/dist/core/export-html/template.js +93 -34
  171. package/dist/core/export-html/tool-renderer.d.ts +5 -11
  172. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  173. package/dist/core/export-html/tool-renderer.js +8 -99
  174. package/dist/core/export-html/tool-renderer.js.map +1 -1
  175. package/dist/core/extensions/index.d.ts +1 -1
  176. package/dist/core/extensions/index.d.ts.map +1 -1
  177. package/dist/core/extensions/index.js.map +1 -1
  178. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  179. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  180. package/dist/core/extensions/jiti-loader.js +4 -0
  181. package/dist/core/extensions/jiti-loader.js.map +1 -0
  182. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  183. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  184. package/dist/core/extensions/jiti-static-loader.js +4 -0
  185. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  186. package/dist/core/extensions/loader.d.ts.map +1 -1
  187. package/dist/core/extensions/loader.js +102 -74
  188. package/dist/core/extensions/loader.js.map +1 -1
  189. package/dist/core/extensions/runner.d.ts +44 -14
  190. package/dist/core/extensions/runner.d.ts.map +1 -1
  191. package/dist/core/extensions/runner.js +297 -169
  192. package/dist/core/extensions/runner.js.map +1 -1
  193. package/dist/core/extensions/types.d.ts +482 -238
  194. package/dist/core/extensions/types.d.ts.map +1 -1
  195. package/dist/core/extensions/types.js.map +1 -1
  196. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  197. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  198. package/dist/core/extensions/virtual-modules.js +35 -0
  199. package/dist/core/extensions/virtual-modules.js.map +1 -0
  200. package/dist/core/extensions/wrapper.d.ts +2 -2
  201. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  202. package/dist/core/extensions/wrapper.js +3 -22
  203. package/dist/core/extensions/wrapper.js.map +1 -1
  204. package/dist/core/footer-data-provider.d.ts.map +1 -1
  205. package/dist/core/footer-data-provider.js.map +1 -1
  206. package/dist/core/http-dispatcher.d.ts +13 -0
  207. package/dist/core/http-dispatcher.d.ts.map +1 -1
  208. package/dist/core/http-dispatcher.js +13 -4
  209. package/dist/core/http-dispatcher.js.map +1 -1
  210. package/dist/core/index.d.ts +2 -1
  211. package/dist/core/index.d.ts.map +1 -1
  212. package/dist/core/index.js.map +1 -1
  213. package/dist/core/mcp-servers.d.ts +139 -0
  214. package/dist/core/mcp-servers.d.ts.map +1 -0
  215. package/dist/core/mcp-servers.js +232 -0
  216. package/dist/core/mcp-servers.js.map +1 -0
  217. package/dist/core/messages.d.ts.map +1 -1
  218. package/dist/core/messages.js +1 -0
  219. package/dist/core/messages.js.map +1 -1
  220. package/dist/{modes/interactive → core}/model-catalog-refresh.d.ts +2 -2
  221. package/dist/core/model-catalog-refresh.d.ts.map +1 -0
  222. package/dist/{modes/interactive → core}/model-catalog-refresh.js +2 -2
  223. package/dist/core/model-catalog-refresh.js.map +1 -0
  224. package/dist/core/model-config.d.ts +886 -80
  225. package/dist/core/model-config.d.ts.map +1 -1
  226. package/dist/core/model-config.js +33 -148
  227. package/dist/core/model-config.js.map +1 -1
  228. package/dist/core/model-registry.d.ts +15 -1
  229. package/dist/core/model-registry.d.ts.map +1 -1
  230. package/dist/core/model-registry.js +29 -0
  231. package/dist/core/model-registry.js.map +1 -1
  232. package/dist/core/model-resolver.d.ts +19 -46
  233. package/dist/core/model-resolver.d.ts.map +1 -1
  234. package/dist/core/model-resolver.js +149 -359
  235. package/dist/core/model-resolver.js.map +1 -1
  236. package/dist/core/model-runtime.d.ts +47 -3
  237. package/dist/core/model-runtime.d.ts.map +1 -1
  238. package/dist/core/model-runtime.js +205 -43
  239. package/dist/core/model-runtime.js.map +1 -1
  240. package/dist/core/models-store.d.ts.map +1 -1
  241. package/dist/core/models-store.js.map +1 -1
  242. package/dist/core/nested-tool-calls.d.ts +103 -0
  243. package/dist/core/nested-tool-calls.d.ts.map +1 -0
  244. package/dist/core/nested-tool-calls.js +179 -0
  245. package/dist/core/nested-tool-calls.js.map +1 -0
  246. package/dist/core/output-guard.d.ts.map +1 -1
  247. package/dist/core/output-guard.js.map +1 -1
  248. package/dist/core/package-manager.d.ts +4 -0
  249. package/dist/core/package-manager.d.ts.map +1 -1
  250. package/dist/core/package-manager.js +62 -15
  251. package/dist/core/package-manager.js.map +1 -1
  252. package/dist/core/pi-manifest.d.ts.map +1 -1
  253. package/dist/core/pi-manifest.js.map +1 -1
  254. package/dist/core/project-trust.d.ts.map +1 -1
  255. package/dist/core/project-trust.js +2 -1
  256. package/dist/core/project-trust.js.map +1 -1
  257. package/dist/core/prompt-templates.d.ts +6 -1
  258. package/dist/core/prompt-templates.d.ts.map +1 -1
  259. package/dist/core/prompt-templates.js +68 -37
  260. package/dist/core/prompt-templates.js.map +1 -1
  261. package/dist/core/provider-attribution.d.ts.map +1 -1
  262. package/dist/core/provider-attribution.js.map +1 -1
  263. package/dist/core/provider-composer.d.ts +42 -20
  264. package/dist/core/provider-composer.d.ts.map +1 -1
  265. package/dist/core/provider-composer.js +126 -40
  266. package/dist/core/provider-composer.js.map +1 -1
  267. package/dist/core/radius.d.ts +5 -0
  268. package/dist/core/radius.d.ts.map +1 -1
  269. package/dist/core/radius.js +8 -0
  270. package/dist/core/radius.js.map +1 -1
  271. package/dist/core/remote-catalog-provider.d.ts +19 -1
  272. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  273. package/dist/core/remote-catalog-provider.js +102 -34
  274. package/dist/core/remote-catalog-provider.js.map +1 -1
  275. package/dist/core/resolve-config-value.d.ts.map +1 -1
  276. package/dist/core/resolve-config-value.js.map +1 -1
  277. package/dist/core/resource-loader.d.ts +11 -2
  278. package/dist/core/resource-loader.d.ts.map +1 -1
  279. package/dist/core/resource-loader.js +170 -42
  280. package/dist/core/resource-loader.js.map +1 -1
  281. package/dist/core/runtime-credentials.d.ts.map +1 -1
  282. package/dist/core/runtime-credentials.js.map +1 -1
  283. package/dist/core/sdk.d.ts +16 -5
  284. package/dist/core/sdk.d.ts.map +1 -1
  285. package/dist/core/sdk.js +124 -52
  286. package/dist/core/sdk.js.map +1 -1
  287. package/dist/core/session-cwd.d.ts.map +1 -1
  288. package/dist/core/session-cwd.js.map +1 -1
  289. package/dist/core/session-export.d.ts +6 -2
  290. package/dist/core/session-export.d.ts.map +1 -1
  291. package/dist/core/session-export.js +14 -13
  292. package/dist/core/session-export.js.map +1 -1
  293. package/dist/core/session-manager.d.ts +72 -13
  294. package/dist/core/session-manager.d.ts.map +1 -1
  295. package/dist/core/session-manager.js +277 -124
  296. package/dist/core/session-manager.js.map +1 -1
  297. package/dist/core/settings-defaults.d.ts +65 -0
  298. package/dist/core/settings-defaults.d.ts.map +1 -0
  299. package/dist/core/settings-defaults.js +66 -0
  300. package/dist/core/settings-defaults.js.map +1 -0
  301. package/dist/core/settings-diagnostics.d.ts.map +1 -1
  302. package/dist/core/settings-diagnostics.js.map +1 -1
  303. package/dist/core/settings-manager.d.ts +41 -126
  304. package/dist/core/settings-manager.d.ts.map +1 -1
  305. package/dist/core/settings-manager.js +165 -52
  306. package/dist/core/settings-manager.js.map +1 -1
  307. package/dist/core/settings-schema.d.ts +224 -0
  308. package/dist/core/settings-schema.d.ts.map +1 -0
  309. package/dist/core/settings-schema.js +285 -0
  310. package/dist/core/settings-schema.js.map +1 -0
  311. package/dist/core/skills.d.ts +4 -1
  312. package/dist/core/skills.d.ts.map +1 -1
  313. package/dist/core/skills.js +6 -1
  314. package/dist/core/skills.js.map +1 -1
  315. package/dist/core/slash-commands.d.ts.map +1 -1
  316. package/dist/core/slash-commands.js +3 -2
  317. package/dist/core/slash-commands.js.map +1 -1
  318. package/dist/core/source-info.d.ts +8 -0
  319. package/dist/core/source-info.d.ts.map +1 -1
  320. package/dist/core/source-info.js +16 -0
  321. package/dist/core/source-info.js.map +1 -1
  322. package/dist/core/system-prompt.d.ts +55 -6
  323. package/dist/core/system-prompt.d.ts.map +1 -1
  324. package/dist/core/system-prompt.js +128 -93
  325. package/dist/core/system-prompt.js.map +1 -1
  326. package/dist/core/telemetry.d.ts +2 -0
  327. package/dist/core/telemetry.d.ts.map +1 -1
  328. package/dist/core/telemetry.js +45 -0
  329. package/dist/core/telemetry.js.map +1 -1
  330. package/dist/core/theme/dark.json +78 -0
  331. package/dist/core/theme/light.json +78 -0
  332. package/dist/core/theme/system-theme.d.ts +54 -0
  333. package/dist/core/theme/system-theme.d.ts.map +1 -0
  334. package/dist/core/theme/system-theme.js +547 -0
  335. package/dist/core/theme/system-theme.js.map +1 -0
  336. package/dist/core/theme/theme-schema.d.ts +28 -0
  337. package/dist/core/theme/theme-schema.d.ts.map +1 -0
  338. package/dist/core/theme/theme-schema.js +105 -0
  339. package/dist/core/theme/theme-schema.js.map +1 -0
  340. package/dist/core/theme/theme-tokens.d.ts +257 -0
  341. package/dist/core/theme/theme-tokens.d.ts.map +1 -0
  342. package/dist/core/theme/theme-tokens.js +94 -0
  343. package/dist/core/theme/theme-tokens.js.map +1 -0
  344. package/dist/core/theme/theme.d.ts +162 -0
  345. package/dist/core/theme/theme.d.ts.map +1 -0
  346. package/dist/{modes/interactive → core}/theme/theme.js +265 -402
  347. package/dist/core/theme/theme.js.map +1 -0
  348. package/dist/core/timings.d.ts.map +1 -1
  349. package/dist/core/timings.js.map +1 -1
  350. package/dist/core/tools/bash.d.ts +14 -1
  351. package/dist/core/tools/bash.d.ts.map +1 -1
  352. package/dist/core/tools/bash.js +43 -6
  353. package/dist/core/tools/bash.js.map +1 -1
  354. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  355. package/dist/core/tools/edit-diff.js.map +1 -1
  356. package/dist/core/tools/edit.d.ts +1 -2
  357. package/dist/core/tools/edit.d.ts.map +1 -1
  358. package/dist/core/tools/edit.js +0 -3
  359. package/dist/core/tools/edit.js.map +1 -1
  360. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  361. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  362. package/dist/core/tools/find.d.ts.map +1 -1
  363. package/dist/core/tools/find.js +0 -2
  364. package/dist/core/tools/find.js.map +1 -1
  365. package/dist/core/tools/grep.d.ts.map +1 -1
  366. package/dist/core/tools/grep.js +0 -2
  367. package/dist/core/tools/grep.js.map +1 -1
  368. package/dist/core/tools/index.d.ts.map +1 -1
  369. package/dist/core/tools/index.js.map +1 -1
  370. package/dist/core/tools/ls.d.ts.map +1 -1
  371. package/dist/core/tools/ls.js +0 -2
  372. package/dist/core/tools/ls.js.map +1 -1
  373. package/dist/core/tools/output-accumulator.d.ts +11 -0
  374. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  375. package/dist/core/tools/output-accumulator.js +40 -10
  376. package/dist/core/tools/output-accumulator.js.map +1 -1
  377. package/dist/core/tools/path-utils.d.ts.map +1 -1
  378. package/dist/core/tools/path-utils.js.map +1 -1
  379. package/dist/core/tools/powershell.d.ts.map +1 -1
  380. package/dist/core/tools/powershell.js.map +1 -1
  381. package/dist/core/tools/read.d.ts +17 -1
  382. package/dist/core/tools/read.d.ts.map +1 -1
  383. package/dist/core/tools/read.js +23 -4
  384. package/dist/core/tools/read.js.map +1 -1
  385. package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
  386. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  387. package/dist/core/tools/tool-definition-wrapper.js +3 -1
  388. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  389. package/dist/core/tools/truncate.d.ts +14 -0
  390. package/dist/core/tools/truncate.d.ts.map +1 -1
  391. package/dist/core/tools/truncate.js +29 -0
  392. package/dist/core/tools/truncate.js.map +1 -1
  393. package/dist/core/tools/write.d.ts.map +1 -1
  394. package/dist/core/tools/write.js +0 -2
  395. package/dist/core/tools/write.js.map +1 -1
  396. package/dist/core/trust-manager.d.ts.map +1 -1
  397. package/dist/core/trust-manager.js +1 -0
  398. package/dist/core/trust-manager.js.map +1 -1
  399. package/dist/core/usage-totals.d.ts +3 -1
  400. package/dist/core/usage-totals.d.ts.map +1 -1
  401. package/dist/core/usage-totals.js +28 -1
  402. package/dist/core/usage-totals.js.map +1 -1
  403. package/dist/core/virtual-models.d.ts +117 -0
  404. package/dist/core/virtual-models.d.ts.map +1 -0
  405. package/dist/core/virtual-models.js +124 -0
  406. package/dist/core/virtual-models.js.map +1 -0
  407. package/dist/extensions/browser/index.d.ts.map +1 -1
  408. package/dist/extensions/browser/index.js.map +1 -1
  409. package/dist/extensions/codemode/execute.d.ts +16 -0
  410. package/dist/extensions/codemode/execute.d.ts.map +1 -0
  411. package/dist/extensions/codemode/execute.js +665 -0
  412. package/dist/extensions/codemode/execute.js.map +1 -0
  413. package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
  414. package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
  415. package/dist/extensions/codemode/execute.lazy.js +3 -0
  416. package/dist/extensions/codemode/execute.lazy.js.map +1 -0
  417. package/dist/extensions/codemode/index.d.ts +21 -0
  418. package/dist/extensions/codemode/index.d.ts.map +1 -0
  419. package/dist/extensions/codemode/index.js +33 -0
  420. package/dist/extensions/codemode/index.js.map +1 -0
  421. package/dist/extensions/codemode/tool.d.ts +124 -0
  422. package/dist/extensions/codemode/tool.d.ts.map +1 -0
  423. package/dist/extensions/codemode/tool.js +286 -0
  424. package/dist/extensions/codemode/tool.js.map +1 -0
  425. package/dist/extensions/codemode/worker.d.ts +7 -0
  426. package/dist/extensions/codemode/worker.d.ts.map +1 -0
  427. package/dist/extensions/codemode/worker.js +7 -0
  428. package/dist/extensions/codemode/worker.js.map +1 -0
  429. package/dist/extensions/context-pruning/compress_context.d.ts.map +1 -1
  430. package/dist/extensions/context-pruning/compress_context.js +1 -3
  431. package/dist/extensions/context-pruning/compress_context.js.map +1 -1
  432. package/dist/extensions/context-pruning/context-pruning-state.d.ts.map +1 -1
  433. package/dist/extensions/context-pruning/context-pruning-state.js.map +1 -1
  434. package/dist/extensions/index.d.ts.map +1 -1
  435. package/dist/extensions/index.js +6 -2
  436. package/dist/extensions/index.js.map +1 -1
  437. package/dist/extensions/llama/client.d.ts +2 -0
  438. package/dist/extensions/llama/client.d.ts.map +1 -1
  439. package/dist/extensions/llama/client.js +7 -3
  440. package/dist/extensions/llama/client.js.map +1 -1
  441. package/dist/extensions/llama/huggingface.d.ts.map +1 -1
  442. package/dist/extensions/llama/huggingface.js.map +1 -1
  443. package/dist/extensions/llama/index.d.ts.map +1 -1
  444. package/dist/extensions/llama/index.js +0 -4
  445. package/dist/extensions/llama/index.js.map +1 -1
  446. package/dist/extensions/llama/provider.d.ts +1 -1
  447. package/dist/extensions/llama/provider.d.ts.map +1 -1
  448. package/dist/extensions/llama/provider.js +103 -13
  449. package/dist/extensions/llama/provider.js.map +1 -1
  450. package/dist/extensions/llama/ui.d.ts +3 -2
  451. package/dist/extensions/llama/ui.d.ts.map +1 -1
  452. package/dist/extensions/llama/ui.js +106 -364
  453. package/dist/extensions/llama/ui.js.map +1 -1
  454. package/dist/extensions/mcp/cli.d.ts +21 -0
  455. package/dist/extensions/mcp/cli.d.ts.map +1 -0
  456. package/dist/extensions/mcp/cli.js +494 -0
  457. package/dist/extensions/mcp/cli.js.map +1 -0
  458. package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
  459. package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
  460. package/dist/extensions/mcp/cli.lazy.js +3 -0
  461. package/dist/extensions/mcp/cli.lazy.js.map +1 -0
  462. package/dist/extensions/mcp/config.d.ts +84 -0
  463. package/dist/extensions/mcp/config.d.ts.map +1 -0
  464. package/dist/extensions/mcp/config.js +196 -0
  465. package/dist/extensions/mcp/config.js.map +1 -0
  466. package/dist/extensions/mcp/index.d.ts +71 -2
  467. package/dist/extensions/mcp/index.d.ts.map +1 -1
  468. package/dist/extensions/mcp/index.js +839 -131
  469. package/dist/extensions/mcp/index.js.map +1 -1
  470. package/dist/extensions/mcp/log.d.ts +16 -0
  471. package/dist/extensions/mcp/log.d.ts.map +1 -0
  472. package/dist/extensions/mcp/log.js +66 -0
  473. package/dist/extensions/mcp/log.js.map +1 -0
  474. package/dist/extensions/mcp/oauth.d.ts +102 -0
  475. package/dist/extensions/mcp/oauth.d.ts.map +1 -0
  476. package/dist/extensions/mcp/oauth.js +428 -0
  477. package/dist/extensions/mcp/oauth.js.map +1 -0
  478. package/dist/extensions/mcp/resources.d.ts +36 -0
  479. package/dist/extensions/mcp/resources.d.ts.map +1 -0
  480. package/dist/extensions/mcp/resources.js +261 -0
  481. package/dist/extensions/mcp/resources.js.map +1 -0
  482. package/dist/extensions/mcp/runtime.d.ts +98 -0
  483. package/dist/extensions/mcp/runtime.d.ts.map +1 -0
  484. package/dist/extensions/mcp/runtime.js +378 -0
  485. package/dist/extensions/mcp/runtime.js.map +1 -0
  486. package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
  487. package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
  488. package/dist/extensions/mcp/runtime.lazy.js +3 -0
  489. package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
  490. package/dist/extensions/mcp/tools.d.ts +84 -0
  491. package/dist/extensions/mcp/tools.d.ts.map +1 -0
  492. package/dist/extensions/mcp/tools.js +263 -0
  493. package/dist/extensions/mcp/tools.js.map +1 -0
  494. package/dist/extensions/punch/a2a-listen.d.ts +9 -0
  495. package/dist/extensions/punch/a2a-listen.d.ts.map +1 -0
  496. package/dist/extensions/punch/a2a-listen.js +88 -0
  497. package/dist/extensions/punch/a2a-listen.js.map +1 -0
  498. package/dist/extensions/punch/a2a.d.ts +12 -0
  499. package/dist/extensions/punch/a2a.d.ts.map +1 -0
  500. package/dist/extensions/punch/a2a.js +106 -0
  501. package/dist/extensions/punch/a2a.js.map +1 -0
  502. package/dist/extensions/punch/auth.d.ts.map +1 -1
  503. package/dist/extensions/punch/auth.js.map +1 -1
  504. package/dist/extensions/punch/collabs.d.ts.map +1 -1
  505. package/dist/extensions/punch/collabs.js.map +1 -1
  506. package/dist/extensions/punch/index.d.ts.map +1 -1
  507. package/dist/extensions/punch/index.js +9 -14
  508. package/dist/extensions/punch/index.js.map +1 -1
  509. package/dist/extensions/punch/routines.d.ts +1 -3
  510. package/dist/extensions/punch/routines.d.ts.map +1 -1
  511. package/dist/extensions/punch/routines.js +1 -121
  512. package/dist/extensions/punch/routines.js.map +1 -1
  513. package/dist/extensions/punch/server.d.ts.map +1 -1
  514. package/dist/extensions/punch/server.js.map +1 -1
  515. package/dist/extensions/punch/timezone.d.ts.map +1 -1
  516. package/dist/extensions/punch/timezone.js.map +1 -1
  517. package/dist/extensions/punch/todos.d.ts.map +1 -1
  518. package/dist/extensions/punch/todos.js.map +1 -1
  519. package/dist/extensions/report-progress/index.d.ts.map +1 -1
  520. package/dist/extensions/report-progress/index.js.map +1 -1
  521. package/dist/extensions/subagent/agents.d.ts.map +1 -1
  522. package/dist/extensions/subagent/agents.js.map +1 -1
  523. package/dist/extensions/subagent/index.d.ts.map +1 -1
  524. package/dist/extensions/subagent/index.js +0 -372
  525. package/dist/extensions/subagent/index.js.map +1 -1
  526. package/dist/extensions/tool-search/index.d.ts +12 -0
  527. package/dist/extensions/tool-search/index.d.ts.map +1 -0
  528. package/dist/extensions/tool-search/index.js +15 -0
  529. package/dist/extensions/tool-search/index.js.map +1 -0
  530. package/dist/extensions/tool-search/tool.d.ts +71 -0
  531. package/dist/extensions/tool-search/tool.d.ts.map +1 -0
  532. package/dist/extensions/tool-search/tool.js +187 -0
  533. package/dist/extensions/tool-search/tool.js.map +1 -0
  534. package/dist/extensions/webfetch/index.d.ts.map +1 -1
  535. package/dist/extensions/webfetch/index.js.map +1 -1
  536. package/dist/extensions/websearch/index.d.ts.map +1 -1
  537. package/dist/extensions/websearch/index.js.map +1 -1
  538. package/dist/index.d.ts +13 -6
  539. package/dist/index.d.ts.map +1 -1
  540. package/dist/index.js +9 -6
  541. package/dist/index.js.map +1 -1
  542. package/dist/main.d.ts +1 -1
  543. package/dist/main.d.ts.map +1 -1
  544. package/dist/main.js +139 -173
  545. package/dist/main.js.map +1 -1
  546. package/dist/migrations.d.ts.map +1 -1
  547. package/dist/migrations.js +0 -20
  548. package/dist/migrations.js.map +1 -1
  549. package/dist/modes/index.d.ts +0 -1
  550. package/dist/modes/index.d.ts.map +1 -1
  551. package/dist/modes/index.js +0 -1
  552. package/dist/modes/index.js.map +1 -1
  553. package/dist/modes/json-event.d.ts.map +1 -1
  554. package/dist/modes/json-event.js.map +1 -1
  555. package/dist/modes/print-mode.d.ts.map +1 -1
  556. package/dist/modes/print-mode.js +4 -0
  557. package/dist/modes/print-mode.js.map +1 -1
  558. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  559. package/dist/modes/rpc/jsonl.js.map +1 -1
  560. package/dist/modes/rpc/rpc-client.d.ts +6 -6
  561. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  562. package/dist/modes/rpc/rpc-client.js +12 -8
  563. package/dist/modes/rpc/rpc-client.js.map +1 -1
  564. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  565. package/dist/modes/rpc/rpc-mode.js +16 -46
  566. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  567. package/dist/modes/rpc/rpc-types.d.ts +10 -1
  568. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  569. package/dist/modes/rpc/rpc-types.js.map +1 -1
  570. package/dist/package-manager-cli.d.ts.map +1 -1
  571. package/dist/package-manager-cli.js +43 -43
  572. package/dist/package-manager-cli.js.map +1 -1
  573. package/dist/rpc-entry.d.ts.map +1 -1
  574. package/dist/rpc-entry.js.map +1 -1
  575. package/dist/server/a2a/harness-runner.d.ts.map +1 -1
  576. package/dist/server/a2a/harness-runner.js.map +1 -1
  577. package/dist/server/a2a/run-server.d.ts.map +1 -1
  578. package/dist/server/a2a/run-server.js.map +1 -1
  579. package/dist/utils/abort.d.ts.map +1 -1
  580. package/dist/utils/abort.js.map +1 -1
  581. package/dist/utils/ansi.d.ts +8 -0
  582. package/dist/utils/ansi.d.ts.map +1 -1
  583. package/dist/utils/ansi.js +30 -11
  584. package/dist/utils/ansi.js.map +1 -1
  585. package/dist/utils/changelog.d.ts.map +1 -1
  586. package/dist/utils/changelog.js +5 -2
  587. package/dist/utils/changelog.js.map +1 -1
  588. package/dist/utils/child-process.d.ts.map +1 -1
  589. package/dist/utils/child-process.js.map +1 -1
  590. package/dist/utils/clipboard-command.d.ts.map +1 -1
  591. package/dist/utils/clipboard-command.js.map +1 -1
  592. package/dist/utils/clipboard-image.d.ts.map +1 -1
  593. package/dist/utils/clipboard-image.js +15 -41
  594. package/dist/utils/clipboard-image.js.map +1 -1
  595. package/dist/utils/clipboard.d.ts.map +1 -1
  596. package/dist/utils/clipboard.js +96 -38
  597. package/dist/utils/clipboard.js.map +1 -1
  598. package/dist/utils/colors.d.ts +73 -0
  599. package/dist/utils/colors.d.ts.map +1 -0
  600. package/dist/utils/colors.js +273 -0
  601. package/dist/utils/colors.js.map +1 -0
  602. package/dist/utils/deprecation.d.ts.map +1 -1
  603. package/dist/utils/deprecation.js.map +1 -1
  604. package/dist/utils/exif-orientation.d.ts.map +1 -1
  605. package/dist/utils/exif-orientation.js.map +1 -1
  606. package/dist/utils/frontmatter.d.ts.map +1 -1
  607. package/dist/utils/frontmatter.js.map +1 -1
  608. package/dist/utils/fs-watch.d.ts.map +1 -1
  609. package/dist/utils/fs-watch.js.map +1 -1
  610. package/dist/utils/fuzzy.d.ts +16 -0
  611. package/dist/utils/fuzzy.d.ts.map +1 -0
  612. package/dist/utils/fuzzy.js +111 -0
  613. package/dist/utils/fuzzy.js.map +1 -0
  614. package/dist/utils/git.d.ts.map +1 -1
  615. package/dist/utils/git.js.map +1 -1
  616. package/dist/utils/html.d.ts.map +1 -1
  617. package/dist/utils/html.js.map +1 -1
  618. package/dist/utils/image-convert.d.ts.map +1 -1
  619. package/dist/utils/image-convert.js.map +1 -1
  620. package/dist/utils/image-process.d.ts.map +1 -1
  621. package/dist/utils/image-process.js.map +1 -1
  622. package/dist/utils/image-resize-core.d.ts +12 -0
  623. package/dist/utils/image-resize-core.d.ts.map +1 -1
  624. package/dist/utils/image-resize-core.js +5 -0
  625. package/dist/utils/image-resize-core.js.map +1 -1
  626. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  627. package/dist/utils/image-resize-worker.js +3 -2
  628. package/dist/utils/image-resize-worker.js.map +1 -1
  629. package/dist/utils/image-resize.d.ts.map +1 -1
  630. package/dist/utils/image-resize.js +9 -10
  631. package/dist/utils/image-resize.js.map +1 -1
  632. package/dist/utils/json.d.ts.map +1 -1
  633. package/dist/utils/json.js.map +1 -1
  634. package/dist/utils/management-http.d.ts.map +1 -1
  635. package/dist/utils/management-http.js.map +1 -1
  636. package/dist/utils/mime.d.ts.map +1 -1
  637. package/dist/utils/mime.js +1 -1
  638. package/dist/utils/mime.js.map +1 -1
  639. package/dist/utils/oklab.d.ts +43 -0
  640. package/dist/utils/oklab.d.ts.map +1 -0
  641. package/dist/utils/oklab.js +210 -0
  642. package/dist/utils/oklab.js.map +1 -0
  643. package/dist/utils/open-browser.d.ts.map +1 -1
  644. package/dist/utils/open-browser.js.map +1 -1
  645. package/dist/utils/output-files.d.ts +15 -0
  646. package/dist/utils/output-files.d.ts.map +1 -0
  647. package/dist/utils/output-files.js +30 -0
  648. package/dist/utils/output-files.js.map +1 -0
  649. package/dist/utils/paths.d.ts +3 -3
  650. package/dist/utils/paths.d.ts.map +1 -1
  651. package/dist/utils/paths.js +5 -4
  652. package/dist/utils/paths.js.map +1 -1
  653. package/dist/utils/photon.d.ts.map +1 -1
  654. package/dist/utils/photon.js.map +1 -1
  655. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  656. package/dist/utils/pi-user-agent.js.map +1 -1
  657. package/dist/utils/shell.d.ts +1 -3
  658. package/dist/utils/shell.d.ts.map +1 -1
  659. package/dist/utils/shell.js +3 -30
  660. package/dist/utils/shell.js.map +1 -1
  661. package/dist/utils/sleep.d.ts.map +1 -1
  662. package/dist/utils/sleep.js.map +1 -1
  663. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  664. package/dist/utils/syntax-highlight.js +8 -1
  665. package/dist/utils/syntax-highlight.js.map +1 -1
  666. package/dist/utils/text.d.ts.map +1 -1
  667. package/dist/utils/text.js.map +1 -1
  668. package/dist/utils/tool-result-images.d.ts +3 -1
  669. package/dist/utils/tool-result-images.d.ts.map +1 -1
  670. package/dist/utils/tool-result-images.js +4 -1
  671. package/dist/utils/tool-result-images.js.map +1 -1
  672. package/dist/utils/tools-manager.d.ts.map +1 -1
  673. package/dist/utils/tools-manager.js.map +1 -1
  674. package/dist/utils/version-check.d.ts.map +1 -1
  675. package/dist/utils/version-check.js.map +1 -1
  676. package/dist/utils/windows-self-update.d.ts.map +1 -1
  677. package/dist/utils/windows-self-update.js.map +1 -1
  678. package/dist/utils/wsl.d.ts +3 -0
  679. package/dist/utils/wsl.d.ts.map +1 -0
  680. package/dist/utils/wsl.js +15 -0
  681. package/dist/utils/wsl.js.map +1 -0
  682. package/dist/utils/zip.d.ts +7 -0
  683. package/dist/utils/zip.d.ts.map +1 -0
  684. package/dist/utils/zip.js +60 -0
  685. package/dist/utils/zip.js.map +1 -0
  686. package/docs/cli-integration.md +106 -0
  687. package/docs/cli.md +333 -0
  688. package/docs/codemode.md +230 -0
  689. package/docs/compaction.md +47 -28
  690. package/docs/configuration.md +47 -0
  691. package/docs/containerization.md +109 -82
  692. package/docs/custom-provider.md +109 -713
  693. package/docs/docs.json +148 -96
  694. package/docs/environment-variables.md +18 -3
  695. package/docs/extensions.md +284 -604
  696. package/docs/how-pi-works.md +49 -0
  697. package/docs/images/interactive-mode.png +0 -0
  698. package/docs/index.md +24 -69
  699. package/docs/json.md +193 -65
  700. package/docs/keybindings.md +58 -103
  701. package/docs/llama-cpp.md +24 -4
  702. package/docs/mcp.md +272 -0
  703. package/docs/message-types.md +279 -0
  704. package/docs/models.md +124 -489
  705. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  706. package/docs/packages.md +67 -166
  707. package/docs/prompt-templates.md +31 -68
  708. package/docs/providers.md +158 -228
  709. package/docs/quickstart.md +61 -106
  710. package/docs/rpc-commands.md +860 -0
  711. package/docs/rpc-extension-ui.md +200 -0
  712. package/docs/rpc.md +131 -1554
  713. package/docs/sdk.md +79 -1158
  714. package/docs/security.md +72 -32
  715. package/docs/session-format.md +58 -215
  716. package/docs/sessions.md +35 -114
  717. package/docs/settings.md +98 -326
  718. package/docs/shell-aliases.md +85 -5
  719. package/docs/skills.md +51 -190
  720. package/docs/slash-commands.md +60 -0
  721. package/docs/subagents.md +2 -0
  722. package/docs/terminal-setup.md +7 -182
  723. package/docs/termux.md +74 -83
  724. package/docs/themes.md +89 -273
  725. package/docs/tmux.md +31 -39
  726. package/docs/tui.md +74 -910
  727. package/docs/usage.md +52 -129
  728. package/docs/virtual-models.md +114 -0
  729. package/docs/windows.md +45 -17
  730. package/examples/README.md +13 -5
  731. package/examples/extensions/README.md +4 -30
  732. package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
  733. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  734. package/examples/extensions/custom-provider-anthropic/package.json +17 -17
  735. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  736. package/examples/extensions/custom-provider-gitlab-duo/package.json +14 -14
  737. package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
  738. package/examples/extensions/debug-provider.ts +69 -0
  739. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  740. package/examples/extensions/gondolin/package-lock.json +5 -5
  741. package/examples/extensions/gondolin/package.json +1 -1
  742. package/examples/extensions/jev-router.ts +113 -0
  743. package/examples/extensions/prompt-customizer.ts +19 -67
  744. package/examples/extensions/sandbox/package-lock.json +2 -2
  745. package/examples/extensions/sandbox/package.json +1 -1
  746. package/examples/extensions/with-deps/package-lock.json +2 -2
  747. package/examples/extensions/with-deps/package.json +20 -20
  748. package/examples/rpc-client.ts +35 -0
  749. package/examples/sdk/14-codemode-mcp.ts +61 -0
  750. package/examples/sdk/README.md +3 -2
  751. package/npm-shrinkwrap.json +2425 -0
  752. package/package.json +20 -29
  753. package/schemas/models.schema.json +1157 -0
  754. package/schemas/settings.schema.json +734 -0
  755. package/schemas/theme.schema.json +365 -0
  756. package/dist/bundle/chunks/anthropic-messages-ASRU76PT.js +0 -6
  757. package/dist/bundle/chunks/azure-openai-responses-UGF6LMEX.js +0 -2
  758. package/dist/bundle/chunks/chunk-5PRUVL6W.js +0 -1770
  759. package/dist/bundle/chunks/chunk-6R7UI4IY.js +0 -2
  760. package/dist/bundle/chunks/chunk-A3JYRWB6.js +0 -2
  761. package/dist/bundle/chunks/chunk-CHB3CEFP.js +0 -2
  762. package/dist/bundle/chunks/chunk-ELBMWBDG.js +0 -11
  763. package/dist/bundle/chunks/chunk-GMWCTUPB.js +0 -2
  764. package/dist/bundle/chunks/chunk-GTBU4EAF.js +0 -2
  765. package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
  766. package/dist/bundle/chunks/chunk-UIWY7TU5.js +0 -42
  767. package/dist/bundle/chunks/chunk-XNGRGP62.js +0 -2
  768. package/dist/bundle/chunks/google-generative-ai-VCD2PGIY.js +0 -2
  769. package/dist/bundle/chunks/google-vertex-L6U34ZRC.js +0 -2
  770. package/dist/bundle/chunks/mistral-conversations-IXWQ2YKN.js +0 -5
  771. package/dist/bundle/chunks/node-5YXRXMVN.js +0 -16
  772. package/dist/bundle/chunks/openai-codex-responses-P7HKQLIT.js +0 -10
  773. package/dist/bundle/chunks/openai-completions-O7BFLP3U.js +0 -7
  774. package/dist/bundle/chunks/openai-responses-QAKWAYVG.js +0 -2
  775. package/dist/cli/config-selector.d.ts +0 -16
  776. package/dist/cli/config-selector.d.ts.map +0 -1
  777. package/dist/cli/config-selector.js +0 -32
  778. package/dist/cli/config-selector.js.map +0 -1
  779. package/dist/cli/session-picker.d.ts +0 -10
  780. package/dist/cli/session-picker.d.ts.map +0 -1
  781. package/dist/cli/session-picker.js +0 -36
  782. package/dist/cli/session-picker.js.map +0 -1
  783. package/dist/cli/startup-ui.d.ts +0 -20
  784. package/dist/cli/startup-ui.d.ts.map +0 -1
  785. package/dist/cli/startup-ui.js +0 -185
  786. package/dist/cli/startup-ui.js.map +0 -1
  787. package/dist/core/keybindings.d.ts +0 -428
  788. package/dist/core/keybindings.d.ts.map +0 -1
  789. package/dist/core/keybindings.js +0 -321
  790. package/dist/core/keybindings.js.map +0 -1
  791. package/dist/core/tools/render-utils.d.ts +0 -24
  792. package/dist/core/tools/render-utils.d.ts.map +0 -1
  793. package/dist/core/tools/render-utils.js +0 -65
  794. package/dist/core/tools/render-utils.js.map +0 -1
  795. package/dist/core/tools/renderers/bash.d.ts +0 -12
  796. package/dist/core/tools/renderers/bash.d.ts.map +0 -1
  797. package/dist/core/tools/renderers/bash.js +0 -130
  798. package/dist/core/tools/renderers/bash.js.map +0 -1
  799. package/dist/core/tools/renderers/edit.d.ts +0 -23
  800. package/dist/core/tools/renderers/edit.d.ts.map +0 -1
  801. package/dist/core/tools/renderers/edit.js +0 -167
  802. package/dist/core/tools/renderers/edit.js.map +0 -1
  803. package/dist/core/tools/renderers/find.d.ts +0 -10
  804. package/dist/core/tools/renderers/find.d.ts.map +0 -1
  805. package/dist/core/tools/renderers/find.js +0 -64
  806. package/dist/core/tools/renderers/find.js.map +0 -1
  807. package/dist/core/tools/renderers/grep.d.ts +0 -10
  808. package/dist/core/tools/renderers/grep.d.ts.map +0 -1
  809. package/dist/core/tools/renderers/grep.js +0 -69
  810. package/dist/core/tools/renderers/grep.js.map +0 -1
  811. package/dist/core/tools/renderers/index.d.ts +0 -28
  812. package/dist/core/tools/renderers/index.d.ts.map +0 -1
  813. package/dist/core/tools/renderers/index.js +0 -47
  814. package/dist/core/tools/renderers/index.js.map +0 -1
  815. package/dist/core/tools/renderers/ls.d.ts +0 -10
  816. package/dist/core/tools/renderers/ls.d.ts.map +0 -1
  817. package/dist/core/tools/renderers/ls.js +0 -58
  818. package/dist/core/tools/renderers/ls.js.map +0 -1
  819. package/dist/core/tools/renderers/read.d.ts +0 -11
  820. package/dist/core/tools/renderers/read.d.ts.map +0 -1
  821. package/dist/core/tools/renderers/read.js +0 -129
  822. package/dist/core/tools/renderers/read.js.map +0 -1
  823. package/dist/core/tools/renderers/write.d.ts +0 -10
  824. package/dist/core/tools/renderers/write.d.ts.map +0 -1
  825. package/dist/core/tools/renderers/write.js +0 -153
  826. package/dist/core/tools/renderers/write.js.map +0 -1
  827. package/dist/extensions/mcp/mcp-client.d.ts +0 -31
  828. package/dist/extensions/mcp/mcp-client.d.ts.map +0 -1
  829. package/dist/extensions/mcp/mcp-client.js +0 -149
  830. package/dist/extensions/mcp/mcp-client.js.map +0 -1
  831. package/dist/extensions/mcp/mcp-config.d.ts +0 -47
  832. package/dist/extensions/mcp/mcp-config.d.ts.map +0 -1
  833. package/dist/extensions/mcp/mcp-config.js +0 -281
  834. package/dist/extensions/mcp/mcp-config.js.map +0 -1
  835. package/dist/extensions/mcp/mcp-transport.d.ts +0 -65
  836. package/dist/extensions/mcp/mcp-transport.d.ts.map +0 -1
  837. package/dist/extensions/mcp/mcp-transport.js +0 -278
  838. package/dist/extensions/mcp/mcp-transport.js.map +0 -1
  839. package/dist/modes/interactive/assets/clankolas.png +0 -0
  840. package/dist/modes/interactive/chat-viewport.d.ts +0 -20
  841. package/dist/modes/interactive/chat-viewport.d.ts.map +0 -1
  842. package/dist/modes/interactive/chat-viewport.js +0 -28
  843. package/dist/modes/interactive/chat-viewport.js.map +0 -1
  844. package/dist/modes/interactive/components/armin.d.ts +0 -34
  845. package/dist/modes/interactive/components/armin.d.ts.map +0 -1
  846. package/dist/modes/interactive/components/armin.js +0 -333
  847. package/dist/modes/interactive/components/armin.js.map +0 -1
  848. package/dist/modes/interactive/components/assistant-message.d.ts +0 -26
  849. package/dist/modes/interactive/components/assistant-message.d.ts.map +0 -1
  850. package/dist/modes/interactive/components/assistant-message.js +0 -158
  851. package/dist/modes/interactive/components/assistant-message.js.map +0 -1
  852. package/dist/modes/interactive/components/bash-execution.d.ts +0 -34
  853. package/dist/modes/interactive/components/bash-execution.d.ts.map +0 -1
  854. package/dist/modes/interactive/components/bash-execution.js +0 -175
  855. package/dist/modes/interactive/components/bash-execution.js.map +0 -1
  856. package/dist/modes/interactive/components/bordered-loader.d.ts +0 -16
  857. package/dist/modes/interactive/components/bordered-loader.d.ts.map +0 -1
  858. package/dist/modes/interactive/components/bordered-loader.js +0 -54
  859. package/dist/modes/interactive/components/bordered-loader.js.map +0 -1
  860. package/dist/modes/interactive/components/branch-summary-message.d.ts +0 -16
  861. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +0 -1
  862. package/dist/modes/interactive/components/branch-summary-message.js +0 -44
  863. package/dist/modes/interactive/components/branch-summary-message.js.map +0 -1
  864. package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
  865. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
  866. package/dist/modes/interactive/components/compaction-summary-message.js +0 -45
  867. package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
  868. package/dist/modes/interactive/components/config-selector.d.ts +0 -102
  869. package/dist/modes/interactive/components/config-selector.d.ts.map +0 -1
  870. package/dist/modes/interactive/components/config-selector.js +0 -761
  871. package/dist/modes/interactive/components/config-selector.js.map +0 -1
  872. package/dist/modes/interactive/components/countdown-timer.d.ts +0 -14
  873. package/dist/modes/interactive/components/countdown-timer.d.ts.map +0 -1
  874. package/dist/modes/interactive/components/countdown-timer.js +0 -33
  875. package/dist/modes/interactive/components/countdown-timer.js.map +0 -1
  876. package/dist/modes/interactive/components/custom-editor.d.ts +0 -30
  877. package/dist/modes/interactive/components/custom-editor.d.ts.map +0 -1
  878. package/dist/modes/interactive/components/custom-editor.js +0 -115
  879. package/dist/modes/interactive/components/custom-editor.js.map +0 -1
  880. package/dist/modes/interactive/components/custom-entry.d.ts +0 -19
  881. package/dist/modes/interactive/components/custom-entry.d.ts.map +0 -1
  882. package/dist/modes/interactive/components/custom-entry.js +0 -52
  883. package/dist/modes/interactive/components/custom-entry.js.map +0 -1
  884. package/dist/modes/interactive/components/custom-message.d.ts +0 -22
  885. package/dist/modes/interactive/components/custom-message.d.ts.map +0 -1
  886. package/dist/modes/interactive/components/custom-message.js +0 -87
  887. package/dist/modes/interactive/components/custom-message.js.map +0 -1
  888. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  889. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  890. package/dist/modes/interactive/components/daxnuts.js +0 -140
  891. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  892. package/dist/modes/interactive/components/diff.d.ts +0 -12
  893. package/dist/modes/interactive/components/diff.d.ts.map +0 -1
  894. package/dist/modes/interactive/components/diff.js +0 -133
  895. package/dist/modes/interactive/components/diff.js.map +0 -1
  896. package/dist/modes/interactive/components/dynamic-border.d.ts +0 -15
  897. package/dist/modes/interactive/components/dynamic-border.d.ts.map +0 -1
  898. package/dist/modes/interactive/components/dynamic-border.js +0 -21
  899. package/dist/modes/interactive/components/dynamic-border.js.map +0 -1
  900. package/dist/modes/interactive/components/earendil-announcement.d.ts +0 -5
  901. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +0 -1
  902. package/dist/modes/interactive/components/earendil-announcement.js +0 -40
  903. package/dist/modes/interactive/components/earendil-announcement.js.map +0 -1
  904. package/dist/modes/interactive/components/extension-editor.d.ts +0 -21
  905. package/dist/modes/interactive/components/extension-editor.d.ts.map +0 -1
  906. package/dist/modes/interactive/components/extension-editor.js +0 -98
  907. package/dist/modes/interactive/components/extension-editor.js.map +0 -1
  908. package/dist/modes/interactive/components/extension-input.d.ts +0 -23
  909. package/dist/modes/interactive/components/extension-input.d.ts.map +0 -1
  910. package/dist/modes/interactive/components/extension-input.js +0 -61
  911. package/dist/modes/interactive/components/extension-input.js.map +0 -1
  912. package/dist/modes/interactive/components/extension-selector.d.ts +0 -26
  913. package/dist/modes/interactive/components/extension-selector.d.ts.map +0 -1
  914. package/dist/modes/interactive/components/extension-selector.js +0 -83
  915. package/dist/modes/interactive/components/extension-selector.js.map +0 -1
  916. package/dist/modes/interactive/components/first-time-setup.d.ts +0 -25
  917. package/dist/modes/interactive/components/first-time-setup.d.ts.map +0 -1
  918. package/dist/modes/interactive/components/first-time-setup.js +0 -103
  919. package/dist/modes/interactive/components/first-time-setup.js.map +0 -1
  920. package/dist/modes/interactive/components/footer.d.ts +0 -32
  921. package/dist/modes/interactive/components/footer.d.ts.map +0 -1
  922. package/dist/modes/interactive/components/footer.js +0 -222
  923. package/dist/modes/interactive/components/footer.js.map +0 -1
  924. package/dist/modes/interactive/components/index.d.ts +0 -34
  925. package/dist/modes/interactive/components/index.d.ts.map +0 -1
  926. package/dist/modes/interactive/components/index.js +0 -35
  927. package/dist/modes/interactive/components/index.js.map +0 -1
  928. package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -13
  929. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +0 -1
  930. package/dist/modes/interactive/components/keybinding-hints.js +0 -36
  931. package/dist/modes/interactive/components/keybinding-hints.js.map +0 -1
  932. package/dist/modes/interactive/components/login-dialog.d.ts +0 -52
  933. package/dist/modes/interactive/components/login-dialog.d.ts.map +0 -1
  934. package/dist/modes/interactive/components/login-dialog.js +0 -188
  935. package/dist/modes/interactive/components/login-dialog.js.map +0 -1
  936. package/dist/modes/interactive/components/markdown-transform.d.ts +0 -3
  937. package/dist/modes/interactive/components/markdown-transform.d.ts.map +0 -1
  938. package/dist/modes/interactive/components/markdown-transform.js +0 -19
  939. package/dist/modes/interactive/components/markdown-transform.js.map +0 -1
  940. package/dist/modes/interactive/components/mermaid.d.ts +0 -11
  941. package/dist/modes/interactive/components/mermaid.d.ts.map +0 -1
  942. package/dist/modes/interactive/components/mermaid.js +0 -75
  943. package/dist/modes/interactive/components/mermaid.js.map +0 -1
  944. package/dist/modes/interactive/components/model-selector.d.ts +0 -60
  945. package/dist/modes/interactive/components/model-selector.d.ts.map +0 -1
  946. package/dist/modes/interactive/components/model-selector.js +0 -361
  947. package/dist/modes/interactive/components/model-selector.js.map +0 -1
  948. package/dist/modes/interactive/components/oauth-selector.d.ts +0 -33
  949. package/dist/modes/interactive/components/oauth-selector.d.ts.map +0 -1
  950. package/dist/modes/interactive/components/oauth-selector.js +0 -163
  951. package/dist/modes/interactive/components/oauth-selector.js.map +0 -1
  952. package/dist/modes/interactive/components/question-selector.d.ts +0 -24
  953. package/dist/modes/interactive/components/question-selector.d.ts.map +0 -1
  954. package/dist/modes/interactive/components/question-selector.js +0 -158
  955. package/dist/modes/interactive/components/question-selector.js.map +0 -1
  956. package/dist/modes/interactive/components/scoped-models-selector.d.ts +0 -46
  957. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +0 -1
  958. package/dist/modes/interactive/components/scoped-models-selector.js +0 -326
  959. package/dist/modes/interactive/components/scoped-models-selector.js.map +0 -1
  960. package/dist/modes/interactive/components/session-selector-search.d.ts +0 -23
  961. package/dist/modes/interactive/components/session-selector-search.d.ts.map +0 -1
  962. package/dist/modes/interactive/components/session-selector-search.js +0 -155
  963. package/dist/modes/interactive/components/session-selector-search.js.map +0 -1
  964. package/dist/modes/interactive/components/session-selector.d.ts +0 -95
  965. package/dist/modes/interactive/components/session-selector.d.ts.map +0 -1
  966. package/dist/modes/interactive/components/session-selector.js +0 -867
  967. package/dist/modes/interactive/components/session-selector.js.map +0 -1
  968. package/dist/modes/interactive/components/settings-selector.d.ts +0 -92
  969. package/dist/modes/interactive/components/settings-selector.d.ts.map +0 -1
  970. package/dist/modes/interactive/components/settings-selector.js +0 -709
  971. package/dist/modes/interactive/components/settings-selector.js.map +0 -1
  972. package/dist/modes/interactive/components/settings-submenu.d.ts +0 -72
  973. package/dist/modes/interactive/components/settings-submenu.d.ts.map +0 -1
  974. package/dist/modes/interactive/components/settings-submenu.js +0 -165
  975. package/dist/modes/interactive/components/settings-submenu.js.map +0 -1
  976. package/dist/modes/interactive/components/show-images-selector.d.ts +0 -10
  977. package/dist/modes/interactive/components/show-images-selector.d.ts.map +0 -1
  978. package/dist/modes/interactive/components/show-images-selector.js +0 -39
  979. package/dist/modes/interactive/components/show-images-selector.js.map +0 -1
  980. package/dist/modes/interactive/components/skill-invocation-message.d.ts +0 -17
  981. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +0 -1
  982. package/dist/modes/interactive/components/skill-invocation-message.js +0 -47
  983. package/dist/modes/interactive/components/skill-invocation-message.js.map +0 -1
  984. package/dist/modes/interactive/components/status-indicator.d.ts +0 -30
  985. package/dist/modes/interactive/components/status-indicator.d.ts.map +0 -1
  986. package/dist/modes/interactive/components/status-indicator.js +0 -67
  987. package/dist/modes/interactive/components/status-indicator.js.map +0 -1
  988. package/dist/modes/interactive/components/theme-selector.d.ts +0 -11
  989. package/dist/modes/interactive/components/theme-selector.d.ts.map +0 -1
  990. package/dist/modes/interactive/components/theme-selector.js +0 -50
  991. package/dist/modes/interactive/components/theme-selector.js.map +0 -1
  992. package/dist/modes/interactive/components/thinking-selector.d.ts +0 -23
  993. package/dist/modes/interactive/components/thinking-selector.d.ts.map +0 -1
  994. package/dist/modes/interactive/components/thinking-selector.js +0 -109
  995. package/dist/modes/interactive/components/thinking-selector.js.map +0 -1
  996. package/dist/modes/interactive/components/tool-execution.d.ts +0 -80
  997. package/dist/modes/interactive/components/tool-execution.d.ts.map +0 -1
  998. package/dist/modes/interactive/components/tool-execution.js +0 -328
  999. package/dist/modes/interactive/components/tool-execution.js.map +0 -1
  1000. package/dist/modes/interactive/components/tree-selector.d.ts +0 -94
  1001. package/dist/modes/interactive/components/tree-selector.d.ts.map +0 -1
  1002. package/dist/modes/interactive/components/tree-selector.js +0 -1245
  1003. package/dist/modes/interactive/components/tree-selector.js.map +0 -1
  1004. package/dist/modes/interactive/components/trust-selector.d.ts +0 -23
  1005. package/dist/modes/interactive/components/trust-selector.d.ts.map +0 -1
  1006. package/dist/modes/interactive/components/trust-selector.js +0 -91
  1007. package/dist/modes/interactive/components/trust-selector.js.map +0 -1
  1008. package/dist/modes/interactive/components/user-message-selector.d.ts +0 -30
  1009. package/dist/modes/interactive/components/user-message-selector.d.ts.map +0 -1
  1010. package/dist/modes/interactive/components/user-message-selector.js +0 -114
  1011. package/dist/modes/interactive/components/user-message-selector.js.map +0 -1
  1012. package/dist/modes/interactive/components/user-message.d.ts +0 -16
  1013. package/dist/modes/interactive/components/user-message.d.ts.map +0 -1
  1014. package/dist/modes/interactive/components/user-message.js +0 -49
  1015. package/dist/modes/interactive/components/user-message.js.map +0 -1
  1016. package/dist/modes/interactive/components/visual-truncate.d.ts +0 -24
  1017. package/dist/modes/interactive/components/visual-truncate.d.ts.map +0 -1
  1018. package/dist/modes/interactive/components/visual-truncate.js +0 -33
  1019. package/dist/modes/interactive/components/visual-truncate.js.map +0 -1
  1020. package/dist/modes/interactive/external-editor.d.ts +0 -12
  1021. package/dist/modes/interactive/external-editor.d.ts.map +0 -1
  1022. package/dist/modes/interactive/external-editor.js +0 -38
  1023. package/dist/modes/interactive/external-editor.js.map +0 -1
  1024. package/dist/modes/interactive/interactive-mode.d.ts +0 -443
  1025. package/dist/modes/interactive/interactive-mode.d.ts.map +0 -1
  1026. package/dist/modes/interactive/interactive-mode.js +0 -5604
  1027. package/dist/modes/interactive/interactive-mode.js.map +0 -1
  1028. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  1029. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  1030. package/dist/modes/interactive/model-search.d.ts +0 -12
  1031. package/dist/modes/interactive/model-search.d.ts.map +0 -1
  1032. package/dist/modes/interactive/model-search.js +0 -15
  1033. package/dist/modes/interactive/model-search.js.map +0 -1
  1034. package/dist/modes/interactive/session-share.d.ts +0 -16
  1035. package/dist/modes/interactive/session-share.d.ts.map +0 -1
  1036. package/dist/modes/interactive/session-share.js +0 -184
  1037. package/dist/modes/interactive/session-share.js.map +0 -1
  1038. package/dist/modes/interactive/theme/dark.json +0 -91
  1039. package/dist/modes/interactive/theme/light.json +0 -90
  1040. package/dist/modes/interactive/theme/theme-controller.d.ts +0 -41
  1041. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  1042. package/dist/modes/interactive/theme/theme-controller.js +0 -130
  1043. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  1044. package/dist/modes/interactive/theme/theme-json.d.ts +0 -84
  1045. package/dist/modes/interactive/theme/theme-json.d.ts.map +0 -1
  1046. package/dist/modes/interactive/theme/theme-json.js +0 -130
  1047. package/dist/modes/interactive/theme/theme-json.js.map +0 -1
  1048. package/dist/modes/interactive/theme/theme-schema.json +0 -356
  1049. package/dist/modes/interactive/theme/theme.d.ts +0 -131
  1050. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  1051. package/dist/modes/interactive/theme/theme.js.map +0 -1
  1052. package/dist/modes/interactive/tui-renderer.d.ts +0 -21
  1053. package/dist/modes/interactive/tui-renderer.d.ts.map +0 -1
  1054. package/dist/modes/interactive/tui-renderer.js +0 -66
  1055. package/dist/modes/interactive/tui-renderer.js.map +0 -1
  1056. package/docs/development.md +0 -90
  1057. package/examples/extensions/border-status-editor.ts +0 -145
  1058. package/examples/extensions/built-in-tool-renderer.ts +0 -249
  1059. package/examples/extensions/custom-footer.ts +0 -64
  1060. package/examples/extensions/custom-header.ts +0 -73
  1061. package/examples/extensions/doom-overlay/README.md +0 -46
  1062. package/examples/extensions/doom-overlay/doom/build/doom.js +0 -21
  1063. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  1064. package/examples/extensions/doom-overlay/doom/build.sh +0 -152
  1065. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +0 -72
  1066. package/examples/extensions/doom-overlay/doom-component.ts +0 -132
  1067. package/examples/extensions/doom-overlay/doom-engine.ts +0 -173
  1068. package/examples/extensions/doom-overlay/doom-keys.ts +0 -104
  1069. package/examples/extensions/doom-overlay/index.ts +0 -74
  1070. package/examples/extensions/doom-overlay/wad-finder.ts +0 -55
  1071. package/examples/extensions/entry-renderer.ts +0 -41
  1072. package/examples/extensions/github-issue-autocomplete.ts +0 -185
  1073. package/examples/extensions/handoff.ts +0 -190
  1074. package/examples/extensions/interactive-shell.ts +0 -196
  1075. package/examples/extensions/kimi-deferred-tools.ts +0 -61
  1076. package/examples/extensions/message-renderer.ts +0 -59
  1077. package/examples/extensions/minimal-mode.ts +0 -426
  1078. package/examples/extensions/modal-editor.ts +0 -85
  1079. package/examples/extensions/overlay-qa-tests.ts +0 -1450
  1080. package/examples/extensions/overlay-test.ts +0 -153
  1081. package/examples/extensions/plan-mode/README.md +0 -66
  1082. package/examples/extensions/plan-mode/index.ts +0 -390
  1083. package/examples/extensions/plan-mode/utils.ts +0 -168
  1084. package/examples/extensions/preset.ts +0 -436
  1085. package/examples/extensions/qna.ts +0 -118
  1086. package/examples/extensions/question.ts +0 -278
  1087. package/examples/extensions/questionnaire.ts +0 -440
  1088. package/examples/extensions/rainbow-editor.ts +0 -88
  1089. package/examples/extensions/snake.ts +0 -343
  1090. package/examples/extensions/space-invaders.ts +0 -560
  1091. package/examples/extensions/structured-output.ts +0 -65
  1092. package/examples/extensions/summarize.ts +0 -199
  1093. package/examples/extensions/tic-tac-toe.ts +0 -1008
  1094. package/examples/extensions/todo.ts +0 -297
  1095. package/examples/extensions/tools.ts +0 -146
  1096. package/examples/extensions/truncated-tool.ts +0 -195
  1097. package/examples/plugins/pi-example-plugin/README.md +0 -38
  1098. package/examples/plugins/pi-example-plugin/package.json +0 -10
  1099. package/examples/plugins/pi-example-plugin/src/contract.ts +0 -13
  1100. package/examples/plugins/pi-example-plugin/src/session.ts +0 -23
  1101. package/examples/plugins/pi-example-plugin/src/tui.ts +0 -31
  1102. package/examples/rpc-extension-ui.ts +0 -641
  1103. /package/dist/bundle/chunks/{chunk-PATAL4PO.js → chunk-7ZC4UXSL.js} +0 -0
@@ -294,7 +294,8 @@ user sends prompt ────────────────────
294
294
  │ ┌─── turn (repeats while LLM calls tools) ───┐ │
295
295
  │ │ │ │
296
296
  │ ├─► turn_start │ │
297
- │ ├─► context (can modify messages) │ │
297
+ │ ├─► context (can modify conversation messages) │
298
+ │ ├─► context_with_system (can modify the full transcript)
298
299
  │ ├─► before_provider_headers (can mutate headers) |
299
300
  │ ├─► before_provider_request (can inspect or replace payload)
300
301
  │ ├─► after_provider_response (status + headers, before stream consume)
@@ -307,9 +308,13 @@ user sends prompt ────────────────────
307
308
  │ │ └─► tool_execution_end │ │
308
309
  │ │ │ │
309
310
  │ └─► turn_end │ │
311
+ │ └─► threshold compaction before a naturally required next turn
310
312
  │ │
311
313
  ├─► agent_end │
312
- └─► agent_settled (no retry/compaction/follow-up left) │
314
+ ├─► retry backoff or final-attempt recovery (when selected)
315
+ │ └─► fresh agent_start on successful recovery │
316
+ ├─► agent_before_settle (can append entries and continue)│
317
+ └─► agent_settled (final, notification only) │
313
318
  │
314
319
  user sends another prompt ◄────────────────────────────────┘
315
320
 
@@ -538,10 +543,13 @@ pi.on("before_agent_start", async (event, ctx) => {
538
543
  // event.systemPrompt - current chained system prompt for this handler
539
544
  // (includes changes from earlier before_agent_start handlers)
540
545
  // event.systemPromptOptions - structured options used to build the system prompt
541
- // .customPrompt - any custom system prompt (from --system-prompt, SYSTEM.md, or custom templates)
546
+ // .customPrompt - exact prompt prefix from --system-prompt, SYSTEM.md, or custom templates
547
+ // .forceSystemPrompt - optional exact replacement for the complete prompt
542
548
  // .selectedTools - tools currently active in the prompt
543
549
  // .toolSnippets - one-line descriptions for each tool
544
- // .promptGuidelines - custom guideline bullets
550
+ // .toolGuidelines - guideline bullets keyed by tool name
551
+ // .promptGuidelines - additional custom guideline bullets
552
+ // .sections - custom XML-wrapped sections keyed by tag name
545
553
  // .appendSystemPrompt - text from --append-system-prompt flags
546
554
  // .cwd - working directory
547
555
  // .contextFiles - AGENTS.md files and other loaded context files
@@ -560,13 +568,13 @@ pi.on("before_agent_start", async (event, ctx) => {
560
568
  });
561
569
  ```
562
570
 
563
- The `systemPromptOptions` field gives extensions access to the same structured data Pi uses to build the system prompt. This lets you inspect what Pi has loaded — custom prompts, guidelines, tool snippets, context files, skills — without re-discovering resources or re-parsing flags. Use it when your extension needs to make deep, informed changes to the system prompt while respecting user-provided configuration.
571
+ The `systemPromptOptions` field gives extensions access to the same structured data Pi uses to build the system prompt. Collections are mutable. Prefer changing `sections`, `selectedTools`, or `promptGuidelines`: Pi diffs the resulting prompt sections against what the model already has and appends one system message patching only the changed sections. Returning `systemPrompt`, or setting `forceSystemPrompt`, replaces the whole prompt for the run: every provider receives the forced text as its leading system prompt (a cache miss when it changes), and the session transcript keeps recording the structured sections. Tool selection changes update both the prompt contributions and executable provider tools; calling `pi.setActiveTools()` inside the handler has the same effect as editing `selectedTools`. Models that accept system messages mid-conversation receive the patch in place and keep their cached prefix; other models get the replayed prompt as their system prompt, which is a cache miss once per change.
564
572
 
565
573
  Inside `before_agent_start`, `event.systemPrompt` and `ctx.getSystemPrompt()` both reflect the chained system prompt as of the current handler. Later `before_agent_start` handlers can still modify it again.
566
574
 
567
- #### agent_start / agent_end / agent_settled
575
+ #### agent_start / agent_end / agent_before_settle / agent_settled
568
576
 
569
- `agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Pi may still auto-retry, auto-compact and retry, or continue with queued follow-up messages. Use `agent_settled` for status integrations that need to know Pi will not continue running automatically.
577
+ `agent_start` fires when a low-level agent run begins. `agent_end` fires when that run ends, but Pi may still auto-retry, auto-compact and retry, or continue with queued follow-up messages. `agent_before_settle` is the final actionable boundary: it can append session entries and request one continuation. `agent_settled` is final and notification-only; use it for status integrations that need to know Pi will not continue running automatically.
570
578
 
571
579
  ```typescript
572
580
  pi.on("agent_start", async (_event, ctx) => {});
@@ -575,11 +583,28 @@ pi.on("agent_end", async (event, ctx) => {
575
583
  // event.messages - messages from this low-level run
576
584
  });
577
585
 
586
+ let addedReviewReminder = false;
587
+ pi.on("agent_before_settle", async (event, ctx) => {
588
+ if (addedReviewReminder) return;
589
+ addedReviewReminder = true;
590
+ return {
591
+ entries: [...event.entries, {
592
+ type: "custom_message",
593
+ customType: "review-reminder",
594
+ content: "Review the final diff before replying.",
595
+ display: false,
596
+ }],
597
+ continue: true,
598
+ };
599
+ });
600
+
578
601
  pi.on("agent_settled", async (_event, ctx) => {
579
- // ctx.isIdle() is true here unless another extension started a new run.
602
+ // ctx.isIdle() is true; runs requested here start after all settled handlers finish.
580
603
  });
581
604
  ```
582
605
 
606
+ If the run is aborted while `agent_before_settle` handlers are running, valid returned entries are still committed, but requested continuation is suppressed. Work requested from `agent_settled` is deferred until every settled handler completes, so notification dispatch is non-reentrant.
607
+
583
608
  #### ui_prompt_start / ui_prompt_end
584
609
 
585
610
  Notification-only lifecycle events for blocking user-facing extension UI prompts. They fire around `ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`, `ctx.ui.editor()`, and `ctx.ui.custom()` so host/status integrations can report "waiting for user" instead of just "running".
@@ -607,11 +632,34 @@ pi.on("turn_start", async (event, ctx) => {
607
632
  // event.turnIndex, event.timestamp
608
633
  });
609
634
 
635
+ let replacedResponse = false;
610
636
  pi.on("turn_end", async (event, ctx) => {
611
637
  // event.turnIndex, event.message, event.toolResults
638
+ // event.entries contains the structural entries proposed so far.
639
+ if (replacedResponse || event.outcome !== "completed" || event.toolResults.length > 0) return;
640
+ replacedResponse = true;
641
+ return {
642
+ entries: [
643
+ ...event.entries,
644
+ { type: "context_edit", targetId: event.messageEntryId, replacement: null },
645
+ {
646
+ type: "custom_message",
647
+ customType: "replacement-instruction",
648
+ content: "Answer again using the persisted user request.",
649
+ display: false,
650
+ },
651
+ ],
652
+ continue: true,
653
+ };
612
654
  });
613
655
  ```
614
656
 
657
+ `turn_end` runs after the assistant and tool-result messages have been persisted and before the low-level `turn_end` event. Retry backoff and final-attempt recovery still happen after `agent_end`, preserving their existing lifecycle and queue ordering; `agent_before_settle` sees the repaired projection after that work completes. Boundary handlers run in extension load and registration order. Each handler sees prior proposals in `event.entries` and sees `event.context` rebuilt from them. Returning `entries` or `continue` replaces only that field; omitted fields preserve the current proposal. Allowed draft entry types are `custom`, `custom_message`, `context_edit`, and `compaction`. The complete proposal is validated before it is appended in list order after all handlers finish; a handler error is reported and later handlers still run. Validation prevents partially applied semantic errors, but persistence is not transactional.
658
+
659
+ `continue: true` ensures one next provider request for that boundary invocation. If tool results, steering, or a follow-up already cause that request, they satisfy the decision and no additional request is made; otherwise Pi makes one context-only request. Error and aborted responses remain hard exits. `continue: false` never suppresses natural work. Guard continuation conditions: an unconditional `continue: true` is evaluated again after the next response and can create an endless loop. A `custom_message` draft contributes a user-role model message but is extension-authored: it does not run human input hooks, slash commands, skills, or prompt templates.
660
+
661
+ Host integrations that construct `TurnEndEvent` values must now provide `messageEntryId`, `toolResultEntryIds`, `outcome`, `entries`, `continue`, and `context`. `ExtensionEvent` exhaustive switches must also handle `agent_before_settle`. `ExtensionRunner.emit()` excludes actionable turn boundaries; dispatch `turn_end` and `agent_before_settle` through `emitBoundary(baseEvent, buildContext)` so handlers receive chained previews. Other dedicated runner methods still return results for events such as `session_before_*`.
662
+
615
663
  #### message_start / message_update / message_end
616
664
 
617
665
  Fired for message lifecycle updates.
@@ -678,12 +726,31 @@ Fired before each LLM call. Modify messages non-destructively. See [Session Form
678
726
 
679
727
  ```typescript
680
728
  pi.on("context", async (event, ctx) => {
681
- // event.messages - deep copy, safe to modify
729
+ // event.messages - deep copy without system messages, safe to modify
682
730
  const filtered = event.messages.filter(m => !shouldPrune(m));
683
731
  return { messages: filtered };
684
732
  });
685
733
  ```
686
734
 
735
+ `event.messages` holds the conversation without system messages. The prompt and tool declarations belong to Pi and are not part of this hook: when the handler returns a changed list, Pi replays the current prompt sections and tool declarations into one leading system message ahead of the returned messages. Filtering, windowing, or slicing from a compaction summary therefore cannot drop the prompt or the tools. An unchanged list keeps mid-conversation system messages in place, so models that accept them retain their cached prefix. System messages a handler adds are kept after Pi's head. To change the prompt or the tool set durably, use [`before_agent_start`](#before_agent_start) or `pi.setActiveTools()`; to edit system messages for one request, use [`context_with_system`](#context_with_system).
736
+
737
+ #### context_with_system
738
+
739
+ Fired before each LLM call, after every `context` handler has run and Pi has restored the prompt and tool state. `event.messages` is the full transcript, including the leading system message and any mid-conversation prompt or tool patches (see [Session Format](session-format.md#sessionmessageentry)). The returned messages are sent as they are: this hook owns the prompt and tool declarations for the request.
740
+
741
+ ```typescript
742
+ import { getCurrentSystemMessage } from "@punch-bot/ai";
743
+
744
+ pi.on("context_with_system", async (event, ctx) => {
745
+ const cut = findCutIndex(event.messages);
746
+ // Fold the dropped prefix so its prompt and tool state survives as the new head.
747
+ const head = getCurrentSystemMessage(event.messages.slice(0, cut));
748
+ return { messages: head ? [head, ...event.messages.slice(cut)] : event.messages.slice(cut) };
749
+ });
750
+ ```
751
+
752
+ Rules: keep a system message at index 0 (providers read the prompt and initial tool declarations there; Pi reports an error if a handler drops it). Removing a system message removes the tool declarations and section patches it carries. Check your output with `getCurrentSystemPrompt()` and `getCurrentTools()` from `@punch-bot/ai`. Handlers run in extension load order; a `systemPrompt` forced from `before_agent_start` is still projected onto the request afterwards.
753
+
687
754
  #### before_provider_headers
688
755
 
689
756
  Fired after the outgoing HTTP headers are assembled. Use it to add, override, or remove request headers.
@@ -735,6 +802,25 @@ pi.on("after_provider_response", (event, ctx) => {
735
802
 
736
803
  Header availability depends on provider and transport. Providers that abstract HTTP responses may not expose headers.
737
804
 
805
+ #### cache_warming_decision
806
+
807
+ Fired before each prompt-cache refresh with pi's decision filled in. The event carries only pi's cost estimates; use `ctx.model`, `ctx.isIdle()`, and `ctx.getContextUsage()` for everything else.
808
+
809
+ ```typescript
810
+ pi.on("cache_warming_decision", (event, ctx) => {
811
+ // event.warmCost: price of this refresh
812
+ // event.missCost: extra price of the next request if the entry is lost
813
+ // event.continuationProbability: pi's estimate that a request arrives in time
814
+ // event.action: "warm" | "stop", pi's decision
815
+
816
+ if (ctx.model?.provider === "my-provider") {
817
+ return { action: "stop" };
818
+ }
819
+ });
820
+ ```
821
+
822
+ Return `{ action: "warm" }` or `{ action: "stop" }` to override; the last handler that returns an action wins. `"stop"` ends warming until the next real request.
823
+
738
824
  ### Model Events
739
825
 
740
826
  #### model_select
@@ -906,6 +992,8 @@ pi.on("user_bash", (event, ctx) => {
906
992
  });
907
993
  ```
908
994
 
995
+ Returning `undefined` continues to the next handler, then local execution if none handles the event. A valid result stops propagation: `operations` executes the command through the supplied backend, while `result` records the completed command without executing it.
996
+
909
997
  ### Input Events
910
998
 
911
999
  #### input
@@ -1125,7 +1213,7 @@ const options = ctx.getSystemPromptOptions();
1125
1213
  const contextPaths = options.contextFiles?.map((file) => file.path) ?? [];
1126
1214
  ```
1127
1215
 
1128
- This has the same shape and mutability as `before_agent_start` `event.systemPromptOptions`: custom prompt, active tools, tool snippets, prompt guidelines, appended system prompt text, cwd, loaded context files, and loaded skills. It may include full context file contents, so treat it as sensitive extension-local data and avoid exposing it through command lists, logs, or autocomplete metadata.
1216
+ This has the same shape and mutability as `before_agent_start` `event.systemPromptOptions`: custom or forced prompt, active tools, tool snippets, per-tool and custom rules, custom sections, appended prompt text, cwd, loaded context files, and loaded skills. It may include full context file contents, so treat it as sensitive extension-local data and avoid exposing it through command lists, logs, or autocomplete metadata.
1129
1217
 
1130
1218
  This reports the current base prompt inputs. It does not include per-turn `before_agent_start` chained system-prompt changes, later `context` event message mutations, or `before_provider_request` payload rewrites.
1131
1219
 
@@ -1366,7 +1454,16 @@ export default function (pi: ExtensionAPI) {
1366
1454
 
1367
1455
  ### pi.on(event, handler)
1368
1456
 
1369
- Subscribe to events. See [Events](#events) for event types and return values.
1457
+ Subscribe to events. Returns an unsubscribe function that removes only that registration. See [Events](#events) for event types and return values.
1458
+
1459
+ ```typescript
1460
+ const unsubscribe = pi.on("agent_end", async (event) => {
1461
+ unsubscribe();
1462
+ await updateIntegration(event.messages);
1463
+ });
1464
+ ```
1465
+
1466
+ Handlers run in extension load order, then registration order within each extension. Adding or removing a handler does not affect a dispatch already in progress.
1370
1467
 
1371
1468
  ### pi.registerTool(definition)
1372
1469
 
@@ -1600,27 +1697,6 @@ mode and would not execute if sent via `prompt`.
1600
1697
 
1601
1698
  Register a custom TUI renderer for custom messages with your `customType`. Custom messages are created with `pi.sendMessage()` and participate in LLM context. See [Custom UI](#custom-ui).
1602
1699
 
1603
- ### pi.registerMarkdownTransformer(transformer)
1604
-
1605
- Register a transformer for the Markdown in normal user text, assistant text, and thinking blocks. Transformers run in extension load order, and each transformer receives the Markdown returned by the previous transformer. After the chain finishes, Pi renders the transformed content with its built-in renderer.
1606
-
1607
- The transformer receives the Markdown string and a context with:
1608
-
1609
- - `messageType` — `"user"`, `"assistant"`, or `"assistant-thinking"`
1610
- - `isStreaming` — `true` for partial assistant updates; `false` for user, finalized assistant, and restored messages
1611
- - `availableWidth` — exact terminal columns available for the transformed Markdown content
1612
-
1613
- Return the transformed Markdown:
1614
-
1615
- ```typescript
1616
- pi.registerMarkdownTransformer((markdown, { messageType, isStreaming }) => {
1617
- if (isStreaming || messageType === "assistant-thinking") return markdown;
1618
- return markdown.replaceAll("-->", "→");
1619
- });
1620
- ```
1621
-
1622
- If a transformer throws, Pi keeps the Markdown produced so far and continues with the next transformer. The hook is display-only: the original message remains unchanged in the session and model context. It runs for new user messages, assistant streaming updates, restored session messages, and terminal width changes, so transformers should remain synchronous and inexpensive.
1623
-
1624
1700
  ### pi.registerEntryRenderer(customType, renderer)
1625
1701
 
1626
1702
  Register a custom TUI renderer for custom entries with your `customType`. Custom entries are created with `pi.appendEntry()` and do not participate in LLM context.
@@ -2364,670 +2440,274 @@ Custom editors and `ctx.ui.custom()` components receive `keybindings: Keybinding
2364
2440
 
2365
2441
  #### Fallback
2366
2442
 
2367
- If a slot renderer is not defined or throws:
2368
- - `renderCall`: Shows the tool name
2369
- - `renderResult`: Shows raw text from `content`
2370
-
2371
- ### Dynamic Tool Loading
2372
-
2373
- Extensions can register many tools while keeping only a small initial set active. A tool can then add more tools with `pi.setActiveTools()` during execution. Pi detects purely additive changes, records the newly available tool names on that tool result, and applies the updated active set before the next model request.
2374
-
2375
- This works with every model. Models with native deferred-loading support preserve the stable prompt prefix and load the new definitions at the tool-result position. Other models use the fallback described below.
2376
-
2377
- The lifecycle is:
2443
+ Extensions are TypeScript modules that add executable behavior to Pi. Use one when a workflow needs tools, commands, event handlers, model providers, session state, or terminal UI rather than instructions alone.
2378
2444
 
2379
- 1. Register every tool with `pi.registerTool()` so it appears in `pi.getAllTools()`.
2380
- 2. Keep loader tools, such as `search_tools`, active and leave searchable tools inactive.
2381
- 3. During loader execution, call `pi.setActiveTools([...currentTools, ...matchingTools])`. The change must be additive: do not remove currently active tools in the same call.
2382
- 4. Pi records which tools were added on the loader's tool result.
2383
- 5. Before the next model response, Pi exposes the added definitions using native deferred loading when supported, or the normal active tool list otherwise.
2445
+ An extension runs inside the Pi process with the same operating-system permissions. It can inspect prompts, tool calls, files, credentials, and session history, so load extensions only from sources you trust.
2384
2446
 
2385
- You do not need to return provider-specific tool references or mark the loader as a special search tool. The active-tool change is the signal. Names passed to `pi.setActiveTools()` must already be registered; unknown names are ignored.
2447
+ Typical extensions add an agent tool, protect paths, confirm dangerous commands, react to session events, modify context, expose a command, or display persistent status.
2386
2448
 
2387
- #### Models with native deferred loading
2449
+ <a id="quick-start"></a>
2450
+ <a id="writing-an-extension"></a>
2451
+ <a id="create-an-extension"></a>
2388
2452
 
2389
- - **Anthropic**
2390
- - **Models:** Sonnet, Opus, Fable version 4.5 or newer (without Haiku)
2391
- - **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
2392
- - **Fireworks Messages API**
2393
- - **Native representation:** Deferred definitions use `defer_loading`; the load point uses `tool_reference` content.
2394
- - **Loader names:** Use `ToolSearch` or `tool_search` for prefix deferral. Other loader names still work, but Fireworks includes the loaded schemas in the initial tool prefix, losing the cache benefit.
2395
- - This does not change API routing: Fireworks GLM models and Kimi K3 use Chat Completions, not Messages.
2396
- - **OpenAI**
2397
- - **Models:** `gpt-5.4` and newer family
2398
- - **Native representation:** Pi adds completed client `tool_search_call` and `tool_search_output` items at the load point.
2453
+ ## Create and load an extension
2399
2454
 
2400
- For a verified custom model or proxy, native handling can be enabled with `compat.supportsToolReferences: true` for `anthropic-messages`, or `compat.supportsToolSearch: true` for `openai-responses` and `openai-codex-responses`. Leave these disabled unless the endpoint and model accept the corresponding native protocol.
2455
+ An extension exports a default factory that receives `ExtensionAPI`. The factory registers capabilities for the current extension runtime.
2401
2456
 
2402
- #### Fallback behavior
2403
-
2404
- For all other models and providers, dynamic activation still works: Pi sends the complete current active tool list normally on the next request. The model can call the newly activated tools, but adding their definitions may invalidate the provider's cached prompt prefix.
2405
-
2406
- Pi also uses this safe fallback when the active set is not purely additive, such as replacing one group of tools with another. Tool removals therefore work, but they do not use deferred loading.
2407
-
2408
- For the best cache behavior, keep the loader tool active for the whole session and add tools instead of replacing the active set. Also note that activating a tool with `promptSnippet` or `promptGuidelines` rebuilds the system prompt; that system-prompt change can invalidate the prefix even when the provider supports deferred schemas. Lazily loaded tools should usually rely on their tool `description` and omit active-only prompt metadata.
2409
-
2410
- #### Search tool example
2411
-
2412
- The following extension registers two searchable tools, removes them from the initial active set, and keeps only `search_tools` as their loader. The example uses simple keyword matching, but the search implementation could use BM25, embeddings, a remote catalog, or project-specific routing.
2457
+ Create `~/.pi/agent/extensions/hello.ts`:
2413
2458
 
2414
2459
  ```typescript
2415
2460
  import type { ExtensionAPI } from "@punch-bot/cli";
2416
- import { Type } from "typebox";
2417
-
2418
- const SEARCHABLE_TOOL_NAMES = new Set(["lookup_weather", "search_issues"]);
2419
2461
 
2420
2462
  export default function (pi: ExtensionAPI) {
2421
- pi.registerTool({
2422
- name: "lookup_weather",
2423
- label: "Lookup Weather",
2424
- description: "Look up the current weather for a city",
2425
- parameters: Type.Object({ city: Type.String() }),
2426
- async execute(_toolCallId, params) {
2427
- return {
2428
- content: [{ type: "text", text: `Weather for ${params.city}: sunny` }],
2429
- details: {},
2430
- };
2463
+ pi.registerCommand("hello", {
2464
+ description: "Show a greeting",
2465
+ handler: async (name, ctx) => {
2466
+ ctx.ui.notify(`Hello, ${name || "world"}!`, "info");
2431
2467
  },
2432
2468
  });
2469
+ }
2470
+ ```
2433
2471
 
2434
- pi.registerTool({
2435
- name: "search_issues",
2436
- label: "Search Issues",
2437
- description: "Search project issues by keyword",
2438
- parameters: Type.Object({ query: Type.String() }),
2439
- async execute(_toolCallId, params) {
2440
- return {
2441
- content: [{ type: "text", text: `No open issues matching ${params.query}` }],
2442
- details: {},
2443
- };
2444
- },
2445
- });
2472
+ Start Pi and run `/hello`. During development, load a file directly:
2446
2473
 
2447
- pi.registerTool({
2448
- name: "search_tools",
2449
- label: "Search Tools",
2450
- description: "Search for and enable tools relevant to a task",
2451
- promptSnippet: "Search for additional tools when the active tools cannot perform the task",
2452
- promptGuidelines: [
2453
- "Use search_tools when a task requires a capability that is not currently available.",
2454
- ],
2455
- parameters: Type.Object({
2456
- query: Type.String({ description: "Capability or task to search for" }),
2457
- limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 10 })),
2458
- }),
2459
- async execute(_toolCallId, params) {
2460
- const terms = params.query.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
2461
- const matches = pi.getAllTools()
2462
- .filter((tool) => SEARCHABLE_TOOL_NAMES.has(tool.name))
2463
- .map((tool) => ({
2464
- tool,
2465
- score: terms.reduce(
2466
- (score, term) =>
2467
- score + (`${tool.name} ${tool.description}`.toLowerCase().includes(term) ? 1 : 0),
2468
- 0,
2469
- ),
2470
- }))
2471
- .filter((match) => match.score > 0)
2472
- .sort((a, b) => b.score - a.score)
2473
- .slice(0, params.limit ?? 3)
2474
- .map((match) => match.tool.name);
2475
-
2476
- if (matches.length === 0) {
2477
- return {
2478
- content: [{ type: "text", text: `No tools found for: ${params.query}` }],
2479
- details: { matches: [] },
2480
- };
2481
- }
2474
+ ```bash
2475
+ pi --extension ./hello.ts
2476
+ ```
2482
2477
 
2483
- const active = pi.getActiveTools();
2484
- const added = matches.filter((name) => !active.includes(name));
2485
- pi.setActiveTools([...new Set([...active, ...added])]);
2478
+ Pi uses `jiti`, so local TypeScript extensions do not need a separate compilation step. Use [Pi packages](packages.md) for distributed extensions and dependencies.
2486
2479
 
2487
- return {
2488
- content: [{
2489
- type: "text",
2490
- text: added.length > 0
2491
- ? `Loaded tools: ${added.join(", ")}`
2492
- : `Matching tools already active: ${matches.join(", ")}`,
2493
- }],
2494
- details: { matches, added },
2495
- };
2496
- },
2497
- });
2480
+ <a id="extension-locations"></a>
2481
+ <a id="available-imports"></a>
2482
+ <a id="choose-where-it-loads"></a>
2498
2483
 
2499
- pi.on("session_start", () => {
2500
- // Keep searchable tools registered but initially inactive. Preserve built-ins
2501
- // and tools owned by other extensions, and keep the loader itself active.
2502
- const initialTools = pi.getActiveTools().filter(
2503
- (name) => !SEARCHABLE_TOOL_NAMES.has(name),
2504
- );
2505
- pi.setActiveTools([...new Set([...initialTools, "search_tools"])]);
2506
- });
2507
- }
2508
- ```
2484
+ ## Add it to Pi
2509
2485
 
2510
- When `search_tools` adds a match, the model receives that definition on the immediately following request. On a native-capable model the definition is anchored after the search result without changing the initial tool-schema prefix. On other models it appears in the normal tool list on that same following request.
2486
+ Place the extension in your user or project extensions directory. Pi loads direct TypeScript or JavaScript files and subdirectories containing an `index.ts` or `index.js` entry point.
2511
2487
 
2512
- ## Custom UI
2488
+ Use a single file for a small extension and a directory for a multi-file implementation. Put npm dependencies in a nearby `package.json`. See [Configuration](configuration.md) for conventional locations and [Settings](settings.md#resources) for additional paths.
2513
2489
 
2514
- Extensions can interact with users via `ctx.ui` methods and customize how messages/tools render.
2490
+ Reload replaces the extension runtime, so code after `await ctx.reload()` must not reuse state from the old runtime. Only personal and explicit command-line extensions can participate in the `project_trust` event that runs before project extensions load.
2515
2491
 
2516
- **For custom components, see [tui.md](tui.md)** which has copy-paste patterns for:
2517
- - Selection dialogs (SelectList)
2518
- - Async operations with cancel (BorderedLoader)
2519
- - Settings toggles (SettingsList)
2520
- - Status indicators (setStatus)
2521
- - Working message, visibility, and indicator during streaming (`setWorkingMessage`, `setWorkingVisible`, `setWorkingIndicator`)
2522
- - Widgets above/below editor (setWidget)
2523
- - Autocomplete providers layered on top of built-in slash/path completion (addAutocompleteProvider)
2524
- - Custom footers (setFooter)
2492
+ <a id="understand-the-lifecycle"></a>
2525
2493
 
2526
- ### Dialogs
2494
+ ## Respect the runtime lifecycle
2527
2495
 
2528
- ```typescript
2529
- // Select from options
2530
- const choice = await ctx.ui.select("Pick one:", ["A", "B", "C"]);
2496
+ The factory can be synchronous or asynchronous. Pi waits for an asynchronous factory before startup continues, allowing it to fetch configuration or register providers needed during startup.
2531
2497
 
2532
- // Confirm dialog
2533
- const ok = await ctx.ui.confirm("Delete?", "This cannot be undone");
2498
+ Do not start processes, sockets, watchers, or timers in the factory because some invocations load extensions without starting a session.
2499
+ Start long-lived resources from `session_start` or from the command or tool that needs them.
2500
+ Close session-scoped resources from an idempotent `session_shutdown` handler.
2534
2501
 
2535
- // Text input
2536
- const name = await ctx.ui.input("Name:", "placeholder");
2502
+ A run proceeds from input and `before_agent_start`, through model, message, and tool events, to `agent_end`.
2503
+ Pi counts as busy while a run starts, including the compaction check and `before_agent_start`, so messages sent meanwhile go into the starting run.
2504
+ Automatic retries, recovery, compaction, or queued work can continue afterward.
2505
+ <a id="agent_start--agent_end--agent_before_settle--agent_settled"></a>
2537
2506
 
2538
- // Multi-line editor
2539
- const text = await ctx.ui.editor("Edit:", "prefilled text");
2507
+ `agent_before_settle` is the final actionable boundary: it can append entries and request one continuation.
2508
+ `agent_settled` is final and notification-only; use it when an integration needs to know Pi will not continue automatically.
2540
2509
 
2541
- // Notification (non-blocking)
2542
- ctx.ui.notify("Done!", "info"); // "info" | "warning" | "error"
2543
- ```
2510
+ <a id="extensionapi-methods"></a>
2544
2511
 
2545
- #### Timed Dialogs with Countdown
2512
+ ## Choose an integration point
2546
2513
 
2547
- Dialogs support a `timeout` option that auto-dismisses with a live countdown display:
2514
+ | Capability | Main API |
2515
+ |---|---|
2516
+ | Observe or modify lifecycle behavior | `pi.on()` |
2517
+ | Add a model-callable operation | `pi.registerTool()` |
2518
+ | Add a `/` command | `pi.registerCommand()` |
2519
+ | Add a shortcut or CLI flag | `pi.registerShortcut()` or `pi.registerFlag()` |
2520
+ | Send user or custom messages | `pi.sendUserMessage()` or `pi.sendMessage()` |
2521
+ | Persist non-context session data | `pi.appendEntry()` |
2522
+ | Change active tools, model, or thinking level | Session control methods on `pi` |
2523
+ | Add a model provider | `pi.registerProvider()` |
2524
+ | Add an MCP server | `pi.registerMcpServer()` |
2525
+ | Route each request to a model | [`pi.registerVirtualModel()`](virtual-models.md) |
2526
+ | Add terminal rendering | Renderer registration and `ctx.ui` |
2527
+ | Communicate with another extension | `pi.events` |
2548
2528
 
2549
- ```typescript
2550
- // Dialog shows "Title (5s)" → "Title (4s)" → ... → auto-dismisses at 0
2551
- const confirmed = await ctx.ui.confirm(
2552
- "Timed Confirmation",
2553
- "This dialog will auto-cancel in 5 seconds. Confirm?",
2554
- { timeout: 5000 }
2555
- );
2529
+ Use the exported declarations in [`extensions/types.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/extensions/types.ts) for exact event, context, tool, and result types.
2556
2530
 
2557
- if (confirmed) {
2558
- // User confirmed
2559
- } else {
2560
- // User cancelled or timed out
2561
- }
2562
- ```
2531
+ ## Follow the extension contracts
2563
2532
 
2564
- **Return values on timeout:**
2565
- - `select()` returns `undefined`
2566
- - `confirm()` returns `false`
2567
- - `input()` returns `undefined`
2533
+ <a id="events"></a>
2534
+ <a id="work-with-events"></a>
2568
2535
 
2569
- #### Manual Dismissal with AbortSignal
2536
+ ### Events and concurrency
2570
2537
 
2571
- For more control (e.g., to distinguish timeout from user cancel), use `AbortSignal`:
2538
+ Handlers run in extension load and registration order. `pi.on()` returns a function that unsubscribes that registration; changes do not affect a dispatch already in progress.
2539
+ Some events notify; others transform data, replace results, or cancel an operation.
2540
+ Use each event’s declared result type rather than assuming every return value has an effect.
2572
2541
 
2573
- ```typescript
2574
- const controller = new AbortController();
2575
- const timeoutId = setTimeout(() => controller.abort(), 5000);
2542
+ Events cover resource discovery, sessions, agent and message lifecycle, providers, tools, and raw input.
2576
2543
 
2577
- const confirmed = await ctx.ui.confirm(
2578
- "Timed Confirmation",
2579
- "This dialog will auto-cancel in 5 seconds. Confirm?",
2580
- { signal: controller.signal }
2581
- );
2544
+ `before_agent_start` exposes both the current prompt and its structured `systemPromptOptions`. `event.messageType` says what started the run: `"user"` for a prompt or `pi.sendUserMessage()`, with `prompt` and `images`; `"custom"` for `pi.sendMessage(..., { triggerTurn: true })`, with the starting `message` and no `prompt`. A returned `message` is added to either kind of run; check `messageType` to skip runs started by custom messages. Prefer changing prompt sections, selected tools, or guidelines so Pi can append a transcript delta. Returning `systemPrompt`, or setting `forceSystemPrompt`, replaces the whole prompt for that run while the transcript continues recording the structured sections. Providers receive the forced text as their leading system prompt.
2582
2545
 
2583
- clearTimeout(timeoutId);
2546
+ `message_end` can replace a finalized message while preserving its role. `tool_call` can mutate input or block execution. `tool_result` handlers compose, with each handler seeing prior changes.
2584
2547
 
2585
- if (confirmed) {
2586
- // User confirmed
2587
- } else if (controller.signal.aborted) {
2588
- // Dialog timed out
2589
- } else {
2590
- // User cancelled (pressed Escape or selected "No")
2591
- }
2592
- ```
2548
+ <a id="provider_stream_event"></a>
2593
2549
 
2594
- See [examples/extensions/timed-confirm.ts](../examples/extensions/timed-confirm.ts) for complete examples.
2550
+ `provider_stream_event` fires for each parsed provider stream event before Pi normalizes it. The event identifies the provider, API, and model; `event.data` is the earliest structured value available to Pi, not necessarily the original HTTP bytes or SSE frame. Treat it as read-only because mutation can affect normalization. The event is notification-only and is not persisted.
2595
2551
 
2596
- ### Widgets, Status, and Footer
2552
+ Handlers are awaited in stream order, so slow handlers delay stream consumption. Handler errors are reported without changing the provider response. See [`debug-provider.ts`](../examples/extensions/debug-provider.ts) for an opt-in viewer that groups raw events by assistant message.
2597
2553
 
2598
- ```typescript
2599
- // Status in footer (persistent until cleared)
2600
- ctx.ui.setStatus("my-ext", "Processing...");
2601
- ctx.ui.setStatus("my-ext", undefined); // Clear
2554
+ <a id="context_with_system"></a>
2602
2555
 
2603
- // Working loader (shown during streaming)
2604
- ctx.ui.setWorkingMessage("Thinking deeply...");
2605
- ctx.ui.setWorkingMessage(); // Restore default
2606
- ctx.ui.setWorkingVisible(false); // Hide the built-in working loader row entirely
2607
- ctx.ui.setWorkingVisible(true); // Show the built-in working loader row
2556
+ `context` transforms conversation messages without prompt and tool system messages; Pi restores that state afterward. Use `context_with_system` only when a request-local transformation must own the complete transcript, and keep a system message at index zero.
2608
2557
 
2609
- // Working indicator (shown during streaming)
2610
- ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] }); // Static dot
2611
- ctx.ui.setWorkingIndicator({
2612
- frames: [
2613
- ctx.ui.theme.fg("dim", "·"),
2614
- ctx.ui.theme.fg("muted", "•"),
2615
- ctx.ui.theme.fg("accent", "●"),
2616
- ctx.ui.theme.fg("muted", "•"),
2617
- ],
2618
- intervalMs: 120,
2619
- });
2620
- ctx.ui.setWorkingIndicator({ frames: [] }); // Hide indicator
2621
- ctx.ui.setWorkingIndicator(); // Restore default spinner
2622
-
2623
- // Widget above editor (default)
2624
- ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"]);
2625
- // Widget below editor
2626
- ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"], { placement: "belowEditor" });
2627
- ctx.ui.setWidget("my-widget", (tui, theme) => new Text(theme.fg("accent", "Custom"), 0, 0));
2628
- ctx.ui.setWidget("my-widget", undefined); // Clear
2629
-
2630
- // Custom footer (replaces built-in footer entirely)
2631
- ctx.ui.setFooter((tui, theme) => ({
2632
- render(width) { return [theme.fg("dim", "Custom footer")]; },
2633
- invalidate() {},
2634
- }));
2635
- ctx.ui.setFooter(undefined); // Restore built-in footer
2636
-
2637
- // Terminal title
2638
- ctx.ui.setTitle("pi - my-project");
2639
-
2640
- // Editor text
2641
- ctx.ui.setEditorText("Prefill text");
2642
- const current = ctx.ui.getEditorText();
2643
-
2644
- // Paste into editor (triggers paste handling, including collapse for large content)
2645
- ctx.ui.pasteToEditor("pasted content");
2646
-
2647
- // Stack custom autocomplete behavior on top of the built-in provider
2648
- ctx.ui.addAutocompleteProvider((current) => ({
2649
- triggerCharacters: ["#"],
2650
- async getSuggestions(lines, line, col, options) {
2651
- const beforeCursor = (lines[line] ?? "").slice(0, col);
2652
- const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
2653
- if (!match) {
2654
- return current.getSuggestions(lines, line, col, options);
2655
- }
2558
+ `turn_end` and `agent_before_settle` are actionable boundaries. Their handlers can chain proposed `custom`, `custom_message`, `context_edit`, or `compaction` entries and return `continue: true` for one next model request. Guard continuation conditions because an unconditional continuation can loop. Use the exported event declarations for the complete validation and ordering contract.
2656
2559
 
2657
- return {
2658
- prefix: `#${match[1] ?? ""}`,
2659
- items: [{ value: "#2983", label: "#2983", description: "Extension API for autocomplete" }],
2660
- };
2661
- },
2662
- applyCompletion(lines, line, col, item, prefix) {
2663
- return current.applyCompletion(lines, line, col, item, prefix);
2664
- },
2665
- shouldTriggerFileCompletion(lines, line, col) {
2666
- return current.shouldTriggerFileCompletion?.(lines, line, col) ?? true;
2667
- },
2668
- }));
2669
-
2670
- // Tool output expansion
2671
- const wasExpanded = ctx.ui.getToolsExpanded();
2672
- ctx.ui.setToolsExpanded(true);
2673
- ctx.ui.setToolsExpanded(wasExpanded);
2674
-
2675
- // Custom editor (vim mode, emacs mode, etc.)
2676
- ctx.ui.setEditorComponent((tui, theme, keybindings) => new VimEditor(tui, theme, keybindings));
2677
- const currentEditor = ctx.ui.getEditorComponent();
2678
- ctx.ui.setEditorComponent((tui, theme, keybindings) =>
2679
- new WrappedEditor(tui, theme, keybindings, currentEditor?.(tui, theme, keybindings))
2680
- );
2681
- ctx.ui.setEditorComponent(undefined); // Restore default editor
2682
-
2683
- // Theme management (see themes.md for creating themes)
2684
- const themes = ctx.ui.getAllThemes(); // [{ name: "dark", path: "/..." | undefined }, ...]
2685
- const lightTheme = ctx.ui.getTheme("light"); // Load without switching
2686
- const result = ctx.ui.setTheme("light"); // Switch by name
2687
- if (!result.success) {
2688
- ctx.ui.notify(`Failed: ${result.error}`, "error");
2689
- }
2690
- ctx.ui.setTheme(lightTheme!); // Or switch by Theme object
2691
- ctx.ui.theme.fg("accent", "styled text"); // Access current theme
2692
- ```
2560
+ <a id="cache_warming_decision"></a>
2693
2561
 
2694
- Custom working-indicator frames are rendered verbatim. If you want colors, add them to the frame strings yourself, for example with `ctx.ui.theme.fg(...)`.
2562
+ `cache_warming_decision` can override an idle prompt-cache refresh with `{ action: "warm" }` or `{ action: "stop" }`. The last handler that returns an action wins.
2695
2563
 
2696
- ### Autocomplete Providers
2564
+ Tool calls from one assistant message can run in parallel.
2565
+ Do not assume a sibling call or result exists when another tool event runs.
2566
+ Use `ctx.signal` for nested work owned by an active turn; commands and idle session events often have no operation signal.
2697
2567
 
2698
- Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider. Set `triggerCharacters` for custom natural triggers such as `$`.
2568
+ A `user_bash` handler that returns `undefined` passes the command to the next handler and then to local execution if no handler handles it. Returning `operations` or `result` stops propagation. A handler failure blocks the command rather than falling through to local execution.
2699
2569
 
2700
- Typical pattern:
2570
+ <a id="custom-tools"></a>
2571
+ <a id="register-tools"></a>
2701
2572
 
2702
- - inspect the text before the cursor
2703
- - return your own suggestions when your extension-specific syntax matches
2704
- - otherwise delegate to `current.getSuggestions(...)`
2705
- - delegate `applyCompletion(...)` unless you need custom insertion behavior
2573
+ ### Tools
2706
2574
 
2707
- ```typescript
2708
- pi.on("session_start", (_event, ctx) => {
2709
- ctx.ui.addAutocompleteProvider((current) => ({
2710
- triggerCharacters: ["#"],
2711
- async getSuggestions(lines, cursorLine, cursorCol, options) {
2712
- const line = lines[cursorLine] ?? "";
2713
- const beforeCursor = line.slice(0, cursorCol);
2714
- const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
2715
- if (!match) {
2716
- return current.getSuggestions(lines, cursorLine, cursorCol, options);
2717
- }
2575
+ A custom tool defines a name, model-facing description, TypeBox parameter schema, and `execute()` function.
2576
+ Its result requires model-facing `content` and a `details` field for rendering or state reconstruction.
2577
+ Use `details: undefined` when there are no structured details. If the tool makes nested model calls, include their `usage` in the result so session totals remain accurate.
2718
2578
 
2719
- return {
2720
- prefix: `#${match[1] ?? ""}`,
2721
- items: [
2722
- { value: "#2983", label: "#2983", description: "Extension API for registering custom @ autocomplete providers" },
2723
- { value: "#2753", label: "#2753", description: "Reload stale resource settings" },
2724
- ],
2725
- };
2726
- },
2579
+ Throw from `execute()` to produce a failed tool result.
2580
+ Returning an object does not mark it as an error.
2581
+ Return `terminate: true` only when the agent should skip its automatic follow-up after every completed tool in that batch agrees to terminate.
2727
2582
 
2728
- applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
2729
- return current.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
2730
- },
2583
+ Use sequential execution when tools share mutable in-memory state.
2584
+ File-mutating tools should wrap the complete read-modify-write operation with `withFileMutationQueue()`.
2585
+ Truncate large model-facing results and tell the model where to read the complete output.
2731
2586
 
2732
- shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
2733
- return current.shouldTriggerFileCompletion?.(lines, cursorLine, cursorCol) ?? true;
2734
- },
2735
- }));
2736
- });
2737
- ```
2587
+ Declare `outputSchema` and return a matching `structuredContent` when the result is data. The model still receives `content`; programmatic callers such as codemode scripts receive `structuredContent` instead of the text. Tools without `outputSchema` are passed to scripts as their text content. To report a failure that still carries data, return the result with `isError: true` instead of throwing: the model sees an error, and scripts still receive `structuredContent`.
2738
2588
 
2739
- See [github-issue-autocomplete.ts](../examples/extensions/github-issue-autocomplete.ts) for a complete example that preloads the latest open GitHub issues with `gh issue list` and filters them locally for fast `#...` completion. It requires GitHub CLI (`gh`) and a GitHub repository checkout.
2589
+ A tool can run other tools with `ctx.executeTool(name, args, { signal, onUpdate })`. Nested calls go through argument validation and the `tool_call` and `tool_result` handlers like model-issued calls, and emit `tool_execution_start`, `tool_execution_update`, and `tool_execution_end`; all of these events carry `parentToolCallId`, and their `toolCallId` is assigned by pi as `<parent id>/<n>`. These ids do not appear as tool calls or tool results in the transcript. Nested calls do not add transcript entries: their results only reach the calling tool, which reports them itself, for example through `onUpdate` and `details`. The session keeps a bounded record of them (name, arguments, status, duration, error; never results) as `nestedCalls` on the calling tool's result message. It is used for compaction file lists and shown in HTML exports. Arguments over 8 KiB per call or 32 KiB per tool result are omitted, at most 256 calls are kept, and `complete: false` marks a record that lost anything. The `usage` of nested results, at every depth, is added to the calling tool's result `usage`, so a tool reports only its own usage, not that of the tools it called. `ctx.tools` lists the tools `ctx.executeTool()` can call. `tool_result` handlers that redact `content` should also replace `structuredContent`; replacing only `content` drops it.
2740
2590
 
2741
- ### Custom Components
2591
+ See [`hello.ts`](../examples/extensions/hello.ts), [`todo.ts`](../examples/extensions/todo.ts), [`dynamic-tools.ts`](../examples/extensions/dynamic-tools.ts), and [`truncated-tool.ts`](../examples/extensions/truncated-tool.ts).
2742
2592
 
2743
- For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
2593
+ ### Tool exposure
2744
2594
 
2745
- ```typescript
2746
- import { Text, Component } from "@punch-bot/tui";
2595
+ `exposure` controls how the model reaches a tool. "Callable" means callable from other tools through `ctx.executeTool()` (`ctx.tools`), as the `codemode` tool's scripts do:
2747
2596
 
2748
- const result = await ctx.ui.custom<boolean>((tui, theme, keybindings, done) => {
2749
- const text = new Text("Press Enter to confirm, Escape to cancel", 1, 1);
2597
+ - `direct` (default): declared to the model while active, and callable while active.
2598
+ - `model-only`: declared to the model while active, never callable. Use it for tools that orchestrate other tools or ask the user.
2599
+ - `codemode`: callable whenever registered, and listed by the `codemode` tool. Not declared to the model unless activated explicitly.
2600
+ - `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
2601
+ - `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
2750
2602
 
2751
- text.onKey = (key) => {
2752
- if (key === "return") done(true);
2753
- if (key === "escape") done(false);
2754
- return true;
2755
- };
2603
+ `namespace: { name, aliases, description, instructions }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading with its `description`. `instructions` holds longer usage guidance; it is not listed, and codemode scripts read it with `describeNamespace(name)`. `aliases` are other names scripts may look the namespace up by, for example the server name `docs` for `mcp__docs`; a name and the same name as a script identifier (`my-docs`, `my_docs`) match alike.
2756
2604
 
2757
- return text;
2758
- });
2605
+ Registering a `direct` or `model-only` tool activates it; the other exposures are not activated on registration. The active set (`pi.getActiveTools()`, `pi.setActiveTools()`) is the set of tools declared to the model. `pi.getAllTools()` reports each tool's `exposure`, `namespace`, `annotations`, and `reachesTools`.
2759
2606
 
2760
- if (result) {
2761
- // User pressed Enter
2762
- }
2607
+ `annotations` are hints about what a tool does, with the meaning of MCP tool annotations: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. MCP tools carry the hints their server declares. Missing hints take the MCP defaults: a tool is not read-only, and may be destructive and reach an open world. The hints are not verified, but a permission extension can use them to decide which calls to confirm. This confirms the calls Codex asks approval for:
2608
+
2609
+ ```typescript
2610
+ pi.on("tool_call", async (event, ctx) => {
2611
+ const hints = pi.getAllTools().find((tool) => tool.name === event.toolName)?.annotations;
2612
+ const needsApproval =
2613
+ hints?.destructiveHint === true ||
2614
+ (!hints?.readOnlyHint && ((hints?.destructiveHint ?? true) || (hints?.openWorldHint ?? true)));
2615
+ if (needsApproval && !(await ctx.ui.confirm("Allow tool call?", event.toolName))) {
2616
+ return { block: true, reason: `${event.toolName} was not approved` };
2617
+ }
2618
+ });
2763
2619
  ```
2764
2620
 
2765
- The callback receives:
2766
- - `tui` - TUI instance (for screen dimensions, focus management)
2767
- - `theme` - Current theme for styling
2768
- - `keybindings` - App keybinding manager (for checking shortcuts)
2769
- - `done(value)` - Call to close component and return value
2621
+ A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure, namespace, and prompt guidelines. It returns replacement `descriptions` for declared tools (including its own) and `hiddenDeclarations`: active tools whose declarations requests leave out while they stay active and callable. The default system prompt leaves hidden tools out of its tool list and rules, and names no tool in the skills hint when the file reader is hidden, so the orchestrating tool should present their guidelines itself. `codemode` uses only this hook, `exposure`, `reachesTools`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
2770
2622
 
2771
- See [tui.md](tui.md) for the full component API.
2623
+ A tool that reaches other tools declares which ones a call may reach with `reachesTools(input)`: `"all"`, or the words of the input that may name them, where a word refers to every tool or namespace whose name it contains. `codemode` returns `"all"` for scripts that search or list tools and the words of the script otherwise; `tool_search` always returns `"all"`. Extensions that register tools late use it from their `tool_call` handler to finish registering the tools a call needs before it runs, as the MCP extension does for servers that are still connecting. The MCP extension also activates `codemode` or `tool_search` for MCP tools only when the tool of that name declares `reachesTools`.
2772
2624
 
2773
- #### Overlay Mode (Experimental)
2625
+ ### Activate tools dynamically
2774
2626
 
2775
- Pass `{ overlay: true }` to render the component as a floating modal on top of existing content, without clearing the screen:
2627
+ Register every tool first, keep optional tools inactive, and use `pi.setActiveTools()` from a loader tool to select the desired active tools. Names must already be registered; unknown names are ignored.
2776
2628
 
2777
- ```typescript
2778
- const result = await ctx.ui.custom<string | null>(
2779
- (tui, theme, keybindings, done) => new MyOverlayComponent({ onClose: done }),
2780
- { overlay: true }
2781
- );
2782
- ```
2629
+ Pi records the initial prompt and tool set in the transcript's first system message, then appends tool and prompt changes before the next model request. Providers that cannot represent the transition receive a complete transcript checkpoint, which can invalidate the cached prefix.
2630
+
2631
+ ### MCP servers
2783
2632
 
2784
- For advanced positioning (anchors, margins, percentages, responsive visibility), pass `overlayOptions`. Use `onHandle` to control focus or visibility programmatically:
2633
+ `pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `description`, `enabled`, and `timeout`.
2785
2634
 
2786
2635
  ```typescript
2787
- const result = await ctx.ui.custom<string | null>(
2788
- (tui, theme, keybindings, done) => new MyOverlayComponent({ onClose: done }),
2789
- {
2790
- overlay: true,
2791
- overlayOptions: { anchor: "top-right", width: "50%", margin: 2 },
2792
- onHandle: (handle) => {
2793
- handle.focus(); // focus this overlay and bring it to the visual front
2794
- // handle.unfocus({ target: editorComponent }); // release input to a specific component
2795
- // handle.setHidden(true/false); // toggle visibility
2796
- // handle.hide(); // permanently remove
2797
- }
2798
- }
2799
- );
2636
+ pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira", exposure: "codemode" });
2637
+ pi.unregisterMcpServer("jira");
2800
2638
  ```
2801
2639
 
2802
- A focused visible overlay can reclaim input after temporary non-overlay custom UI closes. If you intentionally want another component to keep input while the overlay stays visible, call `handle.unfocus({ target })`. Passing `{ target: null }` releases the overlay without focusing another component.
2640
+ Servers registered while the extension loads connect when the session starts, together with the `mcp.json` servers; servers registered later connect right away, and `pi.unregisterMcpServer()` closes the connection and makes the server's tools unreachable. Registrations are not saved: register again on every load, for example based on the extension's own settings. A server in `mcp.json` with the same name takes precedence, and `/mcp` shows the override. Registering the same name again replaces the extension's earlier registration; names registered by another extension, invalid names, and invalid configs throw.
2803
2641
 
2804
- See [tui.md](tui.md) for the full `OverlayOptions` and `OverlayHandle` API and [overlay-qa-tests.ts](../examples/extensions/overlay-qa-tests.ts) for examples.
2642
+ The built-in MCP support connects registered servers. When nothing does, because another extension replaced it (see [MCP](mcp.md#other-mcp-extensions)), each registration is reported as an extension error. Other MCP extensions can connect registered servers too: read them with `pi.getMcpServers()` on `session_start` and handle the `mcp_servers_change` event for later changes.
2805
2643
 
2806
- ### Custom Editor
2644
+ <a id="extensioncontext"></a>
2645
+ <a id="extensioncommandcontext"></a>
2646
+ <a id="use-extension-context"></a>
2807
2647
 
2808
- Replace the main input editor with a custom implementation (vim mode, emacs mode, etc.):
2648
+ ### Context and session changes
2809
2649
 
2810
- ```typescript
2811
- import { CustomEditor, type ExtensionAPI } from "@punch-bot/cli";
2812
- import { matchesKey } from "@punch-bot/tui";
2650
+ `ExtensionContext` provides the working directory, mode, UI, session manager, model runtime, abort signal, context usage, and controls for compaction and shutdown.
2651
+ Use `ctx.modelRegistry.streamSimple()` for provider-neutral nested model calls.
2813
2652
 
2814
- class VimEditor extends CustomEditor {
2815
- private mode: "normal" | "insert" = "insert";
2653
+ Command handlers receive `ExtensionCommandContext`, which adds operations for waiting until idle, reloading, tree navigation, and session replacement.
2654
+ These operations are command-only because calling them from lifecycle handlers can deadlock the runtime.
2816
2655
 
2817
- handleInput(data: string): void {
2818
- if (matchesKey(data, "escape") && this.mode === "insert") {
2819
- this.mode = "normal";
2820
- return;
2821
- }
2822
- if (this.mode === "normal" && data === "i") {
2823
- this.mode = "insert";
2824
- return;
2825
- }
2826
- super.handleInput(data); // App keybindings + text editing
2827
- }
2828
- }
2656
+ Session replacement invalidates the old context. Capture only plain data before switching, then use the fresh context supplied to `withSession` for session-bound work.
2829
2657
 
2830
- export default function (pi: ExtensionAPI) {
2831
- pi.on("session_start", (_event, ctx) => {
2832
- ctx.ui.setEditorComponent((tui, theme, keybindings) =>
2833
- new VimEditor(tui, theme, keybindings)
2834
- );
2835
- });
2836
- }
2837
- ```
2658
+ <a id="state-management"></a>
2659
+ <a id="persist-state"></a>
2838
2660
 
2839
- **Key points:**
2840
- - Extend `CustomEditor` (not base `Editor`) to get app keybindings (escape to abort, ctrl+d, model switching)
2841
- - Call `super.handleInput(data)` for keys you don't handle
2842
- - Custom editors keep the standalone working row by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to use the built-in editor-border spinner instead.
2843
- - Factory receives `tui`, `theme`, and `keybindings` from the app
2844
- - Use `ctx.ui.getEditorComponent()` before `setEditorComponent()` to wrap the previously configured custom editor
2845
- - Pass `undefined` to restore default: `ctx.ui.setEditorComponent(undefined)`
2661
+ ### State
2846
2662
 
2847
- To compose with another extension that already replaced the editor, capture the previous factory before setting yours:
2663
+ Choose storage based on how state participates in the conversation:
2848
2664
 
2849
- ```typescript
2850
- const previous = ctx.ui.getEditorComponent();
2851
- ctx.ui.setEditorComponent((tui, theme, keybindings) =>
2852
- new MyEditor(tui, theme, keybindings, { base: previous?.(tui, theme, keybindings) })
2853
- );
2854
- ```
2665
+ | State | Storage |
2666
+ |---|---|
2667
+ | Tool state that follows the active branch | Tool-result `details` |
2668
+ | Durable data excluded from model context | `pi.appendEntry()` |
2669
+ | Custom content stored and sent to the model | `pi.sendMessage()` |
2670
+ | Data outside one session | External storage |
2855
2671
 
2856
- See [tui.md](tui.md) Pattern 7 for a complete example with mode indicator.
2672
+ Reconstruct branch-sensitive state from `ctx.sessionManager.getBranch()` during `session_start`.
2673
+ Do not rebuild it from every file entry because abandoned branches represent alternative histories.
2674
+ Register an entry or message renderer when custom stored content should appear in the transcript.
2857
2675
 
2858
- ### Message and Entry Rendering
2676
+ <a id="custom-ui"></a>
2677
+ <a id="mode-behavior"></a>
2678
+ <a id="interact-with-the-user"></a>
2679
+ <a id="account-for-each-mode"></a>
2859
2680
 
2860
- Register a custom renderer for messages with your `customType`. Use message renderers for content that should participate in LLM context:
2681
+ ### UI and modes
2861
2682
 
2862
- ```typescript
2863
- import { Text } from "@punch-bot/tui";
2683
+ `ctx.ui` provides dialogs, notifications, status text, widgets, titles, editor access, and custom components.
2684
+ Use `ctx.ui.custom()` only when the interaction needs its own rendering and input.
2685
+ See [Terminal UI](tui.md) for component, focus, overlay, theme, and performance guidance.
2864
2686
 
2865
- pi.registerMessageRenderer("my-extension", (message, options, theme) => {
2866
- const { expanded, outputPad } = options;
2867
- let text = theme.fg("accent", `[${message.customType}] `);
2868
- text += message.content;
2687
+ Extensions load in interactive, RPC, JSON, and print modes.
2688
+ Interactive mode provides the complete terminal UI.
2689
+ RPC can forward supported dialogs and notifications through the [RPC Extension UI protocol](rpc-extension-ui.md), but not custom terminal components; JSON and print modes have no UI.
2690
+ Guard terminal-only behavior with `ctx.mode === "tui"` and use `ctx.hasUI` for interactions supported by interactive and RPC clients.
2869
2691
 
2870
- if (expanded && message.details) {
2871
- text += "\n" + theme.fg("dim", JSON.stringify(message.details, null, 2));
2872
- }
2692
+ Keep tool and event behavior independent from rendering so non-interactive modes remain functional.
2873
2693
 
2874
- return new Text(text, outputPad, 0);
2875
- });
2876
- ```
2694
+ <a id="error-handling"></a>
2695
+ <a id="handle-errors-and-shutdown"></a>
2877
2696
 
2878
- Messages are sent via `pi.sendMessage()`:
2697
+ ### Errors and cleanup
2879
2698
 
2880
- ```typescript
2881
- pi.sendMessage({
2882
- customType: "my-extension", // Matches registerMessageRenderer
2883
- content: "Status update",
2884
- display: true, // Show in TUI
2885
- details: { ... }, // Available in renderer
2886
- });
2887
- ```
2699
+ Pi reports handler errors and continues where possible. A `tool_call` handler failure blocks the tool as a fail-safe; a tool execution failure becomes an error result for the model.
2888
2700
 
2889
- For TUI-only content that should not be sent to the LLM, render custom entries instead:
2701
+ Release resources in `session_shutdown` even when normal operation attempted cleanup.
2702
+ Keep cleanup idempotent because cancellation, reload, session replacement, and process exit can converge on the same path.
2703
+ Use `ctx.shutdown()` to request an orderly process shutdown.
2890
2704
 
2891
- ```typescript
2892
- pi.registerEntryRenderer("my-card", (entry, options, theme) => {
2893
- return new Text(theme.fg("accent", JSON.stringify(entry.data)));
2894
- });
2705
+ <a id="examples-reference"></a>
2706
+ <a id="use-examples-as-the-implementation-reference"></a>
2707
+
2708
+ ## Examples and reference
2709
+
2710
+ The checked [extension examples](../examples/extensions/) cover tools, lifecycle events, commands, flags, shortcuts, state, rendering, providers, OAuth, remote execution, and terminal components.
2711
+ Start with the smallest example matching your integration point.
2895
2712
 
2896
- pi.appendEntry("my-card", { status: "done" });
2897
- ```
2898
-
2899
- ### Theme Colors
2900
-
2901
- All render functions receive a `theme` object. See [themes.md](themes.md) for creating custom themes and the full color palette.
2902
-
2903
- ```typescript
2904
- // Foreground colors
2905
- theme.fg("toolTitle", text) // Tool names
2906
- theme.fg("accent", text) // Highlights
2907
- theme.fg("success", text) // Success (green)
2908
- theme.fg("error", text) // Errors (red)
2909
- theme.fg("warning", text) // Warnings (yellow)
2910
- theme.fg("muted", text) // Secondary text
2911
- theme.fg("dim", text) // Tertiary text
2912
-
2913
- // Text styles
2914
- theme.bold(text)
2915
- theme.italic(text)
2916
- theme.strikethrough(text)
2917
- ```
2918
-
2919
- For syntax highlighting in custom tool renderers:
2920
-
2921
- ```typescript
2922
- import { highlightCode, getLanguageFromPath } from "@punch-bot/cli";
2923
-
2924
- // Highlight code with explicit language
2925
- const highlighted = highlightCode("const x = 1;", "typescript", theme);
2926
-
2927
- // Auto-detect language from file path
2928
- const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
2929
- const highlighted = highlightCode(code, lang, theme);
2930
- ```
2931
-
2932
- ## Error Handling
2933
-
2934
- - Extension errors are logged, agent continues
2935
- - `tool_call` errors block the tool (fail-safe)
2936
- - Tool `execute` errors must be signaled by throwing; the thrown error is caught, reported to the LLM with `isError: true`, and execution continues
2937
-
2938
- ## Mode Behavior
2939
-
2940
- | Mode | `ctx.mode` | `ctx.hasUI` | Notes |
2941
- |------|------------|-------------|-------|
2942
- | Interactive | `"tui"` | `true` | Full TUI with terminal rendering |
2943
- | RPC (`--mode rpc`) | `"rpc"` | `true` | Dialogs and notifications via JSON protocol; `custom()` returns `undefined`. See [rpc.md](rpc.md) |
2944
- | JSON (`--mode json`) | `"json"` | `false` | Event stream to stdout; UI methods are no-ops |
2945
- | Print (`-p`) | `"print"` | `false` | Extensions run but can't prompt |
2946
-
2947
- Use `ctx.mode === "tui"` before TUI-specific features (`custom()`, component factories, terminal input). Use `ctx.hasUI` before dialog and notification methods that work in both TUI and RPC modes.
2948
-
2949
- ## Examples Reference
2950
-
2951
- All examples in [examples/extensions/](../examples/extensions/).
2952
-
2953
- | Example | Description | Key APIs |
2954
- |---------|-------------|----------|
2955
- | **Tools** |||
2956
- | `hello.ts` | Minimal tool registration | `registerTool` |
2957
- | `question.ts` | Tool with user interaction | `registerTool`, `ui.select` |
2958
- | `questionnaire.ts` | Multi-step wizard tool | `registerTool`, `ui.custom` |
2959
- | `todo.ts` | Stateful tool with persistence | `registerTool`, `appendEntry`, `renderResult`, session events |
2960
- | `dynamic-tools.ts` | Register tools after startup and during commands | `registerTool`, `session_start`, `registerCommand` |
2961
- | `structured-output.ts` | Final structured-output tool with `terminate: true` | `registerTool`, terminating tool results |
2962
- | `truncated-tool.ts` | Output truncation example | `registerTool`, `truncateHead` |
2963
- | `tool-override.ts` | Override built-in read tool | `registerTool` (same name as built-in) |
2964
- | **Commands** |||
2965
- | `pirate.ts` | Modify system prompt per-turn | `registerCommand`, `before_agent_start` |
2966
- | `summarize.ts` | Conversation summary command | `registerCommand`, `ui.custom` |
2967
- | `handoff.ts` | Cross-provider model handoff | `registerCommand`, `ui.editor`, `ui.custom` |
2968
- | `qna.ts` | Q&A with custom UI | `registerCommand`, `ui.custom`, `setEditorText` |
2969
- | `send-user-message.ts` | Inject user messages | `registerCommand`, `sendUserMessage` |
2970
- | `reload-runtime.ts` | Reload command and LLM tool handoff | `registerCommand`, `ctx.reload()`, `sendUserMessage` |
2971
- | `shutdown-command.ts` | Graceful shutdown command | `registerCommand`, `shutdown()` |
2972
- | **Events & Gates** |||
2973
- | `permission-gate.ts` | Block dangerous commands | `on("tool_call")`, `ui.confirm` |
2974
- | `project-trust.ts` | Decide or defer project trust from a user/global or CLI extension | `on("project_trust")`, trust UI, required trust result |
2975
- | `protected-paths.ts` | Block writes to specific paths | `on("tool_call")` |
2976
- | `confirm-destructive.ts` | Confirm session changes | `on("session_before_switch")`, `on("session_before_fork")` |
2977
- | `dirty-repo-guard.ts` | Warn on dirty git repo | `on("session_before_*")`, `exec` |
2978
- | `input-transform.ts` | Transform user input | `on("input")` |
2979
- | `input-transform-streaming.ts` | Streaming-aware input transform | `on("input")`, `streamingBehavior` |
2980
- | `model-status.ts` | React to model changes | `on("model_select")`, `setStatus` |
2981
- | `provider-payload.ts` | Inspect payloads and provider response headers | `on("before_provider_request")`, `on("after_provider_response")` |
2982
- | `system-prompt-header.ts` | Display system prompt info | `on("agent_start")`, `getSystemPrompt` |
2983
- | `claude-rules.ts` | Load rules from files | `on("session_start")`, `on("before_agent_start")` |
2984
- | `prompt-customizer.ts` | Add context-aware tool guidance using `systemPromptOptions` | `on("before_agent_start")`, `BuildSystemPromptOptions` |
2985
- | `file-trigger.ts` | File watcher triggers messages | `sendMessage` |
2986
- | **Compaction & Sessions** |||
2987
- | `custom-compaction.ts` | Custom compaction summary | `on("session_before_compact")` |
2988
- | `trigger-compact.ts` | Trigger compaction manually | `compact()` |
2989
- | `git-checkpoint.ts` | Git stash on turns | `on("turn_start")`, `on("session_before_fork")`, `exec` |
2990
- | `git-merge-and-resolve.ts` | Fetch, merge, and resolve conflicts | `on("agent_end")`, `exec`, `sendUserMessage` |
2991
- | `auto-commit-on-exit.ts` | Commit on shutdown | `on("session_shutdown")`, `exec` |
2992
- | **UI Components** |||
2993
- | `status-line.ts` | Footer status indicator | `setStatus`, session events |
2994
- | `working-indicator.ts` | Customize the streaming working indicator | `setWorkingIndicator`, `registerCommand` |
2995
- | `github-issue-autocomplete.ts` | Add `#1234` issue completions on top of built-in autocomplete by preloading recent open issues from `gh issue list` | `addAutocompleteProvider`, `on("session_start")`, `exec` |
2996
- | `custom-footer.ts` | Replace footer entirely | `registerCommand`, `setFooter` |
2997
- | `custom-header.ts` | Replace startup header | `on("session_start")`, `setHeader` |
2998
- | `modal-editor.ts` | Vim-style modal editor | `setEditorComponent`, `CustomEditor` |
2999
- | `rainbow-editor.ts` | Custom editor styling | `setEditorComponent` |
3000
- | `widget-placement.ts` | Widget above/below editor | `setWidget` |
3001
- | `overlay-test.ts` | Overlay components | `ui.custom` with overlay options |
3002
- | `overlay-qa-tests.ts` | Comprehensive overlay tests | `ui.custom`, all overlay options |
3003
- | `notify.ts` | Simple notifications | `ui.notify` |
3004
- | `timed-confirm.ts` | Dialogs with timeout | `ui.confirm` with timeout/signal |
3005
- | `mac-system-theme.ts` | Auto-switch theme | `setTheme`, `exec` |
3006
- | **Complex Extensions** |||
3007
- | `plan-mode/` | Full plan mode implementation | All event types, `registerCommand`, `registerShortcut`, `registerFlag`, `setStatus`, `setWidget`, `sendMessage`, `setActiveTools` |
3008
- | `preset.ts` | Saveable presets (model, tools, thinking) | `registerCommand`, `registerShortcut`, `registerFlag`, `setModel`, `setActiveTools`, `setThinkingLevel`, `appendEntry` |
3009
- | `tools.ts` | Toggle tools on/off UI | `registerCommand`, `setActiveTools`, `SettingsList`, session events |
3010
- | **Remote & Sandbox** |||
3011
- | `ssh.ts` | SSH remote execution | `registerFlag`, `on("user_bash")`, `on("before_agent_start")`, tool operations |
3012
- | `interactive-shell.ts` | Persistent shell session | `on("user_bash")` |
3013
- | `sandbox/` | Sandboxed tool execution | Tool operations |
3014
- | `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM | Tool operations, built-in tool overrides, `on("user_bash")` |
3015
- | `subagent/` | Spawn sub-agents | `registerTool`, `exec` |
3016
- | **Games** |||
3017
- | `snake.ts` | Snake game | `registerCommand`, `ui.custom`, keyboard handling |
3018
- | `space-invaders.ts` | Space Invaders game | `registerCommand`, `ui.custom` |
3019
- | `doom-overlay/` | Doom in overlay | `ui.custom` with overlay |
3020
- | **Providers** |||
3021
- | `custom-provider-anthropic/` | Custom Anthropic proxy | `registerProvider` |
3022
- | `custom-provider-gitlab-duo/` | GitLab Duo integration | `registerProvider` with OAuth |
3023
- | **Messages & Communication** |||
3024
- | `message-renderer.ts` | Custom message rendering | `registerMessageRenderer`, `sendMessage` |
3025
- | `entry-renderer.ts` | TUI-only custom entry rendering | `registerEntryRenderer`, `appendEntry` |
3026
- | `event-bus.ts` | Inter-extension events | `pi.events` |
3027
- | **Session Metadata** |||
3028
- | `session-name.ts` | Name sessions for selector | `setSessionName`, `getSessionName` |
3029
- | `bookmark.ts` | Bookmark entries for /tree | `setLabel` |
3030
- | **Misc** |||
3031
- | `inline-bash.ts` | Inline bash in tool calls | `on("tool_call")` |
3032
- | `bash-spawn-hook.ts` | Adjust bash command, cwd, and env before execution | `createBashTool`, `spawnHook` |
3033
- | `with-deps/` | Extension with npm dependencies | Package structure with `package.json` |
2713
+ Use [Custom Providers](custom-provider.md) for model-service integrations, [Terminal UI](tui.md) for custom components, and [Pi Packages](packages.md) to install or distribute extensions with other resources.