pi-namespace-patch 0.85.1-namespace.1

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 (1056) hide show
  1. package/CHANGELOG.md +5689 -0
  2. package/README.md +720 -0
  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-VWZZOSJQ.js +6 -0
  20. package/dist/bundle/chunks/anthropic.js +75 -0
  21. package/dist/bundle/chunks/azure-openai-responses-BJLAM6CD.js +2 -0
  22. package/dist/bundle/chunks/bedrock-converse-stream.js +74 -0
  23. package/dist/bundle/chunks/chunk-4L3WN2XY.js +2 -0
  24. package/dist/bundle/chunks/chunk-6CYCI3EJ.js +12 -0
  25. package/dist/bundle/chunks/chunk-6R7UI4IY.js +2 -0
  26. package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  27. package/dist/bundle/chunks/chunk-AXIIZGTV.js +2 -0
  28. package/dist/bundle/chunks/chunk-CLNPYIDP.js +42 -0
  29. package/dist/bundle/chunks/chunk-DRQDKNXA.js +2 -0
  30. package/dist/bundle/chunks/chunk-GMWCTUPB.js +2 -0
  31. package/dist/bundle/chunks/chunk-IDDQWTHI.js +2 -0
  32. package/dist/bundle/chunks/chunk-JJ2YFCJF.js +1547 -0
  33. package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  34. package/dist/bundle/chunks/chunk-NUHFSC37.js +25 -0
  35. package/dist/bundle/chunks/chunk-OUXLLA64.js +11 -0
  36. package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  37. package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  38. package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  39. package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
  40. package/dist/bundle/chunks/chunk-TRDNDS6A.js +4 -0
  41. package/dist/bundle/chunks/chunk-U6ZMQKGD.js +50 -0
  42. package/dist/bundle/chunks/chunk-UAQELI3K.js +2 -0
  43. package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  44. package/dist/bundle/chunks/chunk-XDUWOHPL.js +6 -0
  45. package/dist/bundle/chunks/chunk-XNGRGP62.js +2 -0
  46. package/dist/bundle/chunks/github-copilot.js +2 -0
  47. package/dist/bundle/chunks/google-generative-ai-Q2K7FBDI.js +2 -0
  48. package/dist/bundle/chunks/google-vertex-7UJBF4S7.js +2 -0
  49. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
  50. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  51. package/dist/bundle/chunks/kimi-coding.js +2 -0
  52. package/dist/bundle/chunks/lib-HGQMNYVT.js +9 -0
  53. package/dist/bundle/chunks/mistral-conversations-4M6BZBX6.js +5 -0
  54. package/dist/bundle/chunks/multipart-parser-SQ6GDJL7.js +3 -0
  55. package/dist/bundle/chunks/node-KG362ECQ.js +16 -0
  56. package/dist/bundle/chunks/node-TWVVAGPO.js +2 -0
  57. package/dist/bundle/chunks/openai-codex-responses-R6VYZTVY.js +10 -0
  58. package/dist/bundle/chunks/openai-codex.js +75 -0
  59. package/dist/bundle/chunks/openai-completions-EKZT2IH2.js +7 -0
  60. package/dist/bundle/chunks/openai-responses-TFDINO6W.js +2 -0
  61. package/dist/bundle/chunks/openrouter-images-N4XVVFSD.js +2 -0
  62. package/dist/bundle/chunks/openrouter.js +75 -0
  63. package/dist/bundle/chunks/pi-messages-PML4SPVJ.js +8 -0
  64. package/dist/bundle/chunks/radius.js +75 -0
  65. package/dist/bundle/chunks/src-UK77SYZE.js +4 -0
  66. package/dist/bundle/chunks/xai.js +2 -0
  67. package/dist/bundle/cli.js +3 -0
  68. package/dist/bundle/index.js +2 -0
  69. package/dist/bundle/rpc-entry.js +3 -0
  70. package/dist/cli/args.d.ts +61 -0
  71. package/dist/cli/args.d.ts.map +1 -0
  72. package/dist/cli/args.js +439 -0
  73. package/dist/cli/args.js.map +1 -0
  74. package/dist/cli/auth-check.d.ts +19 -0
  75. package/dist/cli/auth-check.d.ts.map +1 -0
  76. package/dist/cli/auth-check.js +50 -0
  77. package/dist/cli/auth-check.js.map +1 -0
  78. package/dist/cli/auth-command.d.ts +24 -0
  79. package/dist/cli/auth-command.d.ts.map +1 -0
  80. package/dist/cli/auth-command.js +103 -0
  81. package/dist/cli/auth-command.js.map +1 -0
  82. package/dist/cli/config-selector.d.ts +16 -0
  83. package/dist/cli/config-selector.d.ts.map +1 -0
  84. package/dist/cli/config-selector.js +32 -0
  85. package/dist/cli/config-selector.js.map +1 -0
  86. package/dist/cli/credential-print.d.ts +13 -0
  87. package/dist/cli/credential-print.d.ts.map +1 -0
  88. package/dist/cli/credential-print.js +76 -0
  89. package/dist/cli/credential-print.js.map +1 -0
  90. package/dist/cli/file-processor.d.ts +15 -0
  91. package/dist/cli/file-processor.d.ts.map +1 -0
  92. package/dist/cli/file-processor.js +71 -0
  93. package/dist/cli/file-processor.js.map +1 -0
  94. package/dist/cli/initial-message.d.ts +18 -0
  95. package/dist/cli/initial-message.d.ts.map +1 -0
  96. package/dist/cli/initial-message.js +22 -0
  97. package/dist/cli/initial-message.js.map +1 -0
  98. package/dist/cli/list-models.d.ts +9 -0
  99. package/dist/cli/list-models.d.ts.map +1 -0
  100. package/dist/cli/list-models.js +98 -0
  101. package/dist/cli/list-models.js.map +1 -0
  102. package/dist/cli/project-trust.d.ts +10 -0
  103. package/dist/cli/project-trust.d.ts.map +1 -0
  104. package/dist/cli/project-trust.js +48 -0
  105. package/dist/cli/project-trust.js.map +1 -0
  106. package/dist/cli/session-picker.d.ts +10 -0
  107. package/dist/cli/session-picker.d.ts.map +1 -0
  108. package/dist/cli/session-picker.js +36 -0
  109. package/dist/cli/session-picker.js.map +1 -0
  110. package/dist/cli/setup.d.ts +2 -0
  111. package/dist/cli/setup.d.ts.map +1 -0
  112. package/dist/cli/setup.js +12 -0
  113. package/dist/cli/setup.js.map +1 -0
  114. package/dist/cli/startup-ui.d.ts +20 -0
  115. package/dist/cli/startup-ui.d.ts.map +1 -0
  116. package/dist/cli/startup-ui.js +185 -0
  117. package/dist/cli/startup-ui.js.map +1 -0
  118. package/dist/cli.d.ts +3 -0
  119. package/dist/cli.d.ts.map +1 -0
  120. package/dist/cli.js +6 -0
  121. package/dist/cli.js.map +1 -0
  122. package/dist/config.d.ts +98 -0
  123. package/dist/config.d.ts.map +1 -0
  124. package/dist/config.js +464 -0
  125. package/dist/config.js.map +1 -0
  126. package/dist/core/agent-session-runtime.d.ts +119 -0
  127. package/dist/core/agent-session-runtime.d.ts.map +1 -0
  128. package/dist/core/agent-session-runtime.js +317 -0
  129. package/dist/core/agent-session-runtime.js.map +1 -0
  130. package/dist/core/agent-session-services.d.ts +86 -0
  131. package/dist/core/agent-session-services.d.ts.map +1 -0
  132. package/dist/core/agent-session-services.js +134 -0
  133. package/dist/core/agent-session-services.js.map +1 -0
  134. package/dist/core/agent-session.d.ts +684 -0
  135. package/dist/core/agent-session.d.ts.map +1 -0
  136. package/dist/core/agent-session.js +2855 -0
  137. package/dist/core/agent-session.js.map +1 -0
  138. package/dist/core/auth-guidance.d.ts +5 -0
  139. package/dist/core/auth-guidance.d.ts.map +1 -0
  140. package/dist/core/auth-guidance.js +21 -0
  141. package/dist/core/auth-guidance.js.map +1 -0
  142. package/dist/core/auth-storage.d.ts +72 -0
  143. package/dist/core/auth-storage.d.ts.map +1 -0
  144. package/dist/core/auth-storage.js +426 -0
  145. package/dist/core/auth-storage.js.map +1 -0
  146. package/dist/core/bash-executor.d.ts +32 -0
  147. package/dist/core/bash-executor.d.ts.map +1 -0
  148. package/dist/core/bash-executor.js +111 -0
  149. package/dist/core/bash-executor.js.map +1 -0
  150. package/dist/core/cache-stats.d.ts +49 -0
  151. package/dist/core/cache-stats.d.ts.map +1 -0
  152. package/dist/core/cache-stats.js +101 -0
  153. package/dist/core/cache-stats.js.map +1 -0
  154. package/dist/core/compaction/branch-summarization.d.ts +98 -0
  155. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  156. package/dist/core/compaction/branch-summarization.js +251 -0
  157. package/dist/core/compaction/branch-summarization.js.map +1 -0
  158. package/dist/core/compaction/compaction.d.ts +143 -0
  159. package/dist/core/compaction/compaction.d.ts.map +1 -0
  160. package/dist/core/compaction/compaction.js +668 -0
  161. package/dist/core/compaction/compaction.js.map +1 -0
  162. package/dist/core/compaction/index.d.ts +7 -0
  163. package/dist/core/compaction/index.d.ts.map +1 -0
  164. package/dist/core/compaction/index.js +7 -0
  165. package/dist/core/compaction/index.js.map +1 -0
  166. package/dist/core/compaction/utils.d.ts +38 -0
  167. package/dist/core/compaction/utils.d.ts.map +1 -0
  168. package/dist/core/compaction/utils.js +142 -0
  169. package/dist/core/compaction/utils.js.map +1 -0
  170. package/dist/core/defaults.d.ts +4 -0
  171. package/dist/core/defaults.d.ts.map +1 -0
  172. package/dist/core/defaults.js +11 -0
  173. package/dist/core/defaults.js.map +1 -0
  174. package/dist/core/diagnostics.d.ts +15 -0
  175. package/dist/core/diagnostics.d.ts.map +1 -0
  176. package/dist/core/diagnostics.js +2 -0
  177. package/dist/core/diagnostics.js.map +1 -0
  178. package/dist/core/event-bus.d.ts +9 -0
  179. package/dist/core/event-bus.d.ts.map +1 -0
  180. package/dist/core/event-bus.js +25 -0
  181. package/dist/core/event-bus.js.map +1 -0
  182. package/dist/core/exec.d.ts +29 -0
  183. package/dist/core/exec.d.ts.map +1 -0
  184. package/dist/core/exec.js +75 -0
  185. package/dist/core/exec.js.map +1 -0
  186. package/dist/core/experimental.d.ts +6 -0
  187. package/dist/core/experimental.d.ts.map +1 -0
  188. package/dist/core/experimental.js +8 -0
  189. package/dist/core/experimental.js.map +1 -0
  190. package/dist/core/export-html/ansi-to-html.d.ts +22 -0
  191. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  192. package/dist/core/export-html/ansi-to-html.js +249 -0
  193. package/dist/core/export-html/ansi-to-html.js.map +1 -0
  194. package/dist/core/export-html/index.d.ts +37 -0
  195. package/dist/core/export-html/index.d.ts.map +1 -0
  196. package/dist/core/export-html/index.js +226 -0
  197. package/dist/core/export-html/index.js.map +1 -0
  198. package/dist/core/export-html/template.css +1066 -0
  199. package/dist/core/export-html/template.html +55 -0
  200. package/dist/core/export-html/template.js +1864 -0
  201. package/dist/core/export-html/tool-renderer.d.ts +34 -0
  202. package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  203. package/dist/core/export-html/tool-renderer.js +108 -0
  204. package/dist/core/export-html/tool-renderer.js.map +1 -0
  205. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  206. package/dist/core/export-html/vendor/marked.min.js +78 -0
  207. package/dist/core/extensions/index.d.ts +12 -0
  208. package/dist/core/extensions/index.d.ts.map +1 -0
  209. package/dist/core/extensions/index.js +9 -0
  210. package/dist/core/extensions/index.js.map +1 -0
  211. package/dist/core/extensions/loader.d.ts +23 -0
  212. package/dist/core/extensions/loader.d.ts.map +1 -0
  213. package/dist/core/extensions/loader.js +647 -0
  214. package/dist/core/extensions/loader.js.map +1 -0
  215. package/dist/core/extensions/runner.d.ts +178 -0
  216. package/dist/core/extensions/runner.d.ts.map +1 -0
  217. package/dist/core/extensions/runner.js +1011 -0
  218. package/dist/core/extensions/runner.js.map +1 -0
  219. package/dist/core/extensions/types.d.ts +1351 -0
  220. package/dist/core/extensions/types.d.ts.map +1 -0
  221. package/dist/core/extensions/types.js +48 -0
  222. package/dist/core/extensions/types.js.map +1 -0
  223. package/dist/core/extensions/wrapper.d.ts +20 -0
  224. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  225. package/dist/core/extensions/wrapper.js +41 -0
  226. package/dist/core/extensions/wrapper.js.map +1 -0
  227. package/dist/core/footer-data-provider.d.ts +64 -0
  228. package/dist/core/footer-data-provider.d.ts.map +1 -0
  229. package/dist/core/footer-data-provider.js +338 -0
  230. package/dist/core/footer-data-provider.js.map +1 -0
  231. package/dist/core/http-dispatcher.d.ts +22 -0
  232. package/dist/core/http-dispatcher.d.ts.map +1 -0
  233. package/dist/core/http-dispatcher.js +98 -0
  234. package/dist/core/http-dispatcher.js.map +1 -0
  235. package/dist/core/index.d.ts +13 -0
  236. package/dist/core/index.d.ts.map +1 -0
  237. package/dist/core/index.js +13 -0
  238. package/dist/core/index.js.map +1 -0
  239. package/dist/core/keybindings.d.ts +428 -0
  240. package/dist/core/keybindings.d.ts.map +1 -0
  241. package/dist/core/keybindings.js +321 -0
  242. package/dist/core/keybindings.js.map +1 -0
  243. package/dist/core/messages.d.ts +77 -0
  244. package/dist/core/messages.d.ts.map +1 -0
  245. package/dist/core/messages.js +123 -0
  246. package/dist/core/messages.js.map +1 -0
  247. package/dist/core/model-config.d.ts +591 -0
  248. package/dist/core/model-config.d.ts.map +1 -0
  249. package/dist/core/model-config.js +259 -0
  250. package/dist/core/model-config.js.map +1 -0
  251. package/dist/core/model-registry.d.ts +45 -0
  252. package/dist/core/model-registry.d.ts.map +1 -0
  253. package/dist/core/model-registry.js +107 -0
  254. package/dist/core/model-registry.js.map +1 -0
  255. package/dist/core/model-resolver.d.ts +124 -0
  256. package/dist/core/model-resolver.d.ts.map +1 -0
  257. package/dist/core/model-resolver.js +589 -0
  258. package/dist/core/model-resolver.js.map +1 -0
  259. package/dist/core/model-runtime.d.ts +101 -0
  260. package/dist/core/model-runtime.d.ts.map +1 -0
  261. package/dist/core/model-runtime.js +602 -0
  262. package/dist/core/model-runtime.js.map +1 -0
  263. package/dist/core/models-store.d.ts +22 -0
  264. package/dist/core/models-store.d.ts.map +1 -0
  265. package/dist/core/models-store.js +115 -0
  266. package/dist/core/models-store.js.map +1 -0
  267. package/dist/core/output-guard.d.ts +7 -0
  268. package/dist/core/output-guard.d.ts.map +1 -0
  269. package/dist/core/output-guard.js +89 -0
  270. package/dist/core/output-guard.js.map +1 -0
  271. package/dist/core/package-manager.d.ts +215 -0
  272. package/dist/core/package-manager.d.ts.map +1 -0
  273. package/dist/core/package-manager.js +2182 -0
  274. package/dist/core/package-manager.js.map +1 -0
  275. package/dist/core/pi-manifest.d.ts +14 -0
  276. package/dist/core/pi-manifest.d.ts.map +1 -0
  277. package/dist/core/pi-manifest.js +29 -0
  278. package/dist/core/pi-manifest.js.map +1 -0
  279. package/dist/core/project-trust.d.ts +15 -0
  280. package/dist/core/project-trust.d.ts.map +1 -0
  281. package/dist/core/project-trust.js +59 -0
  282. package/dist/core/project-trust.js.map +1 -0
  283. package/dist/core/prompt-templates.d.ts +61 -0
  284. package/dist/core/prompt-templates.d.ts.map +1 -0
  285. package/dist/core/prompt-templates.js +262 -0
  286. package/dist/core/prompt-templates.js.map +1 -0
  287. package/dist/core/provider-attribution.d.ts +4 -0
  288. package/dist/core/provider-attribution.d.ts.map +1 -0
  289. package/dist/core/provider-attribution.js +72 -0
  290. package/dist/core/provider-attribution.js.map +1 -0
  291. package/dist/core/provider-composer.d.ts +58 -0
  292. package/dist/core/provider-composer.d.ts.map +1 -0
  293. package/dist/core/provider-composer.js +402 -0
  294. package/dist/core/provider-composer.js.map +1 -0
  295. package/dist/core/radius.d.ts +2 -0
  296. package/dist/core/radius.d.ts.map +1 -0
  297. package/dist/core/radius.js +2 -0
  298. package/dist/core/radius.js.map +1 -0
  299. package/dist/core/remote-catalog-provider.d.ts +5 -0
  300. package/dist/core/remote-catalog-provider.d.ts.map +1 -0
  301. package/dist/core/remote-catalog-provider.js +122 -0
  302. package/dist/core/remote-catalog-provider.js.map +1 -0
  303. package/dist/core/resolve-config-value.d.ts +30 -0
  304. package/dist/core/resolve-config-value.d.ts.map +1 -0
  305. package/dist/core/resolve-config-value.js +247 -0
  306. package/dist/core/resolve-config-value.js.map +1 -0
  307. package/dist/core/resource-loader.d.ts +227 -0
  308. package/dist/core/resource-loader.d.ts.map +1 -0
  309. package/dist/core/resource-loader.js +910 -0
  310. package/dist/core/resource-loader.js.map +1 -0
  311. package/dist/core/runtime-credentials.d.ts +15 -0
  312. package/dist/core/runtime-credentials.d.ts.map +1 -0
  313. package/dist/core/runtime-credentials.js +39 -0
  314. package/dist/core/runtime-credentials.js.map +1 -0
  315. package/dist/core/sdk.d.ts +108 -0
  316. package/dist/core/sdk.d.ts.map +1 -0
  317. package/dist/core/sdk.js +275 -0
  318. package/dist/core/sdk.js.map +1 -0
  319. package/dist/core/session-cwd.d.ts +19 -0
  320. package/dist/core/session-cwd.d.ts.map +1 -0
  321. package/dist/core/session-cwd.js +38 -0
  322. package/dist/core/session-cwd.js.map +1 -0
  323. package/dist/core/session-export.d.ts +4 -0
  324. package/dist/core/session-export.d.ts.map +1 -0
  325. package/dist/core/session-export.js +32 -0
  326. package/dist/core/session-export.js.map +1 -0
  327. package/dist/core/session-manager.d.ts +357 -0
  328. package/dist/core/session-manager.d.ts.map +1 -0
  329. package/dist/core/session-manager.js +1370 -0
  330. package/dist/core/session-manager.js.map +1 -0
  331. package/dist/core/settings-diagnostics.d.ts +9 -0
  332. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  333. package/dist/core/settings-diagnostics.js +21 -0
  334. package/dist/core/settings-diagnostics.js.map +1 -0
  335. package/dist/core/settings-manager.d.ts +331 -0
  336. package/dist/core/settings-manager.d.ts.map +1 -0
  337. package/dist/core/settings-manager.js +997 -0
  338. package/dist/core/settings-manager.js.map +1 -0
  339. package/dist/core/skills.d.ts +101 -0
  340. package/dist/core/skills.d.ts.map +1 -0
  341. package/dist/core/skills.js +505 -0
  342. package/dist/core/skills.js.map +1 -0
  343. package/dist/core/slash-commands.d.ts +15 -0
  344. package/dist/core/slash-commands.d.ts.map +1 -0
  345. package/dist/core/slash-commands.js +27 -0
  346. package/dist/core/slash-commands.js.map +1 -0
  347. package/dist/core/source-info.d.ts +18 -0
  348. package/dist/core/source-info.d.ts.map +1 -0
  349. package/dist/core/source-info.js +19 -0
  350. package/dist/core/source-info.js.map +1 -0
  351. package/dist/core/system-prompt.d.ts +28 -0
  352. package/dist/core/system-prompt.d.ts.map +1 -0
  353. package/dist/core/system-prompt.js +118 -0
  354. package/dist/core/system-prompt.js.map +1 -0
  355. package/dist/core/telemetry.d.ts +3 -0
  356. package/dist/core/telemetry.d.ts.map +1 -0
  357. package/dist/core/telemetry.js +9 -0
  358. package/dist/core/telemetry.js.map +1 -0
  359. package/dist/core/timings.d.ts +10 -0
  360. package/dist/core/timings.d.ts.map +1 -0
  361. package/dist/core/timings.js +41 -0
  362. package/dist/core/timings.js.map +1 -0
  363. package/dist/core/tools/bash.d.ts +87 -0
  364. package/dist/core/tools/bash.d.ts.map +1 -0
  365. package/dist/core/tools/bash.js +296 -0
  366. package/dist/core/tools/bash.js.map +1 -0
  367. package/dist/core/tools/edit-diff.d.ts +101 -0
  368. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  369. package/dist/core/tools/edit-diff.js +421 -0
  370. package/dist/core/tools/edit-diff.js.map +1 -0
  371. package/dist/core/tools/edit.d.ts +44 -0
  372. package/dist/core/tools/edit.d.ts.map +1 -0
  373. package/dist/core/tools/edit.js +148 -0
  374. package/dist/core/tools/edit.js.map +1 -0
  375. package/dist/core/tools/file-mutation-queue.d.ts +6 -0
  376. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  377. package/dist/core/tools/file-mutation-queue.js +52 -0
  378. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  379. package/dist/core/tools/find.d.ts +42 -0
  380. package/dist/core/tools/find.d.ts.map +1 -0
  381. package/dist/core/tools/find.js +251 -0
  382. package/dist/core/tools/find.js.map +1 -0
  383. package/dist/core/tools/grep.d.ts +41 -0
  384. package/dist/core/tools/grep.d.ts.map +1 -0
  385. package/dist/core/tools/grep.js +252 -0
  386. package/dist/core/tools/grep.js.map +1 -0
  387. package/dist/core/tools/index.d.ts +43 -0
  388. package/dist/core/tools/index.d.ts.map +1 -0
  389. package/dist/core/tools/index.js +129 -0
  390. package/dist/core/tools/index.js.map +1 -0
  391. package/dist/core/tools/ls.d.ts +41 -0
  392. package/dist/core/tools/ls.d.ts.map +1 -0
  393. package/dist/core/tools/ls.js +126 -0
  394. package/dist/core/tools/ls.js.map +1 -0
  395. package/dist/core/tools/output-accumulator.d.ts +52 -0
  396. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  397. package/dist/core/tools/output-accumulator.js +184 -0
  398. package/dist/core/tools/output-accumulator.js.map +1 -0
  399. package/dist/core/tools/path-utils.d.ts +10 -0
  400. package/dist/core/tools/path-utils.d.ts.map +1 -0
  401. package/dist/core/tools/path-utils.js +99 -0
  402. package/dist/core/tools/path-utils.js.map +1 -0
  403. package/dist/core/tools/powershell.d.ts +16 -0
  404. package/dist/core/tools/powershell.d.ts.map +1 -0
  405. package/dist/core/tools/powershell.js +39 -0
  406. package/dist/core/tools/powershell.js.map +1 -0
  407. package/dist/core/tools/read.d.ts +39 -0
  408. package/dist/core/tools/read.d.ts.map +1 -0
  409. package/dist/core/tools/read.js +166 -0
  410. package/dist/core/tools/read.js.map +1 -0
  411. package/dist/core/tools/render-utils.d.ts +24 -0
  412. package/dist/core/tools/render-utils.d.ts.map +1 -0
  413. package/dist/core/tools/render-utils.js +65 -0
  414. package/dist/core/tools/render-utils.js.map +1 -0
  415. package/dist/core/tools/renderers/bash.d.ts +12 -0
  416. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  417. package/dist/core/tools/renderers/bash.js +130 -0
  418. package/dist/core/tools/renderers/bash.js.map +1 -0
  419. package/dist/core/tools/renderers/edit.d.ts +23 -0
  420. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  421. package/dist/core/tools/renderers/edit.js +167 -0
  422. package/dist/core/tools/renderers/edit.js.map +1 -0
  423. package/dist/core/tools/renderers/find.d.ts +10 -0
  424. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  425. package/dist/core/tools/renderers/find.js +64 -0
  426. package/dist/core/tools/renderers/find.js.map +1 -0
  427. package/dist/core/tools/renderers/grep.d.ts +10 -0
  428. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  429. package/dist/core/tools/renderers/grep.js +69 -0
  430. package/dist/core/tools/renderers/grep.js.map +1 -0
  431. package/dist/core/tools/renderers/index.d.ts +28 -0
  432. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  433. package/dist/core/tools/renderers/index.js +47 -0
  434. package/dist/core/tools/renderers/index.js.map +1 -0
  435. package/dist/core/tools/renderers/ls.d.ts +10 -0
  436. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  437. package/dist/core/tools/renderers/ls.js +58 -0
  438. package/dist/core/tools/renderers/ls.js.map +1 -0
  439. package/dist/core/tools/renderers/read.d.ts +11 -0
  440. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  441. package/dist/core/tools/renderers/read.js +129 -0
  442. package/dist/core/tools/renderers/read.js.map +1 -0
  443. package/dist/core/tools/renderers/write.d.ts +10 -0
  444. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  445. package/dist/core/tools/renderers/write.js +153 -0
  446. package/dist/core/tools/renderers/write.js.map +1 -0
  447. package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  448. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  449. package/dist/core/tools/tool-definition-wrapper.js +36 -0
  450. package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  451. package/dist/core/tools/truncate.d.ts +70 -0
  452. package/dist/core/tools/truncate.d.ts.map +1 -0
  453. package/dist/core/tools/truncate.js +215 -0
  454. package/dist/core/tools/truncate.js.map +1 -0
  455. package/dist/core/tools/write.d.ts +30 -0
  456. package/dist/core/tools/write.d.ts.map +1 -0
  457. package/dist/core/tools/write.js +62 -0
  458. package/dist/core/tools/write.js.map +1 -0
  459. package/dist/core/trust-manager.d.ts +36 -0
  460. package/dist/core/trust-manager.d.ts.map +1 -0
  461. package/dist/core/trust-manager.js +203 -0
  462. package/dist/core/trust-manager.js.map +1 -0
  463. package/dist/core/usage-totals.d.ts +19 -0
  464. package/dist/core/usage-totals.d.ts.map +1 -0
  465. package/dist/core/usage-totals.js +52 -0
  466. package/dist/core/usage-totals.js.map +1 -0
  467. package/dist/extensions/index.d.ts +3 -0
  468. package/dist/extensions/index.d.ts.map +1 -0
  469. package/dist/extensions/index.js +3 -0
  470. package/dist/extensions/index.js.map +1 -0
  471. package/dist/extensions/llama/client.d.ts +67 -0
  472. package/dist/extensions/llama/client.d.ts.map +1 -0
  473. package/dist/extensions/llama/client.js +309 -0
  474. package/dist/extensions/llama/client.js.map +1 -0
  475. package/dist/extensions/llama/huggingface.d.ts +23 -0
  476. package/dist/extensions/llama/huggingface.d.ts.map +1 -0
  477. package/dist/extensions/llama/huggingface.js +141 -0
  478. package/dist/extensions/llama/huggingface.js.map +1 -0
  479. package/dist/extensions/llama/index.d.ts +3 -0
  480. package/dist/extensions/llama/index.d.ts.map +1 -0
  481. package/dist/extensions/llama/index.js +219 -0
  482. package/dist/extensions/llama/index.js.map +1 -0
  483. package/dist/extensions/llama/provider.d.ts +12 -0
  484. package/dist/extensions/llama/provider.d.ts.map +1 -0
  485. package/dist/extensions/llama/provider.js +146 -0
  486. package/dist/extensions/llama/provider.js.map +1 -0
  487. package/dist/extensions/llama/ui.d.ts +42 -0
  488. package/dist/extensions/llama/ui.d.ts.map +1 -0
  489. package/dist/extensions/llama/ui.js +416 -0
  490. package/dist/extensions/llama/ui.js.map +1 -0
  491. package/dist/index.d.ts +36 -0
  492. package/dist/index.d.ts.map +1 -0
  493. package/dist/index.js +48 -0
  494. package/dist/index.js.map +1 -0
  495. package/dist/main.d.ts +16 -0
  496. package/dist/main.d.ts.map +1 -0
  497. package/dist/main.js +804 -0
  498. package/dist/main.js.map +1 -0
  499. package/dist/migrations.d.ts +33 -0
  500. package/dist/migrations.d.ts.map +1 -0
  501. package/dist/migrations.js +282 -0
  502. package/dist/migrations.js.map +1 -0
  503. package/dist/modes/index.d.ts +10 -0
  504. package/dist/modes/index.d.ts.map +1 -0
  505. package/dist/modes/index.js +8 -0
  506. package/dist/modes/index.js.map +1 -0
  507. package/dist/modes/interactive/assets/clankolas.png +0 -0
  508. package/dist/modes/interactive/chat-viewport.d.ts +20 -0
  509. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  510. package/dist/modes/interactive/chat-viewport.js +28 -0
  511. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  512. package/dist/modes/interactive/components/armin.d.ts +34 -0
  513. package/dist/modes/interactive/components/armin.d.ts.map +1 -0
  514. package/dist/modes/interactive/components/armin.js +333 -0
  515. package/dist/modes/interactive/components/armin.js.map +1 -0
  516. package/dist/modes/interactive/components/assistant-message.d.ts +26 -0
  517. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  518. package/dist/modes/interactive/components/assistant-message.js +158 -0
  519. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  520. package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  521. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  522. package/dist/modes/interactive/components/bash-execution.js +175 -0
  523. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  524. package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  525. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  526. package/dist/modes/interactive/components/bordered-loader.js +54 -0
  527. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  528. package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  529. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  530. package/dist/modes/interactive/components/branch-summary-message.js +44 -0
  531. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  532. package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  533. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  534. package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  535. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  536. package/dist/modes/interactive/components/config-selector.d.ts +102 -0
  537. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  538. package/dist/modes/interactive/components/config-selector.js +761 -0
  539. package/dist/modes/interactive/components/config-selector.js.map +1 -0
  540. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  541. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  542. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  543. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  544. package/dist/modes/interactive/components/custom-editor.d.ts +30 -0
  545. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  546. package/dist/modes/interactive/components/custom-editor.js +115 -0
  547. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  548. package/dist/modes/interactive/components/custom-entry.d.ts +19 -0
  549. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -0
  550. package/dist/modes/interactive/components/custom-entry.js +52 -0
  551. package/dist/modes/interactive/components/custom-entry.js.map +1 -0
  552. package/dist/modes/interactive/components/custom-message.d.ts +22 -0
  553. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  554. package/dist/modes/interactive/components/custom-message.js +87 -0
  555. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  556. package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
  557. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
  558. package/dist/modes/interactive/components/daxnuts.js +140 -0
  559. package/dist/modes/interactive/components/daxnuts.js.map +1 -0
  560. package/dist/modes/interactive/components/diff.d.ts +12 -0
  561. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  562. package/dist/modes/interactive/components/diff.js +133 -0
  563. package/dist/modes/interactive/components/diff.js.map +1 -0
  564. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  565. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  566. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  567. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  568. package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
  569. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
  570. package/dist/modes/interactive/components/earendil-announcement.js +40 -0
  571. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
  572. package/dist/modes/interactive/components/extension-editor.d.ts +21 -0
  573. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  574. package/dist/modes/interactive/components/extension-editor.js +98 -0
  575. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  576. package/dist/modes/interactive/components/extension-input.d.ts +23 -0
  577. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  578. package/dist/modes/interactive/components/extension-input.js +61 -0
  579. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  580. package/dist/modes/interactive/components/extension-selector.d.ts +26 -0
  581. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  582. package/dist/modes/interactive/components/extension-selector.js +83 -0
  583. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  584. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  585. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  586. package/dist/modes/interactive/components/first-time-setup.js +103 -0
  587. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  588. package/dist/modes/interactive/components/footer.d.ts +32 -0
  589. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  590. package/dist/modes/interactive/components/footer.js +222 -0
  591. package/dist/modes/interactive/components/footer.js.map +1 -0
  592. package/dist/modes/interactive/components/index.d.ts +34 -0
  593. package/dist/modes/interactive/components/index.d.ts.map +1 -0
  594. package/dist/modes/interactive/components/index.js +35 -0
  595. package/dist/modes/interactive/components/index.js.map +1 -0
  596. package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
  597. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  598. package/dist/modes/interactive/components/keybinding-hints.js +36 -0
  599. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  600. package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
  601. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  602. package/dist/modes/interactive/components/login-dialog.js +188 -0
  603. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  604. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  605. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  606. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  607. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  608. package/dist/modes/interactive/components/mermaid.d.ts +11 -0
  609. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  610. package/dist/modes/interactive/components/mermaid.js +75 -0
  611. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  612. package/dist/modes/interactive/components/model-selector.d.ts +60 -0
  613. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  614. package/dist/modes/interactive/components/model-selector.js +361 -0
  615. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  616. package/dist/modes/interactive/components/oauth-selector.d.ts +33 -0
  617. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  618. package/dist/modes/interactive/components/oauth-selector.js +163 -0
  619. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  620. package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
  621. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  622. package/dist/modes/interactive/components/scoped-models-selector.js +326 -0
  623. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  624. package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  625. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  626. package/dist/modes/interactive/components/session-selector-search.js +155 -0
  627. package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  628. package/dist/modes/interactive/components/session-selector.d.ts +95 -0
  629. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  630. package/dist/modes/interactive/components/session-selector.js +867 -0
  631. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  632. package/dist/modes/interactive/components/settings-selector.d.ts +92 -0
  633. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  634. package/dist/modes/interactive/components/settings-selector.js +709 -0
  635. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  636. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  637. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  638. package/dist/modes/interactive/components/settings-submenu.js +165 -0
  639. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  640. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  641. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  642. package/dist/modes/interactive/components/show-images-selector.js +39 -0
  643. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  644. package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  645. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  646. package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  647. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  648. package/dist/modes/interactive/components/status-indicator.d.ts +30 -0
  649. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -0
  650. package/dist/modes/interactive/components/status-indicator.js +67 -0
  651. package/dist/modes/interactive/components/status-indicator.js.map +1 -0
  652. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  653. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  654. package/dist/modes/interactive/components/theme-selector.js +50 -0
  655. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  656. package/dist/modes/interactive/components/thinking-selector.d.ts +23 -0
  657. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  658. package/dist/modes/interactive/components/thinking-selector.js +109 -0
  659. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  660. package/dist/modes/interactive/components/tool-execution.d.ts +80 -0
  661. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  662. package/dist/modes/interactive/components/tool-execution.js +328 -0
  663. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  664. package/dist/modes/interactive/components/tree-selector.d.ts +94 -0
  665. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  666. package/dist/modes/interactive/components/tree-selector.js +1245 -0
  667. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  668. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  669. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  670. package/dist/modes/interactive/components/trust-selector.js +91 -0
  671. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  672. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  673. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  674. package/dist/modes/interactive/components/user-message-selector.js +114 -0
  675. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  676. package/dist/modes/interactive/components/user-message.d.ts +16 -0
  677. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  678. package/dist/modes/interactive/components/user-message.js +49 -0
  679. package/dist/modes/interactive/components/user-message.js.map +1 -0
  680. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  681. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  682. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  683. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  684. package/dist/modes/interactive/external-editor.d.ts +12 -0
  685. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  686. package/dist/modes/interactive/external-editor.js +38 -0
  687. package/dist/modes/interactive/external-editor.js.map +1 -0
  688. package/dist/modes/interactive/interactive-mode.d.ts +443 -0
  689. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  690. package/dist/modes/interactive/interactive-mode.js +5557 -0
  691. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  692. package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
  693. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
  694. package/dist/modes/interactive/model-catalog-refresh.js +34 -0
  695. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
  696. package/dist/modes/interactive/model-search.d.ts +12 -0
  697. package/dist/modes/interactive/model-search.d.ts.map +1 -0
  698. package/dist/modes/interactive/model-search.js +15 -0
  699. package/dist/modes/interactive/model-search.js.map +1 -0
  700. package/dist/modes/interactive/session-share.d.ts +16 -0
  701. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  702. package/dist/modes/interactive/session-share.js +184 -0
  703. package/dist/modes/interactive/session-share.js.map +1 -0
  704. package/dist/modes/interactive/theme/dark.json +91 -0
  705. package/dist/modes/interactive/theme/light.json +90 -0
  706. package/dist/modes/interactive/theme/theme-controller.d.ts +41 -0
  707. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -0
  708. package/dist/modes/interactive/theme/theme-controller.js +130 -0
  709. package/dist/modes/interactive/theme/theme-controller.js.map +1 -0
  710. package/dist/modes/interactive/theme/theme-json.d.ts +84 -0
  711. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  712. package/dist/modes/interactive/theme/theme-json.js +130 -0
  713. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  714. package/dist/modes/interactive/theme/theme-schema.json +356 -0
  715. package/dist/modes/interactive/theme/theme.d.ts +131 -0
  716. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  717. package/dist/modes/interactive/theme/theme.js +991 -0
  718. package/dist/modes/interactive/theme/theme.js.map +1 -0
  719. package/dist/modes/interactive/tui-renderer.d.ts +21 -0
  720. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  721. package/dist/modes/interactive/tui-renderer.js +66 -0
  722. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  723. package/dist/modes/json-event.d.ts +34 -0
  724. package/dist/modes/json-event.d.ts.map +1 -0
  725. package/dist/modes/json-event.js +29 -0
  726. package/dist/modes/json-event.js.map +1 -0
  727. package/dist/modes/print-mode.d.ts +28 -0
  728. package/dist/modes/print-mode.d.ts.map +1 -0
  729. package/dist/modes/print-mode.js +142 -0
  730. package/dist/modes/print-mode.js.map +1 -0
  731. package/dist/modes/rpc/jsonl.d.ts +17 -0
  732. package/dist/modes/rpc/jsonl.d.ts.map +1 -0
  733. package/dist/modes/rpc/jsonl.js +49 -0
  734. package/dist/modes/rpc/jsonl.js.map +1 -0
  735. package/dist/modes/rpc/rpc-client.d.ts +254 -0
  736. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  737. package/dist/modes/rpc/rpc-client.js +495 -0
  738. package/dist/modes/rpc/rpc-client.js.map +1 -0
  739. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  740. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  741. package/dist/modes/rpc/rpc-mode.js +657 -0
  742. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  743. package/dist/modes/rpc/rpc-types.d.ts +469 -0
  744. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  745. package/dist/modes/rpc/rpc-types.js +8 -0
  746. package/dist/modes/rpc/rpc-types.js.map +1 -0
  747. package/dist/package-manager-cli.d.ts +9 -0
  748. package/dist/package-manager-cli.d.ts.map +1 -0
  749. package/dist/package-manager-cli.js +961 -0
  750. package/dist/package-manager-cli.js.map +1 -0
  751. package/dist/rpc-entry.d.ts +3 -0
  752. package/dist/rpc-entry.d.ts.map +1 -0
  753. package/dist/rpc-entry.js +11 -0
  754. package/dist/rpc-entry.js.map +1 -0
  755. package/dist/utils/abort.d.ts +5 -0
  756. package/dist/utils/abort.d.ts.map +1 -0
  757. package/dist/utils/abort.js +48 -0
  758. package/dist/utils/abort.js.map +1 -0
  759. package/dist/utils/ansi.d.ts +2 -0
  760. package/dist/utils/ansi.d.ts.map +1 -0
  761. package/dist/utils/ansi.js +52 -0
  762. package/dist/utils/ansi.js.map +1 -0
  763. package/dist/utils/changelog.d.ts +22 -0
  764. package/dist/utils/changelog.d.ts.map +1 -0
  765. package/dist/utils/changelog.js +165 -0
  766. package/dist/utils/changelog.js.map +1 -0
  767. package/dist/utils/child-process.d.ts +18 -0
  768. package/dist/utils/child-process.d.ts.map +1 -0
  769. package/dist/utils/child-process.js +106 -0
  770. package/dist/utils/child-process.js.map +1 -0
  771. package/dist/utils/clipboard-image.d.ts +11 -0
  772. package/dist/utils/clipboard-image.d.ts.map +1 -0
  773. package/dist/utils/clipboard-image.js +245 -0
  774. package/dist/utils/clipboard-image.js.map +1 -0
  775. package/dist/utils/clipboard-native.d.ts +11 -0
  776. package/dist/utils/clipboard-native.d.ts.map +1 -0
  777. package/dist/utils/clipboard-native.js +20 -0
  778. package/dist/utils/clipboard-native.js.map +1 -0
  779. package/dist/utils/clipboard.d.ts +4 -0
  780. package/dist/utils/clipboard.d.ts.map +1 -0
  781. package/dist/utils/clipboard.js +161 -0
  782. package/dist/utils/clipboard.js.map +1 -0
  783. package/dist/utils/deprecation.d.ts +4 -0
  784. package/dist/utils/deprecation.d.ts.map +1 -0
  785. package/dist/utils/deprecation.js +13 -0
  786. package/dist/utils/deprecation.js.map +1 -0
  787. package/dist/utils/exif-orientation.d.ts +5 -0
  788. package/dist/utils/exif-orientation.d.ts.map +1 -0
  789. package/dist/utils/exif-orientation.js +157 -0
  790. package/dist/utils/exif-orientation.js.map +1 -0
  791. package/dist/utils/frontmatter.d.ts +8 -0
  792. package/dist/utils/frontmatter.d.ts.map +1 -0
  793. package/dist/utils/frontmatter.js +27 -0
  794. package/dist/utils/frontmatter.js.map +1 -0
  795. package/dist/utils/fs-watch.d.ts +5 -0
  796. package/dist/utils/fs-watch.d.ts.map +1 -0
  797. package/dist/utils/fs-watch.js +25 -0
  798. package/dist/utils/fs-watch.js.map +1 -0
  799. package/dist/utils/git.d.ts +26 -0
  800. package/dist/utils/git.d.ts.map +1 -0
  801. package/dist/utils/git.js +195 -0
  802. package/dist/utils/git.js.map +1 -0
  803. package/dist/utils/html.d.ts +7 -0
  804. package/dist/utils/html.d.ts.map +1 -0
  805. package/dist/utils/html.js +40 -0
  806. package/dist/utils/html.js.map +1 -0
  807. package/dist/utils/image-convert.d.ts +10 -0
  808. package/dist/utils/image-convert.d.ts.map +1 -0
  809. package/dist/utils/image-convert.js +45 -0
  810. package/dist/utils/image-convert.js.map +1 -0
  811. package/dist/utils/image-process.d.ts +18 -0
  812. package/dist/utils/image-process.d.ts.map +1 -0
  813. package/dist/utils/image-process.js +83 -0
  814. package/dist/utils/image-process.js.map +1 -0
  815. package/dist/utils/image-resize-core.d.ts +30 -0
  816. package/dist/utils/image-resize-core.d.ts.map +1 -0
  817. package/dist/utils/image-resize-core.js +124 -0
  818. package/dist/utils/image-resize-core.js.map +1 -0
  819. package/dist/utils/image-resize-worker.d.ts +2 -0
  820. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  821. package/dist/utils/image-resize-worker.js +31 -0
  822. package/dist/utils/image-resize-worker.js.map +1 -0
  823. package/dist/utils/image-resize.d.ts +16 -0
  824. package/dist/utils/image-resize.d.ts.map +1 -0
  825. package/dist/utils/image-resize.js +97 -0
  826. package/dist/utils/image-resize.js.map +1 -0
  827. package/dist/utils/json.d.ts +3 -0
  828. package/dist/utils/json.d.ts.map +1 -0
  829. package/dist/utils/json.js +7 -0
  830. package/dist/utils/json.js.map +1 -0
  831. package/dist/utils/management-http.d.ts +25 -0
  832. package/dist/utils/management-http.d.ts.map +1 -0
  833. package/dist/utils/management-http.js +54 -0
  834. package/dist/utils/management-http.js.map +1 -0
  835. package/dist/utils/mime.d.ts +3 -0
  836. package/dist/utils/mime.d.ts.map +1 -0
  837. package/dist/utils/mime.js +110 -0
  838. package/dist/utils/mime.js.map +1 -0
  839. package/dist/utils/open-browser.d.ts +9 -0
  840. package/dist/utils/open-browser.d.ts.map +1 -0
  841. package/dist/utils/open-browser.js +22 -0
  842. package/dist/utils/open-browser.js.map +1 -0
  843. package/dist/utils/paths.d.ts +34 -0
  844. package/dist/utils/paths.d.ts.map +1 -0
  845. package/dist/utils/paths.js +114 -0
  846. package/dist/utils/paths.js.map +1 -0
  847. package/dist/utils/photon.d.ts +21 -0
  848. package/dist/utils/photon.d.ts.map +1 -0
  849. package/dist/utils/photon.js +121 -0
  850. package/dist/utils/photon.js.map +1 -0
  851. package/dist/utils/pi-user-agent.d.ts +2 -0
  852. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  853. package/dist/utils/pi-user-agent.js +5 -0
  854. package/dist/utils/pi-user-agent.js.map +1 -0
  855. package/dist/utils/shell.d.ts +34 -0
  856. package/dist/utils/shell.d.ts.map +1 -0
  857. package/dist/utils/shell.js +216 -0
  858. package/dist/utils/shell.js.map +1 -0
  859. package/dist/utils/sleep.d.ts +5 -0
  860. package/dist/utils/sleep.d.ts.map +1 -0
  861. package/dist/utils/sleep.js +17 -0
  862. package/dist/utils/sleep.js.map +1 -0
  863. package/dist/utils/syntax-highlight.d.ts +13 -0
  864. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  865. package/dist/utils/syntax-highlight.js +177 -0
  866. package/dist/utils/syntax-highlight.js.map +1 -0
  867. package/dist/utils/text.d.ts +8 -0
  868. package/dist/utils/text.d.ts.map +1 -0
  869. package/dist/utils/text.js +9 -0
  870. package/dist/utils/text.js.map +1 -0
  871. package/dist/utils/tool-result-images.d.ts +19 -0
  872. package/dist/utils/tool-result-images.d.ts.map +1 -0
  873. package/dist/utils/tool-result-images.js +45 -0
  874. package/dist/utils/tool-result-images.js.map +1 -0
  875. package/dist/utils/tools-manager.d.ts +13 -0
  876. package/dist/utils/tools-manager.d.ts.map +1 -0
  877. package/dist/utils/tools-manager.js +343 -0
  878. package/dist/utils/tools-manager.js.map +1 -0
  879. package/dist/utils/version-check.d.ts +19 -0
  880. package/dist/utils/version-check.d.ts.map +1 -0
  881. package/dist/utils/version-check.js +79 -0
  882. package/dist/utils/version-check.js.map +1 -0
  883. package/dist/utils/windows-self-update.d.ts +3 -0
  884. package/dist/utils/windows-self-update.d.ts.map +1 -0
  885. package/dist/utils/windows-self-update.js +77 -0
  886. package/dist/utils/windows-self-update.js.map +1 -0
  887. package/docs/compaction.md +418 -0
  888. package/docs/containerization.md +156 -0
  889. package/docs/custom-provider.md +777 -0
  890. package/docs/development.md +90 -0
  891. package/docs/docs.json +156 -0
  892. package/docs/environment-variables.md +99 -0
  893. package/docs/extensions.md +3023 -0
  894. package/docs/images/doom-extension.png +0 -0
  895. package/docs/images/exy.png +0 -0
  896. package/docs/images/interactive-mode.png +0 -0
  897. package/docs/images/tree-view.png +0 -0
  898. package/docs/index.md +84 -0
  899. package/docs/json.md +98 -0
  900. package/docs/keybindings.md +239 -0
  901. package/docs/llama-cpp.md +101 -0
  902. package/docs/models.md +574 -0
  903. package/docs/packages.md +267 -0
  904. package/docs/prompt-templates.md +112 -0
  905. package/docs/providers.md +317 -0
  906. package/docs/quickstart.md +167 -0
  907. package/docs/rpc.md +1618 -0
  908. package/docs/sdk.md +1224 -0
  909. package/docs/security.md +59 -0
  910. package/docs/session-format.md +438 -0
  911. package/docs/sessions.md +145 -0
  912. package/docs/settings.md +369 -0
  913. package/docs/shell-aliases.md +13 -0
  914. package/docs/skills.md +266 -0
  915. package/docs/terminal-setup.md +192 -0
  916. package/docs/termux.md +127 -0
  917. package/docs/themes.md +322 -0
  918. package/docs/tmux.md +63 -0
  919. package/docs/tui.md +961 -0
  920. package/docs/usage.md +311 -0
  921. package/docs/windows.md +39 -0
  922. package/examples/README.md +28 -0
  923. package/examples/extensions/README.md +213 -0
  924. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  925. package/examples/extensions/bash-spawn-hook.ts +30 -0
  926. package/examples/extensions/bookmark.ts +50 -0
  927. package/examples/extensions/border-status-editor.ts +150 -0
  928. package/examples/extensions/built-in-tool-renderer.ts +249 -0
  929. package/examples/extensions/claude-rules.ts +86 -0
  930. package/examples/extensions/commands.ts +72 -0
  931. package/examples/extensions/confirm-destructive.ts +59 -0
  932. package/examples/extensions/custom-compaction.ts +117 -0
  933. package/examples/extensions/custom-footer.ts +64 -0
  934. package/examples/extensions/custom-header.ts +73 -0
  935. package/examples/extensions/custom-provider-anthropic/index.ts +611 -0
  936. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  937. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  938. package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  939. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  940. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  941. package/examples/extensions/dirty-repo-guard.ts +56 -0
  942. package/examples/extensions/doom-overlay/README.md +46 -0
  943. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  944. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  945. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  946. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  947. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  948. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  949. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  950. package/examples/extensions/doom-overlay/index.ts +74 -0
  951. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  952. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  953. package/examples/extensions/dynamic-resources/dynamic.json +81 -0
  954. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  955. package/examples/extensions/dynamic-resources/index.ts +15 -0
  956. package/examples/extensions/dynamic-tools.ts +74 -0
  957. package/examples/extensions/entry-renderer.ts +41 -0
  958. package/examples/extensions/event-bus.ts +43 -0
  959. package/examples/extensions/file-trigger.ts +41 -0
  960. package/examples/extensions/git-checkpoint.ts +53 -0
  961. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  962. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  963. package/examples/extensions/gondolin/index.ts +531 -0
  964. package/examples/extensions/gondolin/package-lock.json +185 -0
  965. package/examples/extensions/gondolin/package.json +19 -0
  966. package/examples/extensions/handoff.ts +190 -0
  967. package/examples/extensions/hello.ts +26 -0
  968. package/examples/extensions/hidden-thinking-label.ts +53 -0
  969. package/examples/extensions/inline-bash.ts +94 -0
  970. package/examples/extensions/input-transform-streaming.ts +39 -0
  971. package/examples/extensions/input-transform.ts +43 -0
  972. package/examples/extensions/interactive-shell.ts +196 -0
  973. package/examples/extensions/kimi-deferred-tools.ts +61 -0
  974. package/examples/extensions/mac-system-theme.ts +47 -0
  975. package/examples/extensions/message-renderer.ts +59 -0
  976. package/examples/extensions/minimal-mode.ts +426 -0
  977. package/examples/extensions/modal-editor.ts +85 -0
  978. package/examples/extensions/model-status.ts +31 -0
  979. package/examples/extensions/notify.ts +57 -0
  980. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  981. package/examples/extensions/overlay-test.ts +153 -0
  982. package/examples/extensions/permission-gate.ts +34 -0
  983. package/examples/extensions/pirate.ts +47 -0
  984. package/examples/extensions/plan-mode/README.md +66 -0
  985. package/examples/extensions/plan-mode/index.ts +390 -0
  986. package/examples/extensions/plan-mode/utils.ts +168 -0
  987. package/examples/extensions/preset.ts +436 -0
  988. package/examples/extensions/project-trust.ts +64 -0
  989. package/examples/extensions/prompt-customizer.ts +97 -0
  990. package/examples/extensions/protected-paths.ts +30 -0
  991. package/examples/extensions/provider-payload.ts +18 -0
  992. package/examples/extensions/qna.ts +118 -0
  993. package/examples/extensions/question.ts +286 -0
  994. package/examples/extensions/questionnaire.ts +448 -0
  995. package/examples/extensions/rainbow-editor.ts +88 -0
  996. package/examples/extensions/reload-runtime.ts +37 -0
  997. package/examples/extensions/rpc-demo.ts +118 -0
  998. package/examples/extensions/sandbox/index.ts +321 -0
  999. package/examples/extensions/sandbox/package-lock.json +92 -0
  1000. package/examples/extensions/sandbox/package.json +19 -0
  1001. package/examples/extensions/send-user-message.ts +97 -0
  1002. package/examples/extensions/session-name.ts +27 -0
  1003. package/examples/extensions/shutdown-command.ts +63 -0
  1004. package/examples/extensions/snake.ts +343 -0
  1005. package/examples/extensions/space-invaders.ts +560 -0
  1006. package/examples/extensions/ssh.ts +220 -0
  1007. package/examples/extensions/status-line.ts +32 -0
  1008. package/examples/extensions/structured-output.ts +65 -0
  1009. package/examples/extensions/subagent/README.md +177 -0
  1010. package/examples/extensions/subagent/agents/planner.md +37 -0
  1011. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  1012. package/examples/extensions/subagent/agents/scout.md +50 -0
  1013. package/examples/extensions/subagent/agents/worker.md +24 -0
  1014. package/examples/extensions/subagent/agents.ts +157 -0
  1015. package/examples/extensions/subagent/index.ts +1038 -0
  1016. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  1017. package/examples/extensions/subagent/prompts/implement.md +10 -0
  1018. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  1019. package/examples/extensions/summarize.ts +199 -0
  1020. package/examples/extensions/system-prompt-header.ts +17 -0
  1021. package/examples/extensions/tic-tac-toe.ts +1008 -0
  1022. package/examples/extensions/timed-confirm.ts +70 -0
  1023. package/examples/extensions/titlebar-spinner.ts +58 -0
  1024. package/examples/extensions/todo.ts +297 -0
  1025. package/examples/extensions/tool-override.ts +144 -0
  1026. package/examples/extensions/tools.ts +146 -0
  1027. package/examples/extensions/trigger-compact.ts +50 -0
  1028. package/examples/extensions/truncated-tool.ts +195 -0
  1029. package/examples/extensions/widget-placement.ts +9 -0
  1030. package/examples/extensions/with-deps/index.ts +32 -0
  1031. package/examples/extensions/with-deps/package-lock.json +31 -0
  1032. package/examples/extensions/with-deps/package.json +22 -0
  1033. package/examples/extensions/working-indicator.ts +123 -0
  1034. package/examples/extensions/working-message-test.ts +25 -0
  1035. package/examples/plugins/pi-example-plugin/README.md +38 -0
  1036. package/examples/plugins/pi-example-plugin/package.json +10 -0
  1037. package/examples/plugins/pi-example-plugin/src/contract.ts +13 -0
  1038. package/examples/plugins/pi-example-plugin/src/session.ts +23 -0
  1039. package/examples/plugins/pi-example-plugin/src/tui.ts +31 -0
  1040. package/examples/rpc-extension-ui.ts +641 -0
  1041. package/examples/sdk/01-minimal.ts +26 -0
  1042. package/examples/sdk/02-custom-model.ts +49 -0
  1043. package/examples/sdk/03-custom-prompt.ts +75 -0
  1044. package/examples/sdk/04-skills.ts +55 -0
  1045. package/examples/sdk/05-tools.ts +48 -0
  1046. package/examples/sdk/06-extensions.ts +99 -0
  1047. package/examples/sdk/07-context-files.ts +47 -0
  1048. package/examples/sdk/08-prompt-templates.ts +51 -0
  1049. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  1050. package/examples/sdk/10-settings.ts +53 -0
  1051. package/examples/sdk/11-sessions.ts +52 -0
  1052. package/examples/sdk/12-full-control.ts +74 -0
  1053. package/examples/sdk/13-session-runtime.ts +67 -0
  1054. package/examples/sdk/README.md +140 -0
  1055. package/npm-shrinkwrap.json +2163 -0
  1056. package/package.json +117 -0
