pi-agent-ide 0.9.5 → 0.9.6

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 (683) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{chunk-BU7IZLKB.js → chunk-2DSY4U73.js} +1 -1
  3. package/dist/chunk-2YO6RVX4.js +1 -0
  4. package/dist/{chunk-CJPS4GXD.js → chunk-34IYWKY5.js} +1 -1
  5. package/dist/{chunk-TL4PHMAU.js → chunk-4CSNQX54.js} +1 -1
  6. package/dist/{chunk-I7AGYUPS.js → chunk-53IV6EKV.js} +1 -1
  7. package/dist/{chunk-K2G3IMXR.js → chunk-5DN2XBVI.js} +1 -1
  8. package/dist/{chunk-D45H2PNW.js → chunk-6W4OJLCJ.js} +1 -1
  9. package/dist/{chunk-JDAH3IXR.js → chunk-6ZYCTWQE.js} +1 -1
  10. package/dist/{chunk-BB4A5UI3.js → chunk-7JWZPJI5.js} +1 -1
  11. package/dist/{chunk-ULO3YOBE.js → chunk-AMSNDWBT.js} +1 -1
  12. package/dist/{chunk-DMHLIVN6.js → chunk-APWMLLSE.js} +6 -6
  13. package/dist/{chunk-U2ROTQLD.js → chunk-B5UJCNQU.js} +1 -1
  14. package/dist/{chunk-VWP2HLFT.js → chunk-BMSAVDRD.js} +6 -6
  15. package/dist/{chunk-A75GMLA4.js → chunk-BRJIXNFU.js} +1 -1
  16. package/dist/{chunk-IMMOFDTW.js → chunk-C2GZLLSP.js} +2 -2
  17. package/dist/{chunk-KUPYPCRL.js → chunk-DHOIQZUF.js} +1 -1
  18. package/dist/{chunk-DFUGBEHK.js → chunk-ECSMTGVM.js} +3 -3
  19. package/dist/{chunk-DEP55R35.js → chunk-EHFWODRT.js} +1 -1
  20. package/dist/{chunk-UCTBXRGA.js → chunk-FBR7ZLLN.js} +1 -1
  21. package/dist/{chunk-ANTYGMDR.js → chunk-FGN2ZMEN.js} +1 -1
  22. package/dist/{chunk-QBA36YEN.js → chunk-FJSYWOE6.js} +1 -1
  23. package/dist/chunk-H6FEBUAP.js +1 -0
  24. package/dist/{chunk-Y6FXFXCN.js → chunk-HFF4GY7R.js} +1 -1
  25. package/dist/{chunk-WPATZK4Y.js → chunk-HJXSEPO7.js} +1 -1
  26. package/dist/{chunk-7IYO2R47.js → chunk-HSEDKYH4.js} +1 -1
  27. package/dist/{chunk-VNCQGBM6.js → chunk-II7AOJNH.js} +1 -1
  28. package/dist/{chunk-GFITSPSQ.js → chunk-J6CDIH3S.js} +15 -15
  29. package/dist/{chunk-V6IPWCPS.js → chunk-JHWLRL4U.js} +1 -1
  30. package/dist/{chunk-FNJ6X7OP.js → chunk-JMQ67UNK.js} +1 -1
  31. package/dist/{chunk-KMFQBEIR.js → chunk-JRIP33PC.js} +1 -1
  32. package/dist/chunk-JYITLCXC.js +1 -0
  33. package/dist/{chunk-7D4ZCPH4.js → chunk-LIGOOMJS.js} +3 -3
  34. package/dist/{chunk-FUOB54RU.js → chunk-LY2UANKU.js} +3 -3
  35. package/dist/chunk-M7P7V4WI.js +25 -0
  36. package/dist/{chunk-W4IAODWI.js → chunk-NF74ITWT.js} +2 -2
  37. package/dist/{chunk-EL4KJ3Q2.js → chunk-NQYUIQRH.js} +1 -1
  38. package/dist/{chunk-MZW7L37L.js → chunk-OIEA4QWF.js} +2 -2
  39. package/dist/{chunk-3E7YABYT.js → chunk-ON5HDFNL.js} +1 -1
  40. package/dist/{chunk-G3OPALJH.js → chunk-P43GGKUC.js} +5 -5
  41. package/dist/{chunk-GCJHOMSI.js → chunk-P7FUD4WY.js} +1 -1
  42. package/dist/{chunk-72YIFABM.js → chunk-QGXZ4RWX.js} +1 -1
  43. package/dist/{chunk-ALZV2EYT.js → chunk-S7E2D5K7.js} +2 -2
  44. package/dist/{chunk-5GASXMD2.js → chunk-T5ACAOKJ.js} +3 -3
  45. package/dist/{chunk-7GKCQCMS.js → chunk-TWJINFQB.js} +4 -4
  46. package/dist/{chunk-2WQFGBV2.js → chunk-TWQ6ACOI.js} +1 -1
  47. package/dist/chunk-UDVVKVG4.js +1 -0
  48. package/dist/{chunk-NFXS3E2A.js → chunk-V2D5MLGE.js} +1 -1
  49. package/dist/{chunk-6TOFURDG.js → chunk-VDSSAP6Y.js} +1 -1
  50. package/dist/{chunk-AVJVTF5H.js → chunk-VHYJTAXX.js} +1 -1
  51. package/dist/{chunk-6UGSUMTI.js → chunk-WCSWQDJ2.js} +1 -1
  52. package/dist/{chunk-X6VMRL6L.js → chunk-WQTF6Q2X.js} +1 -1
  53. package/dist/{chunk-Q6JB5VAP.js → chunk-YFPU2LRR.js} +7 -7
  54. package/dist/{chunk-ISNWEIUW.js → chunk-YLEERRX3.js} +13 -13
  55. package/dist/{chunk-6BAGTM7U.js → chunk-YOJHCARZ.js} +1 -1
  56. package/dist/chunk-YPTDPMK5.js +1 -0
  57. package/dist/{chunk-37UNDG6V.js → chunk-YZTVC7ME.js} +1 -1
  58. package/dist/entry-0.js +1 -1
  59. package/dist/entry-10.js +1 -1
  60. package/dist/entry-11.js +1 -1
  61. package/dist/entry-14.js +1 -1
  62. package/dist/entry-15.js +1 -1
  63. package/dist/entry-17.js +1 -1
  64. package/dist/entry-21.js +1 -1
  65. package/dist/entry-22.js +1 -1
  66. package/dist/entry-25.js +1 -1
  67. package/dist/entry-31.js +1 -1
  68. package/dist/entry-33.js +1 -1
  69. package/dist/entry-34.js +1 -1
  70. package/dist/entry-36.js +1 -1
  71. package/dist/entry-37.js +1 -1
  72. package/dist/entry-38.js +3 -3
  73. package/dist/entry-39.js +1 -1
  74. package/dist/entry-4.js +1 -1
  75. package/dist/entry-40.js +1 -1
  76. package/dist/entry-41.js +1 -1
  77. package/dist/entry-42.js +1 -1
  78. package/dist/entry-43.js +1 -1
  79. package/dist/entry-44.js +1 -1
  80. package/dist/entry-48.js +1 -1
  81. package/dist/entry-49.js +1 -1
  82. package/dist/entry-50.js +1 -1
  83. package/dist/entry-51.js +1 -1
  84. package/dist/entry-52.js +1 -1
  85. package/dist/entry-57.js +1 -1
  86. package/dist/entry-58.js +1 -1
  87. package/dist/entry-59.js +1 -1
  88. package/dist/entry-60.js +1 -1
  89. package/dist/entry-62.js +1 -1
  90. package/dist/entry-63.js +1 -1
  91. package/dist/entry-64.js +1 -1
  92. package/dist/entry-65.js +1 -1
  93. package/dist/entry-66.js +1 -1
  94. package/dist/entry-67.js +1 -1
  95. package/dist/entry-69.js +1 -1
  96. package/dist/entry-72.js +1 -1
  97. package/dist/entry-74.js +1 -1
  98. package/dist/entry-75.js +1 -1
  99. package/dist/entry-79.js +1 -1
  100. package/dist/entry-84.js +1 -1
  101. package/dist/entry-85.js +1 -1
  102. package/dist/entry-86.js +1 -1
  103. package/dist/entry-90.js +1 -1
  104. package/dist/entry-94.js +1 -1
  105. package/dist/pi-agent-ide.js +6 -6
  106. package/docs/development.md +2 -0
  107. package/node_modules/pi-agent-doctor/package.json +1 -1
  108. package/node_modules/pi-agent-doctor/src/connect-plugin.ts +2 -2
  109. package/node_modules/pi-agent-doctor/src/evidence.ts +1 -1
  110. package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +2 -2
  111. package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +4 -4
  112. package/node_modules/pi-agent-doctor/src/project-probes.ts +2 -2
  113. package/node_modules/pi-agent-doctor/src/workspace.ts +2 -2
  114. package/node_modules/pi-agent-documentation/package.json +1 -1
  115. package/node_modules/pi-agent-filesystem/index.ts +2 -2
  116. package/node_modules/pi-agent-filesystem/package.json +7 -7
  117. package/node_modules/pi-agent-filesystem/src/resolver.ts +2 -2
  118. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  119. package/node_modules/pi-agent-filesystem-jq/index.ts +1 -1
  120. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  121. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
  122. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  123. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  124. package/node_modules/pi-agent-ide-ast/index.ts +1 -1
  125. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  126. package/node_modules/pi-agent-ide-ast/src/api/scope.ts +1 -1
  127. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +2 -2
  128. package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
  129. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +5 -5
  130. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +1 -1
  131. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  132. package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
  133. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
  134. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +1 -1
  135. package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
  136. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +1 -1
  137. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
  138. package/node_modules/pi-agent-ide-changes/index.ts +9 -9
  139. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  140. package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +4 -4
  141. package/node_modules/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
  142. package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
  143. package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
  144. package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
  145. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
  146. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
  147. package/node_modules/pi-agent-ide-formatter/index.ts +5 -5
  148. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  149. package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
  150. package/node_modules/pi-agent-ide-formatter/src/formatter.ts +2 -2
  151. package/node_modules/pi-agent-ide-formatter/src/registry.ts +1 -1
  152. package/node_modules/pi-agent-ide-languages/index.ts +1 -1
  153. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  154. package/node_modules/pi-agent-ide-lint/index.ts +9 -9
  155. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  156. package/node_modules/pi-agent-ide-lint/src/command-linter.ts +2 -2
  157. package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
  158. package/node_modules/pi-agent-ide-lint/src/registry.ts +1 -1
  159. package/node_modules/pi-agent-ide-lsp/index.ts +17 -17
  160. package/node_modules/pi-agent-ide-lsp/package.json +12 -12
  161. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +3 -3
  162. package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +3 -3
  163. package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
  164. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +7 -7
  165. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +9 -9
  166. package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
  167. package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +4 -4
  168. package/node_modules/pi-agent-ide-lsp/src/lsp/document-leases.ts +1 -1
  169. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
  170. package/node_modules/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
  171. package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +4 -4
  172. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +13 -13
  173. package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +3 -3
  174. package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
  175. package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +1 -1
  176. package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
  177. package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
  178. package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
  179. package/node_modules/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +17 -5
  180. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +7 -7
  181. package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
  182. package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
  183. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
  184. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +8 -8
  185. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +4 -4
  186. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
  187. package/node_modules/pi-agent-image/package.json +2 -2
  188. package/node_modules/pi-agent-image/src/index.ts +1 -1
  189. package/node_modules/pi-agent-invariant/package.json +1 -1
  190. package/node_modules/pi-agent-pdf/package.json +2 -2
  191. package/node_modules/pi-agent-pdf/src/index.ts +1 -1
  192. package/node_modules/pi-agent-read/index.ts +1 -1
  193. package/node_modules/pi-agent-read/package.json +7 -7
  194. package/node_modules/pi-agent-read/src/api/connect-plugin.ts +1 -1
  195. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  196. package/node_modules/pi-agent-read/src/api/read-parameters.ts +1 -1
  197. package/node_modules/pi-agent-read/src/api/rendering.ts +2 -2
  198. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -2
  199. package/node_modules/pi-agent-read/src/core/extension.ts +4 -4
  200. package/node_modules/pi-agent-read/src/core/read-core.ts +4 -4
  201. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
  202. package/node_modules/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
  203. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
  204. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
  205. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +1 -1
  206. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +1 -1
  207. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
  208. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +7 -7
  209. package/node_modules/pi-agent-resource/package.json +1 -1
  210. package/node_modules/pi-agent-resource/src/content-conversion/connect-plugin.ts +4 -4
  211. package/node_modules/pi-agent-resource/src/content-conversion/content-converter.ts +1 -1
  212. package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -1
  213. package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +4 -4
  214. package/node_modules/pi-agent-resource/src/content-conversion/content-runner.ts +3 -3
  215. package/node_modules/pi-agent-resource/src/content-conversion/plugin-protocol.ts +2 -2
  216. package/node_modules/pi-agent-resource/src/content-conversion/validation.ts +2 -2
  217. package/node_modules/pi-agent-resource/src/index.ts +19 -19
  218. package/node_modules/pi-agent-resource/src/resolver.ts +1 -1
  219. package/node_modules/pi-agent-resource/src/resource-access.ts +1 -1
  220. package/node_modules/pi-agent-resource/src/resource-error.ts +1 -1
  221. package/node_modules/pi-agent-resource/src/resource.ts +1 -1
  222. package/node_modules/pi-agent-resource/src/result-images.ts +1 -1
  223. package/node_modules/pi-agent-resource/src/temp-resource-store.ts +2 -2
  224. package/node_modules/pi-agent-resource/src/tool-result.ts +2 -2
  225. package/node_modules/pi-agent-resource/src/validation.ts +3 -3
  226. package/node_modules/pi-agent-search/index.ts +1 -1
  227. package/node_modules/pi-agent-search/package.json +5 -5
  228. package/node_modules/pi-agent-search/src/api/connect-plugin.ts +1 -1
  229. package/node_modules/pi-agent-search/src/api/fuzzy.ts +2 -2
  230. package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  231. package/node_modules/pi-agent-search/src/api/presentation.ts +1 -1
  232. package/node_modules/pi-agent-search/src/api/search-scope.ts +1 -1
  233. package/node_modules/pi-agent-search/src/api/search.ts +7 -7
  234. package/node_modules/pi-agent-search/src/core/extension.ts +7 -7
  235. package/node_modules/pi-agent-search/src/core/search-core.ts +3 -3
  236. package/node_modules/pi-agent-search-text/index.ts +8 -8
  237. package/node_modules/pi-agent-search-text/package.json +10 -10
  238. package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +1 -1
  239. package/node_modules/pi-agent-search-text/src/file-search.ts +1 -1
  240. package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +2 -2
  241. package/node_modules/pi-agent-search-text/src/persisted-result.ts +1 -1
  242. package/node_modules/pi-agent-search-text/src/resolvers.ts +9 -9
  243. package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -4
  244. package/node_modules/pi-agent-search-text/src/search-backend.ts +3 -3
  245. package/node_modules/pi-agent-search-text/src/search-presentation.ts +1 -1
  246. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -2
  247. package/node_modules/pi-agent-search-text/src/search-renderer.ts +3 -3
  248. package/node_modules/pi-agent-search-text/src/search-result.ts +2 -2
  249. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -1
  250. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +1 -1
  251. package/node_modules/pi-agent-text/package.json +2 -2
  252. package/node_modules/pi-agent-text/src/index.ts +7 -7
  253. package/node_modules/pi-agent-text/src/source-line.ts +1 -1
  254. package/node_modules/pi-agent-text/src/text-document.ts +1 -1
  255. package/node_modules/pi-agent-text-anchor-constant/index.ts +1 -1
  256. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  257. package/node_modules/pi-agent-text-anchor-exact/index.ts +2 -2
  258. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  259. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +2 -2
  260. package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
  261. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -2
  262. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  263. package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -1
  264. package/node_modules/pi-agent-text-editor/index.ts +5 -5
  265. package/node_modules/pi-agent-text-editor/package.json +9 -9
  266. package/node_modules/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
  267. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
  268. package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +2 -2
  269. package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
  270. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
  271. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
  272. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
  273. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
  274. package/node_modules/pi-agent-text-editor/src/api/native-files.ts +1 -1
  275. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
  276. package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -3
  277. package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
  278. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
  279. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
  280. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
  281. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -13
  282. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
  283. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
  284. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +5 -5
  285. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  286. package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
  287. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +1 -1
  288. package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +3 -3
  289. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
  290. package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -2
  291. package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
  292. package/node_modules/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
  293. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
  294. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
  295. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
  296. package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
  297. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +1 -1
  298. package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
  299. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
  300. package/node_modules/pi-agent-text-editor/src/core/source-change-retry.ts +1 -1
  301. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +2 -2
  302. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
  303. package/node_modules/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
  304. package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
  305. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
  306. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
  307. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +19 -19
  308. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
  309. package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
  310. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +19 -19
  311. package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
  312. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +29 -29
  313. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
  314. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
  315. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
  316. package/node_modules/pi-agent-text-editor/src/tools/extension.ts +7 -7
  317. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
  318. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
  319. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
  320. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
  321. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
  322. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
  323. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
  324. package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -5
  325. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  326. package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
  327. package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
  328. package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
  329. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
  330. package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
  331. package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
  332. package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
  333. package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
  334. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
  335. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  336. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  337. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  338. package/node_modules/pi-agent-tool-ui/src/index.ts +1 -1
  339. package/node_modules/pi-agent-tool-ui/src/result-panel.ts +1 -1
  340. package/node_modules/pi-agent-web/index.ts +3 -3
  341. package/node_modules/pi-agent-web/package.json +7 -7
  342. package/node_modules/pi-agent-web/src/doctor-plugin.ts +1 -1
  343. package/node_modules/pi-agent-web/src/resolver.ts +1 -1
  344. package/node_modules/pi-agent-web-html/index.ts +1 -1
  345. package/node_modules/pi-agent-web-html/package.json +2 -2
  346. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  347. package/node_modules/pi-agent-web-image/package.json +3 -3
  348. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  349. package/node_modules/pi-agent-web-text/package.json +3 -3
  350. package/package.json +35 -35
  351. package/src/api/code-view.ts +3 -3
  352. package/src/api/connect-plugin.ts +1 -1
  353. package/src/api/connect-tip-provider.ts +2 -2
  354. package/src/api/doctor-runtime.ts +1 -1
  355. package/src/api/doctor.ts +1 -1
  356. package/src/api/hooks.ts +2 -2
  357. package/src/api/plugin-protocol.ts +1 -1
  358. package/src/api/standalone.ts +1 -1
  359. package/src/api/tips.ts +1 -1
  360. package/src/api/toolchain.ts +3 -3
  361. package/src/backend/config.ts +2 -2
  362. package/src/backend/configured-process.ts +5 -5
  363. package/src/backend/dap-java-transport.ts +6 -6
  364. package/src/backend/dap-node-transport.ts +5 -5
  365. package/src/backend/dap-tcp-transport.ts +3 -3
  366. package/src/backend/dap-transport.ts +5 -5
  367. package/src/backend/debugger-registration.ts +7 -7
  368. package/src/backend/debugger-workspace-owner.ts +10 -10
  369. package/src/backend/doctor-registration.ts +5 -5
  370. package/src/backend/doctor-workspace.ts +13 -13
  371. package/src/backend/file-operation-resolver.ts +5 -5
  372. package/src/backend/file-revision.ts +1 -1
  373. package/src/backend/file-transfer.ts +4 -4
  374. package/src/backend/formatter-registration.ts +11 -11
  375. package/src/backend/git-registration.ts +4 -4
  376. package/src/backend/index.ts +3 -3
  377. package/src/backend/lint-registration.ts +11 -11
  378. package/src/backend/lsp-file-watchers.ts +5 -5
  379. package/src/backend/lsp-registration.ts +11 -11
  380. package/src/backend/lsp-transport.ts +7 -7
  381. package/src/backend/lsp-workspace-owner.ts +4 -4
  382. package/src/backend/object-transfer.ts +5 -5
  383. package/src/backend/owned-command.ts +2 -2
  384. package/src/backend/owned-process-stop.ts +4 -4
  385. package/src/backend/owned-read-command.ts +2 -2
  386. package/src/backend/process-environment.ts +2 -2
  387. package/src/backend/process-metadata.ts +2 -2
  388. package/src/backend/recipe-evidence.ts +2 -2
  389. package/src/backend/registration.ts +8 -8
  390. package/src/backend/registry.ts +2 -2
  391. package/src/backend/resource-resolver.ts +2 -2
  392. package/src/backend/search-environment.ts +3 -3
  393. package/src/backend/ssh-channel.ts +3 -3
  394. package/src/backend/ssh-transport.ts +2 -2
  395. package/src/backend/ssh.ts +6 -6
  396. package/src/backend/tool-config-access.ts +4 -4
  397. package/src/backend/tool-project.ts +5 -5
  398. package/src/backend/web-browser.ts +3 -3
  399. package/src/backend/web-http.ts +2 -2
  400. package/src/backend/web-owner.ts +5 -5
  401. package/src/backend/web-registration.ts +5 -5
  402. package/src/code-review/extension.ts +3 -3
  403. package/src/code-review/reviewer.ts +2 -2
  404. package/src/code-view/diagnostic-view.ts +4 -4
  405. package/src/composite/builtin-extensions.ts +37 -37
  406. package/src/composite/capabilities.ts +2 -2
  407. package/src/composite/capability-schemas.ts +1 -1
  408. package/src/composite/extensions-config.ts +2 -2
  409. package/src/composite/module-settings-store.ts +2 -2
  410. package/src/composite/module-settings.ts +12 -12
  411. package/src/composite/nested-tool-rendering.ts +3 -3
  412. package/src/composite/output-limits.ts +6 -1
  413. package/src/composite/presets.ts +1 -1
  414. package/src/composite/reload-required.ts +6 -6
  415. package/src/composite/settings-documentation.ts +5 -5
  416. package/src/composite/settings-registry.ts +4 -4
  417. package/src/composite/text-results.ts +2 -2
  418. package/src/core/diagnostic-entry.ts +2 -2
  419. package/src/core/diagnostic-store.ts +3 -3
  420. package/src/core/extension.ts +8 -8
  421. package/src/core/ide-core.ts +4 -4
  422. package/src/doctor/config-writer.ts +3 -3
  423. package/src/doctor/core.ts +2 -2
  424. package/src/doctor/discovery.ts +4 -4
  425. package/src/doctor/extension.ts +7 -7
  426. package/src/doctor/index.ts +1 -1
  427. package/src/doctor/inventory.ts +1 -1
  428. package/src/doctor/run.ts +6 -6
  429. package/src/doctor/tip-provider.ts +2 -2
  430. package/src/documentation/extension.ts +3 -3
  431. package/src/documentation/registry.ts +1 -1
  432. package/src/documentation/search.ts +1 -1
  433. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
  434. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  435. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  436. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +1 -1
  437. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  438. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
  439. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  440. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  441. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +2 -2
  442. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +3 -3
  443. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  444. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/index.ts +1 -1
  445. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  446. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  447. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  448. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  449. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  450. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +1 -1
  451. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +1 -1
  452. package/src/extensions/pi-agent-read/index.ts +1 -1
  453. package/src/extensions/pi-agent-read/package.json +7 -7
  454. package/src/extensions/pi-agent-read/src/api/connect-plugin.ts +1 -1
  455. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  456. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +1 -1
  457. package/src/extensions/pi-agent-read/src/api/rendering.ts +2 -2
  458. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -2
  459. package/src/extensions/pi-agent-read/src/core/extension.ts +4 -4
  460. package/src/extensions/pi-agent-read/src/core/read-core.ts +4 -4
  461. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
  462. package/src/extensions/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
  463. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
  464. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
  465. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +1 -1
  466. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +1 -1
  467. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
  468. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +7 -7
  469. package/src/extensions/pi-agent-search/index.ts +1 -1
  470. package/src/extensions/pi-agent-search/package.json +5 -5
  471. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +8 -8
  472. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +10 -10
  473. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +1 -1
  474. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +1 -1
  475. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +2 -2
  476. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +1 -1
  477. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +9 -9
  478. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -4
  479. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +3 -3
  480. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +1 -1
  481. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -2
  482. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +3 -3
  483. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +2 -2
  484. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -1
  485. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +1 -1
  486. package/src/extensions/pi-agent-search/src/api/connect-plugin.ts +1 -1
  487. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +2 -2
  488. package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  489. package/src/extensions/pi-agent-search/src/api/presentation.ts +1 -1
  490. package/src/extensions/pi-agent-search/src/api/search-scope.ts +1 -1
  491. package/src/extensions/pi-agent-search/src/api/search.ts +7 -7
  492. package/src/extensions/pi-agent-search/src/core/extension.ts +7 -7
  493. package/src/extensions/pi-agent-search/src/core/search-core.ts +3 -3
  494. package/src/extensions/pi-agent-text-editor/index.ts +5 -5
  495. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  496. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/index.ts +1 -1
  497. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  498. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +2 -2
  499. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  500. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +2 -2
  501. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
  502. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -2
  503. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  504. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +1 -1
  505. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -5
  506. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  507. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
  508. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
  509. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
  510. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
  511. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
  512. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
  513. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
  514. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
  515. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
  516. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  517. package/src/extensions/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
  518. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
  519. package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +2 -2
  520. package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
  521. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
  522. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
  523. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
  524. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
  525. package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +1 -1
  526. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
  527. package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -3
  528. package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
  529. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
  530. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
  531. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
  532. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -13
  533. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
  534. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
  535. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +5 -5
  536. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
  537. package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
  538. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +1 -1
  539. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +3 -3
  540. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
  541. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +2 -2
  542. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
  543. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
  544. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
  545. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
  546. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
  547. package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
  548. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +1 -1
  549. package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
  550. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
  551. package/src/extensions/pi-agent-text-editor/src/core/source-change-retry.ts +1 -1
  552. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +2 -2
  553. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
  554. package/src/extensions/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
  555. package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
  556. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
  557. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
  558. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +19 -19
  559. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
  560. package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
  561. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +19 -19
  562. package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
  563. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +29 -29
  564. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
  565. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
  566. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
  567. package/src/extensions/pi-agent-text-editor/src/tools/extension.ts +7 -7
  568. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
  569. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
  570. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
  571. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
  572. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
  573. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
  574. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
  575. package/src/index.ts +1 -1
  576. package/src/pi-agent-ide.ts +21 -21
  577. package/src/plugins/pi-agent-ide-ast/index.ts +1 -1
  578. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  579. package/src/plugins/pi-agent-ide-ast/src/api/scope.ts +1 -1
  580. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +2 -2
  581. package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
  582. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +5 -5
  583. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +1 -1
  584. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  585. package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
  586. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
  587. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +1 -1
  588. package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
  589. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +1 -1
  590. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
  591. package/src/plugins/pi-agent-ide-changes/index.ts +9 -9
  592. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  593. package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +4 -4
  594. package/src/plugins/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
  595. package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
  596. package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
  597. package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
  598. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
  599. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
  600. package/src/plugins/pi-agent-ide-debugger/index.ts +11 -11
  601. package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +1 -1
  602. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +4 -4
  603. package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +2 -2
  604. package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +3 -3
  605. package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +1 -1
  606. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +5 -5
  607. package/src/plugins/pi-agent-ide-debugger/src/ui.ts +1 -1
  608. package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +1 -1
  609. package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +2 -2
  610. package/src/plugins/pi-agent-ide-diagnostics/index.ts +1 -1
  611. package/src/plugins/pi-agent-ide-formatter/index.ts +5 -5
  612. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  613. package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
  614. package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +2 -2
  615. package/src/plugins/pi-agent-ide-formatter/src/registry.ts +1 -1
  616. package/src/plugins/pi-agent-ide-languages/index.ts +1 -1
  617. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  618. package/src/plugins/pi-agent-ide-lint/index.ts +9 -9
  619. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  620. package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +2 -2
  621. package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
  622. package/src/plugins/pi-agent-ide-lint/src/registry.ts +1 -1
  623. package/src/plugins/pi-agent-ide-lsp/index.ts +17 -17
  624. package/src/plugins/pi-agent-ide-lsp/package.json +12 -12
  625. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +3 -3
  626. package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +3 -3
  627. package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
  628. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +7 -7
  629. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +9 -9
  630. package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
  631. package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +4 -4
  632. package/src/plugins/pi-agent-ide-lsp/src/lsp/document-leases.ts +1 -1
  633. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
  634. package/src/plugins/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
  635. package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +4 -4
  636. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +13 -13
  637. package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +3 -3
  638. package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
  639. package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +1 -1
  640. package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
  641. package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
  642. package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
  643. package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +17 -5
  644. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +7 -7
  645. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
  646. package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
  647. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
  648. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +8 -8
  649. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +4 -4
  650. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
  651. package/src/plugins/pi-agent-ide-processes/index.ts +4 -4
  652. package/src/plugins/pi-agent-ide-processes/src/ui.ts +1 -1
  653. package/src/plugins/pi-agent-ide-semantic/src/vera-backend.ts +2 -2
  654. package/src/plugins/pi-agent-ide-terminal/index.ts +17 -17
  655. package/src/plugins/pi-agent-ide-terminal/src/origin.ts +1 -1
  656. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
  657. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +3 -3
  658. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +3 -3
  659. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -5
  660. package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +1 -1
  661. package/src/plugins/pi-agent-ide-terminal/src/search.ts +2 -2
  662. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +3 -3
  663. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +1 -1
  664. package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +1 -1
  665. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +9 -9
  666. package/src/plugins/pi-agent-ide-terminal/src/types.ts +1 -1
  667. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +3 -3
  668. package/src/post-edit/gate.ts +1 -1
  669. package/src/semantic/extension.ts +2 -2
  670. package/src/semantic/index.ts +4 -4
  671. package/src/standalone/resource-host.ts +13 -13
  672. package/src/standalone/scoped-api.ts +2 -2
  673. package/src/tips/core.ts +1 -1
  674. package/src/tips/extension.ts +6 -6
  675. package/src/tips/setup-hint.ts +1 -1
  676. package/src/toolchain/diagnostic.ts +1 -1
  677. package/src/toolchain/registry.ts +1 -1
  678. package/dist/chunk-57F5GTHO.js +0 -1
  679. package/dist/chunk-6LAHSOAH.js +0 -25
  680. package/dist/chunk-DDLNVJHJ.js +0 -1
  681. package/dist/chunk-FEZLTM4L.js +0 -1
  682. package/dist/chunk-MDD5ORB6.js +0 -1
  683. package/dist/chunk-S5PL5DFQ.js +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.6 — 2026-11-08
