pi-ui-extend 0.1.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 (420) hide show
  1. package/README.md +307 -0
  2. package/bin/pix.mjs +219 -0
  3. package/dist/app/app.d.ts +96 -0
  4. package/dist/app/app.js +871 -0
  5. package/dist/app/blink-controller.d.ts +23 -0
  6. package/dist/app/blink-controller.js +82 -0
  7. package/dist/app/cli.d.ts +8 -0
  8. package/dist/app/cli.js +83 -0
  9. package/dist/app/clipboard.d.ts +1 -0
  10. package/dist/app/clipboard.js +24 -0
  11. package/dist/app/command-controller.d.ts +18 -0
  12. package/dist/app/command-controller.js +58 -0
  13. package/dist/app/command-host.d.ts +44 -0
  14. package/dist/app/command-host.js +1 -0
  15. package/dist/app/command-model-actions.d.ts +12 -0
  16. package/dist/app/command-model-actions.js +176 -0
  17. package/dist/app/command-navigation-actions.d.ts +19 -0
  18. package/dist/app/command-navigation-actions.js +267 -0
  19. package/dist/app/command-registry.d.ts +32 -0
  20. package/dist/app/command-registry.js +225 -0
  21. package/dist/app/command-runtime.d.ts +5 -0
  22. package/dist/app/command-runtime.js +32 -0
  23. package/dist/app/command-session-actions.d.ts +20 -0
  24. package/dist/app/command-session-actions.js +295 -0
  25. package/dist/app/constants.d.ts +52 -0
  26. package/dist/app/constants.js +103 -0
  27. package/dist/app/conversation-entry-renderer.d.ts +21 -0
  28. package/dist/app/conversation-entry-renderer.js +81 -0
  29. package/dist/app/conversation-shell-renderer.d.ts +5 -0
  30. package/dist/app/conversation-shell-renderer.js +43 -0
  31. package/dist/app/conversation-tool-renderer.d.ts +16 -0
  32. package/dist/app/conversation-tool-renderer.js +216 -0
  33. package/dist/app/conversation-viewport.d.ts +55 -0
  34. package/dist/app/conversation-viewport.js +252 -0
  35. package/dist/app/dcp-stats.d.ts +2 -0
  36. package/dist/app/dcp-stats.js +116 -0
  37. package/dist/app/editor-layout-renderer.d.ts +31 -0
  38. package/dist/app/editor-layout-renderer.js +211 -0
  39. package/dist/app/editor-panels.d.ts +4 -0
  40. package/dist/app/editor-panels.js +130 -0
  41. package/dist/app/extension-actions-controller.d.ts +22 -0
  42. package/dist/app/extension-actions-controller.js +60 -0
  43. package/dist/app/extension-event-bus.d.ts +3 -0
  44. package/dist/app/extension-event-bus.js +23 -0
  45. package/dist/app/extension-ui-controller.d.ts +57 -0
  46. package/dist/app/extension-ui-controller.js +532 -0
  47. package/dist/app/file-link-opener.d.ts +2 -0
  48. package/dist/app/file-link-opener.js +66 -0
  49. package/dist/app/file-links.d.ts +10 -0
  50. package/dist/app/file-links.js +117 -0
  51. package/dist/app/guards.d.ts +3 -0
  52. package/dist/app/guards.js +9 -0
  53. package/dist/app/icons.d.ts +37 -0
  54. package/dist/app/icons.js +97 -0
  55. package/dist/app/id.d.ts +1 -0
  56. package/dist/app/id.js +4 -0
  57. package/dist/app/image-click-targets.d.ts +5 -0
  58. package/dist/app/image-click-targets.js +32 -0
  59. package/dist/app/image-opener.d.ts +2 -0
  60. package/dist/app/image-opener.js +64 -0
  61. package/dist/app/input-action-controller.d.ts +47 -0
  62. package/dist/app/input-action-controller.js +209 -0
  63. package/dist/app/input-controller.d.ts +60 -0
  64. package/dist/app/input-controller.js +425 -0
  65. package/dist/app/input-paste-handler.d.ts +27 -0
  66. package/dist/app/input-paste-handler.js +146 -0
  67. package/dist/app/menu-items-controller.d.ts +32 -0
  68. package/dist/app/menu-items-controller.js +182 -0
  69. package/dist/app/message-content.d.ts +8 -0
  70. package/dist/app/message-content.js +115 -0
  71. package/dist/app/model-ref.d.ts +13 -0
  72. package/dist/app/model-ref.js +50 -0
  73. package/dist/app/model-usage-controller.d.ts +35 -0
  74. package/dist/app/model-usage-controller.js +99 -0
  75. package/dist/app/model-usage-status.d.ts +125 -0
  76. package/dist/app/model-usage-status.js +749 -0
  77. package/dist/app/mouse-controller.d.ts +182 -0
  78. package/dist/app/mouse-controller.js +968 -0
  79. package/dist/app/native-modifiers.d.ts +3 -0
  80. package/dist/app/native-modifiers.js +60 -0
  81. package/dist/app/nerd-font-controller.d.ts +11 -0
  82. package/dist/app/nerd-font-controller.js +90 -0
  83. package/dist/app/popup-action-controller.d.ts +44 -0
  84. package/dist/app/popup-action-controller.js +278 -0
  85. package/dist/app/popup-menu-controller.d.ts +183 -0
  86. package/dist/app/popup-menu-controller.js +1070 -0
  87. package/dist/app/prompt-enhancer-controller.d.ts +40 -0
  88. package/dist/app/prompt-enhancer-controller.js +215 -0
  89. package/dist/app/queued-message-controller.d.ts +62 -0
  90. package/dist/app/queued-message-controller.js +377 -0
  91. package/dist/app/render-controller.d.ts +41 -0
  92. package/dist/app/render-controller.js +378 -0
  93. package/dist/app/render-text.d.ts +19 -0
  94. package/dist/app/render-text.js +67 -0
  95. package/dist/app/request-history.d.ts +23 -0
  96. package/dist/app/request-history.js +131 -0
  97. package/dist/app/runtime.d.ts +39 -0
  98. package/dist/app/runtime.js +195 -0
  99. package/dist/app/screen-selection.d.ts +6 -0
  100. package/dist/app/screen-selection.js +9 -0
  101. package/dist/app/screen-styler.d.ts +34 -0
  102. package/dist/app/screen-styler.js +168 -0
  103. package/dist/app/scroll-controller.d.ts +51 -0
  104. package/dist/app/scroll-controller.js +207 -0
  105. package/dist/app/session-event-controller.d.ts +69 -0
  106. package/dist/app/session-event-controller.js +338 -0
  107. package/dist/app/session-history.d.ts +23 -0
  108. package/dist/app/session-history.js +164 -0
  109. package/dist/app/session-lifecycle-controller.d.ts +55 -0
  110. package/dist/app/session-lifecycle-controller.js +116 -0
  111. package/dist/app/session-search.d.ts +24 -0
  112. package/dist/app/session-search.js +215 -0
  113. package/dist/app/shell-command.d.ts +27 -0
  114. package/dist/app/shell-command.js +176 -0
  115. package/dist/app/shell-controller.d.ts +28 -0
  116. package/dist/app/shell-controller.js +124 -0
  117. package/dist/app/slash-commands.d.ts +6 -0
  118. package/dist/app/slash-commands.js +75 -0
  119. package/dist/app/startup-checks.d.ts +8 -0
  120. package/dist/app/startup-checks.js +59 -0
  121. package/dist/app/startup-info.d.ts +3 -0
  122. package/dist/app/startup-info.js +176 -0
  123. package/dist/app/status-controller.d.ts +35 -0
  124. package/dist/app/status-controller.js +105 -0
  125. package/dist/app/status-line-renderer.d.ts +68 -0
  126. package/dist/app/status-line-renderer.js +453 -0
  127. package/dist/app/subagents-files.d.ts +10 -0
  128. package/dist/app/subagents-files.js +193 -0
  129. package/dist/app/subagents-model.d.ts +23 -0
  130. package/dist/app/subagents-model.js +224 -0
  131. package/dist/app/subagents-widget-controller.d.ts +43 -0
  132. package/dist/app/subagents-widget-controller.js +311 -0
  133. package/dist/app/tab-line-renderer.d.ts +26 -0
  134. package/dist/app/tab-line-renderer.js +222 -0
  135. package/dist/app/tabs-controller.d.ts +100 -0
  136. package/dist/app/tabs-controller.js +885 -0
  137. package/dist/app/terminal-controller.d.ts +40 -0
  138. package/dist/app/terminal-controller.js +135 -0
  139. package/dist/app/terminal-edit-shortcuts.d.ts +23 -0
  140. package/dist/app/terminal-edit-shortcuts.js +138 -0
  141. package/dist/app/terminal-output-buffer.d.ts +20 -0
  142. package/dist/app/terminal-output-buffer.js +52 -0
  143. package/dist/app/toast-controller.d.ts +13 -0
  144. package/dist/app/toast-controller.js +40 -0
  145. package/dist/app/toast-renderer.d.ts +9 -0
  146. package/dist/app/toast-renderer.js +79 -0
  147. package/dist/app/todo-model.d.ts +22 -0
  148. package/dist/app/todo-model.js +179 -0
  149. package/dist/app/todo-widget-controller.d.ts +21 -0
  150. package/dist/app/todo-widget-controller.js +59 -0
  151. package/dist/app/tool-block-renderer.d.ts +26 -0
  152. package/dist/app/tool-block-renderer.js +439 -0
  153. package/dist/app/types.d.ts +550 -0
  154. package/dist/app/types.js +1 -0
  155. package/dist/app/update.d.ts +36 -0
  156. package/dist/app/update.js +315 -0
  157. package/dist/app/voice-controller.d.ts +52 -0
  158. package/dist/app/voice-controller.js +600 -0
  159. package/dist/app/workspace-actions-controller.d.ts +40 -0
  160. package/dist/app/workspace-actions-controller.js +215 -0
  161. package/dist/app/workspace-undo.d.ts +44 -0
  162. package/dist/app/workspace-undo.js +215 -0
  163. package/dist/config.d.ts +62 -0
  164. package/dist/config.js +527 -0
  165. package/dist/context-progress-bar.d.ts +17 -0
  166. package/dist/context-progress-bar.js +48 -0
  167. package/dist/default-pix-config.d.ts +1 -0
  168. package/dist/default-pix-config.js +375 -0
  169. package/dist/fuzzy.d.ts +23 -0
  170. package/dist/fuzzy.js +165 -0
  171. package/dist/input-editor-files.d.ts +15 -0
  172. package/dist/input-editor-files.js +62 -0
  173. package/dist/input-editor.d.ts +186 -0
  174. package/dist/input-editor.js +835 -0
  175. package/dist/main.d.ts +1 -0
  176. package/dist/main.js +12 -0
  177. package/dist/markdown-format.d.ts +22 -0
  178. package/dist/markdown-format.js +542 -0
  179. package/dist/sdk.d.ts +3 -0
  180. package/dist/sdk.js +1 -0
  181. package/dist/syntax-highlight.d.ts +22 -0
  182. package/dist/syntax-highlight.js +528 -0
  183. package/dist/terminal-width.d.ts +6 -0
  184. package/dist/terminal-width.js +245 -0
  185. package/dist/theme.d.ts +56 -0
  186. package/dist/theme.js +118 -0
  187. package/dist/tool-renderers/apply-patch.d.ts +2 -0
  188. package/dist/tool-renderers/apply-patch.js +36 -0
  189. package/dist/tool-renderers/ast.d.ts +2 -0
  190. package/dist/tool-renderers/ast.js +5 -0
  191. package/dist/tool-renderers/compress.d.ts +2 -0
  192. package/dist/tool-renderers/compress.js +126 -0
  193. package/dist/tool-renderers/index.d.ts +3 -0
  194. package/dist/tool-renderers/index.js +44 -0
  195. package/dist/tool-renderers/question.d.ts +2 -0
  196. package/dist/tool-renderers/question.js +88 -0
  197. package/dist/tool-renderers/read.d.ts +2 -0
  198. package/dist/tool-renderers/read.js +36 -0
  199. package/dist/tool-renderers/repo.d.ts +2 -0
  200. package/dist/tool-renderers/repo.js +13 -0
  201. package/dist/tool-renderers/shell.d.ts +3 -0
  202. package/dist/tool-renderers/shell.js +27 -0
  203. package/dist/tool-renderers/skill.d.ts +2 -0
  204. package/dist/tool-renderers/skill.js +132 -0
  205. package/dist/tool-renderers/subagents.d.ts +2 -0
  206. package/dist/tool-renderers/subagents.js +51 -0
  207. package/dist/tool-renderers/todo.d.ts +2 -0
  208. package/dist/tool-renderers/todo.js +9 -0
  209. package/dist/tool-renderers/types.d.ts +42 -0
  210. package/dist/tool-renderers/types.js +1 -0
  211. package/dist/tool-renderers/utils.d.ts +31 -0
  212. package/dist/tool-renderers/utils.js +230 -0
  213. package/dist/tool-renderers/web.d.ts +3 -0
  214. package/dist/tool-renderers/web.js +9 -0
  215. package/dist/tool-renderers/write.d.ts +2 -0
  216. package/dist/tool-renderers/write.js +42 -0
  217. package/dist/ui.d.ts +56 -0
  218. package/dist/ui.js +94 -0
  219. package/docs/release.md +81 -0
  220. package/extensions/question/contract.ts +100 -0
  221. package/extensions/question/index.ts +34 -0
  222. package/extensions/question/render.ts +28 -0
  223. package/extensions/question/result.ts +86 -0
  224. package/extensions/question/tool-description.ts +11 -0
  225. package/extensions/question/tui.ts +629 -0
  226. package/extensions/question/types.ts +123 -0
  227. package/extensions/session-title/config.ts +169 -0
  228. package/extensions/session-title/index.ts +459 -0
  229. package/extensions/terminal-bell/index.ts +315 -0
  230. package/external/pi-tools-suite/README.md +242 -0
  231. package/external/pi-tools-suite/index.ts +1 -0
  232. package/external/pi-tools-suite/licenses/ollama-pi-web-search.MIT +21 -0
  233. package/external/pi-tools-suite/licenses/opencode-mystatus-MIT.txt +21 -0
  234. package/external/pi-tools-suite/package.json +53 -0
  235. package/external/pi-tools-suite/src/antigravity-auth/auth-store.ts +194 -0
  236. package/external/pi-tools-suite/src/antigravity-auth/commands.ts +80 -0
  237. package/external/pi-tools-suite/src/antigravity-auth/constants.ts +26 -0
  238. package/external/pi-tools-suite/src/antigravity-auth/headers.ts +20 -0
  239. package/external/pi-tools-suite/src/antigravity-auth/index.ts +104 -0
  240. package/external/pi-tools-suite/src/antigravity-auth/models.ts +86 -0
  241. package/external/pi-tools-suite/src/antigravity-auth/oauth.ts +305 -0
  242. package/external/pi-tools-suite/src/antigravity-auth/payload.ts +423 -0
  243. package/external/pi-tools-suite/src/antigravity-auth/status.ts +78 -0
  244. package/external/pi-tools-suite/src/antigravity-auth/stream.ts +302 -0
  245. package/external/pi-tools-suite/src/antigravity-auth/types.ts +113 -0
  246. package/external/pi-tools-suite/src/ast-grep/index.ts +6 -0
  247. package/external/pi-tools-suite/src/ast-grep/render.ts +70 -0
  248. package/external/pi-tools-suite/src/ast-grep/schema.ts +109 -0
  249. package/external/pi-tools-suite/src/ast-grep/tool.ts +345 -0
  250. package/external/pi-tools-suite/src/ast-grep/types.ts +55 -0
  251. package/external/pi-tools-suite/src/ast-grep/utils.ts +65 -0
  252. package/external/pi-tools-suite/src/async-subagents/async-subagents.sample.jsonc +222 -0
  253. package/external/pi-tools-suite/src/async-subagents/commands.ts +518 -0
  254. package/external/pi-tools-suite/src/async-subagents/constants.ts +11 -0
  255. package/external/pi-tools-suite/src/async-subagents/core/agent-strategy.ts +74 -0
  256. package/external/pi-tools-suite/src/async-subagents/core/attachment-bridge.ts +133 -0
  257. package/external/pi-tools-suite/src/async-subagents/core/cleanup.ts +66 -0
  258. package/external/pi-tools-suite/src/async-subagents/core/concurrency.ts +90 -0
  259. package/external/pi-tools-suite/src/async-subagents/core/config.ts +819 -0
  260. package/external/pi-tools-suite/src/async-subagents/core/log-limits.ts +166 -0
  261. package/external/pi-tools-suite/src/async-subagents/core/model-fallback.ts +133 -0
  262. package/external/pi-tools-suite/src/async-subagents/core/paths.ts +47 -0
  263. package/external/pi-tools-suite/src/async-subagents/core/pi-invocation.ts +35 -0
  264. package/external/pi-tools-suite/src/async-subagents/core/presets.ts +67 -0
  265. package/external/pi-tools-suite/src/async-subagents/core/process.ts +15 -0
  266. package/external/pi-tools-suite/src/async-subagents/core/prompt.ts +66 -0
  267. package/external/pi-tools-suite/src/async-subagents/core/registry.ts +224 -0
  268. package/external/pi-tools-suite/src/async-subagents/core/retry.ts +191 -0
  269. package/external/pi-tools-suite/src/async-subagents/core/routing.ts +259 -0
  270. package/external/pi-tools-suite/src/async-subagents/core/sessions.ts +138 -0
  271. package/external/pi-tools-suite/src/async-subagents/core/spawn.ts +688 -0
  272. package/external/pi-tools-suite/src/async-subagents/core/state.ts +281 -0
  273. package/external/pi-tools-suite/src/async-subagents/core/stop.ts +131 -0
  274. package/external/pi-tools-suite/src/async-subagents/core/structured-result.ts +237 -0
  275. package/external/pi-tools-suite/src/async-subagents/core/tool-guard.ts +34 -0
  276. package/external/pi-tools-suite/src/async-subagents/core/types.ts +150 -0
  277. package/external/pi-tools-suite/src/async-subagents/core/ultrawork-auto.ts +184 -0
  278. package/external/pi-tools-suite/src/async-subagents/core/utils.ts +11 -0
  279. package/external/pi-tools-suite/src/async-subagents/format.ts +41 -0
  280. package/external/pi-tools-suite/src/async-subagents/index.ts +422 -0
  281. package/external/pi-tools-suite/src/async-subagents/lib.ts +88 -0
  282. package/external/pi-tools-suite/src/async-subagents/live.ts +10 -0
  283. package/external/pi-tools-suite/src/async-subagents/polling.ts +83 -0
  284. package/external/pi-tools-suite/src/async-subagents/render.ts +230 -0
  285. package/external/pi-tools-suite/src/async-subagents/subagent-overlay.ts +77 -0
  286. package/external/pi-tools-suite/src/async-subagents/tasks.ts +120 -0
  287. package/external/pi-tools-suite/src/async-subagents/tools/cleanup.ts +99 -0
  288. package/external/pi-tools-suite/src/async-subagents/tools/result.ts +179 -0
  289. package/external/pi-tools-suite/src/async-subagents/tools/spawn.ts +372 -0
  290. package/external/pi-tools-suite/src/async-subagents/tools/status.ts +60 -0
  291. package/external/pi-tools-suite/src/async-subagents/tools/stop.ts +79 -0
  292. package/external/pi-tools-suite/src/async-subagents/tools/subagents.ts +152 -0
  293. package/external/pi-tools-suite/src/async-subagents/tools/wait.ts +67 -0
  294. package/external/pi-tools-suite/src/async-subagents/types.ts +45 -0
  295. package/external/pi-tools-suite/src/async-subagents/ui.ts +5 -0
  296. package/external/pi-tools-suite/src/compress/commands.ts +440 -0
  297. package/external/pi-tools-suite/src/compress/compress-tool.ts +368 -0
  298. package/external/pi-tools-suite/src/compress/compression-blocks.ts +524 -0
  299. package/external/pi-tools-suite/src/compress/config.ts +310 -0
  300. package/external/pi-tools-suite/src/compress/dcp-tui-filter.ts +498 -0
  301. package/external/pi-tools-suite/src/compress/index.ts +397 -0
  302. package/external/pi-tools-suite/src/compress/prompts.ts +269 -0
  303. package/external/pi-tools-suite/src/compress/pruner-candidates.ts +176 -0
  304. package/external/pi-tools-suite/src/compress/pruner-compression-blocks.ts +260 -0
  305. package/external/pi-tools-suite/src/compress/pruner-message-ids.ts +147 -0
  306. package/external/pi-tools-suite/src/compress/pruner-metadata.ts +268 -0
  307. package/external/pi-tools-suite/src/compress/pruner-nudge.ts +315 -0
  308. package/external/pi-tools-suite/src/compress/pruner-tools.ts +263 -0
  309. package/external/pi-tools-suite/src/compress/pruner-types.ts +25 -0
  310. package/external/pi-tools-suite/src/compress/pruner.ts +92 -0
  311. package/external/pi-tools-suite/src/compress/state.ts +486 -0
  312. package/external/pi-tools-suite/src/compress/ui.ts +308 -0
  313. package/external/pi-tools-suite/src/config.ts +176 -0
  314. package/external/pi-tools-suite/src/context-usage.ts +31 -0
  315. package/external/pi-tools-suite/src/default-pi-tools-suite-config.ts +355 -0
  316. package/external/pi-tools-suite/src/index.ts +46 -0
  317. package/external/pi-tools-suite/src/lib/lsp.ts +62 -0
  318. package/external/pi-tools-suite/src/lib/project.ts +42 -0
  319. package/external/pi-tools-suite/src/lib/tool-args.ts +137 -0
  320. package/external/pi-tools-suite/src/lsp/_shared/config.ts +156 -0
  321. package/external/pi-tools-suite/src/lsp/_shared/glob.ts +60 -0
  322. package/external/pi-tools-suite/src/lsp/_shared/output.ts +102 -0
  323. package/external/pi-tools-suite/src/lsp/_shared/paths.ts +138 -0
  324. package/external/pi-tools-suite/src/lsp/_shared/runner.ts +64 -0
  325. package/external/pi-tools-suite/src/lsp/_shared/template.ts +23 -0
  326. package/external/pi-tools-suite/src/lsp/_shared/trust.ts +116 -0
  327. package/external/pi-tools-suite/src/lsp/_shared/types.ts +98 -0
  328. package/external/pi-tools-suite/src/lsp/async.ts +29 -0
  329. package/external/pi-tools-suite/src/lsp/child-process.ts +81 -0
  330. package/external/pi-tools-suite/src/lsp/client.ts +340 -0
  331. package/external/pi-tools-suite/src/lsp/constants.ts +9 -0
  332. package/external/pi-tools-suite/src/lsp/diagnostics-store.ts +64 -0
  333. package/external/pi-tools-suite/src/lsp/documents.ts +24 -0
  334. package/external/pi-tools-suite/src/lsp/index.ts +31 -0
  335. package/external/pi-tools-suite/src/lsp/lsp-utils.ts +37 -0
  336. package/external/pi-tools-suite/src/lsp/manager.ts +190 -0
  337. package/external/pi-tools-suite/src/lsp/mutation-events.ts +78 -0
  338. package/external/pi-tools-suite/src/lsp/renderer.ts +1 -0
  339. package/external/pi-tools-suite/src/lsp/tool-result.ts +6 -0
  340. package/external/pi-tools-suite/src/lsp/tsserver.ts +107 -0
  341. package/external/pi-tools-suite/src/lsp/types.ts +15 -0
  342. package/external/pi-tools-suite/src/model-tools/apply-patch.ts +590 -0
  343. package/external/pi-tools-suite/src/model-tools/index.ts +430 -0
  344. package/external/pi-tools-suite/src/model-tools/path-utils.ts +6 -0
  345. package/external/pi-tools-suite/src/model-tools/tool-args.ts +11 -0
  346. package/external/pi-tools-suite/src/prompt-commands/index.ts +349 -0
  347. package/external/pi-tools-suite/src/repo-discovery/index.ts +384 -0
  348. package/external/pi-tools-suite/src/repo-discovery/project.ts +7 -0
  349. package/external/pi-tools-suite/src/startup-section.ts +13 -0
  350. package/external/pi-tools-suite/src/terminal-bell/index.ts +309 -0
  351. package/external/pi-tools-suite/src/todo/index.ts +201 -0
  352. package/external/pi-tools-suite/src/todo/state/auto-clear.ts +13 -0
  353. package/external/pi-tools-suite/src/todo/state/invariants.ts +21 -0
  354. package/external/pi-tools-suite/src/todo/state/persistence.ts +94 -0
  355. package/external/pi-tools-suite/src/todo/state/replay.ts +38 -0
  356. package/external/pi-tools-suite/src/todo/state/selectors.ts +49 -0
  357. package/external/pi-tools-suite/src/todo/state/state-reducer.ts +362 -0
  358. package/external/pi-tools-suite/src/todo/state/state.ts +18 -0
  359. package/external/pi-tools-suite/src/todo/state/store.ts +52 -0
  360. package/external/pi-tools-suite/src/todo/state/task-graph.ts +57 -0
  361. package/external/pi-tools-suite/src/todo/todo.ts +487 -0
  362. package/external/pi-tools-suite/src/todo/tool/response-envelope.ts +143 -0
  363. package/external/pi-tools-suite/src/todo/tool/types.ts +188 -0
  364. package/external/pi-tools-suite/src/todo/view/format.ts +18 -0
  365. package/external/pi-tools-suite/src/todo/view/labels.ts +13 -0
  366. package/external/pi-tools-suite/src/tool-descriptions.ts +369 -0
  367. package/external/pi-tools-suite/src/usage/index.ts +152 -0
  368. package/external/pi-tools-suite/src/usage/lib/copilot.ts +535 -0
  369. package/external/pi-tools-suite/src/usage/lib/google.ts +478 -0
  370. package/external/pi-tools-suite/src/usage/lib/openai.ts +268 -0
  371. package/external/pi-tools-suite/src/usage/lib/types.ts +114 -0
  372. package/external/pi-tools-suite/src/usage/lib/utils.ts +134 -0
  373. package/external/pi-tools-suite/src/usage/lib/zhipu.ts +228 -0
  374. package/external/pi-tools-suite/src/web-search/index.ts +397 -0
  375. package/package.json +89 -0
  376. package/skills/context7/SKILL.md +69 -0
  377. package/skills/context7/scripts/context7.sh +73 -0
  378. package/skills/handoff/SKILL.md +15 -0
  379. package/skills/pdf/LICENSE.txt +30 -0
  380. package/skills/pdf/SKILL.md +314 -0
  381. package/skills/pdf/forms.md +294 -0
  382. package/skills/pdf/reference.md +612 -0
  383. package/skills/pdf/scripts/check_bounding_boxes.py +65 -0
  384. package/skills/pdf/scripts/check_fillable_fields.py +11 -0
  385. package/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
  386. package/skills/pdf/scripts/create_validation_image.py +37 -0
  387. package/skills/pdf/scripts/extract_form_field_info.py +122 -0
  388. package/skills/pdf/scripts/extract_form_structure.py +115 -0
  389. package/skills/pdf/scripts/fill_fillable_fields.py +98 -0
  390. package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
  391. package/skills/playwright-cli/SKILL.md +388 -0
  392. package/skills/playwright-cli/references/element-attributes.md +23 -0
  393. package/skills/playwright-cli/references/playwright-tests.md +39 -0
  394. package/skills/playwright-cli/references/request-mocking.md +87 -0
  395. package/skills/playwright-cli/references/running-code.md +241 -0
  396. package/skills/playwright-cli/references/session-management.md +225 -0
  397. package/skills/playwright-cli/references/spec-driven-testing.md +305 -0
  398. package/skills/playwright-cli/references/storage-state.md +275 -0
  399. package/skills/playwright-cli/references/test-generation.md +134 -0
  400. package/skills/playwright-cli/references/tracing.md +139 -0
  401. package/skills/playwright-cli/references/video-recording.md +143 -0
  402. package/skills/simplify/SKILL.md +51 -0
  403. package/skills/skill-creator/LICENSE.txt +202 -0
  404. package/skills/skill-creator/SKILL.md +485 -0
  405. package/skills/skill-creator/agents/analyzer.md +274 -0
  406. package/skills/skill-creator/agents/comparator.md +202 -0
  407. package/skills/skill-creator/agents/grader.md +223 -0
  408. package/skills/skill-creator/assets/eval_review.html +146 -0
  409. package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  410. package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  411. package/skills/skill-creator/references/schemas.md +430 -0
  412. package/skills/skill-creator/scripts/__init__.py +0 -0
  413. package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  414. package/skills/skill-creator/scripts/generate_report.py +326 -0
  415. package/skills/skill-creator/scripts/improve_description.py +247 -0
  416. package/skills/skill-creator/scripts/package_skill.py +136 -0
  417. package/skills/skill-creator/scripts/quick_validate.py +103 -0
  418. package/skills/skill-creator/scripts/run_eval.py +310 -0
  419. package/skills/skill-creator/scripts/run_loop.py +328 -0
  420. package/skills/skill-creator/scripts/utils.py +47 -0
