@subimpact/e 0.0.0-stage → 0.99.2

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 (1147) hide show
  1. package/CHANGELOG.md +6025 -0
  2. package/README.md +54 -2
  3. package/dist/bun/cli.d.ts +5 -0
  4. package/dist/bun/cli.d.ts.map +1 -0
  5. package/dist/bun/cli.js +5 -0
  6. package/dist/bun/cli.js.map +1 -0
  7. package/dist/bun/restore-sandbox-env.d.ts +17 -0
  8. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  9. package/dist/bun/restore-sandbox-env.js +36 -0
  10. package/dist/bun/restore-sandbox-env.js.map +1 -0
  11. package/dist/bun/runtime-setup.d.ts +2 -0
  12. package/dist/bun/runtime-setup.d.ts.map +1 -0
  13. package/dist/bun/runtime-setup.js +9 -0
  14. package/dist/bun/runtime-setup.js.map +1 -0
  15. package/dist/bun/sandbox-env-setup.d.ts +2 -0
  16. package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
  17. package/dist/bun/sandbox-env-setup.js +4 -0
  18. package/dist/bun/sandbox-env-setup.js.map +1 -0
  19. package/dist/bundle/chunks/anthropic-messages-UID2PALB.js +6 -0
  20. package/dist/bundle/chunks/anthropic.js +75 -0
  21. package/dist/bundle/chunks/azure-openai-responses-TLHNIYZK.js +2 -0
  22. package/dist/bundle/chunks/bedrock-converse-stream.js +83 -0
  23. package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
  24. package/dist/bundle/chunks/chunk-5ZENNE67.js +1447 -0
  25. package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
  26. package/dist/bundle/chunks/chunk-6D7LHLKG.js +2 -0
  27. package/dist/bundle/chunks/chunk-75XIWY7P.js +2 -0
  28. package/dist/bundle/chunks/chunk-7JGR3GZN.js +11 -0
  29. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  30. package/dist/bundle/chunks/chunk-A3JYRWB6.js +2 -0
  31. package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
  32. package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +42 -0
  33. package/dist/bundle/chunks/chunk-H3QXYIF7.js +31 -0
  34. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  35. package/dist/bundle/chunks/chunk-LD2P6SFZ.js +2 -0
  36. package/dist/bundle/chunks/chunk-OENUXCXU.js +46 -0
  37. package/dist/bundle/chunks/chunk-OSKPX3Z5.js +2 -0
  38. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  39. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  40. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  41. package/dist/bundle/chunks/chunk-R5J3MOBF.js +11 -0
  42. package/dist/bundle/chunks/chunk-S3GGRYIO.js +6 -0
  43. package/dist/bundle/chunks/chunk-SS3AAGL7.js +132 -0
  44. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  45. package/dist/bundle/chunks/chunk-TRDNDS6A.js +4 -0
  46. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  47. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  48. package/dist/bundle/chunks/chunk-VIV3CWXG.js +2 -0
  49. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NPQN263E.js +2 -0
  50. package/dist/bundle/chunks/github-copilot.js +2 -0
  51. package/dist/bundle/chunks/google-generative-ai-3Z6VNDJN.js +2 -0
  52. package/dist/bundle/chunks/google-vertex-NU6OFGNA.js +2 -0
  53. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
  54. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  55. package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
  56. package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
  57. package/dist/bundle/chunks/kimi-coding.js +2 -0
  58. package/dist/bundle/chunks/lib-TEDK3E5I.js +9 -0
  59. package/dist/bundle/chunks/llama-cpp-classify-XT44PI3C.js +22 -0
  60. package/dist/bundle/chunks/meta.js +2 -0
  61. package/dist/bundle/chunks/mistral-conversations-DKVFNQL6.js +5 -0
  62. package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
  63. package/dist/bundle/chunks/node-O3RIBJRH.js +16 -0
  64. package/dist/bundle/chunks/node-TWVVAGPO.js +2 -0
  65. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  66. package/dist/bundle/chunks/openai-codex-responses-3GKGNXC4.js +10 -0
  67. package/dist/bundle/chunks/openai-codex.js +75 -0
  68. package/dist/bundle/chunks/openai-completions-JXDDPZ23.js +7 -0
  69. package/dist/bundle/chunks/openai-responses-S7GKCCDG.js +3 -0
  70. package/dist/bundle/chunks/openrouter-images-ZVXWCSIM.js +2 -0
  71. package/dist/bundle/chunks/openrouter.js +75 -0
  72. package/dist/bundle/chunks/pi-logo-animation-MA3YLQTM.js +2 -0
  73. package/dist/bundle/chunks/pi-messages-TM5SOOIW.js +8 -0
  74. package/dist/bundle/chunks/radius.js +75 -0
  75. package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
  76. package/dist/bundle/chunks/typesafe-system-one-A4CZTQWZ.js +2 -0
  77. package/dist/bundle/chunks/virtual-modules-VX2P5PB3.js +2 -0
  78. package/dist/bundle/chunks/xai.js +2 -0
  79. package/dist/bundle/cli-runtime.js +3 -0
  80. package/dist/bundle/cli.js +5 -0
  81. package/dist/bundle/index.js +2 -0
  82. package/dist/bundle/rpc-entry.js +3 -0
  83. package/dist/cli/args.d.ts +61 -0
  84. package/dist/cli/args.d.ts.map +1 -0
  85. package/dist/cli/args.js +450 -0
  86. package/dist/cli/args.js.map +1 -0
  87. package/dist/cli/auth-check.d.ts +19 -0
  88. package/dist/cli/auth-check.d.ts.map +1 -0
  89. package/dist/cli/auth-check.js +50 -0
  90. package/dist/cli/auth-check.js.map +1 -0
  91. package/dist/cli/auth-command.d.ts +24 -0
  92. package/dist/cli/auth-command.d.ts.map +1 -0
  93. package/dist/cli/auth-command.js +103 -0
  94. package/dist/cli/auth-command.js.map +1 -0
  95. package/dist/cli/config-selector.d.ts +16 -0
  96. package/dist/cli/config-selector.d.ts.map +1 -0
  97. package/dist/cli/config-selector.js +32 -0
  98. package/dist/cli/config-selector.js.map +1 -0
  99. package/dist/cli/credential-print.d.ts +13 -0
  100. package/dist/cli/credential-print.d.ts.map +1 -0
  101. package/dist/cli/credential-print.js +76 -0
  102. package/dist/cli/credential-print.js.map +1 -0
  103. package/dist/cli/file-processor.d.ts +15 -0
  104. package/dist/cli/file-processor.d.ts.map +1 -0
  105. package/dist/cli/file-processor.js +71 -0
  106. package/dist/cli/file-processor.js.map +1 -0
  107. package/dist/cli/initial-message.d.ts +18 -0
  108. package/dist/cli/initial-message.d.ts.map +1 -0
  109. package/dist/cli/initial-message.js +22 -0
  110. package/dist/cli/initial-message.js.map +1 -0
  111. package/dist/cli/list-models.d.ts +9 -0
  112. package/dist/cli/list-models.d.ts.map +1 -0
  113. package/dist/cli/list-models.js +98 -0
  114. package/dist/cli/list-models.js.map +1 -0
  115. package/dist/cli/project-trust.d.ts +10 -0
  116. package/dist/cli/project-trust.d.ts.map +1 -0
  117. package/dist/cli/project-trust.js +48 -0
  118. package/dist/cli/project-trust.js.map +1 -0
  119. package/dist/cli/session-picker.d.ts +10 -0
  120. package/dist/cli/session-picker.d.ts.map +1 -0
  121. package/dist/cli/session-picker.js +36 -0
  122. package/dist/cli/session-picker.js.map +1 -0
  123. package/dist/cli/setup.d.ts +2 -0
  124. package/dist/cli/setup.d.ts.map +1 -0
  125. package/dist/cli/setup.js +12 -0
  126. package/dist/cli/setup.js.map +1 -0
  127. package/dist/cli/startup-ui.d.ts +20 -0
  128. package/dist/cli/startup-ui.d.ts.map +1 -0
  129. package/dist/cli/startup-ui.js +193 -0
  130. package/dist/cli/startup-ui.js.map +1 -0
  131. package/dist/cli.d.ts +3 -0
  132. package/dist/cli.d.ts.map +1 -0
  133. package/dist/cli.js +6 -0
  134. package/dist/cli.js.map +1 -0
  135. package/dist/config.d.ts +107 -0
  136. package/dist/config.d.ts.map +1 -0
  137. package/dist/config.js +486 -0
  138. package/dist/config.js.map +1 -0
  139. package/dist/core/agent-session-runtime.d.ts +119 -0
  140. package/dist/core/agent-session-runtime.d.ts.map +1 -0
  141. package/dist/core/agent-session-runtime.js +317 -0
  142. package/dist/core/agent-session-runtime.js.map +1 -0
  143. package/dist/core/agent-session-services.d.ts +86 -0
  144. package/dist/core/agent-session-services.d.ts.map +1 -0
  145. package/dist/core/agent-session-services.js +147 -0
  146. package/dist/core/agent-session-services.js.map +1 -0
  147. package/dist/core/agent-session.d.ts +881 -0
  148. package/dist/core/agent-session.d.ts.map +1 -0
  149. package/dist/core/agent-session.js +3524 -0
  150. package/dist/core/agent-session.js.map +1 -0
  151. package/dist/core/auth-guidance.d.ts +5 -0
  152. package/dist/core/auth-guidance.d.ts.map +1 -0
  153. package/dist/core/auth-guidance.js +21 -0
  154. package/dist/core/auth-guidance.js.map +1 -0
  155. package/dist/core/auth-storage.d.ts +72 -0
  156. package/dist/core/auth-storage.d.ts.map +1 -0
  157. package/dist/core/auth-storage.js +426 -0
  158. package/dist/core/auth-storage.js.map +1 -0
  159. package/dist/core/bash-executor.d.ts +32 -0
  160. package/dist/core/bash-executor.d.ts.map +1 -0
  161. package/dist/core/bash-executor.js +111 -0
  162. package/dist/core/bash-executor.js.map +1 -0
  163. package/dist/core/bug-report-upload.d.ts +12 -0
  164. package/dist/core/bug-report-upload.d.ts.map +1 -0
  165. package/dist/core/bug-report-upload.js +22 -0
  166. package/dist/core/bug-report-upload.js.map +1 -0
  167. package/dist/core/bug-report.d.ts +176 -0
  168. package/dist/core/bug-report.d.ts.map +1 -0
  169. package/dist/core/bug-report.js +292 -0
  170. package/dist/core/bug-report.js.map +1 -0
  171. package/dist/core/cache-stats.d.ts +49 -0
  172. package/dist/core/cache-stats.d.ts.map +1 -0
  173. package/dist/core/cache-stats.js +112 -0
  174. package/dist/core/cache-stats.js.map +1 -0
  175. package/dist/core/cache-warmer.d.ts +103 -0
  176. package/dist/core/cache-warmer.d.ts.map +1 -0
  177. package/dist/core/cache-warmer.js +359 -0
  178. package/dist/core/cache-warmer.js.map +1 -0
  179. package/dist/core/compaction/branch-summarization.d.ts +98 -0
  180. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  181. package/dist/core/compaction/branch-summarization.js +251 -0
  182. package/dist/core/compaction/branch-summarization.js.map +1 -0
  183. package/dist/core/compaction/compaction.d.ts +145 -0
  184. package/dist/core/compaction/compaction.d.ts.map +1 -0
  185. package/dist/core/compaction/compaction.js +744 -0
  186. package/dist/core/compaction/compaction.js.map +1 -0
  187. package/dist/core/compaction/index.d.ts +7 -0
  188. package/dist/core/compaction/index.d.ts.map +1 -0
  189. package/dist/core/compaction/index.js +7 -0
  190. package/dist/core/compaction/index.js.map +1 -0
  191. package/dist/core/compaction/utils.d.ts +39 -0
  192. package/dist/core/compaction/utils.d.ts.map +1 -0
  193. package/dist/core/compaction/utils.js +149 -0
  194. package/dist/core/compaction/utils.js.map +1 -0
  195. package/dist/core/crash-log.d.ts +27 -0
  196. package/dist/core/crash-log.d.ts.map +1 -0
  197. package/dist/core/crash-log.js +140 -0
  198. package/dist/core/crash-log.js.map +1 -0
  199. package/dist/core/defaults.d.ts +4 -0
  200. package/dist/core/defaults.d.ts.map +1 -0
  201. package/dist/core/defaults.js +11 -0
  202. package/dist/core/defaults.js.map +1 -0
  203. package/dist/core/diagnostics.d.ts +15 -0
  204. package/dist/core/diagnostics.d.ts.map +1 -0
  205. package/dist/core/diagnostics.js +2 -0
  206. package/dist/core/diagnostics.js.map +1 -0
  207. package/dist/core/event-bus.d.ts +9 -0
  208. package/dist/core/event-bus.d.ts.map +1 -0
  209. package/dist/core/event-bus.js +25 -0
  210. package/dist/core/event-bus.js.map +1 -0
  211. package/dist/core/exec.d.ts +29 -0
  212. package/dist/core/exec.d.ts.map +1 -0
  213. package/dist/core/exec.js +75 -0
  214. package/dist/core/exec.js.map +1 -0
  215. package/dist/core/experimental.d.ts +2 -0
  216. package/dist/core/experimental.d.ts.map +1 -0
  217. package/dist/core/experimental.js +6 -0
  218. package/dist/core/experimental.js.map +1 -0
  219. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  220. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  221. package/dist/core/export-html/ansi-to-html.js +249 -0
  222. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  223. package/dist/core/export-html/index.d.ts +37 -0
  224. package/dist/core/export-html/index.d.ts.map +1 -0
  225. package/dist/core/export-html/index.js +226 -0
  226. package/dist/core/export-html/index.js.map +1 -0
  227. package/dist/core/export-html/template.css +1076 -0
  228. package/dist/core/export-html/template.html +55 -0
  229. package/dist/core/export-html/template.js +1918 -0
  230. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  231. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  232. package/dist/core/export-html/tool-renderer.js +108 -0
  233. package/dist/core/export-html/tool-renderer.js.map +1 -0
  234. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  235. package/dist/core/export-html/vendor/marked.min.js +78 -0
  236. package/dist/core/extensions/index.d.ts +12 -0
  237. package/dist/core/extensions/index.d.ts.map +1 -0
  238. package/dist/core/extensions/index.js +9 -0
  239. package/dist/core/extensions/index.js.map +1 -0
  240. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  241. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  242. package/dist/core/extensions/jiti-loader.js +4 -0
  243. package/dist/core/extensions/jiti-loader.js.map +1 -0
  244. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  245. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  246. package/dist/core/extensions/jiti-static-loader.js +4 -0
  247. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  248. package/dist/core/extensions/loader.d.ts +23 -0
  249. package/dist/core/extensions/loader.d.ts.map +1 -0
  250. package/dist/core/extensions/loader.js +667 -0
  251. package/dist/core/extensions/loader.js.map +1 -0
  252. package/dist/core/extensions/runner.d.ts +204 -0
  253. package/dist/core/extensions/runner.d.ts.map +1 -0
  254. package/dist/core/extensions/runner.js +1207 -0
  255. package/dist/core/extensions/runner.js.map +1 -0
  256. package/dist/core/extensions/types.d.ts +1667 -0
  257. package/dist/core/extensions/types.d.ts.map +1 -0
  258. package/dist/core/extensions/types.js +48 -0
  259. package/dist/core/extensions/types.js.map +1 -0
  260. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  261. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  262. package/dist/core/extensions/virtual-modules.js +38 -0
  263. package/dist/core/extensions/virtual-modules.js.map +1 -0
  264. package/dist/core/extensions/wrapper.d.ts +20 -0
  265. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  266. package/dist/core/extensions/wrapper.js +22 -0
  267. package/dist/core/extensions/wrapper.js.map +1 -0
  268. package/dist/core/footer-data-provider.d.ts +64 -0
  269. package/dist/core/footer-data-provider.d.ts.map +1 -0
  270. package/dist/core/footer-data-provider.js +338 -0
  271. package/dist/core/footer-data-provider.js.map +1 -0
  272. package/dist/core/http-dispatcher.d.ts +22 -0
  273. package/dist/core/http-dispatcher.d.ts.map +1 -0
  274. package/dist/core/http-dispatcher.js +98 -0
  275. package/dist/core/http-dispatcher.js.map +1 -0
  276. package/dist/core/index.d.ts +14 -0
  277. package/dist/core/index.d.ts.map +1 -0
  278. package/dist/core/index.js +13 -0
  279. package/dist/core/index.js.map +1 -0
  280. package/dist/core/keybindings.d.ts +428 -0
  281. package/dist/core/keybindings.d.ts.map +1 -0
  282. package/dist/core/keybindings.js +321 -0
  283. package/dist/core/keybindings.js.map +1 -0
  284. package/dist/core/messages.d.ts +77 -0
  285. package/dist/core/messages.d.ts.map +1 -0
  286. package/dist/core/messages.js +124 -0
  287. package/dist/core/messages.js.map +1 -0
  288. package/dist/core/model-config.d.ts +724 -0
  289. package/dist/core/model-config.d.ts.map +1 -0
  290. package/dist/core/model-config.js +282 -0
  291. package/dist/core/model-config.js.map +1 -0
  292. package/dist/core/model-registry.d.ts +61 -0
  293. package/dist/core/model-registry.d.ts.map +1 -0
  294. package/dist/core/model-registry.js +140 -0
  295. package/dist/core/model-registry.js.map +1 -0
  296. package/dist/core/model-resolver.d.ts +124 -0
  297. package/dist/core/model-resolver.d.ts.map +1 -0
  298. package/dist/core/model-resolver.js +590 -0
  299. package/dist/core/model-resolver.js.map +1 -0
  300. package/dist/core/model-runtime.d.ts +145 -0
  301. package/dist/core/model-runtime.d.ts.map +1 -0
  302. package/dist/core/model-runtime.js +758 -0
  303. package/dist/core/model-runtime.js.map +1 -0
  304. package/dist/core/models-store.d.ts +22 -0
  305. package/dist/core/models-store.d.ts.map +1 -0
  306. package/dist/core/models-store.js +115 -0
  307. package/dist/core/models-store.js.map +1 -0
  308. package/dist/core/nested-tool-calls.d.ts +102 -0
  309. package/dist/core/nested-tool-calls.d.ts.map +1 -0
  310. package/dist/core/nested-tool-calls.js +178 -0
  311. package/dist/core/nested-tool-calls.js.map +1 -0
  312. package/dist/core/output-guard.d.ts +7 -0
  313. package/dist/core/output-guard.d.ts.map +1 -0
  314. package/dist/core/output-guard.js +89 -0
  315. package/dist/core/output-guard.js.map +1 -0
  316. package/dist/core/package-manager.d.ts +217 -0
  317. package/dist/core/package-manager.d.ts.map +1 -0
  318. package/dist/core/package-manager.js +2224 -0
  319. package/dist/core/package-manager.js.map +1 -0
  320. package/dist/core/pi-manifest.d.ts +8 -0
  321. package/dist/core/pi-manifest.d.ts.map +1 -0
  322. package/dist/core/pi-manifest.js +26 -0
  323. package/dist/core/pi-manifest.js.map +1 -0
  324. package/dist/core/project-trust.d.ts +15 -0
  325. package/dist/core/project-trust.d.ts.map +1 -0
  326. package/dist/core/project-trust.js +59 -0
  327. package/dist/core/project-trust.js.map +1 -0
  328. package/dist/core/prompt-templates.d.ts +59 -0
  329. package/dist/core/prompt-templates.d.ts.map +1 -0
  330. package/dist/core/prompt-templates.js +262 -0
  331. package/dist/core/prompt-templates.js.map +1 -0
  332. package/dist/core/provider-attribution.d.ts +4 -0
  333. package/dist/core/provider-attribution.d.ts.map +1 -0
  334. package/dist/core/provider-attribution.js +72 -0
  335. package/dist/core/provider-attribution.js.map +1 -0
  336. package/dist/core/provider-composer.d.ts +79 -0
  337. package/dist/core/provider-composer.d.ts.map +1 -0
  338. package/dist/core/provider-composer.js +475 -0
  339. package/dist/core/provider-composer.js.map +1 -0
  340. package/dist/core/radius.d.ts +5 -0
  341. package/dist/core/radius.d.ts.map +1 -0
  342. package/dist/core/radius.js +9 -0
  343. package/dist/core/radius.js.map +1 -0
  344. package/dist/core/remote-catalog-provider.d.ts +12 -0
  345. package/dist/core/remote-catalog-provider.d.ts.map +1 -0
  346. package/dist/core/remote-catalog-provider.js +132 -0
  347. package/dist/core/remote-catalog-provider.js.map +1 -0
  348. package/dist/core/resolve-config-value.d.ts +30 -0
  349. package/dist/core/resolve-config-value.d.ts.map +1 -0
  350. package/dist/core/resolve-config-value.js +247 -0
  351. package/dist/core/resolve-config-value.js.map +1 -0
  352. package/dist/core/resource-loader.d.ts +227 -0
  353. package/dist/core/resource-loader.d.ts.map +1 -0
  354. package/dist/core/resource-loader.js +1004 -0
  355. package/dist/core/resource-loader.js.map +1 -0
  356. package/dist/core/runtime-credentials.d.ts +15 -0
  357. package/dist/core/runtime-credentials.d.ts.map +1 -0
  358. package/dist/core/runtime-credentials.js +39 -0
  359. package/dist/core/runtime-credentials.js.map +1 -0
  360. package/dist/core/sdk.d.ts +108 -0
  361. package/dist/core/sdk.d.ts.map +1 -0
  362. package/dist/core/sdk.js +315 -0
  363. package/dist/core/sdk.js.map +1 -0
  364. package/dist/core/session-cwd.d.ts +19 -0
  365. package/dist/core/session-cwd.d.ts.map +1 -0
  366. package/dist/core/session-cwd.js +38 -0
  367. package/dist/core/session-cwd.js.map +1 -0
  368. package/dist/core/session-export.d.ts +8 -0
  369. package/dist/core/session-export.d.ts.map +1 -0
  370. package/dist/core/session-export.js +33 -0
  371. package/dist/core/session-export.js.map +1 -0
  372. package/dist/core/session-manager.d.ts +416 -0
  373. package/dist/core/session-manager.d.ts.map +1 -0
  374. package/dist/core/session-manager.js +1523 -0
  375. package/dist/core/session-manager.js.map +1 -0
  376. package/dist/core/settings-diagnostics.d.ts +9 -0
  377. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  378. package/dist/core/settings-diagnostics.js +21 -0
  379. package/dist/core/settings-diagnostics.js.map +1 -0
  380. package/dist/core/settings-manager.d.ts +362 -0
  381. package/dist/core/settings-manager.d.ts.map +1 -0
  382. package/dist/core/settings-manager.js +1103 -0
  383. package/dist/core/settings-manager.js.map +1 -0
  384. package/dist/core/skills.d.ts +60 -0
  385. package/dist/core/skills.d.ts.map +1 -0
  386. package/dist/core/skills.js +407 -0
  387. package/dist/core/skills.js.map +1 -0
  388. package/dist/core/slash-commands.d.ts +15 -0
  389. package/dist/core/slash-commands.d.ts.map +1 -0
  390. package/dist/core/slash-commands.js +28 -0
  391. package/dist/core/slash-commands.js.map +1 -0
  392. package/dist/core/source-info.d.ts +26 -0
  393. package/dist/core/source-info.d.ts.map +1 -0
  394. package/dist/core/source-info.js +35 -0
  395. package/dist/core/source-info.js.map +1 -0
  396. package/dist/core/system-prompt.d.ts +71 -0
  397. package/dist/core/system-prompt.d.ts.map +1 -0
  398. package/dist/core/system-prompt.js +147 -0
  399. package/dist/core/system-prompt.js.map +1 -0
  400. package/dist/core/telemetry.d.ts +3 -0
  401. package/dist/core/telemetry.d.ts.map +1 -0
  402. package/dist/core/telemetry.js +10 -0
  403. package/dist/core/telemetry.js.map +1 -0
  404. package/dist/core/timings.d.ts +6 -0
  405. package/dist/core/timings.d.ts.map +1 -0
  406. package/dist/core/timings.js +42 -0
  407. package/dist/core/timings.js.map +1 -0
  408. package/dist/core/tools/bash.d.ts +101 -0
  409. package/dist/core/tools/bash.d.ts.map +1 -0
  410. package/dist/core/tools/bash.js +348 -0
  411. package/dist/core/tools/bash.js.map +1 -0
  412. package/dist/core/tools/edit-diff.d.ts +101 -0
  413. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  414. package/dist/core/tools/edit-diff.js +421 -0
  415. package/dist/core/tools/edit-diff.js.map +1 -0
  416. package/dist/core/tools/edit.d.ts +44 -0
  417. package/dist/core/tools/edit.d.ts.map +1 -0
  418. package/dist/core/tools/edit.js +147 -0
  419. package/dist/core/tools/edit.js.map +1 -0
  420. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  421. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  422. package/dist/core/tools/file-mutation-queue.js +52 -0
  423. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  424. package/dist/core/tools/find.d.ts +42 -0
  425. package/dist/core/tools/find.d.ts.map +1 -0
  426. package/dist/core/tools/find.js +251 -0
  427. package/dist/core/tools/find.js.map +1 -0
  428. package/dist/core/tools/grep.d.ts +41 -0
  429. package/dist/core/tools/grep.d.ts.map +1 -0
  430. package/dist/core/tools/grep.js +252 -0
  431. package/dist/core/tools/grep.js.map +1 -0
  432. package/dist/core/tools/index.d.ts +43 -0
  433. package/dist/core/tools/index.d.ts.map +1 -0
  434. package/dist/core/tools/index.js +129 -0
  435. package/dist/core/tools/index.js.map +1 -0
  436. package/dist/core/tools/ls.d.ts +41 -0
  437. package/dist/core/tools/ls.d.ts.map +1 -0
  438. package/dist/core/tools/ls.js +126 -0
  439. package/dist/core/tools/ls.js.map +1 -0
  440. package/dist/core/tools/output-accumulator.d.ts +63 -0
  441. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  442. package/dist/core/tools/output-accumulator.js +220 -0
  443. package/dist/core/tools/output-accumulator.js.map +1 -0
  444. package/dist/core/tools/path-utils.d.ts +10 -0
  445. package/dist/core/tools/path-utils.d.ts.map +1 -0
  446. package/dist/core/tools/path-utils.js +99 -0
  447. package/dist/core/tools/path-utils.js.map +1 -0
  448. package/dist/core/tools/powershell.d.ts +16 -0
  449. package/dist/core/tools/powershell.d.ts.map +1 -0
  450. package/dist/core/tools/powershell.js +39 -0
  451. package/dist/core/tools/powershell.js.map +1 -0
  452. package/dist/core/tools/read.d.ts +42 -0
  453. package/dist/core/tools/read.d.ts.map +1 -0
  454. package/dist/core/tools/read.js +169 -0
  455. package/dist/core/tools/read.js.map +1 -0
  456. package/dist/core/tools/render-utils.d.ts +30 -0
  457. package/dist/core/tools/render-utils.d.ts.map +1 -0
  458. package/dist/core/tools/render-utils.js +91 -0
  459. package/dist/core/tools/render-utils.js.map +1 -0
  460. package/dist/core/tools/renderers/bash.d.ts +12 -0
  461. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  462. package/dist/core/tools/renderers/bash.js +117 -0
  463. package/dist/core/tools/renderers/bash.js.map +1 -0
  464. package/dist/core/tools/renderers/edit.d.ts +23 -0
  465. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  466. package/dist/core/tools/renderers/edit.js +167 -0
  467. package/dist/core/tools/renderers/edit.js.map +1 -0
  468. package/dist/core/tools/renderers/find.d.ts +10 -0
  469. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  470. package/dist/core/tools/renderers/find.js +64 -0
  471. package/dist/core/tools/renderers/find.js.map +1 -0
  472. package/dist/core/tools/renderers/grep.d.ts +10 -0
  473. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  474. package/dist/core/tools/renderers/grep.js +69 -0
  475. package/dist/core/tools/renderers/grep.js.map +1 -0
  476. package/dist/core/tools/renderers/index.d.ts +28 -0
  477. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  478. package/dist/core/tools/renderers/index.js +47 -0
  479. package/dist/core/tools/renderers/index.js.map +1 -0
  480. package/dist/core/tools/renderers/ls.d.ts +10 -0
  481. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  482. package/dist/core/tools/renderers/ls.js +58 -0
  483. package/dist/core/tools/renderers/ls.js.map +1 -0
  484. package/dist/core/tools/renderers/read.d.ts +11 -0
  485. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  486. package/dist/core/tools/renderers/read.js +130 -0
  487. package/dist/core/tools/renderers/read.js.map +1 -0
  488. package/dist/core/tools/renderers/write.d.ts +10 -0
  489. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  490. package/dist/core/tools/renderers/write.js +153 -0
  491. package/dist/core/tools/renderers/write.js.map +1 -0
  492. package/dist/core/tools/tool-definition-wrapper.d.ts +16 -0
  493. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  494. package/dist/core/tools/tool-definition-wrapper.js +38 -0
  495. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  496. package/dist/core/tools/truncate.d.ts +84 -0
  497. package/dist/core/tools/truncate.d.ts.map +1 -0
  498. package/dist/core/tools/truncate.js +244 -0
  499. package/dist/core/tools/truncate.js.map +1 -0
  500. package/dist/core/tools/write.d.ts +30 -0
  501. package/dist/core/tools/write.d.ts.map +1 -0
  502. package/dist/core/tools/write.js +61 -0
  503. package/dist/core/tools/write.js.map +1 -0
  504. package/dist/core/trust-manager.d.ts +36 -0
  505. package/dist/core/trust-manager.d.ts.map +1 -0
  506. package/dist/core/trust-manager.js +203 -0
  507. package/dist/core/trust-manager.js.map +1 -0
  508. package/dist/core/usage-totals.d.ts +21 -0
  509. package/dist/core/usage-totals.d.ts.map +1 -0
  510. package/dist/core/usage-totals.js +79 -0
  511. package/dist/core/usage-totals.js.map +1 -0
  512. package/dist/core/virtual-models.d.ts +117 -0
  513. package/dist/core/virtual-models.d.ts.map +1 -0
  514. package/dist/core/virtual-models.js +124 -0
  515. package/dist/core/virtual-models.js.map +1 -0
  516. package/dist/extensions/index.d.ts +3 -0
  517. package/dist/extensions/index.d.ts.map +1 -0
  518. package/dist/extensions/index.js +3 -0
  519. package/dist/extensions/index.js.map +1 -0
  520. package/dist/extensions/llama/client.d.ts +69 -0
  521. package/dist/extensions/llama/client.d.ts.map +1 -0
  522. package/dist/extensions/llama/client.js +313 -0
  523. package/dist/extensions/llama/client.js.map +1 -0
  524. package/dist/extensions/llama/huggingface.d.ts +23 -0
  525. package/dist/extensions/llama/huggingface.d.ts.map +1 -0
  526. package/dist/extensions/llama/huggingface.js +141 -0
  527. package/dist/extensions/llama/huggingface.js.map +1 -0
  528. package/dist/extensions/llama/index.d.ts +3 -0
  529. package/dist/extensions/llama/index.d.ts.map +1 -0
  530. package/dist/extensions/llama/index.js +219 -0
  531. package/dist/extensions/llama/index.js.map +1 -0
  532. package/dist/extensions/llama/provider.d.ts +12 -0
  533. package/dist/extensions/llama/provider.d.ts.map +1 -0
  534. package/dist/extensions/llama/provider.js +213 -0
  535. package/dist/extensions/llama/provider.js.map +1 -0
  536. package/dist/extensions/llama/ui.d.ts +42 -0
  537. package/dist/extensions/llama/ui.d.ts.map +1 -0
  538. package/dist/extensions/llama/ui.js +416 -0
  539. package/dist/extensions/llama/ui.js.map +1 -0
  540. package/dist/index.d.ts +38 -0
  541. package/dist/index.d.ts.map +1 -0
  542. package/dist/index.js +49 -0
  543. package/dist/index.js.map +1 -0
  544. package/dist/main.d.ts +16 -0
  545. package/dist/main.d.ts.map +1 -0
  546. package/dist/main.js +819 -0
  547. package/dist/main.js.map +1 -0
  548. package/dist/migrations.d.ts +33 -0
  549. package/dist/migrations.d.ts.map +1 -0
  550. package/dist/migrations.js +282 -0
  551. package/dist/migrations.js.map +1 -0
  552. package/dist/modes/index.d.ts +10 -0
  553. package/dist/modes/index.d.ts.map +1 -0
  554. package/dist/modes/index.js +8 -0
  555. package/dist/modes/index.js.map +1 -0
  556. package/dist/modes/interactive/assets/clankolas.png +0 -0
  557. package/dist/modes/interactive/bug-report.d.ts +16 -0
  558. package/dist/modes/interactive/bug-report.d.ts.map +1 -0
  559. package/dist/modes/interactive/bug-report.js +210 -0
  560. package/dist/modes/interactive/bug-report.js.map +1 -0
  561. package/dist/modes/interactive/chat-viewport.d.ts +20 -0
  562. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  563. package/dist/modes/interactive/chat-viewport.js +28 -0
  564. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  565. package/dist/modes/interactive/components/armin.d.ts +34 -0
  566. package/dist/modes/interactive/components/armin.d.ts.map +1 -0
  567. package/dist/modes/interactive/components/armin.js +333 -0
  568. package/dist/modes/interactive/components/armin.js.map +1 -0
  569. package/dist/modes/interactive/components/assistant-message.d.ts +26 -0
  570. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  571. package/dist/modes/interactive/components/assistant-message.js +158 -0
  572. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  573. package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  574. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  575. package/dist/modes/interactive/components/bash-execution.js +175 -0
  576. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  577. package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  578. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  579. package/dist/modes/interactive/components/bordered-loader.js +54 -0
  580. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  581. package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  582. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  583. package/dist/modes/interactive/components/branch-summary-message.js +51 -0
  584. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  585. package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  586. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  587. package/dist/modes/interactive/components/compaction-summary-message.js +52 -0
  588. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  589. package/dist/modes/interactive/components/config-selector.d.ts +102 -0
  590. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  591. package/dist/modes/interactive/components/config-selector.js +771 -0
  592. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  593. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  594. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  595. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  596. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  597. package/dist/modes/interactive/components/custom-editor.d.ts +30 -0
  598. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  599. package/dist/modes/interactive/components/custom-editor.js +115 -0
  600. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  601. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  602. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  603. package/dist/modes/interactive/components/custom-entry.js +52 -0
  604. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  605. package/dist/modes/interactive/components/custom-message.d.ts +22 -0
  606. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  607. package/dist/modes/interactive/components/custom-message.js +87 -0
  608. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  609. package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
  610. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
  611. package/dist/modes/interactive/components/daxnuts.js +140 -0
  612. package/dist/modes/interactive/components/daxnuts.js.map +1 -0
  613. package/dist/modes/interactive/components/diff.d.ts +12 -0
  614. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  615. package/dist/modes/interactive/components/diff.js +133 -0
  616. package/dist/modes/interactive/components/diff.js.map +1 -0
  617. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  618. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  619. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  620. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  621. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  622. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  623. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  624. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  625. package/dist/modes/interactive/components/extension-editor.d.ts +24 -0
  626. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  627. package/dist/modes/interactive/components/extension-editor.js +103 -0
  628. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  629. package/dist/modes/interactive/components/extension-input.d.ts +25 -0
  630. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  631. package/dist/modes/interactive/components/extension-input.js +67 -0
  632. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  633. package/dist/modes/interactive/components/extension-selector.d.ts +27 -0
  634. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  635. package/dist/modes/interactive/components/extension-selector.js +87 -0
  636. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  637. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  638. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  639. package/dist/modes/interactive/components/first-time-setup.js +109 -0
  640. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  641. package/dist/modes/interactive/components/footer.d.ts +39 -0
  642. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  643. package/dist/modes/interactive/components/footer.js +265 -0
  644. package/dist/modes/interactive/components/footer.js.map +1 -0
  645. package/dist/modes/interactive/components/index.d.ts +34 -0
  646. package/dist/modes/interactive/components/index.d.ts.map +1 -0
  647. package/dist/modes/interactive/components/index.js +35 -0
  648. package/dist/modes/interactive/components/index.js.map +1 -0
  649. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  650. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  651. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  652. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  653. package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
  654. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  655. package/dist/modes/interactive/components/login-dialog.js +188 -0
  656. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  657. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  658. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  659. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  660. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  661. package/dist/modes/interactive/components/mermaid.d.ts +11 -0
  662. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  663. package/dist/modes/interactive/components/mermaid.js +75 -0
  664. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  665. package/dist/modes/interactive/components/model-selector.d.ts +60 -0
  666. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  667. package/dist/modes/interactive/components/model-selector.js +361 -0
  668. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  669. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  670. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  671. package/dist/modes/interactive/components/oauth-selector.js +163 -0
  672. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  673. package/dist/modes/interactive/components/pi-logo-animation.d.ts +68 -0
  674. package/dist/modes/interactive/components/pi-logo-animation.d.ts.map +1 -0
  675. package/dist/modes/interactive/components/pi-logo-animation.js +1086 -0
  676. package/dist/modes/interactive/components/pi-logo-animation.js.map +1 -0
  677. package/dist/modes/interactive/components/pi-logo-animation.lazy.d.ts +7 -0
  678. package/dist/modes/interactive/components/pi-logo-animation.lazy.d.ts.map +1 -0
  679. package/dist/modes/interactive/components/pi-logo-animation.lazy.js +12 -0
  680. package/dist/modes/interactive/components/pi-logo-animation.lazy.js.map +1 -0
  681. package/dist/modes/interactive/components/pi-logo.d.ts +12 -0
  682. package/dist/modes/interactive/components/pi-logo.d.ts.map +1 -0
  683. package/dist/modes/interactive/components/pi-logo.js +25 -0
  684. package/dist/modes/interactive/components/pi-logo.js.map +1 -0
  685. package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
  686. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  687. package/dist/modes/interactive/components/scoped-models-selector.js +326 -0
  688. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  689. package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  690. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  691. package/dist/modes/interactive/components/session-selector-search.js +155 -0
  692. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  693. package/dist/modes/interactive/components/session-selector.d.ts +95 -0
  694. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  695. package/dist/modes/interactive/components/session-selector.js +893 -0
  696. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  697. package/dist/modes/interactive/components/settings-selector.d.ts +96 -0
  698. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  699. package/dist/modes/interactive/components/settings-selector.js +742 -0
  700. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  701. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  702. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  703. package/dist/modes/interactive/components/settings-submenu.js +165 -0
  704. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  705. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  706. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  707. package/dist/modes/interactive/components/show-images-selector.js +39 -0
  708. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  709. package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  710. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  711. package/dist/modes/interactive/components/skill-invocation-message.js +54 -0
  712. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  713. package/dist/modes/interactive/components/status-indicator.d.ts +30 -0
  714. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  715. package/dist/modes/interactive/components/status-indicator.js +67 -0
  716. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  717. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  718. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  719. package/dist/modes/interactive/components/theme-selector.js +50 -0
  720. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  721. package/dist/modes/interactive/components/themed-text.d.ts +17 -0
  722. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
  723. package/dist/modes/interactive/components/themed-text.js +29 -0
  724. package/dist/modes/interactive/components/themed-text.js.map +1 -0
  725. package/dist/modes/interactive/components/thinking-selector.d.ts +23 -0
  726. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  727. package/dist/modes/interactive/components/thinking-selector.js +109 -0
  728. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  729. package/dist/modes/interactive/components/tool-execution.d.ts +80 -0
  730. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  731. package/dist/modes/interactive/components/tool-execution.js +337 -0
  732. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  733. package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
  734. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  735. package/dist/modes/interactive/components/tree-selector.js +1254 -0
  736. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  737. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  738. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  739. package/dist/modes/interactive/components/trust-selector.js +91 -0
  740. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  741. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  742. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  743. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  744. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  745. package/dist/modes/interactive/components/user-message.d.ts +16 -0
  746. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  747. package/dist/modes/interactive/components/user-message.js +50 -0
  748. package/dist/modes/interactive/components/user-message.js.map +1 -0
  749. package/dist/modes/interactive/components/visual-truncate.d.ts +48 -0
  750. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  751. package/dist/modes/interactive/components/visual-truncate.js +66 -0
  752. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  753. package/dist/modes/interactive/external-editor.d.ts +12 -0
  754. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  755. package/dist/modes/interactive/external-editor.js +38 -0
  756. package/dist/modes/interactive/external-editor.js.map +1 -0
  757. package/dist/modes/interactive/interactive-mode.d.ts +470 -0
  758. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  759. package/dist/modes/interactive/interactive-mode.js +5789 -0
  760. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  761. package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
  762. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
  763. package/dist/modes/interactive/model-catalog-refresh.js +34 -0
  764. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
  765. package/dist/modes/interactive/model-search.d.ts +12 -0
  766. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  767. package/dist/modes/interactive/model-search.js +15 -0
  768. package/dist/modes/interactive/model-search.js.map +1 -0
  769. package/dist/modes/interactive/session-share.d.ts +18 -0
  770. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  771. package/dist/modes/interactive/session-share.js +188 -0
  772. package/dist/modes/interactive/session-share.js.map +1 -0
  773. package/dist/modes/interactive/theme/dark.json +78 -0
  774. package/dist/modes/interactive/theme/light.json +78 -0
  775. package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  776. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  777. package/dist/modes/interactive/theme/system-theme.js +546 -0
  778. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  779. package/dist/modes/interactive/theme/theme-controller.d.ts +81 -0
  780. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  781. package/dist/modes/interactive/theme/theme-controller.js +210 -0
  782. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  783. package/dist/modes/interactive/theme/theme-json.d.ts +85 -0
  784. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  785. package/dist/modes/interactive/theme/theme-json.js +132 -0
  786. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  787. package/dist/modes/interactive/theme/theme-schema.json +361 -0
  788. package/dist/modes/interactive/theme/theme.d.ts +158 -0
  789. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  790. package/dist/modes/interactive/theme/theme.js +912 -0
  791. package/dist/modes/interactive/theme/theme.js.map +1 -0
  792. package/dist/modes/interactive/tui-renderer.d.ts +22 -0
  793. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  794. package/dist/modes/interactive/tui-renderer.js +67 -0
  795. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  796. package/dist/modes/json-event.d.ts +34 -0
  797. package/dist/modes/json-event.d.ts.map +1 -0
  798. package/dist/modes/json-event.js +29 -0
  799. package/dist/modes/json-event.js.map +1 -0
  800. package/dist/modes/print-mode.d.ts +28 -0
  801. package/dist/modes/print-mode.d.ts.map +1 -0
  802. package/dist/modes/print-mode.js +142 -0
  803. package/dist/modes/print-mode.js.map +1 -0
  804. package/dist/modes/rpc/jsonl.d.ts +17 -0
  805. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  806. package/dist/modes/rpc/jsonl.js +49 -0
  807. package/dist/modes/rpc/jsonl.js.map +1 -0
  808. package/dist/modes/rpc/rpc-client.d.ts +254 -0
  809. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  810. package/dist/modes/rpc/rpc-client.js +499 -0
  811. package/dist/modes/rpc/rpc-client.js.map +1 -0
  812. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  813. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  814. package/dist/modes/rpc/rpc-mode.js +655 -0
  815. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  816. package/dist/modes/rpc/rpc-types.d.ts +478 -0
  817. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  818. package/dist/modes/rpc/rpc-types.js +8 -0
  819. package/dist/modes/rpc/rpc-types.js.map +1 -0
  820. package/dist/package-manager-cli.d.ts +9 -0
  821. package/dist/package-manager-cli.d.ts.map +1 -0
  822. package/dist/package-manager-cli.js +976 -0
  823. package/dist/package-manager-cli.js.map +1 -0
  824. package/dist/rpc-entry.d.ts +3 -0
  825. package/dist/rpc-entry.d.ts.map +1 -0
  826. package/dist/rpc-entry.js +11 -0
  827. package/dist/rpc-entry.js.map +1 -0
  828. package/dist/utils/abort.d.ts +5 -0
  829. package/dist/utils/abort.d.ts.map +1 -0
  830. package/dist/utils/abort.js +48 -0
  831. package/dist/utils/abort.js.map +1 -0
  832. package/dist/utils/ansi.d.ts +2 -0
  833. package/dist/utils/ansi.d.ts.map +1 -0
  834. package/dist/utils/ansi.js +52 -0
  835. package/dist/utils/ansi.js.map +1 -0
  836. package/dist/utils/changelog.d.ts +22 -0
  837. package/dist/utils/changelog.d.ts.map +1 -0
  838. package/dist/utils/changelog.js +165 -0
  839. package/dist/utils/changelog.js.map +1 -0
  840. package/dist/utils/child-process.d.ts +18 -0
  841. package/dist/utils/child-process.d.ts.map +1 -0
  842. package/dist/utils/child-process.js +106 -0
  843. package/dist/utils/child-process.js.map +1 -0
  844. package/dist/utils/clipboard-command.d.ts +7 -0
  845. package/dist/utils/clipboard-command.d.ts.map +1 -0
  846. package/dist/utils/clipboard-command.js +45 -0
  847. package/dist/utils/clipboard-command.js.map +1 -0
  848. package/dist/utils/clipboard-image.d.ts +11 -0
  849. package/dist/utils/clipboard-image.d.ts.map +1 -0
  850. package/dist/utils/clipboard-image.js +214 -0
  851. package/dist/utils/clipboard-image.js.map +1 -0
  852. package/dist/utils/clipboard.d.ts +6 -0
  853. package/dist/utils/clipboard.d.ts.map +1 -0
  854. package/dist/utils/clipboard.js +156 -0
  855. package/dist/utils/clipboard.js.map +1 -0
  856. package/dist/utils/deprecation.d.ts +4 -0
  857. package/dist/utils/deprecation.d.ts.map +1 -0
  858. package/dist/utils/deprecation.js +13 -0
  859. package/dist/utils/deprecation.js.map +1 -0
  860. package/dist/utils/exif-orientation.d.ts +5 -0
  861. package/dist/utils/exif-orientation.d.ts.map +1 -0
  862. package/dist/utils/exif-orientation.js +157 -0
  863. package/dist/utils/exif-orientation.js.map +1 -0
  864. package/dist/utils/frontmatter.d.ts +8 -0
  865. package/dist/utils/frontmatter.d.ts.map +1 -0
  866. package/dist/utils/frontmatter.js +27 -0
  867. package/dist/utils/frontmatter.js.map +1 -0
  868. package/dist/utils/fs-watch.d.ts +5 -0
  869. package/dist/utils/fs-watch.d.ts.map +1 -0
  870. package/dist/utils/fs-watch.js +25 -0
  871. package/dist/utils/fs-watch.js.map +1 -0
  872. package/dist/utils/git.d.ts +26 -0
  873. package/dist/utils/git.d.ts.map +1 -0
  874. package/dist/utils/git.js +195 -0
  875. package/dist/utils/git.js.map +1 -0
  876. package/dist/utils/html.d.ts +7 -0
  877. package/dist/utils/html.d.ts.map +1 -0
  878. package/dist/utils/html.js +40 -0
  879. package/dist/utils/html.js.map +1 -0
  880. package/dist/utils/image-convert.d.ts +10 -0
  881. package/dist/utils/image-convert.d.ts.map +1 -0
  882. package/dist/utils/image-convert.js +45 -0
  883. package/dist/utils/image-convert.js.map +1 -0
  884. package/dist/utils/image-process.d.ts +18 -0
  885. package/dist/utils/image-process.d.ts.map +1 -0
  886. package/dist/utils/image-process.js +83 -0
  887. package/dist/utils/image-process.js.map +1 -0
  888. package/dist/utils/image-resize-core.d.ts +30 -0
  889. package/dist/utils/image-resize-core.d.ts.map +1 -0
  890. package/dist/utils/image-resize-core.js +124 -0
  891. package/dist/utils/image-resize-core.js.map +1 -0
  892. package/dist/utils/image-resize-worker.d.ts +2 -0
  893. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  894. package/dist/utils/image-resize-worker.js +31 -0
  895. package/dist/utils/image-resize-worker.js.map +1 -0
  896. package/dist/utils/image-resize.d.ts +16 -0
  897. package/dist/utils/image-resize.d.ts.map +1 -0
  898. package/dist/utils/image-resize.js +97 -0
  899. package/dist/utils/image-resize.js.map +1 -0
  900. package/dist/utils/json.d.ts +3 -0
  901. package/dist/utils/json.d.ts.map +1 -0
  902. package/dist/utils/json.js +7 -0
  903. package/dist/utils/json.js.map +1 -0
  904. package/dist/utils/management-http.d.ts +25 -0
  905. package/dist/utils/management-http.d.ts.map +1 -0
  906. package/dist/utils/management-http.js +54 -0
  907. package/dist/utils/management-http.js.map +1 -0
  908. package/dist/utils/mime.d.ts +3 -0
  909. package/dist/utils/mime.d.ts.map +1 -0
  910. package/dist/utils/mime.js +110 -0
  911. package/dist/utils/mime.js.map +1 -0
  912. package/dist/utils/open-browser.d.ts +9 -0
  913. package/dist/utils/open-browser.d.ts.map +1 -0
  914. package/dist/utils/open-browser.js +22 -0
  915. package/dist/utils/open-browser.js.map +1 -0
  916. package/dist/utils/paths.d.ts +34 -0
  917. package/dist/utils/paths.d.ts.map +1 -0
  918. package/dist/utils/paths.js +115 -0
  919. package/dist/utils/paths.js.map +1 -0
  920. package/dist/utils/photon.d.ts +21 -0
  921. package/dist/utils/photon.d.ts.map +1 -0
  922. package/dist/utils/photon.js +121 -0
  923. package/dist/utils/photon.js.map +1 -0
  924. package/dist/utils/pi-user-agent.d.ts +2 -0
  925. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  926. package/dist/utils/pi-user-agent.js +5 -0
  927. package/dist/utils/pi-user-agent.js.map +1 -0
  928. package/dist/utils/shell.d.ts +32 -0
  929. package/dist/utils/shell.d.ts.map +1 -0
  930. package/dist/utils/shell.js +189 -0
  931. package/dist/utils/shell.js.map +1 -0
  932. package/dist/utils/sleep.d.ts +5 -0
  933. package/dist/utils/sleep.d.ts.map +1 -0
  934. package/dist/utils/sleep.js +17 -0
  935. package/dist/utils/sleep.js.map +1 -0
  936. package/dist/utils/syntax-highlight.d.ts +13 -0
  937. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  938. package/dist/utils/syntax-highlight.js +179 -0
  939. package/dist/utils/syntax-highlight.js.map +1 -0
  940. package/dist/utils/text.d.ts +8 -0
  941. package/dist/utils/text.d.ts.map +1 -0
  942. package/dist/utils/text.js +9 -0
  943. package/dist/utils/text.js.map +1 -0
  944. package/dist/utils/tool-result-images.d.ts +21 -0
  945. package/dist/utils/tool-result-images.d.ts.map +1 -0
  946. package/dist/utils/tool-result-images.js +48 -0
  947. package/dist/utils/tool-result-images.js.map +1 -0
  948. package/dist/utils/tools-manager.d.ts +13 -0
  949. package/dist/utils/tools-manager.d.ts.map +1 -0
  950. package/dist/utils/tools-manager.js +343 -0
  951. package/dist/utils/tools-manager.js.map +1 -0
  952. package/dist/utils/version-check.d.ts +19 -0
  953. package/dist/utils/version-check.d.ts.map +1 -0
  954. package/dist/utils/version-check.js +72 -0
  955. package/dist/utils/version-check.js.map +1 -0
  956. package/dist/utils/windows-self-update.d.ts +3 -0
  957. package/dist/utils/windows-self-update.d.ts.map +1 -0
  958. package/dist/utils/windows-self-update.js +77 -0
  959. package/dist/utils/windows-self-update.js.map +1 -0
  960. package/dist/utils/wsl.d.ts +3 -0
  961. package/dist/utils/wsl.d.ts.map +1 -0
  962. package/dist/utils/wsl.js +15 -0
  963. package/dist/utils/wsl.js.map +1 -0
  964. package/dist/utils/zip.d.ts +7 -0
  965. package/dist/utils/zip.d.ts.map +1 -0
  966. package/dist/utils/zip.js +60 -0
  967. package/dist/utils/zip.js.map +1 -0
  968. package/docs/cli-integration.md +106 -0
  969. package/docs/cli.md +329 -0
  970. package/docs/compaction.md +463 -0
  971. package/docs/configuration.md +47 -0
  972. package/docs/containerization.md +183 -0
  973. package/docs/custom-provider.md +173 -0
  974. package/docs/docs.json +208 -0
  975. package/docs/environment-variables.md +104 -0
  976. package/docs/extensions.md +270 -0
  977. package/docs/how-pi-works.md +49 -0
  978. package/docs/images/doom-extension.png +0 -0
  979. package/docs/images/exy.png +0 -0
  980. package/docs/images/interactive-mode.png +0 -0
  981. package/docs/images/tree-view.png +0 -0
  982. package/docs/index.md +39 -0
  983. package/docs/json.md +226 -0
  984. package/docs/keybindings.md +194 -0
  985. package/docs/llama-cpp.md +114 -0
  986. package/docs/mcp.md +248 -0
  987. package/docs/message-types.md +261 -0
  988. package/docs/models.md +158 -0
  989. package/docs/packages.md +129 -0
  990. package/docs/prompt-templates.md +59 -0
  991. package/docs/providers.md +190 -0
  992. package/docs/quickstart.md +122 -0
  993. package/docs/rpc-commands.md +860 -0
  994. package/docs/rpc-extension-ui.md +200 -0
  995. package/docs/rpc.md +193 -0
  996. package/docs/sdk.md +147 -0
  997. package/docs/security.md +99 -0
  998. package/docs/session-format.md +293 -0
  999. package/docs/sessions.md +66 -0
  1000. package/docs/settings.md +169 -0
  1001. package/docs/shell-aliases.md +93 -0
  1002. package/docs/skills.md +93 -0
  1003. package/docs/slash-commands.md +60 -0
  1004. package/docs/terminal-setup.md +219 -0
  1005. package/docs/termux.md +117 -0
  1006. package/docs/themes.md +136 -0
  1007. package/docs/tmux.md +55 -0
  1008. package/docs/tui.md +125 -0
  1009. package/docs/usage.md +94 -0
  1010. package/docs/virtual-models.md +114 -0
  1011. package/docs/windows.md +67 -0
  1012. package/examples/README.md +39 -0
  1013. package/examples/extensions/README.md +214 -0
  1014. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  1015. package/examples/extensions/bash-spawn-hook.ts +30 -0
  1016. package/examples/extensions/bookmark.ts +50 -0
  1017. package/examples/extensions/border-status-editor.ts +150 -0
  1018. package/examples/extensions/built-in-tool-renderer.ts +225 -0
  1019. package/examples/extensions/claude-rules.ts +86 -0
  1020. package/examples/extensions/commands.ts +72 -0
  1021. package/examples/extensions/confirm-destructive.ts +59 -0
  1022. package/examples/extensions/custom-compaction.ts +117 -0
  1023. package/examples/extensions/custom-footer.ts +64 -0
  1024. package/examples/extensions/custom-header.ts +73 -0
  1025. package/examples/extensions/custom-provider-anthropic/index.ts +617 -0
  1026. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  1027. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  1028. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  1029. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  1030. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  1031. package/examples/extensions/debug-provider.ts +90 -0
  1032. package/examples/extensions/dirty-repo-guard.ts +56 -0
  1033. package/examples/extensions/doom-overlay/README.md +46 -0
  1034. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  1035. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  1036. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  1037. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  1038. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  1039. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  1040. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  1041. package/examples/extensions/doom-overlay/index.ts +74 -0
  1042. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  1043. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  1044. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  1045. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  1046. package/examples/extensions/dynamic-resources/index.ts +15 -0
  1047. package/examples/extensions/dynamic-tools.ts +74 -0
  1048. package/examples/extensions/entry-renderer.ts +41 -0
  1049. package/examples/extensions/event-bus.ts +43 -0
  1050. package/examples/extensions/file-trigger.ts +41 -0
  1051. package/examples/extensions/git-checkpoint.ts +53 -0
  1052. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  1053. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  1054. package/examples/extensions/gondolin/index.ts +531 -0
  1055. package/examples/extensions/gondolin/package-lock.json +185 -0
  1056. package/examples/extensions/gondolin/package.json +19 -0
  1057. package/examples/extensions/handoff.ts +190 -0
  1058. package/examples/extensions/hello.ts +26 -0
  1059. package/examples/extensions/hidden-thinking-label.ts +53 -0
  1060. package/examples/extensions/inline-bash.ts +94 -0
  1061. package/examples/extensions/input-transform-streaming.ts +39 -0
  1062. package/examples/extensions/input-transform.ts +43 -0
  1063. package/examples/extensions/interactive-shell.ts +196 -0
  1064. package/examples/extensions/jev-router.ts +113 -0
  1065. package/examples/extensions/mac-system-theme.ts +47 -0
  1066. package/examples/extensions/message-renderer.ts +59 -0
  1067. package/examples/extensions/minimal-mode.ts +354 -0
  1068. package/examples/extensions/modal-editor.ts +85 -0
  1069. package/examples/extensions/model-status.ts +31 -0
  1070. package/examples/extensions/notify.ts +57 -0
  1071. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  1072. package/examples/extensions/overlay-test.ts +153 -0
  1073. package/examples/extensions/permission-gate.ts +34 -0
  1074. package/examples/extensions/pirate.ts +47 -0
  1075. package/examples/extensions/plan-mode/README.md +66 -0
  1076. package/examples/extensions/plan-mode/index.ts +390 -0
  1077. package/examples/extensions/plan-mode/utils.ts +168 -0
  1078. package/examples/extensions/preset.ts +436 -0
  1079. package/examples/extensions/project-trust.ts +64 -0
  1080. package/examples/extensions/prompt-customizer.ts +49 -0
  1081. package/examples/extensions/protected-paths.ts +30 -0
  1082. package/examples/extensions/provider-payload.ts +18 -0
  1083. package/examples/extensions/qna.ts +118 -0
  1084. package/examples/extensions/question.ts +286 -0
  1085. package/examples/extensions/questionnaire.ts +448 -0
  1086. package/examples/extensions/rainbow-editor.ts +88 -0
  1087. package/examples/extensions/reload-runtime.ts +37 -0
  1088. package/examples/extensions/rpc-demo.ts +118 -0
  1089. package/examples/extensions/sandbox/index.ts +321 -0
  1090. package/examples/extensions/sandbox/package-lock.json +92 -0
  1091. package/examples/extensions/sandbox/package.json +19 -0
  1092. package/examples/extensions/send-user-message.ts +97 -0
  1093. package/examples/extensions/session-name.ts +27 -0
  1094. package/examples/extensions/shutdown-command.ts +63 -0
  1095. package/examples/extensions/snake.ts +343 -0
  1096. package/examples/extensions/space-invaders.ts +560 -0
  1097. package/examples/extensions/ssh.ts +220 -0
  1098. package/examples/extensions/status-line.ts +32 -0
  1099. package/examples/extensions/structured-output.ts +65 -0
  1100. package/examples/extensions/subagent/README.md +177 -0
  1101. package/examples/extensions/subagent/agents/planner.md +37 -0
  1102. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  1103. package/examples/extensions/subagent/agents/scout.md +50 -0
  1104. package/examples/extensions/subagent/agents/worker.md +24 -0
  1105. package/examples/extensions/subagent/agents.ts +157 -0
  1106. package/examples/extensions/subagent/index.ts +1038 -0
  1107. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  1108. package/examples/extensions/subagent/prompts/implement.md +10 -0
  1109. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  1110. package/examples/extensions/summarize.ts +199 -0
  1111. package/examples/extensions/system-prompt-header.ts +17 -0
  1112. package/examples/extensions/tic-tac-toe.ts +1008 -0
  1113. package/examples/extensions/timed-confirm.ts +70 -0
  1114. package/examples/extensions/titlebar-spinner.ts +58 -0
  1115. package/examples/extensions/todo.ts +297 -0
  1116. package/examples/extensions/tool-override.ts +144 -0
  1117. package/examples/extensions/tools.ts +146 -0
  1118. package/examples/extensions/trigger-compact.ts +50 -0
  1119. package/examples/extensions/truncated-tool.ts +195 -0
  1120. package/examples/extensions/widget-placement.ts +9 -0
  1121. package/examples/extensions/with-deps/index.ts +32 -0
  1122. package/examples/extensions/with-deps/package-lock.json +31 -0
  1123. package/examples/extensions/with-deps/package.json +22 -0
  1124. package/examples/extensions/working-indicator.ts +123 -0
  1125. package/examples/extensions/working-message-test.ts +25 -0
  1126. package/examples/plugins/pi-example-plugin/README.md +38 -0
  1127. package/examples/plugins/pi-example-plugin/package.json +10 -0
  1128. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  1129. package/examples/plugins/pi-example-plugin/src/session.ts +24 -0
  1130. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  1131. package/examples/rpc-client.ts +35 -0
  1132. package/examples/rpc-extension-ui.ts +661 -0
  1133. package/examples/sdk/01-minimal.ts +26 -0
  1134. package/examples/sdk/02-custom-model.ts +49 -0
  1135. package/examples/sdk/03-custom-prompt.ts +75 -0
  1136. package/examples/sdk/04-skills.ts +55 -0
  1137. package/examples/sdk/05-tools.ts +48 -0
  1138. package/examples/sdk/06-extensions.ts +99 -0
  1139. package/examples/sdk/07-context-files.ts +47 -0
  1140. package/examples/sdk/08-prompt-templates.ts +51 -0
  1141. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  1142. package/examples/sdk/10-settings.ts +53 -0
  1143. package/examples/sdk/11-sessions.ts +52 -0
  1144. package/examples/sdk/12-full-control.ts +74 -0
  1145. package/examples/sdk/13-session-runtime.ts +67 -0
  1146. package/examples/sdk/README.md +140 -0
  1147. package/package.json +110 -5
