pi-agent-ide 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +81 -23
  3. package/assets/gallery/apply-editing.png +0 -0
  4. package/assets/gallery/debugging.png +0 -0
  5. package/assets/gallery/read-web.png +0 -0
  6. package/assets/gallery/search-replace.png +0 -0
  7. package/assets/gallery/terminal.png +0 -0
  8. package/assets/gallery/tool-editing.png +0 -0
  9. package/dist/chunk-22CLOM2D.js +1 -0
  10. package/dist/{chunk-LY6U5EAD.js → chunk-2527OQ4Y.js} +1 -1
  11. package/dist/chunk-3XJ3KDPZ.js +16 -0
  12. package/dist/chunk-5JELU6RV.js +7 -0
  13. package/dist/chunk-DDKHZZDO.js +5 -0
  14. package/dist/chunk-FEDVTZJG.js +1 -0
  15. package/dist/chunk-HSM6R7IB.js +27 -0
  16. package/dist/chunk-K5G4FDXD.js +1 -0
  17. package/dist/chunk-M5IVSCR2.js +1 -0
  18. package/dist/chunk-OYWIZII6.js +1 -0
  19. package/dist/chunk-P7XO5CIP.js +2 -0
  20. package/dist/chunk-PCZH7GOX.js +26 -0
  21. package/dist/{chunk-DQXPQOF7.js → chunk-SQ7ZTGOP.js} +1 -1
  22. package/dist/entry-10.js +1 -1
  23. package/dist/entry-11.js +1 -1
  24. package/dist/entry-12.js +1 -1
  25. package/dist/entry-13.js +1 -1
  26. package/dist/entry-14.js +1 -1
  27. package/dist/entry-15.js +1 -1
  28. package/dist/entry-16.js +1 -0
  29. package/dist/entry-18.js +1 -1
  30. package/dist/entry-19.js +1 -1
  31. package/dist/entry-20.js +1 -1
  32. package/dist/entry-21.js +1 -1
  33. package/dist/entry-22.js +1 -2
  34. package/dist/entry-23.js +2 -1
  35. package/dist/entry-24.js +1 -1
  36. package/dist/entry-25.js +1 -1
  37. package/dist/entry-26.js +1 -1
  38. package/dist/entry-27.js +1 -12
  39. package/dist/entry-28.js +12 -1
  40. package/dist/entry-29.js +1 -1
  41. package/dist/entry-30.js +1 -1
  42. package/dist/entry-31.js +1 -1
  43. package/dist/entry-32.js +1 -4
  44. package/dist/entry-33.js +3 -8
  45. package/dist/entry-34.js +9 -1
  46. package/dist/entry-35.js +1 -1
  47. package/dist/entry-36.js +1 -1
  48. package/dist/entry-37.js +1 -1
  49. package/dist/entry-38.js +1 -1
  50. package/dist/entry-39.js +1 -1
  51. package/dist/entry-40.js +1 -1
  52. package/dist/entry-41.js +1 -18
  53. package/dist/entry-42.js +18 -1
  54. package/dist/entry-43.js +1 -1
  55. package/dist/entry-44.js +1 -1
  56. package/dist/entry-45.js +1 -1
  57. package/dist/entry-46.js +1 -7
  58. package/dist/entry-47.js +7 -11
  59. package/dist/entry-48.js +11 -1
  60. package/dist/entry-49.js +1 -1
  61. package/dist/entry-50.js +1 -1
  62. package/dist/entry-51.js +1 -1
  63. package/dist/entry-52.js +1 -1
  64. package/dist/entry-53.js +1 -1
  65. package/dist/entry-54.js +1 -1
  66. package/dist/entry-55.js +1 -1
  67. package/dist/entry-56.js +1 -0
  68. package/dist/entry-57.js +0 -1
  69. package/dist/entry-58.js +1 -0
  70. package/dist/entry-59.js +0 -1
  71. package/dist/entry-60.js +1 -1
  72. package/dist/entry-61.js +1 -1
  73. package/dist/entry-62.js +1 -1
  74. package/dist/entry-63.js +1 -1
  75. package/dist/entry-64.js +1 -1
  76. package/dist/entry-65.js +1 -0
  77. package/dist/entry-66.js +0 -1
  78. package/dist/entry-67.js +1 -0
  79. package/dist/entry-68.js +0 -1
  80. package/dist/entry-69.js +1 -1
  81. package/dist/entry-70.js +1 -1
  82. package/dist/entry-71.js +1 -203
  83. package/dist/entry-72.js +254 -25
  84. package/dist/entry-73.js +30 -2
  85. package/dist/entry-74.js +2 -1
  86. package/dist/entry-75.js +1 -1
  87. package/dist/entry-76.js +1 -1
  88. package/dist/entry-77.js +3 -3
  89. package/dist/entry-78.js +3 -1
  90. package/dist/entry-79.js +1 -1
  91. package/dist/entry-80.js +1 -1
  92. package/dist/entry-81.js +1 -0
  93. package/dist/pi-agent-ide.js +3 -3
  94. package/docs/configuration.md +3 -1
  95. package/docs/development.md +0 -6
  96. package/docs/tools.md +12 -0
  97. package/node_modules/pi-agent-doctor/package.json +6 -6
  98. package/node_modules/pi-agent-doctor/runtime/entry-22.js +1 -0
  99. package/node_modules/pi-agent-filesystem/package.json +7 -7
  100. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  101. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  102. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  103. package/node_modules/pi-agent-filesystem-text/runtime/entry-26.js +2 -0
  104. package/node_modules/pi-agent-ide-ast/package.json +12 -11
  105. package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +0 -1
  106. package/node_modules/pi-agent-ide-ast/runtime/entry-28.js +2 -0
  107. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +8 -6
  108. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  109. package/node_modules/pi-agent-ide-changes/runtime/entry-29.js +0 -1
  110. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  111. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  112. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  113. package/node_modules/pi-agent-ide-lint/src/command-linter.ts +3 -1
  114. package/node_modules/pi-agent-ide-lsp/package.json +10 -10
  115. package/node_modules/pi-agent-ide-lsp/runtime/entry-34.js +2 -0
  116. package/node_modules/pi-agent-image/package.json +3 -3
  117. package/node_modules/pi-agent-invariant/package.json +2 -2
  118. package/node_modules/pi-agent-pdf/package.json +3 -3
  119. package/node_modules/pi-agent-read/package.json +11 -11
  120. package/node_modules/pi-agent-read/runtime/entry-41.js +0 -1
  121. package/node_modules/pi-agent-read/runtime/entry-42.js +2 -0
  122. package/node_modules/pi-agent-read/src/api/read-parameters.ts +2 -2
  123. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +11 -6
  124. package/node_modules/pi-agent-resource/package.json +2 -2
  125. package/node_modules/pi-agent-search/package.json +7 -7
  126. package/node_modules/pi-agent-search/runtime/entry-46.js +0 -1
  127. package/node_modules/pi-agent-search-text/package.json +9 -9
  128. package/node_modules/pi-agent-search-text/runtime/entry-48.js +1 -0
  129. package/node_modules/pi-agent-search-text/src/resolvers.ts +32 -27
  130. package/node_modules/pi-agent-search-text/src/search-session.ts +27 -1
  131. package/node_modules/pi-agent-text/package.json +3 -3
  132. package/node_modules/pi-agent-text/runtime/entry-50.js +1 -0
  133. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  134. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-51.js +2 -0
  135. package/node_modules/pi-agent-text-anchor-exact/index.ts +3 -3
  136. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  137. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -1
  138. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-53.js +2 -0
  139. package/node_modules/pi-agent-text-anchor-exact/src/config.ts +2 -2
  140. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  141. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +0 -1
  142. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-55.js +2 -0
  143. package/node_modules/pi-agent-text-editor/package.json +25 -25
  144. package/node_modules/pi-agent-text-editor/runtime/entry-71.js +0 -1
  145. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +125 -3
  146. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
  147. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
  148. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +32 -3
  149. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +21 -19
  150. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +37 -0
  151. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +85 -34
  152. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +2 -3
  153. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +589 -241
  154. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
  155. package/node_modules/pi-agent-text-editor/src/core/text-editor-config.ts +3 -3
  156. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
  157. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
  158. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
  159. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
  160. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
  161. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
  162. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  163. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  164. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-74.js +2 -0
  165. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  166. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  167. package/node_modules/pi-agent-tool-ui/runtime/entry-76.js +1 -0
  168. package/node_modules/pi-agent-web/package.json +7 -7
  169. package/node_modules/pi-agent-web/src/resolver.ts +128 -1
  170. package/node_modules/pi-agent-web-html/package.json +3 -3
  171. package/node_modules/pi-agent-web-image/package.json +4 -4
  172. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  173. package/node_modules/pi-agent-web-text/package.json +4 -4
  174. package/node_modules/pi-agent-web-text/runtime/entry-81.js +2 -0
  175. package/package.json +44 -39
  176. package/src/api/path-identity.ts +15 -0
  177. package/src/composite/builtin-extensions.ts +7 -2
  178. package/src/composite/module-labels.ts +4 -0
  179. package/src/composite/module-settings.ts +34 -14
  180. package/src/composite/preferences.ts +46 -3
  181. package/src/composite/selection.ts +5 -1
  182. package/src/doctor/inventory.ts +7 -2
  183. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  184. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  185. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  186. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  187. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-26.js +2 -0
  188. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-23.js +2 -0
  189. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  190. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  191. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  192. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  193. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  194. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-81.js +2 -0
  195. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-77.js +2 -0
  196. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +128 -1
  197. package/src/extensions/pi-agent-read/package.json +11 -11
  198. package/src/extensions/pi-agent-read/runtime/entry-41.js +0 -1
  199. package/src/extensions/pi-agent-read/runtime/entry-42.js +2 -0
  200. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +2 -2
  201. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +11 -6
  202. package/src/extensions/pi-agent-search/package.json +7 -7
  203. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
  204. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
  205. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-49.js +1 -0
  206. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +32 -27
  207. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +27 -1
  208. package/src/extensions/pi-agent-search/runtime/entry-46.js +0 -1
  209. package/src/extensions/pi-agent-search/runtime/entry-47.js +2 -0
  210. package/src/extensions/pi-agent-text-editor/package.json +25 -25
  211. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  212. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-51.js +2 -0
  213. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +3 -3
  214. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  215. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +0 -1
  216. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-53.js +2 -0
  217. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/config.ts +2 -2
  218. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  219. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +0 -1
  220. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-55.js +2 -0
  221. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  222. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  223. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-74.js +2 -0
  224. package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +0 -1
  225. package/src/extensions/pi-agent-text-editor/runtime/entry-72.js +2 -0
  226. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +125 -3
  227. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +1 -1
  228. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +14 -0
  229. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +32 -3
  230. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +21 -19
  231. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +37 -0
  232. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +85 -34
  233. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +2 -3
  234. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +589 -241
  235. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +5 -0
  236. package/src/extensions/pi-agent-text-editor/src/core/text-editor-config.ts +3 -3
  237. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +9 -1
  238. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +53 -0
  239. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +11 -41
  240. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +8 -18
  241. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +11 -41
  242. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +9 -19
  243. package/src/pi-agent-ide.ts +15 -2
  244. package/src/plugins/pi-agent-ide-ast/package.json +12 -11
  245. package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +0 -1
  246. package/src/plugins/pi-agent-ide-ast/runtime/entry-28.js +2 -0
  247. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +8 -6
  248. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  249. package/src/plugins/pi-agent-ide-changes/runtime/entry-29.js +0 -1
  250. package/src/plugins/pi-agent-ide-debugger/index.ts +3 -9
  251. package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +31 -0
  252. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +3 -1
  253. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +24 -23
  254. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -2
  255. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +55 -17
  256. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +55 -22
  257. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  258. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  259. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  260. package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +3 -1
  261. package/src/plugins/pi-agent-ide-lsp/package.json +10 -10
  262. package/src/plugins/pi-agent-ide-lsp/runtime/entry-34.js +2 -0
  263. package/src/plugins/pi-agent-ide-processes/src/registry.ts +6 -0
  264. package/src/plugins/pi-agent-ide-processes/src/ui.ts +28 -11
  265. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  266. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +2 -0
  267. package/src/plugins/pi-agent-ide-terminal/src/search.ts +32 -2
  268. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +5 -4
  269. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +2 -2
  270. package/src/plugins/pi-agent-ide-terminal/src/types.ts +3 -1
  271. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +1 -1
  272. package/src/plugins/pi-agent-ide-vision/index.ts +232 -0
  273. package/src/plugins/pi-agent-ide-vision/src/vision.ts +530 -0
  274. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +30 -0
  275. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +33 -0
  276. package/dist/chunk-5PLV4HLG.js +0 -1
  277. package/dist/chunk-BGUSBUUD.js +0 -26
  278. package/dist/chunk-G725MARR.js +0 -16
  279. package/dist/chunk-HKXDP2FD.js +0 -7
  280. package/dist/chunk-J4RTW44E.js +0 -1
  281. package/dist/chunk-QH4ZUDOD.js +0 -1
  282. package/dist/chunk-WGGIQ7IJ.js +0 -1
  283. package/dist/chunk-ZG2MWXCR.js +0 -2
  284. package/dist/chunk-ZUMN6U77.js +0 -27
  285. package/dist/entry-17.js +0 -1
  286. package/docs/evaluation.md +0 -14
  287. package/node_modules/pi-agent-doctor/runtime/entry-17.js +0 -1
  288. package/node_modules/pi-agent-filesystem/runtime/entry-22.js +0 -2
  289. package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  290. package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  291. package/node_modules/pi-agent-image/runtime/entry-34.js +0 -1
  292. package/node_modules/pi-agent-resource/runtime/entry-42.js +0 -1
  293. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
  294. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  295. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  296. package/node_modules/pi-agent-text-editor/runtime/entry-55.js +0 -1
  297. package/node_modules/pi-agent-tool-call-interception/runtime/entry-74.js +0 -1
  298. package/node_modules/pi-agent-web/runtime/entry-76.js +0 -2
  299. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-23.js +0 -2
  300. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +0 -2
  301. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-77.js +0 -2
  302. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +0 -2
  303. package/src/extensions/pi-agent-read/runtime/entry-37.js +0 -1
  304. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +0 -2
  305. package/src/extensions/pi-agent-search/runtime/entry-43.js +0 -1
  306. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +0 -2
  307. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  308. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  309. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-72.js +0 -2
  310. package/src/extensions/pi-agent-text-editor/runtime/entry-55.js +0 -1
  311. package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  312. package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  313. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-23.js +0 -0
  314. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-24.js +0 -0
  315. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-25.js +0 -0
  316. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-30.js +0 -0
  317. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-31.js +0 -0
  318. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-32.js +0 -0
  319. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-33.js +0 -0
  320. /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-35.js +0 -0
  321. /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-36.js +0 -0
  322. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-37.js +0 -0
  323. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-43.js +0 -0
  324. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-47.js +0 -0
  325. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-49.js +0 -0
  326. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-72.js +0 -0
  327. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-73.js +0 -0
  328. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-75.js +0 -0
  329. /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-77.js +0 -0
  330. /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-78.js +0 -0
  331. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-79.js +0 -0
  332. /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-80.js +0 -0
  333. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-24.js +0 -0
  334. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-25.js +0 -0
  335. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-78.js +0 -0
  336. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-79.js +0 -0
  337. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-80.js +0 -0
  338. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-73.js +0 -0
  339. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-30.js +0 -0
  340. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-31.js +0 -0
  341. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-32.js +0 -0
  342. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-33.js +0 -0