4
+
5
+ ### Changed
6
+
7
+ - Pi starts faster with pi-agent-ide installed: the image processing module loads on first use instead of at startup.
8
+ - Pi loads pi-agent-ide from a local checkout about four times faster.
9
+
10
+ ### Fixed
11
+
12
+ - Renames and other edits from a language server shared by several Pi sessions are no longer rejected as stale when another session's text reaches the server during the request.
13
+
3
14
  ## 0.9.5 — 2026-11-08
4
15
 
5
16
  ### Added
@@ -1 +1 @@
1
- import{c as a,d as u,e as c}from"./chunk-S5PL5DFQ.js";import{a as t}from"./chunk-EI7MMDWY.js";function E(o,r){let s=t(()=>{let e,i={plugin:r,accept(R){if(e!==void 0)throw new Error(`Plugin ${r.id} registration was accepted more than once`);e=R}};return o.events.emit(u,i),e},"announce"),n=t(()=>{},"unsubscribe");n=o.events.on(a,e=>{if(!c(e))throw new Error("Invalid pi-agent-read core readiness event");let i=s();if(i===void 0)throw new Error("pi-agent-read core announced readiness without accepting the plugin");n(),i.catch(()=>{})}),o.on("session_shutdown",n);let d=s();if(d!==void 0)return n(),d}t(E,"connectReadPlugin");export{E as a};
1
+ import{c as a,d as u,e as c}from"./chunk-H6FEBUAP.js";import{a as t}from"./chunk-EI7MMDWY.js";function E(o,r){let s=t(()=>{let e,i={plugin:r,accept(R){if(e!==void 0)throw new Error(`Plugin ${r.id} registration was accepted more than once`);e=R}};return o.events.emit(u,i),e},"announce"),n=t(()=>{},"unsubscribe");n=o.events.on(a,e=>{if(!c(e))throw new Error("Invalid pi-agent-read core readiness event");let i=s();if(i===void 0)throw new Error("pi-agent-read core announced readiness without accepting the plugin");n(),i.catch(()=>{})}),o.on("session_shutdown",n);let d=s();if(d!==void 0)return n(),d}t(E,"connectReadPlugin");export{E as a};
@@ -0,0 +1 @@
1
+ import{d,e as u,f as a}from"./chunk-MLFJU2US.js";import{a as n}from"./chunk-EI7MMDWY.js";function E(r,i){let s=n(()=>{let o,t={plugin:i,accept(f){if(o!==void 0)throw new Error(`Doctor plugin ${i.id} was accepted more than once`);o=f}};return r.events.emit(u,t),o},"announce"),e=n(()=>{},"unsubscribe");e=r.events.on(d,o=>{if(!a(o))throw new Error("Invalid doctor core readiness event");let t=s();if(t===void 0)throw new Error("Doctor core did not accept the plugin");e(),t.catch(()=>{})}),r.on("session_shutdown",e);let c=s();if(c!==void 0)return e(),c}n(E,"connectDoctorPlugin");export{E as a};
@@ -1 +1 @@
1
- import{a as R}from"./chunk-L2B4DTVS.js";import{b as T}from"./chunk-OTVNO5SX.js";import{c as w,d as S}from"./chunk-XHFAV2NI.js";import{a as t}from"./chunk-EI7MMDWY.js";import{Container as W,Key as P,matchesKey as A,MouseRegion as O,SelectList as K,Text as I,truncateToWidth as D,visibleWidth as C}from"@earendil-works/pi-tui";var x=class{constructor(e,o,r){this.registry=e;this.activityMode=o;e.onDidChange(()=>this.#i()),r.registerCommand("agent-ide-processes",{description:"Show active terminal and debugger processes created by Agent IDE",handler:t(async(c,n)=>{if(this.bind(n),n.mode!=="tui"){n.ui.notify("The Agent IDE process overlay requires the TUI.","info");return}await this.#d(n)},"handler")})}static{t(this,"AgentIdeProcessesUi")}#t;#s=!1;#r;#e;setActivityMode(e){e!==this.activityMode&&(this.activityMode=e,this.#i())}bind(e){this.#s||(this.#t=e,this.#i())}dispose(){this.#s=!0,this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,this.#t?.ui.setWidget("agent-ide-processes",void 0),this.#t?.ui.setStatus("agent-ide-processes",void 0),this.#t=void 0}#n(){return this.registry.list()}#i(){let e=this.#t;if(this.#s||e===void 0||!e.hasUI)return;let o=this.#n();if(this.activityMode==="off"||o.length===0){e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",void 0),this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0;return}if(this.activityMode==="compact"){this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",`Agent IDE processes: ${o.length}`);return}e.ui.setStatus("agent-ide-processes",void 0),e.ui.setWidget("agent-ide-processes",(r,c)=>U(o,c,n=>{this.#d(e,n).catch(p=>{e.ui.notify(`Could not open process details: ${String(p)}`,"error")})}),{placement:"belowEditor"}),this.#e??=setInterval(()=>this.#i(),1e3)}#d(e,o){return this.#r??=this.#o(e,o).finally(()=>{this.#r=void 0}),this.#r}async#o(e,o){for(;;){if(this.#n().length===0){e.ui.notify("No active Agent IDE processes.","info");return}let r=t(()=>{},"disposeRefresh"),c,n;try{n=await e.ui.custom((f,g,B,E)=>{let h=this.#n(),a=h.find(d=>d.source===o),l=a?"detail":"list";o=void 0;let M=t(d=>{let u=h.map(i=>({value:i.source,label:`${i.status} ${i.kind} ${i.title}`,description:i.description})),y=new K(u,Math.min(u.length,12),{selectedPrefix:t(i=>g.fg("accent",i),"selectedPrefix"),selectedText:t(i=>g.fg("accent",i),"selectedText"),description:t(i=>g.fg("muted",i),"description"),scrollInfo:t(i=>g.fg("dim",i),"scrollInfo"),noMatch:t(i=>g.fg("warning",i),"noMatch")}),m=u.findIndex(i=>i.value===d);return m>=0&&y.setSelectedIndex(m),y.onSelect=i=>{a=h.find(L=>L.source===i.value),l="detail",f.requestRender()},y.onCancel=()=>E(null),y},"createList"),v=M(a?.source),$=t(()=>{let d=a?.source??v.getSelectedItem()?.value;h=this.#n(),a=l==="list"?void 0:h.find(u=>u.source===d),v=M(d),f.requestRender()},"refresh");return r=this.registry.onDidChange($),c=setInterval($,1e3),{invalidate:t(()=>v.invalidate(),"invalidate"),render(d){let u=new W;l==="list"?(u.addChild(v),u.addChild(new I(g.fg("dim",h.length===0?"esc close":"enter view \xB7 d stop \xB7 esc close"),1,0))):a===void 0?(u.addChild(new I(g.fg("warning","Process is no longer active."),1,0)),u.addChild(new I(g.fg("dim","esc back"),1,0))):(u.addChild(a.renderDetail(g)),u.addChild(new I(g.fg(l==="confirm"?"warning":"dim",l==="confirm"?"Stop this process? y confirm \xB7 n/esc cancel":l==="input"?"input mode \xB7 type to send \xB7 esc stop input":a.sendInput===void 0?"esc back \xB7 d stop":"i input \xB7 esc back \xB7 d stop"),1,0)));let y=t(i=>g.fg("accent",i),"accent"),m=Math.max(1,d-2);return[k("Agent IDE Processes",`${h.length} active`,d,y),...u.render(m).map(i=>b(i,d,y)),_(d,y)]},handleInput(d){l==="list"?d==="d"?(a=h.find(u=>u.source===v.getSelectedItem()?.value),a!==void 0&&(l="confirm")):v.handleInput(d):l==="detail"?A(d,P.escape)?l="list":d==="d"&&a!==void 0?l="confirm":d==="i"&&a?.sendInput!==void 0&&(l="input"):l==="input"?A(d,P.escape)?l="detail":a?.sendInput?.(d):d==="y"&&a!==void 0?E({source:a.source}):(d==="n"||A(d,P.escape))&&(l="detail"),f.requestRender()}}},{overlay:!0,overlayOptions:{width:"75%",maxHeight:"80%",minWidth:52}})}finally{r(),c!==void 0&&clearInterval(c)}if(n===null)return;let p=this.#n().find(f=>f.source===n.source);p!==void 0&&await p.stop()}}};function U(s,e,o){let r=new W;if(s.length===0)return r;let c=t(n=>e.fg("accent",n),"accent");r.addChild({invalidate(){},render:t(n=>[k("Agent IDE Processes",`${s.length} active`,n,c)],"render")});for(let[n,p]of s.entries())r.addChild(new O({invalidate(){},render:t(f=>p.renderSummary(e).map(g=>b(` ${g} `,f,c)),"render")},f=>{if(!(o===void 0||f.type!=="click"||f.button!=="left"))return o(p.source),{handled:!0}})),n<s.length-1&&r.addChild({invalidate(){},render:t(f=>[b("",f,c)],"render")});return r.addChild({invalidate(){},render:t(n=>[_(n,c)],"render")}),r}t(U,"createProcessWidget");function k(s,e,o,r){if(o<=1)return r("\u256D");let c=o-2,n=`\u2500 ${s} `,p=` ${e} \u2500`,f="\u2500".repeat(Math.max(0,c-C(n)-C(p)));return r(`\u256D${D(`${n}${f}${p}`,c).padEnd(c,"\u2500")}\u256E`)}t(k,"borderTop");function b(s,e,o){if(e<=1)return o("\u2502");let r=e-2,c=D(s,r);return`${o("\u2502")}${c}${" ".repeat(Math.max(0,r-C(c)))}${o("\u2502")}`}t(b,"borderLine");function _(s,e){return e(s<=1?"\u2570":`\u2570${"\u2500".repeat(s-2)}\u256F`)}t(_,"borderBottom");async function j(s){let e=R(s),o=await S(w()),r=new x(e,q(o.preferences?.["processes.activity"]),s);T(s,"processes.activity",c=>r.setActivityMode(q(c))),s.on("session_start",(c,n)=>r.bind(n)),s.on("session_shutdown",()=>r.dispose())}t(j,"registerAgentIdeProcesses");function q(s){return s==="compact"||s==="off"?s:"detailed"}t(q,"activityMode");export{j as default};
1
+ import{a as R}from"./chunk-L2B4DTVS.js";import{b as T}from"./chunk-OTVNO5SX.js";import{c as w,d as S}from"./chunk-XHFAV2NI.js";import{a as t}from"./chunk-EI7MMDWY.js";import{Container as W,Key as P,matchesKey as A,MouseRegion as O,SelectList as K,Text as I,truncateToWidth as D,visibleWidth as C}from"@earendil-works/pi-tui";var x=class{constructor(e,o,r){this.registry=e;this.activityMode=o;e.onDidChange(()=>this.#i()),r.registerCommand("agent-ide-processes",{description:"Show active terminal and debugger processes created by Agent IDE",handler:t(async(c,n)=>{if(this.bind(n),n.mode!=="tui"){n.ui.notify("The Agent IDE process overlay requires the TUI.","info");return}await this.#d(n)},"handler")})}static{t(this,"AgentIdeProcessesUi")}#t;#s=!1;#r;#e;setActivityMode(e){e!==this.activityMode&&(this.activityMode=e,this.#i())}bind(e){this.#s||(this.#t=e,this.#i())}dispose(){this.#s=!0,this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,this.#t?.ui.setWidget("agent-ide-processes",void 0),this.#t?.ui.setStatus("agent-ide-processes",void 0),this.#t=void 0}#n(){return this.registry.list()}#i(){let e=this.#t;if(this.#s||e===void 0||!e.hasUI)return;let o=this.#n();if(this.activityMode==="off"||o.length===0){e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",void 0),this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0;return}if(this.activityMode==="compact"){this.#e!==void 0&&clearInterval(this.#e),this.#e=void 0,e.ui.setWidget("agent-ide-processes",void 0),e.ui.setStatus("agent-ide-processes",`Agent IDE processes: ${o.length}`);return}e.ui.setStatus("agent-ide-processes",void 0),e.ui.setWidget("agent-ide-processes",(r,c)=>U(o,c,n=>{this.#d(e,n).catch(p=>{e.ui.notify(`Could not open process details: ${String(p)}`,"error")})}),{placement:"belowEditor"}),this.#e??=setInterval(()=>this.#i(),1e3)}#d(e,o){return this.#r??=this.#o(e,o).finally(()=>{this.#r=void 0}),this.#r}async#o(e,o){for(;;){if(this.#n().length===0){e.ui.notify("No active Agent IDE processes.","info");return}let r=t(()=>{},"disposeRefresh"),c,n;try{n=await e.ui.custom((f,g,H,E)=>{let h=this.#n(),a=h.find(d=>d.source===o),l=a?"detail":"list";o=void 0;let M=t(d=>{let u=h.map(i=>({value:i.source,label:`${i.status} ${i.kind} ${i.title}`,description:i.description})),y=new K(u,Math.min(u.length,12),{selectedPrefix:t(i=>g.fg("accent",i),"selectedPrefix"),selectedText:t(i=>g.fg("accent",i),"selectedText"),description:t(i=>g.fg("muted",i),"description"),scrollInfo:t(i=>g.fg("dim",i),"scrollInfo"),noMatch:t(i=>g.fg("warning",i),"noMatch")}),m=u.findIndex(i=>i.value===d);return m>=0&&y.setSelectedIndex(m),y.onSelect=i=>{a=h.find(L=>L.source===i.value),l="detail",f.requestRender()},y.onCancel=()=>E(null),y},"createList"),v=M(a?.source),$=t(()=>{let d=a?.source??v.getSelectedItem()?.value;h=this.#n(),a=l==="list"?void 0:h.find(u=>u.source===d),v=M(d),f.requestRender()},"refresh");return r=this.registry.onDidChange($),c=setInterval($,1e3),{invalidate:t(()=>v.invalidate(),"invalidate"),render(d){let u=new W;l==="list"?(u.addChild(v),u.addChild(new I(g.fg("dim",h.length===0?"esc close":"enter view \xB7 d stop \xB7 esc close"),1,0))):a===void 0?(u.addChild(new I(g.fg("warning","Process is no longer active."),1,0)),u.addChild(new I(g.fg("dim","esc back"),1,0))):(u.addChild(a.renderDetail(g)),u.addChild(new I(g.fg(l==="confirm"?"warning":"dim",l==="confirm"?"Stop this process? y confirm \xB7 n/esc cancel":l==="input"?"input mode \xB7 type to send \xB7 esc stop input":a.sendInput===void 0?"esc back \xB7 d stop":"i input \xB7 esc back \xB7 d stop"),1,0)));let y=t(i=>g.fg("accent",i),"accent"),m=Math.max(1,d-2);return[k("Agent IDE Processes",`${h.length} active`,d,y),...u.render(m).map(i=>b(i,d,y)),_(d,y)]},handleInput(d){l==="list"?d==="d"?(a=h.find(u=>u.source===v.getSelectedItem()?.value),a!==void 0&&(l="confirm")):v.handleInput(d):l==="detail"?A(d,P.escape)?l="list":d==="d"&&a!==void 0?l="confirm":d==="i"&&a?.sendInput!==void 0&&(l="input"):l==="input"?A(d,P.escape)?l="detail":a?.sendInput?.(d):d==="y"&&a!==void 0?E({source:a.source}):(d==="n"||A(d,P.escape))&&(l="detail"),f.requestRender()}}},{overlay:!0,overlayOptions:{width:"75%",maxHeight:"80%",minWidth:52}})}finally{r(),c!==void 0&&clearInterval(c)}if(n===null)return;let p=this.#n().find(f=>f.source===n.source);p!==void 0&&await p.stop()}}};function U(s,e,o){let r=new W;if(s.length===0)return r;let c=t(n=>e.fg("accent",n),"accent");r.addChild({invalidate(){},render:t(n=>[k("Agent IDE Processes",`${s.length} active`,n,c)],"render")});for(let[n,p]of s.entries())r.addChild(new O({invalidate(){},render:t(f=>p.renderSummary(e).map(g=>b(` ${g} `,f,c)),"render")},f=>{if(!(o===void 0||f.type!=="click"||f.button!=="left"))return o(p.source),{handled:!0}})),n<s.length-1&&r.addChild({invalidate(){},render:t(f=>[b("",f,c)],"render")});return r.addChild({invalidate(){},render:t(n=>[_(n,c)],"render")}),r}t(U,"createProcessWidget");function k(s,e,o,r){if(o<=1)return r("\u256D");let c=o-2,n=`\u2500 ${s} `,p=` ${e} \u2500`,f="\u2500".repeat(Math.max(0,c-C(n)-C(p)));return r(`\u256D${D(`${n}${f}${p}`,c).padEnd(c,"\u2500")}\u256E`)}t(k,"borderTop");function b(s,e,o){if(e<=1)return o("\u2502");let r=e-2,c=D(s,r);return`${o("\u2502")}${c}${" ".repeat(Math.max(0,r-C(c)))}${o("\u2502")}`}t(b,"borderLine");function _(s,e){return e(s<=1?"\u2570":`\u2570${"\u2500".repeat(s-2)}\u256F`)}t(_,"borderBottom");async function B(s){let e=R(s),o=await S(w()),r=new x(e,q(o.preferences?.["processes.activity"]),s);T(s,"processes.activity",c=>r.setActivityMode(q(c))),s.on("session_start",(c,n)=>r.bind(n)),s.on("session_shutdown",()=>r.dispose())}t(B,"registerAgentIdeProcesses");function q(s){return s==="compact"||s==="off"?s:"detailed"}t(q,"activityMode");export{B as default};
@@ -1,4 +1,4 @@
1
- import{b as x}from"./chunk-LLP3EIJL.js";import{a as C,m as X}from"./chunk-72YIFABM.js";import{a as D}from"./chunk-37UNDG6V.js";import{c as P,d as R}from"./chunk-6TOFURDG.js";import"./chunk-SIYPD5MM.js";import{b as S}from"./chunk-T4FTT3U4.js";import"./chunk-ALZV2EYT.js";import{a as H}from"./chunk-ZC65Z3CK.js";import{a as K,b as Q,c as Z,d as ee,g as te}from"./chunk-OFILFO6D.js";import{a as d}from"./chunk-EI7MMDWY.js";var $=[],k=[],J=[];function j(r,e,t){if(e.some(i=>i.name===t))throw new Error(`[pi-agent-ide] ${r} "${t}" is already registered. Use a unique name.`)}d(j,"assertUniqueName");function re(r){let e=new Set;for(let t of r){let i=`${t.kind}:${t.name}`;if(e.has(i))throw new Error(`[pi-agent-ide] ${t.kind} "${t.name}" is registered twice by one plugin.`);switch(e.add(i),t.kind){case"compiler":{j(t.kind,k,t.name);break}case"formatter":{j(t.kind,$,t.name);break}case"linter":{j(t.kind,J,t.name);break}}}for(let t of r)switch(t.kind){case"compiler":{k.push(t);break}case"formatter":{$.push(t);break}case"linter":{J.push(t);break}}}d(re,"registerTools");async function ie(r,e){let t=[];for(let i of r)try{await i.detect(e)&&t.push(i)}catch(o){console.error(`[pi-agent-ide] detect failed for "${i.name}":`,o)}return t.sort((i,o)=>o.priority-i.priority),ve(t),t}d(ie,"filterActive");function ve(r){let e=new Map;for(let t of r)for(let i of t.extensions){let o=`${i}@${t.priority}`,c=e.get(o);if(c!==void 0)throw new Error(`[pi-agent-ide] priority conflict: tools "${c}" and "${t.name}" both claim "${i}" at priority ${t.priority}.`);e.set(o,t.name)}}d(ve,"assertNoPriorityConflicts");async function ne(r){let[e,t]=await Promise.all([ie($,r),ie(k.filter(i=>i.syntaxOnly===!0),r)]);return{ctx:r,formatters:e,compilers:t,linters:[]}}d(ne,"warmupFormatting");function q(){$.length=0,k.length=0,J.length=0}d(q,"resetRegistry");import{readFile as be}from"node:fs/promises";import A from"node:path";var F=class{constructor(e,t={}){this.sources=e;this.options=t}static{d(this,"DiagnosticStore")}files=new Map;dirty=new Set;sent=new Map;queue=[];running=0;disposed=!1;changeListeners=new Set;onDidChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}schedule(e,t,{cwd:i,parentToolCallId:o}){this.disposed||this.ensure(e,t,i,o)}async read(e,{cwd:t,mode:i,signal:o}){o?.throwIfAborted(),this.assertActive();let c=S(e,t),a=await this.readText(c,t,o);this.assertActive();let n=this.ensure(c,a,t);i==="complete"?await this.waitComplete(n,o):i!=="snapshot"&&await Te(Promise.all(n.jobs),this.options.readWaitMs??5e3),o?.throwIfAborted(),this.assertActive();let l=await this.readText(c,t,o);this.assertActive();let s=this.ensure(c,l,t);if(i==="complete"&&s!==n)throw Object.assign(new Error("File changed during diagnostics"),{code:"DIAGNOSTICS_STALE"});return{filePath:c,content:s.content,results:[...s.results.values()]}}async waitComplete(e,t){let i=t?AbortSignal.any([t,e.controller.signal]):e.controller.signal;i.throwIfAborted();let o=[];await new Promise((c,a)=>{let n=d(p=>a(Object.assign(new Error(p),{code:p,details:[...e.results.values()]})),"fail"),l=d(()=>{let p=[...e.results.values()];p.some(g=>g.status==="unavailable")?n("DIAGNOSTICS_UNAVAILABLE"):p.every(g=>g.status==="ready")&&c()},"check"),s=d(()=>a(i.reason),"abort"),u=this.onDidChange(l),f=setTimeout(()=>n("DIAGNOSTICS_TIMEOUT"),this.options.checkTimeoutMs??3e4);i.addEventListener("abort",s,{once:!0});let h=d(()=>{clearTimeout(f),u(),i.removeEventListener("abort",s)},"cleanup");Promise.resolve().then(l),o.push(h)}).finally(()=>{for(let c of o)c()})}async takeNotifications(e){let t=[];for(let i of[...this.dirty]){if(i.cwd!==(e.includes("://")?e:A.resolve(e))||(this.dirty.delete(i),!await this.isCurrent(i)))continue;let o=[...i.results.values()].filter(s=>s.status!=="pending"&&s.status!=="unavailable"&&s.diagnostics.length>0),c=this.key(i.filePath,i.cwd),a=JSON.stringify(o);if(this.sent.get(c)===a||(this.sent.set(c,a),o.length===0))continue;let n=o.map(s=>{let u=["error","warning","info","hint"].flatMap(f=>{let h=s.diagnostics.filter(p=>p.severity===f).length;return h>0?[`${h} ${f}`]:[]});return`${s.source} ${u.join(", ")}${s.status==="snapshot"?" (snapshot; completion unknown)":s.status==="unversioned"?" (unversioned)":""}`}).join("; "),l=i.filePath.includes("://")?i.filePath:A.relative(e,i.filePath);t.push({filePath:l,...i.parentToolCallId===void 0?{}:{parentToolCallId:i.parentToolCallId},results:o,text:`${JSON.stringify(l)}: ${n}.`})}return t}dispose(){this.disposed=!0,this.changeListeners.clear();for(let e of this.files.values())e.controller.abort();this.files.clear(),this.dirty.clear(),this.sent.clear(),this.pump()}async readText(e,t,i){for(let o of this.options.readers??[]){let c=await o.readText(e,{cwd:t,signal:i});if(c!==void 0)return c}if(e.includes("://"))throw Object.assign(new Error("No diagnostic reader for resource owner"),{code:"UNSUPPORTED_SOURCE"});return be(e,{encoding:"utf8",signal:i})}key(e,t){return JSON.stringify([t.includes("://")?t:A.resolve(t),S(e,t)])}ensure(e,t,i,o){let c=this.key(e,i),a=this.files.get(c);if(a?.content===t)return a;a?.controller.abort(),a&&this.dirty.delete(a);let n={cwd:i.includes("://")?i:A.resolve(i),filePath:S(e,i),content:t,...o===void 0?{}:{parentToolCallId:o},controller:new AbortController,results:new Map,jobs:[],publications:new Map};this.files.set(c,n),this.sources.length===0&&n.results.set("diagnostics",{source:"diagnostics",status:"unavailable",diagnostics:[],reason:"No diagnostic sources registered"}),this.dirty.add(n);for(let l of this.sources){n.results.set(l.id,{source:l.id,status:"pending",diagnostics:[]});let s=new Promise(u=>{this.queue.push(async()=>{try{await this.check(n,l)}finally{u()}})});n.jobs.push(s)}return queueMicrotask(()=>this.pump()),n}pump(){for(;this.running<(this.options.concurrency??4)&&this.queue.length>0;){let e=this.queue.shift();if(!e)break;this.running++,e().finally(()=>{this.running--,this.pump()})}}active(e){return!this.disposed&&!e.controller.signal.aborted}assertActive(){if(this.disposed)throw new Error("Diagnostics session has ended")}async isCurrent(e){if(!this.active(e))return!1;let t=await this.readText(e.filePath,e.cwd,e.controller.signal).catch(()=>{});return this.active(e)&&t===e.content}async publish(e,t,i){let o=(e.publications.get(t)??0)+1;if(e.publications.set(t,o),!await this.isCurrent(e)||e.publications.get(t)!==o)return;let c={...i,source:i.source??t};if(JSON.stringify(e.results.get(t))===JSON.stringify(c))return;e.results.set(t,c),this.dirty.add(e);let a=[...e.results.values()].some(n=>n.status!=="pending"&&n.status!=="unavailable"&&n.diagnostics.length>0);a||this.sent.delete(this.key(e.filePath,e.cwd));for(let n of this.changeListeners)n(e.cwd,a)}async check(e,t){if(!await this.isCurrent(e))return;let i=new AbortController,o=AbortSignal.any([i.signal,e.controller.signal]);if(o.aborted)return;let c,a;try{let n=new Promise((s,u)=>{a=d(()=>u(o.reason),"onAbort"),o.addEventListener("abort",a,{once:!0}),c=setTimeout(()=>i.abort(new Error("Diagnostic check timed out")),this.options.checkTimeoutMs??3e4)}),l=await Promise.race([t.diagnose(e.filePath,{cwd:e.cwd,content:e.content,signal:o,publish:d(s=>{o.aborted||this.publish(e,t.id,s)},"publish")}),n]);await this.publish(e,t.id,l)}catch(n){await this.publish(e,t.id,{status:"unavailable",diagnostics:[],reason:n instanceof Error?n.message:String(n)})}finally{clearTimeout(c),a&&o.removeEventListener("abort",a)}}};async function Te(r,e){let t;try{await Promise.race([r,new Promise(i=>{t=setTimeout(i,e)})])}finally{clearTimeout(t)}}d(Te,"waitAtMost");function oe(){let r=new Map,e=[],t=[],i=new F(e,{readers:t}),o=Promise.resolve();return{diagnostics:i,registerPlugin(c){if(c.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let a=r.get(c.id);if(a!==void 0)return a;let n=o.then(async()=>{let l=[],s=[],u=[],f=!0,h={addTool(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);xe(g),l.push(g)},addDiagnosticSource(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);Ie(g),s.push(g)},addDiagnosticFileReader(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);if(!g.id.trim()||typeof g.readText!="function")throw new TypeError("Invalid diagnostic file reader");u.push(g)},readDiagnostics(g,E){return i.read(g,E)}};try{await c.setup(h)}catch(g){throw f=!1,g}f=!1,Ee(e,s);let p=new Set(t.map(g=>g.id));for(let g of u){if(p.has(g.id))throw new Error(`Diagnostic file reader ${g.id} is already registered`);p.add(g.id)}re(l),e.push(...s),t.push(...u)});return r.set(c.id,n),o=n.catch(()=>{}),n.catch(()=>{r.delete(c.id)}),n},async waitForPendingPlugins(){await Promise.all(r.values())}}}d(oe,"createIdeCore");function Ee(r,e){let t=new Set(r.map(i=>i.id));for(let i of e){if(t.has(i.id))throw new Error(`Diagnostic source ${i.id} is already registered`);t.add(i.id)}}d(Ee,"assertUniqueDiagnosticSources");function xe(r){if(!se(r))throw new TypeError("IDE tool must be an object");let e=r.kind,t=e==="compiler"?r.compile:e==="formatter"?r.format:e==="linter"?r.lint:void 0;if(t===void 0||typeof t!="function"||typeof r.detect!="function"||typeof r.name!="string"||r.name.trim().length===0||typeof r.priority!="number"||!Number.isFinite(r.priority)||!Array.isArray(r.extensions)||r.extensions.length===0||r.extensions.some(i=>typeof i!="string"||i.length===0))throw new TypeError("Invalid pi-agent-ide tool contribution")}d(xe,"assertIdeTool");function Ie(r){if(!se(r)||typeof r.id!="string"||r.id.trim().length===0||typeof r.diagnose!="function")throw new TypeError("Invalid pi-agent-ide diagnostic source contribution")}d(Ie,"assertDiagnosticSource");function se(r){return typeof r=="object"&&r!==null}d(se,"isRecord");function ae(r,e,t=console.error){let i=new Map,o=!1,c=Promise.resolve();return{schedule(a){if(o||i.has(a))return;let n=setTimeout(()=>{i.delete(a),c=c.then(async()=>{o||await r(a)}).catch(t)},e);i.set(a,n)},dispose(){o=!0;for(let a of i.values())clearTimeout(a);i.clear()}}}d(ae,"createDiagnosticDelivery");import{Text as ce}from"@earendil-works/pi-tui";var B="ide-diagnostic-summary";function le(r){let e=new Map;for(let t of r){let i=t.parentToolCallId,o=e.get(i)??[];o.push(Pe(t)),e.set(i,o)}return[...e].map(([t,i])=>({files:i,...t===void 0?{}:{parentToolCallId:t}}))}d(le,"diagnosticEntryGroups");function Pe(r){return{filePath:r.filePath,sources:r.results.map(e=>{let t={error:0,warning:0,info:0,hint:0};for(let i of e.diagnostics)t[i.severity]++;return{source:e.source,status:e.status,counts:t}})}}d(Pe,"diagnosticEntryData");function U(r,e,t=!1){return{render(i){let o=r.sources.filter(n=>n.status!=="pending"&&n.status!=="unavailable"&&Object.values(n.counts).some(l=>l>0));if(o.length===0)return[];let c=o.map(n=>`${G(n.counts,e)} ${e.fg("dim",`(${V(n.source)})`)}`+(n.status==="ready"?"":` \xB7 ${e.fg("dim",n.status)}`)).join(" \xB7 "),a=[`${e.fg("accent","Diagnostics")} ${e.fg("toolTitle",V(r.filePath))} \xB7 ${c}`];if(t)for(let n of o)a.push(` ${e.fg("dim",V(n.source))} \xB7 ${G(n.counts,e)} \xB7 ${e.fg("dim",n.status)}`);return new ce(a.join(`
1
+ import{b as x}from"./chunk-LLP3EIJL.js";import{a as C,m as X}from"./chunk-QGXZ4RWX.js";import{a as D}from"./chunk-YZTVC7ME.js";import{c as P,d as R}from"./chunk-VDSSAP6Y.js";import"./chunk-SIYPD5MM.js";import{b as S}from"./chunk-T4FTT3U4.js";import"./chunk-S7E2D5K7.js";import{a as H}from"./chunk-ZC65Z3CK.js";import{a as K,b as Q,c as Z,d as ee,g as te}from"./chunk-OFILFO6D.js";import{a as d}from"./chunk-EI7MMDWY.js";var $=[],k=[],J=[];function j(r,e,t){if(e.some(i=>i.name===t))throw new Error(`[pi-agent-ide] ${r} "${t}" is already registered. Use a unique name.`)}d(j,"assertUniqueName");function re(r){let e=new Set;for(let t of r){let i=`${t.kind}:${t.name}`;if(e.has(i))throw new Error(`[pi-agent-ide] ${t.kind} "${t.name}" is registered twice by one plugin.`);switch(e.add(i),t.kind){case"compiler":{j(t.kind,k,t.name);break}case"formatter":{j(t.kind,$,t.name);break}case"linter":{j(t.kind,J,t.name);break}}}for(let t of r)switch(t.kind){case"compiler":{k.push(t);break}case"formatter":{$.push(t);break}case"linter":{J.push(t);break}}}d(re,"registerTools");async function ie(r,e){let t=[];for(let i of r)try{await i.detect(e)&&t.push(i)}catch(o){console.error(`[pi-agent-ide] detect failed for "${i.name}":`,o)}return t.sort((i,o)=>o.priority-i.priority),ve(t),t}d(ie,"filterActive");function ve(r){let e=new Map;for(let t of r)for(let i of t.extensions){let o=`${i}@${t.priority}`,c=e.get(o);if(c!==void 0)throw new Error(`[pi-agent-ide] priority conflict: tools "${c}" and "${t.name}" both claim "${i}" at priority ${t.priority}.`);e.set(o,t.name)}}d(ve,"assertNoPriorityConflicts");async function ne(r){let[e,t]=await Promise.all([ie($,r),ie(k.filter(i=>i.syntaxOnly===!0),r)]);return{ctx:r,formatters:e,compilers:t,linters:[]}}d(ne,"warmupFormatting");function q(){$.length=0,k.length=0,J.length=0}d(q,"resetRegistry");import{readFile as be}from"node:fs/promises";import A from"node:path";var F=class{constructor(e,t={}){this.sources=e;this.options=t}static{d(this,"DiagnosticStore")}files=new Map;dirty=new Set;sent=new Map;queue=[];running=0;disposed=!1;changeListeners=new Set;onDidChange(e){return this.changeListeners.add(e),()=>this.changeListeners.delete(e)}schedule(e,t,{cwd:i,parentToolCallId:o}){this.disposed||this.ensure(e,t,i,o)}async read(e,{cwd:t,mode:i,signal:o}){o?.throwIfAborted(),this.assertActive();let c=S(e,t),a=await this.readText(c,t,o);this.assertActive();let n=this.ensure(c,a,t);i==="complete"?await this.waitComplete(n,o):i!=="snapshot"&&await Te(Promise.all(n.jobs),this.options.readWaitMs??5e3),o?.throwIfAborted(),this.assertActive();let l=await this.readText(c,t,o);this.assertActive();let s=this.ensure(c,l,t);if(i==="complete"&&s!==n)throw Object.assign(new Error("File changed during diagnostics"),{code:"DIAGNOSTICS_STALE"});return{filePath:c,content:s.content,results:[...s.results.values()]}}async waitComplete(e,t){let i=t?AbortSignal.any([t,e.controller.signal]):e.controller.signal;i.throwIfAborted();let o=[];await new Promise((c,a)=>{let n=d(p=>a(Object.assign(new Error(p),{code:p,details:[...e.results.values()]})),"fail"),l=d(()=>{let p=[...e.results.values()];p.some(g=>g.status==="unavailable")?n("DIAGNOSTICS_UNAVAILABLE"):p.every(g=>g.status==="ready")&&c()},"check"),s=d(()=>a(i.reason),"abort"),u=this.onDidChange(l),f=setTimeout(()=>n("DIAGNOSTICS_TIMEOUT"),this.options.checkTimeoutMs??3e4);i.addEventListener("abort",s,{once:!0});let h=d(()=>{clearTimeout(f),u(),i.removeEventListener("abort",s)},"cleanup");Promise.resolve().then(l),o.push(h)}).finally(()=>{for(let c of o)c()})}async takeNotifications(e){let t=[];for(let i of[...this.dirty]){if(i.cwd!==(e.includes("://")?e:A.resolve(e))||(this.dirty.delete(i),!await this.isCurrent(i)))continue;let o=[...i.results.values()].filter(s=>s.status!=="pending"&&s.status!=="unavailable"&&s.diagnostics.length>0),c=this.key(i.filePath,i.cwd),a=JSON.stringify(o);if(this.sent.get(c)===a||(this.sent.set(c,a),o.length===0))continue;let n=o.map(s=>{let u=["error","warning","info","hint"].flatMap(f=>{let h=s.diagnostics.filter(p=>p.severity===f).length;return h>0?[`${h} ${f}`]:[]});return`${s.source} ${u.join(", ")}${s.status==="snapshot"?" (snapshot; completion unknown)":s.status==="unversioned"?" (unversioned)":""}`}).join("; "),l=i.filePath.includes("://")?i.filePath:A.relative(e,i.filePath);t.push({filePath:l,...i.parentToolCallId===void 0?{}:{parentToolCallId:i.parentToolCallId},results:o,text:`${JSON.stringify(l)}: ${n}.`})}return t}dispose(){this.disposed=!0,this.changeListeners.clear();for(let e of this.files.values())e.controller.abort();this.files.clear(),this.dirty.clear(),this.sent.clear(),this.pump()}async readText(e,t,i){for(let o of this.options.readers??[]){let c=await o.readText(e,{cwd:t,signal:i});if(c!==void 0)return c}if(e.includes("://"))throw Object.assign(new Error("No diagnostic reader for resource owner"),{code:"UNSUPPORTED_SOURCE"});return be(e,{encoding:"utf8",signal:i})}key(e,t){return JSON.stringify([t.includes("://")?t:A.resolve(t),S(e,t)])}ensure(e,t,i,o){let c=this.key(e,i),a=this.files.get(c);if(a?.content===t)return a;a?.controller.abort(),a&&this.dirty.delete(a);let n={cwd:i.includes("://")?i:A.resolve(i),filePath:S(e,i),content:t,...o===void 0?{}:{parentToolCallId:o},controller:new AbortController,results:new Map,jobs:[],publications:new Map};this.files.set(c,n),this.sources.length===0&&n.results.set("diagnostics",{source:"diagnostics",status:"unavailable",diagnostics:[],reason:"No diagnostic sources registered"}),this.dirty.add(n);for(let l of this.sources){n.results.set(l.id,{source:l.id,status:"pending",diagnostics:[]});let s=new Promise(u=>{this.queue.push(async()=>{try{await this.check(n,l)}finally{u()}})});n.jobs.push(s)}return queueMicrotask(()=>this.pump()),n}pump(){for(;this.running<(this.options.concurrency??4)&&this.queue.length>0;){let e=this.queue.shift();if(!e)break;this.running++,e().finally(()=>{this.running--,this.pump()})}}active(e){return!this.disposed&&!e.controller.signal.aborted}assertActive(){if(this.disposed)throw new Error("Diagnostics session has ended")}async isCurrent(e){if(!this.active(e))return!1;let t=await this.readText(e.filePath,e.cwd,e.controller.signal).catch(()=>{});return this.active(e)&&t===e.content}async publish(e,t,i){let o=(e.publications.get(t)??0)+1;if(e.publications.set(t,o),!await this.isCurrent(e)||e.publications.get(t)!==o)return;let c={...i,source:i.source??t};if(JSON.stringify(e.results.get(t))===JSON.stringify(c))return;e.results.set(t,c),this.dirty.add(e);let a=[...e.results.values()].some(n=>n.status!=="pending"&&n.status!=="unavailable"&&n.diagnostics.length>0);a||this.sent.delete(this.key(e.filePath,e.cwd));for(let n of this.changeListeners)n(e.cwd,a)}async check(e,t){if(!await this.isCurrent(e))return;let i=new AbortController,o=AbortSignal.any([i.signal,e.controller.signal]);if(o.aborted)return;let c,a;try{let n=new Promise((s,u)=>{a=d(()=>u(o.reason),"onAbort"),o.addEventListener("abort",a,{once:!0}),c=setTimeout(()=>i.abort(new Error("Diagnostic check timed out")),this.options.checkTimeoutMs??3e4)}),l=await Promise.race([t.diagnose(e.filePath,{cwd:e.cwd,content:e.content,signal:o,publish:d(s=>{o.aborted||this.publish(e,t.id,s)},"publish")}),n]);await this.publish(e,t.id,l)}catch(n){await this.publish(e,t.id,{status:"unavailable",diagnostics:[],reason:n instanceof Error?n.message:String(n)})}finally{clearTimeout(c),a&&o.removeEventListener("abort",a)}}};async function Te(r,e){let t;try{await Promise.race([r,new Promise(i=>{t=setTimeout(i,e)})])}finally{clearTimeout(t)}}d(Te,"waitAtMost");function oe(){let r=new Map,e=[],t=[],i=new F(e,{readers:t}),o=Promise.resolve();return{diagnostics:i,registerPlugin(c){if(c.id.trim().length===0)return Promise.reject(new Error("Plugin ID must not be empty"));let a=r.get(c.id);if(a!==void 0)return a;let n=o.then(async()=>{let l=[],s=[],u=[],f=!0,h={addTool(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);xe(g),l.push(g)},addDiagnosticSource(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);Ie(g),s.push(g)},addDiagnosticFileReader(g){if(!f)throw new Error(`Plugin ${c.id} setup is already complete`);if(!g.id.trim()||typeof g.readText!="function")throw new TypeError("Invalid diagnostic file reader");u.push(g)},readDiagnostics(g,E){return i.read(g,E)}};try{await c.setup(h)}catch(g){throw f=!1,g}f=!1,Ee(e,s);let p=new Set(t.map(g=>g.id));for(let g of u){if(p.has(g.id))throw new Error(`Diagnostic file reader ${g.id} is already registered`);p.add(g.id)}re(l),e.push(...s),t.push(...u)});return r.set(c.id,n),o=n.catch(()=>{}),n.catch(()=>{r.delete(c.id)}),n},async waitForPendingPlugins(){await Promise.all(r.values())}}}d(oe,"createIdeCore");function Ee(r,e){let t=new Set(r.map(i=>i.id));for(let i of e){if(t.has(i.id))throw new Error(`Diagnostic source ${i.id} is already registered`);t.add(i.id)}}d(Ee,"assertUniqueDiagnosticSources");function xe(r){if(!se(r))throw new TypeError("IDE tool must be an object");let e=r.kind,t=e==="compiler"?r.compile:e==="formatter"?r.format:e==="linter"?r.lint:void 0;if(t===void 0||typeof t!="function"||typeof r.detect!="function"||typeof r.name!="string"||r.name.trim().length===0||typeof r.priority!="number"||!Number.isFinite(r.priority)||!Array.isArray(r.extensions)||r.extensions.length===0||r.extensions.some(i=>typeof i!="string"||i.length===0))throw new TypeError("Invalid pi-agent-ide tool contribution")}d(xe,"assertIdeTool");function Ie(r){if(!se(r)||typeof r.id!="string"||r.id.trim().length===0||typeof r.diagnose!="function")throw new TypeError("Invalid pi-agent-ide diagnostic source contribution")}d(Ie,"assertDiagnosticSource");function se(r){return typeof r=="object"&&r!==null}d(se,"isRecord");function ae(r,e,t=console.error){let i=new Map,o=!1,c=Promise.resolve();return{schedule(a){if(o||i.has(a))return;let n=setTimeout(()=>{i.delete(a),c=c.then(async()=>{o||await r(a)}).catch(t)},e);i.set(a,n)},dispose(){o=!0;for(let a of i.values())clearTimeout(a);i.clear()}}}d(ae,"createDiagnosticDelivery");import{Text as ce}from"@earendil-works/pi-tui";var B="ide-diagnostic-summary";function le(r){let e=new Map;for(let t of r){let i=t.parentToolCallId,o=e.get(i)??[];o.push(Pe(t)),e.set(i,o)}return[...e].map(([t,i])=>({files:i,...t===void 0?{}:{parentToolCallId:t}}))}d(le,"diagnosticEntryGroups");function Pe(r){return{filePath:r.filePath,sources:r.results.map(e=>{let t={error:0,warning:0,info:0,hint:0};for(let i of e.diagnostics)t[i.severity]++;return{source:e.source,status:e.status,counts:t}})}}d(Pe,"diagnosticEntryData");function U(r,e,t=!1){return{render(i){let o=r.sources.filter(n=>n.status!=="pending"&&n.status!=="unavailable"&&Object.values(n.counts).some(l=>l>0));if(o.length===0)return[];let c=o.map(n=>`${G(n.counts,e)} ${e.fg("dim",`(${V(n.source)})`)}`+(n.status==="ready"?"":` \xB7 ${e.fg("dim",n.status)}`)).join(" \xB7 "),a=[`${e.fg("accent","Diagnostics")} ${e.fg("toolTitle",V(r.filePath))} \xB7 ${c}`];if(t)for(let n of o)a.push(` ${e.fg("dim",V(n.source))} \xB7 ${G(n.counts,e)} \xB7 ${e.fg("dim",n.status)}`);return new ce(a.join(`
2
2
  `),0,0).render(i)},invalidate(){}}}d(U,"renderDiagnosticEntry");function de(r){r.registerEntryRenderer(B,(e,t,i)=>{let o=H(e.data);return"files"in o?Re(o.files,i,t.expanded):U(o,i,t.expanded)})}d(de,"registerDiagnosticEntryRenderer");function Re(r,e,t=!1){return{render(i){let o=r.filter(l=>l.sources.some(s=>s.status!=="pending"&&s.status!=="unavailable"&&Object.values(s.counts).some(u=>u>0)));if(o.length===1&&o[0])return U(o[0],e,t).render(i);if(o.length===0)return[];let c={error:0,warning:0,info:0,hint:0},a=new Set;for(let l of o)for(let s of l.sources)if(!(s.status==="pending"||s.status==="unavailable")){a.add(s.source);for(let u of["error","warning","info","hint"])c[u]+=s.counts[u]}let n=new ce(`${e.fg("accent","Diagnostics")} \xB7 ${o.length} files \xB7 ${G(c,e)} \xB7 ${a.size} tools`,0,0).render(i);return t?[...n,...o.flatMap(l=>U(l,e,!0).render(i))]:n},invalidate(){}}}d(Re,"renderDiagnosticBatch");function G(r,e){return["error","warning","info","hint"].filter(t=>r[t]>0).map(t=>{let i=r[t],o=t==="info"||i===1?t:`${t}s`,c=i>0&&(t==="error"||t==="warning")?t:"muted";return e.fg(c,`${i} ${o}`)}).join(", ")}d(G,"renderCounts");function V(r){return r.replace(/[\u0000-\u001f\u007f-\u009f]/g," ")}d(V,"plain");import ue from"node:path";async function fe(r){if(!ue.isAbsolute(r.resourceSource)&&!r.resourceSource.startsWith("ssh://"))return{formatting:{status:"unavailable"}};let e;try{let t=await ne({cwd:r.cwd}),i=ue.extname(r.resourceSource).toLowerCase(),o=d(l=>l.extensions.includes(i)||l.extensions.includes("*"),"matches"),c=t.compilers.find(o);if(c&&(await c.compile({filePath:r.resourceSource},t.ctx)).syntaxErrors.length>0)return{formatting:{status:"skipped-syntax"}};let a=t.formatters.find(o);if(!a)return{formatting:{status:"unavailable"}};e=a.name;let n=await a.format({filePath:r.resourceSource},t.ctx);return n.formatter===null?{formatting:{status:"unavailable"}}:(e=n.formatter??a.name,{formatting:{status:n.ok?n.edits>0?"changed":"unchanged":"failed",formatter:e},...n.ok?{diffStatuses:[{text:`Formatted (${e})`,tone:"success",formatter:e}]}:{diffStatuses:[{text:`Formatting failed (${e})`,formatter:e,tone:"error"}]}})}catch{return{diffStatuses:[{text:"Formatting failed",tone:"error",formattingStatus:"failed",...e===void 0?{}:{formatter:e}}],formatting:{status:"failed",...e===void 0?{}:{formatter:e}}}}}d(fe,"runIdePostEditGate");import{readFile as Oe}from"node:fs/promises";import he from"node:path";import{Text as Ne}from"@earendil-works/pi-tui";import{readFile as De}from"node:fs/promises";import Ce from"node:path";import{Type as v}from"typebox";import{Value as Se}from"typebox/value";import{parseDocument as $e}from"yaml";var _=".pi/pi-agent-ide/code-review.yaml",ke=v.Object({rules:v.Array(v.Object({id:v.String({pattern:"^[a-z][a-z0-9-]*$",maxLength:64}),description:v.String({minLength:1,maxLength:2048}),enabled:v.Optional(v.Boolean())},{additionalProperties:!1}),{maxItems:32})},{additionalProperties:!1});function Ae(r){if(Buffer.byteLength(r,"utf8")>65536)throw new Error("Review rules file is too large (64 KiB limit).");let e=$e(r),[t]=e.errors;if(t)throw new Error(t.message);let i=e.toJS({maxAliasCount:0});if(!Se.Check(ke,i))throw new Error("Expected rules: [{ id, description, enabled? }]; at most 32 rules with descriptions up to 2048 characters.");let o=new Set,c=[];for(let a of i.rules){if(o.has(a.id))throw new Error(`Duplicate review rule: ${a.id}`);if(o.add(a.id),!a.description.trim())throw new Error(`Empty description for ${a.id}`);a.enabled!==!1&&c.push({id:a.id,description:a.description.trim()})}return c}d(Ae,"parseReviewRules");async function ge(r){let e=Ce.resolve(r,_);try{return Ae(await De(e,"utf8"))}catch(t){if(t.code==="ENOENT")return[];throw new Error(`Cannot load ${e}: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}d(ge,"readReviewRules");import{createHash as _e}from"node:crypto";import{structuredPatch as Fe}from"diff";function pe(r,e){if(r===e)return[];if(r.length+e.length>3e5)throw new Error("File is too large for automatic review.");let t=Fe("before","after",r,e,void 0,void 0,{context:3,timeout:100});if(!t)throw new Error("Diff exceeded the automatic review time limit.");if(t.hunks.length>16)throw new Error("Change has too many fragments for automatic review (16 limit).");return t.hunks.map(i=>{let o=`@@ -${i.oldStart},${i.oldLines} +${i.newStart},${i.newLines} @@
3
3
  ${i.lines.join(`
4
4
  `)}`;if(o.length>12e3)throw new Error("Fragment is too large for automatic review (12000 character limit).");return{diff:o}})}d(pe,"reviewFragments");function me(r,e=300){let t=new Map,i=!1,o=Promise.resolve(),c=d(s=>!i&&r.enabled()&&t.get(s.edit.file)===s&&!s.controller.signal.aborted,"valid"),a=d(async s=>c(s)&&await r.current(s.edit.file)===s.edit.after&&c(s),"fresh");async function n(s){if(!c(s))return;s.started=!0;let{edit:u}=s;try{let f=r.runtime();if(!f)return;let h=AbortSignal.any([s.controller.signal,AbortSignal.timeout(15e3)]),p=await f.available(h),g=p.find(m=>m.provider==="typesafe"&&/jev/i.test(m.id))??p.find(m=>/jev/i.test(m.id));if(!g||!c(s))return;let E=await r.rules(u.cwd);if(E.length===0||!await a(s))return;let ye=Object.fromEntries(E.map(m=>[m.id,{type:"choice",instructions:`Check whether this change violates the following project rule: ${m.description}
@@ -1 +1 @@
1
- import{a as O}from"./chunk-UCTBXRGA.js";import{a as R}from"./chunk-TSNY2FSU.js";import{a as v,b as S}from"./chunk-V6IPWCPS.js";import{b as y}from"./chunk-FTECKRK6.js";import"./chunk-PPCWY4BB.js";import{a as w,b as E,c as b}from"./chunk-NFXS3E2A.js";import"./chunk-5W6QQZFI.js";import{g as s}from"./chunk-KJAR2WDO.js";import{a as p,b as k,d as C}from"./chunk-D45H2PNW.js";import{c as g}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as u,l as h,m as P}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-MDD5ORB6.js";import"./chunk-MLFJU2US.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import{a as c}from"./chunk-EI7MMDWY.js";import T from"node:path";function A(i){let l=v(i),U=R(i),d=new Map;return{async resolveProject(r,o){if(r.startsWith("ssh://")||o.startsWith("ssh://")){let e=i.resolve(r,o);if(!e)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let t=i.resolve(o);if(t&&t.location.target!==e.location.target)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");return O(e.backend,e.location.path,t?.location.path,"formatters",p)}if(r.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let n=await u(o,r,"formatters",p);return n===void 0?void 0:{cwd:n,external:n!==T.resolve(o)}},async loadRegistry(r,o){let n=JSON.stringify([r,o]),e=d.get(n);if(!e){let t=i.resolve(r);e=k.fromDirectory(r,{includeGlobal:!o,requireBuiltInEvidence:!0,...t?{layerAccess:l,executableAvailability:c(a=>y(t.backend,t.location.path,a),"executableAvailability"),recipeEvidence:c(a=>S(t.backend,t.location.path,a),"recipeEvidence")}:{}}),d.set(n,e)}return e},async run(r,o,n){let e=i.resolve(n);if(!e){if(n.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",n,"not-applied");return P(r,{projectRoot:o,filePath:n})}let t=await e.backend.read(e.location.path),a=await h(r.run,{projectRoot:o,filePath:n,processAccess:U}),m=await e.backend.read(e.location.path);if(!a.ok)return{ok:!1,changed:!m.bytes.equals(t.bytes)};if(r.output==="stdout"){if(m.version!==t.version)throw new s("CONFLICT",n,"not-applied");let f=Buffer.from(a.stdout);return f.equals(t.bytes)||await e.backend.write(e.location.path,f,t.version),{ok:!0,changed:!f.equals(t.bytes)}}return{ok:!0,changed:!m.bytes.equals(t.bytes)}}}}c(A,"createOwnedFormatterRuntime");async function F(i){let l=new b(await E(w(g())));await C(i,A(l))}c(F,"registerOwnedFormatter");export{A as createOwnedFormatterRuntime,F as default};
1
+ import{a as O}from"./chunk-FBR7ZLLN.js";import{a as R}from"./chunk-TSNY2FSU.js";import{a as v,b as S}from"./chunk-JHWLRL4U.js";import{b as y}from"./chunk-FTECKRK6.js";import"./chunk-PPCWY4BB.js";import{a as w,b as E,c as b}from"./chunk-V2D5MLGE.js";import"./chunk-5W6QQZFI.js";import{g as s}from"./chunk-KJAR2WDO.js";import{a as p,b as k,d as C}from"./chunk-6W4OJLCJ.js";import{c as g}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as u,l as h,m as P}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import{a as c}from"./chunk-EI7MMDWY.js";import T from"node:path";function A(i){let l=v(i),U=R(i),d=new Map;return{async resolveProject(r,o){if(r.startsWith("ssh://")||o.startsWith("ssh://")){let e=i.resolve(r,o);if(!e)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let t=i.resolve(o);if(t&&t.location.target!==e.location.target)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");return O(e.backend,e.location.path,t?.location.path,"formatters",p)}if(r.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let n=await u(o,r,"formatters",p);return n===void 0?void 0:{cwd:n,external:n!==T.resolve(o)}},async loadRegistry(r,o){let n=JSON.stringify([r,o]),e=d.get(n);if(!e){let t=i.resolve(r);e=k.fromDirectory(r,{includeGlobal:!o,requireBuiltInEvidence:!0,...t?{layerAccess:l,executableAvailability:c(a=>y(t.backend,t.location.path,a),"executableAvailability"),recipeEvidence:c(a=>S(t.backend,t.location.path,a),"recipeEvidence")}:{}}),d.set(n,e)}return e},async run(r,o,n){let e=i.resolve(n);if(!e){if(n.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",n,"not-applied");return P(r,{projectRoot:o,filePath:n})}let t=await e.backend.read(e.location.path),a=await h(r.run,{projectRoot:o,filePath:n,processAccess:U}),m=await e.backend.read(e.location.path);if(!a.ok)return{ok:!1,changed:!m.bytes.equals(t.bytes)};if(r.output==="stdout"){if(m.version!==t.version)throw new s("CONFLICT",n,"not-applied");let f=Buffer.from(a.stdout);return f.equals(t.bytes)||await e.backend.write(e.location.path,f,t.version),{ok:!0,changed:!f.equals(t.bytes)}}return{ok:!0,changed:!m.bytes.equals(t.bytes)}}}}c(A,"createOwnedFormatterRuntime");async function F(i){let l=new b(await E(w(g())));await C(i,A(l))}c(F,"registerOwnedFormatter");export{A as createOwnedFormatterRuntime,F as default};
@@ -1 +1 @@
1
- import{a as d,b as u,c as w}from"./chunk-NFXS3E2A.js";import"./chunk-KJAR2WDO.js";import{b as f}from"./chunk-5GASXMD2.js";import"./chunk-DEP55R35.js";import{c}from"./chunk-XHFAV2NI.js";import"./chunk-R2U5WXYR.js";import"./chunk-KN6VPARZ.js";import"./chunk-MDD5ORB6.js";import"./chunk-MLFJU2US.js";import"./chunk-37UNDG6V.js";import"./chunk-6TOFURDG.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-ALZV2EYT.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import{readFile as x}from"node:fs/promises";async function g(o){let n=new w(await u(d(c())));await f(o,m(o,n))}i(g,"registerOwnedGit");function m(o,n){return{exec:i(async(t,r,e)=>{let a=n.resolve(e.cwd);if(!a){if(/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.cwd))throw new Error(`Unsupported Git resource: ${e.cwd}`);return o.exec(t,r,e)}let s=await a.backend.execute(t,r,a.location.path,e);return{code:s.exitCode,stdout:s.stdout.toString("utf8"),stderr:s.stderr.toString("utf8")}},"exec"),async writeIndex(t,r){let e=n.resolve(r.cwd);return e?(await e.backend.writeGitIndex(e.location.path,t,r),!0):!1},async readText(t,r){let e=n.resolve(t);if(e)return(await e.backend.read(e.location.path,{signal:r})).bytes.toString("utf8");if(/^[a-z][a-z0-9+.-]*:\/\//iu.test(t))throw new Error(`Unsupported Git resource: ${t}`);return x(t,{encoding:"utf8",signal:r})}}}i(m,"createOwnedGitExecutor");export{m as createOwnedGitExecutor,g as default};
1
+ import{a as d,b as u,c as w}from"./chunk-V2D5MLGE.js";import"./chunk-KJAR2WDO.js";import{b as f}from"./chunk-T5ACAOKJ.js";import"./chunk-EHFWODRT.js";import{c}from"./chunk-XHFAV2NI.js";import"./chunk-R2U5WXYR.js";import"./chunk-KN6VPARZ.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-YZTVC7ME.js";import"./chunk-VDSSAP6Y.js";import"./chunk-2DSY4U73.js";import"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import{readFile as x}from"node:fs/promises";async function g(o){let n=new w(await u(d(c())));await f(o,m(o,n))}i(g,"registerOwnedGit");function m(o,n){return{exec:i(async(t,r,e)=>{let a=n.resolve(e.cwd);if(!a){if(/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.cwd))throw new Error(`Unsupported Git resource: ${e.cwd}`);return o.exec(t,r,e)}let s=await a.backend.execute(t,r,a.location.path,e);return{code:s.exitCode,stdout:s.stdout.toString("utf8"),stderr:s.stderr.toString("utf8")}},"exec"),async writeIndex(t,r){let e=n.resolve(r.cwd);return e?(await e.backend.writeGitIndex(e.location.path,t,r),!0):!1},async readText(t,r){let e=n.resolve(t);if(e)return(await e.backend.read(e.location.path,{signal:r})).bytes.toString("utf8");if(/^[a-z][a-z0-9+.-]*:\/\//iu.test(t))throw new Error(`Unsupported Git resource: ${t}`);return x(t,{encoding:"utf8",signal:r})}}}i(m,"createOwnedGitExecutor");export{m as createOwnedGitExecutor,g as default};
@@ -1 +1 @@
1
- import{a as g,c as P,d as T}from"./chunk-72FL5FHZ.js";import{b as C,c as k,g as R,i as E,k as F,m as d,n as x}from"./chunk-S3T5NOSL.js";import{a as w}from"./chunk-MDD5ORB6.js";import{b as y,c as h}from"./chunk-MLFJU2US.js";import{a as v}from"./chunk-ZAWRSA7N.js";import{a as b,b as j}from"./chunk-OFILFO6D.js";import{a as f}from"./chunk-EI7MMDWY.js";var A=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],z=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],p=[e("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),e("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),e("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),e("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),e("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],A,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),e("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),e("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],z,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),e("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),e("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),e("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),e("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),e("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),e("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),e("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),e("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),e("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),e("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),e("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),e("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),e("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),e("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),e("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),e("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),e("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),e("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),e("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),e("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),e("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),e("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),e("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function e(r,t,o,i,a,l,n,s,m,u){return{id:r,name:r,kind:"formatter",languages:t,executables:o,configFiles:i,documentation:n,...s&&{dependencies:s},...m&&{configSections:m},formatter:{extensions:a,...u&&{fileNames:u},run:{command:l},output:"in-place"}}}f(e,"recipe");var c=class r{constructor(t,o,i=new Map){this.formatters=t;this.availableBuiltIns=o;this.evidence=i}static{f(this,"FormatterCommandRegistry")}static async fromDirectory(t,o={}){let i=await R(t,"formatters",s=>x(s).formatters,o),{available:a,evidence:l}=await F(t,i.entries.filter(s=>s.layer==="built-in").map(s=>({id:s.id,config:s.config.run})),p,o),n=[...i.entries].sort((s,m)=>s.layer==="built-in"&&m.layer==="built-in"?(l.get(m.id)?.score??0)-(l.get(s.id)?.score??0):0);return new r(n,a,l)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([o,i])=>({id:o,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,o){return this.resolveEntry(t,o)?.config}resolveEntry(t,o){return E(this.formatters,this.availableBuiltIns,this.evidence,t,o)}get entries(){return this.formatters}};var I={protocol:y,apiVersion:h,id:"formatter",setup(r){for(let t of p)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:$}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let o=await c.fromDirectory(t.cwd,g(t)),i=M(o,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:l})=>{let n=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`;return T(t,l,async s=>{try{let m=t.workspace?await t.workspace.run(a.config.run,s,t.signal):await d(a.config,{projectRoot:t.cwd,filePath:s,env:t.env});return t.signal?.throwIfAborted(),m.ok?{status:"pass",message:`${n}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${n}: probe failed`,detail:a.sourcePath}}catch(m){return t.signal?.throwIfAborted(),{status:"fail",message:`${n}: ${m instanceof Error?m.message:String(m)}`,detail:a.sourcePath}}})}))}catch(o){return t.signal?.throwIfAborted(),[{status:"fail",message:o instanceof Error?o.message:String(o)}]}}})}};async function $(r){try{let t=await c.fromDirectory(r.cwd,g(r)),o=[],i=new Map;for(let[a,l]of r.detectedLanguages){let n=l.map(s=>t.resolveEntry(s,r.cwd)).find(s=>s!==void 0);n!==void 0&&(o.push({kind:"formatter",languageId:a,toolId:n.id}),await P(r,n.config.run)||i.set(n.id,{id:`formatter-${n.id}-unavailable`,message:`Configured formatter ${n.id} cannot run ${JSON.stringify(n.config.run.command)}`}))}return{selections:o,actions:[...i.values()]}}catch(t){return r.signal?.throwIfAborted(),{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}f($,"inspectFormatterSetup");function M(r,t,o){let i=new Map;for(let a of t){let l=r.resolveEntry(a,o);l!==void 0&&!i.has(l.id)&&i.set(l.id,{entry:l,source:a})}return[...i.values()]}f(M,"applicableFormatters");import _ from"node:path";var S=new Map;function D(r){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:f(async t=>(r?await r.loadRegistry(t.cwd,!1):await O(t.cwd),!0),"detect"),async format({filePath:t},o){if(!r&&(t.includes("://")||o.cwd.includes("://")))throw Object.assign(new Error("Formatter requires its resource owner"),{code:"UNSUPPORTED_SOURCE"});let i=r?await r.resolveProject(t,o.cwd):await k(o.cwd,t,"formatters",p).then(m=>m===void 0?void 0:{cwd:m,external:m!==_.resolve(o.cwd)});if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=i.cwd,n=(r?await r.loadRegistry(a,i.external):await O(a,i.external)).resolve(t,a);if(n===void 0)return{ok:!0,edits:0,formatter:null};let s=C(n.run.command);if(r){let m=await r.run(n,a,t);return{ok:m.ok,edits:m.changed?1:0,formatter:s}}try{let m=await d(n,{projectRoot:a,filePath:t});return{ok:m.ok,edits:m.changed?1:0,formatter:s}}catch{return{ok:!1,edits:0,formatter:s}}}}}f(D,"createFormatter");async function O(r,t=!1){let o=JSON.stringify([r,t]),i=S.get(o);return i===void 0&&(i=c.fromDirectory(r,{includeGlobal:!t,requireBuiltInEvidence:!0}),S.set(o,i)),i}f(O,"loadRegistry");async function q(r){await N(r)}f(q,"registerFormatter");async function N(r,t){let o=D(t),i={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:f(()=>Promise.resolve(!0),"detect"),async format(l,n){return o.format(l,n)}},a={protocol:b,apiVersion:5,id:"formatter",setup(l){l.addTool(i)}};await Promise.all([v(r,a),w(r,I)])}f(N,"registerFormatterWithOwner");export{p as a,c as b,q as c,N as d};
1
+ import{a as g,c as P,d as T}from"./chunk-72FL5FHZ.js";import{b as C,c as k,g as R,i as E,k as F,m as d,n as x}from"./chunk-S3T5NOSL.js";import{a as w}from"./chunk-2YO6RVX4.js";import{b as y,c as h}from"./chunk-MLFJU2US.js";import{a as v}from"./chunk-ZAWRSA7N.js";import{a as b,b as j}from"./chunk-OFILFO6D.js";import{a as f}from"./chunk-EI7MMDWY.js";var A=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],z=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],p=[e("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),e("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),e("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),e("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),e("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],A,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),e("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),e("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],z,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),e("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),e("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),e("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),e("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),e("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),e("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),e("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),e("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),e("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),e("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),e("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),e("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),e("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),e("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),e("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),e("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),e("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),e("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),e("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),e("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),e("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),e("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),e("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function e(r,t,o,i,a,l,n,s,m,u){return{id:r,name:r,kind:"formatter",languages:t,executables:o,configFiles:i,documentation:n,...s&&{dependencies:s},...m&&{configSections:m},formatter:{extensions:a,...u&&{fileNames:u},run:{command:l},output:"in-place"}}}f(e,"recipe");var c=class r{constructor(t,o,i=new Map){this.formatters=t;this.availableBuiltIns=o;this.evidence=i}static{f(this,"FormatterCommandRegistry")}static async fromDirectory(t,o={}){let i=await R(t,"formatters",s=>x(s).formatters,o),{available:a,evidence:l}=await F(t,i.entries.filter(s=>s.layer==="built-in").map(s=>({id:s.id,config:s.config.run})),p,o),n=[...i.entries].sort((s,m)=>s.layer==="built-in"&&m.layer==="built-in"?(l.get(m.id)?.score??0)-(l.get(s.id)?.score??0):0);return new r(n,a,l)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([o,i])=>({id:o,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,o){return this.resolveEntry(t,o)?.config}resolveEntry(t,o){return E(this.formatters,this.availableBuiltIns,this.evidence,t,o)}get entries(){return this.formatters}};var I={protocol:y,apiVersion:h,id:"formatter",setup(r){for(let t of p)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:$}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let o=await c.fromDirectory(t.cwd,g(t)),i=M(o,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:l})=>{let n=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`;return T(t,l,async s=>{try{let m=t.workspace?await t.workspace.run(a.config.run,s,t.signal):await d(a.config,{projectRoot:t.cwd,filePath:s,env:t.env});return t.signal?.throwIfAborted(),m.ok?{status:"pass",message:`${n}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${n}: probe failed`,detail:a.sourcePath}}catch(m){return t.signal?.throwIfAborted(),{status:"fail",message:`${n}: ${m instanceof Error?m.message:String(m)}`,detail:a.sourcePath}}})}))}catch(o){return t.signal?.throwIfAborted(),[{status:"fail",message:o instanceof Error?o.message:String(o)}]}}})}};async function $(r){try{let t=await c.fromDirectory(r.cwd,g(r)),o=[],i=new Map;for(let[a,l]of r.detectedLanguages){let n=l.map(s=>t.resolveEntry(s,r.cwd)).find(s=>s!==void 0);n!==void 0&&(o.push({kind:"formatter",languageId:a,toolId:n.id}),await P(r,n.config.run)||i.set(n.id,{id:`formatter-${n.id}-unavailable`,message:`Configured formatter ${n.id} cannot run ${JSON.stringify(n.config.run.command)}`}))}return{selections:o,actions:[...i.values()]}}catch(t){return r.signal?.throwIfAborted(),{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}f($,"inspectFormatterSetup");function M(r,t,o){let i=new Map;for(let a of t){let l=r.resolveEntry(a,o);l!==void 0&&!i.has(l.id)&&i.set(l.id,{entry:l,source:a})}return[...i.values()]}f(M,"applicableFormatters");import _ from"node:path";var S=new Map;function D(r){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:f(async t=>(r?await r.loadRegistry(t.cwd,!1):await O(t.cwd),!0),"detect"),async format({filePath:t},o){if(!r&&(t.includes("://")||o.cwd.includes("://")))throw Object.assign(new Error("Formatter requires its resource owner"),{code:"UNSUPPORTED_SOURCE"});let i=r?await r.resolveProject(t,o.cwd):await k(o.cwd,t,"formatters",p).then(m=>m===void 0?void 0:{cwd:m,external:m!==_.resolve(o.cwd)});if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=i.cwd,n=(r?await r.loadRegistry(a,i.external):await O(a,i.external)).resolve(t,a);if(n===void 0)return{ok:!0,edits:0,formatter:null};let s=C(n.run.command);if(r){let m=await r.run(n,a,t);return{ok:m.ok,edits:m.changed?1:0,formatter:s}}try{let m=await d(n,{projectRoot:a,filePath:t});return{ok:m.ok,edits:m.changed?1:0,formatter:s}}catch{return{ok:!1,edits:0,formatter:s}}}}}f(D,"createFormatter");async function O(r,t=!1){let o=JSON.stringify([r,t]),i=S.get(o);return i===void 0&&(i=c.fromDirectory(r,{includeGlobal:!t,requireBuiltInEvidence:!0}),S.set(o,i)),i}f(O,"loadRegistry");async function q(r){await N(r)}f(q,"registerFormatter");async function N(r,t){let o=D(t),i={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:f(()=>Promise.resolve(!0),"detect"),async format(l,n){return o.format(l,n)}},a={protocol:b,apiVersion:5,id:"formatter",setup(l){l.addTool(i)}};await Promise.all([v(r,a),w(r,I)])}f(N,"registerFormatterWithOwner");export{p as a,c as b,q as c,N as d};
@@ -1 +1 @@
1
- import{a as b}from"./chunk-UCTBXRGA.js";import{a as y}from"./chunk-7IYO2R47.js";import{a as k,b as E}from"./chunk-V6IPWCPS.js";import"./chunk-KX7MG72M.js";import{b as S}from"./chunk-FTECKRK6.js";import{a as u,b as w,c as v}from"./chunk-NFXS3E2A.js";import{g as c}from"./chunk-KJAR2WDO.js";import{a as p,b as h,d as P}from"./chunk-VWP2HLFT.js";import{c as f}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as m}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-JXULBI4S.js";import"./chunk-HFCHOFLV.js";import"./chunk-5AROEOJB.js";import"./chunk-47SPPIXK.js";import"./chunk-VAXLSPPU.js";import"./chunk-MDD5ORB6.js";import"./chunk-MLFJU2US.js";import"./chunk-PS2B6THP.js";import"./chunk-37UNDG6V.js";import"./chunk-6TOFURDG.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-YNOR4LIE.js";import"./chunk-FNJ6X7OP.js";import"./chunk-T4FTT3U4.js";import"./chunk-ALZV2EYT.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{a as i}from"./chunk-EI7MMDWY.js";import R from"node:path";function g(d){let n=i(o=>{let e=d.resolve(o);if(!e)throw new c("UNSUPPORTED_SOURCE",o,"not-applied");return e},"resolve");return{transport:i(o=>y(d,o),"transport"),async readText(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes.toString("utf8")},async readSnapshot(o,e){let r=n(o),t=await r.backend.read(r.location.path,{signal:e});return{content:t.bytes.toString("utf8"),version:t.version}},async readBytes(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes},async exists(o,e){let r=n(o);try{return await r.backend.stat(r.location.path,{signal:e}),!0}catch(t){if(t instanceof c&&t.code==="ENOENT")return!1;throw t}},async isFile(o,e){let r=n(o);return(await r.backend.stat(r.location.path,{signal:e})).kind==="file"},async entries(o,e){let r=n(o);return(await r.backend.list(r.location.path,{signal:e})).map(t=>({name:t.name,kind:t.kind==="symlink"?"other":t.kind}))}}}i(g,"createSshLspWorkspaceOwner");async function O(d){let n=new v(await w(u(f()))),o=g(n);await P(d,{workspace:i(e=>e.startsWith("ssh://")?o:void 0,"workspace"),async loadRegistry(e,r,t){t?.throwIfAborted();let s=n.resolve(e);if(s)return h.fromPackageDir(e,{signal:t,layerAccess:k(n,t),includeGlobal:!r,requireBuiltInEvidence:r,recipes:p,recipeEvidence:i(a=>E(s.backend,s.location.path,a,t),"recipeEvidence"),executableAvailability:i(a=>S(s.backend,s.location.path,a,t),"executableAvailability")});if(e.includes("://"))throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return h.fromPackageDir(r?e:process.env.PI_AGENT_IDE_CONFIG_DIR??e,{signal:t,includeGlobal:!r,requireBuiltInEvidence:r,recipes:p})},async resolveProject(e,r,t){if(t?.throwIfAborted(),e.startsWith("ssh://")||r.startsWith("ssh://")){let a=n.resolve(e,r);if(!a)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");let l=n.resolve(r);if(l&&l.location.target!==a.location.target)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return b(a.backend,a.location.path,l?.location.path,"lsp-servers",p,t)}let s=await m(r,e,"lsp-servers",p,t);return s===void 0?void 0:{cwd:s,external:s!==R.resolve(r)}}})}i(O,"registerOwnedLsp");export{O as default};
1
+ import{a as b}from"./chunk-FBR7ZLLN.js";import{a as y}from"./chunk-HSEDKYH4.js";import{a as k,b as E}from"./chunk-JHWLRL4U.js";import"./chunk-KX7MG72M.js";import{b as S}from"./chunk-FTECKRK6.js";import{a as u,b as w,c as v}from"./chunk-V2D5MLGE.js";import{g as c}from"./chunk-KJAR2WDO.js";import{a as p,b as h,d as P}from"./chunk-BMSAVDRD.js";import{c as f}from"./chunk-XHFAV2NI.js";import"./chunk-72FL5FHZ.js";import{c as m}from"./chunk-S3T5NOSL.js";import"./chunk-BXGMMZT3.js";import"./chunk-JXULBI4S.js";import"./chunk-HFCHOFLV.js";import"./chunk-5AROEOJB.js";import"./chunk-47SPPIXK.js";import"./chunk-VAXLSPPU.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-PS2B6THP.js";import"./chunk-YZTVC7ME.js";import"./chunk-VDSSAP6Y.js";import"./chunk-2DSY4U73.js";import"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-YNOR4LIE.js";import"./chunk-JMQ67UNK.js";import"./chunk-T4FTT3U4.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{a as i}from"./chunk-EI7MMDWY.js";import R from"node:path";function g(d){let n=i(o=>{let e=d.resolve(o);if(!e)throw new c("UNSUPPORTED_SOURCE",o,"not-applied");return e},"resolve");return{transport:i(o=>y(d,o),"transport"),async readText(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes.toString("utf8")},async readSnapshot(o,e){let r=n(o),t=await r.backend.read(r.location.path,{signal:e});return{content:t.bytes.toString("utf8"),version:t.version}},async readBytes(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes},async exists(o,e){let r=n(o);try{return await r.backend.stat(r.location.path,{signal:e}),!0}catch(t){if(t instanceof c&&t.code==="ENOENT")return!1;throw t}},async isFile(o,e){let r=n(o);return(await r.backend.stat(r.location.path,{signal:e})).kind==="file"},async entries(o,e){let r=n(o);return(await r.backend.list(r.location.path,{signal:e})).map(t=>({name:t.name,kind:t.kind==="symlink"?"other":t.kind}))}}}i(g,"createSshLspWorkspaceOwner");async function O(d){let n=new v(await w(u(f()))),o=g(n);await P(d,{workspace:i(e=>e.startsWith("ssh://")?o:void 0,"workspace"),async loadRegistry(e,r,t){t?.throwIfAborted();let s=n.resolve(e);if(s)return h.fromPackageDir(e,{signal:t,layerAccess:k(n,t),includeGlobal:!r,requireBuiltInEvidence:r,recipes:p,recipeEvidence:i(a=>E(s.backend,s.location.path,a,t),"recipeEvidence"),executableAvailability:i(a=>S(s.backend,s.location.path,a,t),"executableAvailability")});if(e.includes("://"))throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return h.fromPackageDir(r?e:process.env.PI_AGENT_IDE_CONFIG_DIR??e,{signal:t,includeGlobal:!r,requireBuiltInEvidence:r,recipes:p})},async resolveProject(e,r,t){if(t?.throwIfAborted(),e.startsWith("ssh://")||r.startsWith("ssh://")){let a=n.resolve(e,r);if(!a)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");let l=n.resolve(r);if(l&&l.location.target!==a.location.target)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return b(a.backend,a.location.path,l?.location.path,"lsp-servers",p,t)}let s=await m(r,e,"lsp-servers",p,t);return s===void 0?void 0:{cwd:s,external:s!==R.resolve(r)}}})}i(O,"registerOwnedLsp");export{O as default};
@@ -1,4 +1,4 @@
1
- import{b as g,c as y,d as _,e as C,g as k}from"./chunk-57F5GTHO.js";import{a as i}from"./chunk-EI7MMDWY.js";import{truncateToWidth as N,wrapTextWithAnsi as L}from"@earendil-works/pi-tui";var x="PI AGENT IDE",U=/\/[a-z][\w-]*/giu,m=class{constructor(t,n){this.tip=t;this.theme=n}static{i(this,"TipCallout")}cached;render(t){if(this.cached?.width===t)return this.cached.lines;let n=$(this.tip,this.theme,t);return this.cached={width:t,lines:n},n}invalidate(){this.cached=void 0}};function $(e,t,n){if(n<=0)return[];if(n<=2)return[t.fg("accent",n===1?"\u2502":"\u2502 ")];let s=n-2,r=t.fg("accent",t.bold(x))+t.fg("dim"," \xB7 ")+t.bold(e.title),o=e.body.split(`
1
+ import{b as g,c as y,d as _,e as C,g as k}from"./chunk-JYITLCXC.js";import{a as i}from"./chunk-EI7MMDWY.js";import{truncateToWidth as N,wrapTextWithAnsi as L}from"@earendil-works/pi-tui";var x="PI AGENT IDE",U=/\/[a-z][\w-]*/giu,m=class{constructor(t,n){this.tip=t;this.theme=n}static{i(this,"TipCallout")}cached;render(t){if(this.cached?.width===t)return this.cached.lines;let n=$(this.tip,this.theme,t);return this.cached={width:t,lines:n},n}invalidate(){this.cached=void 0}};function $(e,t,n){if(n<=0)return[];if(n<=2)return[t.fg("accent",n===1?"\u2502":"\u2502 ")];let s=n-2,r=t.fg("accent",t.bold(x))+t.fg("dim"," \xB7 ")+t.bold(e.title),o=e.body.split(`
2
2
  `).map(c=>c.length===0?"":z(c,t)),d=[r,...o].flatMap(c=>M(c,s)),a=t.fg("accent","\u2502");return d.map(c=>N(`${a} ${c}`,n))}i($,"renderTip");function M(e,t){return e.length===0?[""]:L(e,t)}i(M,"wrapLine");function z(e,t){let n="",s=0;for(let r of e.matchAll(U)){let o=r.index;n+=t.fg("muted",e.slice(s,o)),n+=t.fg("accent",t.bold(r[0])),s=o+r[0].length}return n+t.fg("muted",e.slice(s))}i(z,"styleBodyLine");var h=class{static{i(this,"TipCore")}providers=new Map;registerProvider(t){if(!/^[a-z0-9][a-z0-9.-]*$/u.test(t.id))return Promise.reject(new Error(`Invalid tip provider ID: ${t.id}`));let n=this.providers.get(t.id);return n!==void 0?n===t?Promise.resolve():Promise.reject(new Error(`Tip provider ${t.id} is already registered`)):(this.providers.set(t.id,t),Promise.resolve())}get isEmpty(){return this.providers.size===0}async collectTips(t){let n=[];for(let s of this.providers.values()){if(t.signal?.aborted)break;try{let r=await V(s,t);r!==void 0&&Y(r)&&n.push({providerId:s.id,tip:r})}catch{}}return n}};async function V(e,t){let n=t.signal;if(n===void 0)return e.getTip(t);if(n.aborted)return;let s=i(()=>{},"abort"),r=new Promise(o=>{s=i(()=>o(void 0),"abort"),n.addEventListener("abort",s,{once:!0})});try{return await Promise.race([e.getTip(t),r])}finally{n.removeEventListener("abort",s)}}i(V,"collectTip");function Y(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&/^[a-z0-9][a-z0-9.-]*$/u.test(t.id)&&typeof t.title=="string"&&t.title.trim().length>0&&typeof t.body=="string"&&t.body.trim().length>0&&(t.scope===void 0||t.scope==="project"||t.scope==="global")}i(Y,"isTip");import{randomUUID as F}from"node:crypto";import{mkdir as I,readFile as G,rename as H,rm as S,stat as J,writeFile as K}from"node:fs/promises";import{setTimeout as W}from"node:timers/promises";import{homedir as B}from"node:os";import f from"node:path";var O=1,Q=10,X=5e3,q=6e4,p=Promise.resolve();function Z(e=process.env){let t=e.PI_CODING_AGENT_DIR??f.join(B(),".pi","agent");return f.join(t,"pi-agent-ide","tips.json")}i(Z,"resolveTipStatePath");var P=class{constructor(t=Z()){this.statePath=t}static{i(this,"TipStateStore")}async shownFor(t){let n=await T(this.statePath);return new Set(w(n,t))}async claimIfUnseen(t,n,s){let r=p.then(async()=>{try{return await v(this.statePath,async()=>{let o=await T(this.statePath),d=new Set(w(o,t));return d.has(n)||s!==void 0&&d.has(s)?!1:(d.add(n),await E(this.statePath,b(o,t,[...d])),!0)})}catch{return!0}});return p=r.then(()=>{},()=>{}),r}async markShown(t,n){if(n.length===0)return;p=p.then(async()=>{await v(this.statePath,async()=>{let r=await T(this.statePath),o=new Set(w(r,t));for(let d of n)o.add(d);await E(this.statePath,b(r,t,[...o]))})}).catch(()=>{}),await p}async unmarkShown(t,n){p=p.then(async()=>{try{await v(this.statePath,async()=>{let r=await T(this.statePath),o=new Set(w(r,t));o.delete(n)&&await E(this.statePath,b(r,t,[...o]))})}catch{}}).catch(()=>{}),await p}};function w(e,t){return t===void 0?e.global??[]:e.projects[t]??[]}i(w,"shownIds");function b(e,t,n){return t===void 0?{...e,global:n}:{...e,projects:{...e.projects,[t]:n}}}i(b,"withShown");function j(e){return f.resolve(e)}i(j,"normalizeProjectPath");async function T(e){try{let t=JSON.parse(await G(e,"utf8"));return et(t)?t:R()}catch{return R()}}i(T,"readState");async function v(e,t){let n=`${e}.lock`;await I(f.dirname(e),{recursive:!0});let s=Date.now();for(;;)try{await I(n);break}catch(r){if(tt(r)!=="EEXIST")throw r;try{if(Date.now()-(await J(n)).mtimeMs>q){await S(n,{recursive:!0,force:!0});continue}}catch{}if(Date.now()-s>=X)throw new Error(`Timed out waiting for startup-tip state lock: ${n}`,{cause:r});await W(Q)}try{return await t()}finally{await S(n,{recursive:!0,force:!0})}}i(v,"withStateLock");function tt(e){return typeof e=="object"&&e!==null&&"code"in e?String(e.code):void 0}i(tt,"errorCode");async function E(e,t){try{await I(f.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.${F()}.tmp`;try{await K(n,`${JSON.stringify(t,null,2)}
3
3
  `,"utf8"),await H(n,e)}finally{await S(n,{force:!0})}}catch{}}i(E,"writeState");function R(){return{version:O,projects:{}}}i(R,"emptyState");function et(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version!==O||typeof t.projects!="object"||t.projects===null||Array.isArray(t.projects)||t.global!==void 0&&(!Array.isArray(t.global)||!t.global.every(n=>typeof n=="string"))?!1:Object.values(t.projects).every(n=>Array.isArray(n)&&n.every(s=>typeof s=="string"))}i(et,"isState");function D(e){return{protocol:g,apiVersion:y,id:"agent-setup",getTip(t){if(!(t.mode!=="tui"||!t.hasUI||!e()))return{id:"agent-setup-v1",scope:"global",title:"Agent-assisted setup",body:`You can ask your agent to configure Pi Agent IDE.
4
4
  Try: \u201CHelp me configure Pi Agent IDE for this project.\u201D
@@ -1,2 +1,2 @@
1
- import"./chunk-NNCZYO4Q.js";import{d as k}from"./chunk-FUOB54RU.js";import"./chunk-PS2B6THP.js";import{d as y}from"./chunk-72YIFABM.js";import"./chunk-6TOFURDG.js";import{a as P}from"./chunk-BU7IZLKB.js";import{a as h,b as w}from"./chunk-S5PL5DFQ.js";import"./chunk-SIYPD5MM.js";import{a as I,b as v,c as C,d as A,e as E,h as b}from"./chunk-FNJ6X7OP.js";import"./chunk-T4FTT3U4.js";import"./chunk-ALZV2EYT.js";import"./chunk-ZC65Z3CK.js";import{a as T}from"./chunk-ZAWRSA7N.js";import{a as N,b as O}from"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{a as l}from"./chunk-EI7MMDWY.js";import W from"node:path";var S="diagnostics",_=k({kind:"code-view",label:"Diagnostics"});async function q(c){let n,t=l((a,f,e)=>{if(n===void 0)throw new Error("IDE diagnostics are not connected");return n(a,{cwd:f,...e})},"collect"),s={protocol:N,apiVersion:5,id:"diagnostics",setup(a){n=a.readDiagnostics}},r=new WeakMap,i=new WeakMap,o=new WeakMap,u=new WeakMap,M={protocol:h,apiVersion:w,id:"diagnostics",setup(a){a.addResolver({resolver:H(t,i),renderResult:_});let f=b();a.addView({view:"diagnostics",priority:100,presenter:j(t,u)}),a.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler(e){if(e.state?.resolvedBy==="diagnostics"){let p=e.state.content[0],g=i.get(p);return g&&r.set(e.request,g),f(e)}return e.state?.contentKind==="text"&&e.request.views?.includes("diagnostics")&&o.set(e.request,e.state.text),{kind:"continue",context:e}}}),a.addHandler({stage:"post-read",handler(e){let p=r.get(e.request);if(p&&e.result)return{kind:"continue",context:e,transform:l(d=>({...d,details:{...d.details,diagnosticCheck:p}}),"transform")};let g=o.get(e.request),R=g&&u.get(g),m=e.result,V=m?.content[0];return!R||!m||V?.type!=="text"?{kind:"continue",context:e}:{kind:"continue",context:e,transform(d){let D=d.content[0];return D?.type!=="text"?d:{...d,content:[{...D,text:`${R}
1
+ import"./chunk-NNCZYO4Q.js";import{d as k}from"./chunk-LY2UANKU.js";import"./chunk-PS2B6THP.js";import{d as y}from"./chunk-QGXZ4RWX.js";import"./chunk-VDSSAP6Y.js";import{a as P}from"./chunk-2DSY4U73.js";import{a as h,b as w}from"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import{a as I,b as v,c as C,d as A,e as E,h as b}from"./chunk-JMQ67UNK.js";import"./chunk-T4FTT3U4.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import{a as T}from"./chunk-ZAWRSA7N.js";import{a as N,b as O}from"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{a as l}from"./chunk-EI7MMDWY.js";import W from"node:path";var S="diagnostics",_=k({kind:"code-view",label:"Diagnostics"});async function q(c){let n,t=l((a,f,e)=>{if(n===void 0)throw new Error("IDE diagnostics are not connected");return n(a,{cwd:f,...e})},"collect"),s={protocol:N,apiVersion:5,id:"diagnostics",setup(a){n=a.readDiagnostics}},r=new WeakMap,i=new WeakMap,o=new WeakMap,u=new WeakMap,M={protocol:h,apiVersion:w,id:"diagnostics",setup(a){a.addResolver({resolver:H(t,i),renderResult:_});let f=b();a.addView({view:"diagnostics",priority:100,presenter:j(t,u)}),a.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler(e){if(e.state?.resolvedBy==="diagnostics"){let p=e.state.content[0],g=i.get(p);return g&&r.set(e.request,g),f(e)}return e.state?.contentKind==="text"&&e.request.views?.includes("diagnostics")&&o.set(e.request,e.state.text),{kind:"continue",context:e}}}),a.addHandler({stage:"post-read",handler(e){let p=r.get(e.request);if(p&&e.result)return{kind:"continue",context:e,transform:l(d=>({...d,details:{...d.details,diagnosticCheck:p}}),"transform")};let g=o.get(e.request),R=g&&u.get(g),m=e.result,V=m?.content[0];return!R||!m||V?.type!=="text"?{kind:"continue",context:e}:{kind:"continue",context:e,transform(d){let D=d.content[0];return D?.type!=="text"?d:{...d,content:[{...D,text:`${R}
2
2
  ${D.text}`},...d.content.slice(1)],details:{...d.details,diagnosticStatus:R}}}}}}),a.describe({path:"diagnostics:<path> \u2014 lint and language-server diagnostics.",views:"diagnostics \u2014 diagnostics beside the text."})}};await Promise.all([T(c,s),P(c,M)])}l(q,"registerDiagnostics");function H(c,n){return{id:"diagnostics",tryResolve(t,s){return Promise.resolve(L(t,s.cwd,c,n,{signal:s.signal,...s.audience==="script"&&{mode:"complete"}}))}}}l(H,"createDiagnosticResolver");function L(c,n,t,s,r){let i;try{i=I(c,S,n)}catch(o){return{kind:"failed",error:o}}return i===void 0?{kind:"not-handled"}:{kind:"resolved",resource:{source:v(S,i),async read(){let o=await t(i,n,r),u=C(i,o.content,o.results);return s.set(u,u.diagnosticCheck),[u]}}}}l(L,"resolveDiagnosticSource");function j(c,n){return{id:"diagnostics",async present(t,s){if(s.purpose!=="read"||!W.isAbsolute(t.source)&&!t.source.startsWith("ssh://"))return t;let r=s.audience==="script"&&!s.requestedViews?.includes("diagnostics");if(r&&y(t.source))return t;let i=await c(t.source,s.cwd,{signal:s.signal,...s.audience==="script"&&{mode:r?"snapshot":"complete"}}).catch(o=>{if(s.signal?.throwIfAborted(),!r)throw o});if(i===void 0||r&&i.content!==t.content)return t;if(i.content!==t.content)throw new Error("File changed during diagnostic read; read it again for current source lines.");return n.set(t,E(i.results)),A(t,i.results)}}}l(j,"createDiagnosticPresenter");export{q as default};
@@ -1,17 +1,17 @@
1
- import{a as me}from"./chunk-OCU6NW5Y.js";import{a as ue,b as fe,c as pe,d as he,e as ge,j as Re}from"./chunk-DFUGBEHK.js";import{a as C}from"./chunk-K5M65CAF.js";import{a as we,b as xe}from"./chunk-W4IAODWI.js";import{a as ye,b as E,c as Se,d as be}from"./chunk-5D4C225L.js";import{f as Q,g as U}from"./chunk-JXULBI4S.js";import{b as le,c as de}from"./chunk-R2U5WXYR.js";import{d as x,f as ie,g as q,h as oe,i as ae,j as se}from"./chunk-HFCHOFLV.js";import{c as K,d as Y}from"./chunk-5AROEOJB.js";import{a as ee}from"./chunk-47SPPIXK.js";import{a as Z,b as X}from"./chunk-VAXLSPPU.js";import{a as ne}from"./chunk-MDD5ORB6.js";import{b as te,c as re}from"./chunk-MLFJU2US.js";import{a as G,e as J}from"./chunk-PS2B6THP.js";import{a as ce}from"./chunk-37UNDG6V.js";import{c as B,d as V,f as W}from"./chunk-6TOFURDG.js";import{a as j}from"./chunk-BU7IZLKB.js";import{a as D,b as L}from"./chunk-S5PL5DFQ.js";import{M as P,N as F}from"./chunk-SIYPD5MM.js";import{m as M}from"./chunk-ALZV2EYT.js";import{a as f}from"./chunk-EI7MMDWY.js";import{readFile as Ve}from"node:fs/promises";import{Text as Ne}from"@earendil-works/pi-tui";import{Type as R}from"typebox";var Oe=R.Object({pattern:R.String({minLength:1,description:"Glob (*, **, ?, [abc], {a,b}) or plain text matched as a case-insensitive subsequence. A glob with / matches paths relative to path; one without / matches file names at any depth."}),path:R.Optional(R.String({description:"Directory to search, local or ssh://; defaults to cwd."})),include:R.Optional(R.String({description:"Include glob"})),exclude:R.Optional(R.String({description:"Exclude glob"})),limit:R.Optional(R.Integer({minimum:1,maximum:1e3,description:"Maximum files (default 100)."}))},{additionalProperties:!1});function Ae(t,s,a){t.registerTool(U({name:"file_search",label:"file_search",exposure:"direct",namespace:{name:"ide_file_search",description:"Find files by path."},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},description:"Use file_search to find file paths by glob or partial name, locally or over SSH. Pass a returned path to read or an edit tool.",promptSnippet:"Find file paths by glob or partial name",parameters:Oe,outputSchema:K,renderCall(c,o,r){return J(r.lastComponent,{tool:"file_search",primary:{text:c.pattern,color:"accent",truncate:"end"},qualifiers:[...c.path===void 0?[]:[{text:`in ${c.path}`,color:"accent",truncate:"start"}],...c.include===void 0?[]:[{text:`include ${c.include}`}],...c.exclude===void 0?[]:[{text:`exclude ${c.exclude}`}],...c.limit===void 0?[]:[{text:`limit ${String(c.limit)}`}]],expanded:r.expanded},o)},renderResult(c,o,r,e){let n=c.details;return s.renderResult!==void 0&&n?.payload!==void 0&&!e.isError&&!o.isPartial?s.renderResult({...c,details:n.payload},o,r,e):new Ne(c.content.flatMap(i=>i.type==="text"?[i.text]:[]).join(`
2
- `),0,0)},async execute(c,o,r,e,n){let i={pattern:o.pattern};return await(await a).searchWith(s,{query:o.pattern,...o.path===void 0?{}:{path:o.path},...o.include===void 0?{}:{include:o.include},...o.exclude===void 0?{}:{exclude:o.exclude},...o.limit===void 0?{}:{limit:o.limit},options:{files:i}},{cwd:n.cwd,...r!==void 0&&{signal:r},...e!==void 0&&{onUpdate:e}})}},new Q))}f(Ae,"registerFileSearchTool");var ve={protocol:te,apiVersion:re,id:"search-text",setup(t){t.addSetupCheck({id:"ripgrep",async inspect(s){let a=s.workspace?"rg":C(s.env.PI_CODING_AGENT_DIR);return await de(s,a)?{}:{actions:[{id:"ripgrep-unavailable",message:"Local search is unavailable because ripgrep was not found"}]}}}),t.addCheck({id:"ripgrep",title:"Local search",async run(s){let a=s.env.PI_CODING_AGENT_DIR,c=s.workspace?"rg":C(a),o=await le(s,c,["--version"]);return[o.ok?{status:"pass",message:"ripgrep is available",detail:o.detail}:{status:"fail",message:"ripgrep is not available",detail:o.detail}]}})}};import O from"node:path";import{pathToFileURL as De}from"node:url";async function k(t,s,a,c){if(t.include!==void 0||t.exclude!==void 0)throw new Error("Include/exclude globs are unsupported for result scopes; filter the target array instead.");let o=f(async(i,l=t.condition)=>{let g=[],h=new Set;for(let d of s.targets){c?.throwIfAborted(),await P({targets:[d],complete:s.complete},c);let u=M(d.source,d.expectedContent),p=[0];for(let m of u.lines)p.push((p.at(-1)??0)+m.content.length+m.lineEnding.length);for(let m of d.ranges){let b=(p[m.start.lineNumber-1]??u.content.length)+m.start.column,S=(p[m.end.lineNumber-1]??u.content.length)+m.end.column,w=await pe({...t,query:i,condition:l},u.content.slice(b,S),a.includes("://")?process.cwd():a,c);for(let y of w.matches){let A=m.start.lineNumber+y.lineNumber-1,v=y.endLineNumber??y.lineNumber,$=f(ke=>ke===1?m.start.column:0,"shift"),T={...y,source:d.source,lineNumber:A,startColumn:y.startColumn+$(y.lineNumber),...y.endLineNumber===void 0?{}:{endLineNumber:m.start.lineNumber+y.endLineNumber-1},endColumn:y.endColumn+$(v),lineText:u.lines[A-1]?.content??""},H=JSON.stringify([T.source,A,T.startColumn,T.endLineNumber??A,T.endColumn]);h.has(H)||(h.add(H),g.push(T))}}}return g.sort((d,u)=>d.source.localeCompare(u.source)||d.lineNumber-u.lineNumber||d.startColumn-u.startColumn||d.endColumn-u.endColumn),{matches:g,complete:s.complete}},"search"),r=t.query,e=await o(r),n=[];for(let i of t.fallbacks??[]){if(e.matches.length>0||!e.complete)break;try{e=await o(i.query,i.condition),r=i.query,n.push(i.mode==="regex"?"Search fallback: no literal matches; tried unquoted terms as regex.":"Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.")}catch(l){if(c?.aborted||i.mode!=="regex"||!(l instanceof Error)||!/regex parse error:|PCRE2: error compiling pattern/iu.test(l.message))throw l;n.push("Search fallback: invalid regex skipped; literal search found no matches.")}}return await P(s,c),{...e,query:r,notices:n}}f(k,"runScopedSearch");import{spawn as Ie}from"node:child_process";import{stat as _e}from"node:fs/promises";async function Te(t,s,a,c){let o=AbortSignal.timeout(x.timeoutMs),r=a===void 0?o:AbortSignal.any([a,o]);try{if(r.throwIfAborted(),c!==void 0&&c.byteSize===void 0)return z("source owner cannot bound candidate snapshots");let e=await Fe(t,s,r,c);if(e.limited)return z("name collection reached its byte or unique-name budget");let n=[],i=0,l=new Set;for(let g of oe(t.query,e.names)){r.throwIfAborted();let h=await N({...t,query:g.identifier},s,r,c);if(h.matches.length===0){if(!h.complete)return z("candidate verification reached its byte budget before capturing a match");continue}for(let d of h.matches)if(!l.has(d.source)&&(l.add(d.source),i+=c===void 0?(await _e(d.source)).size:await He(c,d.source,r),i>x.vocabularyBytes))return z("candidate source snapshots exceeded the byte budget");n.push({...g,...h})}return n.length===0?void 0:{status:"ready",candidates:n}}catch(e){return a?.throwIfAborted(),z(o.aborted?"extra search reached its time budget":`extra search failed: ${e instanceof Error?e.message:String(e)}`)}}f(Te,"searchFuzzy");async function N(t,s,a,c){let o=AbortSignal.timeout(x.timeoutMs),r=a===void 0?o:AbortSignal.any([a,o]),e=await ue({...t,regex:!1,caseSensitive:!0,wholeWord:!0},s,r,{matches:x.matchesPerCandidate,bytes:x.verificationBytes},c);return{...e,matches:e.matches.filter(n=>n.lineText[n.startColumn-1]!=="$"&&n.lineText[n.endColumn]!=="$")}}f(N,"searchFuzzyAlternative");async function He(t,s,a){if(t.byteSize===void 0)throw new Error("Source owner cannot bound candidate snapshots");return t.byteSize(s,a)}f(He,"ownedByteSize");function z(t){return{status:"skipped",message:t,candidates:[]}}f(z,"skipped");async function Fe(t,s,a,c){let o=await fe(t,s,c,a);if(c!==void 0){let r=new q,e=new AbortController,n=AbortSignal.any([a,e.signal]);try{let i=await c.runLines(["--only-matching","--no-filename","--case-sensitive",...o.arguments,"--","[A-Za-z_$][A-Za-z0-9_$]*",o.target],o.cwd,l=>{e.signal.aborted||(r.account(Buffer.byteLength(l)+1)&&r.add(l),r.limited&&e.abort())},n);if(!r.limited&&i.code!==0&&i.code!==1)throw new Error(i.stderr.trim()||"Ripgrep failed.")}catch(i){if(a.throwIfAborted(),!r.limited)throw i}return r}return a.throwIfAborted(),new Promise((r,e)=>{let n=Ie(C(),["--only-matching","--no-filename","--case-sensitive",...o.arguments,"--","[A-Za-z_$][A-Za-z0-9_$]*",o.target],{cwd:o.cwd,stdio:["ignore","pipe","pipe"]}),i=new q,l="",g=!1,h="",d=f(()=>{n.kill()},"abort"),u=f(()=>{a.removeEventListener("abort",d)},"cleanup");n.stdout.on("data",p=>{if(!i.account(p.length)){n.kill();return}for(let m of p)if(m===10){if(g||i.add(l),l="",g=!1,i.limited){n.kill();break}}else g||(l.length===x.identifierLength?(l="",g=!0):l+=String.fromCharCode(m))}),n.stderr.setEncoding("utf8"),n.stderr.on("data",p=>{h=(h+p).slice(0,4096)}),n.once("error",p=>{u(),e(p)}),n.once("close",p=>{if(u(),a.aborted){e(a.reason);return}if(!i.limited&&p!==0&&p!==1){e(new Error(h.trim()||`ripgrep exited with code ${String(p)}`));return}r(i)}),a.addEventListener("abort",d,{once:!0}),a.aborted&&d()})}f(Fe,"collectNames");var $e="Anchors: SEARCH#HASH:N:line (line), SEARCH#HASH:N:match (exact match), SEARCH#HASH:all:line (each unique containing line), SEARCH#HASH:all:match (every exact match)";function I(t,s=!1){return Pe("text",t,he,s)}f(I,"createTextResolver");function _(t,s=!1){return Pe("regex",t,a=>a.query.startsWith("regex:")?{...a,query:a.query.slice(6),regex:!0}:void 0,s)}f(_,"createRegexResolver");function Ce(t){let s=t.options?.files;return typeof s?.pattern=="string"?s:void 0}f(Ce,"fileOptions");function Ee(){return{id:"files",readResources:f((t,s)=>Ce(t)===void 0?[]:[t.path??s.cwd],"readResources"),toScriptData(t){let s=t;return{kind:"files",files:[...s.files],complete:s.complete}},async tryResolve(t,s){let a=Ce(t);if(a===void 0)return{kind:"not-handled"};let c=a.pattern.trim(),o=await me(c,t,s.cwd,s.signal,s.environment);return{kind:"resolved",payload:{query:c,...o}}},renderResult(t,s,a){let c=t.details;return new G({summary:`${c.files.length}${c.complete?"":"+"} ${c.files.length===1?"file":"files"}`,rows:c.files.length?c.files.map(o=>({kind:"source",label:o,link:o.startsWith("ssh://")?o:De(O.resolve(c.cwd,o)).href})):[{kind:"note",text:"No files found"}]},a,s.expanded)},format(t,s){let a=t;return{content:[{type:"text",text:[a.complete?`${String(a.files.length)} files`:`${String(a.files.length)}+ files (limit reached)`,...a.files].join(`
1
+ import{a as me}from"./chunk-OCU6NW5Y.js";import{a as ue,b as fe,c as pe,d as he,e as ge,j as Re}from"./chunk-ECSMTGVM.js";import{a as C}from"./chunk-K5M65CAF.js";import{a as we,b as xe}from"./chunk-NF74ITWT.js";import{a as ye,b as E,c as Se,d as be}from"./chunk-5D4C225L.js";import{f as Q,g as U}from"./chunk-JXULBI4S.js";import{b as le,c as de}from"./chunk-R2U5WXYR.js";import{d as x,f as ie,g as q,h as oe,i as ae,j as se}from"./chunk-HFCHOFLV.js";import{c as K,d as Y}from"./chunk-5AROEOJB.js";import{a as ee}from"./chunk-47SPPIXK.js";import{a as Z,b as X}from"./chunk-VAXLSPPU.js";import{a as ne}from"./chunk-2YO6RVX4.js";import{b as te,c as re}from"./chunk-MLFJU2US.js";import{a as G,e as J}from"./chunk-PS2B6THP.js";import{a as ce}from"./chunk-YZTVC7ME.js";import{c as B,d as V,f as W}from"./chunk-VDSSAP6Y.js";import{a as M}from"./chunk-2DSY4U73.js";import{a as D,b as L}from"./chunk-H6FEBUAP.js";import{M as P,N as F}from"./chunk-SIYPD5MM.js";import{m as j}from"./chunk-S7E2D5K7.js";import{a as f}from"./chunk-EI7MMDWY.js";import{readFile as Ve}from"node:fs/promises";import{Text as Ne}from"@earendil-works/pi-tui";import{Type as R}from"typebox";var Oe=R.Object({pattern:R.String({minLength:1,description:"Glob (*, **, ?, [abc], {a,b}) or plain text matched as a case-insensitive subsequence. A glob with / matches paths relative to path; one without / matches file names at any depth."}),path:R.Optional(R.String({description:"Directory to search, local or ssh://; defaults to cwd."})),include:R.Optional(R.String({description:"Include glob"})),exclude:R.Optional(R.String({description:"Exclude glob"})),limit:R.Optional(R.Integer({minimum:1,maximum:1e3,description:"Maximum files (default 100)."}))},{additionalProperties:!1});function Ae(t,s,a){t.registerTool(U({name:"file_search",label:"file_search",exposure:"direct",namespace:{name:"ide_file_search",description:"Find files by path."},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1},description:"Use file_search to find file paths by glob or partial name, locally or over SSH. Pass a returned path to read or an edit tool.",promptSnippet:"Find file paths by glob or partial name",parameters:Oe,outputSchema:K,renderCall(c,o,r){return J(r.lastComponent,{tool:"file_search",primary:{text:c.pattern,color:"accent",truncate:"end"},qualifiers:[...c.path===void 0?[]:[{text:`in ${c.path}`,color:"accent",truncate:"start"}],...c.include===void 0?[]:[{text:`include ${c.include}`}],...c.exclude===void 0?[]:[{text:`exclude ${c.exclude}`}],...c.limit===void 0?[]:[{text:`limit ${String(c.limit)}`}]],expanded:r.expanded},o)},renderResult(c,o,r,e){let n=c.details;return s.renderResult!==void 0&&n?.payload!==void 0&&!e.isError&&!o.isPartial?s.renderResult({...c,details:n.payload},o,r,e):new Ne(c.content.flatMap(i=>i.type==="text"?[i.text]:[]).join(`
2
+ `),0,0)},async execute(c,o,r,e,n){let i={pattern:o.pattern};return await(await a).searchWith(s,{query:o.pattern,...o.path===void 0?{}:{path:o.path},...o.include===void 0?{}:{include:o.include},...o.exclude===void 0?{}:{exclude:o.exclude},...o.limit===void 0?{}:{limit:o.limit},options:{files:i}},{cwd:n.cwd,...r!==void 0&&{signal:r},...e!==void 0&&{onUpdate:e}})}},new Q))}f(Ae,"registerFileSearchTool");var ve={protocol:te,apiVersion:re,id:"search-text",setup(t){t.addSetupCheck({id:"ripgrep",async inspect(s){let a=s.workspace?"rg":C(s.env.PI_CODING_AGENT_DIR);return await de(s,a)?{}:{actions:[{id:"ripgrep-unavailable",message:"Local search is unavailable because ripgrep was not found"}]}}}),t.addCheck({id:"ripgrep",title:"Local search",async run(s){let a=s.env.PI_CODING_AGENT_DIR,c=s.workspace?"rg":C(a),o=await le(s,c,["--version"]);return[o.ok?{status:"pass",message:"ripgrep is available",detail:o.detail}:{status:"fail",message:"ripgrep is not available",detail:o.detail}]}})}};import O from"node:path";import{pathToFileURL as De}from"node:url";async function k(t,s,a,c){if(t.include!==void 0||t.exclude!==void 0)throw new Error("Include/exclude globs are unsupported for result scopes; filter the target array instead.");let o=f(async(i,l=t.condition)=>{let g=[],h=new Set;for(let d of s.targets){c?.throwIfAborted(),await P({targets:[d],complete:s.complete},c);let u=j(d.source,d.expectedContent),p=[0];for(let m of u.lines)p.push((p.at(-1)??0)+m.content.length+m.lineEnding.length);for(let m of d.ranges){let b=(p[m.start.lineNumber-1]??u.content.length)+m.start.column,S=(p[m.end.lineNumber-1]??u.content.length)+m.end.column,w=await pe({...t,query:i,condition:l},u.content.slice(b,S),a.includes("://")?process.cwd():a,c);for(let y of w.matches){let A=m.start.lineNumber+y.lineNumber-1,v=y.endLineNumber??y.lineNumber,$=f(ke=>ke===1?m.start.column:0,"shift"),T={...y,source:d.source,lineNumber:A,startColumn:y.startColumn+$(y.lineNumber),...y.endLineNumber===void 0?{}:{endLineNumber:m.start.lineNumber+y.endLineNumber-1},endColumn:y.endColumn+$(v),lineText:u.lines[A-1]?.content??""},H=JSON.stringify([T.source,A,T.startColumn,T.endLineNumber??A,T.endColumn]);h.has(H)||(h.add(H),g.push(T))}}}return g.sort((d,u)=>d.source.localeCompare(u.source)||d.lineNumber-u.lineNumber||d.startColumn-u.startColumn||d.endColumn-u.endColumn),{matches:g,complete:s.complete}},"search"),r=t.query,e=await o(r),n=[];for(let i of t.fallbacks??[]){if(e.matches.length>0||!e.complete)break;try{e=await o(i.query,i.condition),r=i.query,n.push(i.mode==="regex"?"Search fallback: no literal matches; tried unquoted terms as regex.":"Search fallback: no matches in earlier modes; tried separate words. Use these matches as location hints; refine the query before editing.")}catch(l){if(c?.aborted||i.mode!=="regex"||!(l instanceof Error)||!/regex parse error:|PCRE2: error compiling pattern/iu.test(l.message))throw l;n.push("Search fallback: invalid regex skipped; literal search found no matches.")}}return await P(s,c),{...e,query:r,notices:n}}f(k,"runScopedSearch");import{spawn as Ie}from"node:child_process";import{stat as _e}from"node:fs/promises";async function Te(t,s,a,c){let o=AbortSignal.timeout(x.timeoutMs),r=a===void 0?o:AbortSignal.any([a,o]);try{if(r.throwIfAborted(),c!==void 0&&c.byteSize===void 0)return z("source owner cannot bound candidate snapshots");let e=await Fe(t,s,r,c);if(e.limited)return z("name collection reached its byte or unique-name budget");let n=[],i=0,l=new Set;for(let g of oe(t.query,e.names)){r.throwIfAborted();let h=await N({...t,query:g.identifier},s,r,c);if(h.matches.length===0){if(!h.complete)return z("candidate verification reached its byte budget before capturing a match");continue}for(let d of h.matches)if(!l.has(d.source)&&(l.add(d.source),i+=c===void 0?(await _e(d.source)).size:await He(c,d.source,r),i>x.vocabularyBytes))return z("candidate source snapshots exceeded the byte budget");n.push({...g,...h})}return n.length===0?void 0:{status:"ready",candidates:n}}catch(e){return a?.throwIfAborted(),z(o.aborted?"extra search reached its time budget":`extra search failed: ${e instanceof Error?e.message:String(e)}`)}}f(Te,"searchFuzzy");async function N(t,s,a,c){let o=AbortSignal.timeout(x.timeoutMs),r=a===void 0?o:AbortSignal.any([a,o]),e=await ue({...t,regex:!1,caseSensitive:!0,wholeWord:!0},s,r,{matches:x.matchesPerCandidate,bytes:x.verificationBytes},c);return{...e,matches:e.matches.filter(n=>n.lineText[n.startColumn-1]!=="$"&&n.lineText[n.endColumn]!=="$")}}f(N,"searchFuzzyAlternative");async function He(t,s,a){if(t.byteSize===void 0)throw new Error("Source owner cannot bound candidate snapshots");return t.byteSize(s,a)}f(He,"ownedByteSize");function z(t){return{status:"skipped",message:t,candidates:[]}}f(z,"skipped");async function Fe(t,s,a,c){let o=await fe(t,s,c,a);if(c!==void 0){let r=new q,e=new AbortController,n=AbortSignal.any([a,e.signal]);try{let i=await c.runLines(["--only-matching","--no-filename","--case-sensitive",...o.arguments,"--","[A-Za-z_$][A-Za-z0-9_$]*",o.target],o.cwd,l=>{e.signal.aborted||(r.account(Buffer.byteLength(l)+1)&&r.add(l),r.limited&&e.abort())},n);if(!r.limited&&i.code!==0&&i.code!==1)throw new Error(i.stderr.trim()||"Ripgrep failed.")}catch(i){if(a.throwIfAborted(),!r.limited)throw i}return r}return a.throwIfAborted(),new Promise((r,e)=>{let n=Ie(C(),["--only-matching","--no-filename","--case-sensitive",...o.arguments,"--","[A-Za-z_$][A-Za-z0-9_$]*",o.target],{cwd:o.cwd,stdio:["ignore","pipe","pipe"]}),i=new q,l="",g=!1,h="",d=f(()=>{n.kill()},"abort"),u=f(()=>{a.removeEventListener("abort",d)},"cleanup");n.stdout.on("data",p=>{if(!i.account(p.length)){n.kill();return}for(let m of p)if(m===10){if(g||i.add(l),l="",g=!1,i.limited){n.kill();break}}else g||(l.length===x.identifierLength?(l="",g=!0):l+=String.fromCharCode(m))}),n.stderr.setEncoding("utf8"),n.stderr.on("data",p=>{h=(h+p).slice(0,4096)}),n.once("error",p=>{u(),e(p)}),n.once("close",p=>{if(u(),a.aborted){e(a.reason);return}if(!i.limited&&p!==0&&p!==1){e(new Error(h.trim()||`ripgrep exited with code ${String(p)}`));return}r(i)}),a.addEventListener("abort",d,{once:!0}),a.aborted&&d()})}f(Fe,"collectNames");var $e="Anchors: SEARCH#HASH:N:line (line), SEARCH#HASH:N:match (exact match), SEARCH#HASH:all:line (each unique containing line), SEARCH#HASH:all:match (every exact match)";function I(t,s=!1){return Pe("text",t,he,s)}f(I,"createTextResolver");function _(t,s=!1){return Pe("regex",t,a=>a.query.startsWith("regex:")?{...a,query:a.query.slice(6),regex:!0}:void 0,s)}f(_,"createRegexResolver");function Ce(t){let s=t.options?.files;return typeof s?.pattern=="string"?s:void 0}f(Ce,"fileOptions");function Ee(){return{id:"files",readResources:f((t,s)=>Ce(t)===void 0?[]:[t.path??s.cwd],"readResources"),toScriptData(t){let s=t;return{kind:"files",files:[...s.files],complete:s.complete}},async tryResolve(t,s){let a=Ce(t);if(a===void 0)return{kind:"not-handled"};let c=a.pattern.trim(),o=await me(c,t,s.cwd,s.signal,s.environment);return{kind:"resolved",payload:{query:c,...o}}},renderResult(t,s,a){let c=t.details;return new G({summary:`${c.files.length}${c.complete?"":"+"} ${c.files.length===1?"file":"files"}`,rows:c.files.length?c.files.map(o=>({kind:"source",label:o,link:o.startsWith("ssh://")?o:De(O.resolve(c.cwd,o)).href})):[{kind:"note",text:"No files found"}]},a,s.expanded)},format(t,s){let a=t;return{content:[{type:"text",text:[a.complete?`${String(a.files.length)} files`:`${String(a.files.length)}+ files (limit reached)`,...a.files].join(`
3
3
  `)}],details:{query:a.query,files:a.files,complete:a.complete,cwd:s.cwd}}}}}f(Ee,"createFileResolver");function Pe(t,s,a,c=!1){return{readResources:f((o,r)=>a(o)===void 0||c&&r.scope===void 0?[]:r.scope?.targets.map(e=>e.source)??[o.path??r.cwd],"readResources"),id:t,supportsResultScope:!0,supportsMultiline:!0,toScriptData(o,r){let e=o,n=r,i=n.sessionId;return{...Y(e.matches,e.complete,i,n),notices:[...e.notices],...n.fuzzy===void 0?{}:{fuzzy:n.fuzzy}}},async tryResolve(o,r){if(c&&r.scope===void 0)return{kind:"not-handled"};let e=a(o);if(e===void 0)return{kind:"not-handled"};let n=r.scope===void 0?await ge(e,r.cwd,r.signal,r.environment):await k(e,r.scope,r.cwd,r.signal),i=r.scope===void 0&&t==="text"&&o.multiline!==!0&&n.complete&&n.matches.length===0&&ie(o.query)?await Te({...o,query:o.query},r.cwd,r.signal,r.environment):void 0;return{kind:"resolved",payload:{request:{...o,query:n.query},...n,recipe:{...e,originalQuery:o.query},...i===void 0?{}:{fuzzy:i}}}},async format(o,r){let e=o,n=r.scope,i=await s.registerIfCurrent(e.request.query,e.matches,e.complete,r.cwd,r.signal,e.recipe,n===void 0?void 0:h=>k(e.recipe,n,r.cwd,h),void 0,r.environment);if(e.fuzzy!==void 0){let h=E(e.request.query,[],e.complete,r.cwd),d=[],u=!1,p=AbortSignal.timeout(x.timeoutMs),m=r.signal===void 0?p:AbortSignal.any([r.signal,p]);for(let y of e.fuzzy.candidates){let A={...e.request,query:y.identifier,regex:!1,caseSensitive:!0,wholeWord:!0},v;try{v=await s.registerIfCurrent(y.identifier,y.matches,y.complete,r.cwd,m,A,$=>N(A,r.cwd,$,r.environment),x.vocabularyBytes,r.environment)}catch{r.signal?.throwIfAborted()}v===void 0&&(u=!0),d.push(ae(y,v?.id,v))}let b=u?"Some candidate files changed or could not be registered; locations are shown without stable references.":e.fuzzy.message,S={status:e.fuzzy.status,...b===void 0?{}:{message:b},candidates:d},w=[...e.notices,"No matches found."];return d.some(y=>y.selection.matches[0]?.references!==void 0)&&w.push($e),S.status==="ready"&&S.message!==void 0&&w.push(S.message),S.status==="skipped"&&w.push(`Possible-name fallback skipped: ${S.message}`),d.length>0&&w.push("Possible names \u2014 spelling suggestions, not equivalent behavior.",...d.map(se)),{content:[{type:"text",text:w.join(`
4
4
 
5
5
  `)}],details:{...h,...i?.target===void 0?{}:{target:i.target,matchTargets:[]},fuzzyPresentation:Se(e.fuzzy.candidates,r.cwd),fuzzy:S}}}let l=e.request.limit??50;if(e.matches.length===0)return{content:[{type:"text",text:[...e.notices,"No matches found."].join(`
6
6
  `)}],details:{...E(e.request.query,[],e.complete,r.cwd),...i?.target===void 0?{}:{target:i.target,matchTargets:[]}}};let g=i??{query:e.request.query,matches:e.matches,complete:e.complete};return{content:[{type:"text",text:[...e.notices,Le(g,r.cwd,l,i!==void 0)].join(`
7
- `)}],details:{...E(g.query,g.matches,g.complete,r.cwd,i?.id,l),...i?.target===void 0?{}:{target:i.target,matchTargets:i.matchTargets}}}},renderResult:xe}}f(Pe,"createMatchResolver");function Le(t,s,a,c=!0){let o=new Set(t.matches.map(d=>d.source)).size,r=t.matches.length,e=`${String(r)}${t.complete?"":"+"} ${ze(r,"match","matches")} in ${String(o)} ${ze(o,"file","files")}`,n=c?t.complete?`SEARCH#${t.id}:all:line / SEARCH#${t.id}:all:match \u2014 ${e}`:`${e} (incomplete results; no all anchors were registered)`:`${e} (files changed during search; results shown without anchors)`,i=c?[$e,n]:[n],l=new Map(t.matches.map((d,u)=>[d,u+1])),g=ye(t.matches,a);for(let[d,u]of g.files.entries()){d>0&&i.push("");let p=Be(u.source,s);if(u.kind==="compacted"){i.push(`${p}: ${String(u.matchCount)} matches across ${String(u.uniqueLineCount)} unique line texts (compacted)`);for(let m of u.groups){let b=l.get(m.first),S=m.first;i.push(c&&b!==void 0?` \xD7${String(m.matchCount)} first at ${p}:${String(S.lineNumber)} SEARCH#${t.id}:${String(b)}:line SEARCH#${t.id}:${String(b)}:match`:` \xD7${String(m.matchCount)} first at ${p}:${String(S.lineNumber)}`,` ${Me(m.text)}`)}u.groups.length<u.uniqueLineCount&&i.push(` \u2026 ${String(u.uniqueLineCount-u.groups.length)} more unique line texts`),i.push(` Search again with path: ${JSON.stringify(p)} and a narrower query to see individual matches.`);continue}for(let m of u.matches){let b=l.get(m);if(b===void 0)continue;let S=m.endLineNumber===void 0?String(m.endColumn+1):`${String(m.endLineNumber)}:${String(m.endColumn+1)}`,w=`${p}:${String(m.lineNumber)}:${String(m.startColumn+1)}-${S}`;i.push(c?`${w} SEARCH#${t.id}:${String(b)}:line SEARCH#${t.id}:${String(b)}:match`:w,` ${je(m)}`)}}let h=o-g.files.length;if(h>0){let d=g.files.reduce((u,p)=>u+(p.kind==="detailed"?p.matches.length:p.matchCount),0);i.push(`
7
+ `)}],details:{...E(g.query,g.matches,g.complete,r.cwd,i?.id,l),...i?.target===void 0?{}:{target:i.target,matchTargets:i.matchTargets}}}},renderResult:xe}}f(Pe,"createMatchResolver");function Le(t,s,a,c=!0){let o=new Set(t.matches.map(d=>d.source)).size,r=t.matches.length,e=`${String(r)}${t.complete?"":"+"} ${ze(r,"match","matches")} in ${String(o)} ${ze(o,"file","files")}`,n=c?t.complete?`SEARCH#${t.id}:all:line / SEARCH#${t.id}:all:match \u2014 ${e}`:`${e} (incomplete results; no all anchors were registered)`:`${e} (files changed during search; results shown without anchors)`,i=c?[$e,n]:[n],l=new Map(t.matches.map((d,u)=>[d,u+1])),g=ye(t.matches,a);for(let[d,u]of g.files.entries()){d>0&&i.push("");let p=Be(u.source,s);if(u.kind==="compacted"){i.push(`${p}: ${String(u.matchCount)} matches across ${String(u.uniqueLineCount)} unique line texts (compacted)`);for(let m of u.groups){let b=l.get(m.first),S=m.first;i.push(c&&b!==void 0?` \xD7${String(m.matchCount)} first at ${p}:${String(S.lineNumber)} SEARCH#${t.id}:${String(b)}:line SEARCH#${t.id}:${String(b)}:match`:` \xD7${String(m.matchCount)} first at ${p}:${String(S.lineNumber)}`,` ${je(m.text)}`)}u.groups.length<u.uniqueLineCount&&i.push(` \u2026 ${String(u.uniqueLineCount-u.groups.length)} more unique line texts`),i.push(` Search again with path: ${JSON.stringify(p)} and a narrower query to see individual matches.`);continue}for(let m of u.matches){let b=l.get(m);if(b===void 0)continue;let S=m.endLineNumber===void 0?String(m.endColumn+1):`${String(m.endLineNumber)}:${String(m.endColumn+1)}`,w=`${p}:${String(m.lineNumber)}:${String(m.startColumn+1)}-${S}`;i.push(c?`${w} SEARCH#${t.id}:${String(b)}:line SEARCH#${t.id}:${String(b)}:match`:w,` ${Me(m)}`)}}let h=o-g.files.length;if(h>0){let d=g.files.reduce((u,p)=>u+(p.kind==="detailed"?p.matches.length:p.matchCount),0);i.push(`
8
8
  \u2026 ${h} more files (${r-d} matches) not displayed. Narrow path, include, or query to see them.`)}return i.join(`
9
- `)}f(Le,"formatSearchSession");function je(t){if(t.endLineNumber!==void 0){let r=Math.max(0,t.startColumn-64),e=t.matchedText.replace(/\r\n/gu,`
9
+ `)}f(Le,"formatSearchSession");function Me(t){if(t.endLineNumber!==void 0){let r=Math.max(0,t.startColumn-64),e=t.matchedText.replace(/\r\n/gu,`
10
10
  `).split(`
11
11
  `),n=e.slice(0,8),i=e.length-n.length;return`${r>0?"\u2026":""}${t.lineText.slice(r,t.startColumn)}\u27E6${n.join(`
12
12
  `)}${i>0?`
13
- \u2026 ${String(i)} more lines`:""}\u27E7`}let a=Math.max(0,t.startColumn-64),c=Math.min(t.lineText.length,t.endColumn+64);return`${a>0?"\u2026":""}${t.lineText.slice(a,t.startColumn)}\u27E6${t.lineText.slice(t.startColumn,t.endColumn)}\u27E7${t.lineText.slice(t.endColumn,c)}${c<t.lineText.length?"\u2026":""}`}f(je,"previewMatch");function Me(t){return`${t.slice(0,129)}${t.length>129?"\u2026":""}`}f(Me,"previewLine");function Be(t,s){if(t.includes("://"))return t;let a=O.relative(s,t);return a.length>0&&!a.startsWith("..")&&!O.isAbsolute(a)?a:t}f(Be,"displaySource");function ze(t,s,a){return t===1?s:a}f(ze,"plural");async function We(t){return qe(t,!0)}f(We,"registerTextSearch");async function Vt(t){return qe(t,!1)}f(Vt,"registerResourceSearchSelections");async function qe(t,s){let a,c=new Promise(e=>a=e);s&&Ae(t,Ee(),c);let o,r=new Re(void 0,F(t),async(e,n,i)=>{if(o===void 0){if(!s)throw new Error("Resource search requires its owning Read host.");if(e.includes("://"))throw new Error("No search snapshot owner for this source.");return Ve(e,{encoding:"utf8",signal:i})}let l=await o.read({path:e},{cwd:n,signal:i},"script");if(l.isError||l.script?.kind!=="text"||l.script.source!==e)throw new Error(l.details.failure?.message??"The source cannot provide an exact text snapshot.");return l.script.content});t.on("tool_result",async(e,n)=>{if(e.toolName!=="replace"||e.isError||typeof e.details!="object"||e.details===null)return;let i="metadata"in e.details?e.details.metadata:void 0,l=i&&typeof i=="object"&&"searchObservations"in i?i.searchObservations:void 0,g=Array.isArray(l)?l:await r.observeAfterEdit([e.input.path,e.input.start,e.input.end],n.signal);if(g.length!==0)return{content:[...e.content,{type:"text",text:["Original search observed after editing (not task validation):",...g.map(h=>{let{query:d,fallbacks:u,...p}=h.scope;return[`SEARCH#${h.sessionId}: ${JSON.stringify(h.query)}`,`Scope and options: ${JSON.stringify(p)}`,h.error===void 0?`Matches: ${h.matches}${h.complete===!0?"; complete search.":"+; incomplete search, lower bound only."}`:`Search failed: ${h.error}. Applied edits remain applied.`,...h.notices??[]].join(`
13
+ \u2026 ${String(i)} more lines`:""}\u27E7`}let a=Math.max(0,t.startColumn-64),c=Math.min(t.lineText.length,t.endColumn+64);return`${a>0?"\u2026":""}${t.lineText.slice(a,t.startColumn)}\u27E6${t.lineText.slice(t.startColumn,t.endColumn)}\u27E7${t.lineText.slice(t.endColumn,c)}${c<t.lineText.length?"\u2026":""}`}f(Me,"previewMatch");function je(t){return`${t.slice(0,129)}${t.length>129?"\u2026":""}`}f(je,"previewLine");function Be(t,s){if(t.includes("://"))return t;let a=O.relative(s,t);return a.length>0&&!a.startsWith("..")&&!O.isAbsolute(a)?a:t}f(Be,"displaySource");function ze(t,s,a){return t===1?s:a}f(ze,"plural");async function We(t){return qe(t,!0)}f(We,"registerTextSearch");async function Vt(t){return qe(t,!1)}f(Vt,"registerResourceSearchSelections");async function qe(t,s){let a,c=new Promise(e=>a=e);s&&Ae(t,Ee(),c);let o,r=new Re(void 0,F(t),async(e,n,i)=>{if(o===void 0){if(!s)throw new Error("Resource search requires its owning Read host.");if(e.includes("://"))throw new Error("No search snapshot owner for this source.");return Ve(e,{encoding:"utf8",signal:i})}let l=await o.read({path:e},{cwd:n,signal:i},"script");if(l.isError||l.script?.kind!=="text"||l.script.source!==e)throw new Error(l.details.failure?.message??"The source cannot provide an exact text snapshot.");return l.script.content});t.on("tool_result",async(e,n)=>{if(e.toolName!=="replace"||e.isError||typeof e.details!="object"||e.details===null)return;let i="metadata"in e.details?e.details.metadata:void 0,l=i&&typeof i=="object"&&"searchObservations"in i?i.searchObservations:void 0,g=Array.isArray(l)?l:await r.observeAfterEdit([e.input.path,e.input.start,e.input.end],n.signal);if(g.length!==0)return{content:[...e.content,{type:"text",text:["Original search observed after editing (not task validation):",...g.map(h=>{let{query:d,fallbacks:u,...p}=h.scope;return[`SEARCH#${h.sessionId}: ${JSON.stringify(h.query)}`,`Scope and options: ${JSON.stringify(p)}`,h.error===void 0?`Matches: ${h.matches}${h.complete===!0?"; complete search.":"+; incomplete search, lower bound only."}`:`Search failed: ${h.error}. Applied edits remain applied.`,...h.notices??[]].join(`
14
14
  `)})].join(`
15
15
  `)}],details:{...e.details,searchObservations:g},...e.structuredContent===void 0?{}:{structuredContent:e.structuredContent}}}),t.on("tool_result",e=>{if(e.toolName!=="search"||typeof e.details!="object"||e.details===null)return;let n=e.details;if(be(n.payload))return{details:{...n,payload:we(n.payload,e.content.flatMap(i=>i.type==="text"?[i.text]:[]).join(`
16
- `))}}}),await Promise.all([j(t,{protocol:D,apiVersion:L,id:"search-snapshots",setup(e){o=e}}),ne(t,ve),ee(t,{protocol:Z,apiVersion:X,id:"local",setup(e){e.addScopeProvider((n,i)=>r.resolveSearchScope(n,i)),e.addSelectionProvider((n,i)=>r.register(n.request.query,n.matches,n.complete,i.cwd,i.signal,{...n.request,regex:!1},n.refresh,void 0,i.environment)),s?(a(e),e.addResolver({resolver:_(r),priority:-10}),e.addResolver({resolver:I(r),fallback:!0})):(e.addResolver({resolver:_(r,!0),priority:-10}),e.addResolver({resolver:I(r,!0),fallback:!0})),s&&e.describe(["Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching.","After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.","The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.","SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.","Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections."].join(`
16
+ `))}}}),await Promise.all([M(t,{protocol:D,apiVersion:L,id:"search-snapshots",setup(e){o=e}}),ne(t,ve),ee(t,{protocol:Z,apiVersion:X,id:"local",setup(e){e.addScopeProvider((n,i)=>r.resolveSearchScope(n,i)),e.addSelectionProvider((n,i)=>r.register(n.request.query,n.matches,n.complete,i.cwd,i.signal,{...n.request,regex:!1},n.refresh,void 0,i.environment)),s?(a(e),e.addResolver({resolver:_(r),priority:-10}),e.addResolver({resolver:I(r),fallback:!0})):(e.addResolver({resolver:_(r,!0),priority:-10}),e.addResolver({resolver:I(r,!0),fallback:!0})),s&&e.describe(["Local queries try literal terms first, then unquoted terms as regex when no literal results exist, then separate words for ordinary multi-word queries. Quoted terms stay literal. Boolean conditions stay intact across fallback. Uppercase AND/OR, infix NOT, ||, and space-separated | are Boolean operators; unspaced | and regex groups/classes belong to regex terms. Parentheses containing Boolean operators group Boolean conditions. regex:<pattern> forces regex-only matching.","After a complete zero result, a single unquoted ASCII identifier may produce separate possible-name groups: naming-style changes, one leading/trailing component, then small typos. Each group reports a verified case-sensitive whole-identifier alternative in the same scope, its count/completeness, and Read references. Budget skips are explicit. A candidate all-reference refreshes that exact alternative, not the fuzzy ranking. Registered local candidate selections also expose strict snapshot targets. Result scopes stay exact and do not run this extra branch.","The result says when a query was broadened. Empty or unknown prefixes are searched as plain text. A recognized prefixed query returns its own results or error; it does not silently become a text search.","SEARCH#HASH:N:line selects one containing line; :match selects its exact match. :all:line selects all unique containing lines and :all:match selects all matches. Read returns containing lines for both forms. A SEARCH resource can be used as a read path or mutation path/anchor; omit the file path for an all-selection spanning files.","Use SEARCH references exactly as returned to select the matching content. A single-result reference becomes stale when its file changes; obtain a fresh result before using it again. An :all reference refreshes the original query when a selected file changes. Search compacts noisy files when the detail limit is exceeded; narrow the query to that file to see individual matches. Compaction does not remove complete :all selections."].join(`
17
17
  `))}}),ce(t,{protocol:B,apiVersion:V,id:"search-anchors",setup(e){e.tool("replace").addHandler({stage:"text-post-edit",async handler(n){if(!n.result||typeof n.result!="object"||!("kind"in n.result)||n.result.kind!=="completed"||!n.input||typeof n.input!="object")return n;let i=n.input,l=await r.observeAfterEdit([i.path,i.start,i.end],n.signal);return l.length===0?n:{...n,metadata:{...n.metadata,searchObservations:l}}}}),e.addAnchorResolver({resolver:r.anchorResolver(),resources:r.resourceResolver(),kind:W,type:"auxiliary",describeInPrompt:!1})}})])}f(qe,"registerSearch");export{We as a,Vt as b};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-37UNDG6V.js";import{c as s,d as l,e as c}from"./chunk-6TOFURDG.js";import{a as i}from"./chunk-ALZV2EYT.js";import{a as t}from"./chunk-EI7MMDWY.js";var o=class extends i{static{t(this,"ConstantTextAnchor")}constructor(n,r){super(n,r)}};function p(){return{id:"file-position",description:"`begin` and `end` select the first and last existing lines.",renderFull(e){return e},renderCompact(e){return e==="begin"?"file start":"file end"},tryResolve(e,n){return Promise.resolve(a(e,n))}}}t(p,"createConstantTextAnchorResolver");function a(e,n){return e!=="begin"&&e!=="end"?{kind:"not-handled"}:n.lines.length===0?{kind:"failed",error:new Error(`${e} cannot resolve in an empty file`)}:{kind:"resolved",anchor:new o(e,e==="begin"?1:n.lines.length)}}t(a,"resolveConstantAnchor");async function T(e){await d(e,{protocol:s,apiVersion:l,id:"text-anchor-constant",setup(r){r.addAnchorResolver({resolver:p(),kind:c,type:"constant"})}})}t(T,"registerConstantTextAnchors");export{T as a};
1
+ import{a as d}from"./chunk-YZTVC7ME.js";import{c as s,d as l,e as c}from"./chunk-VDSSAP6Y.js";import{a as i}from"./chunk-S7E2D5K7.js";import{a as t}from"./chunk-EI7MMDWY.js";var o=class extends i{static{t(this,"ConstantTextAnchor")}constructor(n,r){super(n,r)}};function p(){return{id:"file-position",description:"`begin` and `end` select the first and last existing lines.",renderFull(e){return e},renderCompact(e){return e==="begin"?"file start":"file end"},tryResolve(e,n){return Promise.resolve(a(e,n))}}}t(p,"createConstantTextAnchorResolver");function a(e,n){return e!=="begin"&&e!=="end"?{kind:"not-handled"}:n.lines.length===0?{kind:"failed",error:new Error(`${e} cannot resolve in an empty file`)}:{kind:"resolved",anchor:new o(e,e==="begin"?1:n.lines.length)}}t(a,"resolveConstantAnchor");async function T(e){await d(e,{protocol:s,apiVersion:l,id:"text-anchor-constant",setup(r){r.addAnchorResolver({resolver:p(),kind:c,type:"constant"})}})}t(T,"registerConstantTextAnchors");export{T as a};