pi-agent-ide 0.9.8 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (908) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +5 -3
  3. package/dist/chunk-26SMC6OS.js +2 -0
  4. package/dist/chunk-2EY3LEZ7.js +1 -0
  5. package/dist/chunk-2QCE7GOV.js +1 -0
  6. package/dist/chunk-3BRGWFEI.js +2 -0
  7. package/dist/chunk-3JBQYLJ4.js +5 -0
  8. package/dist/chunk-3KM5DSWL.js +37 -0
  9. package/dist/chunk-3V3OQO5S.js +118 -0
  10. package/dist/chunk-45EJ4762.js +33 -0
  11. package/dist/chunk-4DLSZYUO.js +1 -0
  12. package/dist/chunk-54EFJYUB.js +1 -0
  13. package/dist/{chunk-5DN2XBVI.js → chunk-5TPYHUJV.js} +1 -1
  14. package/dist/{chunk-KQV2ZXLP.js → chunk-6DC2Q5BI.js} +1 -1
  15. package/dist/chunk-72WO7H5T.js +1 -0
  16. package/dist/chunk-72X24ARV.js +2 -0
  17. package/dist/chunk-7OAAM5FL.js +1 -0
  18. package/dist/chunk-AB6RSWMB.js +23 -0
  19. package/dist/chunk-ASVMQMPX.js +10 -0
  20. package/dist/chunk-BW3XONMZ.js +1 -0
  21. package/dist/chunk-C327T6YP.js +19 -0
  22. package/dist/{chunk-R2U5WXYR.js → chunk-D23NS4VV.js} +1 -1
  23. package/dist/chunk-E4V4VNRM.js +3 -0
  24. package/dist/chunk-E7JBYW43.js +1 -0
  25. package/dist/chunk-GDIF3WT6.js +12 -0
  26. package/dist/chunk-GNYFA6FS.js +2 -0
  27. package/dist/{chunk-DHOIQZUF.js → chunk-GQXZEOND.js} +1 -1
  28. package/dist/chunk-GT2JPOBM.js +1 -0
  29. package/dist/chunk-GTZOIJCH.js +1 -0
  30. package/dist/chunk-HRZAIZGR.js +1 -0
  31. package/dist/{chunk-H6FEBUAP.js → chunk-HSAGZWPO.js} +1 -1
  32. package/dist/{chunk-2DSY4U73.js → chunk-I3G6K7QU.js} +1 -1
  33. package/dist/chunk-IRLWXPL4.js +7 -0
  34. package/dist/chunk-IZTOXSTR.js +6 -0
  35. package/dist/chunk-J5CKSIH7.js +1 -0
  36. package/dist/chunk-JKM4E5VB.js +5 -0
  37. package/dist/chunk-JMCI2ZE2.js +3 -0
  38. package/dist/{chunk-YZTVC7ME.js → chunk-JY63UUC2.js} +1 -1
  39. package/dist/chunk-KM4NOIOB.js +5 -0
  40. package/dist/chunk-L2YDUMZC.js +13 -0
  41. package/dist/chunk-MCHU3BLO.js +53 -0
  42. package/dist/chunk-MJMRV76H.js +1 -0
  43. package/dist/chunk-MMQIHUU5.js +1 -0
  44. package/dist/chunk-MNAIMZRO.js +9 -0
  45. package/dist/chunk-NKI4TZSS.js +2 -0
  46. package/dist/chunk-NSBRKTZ7.js +1 -0
  47. package/dist/chunk-NWCTAVGR.js +4 -0
  48. package/dist/chunk-O2C3F3MA.js +1 -0
  49. package/dist/chunk-OA26FH5G.js +1 -0
  50. package/dist/chunk-OEEE5BLN.js +16 -0
  51. package/dist/chunk-OLMACWQX.js +11 -0
  52. package/dist/{chunk-72FL5FHZ.js → chunk-PBMHSK6J.js} +1 -1
  53. package/dist/chunk-QCAGAJHJ.js +1 -0
  54. package/dist/{chunk-P7FUD4WY.js → chunk-QR7JR3P2.js} +1 -1
  55. package/dist/chunk-QSU5AEKW.js +1 -0
  56. package/dist/chunk-QUK5ZEYX.js +1 -0
  57. package/dist/chunk-R7576HPO.js +25 -0
  58. package/dist/{chunk-B5UJCNQU.js → chunk-RNDSWVJF.js} +1 -1
  59. package/dist/chunk-RYJEEBET.js +1 -0
  60. package/dist/chunk-S4GTWS2J.js +6 -0
  61. package/dist/chunk-SF44YQCB.js +2 -0
  62. package/dist/chunk-SJQGFUXR.js +6 -0
  63. package/dist/chunk-SKZTIAE4.js +4 -0
  64. package/dist/chunk-SZRC24OB.js +1 -0
  65. package/dist/chunk-T5PXAYWC.js +1 -0
  66. package/dist/chunk-TIZ4QDF3.js +1 -0
  67. package/dist/chunk-UN3XLVPR.js +18 -0
  68. package/dist/chunk-V2LLMBTA.js +1 -0
  69. package/dist/chunk-VB5P3TXJ.js +111 -0
  70. package/dist/chunk-VNG4QPPT.js +12 -0
  71. package/dist/chunk-VNNAVC4S.js +15 -0
  72. package/dist/chunk-VPBGKSFI.js +3 -0
  73. package/dist/chunk-VQ2RA43A.js +7 -0
  74. package/dist/chunk-VWYI4WF7.js +3 -0
  75. package/dist/chunk-W25HNEMR.js +4 -0
  76. package/dist/chunk-X7CHS7JB.js +1 -0
  77. package/dist/chunk-XEPCURYZ.js +1 -0
  78. package/dist/chunk-XKVU6AAS.js +7 -0
  79. package/dist/chunk-XLTAP5YC.js +24 -0
  80. package/dist/chunk-XQMNVPNS.js +1 -0
  81. package/dist/chunk-YI32H7Z2.js +4 -0
  82. package/dist/chunk-ZYG5E3DI.js +9 -0
  83. package/dist/entry-0.js +1 -1
  84. package/dist/entry-12.js +1 -1
  85. package/dist/entry-15.js +1 -1
  86. package/dist/entry-17.js +1 -1
  87. package/dist/entry-18.js +1 -1
  88. package/dist/entry-19.js +1 -1
  89. package/dist/entry-20.js +1 -1
  90. package/dist/entry-21.js +1 -1
  91. package/dist/entry-22.js +1 -1
  92. package/dist/entry-27.js +1 -1
  93. package/dist/entry-28.js +1 -1
  94. package/dist/entry-31.js +2 -2
  95. package/dist/entry-32.js +1 -1
  96. package/dist/entry-33.js +1 -1
  97. package/dist/entry-34.js +1 -1
  98. package/dist/entry-35.js +1 -1
  99. package/dist/entry-36.js +1 -1
  100. package/dist/entry-37.js +1 -1
  101. package/dist/entry-38.js +19 -13
  102. package/dist/entry-4.js +1 -1
  103. package/dist/entry-40.js +1 -1
  104. package/dist/entry-41.js +1 -1
  105. package/dist/entry-43.js +1 -1
  106. package/dist/entry-44.js +1 -1
  107. package/dist/entry-45.js +1 -1
  108. package/dist/entry-48.js +1 -1
  109. package/dist/entry-49.js +1 -1
  110. package/dist/entry-50.js +1 -1
  111. package/dist/entry-51.js +1 -1
  112. package/dist/entry-52.js +1 -1
  113. package/dist/entry-53.js +1 -1
  114. package/dist/entry-54.js +1 -1
  115. package/dist/entry-55.js +1 -1
  116. package/dist/entry-56.js +1 -1
  117. package/dist/entry-57.js +1 -1
  118. package/dist/entry-58.js +1 -1
  119. package/dist/entry-59.js +1 -1
  120. package/dist/entry-60.js +1 -1
  121. package/dist/entry-61.js +1 -1
  122. package/dist/entry-62.js +1 -1
  123. package/dist/entry-63.js +1 -1
  124. package/dist/entry-64.js +1 -1
  125. package/dist/entry-65.js +1 -1
  126. package/dist/entry-66.js +1 -1
  127. package/dist/entry-67.js +1 -1
  128. package/dist/entry-68.js +1 -0
  129. package/dist/entry-69.js +1 -1
  130. package/dist/entry-71.js +1 -1
  131. package/dist/entry-72.js +0 -1
  132. package/dist/entry-73.js +1 -1
  133. package/dist/entry-74.js +1 -1
  134. package/dist/entry-75.js +1 -1
  135. package/dist/entry-76.js +1 -1
  136. package/dist/entry-77.js +1 -1
  137. package/dist/entry-78.js +1 -0
  138. package/dist/entry-79.js +1 -1
  139. package/dist/entry-8.js +1 -1
  140. package/dist/entry-80.js +1 -0
  141. package/dist/entry-81.js +0 -1
  142. package/dist/entry-82.js +1 -1
  143. package/dist/entry-83.js +1 -1
  144. package/dist/entry-84.js +0 -1
  145. package/dist/entry-85.js +1 -1
  146. package/dist/entry-86.js +1 -2
  147. package/dist/entry-87.js +1 -1
  148. package/dist/entry-88.js +1 -1
  149. package/dist/entry-89.js +1 -1
  150. package/dist/entry-90.js +1 -1
  151. package/dist/entry-91.js +1 -3
  152. package/dist/entry-92.js +1 -1
  153. package/dist/entry-93.js +1 -1
  154. package/dist/entry-94.js +1 -1
  155. package/dist/entry-95.js +3 -0
  156. package/dist/entry-96.js +1 -0
  157. package/dist/entry-97.js +1 -0
  158. package/dist/entry-98.js +1 -0
  159. package/dist/pi-agent-ide.js +26 -13
  160. package/docs/agent-guides/ast-search.md +15 -4
  161. package/docs/agent-guides/debugger.md +1 -1
  162. package/docs/agent-guides/git-changes.md +1 -0
  163. package/docs/agent-guides/ssh.md +27 -7
  164. package/docs/agent-guides/terminal.md +4 -0
  165. package/docs/configuration.md +65 -11
  166. package/docs/development.md +4 -0
  167. package/docs/extensions.md +6 -4
  168. package/docs/nightly.md +7 -1
  169. package/docs/releases.md +1 -1
  170. package/docs/structured-results.md +29 -15
  171. package/docs/tools.md +95 -29
  172. package/docs/user-hooks.md +1 -1
  173. package/node_modules/pi-agent-doctor/package.json +1 -1
  174. package/node_modules/pi-agent-doctor/src/catalog.ts +2 -0
  175. package/node_modules/pi-agent-doctor/src/executable.ts +1 -1
  176. package/node_modules/pi-agent-documentation/package.json +1 -1
  177. package/node_modules/pi-agent-filesystem/package.json +7 -7
  178. package/node_modules/pi-agent-filesystem/src/file-write-lock.ts +6 -4
  179. package/node_modules/pi-agent-filesystem/src/replace-file.ts +5 -2
  180. package/node_modules/pi-agent-filesystem/src/resolver.ts +26 -10
  181. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  182. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  183. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  184. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  185. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  186. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +56 -65
  187. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +197 -130
  188. package/node_modules/pi-agent-ide-ast/src/ast/read-text.ts +2 -1
  189. package/node_modules/pi-agent-ide-ast/src/ast-grep-binary.ts +46 -0
  190. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +119 -97
  191. package/node_modules/pi-agent-ide-ast/src/extension.ts +9 -24
  192. package/node_modules/pi-agent-ide-ast/src/outline-page.ts +96 -0
  193. package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +42 -78
  194. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +5 -1
  195. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +2 -1
  196. package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +24 -5
  197. package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +2 -1
  198. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +406 -200
  199. package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +27 -9
  200. package/node_modules/pi-agent-ide-ast/src/tool-outline.ts +191 -0
  201. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  202. package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +63 -20
  203. package/node_modules/pi-agent-ide-changes/src/changes/change-types.ts +1 -0
  204. package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +25 -0
  205. package/node_modules/pi-agent-ide-changes/src/changes/git-paths.ts +13 -6
  206. package/node_modules/pi-agent-ide-changes/src/index-mutation-queue.ts +12 -8
  207. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +88 -78
  208. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +29 -3
  209. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  210. package/node_modules/pi-agent-ide-formatter/src/formatter.ts +39 -3
  211. package/node_modules/pi-agent-ide-formatter/src/rustfmt.ts +101 -0
  212. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  213. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  214. package/node_modules/pi-agent-ide-lint/src/catalog.ts +20 -14
  215. package/node_modules/pi-agent-ide-lint/src/registry.ts +2 -2
  216. package/node_modules/pi-agent-ide-lsp/index.ts +15 -88
  217. package/node_modules/pi-agent-ide-lsp/package.json +12 -12
  218. package/node_modules/pi-agent-ide-lsp/src/catalog.ts +21 -9
  219. package/node_modules/pi-agent-ide-lsp/src/lsp/clang-coverage.ts +265 -0
  220. package/node_modules/pi-agent-ide-lsp/src/lsp/clangd-launch.ts +48 -0
  221. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +94 -11
  222. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +514 -207
  223. package/node_modules/pi-agent-ide-lsp/src/lsp/corrected-names.ts +222 -0
  224. package/node_modules/pi-agent-ide-lsp/src/lsp/declaration-scan.ts +116 -0
  225. package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +20 -1
  226. package/node_modules/pi-agent-ide-lsp/src/lsp/files-containing.ts +70 -0
  227. package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +1 -1
  228. package/node_modules/pi-agent-ide-lsp/src/lsp/initialization-options.ts +37 -0
  229. package/node_modules/pi-agent-ide-lsp/src/lsp/line-breaks.ts +16 -0
  230. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +185 -131
  231. package/node_modules/pi-agent-ide-lsp/src/lsp/missing-sources.ts +21 -0
  232. package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +45 -24
  233. package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +17 -0
  234. package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +40 -12
  235. package/node_modules/pi-agent-ide-lsp/src/lsp/range-match.ts +49 -0
  236. package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +16 -5
  237. package/node_modules/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +7 -1
  238. package/node_modules/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +133 -37
  239. package/node_modules/pi-agent-ide-lsp/src/lsp/shared-servers.ts +164 -13
  240. package/node_modules/pi-agent-ide-lsp/src/lsp/source-changes.ts +18 -6
  241. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +414 -174
  242. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-selectors.ts +424 -0
  243. package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +67 -0
  244. package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +10 -0
  245. package/node_modules/pi-agent-ide-lsp/src/name-captures.ts +66 -0
  246. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +384 -93
  247. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +356 -79
  248. package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +33 -11
  249. package/node_modules/pi-agent-image/package.json +2 -2
  250. package/node_modules/pi-agent-image/src/image-converter.ts +13 -2
  251. package/node_modules/pi-agent-invariant/package.json +1 -1
  252. package/node_modules/pi-agent-pdf/package.json +2 -2
  253. package/node_modules/pi-agent-read/package.json +7 -7
  254. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  255. package/node_modules/pi-agent-read/src/api/read-parameters.ts +51 -12
  256. package/node_modules/pi-agent-read/src/api/tools/read.ts +39 -3
  257. package/node_modules/pi-agent-read/src/core/extension.ts +80 -3
  258. package/node_modules/pi-agent-read/src/core/read-core.ts +6 -0
  259. package/node_modules/pi-agent-read/src/core/tools/read/list-result.ts +79 -0
  260. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +45 -4
  261. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +18 -9
  262. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +16 -3
  263. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +37 -9
  264. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +15 -4
  265. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +49 -18
  266. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +158 -51
  267. package/node_modules/pi-agent-resource/package.json +5 -1
  268. package/node_modules/pi-agent-resource/src/file-text-read.ts +86 -0
  269. package/node_modules/pi-agent-resource/src/index.ts +54 -0
  270. package/node_modules/pi-agent-resource/src/json-structured-arguments.ts +131 -0
  271. package/node_modules/pi-agent-resource/src/line-map.ts +750 -0
  272. package/node_modules/pi-agent-resource/src/resolver.ts +2 -0
  273. package/node_modules/pi-agent-resource/src/resource-scheduler.ts +63 -23
  274. package/node_modules/pi-agent-resource/src/resource.ts +5 -0
  275. package/node_modules/pi-agent-resource/src/result-targets.ts +693 -66
  276. package/node_modules/pi-agent-resource/src/script-calls.ts +21 -0
  277. package/node_modules/pi-agent-resource/src/tool-deadline.ts +199 -0
  278. package/node_modules/pi-agent-resource/src/tool-result.ts +14 -5
  279. package/node_modules/pi-agent-resource/src/unchanged-read.ts +62 -0
  280. package/node_modules/pi-agent-search/package.json +8 -9
  281. package/node_modules/pi-agent-search/runtime/entry-57.js +0 -1
  282. package/node_modules/pi-agent-search/src/api/fuzzy.ts +2 -1
  283. package/node_modules/pi-agent-search/src/api/null-fields.ts +50 -0
  284. package/node_modules/pi-agent-search/src/api/path-list.ts +68 -0
  285. package/node_modules/pi-agent-search/src/api/presentation.ts +2 -1
  286. package/node_modules/pi-agent-search/src/api/search-call-policy.ts +16 -0
  287. package/node_modules/pi-agent-search/src/api/search-capture.ts +56 -0
  288. package/node_modules/pi-agent-search/src/api/search-parameters.ts +26 -4
  289. package/node_modules/pi-agent-search/src/api/search-scope.ts +38 -2
  290. package/node_modules/pi-agent-search/src/api/search.ts +46 -3
  291. package/node_modules/pi-agent-search/src/api/structured-result.ts +121 -26
  292. package/node_modules/pi-agent-search/src/core/extension.ts +75 -42
  293. package/node_modules/pi-agent-search/src/core/search-config.ts +2 -2
  294. package/node_modules/pi-agent-search/src/core/search-core.ts +103 -39
  295. package/node_modules/pi-agent-search-text/index.ts +62 -20
  296. package/node_modules/pi-agent-search-text/package.json +15 -15
  297. package/node_modules/pi-agent-search-text/runtime/entry-59.js +1 -0
  298. package/node_modules/pi-agent-search-text/src/current-matches.ts +314 -0
  299. package/node_modules/pi-agent-search-text/src/file-search.ts +178 -99
  300. package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +40 -17
  301. package/node_modules/pi-agent-search-text/src/persisted-result.ts +3 -8
  302. package/node_modules/pi-agent-search-text/src/resolvers.ts +395 -103
  303. package/node_modules/pi-agent-search-text/src/ripgrep.ts +142 -0
  304. package/node_modules/pi-agent-search-text/src/scoped-search.ts +24 -12
  305. package/node_modules/pi-agent-search-text/src/search-backend.ts +333 -108
  306. package/node_modules/pi-agent-search-text/src/search-presentation.ts +6 -0
  307. package/node_modules/pi-agent-search-text/src/search-query.ts +69 -34
  308. package/node_modules/pi-agent-search-text/src/search-recipe.ts +80 -8
  309. package/node_modules/pi-agent-search-text/src/search-renderer.ts +2 -1
  310. package/node_modules/pi-agent-search-text/src/search-result.ts +10 -1
  311. package/node_modules/pi-agent-search-text/src/search-session.ts +449 -58
  312. package/node_modules/pi-agent-search-text/src/tool-file-search.ts +51 -6
  313. package/node_modules/pi-agent-text/package.json +3 -3
  314. package/node_modules/pi-agent-text/runtime/entry-63.js +1 -0
  315. package/node_modules/pi-agent-text/src/index.ts +18 -0
  316. package/node_modules/pi-agent-text/src/line-anchors.ts +211 -0
  317. package/node_modules/pi-agent-text/src/no-final-line-break.ts +12 -0
  318. package/node_modules/pi-agent-text/src/search-highlight.ts +8 -0
  319. package/node_modules/pi-agent-text/src/source-line.ts +7 -1
  320. package/node_modules/pi-agent-text/src/text-anchor.ts +34 -3
  321. package/node_modules/pi-agent-text/src/text-converter.ts +2 -1
  322. package/node_modules/pi-agent-text/src/text-document.ts +9 -23
  323. package/node_modules/pi-agent-text/src/text-target.ts +14 -6
  324. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  325. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-64.js +2 -0
  326. package/node_modules/pi-agent-text-anchor-exact/index.ts +1 -65
  327. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -5
  328. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-65.js +0 -1
  329. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-66.js +2 -0
  330. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +185 -184
  331. package/node_modules/pi-agent-text-anchor-exact/src/anchored-literal-view.ts +122 -0
  332. package/node_modules/pi-agent-text-anchor-exact/src/fuzzy-worker.ts +2 -1
  333. package/node_modules/pi-agent-text-anchor-exact/src/literal-match.ts +359 -0
  334. package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +1 -0
  335. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +5 -3
  336. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  337. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-67.js +0 -1
  338. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-68.js +2 -0
  339. package/node_modules/pi-agent-text-anchor-line-hash/src/anchor.ts +92 -67
  340. package/node_modules/pi-agent-text-anchor-line-hash/src/range-history.ts +105 -0
  341. package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +22 -17
  342. package/node_modules/pi-agent-text-editor/index.ts +0 -10
  343. package/node_modules/pi-agent-text-editor/package.json +37 -26
  344. package/node_modules/pi-agent-text-editor/runtime/entry-84.js +0 -1
  345. package/node_modules/pi-agent-text-editor/runtime/entry-85.js +1 -0
  346. package/node_modules/pi-agent-text-editor/runtime/entry-86.js +1 -0
  347. package/node_modules/pi-agent-text-editor/runtime/entry-88.js +2 -0
  348. package/node_modules/pi-agent-text-editor/src/api/anchor-excerpt.ts +7 -0
  349. package/node_modules/pi-agent-text-editor/src/api/anchor-inspection.ts +2 -1
  350. package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +2 -0
  351. package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +40 -8
  352. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +6 -1
  353. package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +37 -2
  354. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  355. package/node_modules/pi-agent-text-editor/src/api/native-files.ts +16 -2
  356. package/node_modules/pi-agent-text-editor/src/api/pi-edit-text.ts +82 -0
  357. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +9 -2
  358. package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +1 -0
  359. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +13 -2
  360. package/node_modules/pi-agent-text-editor/src/api/text-selector-fields.ts +210 -0
  361. package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -0
  362. package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  363. package/node_modules/pi-agent-text-editor/src/core/already-done.ts +123 -0
  364. package/node_modules/pi-agent-text-editor/src/core/anchor-candidates.ts +116 -0
  365. package/node_modules/pi-agent-text-editor/src/core/anchor-preview.ts +32 -0
  366. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +109 -23
  367. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +19 -5
  368. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +6 -5
  369. package/node_modules/pi-agent-text-editor/src/core/extension.ts +54 -21
  370. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +7 -3
  371. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +14 -5
  372. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +32 -11
  373. package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +67 -38
  374. package/node_modules/pi-agent-text-editor/src/core/file-write-observations.ts +287 -0
  375. package/node_modules/pi-agent-text-editor/src/core/image-write.ts +16 -4
  376. package/node_modules/pi-agent-text-editor/src/core/lookalike-bytes.ts +254 -0
  377. package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +29 -12
  378. package/node_modules/pi-agent-text-editor/src/core/mutation-result/compact-receipt.ts +48 -0
  379. package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +2 -1
  380. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +24 -34
  381. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +13 -20
  382. package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +32 -3
  383. package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +36 -2
  384. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +26 -19
  385. package/node_modules/pi-agent-text-editor/src/core/native-snapshot-source.ts +13 -0
  386. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +526 -148
  387. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +28 -3
  388. package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +34 -14
  389. package/node_modules/pi-agent-text-editor/src/core/reference-list.ts +95 -0
  390. package/node_modules/pi-agent-text-editor/src/core/result-scope.ts +129 -0
  391. package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +20 -8
  392. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +86 -69
  393. package/node_modules/pi-agent-text-editor/src/core/source-aliases.ts +92 -0
  394. package/node_modules/pi-agent-text-editor/src/core/source-change-retry.ts +92 -7
  395. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +2 -0
  396. package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +162 -47
  397. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +321 -101
  398. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +206 -134
  399. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -2
  400. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +133 -18
  401. package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +13 -0
  402. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +823 -226
  403. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +51 -1
  404. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +7 -4
  405. package/node_modules/pi-agent-text-editor/src/tools/display-marker.ts +15 -0
  406. package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +268 -159
  407. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +37 -32
  408. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +24 -70
  409. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +23 -36
  410. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +31 -45
  411. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +33 -65
  412. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +80 -42
  413. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +27 -16
  414. package/node_modules/pi-agent-text-editor-renderer/index.ts +0 -14
  415. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -6
  416. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-89.js +2 -0
  417. package/node_modules/pi-agent-text-editor-renderer/src/diff-model.ts +204 -78
  418. package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +75 -8
  419. package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +4 -1
  420. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -3
  421. package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +44 -30
  422. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +170 -26
  423. package/node_modules/pi-agent-text-editor-stale-anchor/index.ts +83 -83
  424. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -6
  425. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  426. package/node_modules/pi-agent-tool-call-interception/runtime/entry-91.js +1 -0
  427. package/node_modules/pi-agent-tool-ui/package.json +3 -3
  428. package/node_modules/pi-agent-tool-ui/runtime/entry-92.js +1 -0
  429. package/node_modules/pi-agent-tool-ui/runtime/entry-93.js +1 -0
  430. package/node_modules/pi-agent-web/index.ts +0 -3
  431. package/node_modules/pi-agent-web/package.json +8 -8
  432. package/node_modules/pi-agent-web/src/search.ts +1 -2
  433. package/node_modules/pi-agent-web-html/package.json +3 -3
  434. package/node_modules/pi-agent-web-html/runtime/entry-95.js +2 -0
  435. package/node_modules/pi-agent-web-image/package.json +4 -4
  436. package/node_modules/pi-agent-web-image/runtime/entry-96.js +2 -0
  437. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  438. package/node_modules/pi-agent-web-pdf/runtime/entry-97.js +2 -0
  439. package/node_modules/pi-agent-web-text/package.json +4 -4
  440. package/node_modules/pi-agent-web-text/runtime/entry-98.js +2 -0
  441. package/package.json +38 -38
  442. package/skills/capture-code-review-rule/SKILL.md +1 -1
  443. package/skills/configure-agent-ide/SKILL.md +1 -1
  444. package/src/api/code-view.ts +0 -2
  445. package/src/api/tool-config/linters.json +1 -0
  446. package/src/api/tool-config/lsp-servers.json +5 -0
  447. package/src/api/tool-config.ts +23 -2
  448. package/src/backend/config.ts +2 -0
  449. package/src/backend/configured-process.ts +1 -0
  450. package/src/backend/dap-java-transport.ts +4 -2
  451. package/src/backend/dap-java-worker.py +11 -4
  452. package/src/backend/dap-node-transport.ts +4 -2
  453. package/src/backend/dap-tcp-transport.ts +2 -3
  454. package/src/backend/debugger-workspace-owner.ts +6 -6
  455. package/src/backend/doctor-probe-worker.py +23 -15
  456. package/src/backend/doctor-workspace.ts +19 -18
  457. package/src/backend/file-transfer.ts +160 -56
  458. package/src/backend/formatter-registration.ts +54 -2
  459. package/src/backend/identity.ts +81 -12
  460. package/src/backend/lsp-file-watchers.ts +7 -9
  461. package/src/backend/lsp-workspace-owner.ts +25 -1
  462. package/src/backend/object-transfer.ts +28 -15
  463. package/src/backend/owned-command.ts +2 -1
  464. package/src/backend/owned-read-command.ts +2 -1
  465. package/src/backend/packaged-source.ts +12 -0
  466. package/src/backend/process-environment.ts +7 -9
  467. package/src/backend/process-metadata.ts +5 -5
  468. package/src/backend/recipe-evidence-worker.py +2 -0
  469. package/src/backend/recipe-evidence.ts +7 -8
  470. package/src/backend/registration.ts +2 -1
  471. package/src/backend/registry.ts +12 -2
  472. package/src/backend/resource-resolver.ts +11 -32
  473. package/src/backend/search-environment.ts +61 -4
  474. package/src/backend/ssh-channel-worker.py +6 -304
  475. package/src/backend/ssh-channel.ts +287 -36
  476. package/src/backend/ssh-connection-loss.ts +123 -0
  477. package/src/backend/ssh-file-stream.ts +216 -0
  478. package/src/backend/ssh-master.ts +443 -0
  479. package/src/backend/ssh-transfer-worker-windows.py +84 -0
  480. package/src/backend/ssh-transfer-worker.py +43 -10
  481. package/src/backend/ssh-transport.ts +238 -24
  482. package/src/backend/ssh-worker.py +7 -728
  483. package/src/backend/ssh.ts +83 -35
  484. package/src/backend/ssh_channel_common.py +68 -0
  485. package/src/backend/ssh_channel_posix.py +324 -0
  486. package/src/backend/ssh_channel_windows.py +527 -0
  487. package/src/backend/ssh_paths.py +23 -0
  488. package/src/backend/ssh_windows_files.py +254 -0
  489. package/src/backend/ssh_worker_common.py +96 -0
  490. package/src/backend/ssh_worker_posix.py +780 -0
  491. package/src/backend/ssh_worker_windows.py +687 -0
  492. package/src/backend/tool-config-access.ts +14 -11
  493. package/src/backend/tool-project.ts +4 -3
  494. package/src/backend/web-browser.ts +2 -3
  495. package/src/backend/web-http.ts +5 -5
  496. package/src/code-view/diagnostic-view.ts +12 -30
  497. package/src/code-view/reference.ts +9 -18
  498. package/src/code-view/source-view.ts +2 -1
  499. package/src/composite/codemode-tool-names.ts +79 -0
  500. package/src/composite/detached-results.ts +25 -6
  501. package/src/composite/ide-alias-rendering.ts +26 -4
  502. package/src/composite/module-labels.ts +2 -2
  503. package/src/composite/module-settings.ts +1 -0
  504. package/src/composite/nested-tool-rendering.ts +70 -24
  505. package/src/composite/output-limits.ts +12 -5
  506. package/src/composite/parallel-tool-guidance.ts +38 -0
  507. package/src/composite/script-values/ast-search.ts +56 -0
  508. package/src/composite/script-values/copy.ts +8 -0
  509. package/src/composite/script-values/delete.ts +5 -0
  510. package/src/composite/script-values/diff.ts +28 -0
  511. package/src/composite/script-values/edit-selection.ts +48 -0
  512. package/src/composite/script-values/failures.ts +170 -0
  513. package/src/composite/script-values/file-receipts.ts +63 -0
  514. package/src/composite/script-values/file-search.ts +10 -0
  515. package/src/composite/script-values/index.ts +55 -0
  516. package/src/composite/script-values/insert.ts +5 -0
  517. package/src/composite/script-values/lsp-search.ts +136 -0
  518. package/src/composite/script-values/match.ts +53 -0
  519. package/src/composite/script-values/move.ts +8 -0
  520. package/src/composite/script-values/path-list.ts +25 -0
  521. package/src/composite/script-values/provider-value.ts +21 -0
  522. package/src/composite/script-values/read.ts +206 -0
  523. package/src/composite/script-values/replace.ts +5 -0
  524. package/src/composite/script-values/result-reference.ts +9 -0
  525. package/src/composite/script-values/search-matches.ts +113 -0
  526. package/src/composite/script-values/search.ts +64 -0
  527. package/src/composite/script-values/semantic-search.ts +8 -0
  528. package/src/composite/script-values/terminal.ts +112 -0
  529. package/src/composite/script-values/text.ts +7 -0
  530. package/src/composite/script-values/types.ts +56 -0
  531. package/src/composite/script-values/undo.ts +5 -0
  532. package/src/composite/script-values/write.ts +8 -0
  533. package/src/composite/settings-panel.ts +18 -2
  534. package/src/composite/text-results.ts +488 -175
  535. package/src/composite/tool-availability.ts +29 -16
  536. package/src/composite/tool-discovery-guidance.ts +97 -0
  537. package/src/documentation/attachment.ts +31 -0
  538. package/src/documentation/extension.ts +6 -2
  539. package/src/documentation/search.ts +1 -7
  540. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  541. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  542. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  543. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  544. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  545. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/file-write-lock.ts +6 -4
  546. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/replace-file.ts +5 -2
  547. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +26 -10
  548. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +0 -3
  549. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -8
  550. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -3
  551. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-95.js +2 -0
  552. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  553. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-96.js +2 -0
  554. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  555. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-97.js +2 -0
  556. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  557. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-98.js +2 -0
  558. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-94.js +2 -0
  559. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +1 -2
  560. package/src/extensions/pi-agent-read/package.json +7 -7
  561. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  562. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +51 -12
  563. package/src/extensions/pi-agent-read/src/api/tools/read.ts +39 -3
  564. package/src/extensions/pi-agent-read/src/core/extension.ts +80 -3
  565. package/src/extensions/pi-agent-read/src/core/read-core.ts +6 -0
  566. package/src/extensions/pi-agent-read/src/core/tools/read/list-result.ts +79 -0
  567. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +45 -4
  568. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +18 -9
  569. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +16 -3
  570. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +37 -9
  571. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +15 -4
  572. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +49 -18
  573. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +158 -51
  574. package/src/extensions/pi-agent-search/package.json +8 -9
  575. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +62 -20
  576. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +15 -15
  577. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-59.js +1 -0
  578. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-62.js +1 -0
  579. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/current-matches.ts +314 -0
  580. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +178 -99
  581. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +40 -17
  582. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +3 -8
  583. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +395 -103
  584. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/ripgrep.ts +142 -0
  585. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +24 -12
  586. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +333 -108
  587. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +6 -0
  588. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-query.ts +69 -34
  589. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +80 -8
  590. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +2 -1
  591. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +10 -1
  592. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +449 -58
  593. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +51 -6
  594. package/src/extensions/pi-agent-search/runtime/entry-57.js +0 -1
  595. package/src/extensions/pi-agent-search/runtime/entry-58.js +2 -0
  596. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +2 -1
  597. package/src/extensions/pi-agent-search/src/api/null-fields.ts +50 -0
  598. package/src/extensions/pi-agent-search/src/api/path-list.ts +68 -0
  599. package/src/extensions/pi-agent-search/src/api/presentation.ts +2 -1
  600. package/src/extensions/pi-agent-search/src/api/search-call-policy.ts +16 -0
  601. package/src/extensions/pi-agent-search/src/api/search-capture.ts +56 -0
  602. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +26 -4
  603. package/src/extensions/pi-agent-search/src/api/search-scope.ts +38 -2
  604. package/src/extensions/pi-agent-search/src/api/search.ts +46 -3
  605. package/src/extensions/pi-agent-search/src/api/structured-result.ts +121 -26
  606. package/src/extensions/pi-agent-search/src/core/extension.ts +75 -42
  607. package/src/extensions/pi-agent-search/src/core/search-config.ts +2 -2
  608. package/src/extensions/pi-agent-search/src/core/search-core.ts +103 -39
  609. package/src/extensions/pi-agent-text-editor/index.ts +0 -10
  610. package/src/extensions/pi-agent-text-editor/package.json +37 -26
  611. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  612. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-64.js +2 -0
  613. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +1 -65
  614. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -5
  615. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-65.js +0 -1
  616. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-66.js +2 -0
  617. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +185 -184
  618. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchored-literal-view.ts +122 -0
  619. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/fuzzy-worker.ts +2 -1
  620. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/literal-match.ts +359 -0
  621. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +1 -0
  622. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +5 -3
  623. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  624. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-67.js +0 -1
  625. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-68.js +2 -0
  626. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/anchor.ts +92 -67
  627. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/range-history.ts +105 -0
  628. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +22 -17
  629. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +0 -14
  630. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -6
  631. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-89.js +2 -0
  632. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-model.ts +204 -78
  633. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +75 -8
  634. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +4 -1
  635. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -3
  636. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +44 -30
  637. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +170 -26
  638. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/index.ts +83 -83
  639. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -6
  640. package/src/extensions/pi-agent-text-editor/runtime/entry-84.js +0 -1
  641. package/src/extensions/pi-agent-text-editor/runtime/entry-85.js +1 -0
  642. package/src/extensions/pi-agent-text-editor/runtime/entry-86.js +1 -0
  643. package/src/extensions/pi-agent-text-editor/runtime/entry-87.js +1 -0
  644. package/src/extensions/pi-agent-text-editor/runtime/entry-88.js +2 -0
  645. package/src/extensions/pi-agent-text-editor/src/api/anchor-excerpt.ts +7 -0
  646. package/src/extensions/pi-agent-text-editor/src/api/anchor-inspection.ts +2 -1
  647. package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +2 -0
  648. package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +40 -8
  649. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +6 -1
  650. package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +37 -2
  651. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  652. package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +16 -2
  653. package/src/extensions/pi-agent-text-editor/src/api/pi-edit-text.ts +82 -0
  654. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +9 -2
  655. package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +1 -0
  656. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +13 -2
  657. package/src/extensions/pi-agent-text-editor/src/api/text-selector-fields.ts +210 -0
  658. package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -0
  659. package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +3 -0
  660. package/src/extensions/pi-agent-text-editor/src/core/already-done.ts +123 -0
  661. package/src/extensions/pi-agent-text-editor/src/core/anchor-candidates.ts +116 -0
  662. package/src/extensions/pi-agent-text-editor/src/core/anchor-preview.ts +32 -0
  663. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +109 -23
  664. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +19 -5
  665. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +6 -5
  666. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +54 -21
  667. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +7 -3
  668. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +14 -5
  669. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +32 -11
  670. package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +67 -38
  671. package/src/extensions/pi-agent-text-editor/src/core/file-write-observations.ts +287 -0
  672. package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +16 -4
  673. package/src/extensions/pi-agent-text-editor/src/core/lookalike-bytes.ts +254 -0
  674. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +29 -12
  675. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/compact-receipt.ts +48 -0
  676. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +2 -1
  677. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +24 -34
  678. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +13 -20
  679. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +32 -3
  680. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +36 -2
  681. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +26 -19
  682. package/src/extensions/pi-agent-text-editor/src/core/native-snapshot-source.ts +13 -0
  683. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +526 -148
  684. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +28 -3
  685. package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +34 -14
  686. package/src/extensions/pi-agent-text-editor/src/core/reference-list.ts +95 -0
  687. package/src/extensions/pi-agent-text-editor/src/core/result-scope.ts +129 -0
  688. package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +20 -8
  689. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +86 -69
  690. package/src/extensions/pi-agent-text-editor/src/core/source-aliases.ts +92 -0
  691. package/src/extensions/pi-agent-text-editor/src/core/source-change-retry.ts +92 -7
  692. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +2 -0
  693. package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +162 -47
  694. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +321 -101
  695. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +206 -134
  696. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -2
  697. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +133 -18
  698. package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +13 -0
  699. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +823 -226
  700. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +51 -1
  701. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +7 -4
  702. package/src/extensions/pi-agent-text-editor/src/tools/display-marker.ts +15 -0
  703. package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +268 -159
  704. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +37 -32
  705. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +24 -70
  706. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +23 -36
  707. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +31 -45
  708. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +33 -65
  709. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +80 -42
  710. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +27 -16
  711. package/src/pi-agent-ide.ts +41 -32
  712. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  713. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +56 -65
  714. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +197 -130
  715. package/src/plugins/pi-agent-ide-ast/src/ast/read-text.ts +2 -1
  716. package/src/plugins/pi-agent-ide-ast/src/ast-grep-binary.ts +46 -0
  717. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +119 -97
  718. package/src/plugins/pi-agent-ide-ast/src/extension.ts +9 -24
  719. package/src/plugins/pi-agent-ide-ast/src/outline-page.ts +96 -0
  720. package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +42 -78
  721. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +5 -1
  722. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +2 -1
  723. package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +24 -5
  724. package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +2 -1
  725. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +406 -200
  726. package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +27 -9
  727. package/src/plugins/pi-agent-ide-ast/src/tool-outline.ts +191 -0
  728. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  729. package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +63 -20
  730. package/src/plugins/pi-agent-ide-changes/src/changes/change-types.ts +1 -0
  731. package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +25 -0
  732. package/src/plugins/pi-agent-ide-changes/src/changes/git-paths.ts +13 -6
  733. package/src/plugins/pi-agent-ide-changes/src/index-mutation-queue.ts +12 -8
  734. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +88 -78
  735. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +29 -3
  736. package/src/plugins/pi-agent-ide-debugger/index.ts +42 -32
  737. package/src/plugins/pi-agent-ide-debugger/src/string-enum.ts +14 -0
  738. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +124 -79
  739. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  740. package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +39 -3
  741. package/src/plugins/pi-agent-ide-formatter/src/rustfmt.ts +101 -0
  742. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  743. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  744. package/src/plugins/pi-agent-ide-lint/src/catalog.ts +20 -14
  745. package/src/plugins/pi-agent-ide-lint/src/registry.ts +2 -2
  746. package/src/plugins/pi-agent-ide-lsp/index.ts +15 -88
  747. package/src/plugins/pi-agent-ide-lsp/package.json +12 -12
  748. package/src/plugins/pi-agent-ide-lsp/src/catalog.ts +21 -9
  749. package/src/plugins/pi-agent-ide-lsp/src/lsp/clang-coverage.ts +265 -0
  750. package/src/plugins/pi-agent-ide-lsp/src/lsp/clangd-launch.ts +48 -0
  751. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +94 -11
  752. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +514 -207
  753. package/src/plugins/pi-agent-ide-lsp/src/lsp/corrected-names.ts +222 -0
  754. package/src/plugins/pi-agent-ide-lsp/src/lsp/declaration-scan.ts +116 -0
  755. package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +20 -1
  756. package/src/plugins/pi-agent-ide-lsp/src/lsp/files-containing.ts +70 -0
  757. package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +1 -1
  758. package/src/plugins/pi-agent-ide-lsp/src/lsp/initialization-options.ts +37 -0
  759. package/src/plugins/pi-agent-ide-lsp/src/lsp/line-breaks.ts +16 -0
  760. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +185 -131
  761. package/src/plugins/pi-agent-ide-lsp/src/lsp/missing-sources.ts +21 -0
  762. package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +45 -24
  763. package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +17 -0
  764. package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +40 -12
  765. package/src/plugins/pi-agent-ide-lsp/src/lsp/range-match.ts +49 -0
  766. package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +16 -5
  767. package/src/plugins/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +7 -1
  768. package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +133 -37
  769. package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-servers.ts +164 -13
  770. package/src/plugins/pi-agent-ide-lsp/src/lsp/source-changes.ts +18 -6
  771. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +414 -174
  772. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-selectors.ts +424 -0
  773. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +67 -0
  774. package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +10 -0
  775. package/src/plugins/pi-agent-ide-lsp/src/name-captures.ts +66 -0
  776. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +384 -93
  777. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +356 -79
  778. package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +33 -11
  779. package/src/plugins/pi-agent-ide-processes/src/registry.ts +64 -3
  780. package/src/plugins/pi-agent-ide-processes/src/ui.ts +57 -1
  781. package/src/plugins/pi-agent-ide-semantic/src/backend.ts +18 -6
  782. package/src/plugins/pi-agent-ide-semantic/src/vera-backend.ts +16 -9
  783. package/src/plugins/pi-agent-ide-terminal/index.ts +23 -7
  784. package/src/plugins/pi-agent-ide-terminal/src/list.ts +79 -0
  785. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +22 -0
  786. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +3 -0
  787. package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +18 -6
  788. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +132 -18
  789. package/src/plugins/pi-agent-ide-terminal/src/search.ts +117 -50
  790. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +94 -10
  791. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +24 -1
  792. package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +5 -2
  793. package/src/plugins/pi-agent-ide-terminal/src/terminal-text.ts +173 -0
  794. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +266 -112
  795. package/src/plugins/pi-agent-ide-terminal/src/types.ts +6 -1
  796. package/src/plugins/pi-agent-ide-terminal/src/ui.ts +11 -6
  797. package/src/plugins/pi-agent-ide-terminal/src/unix-pty-output.ts +47 -0
  798. package/src/post-edit/gate.ts +16 -1
  799. package/src/semantic/extension.ts +8 -2
  800. package/src/standalone/scoped-api.ts +85 -18
  801. package/src/toolchain/types.ts +4 -0
  802. package/dist/chunk-2AANEKFS.js +0 -1
  803. package/dist/chunk-33U3RUM3.js +0 -12
  804. package/dist/chunk-34IYWKY5.js +0 -1
  805. package/dist/chunk-4CSNQX54.js +0 -23
  806. package/dist/chunk-53IV6EKV.js +0 -1
  807. package/dist/chunk-5AROEOJB.js +0 -1
  808. package/dist/chunk-5D4C225L.js +0 -1
  809. package/dist/chunk-5W6QQZFI.js +0 -2
  810. package/dist/chunk-6W4OJLCJ.js +0 -1
  811. package/dist/chunk-6ZYCTWQE.js +0 -1
  812. package/dist/chunk-756K3LJY.js +0 -1
  813. package/dist/chunk-AMSNDWBT.js +0 -2
  814. package/dist/chunk-APWMLLSE.js +0 -17
  815. package/dist/chunk-BMSAVDRD.js +0 -13
  816. package/dist/chunk-BRJIXNFU.js +0 -5
  817. package/dist/chunk-C2GZLLSP.js +0 -5
  818. package/dist/chunk-ECSMTGVM.js +0 -6
  819. package/dist/chunk-EWTVVPUA.js +0 -11
  820. package/dist/chunk-FBR7ZLLN.js +0 -1
  821. package/dist/chunk-FGN2ZMEN.js +0 -1
  822. package/dist/chunk-FJSYWOE6.js +0 -1
  823. package/dist/chunk-FTECKRK6.js +0 -1
  824. package/dist/chunk-GRZTKMXQ.js +0 -1
  825. package/dist/chunk-HFCHOFLV.js +0 -2
  826. package/dist/chunk-HFF4GY7R.js +0 -3
  827. package/dist/chunk-HJXSEPO7.js +0 -111
  828. package/dist/chunk-HSEDKYH4.js +0 -1
  829. package/dist/chunk-II7AOJNH.js +0 -9
  830. package/dist/chunk-J34VKQGJ.js +0 -1
  831. package/dist/chunk-J6CDIH3S.js +0 -84
  832. package/dist/chunk-JHWLRL4U.js +0 -1
  833. package/dist/chunk-JMQ67UNK.js +0 -3
  834. package/dist/chunk-JRIP33PC.js +0 -13
  835. package/dist/chunk-K5M65CAF.js +0 -1
  836. package/dist/chunk-KJAR2WDO.js +0 -1
  837. package/dist/chunk-KX7MG72M.js +0 -1
  838. package/dist/chunk-L2B4DTVS.js +0 -1
  839. package/dist/chunk-LEKC4GQK.js +0 -5
  840. package/dist/chunk-LIGOOMJS.js +0 -10
  841. package/dist/chunk-LY2UANKU.js +0 -6
  842. package/dist/chunk-M7P7V4WI.js +0 -25
  843. package/dist/chunk-MXLSGMRZ.js +0 -3
  844. package/dist/chunk-N2NEFXHB.js +0 -13
  845. package/dist/chunk-NF74ITWT.js +0 -2
  846. package/dist/chunk-NQYUIQRH.js +0 -1
  847. package/dist/chunk-OCU6NW5Y.js +0 -1
  848. package/dist/chunk-OIEA4QWF.js +0 -4
  849. package/dist/chunk-ON5HDFNL.js +0 -10
  850. package/dist/chunk-P43GGKUC.js +0 -28
  851. package/dist/chunk-PPCWY4BB.js +0 -1
  852. package/dist/chunk-QGXZ4RWX.js +0 -1
  853. package/dist/chunk-S3T5NOSL.js +0 -1
  854. package/dist/chunk-S7E2D5K7.js +0 -5
  855. package/dist/chunk-SIYPD5MM.js +0 -3
  856. package/dist/chunk-STUZZM5B.js +0 -1
  857. package/dist/chunk-T4FTT3U4.js +0 -1
  858. package/dist/chunk-T5ACAOKJ.js +0 -4
  859. package/dist/chunk-TILMPAF2.js +0 -1
  860. package/dist/chunk-TSNY2FSU.js +0 -1
  861. package/dist/chunk-TWJINFQB.js +0 -9
  862. package/dist/chunk-TWQ6ACOI.js +0 -1
  863. package/dist/chunk-UDVVKVG4.js +0 -1
  864. package/dist/chunk-V2D5MLGE.js +0 -1
  865. package/dist/chunk-VDSSAP6Y.js +0 -1
  866. package/dist/chunk-VHYJTAXX.js +0 -1
  867. package/dist/chunk-WCSWQDJ2.js +0 -22
  868. package/dist/chunk-WQTF6Q2X.js +0 -3
  869. package/dist/chunk-XE4W5YTE.js +0 -2
  870. package/dist/chunk-YFPU2LRR.js +0 -23
  871. package/dist/chunk-YLEERRX3.js +0 -33
  872. package/dist/chunk-YOJHCARZ.js +0 -1
  873. package/dist/chunk-YPTDPMK5.js +0 -1
  874. package/docs/agent-guides/editing.md +0 -43
  875. package/docs/agent-guides/search.md +0 -38
  876. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +0 -73
  877. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-63.js +0 -2
  878. package/node_modules/pi-agent-text-anchor-exact/runtime/entry-64.js +0 -1
  879. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-66.js +0 -1
  880. package/node_modules/pi-agent-text-editor/runtime/entry-68.js +0 -1
  881. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-85.js +0 -2
  882. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +0 -2
  883. package/node_modules/pi-agent-tool-ui/runtime/entry-88.js +0 -1
  884. package/node_modules/pi-agent-tool-ui/runtime/entry-89.js +0 -1
  885. package/node_modules/pi-agent-web-html/runtime/entry-91.js +0 -2
  886. package/node_modules/pi-agent-web-image/runtime/entry-92.js +0 -2
  887. package/node_modules/pi-agent-web-pdf/runtime/entry-93.js +0 -2
  888. package/src/composite/search-facts.ts +0 -45
  889. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-91.js +0 -2
  890. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-92.js +0 -2
  891. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-93.js +0 -2
  892. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-94.js +0 -2
  893. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-58.js +0 -2
  894. package/src/extensions/pi-agent-search/runtime/entry-54.js +0 -1
  895. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-63.js +0 -2
  896. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-64.js +0 -1
  897. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-66.js +0 -1
  898. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-85.js +0 -2
  899. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-86.js +0 -2
  900. package/src/extensions/pi-agent-text-editor/runtime/entry-68.js +0 -1
  901. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +0 -73
  902. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-54.js +0 -0
  903. /package/node_modules/{pi-agent-search-text → pi-agent-search}/runtime/entry-58.js +0 -0
  904. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-62.js +0 -0
  905. /package/node_modules/{pi-agent-tool-call-interception → pi-agent-text-editor}/runtime/entry-87.js +0 -0
  906. /package/node_modules/{pi-agent-web → pi-agent-text-editor-stale-anchor}/runtime/entry-90.js +0 -0
  907. /package/node_modules/{pi-agent-web-text → pi-agent-web}/runtime/entry-94.js +0 -0
  908. /package/src/extensions/{pi-agent-read/extensions/pi-agent-web → pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor}/runtime/entry-90.js +0 -0
