pi-agent-ide 0.3.0 → 0.5.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 (413) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +7 -6
  3. package/dist/chunk-25CZ5ZIU.js +3 -0
  4. package/dist/chunk-526E364R.js +3 -0
  5. package/dist/chunk-5PLV4HLG.js +1 -0
  6. package/dist/chunk-5QQABP47.js +14 -0
  7. package/dist/{chunk-72EEL2DW.js → chunk-6CZO43OH.js} +1 -1
  8. package/dist/chunk-AWXVJ5AC.js +1 -0
  9. package/dist/chunk-BGUSBUUD.js +26 -0
  10. package/dist/{chunk-CW53ZTU3.js → chunk-DQXPQOF7.js} +1 -1
  11. package/dist/chunk-EJ5OACQM.js +1 -0
  12. package/dist/chunk-ESPNEJHK.js +1 -0
  13. package/dist/chunk-G725MARR.js +16 -0
  14. package/dist/{chunk-M5L42DWE.js → chunk-HKXDP2FD.js} +2 -2
  15. package/dist/chunk-IQD6PON5.js +0 -0
  16. package/dist/chunk-J34VKQGJ.js +1 -0
  17. package/dist/chunk-J4RTW44E.js +1 -0
  18. package/dist/{chunk-HGPUI7F3.js → chunk-KII2JQC5.js} +1 -1
  19. package/dist/{chunk-CEKXBS55.js → chunk-L7JMDDSD.js} +1 -1
  20. package/dist/{chunk-EWNWKDMP.js → chunk-LY6U5EAD.js} +1 -1
  21. package/dist/{chunk-ERVMDQGX.js → chunk-MGCHOGQD.js} +1 -1
  22. package/dist/{chunk-LRYE2WCN.js → chunk-O6LE42GK.js} +1 -1
  23. package/dist/{chunk-KAB3AYA2.js → chunk-OBNING2A.js} +1 -1
  24. package/dist/chunk-QH4ZUDOD.js +1 -0
  25. package/dist/{chunk-VFBLX4TG.js → chunk-T6LX2RX5.js} +1 -1
  26. package/dist/{chunk-AADJ2KIB.js → chunk-U22JNO6N.js} +1 -1
  27. package/dist/chunk-U2JKHKLK.js +0 -0
  28. package/dist/{chunk-SSHZEWWV.js → chunk-WGGIQ7IJ.js} +1 -1
  29. package/dist/chunk-ZG2MWXCR.js +2 -0
  30. package/dist/chunk-ZUMN6U77.js +27 -0
  31. package/dist/entry-10.js +1 -1
  32. package/dist/entry-11.js +1 -1
  33. package/dist/entry-12.js +1 -1
  34. package/dist/entry-13.js +1 -1
  35. package/dist/entry-14.js +1 -1
  36. package/dist/entry-15.js +1 -0
  37. package/dist/entry-17.js +1 -1
  38. package/dist/entry-18.js +1 -1
  39. package/dist/entry-19.js +1 -1
  40. package/dist/entry-20.js +1 -1
  41. package/dist/entry-21.js +1 -2
  42. package/dist/entry-22.js +2 -1
  43. package/dist/entry-23.js +1 -1
  44. package/dist/entry-24.js +1 -1
  45. package/dist/entry-25.js +1 -1
  46. package/dist/entry-26.js +1 -12
  47. package/dist/entry-27.js +12 -1
  48. package/dist/entry-28.js +1 -1
  49. package/dist/entry-29.js +1 -1
  50. package/dist/entry-30.js +1 -1
  51. package/dist/entry-31.js +1 -4
  52. package/dist/entry-32.js +3 -8
  53. package/dist/entry-33.js +9 -1
  54. package/dist/entry-34.js +1 -1
  55. package/dist/entry-35.js +1 -1
  56. package/dist/entry-36.js +1 -1
  57. package/dist/entry-37.js +1 -1
  58. package/dist/entry-38.js +1 -1
  59. package/dist/entry-39.js +1 -1
  60. package/dist/entry-40.js +1 -18
  61. package/dist/entry-41.js +18 -1
  62. package/dist/entry-42.js +1 -1
  63. package/dist/entry-43.js +1 -1
  64. package/dist/entry-44.js +1 -1
  65. package/dist/entry-45.js +1 -7
  66. package/dist/entry-46.js +7 -11
  67. package/dist/entry-47.js +11 -1
  68. package/dist/entry-48.js +1 -1
  69. package/dist/entry-49.js +1 -1
  70. package/dist/entry-50.js +1 -1
  71. package/dist/entry-51.js +1 -1
  72. package/dist/entry-52.js +1 -1
  73. package/dist/entry-53.js +1 -1
  74. package/dist/entry-54.js +1 -1
  75. package/dist/entry-55.js +1 -0
  76. package/dist/entry-56.js +0 -1
  77. package/dist/entry-57.js +1 -0
  78. package/dist/entry-58.js +0 -1
  79. package/dist/entry-59.js +1 -1
  80. package/dist/entry-60.js +1 -1
  81. package/dist/entry-61.js +1 -1
  82. package/dist/entry-62.js +1 -1
  83. package/dist/entry-63.js +1 -1
  84. package/dist/entry-64.js +1 -0
  85. package/dist/entry-65.js +0 -1
  86. package/dist/entry-66.js +1 -0
  87. package/dist/entry-67.js +0 -1
  88. package/dist/entry-68.js +1 -1
  89. package/dist/entry-69.js +1 -1
  90. package/dist/entry-70.js +1 -123
  91. package/dist/entry-71.js +198 -25
  92. package/dist/entry-72.js +30 -2
  93. package/dist/entry-73.js +2 -1
  94. package/dist/entry-74.js +1 -1
  95. package/dist/entry-75.js +1 -1
  96. package/dist/entry-76.js +1 -3
  97. package/dist/entry-77.js +3 -1
  98. package/dist/entry-78.js +1 -1
  99. package/dist/entry-79.js +1 -1
  100. package/dist/entry-8.js +1 -1
  101. package/dist/entry-80.js +1 -0
  102. package/dist/entry-9.js +1 -1
  103. package/dist/pi-agent-ide.js +3 -3
  104. package/docs/configuration.md +1 -1
  105. package/docs/tools.md +11 -0
  106. package/docs/user-hooks.md +68 -0
  107. package/node_modules/pi-agent-doctor/package.json +6 -6
  108. package/node_modules/pi-agent-doctor/runtime/entry-21.js +1 -0
  109. package/node_modules/pi-agent-doctor/src/catalog.ts +9 -1
  110. package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +5 -0
  111. package/node_modules/pi-agent-filesystem/package.json +7 -7
  112. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  113. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  114. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  115. package/node_modules/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
  116. package/node_modules/pi-agent-ide-ast/package.json +32 -11
  117. package/node_modules/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  118. package/node_modules/pi-agent-ide-ast/runtime/entry-27.js +2 -0
  119. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +16 -8
  120. package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
  121. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +22 -17
  122. package/node_modules/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
  123. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
  124. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +4 -1
  125. package/node_modules/pi-agent-ide-changes/index.ts +3 -1
  126. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  127. package/node_modules/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  128. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
  129. package/node_modules/pi-agent-ide-formatter/package.json +9 -4
  130. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  131. package/node_modules/pi-agent-ide-lint/package.json +13 -8
  132. package/node_modules/pi-agent-ide-lsp/index.ts +4 -1
  133. package/node_modules/pi-agent-ide-lsp/package.json +15 -10
  134. package/node_modules/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
  135. package/node_modules/pi-agent-image/package.json +3 -3
  136. package/node_modules/pi-agent-invariant/package.json +2 -2
  137. package/node_modules/pi-agent-pdf/package.json +3 -3
  138. package/node_modules/pi-agent-read/package.json +11 -11
  139. package/node_modules/pi-agent-read/runtime/entry-40.js +0 -1
  140. package/node_modules/pi-agent-read/runtime/entry-41.js +2 -0
  141. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  142. package/node_modules/pi-agent-read/src/api/rendering.ts +1 -1
  143. package/node_modules/pi-agent-read/src/api/tools/read.ts +32 -0
  144. package/node_modules/pi-agent-read/src/core/read-core.ts +8 -0
  145. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
  146. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +66 -4
  147. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +105 -5
  148. package/node_modules/pi-agent-resource/package.json +2 -2
  149. package/node_modules/pi-agent-resource/src/resource.ts +2 -0
  150. package/node_modules/pi-agent-search/package.json +7 -7
  151. package/node_modules/pi-agent-search/runtime/entry-45.js +0 -1
  152. package/node_modules/pi-agent-search/src/api/search-parameters.ts +5 -1
  153. package/node_modules/pi-agent-search-text/index.ts +1 -1
  154. package/node_modules/pi-agent-search-text/package.json +9 -9
  155. package/node_modules/pi-agent-search-text/runtime/entry-47.js +1 -0
  156. package/node_modules/pi-agent-search-text/src/resolvers.ts +47 -19
  157. package/node_modules/pi-agent-search-text/src/search-backend.ts +6 -15
  158. package/node_modules/pi-agent-search-text/src/search-presentation.ts +80 -0
  159. package/node_modules/pi-agent-search-text/src/search-renderer.ts +17 -1
  160. package/node_modules/pi-agent-search-text/src/search-result.ts +32 -12
  161. package/node_modules/pi-agent-search-text/src/search-session.ts +6 -3
  162. package/node_modules/pi-agent-text/package.json +3 -3
  163. package/node_modules/pi-agent-text/runtime/entry-49.js +1 -0
  164. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  165. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
  166. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  167. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  168. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
  169. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  170. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  171. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
  172. package/node_modules/pi-agent-text-editor/package.json +25 -25
  173. package/node_modules/pi-agent-text-editor/runtime/entry-70.js +0 -1
  174. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
  175. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
  176. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  177. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
  178. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
  179. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  180. package/node_modules/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
  181. package/node_modules/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
  182. package/node_modules/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
  183. package/node_modules/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
  184. package/node_modules/pi-agent-text-editor/src/core/apply/output.ts +37 -8
  185. package/node_modules/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
  186. package/node_modules/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
  187. package/node_modules/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
  188. package/node_modules/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
  189. package/node_modules/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
  190. package/node_modules/pi-agent-text-editor/src/core/extension.ts +3 -2
  191. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
  192. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +4 -4
  193. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
  194. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  195. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +182 -10
  196. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +135 -6
  197. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
  198. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
  199. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
  200. package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -0
  201. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  202. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +60 -2
  203. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  204. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
  205. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  206. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  207. package/node_modules/pi-agent-tool-ui/runtime/entry-75.js +1 -0
  208. package/node_modules/pi-agent-web/package.json +7 -7
  209. package/node_modules/pi-agent-web-html/package.json +3 -3
  210. package/node_modules/pi-agent-web-image/package.json +4 -4
  211. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  212. package/node_modules/pi-agent-web-text/package.json +4 -4
  213. package/node_modules/pi-agent-web-text/runtime/entry-80.js +2 -0
  214. package/package.json +61 -38
  215. package/src/api/hooks.ts +168 -0
  216. package/src/api/text-editor.ts +2 -0
  217. package/src/composite/builtin-extensions.ts +13 -0
  218. package/src/composite/extensions-config.ts +18 -0
  219. package/src/composite/module-labels.ts +12 -0
  220. package/src/composite/module-settings-store.ts +17 -1
  221. package/src/composite/module-settings.ts +34 -4
  222. package/src/composite/preferences.ts +26 -0
  223. package/src/composite/settings-panel.ts +62 -30
  224. package/src/core/reload-resource-store.ts +34 -0
  225. package/src/doctor/tip-provider.ts +1 -0
  226. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  227. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  228. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  229. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  230. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-25.js +2 -0
  231. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-22.js +2 -0
  232. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  233. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  234. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  235. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  236. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  237. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-80.js +2 -0
  238. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-76.js +2 -0
  239. package/src/extensions/pi-agent-read/package.json +11 -11
  240. package/src/extensions/pi-agent-read/runtime/entry-40.js +0 -1
  241. package/src/extensions/pi-agent-read/runtime/entry-41.js +2 -0
  242. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  243. package/src/extensions/pi-agent-read/src/api/rendering.ts +1 -1
  244. package/src/extensions/pi-agent-read/src/api/tools/read.ts +32 -0
  245. package/src/extensions/pi-agent-read/src/core/read-core.ts +8 -0
  246. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +38 -4
  247. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +66 -4
  248. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +105 -5
  249. package/src/extensions/pi-agent-search/package.json +7 -7
  250. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
  251. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
  252. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-47.js +1 -0
  253. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-48.js +1 -0
  254. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +47 -19
  255. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +6 -15
  256. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +80 -0
  257. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +17 -1
  258. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +32 -12
  259. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +6 -3
  260. package/src/extensions/pi-agent-search/runtime/entry-45.js +0 -1
  261. package/src/extensions/pi-agent-search/runtime/entry-46.js +2 -0
  262. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +5 -1
  263. package/src/extensions/pi-agent-text-editor/package.json +25 -25
  264. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  265. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-50.js +2 -0
  266. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  267. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-51.js +0 -1
  268. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-52.js +2 -0
  269. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  270. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-53.js +0 -1
  271. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-54.js +2 -0
  272. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -0
  273. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  274. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +60 -2
  275. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  276. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-73.js +2 -0
  277. package/src/extensions/pi-agent-text-editor/runtime/entry-70.js +0 -1
  278. package/src/extensions/pi-agent-text-editor/runtime/entry-71.js +2 -0
  279. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +7 -1
  280. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +3 -0
  281. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +1 -0
  282. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +47 -0
  283. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +6 -1
  284. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  285. package/src/extensions/pi-agent-text-editor/src/core/apply/apply-undo-store.ts +155 -0
  286. package/src/extensions/pi-agent-text-editor/src/core/apply/execution.ts +56 -77
  287. package/src/extensions/pi-agent-text-editor/src/core/apply/mixed-source.ts +7 -12
  288. package/src/extensions/pi-agent-text-editor/src/core/apply/mutation-outcome.ts +2 -0
  289. package/src/extensions/pi-agent-text-editor/src/core/apply/output.ts +37 -8
  290. package/src/extensions/pi-agent-text-editor/src/core/apply/prompt.ts +42 -37
  291. package/src/extensions/pi-agent-text-editor/src/core/apply/renderer.ts +51 -15
  292. package/src/extensions/pi-agent-text-editor/src/core/apply/runtime.ts +119 -20
  293. package/src/extensions/pi-agent-text-editor/src/core/apply/tool.ts +28 -7
  294. package/src/extensions/pi-agent-text-editor/src/core/apply/transaction.ts +387 -0
  295. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +3 -2
  296. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +68 -71
  297. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +4 -4
  298. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +11 -0
  299. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  300. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +182 -10
  301. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +135 -6
  302. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +9 -4
  303. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -2
  304. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -4
  305. package/src/pi-agent-ide.ts +2 -1
  306. package/src/plugins/pi-agent-ide-ast/package.json +32 -11
  307. package/src/plugins/pi-agent-ide-ast/runtime/entry-26.js +0 -1
  308. package/src/plugins/pi-agent-ide-ast/runtime/entry-27.js +2 -0
  309. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +16 -8
  310. package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +151 -0
  311. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +22 -17
  312. package/src/plugins/pi-agent-ide-ast/src/ast/syntax-tree.ts +25 -0
  313. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +52 -1
  314. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +4 -1
  315. package/src/plugins/pi-agent-ide-changes/index.ts +3 -1
  316. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  317. package/src/plugins/pi-agent-ide-changes/runtime/entry-28.js +0 -1
  318. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +42 -9
  319. package/src/plugins/pi-agent-ide-debugger/index.ts +573 -0
  320. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +73 -0
  321. package/src/plugins/pi-agent-ide-debugger/src/catalog.ts +306 -0
  322. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +338 -0
  323. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +349 -0
  324. package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +39 -0
  325. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +152 -0
  326. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +1344 -0
  327. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +14 -0
  328. package/src/plugins/pi-agent-ide-formatter/package.json +9 -4
  329. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  330. package/src/plugins/pi-agent-ide-lint/package.json +13 -8
  331. package/src/plugins/pi-agent-ide-lsp/index.ts +4 -1
  332. package/src/plugins/pi-agent-ide-lsp/package.json +15 -10
  333. package/src/plugins/pi-agent-ide-lsp/runtime/entry-33.js +2 -0
  334. package/src/plugins/pi-agent-ide-processes/index.ts +28 -0
  335. package/src/plugins/pi-agent-ide-processes/src/registry.ts +81 -0
  336. package/src/plugins/pi-agent-ide-processes/src/ui.ts +252 -0
  337. package/src/plugins/pi-agent-ide-terminal/index.ts +40 -0
  338. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +52 -0
  339. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +30 -0
  340. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +204 -0
  341. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +452 -0
  342. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +127 -0
  343. package/src/plugins/pi-agent-ide-terminal/src/search.ts +159 -0
  344. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +642 -0
  345. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +56 -0
  346. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +151 -0
  347. package/src/plugins/pi-agent-ide-terminal/src/types.ts +78 -0
  348. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +212 -0
  349. package/dist/chunk-5MSNYFDE.js +0 -1
  350. package/dist/chunk-B5KB2I7J.js +0 -3
  351. package/dist/chunk-NMFQGKPE.js +0 -2
  352. package/dist/chunk-OVUYPHDE.js +0 -1
  353. package/dist/chunk-RHV5STR3.js +0 -3
  354. package/dist/chunk-TPIHQYK2.js +0 -14
  355. package/dist/chunk-VCCMVQXU.js +0 -1
  356. package/dist/chunk-VZJIZXSH.js +0 -14
  357. package/dist/entry-16.js +0 -1
  358. package/node_modules/pi-agent-doctor/runtime/entry-16.js +0 -1
  359. package/node_modules/pi-agent-filesystem/runtime/entry-21.js +0 -2
  360. package/node_modules/pi-agent-ide-ast/runtime/entry-25.js +0 -1
  361. package/node_modules/pi-agent-ide-changes/runtime/entry-27.js +0 -1
  362. package/node_modules/pi-agent-image/runtime/entry-33.js +0 -1
  363. package/node_modules/pi-agent-resource/runtime/entry-41.js +0 -1
  364. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
  365. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
  366. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
  367. package/node_modules/pi-agent-text-editor/runtime/entry-54.js +0 -1
  368. package/node_modules/pi-agent-tool-call-interception/runtime/entry-73.js +0 -1
  369. package/node_modules/pi-agent-web/runtime/entry-75.js +0 -2
  370. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-22.js +0 -2
  371. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-21.js +0 -2
  372. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-76.js +0 -2
  373. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-75.js +0 -2
  374. package/src/extensions/pi-agent-read/runtime/entry-36.js +0 -1
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-46.js +0 -2
  376. package/src/extensions/pi-agent-search/runtime/entry-42.js +0 -1
  377. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-49.js +0 -2
  378. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-50.js +0 -1
  379. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-52.js +0 -1
  380. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-71.js +0 -2
  381. package/src/extensions/pi-agent-text-editor/runtime/entry-54.js +0 -1
  382. package/src/plugins/pi-agent-ide-ast/runtime/entry-25.js +0 -1
  383. package/src/plugins/pi-agent-ide-changes/runtime/entry-27.js +0 -1
  384. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-22.js +0 -0
  385. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
  386. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
  387. /package/node_modules/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
  388. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
  389. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
  390. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
  391. /package/node_modules/{pi-agent-invariant → pi-agent-image}/runtime/entry-34.js +0 -0
  392. /package/node_modules/{pi-agent-pdf → pi-agent-invariant}/runtime/entry-35.js +0 -0
  393. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-36.js +0 -0
  394. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-42.js +0 -0
  395. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-46.js +0 -0
  396. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-48.js +0 -0
  397. /package/node_modules/{pi-agent-text-editor-renderer → pi-agent-text-editor}/runtime/entry-71.js +0 -0
  398. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
  399. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-74.js +0 -0
  400. /package/node_modules/{pi-agent-web-html → pi-agent-web}/runtime/entry-76.js +0 -0
  401. /package/node_modules/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
  402. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
  403. /package/node_modules/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
  404. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-23.js +0 -0
  405. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-pdf}/runtime/entry-24.js +0 -0
  406. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-image → pi-agent-web-html}/runtime/entry-77.js +0 -0
  407. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-image}/runtime/entry-78.js +0 -0
  408. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-pdf}/runtime/entry-79.js +0 -0
  409. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor-renderer}/runtime/entry-72.js +0 -0
  410. /package/src/plugins/{pi-agent-ide-formatter → pi-agent-ide-changes}/runtime/entry-29.js +0 -0
  411. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-formatter}/runtime/entry-30.js +0 -0
  412. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-languages}/runtime/entry-31.js +0 -0
  413. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-lint}/runtime/entry-32.js +0 -0