@@ -0,0 +1,188 @@
1
+ import { StringEnum } from "@earendil-works/pi-ai";
2
+ import { type Static, Type } from "typebox";
3
+
4
+ // ---------------------------------------------------------------------------
5
+ // Tool / command identity — verbatim string boundaries.
6
+ // Tool name "todo" is the persistence key for branch replay (filtering
7
+ // `toolResult.toolName === "todo"`) AND the permissions entry at
8
+ // `templates/pi-permissions.jsonc:26`. DO NOT rename.
9
+ // ---------------------------------------------------------------------------
10
+
11
+ export const TOOL_NAME = "todo";
12
+ export const TOOL_LABEL = "Todo";
13
+ export const COMMAND_NAME = "todos";
14
+
15
+ // ---------------------------------------------------------------------------
16
+ // User-facing strings (kept stable for /todos UX parity).
17
+ // ---------------------------------------------------------------------------
18
+
19
+ export const ERR_REQUIRES_INTERACTIVE = "/todos requires interactive mode";
20
+ export const MSG_NO_TODOS = "No todos yet. Ask the agent to add some!";
21
+
22
+ // ---------------------------------------------------------------------------
23
+ // Public domain types
24
+ // ---------------------------------------------------------------------------
25
+
26
+ export type TaskStatus = "pending" | "in_progress" | "deferred" | "completed" | "deleted";
27
+ export type TaskPriority = "low" | "medium" | "high" | "urgent";
28
+
29
+ export type TaskAction = "create" | "update" | "batch_create" | "batch_update" | "list" | "get" | "delete" | "clear" | "export" | "import";
30
+
31
+ export interface Task {
32
+ id: number;
33
+ subject: string;
34
+ description?: string;
35
+ activeForm?: string;
36
+ status: TaskStatus;
37
+ priority?: TaskPriority;
38
+ parentId?: number;
39
+ blockedBy?: number[];
40
+ tags?: string[];
41
+ owner?: string;
42
+ metadata?: Record<string, unknown>;
43
+ }
44
+
45
+ /**
46
+ * Persistence + replay snapshot. Every successful `todo` tool call returns this
47
+ * shape under `details`; `state/replay.ts` reads the latest one from the branch
48
+ * to reconstruct module state. Field order and field names are pinned by
49
+ * cross-version replay compatibility.
50
+ */
51
+ export interface TaskDetails {
52
+ action: TaskAction;
53
+ params: Record<string, unknown>;
54
+ tasks: Task[];
55
+ nextId: number;
56
+ error?: string;
57
+ }
58
+
59
+ /**
60
+ * Open-shape input bag the reducer accepts. Stays an interface so the index
61
+ * signature (`[key: string]: unknown`) lets the runtime pass through TypeBox
62
+ * `Static<typeof TodoParamsSchema>` without `as` casts.
63
+ */
64
+ export interface TaskMutationParams {
65
+ [key: string]: unknown;
66
+ subject?: string;
67
+ description?: string;
68
+ activeForm?: string;
69
+ status?: TaskStatus;
70
+ priority?: TaskPriority;
71
+ parentId?: number | null;
72
+ clearParent?: boolean;
73
+ blockedBy?: number[];
74
+ addBlockedBy?: number[];
75
+ removeBlockedBy?: number[];
76
+ tags?: string[];
77
+ addTags?: string[];
78
+ removeTags?: string[];
79
+ owner?: string;
80
+ metadata?: Record<string, unknown>;
81
+ id?: number;
82
+ includeDeleted?: boolean;
83
+ tag?: string;
84
+ blockedOnly?: boolean;
85
+ items?: TaskMutationParams[];
86
+ format?: "json" | "markdown";
87
+ content?: string;
88
+ replace?: boolean;
89
+ }
90
+
91
+ // ---------------------------------------------------------------------------
92
+ // TypeBox parameter schema — every `description` doubles as LLM-facing prompt
93
+ // copy. Field order and wording are pinned by registration tests and the
94
+ // pre-refactor schema at `packages/rpiv-todo/todo.ts:512-573`.
95
+ // ---------------------------------------------------------------------------
96
+
97
+ export const TodoParamsSchema = Type.Object({
98
+ action: StringEnum(["create", "update", "batch_create", "batch_update", "list", "get", "delete", "clear", "export", "import"] as const),
99
+ subject: Type.Optional(Type.String({ description: "Task subject line (required for create)" })),
100
+ description: Type.Optional(Type.String({ description: "Long-form task description" })),
101
+ activeForm: Type.Optional(
102
+ Type.String({
103
+ description: "Present-continuous spinner label shown while status is in_progress (e.g. 'writing tests')",
104
+ }),
105
+ ),
106
+ status: Type.Optional(
107
+ StringEnum(["pending", "in_progress", "deferred", "completed", "deleted"] as const, {
108
+ description: "Target status (update) or list filter (list)",
109
+ }),
110
+ ),
111
+ priority: Type.Optional(
112
+ StringEnum(["low", "medium", "high", "urgent"] as const, {
113
+ description: "Task priority (create/update) or list/export filter (list/export)",
114
+ }),
115
+ ),
116
+ parentId: Type.Optional(
117
+ Type.Number({
118
+ description: "Parent task id for hierarchy/subtasks (create/update); must refer to a non-deleted task",
119
+ }),
120
+ ),
121
+ clearParent: Type.Optional(
122
+ Type.Boolean({
123
+ description: "Remove the parentId from a task (update only)",
124
+ }),
125
+ ),
126
+ blockedBy: Type.Optional(
127
+ Type.Array(Type.Number(), {
128
+ description: "Initial blockedBy ids (create only)",
129
+ }),
130
+ ),
131
+ addBlockedBy: Type.Optional(
132
+ Type.Array(Type.Number(), {
133
+ description: "Task ids to add to blockedBy (update only, additive merge)",
134
+ }),
135
+ ),
136
+ removeBlockedBy: Type.Optional(
137
+ Type.Array(Type.Number(), {
138
+ description: "Task ids to remove from blockedBy (update only, additive merge)",
139
+ }),
140
+ ),
141
+ tags: Type.Optional(
142
+ Type.Array(Type.String(), {
143
+ description: "Tags to set on create/update, replacing the previous tag list",
144
+ }),
145
+ ),
146
+ addTags: Type.Optional(
147
+ Type.Array(Type.String(), {
148
+ description: "Tags to add on update without replacing existing tags",
149
+ }),
150
+ ),
151
+ removeTags: Type.Optional(
152
+ Type.Array(Type.String(), {
153
+ description: "Tags to remove on update",
154
+ }),
155
+ ),
156
+ owner: Type.Optional(Type.String({ description: "Agent/owner assigned to this task" })),
157
+ metadata: Type.Optional(
158
+ Type.Record(Type.String(), Type.Unknown(), {
159
+ description: "Arbitrary metadata; pass null value for a key to delete that key on update",
160
+ }),
161
+ ),
162
+ id: Type.Optional(
163
+ Type.Number({
164
+ description: "Task id (required for update, get, delete)",
165
+ }),
166
+ ),
167
+ includeDeleted: Type.Optional(
168
+ Type.Boolean({
169
+ description: "If true, list action returns deleted (tombstoned) tasks as well. Default: false.",
170
+ }),
171
+ ),
172
+ tag: Type.Optional(Type.String({ description: "Tag filter for list/export" })),
173
+ blockedOnly: Type.Optional(Type.Boolean({ description: "If true, list only tasks blocked by another task" })),
174
+ items: Type.Optional(
175
+ Type.Array(Type.Record(Type.String(), Type.Unknown()), {
176
+ description: "Batch items for batch_create or batch_update; each item uses the same fields as create/update",
177
+ }),
178
+ ),
179
+ format: Type.Optional(
180
+ StringEnum(["json", "markdown"] as const, {
181
+ description: "Import/export format. Default: json.",
182
+ }),
183
+ ),
184
+ content: Type.Optional(Type.String({ description: "Import content for action=import" })),
185
+ replace: Type.Optional(Type.Boolean({ description: "For import, replace existing tasks instead of appending. Default: false." })),
186
+ });
187
+
188
+ export type TodoParams = Static<typeof TodoParamsSchema>;
@@ -0,0 +1,18 @@
1
+ import { formatStatusLabel } from "./labels.js";
2
+ import type { Task } from "../tool/types.js";
3
+
4
+ // Re-export so legacy import paths (todo.ts, tests) continue to resolve.
5
+ export { formatStatusLabel };
6
+
7
+ /**
8
+ * Format a single task line for the `/todos` slash command (no glyph color,
9
+ * indented bullet prefix). Pre-refactor `todo.ts:670-674`.
10
+ */
11
+ export function formatCommandTaskLine(t: Task, glyph: string): string {
12
+ const form = t.status === "in_progress" && t.activeForm ? ` (${t.activeForm})` : "";
13
+ const priority = t.priority ? ` (${t.priority})` : "";
14
+ const parent = t.parentId !== undefined ? ` ↳ #${t.parentId}` : "";
15
+ const block = t.blockedBy?.length ? ` ⛓ ${t.blockedBy.map((id) => `#${id}`).join(",")}` : "";
16
+ const tags = t.tags?.length ? ` ${t.tags.map((tag) => `#${tag}`).join(" ")}` : "";
17
+ return ` ${glyph} #${t.id} ${t.subject}${priority}${form}${parent}${block}${tags}`;
18
+ }
@@ -0,0 +1,13 @@
1
+ import type { TaskStatus } from "../tool/types.js";
2
+
3
+ const STATUS_LABELS: Record<TaskStatus, string> = {
4
+ pending: "pending",
5
+ in_progress: "in progress",
6
+ deferred: "deferred",
7
+ completed: "completed",
8
+ deleted: "deleted",
9
+ };
10
+
11
+ export function formatStatusLabel(status: TaskStatus): string {
12
+ return STATUS_LABELS[status];
13
+ }
@@ -0,0 +1,369 @@
1
+ import { COMPRESS_RANGE_DESCRIPTION } from "./compress/prompts.js";
2
+
3
+ export type ToolDescription = {
4
+ name: string;
5
+ label: string;
6
+ description: string;
7
+ promptSnippet?: string;
8
+ promptGuidelines?: string[];
9
+ };
10
+
11
+ export type RepoDiscoveryCommand = "architecture" | "structure" | "ast" | "search" | "explain" | "deps";
12
+
13
+ export type RepoDiscoveryToolDescription = ToolDescription & Required<Pick<ToolDescription, "promptSnippet" | "promptGuidelines">> & {
14
+ command: RepoDiscoveryCommand;
15
+ targetDescription?: string;
16
+ };
17
+
18
+ export type ToolDescriptionSetOptions = {
19
+ repoDiscovery?: boolean;
20
+ };
21
+
22
+ function hasRepoDiscovery(options: ToolDescriptionSetOptions | boolean = false): boolean {
23
+ return typeof options === "boolean" ? options : options.repoDiscovery === true;
24
+ }
25
+
26
+ export const COMPRESS_TOOL_DESCRIPTION: ToolDescription = {
27
+ name: "compress",
28
+ label: "Compress Context",
29
+ description: COMPRESS_RANGE_DESCRIPTION,
30
+ promptSnippet: "Compress closed conversation slices as steady context housekeeping; after implementation + verification, compress before replying or starting a new task unless exact raw logs/diffs are still needed.",
31
+ promptGuidelines: [
32
+ "Treat completed implementation + verification slices as compression candidates immediately, not only at context-limit warnings.",
33
+ "Do not carry large stale tool outputs, diffs, or exploration logs across task boundaries; summarize their actionable result instead.",
34
+ "Keep active, still-needed context raw; compress only closed ranges whose exact content is unlikely to be needed next.",
35
+ ],
36
+ };
37
+
38
+ export function astGrepToolDescriptions(maxLines: number, maxBytesLabel: string) {
39
+ return {
40
+ astGrep: {
41
+ name: "ast_grep",
42
+ label: "ast-grep",
43
+ description: `Read-only AST structural search/scan. Use for language-aware patterns, sgconfig/rule scans, JSON matches, and rewrite previews. Use text search for plain strings and ast_apply for mutations. Output truncates at ${maxLines} lines or ${maxBytesLabel} with full output saved to a temp file.`,
44
+ promptSnippet: "Use ast_grep for AST/structural code search, not plain text search. It previews rewrites only; use ast_apply to mutate files.",
45
+ promptGuidelines: [
46
+ "Use ast_grep when syntax/AST structure matters; use Grep/text search for exact strings or regex.",
47
+ "Keep searches narrow with paths/globs and set lang explicitly for ambiguous snippets.",
48
+ "ast_grep is read-only: use rewrite to preview replacements, never to apply them.",
49
+ "Use ast_apply for intended ast-grep rewrites or scan fixes; use command=scan with rule, inlineRules, or config for rule-based scans.",
50
+ ],
51
+ },
52
+ astApply: {
53
+ name: "ast_apply",
54
+ label: "ast-apply",
55
+ description: `Mutating AST rewrite/fix tool powered by ast-grep. Use for structural replacements or scan fixes after you know the pattern/rule is correct. Reports changedFiles for post-edit diagnostics and truncates output at ${maxLines} lines or ${maxBytesLabel}.`,
56
+ promptSnippet: "Use ast_apply only when you intend to mutate files with ast-grep structural rewrites or scan fixes.",
57
+ promptGuidelines: [
58
+ "Use ast_apply for AST-aware bulk edits, not simple one-off text replacements.",
59
+ "For pattern rewrites, use command=run with pattern, rewrite, and lang when ambiguous; for rule fixes, use command=scan with rule, inlineRules, or config.",
60
+ "Run ast_grep first when the match set is uncertain; use ast_apply directly only for obvious, scoped rewrites.",
61
+ ],
62
+ },
63
+ } satisfies Record<string, ToolDescription>;
64
+ }
65
+
66
+ export function asyncSubagentToolDescriptions(options: ToolDescriptionSetOptions | boolean = false) {
67
+ const repoDiscovery = hasRepoDiscovery(options);
68
+
69
+ return {
70
+ subagents: {
71
+ name: "subagents",
72
+ label: "Subagents",
73
+ description: [
74
+ "Manage isolated async sub-agents for large, parallel, context-heavy work.",
75
+ "Sub-agent presets defined in async-subagents config and selected with /subagent-preset can choose per-role model/thinking/extra-arg configurations for future spawns across sessions until changed; AGENTS_PRESET or /subagent-preset session <name> overrides the saved preset for the current process/session; /subagent-preset init copies the bundled sample when no config exists.",
76
+ "When subagentType is omitted, async-subagents asks a lightweight router model to choose the configured role from the current config; prefer omitting it unless the user or task constraints require an explicit role.",
77
+ repoDiscovery
78
+ ? "Use for broad independent tracks, review axes, or hypotheses even though repo_* tools are available."
79
+ : "Use first for broad codebase discovery split into tracks, review axes, or incident-triage hypotheses when repo_* tools are unavailable.",
80
+ "Use action=spawn/status/wait/result/stop/cleanup with the matching options; spawned runs are registered under project .pi/subagents while the main session is alive so status/wait/stop can omit runDir for the latest run and result can resolve runDir by agentId.",
81
+ "Collect compact results only when the parent task needs them.",
82
+ "Spawned agents run in isolated background pi processes with extensions disabled to prevent recursive sub-agent spawning.",
83
+ "Each agent has a wall-clock watchdog timeout (default 30 minutes); spawn timeoutSeconds or task timeoutSeconds can shorten it for tests or bounded probes.",
84
+ "Concurrency is limited project-wide by maxConcurrent (default 5); excess agents queue automatically.",
85
+ "Failed agents can be auto-retried with exponential backoff when retry is configured per type or globally.",
86
+ "Preset fallbackModels can switch future sub-agent spawns in the current process/session to a fallback provider/model after quota/rate-limit failures; Antigravity account rotation is allowed to exhaust all accounts for the model first.",
87
+ ].join(" "),
88
+ promptSnippet:
89
+ "Use subagents action='spawn' when multiple independent agents are useful, the user asks to delegate/parallelize/split work, or one large review/deep investigation should stay out of the main context. " +
90
+ "Default to omitting subagentType so the configured router chooses from the live role config; set it only when the user explicitly named a role, vision/image handling is required, or a deterministic technical override is needed. Avoid trivial reads/edits, and do not call status/wait immediately after spawn just for progress. " +
91
+ (repoDiscovery
92
+ ? "For one semantic code-discovery question, use repo_search directly instead; for independent tracks/hypotheses/review axes, delegate even when repo_* tools are available. Use result with compact=true only after completion when findings are needed in the parent context."
93
+ : "For one focused code-discovery question, use direct read/grep tools instead. When the user asks for broad discovery split into tracks, hypotheses, incident triage, release readiness, risk strategy, or parallel reviews and indexed discovery is unavailable, spawn several focused scan/quick agents first before parent-context file search. Use result with compact=true only after completion when findings are needed in the parent context."),
94
+ promptGuidelines: [
95
+ "Use action='spawn' only for LARGE or PARALLEL tasks: independent investigations, repo-wide sweeps, deep debugging, or code review/audit that would bloat the parent context.",
96
+ "Treat explicit requests to delegate, use sub-agents, run parallel agents, split into independent tracks, investigate hypotheses, or run separate review axes as spawn triggers; spawn first unless the request is trivial or clearly single-file.",
97
+ repoDiscovery
98
+ ? "Do not spawn merely because code is unfamiliar; make one direct repo_search call for a single discovery question, and spawn only when several separate questions or review axes should run independently."
99
+ : "Do not spawn merely because code is unfamiliar; use direct read/grep tools for a single discovery question, and spawn only when several separate questions or review axes should run independently.",
100
+ repoDiscovery
101
+ ? "When repo_search answers one discovery question, prefer it over a swarm; do not let repo_* availability suppress delegation for multi-track reviews, independent hypotheses, explicit parallelism, or deep isolated review."
102
+ : "When indexed discovery is unavailable and the task spans multiple files, modules, hypotheses, or explicitly separate tracks, spawn a small swarm of focused scan/quick agents before serial grep/read in the parent context, even for a small project.",
103
+ repoDiscovery
104
+ ? "For incident triage, release-readiness, or risk/test-strategy prompts with separate hypotheses or review tracks, prefer spawning focused review agents over doing every track serially in the parent context."
105
+ : "For incident triage, release-readiness, or risk/test-strategy prompts with separate hypotheses or review tracks and no repo_* tools, call action='spawn' as the first discovery step; direct read/grep can follow after delegation if needed.",
106
+ repoDiscovery
107
+ ? "Do not use subagents for exact-string lookups, known-file edits, typo/text replacements, or obvious one-file changes; use the cheapest direct path instead."
108
+ : "Do not use subagents for exact-string lookups, known-file edits, typo/text replacements, or obvious one-file changes; use the cheapest direct path instead.",
109
+ "Spawn multiple focused agents in one action='spawn' call when they investigate independent questions.",
110
+ "For synthetic tests or intentionally bounded probes, pass timeoutSeconds slightly above the expected runtime so hung sub-agents are stopped automatically.",
111
+ "For subagents action='spawn', default to leaving subagentType unset and let the lightweight router choose from configured role descriptions. Do not choose a role just because a built-in example seems to fit; the router has the current user config and presets. Set subagentType explicitly only when the user named the role, image inspection requires vision, tests need deterministic routing, or there is another concrete technical reason to bypass the router.",
112
+ "Use subagentType='vision' with imagePaths and optional focus when a text-only/blind parent model needs a visual description of screenshots, UI state, diagrams, or other images.",
113
+ "If the user asks to start, run, launch, or test parallel sub-agents, call action='spawn' and then stop; do not immediately call action='wait'.",
114
+ "Use action='status' for a non-blocking progress check or to recover after reload/crash.",
115
+ "After spawn, project-local .pi/subagents/registry.json records latest runDir and agentId mappings until normal main-session shutdown; if runDir is missing after compaction/reload, call status without runDir or result with agentId instead of failing solely because runDir was lost.",
116
+ "Use action='wait' only when the user asks to wait/collect now, or your next parent step depends on completion.",
117
+ "Use action='result' only after status/wait confirms completion; keep compact=true unless full output is necessary.",
118
+ "Use action='stop' when the user asks to stop, cancel, or kill running sub-agents.",
119
+ "Use action='cleanup' with delete=true after collecting all results to free disk space.",
120
+ "Do NOT use subagents for trivial tasks, single file reads, simple edits, or interactive user input.",
121
+ ],
122
+ },
123
+ spawnAction: {
124
+ name: "async_subagents_spawn",
125
+ label: "Subagent Spawn Action",
126
+ description: "Internal action implementation for subagents action='spawn'.",
127
+ },
128
+ statusAction: {
129
+ name: "async_subagents_status",
130
+ label: "Subagent Status Action",
131
+ description: "Non-blocking status check for async sub-agents in a run directory. Shows running/done/failed/planned for each agent.",
132
+ },
133
+ waitAction: {
134
+ name: "async_subagents_wait",
135
+ label: "Subagent Wait Action",
136
+ description: [
137
+ "Wait for async sub-agents only when completion is required before the parent can proceed.",
138
+ "Returns final status of each agent. Use action='result' to read completed output.",
139
+ ].join(" "),
140
+ },
141
+ resultAction: {
142
+ name: "async_subagents_result",
143
+ label: "Subagent Result Action",
144
+ description: [
145
+ "Read output from one async sub-agent after it completes.",
146
+ "By default returns a compact structured summary/findings/files/risks/next actions plus artifact paths, not the full raw result text.",
147
+ "Set compact=false only when the parent needs the full result text and stderr in context.",
148
+ "A result.json with machine-readable structured output is written alongside the raw result.md on completion.",
149
+ "Defaults to compact output to avoid polluting the parent context; the full result.md path is included for later inspection.",
150
+ ].join(" "),
151
+ },
152
+ stopAction: {
153
+ name: "async_subagents_stop",
154
+ label: "Subagent Stop Action",
155
+ description: "Stop running async sub-agents in a run directory when the user asks to cancel/stop/kill them. Sends SIGTERM by default or SIGKILL with force=true.",
156
+ },
157
+ cleanupAction: {
158
+ name: "async_subagents_cleanup",
159
+ label: "Subagent Cleanup Action",
160
+ description: "Clean up old completed async sub-agent run directories after results are collected. Dry-run by default; pass delete=true to remove.",
161
+ },
162
+ } satisfies Record<string, ToolDescription>;
163
+ }
164
+
165
+ export const ASYNC_SUBAGENT_TOOL_DESCRIPTIONS = asyncSubagentToolDescriptions(false);
166
+ export const ASYNC_SUBAGENT_TOOL_DESCRIPTIONS_WITH_REPO = asyncSubagentToolDescriptions(true);
167
+
168
+ export const REPO_DISCOVERY_TOOLS: RepoDiscoveryToolDescription[] = [
169
+ {
170
+ name: "repo_architecture",
171
+ label: "Repo Architecture",
172
+ command: "architecture",
173
+ description: "Indexed repo architecture map: entrypoints, module boundaries, cycles, and unresolved dependency classes. Use before broad reads in unfamiliar codebases; skip for exact-string lookups, known-file edits, or other trivial changes.",
174
+ promptSnippet: "Use repo_architecture for a compact indexed architecture overview before broad multi-file reads, not for simple literal searches or small known-scope edits.",
175
+ promptGuidelines: [
176
+ "For exact strings, filenames, known symbols, typo/text replacements, or obvious one-file edits, skip repo_architecture and use the cheapest direct path: text search/read, then edit.",
177
+ "For broad exploration in an unfamiliar codebase, make one narrow architecture call first; add --path-prefix in args when a subsystem is known.",
178
+ "Use repo_structure for file/symbol listings and repo_search for behavior questions after this overview.",
179
+ ],
180
+ },
181
+ {
182
+ name: "repo_structure",
183
+ label: "Repo Structure",
184
+ command: "structure",
185
+ description: "Indexed file tree and exported-symbol view for a directory/module. Use to choose files/ranges without dumping source.",
186
+ promptSnippet: "Use repo_structure for file trees, module contents, and exported symbols; narrow with idx flags.",
187
+ promptGuidelines: [
188
+ "Pass --path-prefix, --kind, --max-files, or --max-depth in args whenever possible.",
189
+ "Use repo_ast for one large file's syntax map and repo_search for semantic behavior discovery.",
190
+ ],
191
+ },
192
+ {
193
+ name: "repo_ast",
194
+ label: "Repo AST",
195
+ command: "ast",
196
+ description: "Indexed AST map for one file. Use before repeated reads of a large file or when parent syntax structure matters.",
197
+ promptSnippet: "Use repo_ast with target=<file> to map one large file before choosing exact ranges to read.",
198
+ promptGuidelines: [
199
+ "Use this for one known file, not repo-wide search.",
200
+ "Pass --max-depth or --max-nodes in args to keep the AST map compact.",
201
+ ],
202
+ targetDescription: "File path to map, e.g. src/api/client.ts.",
203
+ },
204
+ {
205
+ name: "repo_search",
206
+ label: "Repo Search",
207
+ command: "search",
208
+ description: "Indexed hybrid/semantic repository search for behavior questions when exact identifiers or files are unknown. Use natural-language behavior queries, not synonym dumps. Defaults to hybrid ranking; read returned ranges next.",
209
+ promptSnippet: "Use repo_search for conceptual codebase questions; query for behavior, not a bag of synonyms. Leave default hybrid ranking for first-pass searches and use Grep/read when exact names or positions are known.",
210
+ promptGuidelines: [
211
+ "Phrase target as the behavior to locate, not a whitespace-separated pile of near-synonyms; keep exact identifiers only as useful anchors.",
212
+ "For initial unknown-file behavior searches, prefer the default hybrid ranking; pass --mode semantic only when lexical/symbol terms are misleading or the query is purely conceptual.",
213
+ "Do not launch several broad repo_search calls for the same question before reading results. Make one targeted search, read the best returned ranges, then refine only if evidence is missing.",
214
+ "Write a specific conceptual target, not a generic word. Add --path-prefix, --max-files, --dedupe-file, or --exclude-tests in args to reduce noise.",
215
+ "After repo_search, read the returned ranges instead of launching another broad search unless a specific gap remains; prefer read over --include-content for full evidence unless you only need a compact preview.",
216
+ "For mutation-site, bug-location, or behavior-cause questions, the assignment/write/branch/call that directly causes the behavior is the answer. If a read range contains that exact evidence, stop searching and answer from it.",
217
+ "Avoid repeated near-duplicate searches after finding direct source evidence. Continue only for a named gap such as callers, persistence path, tests, or user-requested impact analysis, and make the follow-up query narrower.",
218
+ ],
219
+ targetDescription: "Natural-language behavior query, e.g. auth session token validation.",
220
+ },
221
+ {
222
+ name: "repo_explain",
223
+ label: "Repo Explain",
224
+ command: "explain",
225
+ description: "Indexed explanation for a known symbol. Prefer file::symbol when the name may be ambiguous.",
226
+ promptSnippet: "Use repo_explain for a known symbol after you already know its name or file scope.",
227
+ promptGuidelines: [
228
+ "Prefer target=file::symbol for ambiguous names.",
229
+ "Use repo_search instead when you do not yet know the relevant symbol.",
230
+ ],
231
+ targetDescription: "Symbol or file-scoped symbol, e.g. createClient or src/api/client.ts::createClient.",
232
+ },
233
+ {
234
+ name: "repo_deps",
235
+ label: "Repo Deps",
236
+ command: "deps",
237
+ description: "Indexed dependency/caller tracing for a known path or symbol. Use for import impact and first-hop call/dependency analysis.",
238
+ promptSnippet: "Use repo_deps with target=<path|path::symbol> to trace imports, imported-by, callers, or callees.",
239
+ promptGuidelines: [
240
+ "Start with --depth 1 in args; add --direction callers|callees|both, --mode calls, or --show-edges only when needed.",
241
+ "Use repo_search first when you do not yet know the target path or symbol.",
242
+ ],
243
+ targetDescription: "Path or file-scoped symbol, e.g. src/api/client.ts or src/api/client.ts::createClient.",
244
+ },
245
+ ];
246
+
247
+ export const REPO_DISCOVERY_TOOL_NAMES = REPO_DISCOVERY_TOOLS.map((tool) => tool.name);
248
+
249
+ export const TODO_TOOL_DESCRIPTION: ToolDescription = {
250
+ name: "todo",
251
+ label: "Todo",
252
+ description: "Track and keep in sync non-trivial multi-step work as todos. Actions: create, update, batch_create, batch_update, list, get, delete, clear, export, import. Supports priorities, tags, parent/subtask hierarchy, blockers, deferred out-of-scope items, and dependencies; skip trivial or chat-only requests. Resynchronize the plan when requirements are added, canceled, or become obsolete, whether from user input or discovered facts. Keep exactly one task in_progress and complete it only after verification.",
253
+ promptSnippet: "Track/sync non-trivial multi-step work; resync when requirements or discoveries change the plan; keep one task in_progress",
254
+ promptGuidelines: [
255
+ "Use `todo` for complex work with 3+ steps, explicit user task lists, or new non-trivial requirements. Skip single trivial tasks and purely conversational requests.",
256
+ "When the user adds, removes, cancels, reprioritizes, or changes the goal, scope, requirements, constraints, or chosen approach, use `todo` before continuing to synchronize the plan: update still-relevant tasks, defer or delete obsolete tasks, add new required tasks, and adjust dependencies/order.",
257
+ "When your own investigation or verification discovers new facts that make the current todo plan stale, incomplete, impossible, unsafe, or no longer the best approach, use `todo` to revise the plan immediately instead of following outdated tasks.",
258
+ "Update todos as part of the workflow, not as end-of-task cleanup: whenever you start, finish, block, split, abandon, or materially change a step, call `todo` immediately before continuing.",
259
+ "Before starting work, mark exactly one task in_progress with activeForm (present-continuous label). Mark it completed immediately after the required verification, never in batches.",
260
+ "If implementation is partial, tests fail, or a blocker remains, keep the task in_progress and add/update a blocker task instead of completing it.",
261
+ "Never use `clear`, `delete`, or batch deletion to hide unfinished, stale, or forgotten todos. Defer obsolete items or update them with the reason; only delete when the user explicitly asks or the item was created by mistake.",
262
+ "Before giving a final response for work that used todos, ensure every visible todo is completed, deferred, or intentionally still in_progress with a blocker/explanation.",
263
+ "Keep subjects short and imperative; put details in description only when needed. Use priority, tags, and parentId for large plans; use blockedBy on create and addBlockedBy/removeBlockedBy on update for dependencies.",
264
+ "Use batch_create/batch_update for large explicit plans, but still keep exactly one visible task in_progress unless the user asks otherwise.",
265
+ "list hides deleted tombstones unless includeDeleted:true; pass status, priority, tag, or blockedOnly only when you need a filtered list.",
266
+ "Use export/import for handoff or plan migration; import with replace:true only when the user explicitly wants to overwrite the current todo state.",
267
+ "When every visible todo is completed, todo state clears automatically; do not call clear afterward just to remove completed tasks.",
268
+ "Optional project persistence is controlled by `/todos persist on|off|status` or the discoverable `/todos-persist on|off|status` alias; when resuming a persisted plan, ask the user which items are in scope and run `/todos scope <id...>` or `/todos-scope <id...>` so out-of-scope active tasks become deferred.",
269
+ ],
270
+ };
271
+
272
+ export const WEB_SEARCH_TOOL_DESCRIPTIONS = {
273
+ webSearch: {
274
+ name: "web_search",
275
+ label: "web-search",
276
+ description:
277
+ "Search the web for real-time information using your local Ollama instance's web_search API. Requires Ollama running locally with web search enabled; supports per-call timeout_ms and PI_WEB_SEARCH_TIMEOUT_MS.",
278
+ promptSnippet: "Search the web for current or real-time information through the local Ollama web_search API.",
279
+ promptGuidelines: [
280
+ "Use web_search when the user needs current public web information that may not be in the model's training data.",
281
+ "Keep web_search queries focused; use max_results only when a different result count is useful.",
282
+ "Do not include secrets, tokens, or private repository data in web_search queries.",
283
+ "Do not use web_search for repository-local code discovery; use repo_* or file/search tools instead.",
284
+ ],
285
+ },
286
+ webFetch: {
287
+ name: "web_fetch",
288
+ label: "web-fetch",
289
+ description:
290
+ "Fetch and extract text content from a web page URL using your local Ollama instance's web_fetch API. Requires Ollama running locally with web fetch enabled; supports per-call timeout_ms and PI_WEB_SEARCH_TIMEOUT_MS.",
291
+ promptSnippet: "Fetch and extract text from a specific URL through the local Ollama web_fetch API.",
292
+ promptGuidelines: [
293
+ "Use web_fetch when the user provides a URL or after web_search returns a specific page that needs deeper reading.",
294
+ "Do not pass URLs containing secrets or private credentials to web_fetch.",
295
+ "Do not use web_fetch as a generic repository file reader; use read for local files.",
296
+ ],
297
+ },
298
+ } satisfies Record<string, ToolDescription>;
299
+
300
+ export function claudeAliasToolDescriptions(options: ToolDescriptionSetOptions | boolean = false) {
301
+ const repoDiscovery = hasRepoDiscovery(options);
302
+
303
+ return {
304
+ Read: {
305
+ name: "Read",
306
+ label: "Read",
307
+ description: repoDiscovery
308
+ ? "Read file contents when the exact path is known. Use Glob/Grep or repo_search/repo_structure first when you still need to locate the file."
309
+ : "Read file contents when the exact path is known. Use Glob/Grep first when you still need to locate the file.",
310
+ },
311
+ Edit: {
312
+ name: "Edit",
313
+ label: "Edit",
314
+ description: "Replace exact text in an existing file. Use for surgical edits; use Write only for intentional whole-file replacement.",
315
+ },
316
+ Write: {
317
+ name: "Write",
318
+ label: "Write",
319
+ description: "Create or overwrite a file with complete contents. Use only when replacing the whole file is intended.",
320
+ },
321
+ Bash: {
322
+ name: "Bash",
323
+ label: "Bash",
324
+ description: "Run shell commands for builds, tests, package managers, git, and project CLIs. Prefer Read/Edit/Write/Grep/Glob for file operations.",
325
+ },
326
+ Grep: {
327
+ name: "Grep",
328
+ label: "Grep",
329
+ description: repoDiscovery
330
+ ? "Search file contents with ripgrep when you know the exact text or regex pattern. Narrow with path/glob/context/limit; use repo_search for semantic exploration and ast_grep for AST structure."
331
+ : "Search file contents with ripgrep when you know the exact text or regex pattern. Narrow with path/glob/context/limit; use ast_grep for AST structure.",
332
+ },
333
+ Glob: {
334
+ name: "Glob",
335
+ label: "Glob",
336
+ description: repoDiscovery
337
+ ? "Find files by path/name glob pattern, such as **/*.ts. Use before Read when only filenames are needed; use Grep for content search and repo_search for semantic exploration."
338
+ : "Find files by path/name glob pattern, such as **/*.ts. Use before Read when only filenames are needed; use Grep for content search.",
339
+ },
340
+ } satisfies Record<string, ToolDescription>;
341
+ }
342
+
343
+ export const CLAUDE_ALIAS_TOOL_DESCRIPTIONS = claudeAliasToolDescriptions(false);
344
+ export const CLAUDE_ALIAS_TOOL_DESCRIPTIONS_WITH_REPO = claudeAliasToolDescriptions(true);
345
+
346
+ export const CODEX_ALIAS_TOOL_DESCRIPTIONS = {
347
+ shellCommand: {
348
+ name: "shell",
349
+ label: "shell",
350
+ description: "Run shell commands for builds, tests, package managers, git, and project CLIs. Set workdir/cwd instead of cd; prefer read for simple file reads.",
351
+ },
352
+ applyPatch: {
353
+ name: "apply_patch",
354
+ label: "apply_patch",
355
+ description: `Apply file edits with a relative-path patch or a standard unified diff. Use for creating, updating, moving, or deleting files; keep each patch focused.
356
+
357
+ Begin-patch format:
358
+ *** Begin Patch
359
+ *** Update File: path/to/file
360
+ @@ optional context
361
+ -old text
362
+ +new text
363
+ *** End Patch
364
+
365
+ Begin-patch sections: *** Add File (new lines start with +), *** Update File (may include *** Move to: new/path), and *** Delete File. A single Begin Patch block may contain multiple file sections and modify multiple files; use one multi-file patch for tightly related edits, while keeping unrelated changes separate. Update hunks may use @@ optional context, omit the first @@, and use *** End of File. The whole begin patch may be wrapped in <<EOF ... EOF. Matching tolerates trailing-space, trim, and common Unicode punctuation differences.
366
+
367
+ Unified diff is also supported (for example, git diff output with ---/+++ headers). Paths must be workspace-relative, never absolute. Provide the complete patch in input.`,
368
+ },
369
+ } satisfies Record<string, ToolDescription>;