package/dist/entry-88.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e}from"./chunk-RQ7JJ7GV.js";import"./chunk-EI7MMDWY.js";export{a as OPERATION_APPROVAL_EVENT,b as OPERATION_PERMISSION_ENTRY,d as confirmOperation,e as createOperationApproval,c as registerOperationApproval};
1
+ import{a as o,b as n,c as d,d as m}from"./chunk-VB5P3TXJ.js";import"./chunk-YHADTHQM.js";import"./chunk-J5CKSIH7.js";import"./chunk-TIZ4QDF3.js";import"./chunk-JMCI2ZE2.js";import"./chunk-ASVMQMPX.js";import"./chunk-72WO7H5T.js";import"./chunk-QR7JR3P2.js";import"./chunk-E4V4VNRM.js";import"./chunk-VNG4QPPT.js";import"./chunk-YGGKGZO2.js";import"./chunk-VNNAVC4S.js";import"./chunk-6DC2Q5BI.js";import"./chunk-BW3XONMZ.js";import"./chunk-GTZOIJCH.js";import"./chunk-JXULBI4S.js";import"./chunk-SJQGFUXR.js";import"./chunk-QCAGAJHJ.js";import"./chunk-I3G6K7QU.js";import"./chunk-HSAGZWPO.js";import"./chunk-PS2B6THP.js";import"./chunk-XEPCURYZ.js";import"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import{c as i}from"./chunk-RQ7JJ7GV.js";import"./chunk-IRLWXPL4.js";import"./chunk-ZC65Z3CK.js";import{a as t}from"./chunk-EI7MMDWY.js";import{Type as a}from"typebox";function s(e){e.registerTool({name:"edit",label:"edit",description:"",exposure:"hidden",parameters:a.Object({},{additionalProperties:!1}),execute(){throw new Error("Hidden edit must never execute.")}})}t(s,"hideBuiltinEdit");async function p(e){i(e);let r=await d(e);s(e),m(e,r),n(e,r),o(e,r)}t(p,"registerTextEditor");export{p as default};
package/dist/entry-89.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-PS2B6THP.js";import"./chunk-EI7MMDWY.js";export{a as ResultPanel,d as ToolCallHeader,h as preserveEnclosingBackground,g as renderToolCallDetails,f as renderToolCallHeader,i as singleLine,b as sourceRows,c as toolBackgroundAnsi,e as toolCallHeader};
1
+ import{a}from"./chunk-XLTAP5YC.js";import"./chunk-GDIF3WT6.js";import"./chunk-VNNAVC4S.js";import"./chunk-6DC2Q5BI.js";import"./chunk-JXULBI4S.js";import"./chunk-QCAGAJHJ.js";import"./chunk-JY63UUC2.js";import"./chunk-PS2B6THP.js";import"./chunk-XEPCURYZ.js";import"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import"./chunk-IRLWXPL4.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as default};
package/dist/entry-90.js CHANGED
@@ -1 +1 @@
1
- import{b as a,c as b}from"./chunk-BRJIXNFU.js";import"./chunk-NNCZYO4Q.js";import"./chunk-HFCHOFLV.js";import"./chunk-5AROEOJB.js";import"./chunk-47SPPIXK.js";import"./chunk-VAXLSPPU.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-LY2UANKU.js";import"./chunk-PS2B6THP.js";import"./chunk-2DSY4U73.js";import"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import"./chunk-756K3LJY.js";import"./chunk-S7E2D5K7.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as default,b as registerWebWithOwner};
1
+ import{b as _}from"./chunk-YHADTHQM.js";import{a as v}from"./chunk-JMCI2ZE2.js";import"./chunk-72WO7H5T.js";import{b as k}from"./chunk-VNG4QPPT.js";import"./chunk-6DC2Q5BI.js";import{l as b}from"./chunk-BW3XONMZ.js";import{b as R}from"./chunk-GTZOIJCH.js";import"./chunk-JXULBI4S.js";import{a as O}from"./chunk-JY63UUC2.js";import"./chunk-PS2B6THP.js";import{d as S,e as x}from"./chunk-XEPCURYZ.js";import{B as M,ta as C}from"./chunk-OEEE5BLN.js";import{a as w}from"./chunk-2QCE7GOV.js";import"./chunk-IRLWXPL4.js";import{a as P}from"./chunk-ZC65Z3CK.js";import{a as h}from"./chunk-EI7MMDWY.js";var E="\0",$="";async function j(i){await O(i,{protocol:S,apiVersion:x,id:"text-editor-stale-anchor",setup(c){let s=B(i,c);k(i,s.handler),c.onMutationTool(s.add)}})}h(j,"registerTextEditorStaleAnchor");function B(i,r){let c=C(i),s=new Map,p=[],u=new Map,a=new Map,l=new Map,g={name:"text-editor-stale-anchor-inspection",blockExecution:!0,toolNames:p,async intercept(e){let o=s.get(e.toolCall.name);if(o===void 0)return;let n={...w(e.partialArgs??e.args,o.parameters,{cwd:e.cwd,sourceFields:[o.source.field,...(o.source.targets??[]).map(t=>t.field)],resolveSource:h(t=>c.source(t,e.cwd,!0),"resolveSource")})};try{for(let t of[o.source.field,...(o.source.targets??[]).map(d=>d.field)]){let d=n[t];if(d===void 0)continue;let f=c.source(d,e.cwd);if(typeof f=="string"&&!f.startsWith("RESULT#")){if(f.startsWith("SEARCH#"))return;n[t]=f;continue}let y=c.resolve(f,e.cwd,{forScope:!0,allowAdjusted:!0});if(!y.complete||y.targets.length!==1)return;n[t]=y.targets[0]?.source}}catch(t){return t instanceof M&&t.code==="NO_EDITABLE_TEXT"?H(e.toolCall.name,o.source.field,t.source,t.code):void 0}let m=L(n,e,u,o.source.field,o.source.inherited?_(i)?.source:void 0);if(m===void 0)return;let T;try{T=b(o.name,n)}catch{return}o.pair!==void 0&&T.push({sourceField:o.source.field,fields:o.pair});let A=new Set;for(let{sourceField:t,fields:d}of T){let f=n[t],y=await V(r,e,o,n,typeof f=="string"?f:m,d,a,l);if(y!==void 0)return y;if(d.every(I=>typeof n[I]=="string"))for(let I of d)A.add(I)}for(let t of o.anchors??[]){if(A.has(t.field))continue;let d=n[t.field];if(!R(t,d))continue;let f=n[t.sourceField],y=typeof f=="string"?f:m,I=await D(r,e,[t.field],y,[d],[t.kinds],a,l);if(I!==void 0)return I}},onContentEnd(e){a.delete(e),l.delete(e)},onAbort(e){a.delete(e),l.delete(e),u.delete(e)},onAgentEnd(){a.clear(),l.clear(),u.clear()}};return{handler:g,add(e){(e.anchors?.length??0)>0&&(s.set(e.name,e),p.push(e.name),k(i,g))}}}h(B,"createHandler");function L(i,r,c,s,p){let u=i[s];if(typeof u=="string")return r.contentIndex!==void 0&&c.set(r.contentIndex,u),u;if(r.contentIndex!==void 0)for(let a=r.contentIndex-1;a>=0;a-=1){let l=c.get(a);if(l!==void 0)return i[s]=l,l}return p!==void 0&&(i[s]=p),p}h(L,"resolveSource");async function V(i,r,c,s,p,[u,a],l,g){let e=s[u],o=s[a];if(typeof e!="string"||typeof o!="string")return;let n=c.anchors?.find(({field:T})=>T===u),m=c.anchors?.find(({field:T})=>T===a);if(!(n===void 0||m===void 0)&&!(!R(n,e)||!R(m,o)))return D(i,r,[u,a],p,[e,o],[n.kinds,m.kinds],l,g)}h(V,"inspectAnchorPair");async function D(i,r,c,s,p,u,a,l){let g=r.contentIndex??-1,e=`${s}${E}${c.join($)}${E}${p.join(E)}${E}${u.map(d=>d.join($)).join(E)}`,o=l.get(g)?.get(e);if(o!==void 0)return o;let n=a.get(g)?.get(e);if(n===void 0){let d=await i.inspectTextAnchors({source:s,anchors:p,kinds:u,cwd:r.cwd,...r.signal!==void 0&&{signal:r.signal}}),f=a.get(g)??new Map;f.set(e,d),a.set(g,f),n=d}if(n.kind==="valid")return;if(n.kind==="failed")return H(r.toolCall.name,s,n.reason,n.cause instanceof M?n.cause.code:void 0);if(n.rejectionCode!=="stale")return;let m=n.anchorIndex,T={guardId:"stale-anchor",effect:"not-applied",toolName:r.toolCall.name,field:P(c[m]),path:s,anchor:P(p[m]),...r.partialArgs!==void 0&&{stoppedEarly:!0}},A=N(T,n.reason),t=l.get(g)??new Map;return t.set(e,A),l.set(g,t),A}h(D,"inspectAnchors");function H(i,r,c,s){return{annotation:{kind:"blocked",reason:c},message:{customType:"text-editor-resolver-block",content:`[SYSTEM] ${i} blocked: ${c}`,display:!1,details:{guardId:"resolver",effect:"not-applied",...s===void 0?{}:{code:s},toolName:i,source:r,reason:c}}}}h(H,"makeResolverBlockResult");function N(i,r){return{annotation:{kind:"stale-anchor"},message:{customType:"text-editor-stale-anchor-block",content:v(i,r),display:!1,details:i}}}h(N,"makeBlockResult");export{j as default};
package/dist/entry-91.js CHANGED
@@ -1,3 +1 @@
1
- import{J as c}from"./chunk-SIYPD5MM.js";import{a as r}from"./chunk-EI7MMDWY.js";import{parseHTML as g}from"linkedom";async function d(t,n,e=p){try{let o=await e(t,n);return{content:o.content.trim(),title:o.title.trim(),usedFallback:!1}}catch{return{...b(t,n),usedFallback:!0}}}r(d,"extractReadableHtml");async function p(t,n){let e=u(t,n),{Defuddle:o}=await import("defuddle/node"),i=await o(e,n,{markdown:!0,useAsync:!1});return{content:i.content,title:i.title}}r(p,"extractWithDefuddle");function b(t,n){let e=u(t,n);for(let a of e.querySelectorAll("script, style, nav, footer, header, aside, noscript, template"))a.remove();let o=e.querySelector("article, main")??e.body??e.documentElement,i=s(o?.textContent??""),l=s(e.querySelector("title")?.textContent??"");return{content:i,title:l}}r(b,"extractPlainText");function u(t,n){let e=g(t);try{Object.defineProperty(e.document,"location",{value:new URL(n),configurable:!0})}catch{}return e.document}r(u,"parseDocument");function s(t){return t.replace(/\s+/gu," ").trim()}r(s,"normalizeWhitespace");var x=new Set(["application/xhtml+xml","text/html"]),w=/^\u{FEFF}?\s*(?:<!doctype\s+html\b|<(?:article|body|head|html)\b)/iu;function f(){return{id:"html",description:"Web page \u2014 readable page text.",async tryConvert(t,n){if(!E(t.bytes,t.mediaType))return{kind:"not-handled"};let e=m(n.signal);if(e!==void 0)return{kind:"failed",error:e};let o;try{o=new TextDecoder("utf8",{fatal:!0}).decode(t.bytes)}catch(y){return{kind:"failed",error:new TypeError(`${t.source} is not valid UTF-8 HTML`,{cause:y})}}let i=await d(o,t.source),l=m(n.signal);return l!==void 0?{kind:"failed",error:l}:{kind:"converted",content:[{type:"text",text:i.title.length===0?i.content:i.content.length===0?`# ${i.title}`:`# ${i.title}
2
-
3
- ${i.content}`}]}}}}r(f,"createHtmlContentConverter");function E(t,n){if(n!==void 0){let o=n.split(";",1)[0]?.trim().toLowerCase()??"";if(x.has(o))return!0}let e=new TextDecoder("utf8").decode(t.subarray(0,1024));return w.test(e)}r(E,"isHtmlInput");function m(t){if(t?.aborted===!0)return t.reason instanceof Error?t.reason:C()}r(m,"cancellationError");function C(){let t=new Error("The operation was aborted");return t.name="AbortError",t}r(C,"abortError");var h={target:{provider:"web",capability:"read"},converter:f(),priority:200};async function H(t){await c(t,h)}r(H,"registerWebHtml");export{H as default};
1
+ import{a,b,c,d,e,f,g,h}from"./chunk-JXULBI4S.js";import"./chunk-PS2B6THP.js";import"./chunk-EI7MMDWY.js";export{b as TOOL_CALL_INTERCEPTION_ANCHOR_RENDER_PATCH,a as TOOL_CALL_INTERCEPTION_DETAILS_KEY,f as ToolCallInterceptionRenderStore,c as getToolCallInterception,h as isToolCallAnnotation,e as withBlockedToolResult,d as withToolCallInterceptionDetails,g as withToolCallInterceptionRendering};
package/dist/entry-92.js CHANGED
@@ -1 +1 @@
1
- import{a as r}from"./chunk-XE4W5YTE.js";import{J as e}from"./chunk-SIYPD5MM.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:100};async function i(o){await e(o,n)}t(i,"registerWebImage");export{i as default};
1
+ import{a,b,c,d,e}from"./chunk-RQ7JJ7GV.js";import"./chunk-EI7MMDWY.js";export{a as OPERATION_APPROVAL_EVENT,b as OPERATION_PERMISSION_ENTRY,d as confirmOperation,e as createOperationApproval,c as registerOperationApproval};
package/dist/entry-93.js CHANGED
@@ -1 +1 @@
1
- import{a as r}from"./chunk-UGWRUW77.js";import{J as e}from"./chunk-SIYPD5MM.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:200};async function i(o){await e(o,n)}t(i,"registerWebPdf");export{i as default};
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-PS2B6THP.js";import"./chunk-EI7MMDWY.js";export{a as ResultPanel,d as ToolCallHeader,h as preserveEnclosingBackground,g as renderToolCallDetails,f as renderToolCallHeader,i as singleLine,b as sourceRows,c as toolBackgroundAnsi,e as toolCallHeader};
package/dist/entry-94.js CHANGED
@@ -1 +1 @@
1
- import{J as e}from"./chunk-SIYPD5MM.js";import{p as r}from"./chunk-S7E2D5K7.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:300};async function i(o){await e(o,n)}t(i,"registerWebText");export{i as default};
1
+ import{b as a,c as b}from"./chunk-KM4NOIOB.js";import"./chunk-NNCZYO4Q.js";import"./chunk-3JBQYLJ4.js";import"./chunk-47SPPIXK.js";import"./chunk-VAXLSPPU.js";import"./chunk-2YO6RVX4.js";import"./chunk-MLFJU2US.js";import"./chunk-IZTOXSTR.js";import"./chunk-I3G6K7QU.js";import"./chunk-HSAGZWPO.js";import"./chunk-PS2B6THP.js";import"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import"./chunk-2EY3LEZ7.js";import"./chunk-IRLWXPL4.js";import"./chunk-ZC65Z3CK.js";import"./chunk-EI7MMDWY.js";export{a as default,b as registerWebWithOwner};
@@ -0,0 +1,3 @@
1
+ import{ca as c}from"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import{a as r}from"./chunk-EI7MMDWY.js";import{parseHTML as g}from"linkedom";async function d(t,n,e=p){try{let o=await e(t,n);return{content:o.content.trim(),title:o.title.trim(),usedFallback:!1}}catch{return{...b(t,n),usedFallback:!0}}}r(d,"extractReadableHtml");async function p(t,n){let e=u(t,n),{Defuddle:o}=await import("defuddle/node"),i=await o(e,n,{markdown:!0,useAsync:!1});return{content:i.content,title:i.title}}r(p,"extractWithDefuddle");function b(t,n){let e=u(t,n);for(let a of e.querySelectorAll("script, style, nav, footer, header, aside, noscript, template"))a.remove();let o=e.querySelector("article, main")??e.body??e.documentElement,i=s(o?.textContent??""),l=s(e.querySelector("title")?.textContent??"");return{content:i,title:l}}r(b,"extractPlainText");function u(t,n){let e=g(t);try{Object.defineProperty(e.document,"location",{value:new URL(n),configurable:!0})}catch{}return e.document}r(u,"parseDocument");function s(t){return t.replace(/\s+/gu," ").trim()}r(s,"normalizeWhitespace");var x=new Set(["application/xhtml+xml","text/html"]),w=/^\u{FEFF}?\s*(?:<!doctype\s+html\b|<(?:article|body|head|html)\b)/iu;function f(){return{id:"html",description:"Web page \u2014 readable page text.",async tryConvert(t,n){if(!E(t.bytes,t.mediaType))return{kind:"not-handled"};let e=m(n.signal);if(e!==void 0)return{kind:"failed",error:e};let o;try{o=new TextDecoder("utf8",{fatal:!0}).decode(t.bytes)}catch(y){return{kind:"failed",error:new TypeError(`${t.source} is not valid UTF-8 HTML`,{cause:y})}}let i=await d(o,t.source),l=m(n.signal);return l!==void 0?{kind:"failed",error:l}:{kind:"converted",content:[{type:"text",text:i.title.length===0?i.content:i.content.length===0?`# ${i.title}`:`# ${i.title}
2
+
3
+ ${i.content}`}]}}}}r(f,"createHtmlContentConverter");function E(t,n){if(n!==void 0){let o=n.split(";",1)[0]?.trim().toLowerCase()??"";if(x.has(o))return!0}let e=new TextDecoder("utf8").decode(t.subarray(0,1024));return w.test(e)}r(E,"isHtmlInput");function m(t){if(t?.aborted===!0)return t.reason instanceof Error?t.reason:C()}r(m,"cancellationError");function C(){let t=new Error("The operation was aborted");return t.name="AbortError",t}r(C,"abortError");var h={target:{provider:"web",capability:"read"},converter:f(),priority:200};async function H(t){await c(t,h)}r(H,"registerWebHtml");export{H as default};
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-72X24ARV.js";import{ca as e}from"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:100};async function i(o){await e(o,n)}t(i,"registerWebImage");export{i as default};
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-UGWRUW77.js";import{ca as e}from"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:200};async function i(o){await e(o,n)}t(i,"registerWebPdf");export{i as default};
@@ -0,0 +1 @@
1
+ import{ca as e}from"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import{w as r}from"./chunk-IRLWXPL4.js";import{a as t}from"./chunk-EI7MMDWY.js";var n={target:{provider:"web",capability:"read"},converter:r(),priority:300};async function i(o){await e(o,n)}t(i,"registerWebText");export{i as default};
@@ -1,5 +1,5 @@
1
- import{a as Ce,b as ke}from"./chunk-OTVNO5SX.js";import{a as Te,b as Re}from"./chunk-LLP3EIJL.js";import{a as z,b as J,c as V,d as X,e as $,f as j}from"./chunk-XHFAV2NI.js";import{a as Pe}from"./chunk-VHYJTAXX.js";import"./chunk-JYITLCXC.js";import{a as ye}from"./chunk-M7P7V4WI.js";import{f as te}from"./chunk-33U3RUM3.js";import{a as we}from"./chunk-YGGKGZO2.js";import"./chunk-N2NEFXHB.js";import"./chunk-KQV2ZXLP.js";import"./chunk-MPT3R4BL.js";import{g as be}from"./chunk-KN6VPARZ.js";import"./chunk-2DSY4U73.js";import"./chunk-H6FEBUAP.js";import"./chunk-SIYPD5MM.js";import{a as ne,b as ve,c as Ee}from"./chunk-TSQ6FBTB.js";import{a as Ie,b as xe,c as Se,f as oe,g as Ae}from"./chunk-YNOR4LIE.js";import{c as he}from"./chunk-RQ7JJ7GV.js";import"./chunk-ZC65Z3CK.js";import{a as r}from"./chunk-EI7MMDWY.js";var ie={"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."],"search.semantic":["Optional semantic search","Search indexed project code by meaning using the selected engine."],"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 M=[T("ide.core",()=>import("./chunk-4CSNQX54.js")),T("ide.tips",()=>import("./chunk-7JWZPJI5.js")),T("ide.doctor",()=>import("./chunk-TWJINFQB.js")),T("ide.languages",()=>import("./entry-42.js"),["ide.doctor"]),T("read.core",()=>import("./entry-52.js")),T("ide.documentation",async()=>{let{default:e}=await import("./chunk-YPTDPMK5.js");return{default:r(t=>e(t),"default")}},["read.core"]),T("read.filesystem",()=>import("./entry-31.js"),["read.core","editor.core"]),T("read.ssh",()=>import("./chunk-II7AOJNH.js"),["read.filesystem"]),T("read.filesystem.jq",()=>import("./entry-34.js"),["read.filesystem","ide.documentation","ide.doctor"]),T("read.filesystem.image",()=>import("./entry-32.js"),["read.filesystem"]),T("read.filesystem.pdf",()=>import("./entry-35.js"),["read.filesystem"]),T("read.filesystem.text",()=>import("./entry-36.js"),["read.filesystem"]),T("read.web",()=>import("./chunk-NQYUIQRH.js"),["read.core"]),T("read.web.html",()=>import("./entry-91.js"),["read.web"]),T("read.web.image",()=>import("./entry-92.js"),["read.web"]),T("read.web.pdf",()=>import("./entry-93.js"),["read.web"]),T("read.web.text",()=>import("./entry-94.js"),["read.web"]),T("search.core",()=>import("./entry-57.js")),T("search.semantic",()=>import("./chunk-JRIP33PC.js"),["search.core"]),T("search.text",()=>import("./entry-58.js"),["search.core"]),T("editor.renderer",()=>import("./entry-85.js"),["editor.core"]),T("editor.core",()=>import("./entry-84.js")),T("editor.anchor.constant",()=>import("./entry-63.js"),["read.core","editor.core"]),T("editor.anchor.line-hash",()=>import("./entry-67.js"),["read.core","editor.core"]),T("editor.anchor.exact",()=>import("./entry-65.js"),["editor.core"]),T("editor.stale-anchor",()=>import("./entry-86.js"),["editor.core"]),T("ide.ast",()=>import("./entry-38.js"),["ide.core","read.core","search.core","editor.core"]),T("ide.formatter",()=>import("./chunk-53IV6EKV.js"),["ide.core"]),T("ide.lint",()=>import("./chunk-FJSYWOE6.js"),["ide.core"]),T("ide.changes",()=>import("./chunk-5DN2XBVI.js"),["ide.core","read.core","editor.core"]),T("ide.lsp",()=>import("./chunk-6ZYCTWQE.js"),["ide.core","read.core","search.core"]),T("ide.processes",()=>import("./chunk-34IYWKY5.js")),T("ide.debugger",()=>import("./chunk-YLEERRX3.js"),["ide.processes","read.core","editor.core"]),T("ide.terminal",()=>import("./chunk-P43GGKUC.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),T("ide.diagnostics",()=>import("./chunk-AMSNDWBT.js"),["ide.core","read.core"])];function T(e,t,s=[],d=!0){return{id:e,name:ie[e][0],description:ie[e][1],dependencies:s,async register(i,u){await(await t()).default(i,u)},...d?{}:{defaultEnabled:!1}}}r(T,"builtin");function K(e,t,s){return{kind:"choice",id:e,name:t,description:s,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}r(K,"presentationPreference");var Z=[{kind:"choice",id:"search.semantic.engine",name:"Semantic search engine",description:"Choose the engine used by /semantic-index and semantic_search.",default:"colgrep",group:"features",values:[{value:"colgrep",label:"ColGREP"},{value:"vera",label:"Vera"}]},{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"}]},K("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),K("ui.read","Read","Choose how Read calls and results are displayed."),K("ui.search","Search","Choose how Search calls and results are displayed."),K("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:"lsp.idle-timeout",name:"Language server idle timeout",description:"Minutes without requests before a language server stops; the next request starts it again. Use a positive number.",default:"10",group:"features",placeholder:"10"}];function Y(e,t,s=[]){let d=new Map;for(let p of e){if(d.has(p.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${p.id}`);d.set(p.id,p)}for(let p of e)for(let S of p.dependencies)if(!d.has(S))throw new Error(`Pi Agent IDE extension ${p.id} has unknown dependency ${S}`);let i=new Set;for(let p of t)d.has(p)&&i.add(p);for(let p of s)if(!d.has(p))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${p}`);let u=lt(d,s,i),c=new Set;for(let p of e)(p.defaultEnabled===!1&&!u.has(p.id)||i.has(p.id))&&c.add(p.id);let b=!0;for(;b;){b=!1;for(let p of e)c.has(p.id)||p.dependencies.every(S=>!c.has(S))||(c.add(p.id),b=!0)}return{enabled:e.filter(p=>!c.has(p.id)),disabled:c}}r(Y,"selectBuiltinExtensions");function lt(e,t,s){let d=new Set,i=[...t];for(;i.length>0;){let u=i.pop();if(!(d.has(u)||s.has(u))){d.add(u);for(let c of e.get(u)?.dependencies??[])d.has(c)||i.push(c)}}return d}r(lt,"collectForcedOn");import{Input as wt}from"@earendil-works/pi-tui";import{mkdir as ct,readFile as ut,writeFile as ft}from"node:fs/promises";import pt from"node:path";import{withFileMutationQueue as gt}from"@earendil-works/pi-coding-agent";async function _e(e,t,s=new Map,d=new Map,i){await gt(e,async()=>{let u=await j(e),c={};try{c=JSON.parse(await ut(e,"utf8"))}catch(m){if(!(m instanceof Error&&"code"in m&&m.code==="ENOENT"))throw m}let b=new Set(u.disabled),p=new Set(u.enabled);for(let[m,f]of t)b.delete(m),p.delete(m),f==="disabled"&&b.add(m),f==="enabled"&&p.add(m);let S={...u.preferences};for(let[m,f]of d)f===void 0?delete S[m]:S[m]=f;let A={...u.flags};for(let[m,f]of s)m==="pi-agent-ide-no-animations"&&delete c.noAnimations,m==="pi-agent-ide-no-post-processing"&&delete c.noPostProcessing,f===void 0?delete A[m]:A[m]=f;i===null&&delete c.preset,await ct(pt.dirname(e),{recursive:!0}),await ft(e,`${JSON.stringify({...c,disabled:[...b],enabled:[...p],...i==null?{}:{preset:i},...s.size>0?{flags:A}:{},...d.size>0?{preferences:S}:{}},null,2)}
2
- `)})}r(_e,"saveModuleChoices");import{getSettingsListTheme as mt}from"@earendil-works/pi-coding-agent";import{matchesKey as Q,SettingsList as ht,truncateToWidth as De,visibleWidth as Oe}from"@earendil-works/pi-tui";function Ne(e,t,s,d,i=""){let u=["extensions","behavior","ui"],c="extensions",b=r(w=>w==="extensions"?"modules":w==="behavior"?"features":"ui","itemKey"),p=r(w=>w==="extensions"?"modules":w==="behavior"?"features":"ui","changeKey"),S=r(()=>{let w=b(c),o=t()[w]??[];return new ht(o,12,mt(),(n,a)=>{s(p(c),n,a);for(let l of t()[w]??[]){let h=o.find(y=>y.id===l.id);h&&Object.assign(h,l)}},()=>d(!1),{enableSearch:!0})},"createList"),A=S(),m=r(w=>e.fg("borderMuted",w),"border"),f=r((w,o)=>{if(o<=1)return m("\u2502");let n=o-2,a=De(w,n);return`${m("\u2502")}${a}${" ".repeat(Math.max(0,n-Oe(a)))}${m("\u2502")}`},"row"),g=r(w=>m(w<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,w-2))}\u2524`),"rule");return{render(w){let o=Math.max(1,w),n=Math.max(1,o-4),a=` Agent IDE settings${i?` \xB7 ${i}`:""} `,l=o<=1?m("\u256D"):`${m("\u256D\u2500")}${e.fg("accent",e.bold(De(a,Math.max(0,o-3),"")))}${m(`${"\u2500".repeat(Math.max(0,o-Oe(a)-3))}\u256E`)}`,h={extensions:"Features",behavior:"Behavior",ui:"UI"},y=u.map(R=>R===c?e.fg("accent",e.bold(`[ ${h[R]} ]`)):e.fg("dim",` ${h[R]} `)).join(" "),I=A.render(n).map(R=>f(` ${R} `,o)),v=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc exit ");return[l,f(` ${y} `,o),g(o),...I,g(o),f(v,o),m(o<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,o-2))}\u256F`)]},invalidate(){A.invalidate()},handleInput(w){Q(w,"tab")||Q(w,"shift+tab")?(c=u[(u.indexOf(c)+(Q(w,"shift+tab")?2:1))%u.length]??"extensions",A=S()):Q(w,"ctrl+s")?d(!0):A.handleInput(w)}}}r(Ne,"createSettingsPanel");var yt=new Set(["pi-agent-ide-yolo","pi-agent-ide-filesystem-yolo","pi-agent-ide-no-post-processing","pi-agent-ide-no-animations","pi-agent-ide-code-review","pi-agent-ide-code-review-capture"]),bt=new Set(["search.semantic.engine","ui.codemode","ui.diffs","ui.read","ui.search","ui.terminal","processes.activity"]);function re(e){return!yt.has(e)}r(re,"flagRequiresReload");function se(e){return!bt.has(e)}r(se,"preferenceRequiresReload");function ae(e,t,s,d,i,u=new Set){let c=r(f=>Y(s,[...J(s,f.preset??"full"),...f.disabled],f.enabled).disabled,"selected"),b=c(e),p=c(t),S=s.filter(f=>b.has(f.id)!==p.has(f.id)).map(f=>f.name??f.id),A=$(e),m=$(t);for(let f of d)re(f.id)&&!u.has(f.id)&&(A[f.id]??f.default)!==(m[f.id]??f.default)&&S.push(f.name);for(let f of i)se(f.id)&&(e.preferences?.[f.id]??f.default)!==(t.preferences?.[f.id]??f.default)&&S.push(f.name);return S}r(ae,"pendingReloadChanges");function Me(e,t=[],s=[],d){let i=d;e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(u,c){if(c.hasUI)try{let b=await c.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(b===void 0)return;let p=V(process.env,void 0,c.cwd),S=await X(p);i??=S;let A=new Set(t.filter(R=>process.argv.some(E=>E===`--${R.id}`||E.startsWith(`--${R.id}=`))).map(R=>R.id)),m=new Set(ae(i,S,M,t,s,A)),f=b==="Project"?p.projectPath:p.globalPath,g=await j(f),w=await j(b==="Project"?p.globalPath:p.projectPath),o=new Map,n=new Map,a=new Map,l,h=await c.ui.custom((R,E,C,_)=>{let F=Ne(E,()=>{let O=new Set(g.disabled),k=new Set(g.enabled);for(let[P,x]of o)O.delete(P),k.delete(P),x==="disabled"&&O.add(P),x==="enabled"&&k.add(P);let N=Y(M,[...J(M,b==="Project"?(l===void 0?g.preset:l)??w.preset??"full":w.preset??(l===void 0?g.preset:l)??"full"),...O,...w.disabled],[...k,...w.enabled]);return{modules:M.map(P=>({id:P.id,label:`${P.name??P.id}${m.has(P.name??P.id)?" *":""}`,description:`${P.description??""} Reload required for changes. Effective: ${N.disabled.has(P.id)?"off":"on"}.${w.disabled.includes(P.id)?" Disabled in the other scope.":P.dependencies.some(x=>N.disabled.has(x))?" A dependency is disabled.":""}`,currentValue:o.get(P.id)??(g.disabled.includes(P.id)?"disabled":g.enabled.includes(P.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[D(),...W("features"),...L("features")],ui:[...W("ui"),...L("ui")]};function D(){let P=l===void 0?g.preset:l;return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:z.find(x=>x.value===P)?.label??"default",values:["default",...z.map(x=>x.label)]}}function L(P){return s.filter(x=>x.group===P).map(x=>{let q=a.has(x.id)?a.get(x.id):g.preferences?.[x.id];return{id:x.id,label:`${x.name}${m.has(x.name)?" *":""}`,description:`${x.description}${se(x.id)?" Reload required for changes.":""} Default: ${x.kind==="choice"?x.values.find(B=>B.value===x.default)?.label??x.default:x.default||"empty"}.`,currentValue:q===void 0?"default":x.kind==="choice"?x.values.find(B=>B.value===q)?.label??q:q,...x.kind==="choice"?{values:["default",...x.values.map(B=>B.label)]}:{submenu:r((B,ge)=>{let H=new wt,me=B==="default"?x.default:B;return me.length>0&&H.handleInput(me),H.focused=!0,H.onSubmit=dt=>ge(dt),H.onEscape=()=>ge(),H},"submenu")}}})}function W(P){return t.filter(x=>(x.group??"features")===P).map(x=>{let q=n.has(x.id)?n.get(x.id):$(g)[x.id];return{id:x.id,label:`${x.name}${m.has(x.name)?" *":""}`,description:`${x.description}${re(x.id)?" Reload required for changes.":""}`,currentValue:q===void 0?"default":q?x.labels?.on??"enabled":x.labels?.off??"disabled",values:["default",x.labels?.off??"disabled",x.labels?.on??"enabled"]}})}},(O,k,N)=>{if(O==="modules"){let D=g.disabled.includes(k)?"disabled":g.enabled.includes(k)?"enabled":"default";N===D?o.delete(k):o.set(k,N)}else if(k==="preset"){let D=z.find(L=>L.label===N)?.value??null;l=D===(g.preset??null)?void 0:D}else if(s.some(D=>D.id===k)){let D=s.find(W=>W.id===k),L=N==="default"||N.length===0?void 0:D?.kind==="choice"?D.values.find(W=>W.label===N)?.value:N;L===g.preferences?.[k]?a.delete(k):a.set(k,L)}else{let D=N==="default"?void 0:N===(t.find(L=>L.id===k)?.labels?.on??"enabled");D===$(g)[k]?n.delete(k):n.set(k,D)}},_,`${b}${m.size?" \xB7 * reload pending":""}`);return{render:r(O=>F.render(O),"render"),invalidate:r(()=>F.invalidate(),"invalidate"),handleInput(O){F.handleInput(O),R.requestRender()}}});if(o.size+n.size+a.size+(l===void 0?0:1)===0||!h&&!await c.ui.confirm("Unsaved changes","Save changes?"))return;await _e(f,o,n,a,l);let y=await X(p);for(let R of s){let E=y.preferences?.[R.id];if(E!==void 0&&R.kind==="choice"&&!R.values.some(C=>C.value===E))throw new Error(`Saved settings contain an invalid choice: ${R.id}`)}e.events?.emit(Ce,{preferences:y.preferences??{}}),e.events?.emit(Te,{flags:$(y)});let I=[];e.events?.emit(Pe,{cwd:c.cwd,waitUntil:r(R=>I.push(R),"waitUntil")}),await Promise.all(I);let v=ae(i,y,M,t,s,A);if(c.ui.setStatus("pi-agent-ide-reload",v.length?`Reload required (${v.length}; see settings)`:void 0),v.length===0){c.ui.notify(`Saved ${b.toLowerCase()} Agent IDE settings.`,"info");return}c.ui.notify(`Saved ${b.toLowerCase()} Agent IDE settings. Reload required: ${v.join(", ")}.`,"info"),await c.ui.confirm("Reload Pi?","Reload extensions to apply pending settings. In-memory extension state may reset.")&&await c.reload()}catch(b){c.ui.notify(b instanceof Error?b.message:String(b),"error")}}})}r(Me,"registerModuleSettings");import{readFile as vt}from"node:fs/promises";import de from"node:path";import{getMarkdownTheme as Et}from"@earendil-works/pi-coding-agent";import{Markdown as It,matchesKey as G,ScrollView as xt,truncateToWidth as St}from"@earendil-works/pi-tui";function At(){return vt(de.join(de.dirname(de.dirname(import.meta.dirname)),"docs/settings-help.md"),"utf8")}r(At,"readSettingsHelp");function $e(e){e.registerCommand("agent-ide-help",{description:"Read the short Agent IDE settings guide",async handler(t,s){if(!(s.mode!=="tui"||!s.hasUI))try{let d=await At();await s.ui.custom((i,u,c,b)=>new le(d,u,()=>Math.max(5,Math.min(36,i.terminal.rows-4)),()=>i.requestRender(),b),{overlay:!0,overlayOptions:{width:92,margin:1}})}catch(d){s.ui.notify(d instanceof Error?d.message:String(d),"error")}}})}r($e,"registerSettingsHelp");var le=class{constructor(t,s,d,i,u){this.content=t;this.theme=s;this.height=d;this.requestRender=i;this.done=u;this.markdown=this.createMarkdown(),this.scroll=new xt(this.markdown)}static{r(this,"SettingsHelpPanel")}markdown;scroll;createMarkdown(){return new It(this.content,0,0,Et(),{color:r(t=>this.theme.fg("text",t),"color")})}invalidate(){this.markdown.invalidate()}handleInput(t){if(G(t,"escape")){this.done();return}G(t,"up")?this.scroll.scrollBy(-1):G(t,"down")?this.scroll.scrollBy(1):G(t,"pageUp")?this.scroll.scrollBy(-this.scroll.viewportHeight):G(t,"pageDown")||G(t,"space")?this.scroll.scrollBy(this.scroll.viewportHeight):G(t,"home")?this.scroll.scrollToStart():G(t,"end")&&this.scroll.scrollToEnd()}render(t){let s=Math.max(1,t-4),d=this.markdown.render(s),i=Math.max(1,this.height()-4);this.scroll.updateLayout(d.length,i,this.requestRender);let u=d.slice(this.scroll.scrollTop,this.scroll.scrollTop+i);for(;u.length<i;)u.push("");let c=this.theme.fg("border","\u2500".repeat(Math.max(0,t-2))),b=r(p=>this.theme.fg("border","\u2502 ")+St(p,s,"\u2026",!0)+this.theme.fg("border"," \u2502"),"row");return[this.theme.fg("border","\u256D")+c+this.theme.fg("border","\u256E"),b(this.theme.fg("accent","Agent IDE settings help")),...u.map(b),b(this.theme.fg("muted","\u2191\u2193 scroll \xB7 PgUp/PgDn page \xB7 Home/End \xB7 Esc close")),this.theme.fg("border","\u2570")+c+this.theme.fg("border","\u256F")]}};function Fe(e,t){let s=[];return{definitions:s,register(d){if(s.some(i=>i.id===d.id))throw new Error(`Duplicate feature flag: ${d.id}`);s.push(d),e.registerFlag(d.id,{type:"boolean",description:d.description,default:t[d.id]??d.default})}}}r(Fe,"createFeatureFlags");function Le(e,t=Z){return{id:"ide-settings",description:"IDE settings and their scopes",triggers:[{tool:"read",resourcePrefixes:["docs:ide-settings"]}],get markdown(){let s={preferences:t,flags:e,modules:M.map(({id:i,name:u,description:c,defaultEnabled:b,dependencies:p})=>({id:i,name:u,description:c,default:b!==!1,dependencies:p})),presets:z};return`# IDE settings
1
+ import{a as Me}from"./chunk-X7CHS7JB.js";import{a as $e,b as Fe}from"./chunk-OTVNO5SX.js";import{a as Oe,b as Ne}from"./chunk-LLP3EIJL.js";import{a as V,b as z,c as J,d as X,e as $,f as B}from"./chunk-XHFAV2NI.js";import"./chunk-JYITLCXC.js";import{a as xe}from"./chunk-MCHU3BLO.js";import{b as Ae}from"./chunk-XKVU6AAS.js";import{a as Ie}from"./chunk-E4V4VNRM.js";import{f as Q}from"./chunk-GDIF3WT6.js";import"./chunk-VNG4QPPT.js";import{a as Te}from"./chunk-YGGKGZO2.js";import"./chunk-VNNAVC4S.js";import"./chunk-6DC2Q5BI.js";import"./chunk-BW3XONMZ.js";import"./chunk-GTZOIJCH.js";import"./chunk-JXULBI4S.js";import"./chunk-MPT3R4BL.js";import{g as Se}from"./chunk-KN6VPARZ.js";import"./chunk-I3G6K7QU.js";import"./chunk-HSAGZWPO.js";import"./chunk-PS2B6THP.js";import"./chunk-XEPCURYZ.js";import"./chunk-OEEE5BLN.js";import"./chunk-2QCE7GOV.js";import{a as re,b as Re,c as Pe}from"./chunk-TSQ6FBTB.js";import{a as Ce,b as _e,c as ke,f as ie,g as De}from"./chunk-YNOR4LIE.js";import{c as ve}from"./chunk-RQ7JJ7GV.js";import"./chunk-IRLWXPL4.js";import"./chunk-ZC65Z3CK.js";import{a as d}from"./chunk-EI7MMDWY.js";var se={"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."],"search.semantic":["Optional semantic search","Search indexed project code by meaning using the selected engine."],"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":["Line anchors","Select lines by content-derived anchors that stay valid while other lines change."],"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 M=[A("ide.core",()=>import("./chunk-AB6RSWMB.js")),A("ide.tips",()=>import("./chunk-7JWZPJI5.js")),A("ide.doctor",()=>import("./chunk-ZYG5E3DI.js")),A("ide.languages",()=>import("./entry-42.js"),["ide.doctor"]),A("read.core",()=>import("./entry-52.js")),A("ide.documentation",async()=>{let{default:e}=await import("./chunk-RYJEEBET.js");return{default:d(t=>e(t),"default")}},["read.core"]),A("read.filesystem",()=>import("./entry-31.js"),["read.core","editor.core"]),A("read.ssh",()=>import("./chunk-MNAIMZRO.js"),["read.filesystem"]),A("read.filesystem.jq",()=>import("./entry-34.js"),["read.filesystem","ide.documentation","ide.doctor"]),A("read.filesystem.image",()=>import("./entry-32.js"),["read.filesystem"]),A("read.filesystem.pdf",()=>import("./entry-35.js"),["read.filesystem"]),A("read.filesystem.text",()=>import("./entry-36.js"),["read.filesystem"]),A("read.web",()=>import("./chunk-7OAAM5FL.js"),["read.core"]),A("read.web.html",()=>import("./entry-95.js"),["read.web"]),A("read.web.image",()=>import("./entry-96.js"),["read.web"]),A("read.web.pdf",()=>import("./entry-97.js"),["read.web"]),A("read.web.text",()=>import("./entry-98.js"),["read.web"]),A("search.core",()=>import("./entry-58.js")),A("search.semantic",()=>import("./chunk-L2YDUMZC.js"),["search.core"]),A("search.text",()=>import("./entry-59.js"),["search.core"]),A("editor.renderer",()=>import("./entry-89.js"),["editor.core"]),A("editor.core",()=>import("./entry-88.js")),A("editor.anchor.constant",()=>import("./entry-64.js"),["read.core","editor.core"]),A("editor.anchor.line-hash",()=>import("./entry-68.js"),["read.core","editor.core"]),A("editor.anchor.exact",()=>import("./entry-66.js"),["editor.core"]),A("editor.stale-anchor",()=>import("./entry-90.js"),["editor.core"]),A("ide.ast",()=>import("./entry-38.js"),["ide.core","read.core","search.core","editor.core"]),A("ide.formatter",()=>import("./chunk-SKZTIAE4.js"),["ide.core"]),A("ide.lint",()=>import("./chunk-O2C3F3MA.js"),["ide.core"]),A("ide.changes",()=>import("./chunk-5TPYHUJV.js"),["ide.core","read.core","editor.core"]),A("ide.lsp",()=>import("./chunk-NSBRKTZ7.js"),["ide.core","read.core","search.core"]),A("ide.processes",()=>import("./chunk-GT2JPOBM.js")),A("ide.debugger",()=>import("./chunk-45EJ4762.js"),["ide.processes","read.core","editor.core"]),A("ide.terminal",()=>import("./chunk-3KM5DSWL.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),A("ide.diagnostics",()=>import("./chunk-NWCTAVGR.js"),["ide.core","read.core"])];function A(e,t,i=[],r=!0){return{id:e,name:se[e][0],description:se[e][1],dependencies:i,async register(n,s){await(await t()).default(n,s)},...r?{}:{defaultEnabled:!1}}}d(A,"builtin");function ee(e,t,i){return{kind:"choice",id:e,name:t,description:i,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}d(ee,"presentationPreference");var te=[{kind:"choice",id:"search.semantic.engine",name:"Semantic search engine",description:"Choose the engine used by /semantic-index and semantic_search.",default:"colgrep",group:"features",values:[{value:"colgrep",label:"ColGREP"},{value:"vera",label:"Vera"}]},{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"}]},ee("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),ee("ui.read","Read","Choose how Read calls and results are displayed."),ee("ui.search","Search","Choose how Search calls and results are displayed."),ee("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:"lsp.idle-timeout",name:"Language server idle timeout",description:"Minutes without requests before a language server stops; the next request starts it again. Use a positive number.",default:"10",group:"features",placeholder:"10"}];function Y(e,t,i=[]){let r=new Map;for(let p of e){if(r.has(p.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${p.id}`);r.set(p.id,p)}for(let p of e)for(let v of p.dependencies)if(!r.has(v))throw new Error(`Pi Agent IDE extension ${p.id} has unknown dependency ${v}`);let n=new Set;for(let p of t)r.has(p)&&n.add(p);for(let p of i)if(!r.has(p))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${p}`);let s=Tt(r,i,n),a=new Set;for(let p of e)(p.defaultEnabled===!1&&!s.has(p.id)||n.has(p.id))&&a.add(p.id);let f=!0;for(;f;){f=!1;for(let p of e)a.has(p.id)||p.dependencies.every(v=>!a.has(v))||(a.add(p.id),f=!0)}return{enabled:e.filter(p=>!a.has(p.id)),disabled:a}}d(Y,"selectBuiltinExtensions");function Tt(e,t,i){let r=new Set,n=[...t];for(;n.length>0;){let s=n.pop();if(!(r.has(s)||i.has(s))){r.add(s);for(let a of e.get(s)?.dependencies??[])r.has(a)||n.push(a)}}return r}d(Tt,"collectForcedOn");import{Input as Ft}from"@earendil-works/pi-tui";import{mkdir as St,readFile as At,writeFile as Rt}from"node:fs/promises";import Pt from"node:path";import{withFileMutationQueue as Ct}from"@earendil-works/pi-coding-agent";async function Le(e,t,i=new Map,r=new Map,n){await Ct(e,async()=>{let s=await B(e),a={};try{a=JSON.parse(await At(e,"utf8"))}catch(b){if(!(b instanceof Error&&"code"in b&&b.code==="ENOENT"))throw b}let f=new Set(s.disabled),p=new Set(s.enabled);for(let[b,g]of t)f.delete(b),p.delete(b),g==="disabled"&&f.add(b),g==="enabled"&&p.add(b);let v={...s.preferences};for(let[b,g]of r)g===void 0?delete v[b]:v[b]=g;let I={...s.flags};for(let[b,g]of i)b==="pi-agent-ide-no-animations"&&delete a.noAnimations,b==="pi-agent-ide-no-post-processing"&&delete a.noPostProcessing,g===void 0?delete I[b]:I[b]=g;n===null&&delete a.preset,await St(Pt.dirname(e),{recursive:!0}),await Rt(e,`${JSON.stringify({...a,disabled:[...f],enabled:[...p],...n==null?{}:{preset:n},...i.size>0?{flags:I}:{},...r.size>0?{preferences:v}:{}},null,2)}
2
+ `)})}d(Le,"saveModuleChoices");import{getSettingsListTheme as _t}from"@earendil-works/pi-coding-agent";import{matchesKey as ne,SettingsList as kt,truncateToWidth as je,visibleWidth as ae}from"@earendil-works/pi-tui";var Dt=12,Ot=3,Nt=18,Be=[" Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc exit "," Tab \xB7 Enter \xB7 Ctrl+S save \xB7 Esc "," Ctrl+S save "];function Ge(e,t,i,r,n="",s=()=>Number.POSITIVE_INFINITY){let a=["extensions","behavior","ui"],f="extensions",p=d(o=>o==="extensions"?"modules":o==="behavior"?"features":"ui","itemKey"),v=d(o=>o==="extensions"?"modules":o==="behavior"?"features":"ui","changeKey"),I=d(()=>Math.max(Ot,Math.min(Dt,s()-Nt)),"visibleEntries"),b=d(()=>{let o=p(f),c=t()[o]??[];return new kt(c,I(),_t(),(u,h)=>{i(v(f),u,h);for(let y of t()[o]??[]){let T=c.find(w=>w.id===y.id);T&&Object.assign(T,y)}},()=>r(!1),{enableSearch:!0})},"createList"),g=b(),m=d(o=>e.fg("borderMuted",o),"border"),S=d((o,c)=>{if(c<=1)return m("\u2502");let u=c-2,h=je(o,u);return`${m("\u2502")}${h}${" ".repeat(Math.max(0,u-ae(h)))}${m("\u2502")}`},"row"),l=d(o=>m(o<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,o-2))}\u2524`),"rule");return{render(o){let c=Math.max(1,o),u=Math.max(1,c-4),h=` Agent IDE settings${n?` \xB7 ${n}`:""} `,y=c<=1?m("\u256D"):`${m("\u256D\u2500")}${e.fg("accent",e.bold(je(h,Math.max(0,c-3),"")))}${m(`${"\u2500".repeat(Math.max(0,c-ae(h)-3))}\u256E`)}`,T={extensions:"Features",behavior:"Behavior",ui:"UI"},w=a.map(P=>P===f?e.fg("accent",e.bold(`[ ${T[P]} ]`)):e.fg("dim",` ${T[P]} `)).join(" "),R=g.render(u).map(P=>S(` ${P} `,c)),E=Be.find(P=>ae(P)<=c-2)??Be[2],_=e.fg("dim",E);return[y,S(` ${w} `,c),l(c),...R,l(c),S(_,c),m(c<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,c-2))}\u256F`)]},invalidate(){g.invalidate()},handleInput(o){ne(o,"tab")||ne(o,"shift+tab")?(f=a[(a.indexOf(f)+(ne(o,"shift+tab")?2:1))%a.length]??"extensions",g=b()):ne(o,"ctrl+s")?r(!0):g.handleInput(o)}}}d(Ge,"createSettingsPanel");var Mt=new Set(["pi-agent-ide-yolo","pi-agent-ide-filesystem-yolo","pi-agent-ide-no-post-processing","pi-agent-ide-no-animations","pi-agent-ide-code-review","pi-agent-ide-code-review-capture"]),$t=new Set(["search.semantic.engine","ui.codemode","ui.diffs","ui.read","ui.search","ui.terminal","processes.activity"]);function de(e){return!Mt.has(e)}d(de,"flagRequiresReload");function le(e){return!$t.has(e)}d(le,"preferenceRequiresReload");function ce(e,t,i,r,n,s=new Set){let a=d(g=>Y(i,[...z(i,g.preset??"full"),...g.disabled],g.enabled).disabled,"selected"),f=a(e),p=a(t),v=i.filter(g=>f.has(g.id)!==p.has(g.id)).map(g=>g.name??g.id),I=$(e),b=$(t);for(let g of r)de(g.id)&&!s.has(g.id)&&(I[g.id]??g.default)!==(b[g.id]??g.default)&&v.push(g.name);for(let g of n)le(g.id)&&(e.preferences?.[g.id]??g.default)!==(t.preferences?.[g.id]??g.default)&&v.push(g.name);return v}d(ce,"pendingReloadChanges");function Ue(e,t=[],i=[],r){let n=r;e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(s,a){if(a.hasUI)try{let f=await a.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(f===void 0)return;let p=J(process.env,void 0,a.cwd),v=await X(p);n??=v;let I=new Set(t.filter(R=>process.argv.some(E=>E===`--${R.id}`||E.startsWith(`--${R.id}=`))).map(R=>R.id)),b=new Set(ce(n,v,M,t,i,I)),g=f==="Project"?p.projectPath:p.globalPath,m=await B(g),S=await B(f==="Project"?p.globalPath:p.projectPath),l=new Map,o=new Map,c=new Map,u,h=await a.ui.custom((R,E,_,P)=>{let F=Ge(E,()=>{let O=new Set(m.disabled),k=new Set(m.enabled);for(let[C,x]of l)O.delete(C),k.delete(C),x==="disabled"&&O.add(C),x==="enabled"&&k.add(C);let N=Y(M,[...z(M,f==="Project"?(u===void 0?m.preset:u)??S.preset??"full":S.preset??(u===void 0?m.preset:u)??"full"),...O,...S.disabled],[...k,...S.enabled]);return{modules:M.map(C=>({id:C.id,label:`${C.name??C.id}${b.has(C.name??C.id)?" *":""}`,description:`${C.description??""} Reload required for changes. Effective: ${N.disabled.has(C.id)?"off":"on"}.${S.disabled.includes(C.id)?" Disabled in the other scope.":C.dependencies.some(x=>N.disabled.has(x))?" A dependency is disabled.":""}`,currentValue:l.get(C.id)??(m.disabled.includes(C.id)?"disabled":m.enabled.includes(C.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[D(),...W("features"),...L("features")],ui:[...W("ui"),...L("ui")]};function D(){let C=u===void 0?m.preset:u;return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:V.find(x=>x.value===C)?.label??"default",values:["default",...V.map(x=>x.label)]}}function L(C){return i.filter(x=>x.group===C).map(x=>{let q=c.has(x.id)?c.get(x.id):m.preferences?.[x.id];return{id:x.id,label:`${x.name}${b.has(x.name)?" *":""}`,description:`${x.description}${le(x.id)?" Reload required for changes.":""} Default: ${x.kind==="choice"?x.values.find(j=>j.value===x.default)?.label??x.default:x.default||"empty"}.`,currentValue:q===void 0?"default":x.kind==="choice"?x.values.find(j=>j.value===q)?.label??q:q,...x.kind==="choice"?{values:["default",...x.values.map(j=>j.label)]}:{submenu:d((j,we)=>{let H=new Ft,Ee=j==="default"?x.default:j;return Ee.length>0&&H.handleInput(Ee),H.focused=!0,H.onSubmit=It=>we(It),H.onEscape=()=>we(),H},"submenu")}}})}function W(C){return t.filter(x=>(x.group??"features")===C).map(x=>{let q=o.has(x.id)?o.get(x.id):$(m)[x.id];return{id:x.id,label:`${x.name}${b.has(x.name)?" *":""}`,description:`${x.description}${de(x.id)?" Reload required for changes.":""}`,currentValue:q===void 0?"default":q?x.labels?.on??"enabled":x.labels?.off??"disabled",values:["default",x.labels?.off??"disabled",x.labels?.on??"enabled"]}})}},(O,k,N)=>{if(O==="modules"){let D=m.disabled.includes(k)?"disabled":m.enabled.includes(k)?"enabled":"default";N===D?l.delete(k):l.set(k,N)}else if(k==="preset"){let D=V.find(L=>L.label===N)?.value??null;u=D===(m.preset??null)?void 0:D}else if(i.some(D=>D.id===k)){let D=i.find(W=>W.id===k),L=N==="default"||N.length===0?void 0:D?.kind==="choice"?D.values.find(W=>W.label===N)?.value:N;L===m.preferences?.[k]?c.delete(k):c.set(k,L)}else{let D=N==="default"?void 0:N===(t.find(L=>L.id===k)?.labels?.on??"enabled");D===$(m)[k]?o.delete(k):o.set(k,D)}},P,`${f}${b.size?" \xB7 * reload pending":""}`,()=>R.terminal.rows);return{render:d(O=>F.render(O),"render"),invalidate:d(()=>F.invalidate(),"invalidate"),handleInput(O){F.handleInput(O),R.requestRender()}}});if(l.size+o.size+c.size+(u===void 0?0:1)===0||!h&&!await a.ui.confirm("Unsaved changes","Save changes?"))return;await Le(g,l,o,c,u);let y=await X(p);for(let R of i){let E=y.preferences?.[R.id];if(E!==void 0&&R.kind==="choice"&&!R.values.some(_=>_.value===E))throw new Error(`Saved settings contain an invalid choice: ${R.id}`)}e.events?.emit($e,{preferences:y.preferences??{}}),e.events?.emit(Oe,{flags:$(y)});let T=[];e.events?.emit(Me,{cwd:a.cwd,waitUntil:d(R=>T.push(R),"waitUntil")}),await Promise.all(T);let w=ce(n,y,M,t,i,I);if(a.ui.setStatus("pi-agent-ide-reload",w.length?`Reload required (${w.length}; see settings)`:void 0),w.length===0){a.ui.notify(`Saved ${f.toLowerCase()} Agent IDE settings.`,"info");return}a.ui.notify(`Saved ${f.toLowerCase()} Agent IDE settings. Reload required: ${w.join(", ")}.`,"info"),await a.ui.confirm("Reload Pi?","Reload extensions to apply pending settings. In-memory extension state may reset.")&&await a.reload()}catch(f){a.ui.notify(f instanceof Error?f.message:String(f),"error")}}})}d(Ue,"registerModuleSettings");import{readFile as Lt}from"node:fs/promises";import ue from"node:path";import{getMarkdownTheme as jt}from"@earendil-works/pi-coding-agent";import{Markdown as Bt,matchesKey as G,ScrollView as Gt,truncateToWidth as Ut}from"@earendil-works/pi-tui";function qt(){return Lt(ue.join(ue.dirname(ue.dirname(import.meta.dirname)),"docs/settings-help.md"),"utf8")}d(qt,"readSettingsHelp");function qe(e){e.registerCommand("agent-ide-help",{description:"Read the short Agent IDE settings guide",async handler(t,i){if(!(i.mode!=="tui"||!i.hasUI))try{let r=await qt();await i.ui.custom((n,s,a,f)=>new fe(r,s,()=>Math.max(5,Math.min(36,n.terminal.rows-4)),()=>n.requestRender(),f),{overlay:!0,overlayOptions:{width:92,margin:1}})}catch(r){i.ui.notify(r instanceof Error?r.message:String(r),"error")}}})}d(qe,"registerSettingsHelp");var fe=class{constructor(t,i,r,n,s){this.content=t;this.theme=i;this.height=r;this.requestRender=n;this.done=s;this.markdown=this.createMarkdown(),this.scroll=new Gt(this.markdown)}static{d(this,"SettingsHelpPanel")}markdown;scroll;createMarkdown(){return new Bt(this.content,0,0,jt(),{color:d(t=>this.theme.fg("text",t),"color")})}invalidate(){this.markdown.invalidate()}handleInput(t){if(G(t,"escape")){this.done();return}G(t,"up")?this.scroll.scrollBy(-1):G(t,"down")?this.scroll.scrollBy(1):G(t,"pageUp")?this.scroll.scrollBy(-this.scroll.viewportHeight):G(t,"pageDown")||G(t,"space")?this.scroll.scrollBy(this.scroll.viewportHeight):G(t,"home")?this.scroll.scrollToStart():G(t,"end")&&this.scroll.scrollToEnd()}render(t){let i=Math.max(1,t-4),r=this.markdown.render(i),n=Math.max(1,this.height()-4);this.scroll.updateLayout(r.length,n,this.requestRender);let s=r.slice(this.scroll.scrollTop,this.scroll.scrollTop+n);for(;s.length<n;)s.push("");let a=this.theme.fg("border","\u2500".repeat(Math.max(0,t-2))),f=d(p=>this.theme.fg("border","\u2502 ")+Ut(p,i,"\u2026",!0)+this.theme.fg("border"," \u2502"),"row");return[this.theme.fg("border","\u256D")+a+this.theme.fg("border","\u256E"),f(this.theme.fg("accent","Agent IDE settings help")),...s.map(f),f(this.theme.fg("muted","\u2191\u2193 scroll \xB7 PgUp/PgDn page \xB7 Home/End \xB7 Esc close")),this.theme.fg("border","\u2570")+a+this.theme.fg("border","\u256F")]}};function We(e,t){let i=[];return{definitions:i,register(r){if(i.some(n=>n.id===r.id))throw new Error(`Duplicate feature flag: ${r.id}`);i.push(r),e.registerFlag(r.id,{type:"boolean",description:r.description,default:t[r.id]??r.default})}}}d(We,"createFeatureFlags");function Ve(e,t=te){return{id:"ide-settings",description:"IDE settings and their scopes",triggers:[{tool:"read",resourcePrefixes:["docs:ide-settings"]}],get markdown(){let i={preferences:t,flags:e,modules:M.map(({id:n,name:s,description:a,defaultEnabled:f,dependencies:p})=>({id:n,name:s,description:a,default:f!==!1,dependencies:p})),presets:V};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. The settings menu applies live settings on save and marks pending reload-only settings with an asterisk. Module selection, diagnostic buffering, developer mode and unknown external settings require reload; effective changes masked by other scopes, dependencies or CLI flags do not. Reverting pending changes clears the indicator. Built-in CLI flags can override saved defaults for an invocation.
5
5
 
@@ -23,22 +23,35 @@ Choices carry their saved value and human label. Text settings carry a descripti
23
23
 
24
24
  \`\`\`json
25
25
  {
26
- ${Object.entries(s).map(([i,u])=>` "${i}": [
27
- ${u.map(c=>` ${JSON.stringify(c)}`).join(`,
26
+ ${Object.entries(i).map(([n,s])=>` "${n}": [
27
+ ${s.map(a=>` ${JSON.stringify(a)}`).join(`,
28
28
  `)}
29
29
  ]`).join(`,
30
30
  `)}
31
31
  }
32
32
  \`\`\`
33
- `}}}r(Le,"createIdeSettingsDocumentation");function Be(e){let t=new Set,s=new Set;for(let d of e)if(d.startsWith("-"))t.add(d.slice(1)),s.delete(d.slice(1));else{let i=d.startsWith("+")?d.slice(1):d;t.delete(i),s.add(i)}return{excluded:t,requested:s}}r(Be,"resolveToolSelection");function je(e){let t=new Map,s=new Set;return{api:{...e,registerTool:r(i=>{let u=i.name.startsWith("ide_capability_");(i.namespace?.name.startsWith("ide_")===!0||u)&&t.set(i.name,{hide:r(()=>e.registerTool({...i,get description(){return i.description},get promptGuidelines(){return i.promptGuidelines},get parameters(){return i.parameters},exposure:"hidden"}),"hide"),restore:r(()=>e.registerTool(i),"restore")}),u&&(Be(e.getSettings().defaultTools??[]).excluded.has(i.name)?s.add(i.name):s.delete(i.name)),s.has(i.name)?t.get(i.name)?.hide():e.registerTool(i)},"registerTool")},reconcile(i=!1,u=[],c=!1){let{excluded:b,requested:p}=Be(e.getSettings().defaultTools??[]);for(let[g,w]of t)b.has(g)!==s.has(g)&&(b.has(g)?(w.hide(),s.add(g)):(w.restore(),s.delete(g)));let S=e.getAllTools().filter(g=>g.exposure!=="hidden"),A=new Set(e.getActiveTools());for(let g of S)i&&!c&&t.has(g.name)&&(p.has(g.name)||g.exposure==="deferred"&&u.includes(g.name))&&A.add(g.name);i&&!b.has("tool_search")&&S.some(g=>g.name==="tool_search")&&S.some(g=>t.has(g.name)&&g.exposure==="deferred")&&A.add("tool_search");let m=e.getActiveTools(),f=[...A].filter(g=>!s.has(g));(f.length!==m.length||f.some(g=>!m.includes(g)))&&e.setActiveTools(f)}}}r(je,"createIdeToolAvailability");import{Type as Tt}from"typebox";import{Text as Rt}from"@earendil-works/pi-tui";function Ge(e){return[...new Set(e.filter(t=>t!==void 0&&t!==""))].join(`
34
- `)}r(Ge,"joinUnique");function Ue(e,t){if(t.length===0)return e;let s=e.parameters;if(s.properties===void 0)throw new Error(`Capability target is not an object schema: ${e.name}`);let d={...s.properties};for(let i of t)for(let u of Object.keys(i.parameters??{}))if(!Object.hasOwn(d,u))throw new Error(`Unknown capability parameter: ${e.name}.${u}`);for(let[i,u]of Object.entries(d)){let c=t.map(b=>b.parameters?.[i]);c.some(b=>b!==void 0)&&(d[i]={...u,description:Ge([typeof u.description=="string"?u.description:void 0,...c])})}return{...e,description:Ge([e.description,...t.flatMap(i=>[i.description,...i.promptGuidelines??[]])]),parameters:{...e.parameters,properties:d},promptGuidelines:[...new Set([...e.promptGuidelines??[],...t.flatMap(i=>i.promptGuidelines??[])])]}}r(Ue,"composeCapabilitySchema");var qe="ide-capabilities/v1";function U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(U,"record");function Pt(e){if(!U(e)||typeof e.id!="string")throw new Error("Invalid IDE capability");if(e.version!==1||!/^[a-z][a-z0-9._-]*$/u.test(e.id))throw new Error("Invalid IDE capability identity");if(!Array.isArray(e.tools)||e.tools.some(t=>typeof t!="string"||!t))throw new Error("Invalid IDE capability tools");if(e.tools.length===0&&e.discovery===void 0)throw new Error("A capability needs an existing tool or a discovery loader");if(e.discovery!==void 0){let t=e.discovery;if(!U(t)||typeof t.name!="string"||!/^ide_capability_[a-z0-9_]+$/u.test(t.name)||typeof t.description!="string"||!t.description.trim())throw new Error("Invalid capability discovery metadata");if(t.namespace!==void 0&&(!U(t.namespace)||typeof t.namespace.name!="string"||typeof t.namespace.description!="string"))throw new Error("Invalid capability namespace")}if(!U(e.schemas))throw new Error("Invalid capability schemas");for(let t of Object.values(e.schemas))if(!U(t)||t.description!==void 0&&typeof t.description!="string"||t.parameters!==void 0&&(!U(t.parameters)||Object.values(t.parameters).some(s=>typeof s!="string"))||t.promptGuidelines!==void 0&&(!Array.isArray(t.promptGuidelines)||t.promptGuidelines.some(s=>typeof s!="string")))throw new Error("Invalid capability schema metadata")}r(Pt,"validate");function We(e){let t=new Map,s=new Map,d=new Set,i=new Set,u=!1,c=r(()=>new Set(e.getAllTools().filter(o=>o.exposure!=="hidden").map(o=>o.name)),"visibleTools"),b=r(o=>[...o.tools,...o.discovery?[o.discovery.name]:[]],"triggers"),p=r((o,n)=>b(o).some(a=>n.has(a)),"available"),S=r(()=>{if(!u)return;let o=c(),n=[...s].map(([a,l])=>{let h=[...t.values()].filter(y=>i.has(y.id)&&p(y,o)).flatMap(y=>y.schemas[a]===void 0?[]:[y.schemas[a]]);return l(h)});for(let a of n)a()},"refresh"),A=r(o=>{let n,a=r(l=>{let h=Ue(o,l),y=JSON.stringify([h.description,h.parameters,h.promptGuidelines]);return()=>{y!==n&&(e.registerTool(h),n=y)}},"prepare");for(let l of t.values()){let h=l.schemas[o.name];h!==void 0&&a([h])}s.set(o.name,a),e.registerTool(o),S()},"registerTool"),m=r(o=>{let n=c(),a=!1;for(let l of t.values())!i.has(l.id)&&p(l,n)&&b(l).some(h=>o.includes(h)&&n.has(h))&&(i.add(l.id),a=!0);a&&(e.appendEntry(qe,{version:1,active:[...i]}),S())},"activate"),f=r(o=>{let n=o.discovery;if(!(n===void 0||d.has(n.name))){if(e.getAllTools().some(a=>a.name===n.name))throw new Error(`Capability loader name is already registered: ${n.name}`);e.registerTool({name:n.name,label:n.name,description:n.description,exposure:"deferred",namespace:n.namespace,parameters:Tt.Object({}),renderResult(a){return new Rt(a.content.flatMap(l=>l.type==="text"?[l.text]:[]).join(`
35
- `),0,0)},async execute(){return m([n.name]),{content:[{type:"text",text:`Enabled capability ${o.id}.`}],details:{capability:o.id}}}}),d.add(n.name)}},"installLoader"),g=r(o=>{i=new Set;for(let n of o.sessionManager.getBranch())n.type!=="custom"||n.customType!==qe||!U(n.data)||n.data.version!==1||!Array.isArray(n.data.active)||(i=new Set(n.data.active.filter(a=>typeof a=="string")));S()},"restore"),w=e.events.on(ve,o=>{let n=o;try{let a=n.capability;if(Pt(a),t.has(a.id))throw new Error(`Duplicate capability: ${a.id}`);let l=a.discovery?.name;if(l!==void 0&&(s.has(l)||[...t.values()].some(y=>y.discovery?.name===l)||u&&e.getAllTools().some(y=>y.name===l)))throw new Error(`Capability loader name is already registered: ${l}`);for(let[y,I]of Object.entries(a.schemas))s.get(y)?.([I]);let h=structuredClone(a);u&&f(h),t.set(h.id,h),S(),n.accept()}catch(a){n.accept(a instanceof Error?a:new Error(String(a)))}});return e.on("session_shutdown",w),e.on("tool_call",o=>m([o.toolName])),e.on("tool_result",o=>{m([o.toolName]),!(o.toolName!=="tool_search"||o.isError||!U(o.details)||!Array.isArray(o.details.loaded))&&m(o.details.loaded.filter(n=>typeof n=="string"))}),e.events.emit(Ee,{version:1}),{api:{...e,registerTool:A},finalize(o){e.on("session_start",(n,a)=>{u=!0;let l=[];for(let h of t.values())try{f(h)}catch(y){t.delete(h.id),l.push(y instanceof Error?y.message:String(y))}if(o(),g(a),l.length>0)throw new Error(l.join(`
36
- `))}),e.on("session_tree",(n,a)=>g(a)),e.on("session_compact",(n,a)=>g(a)),e.on("before_agent_start",S),e.on("turn_start",S)}}}r(We,"createIdeCapabilities");import{ToolExecutionComponent as Je}from"@earendil-works/pi-coding-agent";import{Container as ce,Spacer as Ve,Text as ee}from"@earendil-works/pi-tui";import{isDeepStrictEqual as Ct}from"node:util";import{createCodemodeExtension as kt}from"@earendil-works/pi-coding-agent";function ze(e,t){let s=r(i=>{if(!i.startsWith("mcp__"))return;let u=e.getAllTools(),c=u.find(p=>p.name===i);if(!c||c.namespace||c.exposure==="hidden")return;let b=u.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===c.description&&Ct(p.parameters,c.parameters));return b.length===1?b[0]?.name:void 0},"source"),d;return e.registerToolRenderer((i,u)=>{let c=s(i);return c!=="codemode"?c===void 0?u():t.get(c):(d||kt()({...e,registerTool:r(b=>{let{renderShell:p,renderCall:S,renderResult:A}=b;d={renderShell:p,renderCall:S,renderResult:A}},"registerTool")}),d??u())}),e.on("before_agent_start",()=>{for(let i of e.getAllTools()){let u=s(i.name),c=u===void 0?void 0:t.get(u);if(!c)continue;let b=Object.getOwnPropertyDescriptors(c);delete b.namespace,b.name={value:i.name,enumerable:!0,configurable:!0,writable:!0},b.exposure={value:i.exposure==="model-only"?i.exposure:"deferred",enumerable:!0,configurable:!0,writable:!0};let p=r(m=>{let f=c.prepareLoadout?.(m);return m.declared.some(g=>g.name===c.name)?{...f,hiddenDeclarations:[...f?.hiddenDeclarations??[],i.name]}:f},"prepareLoadout");b.prepareLoadout={value:p,enumerable:!0,configurable:!0,writable:!0};let S=r(async(m,f,g,w,o)=>{let{result:n,isError:a}=await o.executeTool(c.name,f,{signal:g,onUpdate:w}),{usage:l,...h}=n;return{...h,isError:a}},"execute");b.execute={value:S,enumerable:!0,configurable:!0,writable:!0};let A=Object.defineProperties({},b);e.registerTool(A)}}),s}r(ze,"registerIdeAliasCompatibility");var ue="ide-nested-results",Ye=256,He=512*1024,Xe=8*1024,_t=32*1024,Dt=r(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function Ke(e){let t=e.retention,s=[t?.argumentsTruncated&&"arguments shortened",t?.resultsOmitted&&"result displays omitted",t?.callsOmitted&&"call panels omitted",t?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(s.length>0)return`Nested IDE display: ${s.join("; ")}. Tool execution and parent output are unchanged.`;if(!t&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}r(Ke,"retentionWarning");function Ot(e){let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let s=Math.floor(t),d=Math.floor(s/60);return d<60?`${d}m ${s%60}s`:`${Math.floor(d/60)}h ${d%60}m ${s%60}s`}r(Ot,"formatToolDuration");function Ze(e,t=!1){let s=new Map,d=ze(e,s),i=new Map,u=new Map,c=new Map,b,p=new WeakMap,S=new WeakMap,A=r(o=>{let n=s.get(o),a=n?.renderResult;if(!n||!a)return n;let l=S.get(n);if(!l){let h=new WeakMap;l={...n,renderResult(y,I,v,R){let E=R.lastComponent&&h.get(R.lastComponent),C=a.call(n,y,I,v,{...R,lastComponent:E??R.lastComponent});if(I.isPartial||R.durationMs===void 0)return C;let _=new ce;return _.addChild(C),_.addChild(new Ve(1)),_.addChild(new ee(v.fg("muted",`Took ${Ot(R.durationMs)}`),0,0)),h.set(_,C),_}},S.set(n,l)}return l},"timedDefinition"),m=r((o,n,a)=>{n.result=a,n.resultOmitted=!1;try{let h=JSON.stringify(o);if(Buffer.byteLength(h)<=He){n.result=JSON.parse(JSON.stringify(a));return}}catch{}let l=a.details&&typeof a.details=="object"?Object.entries(a.details).filter(([h,y])=>(h==="source"||h==="fullOutputPath")&&typeof y=="string").map(([h,y])=>`${h}: ${String(y)}`):[];n.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...l].join(`
37
- `)}],details:void 0,isError:a.isError},n.resultOmitted=!0},"retainResult"),f=r(()=>{i.clear(),u.clear(),c.clear()},"clear");e.on("session_start",(o,n)=>{f(),n.mode==="tui"&&n.ui.setWidget(ue,a=>(b=a,{render:r(()=>[],"render"),invalidate:r(()=>{},"invalidate")}))}),e.on("session_tree",f),e.on("session_shutdown",f),e.on("tool_execution_start",(o,n)=>{if(o.parentToolCallId===void 0){let E=d(o.toolName);E!==void 0&&i.set(o.toolCallId,E);return}let a=u.get(o.parentToolCallId)??o.parentToolCallId;if(u.set(o.toolCallId,a),i.get(a)===o.toolName||!s.has(o.toolName))return;let l=c.get(a);if(l||(l={parentToolCallId:a,cwd:n.cwd,calls:[],retention:Dt()},c.set(a,l)),l.calls.length>=Ye){l.retention.callsOmitted=!0;return}let h=JSON.stringify(o.args),y=_t-l.calls.reduce((E,C)=>E+Buffer.byteLength(JSON.stringify(C.args)),0)-(Ye-l.calls.length-1)*2,I=Buffer.byteLength(h)>Math.min(Xe,y),v=I?Object.fromEntries(Object.entries(o.args).map(([E,C])=>[E,typeof C=="string"?C.slice(0,200)+(C.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(h),R=Buffer.byteLength(JSON.stringify(v))<=Math.min(Xe,y)?v:{};l.calls.push({id:o.toolCallId,name:o.toolName,args:R,argumentsTruncated:I})}),e.on("tool_execution_end",o=>{i.delete(o.toolCallId);let n=u.get(o.toolCallId);if(n===void 0)return;u.delete(o.toolCallId);let a=c.get(n),l=a?.calls.find(h=>h.id===o.toolCallId);if(a&&l){typeof o.durationMs=="number"&&Number.isFinite(o.durationMs)&&(l.durationMs=o.durationMs);let h=o.result;m(a,l,{content:h.content.filter(y=>y.type!=="text"||!y.text.startsWith(`
33
+ `}}}d(Ve,"createIdeSettingsDocumentation");var Wt=new Set(["ast_search","lsp_search","diff","undo"]);function ze(e,t){return{...e,get description(){return e.description},get promptGuidelines(){return e.promptGuidelines},get parameters(){return e.parameters},exposure:t}}d(ze,"withExposure");function Je(e){let t=new Set,i=new Set;for(let r of e)if(r.startsWith("-"))t.add(r.slice(1)),i.delete(r.slice(1));else{let n=r.startsWith("+")?r.slice(1):r;t.delete(n),i.add(n)}return{excluded:t,requested:i}}d(Je,"resolveToolSelection");function Ye(e){let t=new Map,i=new Set;return{api:{...e,registerTool:d(n=>{let s=n.namespace?.name.startsWith("ide_")&&n.exposure!=="hidden"&&Wt.has(n.name)?ze(n,"deferred"):n,a=s.name.startsWith("ide_capability_");(s.namespace?.name.startsWith("ide_")===!0||a)&&t.set(s.name,{hide:d(()=>e.registerTool(ze(s,"hidden")),"hide"),restore:d(()=>e.registerTool(s),"restore")}),a&&(Je(e.getSettings().defaultTools??[]).excluded.has(s.name)?i.add(s.name):i.delete(s.name)),i.has(s.name)?t.get(s.name)?.hide():e.registerTool(s)},"registerTool")},reconcile(n=!1,s=[],a=!1){let{excluded:f,requested:p}=Je(e.getSettings().defaultTools??[]);for(let[m,S]of t)f.has(m)!==i.has(m)&&(f.has(m)?(S.hide(),i.add(m)):(S.restore(),i.delete(m)));let v=e.getAllTools().filter(m=>m.exposure!=="hidden"),I=new Set(e.getActiveTools());for(let m of v)n&&!a&&t.has(m.name)&&(p.has(m.name)||m.exposure==="deferred"&&s.includes(m.name))&&I.add(m.name);n&&!f.has("tool_search")&&v.some(m=>m.name==="tool_search")&&v.some(m=>t.has(m.name)&&m.exposure==="deferred")&&I.add("tool_search");let b=e.getActiveTools(),g=[...I].filter(m=>!i.has(m));(g.length!==b.length||g.some(m=>!b.includes(m)))&&e.setActiveTools(g)}}}d(Ye,"createIdeToolAvailability");function Vt(e){let t=e.filter(n=>n.exposure!=="hidden"),i=[],r=d((n,s)=>{n.length>0&&i.push({names:n,suffix:s})},"add");for(let[n,s]of[["ast_search"," for structural code search: syntax patterns, captures and enclosing functions or classes."],["lsp_search"," for navigation through language servers: symbol definitions, references and call graphs."],["diff"," when comparing text sources."],["undo"," when reverting the last text edit or an uncommitted Git change."]])t.some(a=>a.name===n)&&r([n],s);return r(t.filter(n=>n.namespace?.name==="ide_git").map(n=>n.name)," in ide_git when staging or unstaging selected Git changes."),t.some(n=>n.name==="debug"&&n.namespace?.name==="ide_debug")&&r(["debug"]," in ide_debug when creating a debugger session."),i}d(Vt,"getIdeToolGuidance");function He(e,t,i){let r=Vt(e),n=[],s=t.includes("codemode");s&&n.push("Inside Codemode, call known tools as tools.<name>(args), including deferred IDE tools. Find other tools with the script discovery functions in the Codemode description.");let a=r.some(({names:f})=>f.some(p=>!t.includes(p)));return!(s&&i)&&a&&(t.includes("tool_search")?n.push("For direct calls, use tool_search to load tools not yet listed."):s||n.push("Enable native tool_search to load deferred IDE tools.")),[...n,...r.map(({names:f,suffix:p})=>`Use ${f.join(" and ")}${p}`)].join(`
34
+ `)}d(He,"buildIdeDiscoveryGuidance");function Xe(e){if(e.toolName!=="codemode"||!e.isError)return;let[t]=e.content;if(t?.type!=="text"||!t.text.startsWith(`Script failed
35
+ `))return;let i=`Script error:
36
+ `;for(let r=e.content.length-1;r>0;r--){let n=e.content[r];if(n?.type!=="text")continue;let s=n.text.lastIndexOf(i);if(s===-1)continue;let a=s+i.length,f=n.text.slice(a),p=f.replace(/^TypeError: tools\.tool_search does not exist\.[^\r\n]*/u,"TypeError: tool_search is for direct calls only. Replace tools.tool_search({ query, limit }) with searchTools(query, { limit }).");if(p===f)return;let v=[...e.content];return v[r]={...n,text:n.text.slice(0,a)+p},{content:v}}}d(Xe,"explainCodemodeDiscoveryError");function zt(e){switch(e){case"openai-responses":case"openai-codex-responses":case"azure-openai-responses":return"responses";case"openai-completions":return"completions";case"anthropic-messages":return"anthropic";default:return"neutral"}}d(zt,"parallelToolFamily");var Jt={responses:"Use `multi_tool_use.parallel` to submit independent tool calls together.",completions:"Put independent calls in the same response's `tool_calls` array.",anthropic:"Put independent calls in multiple `tool_use` blocks in a single response.",neutral:"Submit independent tool calls together in a single response."};function Ke(e){return["Before calling tools, plan ALL calls you can make without seeing another call's result.","Batch independent calls, including reads of different files and edits to separate selections.",Jt[zt(e)],"Run calls in sequence only when a call needs an earlier result or their effects must be ordered; merge overlapping edits into one.","Plan \u2192 issue one parallel batch \u2192 analyze results \u2192 repeat for newly discovered calls.","Do not use shell scripts to parallelize IDE calls. In Codemode, use Promise.all for independent calls; keep dependent calls and edits to the same file in order."].join(`
37
+ `)}d(Ke,"buildParallelToolGuidance");import{Type as Yt}from"typebox";import{Text as Ht}from"@earendil-works/pi-tui";function Ze(e){return[...new Set(e.filter(t=>t!==void 0&&t!==""))].join(`
38
+ `)}d(Ze,"joinUnique");function Qe(e,t){if(t.length===0)return e;let i=e.parameters;if(i.properties===void 0)throw new Error(`Capability target is not an object schema: ${e.name}`);let r={...i.properties};for(let n of t)for(let s of Object.keys(n.parameters??{}))if(!Object.hasOwn(r,s))throw new Error(`Unknown capability parameter: ${e.name}.${s}`);for(let[n,s]of Object.entries(r)){let a=t.map(f=>f.parameters?.[n]);a.some(f=>f!==void 0)&&(r[n]={...s,description:Ze([typeof s.description=="string"?s.description:void 0,...a])})}return{...e,description:Ze([e.description,...t.flatMap(n=>[n.description,...n.promptGuidelines??[]])]),parameters:{...e.parameters,properties:r},promptGuidelines:[...new Set([...e.promptGuidelines??[],...t.flatMap(n=>n.promptGuidelines??[])])]}}d(Qe,"composeCapabilitySchema");var et="ide-capabilities/v1";function U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}d(U,"record");function Xt(e){if(!U(e)||typeof e.id!="string")throw new Error("Invalid IDE capability");if(e.version!==1||!/^[a-z][a-z0-9._-]*$/u.test(e.id))throw new Error("Invalid IDE capability identity");if(!Array.isArray(e.tools)||e.tools.some(t=>typeof t!="string"||!t))throw new Error("Invalid IDE capability tools");if(e.tools.length===0&&e.discovery===void 0)throw new Error("A capability needs an existing tool or a discovery loader");if(e.discovery!==void 0){let t=e.discovery;if(!U(t)||typeof t.name!="string"||!/^ide_capability_[a-z0-9_]+$/u.test(t.name)||typeof t.description!="string"||!t.description.trim())throw new Error("Invalid capability discovery metadata");if(t.namespace!==void 0&&(!U(t.namespace)||typeof t.namespace.name!="string"||typeof t.namespace.description!="string"))throw new Error("Invalid capability namespace")}if(!U(e.schemas))throw new Error("Invalid capability schemas");for(let t of Object.values(e.schemas))if(!U(t)||t.description!==void 0&&typeof t.description!="string"||t.parameters!==void 0&&(!U(t.parameters)||Object.values(t.parameters).some(i=>typeof i!="string"))||t.promptGuidelines!==void 0&&(!Array.isArray(t.promptGuidelines)||t.promptGuidelines.some(i=>typeof i!="string")))throw new Error("Invalid capability schema metadata")}d(Xt,"validate");function tt(e){let t=new Map,i=new Map,r=new Set,n=new Set,s=!1,a=d(()=>new Set(e.getAllTools().filter(l=>l.exposure!=="hidden").map(l=>l.name)),"visibleTools"),f=d(l=>[...l.tools,...l.discovery?[l.discovery.name]:[]],"triggers"),p=d((l,o)=>f(l).some(c=>o.has(c)),"available"),v=d(()=>{if(!s)return;let l=a(),o=[...i].map(([c,u])=>{let h=[...t.values()].filter(y=>n.has(y.id)&&p(y,l)).flatMap(y=>y.schemas[c]===void 0?[]:[y.schemas[c]]);return u(h)});for(let c of o)c()},"refresh"),I=d(l=>{let o,c=d(u=>{let h=Qe(l,u),y=JSON.stringify([h.description,h.parameters,h.promptGuidelines]);return()=>{y!==o&&(e.registerTool(h),o=y)}},"prepare");for(let u of t.values()){let h=u.schemas[l.name];h!==void 0&&c([h])}i.set(l.name,c),e.registerTool(l),v()},"registerTool"),b=d(l=>{let o=a(),c=!1;for(let u of t.values())!n.has(u.id)&&p(u,o)&&f(u).some(h=>l.includes(h)&&o.has(h))&&(n.add(u.id),c=!0);c&&(e.appendEntry(et,{version:1,active:[...n]}),v())},"activate"),g=d(l=>{let o=l.discovery;if(!(o===void 0||r.has(o.name))){if(e.getAllTools().some(c=>c.name===o.name))throw new Error(`Capability loader name is already registered: ${o.name}`);e.registerTool({name:o.name,label:o.name,description:o.description,exposure:"deferred",namespace:o.namespace,parameters:Yt.Object({}),renderResult(c){return new Ht(c.content.flatMap(u=>u.type==="text"?[u.text]:[]).join(`
39
+ `),0,0)},async execute(){return b([o.name]),{content:[{type:"text",text:`Enabled capability ${l.id}.`}],details:{capability:l.id}}}}),r.add(o.name)}},"installLoader"),m=d(l=>{n=new Set;for(let o of l.sessionManager.getBranch())o.type!=="custom"||o.customType!==et||!U(o.data)||o.data.version!==1||!Array.isArray(o.data.active)||(n=new Set(o.data.active.filter(c=>typeof c=="string")));v()},"restore"),S=e.events.on(Re,l=>{let o=l;try{let c=o.capability;if(Xt(c),t.has(c.id))throw new Error(`Duplicate capability: ${c.id}`);let u=c.discovery?.name;if(u!==void 0&&(i.has(u)||[...t.values()].some(y=>y.discovery?.name===u)||s&&e.getAllTools().some(y=>y.name===u)))throw new Error(`Capability loader name is already registered: ${u}`);for(let[y,T]of Object.entries(c.schemas))i.get(y)?.([T]);let h=structuredClone(c);s&&g(h),t.set(h.id,h),v(),o.accept()}catch(c){o.accept(c instanceof Error?c:new Error(String(c)))}});return e.on("session_shutdown",S),e.on("tool_call",l=>b([l.toolName])),e.on("tool_result",l=>{b([l.toolName]),!(l.toolName!=="tool_search"||l.isError||!U(l.details)||!Array.isArray(l.details.loaded))&&b(l.details.loaded.filter(o=>typeof o=="string"))}),e.events.emit(Pe,{version:1}),{api:{...e,registerTool:I},finalize(l){e.on("session_start",(o,c)=>{s=!0;let u=[];for(let h of t.values())try{g(h)}catch(y){t.delete(h.id),u.push(y instanceof Error?y.message:String(y))}if(l(),m(c),u.length>0)throw new Error(u.join(`
40
+ `))}),e.on("session_tree",(o,c)=>m(c)),e.on("session_compact",(o,c)=>m(c)),e.on("before_agent_start",v),e.on("turn_start",v)}}}d(tt,"createIdeCapabilities");import{DEFAULT_MAX_BYTES as Qt,DEFAULT_MAX_LINES as en,truncateHead as tn,ToolExecutionComponent as it}from"@earendil-works/pi-coding-agent";import{Container as pe,Spacer as st,Text as oe}from"@earendil-works/pi-tui";import{isDeepStrictEqual as Kt}from"node:util";import{createCodemodeExtension as Zt}from"@earendil-works/pi-coding-agent";function nt(e){return e.name==="codemode"&&e.sourceInfo.source==="builtin"&&e.sourceInfo.path==="builtin:codemode"}d(nt,"isBuiltinCodemode");function ot(e){let t=e?.renderResult;return t?{...e,renderResult:d((i,r,n,s)=>t(Ae(i),r,n,s),"renderResult")}:e}d(ot,"withCodemodeGuideFiltering");function rt(e,t){let i=d(n=>{if(!n.startsWith("mcp__"))return;let s=e.getAllTools(),a=s.find(p=>p.name===n);if(!a||a.namespace||a.exposure==="hidden")return;let f=s.filter(p=>(t.has(p.name)&&p.namespace?.name.startsWith("ide_")===!0||nt(p))&&p.exposure!=="hidden"&&p.description===a.description&&Kt(p.parameters,a.parameters));return f.length===1?f[0]?.name:void 0},"source"),r;return e.registerToolRenderer((n,s)=>{if(n==="codemode"&&e.getAllTools().some(nt))return ot(s());let a=i(n);return a!=="codemode"?a===void 0?s():t.get(a):(r||Zt()({...e,registerTool:d(f=>{let{renderShell:p,renderCall:v,renderResult:I}=f;r={renderShell:p,renderCall:v,renderResult:I}},"registerTool")}),r?ot(r):s())}),e.on("before_agent_start",()=>{for(let n of e.getAllTools()){let s=i(n.name),a=s===void 0?void 0:t.get(s);if(!a)continue;let f=Object.getOwnPropertyDescriptors(a);delete f.namespace,f.name={value:n.name,enumerable:!0,configurable:!0,writable:!0},f.exposure={value:n.exposure==="model-only"?n.exposure:"deferred",enumerable:!0,configurable:!0,writable:!0};let p=d(b=>{let g=a.prepareLoadout?.(b);return b.declared.some(m=>m.name===a.name)?{...g,hiddenDeclarations:[...g?.hiddenDeclarations??[],n.name]}:g},"prepareLoadout");f.prepareLoadout={value:p,enumerable:!0,configurable:!0,writable:!0};let v=d(async(b,g,m,S,l)=>{let{result:o,isError:c}=await l.executeTool(a.name,g,{signal:m,onUpdate:S}),{usage:u,...h}=o;return{...h,isError:c}},"execute");f.execute={value:v,enumerable:!0,configurable:!0,writable:!0};let I=Object.defineProperties({},f);e.registerTool(I)}}),i}d(rt,"registerIdeAliasCompatibility");var ge="ide-nested-results",at=256,dt=512*1024,lt=8*1024,nn=32*1024,on=d(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function ct(e){let t=e.retention,i=[t?.argumentsTruncated&&"arguments shortened",t?.resultsOmitted&&"result displays omitted",t?.callsOmitted&&"call panels omitted",t?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(i.length>0)return`Nested IDE display: ${i.join("; ")}. Tool execution and parent output are unchanged.`;if(!t&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}d(ct,"retentionWarning");function rn(e){let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let i=Math.floor(t),r=Math.floor(i/60);return r<60?`${r}m ${i%60}s`:`${Math.floor(r/60)}h ${r%60}m ${i%60}s`}d(rn,"formatToolDuration");function sn(e){let t=e.content.map(r=>{if(r.type!=="text")return r;let n=/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u.exec(r.text)?.[0],s=n?r.text.slice(n.length):r.text,a=tn(s,{maxBytes:Qt,maxLines:en});if(!a.truncated)return r;let f=`[Showing ${a.outputLines} of ${a.totalLines} lines in this panel; the calling tool received the whole result.]`;return{...r,text:(n??"")+(a.content?`${a.content}
41
+
42
+ ${f}`:f)}});if(t.every((r,n)=>r===e.content[n]))return;let i=e.details!==null&&typeof e.details=="object"?Object.fromEntries(Object.entries(e.details).filter(([,r])=>["string","number","boolean"].includes(typeof r))):e.details;return{...e,content:t,details:i}}d(sn,"shortenedDisplay");function ut(e,t=!1){let i=new Map,r=rt(e,i),n=new Map,s=new Map,a=new Map,f,p=new WeakMap,v=new WeakMap,I=d(l=>{let o=i.get(l),c=o?.renderResult;if(!o||!c)return o;let u=v.get(o);if(!u){let h=new WeakMap;u={...o,renderResult(y,T,w,R){let E=R.lastComponent&&h.get(R.lastComponent),_=c.call(o,y,T,w,{...R,lastComponent:E??R.lastComponent});if(T.isPartial||R.durationMs===void 0)return _;let P=new pe;return P.addChild(_),P.addChild(new st(1)),P.addChild(new oe(w.fg("muted",`Took ${rn(R.durationMs)}`),0,0)),h.set(P,_),P}},v.set(o,u)}return u},"timedDefinition"),b=d((l,o,c)=>{o.resultOmitted=!1;for(let h of[c,o.name==="read"?sn(c):void 0])if(h!==void 0){o.result=h;try{let y=JSON.stringify(l);if(Buffer.byteLength(y)<=dt){o.result=JSON.parse(JSON.stringify(h));return}}catch{}}let u=c.details&&typeof c.details=="object"?Object.entries(c.details).filter(([h,y])=>(h==="source"||h==="fullOutputPath")&&typeof y=="string").map(([h,y])=>`${h}: ${String(y)}`):[];o.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...u].join(`
43
+ `)}],details:void 0,isError:c.isError},o.resultOmitted=!0},"retainResult"),g=d(()=>{n.clear(),s.clear(),a.clear()},"clear");e.on("session_start",(l,o)=>{g(),o.mode==="tui"&&o.ui.setWidget(ge,c=>(f=c,{render:d(()=>[],"render"),invalidate:d(()=>{},"invalidate")}))}),e.on("session_tree",g),e.on("session_shutdown",g),e.on("tool_execution_start",(l,o)=>{if(l.parentToolCallId===void 0){let E=r(l.toolName);E!==void 0&&n.set(l.toolCallId,E);return}let c=s.get(l.parentToolCallId)??l.parentToolCallId;if(s.set(l.toolCallId,c),n.get(c)===l.toolName||!i.has(l.toolName))return;let u=a.get(c);if(u||(u={parentToolCallId:c,cwd:o.cwd,calls:[],retention:on()},a.set(c,u)),u.calls.length>=at){u.retention.callsOmitted=!0;return}let h=JSON.stringify(l.args),y=nn-u.calls.reduce((E,_)=>E+Buffer.byteLength(JSON.stringify(_.args)),0)-(at-u.calls.length-1)*2,T=Buffer.byteLength(h)>Math.min(lt,y),w=T?Object.fromEntries(Object.entries(l.args).map(([E,_])=>[E,typeof _=="string"?_.slice(0,200)+(_.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(h),R=Buffer.byteLength(JSON.stringify(w))<=Math.min(lt,y)?w:{};u.calls.push({id:l.toolCallId,name:l.toolName,args:R,argumentsTruncated:T})}),e.on("tool_execution_end",l=>{n.delete(l.toolCallId);let o=s.get(l.toolCallId);if(o===void 0)return;s.delete(l.toolCallId);let c=a.get(o),u=c?.calls.find(h=>h.id===l.toolCallId);if(c&&u){typeof l.durationMs=="number"&&Number.isFinite(l.durationMs)&&(u.durationMs=l.durationMs);let h=l.result;b(c,u,{content:h.content.filter(y=>y.type!=="text"||!y.text.startsWith(`
38
44
 
39
45
  ---
40
46
 
41
- # Guide:`)),details:h.details,isError:o.isError})}}),e.on("message_end",o=>{if(o.message.role!=="toolResult")return;let n=c.get(o.message.toolCallId);if(!n)return;c.delete(o.message.toolCallId);for(let[y,I]of u)I===n.parentToolCallId&&u.delete(y);let a=n.calls.filter(y=>!y.batched),l={...n,parentToolName:o.message.toolName,calls:[],retention:{...n.retention,argumentsTruncated:a.some(y=>y.argumentsTruncated===!0),resultsOmitted:a.some(y=>y.resultOmitted===!0),resultsUnavailable:a.some(y=>!y.result)}},h=Buffer.byteLength(JSON.stringify(l));for(let y of a){let I=JSON.stringify(y);if(h+=Buffer.byteLength(I)+(l.calls.length>0?1:0),h>He){l.retention.callsOmitted=!0;break}l.calls.push(JSON.parse(I))}e.appendEntry(ue,l)}),e.registerEntryRenderer(ue,r(function o(n,a,l){if(!Array.isArray(n.data?.calls))return;let h=(typeof t=="function"?t():t)&&n.data.parentToolName==="codemode"&&!a.expanded,y=h?n.data.calls.filter(E=>E.result?.isError):n.data.calls;if(h&&y.length===0){let E=Ke(n.data);return E?new ee(l.fg("warning",E),0,0):new ce}if(!b)return{render:r(E=>b?o(n,a,l)?.render(E)??[]:[],"render"),invalidate:r(()=>{n.data&&p.get(n.data)?.invalidate()},"invalidate")};let I=Ke(n.data),v=h?void 0:p.get(n.data);if(!v){v=new ce;for(let E of y){let C=new Je(E.name,E.id,E.renderArgs??E.args,{showImages:!0},E.resultOmitted||E.omitted||!E.result?void 0:A(E.name),b,n.data.cwd);E.result?C.updateResult({...E.result,...E.durationMs===void 0||E.groupedResult===!0?{}:{durationMs:E.durationMs}}):C.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),v.addChild(new Ve(1)),v.addChild(C)}I&&v.addChild(new ee(l.fg("warning",I),0,0)),h||p.set(n.data,v)}let R=v.children.at(-1);I&&R instanceof ee&&R.setText(l.fg("warning",I));for(let E of v.children)E instanceof Je&&E.setExpanded(a.expanded);return v},"renderEntry"));let g=r(()=>{e.events.on(we,o=>{let n=o,a=c.get(n.parentToolCallId);if(!a)return;let l=te(n.result.details),h=n.calls.findLast(I=>!n.unchangedCopyCalls?.includes(I)),y="callIdsByResult"in l&&Array.isArray(l.callIdsByResult)?l.callIdsByResult:[];for(let I of n.calls){let v=a.calls.find(_=>_.id===I);if(!v)continue;let R=l.results?.filter((_,F)=>(y[F]===I||y.length===0&&n.calls.length===1)&&_.data.errors?.some(O=>O.code==="POST_WRITE_FAILED"||O.code==="POST_EDIT_FAILED"))??[];if(v.postWriteFailure=R.length>0,v.postWriteFailure){v.batched=!1,delete v.renderArgs,m(a,v,{content:n.result.content,details:{results:R,effect:"applied"},isError:!0});continue}let E=n.mutationResults?.get(I),C=E?.details.metadata?.copyRollback;if(v.name==="copy"&&E&&(C==="restored"||C==="failed")){v.copyRollback=C,v.batched=!1,m(a,v,{content:E.content,details:te(E.details),isError:!0});continue}if(v.unchangedCopy=v.name==="copy"&&n.unchangedCopyCalls?.includes(I)===!0,v.batched=!v.unchangedCopy&&I!==h,v.groupedResult=!v.batched&&!v.unchangedCopy&&n.calls.filter(_=>!n.unchangedCopyCalls?.includes(_)).length>1,v.unchangedCopy)m(a,v,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1});else if(v.batched)v.result=void 0;else{new Set(l.mutationRender?.map(F=>F.path)).size>1&&(v.renderArgs={}),v.rollback=l.results?.some(F=>F.data.rollback!==void 0)===!0;let _=v.result?.details?.metadata?.targetUnavailable;m(a,v,{content:n.result.content,details:typeof _=="string"?{...l,metadata:{...l.metadata,targetUnavailable:_}}:l,isError:n.result.isError===!0||v.rollback})}}}),e.on("tool_result",o=>{let n=o.details,a=c.get(o.toolCallId);if(a&&n&&typeof n=="object"&&"editorBatchResults"in n&&Array.isArray(n.editorBatchResults))for(let l of n.editorBatchResults)for(let h of l.data?.operations??[]){let y=a.calls.find(v=>v.id===h.id);if(!y)continue;let I=h.errors.map(v=>v.message);y.rollback||y.postWriteFailure||y.copyRollback!==void 0||y.unchangedCopy&&I.length===0&&h.effect==="not-applied"||(I.length>0||h.effect!=="applied")&&(y.batched=!1,delete y.renderArgs,m(a,y,{content:[{type:"text",text:`${y.name}: ${h.effect}.
42
- ${I.join(`
43
- `)}`}],details:void 0,isError:I.length>0||h.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:r(o=>{s.set(o.name,o),e.registerTool(o)},"registerTool")},finalize:g}}r(Ze,"createNestedIdeRendering");function et(e){e.on("tool_result",t=>{let s=Qe(t.details),d=Qe(t.structuredContent);if(!(s===void 0&&d===void 0))return{...s!==void 0&&{details:s.value},...d!==void 0&&{structuredContent:d.value}}})}r(et,"registerDetachedResults");function Qe(e){if(e!=null)try{return{value:structuredClone(e)}}catch{return}}r(Qe,"detached");function fe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(fe,"isRecord");function tt(e,t){let s=e.map(d=>!fe(d)||d.type!=="function"||typeof d.name!="string"||!t.has(d.name)||d.strict!==void 0?d:{...d,strict:!1});return s.some((d,i)=>d!==e[i])?s:e}r(tt,"relaxed");function nt(e,t){if(!fe(e))return e;let s=e;if(Array.isArray(e.tools)){let i=tt(e.tools,t);i!==e.tools&&(s={...s,tools:i})}let d=e.input;if(Array.isArray(d)){let i=d.map(u=>{if(!fe(u)||u.type!=="additional_tools"||!Array.isArray(u.tools))return u;let c=tt(u.tools,t);return c===u.tools?u:{...u,tools:c}});i.some((u,c)=>u!==d[c])&&(s={...s,input:i})}return s}r(nt,"preserveResponsesToolOmission");function ot(e,t,s){let d=new Map,i=[],u=[];function c(A,m){Ae(A,m);for(let f of m){let g=d.get(f.id);if(g)throw new Error(`Setting ${f.id} is already registered by ${g.owner}`)}for(let f of m)if(d.set(f.id,{owner:A,definition:f}),f.kind==="boolean"){let{kind:g,group:w,...o}=f;i.push({...o,...w==="ui"?{group:w}:{}})}else u.push({...f,group:f.group??"features"})}r(c,"register"),c("pi-agent-ide",[...t.map(A=>({...A,kind:"boolean"})),...s]);async function b(A,m){let f=d.get(A)?.definition;if(!f)throw new Error(`Unknown Agent IDE setting: ${A}`);let g=V(process.env,void 0,m),[w,o]=await Promise.all([j(g.globalPath),j(g.projectPath)]),n=f.kind==="boolean"?{...$(w),...$(o)}:{...w.preferences,...o.preferences},a=Object.hasOwn(n,A),l=a?n[A]:f.default;if(l===void 0||(f.kind==="boolean"?typeof l!="boolean":typeof l!="string"))throw new Error(`Invalid saved setting type: ${A}`);if(f.kind==="choice"&&!f.values.some(h=>h.value===l))throw new Error(`Invalid saved setting choice: ${A}`);return{value:l,overridden:a}}r(b,"read");let p=e.events.on(Ie,A=>{let m=A;try{c(m.owner,m.definitions),m.accept()}catch(f){m.accept(f instanceof Error?f:new Error(String(f)))}}),S=e.events.on(xe,A=>{let m=A;m.accept(b(m.id,m.cwd))});return e.on("session_shutdown",()=>{p(),S()}),e.events.emit(Se,void 0),{flags:i,preferences:u,read:b}}r(ot,"createAgentIdeSettingsRegistry");import{VERSION as at}from"@earendil-works/pi-coding-agent";import{getCurrentTools as Nt}from"@earendil-works/pi-ai";function it(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e);if(t===null||pe(t,[0,99,1])<0||st(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(it,"assertSupportedHost");function rt(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?/u.exec(e);return t!==null&&pe(t,[1,3,0])>=0&&!st(t,[1,3,0])}r(rt,"hostOwnsToolLoadout");function pe(e,t){return e.slice(1,4).map((s,d)=>Number(s)-(t[d]??0)).find(s=>s!==0)??0}r(pe,"compareVersion");function st(e,t){return pe(e,t)===0&&e[4]!==void 0}r(st,"isPrereleaseOf");async function Mt(e){it(at);let t=await X(V()),s={...t.preferences};for(let g of["ui.codemode","ui.read","ui.search","ui.diffs","ui.terminal"])ke(e,g,w=>{w===void 0?delete s[g]:s[g]=w});let d=Ze(e,()=>s["ui.codemode"]!=="on"),i=ye(d.api),u=je(i.api),c=We(u.api),b=!1;e.on("session_shutdown",()=>{b=!0}),e.on("before_provider_request",(g,w)=>{if(b||w.model?.api!=="openai-responses")return;let o=new Set(e.getAllTools().filter(n=>n.namespace?.name.startsWith("ide_")).map(n=>n.name));return nt(g.payload,o)}),e.on("session_start",(g,w)=>{if(b=!1,rt(at)){u.reconcile(!0,[],!0);return}let o=g.reason==="reload"?[]:Nt(w.sessionManager.getBranch().flatMap(n=>n.type==="message"?[n.message]:[])).map(n=>n.name);u.reconcile(!0,o)}),e.on("before_agent_start",g=>{u.reconcile();let w=g.systemPromptOptions;w.toolSnippets.bash&&(w.toolSnippets.bash=w.toolSnippets.bash.replace("Execute bash commands (ls, grep, find, etc.)","Execute Bash commands"));let o=/^<rules>\n([\s\S]*?)\n<\/rules>$/mu.exec(g.systemPrompt)?.[1];o?.includes("- Use bash for file operations like ls, rg, find")&&(w.sections.rules=o.replace(/(?:^|\n)- Use bash for file operations like ls, rg, find(?=\n|$)/u,"").trim());let n=e.getAllTools().filter(I=>I.exposure!=="hidden"),a=e.getActiveTools(),l=a.includes("tool_search")?"Use tool_search to find":a.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",h=n.filter(I=>I.namespace?.name==="ide_git").map(I=>I.name),y=[...h.length===0?[]:[`${l} ${h.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...n.some(I=>I.name==="debug"&&I.namespace?.name==="ide_debug")?[`${l} debug in ide_debug when creating a debugger session.`]:[]];w.sections.ide_discovery=y.join(`
44
- `)});let p=Fe(e,{"pi-agent-ide-no-animations":t.noAnimations??!1,"pi-agent-ide-no-post-processing":t.noPostProcessing??!1,...t.flags});p.register({id:"pi-agent-ide-developer-mode",name:"Developer mode",description:"Enable development commands, including manual setup-hint previews.",default:!1}),p.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),p.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}),p.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}),p.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}),p.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 S=ot(e,[...p.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"}}],Z);he(e,{async isAllowed(g,w){if(g.yoloSetting===void 0)return!1;let o=await oe(e.events,g.yoloSetting,w.cwd);if(typeof o.value!="boolean")throw new Error(`Operation approval needs a boolean YOLO setting: ${g.yoloSetting}`);return o.overridden?o.value:(await oe(e.events,"pi-agent-ide-yolo",w.cwd)).value===!0}}),Me(e,S.flags,S.preferences,t),$e(e),be(e,[Le(S.flags,S.preferences)]);let A=J(M,t.preset??"full"),{enabled:m}=Y(M,[...A,...t.disabled],t.enabled),f=Re(e,"pi-agent-ide-no-animations");for(let g of m)await g.register(c.api,{preferences:s,animationsEnabled:r(()=>!f(),"animationsEnabled")});c.finalize(()=>u.reconcile(!0,[],!0)),d.finalize(),i.finalize(),et(e)}r(Mt,"registerUnifiedPiAgentIde");export{Mt as default};
47
+ # Guide:`)),details:h.details,isError:l.isError})}}),e.on("message_end",l=>{if(l.message.role!=="toolResult")return;let o=a.get(l.message.toolCallId);if(!o)return;a.delete(l.message.toolCallId);for(let[y,T]of s)T===o.parentToolCallId&&s.delete(y);let c=o.calls.filter(y=>!y.batched),u={...o,parentToolName:l.message.toolName,calls:[],retention:{...o.retention,argumentsTruncated:c.some(y=>y.argumentsTruncated===!0),resultsOmitted:c.some(y=>y.resultOmitted===!0),resultsUnavailable:c.some(y=>!y.result)}},h=Buffer.byteLength(JSON.stringify(u));for(let y of c){let T=JSON.stringify(y);if(h+=Buffer.byteLength(T)+(u.calls.length>0?1:0),h>dt){u.retention.callsOmitted=!0;break}u.calls.push(JSON.parse(T))}e.appendEntry(ge,u)}),e.registerEntryRenderer(ge,d(function l(o,c,u){if(!Array.isArray(o.data?.calls))return;let h=(typeof t=="function"?t():t)&&o.data.parentToolName==="codemode"&&!c.expanded,y=h?o.data.calls.filter(E=>E.result?.isError):o.data.calls;if(h&&y.length===0){let E=ct(o.data);return E?new oe(u.fg("warning",E),0,0):new pe}if(!f)return{render:d(E=>f?l(o,c,u)?.render(E)??[]:[],"render"),invalidate:d(()=>{o.data&&p.get(o.data)?.invalidate()},"invalidate")};let T=ct(o.data),w=h?void 0:p.get(o.data);if(!w){w=new pe;for(let E of y){let _=new it(E.name,E.id,E.renderArgs??E.args,{showImages:!0},E.resultOmitted||E.omitted||!E.result?void 0:I(E.name),f,o.data.cwd);E.result?_.updateResult({...E.result,...E.durationMs===void 0||E.groupedResult===!0?{}:{durationMs:E.durationMs}}):_.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),w.addChild(new st(1)),w.addChild(_)}T&&w.addChild(new oe(u.fg("warning",T),0,0)),h||p.set(o.data,w)}let R=w.children.at(-1);T&&R instanceof oe&&R.setText(u.fg("warning",T));for(let E of w.children)E instanceof it&&E.setExpanded(c.expanded);return w},"renderEntry"));let m=d(()=>{e.events.on(Te,l=>{let o=l,c=a.get(o.parentToolCallId);if(!c)return;let u=Q(o.result.details),h=o.calls.findLast(T=>!o.unchangedCalls?.includes(T)),y="callIdsByResult"in o.result.details&&Array.isArray(o.result.details.callIdsByResult)?o.result.details.callIdsByResult:[];for(let T of o.calls){let w=c.calls.find(P=>P.id===T);if(!w)continue;let R=o.result.details.results?.filter((P,F)=>(y[F]===T||y.length===0&&o.calls.length===1)&&P.data.errors?.some(O=>O.code==="POST_WRITE_FAILED"||O.code==="POST_EDIT_FAILED"))??[];if(w.postWriteFailure=R.length>0,w.postWriteFailure){w.batched=!1,delete w.renderArgs,b(c,w,{content:o.result.content,details:Q({results:R,effect:"applied"}),isError:!0});continue}let E=o.mutationResults?.get(T),_=E?.details.metadata?.copyRollback;if(w.name==="copy"&&E&&(_==="restored"||_==="failed")){w.copyRollback=_,w.batched=!1,b(c,w,{content:E.content,details:Q(E.details),isError:!0});continue}if(w.unchanged=o.unchangedCalls?.includes(T)===!0,w.batched=!w.unchanged&&T!==h,w.groupedResult=!w.batched&&!w.unchanged&&o.calls.filter(P=>!o.unchangedCalls?.includes(P)).length>1,w.unchanged)b(c,w,{content:o.mutationResults?.get(T)?.content??[{type:"text",text:Ie}],details:{},isError:!1});else if(w.batched)w.result=void 0;else{new Set(u.mutationRender?.map(F=>F.path)).size>1&&(w.renderArgs={}),w.rollback=o.result.details.results?.some(F=>F.data.rollback!==void 0)===!0;let P=w.result?.details?.metadata?.targetUnavailable;b(c,w,{content:o.result.content,details:typeof P=="string"?{...u,metadata:{...u.metadata,targetUnavailable:P}}:u,isError:o.result.isError===!0||w.rollback})}}}),e.on("tool_result",l=>{let o=l.details,c=a.get(l.toolCallId);if(c&&o&&typeof o=="object"&&"editorBatchResults"in o&&Array.isArray(o.editorBatchResults))for(let u of o.editorBatchResults)for(let h of u.data?.operations??[]){let y=c.calls.find(w=>w.id===h.id);if(!y)continue;let T=h.errors.map(w=>w.message);y.rollback||y.postWriteFailure||y.copyRollback!==void 0||y.unchanged&&T.length===0&&h.effect==="not-applied"||(T.length>0||h.effect!=="applied")&&(y.batched=!1,delete y.renderArgs,b(c,y,{content:[{type:"text",text:`${y.name}: ${h.effect}.
48
+ ${T.join(`
49
+ `)}`}],details:void 0,isError:T.length>0||h.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:d(l=>{i.set(l.name,l),e.registerTool(l)},"registerTool")},finalize:m}}d(ut,"createNestedIdeRendering");function pt(e){e.on("tool_result",t=>{let i=ft(t.details),r=ft(t.structuredContent);if(!(i===void 0&&r===void 0))return{...i!==void 0&&{details:i.value},...r!==void 0&&{structuredContent:r.value}}})}d(pt,"registerDetachedResults");function ft(e){if(e!=null)return{value:me(e,new Map)}}d(ft,"detached");function me(e,t){if(typeof e=="string")return structuredClone(e);if(e===null||typeof e!="object")return e;let i=t.get(e);if(i!==void 0)return i;if(Array.isArray(e)){let s=[];t.set(e,s);for(let a of e)s.push(me(a,t));return s}let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return e;let n=r===null?Object.create(null):{};t.set(e,n);for(let[s,a]of Object.entries(e))n[s]=me(a,t);return n}d(me,"copy");function he(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}d(he,"isRecord");function gt(e,t){let i=e.map(r=>!he(r)||r.type!=="function"||typeof r.name!="string"||!t.has(r.name)||r.strict!==void 0?r:{...r,strict:!1});return i.some((r,n)=>r!==e[n])?i:e}d(gt,"relaxed");function mt(e,t){if(!he(e))return e;let i=e;if(Array.isArray(e.tools)){let n=gt(e.tools,t);n!==e.tools&&(i={...i,tools:n})}let r=e.input;if(Array.isArray(r)){let n=r.map(s=>{if(!he(s)||s.type!=="additional_tools"||!Array.isArray(s.tools))return s;let a=gt(s.tools,t);return a===s.tools?s:{...s,tools:a}});n.some((s,a)=>s!==r[a])&&(i={...i,input:n})}return i}d(mt,"preserveResponsesToolOmission");function K(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}d(K,"isRecord");function Z(e,t,i){let r=i(e[t]);return r===e[t]?e:{...e,[t]:r}}d(Z,"mapField");function ye(e,t){if(!Array.isArray(e))return e;let i=e.map(t);return i.some((r,n)=>r!==e[n])?i:e}d(ye,"mapArray");function ht(e,t){if(!K(e))return e;let i=d(s=>{if(!K(s))return s;if(typeof s.name=="string")return t(s);let a=s;for(let f of["function","toolSpec"])a=Z(a,f,p=>K(p)?t(p):p);return Z(a,"functionDeclarations",f=>ye(f,i))},"declaration"),r=d(s=>Z(s,"tools",a=>ye(a,i)),"tools"),n=r(e);for(let s of["config","toolConfig"])n=Z(n,s,a=>K(a)?r(a):a);return Z(n,"input",s=>ye(s,a=>K(a)&&a.type==="additional_tools"?r(a):a))}d(ht,"mapDeclarations");function an(e,t){let i=new Map;return ht(e,r=>{if(typeof r.name!="string"||t.has(r.name))return r;let n=r.name,s=[...t].filter(f=>f.toLowerCase()===n.toLowerCase()),[a]=s;return s.length===1&&a&&i.set(n,{displayed:n,canonical:a}),r}),[...i.values()]}d(an,"codemodeToolNameMappings");function yt(e,t,i=!1){let r=an(e,t);return!i&&r.length===0?e:ht(e,n=>typeof n.description!="string"?n:i&&n.name==="tool_search"?{...n,description:`For direct calls only. ${n.description}`}:n.name!=="codemode"||r.length===0?n:{...n,description:`${n.description}
50
+
51
+ Use these exact JavaScript members inside Codemode instead of the provider-facing tool names:
52
+ ${r.map(({displayed:s,canonical:a})=>`${s} \u2192 tools.${a}`).join(`
53
+ `)}`})}d(yt,"explainCodemodeToolNames");function bt(e,t,i){let r=new Map,n=[],s=[];function a(I,b){De(I,b);for(let g of b){let m=r.get(g.id);if(m)throw new Error(`Setting ${g.id} is already registered by ${m.owner}`)}for(let g of b)if(r.set(g.id,{owner:I,definition:g}),g.kind==="boolean"){let{kind:m,group:S,...l}=g;n.push({...l,...S==="ui"?{group:S}:{}})}else s.push({...g,group:g.group??"features"})}d(a,"register"),a("pi-agent-ide",[...t.map(I=>({...I,kind:"boolean"})),...i]);async function f(I,b){let g=r.get(I)?.definition;if(!g)throw new Error(`Unknown Agent IDE setting: ${I}`);let m=J(process.env,void 0,b),[S,l]=await Promise.all([B(m.globalPath),B(m.projectPath)]),o=g.kind==="boolean"?{...$(S),...$(l)}:{...S.preferences,...l.preferences},c=Object.hasOwn(o,I),u=c?o[I]:g.default;if(u===void 0||(g.kind==="boolean"?typeof u!="boolean":typeof u!="string"))throw new Error(`Invalid saved setting type: ${I}`);if(g.kind==="choice"&&!g.values.some(h=>h.value===u))throw new Error(`Invalid saved setting choice: ${I}`);return{value:u,overridden:c}}d(f,"read");let p=e.events.on(Ce,I=>{let b=I;try{a(b.owner,b.definitions),b.accept()}catch(g){b.accept(g instanceof Error?g:new Error(String(g)))}}),v=e.events.on(_e,I=>{let b=I;b.accept(f(b.id,b.cwd))});return e.on("session_shutdown",()=>{p(),v()}),e.events.emit(ke,void 0),{flags:n,preferences:s,read:f}}d(bt,"createAgentIdeSettingsRegistry");import{VERSION as xt}from"@earendil-works/pi-coding-agent";import{getCurrentTools as dn}from"@earendil-works/pi-ai";function wt(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e);if(t===null||be(t,[0,99,1])<0||vt(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.`)}d(wt,"assertSupportedHost");function Et(e){let t=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?/u.exec(e);return t!==null&&be(t,[1,3,0])>=0&&!vt(t,[1,3,0])}d(Et,"hostOwnsToolLoadout");function be(e,t){return e.slice(1,4).map((i,r)=>Number(i)-(t[r]??0)).find(i=>i!==0)??0}d(be,"compareVersion");function vt(e,t){return be(e,t)===0&&e[4]!==void 0}d(vt,"isPrereleaseOf");async function ln(e){wt(xt);let t=await X(J()),i={...t.preferences};for(let m of["ui.codemode","ui.read","ui.search","ui.diffs","ui.terminal"])Fe(e,m,S=>{S===void 0?delete i[m]:i[m]=S});let r=ut(e,()=>i["ui.codemode"]!=="on"),n=xe(r.api),s=Ye(n.api),a=tt(s.api),f=!1;e.on("session_shutdown",()=>{f=!0}),e.on("before_provider_request",(m,S)=>{if(f)return;let l=S.model?.api,o=e.getAllTools(),c=new Set(o.filter(h=>h.namespace?.name.startsWith("ide_")&&h.exposure!=="hidden").map(h=>h.name)),u=l==="openai-responses"?mt(m.payload,c):m.payload;return yt(u,c,o.some(h=>h.name==="tool_search"&&h.exposure==="model-only"))}),e.on("session_start",(m,S)=>{if(f=!1,Et(xt)){s.reconcile(!0,[],!0);return}let l=m.reason==="reload"?[]:dn(S.sessionManager.getBranch().flatMap(o=>o.type==="message"?[o.message]:[])).map(o=>o.name);s.reconcile(!0,l)}),e.on("before_agent_start",(m,S)=>{s.reconcile();let l=m.systemPromptOptions;l.toolSnippets.bash&&(l.toolSnippets.bash=l.toolSnippets.bash.replace("Execute bash commands (ls, grep, find, etc.)","Execute Bash commands"));let o=/^<rules>\n([\s\S]*?)\n<\/rules>$/mu.exec(m.systemPrompt)?.[1],c=/(?:^|\n)- Use bash for file operations like ls, rg, find(?=\n|$)/u;if(o&&c.test(o)){let u=o.replace(c,"").replace(/^\n/u,"");l.forceSystemPrompt!==void 0?l.forceSystemPrompt=l.forceSystemPrompt.replace(`<rules>
54
+ ${o}
55
+ </rules>`,`<rules>
56
+ ${u}
57
+ </rules>`):l.sections.rules=u}l.sections.parallel_tool_calls=Ke(S.model?.api),l.sections.ide_discovery=He(e.getAllTools(),e.getActiveTools(),e.getSettings().codemode?.mode==="only")});let p=We(e,{"pi-agent-ide-no-animations":t.noAnimations??!1,"pi-agent-ide-no-post-processing":t.noPostProcessing??!1,...t.flags});p.register({id:"pi-agent-ide-developer-mode",name:"Developer mode",description:"Enable development commands, including manual setup-hint previews.",default:!1}),p.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),p.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}),p.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}),p.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}),p.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 v=bt(e,[...p.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"}}],te);ve(e,{async isAllowed(m,S){if(m.yoloSetting===void 0)return!1;let l=await ie(e.events,m.yoloSetting,S.cwd);if(typeof l.value!="boolean")throw new Error(`Operation approval needs a boolean YOLO setting: ${m.yoloSetting}`);return l.overridden?l.value:(await ie(e.events,"pi-agent-ide-yolo",S.cwd)).value===!0}}),Ue(e,v.flags,v.preferences,t),qe(e),Se(e,[Ve(v.flags,v.preferences)]);let I=z(M,t.preset??"full"),{enabled:b}=Y(M,[...I,...t.disabled],t.enabled),g=Ne(e,"pi-agent-ide-no-animations");for(let m of b)await m.register(a.api,{preferences:i,animationsEnabled:d(()=>!g(),"animationsEnabled")});a.finalize(()=>s.reconcile(!0,[],!0)),r.finalize(),e.on("tool_result",Xe),n.finalize(),pt(e)}d(ln,"registerUnifiedPiAgentIde");export{ln as default};
@@ -6,11 +6,20 @@
6
6
 
7
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
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.
9
+ In direct calls, 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 keeps working when other lines of its file change, including other parts of its own line, and goes stale when the matched text or its direct neighbours change; repeat the search.
10
+
11
+ In Codemode, `ast_search` returns `{ id, complete, matches }` like Search, and each match adds `captures`: the nodes of each metavariable, keyed by its name without `$`, as `{ text, id }`. Pass any `id` to a source parameter.
10
12
 
11
13
  ```js
12
14
  const calls = await tools.ast_search({ path: "client.ts", pattern: "request($OPTIONS)" });
13
- text(calls.result);
15
+ if (calls && typeof calls !== "string") {
16
+ for (const call of calls.matches) {
17
+ const [options] = call.captures.OPTIONS ?? [];
18
+ if (options?.id) {
19
+ await tools.replace({ path: options.id, text: `{ ...${options.text}, retry: true }` });
20
+ }
21
+ }
22
+ }
14
23
  ```
15
24
 
16
25
  ## Rules
@@ -40,9 +49,9 @@ Node kinds are tree-sitter names and differ by language, for example `function_d
40
49
  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
50
 
42
51
  ```js
43
- const hit = await tools.search({ path: "src/app.ts", query: '"connection lost"' });
52
+ const hit = await tools.search({ path: "src/app.ts", query: "connection lost" });
44
53
  const fn = await tools.ast_search({
45
- path: hit.result,
54
+ path: hit,
46
55
  relation: "enclosing",
47
56
  language: "typescript",
48
57
  rule: {
@@ -56,3 +65,5 @@ const fn = await tools.ast_search({
56
65
  ```
57
66
 
58
67
  Without `relation`, a result scope keeps only matches wholly inside its ranges; matches are never clipped.
68
+
69
+ If other sessions changed lines inside the result since it was issued, `ast_search` searches the current text of the same region and says so; it fails only when no line of the region is left. Its matches are anchored to the current file.
@@ -1,6 +1,6 @@
1
1
  # Debugger workflow
2
2
 
3
- Create a session with `debug`, then read the returned `debug:<session>` resource before choosing a breakpoint. Read a source resource with `views: ["anchors"]`; insert `breakpoint` at a current source anchor. Start and control the session by inserting `start`, `continue`, `step over`, `step into`, or `step out` on the session resource. While stopped, insert `evaluate <expression>` to evaluate in the selected stack frame.
3
+ Create a session with `debug`, then read the returned `debug:<session>` resource before choosing a breakpoint. Read a source resource with `views: ["anchors"]`; set a breakpoint with `insert`, passing `text: "breakpoint"` and the current source anchor as `after`. Start and control the session by inserting `start`, `continue`, `step over`, `step into`, or `step out` on the session resource. While stopped, insert `evaluate <expression>` to evaluate in the selected stack frame.
4
4
 
5
5
  Read stopped state before the next action. Use `views: ["breakpoints"]` when breakpoint locations matter. Delete the returned breakpoint resource to remove that breakpoint. Delete the session resource to terminate it. Debug resources survive extension reloads, but program files and anchors may change, so re-read before acting.
6
6
 
@@ -2,4 +2,5 @@
2
2
 
3
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
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
+ - `undo` with `last` restores the saved text only if the file still matches the result of that edit. If another writer changed the file, `undo` refuses rather than overwriting it. Read the current file before deciding what to revert.
5
6
  - 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.
@@ -4,23 +4,43 @@
4
4
 
5
5
  1. Read `.pi/pi-agent-ide/ssh.json` in the project and reuse a matching target. Create the file if it is missing, keeping other targets. Use the global `~/.pi/agent/pi-agent-ide/ssh.json` (or `$PI_CODING_AGENT_DIR/pi-agent-ide/ssh.json`) only when the user asks.
6
6
  2. Take the host from the user's request and the OpenSSH config. Ask only for what you can't find, such as the remote workspace path. Keys, passwords and host keys stay in OpenSSH. Don't print credentials or turn off host-key checks; ask before changing authentication or trusting a new host key.
7
- 3. Check access with local bash: `ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o ConnectTimeout=10 HOST 'pwd; python3 --version'` (add `-F <config>` for a custom config). The target needs Python 3. If this fails, fix SSH access first: a target record can't fix authentication.
8
- 4. Add a record with a short unique `id` (such as `vps`), the OpenSSH `host` alias (optionally `user@alias`) and an absolute Linux `workspace`. Optional `configFile` points to an OpenSSH config, relative to `ssh.json`.
7
+ 3. Check access with local bash: `ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o ConnectTimeout=10 HOST 'pwd; python3 --version'` (add `-F <config>` for a custom config). For a native Windows host, run `py -3 --version` instead; the `python3` command there is often the Microsoft Store alias, not Python. The target needs Python 3. If this fails, fix SSH access first: a target record can't fix authentication.
8
+ 4. Add a record with a short unique `id` (such as `vps`), the OpenSSH `host` alias (optionally `user@alias`) and an absolute `workspace`. For a native Windows host, add `"os": "windows"` and give the workspace with its drive, such as `C:/Users/name`; Linux is the default. A host reached through WSL is a Linux target. Optional `configFile` points to an OpenSSH config, relative to `ssh.json`.
9
9
  5. Reload Pi extensions (the reload tool, or ask the user for `/reload`). Then read `docs:ssh` again to see the configured workspaces.
10
- 6. Verify with `read` on the `ssh://` workspace and `bash` with that SSH `cwd`, for example `hostname; pwd`. A plain `ssh` command succeeding does not prove IDE access.
10
+ 6. Verify with `read` on the `ssh://` workspace. Also run a command with that SSH `cwd`: `hostname; pwd` with `bash` on a Linux target, or `hostname` with `remote_powershell` on a Windows target. A plain `ssh` command succeeding does not prove IDE access.
11
11
 
12
12
  ```json
13
- { "targets": [{ "id": "vps", "host": "vps", "workspace": "/root" }] }
13
+ {
14
+ "targets": [
15
+ { "id": "vps", "host": "vps", "workspace": "/root" },
16
+ { "id": "win", "host": "win", "workspace": "C:/Users/name", "os": "windows" }
17
+ ]
18
+ }
14
19
  ```
15
20
 
16
21
  Keep machine-specific targets out of shared Git history unless the user asks.
17
22
 
23
+ ## Windows targets
24
+
25
+ - Name Windows files with their drive: `ssh://win/C:/Users/name/file.txt`. Relative paths may use `\` or `/`.
26
+ - Windows targets support `read`, `raw:`, directory listings, the write and edit tools, `delete`, `copy`, `move`, `undo`, copies between a target and local paths, and terminal sessions through `remote_powershell`. Other operations on a Windows target report `CAPABILITY_UNAVAILABLE`.
27
+ - `remote_powershell` runs Windows PowerShell in a terminal session with resize, control keys such as Ctrl+C, background sessions and `shell:` references. Stopping a session ends everything it started.
28
+ - `search` and `file_search` need ripgrep (`rg`) and `ast_search` needs `ast-grep` on the target's PATH for SSH sessions; for example `winget install BurntSushi.ripgrep.MSVC` and `npm install --global @ast-grep/cli`. A missing tool is reported by name with this hint. An npm `.cmd` shim works.
29
+ - The `changes` view, `stage` and `unstage` use the target's Git. With `core.autocrlf` or an `eol` attribute, a CRLF file is compared to Git's LF blobs. `undo` with a `CHANGE#` anchor rewrites the file, so it needs file writes on the target; it restores CRLF only in a file that is uniformly CRLF.
30
+ - Line endings are written exactly as given. Replacing a file keeps its attributes and permissions (ACL).
31
+ - A file that is read-only or open in another process cannot be replaced. The tool reports `FILE_READ_ONLY` or `FILE_IN_USE` and changes nothing; close the other program and retry.
32
+ - Symbolic links and junctions are links: delete, copy and move act on the link, never on what it points to. Creating a symbolic link needs the Windows privilege for it (Developer Mode or an administrator account).
33
+ - Names that differ only in letter case are the same file. `move` can rename a file only in case.
34
+ - A tree copied from another system cannot contain names Windows forbids (`<>:"\|?*`, trailing dots or spaces, `CON`, `NUL`); the copy is refused before anything is written.
35
+
18
36
  ## Work on a target
19
37
 
20
- - Use the ordinary tools with `ssh://<target>/<absolute path>`: read, write and edit tools, search, file_search, ast_search, lsp_search, copy, move, delete, undo. Copy and move also work between local and remote paths.
21
- - Run commands with `bash` and an SSH `cwd`; debug with `debug` and an SSH `cwd`. Read `docs:terminal` or `docs:debugger` first.
38
+ - Use the ordinary tools with `ssh://<target>/<absolute path>`: read, write and edit tools, search, file_search, outline, ast_search, lsp_search, copy, move, delete, undo. Copy and move also work between local and remote paths. The calling IDE tool's deadline applies to the whole transfer. The transfer can also stop when no data moves for 30 s (`TRANSFER_STALLED`). If the tool cannot confirm the effect of a failed write, check the target before retrying.
39
+ - In a Pi session running natively on Windows, local paths in copy and move are Windows paths (`C:\work\file.bin` or `C:/work/file.bin`), and both directions work against a Linux target. A `file:` URL as a copy target is rejected.
40
+ - Run commands with an SSH `cwd`: `bash` for Linux targets and `remote_powershell` for Windows targets. On a Windows host, `powershell` runs on Windows targets and `remote_bash` on Linux targets. `remote_powershell` and `remote_bash` appear only when a target of that OS is configured and need an `ssh://` `cwd`. Debug with `debug` and an SSH `cwd`. Read `docs:terminal` or `docs:debugger` first.
22
41
  - `raw:ssh://…` reads original bytes. `web:ssh://<target>/https://…` fetches a page from the target; plain URLs are still fetched locally.
23
42
  - The workspace is only the base for relative paths, not a sandbox.
24
- - The target needs its own tools: Git for `changes` and `undo`, `ast-grep` for ast_search, the language servers for lsp_search, and Node, `playwright-core` and Chromium for rendered web pages. Nothing is installed automatically.
43
+ - The target needs its own tools: Git for `changes` and `undo`, `ast-grep` for ast_search, the language servers for lsp_search (plus `rg` for C and C++ references and renames), and Node, `playwright-core` and Chromium for rendered web pages. Nothing is installed automatically.
25
44
  - Operations across two machines are not atomic. After a failure, check both sides before retrying; don't replay a write whose effect is unknown.
45
+ - A lost connection reports `TRANSPORT_FAILED` with what OpenSSH saw (reset, closed by the target, keepalive or TCP timeout), whether the command had started and how long the target was silent before the loss. Pi reconnects by itself when the network drops a connection while it is being set up. When the error says nothing ran on the target, a retry is safe; when the command was running, it was stopped and its effect is unknown.
26
46
  - `/agent-ide-doctor ssh://<target>/<path>` checks that project's setup on the target.
@@ -2,7 +2,11 @@
2
2
 
3
3
  - Write the syntax of the shell named in the tool's `command` field; don't infer it from the tool name or the OS.
4
4
  - Run servers, watchers and long builds with `background: true`. A command that hits its timeout keeps running in the background.
5
+ - Give a long-lived session a `name`, such as `dev-server`; its address becomes `shell:dev-server`. Rename a session with `move`, `path: shell:<session>` and `target: shell:<name>`.
6
+ - Read `shell:` to list the terminal sessions of this Pi session, including finished ones. Search with `path: shell:` to search all of them.
5
7
  - A returned or background session is not finished: check `status` and `exitCode` in its `shell:<session>` resource before treating it as done.
8
+ - In Codemode, a terminal call returns `{ output, exit_code, truncated, full_output_path, wall_time_seconds, session }`. Check `exit_code`: a non-zero code is a value, not a failure. It is absent while the command still runs; pass `session` to `read`, `write`, `insert` or `delete`.
9
+ - `output` holds up to 1 MiB; longer output keeps its first and last 512 KiB around an omission marker. When `truncated` is true, read `full_output_path` for the complete log.
6
10
  - Don't poll. When only waiting is left, end your turn: Pi wakes you when the session finishes, or with one notice after two minutes of silence. Then decide whether to keep waiting, send input or delete the session.
7
11
  - Send input only while `status` is `running`: `write` for exact text, `insert` for keys such as `Enter` or `Ctrl+C`. `delete` ends the session.
8
12
  - Use the `image` view when screen layout matters and `sequence` when changes over time matter.