@@ -1,5 +1,4 @@
1
1
  import {
2
- DynamicBorder,
3
2
  type ExtensionAPI,
4
3
  type ExtensionContext,
5
4
  type Theme,
@@ -105,7 +104,7 @@ export class AgentIdeProcessesUi {
105
104
  action = await context.ui.custom<{ readonly source: string } | null>(
106
105
  (tui, theme, _keys, done) => {
107
106
  let active = this.#active();
108
- let page: "list" | "detail" | "confirm" = "list";
107
+ let page: "list" | "detail" | "input" | "confirm" = "list";
109
108
  let selected: AgentIdeProcess | undefined;
110
109
  const createList = (selectedSource?: string): SelectList => {
111
110
  const items: SelectItem[] = active.map((process) => ({
@@ -148,19 +147,24 @@ export class AgentIdeProcessesUi {
148
147
  invalidate: () => list.invalidate(),
149
148
  render(width: number) {
150
149
  const container = new Container();
151
- container.addChild(new DynamicBorder((text) => theme.fg("accent", text)));
150
+
152
151
  if (page === "list") {
153
- container.addChild(
154
- new Text(theme.fg("accent", theme.bold("Agent IDE processes")), 1, 0),
155
- );
156
152
  container.addChild(list);
157
153
  container.addChild(
158
- new Text(theme.fg("dim", "enter view · d stop · esc close"), 1, 0),
154
+ new Text(
155
+ theme.fg(
156
+ "dim",
157
+ active.length === 0 ? "esc close" : "enter view · d stop · esc close",
158
+ ),
159
+ 1,
160
+ 0,
161
+ ),
159
162
  );
160
163
  } else if (selected === undefined) {
161
164
  container.addChild(
162
165
  new Text(theme.fg("warning", "Process is no longer active."), 1, 0),
163
166
  );
167
+ container.addChild(new Text(theme.fg("dim", "esc back"), 1, 0));
164
168
  } else {
165
169
  container.addChild(selected.renderDetail(theme));
166
170
  container.addChild(
@@ -169,15 +173,24 @@ export class AgentIdeProcessesUi {
169
173
  page === "confirm" ? "warning" : "dim",
170
174
  page === "confirm"
171
175
  ? "Stop this process? y confirm · n/esc cancel"
172
- : "esc back · d stop",
176
+ : page === "input"
177
+ ? "input mode · type to send · esc stop input"
178
+ : selected.sendInput === undefined
179
+ ? "esc back · d stop"
180
+ : "i input · esc back · d stop",
173
181
  ),
174
182
  1,
175
183
  0,
176
184
  ),
177
185
  );
178
186
  }
179
- container.addChild(new DynamicBorder((text) => theme.fg("accent", text)));
180
- return container.render(width);
187
+ const accent = (text: string): string => theme.fg("accent", text);
188
+ const innerWidth = Math.max(1, width - 2);
189
+ return [
190
+ borderTop("Agent IDE Processes", `${active.length} active`, width, accent),
191
+ ...container.render(innerWidth).map((line) => borderLine(line, width, accent)),
192
+ borderBottom(width, accent),
193
+ ];
181
194
  },
182
195
  handleInput(data: string) {
183
196
  if (page === "list") {
@@ -189,7 +202,11 @@ export class AgentIdeProcessesUi {
189
202
  } else list.handleInput(data);
190
203
  } else if (page === "detail") {
191
204
  if (matchesKey(data, Key.escape)) page = "list";
192
- else if (data === "d") page = "confirm";
205
+ else if (data === "d" && selected !== undefined) page = "confirm";
206
+ else if (data === "i" && selected?.sendInput !== undefined) page = "input";
207
+ } else if (page === "input") {
208
+ if (matchesKey(data, Key.escape)) page = "detail";
209
+ else selected?.sendInput?.(data);
193
210
  } else if (data === "y" && selected !== undefined)
194
211
  done({ source: selected.source });
195
212
  else if (data === "n" || matchesKey(data, Key.escape)) page = "detail";
@@ -30,7 +30,7 @@ export default async function registerTerminal(pi: ExtensionAPI): Promise<void>
30
30
  pi.on("session_shutdown", async (event) => {
31
31
  ui.dispose();
32
32
  removeProcessProvider();
33
- if (event.reason === "reload") {
33
+ if (event.reason !== "quit") {
34
34
  retainReloadResource("terminal", manager);
35
35
  return;
36
36
  }
@@ -21,8 +21,10 @@ export function terminalProcessProvider(manager: TerminalSessionManager): AgentI
21
21
  title: snapshot.shell.toLocaleLowerCase(),
22
22
  description: snapshot.command,
23
23
  status: snapshot.status === "stopping" ? ("stopping" as const) : ("running" as const),
24
+ ...(snapshot.pid === undefined ? {} : { pid: snapshot.pid, owned: true }),
24
25
  renderSummary: (theme) => renderActiveTerminal(snapshot, theme).split("\n"),
25
26
  renderDetail: (theme) => renderTerminalResult(snapshot, true, theme),
27
+ sendInput: (data) => manager.write(snapshot.source, data),
26
28
  stop: () => manager.delete(snapshot.source),
27
29
  };
28
30
  }),
@@ -7,6 +7,7 @@ import {
7
7
  import type { SearchRequest, SearchSelectionMatch } from "pi-agent-search/api/search";
8
8
 
9
9
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
+ import type { Component } from "@earendil-works/pi-tui";
10
11
 
11
12
  import { renderTerminalAction } from "#src/plugins/pi-agent-ide-terminal/src/renderer.js";
12
13
  import type { TerminalSessionManager } from "#src/plugins/pi-agent-ide-terminal/src/session-manager.js";
@@ -85,22 +86,51 @@ function terminalSearchResolver(manager: TerminalSessionManager) {
85
86
  },
86
87
  renderResult(
87
88
  result: { details: unknown },
88
- _options: unknown,
89
+ options: { readonly expanded?: boolean },
89
90
  theme: Parameters<typeof renderTerminalAction>[4],
90
91
  ) {
91
92
  const details = result.details;
92
93
  const payload = isRecord(details) ? parsePayload(details.payload) : parsePayload(undefined);
93
- return renderTerminalAction(
94
+ const content = renderTerminalAction(
94
95
  payload.snapshot,
95
96
  "search",
96
97
  JSON.stringify(payload.query),
97
98
  payload.matches.slice(-6).map((match) => `${match.lineNumber}: ${match.lineText}`),
98
99
  theme,
99
100
  );
101
+ return new TerminalSearchPanel(content, options.expanded === true, theme);
100
102
  },
101
103
  };
102
104
  }
103
105
 
106
+ const COMPACT_TERMINAL_SEARCH_ROWS = 12;
107
+
108
+ /** Keep terminal search readable without changing the complete agent-facing result. */
109
+ export class TerminalSearchPanel implements Component {
110
+ public constructor(
111
+ private readonly content: Component,
112
+ private readonly expanded: boolean,
113
+ private readonly theme: Parameters<typeof renderTerminalAction>[4],
114
+ ) {}
115
+
116
+ public render(width: number): string[] {
117
+ const rows = this.content.render(width);
118
+ if (this.expanded || rows.length <= COMPACT_TERMINAL_SEARCH_ROWS) return rows;
119
+ const shown = COMPACT_TERMINAL_SEARCH_ROWS - 1;
120
+ return [
121
+ ...rows.slice(0, shown),
122
+ this.theme.fg(
123
+ "muted",
124
+ `… ${String(rows.length - shown)} visual rows omitted · ctrl+o to expand`,
125
+ ),
126
+ ];
127
+ }
128
+
129
+ public invalidate(): void {
130
+ this.content.invalidate();
131
+ }
132
+ }
133
+
104
134
  export function findTerminalMatches(
105
135
  snapshot: TerminalSessionSnapshot,
106
136
  request: SearchRequest,
@@ -13,7 +13,7 @@ import type {
13
13
  ShellProfile,
14
14
  TerminalSession,
15
15
  TerminalSessionSnapshot,
16
- TerminalWaitReason,
16
+ TerminalWaitOutcomeReason,
17
17
  } from "#src/plugins/pi-agent-ide-terminal/src/types.js";
18
18
 
19
19
  const require = createRequire(import.meta.url);
@@ -65,6 +65,7 @@ export class TerminalSessionManager {
65
65
  cwd: session.cwd,
66
66
  shell: session.shell.displayName,
67
67
  shellFamily: session.shell.family,
68
+ ...(session.process === undefined ? {} : { pid: session.process.pid }),
68
69
  background: session.background,
69
70
  status: session.status,
70
71
  ...(session.waitReason === undefined ? {} : { waitReason: session.waitReason }),
@@ -215,7 +216,7 @@ export class TerminalSessionManager {
215
216
  readonly timeoutMs: number;
216
217
  readonly interactiveDelayMs?: number;
217
218
  },
218
- ): Promise<{ readonly session: TerminalSession; readonly reason?: TerminalWaitReason }> {
219
+ ): Promise<{ readonly session: TerminalSession; readonly reason?: TerminalWaitOutcomeReason }> {
219
220
  const session = this.required(sourceOrId);
220
221
  if (isTerminalStatus(session.status)) return { session };
221
222
  const interactiveDelayMs = options.interactiveDelayMs ?? 3_000;
@@ -223,7 +224,7 @@ export class TerminalSessionManager {
223
224
  return await new Promise((resolve) => {
224
225
  let settled = false;
225
226
  let interactiveSince: number | undefined;
226
- const finish = (reason?: TerminalWaitReason): void => {
227
+ const finish = (reason?: TerminalWaitOutcomeReason): void => {
227
228
  if (settled) return;
228
229
  if (reason !== undefined && isTerminalStatus(session.status)) reason = undefined;
229
230
  settled = true;
@@ -232,7 +233,7 @@ export class TerminalSessionManager {
232
233
  options.signal?.removeEventListener("abort", onAbort);
233
234
  if (reason !== undefined) {
234
235
  session.background = true;
235
- session.waitReason = reason;
236
+ if (reason !== "aborted") session.waitReason = reason;
236
237
  this.#emitChanged(session);
237
238
  }
238
239
  resolve({ session, ...(reason === undefined ? {} : { reason }) });
@@ -65,9 +65,9 @@ export function registerTerminalTools(
65
65
  promptSnippet: `Execute ${profile.displayName} commands in synchronous or background terminal sessions`,
66
66
  promptGuidelines: [
67
67
  `Write commands for ${profile.displayName}; commands are not translated between shell languages.`,
68
- `Use ${toolName} with background for servers, watchers, and long builds. Foreground waits become background after timeoutSeconds (60 by default), on a stable interactive prompt, or when the turn is aborted. A background session with no output for two minutes wakes an idle agent so it can be inspected. Sessions survive extension reloads and keep the same shell: source. Large output returns a bounded tail and a fullOutput file path. Use the returned shell: source with read, write, insert, and delete.`,
68
+ `Use ${toolName} with background for servers, watchers, and long builds. After a session enters background, do not poll it continuously; continue other work or wait for completion. Keep short tasks in the foreground. Enable periodic or verbose output for long-running commands. Use the returned shell: source with read, write, insert, and delete.`,
69
69
  ],
70
- description: `Use ${toolName} to execute a command in the user's configured ${profile.displayName} shell (${profile.executable}). Every call creates an addressable terminal session. Set background to true to continue without waiting. A foreground wait automatically returns the live session as background on timeout, a stable interactive prompt, or turn abort; completion is delivered automatically and wakes the agent. Sessions survive extension reloads and keep the same shell: source. Output uses the shared Read limits, keeps the tail, and links a complete log file when truncated. ${shellSyntaxGuidance(profile)}`,
70
+ description: `Use ${toolName} to execute a command in the user's configured ${profile.displayName} shell (${profile.executable}). Every call creates an addressable terminal session. Set background to true to continue without waiting. A foreground wait automatically returns the live session as background on timeout, a stable interactive prompt, or turn abort. Background completion is delivered automatically and wakes the agent. Silent background sessions are treated as potentially stale after two minutes and wake an idle agent for inspection. Sessions survive extension reloads and keep the same shell: source. Output uses the shared Read limits, keeps the tail, and links a complete log file when truncated. ${shellSyntaxGuidance(profile)}`,
71
71
  parameters: runParameters,
72
72
  async execute(_toolCallId, input, signal, onUpdate, context) {
73
73
  ui.bind(context);
@@ -1,7 +1,8 @@
1
1
  import type { IPty } from "node-pty";
2
2
  import type { Terminal } from "@xterm/headless";
3
3
 
4
- export type TerminalWaitReason = "timeout" | "interactive" | "aborted";
4
+ export type TerminalWaitReason = "timeout" | "interactive";
5
+ export type TerminalWaitOutcomeReason = TerminalWaitReason | "aborted";
5
6
  export type TerminalCompletionReason = "timeout";
6
7
 
7
8
  export type TerminalSessionStatus =
@@ -56,6 +57,7 @@ export interface TerminalSessionSnapshot {
56
57
  readonly cwd: string;
57
58
  readonly shell: string;
58
59
  readonly shellFamily: ShellProfile["family"];
60
+ readonly pid?: number;
59
61
  readonly background: boolean;
60
62
  readonly status: TerminalSessionStatus;
61
63
  readonly waitReason?: TerminalWaitReason;
@@ -75,7 +75,7 @@ export class TerminalUi {
75
75
  {
76
76
  customType: "terminal-wait-transition",
77
77
  display: false,
78
- content: `Terminal wait aborted; ${snapshot.source} is still running in background. Read it to inspect output, then use write or insert to send input.`,
78
+ content: `Terminal wait ended; ${snapshot.source} is still running in background. Read it to inspect output, then use write or insert to send input.`,
79
79
  details: snapshot,
80
80
  },
81
81
  { triggerTurn: true, deliverAs: "steer" },
@@ -0,0 +1,232 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+
3
+ import type { BuiltinExtensionContext } from "#src/composite/selection.js";
4
+ import { connectReadPlugin } from "pi-agent-read/api/connect-plugin";
5
+ import { READ_API_VERSION, READ_PROTOCOL } from "pi-agent-read/api/plugin-protocol";
6
+ import type { ReadRequest, ReadToolResult } from "pi-agent-read/api/tools/read";
7
+ import { connectSearchPlugin } from "pi-agent-search/api/connect-plugin";
8
+ import { SEARCH_API_VERSION, SEARCH_PROTOCOL } from "pi-agent-search/api/plugin-protocol";
9
+
10
+ import { agentIdeProcessRegistry } from "#src/plugins/pi-agent-ide-processes/src/registry.js";
11
+ import {
12
+ captureImages,
13
+ configureVision,
14
+ createCaptureBackend,
15
+ getVisionDefaults,
16
+ isExecutableAllowed,
17
+ listProcesses,
18
+ parseDisplaySource,
19
+ parseVisionView,
20
+ readProcess,
21
+ type VisionOptions,
22
+ } from "#src/plugins/pi-agent-ide-vision/src/vision.js";
23
+
24
+ /** Register process discovery and guarded visual capture resources. */
25
+ export default async function registerVision(
26
+ pi: ExtensionAPI,
27
+ context?: BuiltinExtensionContext,
28
+ ): Promise<void> {
29
+ const preferences = context?.preferences ?? {};
30
+ configureVision({
31
+ durationSeconds: preferences["vision.sequenceDurationSeconds"],
32
+ intervalSeconds: preferences["vision.sequenceIntervalSeconds"],
33
+ scale: preferences["vision.imageScale"],
34
+ allowedExecutables: preferences["vision.allowedExecutables"],
35
+ });
36
+ const registry = agentIdeProcessRegistry(pi);
37
+ const backend = createCaptureBackend();
38
+ await Promise.all([
39
+ connectReadPlugin(pi, {
40
+ protocol: READ_PROTOCOL,
41
+ apiVersion: READ_API_VERSION,
42
+ id: "vision",
43
+ setup(api) {
44
+ for (const view of ["image", "sequence"]) {
45
+ api.addView({
46
+ view,
47
+ presenter: { id: `vision-${view}`, present: (document) => document },
48
+ });
49
+ }
50
+ api.addHandler({
51
+ stage: "pre-read",
52
+ async handler(context) {
53
+ const source = context.request.path;
54
+ if (source === undefined) return { kind: "continue", context };
55
+ const displayIndex = parseDisplaySource(source);
56
+ if (displayIndex !== undefined) {
57
+ if (pi.getFlag("pi-agent-ide-vision-displays") !== true) {
58
+ return failed(
59
+ source,
60
+ "Display capture is disabled. Enable --pi-agent-ide-vision-displays to allow it.",
61
+ );
62
+ }
63
+ try {
64
+ const content = await captureImages(
65
+ () => backend.captureDisplay(displayIndex, context.resolverContext.signal),
66
+ options(context.request),
67
+ context.resolverContext.signal,
68
+ );
69
+ return returned(source, content);
70
+ } catch (error) {
71
+ return failed(source, errorMessage(error));
72
+ }
73
+ }
74
+ const processPid = prefixedPid(source, "process:");
75
+ if (processPid !== undefined) {
76
+ const metadata = await readProcess(processPid, registry);
77
+ return returned(source, [{ type: "text", text: formatProcess(metadata) }]);
78
+ }
79
+ const windowPid = prefixedPid(source, "window:");
80
+ if (windowPid !== undefined) {
81
+ const metadata = await readProcess(windowPid, registry);
82
+ if (
83
+ !metadata.owned &&
84
+ !isExecutableAllowed(metadata.command) &&
85
+ pi.getFlag("pi-agent-ide-vision-arbitrary-windows") !== true
86
+ ) {
87
+ return failed(
88
+ source,
89
+ `Window capture for PID ${windowPid} is denied because the process is neither Agent IDE-owned nor allowlisted by executable name. Enable --pi-agent-ide-vision-arbitrary-windows to allow it.`,
90
+ );
91
+ }
92
+
93
+ try {
94
+ const content = await captureImages(
95
+ () => backend.captureWindow(windowPid, context.resolverContext.signal),
96
+ options(context.request),
97
+ context.resolverContext.signal,
98
+ );
99
+ return returned(source, content);
100
+ } catch (error) {
101
+ return failed(source, errorMessage(error));
102
+ }
103
+ }
104
+ if (/^https?:\/\//iu.test(source) && requestsScreenshot(context.request)) {
105
+ const url = new URL(source);
106
+ try {
107
+ const content = await captureImages(
108
+ () => backend.captureUrl(url, context.resolverContext.signal),
109
+ options(context.request),
110
+ context.resolverContext.signal,
111
+ );
112
+ return returned(url.href, content);
113
+ } catch (error) {
114
+ return failed(url.href, errorMessage(error));
115
+ }
116
+ }
117
+ return { kind: "continue", context };
118
+ },
119
+ });
120
+ const defaults = getVisionDefaults();
121
+ api.describe(
122
+ `Process metadata: process:PID. Visual capture: window:PID and display: or display:#N. HTTP(S) sources accept image and sequence screenshots. Use named view parameters such as sequence:duration=2,interval=0.5,scale=0.5 and image:scale=0.5,region=0.25,0.25,0.5,0.5. Duration is limited to 10 seconds and sequences to 20 frames. Defaults: duration=${defaults.durationSeconds}, interval=${defaults.intervalSeconds}, scale=${defaults.scale}. Region uses normalized x,y,width,height and runs before scaling. For captures, limit is a square grid cell size in output pixels and offset is one zero-based row-major cell index; limit without offset selects cell 0, while offset without limit is invalid. Omit both for the bounded transformed image.`,
123
+ );
124
+ api.addPromptGuideline(
125
+ "Use search with process:<query> before reading process:PID or window:PID. Capture arbitrary desktop windows and full displays only when their dedicated flags are enabled; Agent IDE-owned terminal processes are allowed by default. Use a bounded sequence view only when one image is insufficient; set named duration, interval, scale and region parameters when the defaults do not fit. Use limit and offset to select one image grid cell.",
126
+ );
127
+ },
128
+ }),
129
+ connectSearchPlugin(pi, {
130
+ protocol: SEARCH_PROTOCOL,
131
+ apiVersion: SEARCH_API_VERSION,
132
+ id: "vision-processes",
133
+ setup(api) {
134
+ api.addResolver({
135
+ priority: -100,
136
+ resolver: {
137
+ id: "processes",
138
+ async tryResolve(request) {
139
+ const match = /^process:(.*)$/isu.exec(request.query);
140
+ if (match === null) return { kind: "not-handled" as const };
141
+ const query = (match[1] ?? "").trim().toLowerCase();
142
+ const matches = (await listProcesses(registry))
143
+ .filter(
144
+ (item) =>
145
+ query.length === 0 ||
146
+ String(item.pid) === query ||
147
+ item.command.toLowerCase().includes(query),
148
+ )
149
+ .slice(0, Math.min(request.limit ?? 50, 100));
150
+ return { kind: "resolved" as const, payload: matches };
151
+ },
152
+ format(payload) {
153
+ const processes = payload as Awaited<ReturnType<typeof listProcesses>>;
154
+ return {
155
+ content: [
156
+ {
157
+ type: "text" as const,
158
+ text:
159
+ processes.length === 0
160
+ ? "No matching processes."
161
+ : processes.map(formatProcess).join("\n\n"),
162
+ },
163
+ ],
164
+ details: { count: processes.length, processes },
165
+ };
166
+ },
167
+ },
168
+ });
169
+ api.describe(
170
+ "process:<query> finds running processes by PID or command for process:PID metadata reads and guarded window:PID capture.",
171
+ );
172
+ api.addPromptGuideline(
173
+ "Use process:<query> to discover a PID before selecting a process or window source.",
174
+ );
175
+ },
176
+ }),
177
+ ]);
178
+ }
179
+
180
+ function prefixedPid(source: string, prefix: string): number | undefined {
181
+ if (!source.startsWith(prefix)) return undefined;
182
+ const value = source.slice(prefix.length);
183
+ if (!/^\d+$/u.test(value)) throw new Error(`${prefix} sources require a numeric PID`);
184
+ return Number(value);
185
+ }
186
+ function options(request: ReadRequest): VisionOptions {
187
+ const selected = parseVisionView(request.views, getVisionDefaults()) ?? {
188
+ mode: "image" as const,
189
+ ...getVisionDefaults(),
190
+ };
191
+ return {
192
+ ...selected,
193
+ ...(request.limit === undefined ? {} : { cellSize: request.limit }),
194
+ ...(request.offset === undefined ? {} : { cellIndex: request.offset }),
195
+ };
196
+ }
197
+ function requestsScreenshot(request: ReadRequest): boolean {
198
+ return request.views?.some((view) => /^(?:image|sequence)(?::|$)/u.test(view)) === true;
199
+ }
200
+ function returned(source: string, content: ReadToolResult["content"]) {
201
+ return {
202
+ kind: "return" as const,
203
+ result: { content, details: { source, resolvedBy: "vision" } },
204
+ };
205
+ }
206
+ function failed(source: string, message: string) {
207
+ return {
208
+ kind: "return" as const,
209
+ result: {
210
+ content: [{ type: "text" as const, text: message }],
211
+ details: {
212
+ source,
213
+ resolvedBy: "vision",
214
+ failure: { code: "READ_FAILED" as const, source, resolverId: "vision", message },
215
+ },
216
+ isError: true,
217
+ },
218
+ };
219
+ }
220
+ function errorMessage(error: unknown): string {
221
+ return error instanceof Error ? error.message : String(error);
222
+ }
223
+ function formatProcess(item: Awaited<ReturnType<typeof readProcess>>): string {
224
+ return [
225
+ `PID: ${item.pid}`,
226
+ `Command: ${item.command}`,
227
+ `Owned by Agent IDE: ${item.owned ? "yes" : "no"}`,
228
+ ...(item.parentPid === undefined ? [] : [`Parent PID: ${item.parentPid}`]),
229
+ ...(item.started === undefined ? [] : [`Started: ${item.started}`]),
230
+ ...(item.source === undefined ? [] : [`Agent IDE source: ${item.source}`]),
231
+ ].join("\n");
232
+ }