@@ -1,25 +1,39 @@
1
1
  import { getSettingsListTheme, type Theme } from "@earendil-works/pi-coding-agent";
2
- import { matchesKey, SettingsList, Text, type SettingItem } from "@earendil-works/pi-tui";
2
+ import {
3
+ matchesKey,
4
+ SettingsList,
5
+ truncateToWidth,
6
+ visibleWidth,
7
+ type SettingItem,
8
+ } from "@earendil-works/pi-tui";
3
9
 
4
- /** Two settings tabs share staged choices; saving and canceling are explicit. */
10
+ type SettingsTab = "extensions" | "behavior" | "ui";
11
+ type SettingsItems = { modules: SettingItem[]; features: SettingItem[]; ui?: SettingItem[] };
12
+
13
+ /** Render staged Agent IDE settings in one bordered, keyboard-driven panel. */
5
14
  export function createSettingsPanel(
6
15
  theme: Theme,
7
- items: () => { modules: SettingItem[]; features: SettingItem[]; ui?: SettingItem[] },
16
+ items: () => SettingsItems,
8
17
  change: (tab: "modules" | "features" | "ui", id: string, value: string) => void,
9
18
  done: (save: boolean) => void,
10
19
  scope = "",
11
20
  ) {
12
- const tabs = ["modules", "features", "ui"] as const;
13
- let tab: (typeof tabs)[number] = "modules";
21
+ const tabs = ["extensions", "behavior", "ui"] as const;
22
+ let tab: SettingsTab = "extensions";
23
+ const itemKey = (selected: SettingsTab): keyof SettingsItems =>
24
+ selected === "extensions" ? "modules" : selected === "behavior" ? "features" : "ui";
25
+ const changeKey = (selected: SettingsTab): "modules" | "features" | "ui" =>
26
+ selected === "extensions" ? "modules" : selected === "behavior" ? "features" : "ui";
14
27
  const createList = () => {
15
- const entries = items()[tab] ?? [];
28
+ const key = itemKey(tab);
29
+ const entries = items()[key] ?? [];
16
30
  return new SettingsList(
17
31
  entries,
18
32
  12,
19
33
  getSettingsListTheme(),
20
34
  (id, value) => {
21
- change(tab, id, value);
22
- for (const next of items()[tab] ?? []) {
35
+ change(changeKey(tab), id, value);
36
+ for (const next of items()[key] ?? []) {
23
37
  const entry = entries.find((item) => item.id === next.id);
24
38
  if (entry) Object.assign(entry, next);
25
39
  }
@@ -29,30 +43,48 @@ export function createSettingsPanel(
29
43
  );
30
44
  };
31
45
  let list = createList();
46
+
47
+ const border = (value: string) => theme.fg("borderMuted", value);
48
+ const row = (content: string, width: number): string => {
49
+ if (width <= 1) return border("│");
50
+ const inner = width - 2;
51
+ const clipped = truncateToWidth(content, inner);
52
+ return `${border("│")}${clipped}${" ".repeat(Math.max(0, inner - visibleWidth(clipped)))}${border("│")}`;
53
+ };
54
+ const rule = (width: number): string =>
55
+ border(width <= 1 ? "├" : `├${"─".repeat(Math.max(0, width - 2))}┤`);
56
+
32
57
  return {
33
58
  render(width: number): string[] {
59
+ const panelWidth = Math.max(1, width);
60
+ const innerWidth = Math.max(1, panelWidth - 4);
61
+ const title = ` Agent IDE settings${scope ? ` · ${scope}` : ""} `;
62
+ const top =
63
+ panelWidth <= 1
64
+ ? border("╭")
65
+ : `${border("╭─")}${theme.fg("accent", theme.bold(truncateToWidth(title, Math.max(0, panelWidth - 3), "")))}${border(`${"─".repeat(Math.max(0, panelWidth - visibleWidth(title) - 3))}╮`)}`;
66
+ const labels: Record<SettingsTab, string> = {
67
+ extensions: "Features",
68
+ behavior: "Behavior",
69
+ ui: "UI",
70
+ };
71
+ const tabLine = tabs
72
+ .map((id) =>
73
+ id === tab
74
+ ? theme.fg("accent", theme.bold(`[ ${labels[id]} ]`))
75
+ : theme.fg("dim", ` ${labels[id]} `),
76
+ )
77
+ .join(" ");
78
+ const body = list.render(innerWidth).map((line) => row(` ${line} `, panelWidth));
79
+ const help = theme.fg("dim", " Tab switch · Enter change · Ctrl+S save · Esc cancel ");
34
80
  return [
35
- ...new Text(
36
- theme.fg("accent", theme.bold(`Agent IDE settings${scope ? ` · ${scope}` : ""}`)),
37
- 1,
38
- 0,
39
- ).render(width),
40
- ...new Text(
41
- tabs
42
- .map((id) => {
43
- const label = id === "ui" ? "UI" : id === "modules" ? "Modules" : "Features";
44
- return id === tab ? `[${label}]` : label;
45
- })
46
- .join(" "),
47
- 1,
48
- 0,
49
- ).render(width),
50
- ...list.render(width),
51
- ...new Text(
52
- theme.fg("dim", "Tab: switch tab · Enter: change · Ctrl+S: save · Esc: cancel"),
53
- 1,
54
- 0,
55
- ).render(width),
81
+ top,
82
+ row(` ${tabLine} `, panelWidth),
83
+ rule(panelWidth),
84
+ ...body,
85
+ rule(panelWidth),
86
+ row(help, panelWidth),
87
+ border(panelWidth <= 1 ? "╰" : `╰${"─".repeat(Math.max(0, panelWidth - 2))}╯`),
56
88
  ];
57
89
  },
58
90
  invalidate(): void {
@@ -62,7 +94,7 @@ export function createSettingsPanel(
62
94
  if (matchesKey(data, "tab") || matchesKey(data, "shift+tab")) {
63
95
  tab =
64
96
  tabs[(tabs.indexOf(tab) + (matchesKey(data, "shift+tab") ? 2 : 1)) % tabs.length] ??
65
- "modules";
97
+ "extensions";
66
98
  list = createList();
67
99
  } else if (matchesKey(data, "ctrl+s")) done(true);
68
100
  else list.handleInput(data);
@@ -0,0 +1,34 @@
1
+ const reloadResourceStoreKey = Symbol.for("pi-agent-ide.reload-resource-store");
2
+
3
+ type ReloadResourceStore = Map<string, unknown>;
4
+ type GlobalWithReloadResources = typeof globalThis & {
5
+ [reloadResourceStoreKey]?: ReloadResourceStore;
6
+ };
7
+
8
+ function store(): ReloadResourceStore {
9
+ const sharedGlobal = globalThis as GlobalWithReloadResources;
10
+ const existing = sharedGlobal[reloadResourceStoreKey];
11
+ if (existing !== undefined) return existing;
12
+ const created = new Map<string, unknown>();
13
+ sharedGlobal[reloadResourceStoreKey] = created;
14
+ return created;
15
+ }
16
+
17
+ /** Retain one live resource owner while extension modules reload in this process. */
18
+ export function retainReloadResource(key: string, value: unknown): void {
19
+ store().set(key, value);
20
+ }
21
+
22
+ /** Transfer a retained resource owner to the newly loaded extension instance. */
23
+ export function takeReloadResource(key: string): unknown {
24
+ const resources = store();
25
+ const value = resources.get(key);
26
+ resources.delete(key);
27
+ return value;
28
+ }
29
+
30
+ /** Remove a retained owner only when it is the expected instance. */
31
+ export function forgetReloadResource(key: string, value: unknown): void {
32
+ const resources = store();
33
+ if (resources.get(key) === value) resources.delete(key);
34
+ }
@@ -72,6 +72,7 @@ function setupItems(result: DoctorSetupRun): readonly SetupItem[] {
72
72
  .filter((language) => result.detectedLanguages.has(language))
73
73
  .join(", ");
74
74
  const capability = {
75
+ debugger: "debugging",
75
76
  formatter: "formatting",
76
77
  linter: "linting",
77
78
  lsp: "language support",
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-image": "0.3.0",
10
- "pi-agent-read": "0.3.0",
11
- "pi-agent-resource": "0.3.0",
12
- "pi-agent-text": "0.3.0",
13
- "pi-agent-text-editor": "0.3.0"
9
+ "pi-agent-image": "0.5.0",
10
+ "pi-agent-read": "0.5.0",
11
+ "pi-agent-resource": "0.5.0",
12
+ "pi-agent-text": "0.5.0",
13
+ "pi-agent-text-editor": "0.5.0"
14
14
  },
15
15
  "pi": {
16
16
  "extensions": [
17
- "./runtime/entry-21.js"
17
+ "./runtime/entry-22.js"
18
18
  ]
19
19
  },
20
20
  "peerDependencies": {
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-image",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#extension": "./index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-image": "0.3.0",
10
- "pi-agent-resource": "0.3.0"
9
+ "pi-agent-image": "0.5.0",
10
+ "pi-agent-resource": "0.5.0"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
14
- "./runtime/entry-22.js"
14
+ "./runtime/entry-23.js"
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-pdf",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-pdf": "0.3.0",
7
- "pi-agent-resource": "0.3.0"
6
+ "pi-agent-pdf": "0.5.0",
7
+ "pi-agent-resource": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-23.js"
11
+ "./runtime/entry-24.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pi-agent-filesystem-text",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#extension": "./index.ts"
7
7
  },
8
8
  "dependencies": {
9
- "pi-agent-resource": "0.3.0",
10
- "pi-agent-text": "0.3.0"
9
+ "pi-agent-resource": "0.5.0",
10
+ "pi-agent-text": "0.5.0"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
14
- "./runtime/entry-24.js"
14
+ "./runtime/entry-25.js"
15
15
  ]
16
16
  },
17
17
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../../../../../../dist/entry-25.js";
2
+ export { default } from "../../../../../../../../dist/entry-25.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../../../../dist/entry-22.js";
2
+ export { default } from "../../../../../../dist/entry-22.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-web",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,16 +8,16 @@
8
8
  "dependencies": {
9
9
  "defuddle": "^0.19.1",
10
10
  "linkedom": "^0.18.12",
11
- "pi-agent-doctor": "0.3.0",
12
- "pi-agent-image": "0.3.0",
13
- "pi-agent-read": "0.3.0",
14
- "pi-agent-resource": "0.3.0",
15
- "pi-agent-text": "0.3.0",
11
+ "pi-agent-doctor": "0.5.0",
12
+ "pi-agent-image": "0.5.0",
13
+ "pi-agent-read": "0.5.0",
14
+ "pi-agent-resource": "0.5.0",
15
+ "pi-agent-text": "0.5.0",
16
16
  "playwright-core": "^1.62.1"
17
17
  },
18
18
  "pi": {
19
19
  "extensions": [
20
- "./runtime/entry-75.js"
20
+ "./runtime/entry-76.js"
21
21
  ]
22
22
  },
23
23
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-web-html",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,11 +8,11 @@
8
8
  "dependencies": {
9
9
  "defuddle": "^0.19.1",
10
10
  "linkedom": "^0.18.12",
11
- "pi-agent-resource": "0.3.0"
11
+ "pi-agent-resource": "0.5.0"
12
12
  },
13
13
  "pi": {
14
14
  "extensions": [
15
- "./runtime/entry-76.js"
15
+ "./runtime/entry-77.js"
16
16
  ]
17
17
  },
18
18
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-web-image",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-image": "0.3.0",
7
- "pi-agent-resource": "0.3.0"
6
+ "pi-agent-image": "0.5.0",
7
+ "pi-agent-resource": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-77.js"
11
+ "./runtime/entry-78.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-web-pdf",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-pdf": "0.3.0",
7
- "pi-agent-resource": "0.3.0"
6
+ "pi-agent-pdf": "0.5.0",
7
+ "pi-agent-resource": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-78.js"
11
+ "./runtime/entry-79.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pi-agent-web-text",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-resource": "0.3.0",
7
- "pi-agent-text": "0.3.0"
6
+ "pi-agent-resource": "0.5.0",
7
+ "pi-agent-text": "0.5.0"
8
8
  },
9
9
  "pi": {
10
10
  "extensions": [
11
- "./runtime/entry-79.js"
11
+ "./runtime/entry-80.js"
12
12
  ]
13
13
  },
14
14
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export * from "../../../../../../../../dist/entry-80.js";
2
+ export { default } from "../../../../../../../../dist/entry-80.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../../../../dist/entry-76.js";
2
+ export { default } from "../../../../../../dist/entry-76.js";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-read",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -8,31 +8,31 @@
8
8
  "exports": {
9
9
  "./api/connect-plugin": {
10
10
  "types": "./src/api/connect-plugin.ts",
11
- "default": "./runtime/entry-36.js"
11
+ "default": "./runtime/entry-37.js"
12
12
  },
13
13
  "./api/rendering": {
14
14
  "types": "./src/api/rendering.ts",
15
- "default": "./runtime/entry-37.js"
15
+ "default": "./runtime/entry-38.js"
16
16
  },
17
17
  "./api/plugin-protocol": {
18
18
  "types": "./src/api/plugin-protocol.ts",
19
- "default": "./runtime/entry-38.js"
19
+ "default": "./runtime/entry-39.js"
20
20
  },
21
21
  "./api/tools/read": {
22
22
  "types": "./src/api/tools/read.ts",
23
- "default": "./runtime/entry-39.js"
23
+ "default": "./runtime/entry-40.js"
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "pi-agent-invariant": "0.3.0",
28
- "pi-agent-resource": "0.3.0",
29
- "pi-agent-text": "0.3.0",
30
- "pi-agent-tool-call-interception": "0.3.0",
31
- "pi-agent-tool-ui": "0.3.0"
27
+ "pi-agent-invariant": "0.5.0",
28
+ "pi-agent-resource": "0.5.0",
29
+ "pi-agent-text": "0.5.0",
30
+ "pi-agent-tool-call-interception": "0.5.0",
31
+ "pi-agent-tool-ui": "0.5.0"
32
32
  },
33
33
  "pi": {
34
34
  "extensions": [
35
- "./runtime/entry-40.js"
35
+ "./runtime/entry-41.js"
36
36
  ]
37
37
  },
38
38
  "peerDependencies": {
@@ -1,2 +1 @@
1
1
  export * from "../../../../dist/entry-40.js";
2
- export { default } from "../../../../dist/entry-40.js";
@@ -0,0 +1,2 @@
1
+ export * from "../../../../dist/entry-41.js";
2
+ export { default } from "../../../../dist/entry-41.js";
@@ -5,7 +5,7 @@ import type { ReadToolPluginApi } from "#src/api/tools/read.js";
5
5
 
6
6
  export const READ_PROTOCOL = "pi-agent-read";
7
7
 
8
- export const READ_API_VERSION = 11;
8
+ export const READ_API_VERSION = 13;
9
9
 
10
10
  export const READ_CORE_READY_EVENT = `${READ_PROTOCOL}/core/ready`;
11
11
 
@@ -8,6 +8,6 @@ export interface ReadResultRendererOptions {
8
8
  readonly nativeResources?: boolean;
9
9
  }
10
10
 
11
- export { createReadResultRenderer } from "#src/core/tools/read/read-renderer.js";
11
+ export { COMPACT_READ_ROWS, createReadResultRenderer } from "#src/core/tools/read/read-renderer.js";
12
12
 
13
13
  export type { ReadResultRenderer } from "#src/api/tools/read.js";
@@ -53,9 +53,14 @@ export interface ReadFailure {
53
53
  }
54
54
 
55
55
  export type ReadResultRenderer = NonNullable<ToolDefinition["renderResult"]>;
56
+ export type ReadCallRenderer = NonNullable<ToolDefinition["renderCall"]>;
56
57
 
57
58
  export interface ResourceResolverRegistration {
58
59
  readonly resolver: ResourceResolver;
60
+ /** Selects a resolver-specific call header before resource resolution. */
61
+ readonly matchesCall?: (source: string) => boolean;
62
+ /** Renders only the read call header; result rendering remains independent. */
63
+ readonly renderCall?: ReadCallRenderer;
59
64
  readonly priority?: number;
60
65
  readonly renderResult?: ReadResultRenderer;
61
66
  readonly preserveTruncatedOutput?: boolean;
@@ -247,6 +252,26 @@ export type ReadOutputReducer = (
247
252
  context: ResourceResolverContext,
248
253
  budget: ReadOutputBudget,
249
254
  ) => Promise<ReadToolResult | undefined>;
255
+ /** A resolved Resource access check that runs before Resource.read(). */
256
+ export interface ReadResourceGuardEvent {
257
+ readonly requestedSource: string;
258
+ readonly resourceSource: string;
259
+ readonly resolvedBy: string;
260
+ readonly cwd: string;
261
+ readonly request: ReadRequest;
262
+ readonly audience: "agent" | "script";
263
+ readonly signal?: AbortSignal;
264
+ }
265
+ export type ReadResourceGuardOutcome =
266
+ | { readonly kind: "accepted" }
267
+ | { readonly kind: "rejected"; readonly reason: string };
268
+ export interface ReadResourceGuardRegistration {
269
+ readonly id: string;
270
+ readonly guard: (
271
+ event: ReadResourceGuardEvent,
272
+ ) => ReadResourceGuardOutcome | Promise<ReadResourceGuardOutcome>;
273
+ }
274
+
250
275
  export interface ReadToolPluginApi {
251
276
  /** Registers a format-aware reducer shared by read and composed output. */
252
277
  addOutputReducer(reducer: ReadOutputReducer): void;
@@ -267,6 +292,8 @@ export interface ReadToolPluginApi {
267
292
  addResolver(registration: ResourceResolverRegistration): void;
268
293
  addTargetResolver(registration: TextTargetResolverRegistration): void;
269
294
  addHandler(registration: ReadHandlerRegistration): void;
295
+ /** Registers a fail-closed check over resolved Resources before their content is read. */
296
+ addResourceGuard(registration: ReadResourceGuardRegistration): void;
270
297
  /** Registers a named view whose presenter runs when a request lists the view. */
271
298
  addView(registration: ReadViewRegistration): void;
272
299
  addFragmentResolver(registration: FragmentResolverRegistration): void;
@@ -279,6 +306,8 @@ export interface ReadToolPluginApi {
279
306
  const functionSchema = Type.Function([], Type.Unknown());
280
307
  const resourceResolverRegistrationSchema = Type.Object({
281
308
  resolver: Type.Unknown(),
309
+ matchesCall: Type.Optional(functionSchema),
310
+ renderCall: Type.Optional(functionSchema),
282
311
  priority: Type.Optional(Type.Number()),
283
312
  renderResult: Type.Optional(functionSchema),
284
313
  preserveTruncatedOutput: Type.Optional(Type.Boolean()),
@@ -342,6 +371,9 @@ export function isResourceResolverRegistration(
342
371
  return (
343
372
  registration.resolver.id !== "any" &&
344
373
  (!("priority" in registration) || typeof registration.priority === "number") &&
374
+ (!("matchesCall" in registration) || typeof registration.matchesCall === "function") &&
375
+ (!("renderCall" in registration) || typeof registration.renderCall === "function") &&
376
+ "matchesCall" in registration === "renderCall" in registration &&
345
377
  (!("renderResult" in registration) || typeof registration.renderResult === "function")
346
378
  );
347
379
  }
@@ -14,6 +14,7 @@ import {
14
14
  type PromptDescriptionSource,
15
15
  type ReadHandlerRegistration,
16
16
  type ReadOutputReducer,
17
+ type ReadResourceGuardRegistration,
17
18
  type ReadViewRegistration,
18
19
  type ResourceResolverRegistration,
19
20
  type TextTargetResolverRegistration,
@@ -166,6 +167,7 @@ function createPluginContributionController(
166
167
  const setupPromptContributions: PromptDescriptionSource[] = [];
167
168
 
168
169
  const setupPromptGuidelines: PromptDescriptionSource[] = [];
170
+ const setupResourceGuards: ReadResourceGuardRegistration[] = [];
169
171
  const setupResolvers: ResourceResolverRegistration[] = [];
170
172
  const setupTargetResolvers: TextTargetResolverRegistration[] = [];
171
173
  const setupReadHandlers: ReadHandlerRegistration[] = [];
@@ -200,6 +202,11 @@ function createPluginContributionController(
200
202
  assertAvailable();
201
203
  return read.execute(request, context, audience);
202
204
  },
205
+ addResourceGuard(registration): void {
206
+ assertAvailable();
207
+ if (state === "setup") setupResourceGuards.push(registration);
208
+ else read.registerContributions(pluginId, { resourceGuards: [registration] });
209
+ },
203
210
  addResolver(registration): void {
204
211
  assertAvailable();
205
212
  if (!isResourceResolverRegistration(registration)) {
@@ -305,6 +312,7 @@ function createPluginContributionController(
305
312
  }
306
313
 
307
314
  read.registerContributions(pluginId, {
315
+ resourceGuards: setupResourceGuards,
308
316
  resolvers: setupResolvers,
309
317
  targetResolvers: setupTargetResolvers,
310
318
  handlers: setupReadHandlers,
@@ -1,8 +1,12 @@
1
- import { open, stat } from "node:fs/promises";
1
+ import { open, realpath, stat } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
- import type { ReadRequest, ReadToolResult } from "#src/api/tools/read.js";
5
+ import type {
6
+ ReadRequest,
7
+ ReadResourceGuardRegistration,
8
+ ReadToolResult,
9
+ } from "#src/api/tools/read.js";
6
10
  import { failureResult } from "#src/core/tools/read/read-result.js";
7
11
  import {
8
12
  READ_OUTPUT_MAX_BYTES,
@@ -14,6 +18,7 @@ export async function readRaw(
14
18
  request: ReadRequest,
15
19
  context: { cwd: string; signal?: AbortSignal },
16
20
  audience: "agent" | "script",
21
+ guards: readonly { readonly registration: ReadResourceGuardRegistration }[] = [],
17
22
  ): Promise<ReadToolResult> {
18
23
  const requested = request.path ?? "";
19
24
  try {
@@ -28,9 +33,39 @@ export async function readRaw(
28
33
  throw new Error("Use an integer byte offset and a non-negative integer byte limit");
29
34
  const input = requested.slice(4);
30
35
  if (input.length === 0) throw new Error("Supply a local file after raw:");
31
- const file = input.startsWith("file://")
36
+ const requestedFile = input.startsWith("file://")
32
37
  ? fileURLToPath(input)
33
38
  : path.resolve(context.cwd, input);
39
+ const file = await realpath(requestedFile);
40
+ const source = `raw:${file}`;
41
+ for (const { registration } of guards) {
42
+ try {
43
+ const outcome = await registration.guard({
44
+ requestedSource: requested,
45
+ resourceSource: source,
46
+ resolvedBy: "raw",
47
+ cwd: context.cwd,
48
+ request,
49
+ audience,
50
+ ...(context.signal !== undefined && { signal: context.signal }),
51
+ });
52
+ if (outcome.kind === "rejected")
53
+ return failureResult({
54
+ code: "READ_FAILED",
55
+ source,
56
+ resolverId: "raw",
57
+ message: `Read blocked by hook ${registration.id}: ${outcome.reason}`,
58
+ });
59
+ } catch (error) {
60
+ return failureResult({
61
+ code: "READ_FAILED",
62
+ source,
63
+ resolverId: "raw",
64
+ message: `Read blocked because hook ${registration.id} failed: ${error instanceof Error ? error.message : String(error)}`,
65
+ cause: error,
66
+ });
67
+ }
68
+ }
34
69
  context.signal?.throwIfAborted();
35
70
  if (!(await stat(file)).isFile()) throw new Error("Raw reads require a regular file");
36
71
  const handle = await open(file, "r");
@@ -58,7 +93,6 @@ export async function readRaw(
58
93
  }
59
94
  context.signal?.throwIfAborted();
60
95
  const bytes = buffer.subarray(0, count);
61
- const source = `raw:${file}`;
62
96
  const nextOffset = start + count;
63
97
  const hasMore = nextOffset < stat.size;
64
98
  const header = `${source}\nBytes ${start}..${nextOffset} (end exclusive), ${stat.size} bytes total`;