@celljs/ta 0.0.0-stage → 4.5.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 (325) hide show
  1. package/README.md +94 -2
  2. package/bin/ta.mjs +10 -0
  3. package/dist/cli.mjs +517 -0
  4. package/dist/pi/CHANGELOG.md +32 -0
  5. package/dist/pi/dist/bundle/chunks/anthropic-messages-BWGCKOF4.js +6 -0
  6. package/dist/pi/dist/bundle/chunks/anthropic.js +75 -0
  7. package/dist/pi/dist/bundle/chunks/azure-openai-responses-FSC6BAW3.js +2 -0
  8. package/dist/pi/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
  9. package/dist/pi/dist/bundle/chunks/chunk-36QC74V4.js +2 -0
  10. package/dist/pi/dist/bundle/chunks/chunk-3TGLJEWK.js +2 -0
  11. package/dist/pi/dist/bundle/chunks/chunk-44DLKSKE.js +1232 -0
  12. package/dist/pi/dist/bundle/chunks/chunk-4EYXVSA5.js +129 -0
  13. package/dist/pi/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
  14. package/dist/pi/dist/bundle/chunks/chunk-62VOPMLK.js +65 -0
  15. package/dist/pi/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
  16. package/dist/pi/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
  17. package/dist/pi/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
  18. package/dist/pi/dist/bundle/chunks/chunk-7O7QKK6A.js +2 -0
  19. package/dist/pi/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
  20. package/dist/pi/dist/bundle/chunks/chunk-B46VJEHW.js +44 -0
  21. package/dist/pi/dist/bundle/chunks/chunk-C2WU32PX.js +2 -0
  22. package/dist/pi/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
  23. package/dist/pi/dist/bundle/chunks/chunk-CHWNPHIS.js +82 -0
  24. package/dist/pi/dist/bundle/chunks/chunk-EBFHJFEE.js +2 -0
  25. package/dist/pi/dist/bundle/chunks/chunk-EOO47QGR.js +2 -0
  26. package/dist/pi/dist/bundle/chunks/chunk-FFMDRXC4.js +10 -0
  27. package/dist/pi/dist/bundle/chunks/chunk-GN3QYODH.js +16 -0
  28. package/dist/pi/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
  29. package/dist/pi/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
  30. package/dist/pi/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
  31. package/dist/pi/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
  32. package/dist/pi/dist/bundle/chunks/chunk-NL4X6LBY.js +4 -0
  33. package/dist/pi/dist/bundle/chunks/chunk-NZY7EIPA.js +4 -0
  34. package/dist/pi/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
  35. package/dist/pi/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
  36. package/dist/pi/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
  37. package/dist/pi/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
  38. package/dist/pi/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
  39. package/dist/pi/dist/bundle/chunks/chunk-R2EGYMOO.js +7 -0
  40. package/dist/pi/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
  41. package/dist/pi/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
  42. package/dist/pi/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
  43. package/dist/pi/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
  44. package/dist/pi/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  45. package/dist/pi/dist/bundle/chunks/chunk-V6KH5QG4.js +9 -0
  46. package/dist/pi/dist/bundle/chunks/chunk-VOLAXWGI.js +2 -0
  47. package/dist/pi/dist/bundle/chunks/chunk-YZKQS34S.js +9 -0
  48. package/dist/pi/dist/bundle/chunks/cli-MCOUW5WS.js +53 -0
  49. package/dist/pi/dist/bundle/chunks/cloudflare-workers-ai-system-one-WLAFJSP6.js +2 -0
  50. package/dist/pi/dist/bundle/chunks/codemode-worker.js +478 -0
  51. package/dist/pi/dist/bundle/chunks/easter-egg-3d-WMBNSJ4M.js +2 -0
  52. package/dist/pi/dist/bundle/chunks/execute-4CEBORGZ.js +505 -0
  53. package/dist/pi/dist/bundle/chunks/github-copilot.js +2 -0
  54. package/dist/pi/dist/bundle/chunks/google-generative-ai-INGKNW72.js +2 -0
  55. package/dist/pi/dist/bundle/chunks/google-vertex-IBTX6MBF.js +2 -0
  56. package/dist/pi/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
  57. package/dist/pi/dist/bundle/chunks/image-resize-worker.js +2 -0
  58. package/dist/pi/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
  59. package/dist/pi/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
  60. package/dist/pi/dist/bundle/chunks/kimi-coding.js +2 -0
  61. package/dist/pi/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
  62. package/dist/pi/dist/bundle/chunks/llama-cpp-classify-V5U3QKXI.js +22 -0
  63. package/dist/pi/dist/bundle/chunks/meta.js +2 -0
  64. package/dist/pi/dist/bundle/chunks/mistral-conversations-S4OWXIXQ.js +5 -0
  65. package/dist/pi/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
  66. package/dist/pi/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
  67. package/dist/pi/dist/bundle/chunks/node-KCMANYC2.js +16 -0
  68. package/dist/pi/dist/bundle/chunks/openai-chatgpt.js +75 -0
  69. package/dist/pi/dist/bundle/chunks/openai-codex-responses-QAWLOQSN.js +10 -0
  70. package/dist/pi/dist/bundle/chunks/openai-codex.js +75 -0
  71. package/dist/pi/dist/bundle/chunks/openai-completions-EJNYB6IX.js +7 -0
  72. package/dist/pi/dist/bundle/chunks/openai-decisions-IXI34BYG.js +5 -0
  73. package/dist/pi/dist/bundle/chunks/openai-responses-MD3562FB.js +4 -0
  74. package/dist/pi/dist/bundle/chunks/openrouter-images-PISKSFMS.js +2 -0
  75. package/dist/pi/dist/bundle/chunks/openrouter.js +75 -0
  76. package/dist/pi/dist/bundle/chunks/pi-messages-NORUKF4E.js +8 -0
  77. package/dist/pi/dist/bundle/chunks/radius.js +75 -0
  78. package/dist/pi/dist/bundle/chunks/runtime-FQB7RU7U.js +2 -0
  79. package/dist/pi/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
  80. package/dist/pi/dist/bundle/chunks/typesafe-system-one-CHVC2UUI.js +2 -0
  81. package/dist/pi/dist/bundle/chunks/virtual-modules-O76XM3OB.js +2 -0
  82. package/dist/pi/dist/bundle/chunks/xai.js +2 -0
  83. package/dist/pi/dist/bundle/cli-runtime.js +3 -0
  84. package/dist/pi/dist/bundle/cli.js +5 -0
  85. package/dist/pi/dist/bundle/index.js +2 -0
  86. package/dist/pi/dist/bundle/rpc-entry.js +3 -0
  87. package/dist/pi/dist/core/export-html/ansi-to-html.js +249 -0
  88. package/dist/pi/dist/core/export-html/index.js +228 -0
  89. package/dist/pi/dist/core/export-html/template.css +1085 -0
  90. package/dist/pi/dist/core/export-html/template.html +56 -0
  91. package/dist/pi/dist/core/export-html/template.js +2044 -0
  92. package/dist/pi/dist/core/export-html/tool-renderer.js +113 -0
  93. package/dist/pi/dist/core/export-html/vendor/highlight.min.js +1213 -0
  94. package/dist/pi/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
  95. package/dist/pi/dist/core/export-html/vendor/marked.min.js +79 -0
  96. package/dist/pi/dist/modes/interactive/assets/clankolas.png +0 -0
  97. package/dist/pi/dist/modes/interactive/theme/dark.json +78 -0
  98. package/dist/pi/dist/modes/interactive/theme/light.json +78 -0
  99. package/dist/pi/docs/cli-integration.md +106 -0
  100. package/dist/pi/docs/cli.md +343 -0
  101. package/dist/pi/docs/codemode.md +230 -0
  102. package/dist/pi/docs/compaction.md +463 -0
  103. package/dist/pi/docs/configuration.md +47 -0
  104. package/dist/pi/docs/containerization.md +183 -0
  105. package/dist/pi/docs/custom-provider.md +227 -0
  106. package/dist/pi/docs/docs.json +220 -0
  107. package/dist/pi/docs/environment-variables.md +103 -0
  108. package/dist/pi/docs/extensions.md +3347 -0
  109. package/dist/pi/docs/how-pi-works.md +49 -0
  110. package/dist/pi/docs/images/doom-extension.png +0 -0
  111. package/dist/pi/docs/images/exy.png +0 -0
  112. package/dist/pi/docs/images/interactive-mode.png +0 -0
  113. package/dist/pi/docs/images/tree-view.png +0 -0
  114. package/dist/pi/docs/index.md +39 -0
  115. package/dist/pi/docs/json.md +226 -0
  116. package/dist/pi/docs/keybindings.md +195 -0
  117. package/dist/pi/docs/llama-cpp.md +132 -0
  118. package/dist/pi/docs/mcp.md +274 -0
  119. package/dist/pi/docs/message-types.md +279 -0
  120. package/dist/pi/docs/models-configuration.md +196 -0
  121. package/dist/pi/docs/models.md +225 -0
  122. package/dist/pi/docs/nvidia-rtx-llama-cpp.md +96 -0
  123. package/dist/pi/docs/packages.md +153 -0
  124. package/dist/pi/docs/prompt-templates.md +59 -0
  125. package/dist/pi/docs/providers.md +247 -0
  126. package/dist/pi/docs/quickstart.md +140 -0
  127. package/dist/pi/docs/rpc-commands.md +860 -0
  128. package/dist/pi/docs/rpc-extension-ui.md +200 -0
  129. package/dist/pi/docs/rpc.md +193 -0
  130. package/dist/pi/docs/sdk.md +147 -0
  131. package/dist/pi/docs/security.md +99 -0
  132. package/dist/pi/docs/session-format.md +293 -0
  133. package/dist/pi/docs/sessions.md +74 -0
  134. package/dist/pi/docs/settings.md +173 -0
  135. package/dist/pi/docs/shell-aliases.md +93 -0
  136. package/dist/pi/docs/skills.md +93 -0
  137. package/dist/pi/docs/slash-commands.md +61 -0
  138. package/dist/pi/docs/terminal-setup.md +235 -0
  139. package/dist/pi/docs/termux.md +117 -0
  140. package/dist/pi/docs/themes.md +138 -0
  141. package/dist/pi/docs/tmux.md +61 -0
  142. package/dist/pi/docs/tui.md +197 -0
  143. package/dist/pi/docs/usage.md +94 -0
  144. package/dist/pi/docs/virtual-models.md +114 -0
  145. package/dist/pi/docs/windows.md +108 -0
  146. package/dist/pi/examples/README.md +36 -0
  147. package/dist/pi/examples/extensions/README.md +215 -0
  148. package/dist/pi/examples/extensions/auto-commit-on-exit.ts +49 -0
  149. package/dist/pi/examples/extensions/bash-spawn-hook.ts +30 -0
  150. package/dist/pi/examples/extensions/bookmark.ts +50 -0
  151. package/dist/pi/examples/extensions/border-status-editor.ts +150 -0
  152. package/dist/pi/examples/extensions/built-in-tool-renderer.ts +225 -0
  153. package/dist/pi/examples/extensions/claude-rules.ts +86 -0
  154. package/dist/pi/examples/extensions/commands.ts +72 -0
  155. package/dist/pi/examples/extensions/confirm-destructive.ts +59 -0
  156. package/dist/pi/examples/extensions/custom-compaction.ts +117 -0
  157. package/dist/pi/examples/extensions/custom-footer.ts +64 -0
  158. package/dist/pi/examples/extensions/custom-header.ts +73 -0
  159. package/dist/pi/examples/extensions/custom-provider-anthropic/index.ts +613 -0
  160. package/dist/pi/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  161. package/dist/pi/examples/extensions/custom-provider-anthropic/package.json +19 -0
  162. package/dist/pi/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
  163. package/dist/pi/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  164. package/dist/pi/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  165. package/dist/pi/examples/extensions/debug-provider.ts +90 -0
  166. package/dist/pi/examples/extensions/dirty-repo-guard.ts +56 -0
  167. package/dist/pi/examples/extensions/doom-overlay/README.md +46 -0
  168. package/dist/pi/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  169. package/dist/pi/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  170. package/dist/pi/examples/extensions/doom-overlay/doom/build.sh +152 -0
  171. package/dist/pi/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  172. package/dist/pi/examples/extensions/doom-overlay/doom-component.ts +132 -0
  173. package/dist/pi/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  174. package/dist/pi/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  175. package/dist/pi/examples/extensions/doom-overlay/index.ts +74 -0
  176. package/dist/pi/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  177. package/dist/pi/examples/extensions/dynamic-resources/SKILL.md +8 -0
  178. package/dist/pi/examples/extensions/dynamic-resources/dynamic.json +81 -0
  179. package/dist/pi/examples/extensions/dynamic-resources/dynamic.md +5 -0
  180. package/dist/pi/examples/extensions/dynamic-resources/index.ts +15 -0
  181. package/dist/pi/examples/extensions/dynamic-tools.ts +74 -0
  182. package/dist/pi/examples/extensions/entry-renderer.ts +41 -0
  183. package/dist/pi/examples/extensions/event-bus.ts +43 -0
  184. package/dist/pi/examples/extensions/file-trigger.ts +41 -0
  185. package/dist/pi/examples/extensions/git-checkpoint.ts +53 -0
  186. package/dist/pi/examples/extensions/git-merge-and-resolve.ts +115 -0
  187. package/dist/pi/examples/extensions/github-issue-autocomplete.ts +185 -0
  188. package/dist/pi/examples/extensions/gondolin/index.ts +531 -0
  189. package/dist/pi/examples/extensions/gondolin/package-lock.json +175 -0
  190. package/dist/pi/examples/extensions/gondolin/package.json +19 -0
  191. package/dist/pi/examples/extensions/handoff.ts +190 -0
  192. package/dist/pi/examples/extensions/hello.ts +26 -0
  193. package/dist/pi/examples/extensions/hidden-thinking-label.ts +53 -0
  194. package/dist/pi/examples/extensions/inline-bash.ts +94 -0
  195. package/dist/pi/examples/extensions/input-transform-streaming.ts +39 -0
  196. package/dist/pi/examples/extensions/input-transform.ts +43 -0
  197. package/dist/pi/examples/extensions/interactive-shell.ts +196 -0
  198. package/dist/pi/examples/extensions/jev-router.ts +113 -0
  199. package/dist/pi/examples/extensions/mac-system-theme.ts +47 -0
  200. package/dist/pi/examples/extensions/message-renderer.ts +59 -0
  201. package/dist/pi/examples/extensions/minimal-mode.ts +353 -0
  202. package/dist/pi/examples/extensions/modal-editor.ts +85 -0
  203. package/dist/pi/examples/extensions/model-status.ts +31 -0
  204. package/dist/pi/examples/extensions/notify.ts +57 -0
  205. package/dist/pi/examples/extensions/overlay-qa-tests.ts +1450 -0
  206. package/dist/pi/examples/extensions/overlay-test.ts +153 -0
  207. package/dist/pi/examples/extensions/permission-gate.ts +34 -0
  208. package/dist/pi/examples/extensions/pirate.ts +47 -0
  209. package/dist/pi/examples/extensions/plan-mode/README.md +66 -0
  210. package/dist/pi/examples/extensions/plan-mode/index.ts +394 -0
  211. package/dist/pi/examples/extensions/plan-mode/utils.ts +168 -0
  212. package/dist/pi/examples/extensions/preset.ts +438 -0
  213. package/dist/pi/examples/extensions/project-trust.ts +64 -0
  214. package/dist/pi/examples/extensions/prompt-customizer.ts +49 -0
  215. package/dist/pi/examples/extensions/protected-paths.ts +30 -0
  216. package/dist/pi/examples/extensions/provider-payload.ts +18 -0
  217. package/dist/pi/examples/extensions/qna.ts +118 -0
  218. package/dist/pi/examples/extensions/question.ts +286 -0
  219. package/dist/pi/examples/extensions/questionnaire.ts +448 -0
  220. package/dist/pi/examples/extensions/rainbow-editor.ts +88 -0
  221. package/dist/pi/examples/extensions/reload-runtime.ts +49 -0
  222. package/dist/pi/examples/extensions/rpc-demo.ts +118 -0
  223. package/dist/pi/examples/extensions/send-user-message.ts +97 -0
  224. package/dist/pi/examples/extensions/session-name.ts +27 -0
  225. package/dist/pi/examples/extensions/shutdown-command.ts +63 -0
  226. package/dist/pi/examples/extensions/snake.ts +343 -0
  227. package/dist/pi/examples/extensions/space-invaders.ts +560 -0
  228. package/dist/pi/examples/extensions/ssh.ts +220 -0
  229. package/dist/pi/examples/extensions/status-line.ts +32 -0
  230. package/dist/pi/examples/extensions/structured-output.ts +65 -0
  231. package/dist/pi/examples/extensions/subagent/README.md +177 -0
  232. package/dist/pi/examples/extensions/subagent/agents/planner.md +37 -0
  233. package/dist/pi/examples/extensions/subagent/agents/reviewer.md +35 -0
  234. package/dist/pi/examples/extensions/subagent/agents/scout.md +50 -0
  235. package/dist/pi/examples/extensions/subagent/agents/worker.md +24 -0
  236. package/dist/pi/examples/extensions/subagent/agents.ts +157 -0
  237. package/dist/pi/examples/extensions/subagent/index.ts +1036 -0
  238. package/dist/pi/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  239. package/dist/pi/examples/extensions/subagent/prompts/implement.md +10 -0
  240. package/dist/pi/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  241. package/dist/pi/examples/extensions/summarize.ts +199 -0
  242. package/dist/pi/examples/extensions/system-prompt-header.ts +17 -0
  243. package/dist/pi/examples/extensions/tic-tac-toe.ts +1008 -0
  244. package/dist/pi/examples/extensions/timed-confirm.ts +70 -0
  245. package/dist/pi/examples/extensions/titlebar-spinner.ts +58 -0
  246. package/dist/pi/examples/extensions/todo.ts +304 -0
  247. package/dist/pi/examples/extensions/tool-override.ts +144 -0
  248. package/dist/pi/examples/extensions/tools.ts +148 -0
  249. package/dist/pi/examples/extensions/trigger-compact.ts +50 -0
  250. package/dist/pi/examples/extensions/truncated-tool.ts +195 -0
  251. package/dist/pi/examples/extensions/widget-placement.ts +9 -0
  252. package/dist/pi/examples/extensions/with-deps/index.ts +32 -0
  253. package/dist/pi/examples/extensions/with-deps/package-lock.json +31 -0
  254. package/dist/pi/examples/extensions/with-deps/package.json +22 -0
  255. package/dist/pi/examples/extensions/working-indicator.ts +123 -0
  256. package/dist/pi/examples/extensions/working-message-test.ts +25 -0
  257. package/dist/pi/examples/rpc-client.ts +35 -0
  258. package/dist/pi/examples/rpc-extension-ui.ts +661 -0
  259. package/dist/pi/examples/sdk/01-minimal.ts +26 -0
  260. package/dist/pi/examples/sdk/02-custom-model.ts +49 -0
  261. package/dist/pi/examples/sdk/03-custom-prompt.ts +75 -0
  262. package/dist/pi/examples/sdk/04-skills.ts +55 -0
  263. package/dist/pi/examples/sdk/05-tools.ts +48 -0
  264. package/dist/pi/examples/sdk/06-extensions.ts +99 -0
  265. package/dist/pi/examples/sdk/07-context-files.ts +47 -0
  266. package/dist/pi/examples/sdk/08-prompt-templates.ts +51 -0
  267. package/dist/pi/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  268. package/dist/pi/examples/sdk/10-settings.ts +53 -0
  269. package/dist/pi/examples/sdk/11-sessions.ts +52 -0
  270. package/dist/pi/examples/sdk/12-full-control.ts +74 -0
  271. package/dist/pi/examples/sdk/13-session-runtime.ts +67 -0
  272. package/dist/pi/examples/sdk/14-codemode-mcp.ts +61 -0
  273. package/dist/pi/examples/sdk/README.md +141 -0
  274. package/dist/pi/examples/tsconfig.json +180 -0
  275. package/dist/pi/node_modules/@silvia-odwyer/photon-node/LICENSE.md +201 -0
  276. package/dist/pi/node_modules/@silvia-odwyer/photon-node/README.md +158 -0
  277. package/dist/pi/node_modules/@silvia-odwyer/photon-node/package.json +23 -0
  278. package/dist/pi/node_modules/@silvia-odwyer/photon-node/photon_rs.d.ts +3226 -0
  279. package/dist/pi/node_modules/@silvia-odwyer/photon-node/photon_rs.js +4521 -0
  280. package/dist/pi/node_modules/@silvia-odwyer/photon-node/photon_rs_bg.js +4270 -0
  281. package/dist/pi/node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm +0 -0
  282. package/dist/pi/node_modules/jiti/LICENSE +21 -0
  283. package/dist/pi/node_modules/jiti/README.md +258 -0
  284. package/dist/pi/node_modules/jiti/dist/babel.cjs +257 -0
  285. package/dist/pi/node_modules/jiti/dist/jiti.cjs +1 -0
  286. package/dist/pi/node_modules/jiti/lib/jiti-cli.mjs +34 -0
  287. package/dist/pi/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
  288. package/dist/pi/node_modules/jiti/lib/jiti-native.mjs +121 -0
  289. package/dist/pi/node_modules/jiti/lib/jiti-register.d.mts +1 -0
  290. package/dist/pi/node_modules/jiti/lib/jiti-register.mjs +4 -0
  291. package/dist/pi/node_modules/jiti/lib/jiti-static.mjs +23 -0
  292. package/dist/pi/node_modules/jiti/lib/jiti.cjs +30 -0
  293. package/dist/pi/node_modules/jiti/lib/jiti.d.cts +8 -0
  294. package/dist/pi/node_modules/jiti/lib/jiti.d.mts +8 -0
  295. package/dist/pi/node_modules/jiti/lib/jiti.mjs +29 -0
  296. package/dist/pi/node_modules/jiti/lib/types.d.ts +420 -0
  297. package/dist/pi/node_modules/jiti/package.json +146 -0
  298. package/dist/pi/node_modules/quickjs-wasi/LICENSE +21 -0
  299. package/dist/pi/node_modules/quickjs-wasi/README.md +852 -0
  300. package/dist/pi/node_modules/quickjs-wasi/dist/extensions.d.ts +110 -0
  301. package/dist/pi/node_modules/quickjs-wasi/dist/extensions.d.ts.map +1 -0
  302. package/dist/pi/node_modules/quickjs-wasi/dist/extensions.js +372 -0
  303. package/dist/pi/node_modules/quickjs-wasi/dist/extensions.js.map +1 -0
  304. package/dist/pi/node_modules/quickjs-wasi/dist/index.d.ts +1263 -0
  305. package/dist/pi/node_modules/quickjs-wasi/dist/index.d.ts.map +1 -0
  306. package/dist/pi/node_modules/quickjs-wasi/dist/index.js +2787 -0
  307. package/dist/pi/node_modules/quickjs-wasi/dist/index.js.map +1 -0
  308. package/dist/pi/node_modules/quickjs-wasi/dist/version.d.ts +2 -0
  309. package/dist/pi/node_modules/quickjs-wasi/dist/version.d.ts.map +1 -0
  310. package/dist/pi/node_modules/quickjs-wasi/dist/version.js +3 -0
  311. package/dist/pi/node_modules/quickjs-wasi/dist/version.js.map +1 -0
  312. package/dist/pi/node_modules/quickjs-wasi/dist/wasi-shim.d.ts +61 -0
  313. package/dist/pi/node_modules/quickjs-wasi/dist/wasi-shim.d.ts.map +1 -0
  314. package/dist/pi/node_modules/quickjs-wasi/dist/wasi-shim.js +103 -0
  315. package/dist/pi/node_modules/quickjs-wasi/dist/wasi-shim.js.map +1 -0
  316. package/dist/pi/node_modules/quickjs-wasi/extensions/crypto/crypto.so +0 -0
  317. package/dist/pi/node_modules/quickjs-wasi/extensions/encoding/encoding.so +0 -0
  318. package/dist/pi/node_modules/quickjs-wasi/extensions/headers/headers.so +0 -0
  319. package/dist/pi/node_modules/quickjs-wasi/extensions/structured-clone/structured-clone.so +0 -0
  320. package/dist/pi/node_modules/quickjs-wasi/extensions/url/url.so +0 -0
  321. package/dist/pi/node_modules/quickjs-wasi/package.json +69 -0
  322. package/dist/pi/node_modules/quickjs-wasi/quickjs.wasm +0 -0
  323. package/dist/pi/package.json +9 -0
  324. package/dist/serve/index.mjs +16495 -0
  325. package/package.json +52 -4
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Send User Message Example
3
+ *
4
+ * Demonstrates pi.sendUserMessage() for sending user messages from extensions.
5
+ * Unlike pi.sendMessage() which sends custom messages, sendUserMessage() sends
6
+ * actual user messages that appear in the conversation as if typed by the user.
7
+ *
8
+ * Usage:
9
+ * /ask What is 2+2? - Sends a user message (always triggers a turn)
10
+ * /steer Focus on X - Sends while streaming with steer delivery
11
+ * /followup And then? - Sends while streaming with followUp delivery
12
+ */
13
+
14
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
15
+
16
+ export default function (pi: ExtensionAPI) {
17
+ // Simple command that sends a user message
18
+ pi.registerCommand("ask", {
19
+ description: "Send a user message to the agent",
20
+ handler: async (args, ctx) => {
21
+ if (!args.trim()) {
22
+ ctx.ui.notify("Usage: /ask <message>", "warning");
23
+ return;
24
+ }
25
+
26
+ // sendUserMessage always triggers a turn when not streaming
27
+ // If streaming, it will throw (no deliverAs specified)
28
+ if (!ctx.isIdle()) {
29
+ ctx.ui.notify("Agent is busy. Use /steer or /followup instead.", "warning");
30
+ return;
31
+ }
32
+
33
+ pi.sendUserMessage(args);
34
+ },
35
+ });
36
+
37
+ // Command that steers the agent mid-conversation
38
+ pi.registerCommand("steer", {
39
+ description: "Send a steering message (interrupts current processing)",
40
+ handler: async (args, ctx) => {
41
+ if (!args.trim()) {
42
+ ctx.ui.notify("Usage: /steer <message>", "warning");
43
+ return;
44
+ }
45
+
46
+ if (ctx.isIdle()) {
47
+ // Not streaming, just send normally
48
+ pi.sendUserMessage(args);
49
+ } else {
50
+ // Streaming - use steer to interrupt
51
+ pi.sendUserMessage(args, { deliverAs: "steer" });
52
+ }
53
+ },
54
+ });
55
+
56
+ // Command that queues a follow-up message
57
+ pi.registerCommand("followup", {
58
+ description: "Queue a follow-up message (waits for current processing)",
59
+ handler: async (args, ctx) => {
60
+ if (!args.trim()) {
61
+ ctx.ui.notify("Usage: /followup <message>", "warning");
62
+ return;
63
+ }
64
+
65
+ if (ctx.isIdle()) {
66
+ // Not streaming, just send normally
67
+ pi.sendUserMessage(args);
68
+ } else {
69
+ // Streaming - queue as follow-up
70
+ pi.sendUserMessage(args, { deliverAs: "followUp" });
71
+ ctx.ui.notify("Follow-up queued", "info");
72
+ }
73
+ },
74
+ });
75
+
76
+ // Example with content array (text + images would go here)
77
+ pi.registerCommand("askwith", {
78
+ description: "Send a user message with structured content",
79
+ handler: async (args, ctx) => {
80
+ if (!args.trim()) {
81
+ ctx.ui.notify("Usage: /askwith <message>", "warning");
82
+ return;
83
+ }
84
+
85
+ if (!ctx.isIdle()) {
86
+ ctx.ui.notify("Agent is busy", "warning");
87
+ return;
88
+ }
89
+
90
+ // sendUserMessage accepts string or (TextContent | ImageContent)[]
91
+ pi.sendUserMessage([
92
+ { type: "text", text: `User request: ${args}` },
93
+ { type: "text", text: "Please respond concisely." },
94
+ ]);
95
+ },
96
+ });
97
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Session naming example.
3
+ *
4
+ * Shows setSessionName/getSessionName to give sessions friendly names
5
+ * that appear in the session selector instead of the first message.
6
+ *
7
+ * Usage: /session-name [name] - set or show session name
8
+ */
9
+
10
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
11
+
12
+ export default function (pi: ExtensionAPI) {
13
+ pi.registerCommand("session-name", {
14
+ description: "Set or show session name (usage: /session-name [new name])",
15
+ handler: async (args, ctx) => {
16
+ const name = args.trim();
17
+
18
+ if (name) {
19
+ pi.setSessionName(name);
20
+ ctx.ui.notify(`Session named: ${name}`, "info");
21
+ } else {
22
+ const current = pi.getSessionName();
23
+ ctx.ui.notify(current ? `Session: ${current}` : "No session name set", "info");
24
+ }
25
+ },
26
+ });
27
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shutdown Command Extension
3
+ *
4
+ * Adds a /quit command that allows extensions to trigger clean shutdown.
5
+ * Demonstrates how extensions can use ctx.shutdown() to exit pi cleanly.
6
+ */
7
+
8
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
9
+ import { Type } from "typebox";
10
+
11
+ export default function (pi: ExtensionAPI) {
12
+ // Register a /quit command that cleanly exits pi
13
+ pi.registerCommand("quit", {
14
+ description: "Exit pi cleanly",
15
+ handler: async (_args, ctx) => {
16
+ ctx.shutdown();
17
+ },
18
+ });
19
+
20
+ // You can also create a tool that shuts down after completing work
21
+ pi.registerTool({
22
+ name: "finish_and_exit",
23
+ label: "Finish and Exit",
24
+ description: "Complete a task and exit pi",
25
+ parameters: Type.Object({}),
26
+ async execute(_toolCallId, _params, _signal, _onUpdate, ctx) {
27
+ // Do any final work here...
28
+ // Request graceful shutdown (deferred until agent is idle)
29
+ ctx.shutdown();
30
+
31
+ // This return is sent to the LLM before shutdown occurs
32
+ return {
33
+ content: [{ type: "text", text: "Shutdown requested. Exiting after this response." }],
34
+ details: {},
35
+ };
36
+ },
37
+ });
38
+
39
+ // You could also create a more complex tool with parameters
40
+ pi.registerTool({
41
+ name: "deploy_and_exit",
42
+ label: "Deploy and Exit",
43
+ description: "Deploy the application and exit pi",
44
+ parameters: Type.Object({
45
+ environment: Type.String({ description: "Target environment (e.g., production, staging)" }),
46
+ }),
47
+ async execute(_toolCallId, params, _signal, onUpdate, ctx) {
48
+ onUpdate?.({ content: [{ type: "text", text: `Deploying to ${params.environment}...` }], details: {} });
49
+
50
+ // Example deployment logic
51
+ // const result = await pi.exec("npm", ["run", "deploy", params.environment], { signal });
52
+
53
+ // On success, request graceful shutdown
54
+ onUpdate?.({ content: [{ type: "text", text: "Deployment complete, exiting..." }], details: {} });
55
+ ctx.shutdown();
56
+
57
+ return {
58
+ content: [{ type: "text", text: "Done! Shutdown requested." }],
59
+ details: { environment: params.environment },
60
+ };
61
+ },
62
+ });
63
+ }
@@ -0,0 +1,343 @@
1
+ /**
2
+ * Snake game extension - play snake with /snake command
3
+ */
4
+
5
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
6
+ import { matchesKey, visibleWidth } from "@earendil-works/pi-tui";
7
+
8
+ const GAME_WIDTH = 40;
9
+ const GAME_HEIGHT = 15;
10
+ const TICK_MS = 100;
11
+
12
+ type Direction = "up" | "down" | "left" | "right";
13
+ type Point = { x: number; y: number };
14
+
15
+ interface GameState {
16
+ snake: Point[];
17
+ food: Point;
18
+ direction: Direction;
19
+ nextDirection: Direction;
20
+ score: number;
21
+ gameOver: boolean;
22
+ highScore: number;
23
+ }
24
+
25
+ function createInitialState(): GameState {
26
+ const startX = Math.floor(GAME_WIDTH / 2);
27
+ const startY = Math.floor(GAME_HEIGHT / 2);
28
+ return {
29
+ snake: [
30
+ { x: startX, y: startY },
31
+ { x: startX - 1, y: startY },
32
+ { x: startX - 2, y: startY },
33
+ ],
34
+ food: spawnFood([{ x: startX, y: startY }]),
35
+ direction: "right",
36
+ nextDirection: "right",
37
+ score: 0,
38
+ gameOver: false,
39
+ highScore: 0,
40
+ };
41
+ }
42
+
43
+ function spawnFood(snake: Point[]): Point {
44
+ let food: Point;
45
+ do {
46
+ food = {
47
+ x: Math.floor(Math.random() * GAME_WIDTH),
48
+ y: Math.floor(Math.random() * GAME_HEIGHT),
49
+ };
50
+ } while (snake.some((s) => s.x === food.x && s.y === food.y));
51
+ return food;
52
+ }
53
+
54
+ class SnakeComponent {
55
+ private state: GameState;
56
+ private interval: ReturnType<typeof setInterval> | null = null;
57
+ private onClose: () => void;
58
+ private onSave: (state: GameState | null) => void;
59
+ private tui: { requestRender: () => void };
60
+ private cachedLines: string[] = [];
61
+ private cachedWidth = 0;
62
+ private version = 0;
63
+ private cachedVersion = -1;
64
+ private paused: boolean;
65
+
66
+ constructor(
67
+ tui: { requestRender: () => void },
68
+ onClose: () => void,
69
+ onSave: (state: GameState | null) => void,
70
+ savedState?: GameState,
71
+ ) {
72
+ this.tui = tui;
73
+ if (savedState && !savedState.gameOver) {
74
+ // Resume from saved state, start paused
75
+ this.state = savedState;
76
+ this.paused = true;
77
+ } else {
78
+ // New game or saved game was over
79
+ this.state = createInitialState();
80
+ if (savedState) {
81
+ this.state.highScore = savedState.highScore;
82
+ }
83
+ this.paused = false;
84
+ this.startGame();
85
+ }
86
+ this.onClose = onClose;
87
+ this.onSave = onSave;
88
+ }
89
+
90
+ private startGame(): void {
91
+ this.interval = setInterval(() => {
92
+ if (!this.state.gameOver) {
93
+ this.tick();
94
+ this.version++;
95
+ this.tui.requestRender();
96
+ }
97
+ }, TICK_MS);
98
+ }
99
+
100
+ private tick(): void {
101
+ // Apply queued direction change
102
+ this.state.direction = this.state.nextDirection;
103
+
104
+ // Calculate new head position
105
+ const head = this.state.snake[0];
106
+ let newHead: Point;
107
+
108
+ switch (this.state.direction) {
109
+ case "up":
110
+ newHead = { x: head.x, y: head.y - 1 };
111
+ break;
112
+ case "down":
113
+ newHead = { x: head.x, y: head.y + 1 };
114
+ break;
115
+ case "left":
116
+ newHead = { x: head.x - 1, y: head.y };
117
+ break;
118
+ case "right":
119
+ newHead = { x: head.x + 1, y: head.y };
120
+ break;
121
+ }
122
+
123
+ // Check wall collision
124
+ if (newHead.x < 0 || newHead.x >= GAME_WIDTH || newHead.y < 0 || newHead.y >= GAME_HEIGHT) {
125
+ this.state.gameOver = true;
126
+ return;
127
+ }
128
+
129
+ // Check self collision
130
+ if (this.state.snake.some((s) => s.x === newHead.x && s.y === newHead.y)) {
131
+ this.state.gameOver = true;
132
+ return;
133
+ }
134
+
135
+ // Move snake
136
+ this.state.snake.unshift(newHead);
137
+
138
+ // Check food collision
139
+ if (newHead.x === this.state.food.x && newHead.y === this.state.food.y) {
140
+ this.state.score += 10;
141
+ if (this.state.score > this.state.highScore) {
142
+ this.state.highScore = this.state.score;
143
+ }
144
+ this.state.food = spawnFood(this.state.snake);
145
+ } else {
146
+ this.state.snake.pop();
147
+ }
148
+ }
149
+
150
+ handleInput(data: string): void {
151
+ // If paused (resuming), wait for any key
152
+ if (this.paused) {
153
+ if (matchesKey(data, "escape") || data === "q" || data === "Q") {
154
+ // Quit without clearing save
155
+ this.dispose();
156
+ this.onClose();
157
+ return;
158
+ }
159
+ // Any other key resumes
160
+ this.paused = false;
161
+ this.startGame();
162
+ return;
163
+ }
164
+
165
+ // ESC to pause and save
166
+ if (matchesKey(data, "escape")) {
167
+ this.dispose();
168
+ this.onSave(this.state);
169
+ this.onClose();
170
+ return;
171
+ }
172
+
173
+ // Q to quit without saving (clears saved state)
174
+ if (data === "q" || data === "Q") {
175
+ this.dispose();
176
+ this.onSave(null); // Clear saved state
177
+ this.onClose();
178
+ return;
179
+ }
180
+
181
+ // Arrow keys or WASD
182
+ if (matchesKey(data, "up") || data === "w" || data === "W") {
183
+ if (this.state.direction !== "down") this.state.nextDirection = "up";
184
+ } else if (matchesKey(data, "down") || data === "s" || data === "S") {
185
+ if (this.state.direction !== "up") this.state.nextDirection = "down";
186
+ } else if (matchesKey(data, "right") || data === "d" || data === "D") {
187
+ if (this.state.direction !== "left") this.state.nextDirection = "right";
188
+ } else if (matchesKey(data, "left") || data === "a" || data === "A") {
189
+ if (this.state.direction !== "right") this.state.nextDirection = "left";
190
+ }
191
+
192
+ // Restart on game over
193
+ if (this.state.gameOver && (data === "r" || data === "R" || data === " ")) {
194
+ const highScore = this.state.highScore;
195
+ this.state = createInitialState();
196
+ this.state.highScore = highScore;
197
+ this.onSave(null); // Clear saved state on restart
198
+ this.version++;
199
+ this.tui.requestRender();
200
+ }
201
+ }
202
+
203
+ invalidate(): void {
204
+ this.cachedWidth = 0;
205
+ }
206
+
207
+ render(width: number): string[] {
208
+ if (width === this.cachedWidth && this.cachedVersion === this.version) {
209
+ return this.cachedLines;
210
+ }
211
+
212
+ const lines: string[] = [];
213
+
214
+ // Each game cell is 2 chars wide to appear square (terminal cells are ~2:1 aspect)
215
+ const cellWidth = 2;
216
+ const effectiveWidth = Math.min(GAME_WIDTH, Math.floor((width - 4) / cellWidth));
217
+ const effectiveHeight = GAME_HEIGHT;
218
+
219
+ // Colors
220
+ const dim = (s: string) => `\x1b[2m${s}\x1b[22m`;
221
+ const green = (s: string) => `\x1b[32m${s}\x1b[0m`;
222
+ const red = (s: string) => `\x1b[31m${s}\x1b[0m`;
223
+ const yellow = (s: string) => `\x1b[33m${s}\x1b[0m`;
224
+ const bold = (s: string) => `\x1b[1m${s}\x1b[22m`;
225
+
226
+ const boxWidth = effectiveWidth * cellWidth;
227
+
228
+ // Helper to pad content inside box
229
+ const boxLine = (content: string) => {
230
+ const contentLen = visibleWidth(content);
231
+ const padding = Math.max(0, boxWidth - contentLen);
232
+ return dim(" │") + content + " ".repeat(padding) + dim("│");
233
+ };
234
+
235
+ // Top border
236
+ lines.push(this.padLine(dim(` ╭${"─".repeat(boxWidth)}╮`), width));
237
+
238
+ // Header with score
239
+ const scoreText = `Score: ${bold(yellow(String(this.state.score)))}`;
240
+ const highText = `High: ${bold(yellow(String(this.state.highScore)))}`;
241
+ const title = `${bold(green("SNAKE"))} │ ${scoreText} │ ${highText}`;
242
+ lines.push(this.padLine(boxLine(title), width));
243
+
244
+ // Separator
245
+ lines.push(this.padLine(dim(` ├${"─".repeat(boxWidth)}┤`), width));
246
+
247
+ // Game grid
248
+ for (let y = 0; y < effectiveHeight; y++) {
249
+ let row = "";
250
+ for (let x = 0; x < effectiveWidth; x++) {
251
+ const isHead = this.state.snake[0].x === x && this.state.snake[0].y === y;
252
+ const isBody = this.state.snake.slice(1).some((s) => s.x === x && s.y === y);
253
+ const isFood = this.state.food.x === x && this.state.food.y === y;
254
+
255
+ if (isHead) {
256
+ row += green("██"); // Snake head (2 chars)
257
+ } else if (isBody) {
258
+ row += green("▓▓"); // Snake body (2 chars)
259
+ } else if (isFood) {
260
+ row += red("◆ "); // Food (2 chars)
261
+ } else {
262
+ row += " "; // Empty cell (2 spaces)
263
+ }
264
+ }
265
+ lines.push(this.padLine(dim(" │") + row + dim("│"), width));
266
+ }
267
+
268
+ // Separator
269
+ lines.push(this.padLine(dim(` ├${"─".repeat(boxWidth)}┤`), width));
270
+
271
+ // Footer
272
+ let footer: string;
273
+ if (this.paused) {
274
+ footer = `${yellow(bold("PAUSED"))} Press any key to continue, ${bold("Q")} to quit`;
275
+ } else if (this.state.gameOver) {
276
+ footer = `${red(bold("GAME OVER!"))} Press ${bold("R")} to restart, ${bold("Q")} to quit`;
277
+ } else {
278
+ footer = `↑↓←→ or WASD to move, ${bold("ESC")} pause, ${bold("Q")} quit`;
279
+ }
280
+ lines.push(this.padLine(boxLine(footer), width));
281
+
282
+ // Bottom border
283
+ lines.push(this.padLine(dim(` ╰${"─".repeat(boxWidth)}╯`), width));
284
+
285
+ this.cachedLines = lines;
286
+ this.cachedWidth = width;
287
+ this.cachedVersion = this.version;
288
+
289
+ return lines;
290
+ }
291
+
292
+ private padLine(line: string, width: number): string {
293
+ // Calculate visible length (strip ANSI codes)
294
+ const visibleLen = line.replace(/\x1b\[[0-9;]*m/g, "").length;
295
+ const padding = Math.max(0, width - visibleLen);
296
+ return line + " ".repeat(padding);
297
+ }
298
+
299
+ dispose(): void {
300
+ if (this.interval) {
301
+ clearInterval(this.interval);
302
+ this.interval = null;
303
+ }
304
+ }
305
+ }
306
+
307
+ const SNAKE_SAVE_TYPE = "snake-save";
308
+
309
+ export default function (pi: ExtensionAPI) {
310
+ pi.registerCommand("snake", {
311
+ description: "Play Snake!",
312
+
313
+ handler: async (_args, ctx) => {
314
+ if (ctx.mode !== "tui") {
315
+ ctx.ui.notify("Snake requires interactive mode", "error");
316
+ return;
317
+ }
318
+
319
+ // Load saved state from session
320
+ const entries = ctx.sessionManager.getEntries();
321
+ let savedState: GameState | undefined;
322
+ for (let i = entries.length - 1; i >= 0; i--) {
323
+ const entry = entries[i];
324
+ if (entry.type === "custom" && entry.customType === SNAKE_SAVE_TYPE) {
325
+ savedState = entry.data as GameState;
326
+ break;
327
+ }
328
+ }
329
+
330
+ await ctx.ui.custom((tui, _theme, _kb, done) => {
331
+ return new SnakeComponent(
332
+ tui,
333
+ () => done(undefined),
334
+ (state) => {
335
+ // Save or clear state
336
+ pi.appendEntry(SNAKE_SAVE_TYPE, state);
337
+ },
338
+ savedState,
339
+ );
340
+ });
341
+ },
342
+ });
343
+ }