@@ -0,0 +1,270 @@
1
+ # Extensions
2
+
3
+ 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.
4
+
5
+ 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.
6
+
7
+ Typical extensions add an agent tool, protect paths, confirm dangerous commands, react to session events, modify context, expose a command, or display persistent status.
8
+
9
+ <a id="quick-start"></a>
10
+ <a id="writing-an-extension"></a>
11
+ <a id="create-an-extension"></a>
12
+
13
+ ## Create and load an extension
14
+
15
+ An extension exports a default factory that receives `ExtensionAPI`. The factory registers capabilities for the current extension runtime.
16
+
17
+ Create `~/.pi/agent/extensions/hello.ts`:
18
+
19
+ ```typescript
20
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
21
+
22
+ export default function (pi: ExtensionAPI) {
23
+ pi.registerCommand("hello", {
24
+ description: "Show a greeting",
25
+ handler: async (name, ctx) => {
26
+ ctx.ui.notify(`Hello, ${name || "world"}!`, "info");
27
+ },
28
+ });
29
+ }
30
+ ```
31
+
32
+ Start Pi and run `/hello`. During development, load a file directly:
33
+
34
+ ```bash
35
+ pi --extension ./hello.ts
36
+ ```
37
+
38
+ Pi uses `jiti`, so local TypeScript extensions do not need a separate compilation step. Use [Pi packages](packages.md) for distributed extensions and dependencies.
39
+
40
+ <a id="extension-locations"></a>
41
+ <a id="available-imports"></a>
42
+ <a id="choose-where-it-loads"></a>
43
+
44
+ ## Add it to Pi
45
+
46
+ 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.
47
+
48
+ 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.
49
+
50
+ 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.
51
+
52
+ <a id="understand-the-lifecycle"></a>
53
+
54
+ ## Respect the runtime lifecycle
55
+
56
+ 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.
57
+
58
+ Do not start processes, sockets, watchers, or timers in the factory because some invocations load extensions without starting a session.
59
+ Start long-lived resources from `session_start` or from the command or tool that needs them.
60
+ Close session-scoped resources from an idempotent `session_shutdown` handler.
61
+
62
+ A run proceeds from input and `before_agent_start`, through model, message, and tool events, to `agent_end`.
63
+ Automatic retries, recovery, compaction, or queued work can continue afterward.
64
+ <a id="agent_start--agent_end--agent_before_settle--agent_settled"></a>
65
+
66
+ `agent_before_settle` is the final actionable boundary: it can append entries and request one continuation.
67
+ `agent_settled` is final and notification-only; use it when an integration needs to know Pi will not continue automatically.
68
+
69
+ <a id="extensionapi-methods"></a>
70
+
71
+ ## Choose an integration point
72
+
73
+ | Capability | Main API |
74
+ |---|---|
75
+ | Observe or modify lifecycle behavior | `pi.on()` |
76
+ | Add a model-callable operation | `pi.registerTool()` |
77
+ | Add a `/` command | `pi.registerCommand()` |
78
+ | Add a shortcut or CLI flag | `pi.registerShortcut()` or `pi.registerFlag()` |
79
+ | Send user or custom messages | `pi.sendUserMessage()` or `pi.sendMessage()` |
80
+ | Persist non-context session data | `pi.appendEntry()` |
81
+ | Change active tools, model, or thinking level | Session control methods on `pi` |
82
+ | Add a model provider | `pi.registerProvider()` |
83
+ | Add an MCP server | `pi.registerMcpServer()` |
84
+ | Route each request to a model | [`pi.registerVirtualModel()`](virtual-models.md) |
85
+ | Add terminal rendering | Renderer registration and `ctx.ui` |
86
+ | Communicate with another extension | `pi.events` |
87
+
88
+ 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.
89
+
90
+ ## Follow the extension contracts
91
+
92
+ <a id="events"></a>
93
+ <a id="work-with-events"></a>
94
+
95
+ ### Events and concurrency
96
+
97
+ 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.
98
+ Some events notify; others transform data, replace results, or cancel an operation.
99
+ Use each event’s declared result type rather than assuming every return value has an effect.
100
+
101
+ Events cover resource discovery, sessions, agent and message lifecycle, providers, tools, and raw input.
102
+
103
+ `before_agent_start` exposes both the current prompt and its structured `systemPromptOptions`. 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.
104
+
105
+ `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.
106
+
107
+ <a id="provider_stream_event"></a>
108
+
109
+ `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.
110
+
111
+ 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.
112
+
113
+ <a id="context_with_system"></a>
114
+
115
+ `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.
116
+
117
+ `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.
118
+
119
+ <a id="cache_warming_decision"></a>
120
+
121
+ `cache_warming_decision` can override an idle prompt-cache refresh with `{ action: "warm" }` or `{ action: "stop" }`. The last handler that returns an action wins.
122
+
123
+ Tool calls from one assistant message can run in parallel.
124
+ Do not assume a sibling call or result exists when another tool event runs.
125
+ Use `ctx.signal` for nested work owned by an active turn; commands and idle session events often have no operation signal.
126
+
127
+ 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.
128
+
129
+ <a id="custom-tools"></a>
130
+ <a id="register-tools"></a>
131
+
132
+ ### Tools
133
+
134
+ A custom tool defines a name, model-facing description, TypeBox parameter schema, and `execute()` function.
135
+ Its result requires model-facing `content` and a `details` field for rendering or state reconstruction.
136
+ 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.
137
+
138
+ Throw from `execute()` to produce a failed tool result.
139
+ Returning an object does not mark it as an error.
140
+ Return `terminate: true` only when the agent should skip its automatic follow-up after every completed tool in that batch agrees to terminate.
141
+
142
+ Use sequential execution when tools share mutable in-memory state.
143
+ File-mutating tools should wrap the complete read-modify-write operation with `withFileMutationQueue()`.
144
+ Truncate large model-facing results and tell the model where to read the complete output.
145
+
146
+ 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`.
147
+
148
+ 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.
149
+
150
+ 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).
151
+
152
+ ### Tool exposure
153
+
154
+ `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:
155
+
156
+ - `direct` (default): declared to the model while active, and callable while active.
157
+ - `model-only`: declared to the model while active, never callable. Use it for tools that orchestrate other tools or ask the user.
158
+ - `codemode`: callable whenever registered, and listed by the `codemode` tool. Not declared to the model unless activated explicitly.
159
+ - `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
160
+ - `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
161
+
162
+ `namespace: { name, 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)`.
163
+
164
+ 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`, and `annotations`.
165
+
166
+ `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:
167
+
168
+ ```typescript
169
+ pi.on("tool_call", async (event, ctx) => {
170
+ const hints = pi.getAllTools().find((tool) => tool.name === event.toolName)?.annotations;
171
+ const needsApproval =
172
+ hints?.destructiveHint === true ||
173
+ (!hints?.readOnlyHint && ((hints?.destructiveHint ?? true) || (hints?.openWorldHint ?? true)));
174
+ if (needsApproval && !(await ctx.ui.confirm("Allow tool call?", event.toolName))) {
175
+ return { block: true, reason: `${event.toolName} was not approved` };
176
+ }
177
+ });
178
+ ```
179
+
180
+ 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 and namespace. 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. `codemode` uses only this hook, `exposure`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
181
+
182
+ ### Activate tools dynamically
183
+
184
+ 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.
185
+
186
+ 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.
187
+
188
+ ### MCP servers
189
+
190
+ `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`.
191
+
192
+ ```typescript
193
+ pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira", exposure: "codemode" });
194
+ pi.unregisterMcpServer("jira");
195
+ ```
196
+
197
+ 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.
198
+
199
+ 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.
200
+
201
+ <a id="extensioncontext"></a>
202
+ <a id="extensioncommandcontext"></a>
203
+ <a id="use-extension-context"></a>
204
+
205
+ ### Context and session changes
206
+
207
+ `ExtensionContext` provides the working directory, mode, UI, session manager, model runtime, abort signal, context usage, and controls for compaction and shutdown.
208
+ Use `ctx.modelRegistry.streamSimple()` for provider-neutral nested model calls.
209
+
210
+ Command handlers receive `ExtensionCommandContext`, which adds operations for waiting until idle, reloading, tree navigation, and session replacement.
211
+ These operations are command-only because calling them from lifecycle handlers can deadlock the runtime.
212
+
213
+ Session replacement invalidates the old context. Capture only plain data before switching, then use the fresh context supplied to `withSession` for session-bound work.
214
+
215
+ <a id="state-management"></a>
216
+ <a id="persist-state"></a>
217
+
218
+ ### State
219
+
220
+ Choose storage based on how state participates in the conversation:
221
+
222
+ | State | Storage |
223
+ |---|---|
224
+ | Tool state that follows the active branch | Tool-result `details` |
225
+ | Durable data excluded from model context | `pi.appendEntry()` |
226
+ | Custom content stored and sent to the model | `pi.sendMessage()` |
227
+ | Data outside one session | External storage |
228
+
229
+ Reconstruct branch-sensitive state from `ctx.sessionManager.getBranch()` during `session_start`.
230
+ Do not rebuild it from every file entry because abandoned branches represent alternative histories.
231
+ Register an entry or message renderer when custom stored content should appear in the transcript.
232
+
233
+ <a id="custom-ui"></a>
234
+ <a id="mode-behavior"></a>
235
+ <a id="interact-with-the-user"></a>
236
+ <a id="account-for-each-mode"></a>
237
+
238
+ ### UI and modes
239
+
240
+ `ctx.ui` provides dialogs, notifications, status text, widgets, titles, editor access, and custom components.
241
+ Use `ctx.ui.custom()` only when the interaction needs its own rendering and input.
242
+ See [Terminal UI](tui.md) for component, focus, overlay, theme, and performance guidance.
243
+
244
+ Extensions load in interactive, RPC, JSON, and print modes.
245
+ Interactive mode provides the complete terminal UI.
246
+ 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.
247
+ Guard terminal-only behavior with `ctx.mode === "tui"` and use `ctx.hasUI` for interactions supported by interactive and RPC clients.
248
+
249
+ Keep tool and event behavior independent from rendering so non-interactive modes remain functional.
250
+
251
+ <a id="error-handling"></a>
252
+ <a id="handle-errors-and-shutdown"></a>
253
+
254
+ ### Errors and cleanup
255
+
256
+ 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.
257
+
258
+ Release resources in `session_shutdown` even when normal operation attempted cleanup.
259
+ Keep cleanup idempotent because cancellation, reload, session replacement, and process exit can converge on the same path.
260
+ Use `ctx.shutdown()` to request an orderly process shutdown.
261
+
262
+ <a id="examples-reference"></a>
263
+ <a id="use-examples-as-the-implementation-reference"></a>
264
+
265
+ ## Examples and reference
266
+
267
+ The checked [extension examples](../examples/extensions/) cover tools, lifecycle events, commands, flags, shortcuts, state, rendering, providers, OAuth, remote execution, and terminal components.
268
+ Start with the smallest example matching your integration point.
269
+
270
+ 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.
@@ -0,0 +1,49 @@
1
+ # How Pi Works
2
+
3
+ Pi coordinates model requests, tool execution, context assembly, and session storage. A session is Pi's record of a conversation, including messages, tool calls and results, model changes, compactions, and other events.
4
+
5
+ Messages and events in a session form a tree. Each path through that tree is a branch. The branch ending at the current entry is the active branch and supplies the history for the next model request.
6
+
7
+ ## Agent loop
8
+
9
+ A submitted message is added to the active branch. Pi builds a model request from the system prompt, active branch, available tools, and model settings, then sends it through the selected provider.
10
+
11
+ The provider streams an assistant response, which can contain text and tool calls. Pi records the response, executes each tool call, and records the results. That completes one turn. If tool results or queued messages require another model request, Pi starts another turn. Otherwise, the run ends.
12
+
13
+ Steering messages enter after the current assistant turn. Follow-up messages enter after the agent has finished its pending work. Aborting stops the current run and returns queued messages to the editor.
14
+
15
+ ## Context
16
+
17
+ The active branch supplies conversation history. Pi converts its session entries into model-compatible user, assistant, and tool-result messages.
18
+
19
+ Pi builds the system prompt from its base instructions and discovered context files. The request also carries tool definitions and skill descriptions.
20
+
21
+ Full skill instructions are loaded on demand. Extensions can add instructions or transform context.
22
+
23
+ Prompt templates expand editor input before it becomes a user message. Selected files, images, pasted text, and shell output can become message content.
24
+
25
+ ## Sessions
26
+
27
+ Persistent sessions are JSONL files. Each tree entry has an ID and refers to its parent. The current entry identifies the active branch.
28
+
29
+ Continuing from an earlier entry creates another branch in the same file. Forking and cloning copy selected history into a new session file.
30
+
31
+ Model context is reconstructed from the active branch. Compaction inserts a summary entry that replaces older messages in subsequent model requests. The original entries remain in the session tree.
32
+
33
+ ## Interfaces
34
+
35
+ Interactive mode renders session and agent events in the terminal. Print mode runs a prompt and writes the final response. JSON mode writes agent events as JSONL.
36
+
37
+ RPC mode accepts JSONL commands on stdin and writes responses and events to stdout. The TypeScript SDK creates and controls agent sessions in process.
38
+
39
+ All interfaces use the same agent and session mechanisms.
40
+
41
+ ## Extensions and resources
42
+
43
+ Extensions are TypeScript modules loaded into the Pi process. Their factory functions register tools, commands, shortcuts, providers, event handlers, renderers, and terminal UI.
44
+
45
+ Skills provide on-demand instructions and supporting files. Prompt templates provide reusable message text. Themes provide terminal colors. Pi packages distribute these resources through npm or git.
46
+
47
+ ## Trust and permissions
48
+
49
+ Pi resolves project trust before loading project settings and resources. After the trust decision and project-resource loading, Pi loads context files. Enabled tools use the operating-system permissions of the Pi process. Extensions execute inside that process.
Binary file
Binary file
Binary file
Binary file
package/docs/index.md ADDED
@@ -0,0 +1,39 @@
1
+ # Pi
2
+
3
+ Pi is an extensible AI agent that works from your terminal. Give it a goal and a working folder, and it can inspect files, run commands, edit content, and work through multi-step tasks.
4
+
5
+ Use Pi for software development, research notes, writing projects, data files, or hobby work. You can use Pi as is, prompt it to adapt itself to your workflow, or build other applications powered by Pi using the SDK.
6
+
7
+ ## Start using Pi
8
+
9
+ New to Pi? Follow the [Quickstart](quickstart.md) to install Pi, connect a model, and complete your first task.
10
+
11
+ If Pi is already installed, choose what you want to do:
12
+
13
+ - [Use Pi interactively](usage.md) to add files, run commands, direct ongoing work, and export results.
14
+ - [Choose a model](models.md) or connect a subscription, API key, local model, or compatible endpoint.
15
+ - [Continue or branch a session](sessions.md) to resume work or explore another approach without losing history.
16
+ - [Configure Pi](configuration.md) for your preferences, working folders, instructions, and reusable resources.
17
+ - [Understand how Pi works](how-pi-works.md), including tools, context, sessions, and the agent loop.
18
+
19
+ ## Customize Pi
20
+
21
+ Pi can reuse prompts, load specialized instructions, add executable integrations, change its terminal interface, connect model services, and distribute these resources as packages.
22
+ Use the [Quickstart customization chooser](quickstart.md#choose-how-to-customize-pi) to select the smallest mechanism that meets your need.
23
+
24
+ ## Automate or embed Pi
25
+
26
+ - Use [print mode](cli.md#invocation-and-output) for one-off and scripted tasks.
27
+ - Use [JSON event stream mode](json.md) to consume structured events from one run.
28
+ - Use [RPC mode](rpc.md) to control a separate Pi process.
29
+ - Use the [TypeScript SDK](sdk.md) to run Pi inside an application.
30
+
31
+ ## Find reference and setup information
32
+
33
+ Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [provider authentication](providers.md), [keybindings](keybindings.md), and [environment variables](environment-variables.md).
34
+
35
+ For platform-specific help, see [Terminal Setup](terminal-setup.md), [Windows](windows.md), [tmux](tmux.md), [Termux on Android](termux.md), or [Containerization](containerization.md).
36
+
37
+ ## Work safely
38
+
39
+ Pi's tools and extensions run with the permissions of the Pi process. Project trust controls which project resources Pi loads, but it does not sandbox tool calls. Review [Security](security.md) before using untrusted files, repositories, extensions, or unattended automation.
package/docs/json.md ADDED
@@ -0,0 +1,226 @@
1
+ # JSON Event Stream
2
+
3
+ JSON mode emits structured progress for one invocation:
4
+
5
+ ```bash
6
+ pi --mode json "Review this repository"
7
+ ```
8
+
9
+ Pi writes one session header followed by session events, then exits after the supplied prompts finish. RPC mode emits the same session-event shapes but has no session header because it is a bidirectional, long-lived protocol. See [RPC Mode](rpc.md).
10
+
11
+ This page is the canonical reference for events shared by JSON and RPC mode. Message values use the [shared message types](message-types.md).
12
+
13
+ ## Framing and process I/O
14
+
15
+ The stream uses strict JSONL framing. Each record is one JSON object terminated by LF (`\n`). Split records only on LF and strip an optional preceding carriage return. Unicode line and paragraph separators are valid inside JSON strings and are not record boundaries.
16
+
17
+ Node.js `readline` is not suitable for this stream because it also recognizes those Unicode separators. Use a byte or UTF-8 stream decoder and split on LF.
18
+
19
+ Read stdout continuously. A reader that stops consuming records can stall Pi when the pipe buffer fills. Stdout is reserved for JSONL; diagnostics and application logging go to stderr.
20
+
21
+ ## Session header
22
+
23
+ The first JSON-mode record is the current [session header](session-format.md#sessionheader):
24
+
25
+ ```json
26
+ {"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path"}
27
+ ```
28
+
29
+ RPC mode does not emit this record. Use [`get_state`](rpc-commands.md#get_state) for its current session ID and file.
30
+
31
+ ## Event sequence
32
+
33
+ A basic run produces records like these:
34
+
35
+ ```json
36
+ {"type":"agent_start"}
37
+ {"type":"turn_start"}
38
+ {"type":"message_start","message":{"role":"user","content":"Review this repository","timestamp":1733234401000}}
39
+ {"type":"message_end","message":{"role":"user","content":"Review this repository","timestamp":1733234401000}}
40
+ {"type":"message_start","message":{"role":"assistant","content":[],"stopReason":"pending","...":"..."}}
41
+ {"type":"message_update","usage":{"...":"..."},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello"}}
42
+ {"type":"message_end","message":{"role":"assistant","...":"..."}}
43
+ {"type":"turn_end","message":{"role":"assistant","...":"..."},"toolResults":[]}
44
+ {"type":"agent_end","messages":[{"...":"..."}],"willRetry":false}
45
+ {"type":"agent_settled"}
46
+ ```
47
+
48
+ `agent_end` closes one low-level agent run. Automatic retry, overflow recovery, compaction retry, steering, or follow-up work can still continue. `agent_settled` means Pi has no remaining automatic work for that session-level run.
49
+
50
+ ## Agent and turn events
51
+
52
+ | Event | Fields | Meaning |
53
+ |---|---|---|
54
+ | `agent_start` | None | A low-level agent run started. |
55
+ | `agent_end` | `messages`, `willRetry` | That low-level run ended. `messages` contains messages generated by the run. |
56
+ | `agent_settled` | None | Pi will not continue automatically through retries, compaction recovery, or queued messages. |
57
+ | `turn_start` | None | One assistant turn started. |
58
+ | `turn_end` | `message`, `toolResults` | One assistant response and its resulting tool calls finished. |
59
+
60
+ A turn is one assistant response plus any tool calls and tool results produced by that response.
61
+
62
+ ## Message events
63
+
64
+ | Event | Fields | Meaning |
65
+ |---|---|---|
66
+ | `message_start` | `message` | A message started. |
67
+ | `message_update` | `usage`, `assistantMessageEvent` | An assistant message emitted a content-block update. |
68
+ | `message_end` | `message` | A message completed. This is the authoritative final message. |
69
+
70
+ ### Reconstruct streaming messages
71
+
72
+ Wire `message_update` records are delta-only. They omit the SDK event's cumulative `message` field and every `assistantMessageEvent.partial` snapshot so stream size remains linear.
73
+
74
+ The nested event is one of:
75
+
76
+ | Type | Fields in addition to `type` | Meaning |
77
+ |---|---|---|
78
+ | `start` | None | The provider stream started; its cumulative `partial` field is removed on the wire. |
79
+ | `text_start` | `contentIndex` | A text block started. |
80
+ | `text_delta` | `contentIndex`, `delta` | Append text to the block. |
81
+ | `text_end` | `contentIndex`, `content` | The text block ended with authoritative content. |
82
+ | `thinking_start` | `contentIndex` | A thinking block started. |
83
+ | `thinking_delta` | `contentIndex`, `delta` | Append thinking text to the block. |
84
+ | `thinking_end` | `contentIndex`, `content` | The thinking block ended with authoritative content. |
85
+ | `toolcall_start` | `contentIndex`, `id`, `toolName` | A tool-call block started. |
86
+ | `toolcall_delta` | `contentIndex`, `delta` | Append serialized argument data. |
87
+ | `toolcall_end` | `contentIndex`, `toolCall` | The tool call ended with the complete `ToolCall`. |
88
+ | `done` | `reason`, `message` | The provider stream completed successfully. |
89
+ | `error` | `reason`, `error` | The provider stream ended with an error or abort message. |
90
+
91
+ The normal agent loop translates provider-level `start`, `done`, and `error` into `message_start` and `message_end` session events rather than emitting them as `message_update`. They remain admitted by the exported `JsonAgentSessionEvent` transformation for callers that construct a matching session event.
92
+
93
+ Use `contentIndex` to identify the content block. Buffer `delta` fields for a live display, but replace reconstructed data with the completed content in `text_end`, `thinking_end`, or `toolcall_end`. Replace the whole partial message with `message_end.message` when it arrives.
94
+
95
+ The top-level `usage` is the latest cumulative provider-reported usage for the assistant response. It can remain zero until completion when a provider does not report usage while streaming.
96
+
97
+ ```json
98
+ {"type":"message_update","usage":{"input":100,"output":1,"cacheRead":0,"cacheWrite":0,"totalTokens":101,"cost":{"input":0,"output":0,"cacheRead":0,"cacheWrite":0,"total":0}},"assistantMessageEvent":{"type":"text_delta","contentIndex":0,"delta":"Hello "}}
99
+ ```
100
+
101
+ ## Tool execution events
102
+
103
+ | Event | Fields | Meaning |
104
+ |---|---|---|
105
+ | `tool_execution_start` | `toolCallId`, `toolName`, `args` | Tool execution started. |
106
+ | `tool_execution_update` | `toolCallId`, `toolName`, `args`, `partialResult` | The tool reported a partial result. |
107
+ | `tool_execution_end` | `toolCallId`, `toolName`, `result`, `isError` | Tool execution finished. |
108
+
109
+ Use `toolCallId` to correlate the lifecycle. `partialResult` is the latest partial result supplied by the tool. Whether it replaces or extends an earlier update depends on that tool's result contract.
110
+
111
+ ```json
112
+ {"type":"tool_execution_start","toolCallId":"call_abc123","toolName":"bash","args":{"command":"ls -la"}}
113
+ {"type":"tool_execution_update","toolCallId":"call_abc123","toolName":"bash","args":{"command":"ls -la"},"partialResult":{"content":[{"type":"text","text":"partial output"}],"details":{}}}
114
+ {"type":"tool_execution_end","toolCallId":"call_abc123","toolName":"bash","result":{"content":[{"type":"text","text":"complete output"}],"details":{}},"isError":false}
115
+ ```
116
+
117
+ ## Queue and state events
118
+
119
+ | Event | Fields | Meaning |
120
+ |---|---|---|
121
+ | `queue_update` | `steering`, `followUp` | The pending steering or follow-up queue changed. Both fields contain the complete current queue. |
122
+ | `entry_appended` | `entry` | An extension appended a custom session entry through `pi.appendEntry()`. |
123
+ | `session_info_changed` | `name` | The session display name changed. An absent `name` means it was cleared. |
124
+ | `thinking_level_changed` | `level` | The active thinking level changed. |
125
+
126
+ The `entry` value uses a persisted [session entry type](session-format.md#entry-types).
127
+
128
+ ## Compaction events
129
+
130
+ `compaction_start` reports why compaction began:
131
+
132
+ ```json
133
+ {"type":"compaction_start","reason":"threshold"}
134
+ ```
135
+
136
+ `reason` is `"manual"`, `"threshold"`, or `"overflow"`.
137
+
138
+ `compaction_end` contains the result when compaction succeeds:
139
+
140
+ ```json
141
+ {
142
+ "type": "compaction_end",
143
+ "reason": "threshold",
144
+ "result": {
145
+ "summary": "Summary of conversation...",
146
+ "firstKeptEntryId": "abc123",
147
+ "tokensBefore": 150000,
148
+ "estimatedTokensAfter": 32000,
149
+ "usage": {"...": "..."},
150
+ "details": {}
151
+ },
152
+ "aborted": false,
153
+ "willRetry": false
154
+ }
155
+ ```
156
+
157
+ If compaction was aborted, `result` is absent and `aborted` is true. If it failed, `result` is absent, `aborted` is false, and `errorMessage` describes the failure. Successful overflow recovery sets `willRetry` to true before Pi retries the prompt.
158
+
159
+ See [Compaction and Branch Summaries](compaction.md) for result semantics.
160
+
161
+ ## Retry events
162
+
163
+ Assistant-turn retry emits:
164
+
165
+ ```json
166
+ {"type":"auto_retry_start","attempt":1,"maxAttempts":3,"delayMs":2000,"errorMessage":"529 overloaded"}
167
+ {"type":"auto_retry_end","success":true,"attempt":2}
168
+ ```
169
+
170
+ On final failure, `auto_retry_end` has `success: false` and a `finalError` string.
171
+
172
+ Compaction and branch-summary retry emit:
173
+
174
+ ```json
175
+ {"type":"summarization_retry_scheduled","attempt":1,"maxAttempts":3,"delayMs":2000,"errorMessage":"terminated"}
176
+ {"type":"summarization_retry_attempt_start","source":"compaction","reason":"threshold"}
177
+ {"type":"summarization_retry_finished"}
178
+ ```
179
+
180
+ For a branch summary, `source` is `"branchSummary"` and `reason` is absent. The `reason` on a compaction retry is `"manual"`, `"threshold"`, or `"overflow"`.
181
+
182
+ ## RPC-only events
183
+
184
+ A direct RPC [`bash`](rpc-commands.md#bash) command emits one `bash_execution_update` for each output chunk. Its optional `id` matches the command ID. The final command response can contain truncated output, but these events stream all output:
185
+
186
+ ```json
187
+ {"type":"bash_execution_update","id":"req-1","delta":"total 48\n"}
188
+ ```
189
+
190
+ RPC also adds `extension_error` when an extension handler throws:
191
+
192
+ ```json
193
+ {"type":"extension_error","extensionPath":"/path/to/extension.ts","event":"tool_call","error":"Error message"}
194
+ ```
195
+
196
+ Extension UI records are a separate RPC subprotocol, not `AgentSessionEvent` values. See [RPC Extension UI](rpc-extension-ui.md).
197
+
198
+ ## TypeScript types
199
+
200
+ The SDK's `AgentSessionEvent` contains cumulative streaming snapshots for in-process consumers. JSON and RPC transform only `message_update`:
201
+
202
+ ```typescript
203
+ type WithoutPartial<T> = T extends { partial: unknown } ? Omit<T, "partial"> : T;
204
+
205
+ type JsonAssistantMessageEvent<T> = T extends { type: "toolcall_start"; partial: unknown }
206
+ ? WithoutPartial<T> & { id: string; toolName: string }
207
+ : WithoutPartial<T>;
208
+
209
+ type JsonAgentSessionEvent =
210
+ | Exclude<AgentSessionEvent, { type: "message_update" }>
211
+ | {
212
+ type: "message_update";
213
+ usage: Usage;
214
+ assistantMessageEvent: JsonAssistantMessageEvent<AssistantMessageEvent>;
215
+ };
216
+ ```
217
+
218
+ Use the exported `JsonAgentSessionEvent` type from `@earendil-works/pi-coding-agent`. Its implementation is in [`json-event.ts`](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/modes/json-event.ts).
219
+
220
+ ## Example
221
+
222
+ Print completed messages from a one-shot run:
223
+
224
+ ```bash
225
+ pi --mode json "List files" 2>/dev/null | jq -c 'select(.type == "message_end")'
226
+ ```