@@ -0,0 +1,77 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { copyFileSync, existsSync, mkdirSync, renameSync, rmSync } from "node:fs";
3
+ import { basename, dirname, join, relative, resolve, toNamespacedPath } from "node:path";
4
+ import { getCwdRelativePath } from "./paths.js";
5
+ const QUARANTINE_DIR_NAME = ".pi-native-quarantine";
6
+ function normalizePath(path) {
7
+ return toNamespacedPath(resolve(path));
8
+ }
9
+ function getQuarantineRoot(packageDir) {
10
+ let current = resolve(packageDir);
11
+ while (true) {
12
+ if (basename(current).toLowerCase() === "node_modules") {
13
+ return join(current, QUARANTINE_DIR_NAME);
14
+ }
15
+ const parent = dirname(current);
16
+ if (parent === current) {
17
+ return undefined;
18
+ }
19
+ current = parent;
20
+ }
21
+ }
22
+ function getLoadedSharedObjectsInPackageDir(packageDir) {
23
+ const sharedObjects = process.report.getReport().sharedObjects;
24
+ if (!Array.isArray(sharedObjects)) {
25
+ return [];
26
+ }
27
+ const root = normalizePath(packageDir).toLowerCase();
28
+ const seen = new Set();
29
+ const loadedFiles = [];
30
+ for (const value of sharedObjects) {
31
+ if (typeof value !== "string") {
32
+ continue;
33
+ }
34
+ const filePath = normalizePath(value);
35
+ const comparisonPath = filePath.toLowerCase();
36
+ if (getCwdRelativePath(comparisonPath, root) === undefined || seen.has(comparisonPath)) {
37
+ continue;
38
+ }
39
+ seen.add(comparisonPath);
40
+ loadedFiles.push(filePath);
41
+ }
42
+ return loadedFiles;
43
+ }
44
+ export function cleanupWindowsSelfUpdateQuarantine(packageDir) {
45
+ const quarantineRoot = getQuarantineRoot(packageDir);
46
+ if (!quarantineRoot) {
47
+ return;
48
+ }
49
+ try {
50
+ rmSync(quarantineRoot, { recursive: true, force: true });
51
+ }
52
+ catch {
53
+ // A previous pi process may still be exiting and holding a native addon.
54
+ }
55
+ }
56
+ export function quarantineWindowsNativeDependencies(packageDir) {
57
+ const resolvedPackageDir = normalizePath(packageDir);
58
+ const quarantineRoot = getQuarantineRoot(resolvedPackageDir);
59
+ if (!quarantineRoot) {
60
+ return;
61
+ }
62
+ const loadedFiles = getLoadedSharedObjectsInPackageDir(resolvedPackageDir);
63
+ if (loadedFiles.length === 0) {
64
+ return;
65
+ }
66
+ const quarantineRunDir = join(quarantineRoot, `${Date.now()}-${process.pid}-${randomUUID()}`);
67
+ for (const loadedFile of loadedFiles) {
68
+ if (!existsSync(loadedFile)) {
69
+ continue;
70
+ }
71
+ const quarantinePath = join(quarantineRunDir, relative(resolvedPackageDir, loadedFile));
72
+ mkdirSync(dirname(quarantinePath), { recursive: true });
73
+ renameSync(loadedFile, quarantinePath);
74
+ copyFileSync(quarantinePath, loadedFile);
75
+ }
76
+ }
77
+ //# sourceMappingURL=windows-self-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"windows-self-update.js","sourceRoot":"","sources":["../../src/utils/windows-self-update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAEpD,SAAS,aAAa,CAAC,IAAY,EAAU;IAC5C,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAAA,CACvC;AAED,SAAS,iBAAiB,CAAC,UAAkB,EAAsB;IAClE,IAAI,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,OAAO,IAAI,EAAE,CAAC;QACb,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,cAAc,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,GAAG,MAAM,CAAC;IAClB,CAAC;AAAA,CACD;AAED,SAAS,kCAAkC,CAAC,UAAkB,EAAY;IACzE,MAAM,aAAa,GAAI,OAAO,CAAC,MAAM,CAAC,SAAS,EAAkC,CAAC,aAAa,CAAC;IAChG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,IAAI,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC/B,SAAS;QACV,CAAC;QACD,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACtC,MAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC9C,IAAI,kBAAkB,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;YACxF,SAAS;QACV,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACzB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,WAAW,CAAC;AAAA,CACnB;AAED,MAAM,UAAU,kCAAkC,CAAC,UAAkB,EAAQ;IAC5E,MAAM,cAAc,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACrD,IAAI,CAAC,cAAc,EAAE,CAAC;QACrB,OAAO;IACR,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACR,yEAAyE;IAC1E,CAAC;AAAA,CACD;AAED,MAAM,UAAU,mCAAmC,CAAC,UAAkB,EAAQ;IAC7E,MAAM,kBAAkB,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IAC7D,IAAI,CAAC,cAAc,EAAE,CAAC;QACrB,OAAO;IACR,CAAC;IAED,MAAM,WAAW,GAAG,kCAAkC,CAAC,kBAAkB,CAAC,CAAC;IAC3E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO;IACR,CAAC;IAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,GAAG,IAAI,UAAU,EAAE,EAAE,CAAC,CAAC;IAC9F,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,SAAS;QACV,CAAC;QACD,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,CAAC;QACxF,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,UAAU,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QACvC,YAAY,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IAC1C,CAAC;AAAA,CACD","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { copyFileSync, existsSync, mkdirSync, renameSync, rmSync } from \"node:fs\";\nimport { basename, dirname, join, relative, resolve, toNamespacedPath } from \"node:path\";\nimport { getCwdRelativePath } from \"./paths.ts\";\n\nconst QUARANTINE_DIR_NAME = \".pi-native-quarantine\";\n\nfunction normalizePath(path: string): string {\n\treturn toNamespacedPath(resolve(path));\n}\n\nfunction getQuarantineRoot(packageDir: string): string | undefined {\n\tlet current = resolve(packageDir);\n\twhile (true) {\n\t\tif (basename(current).toLowerCase() === \"node_modules\") {\n\t\t\treturn join(current, QUARANTINE_DIR_NAME);\n\t\t}\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) {\n\t\t\treturn undefined;\n\t\t}\n\t\tcurrent = parent;\n\t}\n}\n\nfunction getLoadedSharedObjectsInPackageDir(packageDir: string): string[] {\n\tconst sharedObjects = (process.report.getReport() as { sharedObjects?: unknown }).sharedObjects;\n\tif (!Array.isArray(sharedObjects)) {\n\t\treturn [];\n\t}\n\n\tconst root = normalizePath(packageDir).toLowerCase();\n\tconst seen = new Set<string>();\n\tconst loadedFiles: string[] = [];\n\tfor (const value of sharedObjects) {\n\t\tif (typeof value !== \"string\") {\n\t\t\tcontinue;\n\t\t}\n\t\tconst filePath = normalizePath(value);\n\t\tconst comparisonPath = filePath.toLowerCase();\n\t\tif (getCwdRelativePath(comparisonPath, root) === undefined || seen.has(comparisonPath)) {\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(comparisonPath);\n\t\tloadedFiles.push(filePath);\n\t}\n\treturn loadedFiles;\n}\n\nexport function cleanupWindowsSelfUpdateQuarantine(packageDir: string): void {\n\tconst quarantineRoot = getQuarantineRoot(packageDir);\n\tif (!quarantineRoot) {\n\t\treturn;\n\t}\n\ttry {\n\t\trmSync(quarantineRoot, { recursive: true, force: true });\n\t} catch {\n\t\t// A previous pi process may still be exiting and holding a native addon.\n\t}\n}\n\nexport function quarantineWindowsNativeDependencies(packageDir: string): void {\n\tconst resolvedPackageDir = normalizePath(packageDir);\n\tconst quarantineRoot = getQuarantineRoot(resolvedPackageDir);\n\tif (!quarantineRoot) {\n\t\treturn;\n\t}\n\n\tconst loadedFiles = getLoadedSharedObjectsInPackageDir(resolvedPackageDir);\n\tif (loadedFiles.length === 0) {\n\t\treturn;\n\t}\n\n\tconst quarantineRunDir = join(quarantineRoot, `${Date.now()}-${process.pid}-${randomUUID()}`);\n\tfor (const loadedFile of loadedFiles) {\n\t\tif (!existsSync(loadedFile)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst quarantinePath = join(quarantineRunDir, relative(resolvedPackageDir, loadedFile));\n\t\tmkdirSync(dirname(quarantinePath), { recursive: true });\n\t\trenameSync(loadedFile, quarantinePath);\n\t\tcopyFileSync(quarantinePath, loadedFile);\n\t}\n}\n"]}
@@ -0,0 +1,418 @@
1
+ # Compaction & Branch Summarization
2
+
3
+ LLMs have limited context windows. When conversations grow too long, Pi uses compaction to summarize older content while preserving recent work. This page covers both auto-compaction and branch summarization.
4
+
5
+ **Source files** ([pi-mono](https://github.com/earendil-works/pi-mono)):
6
+ - [`packages/coding-agent/src/core/compaction/compaction.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) - Auto-compaction logic
7
+ - [`packages/coding-agent/src/core/compaction/branch-summarization.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) - Branch summarization
8
+ - [`packages/coding-agent/src/core/compaction/utils.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts) - Shared utilities (file tracking, serialization)
9
+ - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts) - Entry types (`CompactionEntry`, `BranchSummaryEntry`)
10
+ - [`packages/coding-agent/src/core/extensions/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) - Extension event types
11
+
12
+ For TypeScript definitions in your project, inspect `node_modules/@earendil-works/pi-coding-agent/dist/`.
13
+
14
+ ## Overview
15
+
16
+ Pi has two summarization mechanisms:
17
+
18
+ | Mechanism | Trigger | Purpose |
19
+ |-----------|---------|---------|
20
+ | Compaction | Context exceeds threshold, or `/compact` | Summarize old messages to free up context |
21
+ | Branch summarization | `/tree` navigation | Preserve context when switching branches |
22
+
23
+ Both use the same structured summary format and track file operations cumulatively. Compaction and branch-summary requests use fresh routing session IDs and, where supported by the provider, disable prompt-cache writes because these one-off prompts are unlikely to be reused.
24
+
25
+ ## Compaction
26
+
27
+ ### When It Triggers
28
+
29
+ Auto-compaction triggers when:
30
+
31
+ ```
32
+ contextTokens > contextWindow - reserveTokens
33
+ ```
34
+
35
+ By default, `reserveTokens` is 16384 tokens (configurable in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`). This leaves room for the LLM's response.
36
+
37
+ During a multi-turn agent run, Pi checks this threshold after tools finish and their results are appended, before starting the next assistant response. If the threshold is crossed, Pi compacts inside the same agent run and resumes with the summary and retained messages. It skips this between-turn check when the completed tool batch terminates the run and no queued message requires another response. Pi also checks the threshold before a new user prompt and after a low-level agent run ends.
38
+
39
+ You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
40
+
41
+ ### How It Works
42
+
43
+ 1. **Find cut point**: Walk backwards from newest message, accumulating token estimates until `keepRecentTokens` (default 20k, configurable in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`) is reached
44
+ 2. **Extract messages**: Collect messages from the previous kept boundary (or session start) up to the cut point
45
+ 3. **Generate summary**: Call LLM to summarize with structured format, passing the previous summary as iterative context when present
46
+ 4. **Append entry**: Save `CompactionEntry` with summary and `firstKeptEntryId`
47
+ 5. **Rebuilds context**: Session rebuilds the context for the next request, using summary + messages from `firstKeptEntryId` onwards
48
+
49
+ ```
50
+ Before compaction:
51
+
52
+ entry: 0 1 2 3 4 5 6 7 8 9
53
+ ┌─────┬─────┬─────┬──────┬─────┬─────┬──────┬──────┬─────┬─────┐
54
+ │ hdr │ usr │ ass │ tool │ usr │ ass │ tool │ tool │ ass │ tool│
55
+ └─────┴─────┴─────┴──────┴─────┴─────┴──────┴──────┴─────┴─────┘
56
+ └────────┬───────┘ └──────────────┬──────────────┘
57
+ messagesToSummarize kept messages
58
+ ↑
59
+ firstKeptEntryId (entry 4)
60
+
61
+ After compaction (new entry appended):
62
+
63
+ entry: 0 1 2 3 4 5 6 7 8 9 10
64
+ ┌─────┬─────┬─────┬──────┬─────┬─────┬──────┬──────┬─────┬─────┬─────┐
65
+ │ hdr │ usr │ ass │ tool │ usr │ ass │ tool │ tool │ ass │ tool│ cmp │
66
+ └─────┴─────┴─────┴──────┴─────┴─────┴──────┴──────┴─────┴─────┴─────┘
67
+ └──────────┬──────┘ └──────────────────────┬───────────────────┘
68
+ not sent to LLM sent to LLM
69
+ ↑
70
+ starts from firstKeptEntryId
71
+
72
+ What the LLM sees:
73
+
74
+ ┌────────┬─────────┬─────┬─────┬──────┬──────┬─────┬──────┐
75
+ │ system │ summary │ usr │ ass │ tool │ tool │ ass │ tool │
76
+ └────────┴─────────┴─────┴─────┴──────┴──────┴─────┴──────┘
77
+ ↑ ↑ └─────────────────┬────────────────┘
78
+ prompt from cmp messages from firstKeptEntryId
79
+ ```
80
+
81
+ On repeated compactions, the summarized span starts at the previous compaction's kept boundary (`firstKeptEntryId`), not at the compaction entry itself, falling back to the entry after the previous compaction if that kept entry cannot be found in the path. This preserves messages that survived the earlier compaction by including them in the next summarization pass as well. Pi also recalculates `tokensBefore` from the rebuilt session context before writing the new `CompactionEntry`, so the token count reflects the actual pre-compaction context being replaced.
82
+
83
+ ### Split Turns
84
+
85
+ A "turn" starts with a user message and includes all assistant responses and tool calls until the next user message. Normally, compaction cuts at turn boundaries.
86
+
87
+ When a single turn exceeds `keepRecentTokens`, the cut point lands mid-turn at an assistant message. This is a "split turn":
88
+
89
+ ```
90
+ Split turn (one huge turn exceeds budget):
91
+
92
+ entry: 0 1 2 3 4 5 6 7 8
93
+ ┌─────┬─────┬─────┬──────┬─────┬──────┬──────┬─────┬──────┐
94
+ │ hdr │ usr │ ass │ tool │ ass │ tool │ tool │ ass │ tool │
95
+ └─────┴─────┴─────┴──────┴─────┴──────┴──────┴─────┴──────┘
96
+ ↑ ↑
97
+ turnStartIndex = 1 firstKeptEntryId = 7
98
+ │ │
99
+ └──── turnPrefixMessages (1-6) ───────┘
100
+ └── kept (7-8)
101
+
102
+ isSplitTurn = true
103
+ messagesToSummarize = [] (no complete turns before)
104
+ turnPrefixMessages = [usr, ass, tool, ass, tool, tool]
105
+ ```
106
+
107
+ For split turns, Pi generates two summaries and merges them:
108
+ 1. **History summary**: Previous context (if any)
109
+ 2. **Turn prefix summary**: The early part of the split turn
110
+
111
+ ### Cut Point Rules
112
+
113
+ Valid cut points are:
114
+ - User messages
115
+ - Assistant messages
116
+ - BashExecution messages
117
+ - Custom messages (custom_message, branch_summary)
118
+
119
+ Never cut at tool results (they must stay with their tool call).
120
+
121
+ ### CompactionEntry Structure
122
+
123
+ Defined in [`session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
124
+
125
+ ```typescript
126
+ interface CompactionEntry<T = unknown> {
127
+ type: "compaction";
128
+ id: string;
129
+ parentId: string;
130
+ timestamp: number;
131
+ summary: string;
132
+ firstKeptEntryId: string;
133
+ tokensBefore: number;
134
+ usage?: Usage; // LLM usage that generated the summary
135
+ fromHook?: boolean; // true if provided by extension (legacy field name)
136
+ details?: T; // implementation-specific data
137
+ }
138
+
139
+ // Default compaction uses this for details (from compaction.ts):
140
+ interface CompactionDetails {
141
+ readFiles: string[];
142
+ modifiedFiles: string[];
143
+ }
144
+ ```
145
+
146
+ Extensions can store any JSON-serializable data in `details`. The default compaction tracks file operations, but custom extension implementations can use their own structure. Generated and extension-provided summaries store their LLM `usage` when available so session totals include summarization work.
147
+
148
+ See [`prepareCompaction()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) and [`compact()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/compaction.ts) for the implementation. For direct programmatic summarization, `generateSummary()` returns the summary text and `generateSummaryWithUsage()` returns `{ text, usage }`.
149
+
150
+ ## Branch Summarization
151
+
152
+ ### When It Triggers
153
+
154
+ When you use `/tree` to navigate to a different branch, Pi offers to summarize the work you're leaving. This injects context from the left branch into the new branch.
155
+
156
+ ### How It Works
157
+
158
+ 1. **Find common ancestor**: Deepest node shared by old and new positions
159
+ 2. **Collect entries**: Walk from old leaf back to common ancestor
160
+ 3. **Prepare with budget**: Include messages up to token budget (newest first)
161
+ 4. **Generate summary**: Call LLM with structured format
162
+ 5. **Append entry**: Save `BranchSummaryEntry` at navigation point
163
+
164
+ ```
165
+ Tree before navigation:
166
+
167
+ ┌─ B ─ C ─ D (old leaf, being abandoned)
168
+ A ───┤
169
+ └─ E ─ F (target)
170
+
171
+ Common ancestor: A
172
+ Entries to summarize: B, C, D
173
+
174
+ After navigation with summary:
175
+
176
+ ┌─ B ─ C ─ D
177
+ A ───┤
178
+ └─ E ─ F ─ [summary of B,C,D] (new leaf)
179
+ ```
180
+
181
+ ### Cumulative File Tracking
182
+
183
+ Both compaction and branch summarization track files cumulatively. When generating a summary, pi extracts file operations from:
184
+ - Tool calls in the messages being summarized
185
+ - Previous compaction or branch summary `details` (if any)
186
+
187
+ This means file tracking accumulates across multiple compactions or nested branch summaries, preserving the full history of read and modified files.
188
+
189
+ ### BranchSummaryEntry Structure
190
+
191
+ Defined in [`session-manager.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/session-manager.ts):
192
+
193
+ ```typescript
194
+ interface BranchSummaryEntry<T = unknown> {
195
+ type: "branch_summary";
196
+ id: string;
197
+ parentId: string;
198
+ timestamp: number;
199
+ summary: string;
200
+ fromId: string; // Entry we navigated from
201
+ usage?: Usage; // LLM usage that generated the summary
202
+ fromHook?: boolean; // true if provided by extension (legacy field name)
203
+ details?: T; // implementation-specific data
204
+ }
205
+
206
+ // Default branch summarization uses this for details (from branch-summarization.ts):
207
+ interface BranchSummaryDetails {
208
+ readFiles: string[];
209
+ modifiedFiles: string[];
210
+ }
211
+ ```
212
+
213
+ Same as compaction, extensions can store custom data in `details`.
214
+
215
+ See [`collectEntriesForBranchSummary()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), [`prepareBranchEntries()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts), and [`generateBranchSummary()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/branch-summarization.ts) for the implementation.
216
+
217
+ ## Summary Format
218
+
219
+ Both compaction and branch summarization use the same structured format:
220
+
221
+ ```markdown
222
+ ## Goal
223
+ [What the user is trying to accomplish]
224
+
225
+ ## Constraints & Preferences
226
+ - [Requirements mentioned by user]
227
+
228
+ ## Progress
229
+ ### Done
230
+ - [x] [Completed tasks]
231
+
232
+ ### In Progress
233
+ - [ ] [Current work]
234
+
235
+ ### Blocked
236
+ - [Issues, if any]
237
+
238
+ ## Key Decisions
239
+ - **[Decision]**: [Rationale]
240
+
241
+ ## Next Steps
242
+ 1. [What should happen next]
243
+
244
+ ## Critical Context
245
+ - [Data needed to continue]
246
+
247
+ <read-files>
248
+ path/to/file1.ts
249
+ path/to/file2.ts
250
+ </read-files>
251
+
252
+ <modified-files>
253
+ path/to/changed.ts
254
+ </modified-files>
255
+ ```
256
+
257
+ ### Message Serialization
258
+
259
+ Before summarization, messages are serialized to text via [`serializeConversation()`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/compaction/utils.ts):
260
+
261
+ ```
262
+ [User]: What they said
263
+ [Assistant thinking]: Internal reasoning
264
+ [Assistant]: Response text
265
+ [Assistant tool calls]: read(path="foo.ts"); edit(path="bar.ts", ...)
266
+ [Tool result]: Output from tool
267
+ ```
268
+
269
+ This prevents the model from treating it as a conversation to continue.
270
+
271
+ Tool results are truncated to 2000 characters during serialization. Content beyond that limit is replaced with a marker indicating how many characters were truncated. This keeps summarization requests within reasonable token budgets, since tool results (especially from `read` and `bash`) are typically the largest contributors to context size.
272
+
273
+ ## Custom Summarization via Extensions
274
+
275
+ Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.
276
+
277
+ ### session_before_compact
278
+
279
+ Fired before auto-compaction or `/compact`. Can cancel or provide custom summary. See `SessionBeforeCompactEvent` and `CompactionPreparation` in the types file.
280
+
281
+ ```typescript
282
+ pi.on("session_before_compact", async (event, ctx) => {
283
+ const { preparation, branchEntries, customInstructions, reason, willRetry, signal } = event;
284
+
285
+ // preparation.messagesToSummarize - messages to summarize
286
+ // preparation.turnPrefixMessages - split turn prefix (if isSplitTurn)
287
+ // preparation.previousSummary - previous compaction summary
288
+ // preparation.fileOps - extracted file operations
289
+ // preparation.tokensBefore - context tokens before compaction
290
+ // preparation.firstKeptEntryId - where kept messages start
291
+ // preparation.settings - compaction settings
292
+
293
+ // branchEntries - all entries on current branch (for custom state)
294
+ // reason - "manual" (/compact), "threshold", or "overflow"
295
+ // willRetry - whether the aborted turn is retried after compaction (overflow recovery)
296
+ // signal - AbortSignal (pass to LLM calls)
297
+
298
+ // Cancel:
299
+ return { cancel: true };
300
+
301
+ // Custom summary:
302
+ return {
303
+ compaction: {
304
+ summary: "Your summary...",
305
+ firstKeptEntryId: preparation.firstKeptEntryId,
306
+ tokensBefore: preparation.tokensBefore,
307
+ // usage: summaryResponse.usage, // Optional; included in session totals
308
+ details: { /* custom data */ },
309
+ }
310
+ };
311
+ });
312
+ ```
313
+
314
+ #### Converting Messages to Text
315
+
316
+ To generate a summary with your own model, convert messages to text using `serializeConversation`:
317
+
318
+ ```typescript
319
+ import { convertToLlm, serializeConversation } from "@earendil-works/pi-coding-agent";
320
+
321
+ pi.on("session_before_compact", async (event, ctx) => {
322
+ const { preparation } = event;
323
+
324
+ // Convert AgentMessage[] to Message[], then serialize to text
325
+ const conversationText = serializeConversation(
326
+ convertToLlm(preparation.messagesToSummarize)
327
+ );
328
+ // Returns:
329
+ // [User]: message text
330
+ // [Assistant thinking]: thinking content
331
+ // [Assistant]: response text
332
+ // [Assistant tool calls]: read(path="..."); bash(command="...")
333
+ // [Tool result]: output text
334
+
335
+ // Now send to your model for summarization
336
+ const { summary, usage } = await myModel.summarize(conversationText);
337
+
338
+ return {
339
+ compaction: {
340
+ summary,
341
+ firstKeptEntryId: preparation.firstKeptEntryId,
342
+ tokensBefore: preparation.tokensBefore,
343
+ usage,
344
+ }
345
+ };
346
+ });
347
+ ```
348
+
349
+ See [custom-compaction.ts](../examples/extensions/custom-compaction.ts) for a complete example using a different model.
350
+
351
+ ### session_compact_failed
352
+
353
+ Fired when manual or automatic compaction fails or is aborted. This is useful for telemetry extensions that need to pair `session_before_compact` attempts with terminal outcomes.
354
+
355
+ ```typescript
356
+ pi.on("session_compact_failed", async (event, ctx) => {
357
+ const { reason, errorMessage, aborted, willRetry, fromExtension } = event;
358
+ // reason - "manual" (/compact), "threshold", or "overflow"
359
+ // errorMessage - present for non-abort failures
360
+ // aborted - true for cancelled/aborted compactions
361
+ // willRetry - whether the aborted turn would have retried after compaction
362
+ // fromExtension - whether extension-provided compaction content was being used
363
+ });
364
+ ```
365
+
366
+ ### session_before_tree
367
+
368
+ Fired before `/tree` navigation. Always fires regardless of whether user chose to summarize. Can cancel navigation or provide custom summary.
369
+
370
+ ```typescript
371
+ pi.on("session_before_tree", async (event, ctx) => {
372
+ const { preparation, signal } = event;
373
+
374
+ // preparation.targetId - where we're navigating to
375
+ // preparation.oldLeafId - current position (being abandoned)
376
+ // preparation.commonAncestorId - shared ancestor
377
+ // preparation.entriesToSummarize - entries that would be summarized
378
+ // preparation.userWantsSummary - whether user chose to summarize
379
+
380
+ // Cancel navigation entirely:
381
+ return { cancel: true };
382
+
383
+ // Provide custom summary (only used if userWantsSummary is true):
384
+ if (preparation.userWantsSummary) {
385
+ return {
386
+ summary: {
387
+ summary: "Your summary...",
388
+ // usage: summaryResponse.usage, // Optional; included in session totals
389
+ details: { /* custom data */ },
390
+ }
391
+ };
392
+ }
393
+ });
394
+ ```
395
+
396
+ See `SessionBeforeTreeEvent` and `TreePreparation` in the types file.
397
+
398
+ ## Settings
399
+
400
+ Configure compaction in `~/.pi/agent/settings.json` or `<project-dir>/.pi/settings.json`:
401
+
402
+ ```json
403
+ {
404
+ "compaction": {
405
+ "enabled": true,
406
+ "reserveTokens": 16384,
407
+ "keepRecentTokens": 20000
408
+ }
409
+ }
410
+ ```
411
+
412
+ | Setting | Default | Description |
413
+ |---------|---------|-------------|
414
+ | `enabled` | `true` | Enable auto-compaction |
415
+ | `reserveTokens` | `16384` | Tokens to reserve for LLM response |
416
+ | `keepRecentTokens` | `20000` | Recent tokens to keep (not summarized) |
417
+
418
+ Disable auto-compaction with `"enabled": false`. You can still compact manually with `/compact`.
@@ -0,0 +1,156 @@
1
+ # Containerization
2
+
3
+ Pi runs with all permissions by default, but in some cases, you will want to have more control over what directories Pi can write to and which accesses it has.
4
+
5
+ There are two general options. You can either
6
+ 1. run the whole `pi` process inside an isolated environment, or
7
+ 2. run `pi` on the host and route tool execution into an isolated environment.
8
+
9
+ ## Choose a pattern
10
+
11
+ | Pattern | What is isolated | Best for | Notes |
12
+ | --- | --- | --- | --- |
13
+ | Gondolin extension | Built-in tools and `!` commands | Local micro-VM isolation while keeping auth on host | See [`examples/extensions/gondolin/`](../examples/extensions/gondolin/). |
14
+ | Plain Docker | Whole `pi` process in a local container | Simple local isolation | Provider API keys enter the container. |
15
+ | OpenShell | Whole `pi` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway |
16
+ | Docker Sandboxes | Whole `pi` process in a managed sandbox | Local isolation with provider keys kept on the host | Requires Docker Sandboxes (`sbx`). |
17
+
18
+ Extensions run wherever the `pi` process runs. If you run host `pi` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
19
+
20
+ ## Gondolin
21
+
22
+ [Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM.
23
+ Use the [example extension](../examples/extensions/gondolin) when you want `pi` on the host but all built-in tools routed into the VM.
24
+
25
+ Setup:
26
+
27
+ ```bash
28
+ cp -R packages/coding-agent/examples/extensions/gondolin ~/.pi/agent/extensions/gondolin
29
+ cd ~/.pi/agent/extensions/gondolin
30
+ npm install --ignore-scripts
31
+ ```
32
+
33
+ Run from the project you want mounted:
34
+
35
+ ```bash
36
+ cd /path/to/project
37
+ pi -e ~/.pi/agent/extensions/gondolin
38
+ ```
39
+
40
+ The extension mounts the host cwd at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `grep`, `find`, and `ls`.
41
+ User `!` commands are routed into the VM, as well.
42
+ File changes under `/workspace` write through to the host.
43
+
44
+ Requirements: Node.js >= 23.6.0 for `@earendil-works/gondolin`, plus QEMU (requires installation through your package manager).
45
+
46
+ ## Plain Docker
47
+
48
+ Run the whole `pi` process in Docker when you want the simplest local container boundary.
49
+
50
+ `Dockerfile.pi`:
51
+
52
+ ```dockerfile
53
+ FROM node:24-bookworm-slim
54
+
55
+ RUN apt-get update \
56
+ && apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
57
+ && rm -rf /var/lib/apt/lists/*
58
+ RUN npm install -g --ignore-scripts @earendil-works/pi-coding-agent
59
+
60
+ WORKDIR /workspace
61
+ ENTRYPOINT ["pi"]
62
+ ```
63
+
64
+ Build and run:
65
+
66
+ ```bash
67
+ docker build -t pi-sandbox -f Dockerfile.pi .
68
+
69
+ docker run --rm -it \
70
+ -e ANTHROPIC_API_KEY \
71
+ -v "$PWD:/workspace" \
72
+ -v pi-agent-home:/root/.pi/agent \
73
+ pi-sandbox
74
+ ```
75
+
76
+ The `-v "$PWD:/workspace"` mounts your current directory into the container at /workspace such that reads and writes in `/workspace` inside Docker directly affect your host files, like in the Gondolin example.
77
+
78
+ Use a named volume for `/root/.pi/agent` if you want container-local settings and sessions. Mounting your host `~/.pi/agent` exposes host auth and session files to the container.
79
+
80
+ ## OpenShell
81
+
82
+ Use [NVIDIA OpenShell](https://docs.nvidia.com/openshell/about/overview) when you want a policy-controlled sandbox with filesystem, process, network, credential, and inference controls.
83
+ OpenShell can run sandboxes through a local gateway backed by Docker, Podman, or a VM runtime, or through a remote Kubernetes gateway.
84
+
85
+ Every sandbox requires an active gateway.
86
+ Register and select one before creating a sandbox:
87
+
88
+ ```bash
89
+ openshell gateway add <gateway-url> --name <name>
90
+ openshell gateway select <name>
91
+ ```
92
+
93
+ Launch `pi` inside an OpenShell sandbox:
94
+
95
+ ```bash
96
+ openshell sandbox create --name pi-sandbox --from pi -- pi
97
+ ```
98
+
99
+ In this pattern, the whole `pi` process runs inside the sandbox.
100
+ Built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
101
+
102
+ If the gateway is remote, project files are not bind-mounted from the host, meaning writes in the sandbox are not reflected on your machine.
103
+ Clone the repository inside the sandbox or use OpenShell file transfer commands:
104
+
105
+ ```bash
106
+ openshell sandbox upload pi-sandbox ./repo /workspace
107
+ openshell sandbox download pi-sandbox /workspace/repo ./repo-out
108
+ ```
109
+
110
+ OpenShell providers can keep raw model API keys outside the sandbox.
111
+ When inference routing is configured, code inside the sandbox can call `https://inference.local`, and the gateway injects the configured provider credentials upstream.
112
+ Configure Pi to use the corresponding OpenAI-compatible or Anthropic-compatible endpoint if you want model traffic to use this route.
113
+
114
+ ## Docker Sandboxes
115
+
116
+ [Docker Sandboxes](https://docs.docker.com/ai/sandboxes/) is a managed sandbox runtime from Docker that runs the whole `pi` process inside a sandbox.
117
+ It is one of the container boundaries [No Built-in Sandbox](security.md#no-built-in-sandbox) points to.
118
+
119
+ Unlike the Plain Docker pattern above, the provider credential is not passed into the container.
120
+ The sandbox receives a sentinel value instead, and the `sbx` proxy substitutes the real credential on egress to `api.anthropic.com`.
121
+ Credentials are wired at creation time, so store yours on the host before you create the sandbox.
122
+
123
+ For a Claude Pro/Max subscription, run `claude setup-token` on a machine with Claude Code, then store the result on the host.
124
+ If an `anthropic` secret is already bound, remove it first: otherwise the proxy adds an `x-api-key` header alongside the Bearer token and Anthropic rejects the request.
125
+ `sbx secret set-custom` reads the token from stdin, so it stays out of shell history.
126
+
127
+ ```bash
128
+ sbx secret rm anthropic
129
+
130
+ sbx secret set-custom \
131
+ --host api.anthropic.com \
132
+ --env ANTHROPIC_OAUTH_TOKEN \
133
+ --placeholder 'sk-ant-oat01-{rand}'
134
+ ```
135
+
136
+ The sandbox gets an OAuth-shaped placeholder, not the real token, and the proxy swaps it on egress to that host; `ANTHROPIC_OAUTH_TOKEN` is a variable pi already reads and prefers over an API key, so no extra pi configuration is needed.
137
+
138
+ For an API key, store it with `sbx secret set anthropic` instead. The kit wires it the same way, as a sentinel the proxy substitutes on egress.
139
+
140
+ With the credential stored, launch `pi` from the project you want mounted:
141
+
142
+ ```bash
143
+ sbx run --kit "docker.io/sbx/pi-kit:latest" pi
144
+ ```
145
+
146
+ The kit pre-bakes `pi` into its image, so the sandbox starts without installing anything, and the current directory is the sandbox workspace.
147
+
148
+ Do not authenticate from inside the sandbox: `/login` there writes a real token into the container and defeats the proxy model.
149
+
150
+ Scripted use works the same way:
151
+
152
+ ```bash
153
+ sbx exec <sandbox-name> -- pi -p "list the failing tests"
154
+ ```
155
+
156
+ See the [kit documentation](https://github.com/docker/sbx-kits-contrib/tree/main/pi) for the full credential matrix, troubleshooting, and pinning.