pi-agent-ide 0.8.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (603) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +24 -29
  3. package/dist/{chunk-CM3XGY72.js → chunk-2AY526TN.js} +1 -1
  4. package/dist/{chunk-LEJKDYCK.js → chunk-2TZDG2JH.js} +1 -1
  5. package/dist/{chunk-XBQR74IK.js → chunk-4GBFIGH3.js} +1 -1
  6. package/dist/{chunk-PJL3UVMJ.js → chunk-4IWEKRSP.js} +1 -1
  7. package/dist/chunk-52PFWQMU.js +5 -0
  8. package/dist/chunk-5BGWNYQS.js +1 -0
  9. package/dist/{chunk-QUYXINGZ.js → chunk-5S74Z6Y4.js} +3 -3
  10. package/dist/chunk-64JTD2DJ.js +1 -0
  11. package/dist/{chunk-XAHU42FP.js → chunk-6A3ORNW3.js} +2 -2
  12. package/dist/{chunk-ANM3Y5FO.js → chunk-6WCHBHFW.js} +5 -5
  13. package/dist/{chunk-IMGIDBCC.js → chunk-7D7PXIVV.js} +1 -1
  14. package/dist/chunk-7PVDTMEM.js +1 -0
  15. package/dist/chunk-7SG756UO.js +4 -0
  16. package/dist/{chunk-GBUJOR6V.js → chunk-7URANI6I.js} +14 -14
  17. package/dist/{chunk-Z2MNHSJ4.js → chunk-AJZVKDYC.js} +1 -1
  18. package/dist/chunk-AMIIOWFL.js +1 -0
  19. package/dist/{chunk-TOYN4W4F.js → chunk-B25LXXNV.js} +1 -1
  20. package/dist/chunk-C2JT2G5K.js +1 -0
  21. package/dist/chunk-CVOYSEBE.js +1 -0
  22. package/dist/chunk-DDH3FP4G.js +3 -0
  23. package/dist/chunk-FEZLTM4L.js +1 -0
  24. package/dist/{chunk-CPELC6JE.js → chunk-FHRHYY4M.js} +1 -1
  25. package/dist/chunk-FKKAHI62.js +11 -0
  26. package/dist/chunk-FS3KCKFX.js +9 -0
  27. package/dist/chunk-FYOU4RBH.js +2 -0
  28. package/dist/chunk-G4PRFO6G.js +1 -0
  29. package/dist/chunk-GS5ZRTUG.js +1 -0
  30. package/dist/{chunk-XXLLY66B.js → chunk-GXL4NMHR.js} +1 -1
  31. package/dist/{chunk-QT3EAHOG.js → chunk-H3GEEOOL.js} +1 -1
  32. package/dist/chunk-H5Z54BEU.js +25 -0
  33. package/dist/chunk-H7WAM5RH.js +23 -0
  34. package/dist/chunk-HT7LZN5A.js +9 -0
  35. package/dist/chunk-IG5DXVDJ.js +1 -0
  36. package/dist/chunk-K4UTEMDU.js +1 -0
  37. package/dist/chunk-KFBRL2V4.js +3 -0
  38. package/dist/chunk-KN6VPARZ.js +1 -0
  39. package/dist/{chunk-RW2GTYQI.js → chunk-LF325WYO.js} +1 -1
  40. package/dist/chunk-LTADNZKW.js +2 -0
  41. package/dist/{chunk-YJ6T3PEP.js → chunk-MDD5ORB6.js} +1 -1
  42. package/dist/{chunk-S72FVLUX.js → chunk-MLFJU2US.js} +1 -1
  43. package/dist/chunk-NA2NEU4V.js +1 -0
  44. package/dist/chunk-OBTT5INC.js +6 -0
  45. package/dist/{chunk-IICJXZBU.js → chunk-OMNKD7WW.js} +3 -3
  46. package/dist/chunk-PLMHBXWI.js +10 -0
  47. package/dist/{chunk-235QMMVA.js → chunk-PQWANILR.js} +1 -1
  48. package/dist/{chunk-QRJLIV6P.js → chunk-QJ6V5IAY.js} +6 -6
  49. package/dist/chunk-QM5WDEFI.js +1 -0
  50. package/dist/{chunk-SMIFCAAX.js → chunk-RIJRPAL2.js} +1 -1
  51. package/dist/chunk-RIOPUTUJ.js +6 -0
  52. package/dist/chunk-RVFMH77U.js +82 -0
  53. package/dist/{chunk-NJ7C4KMA.js → chunk-SRFWT562.js} +1 -1
  54. package/dist/{chunk-U22JNO6N.js → chunk-STUZZM5B.js} +1 -1
  55. package/dist/{chunk-PT35ZFLH.js → chunk-TNAUCNUT.js} +12 -12
  56. package/dist/{chunk-DUUOCBS3.js → chunk-TVH2ND35.js} +1 -1
  57. package/dist/chunk-TVSZYABY.js +5 -0
  58. package/dist/chunk-TVXZE4KW.js +4 -0
  59. package/dist/chunk-U7YDLVFL.js +1 -0
  60. package/dist/{chunk-KZC7TI5M.js → chunk-UD3DMY3Q.js} +1 -1
  61. package/dist/{chunk-VXP5BMW7.js → chunk-USG6WHAT.js} +1 -1
  62. package/dist/{chunk-RMI3NMQY.js → chunk-V4J3TLCV.js} +2 -2
  63. package/dist/{chunk-ZPT5D4VP.js → chunk-VDJSH3DQ.js} +2 -2
  64. package/dist/{chunk-VMTOFEXF.js → chunk-VMLPXSMK.js} +1 -1
  65. package/dist/{chunk-6T7PSDQW.js → chunk-VN3XBH2Q.js} +1 -1
  66. package/dist/chunk-WAJW4G4F.js +22 -0
  67. package/dist/chunk-WEE3NM6L.js +1 -0
  68. package/dist/{chunk-IM24DB3K.js → chunk-WES2E4VR.js} +1 -1
  69. package/dist/{chunk-RIJMXO43.js → chunk-WQIMM4SU.js} +1 -1
  70. package/dist/chunk-WUO3UW4J.js +17 -0
  71. package/dist/chunk-XE4W5YTE.js +2 -0
  72. package/dist/chunk-XUYIK4TX.js +1 -0
  73. package/dist/{chunk-ZJQRLVVV.js → chunk-Y74EKJOY.js} +1 -1
  74. package/dist/{chunk-AAC77UD4.js → chunk-YPYROPQF.js} +1 -1
  75. package/dist/chunk-ZXO4D5UB.js +1 -0
  76. package/dist/entry-0.js +1 -1
  77. package/dist/entry-1.js +1 -1
  78. package/dist/entry-10.js +1 -1
  79. package/dist/entry-11.js +1 -1
  80. package/dist/entry-12.js +1 -1
  81. package/dist/entry-13.js +1 -1
  82. package/dist/entry-14.js +1 -1
  83. package/dist/entry-15.js +1 -1
  84. package/dist/entry-16.js +1 -1
  85. package/dist/entry-17.js +1 -1
  86. package/dist/entry-18.js +1 -1
  87. package/dist/entry-19.js +1 -1
  88. package/dist/entry-2.js +1 -1
  89. package/dist/entry-20.js +1 -1
  90. package/dist/entry-21.js +1 -0
  91. package/dist/entry-23.js +1 -1
  92. package/dist/entry-24.js +1 -1
  93. package/dist/entry-25.js +1 -1
  94. package/dist/entry-26.js +1 -1
  95. package/dist/entry-27.js +1 -1
  96. package/dist/entry-28.js +1 -1
  97. package/dist/entry-29.js +1 -2
  98. package/dist/entry-3.js +1 -1
  99. package/dist/entry-30.js +2 -1
  100. package/dist/entry-31.js +1 -4
  101. package/dist/entry-32.js +1 -1
  102. package/dist/entry-33.js +1 -1
  103. package/dist/entry-34.js +1 -1
  104. package/dist/entry-35.js +1 -18
  105. package/dist/entry-36.js +1 -1
  106. package/dist/entry-37.js +15 -1
  107. package/dist/entry-38.js +1 -1
  108. package/dist/entry-39.js +1 -1
  109. package/dist/entry-4.js +1 -1
  110. package/dist/entry-40.js +1 -1
  111. package/dist/entry-41.js +1 -1
  112. package/dist/entry-42.js +1 -1
  113. package/dist/entry-43.js +1 -1
  114. package/dist/entry-44.js +1 -1
  115. package/dist/entry-45.js +1 -1
  116. package/dist/entry-46.js +1 -1
  117. package/dist/entry-47.js +1 -1
  118. package/dist/entry-48.js +1 -1
  119. package/dist/entry-49.js +1 -25
  120. package/dist/entry-5.js +1 -1
  121. package/dist/entry-50.js +1 -1
  122. package/dist/entry-51.js +1 -1
  123. package/dist/entry-52.js +1 -1
  124. package/dist/entry-53.js +1 -1
  125. package/dist/entry-54.js +1 -3
  126. package/dist/entry-55.js +1 -13
  127. package/dist/entry-56.js +1 -1
  128. package/dist/entry-57.js +1 -1
  129. package/dist/entry-58.js +1 -1
  130. package/dist/entry-59.js +1 -1
  131. package/dist/entry-6.js +1 -1
  132. package/dist/entry-60.js +1 -1
  133. package/dist/entry-61.js +1 -1
  134. package/dist/entry-62.js +1 -1
  135. package/dist/entry-63.js +1 -1
  136. package/dist/entry-64.js +1 -1
  137. package/dist/entry-65.js +1 -0
  138. package/dist/entry-66.js +1 -1
  139. package/dist/entry-68.js +1 -1
  140. package/dist/entry-69.js +0 -1
  141. package/dist/entry-7.js +1 -1
  142. package/dist/entry-70.js +1 -1
  143. package/dist/entry-71.js +1 -1
  144. package/dist/entry-72.js +1 -1
  145. package/dist/entry-73.js +1 -1
  146. package/dist/entry-74.js +1 -1
  147. package/dist/entry-75.js +1 -0
  148. package/dist/entry-76.js +1 -1
  149. package/dist/entry-78.js +1 -1
  150. package/dist/entry-79.js +0 -1
  151. package/dist/entry-8.js +1 -1
  152. package/dist/entry-80.js +1 -1
  153. package/dist/entry-81.js +1 -80
  154. package/dist/entry-82.js +1 -22
  155. package/dist/entry-83.js +1 -2
  156. package/dist/entry-84.js +1 -1
  157. package/dist/entry-85.js +2 -1
  158. package/dist/entry-86.js +1 -1
  159. package/dist/entry-87.js +1 -1
  160. package/dist/entry-88.js +1 -3
  161. package/dist/entry-89.js +1 -1
  162. package/dist/entry-9.js +1 -1
  163. package/dist/entry-90.js +3 -1
  164. package/dist/entry-91.js +1 -1
  165. package/dist/entry-92.js +1 -0
  166. package/dist/entry-93.js +1 -0
  167. package/dist/pi-agent-ide.js +10 -34
  168. package/docs/agent-guides/ast-search.md +58 -0
  169. package/docs/agent-guides/debugger.md +1 -1
  170. package/docs/agent-guides/editing.md +26 -58
  171. package/docs/agent-guides/git-changes.md +4 -14
  172. package/docs/agent-guides/search.md +38 -0
  173. package/docs/agent-guides/ssh.md +17 -49
  174. package/docs/agent-guides/terminal.md +9 -15
  175. package/docs/configuration.md +9 -13
  176. package/docs/extensions.md +82 -0
  177. package/docs/settings-help.md +2 -2
  178. package/docs/structured-results.md +33 -11
  179. package/docs/tools.md +23 -22
  180. package/node_modules/pi-agent-doctor/package.json +7 -7
  181. package/node_modules/pi-agent-doctor/src/workspace.ts +0 -5
  182. package/node_modules/pi-agent-documentation/package.json +2 -2
  183. package/node_modules/pi-agent-documentation/runtime/entry-29.js +1 -0
  184. package/node_modules/pi-agent-documentation/src/index.ts +26 -10
  185. package/node_modules/pi-agent-filesystem/index.ts +1 -1
  186. package/node_modules/pi-agent-filesystem/package.json +8 -8
  187. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  188. package/node_modules/pi-agent-filesystem-jq/index.ts +9 -63
  189. package/node_modules/pi-agent-filesystem-jq/package.json +12 -6
  190. package/node_modules/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  191. package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  192. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  193. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  194. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  195. package/node_modules/pi-agent-ide-ast/package.json +15 -15
  196. package/node_modules/pi-agent-ide-ast/src/extension.ts +8 -8
  197. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  198. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  199. package/node_modules/pi-agent-ide-changes/index.ts +1 -2
  200. package/node_modules/pi-agent-ide-changes/package.json +10 -10
  201. package/node_modules/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  202. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  203. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  204. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  205. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  206. package/node_modules/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  207. package/node_modules/pi-agent-ide-lsp/index.ts +22 -28
  208. package/node_modules/pi-agent-ide-lsp/package.json +14 -10
  209. package/node_modules/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  210. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  211. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  212. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  213. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  214. package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  215. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  216. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  217. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  218. package/node_modules/pi-agent-image/package.json +3 -3
  219. package/node_modules/pi-agent-image/src/image-converter.ts +24 -1
  220. package/node_modules/pi-agent-invariant/package.json +2 -2
  221. package/node_modules/pi-agent-pdf/package.json +3 -3
  222. package/node_modules/pi-agent-pdf/src/pdf-converter.ts +23 -1
  223. package/node_modules/pi-agent-read/package.json +12 -12
  224. package/node_modules/pi-agent-read/runtime/entry-49.js +0 -1
  225. package/node_modules/pi-agent-read/runtime/entry-51.js +2 -0
  226. package/node_modules/pi-agent-read/src/api/read-parameters.ts +4 -7
  227. package/node_modules/pi-agent-read/src/api/tools/read.ts +2 -0
  228. package/node_modules/pi-agent-read/src/core/extension.ts +0 -8
  229. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  230. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  231. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  232. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  233. package/node_modules/pi-agent-resource/package.json +2 -2
  234. package/node_modules/pi-agent-resource/src/index.ts +8 -0
  235. package/node_modules/pi-agent-resource/src/resource-error-metadata.ts +89 -0
  236. package/node_modules/pi-agent-resource/src/resource-error.ts +6 -1
  237. package/node_modules/pi-agent-resource/src/result-images.ts +87 -0
  238. package/node_modules/pi-agent-resource/src/result-targets.ts +9 -3
  239. package/node_modules/pi-agent-resource/src/tool-result.ts +17 -0
  240. package/node_modules/pi-agent-search/package.json +9 -9
  241. package/node_modules/pi-agent-search/runtime/entry-54.js +0 -1
  242. package/node_modules/pi-agent-search/runtime/entry-55.js +1 -0
  243. package/node_modules/pi-agent-search/runtime/entry-56.js +2 -0
  244. package/node_modules/pi-agent-search/src/api/glob-list.ts +35 -0
  245. package/node_modules/pi-agent-search/src/api/search-parameters.ts +8 -8
  246. package/node_modules/pi-agent-search/src/api/search.ts +14 -2
  247. package/node_modules/pi-agent-search/src/core/extension.ts +11 -20
  248. package/node_modules/pi-agent-search/src/core/search-core.ts +30 -10
  249. package/node_modules/pi-agent-search-text/index.ts +34 -12
  250. package/node_modules/pi-agent-search-text/package.json +17 -15
  251. package/node_modules/pi-agent-search-text/runtime/entry-57.js +1 -0
  252. package/node_modules/pi-agent-search-text/runtime/entry-60.js +1 -0
  253. package/node_modules/pi-agent-search-text/src/file-search.ts +59 -25
  254. package/node_modules/pi-agent-search-text/src/resolvers.ts +61 -16
  255. package/node_modules/pi-agent-search-text/src/scoped-search.ts +9 -3
  256. package/node_modules/pi-agent-search-text/src/search-backend.ts +44 -48
  257. package/node_modules/pi-agent-search-text/src/search-presentation.ts +19 -15
  258. package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -1
  259. package/node_modules/pi-agent-search-text/src/search-result.ts +6 -2
  260. package/node_modules/pi-agent-search-text/src/search-session.ts +1 -0
  261. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +146 -0
  262. package/node_modules/pi-agent-text/package.json +3 -3
  263. package/node_modules/pi-agent-text/src/text-converter.ts +1 -1
  264. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  265. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  266. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  267. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +1 -2
  268. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  269. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  270. package/node_modules/pi-agent-text-editor/package.json +26 -26
  271. package/node_modules/pi-agent-text-editor/runtime/entry-81.js +0 -1
  272. package/node_modules/pi-agent-text-editor/runtime/entry-82.js +1 -0
  273. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  274. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  275. package/node_modules/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  276. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  277. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  278. package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -7
  279. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  280. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +111 -0
  281. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  282. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  283. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  284. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  285. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  286. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  287. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  288. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  289. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  290. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  291. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  292. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  293. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  294. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  295. package/node_modules/pi-agent-text-editor-renderer/index.ts +6 -1
  296. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  297. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  298. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  299. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +6 -6
  300. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  301. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  302. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  303. package/node_modules/pi-agent-tool-ui/runtime/entry-87.js +1 -0
  304. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +1 -0
  305. package/node_modules/pi-agent-web/index.ts +28 -6
  306. package/node_modules/pi-agent-web/package.json +8 -8
  307. package/node_modules/pi-agent-web-html/package.json +3 -3
  308. package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
  309. package/node_modules/pi-agent-web-image/package.json +4 -4
  310. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  311. package/node_modules/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  312. package/node_modules/pi-agent-web-text/package.json +4 -4
  313. package/node_modules/pi-agent-web-text/runtime/entry-93.js +2 -0
  314. package/package.json +61 -58
  315. package/src/api/approval.ts +2 -0
  316. package/src/api/read.ts +2 -0
  317. package/src/api/standalone.ts +7 -0
  318. package/src/backend/doctor-workspace.ts +0 -3
  319. package/src/backend/process-metadata-worker.py +9 -18
  320. package/src/backend/process-metadata.ts +11 -44
  321. package/src/backend/registration.ts +0 -10
  322. package/src/backend/web-browser-worker.mjs +2 -17
  323. package/src/backend/web-browser.ts +1 -26
  324. package/src/composite/builtin-extensions.ts +8 -6
  325. package/src/composite/ide-alias-rendering.ts +18 -2
  326. package/src/composite/module-labels.ts +0 -4
  327. package/src/composite/preferences.ts +0 -36
  328. package/src/composite/settings-documentation.ts +1 -2
  329. package/src/composite/text-results.ts +61 -23
  330. package/src/documentation/extension.ts +39 -15
  331. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +1 -1
  332. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  333. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  334. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +9 -63
  335. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +12 -6
  336. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-32.js +1 -0
  337. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +112 -0
  338. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  339. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-34.js +2 -0
  340. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  341. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-35.js +2 -0
  342. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-30.js +2 -0
  343. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -6
  344. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  345. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  346. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
  347. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  348. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  349. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-92.js +2 -0
  350. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  351. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-93.js +2 -0
  352. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-89.js +2 -0
  353. package/src/extensions/pi-agent-read/package.json +12 -12
  354. package/src/extensions/pi-agent-read/runtime/entry-49.js +0 -1
  355. package/src/extensions/pi-agent-read/runtime/entry-50.js +1 -0
  356. package/src/extensions/pi-agent-read/runtime/entry-51.js +2 -0
  357. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +4 -7
  358. package/src/extensions/pi-agent-read/src/api/tools/read.ts +2 -0
  359. package/src/extensions/pi-agent-read/src/core/extension.ts +0 -8
  360. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +47 -14
  361. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +3 -1
  362. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +14 -2
  363. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +21 -8
  364. package/src/extensions/pi-agent-search/package.json +9 -9
  365. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +34 -12
  366. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +17 -15
  367. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-57.js +1 -0
  368. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  369. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-60.js +1 -0
  370. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +59 -25
  371. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +61 -16
  372. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +9 -3
  373. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +44 -48
  374. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +19 -15
  375. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -1
  376. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +6 -2
  377. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +1 -0
  378. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +146 -0
  379. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  380. package/src/extensions/pi-agent-search/runtime/entry-55.js +1 -0
  381. package/src/extensions/pi-agent-search/runtime/entry-56.js +2 -0
  382. package/src/extensions/pi-agent-search/src/api/glob-list.ts +35 -0
  383. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +8 -8
  384. package/src/extensions/pi-agent-search/src/api/search.ts +14 -2
  385. package/src/extensions/pi-agent-search/src/core/extension.ts +11 -20
  386. package/src/extensions/pi-agent-search/src/core/search-core.ts +30 -10
  387. package/src/extensions/pi-agent-text-editor/package.json +26 -26
  388. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  389. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  390. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +6 -1
  391. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +1 -2
  392. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  393. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-65.js +1 -0
  394. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +2 -0
  395. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +6 -1
  396. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  397. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-84.js +2 -0
  398. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +18 -5
  399. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +6 -6
  400. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-85.js +2 -0
  401. package/src/extensions/pi-agent-text-editor/runtime/entry-81.js +0 -1
  402. package/src/extensions/pi-agent-text-editor/runtime/entry-82.js +1 -0
  403. package/src/extensions/pi-agent-text-editor/runtime/entry-83.js +2 -0
  404. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -0
  405. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +23 -0
  406. package/src/extensions/pi-agent-text-editor/src/api/text-selection-anchor.ts +31 -1
  407. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +11 -21
  408. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +5 -5
  409. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -7
  410. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +22 -4
  411. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +111 -0
  412. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +3 -0
  413. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +5 -1
  414. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +8 -2
  415. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +103 -20
  416. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +146 -62
  417. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +14 -19
  418. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +43 -12
  419. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +5 -5
  420. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +6 -5
  421. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +3 -7
  422. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +6 -8
  423. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +9 -6
  424. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  425. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +37 -22
  426. package/src/pi-agent-ide.ts +8 -15
  427. package/src/plugins/pi-agent-ide-ast/package.json +15 -15
  428. package/src/plugins/pi-agent-ide-ast/src/extension.ts +8 -8
  429. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +104 -26
  430. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +210 -0
  431. package/src/plugins/pi-agent-ide-changes/index.ts +1 -2
  432. package/src/plugins/pi-agent-ide-changes/package.json +10 -10
  433. package/src/plugins/pi-agent-ide-changes/runtime/entry-38.js +1 -0
  434. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +3 -3
  435. package/src/plugins/pi-agent-ide-debugger/index.ts +17 -4
  436. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +2 -11
  437. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  438. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  439. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  440. package/src/plugins/pi-agent-ide-lint/runtime/entry-42.js +2 -0
  441. package/src/plugins/pi-agent-ide-lsp/index.ts +22 -28
  442. package/src/plugins/pi-agent-ide-lsp/package.json +14 -10
  443. package/src/plugins/pi-agent-ide-lsp/runtime/entry-43.js +2 -0
  444. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +1 -1
  445. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +8 -84
  446. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -6
  447. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +11 -11
  448. package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +8 -0
  449. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +1 -1
  450. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +234 -36
  451. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +212 -0
  452. package/src/plugins/pi-agent-ide-processes/src/ui.ts +61 -16
  453. package/src/plugins/pi-agent-ide-terminal/index.ts +1 -1
  454. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +10 -7
  455. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +1 -3
  456. package/src/standalone/resource-host.ts +147 -0
  457. package/src/standalone/scoped-api.ts +457 -0
  458. package/dist/chunk-2RTCSZB3.js +0 -1
  459. package/dist/chunk-4DIUPEDF.js +0 -2
  460. package/dist/chunk-6EDOLYOV.js +0 -1
  461. package/dist/chunk-6FGLAVPJ.js +0 -1
  462. package/dist/chunk-6H32W35W.js +0 -1
  463. package/dist/chunk-6OJ565FL.js +0 -2
  464. package/dist/chunk-6R3Y4AD3.js +0 -1
  465. package/dist/chunk-6TJPMBUQ.js +0 -1
  466. package/dist/chunk-6XFUICD7.js +0 -1
  467. package/dist/chunk-BHSO2MDK.js +0 -6
  468. package/dist/chunk-GSOYVIQS.js +0 -1
  469. package/dist/chunk-HSRH76JN.js +0 -3
  470. package/dist/chunk-HSZ4AQ6L.js +0 -9
  471. package/dist/chunk-I6NPILT5.js +0 -1
  472. package/dist/chunk-K7SRNBIV.js +0 -1
  473. package/dist/chunk-LCWBVOII.js +0 -3
  474. package/dist/chunk-MKEC3U2M.js +0 -4
  475. package/dist/chunk-NUM3YQGK.js +0 -1
  476. package/dist/chunk-OM4LYD3S.js +0 -1
  477. package/dist/chunk-PLKYHUNT.js +0 -1
  478. package/dist/chunk-QIJMV2P2.js +0 -2
  479. package/dist/chunk-RVU73VKN.js +0 -2
  480. package/dist/chunk-SDAH3ECM.js +0 -5
  481. package/dist/chunk-SGQWRIRJ.js +0 -10
  482. package/dist/chunk-SWBJS3U4.js +0 -1
  483. package/dist/chunk-T7I2VX3J.js +0 -1
  484. package/dist/chunk-T7MWQQIF.js +0 -3
  485. package/dist/chunk-VDP5CQHM.js +0 -3
  486. package/dist/chunk-XG7QNAKW.js +0 -9
  487. package/dist/chunk-XLWCSJMR.js +0 -1
  488. package/dist/chunk-YFP4P2FV.js +0 -1
  489. package/dist/chunk-YIXP2ALP.js +0 -9
  490. package/dist/entry-22.js +0 -1
  491. package/docs/agent-guides/diagnostics.md +0 -5
  492. package/docs/agent-guides/json-reading.md +0 -57
  493. package/docs/agent-guides/read-resources.md +0 -17
  494. package/docs/agent-guides/search-code.md +0 -76
  495. package/docs/agent-guides/select-code.md +0 -119
  496. package/docs/agent-guides/vision.md +0 -11
  497. package/node_modules/pi-agent-doctor/runtime/entry-22.js +0 -1
  498. package/node_modules/pi-agent-filesystem/runtime/entry-29.js +0 -2
  499. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  500. package/node_modules/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  501. package/node_modules/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  502. package/node_modules/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  503. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  504. package/node_modules/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  505. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  506. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +0 -387
  507. package/node_modules/pi-agent-ide-ast/src/selection-region.ts +0 -41
  508. package/node_modules/pi-agent-ide-ast/src/source-text.ts +0 -92
  509. package/node_modules/pi-agent-ide-ast/src/text-selection.ts +0 -214
  510. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +0 -277
  511. package/node_modules/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  512. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  513. package/node_modules/pi-agent-image/runtime/entry-42.js +0 -1
  514. package/node_modules/pi-agent-invariant/runtime/entry-43.js +0 -1
  515. package/node_modules/pi-agent-search/runtime/entry-51.js +0 -1
  516. package/node_modules/pi-agent-search-text/runtime/entry-55.js +0 -2
  517. package/node_modules/pi-agent-search-text/runtime/entry-56.js +0 -1
  518. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  519. package/node_modules/pi-agent-text-editor/runtime/entry-66.js +0 -1
  520. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  521. package/node_modules/pi-agent-tool-call-interception/runtime/entry-84.js +0 -1
  522. package/node_modules/pi-agent-tool-ui/runtime/entry-85.js +0 -1
  523. package/node_modules/pi-agent-web/runtime/entry-87.js +0 -2
  524. package/node_modules/pi-agent-web-html/runtime/entry-88.js +0 -2
  525. package/src/backend/vision-capture-worker.py +0 -319
  526. package/src/backend/vision-capture.ts +0 -165
  527. package/src/backend/vision-registration.ts +0 -104
  528. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-30.js +0 -2
  529. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-32.js +0 -2
  530. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-29.js +0 -2
  531. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-88.js +0 -2
  532. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-89.js +0 -2
  533. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-87.js +0 -2
  534. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  535. package/src/extensions/pi-agent-read/runtime/entry-46.js +0 -1
  536. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +0 -2
  537. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +0 -1
  538. package/src/extensions/pi-agent-search/runtime/entry-51.js +0 -1
  539. package/src/extensions/pi-agent-search/runtime/entry-52.js +0 -1
  540. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-60.js +0 -2
  541. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-61.js +0 -1
  542. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-82.js +0 -2
  543. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-83.js +0 -2
  544. package/src/extensions/pi-agent-text-editor/runtime/entry-65.js +0 -1
  545. package/src/extensions/pi-agent-text-editor/runtime/entry-66.js +0 -1
  546. package/src/plugins/pi-agent-ide-ast/runtime/entry-34.js +0 -1
  547. package/src/plugins/pi-agent-ide-ast/runtime/entry-35.js +0 -2
  548. package/src/plugins/pi-agent-ide-ast/src/ast/constructs.ts +0 -193
  549. package/src/plugins/pi-agent-ide-ast/src/ast/element-extent.ts +0 -59
  550. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +0 -204
  551. package/src/plugins/pi-agent-ide-ast/src/geometry-selection.ts +0 -184
  552. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +0 -105
  553. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +0 -387
  554. package/src/plugins/pi-agent-ide-ast/src/selection-region.ts +0 -41
  555. package/src/plugins/pi-agent-ide-ast/src/source-text.ts +0 -92
  556. package/src/plugins/pi-agent-ide-ast/src/text-selection.ts +0 -214
  557. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +0 -277
  558. package/src/plugins/pi-agent-ide-formatter/runtime/entry-38.js +0 -2
  559. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +0 -136
  560. package/src/plugins/pi-agent-ide-vision/index.ts +0 -439
  561. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +0 -47
  562. package/src/plugins/pi-agent-ide-vision/src/vision.ts +0 -585
  563. package/src/plugins/pi-agent-ide-vision/src/windows-display-capture.ps1 +0 -30
  564. package/src/plugins/pi-agent-ide-vision/src/windows-window-capture.ps1 +0 -33
  565. /package/dist/{chunk-U2JKHKLK.js → chunk-3PMHFEJY.js} +0 -0
  566. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-28.js +0 -0
  567. /package/node_modules/{pi-agent-filesystem-image → pi-agent-filesystem}/runtime/entry-30.js +0 -0
  568. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  569. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  570. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-35.js +0 -0
  571. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  572. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  573. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  574. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  575. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
  576. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-44.js +0 -0
  577. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-45.js +0 -0
  578. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-46.js +0 -0
  579. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-50.js +0 -0
  580. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-52.js +0 -0
  581. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-59.js +0 -0
  582. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-61.js +0 -0
  583. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  584. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  585. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  586. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-65.js +0 -0
  587. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-83.js +0 -0
  588. /package/node_modules/{pi-agent-tool-ui → pi-agent-tool-call-interception}/runtime/entry-86.js +0 -0
  589. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-89.js +0 -0
  590. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  591. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  592. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-jq → pi-agent-filesystem-image}/runtime/entry-31.js +0 -0
  593. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-33.js +0 -0
  594. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-90.js +0 -0
  595. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-91.js +0 -0
  596. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-62.js +0 -0
  597. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-63.js +0 -0
  598. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-64.js +0 -0
  599. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-36.js +0 -0
  600. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-37.js +0 -0
  601. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-39.js +0 -0
  602. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-40.js +0 -0
  603. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-41.js +0 -0
@@ -1,5 +1,5 @@
1
- import{a as F,b as W,c as B,d as he,e as q,f as j}from"./chunk-W7CASEO3.js";import{f as Z}from"./chunk-IM24DB3K.js";import{a as ye}from"./chunk-YGGKGZO2.js";import"./chunk-QUYXINGZ.js";import"./chunk-XLWCSJMR.js";import"./chunk-MPT3R4BL.js";import{f as ce}from"./chunk-T7I2VX3J.js";import{a as pe}from"./chunk-BU7IZLKB.js";import{a as ue,b as fe}from"./chunk-S5PL5DFQ.js";import{K as me,d as ge}from"./chunk-LCWBVOII.js";import{a as re,b as ie,c as ae,e as K,f as le}from"./chunk-OJEIX7OZ.js";import{c as de}from"./chunk-RQ7JJ7GV.js";import"./chunk-ZC65Z3CK.js";import{a as l}from"./chunk-EI7MMDWY.js";var Q={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.vision":["Agent vision","Inspect process metadata and capture supported windows and web pages as images."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.ssh":["SSH files","Read and edit configured SSH file sources through existing tools."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var D=[C("ide.core",()=>import("./chunk-RMI3NMQY.js")),C("ide.tips",()=>import("./chunk-BB4A5UI3.js")),C("ide.doctor",()=>import("./chunk-HSZ4AQ6L.js")),C("ide.languages",()=>import("./entry-39.js"),["ide.doctor"]),C("read.core",()=>import("./entry-49.js")),C("ide.documentation",()=>import("./chunk-SGQWRIRJ.js"),["read.core"]),C("read.filesystem",()=>import("./entry-29.js"),["read.core","editor.core"]),C("read.ssh",()=>import("./chunk-YIXP2ALP.js"),["read.filesystem"]),C("read.filesystem.jq",()=>import("./entry-31.js"),["read.filesystem","ide.documentation","ide.doctor"]),C("read.filesystem.image",()=>import("./entry-30.js"),["read.filesystem"]),C("read.filesystem.pdf",()=>import("./entry-32.js"),["read.filesystem"]),C("read.filesystem.text",()=>import("./entry-33.js"),["read.filesystem"]),C("read.web",()=>import("./chunk-YFP4P2FV.js"),["read.core"]),C("read.web.html",()=>import("./entry-88.js"),["read.web"]),C("read.web.image",()=>import("./entry-89.js"),["read.web"]),C("read.web.pdf",()=>import("./entry-90.js"),["read.web"]),C("read.web.text",()=>import("./entry-91.js"),["read.web"]),C("search.core",()=>import("./entry-54.js")),C("search.text",()=>import("./entry-55.js"),["search.core"]),C("editor.renderer",()=>import("./entry-82.js"),["editor.core"]),C("editor.core",()=>import("./entry-81.js")),C("editor.anchor.constant",()=>import("./entry-60.js"),["read.core","editor.core"]),C("editor.anchor.line-hash",()=>import("./entry-64.js"),["read.core","editor.core"]),C("editor.anchor.exact",()=>import("./entry-62.js"),["editor.core"]),C("editor.stale-anchor",()=>import("./entry-83.js"),["editor.core"]),C("ide.ast",()=>import("./entry-35.js"),["ide.core","read.core","search.core","editor.core"]),C("ide.formatter",()=>import("./chunk-ZJQRLVVV.js"),["ide.core"]),C("ide.lint",()=>import("./chunk-6T7PSDQW.js"),["ide.core"]),C("ide.changes",()=>import("./chunk-XBQR74IK.js"),["ide.core","read.core","editor.core"]),C("ide.lsp",()=>import("./chunk-GSOYVIQS.js"),["ide.core","read.core","search.core"]),C("ide.processes",()=>import("./chunk-OM4LYD3S.js")),C("ide.vision",()=>import("./chunk-SDAH3ECM.js"),["ide.processes","read.core","search.core"]),C("ide.debugger",()=>import("./chunk-PT35ZFLH.js"),["ide.processes","read.core","editor.core"]),C("ide.terminal",()=>import("./chunk-GBUJOR6V.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),C("ide.diagnostics",()=>import("./chunk-RVU73VKN.js"),["ide.core","read.core"])];function C(e,t,d=[],i=!0){return{id:e,name:Q[e][0],description:Q[e][1],dependencies:d,async register(o,f){await(await t()).default(o,f)},...i?{}:{defaultEnabled:!1}}}l(C,"builtin");function G(e,t,d){return{kind:"choice",id:e,name:t,description:d,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}l(G,"presentationPreference");var V=[{kind:"choice",id:"ui.codemode",name:"Show tool results from Codemode",description:"Show extra Agent IDE result panels using each tool's presentation setting. Off hides successful panels; errors stay visible. Codemode's own output and other tools are unchanged.",default:"off",group:"ui",values:[{value:"off",label:"Off"},{value:"on",label:"On"}]},G("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),G("ui.read","Read","Choose how Read calls and results are displayed."),G("ui.search","Search","Choose how Search calls and results are displayed."),G("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]},{kind:"text",id:"vision.sequenceDurationSeconds",name:"Vision sequence duration",description:"Default sequence duration in seconds. Requests may override it, up to 10 seconds.",default:"2",group:"features"},{kind:"text",id:"vision.sequenceIntervalSeconds",name:"Vision sequence interval",description:"Default seconds between sequence frames. A sequence may contain at most 20 frames.",default:"0.5",group:"features"},{kind:"text",id:"vision.imageScale",name:"Vision image scale",description:"Default image downscale from greater than 0 through 1.",default:"0.5",group:"features"},{kind:"text",id:"vision.allowedExecutables",name:"Vision allowed executables",description:"Comma-separated executable file names that may be captured without arbitrary-window access.",default:"",group:"features",placeholder:"Unity.exe,UnrealEditor.exe"}];function J(e,t,d=[]){let i=new Map;for(let p of e){if(i.has(p.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${p.id}`);i.set(p.id,p)}for(let p of e)for(let A of p.dependencies)if(!i.has(A))throw new Error(`Pi Agent IDE extension ${p.id} has unknown dependency ${A}`);let o=new Set;for(let p of t)i.has(p)&&o.add(p);for(let p of d)if(!i.has(p))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${p}`);let f=Xe(i,d,o),y=new Set;for(let p of e)(p.defaultEnabled===!1&&!f.has(p.id)||o.has(p.id))&&y.add(p.id);let E=!0;for(;E;){E=!1;for(let p of e)y.has(p.id)||p.dependencies.every(A=>!y.has(A))||(y.add(p.id),E=!0)}return{enabled:e.filter(p=>!y.has(p.id)),disabled:y}}l(J,"selectBuiltinExtensions");function Xe(e,t,d){let i=new Set,o=[...t];for(;o.length>0;){let f=o.pop();if(!(i.has(f)||d.has(f))){i.add(f);for(let y of e.get(f)?.dependencies??[])i.has(y)||o.push(y)}}return i}l(Xe,"collectForcedOn");import{Input as st}from"@earendil-works/pi-tui";import{mkdir as Ke,readFile as Ze,writeFile as Qe}from"node:fs/promises";import et from"node:path";import{withFileMutationQueue as tt}from"@earendil-works/pi-coding-agent";async function be(e,t,d=new Map,i=new Map,o){await tt(e,async()=>{let f=await j(e),y={};try{y=JSON.parse(await Ze(e,"utf8"))}catch(g){if(!(g instanceof Error&&"code"in g&&g.code==="ENOENT"))throw g}let E=new Set(f.disabled),p=new Set(f.enabled);for(let[g,x]of t)E.delete(g),p.delete(g),x==="disabled"&&E.add(g),x==="enabled"&&p.add(g);let A={...f.preferences};for(let[g,x]of i)x===void 0?delete A[g]:A[g]=x;let v={...f.flags};for(let[g,x]of d)g==="pi-agent-ide-no-animations"&&delete y.noAnimations,g==="pi-agent-ide-no-post-processing"&&delete y.noPostProcessing,x===void 0?delete v[g]:v[g]=x;await Ke(et.dirname(e),{recursive:!0}),await Qe(e,`${JSON.stringify({...y,disabled:[...E],enabled:[...p],...o===void 0?{}:{preset:o},...d.size>0?{flags:v}:{},...i.size>0?{preferences:A}:{}},null,2)}
2
- `)})}l(be,"saveModuleChoices");import{getSettingsListTheme as nt}from"@earendil-works/pi-coding-agent";import{matchesKey as H,SettingsList as ot,truncateToWidth as we,visibleWidth as xe}from"@earendil-works/pi-tui";function ve(e,t,d,i,o=""){let f=["extensions","behavior","ui"],y="extensions",E=l(s=>s==="extensions"?"modules":s==="behavior"?"features":"ui","itemKey"),p=l(s=>s==="extensions"?"modules":s==="behavior"?"features":"ui","changeKey"),A=l(()=>{let s=E(y),r=t()[s]??[];return new ot(r,12,nt(),(n,c)=>{d(p(y),n,c);for(let a of t()[s]??[]){let u=r.find(h=>h.id===a.id);u&&Object.assign(u,a)}},()=>i(!1),{enableSearch:!0})},"createList"),v=A(),g=l(s=>e.fg("borderMuted",s),"border"),x=l((s,r)=>{if(r<=1)return g("\u2502");let n=r-2,c=we(s,n);return`${g("\u2502")}${c}${" ".repeat(Math.max(0,n-xe(c)))}${g("\u2502")}`},"row"),b=l(s=>g(s<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,s-2))}\u2524`),"rule");return{render(s){let r=Math.max(1,s),n=Math.max(1,r-4),c=` Agent IDE settings${o?` \xB7 ${o}`:""} `,a=r<=1?g("\u256D"):`${g("\u256D\u2500")}${e.fg("accent",e.bold(we(c,Math.max(0,r-3),"")))}${g(`${"\u2500".repeat(Math.max(0,r-xe(c)-3))}\u256E`)}`,u={extensions:"Features",behavior:"Behavior",ui:"UI"},h=f.map(T=>T===y?e.fg("accent",e.bold(`[ ${u[T]} ]`)):e.fg("dim",` ${u[T]} `)).join(" "),w=v.render(n).map(T=>x(` ${T} `,r)),m=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[a,x(` ${h} `,r),b(r),...w,b(r),x(m,r),g(r<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,r-2))}\u256F`)]},invalidate(){v.invalidate()},handleInput(s){H(s,"tab")||H(s,"shift+tab")?(y=f[(f.indexOf(y)+(H(s,"shift+tab")?2:1))%f.length]??"extensions",v=A()):H(s,"ctrl+s")?i(!0):v.handleInput(s)}}}l(ve,"createSettingsPanel");function Ee(e,t=[],d=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(i,o){if(o.hasUI)try{let f=await o.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(f===void 0)return;let y=B(process.env,void 0,o.cwd),E=f==="Project"?y.projectPath:y.globalPath,p=await j(E),A=await j(f==="Project"?y.globalPath:y.projectPath),v=new Map,g=new Map,x=new Map,b;if(!await o.ui.custom((r,n,c,a)=>{let u=ve(n,()=>{let h=new Set(p.disabled),w=new Set(p.enabled);for(let[R,S]of v)h.delete(R),w.delete(R),S==="disabled"&&h.add(R),S==="enabled"&&w.add(R);let m=J(D,[...W(D,b??p.preset??"full"),...h,...W(D,A.preset??"full"),...A.disabled],[...w,...A.enabled]);return{modules:D.map(R=>({id:R.id,label:R.name??R.id,description:`${R.description??""} Effective: ${m.disabled.has(R.id)?"off":"on"}.${A.disabled.includes(R.id)?" Disabled in the other scope.":R.dependencies.some(S=>m.disabled.has(S))?" A dependency is disabled.":""}`,currentValue:v.get(R.id)??(p.disabled.includes(R.id)?"disabled":p.enabled.includes(R.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[T(),...P("features"),...I("features")],ui:[...P("ui"),...I("ui")]};function T(){let R=b??p.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:F.find(S=>S.value===R)?.label??R,values:F.map(S=>S.label)}}function I(R){return d.filter(S=>S.group===R).map(S=>{let O=x.has(S.id)?x.get(S.id):p.preferences?.[S.id];return{id:S.id,label:S.name,description:`${S.description} Default: ${S.kind==="choice"?S.values.find(M=>M.value===S.default)?.label??S.default:S.default||"empty"}.`,currentValue:O===void 0?"default":S.kind==="choice"?S.values.find(M=>M.value===O)?.label??O:O,...S.kind==="choice"?{values:["default",...S.values.map(M=>M.label)]}:{submenu:l((M,U)=>{let _=new st,k=M==="default"?S.default:M;return k.length>0&&_.handleInput(k),_.focused=!0,_.onSubmit=X=>U(X),_.onEscape=()=>U(),_},"submenu")}}})}function P(R){return t.filter(S=>(S.group??"features")===R).map(S=>{let O=g.has(S.id)?g.get(S.id):q(p)[S.id];return{id:S.id,label:S.name,description:S.description,currentValue:O===void 0?"default":O?S.labels?.on??"enabled":S.labels?.off??"disabled",values:["default",S.labels?.off??"disabled",S.labels?.on??"enabled"]}})}},(h,w,m)=>{if(h==="modules")v.set(w,m);else if(w==="preset")b=F.find(T=>T.label===m)?.value;else if(d.some(T=>T.id===w)){let T=d.find(I=>I.id===w);x.set(w,m==="default"||m.length===0?void 0:T?.kind==="choice"?T.values.find(I=>I.label===m)?.value:m)}else g.set(w,m==="default"?void 0:m===(t.find(T=>T.id===w)?.labels?.on??"enabled"))},a,f);return{render:l(h=>u.render(h),"render"),invalidate:l(()=>u.invalidate(),"invalidate"),handleInput(h){u.handleInput(h),r.requestRender()}}})||v.size+g.size+x.size+(b===void 0?0:1)===0)return;if(await be(E,v,g,x,b),o.ui.notify(`Saved ${f.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await o.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await o.reload();return}}catch(f){o.ui.notify(f instanceof Error?f.message:String(f),"error")}}})}l(Ee,"registerModuleSettings");import{readFile as rt}from"node:fs/promises";import ee from"node:path";import{getMarkdownTheme as it}from"@earendil-works/pi-coding-agent";import{Markdown as at,matchesKey as $,ScrollView as lt,truncateToWidth as dt}from"@earendil-works/pi-tui";function ct(){return rt(ee.join(ee.dirname(ee.dirname(import.meta.dirname)),"docs/settings-help.md"),"utf8")}l(ct,"readSettingsHelp");function Ie(e){e.registerCommand("agent-ide-help",{description:"Read the short Agent IDE settings guide",async handler(t,d){if(!(d.mode!=="tui"||!d.hasUI))try{let i=await ct();await d.ui.custom((o,f,y,E)=>new te(i,f,()=>Math.max(5,Math.min(36,o.terminal.rows-4)),()=>o.requestRender(),E),{overlay:!0,overlayOptions:{width:92,margin:1}})}catch(i){d.ui.notify(i instanceof Error?i.message:String(i),"error")}}})}l(Ie,"registerSettingsHelp");var te=class{constructor(t,d,i,o,f){this.content=t;this.theme=d;this.height=i;this.requestRender=o;this.done=f;this.markdown=this.createMarkdown(),this.scroll=new lt(this.markdown)}static{l(this,"SettingsHelpPanel")}markdown;scroll;createMarkdown(){return new at(this.content,0,0,it(),{color:l(t=>this.theme.fg("text",t),"color")})}invalidate(){this.markdown.invalidate()}handleInput(t){if($(t,"escape")){this.done();return}$(t,"up")?this.scroll.scrollBy(-1):$(t,"down")?this.scroll.scrollBy(1):$(t,"pageUp")?this.scroll.scrollBy(-this.scroll.viewportHeight):$(t,"pageDown")||$(t,"space")?this.scroll.scrollBy(this.scroll.viewportHeight):$(t,"home")?this.scroll.scrollToStart():$(t,"end")&&this.scroll.scrollToEnd()}render(t){let d=Math.max(1,t-4),i=this.markdown.render(d),o=Math.max(1,this.height()-4);this.scroll.updateLayout(i.length,o,this.requestRender);let f=i.slice(this.scroll.scrollTop,this.scroll.scrollTop+o);for(;f.length<o;)f.push("");let y=this.theme.fg("border","\u2500".repeat(Math.max(0,t-2))),E=l(p=>this.theme.fg("border","\u2502 ")+dt(p,d,"\u2026",!0)+this.theme.fg("border"," \u2502"),"row");return[this.theme.fg("border","\u256D")+y+this.theme.fg("border","\u256E"),E(this.theme.fg("accent","Agent IDE settings help")),...f.map(E),E(this.theme.fg("muted","\u2191\u2193 scroll \xB7 PgUp/PgDn page \xB7 Home/End \xB7 Esc close")),this.theme.fg("border","\u2570")+y+this.theme.fg("border","\u256F")]}};function Se(e,t){let d=[];return{definitions:d,register(i){if(d.some(o=>o.id===i.id))throw new Error(`Duplicate feature flag: ${i.id}`);d.push(i),e.registerFlag(i.id,{type:"boolean",description:i.description,default:t[i.id]??i.default})}}}l(Se,"createFeatureFlags");function Te(e,t=V){return{id:"ide-settings",description:"Registered IDE settings, choices, defaults, configuration scopes and inheritance.",triggers:[{tool:"read",resourcePrefixes:["docs:ide-settings"]}],get markdown(){let d={preferences:t,flags:e,modules:D.map(({id:o,name:f,description:y,defaultEnabled:E,dependencies:p})=>({id:o,name:f,description:y,default:E!==!1,dependencies:p})),presets:F};return`# IDE settings
1
+ import{a as N,b as j,c as $,d as le,e as B,f as _}from"./chunk-W7CASEO3.js";import{a as ne}from"./chunk-H5Z54BEU.js";import{f as J}from"./chunk-WES2E4VR.js";import{a as re}from"./chunk-YGGKGZO2.js";import"./chunk-5S74Z6Y4.js";import"./chunk-GS5ZRTUG.js";import"./chunk-MPT3R4BL.js";import{g as oe}from"./chunk-KN6VPARZ.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-DDH3FP4G.js";import{a as se,b as ie,c as ae,e as Y,f as de}from"./chunk-OJEIX7OZ.js";import{c as te}from"./chunk-RQ7JJ7GV.js";import"./chunk-ZC65Z3CK.js";import{a as r}from"./chunk-EI7MMDWY.js";var z={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.ssh":["SSH files","Read and edit configured SSH file sources through existing tools."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var D=[A("ide.core",()=>import("./chunk-V4J3TLCV.js")),A("ide.tips",()=>import("./chunk-BB4A5UI3.js")),A("ide.doctor",()=>import("./chunk-HT7LZN5A.js")),A("ide.languages",()=>import("./entry-41.js"),["ide.doctor"]),A("read.core",()=>import("./entry-51.js")),A("ide.documentation",async()=>{let{default:e}=await import("./chunk-K4UTEMDU.js");return{default:r(t=>e(t),"default")}},["read.core"]),A("read.filesystem",()=>import("./entry-30.js"),["read.core","editor.core"]),A("read.ssh",()=>import("./chunk-FS3KCKFX.js"),["read.filesystem"]),A("read.filesystem.jq",()=>import("./entry-33.js"),["read.filesystem","ide.documentation","ide.doctor"]),A("read.filesystem.image",()=>import("./entry-31.js"),["read.filesystem"]),A("read.filesystem.pdf",()=>import("./entry-34.js"),["read.filesystem"]),A("read.filesystem.text",()=>import("./entry-35.js"),["read.filesystem"]),A("read.web",()=>import("./chunk-QM5WDEFI.js"),["read.core"]),A("read.web.html",()=>import("./entry-90.js"),["read.web"]),A("read.web.image",()=>import("./entry-91.js"),["read.web"]),A("read.web.pdf",()=>import("./entry-92.js"),["read.web"]),A("read.web.text",()=>import("./entry-93.js"),["read.web"]),A("search.core",()=>import("./entry-56.js")),A("search.text",()=>import("./entry-57.js"),["search.core"]),A("editor.renderer",()=>import("./entry-84.js"),["editor.core"]),A("editor.core",()=>import("./entry-83.js")),A("editor.anchor.constant",()=>import("./entry-62.js"),["read.core","editor.core"]),A("editor.anchor.line-hash",()=>import("./entry-66.js"),["read.core","editor.core"]),A("editor.anchor.exact",()=>import("./entry-64.js"),["editor.core"]),A("editor.stale-anchor",()=>import("./entry-85.js"),["editor.core"]),A("ide.ast",()=>import("./entry-37.js"),["ide.core","read.core","search.core","editor.core"]),A("ide.formatter",()=>import("./chunk-Y74EKJOY.js"),["ide.core"]),A("ide.lint",()=>import("./chunk-VN3XBH2Q.js"),["ide.core"]),A("ide.changes",()=>import("./chunk-4GBFIGH3.js"),["ide.core","read.core","editor.core"]),A("ide.lsp",()=>import("./chunk-CVOYSEBE.js"),["ide.core","read.core","search.core"]),A("ide.processes",()=>import("./chunk-XUYIK4TX.js")),A("ide.debugger",()=>import("./chunk-TNAUCNUT.js"),["ide.processes","read.core","editor.core"]),A("ide.terminal",()=>import("./chunk-7URANI6I.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),A("ide.diagnostics",()=>import("./chunk-LTADNZKW.js"),["ide.core","read.core"])];function A(e,t,u=[],f=!0){return{id:e,name:z[e][0],description:z[e][1],dependencies:u,async register(n,d){await(await t()).default(n,d)},...f?{}:{defaultEnabled:!1}}}r(A,"builtin");function L(e,t,u){return{kind:"choice",id:e,name:t,description:u,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}r(L,"presentationPreference");var G=[{kind:"choice",id:"ui.codemode",name:"Show tool results from Codemode",description:"Show extra Agent IDE result panels using each tool's presentation setting. Off hides successful panels; errors stay visible. Codemode's own output and other tools are unchanged.",default:"off",group:"ui",values:[{value:"off",label:"Off"},{value:"on",label:"On"}]},L("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),L("ui.read","Read","Choose how Read calls and results are displayed."),L("ui.search","Search","Choose how Search calls and results are displayed."),L("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]}];function U(e,t,u=[]){let f=new Map;for(let i of e){if(f.has(i.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${i.id}`);f.set(i.id,i)}for(let i of e)for(let R of i.dependencies)if(!f.has(R))throw new Error(`Pi Agent IDE extension ${i.id} has unknown dependency ${R}`);let n=new Set;for(let i of t)f.has(i)&&n.add(i);for(let i of u)if(!f.has(i))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${i}`);let d=Ne(f,u,n),l=new Set;for(let i of e)(i.defaultEnabled===!1&&!d.has(i.id)||n.has(i.id))&&l.add(i.id);let y=!0;for(;y;){y=!1;for(let i of e)l.has(i.id)||i.dependencies.every(R=>!l.has(R))||(l.add(i.id),y=!0)}return{enabled:e.filter(i=>!l.has(i.id)),disabled:l}}r(U,"selectBuiltinExtensions");function Ne(e,t,u){let f=new Set,n=[...t];for(;n.length>0;){let d=n.pop();if(!(f.has(d)||u.has(d))){f.add(d);for(let l of e.get(d)?.dependencies??[])f.has(l)||n.push(l)}}return f}r(Ne,"collectForcedOn");import{Input as We}from"@earendil-works/pi-tui";import{mkdir as $e,readFile as Fe,writeFile as je}from"node:fs/promises";import Be from"node:path";import{withFileMutationQueue as Le}from"@earendil-works/pi-coding-agent";async function ce(e,t,u=new Map,f=new Map,n){await Le(e,async()=>{let d=await _(e),l={};try{l=JSON.parse(await Fe(e,"utf8"))}catch(s){if(!(s instanceof Error&&"code"in s&&s.code==="ENOENT"))throw s}let y=new Set(d.disabled),i=new Set(d.enabled);for(let[s,c]of t)y.delete(s),i.delete(s),c==="disabled"&&y.add(s),c==="enabled"&&i.add(s);let R={...d.preferences};for(let[s,c]of f)c===void 0?delete R[s]:R[s]=c;let I={...d.flags};for(let[s,c]of u)s==="pi-agent-ide-no-animations"&&delete l.noAnimations,s==="pi-agent-ide-no-post-processing"&&delete l.noPostProcessing,c===void 0?delete I[s]:I[s]=c;await $e(Be.dirname(e),{recursive:!0}),await je(e,`${JSON.stringify({...l,disabled:[...y],enabled:[...i],...n===void 0?{}:{preset:n},...u.size>0?{flags:I}:{},...f.size>0?{preferences:R}:{}},null,2)}
2
+ `)})}r(ce,"saveModuleChoices");import{getSettingsListTheme as Ge}from"@earendil-works/pi-coding-agent";import{matchesKey as W,SettingsList as Ue,truncateToWidth as ue,visibleWidth as fe}from"@earendil-works/pi-tui";function ge(e,t,u,f,n=""){let d=["extensions","behavior","ui"],l="extensions",y=r(v=>v==="extensions"?"modules":v==="behavior"?"features":"ui","itemKey"),i=r(v=>v==="extensions"?"modules":v==="behavior"?"features":"ui","changeKey"),R=r(()=>{let v=y(l),a=t()[v]??[];return new Ue(a,12,Ge(),(o,m)=>{u(i(l),o,m);for(let h of t()[v]??[]){let b=a.find(w=>w.id===h.id);b&&Object.assign(b,h)}},()=>f(!1),{enableSearch:!0})},"createList"),I=R(),s=r(v=>e.fg("borderMuted",v),"border"),c=r((v,a)=>{if(a<=1)return s("\u2502");let o=a-2,m=ue(v,o);return`${s("\u2502")}${m}${" ".repeat(Math.max(0,o-fe(m)))}${s("\u2502")}`},"row"),g=r(v=>s(v<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,v-2))}\u2524`),"rule");return{render(v){let a=Math.max(1,v),o=Math.max(1,a-4),m=` Agent IDE settings${n?` \xB7 ${n}`:""} `,h=a<=1?s("\u256D"):`${s("\u256D\u2500")}${e.fg("accent",e.bold(ue(m,Math.max(0,a-3),"")))}${s(`${"\u2500".repeat(Math.max(0,a-fe(m)-3))}\u256E`)}`,b={extensions:"Features",behavior:"Behavior",ui:"UI"},w=d.map(P=>P===l?e.fg("accent",e.bold(`[ ${b[P]} ]`)):e.fg("dim",` ${b[P]} `)).join(" "),S=I.render(o).map(P=>c(` ${P} `,a)),p=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[h,c(` ${w} `,a),g(a),...S,g(a),c(p,a),s(a<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,a-2))}\u256F`)]},invalidate(){I.invalidate()},handleInput(v){W(v,"tab")||W(v,"shift+tab")?(l=d[(d.indexOf(l)+(W(v,"shift+tab")?2:1))%d.length]??"extensions",I=R()):W(v,"ctrl+s")?f(!0):I.handleInput(v)}}}r(ge,"createSettingsPanel");function pe(e,t=[],u=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(f,n){if(n.hasUI)try{let d=await n.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(d===void 0)return;let l=$(process.env,void 0,n.cwd),y=d==="Project"?l.projectPath:l.globalPath,i=await _(y),R=await _(d==="Project"?l.globalPath:l.projectPath),I=new Map,s=new Map,c=new Map,g;if(!await n.ui.custom((a,o,m,h)=>{let b=ge(o,()=>{let w=new Set(i.disabled),S=new Set(i.enabled);for(let[T,E]of I)w.delete(T),S.delete(T),E==="disabled"&&w.add(T),E==="enabled"&&S.add(T);let p=U(D,[...j(D,g??i.preset??"full"),...w,...j(D,R.preset??"full"),...R.disabled],[...S,...R.enabled]);return{modules:D.map(T=>({id:T.id,label:T.name??T.id,description:`${T.description??""} Effective: ${p.disabled.has(T.id)?"off":"on"}.${R.disabled.includes(T.id)?" Disabled in the other scope.":T.dependencies.some(E=>p.disabled.has(E))?" A dependency is disabled.":""}`,currentValue:I.get(T.id)??(i.disabled.includes(T.id)?"disabled":i.enabled.includes(T.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[P(),...C("features"),...x("features")],ui:[...C("ui"),...x("ui")]};function P(){let T=g??i.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:N.find(E=>E.value===T)?.label??T,values:N.map(E=>E.label)}}function x(T){return u.filter(E=>E.group===T).map(E=>{let k=c.has(E.id)?c.get(E.id):i.preferences?.[E.id];return{id:E.id,label:E.name,description:`${E.description} Default: ${E.kind==="choice"?E.values.find(O=>O.value===E.default)?.label??E.default:E.default||"empty"}.`,currentValue:k===void 0?"default":E.kind==="choice"?E.values.find(O=>O.value===k)?.label??k:k,...E.kind==="choice"?{values:["default",...E.values.map(O=>O.label)]}:{submenu:r((O,Q)=>{let F=new We,ee=O==="default"?E.default:O;return ee.length>0&&F.handleInput(ee),F.focused=!0,F.onSubmit=Me=>Q(Me),F.onEscape=()=>Q(),F},"submenu")}}})}function C(T){return t.filter(E=>(E.group??"features")===T).map(E=>{let k=s.has(E.id)?s.get(E.id):B(i)[E.id];return{id:E.id,label:E.name,description:E.description,currentValue:k===void 0?"default":k?E.labels?.on??"enabled":E.labels?.off??"disabled",values:["default",E.labels?.off??"disabled",E.labels?.on??"enabled"]}})}},(w,S,p)=>{if(w==="modules")I.set(S,p);else if(S==="preset")g=N.find(P=>P.label===p)?.value;else if(u.some(P=>P.id===S)){let P=u.find(x=>x.id===S);c.set(S,p==="default"||p.length===0?void 0:P?.kind==="choice"?P.values.find(x=>x.label===p)?.value:p)}else s.set(S,p==="default"?void 0:p===(t.find(P=>P.id===S)?.labels?.on??"enabled"))},h,d);return{render:r(w=>b.render(w),"render"),invalidate:r(()=>b.invalidate(),"invalidate"),handleInput(w){b.handleInput(w),a.requestRender()}}})||I.size+s.size+c.size+(g===void 0?0:1)===0)return;if(await ce(y,I,s,c,g),n.ui.notify(`Saved ${d.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await n.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await n.reload();return}}catch(d){n.ui.notify(d instanceof Error?d.message:String(d),"error")}}})}r(pe,"registerModuleSettings");import{readFile as qe}from"node:fs/promises";import V from"node:path";import{getMarkdownTheme as Je}from"@earendil-works/pi-coding-agent";import{Markdown as Ye,matchesKey as M,ScrollView as ze,truncateToWidth as Ve}from"@earendil-works/pi-tui";function He(){return qe(V.join(V.dirname(V.dirname(import.meta.dirname)),"docs/settings-help.md"),"utf8")}r(He,"readSettingsHelp");function me(e){e.registerCommand("agent-ide-help",{description:"Read the short Agent IDE settings guide",async handler(t,u){if(!(u.mode!=="tui"||!u.hasUI))try{let f=await He();await u.ui.custom((n,d,l,y)=>new H(f,d,()=>Math.max(5,Math.min(36,n.terminal.rows-4)),()=>n.requestRender(),y),{overlay:!0,overlayOptions:{width:92,margin:1}})}catch(f){u.ui.notify(f instanceof Error?f.message:String(f),"error")}}})}r(me,"registerSettingsHelp");var H=class{constructor(t,u,f,n,d){this.content=t;this.theme=u;this.height=f;this.requestRender=n;this.done=d;this.markdown=this.createMarkdown(),this.scroll=new ze(this.markdown)}static{r(this,"SettingsHelpPanel")}markdown;scroll;createMarkdown(){return new Ye(this.content,0,0,Je(),{color:r(t=>this.theme.fg("text",t),"color")})}invalidate(){this.markdown.invalidate()}handleInput(t){if(M(t,"escape")){this.done();return}M(t,"up")?this.scroll.scrollBy(-1):M(t,"down")?this.scroll.scrollBy(1):M(t,"pageUp")?this.scroll.scrollBy(-this.scroll.viewportHeight):M(t,"pageDown")||M(t,"space")?this.scroll.scrollBy(this.scroll.viewportHeight):M(t,"home")?this.scroll.scrollToStart():M(t,"end")&&this.scroll.scrollToEnd()}render(t){let u=Math.max(1,t-4),f=this.markdown.render(u),n=Math.max(1,this.height()-4);this.scroll.updateLayout(f.length,n,this.requestRender);let d=f.slice(this.scroll.scrollTop,this.scroll.scrollTop+n);for(;d.length<n;)d.push("");let l=this.theme.fg("border","\u2500".repeat(Math.max(0,t-2))),y=r(i=>this.theme.fg("border","\u2502 ")+Ve(i,u,"\u2026",!0)+this.theme.fg("border"," \u2502"),"row");return[this.theme.fg("border","\u256D")+l+this.theme.fg("border","\u256E"),y(this.theme.fg("accent","Agent IDE settings help")),...d.map(y),y(this.theme.fg("muted","\u2191\u2193 scroll \xB7 PgUp/PgDn page \xB7 Home/End \xB7 Esc close")),this.theme.fg("border","\u2570")+l+this.theme.fg("border","\u256F")]}};function he(e,t){let u=[];return{definitions:u,register(f){if(u.some(n=>n.id===f.id))throw new Error(`Duplicate feature flag: ${f.id}`);u.push(f),e.registerFlag(f.id,{type:"boolean",description:f.description,default:t[f.id]??f.default})}}}r(he,"createFeatureFlags");function be(e,t=G){return{id:"ide-settings",description:"IDE settings and their scopes",triggers:[{tool:"read",resourcePrefixes:["docs:ide-settings"]}],get markdown(){let u={preferences:t,flags:e,modules:D.map(({id:n,name:d,description:l,defaultEnabled:y,dependencies:i})=>({id:n,name:d,description:l,default:y!==!1,dependencies:i})),presets:N};return`# IDE settings
3
3
 
4
4
  This catalog describes supported settings, not current saved values or live runtime state. It is generated from the registrations used by /agent-ide-settings. Read both configuration scopes to inspect overrides. Reload or restart applies module and startup-only changes; built-in CLI flags may override their saved defaults for an invocation.
5
5
 
@@ -23,43 +23,19 @@ Choices carry their saved value and human label. Text settings carry a descripti
23
23
 
24
24
  \`\`\`json
25
25
  {
26
- ${Object.entries(d).map(([o,f])=>` "${o}": [
27
- ${f.map(y=>` ${JSON.stringify(y)}`).join(`,
26
+ ${Object.entries(u).map(([n,d])=>` "${n}": [
27
+ ${d.map(l=>` ${JSON.stringify(l)}`).join(`,
28
28
  `)}
29
29
  ]`).join(`,
30
30
  `)}
31
31
  }
32
32
  \`\`\`
33
- `}}}l(Te,"createIdeSettingsDocumentation");function Ae(e){let t=new Map,d=new Set;return{api:{...e,registerTool:l(o=>{o.namespace?.name.startsWith("ide_")===!0&&t.set(o.name,{hide:l(()=>e.registerTool({...o,get description(){return o.description},get promptGuidelines(){return o.promptGuidelines},exposure:"hidden"}),"hide"),restore:l(()=>e.registerTool(o),"restore")}),d.has(o.name)?t.get(o.name)?.hide():e.registerTool(o)},"registerTool")},reconcile(o=!1,f=[],y=!1){let E=new Set,p=new Set;for(let b of e.getSettings().defaultTools??[])if(b.startsWith("-"))E.add(b.slice(1)),p.delete(b.slice(1));else{let s=b.startsWith("+")?b.slice(1):b;E.delete(s),p.add(s)}for(let[b,s]of t)E.has(b)!==d.has(b)&&(E.has(b)?(s.hide(),d.add(b)):(s.restore(),d.delete(b)));let A=e.getAllTools().filter(b=>b.exposure!=="hidden"),v=new Set(e.getActiveTools());for(let b of A)o&&!y&&t.has(b.name)&&(p.has(b.name)||b.exposure==="deferred"&&f.includes(b.name))&&v.add(b.name);o&&!E.has("tool_search")&&A.some(b=>b.name==="tool_search")&&A.some(b=>t.has(b.name)&&b.exposure==="deferred")&&v.add("tool_search");let g=e.getActiveTools(),x=[...v].filter(b=>!d.has(b));(x.length!==g.length||x.some(b=>!g.includes(b)))&&e.setActiveTools(x)}}}l(Ae,"createIdeToolAvailability");import{ToolExecutionComponent as Pe}from"@earendil-works/pi-coding-agent";import{Container as ne,Spacer as Ce,Text as z}from"@earendil-works/pi-tui";import{isDeepStrictEqual as ut}from"node:util";import{createCodemodeExtension as ft}from"@earendil-works/pi-coding-agent";function Re(e,t){let d=l(o=>{if(!o.startsWith("mcp__"))return;let f=e.getAllTools(),y=f.find(p=>p.name===o);if(!y||y.namespace||y.exposure==="hidden")return;let E=f.filter(p=>(t.has(p.name)&&p.namespace?.name.startsWith("ide_")===!0||p.name==="codemode"&&p.sourceInfo.source==="builtin"&&p.sourceInfo.path==="builtin:codemode")&&p.exposure!=="hidden"&&p.description===y.description&&ut(p.parameters,y.parameters));return E.length===1?E[0]?.name:void 0},"source"),i;return e.registerToolRenderer((o,f)=>{let y=d(o);return y!=="codemode"?y===void 0?f():t.get(y):(i||ft()({...e,registerTool:l(E=>{let{renderShell:p,renderCall:A,renderResult:v}=E;i={renderShell:p,renderCall:A,renderResult:v}},"registerTool")}),i??f())}),e.on("before_agent_start",()=>{for(let o of e.getAllTools()){let f=d(o.name),y=f===void 0?void 0:t.get(f);if(!y)continue;let E=Object.getOwnPropertyDescriptors(y);delete E.namespace,E.name={value:o.name,enumerable:!0,configurable:!0,writable:!0},E.exposure={value:o.exposure,enumerable:!0,configurable:!0,writable:!0};let p=l(async(v,g,x,b,s)=>{let{result:r,isError:n}=await s.executeTool(y.name,g,{signal:x,onUpdate:b}),{usage:c,...a}=r;return{...a,isError:n}},"execute");E.execute={value:p,enumerable:!0,configurable:!0,writable:!0};let A=Object.defineProperties({},E);e.registerTool(A)}}),d}l(Re,"registerIdeAliasCompatibility");var oe="ide-nested-results",ke=256,Oe=512*1024,Me=8*1024,pt=32*1024,gt=l(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function _e(e){let t=e.retention,d=[t?.argumentsTruncated&&"arguments shortened",t?.resultsOmitted&&"result displays omitted",t?.callsOmitted&&"call panels omitted",t?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(d.length>0)return`Nested IDE display: ${d.join("; ")}. Tool execution and parent output are unchanged.`;if(!t&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}l(_e,"retentionWarning");function mt(e){let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let d=Math.floor(t),i=Math.floor(d/60);return i<60?`${i}m ${d%60}s`:`${Math.floor(i/60)}h ${i%60}m ${d%60}s`}l(mt,"formatToolDuration");function De(e,t=!1){let d=new Map,i=Re(e,d),o=new Map,f=new Map,y=new Map,E,p=new WeakMap,A=new WeakMap,v=l(r=>{let n=d.get(r),c=n?.renderResult;if(!n||!c)return n;let a=A.get(n);if(!a){let u=new WeakMap;a={...n,renderResult(h,w,m,T){let I=T.lastComponent&&u.get(T.lastComponent),P=c.call(n,h,w,m,{...T,lastComponent:I??T.lastComponent});if(w.isPartial||T.durationMs===void 0)return P;let R=new ne;return R.addChild(P),R.addChild(new Ce(1)),R.addChild(new z(m.fg("muted",`Took ${mt(T.durationMs)}`),0,0)),u.set(R,P),R}},A.set(n,a)}return a},"timedDefinition"),g=l((r,n,c)=>{n.result=c,n.resultOmitted=!1;try{let u=JSON.stringify(r);if(Buffer.byteLength(u)<=Oe){n.result=JSON.parse(JSON.stringify(c));return}}catch{}let a=c.details&&typeof c.details=="object"?Object.entries(c.details).filter(([u,h])=>(u==="source"||u==="fullOutputPath")&&typeof h=="string").map(([u,h])=>`${u}: ${String(h)}`):[];n.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...a].join(`
34
- `)}],details:void 0,isError:c.isError},n.resultOmitted=!0},"retainResult"),x=l(()=>{o.clear(),f.clear(),y.clear()},"clear");e.on("session_start",(r,n)=>{x(),n.mode==="tui"&&n.ui.setWidget(oe,c=>(E=c,{render:l(()=>[],"render"),invalidate:l(()=>{},"invalidate")}))}),e.on("session_tree",x),e.on("session_shutdown",x),e.on("tool_execution_start",(r,n)=>{if(r.parentToolCallId===void 0){let I=i(r.toolName);I!==void 0&&o.set(r.toolCallId,I);return}let c=f.get(r.parentToolCallId)??r.parentToolCallId;if(f.set(r.toolCallId,c),o.get(c)===r.toolName||!d.has(r.toolName))return;let a=y.get(c);if(a||(a={parentToolCallId:c,cwd:n.cwd,calls:[],retention:gt()},y.set(c,a)),a.calls.length>=ke){a.retention.callsOmitted=!0;return}let u=JSON.stringify(r.args),h=pt-a.calls.reduce((I,P)=>I+Buffer.byteLength(JSON.stringify(P.args)),0)-(ke-a.calls.length-1)*2,w=Buffer.byteLength(u)>Math.min(Me,h),m=w?Object.fromEntries(Object.entries(r.args).map(([I,P])=>[I,typeof P=="string"?P.slice(0,200)+(P.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(u),T=Buffer.byteLength(JSON.stringify(m))<=Math.min(Me,h)?m:{};a.calls.push({id:r.toolCallId,name:r.toolName,args:T,argumentsTruncated:w})}),e.on("tool_execution_end",r=>{o.delete(r.toolCallId);let n=f.get(r.toolCallId);if(n===void 0)return;f.delete(r.toolCallId);let c=y.get(n),a=c?.calls.find(u=>u.id===r.toolCallId);if(c&&a){typeof r.durationMs=="number"&&Number.isFinite(r.durationMs)&&(a.durationMs=r.durationMs);let u=r.result;g(c,a,{content:u.content.filter(h=>h.type!=="text"||!h.text.startsWith(`
33
+ `}}}r(be,"createIdeSettingsDocumentation");function ye(e){let t=new Map,u=new Set;return{api:{...e,registerTool:r(n=>{n.namespace?.name.startsWith("ide_")===!0&&t.set(n.name,{hide:r(()=>e.registerTool({...n,get description(){return n.description},get promptGuidelines(){return n.promptGuidelines},exposure:"hidden"}),"hide"),restore:r(()=>e.registerTool(n),"restore")}),u.has(n.name)?t.get(n.name)?.hide():e.registerTool(n)},"registerTool")},reconcile(n=!1,d=[],l=!1){let y=new Set,i=new Set;for(let g of e.getSettings().defaultTools??[])if(g.startsWith("-"))y.add(g.slice(1)),i.delete(g.slice(1));else{let v=g.startsWith("+")?g.slice(1):g;y.delete(v),i.add(v)}for(let[g,v]of t)y.has(g)!==u.has(g)&&(y.has(g)?(v.hide(),u.add(g)):(v.restore(),u.delete(g)));let R=e.getAllTools().filter(g=>g.exposure!=="hidden"),I=new Set(e.getActiveTools());for(let g of R)n&&!l&&t.has(g.name)&&(i.has(g.name)||g.exposure==="deferred"&&d.includes(g.name))&&I.add(g.name);n&&!y.has("tool_search")&&R.some(g=>g.name==="tool_search")&&R.some(g=>t.has(g.name)&&g.exposure==="deferred")&&I.add("tool_search");let s=e.getActiveTools(),c=[...I].filter(g=>!u.has(g));(c.length!==s.length||c.some(g=>!s.includes(g)))&&e.setActiveTools(c)}}}r(ye,"createIdeToolAvailability");import{ToolExecutionComponent as ve}from"@earendil-works/pi-coding-agent";import{Container as X,Spacer as Ee,Text as q}from"@earendil-works/pi-tui";import{isDeepStrictEqual as Xe}from"node:util";import{createCodemodeExtension as Ke}from"@earendil-works/pi-coding-agent";function we(e,t){let u=r(n=>{if(!n.startsWith("mcp__"))return;let d=e.getAllTools(),l=d.find(i=>i.name===n);if(!l||l.namespace||l.exposure==="hidden")return;let y=d.filter(i=>(t.has(i.name)&&i.namespace?.name.startsWith("ide_")===!0||i.name==="codemode"&&i.sourceInfo.source==="builtin"&&i.sourceInfo.path==="builtin:codemode")&&i.exposure!=="hidden"&&i.description===l.description&&Xe(i.parameters,l.parameters));return y.length===1?y[0]?.name:void 0},"source"),f;return e.registerToolRenderer((n,d)=>{let l=u(n);return l!=="codemode"?l===void 0?d():t.get(l):(f||Ke()({...e,registerTool:r(y=>{let{renderShell:i,renderCall:R,renderResult:I}=y;f={renderShell:i,renderCall:R,renderResult:I}},"registerTool")}),f??d())}),e.on("before_agent_start",()=>{for(let n of e.getAllTools()){let d=u(n.name),l=d===void 0?void 0:t.get(d);if(!l)continue;let y=Object.getOwnPropertyDescriptors(l);delete y.namespace,y.name={value:n.name,enumerable:!0,configurable:!0,writable:!0},y.exposure={value:n.exposure==="model-only"?n.exposure:"deferred",enumerable:!0,configurable:!0,writable:!0};let i=r(s=>{let c=l.prepareLoadout?.(s);return s.declared.some(g=>g.name===l.name)?{...c,hiddenDeclarations:[...c?.hiddenDeclarations??[],n.name]}:c},"prepareLoadout");y.prepareLoadout={value:i,enumerable:!0,configurable:!0,writable:!0};let R=r(async(s,c,g,v,a)=>{let{result:o,isError:m}=await a.executeTool(l.name,c,{signal:g,onUpdate:v}),{usage:h,...b}=o;return{...b,isError:m}},"execute");y.execute={value:R,enumerable:!0,configurable:!0,writable:!0};let I=Object.defineProperties({},y);e.registerTool(I)}}),u}r(we,"registerIdeAliasCompatibility");var K="ide-nested-results",xe=256,Ie=512*1024,Se=8*1024,Ze=32*1024,Qe=r(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function Te(e){let t=e.retention,u=[t?.argumentsTruncated&&"arguments shortened",t?.resultsOmitted&&"result displays omitted",t?.callsOmitted&&"call panels omitted",t?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(u.length>0)return`Nested IDE display: ${u.join("; ")}. Tool execution and parent output are unchanged.`;if(!t&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}r(Te,"retentionWarning");function et(e){let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let u=Math.floor(t),f=Math.floor(u/60);return f<60?`${f}m ${u%60}s`:`${Math.floor(f/60)}h ${f%60}m ${u%60}s`}r(et,"formatToolDuration");function Ae(e,t=!1){let u=new Map,f=we(e,u),n=new Map,d=new Map,l=new Map,y,i=new WeakMap,R=new WeakMap,I=r(a=>{let o=u.get(a),m=o?.renderResult;if(!o||!m)return o;let h=R.get(o);if(!h){let b=new WeakMap;h={...o,renderResult(w,S,p,P){let x=P.lastComponent&&b.get(P.lastComponent),C=m.call(o,w,S,p,{...P,lastComponent:x??P.lastComponent});if(S.isPartial||P.durationMs===void 0)return C;let T=new X;return T.addChild(C),T.addChild(new Ee(1)),T.addChild(new q(p.fg("muted",`Took ${et(P.durationMs)}`),0,0)),b.set(T,C),T}},R.set(o,h)}return h},"timedDefinition"),s=r((a,o,m)=>{o.result=m,o.resultOmitted=!1;try{let b=JSON.stringify(a);if(Buffer.byteLength(b)<=Ie){o.result=JSON.parse(JSON.stringify(m));return}}catch{}let h=m.details&&typeof m.details=="object"?Object.entries(m.details).filter(([b,w])=>(b==="source"||b==="fullOutputPath")&&typeof w=="string").map(([b,w])=>`${b}: ${String(w)}`):[];o.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...h].join(`
34
+ `)}],details:void 0,isError:m.isError},o.resultOmitted=!0},"retainResult"),c=r(()=>{n.clear(),d.clear(),l.clear()},"clear");e.on("session_start",(a,o)=>{c(),o.mode==="tui"&&o.ui.setWidget(K,m=>(y=m,{render:r(()=>[],"render"),invalidate:r(()=>{},"invalidate")}))}),e.on("session_tree",c),e.on("session_shutdown",c),e.on("tool_execution_start",(a,o)=>{if(a.parentToolCallId===void 0){let x=f(a.toolName);x!==void 0&&n.set(a.toolCallId,x);return}let m=d.get(a.parentToolCallId)??a.parentToolCallId;if(d.set(a.toolCallId,m),n.get(m)===a.toolName||!u.has(a.toolName))return;let h=l.get(m);if(h||(h={parentToolCallId:m,cwd:o.cwd,calls:[],retention:Qe()},l.set(m,h)),h.calls.length>=xe){h.retention.callsOmitted=!0;return}let b=JSON.stringify(a.args),w=Ze-h.calls.reduce((x,C)=>x+Buffer.byteLength(JSON.stringify(C.args)),0)-(xe-h.calls.length-1)*2,S=Buffer.byteLength(b)>Math.min(Se,w),p=S?Object.fromEntries(Object.entries(a.args).map(([x,C])=>[x,typeof C=="string"?C.slice(0,200)+(C.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(b),P=Buffer.byteLength(JSON.stringify(p))<=Math.min(Se,w)?p:{};h.calls.push({id:a.toolCallId,name:a.toolName,args:P,argumentsTruncated:S})}),e.on("tool_execution_end",a=>{n.delete(a.toolCallId);let o=d.get(a.toolCallId);if(o===void 0)return;d.delete(a.toolCallId);let m=l.get(o),h=m?.calls.find(b=>b.id===a.toolCallId);if(m&&h){typeof a.durationMs=="number"&&Number.isFinite(a.durationMs)&&(h.durationMs=a.durationMs);let b=a.result;s(m,h,{content:b.content.filter(w=>w.type!=="text"||!w.text.startsWith(`
35
35
 
36
36
  ---
37
37
 
38
- # Guide:`)),details:u.details,isError:r.isError})}}),e.on("message_end",r=>{if(r.message.role!=="toolResult")return;let n=y.get(r.message.toolCallId);if(!n)return;y.delete(r.message.toolCallId);for(let[h,w]of f)w===n.parentToolCallId&&f.delete(h);let c=n.calls.filter(h=>!h.batched),a={...n,parentToolName:r.message.toolName,calls:[],retention:{...n.retention,argumentsTruncated:c.some(h=>h.argumentsTruncated===!0),resultsOmitted:c.some(h=>h.resultOmitted===!0),resultsUnavailable:c.some(h=>!h.result)}},u=Buffer.byteLength(JSON.stringify(a));for(let h of c){let w=JSON.stringify(h);if(u+=Buffer.byteLength(w)+(a.calls.length>0?1:0),u>Oe){a.retention.callsOmitted=!0;break}a.calls.push(JSON.parse(w))}e.appendEntry(oe,a)}),e.registerEntryRenderer(oe,l(function r(n,c,a){if(!Array.isArray(n.data?.calls))return;let u=t&&n.data.parentToolName==="codemode"&&!c.expanded,h=u?n.data.calls.filter(I=>I.result?.isError):n.data.calls;if(u&&h.length===0){let I=_e(n.data);return I?new z(a.fg("warning",I),0,0):new ne}if(!E)return{render:l(I=>E?r(n,c,a)?.render(I)??[]:[],"render"),invalidate:l(()=>{n.data&&p.get(n.data)?.invalidate()},"invalidate")};let w=_e(n.data),m=u?void 0:p.get(n.data);if(!m){m=new ne;for(let I of h){let P=new Pe(I.name,I.id,I.renderArgs??I.args,{showImages:!0},I.resultOmitted||I.omitted||!I.result?void 0:v(I.name),E,n.data.cwd);I.result?P.updateResult({...I.result,...I.durationMs===void 0||I.groupedResult===!0?{}:{durationMs:I.durationMs}}):P.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),m.addChild(new Ce(1)),m.addChild(P)}w&&m.addChild(new z(a.fg("warning",w),0,0)),u||p.set(n.data,m)}let T=m.children.at(-1);w&&T instanceof z&&T.setText(a.fg("warning",w));for(let I of m.children)I instanceof Pe&&I.setExpanded(c.expanded);return m},"renderEntry"));let b=l(()=>{e.events.on(ye,r=>{let n=r,c=y.get(n.parentToolCallId);if(!c)return;let a=Z(n.result.details),u=n.calls.findLast(w=>!n.unchangedCopyCalls?.includes(w)),h="callIdsByResult"in a&&Array.isArray(a.callIdsByResult)?a.callIdsByResult:[];for(let w of n.calls){let m=c.calls.find(R=>R.id===w);if(!m)continue;let T=a.results?.filter((R,S)=>(h[S]===w||h.length===0&&n.calls.length===1)&&R.data.errors?.some(O=>O.code==="POST_WRITE_FAILED"||O.code==="POST_EDIT_FAILED"))??[];if(m.postWriteFailure=T.length>0,m.postWriteFailure){m.batched=!1,delete m.renderArgs,g(c,m,{content:n.result.content,details:{results:T,effect:"applied"},isError:!0});continue}let I=n.mutationResults?.get(w),P=I?.details.metadata?.copyRollback;if(m.name==="copy"&&I&&(P==="restored"||P==="failed")){m.copyRollback=P,m.batched=!1,g(c,m,{content:I.content,details:Z(I.details),isError:!0});continue}if(m.unchangedCopy=m.name==="copy"&&n.unchangedCopyCalls?.includes(w)===!0,m.batched=!m.unchangedCopy&&w!==u,m.groupedResult=!m.batched&&!m.unchangedCopy&&n.calls.filter(R=>!n.unchangedCopyCalls?.includes(R)).length>1,m.unchangedCopy)g(c,m,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1});else if(m.batched)m.result=void 0;else{new Set(a.mutationRender?.map(S=>S.path)).size>1&&(m.renderArgs={}),m.rollback=a.results?.some(S=>S.data.rollback!==void 0)===!0;let R=m.result?.details?.metadata?.targetUnavailable;g(c,m,{content:n.result.content,details:typeof R=="string"?{...a,metadata:{...a.metadata,targetUnavailable:R}}:a,isError:n.result.isError===!0||m.rollback})}}}),e.on("tool_result",r=>{let n=r.details,c=y.get(r.toolCallId);if(c&&n&&typeof n=="object"&&"editorBatchResults"in n&&Array.isArray(n.editorBatchResults))for(let a of n.editorBatchResults)for(let u of a.data?.operations??[]){let h=c.calls.find(m=>m.id===u.id);if(!h)continue;let w=u.errors.map(m=>m.message);h.rollback||h.postWriteFailure||h.copyRollback!==void 0||h.unchangedCopy&&w.length===0&&u.effect==="not-applied"||(w.length>0||u.effect!=="applied")&&(h.batched=!1,delete h.renderArgs,g(c,h,{content:[{type:"text",text:`${h.name}: ${u.effect}.
39
- ${w.join(`
40
- `)}`}],details:void 0,isError:w.length>0||u.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:l(r=>{d.set(r.name,r),e.registerTool(r)},"registerTool")},finalize:b}}l(De,"createNestedIdeRendering");import{createHash as Et}from"node:crypto";import{createCanvas as ht,loadImage as yt}from"@napi-rs/canvas";import{DEFAULT_MAX_BYTES as bt,DEFAULT_MAX_LINES as wt,truncateHead as xt}from"@earendil-works/pi-coding-agent";var N={bytes:bt,lines:wt,pixels:4e6,images:20,imageBytes:20*1024*1024};async function L(e,t="",d){let i=typeof t=="string"?[t]:t,o=[],f=e.flatMap(n=>{if(n.type!=="text")return[];let c=i.find(a=>a.length>0&&n.text.endsWith(a));return c?(o.push(c),[n.text.slice(0,-c.length)]):[n.text]}).join(`
41
- `),y=o.join(""),E=xt(f,{maxBytes:N.bytes,maxLines:N.lines}),p=[],A;if(E.truncated&&d!==void 0)try{A=await d(f)}catch{p.push("[Full output could not be saved. Narrow the request to inspect it.]")}E.truncated&&p.push(`[Output truncated: useful content is limited to ${N.bytes} bytes / ${N.lines} lines. Narrow the request or read a smaller source range.]`),A!==void 0&&p.push(`[Full output: ${JSON.stringify(A)}. Read with offset/limit, or read ${JSON.stringify("raw:"+A)} for byte ranges. Available until this runtime is disposed.]`);let v=e.filter(n=>n.type==="image"),g=v.slice(0,N.images),x=[],b=Math.floor(N.pixels/Math.max(1,g.length)),s=0,r=v.length-g.length;for(let[n,c]of g.entries())try{let a=Buffer.from(c.data,"base64"),u=await yt(a),h=Math.min(1,Math.sqrt(b/(u.width*u.height))),w=Math.min(b,Math.max(1,Math.floor(u.height*h))),m=Math.min(Math.floor(b/w),Math.max(1,Math.floor(u.width*h))),T=a,I=c.mimeType;if(h<1||s+T.byteLength>N.imageBytes){let P=ht(m,w);P.getContext("2d").drawImage(u,0,0,m,w),T=await P.encode("png"),I="image/png"}if(s+T.byteLength>N.imageBytes){r++;continue}s+=T.byteLength,x.push({type:"image",data:T.toString("base64"),mimeType:I}),h<1&&p.push(`[Image ${n+1} resized from ${u.width}x${u.height} to ${m}x${w} to fit the shared media budget.]`)}catch{r++,p.push(`[Image ${n+1} could not be decoded and was not returned.]`)}return r>0&&p.push(`[${r} images omitted from the result. Read fewer frames or a smaller image region.]`),{text:E.firstLineExceedsLimit?vt(f):E.content,textTruncated:E.truncated,images:x,notices:p,metadataSuffix:y,fullOutput:A}}l(L,"limitIdeOutput");function vt(e){let t=0,d=0;for(let i of e){let o=Buffer.byteLength(i);if(t+o>N.bytes)break;t+=o,d+=i.length}return e.slice(0,d)}l(vt,"bytePrefix");var je={type:"object",properties:{result:{type:"string",description:"Unchanged registered Search result. Pass this string to other tools to reuse its exact selection."},hasMatches:{anyOf:[{type:"boolean"},{type:"null"}],description:"Whether the original query reported matches, excluding spelling alternatives. Null means unknown. False proves absence only when complete is true."},complete:{anyOf:[{type:"boolean"},{type:"null"}],description:"Whether the search covered its requested scope, independent of display truncation. Null means unknown."}},required:["result","hasMatches","complete"],additionalProperties:!1};function $e(e,t){let d={result:t,hasMatches:null,complete:null};if(!Ne(e)||e.status!=="success"||!Ne(e.data))return d;let i=e.data,o=i.kind==="matches"?i.matches:i.kind==="files"?i.files:void 0;return!Array.isArray(o)||typeof i.complete!="boolean"?d:{result:t,hasMatches:o.length>0,complete:i.complete}}l($e,"searchFacts");function Ne(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}l(Ne,"record");var Be={read:["path"],search:["path"],select:["path"],replace:["path"],insert:["path"],delete:["path"],write:["path"],copy:["path","target"],move:["path","target"],undo:["file"],diff:["before","after"]},It=new Set(["write","replace","insert","delete","copy","move"]),St={anyOf:[{type:"string"},{type:"object",description:"Value returned by a resource provider, such as a computer action outcome.",additionalProperties:!0}]},Fe={type:"object",properties:{type:{const:"image"},data:{type:"string"},mimeType:{type:"string"},note:{type:"string"}},required:["type","data","mimeType","note"]},Tt={anyOf:[{type:"string"},Fe,{type:"object",description:"Several images, such as sequence frames, in source order.",properties:{type:{const:"images"},note:{type:"string"},images:{type:"array",items:{type:"object",properties:Fe.properties}}},required:["type","note","images"]}]};function At(e,t){let d=e.filter(o=>o.type==="image").map(({data:o,mimeType:f})=>({type:"image",data:o,mimeType:f}));if(d.length===0)return;let[i]=d;return d.length===1&&i!==void 0?{...i,note:t}:{type:"images",note:t,images:d}}l(At,"readValue");function Rt(e){let t=Y(e)?e.metadata:void 0,d=Y(t)?t.semanticAction:void 0,i=Y(d)?d.script:void 0;return Y(i)&&!Array.isArray(i)?i:void 0}l(Rt,"providerValue");function Y(e){return e!==null&&typeof e=="object"}l(Y,"record");function Le(e){let t=me(e),d=new Set,i=new ge,o=l(s=>i.saveFile(s),"saveFullOutput"),f=new Map,y=l(s=>Et("sha256").update(JSON.stringify(s)).digest("hex"),"signature"),E=l(async(s,r)=>{let n=y(r),c=f.get(s);if(c&&(c.source===n||y(await c.content)===n))return c.content;let a=L(r,"",o).then(u=>[{type:"text",text:u.text+(u.notices.length?`
42
-
43
- ${u.notices.join(`
44
- `)}`:"")},...u.images]);return f.set(s,{source:n,content:a}),a},"limitError");pe(e,{protocol:ue,apiVersion:fe,id:"ide-output-retention",setup(s){s.setOutputSaver(o)}}),e.on("session_shutdown",()=>i.dispose());let p=l((s,r)=>{if(s==="message_end"){let c=r;return e.on("message_end",async(a,u)=>{let h=await c(a,u),w=h?.message??a.message;return w.role!=="toolResult"||!w.isError||!d.has(w.toolName)||w.content.some(m=>m.type==="text"&&m.text.startsWith("<system-result"))?h:{...h,message:{...w,content:await E(w.toolCallId,w.content)}}})}let n=r;return s!=="tool_call"?e.on(s,n):e.on("tool_call",async(c,a)=>{let u=await n(c,a);if(!u?.block||!d.has(c.toolName)||u.reason===void 0)return u;let h=await L([{type:"text",text:u.reason}],"",o);return{...u,reason:h.text+(h.notices.length?`
45
-
46
- ${h.notices.join(`
47
- `)}`:"")}})},"on"),A=new Map,v=new Map,g=l(()=>{A.clear(),v.clear(),f.clear()},"clear");e.on("session_start",g),e.on("session_shutdown",g),e.on("before_agent_start",s=>{s.systemPromptOptions.sections.ide_results="Direct IDE calls return readable text. In Codemode, Search returns { result, hasMatches, complete }; pass its result string to other tools for composition. An image Read returns an image block: show it with image(), pass it to models.classify() images, and pass its note string to other tools. Other text results remain strings. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result string to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves results within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused."}),e.on("tool_execution_start",s=>{s.parentToolCallId!==void 0&&A.set(s.toolCallId,A.get(s.parentToolCallId)??s.parentToolCallId)}),p("tool_call",(s,r)=>{if(!d.has(s.toolName))return;let n={...s.input};try{for(let c of Be[s.toolName]??[]){let a=n[c];if(a!==void 0)if(s.toolName==="diff"&&a!==null&&typeof a=="object"&&"path"in a)n[c]={...a,path:t.source(a.path,r.cwd,!0)};else{let u=t.source(a,r.cwd,s.toolName==="read"?!0:["write","insert","delete"].includes(s.toolName)?"live":!1);if(s.toolName==="read"&&Array.isArray(u)){let h=t.resolve(u,r.cwd);n[c]=t.register(h.targets,r.cwd,h.complete)}else n[c]=u}}s.toolName==="select"&&n.operation&&typeof n.operation=="object"&&"scopes"in n.operation&&(n.operation={...n.operation,scopes:t.source(n.operation.scopes,r.cwd)});for(let c of["text","content"]){let a=n[c];if(typeof a=="string"&&(a.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(a)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(s.input,n)}catch(c){return{block:!0,reason:c instanceof Error?c.message:String(c)}}});let x=l(s=>{d.add(s.name);let r={},n=Object.getOwnPropertyDescriptors(s);delete n.outputSchema,s.name==="search"&&(n.outputSchema={value:je,enumerable:!0,configurable:!0,writable:!0}),s.name==="read"&&(n.outputSchema={value:Tt,enumerable:!0,configurable:!0,writable:!0}),It.has(s.name)&&(n.outputSchema={value:St,enumerable:!0,configurable:!0,writable:!0});let c=l(async(...h)=>{let w=await s.execute(...h).catch(async I=>{let P=await L([{type:"text",text:I instanceof Error?I.message:String(I)}],"",o);throw P.notices.length===0?I:new Error(P.text+`
48
-
49
- ${P.notices.join(`
50
- `)}`,{cause:I})}),m=await L(w.content,Ue(w.details),o),T=m.text+m.metadataSuffix;return{...w,content:[{type:"text",text:T+(m.notices.length?`
51
-
52
- ${m.notices.join(`
53
- `)}`:"")},...m.images]}},"execute");n.execute={value:c,enumerable:!0,configurable:!0,writable:!0};let a=s.renderCall;if(a){let h=l((w,m,T)=>a(Pt(s.name,w),m,T),"renderCall");n.renderCall={value:h,enumerable:!0,configurable:!0,writable:!0}}let u=s.renderResult;if(u){let h=l((w,m,T,I)=>u({...w,content:w.content.map(P=>P.type==="text"?{...P,text:P.text.replace(/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u,"")}:P)},m,T,I),"renderer");n.renderResult={value:h,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(r,n),e.registerTool(r)},"registerTool"),b=l(()=>{e.on("context",async s=>({messages:await Promise.all(s.messages.map(async r=>r.role!=="toolResult"||!r.isError||!d.has(r.toolName)||r.content.some(n=>n.type==="text"&&n.text.startsWith("<system-result"))?r:{...r,content:await E(r.toolCallId,r.content)}))})),e.on("tool_result",async(s,r)=>{if(s.toolName==="codemode"){t.refreshAll();let S=new Set(s.content.flatMap(k=>k.type==="image"?[k.data]:[])),O=(v.get(s.toolCallId)??[]).filter(k=>!S.has(k.data));v.delete(s.toolCallId);for(let[k,X]of A)X===s.toolCallId&&A.delete(k);let M=s.content.filter(k=>k.type==="text"&&k.text.startsWith(`
54
-
55
- ---
56
-
57
- # Guide:`)),U=s.content.filter(k=>!M.includes(k)),_=await L([...U,...O],"",o);return{content:[..._.textTruncated?[{type:"text",text:_.text}]:U.filter(k=>k.type==="text"),..._.images,..._.notices.length?[{type:"text",text:`
58
-
59
- ${_.notices.join(`
60
- `)}`}]:[],...M]}}if(!d.has(s.toolName))return;let n=s.content.filter(S=>S.type==="text").map(S=>S.text).join(`
61
- `),c=s.structuredContent,a=c!==null&&typeof c=="object"&&"data"in c?c:{status:s.isError?"error":"success",data:c},u=a.data,h=u!==null&&typeof u=="object"&&"effect"in u&&u.effect==="applied"&&"targetUnavailable"in u&&typeof u.targetUnavailable=="string"?u.targetUnavailable:void 0,w=h===void 0?n:`${n}
62
-
63
- This result has no verified text selection: ${h}
64
- Read/Search the file before the next edit; do not repeat the applied edit.`,m=We(a),T=t.publish(a,w,r.cwd,m),I=!s.isError&&a.status!=="error",P=s.toolName==="search"&&I?$e(a,T):s.toolName==="read"?I?At(s.content,T):void 0:Rt(s.details),R=A.get(s.toolCallId);if(A.delete(s.toolCallId),R!==void 0){let S=s.content.filter(O=>O.type==="image");S.length&&v.set(R,[...v.get(R)??[],...S])}return{content:[{type:"text",text:T},...s.content.filter(S=>S.type!=="text")],...P!==void 0&&{structuredContent:P}}})},"finalize");return{api:{...e,on:p,registerTool:x},finalize:b}}l(Le,"createIdeTextResults");function Ue(e){if(e===null||typeof e!="object")return[];let t="outputNotice"in e&&typeof e.outputNotice=="string"?[e.outputNotice]:[];if("resources"in e&&Array.isArray(e.resources)){let d=e.resources;for(let i of d)i!==null&&typeof i=="object"&&"details"in i&&t.push(...Ue(i.details))}return t}l(Ue,"outputNotices");function Pt(e,t){let d=l(o=>{if(Array.isArray(o))return o.map(d);if(typeof o!="string")return o;let f=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(o)?.[1];return f?`RESULT#${f}`:o},"label"),i={...t};for(let o of Be[e]??[])Object.assign(i,{[o]:d(t[o])});return i}l(Pt,"displaySources");function We(e){if(e===null||typeof e!="object"||!("data"in e))return[];let t=e.data;return t===null||typeof t!="object"?[]:"resources"in t&&Array.isArray(t.resources)?t.resources.flatMap(i=>We({data:i})):"files"in t&&Array.isArray(t.files)?t.files.flatMap(i=>i!==null&&typeof i=="object"&&"source"in i&&typeof i.source=="string"&&/^(?:shell|debug):/u.test(i.source)?[i.source]:[]):"source"in t&&typeof t.source=="string"?[t.source]:[]}l(We,"resultResources");function qe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}l(qe,"isRecord");function Ge(e,t){if(!qe(e)||!Array.isArray(e.tools))return e;let d=e.tools,i=d.map(o=>!qe(o)||o.type!=="function"||typeof o.name!="string"||!t.has(o.name)||o.strict!==void 0?o:{...o,strict:!1});return i.some((o,f)=>o!==d[f])?{...e,tools:i}:e}l(Ge,"preserveResponsesToolOmission");function Ve(e,t,d){let i=new Map,o=[],f=[];function y(v,g){le(v,g);for(let x of g){let b=i.get(x.id);if(b)throw new Error(`Setting ${x.id} is already registered by ${b.owner}`)}for(let x of g)if(i.set(x.id,{owner:v,definition:x}),x.kind==="boolean"){let{kind:b,group:s,...r}=x;o.push({...r,...s==="ui"?{group:s}:{}})}else f.push({...x,group:x.group??"features"})}l(y,"register"),y("pi-agent-ide",[...t.map(v=>({...v,kind:"boolean"})),...d]);async function E(v,g){let x=i.get(v)?.definition;if(!x)throw new Error(`Unknown Agent IDE setting: ${v}`);let b=B(process.env,void 0,g),[s,r]=await Promise.all([j(b.globalPath),j(b.projectPath)]),n=x.kind==="boolean"?{...q(s),...q(r)}:{...s.preferences,...r.preferences},c=Object.hasOwn(n,v),a=c?n[v]:x.default;if(a===void 0||(x.kind==="boolean"?typeof a!="boolean":typeof a!="string"))throw new Error(`Invalid saved setting type: ${v}`);if(x.kind==="choice"&&!x.values.some(u=>u.value===a))throw new Error(`Invalid saved setting choice: ${v}`);return{value:a,overridden:c}}l(E,"read");let p=e.events.on(re,v=>{let g=v;try{y(g.owner,g.definitions),g.accept()}catch(x){g.accept(x instanceof Error?x:new Error(String(x)))}}),A=e.events.on(ie,v=>{let g=v;g.accept(E(g.id,g.cwd))});return e.on("session_shutdown",()=>{p(),A()}),e.events.emit(ae,void 0),{flags:o,preferences:f,read:E}}l(Ve,"createAgentIdeSettingsRegistry");import{VERSION as Ye}from"@earendil-works/pi-coding-agent";import{getCurrentTools as Ct}from"@earendil-works/pi-ai";function Je(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e);if(t===null||se(t,[0,99,1])<0||ze(t,[0,99,1]))throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${e}. Update Pi before loading the extension.`)}l(Je,"assertSupportedHost");function He(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?/u.exec(e);return t!==null&&se(t,[1,3,0])>=0&&!ze(t,[1,3,0])}l(He,"hostOwnsToolLoadout");function se(e,t){return e.slice(1,4).map((d,i)=>Number(d)-(t[i]??0)).find(d=>d!==0)??0}l(se,"compareVersion");function ze(e,t){return se(e,t)===0&&e[4]!==void 0}l(ze,"isPrereleaseOf");async function kt(e){Je(Ye);let t=await he(B()),d=t.preferences?.["ui.codemode"]!=="on",i=De(e,d),o=Le(i.api),f=Ae(o.api);e.on("before_provider_request",(v,g)=>{if(g.model?.api!=="openai-responses")return;let x=new Set(e.getAllTools().filter(b=>b.namespace?.name.startsWith("ide_")).map(b=>b.name));return Ge(v.payload,x)}),e.on("session_start",(v,g)=>{if(He(Ye)){f.reconcile(!0,[],!0);return}let x=v.reason==="reload"?[]:Ct(g.sessionManager.getBranch().flatMap(b=>b.type==="message"?[b.message]:[])).map(b=>b.name);f.reconcile(!0,x)}),e.on("before_agent_start",v=>{f.reconcile();let g=v.systemPromptOptions;g.toolSnippets.bash&&(g.toolSnippets.bash=g.toolSnippets.bash.replace("Execute bash commands (ls, grep, find, etc.)","Execute Bash commands"));let x=/^<rules>\n([\s\S]*?)\n<\/rules>$/mu.exec(v.systemPrompt)?.[1];x?.includes("- Use bash for file operations like ls, rg, find")&&(g.sections.rules=x.replace(/(?:^|\n)- Use bash for file operations like ls, rg, find(?=\n|$)/u,"").trim());let b=e.getAllTools().filter(a=>a.exposure!=="hidden"),s=e.getActiveTools(),r=s.includes("tool_search")?"Use tool_search to find":s.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",n=b.filter(a=>a.namespace?.name==="ide_git").map(a=>a.name),c=[...n.length===0?[]:[`${r} ${n.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...b.some(a=>a.name==="debug"&&a.namespace?.name==="ide_debug")?[`${r} debug in ide_debug when creating a debugger session.`]:[]];g.sections.ide_discovery=c.join(`
65
- `)});let y=Se(e,{"pi-agent-ide-no-animations":t.noAnimations??!1,"pi-agent-ide-no-post-processing":t.noPostProcessing??!1,...t.flags});y.register({id:"pi-agent-ide-developer-mode",name:"Developer mode",description:"Enable development commands, including manual setup-hint previews.",default:!1}),y.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),y.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),y.register({id:"pi-agent-ide-vision-arbitrary-windows",name:"Capture arbitrary windows",description:"Allow window:PID capture for processes not owned by Agent IDE. Keep disabled unless the agent may inspect other desktop apps.",default:!1}),y.register({id:"pi-agent-ide-vision-displays",name:"Capture full displays",description:"Allow display screenshots through display: and display:#N resources. Keep disabled unless the agent may inspect the full desktop.",default:!1}),y.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),y.register({id:"pi-agent-ide-code-review",name:"Jev code review",description:"Review saved edit fragments against project YAML rules in the background. Sends code to a connected Jev provider.",default:!1}),y.register({id:"pi-agent-ide-code-review-capture",name:"Capture code-review rules",description:"Use the packaged skill to propose reusable rules from user review feedback. Save only after confirmation.",default:!1});let E=Ve(e,[...y.definitions,{id:"pi-agent-ide-yolo",name:"YOLO: allow all operations",description:"Skip existing operation confirmation dialogs unless an extension explicitly disables its YOLO setting. Safety checks and remote permissions still apply.",default:!1,labels:{on:"on",off:"off"}},{id:"pi-agent-ide-filesystem-yolo",name:"YOLO: filesystem operations",description:"Skip filesystem operation confirmations. Default inherits common YOLO; Off disables persistent permission, not remembered session grants. Protected paths stay protected.",default:!1,labels:{on:"on",off:"off"}}],V);de(e,{async isAllowed(v,g){if(v.yoloSetting===void 0)return!1;let x=await K(e.events,v.yoloSetting,g.cwd);if(typeof x.value!="boolean")throw new Error(`Operation approval needs a boolean YOLO setting: ${v.yoloSetting}`);return x.overridden?x.value:(await K(e.events,"pi-agent-ide-yolo",g.cwd)).value===!0}}),Ee(e,E.flags,E.preferences),Ie(e),ce(e,[Te(E.flags,E.preferences)]);let p=W(D,t.preset??"full"),{enabled:A}=J(D,[...p,...t.disabled],t.enabled);for(let v of A)await v.register(f.api,{preferences:t.preferences??{}});i.finalize(),o.finalize()}l(kt,"registerUnifiedPiAgentIde");export{kt as default};
38
+ # Guide:`)),details:b.details,isError:a.isError})}}),e.on("message_end",a=>{if(a.message.role!=="toolResult")return;let o=l.get(a.message.toolCallId);if(!o)return;l.delete(a.message.toolCallId);for(let[w,S]of d)S===o.parentToolCallId&&d.delete(w);let m=o.calls.filter(w=>!w.batched),h={...o,parentToolName:a.message.toolName,calls:[],retention:{...o.retention,argumentsTruncated:m.some(w=>w.argumentsTruncated===!0),resultsOmitted:m.some(w=>w.resultOmitted===!0),resultsUnavailable:m.some(w=>!w.result)}},b=Buffer.byteLength(JSON.stringify(h));for(let w of m){let S=JSON.stringify(w);if(b+=Buffer.byteLength(S)+(h.calls.length>0?1:0),b>Ie){h.retention.callsOmitted=!0;break}h.calls.push(JSON.parse(S))}e.appendEntry(K,h)}),e.registerEntryRenderer(K,r(function a(o,m,h){if(!Array.isArray(o.data?.calls))return;let b=t&&o.data.parentToolName==="codemode"&&!m.expanded,w=b?o.data.calls.filter(x=>x.result?.isError):o.data.calls;if(b&&w.length===0){let x=Te(o.data);return x?new q(h.fg("warning",x),0,0):new X}if(!y)return{render:r(x=>y?a(o,m,h)?.render(x)??[]:[],"render"),invalidate:r(()=>{o.data&&i.get(o.data)?.invalidate()},"invalidate")};let S=Te(o.data),p=b?void 0:i.get(o.data);if(!p){p=new X;for(let x of w){let C=new ve(x.name,x.id,x.renderArgs??x.args,{showImages:!0},x.resultOmitted||x.omitted||!x.result?void 0:I(x.name),y,o.data.cwd);x.result?C.updateResult({...x.result,...x.durationMs===void 0||x.groupedResult===!0?{}:{durationMs:x.durationMs}}):C.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),p.addChild(new Ee(1)),p.addChild(C)}S&&p.addChild(new q(h.fg("warning",S),0,0)),b||i.set(o.data,p)}let P=p.children.at(-1);S&&P instanceof q&&P.setText(h.fg("warning",S));for(let x of p.children)x instanceof ve&&x.setExpanded(m.expanded);return p},"renderEntry"));let g=r(()=>{e.events.on(re,a=>{let o=a,m=l.get(o.parentToolCallId);if(!m)return;let h=J(o.result.details),b=o.calls.findLast(S=>!o.unchangedCopyCalls?.includes(S)),w="callIdsByResult"in h&&Array.isArray(h.callIdsByResult)?h.callIdsByResult:[];for(let S of o.calls){let p=m.calls.find(T=>T.id===S);if(!p)continue;let P=h.results?.filter((T,E)=>(w[E]===S||w.length===0&&o.calls.length===1)&&T.data.errors?.some(k=>k.code==="POST_WRITE_FAILED"||k.code==="POST_EDIT_FAILED"))??[];if(p.postWriteFailure=P.length>0,p.postWriteFailure){p.batched=!1,delete p.renderArgs,s(m,p,{content:o.result.content,details:{results:P,effect:"applied"},isError:!0});continue}let x=o.mutationResults?.get(S),C=x?.details.metadata?.copyRollback;if(p.name==="copy"&&x&&(C==="restored"||C==="failed")){p.copyRollback=C,p.batched=!1,s(m,p,{content:x.content,details:J(x.details),isError:!0});continue}if(p.unchangedCopy=p.name==="copy"&&o.unchangedCopyCalls?.includes(S)===!0,p.batched=!p.unchangedCopy&&S!==b,p.groupedResult=!p.batched&&!p.unchangedCopy&&o.calls.filter(T=>!o.unchangedCopyCalls?.includes(T)).length>1,p.unchangedCopy)s(m,p,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1});else if(p.batched)p.result=void 0;else{new Set(h.mutationRender?.map(E=>E.path)).size>1&&(p.renderArgs={}),p.rollback=h.results?.some(E=>E.data.rollback!==void 0)===!0;let T=p.result?.details?.metadata?.targetUnavailable;s(m,p,{content:o.result.content,details:typeof T=="string"?{...h,metadata:{...h.metadata,targetUnavailable:T}}:h,isError:o.result.isError===!0||p.rollback})}}}),e.on("tool_result",a=>{let o=a.details,m=l.get(a.toolCallId);if(m&&o&&typeof o=="object"&&"editorBatchResults"in o&&Array.isArray(o.editorBatchResults))for(let h of o.editorBatchResults)for(let b of h.data?.operations??[]){let w=m.calls.find(p=>p.id===b.id);if(!w)continue;let S=b.errors.map(p=>p.message);w.rollback||w.postWriteFailure||w.copyRollback!==void 0||w.unchangedCopy&&S.length===0&&b.effect==="not-applied"||(S.length>0||b.effect!=="applied")&&(w.batched=!1,delete w.renderArgs,s(m,w,{content:[{type:"text",text:`${w.name}: ${b.effect}.
39
+ ${S.join(`
40
+ `)}`}],details:void 0,isError:S.length>0||b.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:r(a=>{u.set(a.name,a),e.registerTool(a)},"registerTool")},finalize:g}}r(Ae,"createNestedIdeRendering");function Re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(Re,"isRecord");function Pe(e,t){if(!Re(e)||!Array.isArray(e.tools))return e;let u=e.tools,f=u.map(n=>!Re(n)||n.type!=="function"||typeof n.name!="string"||!t.has(n.name)||n.strict!==void 0?n:{...n,strict:!1});return f.some((n,d)=>n!==u[d])?{...e,tools:f}:e}r(Pe,"preserveResponsesToolOmission");function Ce(e,t,u){let f=new Map,n=[],d=[];function l(I,s){de(I,s);for(let c of s){let g=f.get(c.id);if(g)throw new Error(`Setting ${c.id} is already registered by ${g.owner}`)}for(let c of s)if(f.set(c.id,{owner:I,definition:c}),c.kind==="boolean"){let{kind:g,group:v,...a}=c;n.push({...a,...v==="ui"?{group:v}:{}})}else d.push({...c,group:c.group??"features"})}r(l,"register"),l("pi-agent-ide",[...t.map(I=>({...I,kind:"boolean"})),...u]);async function y(I,s){let c=f.get(I)?.definition;if(!c)throw new Error(`Unknown Agent IDE setting: ${I}`);let g=$(process.env,void 0,s),[v,a]=await Promise.all([_(g.globalPath),_(g.projectPath)]),o=c.kind==="boolean"?{...B(v),...B(a)}:{...v.preferences,...a.preferences},m=Object.hasOwn(o,I),h=m?o[I]:c.default;if(h===void 0||(c.kind==="boolean"?typeof h!="boolean":typeof h!="string"))throw new Error(`Invalid saved setting type: ${I}`);if(c.kind==="choice"&&!c.values.some(b=>b.value===h))throw new Error(`Invalid saved setting choice: ${I}`);return{value:h,overridden:m}}r(y,"read");let i=e.events.on(se,I=>{let s=I;try{l(s.owner,s.definitions),s.accept()}catch(c){s.accept(c instanceof Error?c:new Error(String(c)))}}),R=e.events.on(ie,I=>{let s=I;s.accept(y(s.id,s.cwd))});return e.on("session_shutdown",()=>{i(),R()}),e.events.emit(ae,void 0),{flags:n,preferences:d,read:y}}r(Ce,"createAgentIdeSettingsRegistry");import{VERSION as _e}from"@earendil-works/pi-coding-agent";import{getCurrentTools as tt}from"@earendil-works/pi-ai";function ke(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e);if(t===null||Z(t,[0,99,1])<0||Oe(t,[0,99,1]))throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${e}. Update Pi before loading the extension.`)}r(ke,"assertSupportedHost");function De(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?/u.exec(e);return t!==null&&Z(t,[1,3,0])>=0&&!Oe(t,[1,3,0])}r(De,"hostOwnsToolLoadout");function Z(e,t){return e.slice(1,4).map((u,f)=>Number(u)-(t[f]??0)).find(u=>u!==0)??0}r(Z,"compareVersion");function Oe(e,t){return Z(e,t)===0&&e[4]!==void 0}r(Oe,"isPrereleaseOf");async function nt(e){ke(_e);let t=await le($()),u=t.preferences?.["ui.codemode"]!=="on",f=Ae(e,u),n=ne(f.api),d=ye(n.api),l=!1;e.on("session_shutdown",()=>{l=!0}),e.on("before_provider_request",(s,c)=>{if(l||c.model?.api!=="openai-responses")return;let g=new Set(e.getAllTools().filter(v=>v.namespace?.name.startsWith("ide_")).map(v=>v.name));return Pe(s.payload,g)}),e.on("session_start",(s,c)=>{if(l=!1,De(_e)){d.reconcile(!0,[],!0);return}let g=s.reason==="reload"?[]:tt(c.sessionManager.getBranch().flatMap(v=>v.type==="message"?[v.message]:[])).map(v=>v.name);d.reconcile(!0,g)}),e.on("before_agent_start",s=>{d.reconcile();let c=s.systemPromptOptions;c.toolSnippets.bash&&(c.toolSnippets.bash=c.toolSnippets.bash.replace("Execute bash commands (ls, grep, find, etc.)","Execute Bash commands"));let g=/^<rules>\n([\s\S]*?)\n<\/rules>$/mu.exec(s.systemPrompt)?.[1];g?.includes("- Use bash for file operations like ls, rg, find")&&(c.sections.rules=g.replace(/(?:^|\n)- Use bash for file operations like ls, rg, find(?=\n|$)/u,"").trim());let v=e.getAllTools().filter(b=>b.exposure!=="hidden"),a=e.getActiveTools(),o=a.includes("tool_search")?"Use tool_search to find":a.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",m=v.filter(b=>b.namespace?.name==="ide_git").map(b=>b.name),h=[...m.length===0?[]:[`${o} ${m.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...v.some(b=>b.name==="debug"&&b.namespace?.name==="ide_debug")?[`${o} debug in ide_debug when creating a debugger session.`]:[]];c.sections.ide_discovery=h.join(`
41
+ `)});let y=he(e,{"pi-agent-ide-no-animations":t.noAnimations??!1,"pi-agent-ide-no-post-processing":t.noPostProcessing??!1,...t.flags});y.register({id:"pi-agent-ide-developer-mode",name:"Developer mode",description:"Enable development commands, including manual setup-hint previews.",default:!1}),y.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),y.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),y.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),y.register({id:"pi-agent-ide-code-review",name:"Jev code review",description:"Review saved edit fragments against project YAML rules in the background. Sends code to a connected Jev provider.",default:!1}),y.register({id:"pi-agent-ide-code-review-capture",name:"Capture code-review rules",description:"Use the packaged skill to propose reusable rules from user review feedback. Save only after confirmation.",default:!1});let i=Ce(e,[...y.definitions,{id:"pi-agent-ide-yolo",name:"YOLO: allow all operations",description:"Skip existing operation confirmation dialogs unless an extension explicitly disables its YOLO setting. Safety checks and remote permissions still apply.",default:!1,labels:{on:"on",off:"off"}},{id:"pi-agent-ide-filesystem-yolo",name:"YOLO: filesystem operations",description:"Skip filesystem operation confirmations. Default inherits common YOLO; Off disables persistent permission, not remembered session grants. Protected paths stay protected.",default:!1,labels:{on:"on",off:"off"}}],G);te(e,{async isAllowed(s,c){if(s.yoloSetting===void 0)return!1;let g=await Y(e.events,s.yoloSetting,c.cwd);if(typeof g.value!="boolean")throw new Error(`Operation approval needs a boolean YOLO setting: ${s.yoloSetting}`);return g.overridden?g.value:(await Y(e.events,"pi-agent-ide-yolo",c.cwd)).value===!0}}),pe(e,i.flags,i.preferences),me(e),oe(e,[be(i.flags,i.preferences)]);let R=j(D,t.preset??"full"),{enabled:I}=U(D,[...R,...t.disabled],t.enabled);for(let s of I)await s.register(d.api,{preferences:t.preferences??{}});f.finalize(),n.finalize()}r(nt,"registerUnifiedPiAgentIde");export{nt as default};
@@ -0,0 +1,58 @@
1
+ # Syntax search with ast_search
2
+
3
+ `ast_search` runs ast-grep in files or inside a Read, Search or edit result. It works for every language ast-grep supports.
4
+
5
+ ## Patterns
6
+
7
+ Pass `pattern` in source-code syntax. `$NAME` captures one node and `$$$ARGS` captures several, including their punctuation. A pattern must parse as code in the file's language.
8
+
9
+ Each match shows a `SEARCH#...:N:match` reference and a `capture NAME: RESULT#...` reference per capture. Pass either to Read, Search or an edit tool; a capture selects exactly its nodes, such as a function body or an argument list. `SEARCH#...:all:match` selects every match of a complete result. A single-match reference goes stale when its file changes; repeat the search.
10
+
11
+ ```js
12
+ const calls = await tools.ast_search({ path: "client.ts", pattern: "request($OPTIONS)" });
13
+ text(calls.result);
14
+ ```
15
+
16
+ ## Rules
17
+
18
+ Pass `rule` with `language` for relations a pattern cannot express. `rule` is the value of `rule:` in an ast-grep rule file, as a JSON object: `pattern`, `kind`, `regex`, `inside`, `has`, `not`, `all`, `any`, `follows`, `precedes`. A relational rule needs `stopBy: "end"` to look past the nearest parent or child, and `stopBy: { kind: ... }` to stop at a boundary.
19
+
20
+ Calls to `send` in the own body of `outer`, skipping nested functions:
21
+
22
+ ```json
23
+ {
24
+ "language": "python",
25
+ "rule": {
26
+ "pattern": "send($$$)",
27
+ "inside": {
28
+ "kind": "function_definition",
29
+ "stopBy": { "kind": "function_definition" },
30
+ "has": { "field": "name", "regex": "^outer$" }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ Node kinds are tree-sitter names and differ by language, for example `function_declaration`, `method_definition` and `arrow_function` in TypeScript, `function_definition` in Python. An unknown kind fails with an explicit error.
37
+
38
+ ## Enclosing constructs
39
+
40
+ Pass a Read, Search or edit result as `path` and `relation: "enclosing"` to get the innermost match that contains each of its ranges. Starting from a text match:
41
+
42
+ ```js
43
+ const hit = await tools.search({ path: "src/app.ts", query: '"connection lost"' });
44
+ const fn = await tools.ast_search({
45
+ path: hit.result,
46
+ relation: "enclosing",
47
+ language: "typescript",
48
+ rule: {
49
+ any: [
50
+ { kind: "function_declaration" },
51
+ { kind: "method_definition" },
52
+ { kind: "arrow_function" },
53
+ ],
54
+ },
55
+ });
56
+ ```
57
+
58
+ Without `relation`, a result scope keeps only matches wholly inside its ranges; matches are never clipped.
@@ -6,4 +6,4 @@ Read stopped state before the next action. Use `views: ["breakpoints"]` when bre
6
6
 
7
7
  A session reporting adapter `vscode` runs in the user's VS Code window through DebugMCP; the same resources and actions apply. Its breakpoints and debug session are visible to the user. It shows aggregate values as `<complex value>`; evaluate an expression that formats the value, such as `repr(items)` in Python, to read it. Use `configuration` to launch a `.vscode/launch.json` entry when the program needs arguments or environment or is a compiled executable, and `test` to debug one test. Pass `backend: "native"` with an `adapter` to keep debugging outside VS Code. If `backend: "vscode"` fails, its error names the unmet condition; open the workspace in VS Code or use the native backend.
8
8
 
9
- Use an SSH `cwd` to create a target-owned session. Relative program and source paths resolve on that workspace; returned source files and frames keep canonical SSH identities. Launch needs the selected native adapter on the target. Unsupported target recipes fail without using a controller adapter. Delete the session to stop its owned transport; do not signal a target PID as if it were local.
9
+ Use an SSH `cwd` to debug on a remote target (see `docs:ssh`); the adapter must be installed there.
@@ -1,72 +1,40 @@
1
- # Precise text editing
1
+ # Editing
2
2
 
3
- Use standalone `replace`, `insert`, `delete`, `copy`, and `move` when each change is known in advance and does not depend on another change. Submit independent calls together in one response. Use native Codemode for computed or dependent composition; it does not add grouped rollback.
3
+ ## Select text
4
4
 
5
- Use `write` only to create a file or deliberately replace all its contents. Use `diff` for read-only comparison.
5
+ - `LINE#HASH` from `read` with `views: ["anchors"]` selects a line. `scope-begin-HASH` / `scope-end-HASH` from the `ast` view select a syntax block. `SEARCH#…:line` selects a search match's line, `SEARCH#…:match` the match itself. `begin` and `end` select the first and last line.
6
+ - Without an anchor, use the shortest unique exact text.
7
+ - With `start` and `end`, the selection runs from the start of `start` to the end of `end`. Exact text keeps character boundaries; line anchors take whole lines. When both `start` and `end` match complete lines, such as BEGIN/END marker lines, the selection takes those lines whole.
8
+ - After an exact-text selector fails, exact text is blocked for that file until an anchor-based edit succeeds. Use one of the anchors the error returns; don't guess another string.
9
+ - Anchors and results go stale when their file changes. Read or search again before reusing them.
6
10
 
7
- ## Select the intended text
11
+ ## Pass results between tools
8
12
 
9
- Use a returned anchor when it identifies the intended text. Otherwise use the smallest unique exact string.
13
+ Pass a result unchanged as `path` (outside Codemode its UUID also works). It selects exactly what it returned:
10
14
 
11
- - `LINE#HASH` selects a current source line from the `anchors` view.
12
- - `scope-begin-HASH` and `scope-end-HASH` mark syntax boundaries from the `ast` view.
13
- - `SEARCH#...:line` selects a complete containing line; `SEARCH#...:match` selects the exact match.
14
- - `begin` and `end` select the first and last existing lines.
15
- - A unique exact string selects that fragment.
15
+ - read: its window; search: its matches;
16
+ - replace and insert: the new text; copy and move: the destination text;
17
+ - write and undo: the whole file; delete: nothing.
16
18
 
17
- With `end`, the operation covers complete lines from the first line containing `start` through the last line containing `end`, inclusive. Without `end`, an exact string selects just that fragment.
19
+ In Codemode, `search` returns `{ result, hasMatches, complete }`: pass `result` on. `hasMatches: false` proves absence only when `complete` is `true`. A failed read resolves to `{ status: "error", errors }` instead of rejecting. An image read returns an image block; pass it to `write` as `content` to save it.
18
20
 
19
- After an exact-text selector fails, exact-text edits are blocked for that file, except for Copy destination selectors (`targetStart` and `targetEnd`). Find the intended location among the returned current anchors, or use Read/Search for another section. Edit with its anchor. After that edit succeeds, exact text is available again. Do not retry a guessed string.
21
+ ## Batches and Codemode
20
22
 
21
- Re-read after a mutation before reusing line, scope, or individual Search anchors. Complete `SEARCH#...:all` selections retain their existing query-refresh behavior.
23
+ - Parallel calls in one response all see the files as they were before the batch. Put overlapping changes into one call.
24
+ - A rejected call doesn't cancel the others. Retry only what failed.
25
+ - In Codemode, await edits on different files concurrently and on the same file in order. Failed tools reject: use `Promise.allSettled` when calls may fail.
26
+ - An error is not proof that nothing was written. After a failure or interruption, read the file before retrying.
22
27
 
23
- ## Compose results
28
+ ## Files and directories
24
29
 
25
- Direct results are readable text with a leading system-result envelope. In Codemode, Search returns facts and a `result` string. An image Read returns an image block `{ type: "image", data, mimeType, note }`, or `{ type: "images", note, images }` for several frames; show it with `image()` and pass its `note` string to other tools. Other text results remain strings. The envelope is an internal reference, not file content. Do not edit it or write it into a file. Pass the unchanged result string to another source parameter; outside Codemode you can also pass its UUID. Store/load keeps results in the current session. Read `docs:search-code` for the Search facts.
30
+ - `delete`, `copy` and `move` with a plain path and no `start` act on the whole file, directory or symlink. Symlinks are handled as links, never followed.
31
+ - Copying a directory merges into the target; moving one replaces the target. Recursive transfers have no rollback.
32
+ - Deleting a directory or symlink can ask the user for confirmation; read `docs:ide-settings` if they want to change that.
26
33
 
27
- Read results select their requested source windows. Search results select exact matches. Select derives new boundaries. A displayed item reference selects that item; the whole result retains all selections, including those omitted from its preview.
34
+ ## Blank lines
28
35
 
29
- - `replace.path` replaces selected ranges. `delete.path` removes selected text but keeps the file, even for a whole-file selection.
30
- - `write.path` and `undo.file` require one whole-file selection. Partial and multi-file scopes are rejected, not widened.
31
- - `copy.path` / `move.path` select source ranges; `target` selects destination ranges. A zero-width destination inserts. Arrays pair in declared order, with equal counts and duplicates removed. Unequal counts and overlapping moves are rejected.
32
- - Move succeeds without writes for valid empty arrays and paired zero-width selections. Empty arrays return no selection; paired points return only the unchanged destination points. The usual validation and overlap guards still apply.
33
- - Ordinary filesystem paths without selectors copy or move one whole object: a regular file, directory tree, or symlink. Result inputs remain text selections; a directory listing does not authorize a whole-directory transfer.
34
- - `insert` uses line-based insertion before or after its selected containing lines.
36
+ `insert` with `separation: "blank-line"` puts the text in its own paragraph: inserting `X` after `A` in `A\nB` gives `A\n\nX\n\nB`.
35
37
 
36
- Replace/insert results select their resulting text, including supplied line separators. Empty replacement selects the resulting position, not removed text. Copy/move results select only destination text. Whole regular-text-file transfers and write select the whole destination; undo selects restored files. Delete and binary operations provide no reusable text selection. If a result cannot supply a verified selection, inspect the file instead.
38
+ ## Live resources
37
39
 
38
- Results are strict snapshots. Changed files permanently retire their old IDs, even if the old bytes are restored later. Session changes and reloads also retire IDs. Empty selections are valid no-ops; incomplete or expired selections cannot authorize edits. Diff text and invented coordinates do not grant source authority.
39
-
40
- ## Whole filesystem objects
41
-
42
- Use ordinary paths without text selectors for whole-object Delete, Copy, and Move. Delete removes directory contents recursively and unlinks symlinks without following their targets. Copy merges directory contents into the exact target directory and keeps destination-only entries. Move replaces an existing target directory and removes destination-only entries. Both transfers create missing parents, preserve file bytes and symlink text, and reject symlink destinations, type conflicts, and overlapping trees. Relative links keep their text; moving them can change what they point to.
43
-
44
- Directory and symlink transfers have no reusable text selection. Read their ordinary paths to inspect them. A failure before filesystem execution reports `not-applied`; a failure after execution starts reports `unknown`. Inspect both paths before retrying an unknown transfer. Recursive transfers and cross-device Move have no atomic rollback. Cancellation before execution prevents a transfer; in-flight filesystem work may finish.
45
-
46
- ## Line separation
47
-
48
- Use `separation: "blank-line"` for a separate paragraph or section; use default line mode for adjacent code, list items, or a continuation. Inserting `X` after `A` in `A\nB` with blank-line separation produces `A\n\nX\n\nB`.
49
-
50
- ## Writes and failures
51
-
52
- When Write changes or creates a file, it saves the file and finishes post-edit processing before returning, including in Codemode. If an existing file already matches the supplied content, Write returns its whole-file selection without writing or running post-edit handlers. Earlier pending edits commit before Write. Other eligible text edits keep their pending-batch behavior.
53
-
54
- Independent calls share the original snapshots. Combine overlapping edits into one mutation. A rejected call does not cancel successful peers; retry only unapplied changes.
55
-
56
- An omitted path can inherit the file identified by an anchor, the last read, or the preceding edit in the batch. Supply the path when that would be ambiguous.
57
-
58
- An ordinary `delete.path` without selectors deletes a whole file, directory, or symlink. Directory and link deletion applies Git protection and the shared host permission policy. User-configured YOLO or a remembered session grant can skip its dialog; no tool argument supplies approval. Protected paths, hooks and target revalidation still apply. Without UI, gated operations fail closed unless YOLO or a session grant permits them. Read `docs:ide-settings` when the user asks to change confirmation settings. Links are unlinked without following their targets. A result input removes only selected text. Ordinary copy/move paths without selectors transfer whole regular files and replace an existing regular destination file.
59
-
60
- Inside Codemode, await independent edits on disjoint resources concurrently and overlapping resources in order. Pass a pending edit result directly to another source tool for dependent work; that boundary commits the batch before consuming the result.
61
-
62
- Failed tools reject in Codemode. Use try/catch or Promise.allSettled when independent calls may fail. Inspect the parent result for actual committed effects: an acceptance is not proof of writing, and an error is not proof of rollback. Read the affected files when the result cannot confirm their final state.
63
-
64
- After an interruption, read the affected files before retrying. Retry only unapplied edits.
65
-
66
- ## Specialized resources
67
-
68
- - `shell:<session>`: write sends exact input, insert sends keys, delete terminates the session.
69
- - `debug:<session>`: insert controls the debugger; delete removes a breakpoint or terminates it.
70
- - `symbol:<file>#<selector>#name`: replace performs a native language-server rename when available.
71
-
72
- Read `docs:terminal`, `docs:debugger`, or `docs:search-code` before using these resources. Never guess after a stale snapshot, ambiguous target, incomplete selection, or unknown rollback effect.
40
+ `shell:`, `debug:` and `symbol:` paths: read `docs:terminal` or `docs:debugger`; `symbol:` is described in the `path` field of the edit tools.
@@ -1,15 +1,5 @@
1
- # Git changes and undo workflow
1
+ # Git changes
2
2
 
3
- Read a tracked file with `views: ["changes"]` to see staged and unstaged hunks and current `CHANGE#` anchors. Stage or unstage only the selected current change. Anchors are revision-sensitive, so re-read after index or worktree changes.
4
-
5
- If an unstage anchor is stale, read the file again with `views: ["changes"]` and select a current change.
6
-
7
- After a failed or interrupted unstage call, inspect the index with `git diff --cached -- <file>` before retrying. Do not assume the error means the index stayed unchanged.
8
-
9
- Use a `CHANGE#` anchor to restore that selected Git change to `HEAD` in both worktree and index. Use `last` with a file only for that file's latest text-editor transaction. Inspect current changes before destructive restoration.
10
-
11
- Undo applies the restore before returning, including in Codemode. Earlier pending edits commit before Undo runs. Formatting and registered post-edit handlers run at script end in Codemode; read the file again if they change its bytes.
12
-
13
- `last` restores one saved transaction, not an undo history or redo. A successful restore clears that saved transaction.
14
-
15
- After a failed or interrupted Git restore, read the file and inspect the index with `git diff --cached -- <file>` before retrying. Text restoration can succeed before an index update fails. Retry only the work that remains unapplied.
3
+ - Read a tracked file with `views: ["changes"]` to see its staged and unstaged hunks as `CHANGE#` anchors. Anchors go stale when the file or index changes; read again.
4
+ - Stage or unstage one change by its anchor. `undo` with a `CHANGE#` anchor reverts that change in worktree and index; `undo` with `last` reverts the last tool edit of a file, once.
5
+ - After a failed or interrupted stage, unstage or undo, read the file and check `git diff --cached -- <file>` before retrying: the worktree can change before the index update fails.
@@ -0,0 +1,38 @@
1
+ # Search
2
+
3
+ ## Queries
4
+
5
+ - Plain text is literal. If nothing matches, unquoted input is retried as a regex, then as separate words. The result says when it broadened; treat broadened matches as location hints, not edit targets. Quoted text stays literal.
6
+ - Boolean: uppercase `AND`, `OR`, infix `NOT`, `||` or a spaced `|`; parentheses group. `regex:<pattern>` forces a regex.
7
+ - A match stays on one line. `multiline: true` lets it span lines, and `.` then matches line breaks. Boolean queries are always single-line.
8
+ - Narrow with `path`, `include` and `exclude` before broadening. Find files by name with `file_search`.
9
+ - After zero matches, an identifier can get "possible names": spelling hints in the same scope, each with its own references. They are not equivalents; read a candidate before editing it.
10
+
11
+ ## Results
12
+
13
+ - Each match has `SEARCH#HASH:N:line` (its line) and `SEARCH#HASH:N:match` (the exact match). `:all:line` and `:all:match` select every match, across files. Pass them to `read` or an edit tool as they are.
14
+ - A single reference goes stale when its file changes; search again. An `:all` reference re-runs its query instead.
15
+ - In Codemode, search returns `{ result, hasMatches, complete }`: pass `result` on. `hasMatches: false` proves absence only when `complete` is `true`.
16
+ - A failed or interrupted search is not zero matches.
17
+
18
+ ## Search inside a result
19
+
20
+ Pass an unchanged Read/Search/edit result as `path` to search only its ranges; gaps between ranges and `include`/`exclude` don't apply. Use it to narrow a selection before editing, for example the text between two markers:
21
+
22
+ ```js
23
+ const section = await tools.read({ path: "notes.md", offset: 20, limit: 40 });
24
+ const body = await tools.search({
25
+ path: section,
26
+ query: "regex:(?<=<!-- START -->\\n).*?(?=<!-- END -->)",
27
+ multiline: true,
28
+ });
29
+ await tools.replace({ path: body.result, text: "new body\n" });
30
+ ```
31
+
32
+ For syntax structure, use `ast_search` on the same result.
33
+
34
+ ## Other sources
35
+
36
+ - `docs:all` or `docs:<id>`: guide text, literal or `regex:`. Read the guide for full context.
37
+ - An HTTP(S) URL or `web:ssh://<target>/https://…`: page text, no read needed first. Matches have no edit references.
38
+ - `shell:<session>`: terminal output beyond the tail.