pi-agent-ide 0.7.3 → 0.8.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 (734) hide show
  1. package/CHANGELOG.md +48 -35
  2. package/README.md +70 -19
  3. package/dist/chunk-246NTPOS.js +1 -0
  4. package/dist/chunk-2ITKAXHO.js +1 -0
  5. package/dist/chunk-3WO2NOEQ.js +1 -0
  6. package/dist/{chunk-ZTYWHL2F.js → chunk-47SPPIXK.js} +1 -1
  7. package/dist/chunk-4HWKBCBH.js +1 -0
  8. package/dist/chunk-4W7GH3T7.js +10 -0
  9. package/dist/{chunk-JMVDFOTQ.js → chunk-57F5GTHO.js} +1 -1
  10. package/dist/chunk-6EDOLYOV.js +1 -0
  11. package/dist/chunk-756K3LJY.js +1 -0
  12. package/dist/chunk-7LOVUWNI.js +1 -0
  13. package/dist/chunk-A64JRDZK.js +1 -0
  14. package/dist/chunk-AIT3YWR5.js +3 -0
  15. package/dist/chunk-AKNHSDGV.js +1 -0
  16. package/dist/chunk-AUL5FGGK.js +2 -0
  17. package/dist/chunk-BB4A5UI3.js +5 -0
  18. package/dist/chunk-BQAKA3FU.js +1 -0
  19. package/dist/chunk-BR7GRH4A.js +5 -0
  20. package/dist/chunk-BXGMMZT3.js +1 -0
  21. package/dist/{chunk-ZIWPKIBZ.js → chunk-D4IA2MTA.js} +1 -1
  22. package/dist/chunk-DUUOCBS3.js +3 -0
  23. package/dist/chunk-DXONCYWF.js +3 -0
  24. package/dist/chunk-E2PHA4SQ.js +1 -0
  25. package/dist/{chunk-H445SHSJ.js → chunk-EMRJP6EM.js} +1 -1
  26. package/dist/chunk-GEMDU6XW.js +1 -0
  27. package/dist/chunk-GNACBJM3.js +1 -0
  28. package/dist/chunk-HCK7OIQ3.js +1 -0
  29. package/dist/chunk-HFJGCYFO.js +11 -0
  30. package/dist/chunk-ID4RJIVZ.js +9 -0
  31. package/dist/chunk-IMGIDBCC.js +1 -0
  32. package/dist/chunk-JKMXND6V.js +1 -0
  33. package/dist/chunk-L2B4DTVS.js +1 -0
  34. package/dist/chunk-LAJQSHEI.js +4 -0
  35. package/dist/chunk-LEKC4GQK.js +5 -0
  36. package/dist/chunk-LLRUJD62.js +1 -0
  37. package/dist/{chunk-2ZMMRINH.js → chunk-M4TVRCMZ.js} +1 -1
  38. package/dist/chunk-MKEC3U2M.js +4 -0
  39. package/dist/chunk-N56WAVYA.js +1 -0
  40. package/dist/chunk-OFILFO6D.js +1 -0
  41. package/dist/chunk-OI3HBIPK.js +2 -0
  42. package/dist/{chunk-S6QRG3TQ.js → chunk-OM4LYD3S.js} +1 -1
  43. package/dist/{chunk-WLZIUMJL.js → chunk-PRLIHLCS.js} +1 -1
  44. package/dist/chunk-Q5X6OXNS.js +2 -0
  45. package/dist/chunk-R2U5WXYR.js +1 -0
  46. package/dist/chunk-S72FVLUX.js +1 -0
  47. package/dist/chunk-SWA5B5B2.js +9 -0
  48. package/dist/chunk-T4FTT3U4.js +1 -0
  49. package/dist/chunk-T7MWQQIF.js +3 -0
  50. package/dist/chunk-TGC2ZACO.js +1 -0
  51. package/dist/chunk-TOYN4W4F.js +1 -0
  52. package/dist/chunk-TXG2H7YQ.js +9 -0
  53. package/dist/{chunk-QFTBY67N.js → chunk-UEVGZUII.js} +3 -3
  54. package/dist/{chunk-7UGNGK7Y.js → chunk-VAXLSPPU.js} +1 -1
  55. package/dist/chunk-VDP5CQHM.js +3 -0
  56. package/dist/chunk-VMGZMXEM.js +10 -0
  57. package/dist/chunk-VNTY7BKC.js +1 -0
  58. package/dist/chunk-W3YFF6OO.js +1 -0
  59. package/dist/chunk-W7M3V7FR.js +28 -0
  60. package/dist/chunk-WMHSVEIT.js +29 -0
  61. package/dist/chunk-WPBQ45ZL.js +1 -0
  62. package/dist/chunk-WXGTU2M6.js +1 -0
  63. package/dist/chunk-XSIKDVAR.js +25 -0
  64. package/dist/chunk-YHREORHH.js +2 -0
  65. package/dist/chunk-YJ6T3PEP.js +1 -0
  66. package/dist/chunk-YTYLS2UM.js +1 -0
  67. package/dist/chunk-Z2QGNTGQ.js +1 -0
  68. package/dist/{chunk-QDLTO5PH.js → chunk-ZAWRSA7N.js} +1 -1
  69. package/dist/chunk-ZV5ETNLQ.js +1 -0
  70. package/dist/entry-0.js +1 -1
  71. package/dist/entry-1.js +1 -1
  72. package/dist/entry-10.js +1 -1
  73. package/dist/entry-11.js +1 -1
  74. package/dist/entry-13.js +1 -1
  75. package/dist/entry-14.js +1 -1
  76. package/dist/entry-15.js +1 -1
  77. package/dist/entry-16.js +1 -1
  78. package/dist/entry-17.js +1 -1
  79. package/dist/entry-18.js +1 -0
  80. package/dist/entry-2.js +1 -1
  81. package/dist/entry-20.js +1 -1
  82. package/dist/entry-21.js +1 -1
  83. package/dist/entry-22.js +1 -1
  84. package/dist/entry-23.js +1 -1
  85. package/dist/entry-24.js +1 -1
  86. package/dist/entry-25.js +1 -2
  87. package/dist/entry-26.js +1 -1
  88. package/dist/entry-27.js +2 -2
  89. package/dist/entry-28.js +1 -1
  90. package/dist/entry-29.js +4 -1
  91. package/dist/entry-30.js +1 -1
  92. package/dist/entry-31.js +1 -17
  93. package/dist/entry-32.js +1 -1
  94. package/dist/entry-33.js +18 -3
  95. package/dist/entry-34.js +1 -1
  96. package/dist/entry-35.js +1 -1
  97. package/dist/entry-36.js +1 -4
  98. package/dist/entry-37.js +1 -9
  99. package/dist/entry-38.js +1 -1
  100. package/dist/entry-39.js +1 -1
  101. package/dist/entry-4.js +1 -1
  102. package/dist/entry-40.js +1 -1
  103. package/dist/entry-41.js +1 -1
  104. package/dist/entry-42.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 -25
  108. package/dist/entry-46.js +1 -1
  109. package/dist/entry-47.js +25 -1
  110. package/dist/entry-48.js +1 -1
  111. package/dist/entry-49.js +1 -1
  112. package/dist/entry-50.js +1 -3
  113. package/dist/entry-51.js +1 -13
  114. package/dist/entry-52.js +3 -1
  115. package/dist/entry-53.js +13 -1
  116. package/dist/entry-54.js +1 -1
  117. package/dist/entry-55.js +1 -1
  118. package/dist/entry-56.js +1 -1
  119. package/dist/entry-57.js +1 -1
  120. package/dist/entry-58.js +1 -1
  121. package/dist/entry-59.js +1 -1
  122. package/dist/entry-6.js +1 -1
  123. package/dist/entry-60.js +1 -1
  124. package/dist/entry-61.js +1 -0
  125. package/dist/entry-62.js +1 -1
  126. package/dist/entry-64.js +1 -1
  127. package/dist/entry-65.js +0 -1
  128. package/dist/entry-66.js +1 -1
  129. package/dist/entry-67.js +1 -1
  130. package/dist/entry-68.js +1 -1
  131. package/dist/entry-69.js +1 -1
  132. package/dist/entry-7.js +1 -1
  133. package/dist/entry-70.js +1 -1
  134. package/dist/entry-71.js +1 -0
  135. package/dist/entry-72.js +1 -1
  136. package/dist/entry-74.js +1 -1
  137. package/dist/entry-75.js +0 -1
  138. package/dist/entry-76.js +1 -1
  139. package/dist/entry-77.js +1 -80
  140. package/dist/entry-78.js +1 -19
  141. package/dist/entry-79.js +80 -2
  142. package/dist/entry-8.js +1 -1
  143. package/dist/entry-80.js +22 -1
  144. package/dist/entry-81.js +2 -1
  145. package/dist/entry-82.js +1 -5
  146. package/dist/entry-83.js +1 -3
  147. package/dist/entry-84.js +1 -1
  148. package/dist/entry-85.js +3 -1
  149. package/dist/entry-86.js +1 -1
  150. package/dist/entry-87.js +1 -0
  151. package/dist/entry-88.js +1 -0
  152. package/dist/pi-agent-ide.js +53 -24
  153. package/docs/agent-guides/debugger.md +2 -0
  154. package/docs/agent-guides/editing.md +1 -1
  155. package/docs/agent-guides/search-code.md +7 -2
  156. package/docs/agent-guides/ssh.md +58 -0
  157. package/docs/agent-guides/vision.md +6 -0
  158. package/docs/configuration.md +51 -5
  159. package/docs/development.md +1 -13
  160. package/docs/extensions.md +1 -1
  161. package/docs/releases.md +1 -1
  162. package/docs/settings-help.md +39 -0
  163. package/docs/tools.md +22 -14
  164. package/docs/user-hooks.md +7 -3
  165. package/node_modules/pi-agent-doctor/package.json +10 -9
  166. package/node_modules/pi-agent-doctor/runtime/entry-25.js +1 -0
  167. package/node_modules/pi-agent-doctor/src/evidence.ts +49 -4
  168. package/node_modules/pi-agent-doctor/src/executable.ts +46 -16
  169. package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +78 -0
  170. package/node_modules/pi-agent-doctor/src/fixtures/probe-executable-wait.mjs +10 -0
  171. package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +6 -0
  172. package/node_modules/pi-agent-doctor/src/project-probes.ts +73 -0
  173. package/node_modules/pi-agent-doctor/src/workspace.ts +106 -0
  174. package/node_modules/pi-agent-documentation/package.json +2 -2
  175. package/node_modules/pi-agent-documentation/runtime/entry-26.js +1 -0
  176. package/node_modules/pi-agent-filesystem/package.json +8 -8
  177. package/node_modules/pi-agent-filesystem/src/resolver.ts +23 -7
  178. package/node_modules/pi-agent-filesystem-image/package.json +4 -4
  179. package/node_modules/pi-agent-filesystem-jq/index.ts +33 -6
  180. package/node_modules/pi-agent-filesystem-jq/package.json +6 -7
  181. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +67 -0
  182. package/node_modules/pi-agent-filesystem-pdf/package.json +4 -4
  183. package/node_modules/pi-agent-filesystem-pdf/runtime/entry-30.js +2 -0
  184. package/node_modules/pi-agent-filesystem-text/package.json +4 -4
  185. package/node_modules/pi-agent-ide-ast/package.json +15 -41
  186. package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +2 -1
  187. package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +10 -3
  188. package/node_modules/pi-agent-ide-ast/src/ast/read-text.ts +4 -1
  189. package/node_modules/pi-agent-ide-ast/src/ast/selection.ts +3 -3
  190. package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +13 -10
  191. package/node_modules/pi-agent-ide-ast/src/extension.ts +17 -1
  192. package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +32 -4
  193. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  194. package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +1 -1
  195. package/node_modules/pi-agent-ide-ast/src/search-presentation.ts +4 -3
  196. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +100 -42
  197. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +3 -2
  198. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +2 -1
  199. package/node_modules/pi-agent-ide-changes/index.ts +10 -2
  200. package/node_modules/pi-agent-ide-changes/package.json +10 -11
  201. package/node_modules/pi-agent-ide-changes/runtime/entry-34.js +1 -0
  202. package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +7 -2
  203. package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +18 -1
  204. package/node_modules/pi-agent-ide-changes/src/changes/change-types.ts +3 -0
  205. package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +59 -7
  206. package/node_modules/pi-agent-ide-changes/src/changes/git-paths.ts +49 -0
  207. package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +10 -2
  208. package/node_modules/pi-agent-ide-changes/src/doctor-plugin.ts +13 -14
  209. package/node_modules/pi-agent-ide-changes/src/last-text-transaction-store.ts +2 -1
  210. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +47 -11
  211. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -1
  212. package/node_modules/pi-agent-ide-formatter/index.ts +14 -2
  213. package/node_modules/pi-agent-ide-formatter/package.json +4 -4
  214. package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +47 -35
  215. package/node_modules/pi-agent-ide-formatter/src/formatter.ts +41 -11
  216. package/node_modules/pi-agent-ide-formatter/src/registry.ts +9 -28
  217. package/node_modules/pi-agent-ide-languages/package.json +3 -3
  218. package/node_modules/pi-agent-ide-lint/index.ts +35 -4
  219. package/node_modules/pi-agent-ide-lint/package.json +8 -8
  220. package/node_modules/pi-agent-ide-lint/runtime/entry-38.js +2 -0
  221. package/node_modules/pi-agent-ide-lint/src/command-linter.ts +14 -10
  222. package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +47 -39
  223. package/node_modules/pi-agent-ide-lint/src/registry.ts +9 -25
  224. package/node_modules/pi-agent-ide-lsp/index.ts +107 -25
  225. package/node_modules/pi-agent-ide-lsp/package.json +10 -13
  226. package/node_modules/pi-agent-ide-lsp/runtime/entry-39.js +2 -0
  227. package/node_modules/pi-agent-ide-lsp/src/code-view-resolvers.ts +6 -2
  228. package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +5 -1
  229. package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +5 -3
  230. package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +27 -11
  231. package/node_modules/pi-agent-ide-lsp/src/lsp/abort.ts +62 -0
  232. package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +245 -103
  233. package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +26 -45
  234. package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
  235. package/node_modules/pi-agent-ide-lsp/src/lsp/document-uri.ts +40 -0
  236. package/node_modules/pi-agent-ide-lsp/src/lsp/file-watchers.ts +8 -1
  237. package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +24 -17
  238. package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +255 -56
  239. package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +51 -11
  240. package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +67 -0
  241. package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +149 -18
  242. package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +79 -31
  243. package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +15 -12
  244. package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +16 -0
  245. package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +67 -46
  246. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +50 -19
  247. package/node_modules/pi-agent-image/package.json +3 -3
  248. package/node_modules/pi-agent-invariant/package.json +2 -2
  249. package/node_modules/pi-agent-pdf/package.json +3 -4
  250. package/node_modules/pi-agent-read/package.json +12 -12
  251. package/node_modules/pi-agent-read/runtime/entry-45.js +0 -1
  252. package/node_modules/pi-agent-read/runtime/entry-47.js +2 -0
  253. package/node_modules/pi-agent-read/src/api/tools/read.ts +4 -2
  254. package/node_modules/pi-agent-read/src/core/extension.ts +4 -1
  255. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +143 -69
  256. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +25 -1
  257. package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +67 -44
  258. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +8 -3
  259. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +20 -5
  260. package/node_modules/pi-agent-resource/package.json +2 -2
  261. package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +75 -16
  262. package/node_modules/pi-agent-resource/src/index.ts +3 -0
  263. package/node_modules/pi-agent-resource/src/resource-error.ts +17 -0
  264. package/node_modules/pi-agent-resource/src/resource.ts +23 -0
  265. package/node_modules/pi-agent-resource/src/result-targets.ts +25 -2
  266. package/node_modules/pi-agent-resource/src/validation.ts +2 -1
  267. package/node_modules/pi-agent-search/package.json +9 -9
  268. package/node_modules/pi-agent-search/runtime/entry-50.js +0 -1
  269. package/node_modules/pi-agent-search/runtime/entry-51.js +1 -0
  270. package/node_modules/pi-agent-search/runtime/entry-52.js +2 -0
  271. package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  272. package/node_modules/pi-agent-search/src/api/presentation.ts +10 -2
  273. package/node_modules/pi-agent-search/src/api/search-parameters.ts +7 -3
  274. package/node_modules/pi-agent-search/src/api/search.ts +51 -2
  275. package/node_modules/pi-agent-search/src/core/extension.ts +2 -3
  276. package/node_modules/pi-agent-search/src/core/search-core.ts +98 -8
  277. package/node_modules/pi-agent-search-text/index.ts +37 -1
  278. package/node_modules/pi-agent-search-text/package.json +14 -12
  279. package/node_modules/pi-agent-search-text/runtime/entry-53.js +1 -0
  280. package/node_modules/pi-agent-search-text/runtime/entry-56.js +1 -0
  281. package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +10 -5
  282. package/node_modules/pi-agent-search-text/src/file-search.ts +26 -3
  283. package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +54 -3
  284. package/node_modules/pi-agent-search-text/src/resolvers.ts +22 -5
  285. package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -5
  286. package/node_modules/pi-agent-search-text/src/search-backend.ts +123 -17
  287. package/node_modules/pi-agent-search-text/src/search-recipe.ts +5 -1
  288. package/node_modules/pi-agent-search-text/src/search-result.ts +1 -0
  289. package/node_modules/pi-agent-search-text/src/search-session.ts +166 -31
  290. package/node_modules/pi-agent-text/package.json +3 -3
  291. package/node_modules/pi-agent-text/src/text-document.ts +2 -0
  292. package/node_modules/pi-agent-text-anchor-constant/package.json +4 -4
  293. package/node_modules/pi-agent-text-anchor-exact/package.json +5 -6
  294. package/node_modules/pi-agent-text-anchor-line-hash/package.json +7 -7
  295. package/node_modules/pi-agent-text-anchor-line-hash/runtime/entry-62.js +2 -0
  296. package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +3 -1
  297. package/node_modules/pi-agent-text-editor/package.json +26 -34
  298. package/node_modules/pi-agent-text-editor/runtime/entry-77.js +0 -1
  299. package/node_modules/pi-agent-text-editor/runtime/entry-78.js +1 -0
  300. package/node_modules/pi-agent-text-editor/src/api/delete-guard.ts +29 -2
  301. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +3 -0
  302. package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +55 -0
  303. package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +41 -0
  304. package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +2 -0
  305. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  306. package/node_modules/pi-agent-text-editor/src/api/native-files.ts +127 -0
  307. package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +20 -1
  308. package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +1 -0
  309. package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +93 -85
  310. package/node_modules/pi-agent-text-editor/src/core/extension.ts +15 -2
  311. package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +81 -0
  312. package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +70 -25
  313. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +123 -27
  314. package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +30 -1
  315. package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +147 -105
  316. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  317. package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
  318. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +91 -14
  319. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +74 -9
  320. package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +49 -25
  321. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
  322. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +122 -39
  323. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
  324. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +307 -32
  325. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +85 -31
  326. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
  327. package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +4 -1
  328. package/node_modules/pi-agent-text-editor-renderer/package.json +6 -8
  329. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-80.js +2 -0
  330. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +139 -27
  331. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
  332. package/node_modules/pi-agent-text-editor-stale-anchor/runtime/entry-81.js +2 -0
  333. package/node_modules/pi-agent-tool-call-interception/package.json +3 -3
  334. package/node_modules/pi-agent-tool-call-interception/runtime/entry-82.js +1 -0
  335. package/node_modules/pi-agent-tool-ui/package.json +2 -2
  336. package/node_modules/pi-agent-tool-ui/runtime/entry-83.js +1 -0
  337. package/node_modules/pi-agent-web/index.ts +28 -4
  338. package/node_modules/pi-agent-web/package.json +8 -11
  339. package/node_modules/pi-agent-web/src/doctor-plugin.ts +21 -6
  340. package/node_modules/pi-agent-web/src/resolver.ts +12 -2
  341. package/node_modules/pi-agent-web/src/search.ts +2 -1
  342. package/node_modules/pi-agent-web-html/package.json +3 -5
  343. package/node_modules/pi-agent-web-image/package.json +4 -4
  344. package/node_modules/pi-agent-web-pdf/package.json +4 -4
  345. package/node_modules/pi-agent-web-pdf/runtime/entry-87.js +2 -0
  346. package/node_modules/pi-agent-web-text/package.json +4 -4
  347. package/node_modules/pi-agent-web-text/runtime/entry-88.js +2 -0
  348. package/package.json +43 -39
  349. package/skills/configure-agent-ide/SKILL.md +38 -0
  350. package/src/api/content.ts +6 -0
  351. package/src/api/doctor-runtime.ts +80 -0
  352. package/src/api/doctor.ts +6 -0
  353. package/src/api/hooks.ts +3 -0
  354. package/src/api/plugin-protocol.ts +11 -1
  355. package/src/api/tips.ts +3 -0
  356. package/src/api/tool-config.ts +143 -24
  357. package/src/backend/config.ts +85 -0
  358. package/src/backend/configured-process.ts +59 -0
  359. package/src/backend/dap-java-transport.ts +112 -0
  360. package/src/backend/dap-java-worker.py +218 -0
  361. package/src/backend/dap-node-transport.ts +112 -0
  362. package/src/backend/dap-powershell-worker.py +44 -0
  363. package/src/backend/dap-r-worker.py +210 -0
  364. package/src/backend/dap-tcp-transport.ts +42 -0
  365. package/src/backend/dap-tcp-worker.py +125 -0
  366. package/src/backend/dap-transport.ts +69 -0
  367. package/src/backend/dap-unix-worker.py +63 -0
  368. package/src/backend/debugger-registration.ts +62 -0
  369. package/src/backend/debugger-workspace-owner.ts +413 -0
  370. package/src/backend/doctor-inventory-worker.py +54 -0
  371. package/src/backend/doctor-probe-worker.py +140 -0
  372. package/src/backend/doctor-registration.ts +18 -0
  373. package/src/backend/doctor-workspace.ts +381 -0
  374. package/src/backend/file-operation-resolver.ts +58 -0
  375. package/src/backend/file-revision.ts +13 -0
  376. package/src/backend/file-transfer.ts +302 -0
  377. package/src/backend/file-watch-worker.py +119 -0
  378. package/src/backend/formatter-registration.ts +114 -0
  379. package/src/backend/git-registration.ts +60 -0
  380. package/src/backend/identity.ts +47 -0
  381. package/src/backend/index.ts +12 -0
  382. package/src/backend/lint-registration.ts +102 -0
  383. package/src/backend/lsp-file-watchers.ts +220 -0
  384. package/src/backend/lsp-registration.ts +83 -0
  385. package/src/backend/lsp-transport.ts +87 -0
  386. package/src/backend/lsp-workspace-owner.ts +50 -0
  387. package/src/backend/object-transfer.ts +299 -0
  388. package/src/backend/owned-command.ts +105 -0
  389. package/src/backend/owned-process-stop.ts +36 -0
  390. package/src/backend/owned-read-command.ts +20 -0
  391. package/src/backend/process-environment.ts +77 -0
  392. package/src/backend/process-metadata-worker.py +98 -0
  393. package/src/backend/process-metadata.ts +99 -0
  394. package/src/backend/recipe-evidence-worker.py +26 -0
  395. package/src/backend/recipe-evidence.ts +77 -0
  396. package/src/backend/registration.ts +124 -0
  397. package/src/backend/registry.ts +29 -0
  398. package/src/backend/resource-resolver.ts +147 -0
  399. package/src/backend/search-environment.ts +100 -0
  400. package/src/backend/ssh-channel-worker.py +306 -0
  401. package/src/backend/ssh-channel.ts +376 -0
  402. package/src/backend/ssh-transfer-worker.py +99 -0
  403. package/src/backend/ssh-transport.ts +54 -0
  404. package/src/backend/ssh-worker.py +730 -0
  405. package/src/backend/ssh.ts +610 -0
  406. package/src/backend/tool-config-access.ts +63 -0
  407. package/src/backend/tool-project.ts +71 -0
  408. package/src/backend/vision-capture-worker.py +319 -0
  409. package/src/backend/vision-capture.ts +165 -0
  410. package/src/backend/vision-registration.ts +104 -0
  411. package/src/backend/web-browser-worker.mjs +182 -0
  412. package/src/backend/web-browser.ts +128 -0
  413. package/src/backend/web-http-worker.py +62 -0
  414. package/src/backend/web-http.ts +79 -0
  415. package/src/backend/web-owner.ts +68 -0
  416. package/src/backend/web-registration.ts +14 -0
  417. package/src/code-view/diagnostic-view.ts +2 -2
  418. package/src/code-view/reference.ts +9 -0
  419. package/src/composite/builtin-extensions.ts +9 -14
  420. package/src/composite/module-labels.ts +1 -0
  421. package/src/composite/nested-tool-rendering.ts +26 -6
  422. package/src/composite/preferences.ts +13 -0
  423. package/src/composite/settings-documentation.ts +59 -0
  424. package/src/composite/settings-help.ts +106 -0
  425. package/src/composite/text-results.ts +50 -22
  426. package/src/core/diagnostic-store.ts +32 -10
  427. package/src/core/ide-core.ts +22 -2
  428. package/src/doctor/arguments.ts +19 -0
  429. package/src/doctor/config-writer.ts +72 -29
  430. package/src/doctor/discovery.ts +53 -15
  431. package/src/doctor/extension.ts +27 -10
  432. package/src/doctor/run.ts +42 -7
  433. package/src/documentation/extension.ts +12 -0
  434. package/src/documentation/search.ts +166 -0
  435. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +8 -8
  436. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +4 -4
  437. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +33 -6
  438. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +6 -7
  439. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +67 -0
  440. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +4 -4
  441. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/runtime/entry-30.js +2 -0
  442. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +4 -4
  443. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/runtime/entry-31.js +2 -0
  444. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-27.js +2 -0
  445. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +23 -7
  446. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +28 -4
  447. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +8 -11
  448. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +3 -5
  449. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +4 -4
  450. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +4 -4
  451. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/runtime/entry-87.js +2 -0
  452. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +4 -4
  453. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/runtime/entry-88.js +2 -0
  454. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-84.js +2 -0
  455. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +21 -6
  456. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +12 -2
  457. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/search.ts +2 -1
  458. package/src/extensions/pi-agent-read/package.json +12 -12
  459. package/src/extensions/pi-agent-read/runtime/entry-45.js +0 -1
  460. package/src/extensions/pi-agent-read/runtime/entry-46.js +1 -0
  461. package/src/extensions/pi-agent-read/runtime/entry-47.js +2 -0
  462. package/src/extensions/pi-agent-read/src/api/tools/read.ts +4 -2
  463. package/src/extensions/pi-agent-read/src/core/extension.ts +4 -1
  464. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +143 -69
  465. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +25 -1
  466. package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +67 -44
  467. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +8 -3
  468. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +20 -5
  469. package/src/extensions/pi-agent-search/package.json +9 -9
  470. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +37 -1
  471. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +14 -12
  472. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-53.js +1 -0
  473. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-55.js +1 -0
  474. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-56.js +1 -0
  475. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +10 -5
  476. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +26 -3
  477. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +54 -3
  478. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +22 -5
  479. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -5
  480. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +123 -17
  481. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +5 -1
  482. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +1 -0
  483. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +166 -31
  484. package/src/extensions/pi-agent-search/runtime/entry-50.js +0 -1
  485. package/src/extensions/pi-agent-search/runtime/entry-51.js +1 -0
  486. package/src/extensions/pi-agent-search/runtime/entry-52.js +2 -0
  487. package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
  488. package/src/extensions/pi-agent-search/src/api/presentation.ts +10 -2
  489. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +7 -3
  490. package/src/extensions/pi-agent-search/src/api/search.ts +51 -2
  491. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -3
  492. package/src/extensions/pi-agent-search/src/core/search-core.ts +98 -8
  493. package/src/extensions/pi-agent-text-editor/package.json +26 -34
  494. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +4 -4
  495. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +5 -6
  496. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +7 -7
  497. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-61.js +1 -0
  498. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/runtime/entry-62.js +2 -0
  499. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +3 -1
  500. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +6 -8
  501. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-80.js +2 -0
  502. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +139 -27
  503. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
  504. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-81.js +2 -0
  505. package/src/extensions/pi-agent-text-editor/runtime/entry-77.js +0 -1
  506. package/src/extensions/pi-agent-text-editor/runtime/entry-78.js +1 -0
  507. package/src/extensions/pi-agent-text-editor/runtime/entry-79.js +2 -0
  508. package/src/extensions/pi-agent-text-editor/src/api/delete-guard.ts +29 -2
  509. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +3 -0
  510. package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +55 -0
  511. package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +41 -0
  512. package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +2 -0
  513. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +2 -2
  514. package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +127 -0
  515. package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +20 -1
  516. package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +1 -0
  517. package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +93 -85
  518. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +15 -2
  519. package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +81 -0
  520. package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +70 -25
  521. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +123 -27
  522. package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +30 -1
  523. package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +147 -105
  524. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +2 -0
  525. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +18 -9
  526. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +91 -14
  527. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +74 -9
  528. package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +49 -25
  529. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +16 -8
  530. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +122 -39
  531. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +7 -4
  532. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +307 -32
  533. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +85 -31
  534. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +22 -1
  535. package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +4 -1
  536. package/src/pi-agent-ide.ts +14 -2
  537. package/src/plugins/pi-agent-ide-ast/package.json +15 -41
  538. package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +2 -1
  539. package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +10 -3
  540. package/src/plugins/pi-agent-ide-ast/src/ast/read-text.ts +4 -1
  541. package/src/plugins/pi-agent-ide-ast/src/ast/selection.ts +3 -3
  542. package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +13 -10
  543. package/src/plugins/pi-agent-ide-ast/src/extension.ts +17 -1
  544. package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +32 -4
  545. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  546. package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +1 -1
  547. package/src/plugins/pi-agent-ide-ast/src/search-presentation.ts +4 -3
  548. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +100 -42
  549. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +3 -2
  550. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +2 -1
  551. package/src/plugins/pi-agent-ide-changes/index.ts +10 -2
  552. package/src/plugins/pi-agent-ide-changes/package.json +10 -11
  553. package/src/plugins/pi-agent-ide-changes/runtime/entry-34.js +1 -0
  554. package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +7 -2
  555. package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +18 -1
  556. package/src/plugins/pi-agent-ide-changes/src/changes/change-types.ts +3 -0
  557. package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +59 -7
  558. package/src/plugins/pi-agent-ide-changes/src/changes/git-paths.ts +49 -0
  559. package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +10 -2
  560. package/src/plugins/pi-agent-ide-changes/src/doctor-plugin.ts +13 -14
  561. package/src/plugins/pi-agent-ide-changes/src/last-text-transaction-store.ts +2 -1
  562. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +47 -11
  563. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -1
  564. package/src/plugins/pi-agent-ide-debugger/index.ts +62 -25
  565. package/src/plugins/pi-agent-ide-debugger/src/adapter-executables.ts +3 -1
  566. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +33 -0
  567. package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +150 -171
  568. package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +2 -0
  569. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +152 -58
  570. package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +28 -0
  571. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +4 -1
  572. package/src/plugins/pi-agent-ide-formatter/index.ts +14 -2
  573. package/src/plugins/pi-agent-ide-formatter/package.json +4 -4
  574. package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +47 -35
  575. package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +41 -11
  576. package/src/plugins/pi-agent-ide-formatter/src/registry.ts +9 -28
  577. package/src/plugins/pi-agent-ide-languages/package.json +3 -3
  578. package/src/plugins/pi-agent-ide-lint/index.ts +35 -4
  579. package/src/plugins/pi-agent-ide-lint/package.json +8 -8
  580. package/src/plugins/pi-agent-ide-lint/runtime/entry-38.js +2 -0
  581. package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +14 -10
  582. package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +47 -39
  583. package/src/plugins/pi-agent-ide-lint/src/registry.ts +9 -25
  584. package/src/plugins/pi-agent-ide-lsp/index.ts +107 -25
  585. package/src/plugins/pi-agent-ide-lsp/package.json +10 -13
  586. package/src/plugins/pi-agent-ide-lsp/runtime/entry-39.js +2 -0
  587. package/src/plugins/pi-agent-ide-lsp/src/code-view-resolvers.ts +6 -2
  588. package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +5 -1
  589. package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +5 -3
  590. package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +27 -11
  591. package/src/plugins/pi-agent-ide-lsp/src/lsp/abort.ts +62 -0
  592. package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +245 -103
  593. package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +26 -45
  594. package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
  595. package/src/plugins/pi-agent-ide-lsp/src/lsp/document-uri.ts +40 -0
  596. package/src/plugins/pi-agent-ide-lsp/src/lsp/file-watchers.ts +8 -1
  597. package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +24 -17
  598. package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +255 -56
  599. package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +51 -11
  600. package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +67 -0
  601. package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +149 -18
  602. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +79 -31
  603. package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +15 -12
  604. package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +16 -0
  605. package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +67 -46
  606. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +50 -19
  607. package/src/plugins/pi-agent-ide-processes/src/registry.ts +8 -1
  608. package/src/plugins/pi-agent-ide-terminal/index.ts +7 -0
  609. package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +5 -1
  610. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -2
  611. package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +161 -42
  612. package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +7 -0
  613. package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +11 -0
  614. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +33 -8
  615. package/src/plugins/pi-agent-ide-terminal/src/types.ts +5 -0
  616. package/src/plugins/pi-agent-ide-vision/index.ts +170 -9
  617. package/src/plugins/pi-agent-ide-vision/src/doctor-plugin.ts +47 -0
  618. package/src/plugins/pi-agent-ide-vision/src/vision.ts +42 -1
  619. package/src/post-edit/gate.ts +4 -1
  620. package/src/tips/core.ts +5 -2
  621. package/src/tips/extension.ts +30 -2
  622. package/src/tips/persistence.ts +29 -27
  623. package/src/tips/setup-hint.ts +19 -0
  624. package/src/toolchain/types.ts +2 -0
  625. package/dist/chunk-3YK4XMWB.js +0 -0
  626. package/dist/chunk-5JELU6RV.js +0 -7
  627. package/dist/chunk-6U5OU77O.js +0 -3
  628. package/dist/chunk-7LD2OQH3.js +0 -14
  629. package/dist/chunk-BMOJTJJJ.js +0 -3
  630. package/dist/chunk-BYZSBXUK.js +0 -2
  631. package/dist/chunk-CEX73RI5.js +0 -28
  632. package/dist/chunk-DZWTKF2K.js +0 -1
  633. package/dist/chunk-EOKEQ3YH.js +0 -25
  634. package/dist/chunk-HZ5BNF3A.js +0 -1
  635. package/dist/chunk-IG56UGSO.js +0 -2
  636. package/dist/chunk-KVHDMIZS.js +0 -3
  637. package/dist/chunk-M5IVSCR2.js +0 -1
  638. package/dist/chunk-M5MJP7Z2.js +0 -1
  639. package/dist/chunk-MGCHOGQD.js +0 -1
  640. package/dist/chunk-N34ATN52.js +0 -1
  641. package/dist/chunk-NHKPP2AI.js +0 -28
  642. package/dist/chunk-NRZO5KJT.js +0 -9
  643. package/dist/chunk-OB46OPMZ.js +0 -1
  644. package/dist/chunk-Q6CZ6GBR.js +0 -3
  645. package/dist/chunk-QIK2E64R.js +0 -1
  646. package/dist/chunk-SBP3ABH4.js +0 -5
  647. package/dist/chunk-STBJO3Z3.js +0 -2
  648. package/dist/chunk-T6LX2RX5.js +0 -1
  649. package/dist/chunk-TXOTNK6B.js +0 -11
  650. package/dist/chunk-WZI4YC2O.js +0 -1
  651. package/dist/entry-19.js +0 -1
  652. package/docs/research/apply-native-capability-matrix.md +0 -174
  653. package/docs/research/apply-read-latency.md +0 -221
  654. package/docs/research/codemode-write-context.md +0 -56
  655. package/docs/research/lpt-393-fuzzy-results/file.json +0 -152
  656. package/docs/research/lpt-393-fuzzy-results/repo.json +0 -122
  657. package/docs/research/lpt-393-search-fuzzy-fallback.md +0 -97
  658. package/docs/research/native-codemode-batch-decision.md +0 -31
  659. package/docs/research/native-codemode-batching.md +0 -65
  660. package/node_modules/pi-agent-doctor/runtime/entry-19.js +0 -1
  661. package/node_modules/pi-agent-filesystem/runtime/entry-25.js +0 -2
  662. package/node_modules/pi-agent-filesystem-image/runtime/entry-26.js +0 -2
  663. package/node_modules/pi-agent-ide-ast/runtime/entry-30.js +0 -1
  664. package/node_modules/pi-agent-ide-formatter/runtime/entry-34.js +0 -2
  665. package/node_modules/pi-agent-image/runtime/entry-38.js +0 -1
  666. package/node_modules/pi-agent-invariant/runtime/entry-39.js +0 -1
  667. package/node_modules/pi-agent-search/runtime/entry-47.js +0 -1
  668. package/node_modules/pi-agent-search-text/runtime/entry-51.js +0 -2
  669. package/node_modules/pi-agent-search-text/runtime/entry-52.js +0 -1
  670. package/node_modules/pi-agent-text-anchor-constant/runtime/entry-56.js +0 -2
  671. package/node_modules/pi-agent-text-editor/runtime/entry-62.js +0 -1
  672. package/node_modules/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
  673. package/node_modules/pi-agent-tool-call-interception/runtime/entry-80.js +0 -1
  674. package/node_modules/pi-agent-tool-ui/runtime/entry-81.js +0 -1
  675. package/node_modules/pi-agent-web/runtime/entry-82.js +0 -2
  676. package/node_modules/pi-agent-web-html/runtime/entry-83.js +0 -2
  677. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/runtime/entry-26.js +0 -2
  678. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/runtime/entry-27.js +0 -2
  679. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/runtime/entry-25.js +0 -2
  680. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/runtime/entry-83.js +0 -2
  681. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/runtime/entry-84.js +0 -2
  682. package/src/extensions/pi-agent-read/extensions/pi-agent-web/runtime/entry-82.js +0 -2
  683. package/src/extensions/pi-agent-read/runtime/entry-41.js +0 -1
  684. package/src/extensions/pi-agent-read/runtime/entry-42.js +0 -1
  685. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-51.js +0 -2
  686. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/runtime/entry-52.js +0 -1
  687. package/src/extensions/pi-agent-search/runtime/entry-47.js +0 -1
  688. package/src/extensions/pi-agent-search/runtime/entry-48.js +0 -1
  689. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/runtime/entry-56.js +0 -2
  690. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/runtime/entry-57.js +0 -1
  691. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/runtime/entry-78.js +0 -2
  692. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/runtime/entry-79.js +0 -2
  693. package/src/extensions/pi-agent-text-editor/runtime/entry-61.js +0 -1
  694. package/src/extensions/pi-agent-text-editor/runtime/entry-62.js +0 -1
  695. package/src/plugins/pi-agent-ide-ast/runtime/entry-30.js +0 -1
  696. package/src/plugins/pi-agent-ide-ast/runtime/entry-31.js +0 -2
  697. package/src/plugins/pi-agent-ide-formatter/runtime/entry-34.js +0 -2
  698. /package/node_modules/{pi-agent-documentation → pi-agent-doctor}/runtime/entry-24.js +0 -0
  699. /package/node_modules/{pi-agent-filesystem-jq → pi-agent-filesystem}/runtime/entry-27.js +0 -0
  700. /package/node_modules/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-28.js +0 -0
  701. /package/node_modules/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-29.js +0 -0
  702. /package/node_modules/{pi-agent-ide-ast → pi-agent-filesystem-text}/runtime/entry-31.js +0 -0
  703. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-32.js +0 -0
  704. /package/node_modules/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-33.js +0 -0
  705. /package/node_modules/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-35.js +0 -0
  706. /package/node_modules/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-36.js +0 -0
  707. /package/node_modules/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-37.js +0 -0
  708. /package/node_modules/{pi-agent-pdf → pi-agent-image}/runtime/entry-40.js +0 -0
  709. /package/node_modules/{pi-agent-read → pi-agent-invariant}/runtime/entry-41.js +0 -0
  710. /package/node_modules/{pi-agent-read → pi-agent-pdf}/runtime/entry-42.js +0 -0
  711. /package/node_modules/{pi-agent-resource → pi-agent-read}/runtime/entry-46.js +0 -0
  712. /package/node_modules/{pi-agent-search → pi-agent-resource}/runtime/entry-48.js +0 -0
  713. /package/node_modules/{pi-agent-text → pi-agent-search-text}/runtime/entry-55.js +0 -0
  714. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text}/runtime/entry-57.js +0 -0
  715. /package/node_modules/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-58.js +0 -0
  716. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-59.js +0 -0
  717. /package/node_modules/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-60.js +0 -0
  718. /package/node_modules/{pi-agent-text-editor → pi-agent-text-anchor-line-hash}/runtime/entry-61.js +0 -0
  719. /package/node_modules/{pi-agent-text-editor-stale-anchor → pi-agent-text-editor}/runtime/entry-79.js +0 -0
  720. /package/node_modules/{pi-agent-web-image → pi-agent-web}/runtime/entry-84.js +0 -0
  721. /package/node_modules/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-85.js +0 -0
  722. /package/node_modules/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-86.js +0 -0
  723. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-pdf → pi-agent-filesystem-image}/runtime/entry-28.js +0 -0
  724. /package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/{pi-agent-filesystem-text → pi-agent-filesystem-jq}/runtime/entry-29.js +0 -0
  725. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-pdf → pi-agent-web-html}/runtime/entry-85.js +0 -0
  726. /package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/{pi-agent-web-text → pi-agent-web-image}/runtime/entry-86.js +0 -0
  727. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-exact → pi-agent-text-anchor-constant}/runtime/entry-58.js +0 -0
  728. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-59.js +0 -0
  729. /package/src/extensions/pi-agent-text-editor/plugins/{pi-agent-text-anchor-line-hash → pi-agent-text-anchor-exact}/runtime/entry-60.js +0 -0
  730. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-32.js +0 -0
  731. /package/src/plugins/{pi-agent-ide-changes → pi-agent-ide-ast}/runtime/entry-33.js +0 -0
  732. /package/src/plugins/{pi-agent-ide-languages → pi-agent-ide-changes}/runtime/entry-35.js +0 -0
  733. /package/src/plugins/{pi-agent-ide-lint → pi-agent-ide-formatter}/runtime/entry-36.js +0 -0
  734. /package/src/plugins/{pi-agent-ide-lsp → pi-agent-ide-languages}/runtime/entry-37.js +0 -0
@@ -1,43 +1,72 @@
1
- import{a as j,b as $,c as L,d as ee,e as te,f as B}from"./chunk-W7CASEO3.js";import{f as q}from"./chunk-IM24DB3K.js";import{a as Z}from"./chunk-YGGKGZO2.js";import"./chunk-QUYXINGZ.js";import"./chunk-WLZIUMJL.js";import{a as Y}from"./chunk-BU7IZLKB.js";import{a as H,b as X}from"./chunk-S5PL5DFQ.js";import{J as Q,d as K}from"./chunk-6U5OU77O.js";import"./chunk-ZC65Z3CK.js";import{a as f}from"./chunk-EI7MMDWY.js";var G={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.vision":["Agent vision","Inspect process metadata and capture supported windows and web pages as images."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var O=[T("ide.core",()=>import("./chunk-EOKEQ3YH.js")),T("ide.tips",()=>import("./chunk-BMOJTJJJ.js")),T("ide.doctor",()=>import("./chunk-5JELU6RV.js")),T("ide.languages",()=>import("./entry-35.js"),["ide.doctor"]),T("read.core",()=>import("./entry-45.js")),T("ide.documentation",()=>import("./chunk-NRZO5KJT.js"),["read.core"]),T("read.filesystem",()=>import("./entry-25.js"),["read.core","editor.core"]),T("read.filesystem.jq",()=>import("./entry-27.js"),["read.filesystem","ide.documentation","ide.doctor"]),T("read.filesystem.image",()=>import("./entry-26.js"),["read.filesystem"]),T("read.filesystem.pdf",()=>import("./entry-28.js"),["read.filesystem"]),T("read.filesystem.text",()=>import("./entry-29.js"),["read.filesystem"]),T("read.web",()=>import("./entry-82.js"),["read.core"]),T("read.web.html",()=>import("./entry-83.js"),["read.web"]),T("read.web.image",()=>import("./entry-84.js"),["read.web"]),T("read.web.pdf",()=>import("./entry-85.js"),["read.web"]),T("read.web.text",()=>import("./entry-86.js"),["read.web"]),T("search.core",()=>import("./entry-50.js")),T("search.text",()=>import("./entry-51.js"),["search.core"]),T("editor.renderer",()=>import("./entry-78.js"),["editor.core"]),T("editor.core",()=>import("./entry-77.js")),T("editor.anchor.constant",()=>import("./entry-56.js"),["read.core","editor.core"]),T("editor.anchor.line-hash",()=>import("./entry-60.js"),["read.core","editor.core"]),T("editor.anchor.exact",()=>import("./entry-58.js"),["editor.core"]),T("editor.stale-anchor",()=>import("./entry-79.js"),["editor.core"]),T("ide.ast",()=>import("./entry-31.js"),["ide.core","read.core","search.core","editor.core"]),T("ide.formatter",()=>import("./entry-34.js"),["ide.core"]),T("ide.lint",()=>import("./entry-36.js"),["ide.core"]),T("ide.changes",()=>import("./entry-33.js"),["ide.core","read.core","editor.core"]),T("ide.lsp",()=>import("./entry-37.js"),["ide.core","read.core","search.core"]),T("ide.processes",()=>import("./chunk-S6QRG3TQ.js")),T("ide.vision",()=>import("./chunk-SBP3ABH4.js"),["ide.processes","read.core","search.core"]),T("ide.debugger",()=>import("./chunk-NHKPP2AI.js"),["ide.processes","read.core","editor.core"]),T("ide.terminal",()=>import("./chunk-CEX73RI5.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),T("ide.diagnostics",()=>import("./chunk-BYZSBXUK.js"),["ide.core","read.core"])];function T(e,l,p=[],c=!0){return{id:e,name:G[e][0],description:G[e][1],dependencies:p,async register(r,m){await(await l()).default(r,m)},...c?{}:{defaultEnabled:!1}}}f(T,"builtin");function F(e,l,p){return{kind:"choice",id:e,name:l,description:p,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}f(F,"presentationPreference");var ne=[F("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),F("ui.read","Read","Choose how Read calls and results are displayed."),F("ui.search","Search","Choose how Search calls and results are displayed."),F("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]},{kind:"text",id:"vision.sequenceDurationSeconds",name:"Vision sequence duration",description:"Default sequence duration in seconds. Requests may override it, up to 10 seconds.",default:"2",group:"features"},{kind:"text",id:"vision.sequenceIntervalSeconds",name:"Vision sequence interval",description:"Default seconds between sequence frames. A sequence may contain at most 20 frames.",default:"0.5",group:"features"},{kind:"text",id:"vision.imageScale",name:"Vision image scale",description:"Default image downscale from greater than 0 through 1.",default:"0.5",group:"features"},{kind:"text",id:"vision.allowedExecutables",name:"Vision allowed executables",description:"Comma-separated executable file names that may be captured without arbitrary-window access.",default:"",group:"features",placeholder:"Unity.exe,UnrealEditor.exe"}];function U(e,l,p=[]){let c=new Map;for(let u of e){if(c.has(u.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${u.id}`);c.set(u.id,u)}for(let u of e)for(let w of u.dependencies)if(!c.has(w))throw new Error(`Pi Agent IDE extension ${u.id} has unknown dependency ${w}`);let r=new Set;for(let u of l)c.has(u)&&r.add(u);for(let u of p)if(!c.has(u))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${u}`);let m=Te(c,p,r),h=new Set;for(let u of e)(u.defaultEnabled===!1&&!m.has(u.id)||r.has(u.id))&&h.add(u.id);let v=!0;for(;v;){v=!1;for(let u of e)h.has(u.id)||u.dependencies.every(w=>!h.has(w))||(h.add(u.id),v=!0)}return{enabled:e.filter(u=>!h.has(u.id)),disabled:h}}f(U,"selectBuiltinExtensions");function Te(e,l,p){let c=new Set,r=[...l];for(;r.length>0;){let m=r.pop();if(!(c.has(m)||p.has(m))){c.add(m);for(let h of e.get(m)?.dependencies??[])c.has(h)||r.push(h)}}return c}f(Te,"collectForcedOn");import{Input as Ne}from"@earendil-works/pi-tui";import{mkdir as ve,readFile as Se,writeFile as Re}from"node:fs/promises";import Pe from"node:path";import{withFileMutationQueue as Ce}from"@earendil-works/pi-coding-agent";async function oe(e,l,p=new Map,c=new Map,r){await Ce(e,async()=>{let m=await B(e),h={};try{h=JSON.parse(await Se(e,"utf8"))}catch(n){if(!(n instanceof Error&&"code"in n&&n.code==="ENOENT"))throw n}let v=new Set(m.disabled),u=new Set(m.enabled);for(let[n,s]of l)v.delete(n),u.delete(n),s==="disabled"&&v.add(n),s==="enabled"&&u.add(n);let w={...m.preferences};for(let[n,s]of c)s===void 0?delete w[n]:w[n]=s;let g={...m.flags};for(let[n,s]of p)n==="pi-agent-ide-no-animations"&&delete h.noAnimations,n==="pi-agent-ide-no-post-processing"&&delete h.noPostProcessing,s===void 0?delete g[n]:g[n]=s;await ve(Pe.dirname(e),{recursive:!0}),await Re(e,`${JSON.stringify({...h,disabled:[...v],enabled:[...u],...r===void 0?{}:{preset:r},...p.size>0?{flags:g}:{},...c.size>0?{preferences:w}:{}},null,2)}
2
- `)})}f(oe,"saveModuleChoices");import{getSettingsListTheme as ke}from"@earendil-works/pi-coding-agent";import{matchesKey as W,SettingsList as _e,truncateToWidth as se,visibleWidth as re}from"@earendil-works/pi-tui";function ie(e,l,p,c,r=""){let m=["extensions","behavior","ui"],h="extensions",v=f(i=>i==="extensions"?"modules":i==="behavior"?"features":"ui","itemKey"),u=f(i=>i==="extensions"?"modules":i==="behavior"?"features":"ui","changeKey"),w=f(()=>{let i=v(h),o=l()[i]??[];return new _e(o,12,ke(),(a,d)=>{p(u(h),a,d);for(let x of l()[i]??[]){let b=o.find(E=>E.id===x.id);b&&Object.assign(b,x)}},()=>c(!1),{enableSearch:!0})},"createList"),g=w(),n=f(i=>e.fg("borderMuted",i),"border"),s=f((i,o)=>{if(o<=1)return n("\u2502");let a=o-2,d=se(i,a);return`${n("\u2502")}${d}${" ".repeat(Math.max(0,a-re(d)))}${n("\u2502")}`},"row"),t=f(i=>n(i<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,i-2))}\u2524`),"rule");return{render(i){let o=Math.max(1,i),a=Math.max(1,o-4),d=` Agent IDE settings${r?` \xB7 ${r}`:""} `,x=o<=1?n("\u256D"):`${n("\u256D\u2500")}${e.fg("accent",e.bold(se(d,Math.max(0,o-3),"")))}${n(`${"\u2500".repeat(Math.max(0,o-re(d)-3))}\u256E`)}`,b={extensions:"Features",behavior:"Behavior",ui:"UI"},E=m.map(A=>A===h?e.fg("accent",e.bold(`[ ${b[A]} ]`)):e.fg("dim",` ${b[A]} `)).join(" "),I=g.render(a).map(A=>s(` ${A} `,o)),R=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[x,s(` ${E} `,o),t(o),...I,t(o),s(R,o),n(o<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,o-2))}\u256F`)]},invalidate(){g.invalidate()},handleInput(i){W(i,"tab")||W(i,"shift+tab")?(h=m[(m.indexOf(h)+(W(i,"shift+tab")?2:1))%m.length]??"extensions",g=w()):W(i,"ctrl+s")?c(!0):g.handleInput(i)}}}f(ie,"createSettingsPanel");function ae(e,l=[],p=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(c,r){if(r.hasUI)try{let m=await r.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(m===void 0)return;let h=L(process.env,void 0,r.cwd),v=m==="Project"?h.projectPath:h.globalPath,u=await B(v),w=await B(m==="Project"?h.globalPath:h.projectPath),g=new Map,n=new Map,s=new Map,t;if(!await r.ui.custom((o,a,d,x)=>{let b=ie(a,()=>{let E=new Set(u.disabled),I=new Set(u.enabled);for(let[P,y]of g)E.delete(P),I.delete(P),y==="disabled"&&E.add(P),y==="enabled"&&I.add(P);let R=U(O,[...$(O,t??u.preset??"full"),...E,...$(O,w.preset??"full"),...w.disabled],[...I,...w.enabled]);return{modules:O.map(P=>({id:P.id,label:P.name??P.id,description:`${P.description??""} Effective: ${R.disabled.has(P.id)?"off":"on"}.${w.disabled.includes(P.id)?" Disabled in the other scope.":P.dependencies.some(y=>R.disabled.has(y))?" A dependency is disabled.":""}`,currentValue:g.get(P.id)??(u.disabled.includes(P.id)?"disabled":u.enabled.includes(P.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[A(),...k("features"),...S("features")],ui:[...k("ui"),...S("ui")]};function A(){let P=t??u.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:j.find(y=>y.value===P)?.label??P,values:j.map(y=>y.label)}}function S(P){return p.filter(y=>y.group===P).map(y=>{let C=s.has(y.id)?s.get(y.id):u.preferences?.[y.id];return{id:y.id,label:y.name,description:`${y.description} Default: ${y.kind==="choice"?y.values.find(_=>_.value===y.default)?.label??y.default:y.default||"empty"}.`,currentValue:C===void 0?"default":y.kind==="choice"?y.values.find(_=>_.value===C)?.label??C:C,...y.kind==="choice"?{values:["default",...y.values.map(_=>_.label)]}:{submenu:f((_,z)=>{let D=new Ne,V=_==="default"?y.default:_;return V.length>0&&D.handleInput(V),D.focused=!0,D.onSubmit=Ae=>z(Ae),D.onEscape=()=>z(),D},"submenu")}}})}function k(P){return l.filter(y=>(y.group??"features")===P).map(y=>{let C=n.has(y.id)?n.get(y.id):te(u)[y.id];return{id:y.id,label:y.name,description:y.description,currentValue:C===void 0?"default":C?y.labels?.on??"enabled":y.labels?.off??"disabled",values:["default",y.labels?.off??"disabled",y.labels?.on??"enabled"]}})}},(E,I,R)=>{if(E==="modules")g.set(I,R);else if(I==="preset")t=j.find(A=>A.label===R)?.value;else if(p.some(A=>A.id===I)){let A=p.find(S=>S.id===I);s.set(I,R==="default"||R.length===0?void 0:A?.kind==="choice"?A.values.find(S=>S.label===R)?.value:R)}else n.set(I,R==="default"?void 0:R===(l.find(A=>A.id===I)?.labels?.on??"enabled"))},x,m);return{render:f(E=>b.render(E),"render"),invalidate:f(()=>b.invalidate(),"invalidate"),handleInput(E){b.handleInput(E),o.requestRender()}}})||g.size+n.size+s.size+(t===void 0?0:1)===0)return;if(await oe(v,g,n,s,t),r.ui.notify(`Saved ${m.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await r.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await r.reload();return}}catch(m){r.ui.notify(m instanceof Error?m.message:String(m),"error")}}})}f(ae,"registerModuleSettings");function de(e,l){let p=[];return{definitions:p,register(c){if(p.some(r=>r.id===c.id))throw new Error(`Duplicate feature flag: ${c.id}`);p.push(c),e.registerFlag(c.id,{type:"boolean",description:c.description,default:l[c.id]??c.default})}}}f(de,"createFeatureFlags");function le(e){let l=new Map,p=new Set;return{api:{...e,registerTool:f(r=>{r.namespace?.name.startsWith("ide_")===!0&&l.set(r.name,{hide:f(()=>e.registerTool({...r,get description(){return r.description},get promptGuidelines(){return r.promptGuidelines},exposure:"hidden"}),"hide"),restore:f(()=>e.registerTool(r),"restore")}),p.has(r.name)?l.get(r.name)?.hide():e.registerTool(r)},"registerTool")},reconcile(r=!1,m=[]){let h=new Set,v=new Set;for(let s of e.getSettings().defaultTools??[])if(s.startsWith("-"))h.add(s.slice(1)),v.delete(s.slice(1));else{let t=s.startsWith("+")?s.slice(1):s;h.delete(t),v.add(t)}for(let[s,t]of l)h.has(s)!==p.has(s)&&(h.has(s)?(t.hide(),p.add(s)):(t.restore(),p.delete(s)));let u=e.getAllTools().filter(s=>s.exposure!=="hidden"),w=new Set(e.getActiveTools());for(let s of u)r&&l.has(s.name)&&(v.has(s.name)||s.exposure==="deferred"&&m.includes(s.name))&&w.add(s.name);r&&!h.has("tool_search")&&u.some(s=>s.name==="tool_search")&&u.some(s=>l.has(s.name)&&s.exposure==="deferred")&&w.add("tool_search");let g=e.getActiveTools(),n=[...w].filter(s=>!p.has(s));(n.length!==g.length||n.some(s=>!g.includes(s)))&&e.setActiveTools(n)}}}f(le,"createIdeToolAvailability");import{ToolExecutionComponent as ce}from"@earendil-works/pi-coding-agent";import{Container as Oe,Spacer as Me,Text as ue}from"@earendil-works/pi-tui";var J="ide-nested-results",fe=256,pe=512*1024,ge=8*1024,De=32*1024,$e=f(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function Be(e){let l=e.retention,p=[l?.argumentsTruncated&&"arguments shortened",l?.resultsOmitted&&"result displays omitted",l?.callsOmitted&&"call panels omitted",l?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(p.length>0)return`Nested IDE display: ${p.join("; ")}. Tool execution and parent output are unchanged.`;if(!l&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}f(Be,"retentionWarning");function me(e){let l=new Map,p=new Map,c=new Map,r,m=new WeakMap,h=f((g,n,s)=>{n.result=s,n.resultOmitted=!1;try{let i=JSON.stringify(g);if(Buffer.byteLength(i)<=pe){n.result=JSON.parse(JSON.stringify(s));return}}catch{}let t=s.details&&typeof s.details=="object"?Object.entries(s.details).filter(([i,o])=>(i==="source"||i==="fullOutputPath")&&typeof o=="string").map(([i,o])=>`${i}: ${String(o)}`):[];n.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...t].join(`
3
- `)}],details:void 0,isError:s.isError},n.resultOmitted=!0},"retainResult"),v=f(()=>{p.clear(),c.clear()},"clear");e.on("session_start",(g,n)=>{v(),n.mode==="tui"&&n.ui.setWidget(J,s=>(r=s,{render:f(()=>[],"render"),invalidate:f(()=>{},"invalidate")}))}),e.on("session_tree",v),e.on("session_shutdown",v),e.on("tool_execution_start",(g,n)=>{if(g.parentToolCallId===void 0)return;let s=p.get(g.parentToolCallId)??g.parentToolCallId;if(p.set(g.toolCallId,s),!l.has(g.toolName))return;let t=c.get(s);if(t||(t={parentToolCallId:s,cwd:n.cwd,calls:[],retention:$e()},c.set(s,t)),t.calls.length>=fe){t.retention.callsOmitted=!0;return}let i=JSON.stringify(g.args),o=De-t.calls.reduce((b,E)=>b+Buffer.byteLength(JSON.stringify(E.args)),0)-(fe-t.calls.length-1)*2,a=Buffer.byteLength(i)>Math.min(ge,o),d=a?Object.fromEntries(Object.entries(g.args).map(([b,E])=>[b,typeof E=="string"?E.slice(0,200)+(E.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(i),x=Buffer.byteLength(JSON.stringify(d))<=Math.min(ge,o)?d:{};t.calls.push({id:g.toolCallId,name:g.toolName,args:x,argumentsTruncated:a})}),e.on("tool_execution_end",g=>{let n=p.get(g.toolCallId);if(n===void 0)return;p.delete(g.toolCallId);let s=c.get(n),t=s?.calls.find(i=>i.id===g.toolCallId);if(s&&t){let i=g.result;h(s,t,{content:i.content.filter(o=>o.type!=="text"||!o.text.startsWith(`
1
+ import{a as O,b as B,c as U,d as re,e as ie,f as F}from"./chunk-W7CASEO3.js";import{f as H}from"./chunk-IM24DB3K.js";import"./chunk-QUYXINGZ.js";import"./chunk-PRLIHLCS.js";import{a as ae}from"./chunk-YGGKGZO2.js";import"./chunk-MPT3R4BL.js";import{f as Z}from"./chunk-T7I2VX3J.js";import{a as ne}from"./chunk-BU7IZLKB.js";import{a as ee,b as te}from"./chunk-S5PL5DFQ.js";import{K as se,d as oe}from"./chunk-DXONCYWF.js";import"./chunk-ZC65Z3CK.js";import{a as u}from"./chunk-EI7MMDWY.js";var z={"ide.core":["IDE services","Shared services used by language, formatting and diagnostic modules."],"ide.tips":["Getting started tips","Show contextual guidance while setting up a project."],"ide.documentation":["Progressive agent documentation","Expose packaged guides and attach them on first relevant tool use."],"ide.doctor":["Setup doctor","Check external tools and help configure project support."],"ide.languages":["Language setup","Discover languages and their recommended toolchains."],"ide.processes":["Agent IDE processes","Show active terminal and debugger sessions in one shared process surface."],"ide.vision":["Agent vision","Inspect process metadata and capture supported windows and web pages as images."],"ide.debugger":["Debugger sessions","Debug local programs through addressable DAP sessions and anchored breakpoints."],"ide.terminal":["Terminal sessions","Run and manage local interactive and background terminal processes."],"read.core":["Read tools","Read sources through the configured readers and views."],"read.filesystem":["Local files","Resolve files and folders from the local filesystem."],"read.ssh":["SSH files","Read and edit configured SSH file sources through existing tools."],"read.filesystem.jq":["JSON queries","Query local JSON files through jq read views."],"read.filesystem.image":["Local images","Read local images as visual content."],"read.filesystem.pdf":["Local PDFs","Extract readable content from local PDF documents."],"read.filesystem.text":["Local text","Read local text files with their source coordinates."],"read.web":["Web sources","Read remote sources over HTTP and HTTPS."],"read.web.html":["Web pages","Extract readable content from HTML pages."],"read.web.image":["Web images","Read remote images as visual content."],"read.web.pdf":["Web PDFs","Extract text from remote PDF documents."],"read.web.text":["Web text","Read remote plain-text sources."],"search.core":["Search tools","Run searches through the configured search providers."],"search.text":["Text search","Find text and files and register reusable search selections."],"editor.core":["Editing tools","Make guarded text and whole-file changes, directly or through native Codemode."],"editor.renderer":["Edit previews","Display changes in the shared colored diff panels."],"editor.anchor.constant":["File boundary selectors","Use begin and end to select file boundaries."],"editor.anchor.line-hash":["Checked line selectors","Select lines with hashes that detect stale content."],"editor.anchor.exact":["Exact text selectors","Locate edit ranges using unique source text."],"editor.stale-anchor":["Stale selection recovery","Provide recovery guidance when an edit selection is outdated."],"ide.ast":["Structural code support","Read code outlines and search or edit exact syntax-tree nodes."],"ide.formatter":["Code formatting","Run configured formatters after edits."],"ide.lint":["Lint checks","Run configured linters and collect their findings."],"ide.changes":["Git changes","Inspect and manage uncommitted changes and undo history."],"ide.lsp":["Language servers","Resolve symbols, rename references and collect language-server diagnostics."],"ide.diagnostics":["Diagnostic views","Show diagnostic findings through read views and sources."]};var N=[A("ide.core",()=>import("./chunk-XSIKDVAR.js")),A("ide.tips",()=>import("./chunk-BB4A5UI3.js")),A("ide.doctor",()=>import("./chunk-ID4RJIVZ.js")),A("ide.languages",()=>import("./entry-37.js"),["ide.doctor"]),A("read.core",()=>import("./entry-47.js")),A("ide.documentation",()=>import("./chunk-VMGZMXEM.js"),["read.core"]),A("read.filesystem",()=>import("./entry-27.js"),["read.core","editor.core"]),A("read.ssh",()=>import("./chunk-SWA5B5B2.js"),["read.filesystem"]),A("read.filesystem.jq",()=>import("./entry-29.js"),["read.filesystem","ide.documentation","ide.doctor"]),A("read.filesystem.image",()=>import("./entry-28.js"),["read.filesystem"]),A("read.filesystem.pdf",()=>import("./entry-30.js"),["read.filesystem"]),A("read.filesystem.text",()=>import("./entry-31.js"),["read.filesystem"]),A("read.web",()=>import("./chunk-GNACBJM3.js"),["read.core"]),A("read.web.html",()=>import("./entry-85.js"),["read.web"]),A("read.web.image",()=>import("./entry-86.js"),["read.web"]),A("read.web.pdf",()=>import("./entry-87.js"),["read.web"]),A("read.web.text",()=>import("./entry-88.js"),["read.web"]),A("search.core",()=>import("./entry-52.js")),A("search.text",()=>import("./entry-53.js"),["search.core"]),A("editor.renderer",()=>import("./entry-80.js"),["editor.core"]),A("editor.core",()=>import("./entry-79.js")),A("editor.anchor.constant",()=>import("./entry-58.js"),["read.core","editor.core"]),A("editor.anchor.line-hash",()=>import("./entry-62.js"),["read.core","editor.core"]),A("editor.anchor.exact",()=>import("./entry-60.js"),["editor.core"]),A("editor.stale-anchor",()=>import("./entry-81.js"),["editor.core"]),A("ide.ast",()=>import("./entry-33.js"),["ide.core","read.core","search.core","editor.core"]),A("ide.formatter",()=>import("./chunk-246NTPOS.js"),["ide.core"]),A("ide.lint",()=>import("./chunk-VNTY7BKC.js"),["ide.core"]),A("ide.changes",()=>import("./chunk-ZV5ETNLQ.js"),["ide.core","read.core","editor.core"]),A("ide.lsp",()=>import("./chunk-3WO2NOEQ.js"),["ide.core","read.core","search.core"]),A("ide.processes",()=>import("./chunk-OM4LYD3S.js")),A("ide.vision",()=>import("./chunk-BR7GRH4A.js"),["ide.processes","read.core","search.core"]),A("ide.debugger",()=>import("./chunk-WMHSVEIT.js"),["ide.processes","read.core","editor.core"]),A("ide.terminal",()=>import("./chunk-W7M3V7FR.js"),["ide.processes","read.core","search.core","editor.core","editor.anchor.constant"]),A("ide.diagnostics",()=>import("./chunk-AUL5FGGK.js"),["ide.core","read.core"])];function A(e,s,f=[],l=!0){return{id:e,name:z[e][0],description:z[e][1],dependencies:f,async register(o,g){await(await s()).default(o,g)},...l?{}:{defaultEnabled:!1}}}u(A,"builtin");function W(e,s,f){return{kind:"choice",id:e,name:s,description:f,default:"compact",group:"ui",values:[{value:"full",label:"Full"},{value:"compact",label:"Compact"},{value:"disabled",label:"Disabled"}]}}u(W,"presentationPreference");var G=[{kind:"choice",id:"ui.codemode",name:"Show tool results from Codemode",description:"Show extra Agent IDE result panels using each tool's presentation setting. Off hides successful panels; errors stay visible. Codemode's own output and other tools are unchanged.",default:"off",group:"ui",values:[{value:"off",label:"Off"},{value:"on",label:"On"}]},W("ui.diffs","Diffs","Choose how mutation and comparison diffs are displayed."),W("ui.read","Read","Choose how Read calls and results are displayed."),W("ui.search","Search","Choose how Search calls and results are displayed."),W("ui.terminal","Terminal","Choose how shell commands and terminal output are displayed."),{kind:"choice",id:"processes.activity",name:"Active Agent IDE processes",description:"Choose detailed process cards, a compact active count, or no persistent Agent IDE process UI.",default:"detailed",group:"ui",values:[{value:"detailed",label:"Detailed cards"},{value:"compact",label:"Compact count"},{value:"off",label:"Off"}]},{kind:"text",id:"vision.sequenceDurationSeconds",name:"Vision sequence duration",description:"Default sequence duration in seconds. Requests may override it, up to 10 seconds.",default:"2",group:"features"},{kind:"text",id:"vision.sequenceIntervalSeconds",name:"Vision sequence interval",description:"Default seconds between sequence frames. A sequence may contain at most 20 frames.",default:"0.5",group:"features"},{kind:"text",id:"vision.imageScale",name:"Vision image scale",description:"Default image downscale from greater than 0 through 1.",default:"0.5",group:"features"},{kind:"text",id:"vision.allowedExecutables",name:"Vision allowed executables",description:"Comma-separated executable file names that may be captured without arbitrary-window access.",default:"",group:"features",placeholder:"Unity.exe,UnrealEditor.exe"}];function q(e,s,f=[]){let l=new Map;for(let m of e){if(l.has(m.id))throw new Error(`Duplicate Pi Agent IDE extension ID: ${m.id}`);l.set(m.id,m)}for(let m of e)for(let x of m.dependencies)if(!l.has(x))throw new Error(`Pi Agent IDE extension ${m.id} has unknown dependency ${x}`);let o=new Set;for(let m of s)l.has(m)&&o.add(m);for(let m of f)if(!l.has(m))throw new Error(`Unknown Pi Agent IDE extension ID in enabled: ${m}`);let g=Ne(l,f,o),y=new Set;for(let m of e)(m.defaultEnabled===!1&&!g.has(m.id)||o.has(m.id))&&y.add(m.id);let E=!0;for(;E;){E=!1;for(let m of e)y.has(m.id)||m.dependencies.every(x=>!y.has(x))||(y.add(m.id),E=!0)}return{enabled:e.filter(m=>!y.has(m.id)),disabled:y}}u(q,"selectBuiltinExtensions");function Ne(e,s,f){let l=new Set,o=[...s];for(;o.length>0;){let g=o.pop();if(!(l.has(g)||f.has(g))){l.add(g);for(let y of e.get(g)?.dependencies??[])l.has(y)||o.push(y)}}return l}u(Ne,"collectForcedOn");import{Input as Le}from"@earendil-works/pi-tui";import{mkdir as De,readFile as Me,writeFile as Oe}from"node:fs/promises";import je from"node:path";import{withFileMutationQueue as $e}from"@earendil-works/pi-coding-agent";async function le(e,s,f=new Map,l=new Map,o){await $e(e,async()=>{let g=await F(e),y={};try{y=JSON.parse(await Me(e,"utf8"))}catch(i){if(!(i instanceof Error&&"code"in i&&i.code==="ENOENT"))throw i}let E=new Set(g.disabled),m=new Set(g.enabled);for(let[i,n]of s)E.delete(i),m.delete(i),n==="disabled"&&E.add(i),n==="enabled"&&m.add(i);let x={...g.preferences};for(let[i,n]of l)n===void 0?delete x[i]:x[i]=n;let S={...g.flags};for(let[i,n]of f)i==="pi-agent-ide-no-animations"&&delete y.noAnimations,i==="pi-agent-ide-no-post-processing"&&delete y.noPostProcessing,n===void 0?delete S[i]:S[i]=n;await De(je.dirname(e),{recursive:!0}),await Oe(e,`${JSON.stringify({...y,disabled:[...E],enabled:[...m],...o===void 0?{}:{preset:o},...f.size>0?{flags:S}:{},...l.size>0?{preferences:x}:{}},null,2)}
2
+ `)})}u(le,"saveModuleChoices");import{getSettingsListTheme as Be}from"@earendil-works/pi-coding-agent";import{matchesKey as J,SettingsList as Fe,truncateToWidth as de,visibleWidth as ce}from"@earendil-works/pi-tui";function ue(e,s,f,l,o=""){let g=["extensions","behavior","ui"],y="extensions",E=u(t=>t==="extensions"?"modules":t==="behavior"?"features":"ui","itemKey"),m=u(t=>t==="extensions"?"modules":t==="behavior"?"features":"ui","changeKey"),x=u(()=>{let t=E(y),a=s()[t]??[];return new Fe(a,12,Be(),(r,c)=>{f(m(y),r,c);for(let d of s()[t]??[]){let b=a.find(p=>p.id===d.id);b&&Object.assign(b,d)}},()=>l(!1),{enableSearch:!0})},"createList"),S=x(),i=u(t=>e.fg("borderMuted",t),"border"),n=u((t,a)=>{if(a<=1)return i("\u2502");let r=a-2,c=de(t,r);return`${i("\u2502")}${c}${" ".repeat(Math.max(0,r-ce(c)))}${i("\u2502")}`},"row"),h=u(t=>i(t<=1?"\u251C":`\u251C${"\u2500".repeat(Math.max(0,t-2))}\u2524`),"rule");return{render(t){let a=Math.max(1,t),r=Math.max(1,a-4),c=` Agent IDE settings${o?` \xB7 ${o}`:""} `,d=a<=1?i("\u256D"):`${i("\u256D\u2500")}${e.fg("accent",e.bold(de(c,Math.max(0,a-3),"")))}${i(`${"\u2500".repeat(Math.max(0,a-ce(c)-3))}\u256E`)}`,b={extensions:"Features",behavior:"Behavior",ui:"UI"},p=g.map(T=>T===y?e.fg("accent",e.bold(`[ ${b[T]} ]`)):e.fg("dim",` ${b[T]} `)).join(" "),w=S.render(r).map(T=>n(` ${T} `,a)),I=e.fg("dim"," Tab switch \xB7 Enter change \xB7 Ctrl+S save \xB7 Esc cancel ");return[d,n(` ${p} `,a),h(a),...w,h(a),n(I,a),i(a<=1?"\u2570":`\u2570${"\u2500".repeat(Math.max(0,a-2))}\u256F`)]},invalidate(){S.invalidate()},handleInput(t){J(t,"tab")||J(t,"shift+tab")?(y=g[(g.indexOf(y)+(J(t,"shift+tab")?2:1))%g.length]??"extensions",S=x()):J(t,"ctrl+s")?l(!0):S.handleInput(t)}}}u(ue,"createSettingsPanel");function fe(e,s=[],f=[]){e.registerCommand("agent-ide-settings",{description:"Configure Agent IDE modules and features",async handler(l,o){if(o.hasUI)try{let g=await o.ui.select("Agent IDE settings \u2014 save scope",["Project","Global"]);if(g===void 0)return;let y=U(process.env,void 0,o.cwd),E=g==="Project"?y.projectPath:y.globalPath,m=await F(E),x=await F(g==="Project"?y.globalPath:y.projectPath),S=new Map,i=new Map,n=new Map,h;if(!await o.ui.custom((a,r,c,d)=>{let b=ue(r,()=>{let p=new Set(m.disabled),w=new Set(m.enabled);for(let[R,v]of S)p.delete(R),w.delete(R),v==="disabled"&&p.add(R),v==="enabled"&&w.add(R);let I=q(N,[...B(N,h??m.preset??"full"),...p,...B(N,x.preset??"full"),...x.disabled],[...w,...x.enabled]);return{modules:N.map(R=>({id:R.id,label:R.name??R.id,description:`${R.description??""} Effective: ${I.disabled.has(R.id)?"off":"on"}.${x.disabled.includes(R.id)?" Disabled in the other scope.":R.dependencies.some(v=>I.disabled.has(v))?" A dependency is disabled.":""}`,currentValue:S.get(R.id)??(m.disabled.includes(R.id)?"disabled":m.enabled.includes(R.id)?"enabled":"default"),values:["default","enabled","disabled"]})),features:[T(),...P("features"),...C("features")],ui:[...P("ui"),...C("ui")]};function T(){let R=h??m.preset??"full";return{id:"preset",label:"Preset",description:"Choose the built-in Agent IDE capability set. Reload required.",currentValue:O.find(v=>v.value===R)?.label??R,values:O.map(v=>v.label)}}function C(R){return f.filter(v=>v.group===R).map(v=>{let _=n.has(v.id)?n.get(v.id):m.preferences?.[v.id];return{id:v.id,label:v.name,description:`${v.description} Default: ${v.kind==="choice"?v.values.find(k=>k.value===v.default)?.label??v.default:v.default||"empty"}.`,currentValue:_===void 0?"default":v.kind==="choice"?v.values.find(k=>k.value===_)?.label??_:_,...v.kind==="choice"?{values:["default",...v.values.map(k=>k.label)]}:{submenu:u((k,L)=>{let $=new Le,Q=k==="default"?v.default:k;return Q.length>0&&$.handleInput(Q),$.focused=!0,$.onSubmit=_e=>L(_e),$.onEscape=()=>L(),$},"submenu")}}})}function P(R){return s.filter(v=>(v.group??"features")===R).map(v=>{let _=i.has(v.id)?i.get(v.id):ie(m)[v.id];return{id:v.id,label:v.name,description:v.description,currentValue:_===void 0?"default":_?v.labels?.on??"enabled":v.labels?.off??"disabled",values:["default",v.labels?.off??"disabled",v.labels?.on??"enabled"]}})}},(p,w,I)=>{if(p==="modules")S.set(w,I);else if(w==="preset")h=O.find(T=>T.label===I)?.value;else if(f.some(T=>T.id===w)){let T=f.find(C=>C.id===w);n.set(w,I==="default"||I.length===0?void 0:T?.kind==="choice"?T.values.find(C=>C.label===I)?.value:I)}else i.set(w,I==="default"?void 0:I===(s.find(T=>T.id===w)?.labels?.on??"enabled"))},d,g);return{render:u(p=>b.render(p),"render"),invalidate:u(()=>b.invalidate(),"invalidate"),handleInput(p){b.handleInput(p),a.requestRender()}}})||S.size+i.size+n.size+(h===void 0?0:1)===0)return;if(await le(E,S,i,n,h),o.ui.notify(`Saved ${g.toLowerCase()} Agent IDE settings. Reload required.`,"info"),await o.ui.confirm("Reload Pi?","Reload extensions to apply settings. In-memory extension state may reset.")){await o.reload();return}}catch(g){o.ui.notify(g instanceof Error?g.message:String(g),"error")}}})}u(fe,"registerModuleSettings");import{readFile as Ue}from"node:fs/promises";import V from"node:path";import{getMarkdownTheme as We}from"@earendil-works/pi-coding-agent";import{Markdown as Ge,matchesKey as M,ScrollView as qe,truncateToWidth as Je}from"@earendil-works/pi-tui";function He(){return Ue(V.join(V.dirname(V.dirname(import.meta.dirname)),"docs/settings-help.md"),"utf8")}u(He,"readSettingsHelp");function pe(e){e.registerCommand("agent-ide-help",{description:"Read the short Agent IDE settings guide",async handler(s,f){if(!(f.mode!=="tui"||!f.hasUI))try{let l=await He();await f.ui.custom((o,g,y,E)=>new X(l,g,()=>Math.max(5,Math.min(36,o.terminal.rows-4)),()=>o.requestRender(),E),{overlay:!0,overlayOptions:{width:92,margin:1}})}catch(l){f.ui.notify(l instanceof Error?l.message:String(l),"error")}}})}u(pe,"registerSettingsHelp");var X=class{constructor(s,f,l,o,g){this.content=s;this.theme=f;this.height=l;this.requestRender=o;this.done=g;this.markdown=this.createMarkdown(),this.scroll=new qe(this.markdown)}static{u(this,"SettingsHelpPanel")}markdown;scroll;createMarkdown(){return new Ge(this.content,0,0,We(),{color:u(s=>this.theme.fg("text",s),"color")})}invalidate(){this.markdown.invalidate()}handleInput(s){if(M(s,"escape")){this.done();return}M(s,"up")?this.scroll.scrollBy(-1):M(s,"down")?this.scroll.scrollBy(1):M(s,"pageUp")?this.scroll.scrollBy(-this.scroll.viewportHeight):M(s,"pageDown")||M(s,"space")?this.scroll.scrollBy(this.scroll.viewportHeight):M(s,"home")?this.scroll.scrollToStart():M(s,"end")&&this.scroll.scrollToEnd()}render(s){let f=Math.max(1,s-4),l=this.markdown.render(f),o=Math.max(1,this.height()-4);this.scroll.updateLayout(l.length,o,this.requestRender);let g=l.slice(this.scroll.scrollTop,this.scroll.scrollTop+o);for(;g.length<o;)g.push("");let y=this.theme.fg("border","\u2500".repeat(Math.max(0,s-2))),E=u(m=>this.theme.fg("border","\u2502 ")+Je(m,f,"\u2026",!0)+this.theme.fg("border"," \u2502"),"row");return[this.theme.fg("border","\u256D")+y+this.theme.fg("border","\u256E"),E(this.theme.fg("accent","Agent IDE settings help")),...g.map(E),E(this.theme.fg("muted","\u2191\u2193 scroll \xB7 PgUp/PgDn page \xB7 Home/End \xB7 Esc close")),this.theme.fg("border","\u2570")+y+this.theme.fg("border","\u256F")]}};function ge(e,s){let f=[];return{definitions:f,register(l){if(f.some(o=>o.id===l.id))throw new Error(`Duplicate feature flag: ${l.id}`);f.push(l),e.registerFlag(l.id,{type:"boolean",description:l.description,default:s[l.id]??l.default})}}}u(ge,"createFeatureFlags");function me(e){let s={preferences:G,flags:e,modules:N.map(({id:l,name:o,description:g,defaultEnabled:y,dependencies:E})=>({id:l,name:o,description:g,default:y!==!1,dependencies:E})),presets:O},f=Object.entries(s).map(([l,o])=>` "${l}": [
3
+ ${o.map(g=>` ${JSON.stringify(g)}`).join(`,
4
+ `)}
5
+ ]`).join(`,
6
+ `);return{id:"ide-settings",description:"Registered IDE settings, choices, defaults, configuration scopes and inheritance.",triggers:[{tool:"read",resourcePrefixes:["docs:ide-settings"]}],markdown:`# IDE settings
7
+
8
+ This catalog describes supported settings, not current saved values or live runtime state. It is generated from the registrations used by /agent-ide-settings. Read both configuration scopes to inspect overrides. Reload or restart applies saved changes; CLI flags may override them for an invocation.
9
+
10
+ ## Configuration scopes
11
+
12
+ - Project: <current project>/.pi/pi-agent-ide/extensions.json.
13
+ - Global: <PI_CODING_AGENT_DIR>/pi-agent-ide/extensions.json when that environment variable is non-empty; otherwise <home>/.pi/agent/pi-agent-ide/extensions.json. Resolve a relative PI_CODING_AGENT_DIR against the process working directory.
14
+ - Missing files mean no overrides. Invalid JSON or invalid field types are errors, not defaults.
15
+ - preferences maps registered IDs to strings; flags maps registered IDs to booleans. Project overrides Global per key. Default removes only the selected scope's key, allowing inheritance.
16
+ - preset is a registered preset value. Project overrides Global; without either, full is used. Default removes the selected scope's preset field.
17
+ - disabled and enabled are arrays of unique non-empty module IDs, merged across scopes. Disabled wins in either scope and cascades to dependents. enabled can activate default-off modules and dependencies; it cannot undo a disable or a preset restriction.
18
+ - A module's default below is its built-in default before preset and dependency selection, not its current effective state.
19
+ - Existing noAnimations and noPostProcessing booleans still work. Their registered flags are pi-agent-ide-no-animations and pi-agent-ide-no-post-processing. Within each scope a flags entry wins over its corresponding legacy boolean. When changing or resetting that flag, remove its legacy boolean in the same scope, as the menu does.
20
+ - Text preference values are strings, not JSON numbers. An empty default means no override; saved strings must be non-empty. Read each description for valid ranges. Do not treat storage validation as validation of every preference value.
21
+
22
+ ## Registered settings
23
+
24
+ Choices carry their saved value and human label. Text settings carry a description and optional placeholder. Boolean flag defaults do not include saved or CLI overrides. Preserve unrelated fields when editing configuration.
25
+
26
+ \`\`\`json
27
+ {
28
+ ${f}
29
+ }
30
+ \`\`\`
31
+ `}}u(me,"createIdeSettingsDocumentation");function he(e){let s=new Map,f=new Set;return{api:{...e,registerTool:u(o=>{o.namespace?.name.startsWith("ide_")===!0&&s.set(o.name,{hide:u(()=>e.registerTool({...o,get description(){return o.description},get promptGuidelines(){return o.promptGuidelines},exposure:"hidden"}),"hide"),restore:u(()=>e.registerTool(o),"restore")}),f.has(o.name)?s.get(o.name)?.hide():e.registerTool(o)},"registerTool")},reconcile(o=!1,g=[]){let y=new Set,E=new Set;for(let n of e.getSettings().defaultTools??[])if(n.startsWith("-"))y.add(n.slice(1)),E.delete(n.slice(1));else{let h=n.startsWith("+")?n.slice(1):n;y.delete(h),E.add(h)}for(let[n,h]of s)y.has(n)!==f.has(n)&&(y.has(n)?(h.hide(),f.add(n)):(h.restore(),f.delete(n)));let m=e.getAllTools().filter(n=>n.exposure!=="hidden"),x=new Set(e.getActiveTools());for(let n of m)o&&s.has(n.name)&&(E.has(n.name)||n.exposure==="deferred"&&g.includes(n.name))&&x.add(n.name);o&&!y.has("tool_search")&&m.some(n=>n.name==="tool_search")&&m.some(n=>s.has(n.name)&&n.exposure==="deferred")&&x.add("tool_search");let S=e.getActiveTools(),i=[...x].filter(n=>!f.has(n));(i.length!==S.length||i.some(n=>!S.includes(n)))&&e.setActiveTools(i)}}}u(he,"createIdeToolAvailability");import{ToolExecutionComponent as ye}from"@earendil-works/pi-coding-agent";import{Container as be,Spacer as ze,Text as Y}from"@earendil-works/pi-tui";var K="ide-nested-results",we=256,xe=512*1024,ve=8*1024,Ve=32*1024,Xe=u(()=>({argumentsTruncated:!1,resultsOmitted:!1,callsOmitted:!1,resultsUnavailable:!1}),"retained");function Ee(e){let s=e.retention,f=[s?.argumentsTruncated&&"arguments shortened",s?.resultsOmitted&&"result displays omitted",s?.callsOmitted&&"call panels omitted",s?.resultsUnavailable&&"results unavailable"].filter(Boolean);if(f.length>0)return`Nested IDE display: ${f.join("; ")}. Tool execution and parent output are unchanged.`;if(!s&&e.complete===!1)return"Nested IDE display is incomplete; omission details are unavailable."}u(Ee,"retentionWarning");function Ie(e,s=!1){let f=new Map,l=new Map,o=new Map,g,y=new WeakMap,E=u((i,n,h)=>{n.result=h,n.resultOmitted=!1;try{let a=JSON.stringify(i);if(Buffer.byteLength(a)<=xe){n.result=JSON.parse(JSON.stringify(h));return}}catch{}let t=h.details&&typeof h.details=="object"?Object.entries(h.details).filter(([a,r])=>(a==="source"||a==="fullOutputPath")&&typeof r=="string").map(([a,r])=>`${a}: ${String(r)}`):[];n.result={content:[{type:"text",text:["Result presentation omitted (history size limit or unsupported payload).",...t].join(`
32
+ `)}],details:void 0,isError:h.isError},n.resultOmitted=!0},"retainResult"),m=u(()=>{l.clear(),o.clear()},"clear");e.on("session_start",(i,n)=>{m(),n.mode==="tui"&&n.ui.setWidget(K,h=>(g=h,{render:u(()=>[],"render"),invalidate:u(()=>{},"invalidate")}))}),e.on("session_tree",m),e.on("session_shutdown",m),e.on("tool_execution_start",(i,n)=>{if(i.parentToolCallId===void 0)return;let h=l.get(i.parentToolCallId)??i.parentToolCallId;if(l.set(i.toolCallId,h),!f.has(i.toolName))return;let t=o.get(h);if(t||(t={parentToolCallId:h,cwd:n.cwd,calls:[],retention:Xe()},o.set(h,t)),t.calls.length>=we){t.retention.callsOmitted=!0;return}let a=JSON.stringify(i.args),r=Ve-t.calls.reduce((p,w)=>p+Buffer.byteLength(JSON.stringify(w.args)),0)-(we-t.calls.length-1)*2,c=Buffer.byteLength(a)>Math.min(ve,r),d=c?Object.fromEntries(Object.entries(i.args).map(([p,w])=>[p,typeof w=="string"?w.slice(0,200)+(w.length>200?"\u2026 [omitted]":""):"[omitted]"])):JSON.parse(a),b=Buffer.byteLength(JSON.stringify(d))<=Math.min(ve,r)?d:{};t.calls.push({id:i.toolCallId,name:i.toolName,args:b,argumentsTruncated:c})}),e.on("tool_execution_end",i=>{let n=l.get(i.toolCallId);if(n===void 0)return;l.delete(i.toolCallId);let h=o.get(n),t=h?.calls.find(a=>a.id===i.toolCallId);if(h&&t){let a=i.result;E(h,t,{content:a.content.filter(r=>r.type!=="text"||!r.text.startsWith(`
4
33
 
5
34
  ---
6
35
 
7
- # Guide:`)),details:i.details,isError:g.isError})}}),e.on("message_end",g=>{if(g.message.role!=="toolResult")return;let n=c.get(g.message.toolCallId);if(!n)return;c.delete(g.message.toolCallId);for(let[o,a]of p)a===n.parentToolCallId&&p.delete(o);let s=n.calls.filter(o=>!o.batched),t={...n,calls:[],retention:{...n.retention,argumentsTruncated:s.some(o=>o.argumentsTruncated===!0),resultsOmitted:s.some(o=>o.resultOmitted===!0),resultsUnavailable:s.some(o=>!o.result)}},i=Buffer.byteLength(JSON.stringify(t));for(let o of s){let a=JSON.stringify(o);if(i+=Buffer.byteLength(a)+(t.calls.length>0?1:0),i>pe){t.retention.callsOmitted=!0;break}t.calls.push(JSON.parse(a))}e.appendEntry(J,t)}),e.registerEntryRenderer(J,f(function g(n,s,t){if(!Array.isArray(n.data?.calls))return;if(!r)return{render:f(d=>r?g(n,s,t)?.render(d)??[]:[],"render"),invalidate:f(()=>{n.data&&m.get(n.data)?.invalidate()},"invalidate")};let i=Be(n.data),o=m.get(n.data);if(!o){o=new Oe;for(let d of n.data.calls){let x=new ce(d.name,d.id,d.renderArgs??d.args,{showImages:!0},d.resultOmitted||d.omitted||!d.result?void 0:l.get(d.name),r,n.data.cwd);d.result?x.updateResult(d.result):x.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),o.addChild(new Me(1)),o.addChild(x)}i&&o.addChild(new ue(t.fg("warning",i),0,0)),m.set(n.data,o)}let a=o.children.at(-1);i&&a instanceof ue&&a.setText(t.fg("warning",i));for(let d of o.children)d instanceof ce&&d.setExpanded(s.expanded);return o},"renderEntry"));let u=f(()=>{e.events.on(Z,g=>{let n=g,s=c.get(n.parentToolCallId);if(!s)return;let t=q(n.result.details),i=n.calls.findLast(a=>!n.unchangedCopyCalls?.includes(a)),o="callIdsByResult"in t&&Array.isArray(t.callIdsByResult)?t.callIdsByResult:[];for(let a of n.calls){let d=s.calls.find(I=>I.id===a);if(!d)continue;let x=t.results?.filter((I,R)=>(o[R]===a||o.length===0&&n.calls.length===1)&&I.data.errors?.some(A=>A.code==="POST_WRITE_FAILED"||A.code==="POST_EDIT_FAILED"))??[];if(d.postWriteFailure=x.length>0,d.postWriteFailure){d.batched=!1,delete d.renderArgs,h(s,d,{content:n.result.content,details:{results:x,effect:"applied"},isError:!0});continue}let b=n.copyResults?.get(a),E=b?.details.metadata?.copyRollback;if(d.name==="copy"&&b&&(E==="restored"||E==="failed")){d.copyRollback=E,d.batched=!1,h(s,d,{content:b.content,details:q(b.details),isError:!0});continue}d.unchangedCopy=d.name==="copy"&&n.unchangedCopyCalls?.includes(a)===!0,d.batched=!d.unchangedCopy&&a!==i,d.unchangedCopy?h(s,d,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1}):d.batched?d.result=void 0:(new Set(t.mutationRender?.map(I=>I.path)).size>1&&(d.renderArgs={}),d.rollback=t.results?.some(I=>I.data.rollback!==void 0)===!0,h(s,d,{content:n.result.content,details:t,isError:n.result.isError===!0||d.rollback}))}}),e.on("tool_result",g=>{let n=g.details,s=c.get(g.toolCallId);if(s&&n&&typeof n=="object"&&"editorBatchResults"in n&&Array.isArray(n.editorBatchResults))for(let t of n.editorBatchResults)for(let i of t.data?.operations??[]){let o=s.calls.find(d=>d.id===i.id);if(!o)continue;let a=i.errors.map(d=>d.message);o.rollback||o.postWriteFailure||o.copyRollback!==void 0||o.unchangedCopy&&a.length===0&&i.effect==="not-applied"||(a.length>0||i.effect!=="applied")&&(o.batched=!1,delete o.renderArgs,h(s,o,{content:[{type:"text",text:`${o.name}: ${i.effect}.
8
- ${a.join(`
9
- `)}`}],details:void 0,isError:a.length>0||i.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:f(g=>{l.set(g.name,g),e.registerTool(g)},"registerTool")},finalize:u}}f(me,"createNestedIdeRendering");import{createCanvas as je,loadImage as Le}from"@napi-rs/canvas";import{DEFAULT_MAX_BYTES as Fe,DEFAULT_MAX_LINES as Ue,truncateHead as We}from"@earendil-works/pi-coding-agent";var N={bytes:Fe,lines:Ue,pixels:4e6,images:20,imageBytes:20*1024*1024};async function M(e,l="",p){let c=typeof l=="string"?[l]:l,r=[],m=e.flatMap(a=>{if(a.type!=="text")return[];let d=c.find(x=>x.length>0&&a.text.endsWith(x));return d?(r.push(d),[a.text.slice(0,-d.length)]):[a.text]}).join(`
10
- `),h=r.join(""),v=We(m,{maxBytes:N.bytes,maxLines:N.lines}),u=[],w;if(v.truncated&&p!==void 0)try{w=await p(m)}catch{u.push("[Full output could not be saved. Narrow the request to inspect it.]")}v.truncated&&u.push(`[Output truncated: useful content is limited to ${N.bytes} bytes / ${N.lines} lines. Narrow the request or read a smaller source range.]`),w!==void 0&&u.push(`[Full output: ${JSON.stringify(w)}. Read with offset/limit, or read ${JSON.stringify("raw:"+w)} for byte ranges. Available until this runtime is disposed.]`);let g=e.filter(a=>a.type==="image"),n=g.slice(0,N.images),s=[],t=Math.floor(N.pixels/Math.max(1,n.length)),i=0,o=g.length-n.length;for(let[a,d]of n.entries())try{let x=Buffer.from(d.data,"base64"),b=await Le(x),E=Math.min(1,Math.sqrt(t/(b.width*b.height))),I=Math.min(t,Math.max(1,Math.floor(b.height*E))),R=Math.min(Math.floor(t/I),Math.max(1,Math.floor(b.width*E))),A=x,S=d.mimeType;if(E<1||i+A.byteLength>N.imageBytes){let k=je(R,I);k.getContext("2d").drawImage(b,0,0,R,I),A=await k.encode("png"),S="image/png"}if(i+A.byteLength>N.imageBytes){o++;continue}i+=A.byteLength,s.push({type:"image",data:A.toString("base64"),mimeType:S}),E<1&&u.push(`[Image ${a+1} resized from ${b.width}x${b.height} to ${R}x${I} to fit the shared media budget.]`)}catch{o++,u.push(`[Image ${a+1} could not be decoded and was not returned.]`)}return o>0&&u.push(`[${o} images omitted from the result. Read fewer frames or a smaller image region.]`),{text:v.firstLineExceedsLimit?qe(m):v.content,textTruncated:v.truncated,images:s,notices:u,metadataSuffix:h,fullOutput:w}}f(M,"limitIdeOutput");function qe(e){let l=0,p=0;for(let c of e){let r=Buffer.byteLength(c);if(l+r>N.bytes)break;l+=r,p+=c.length}return e.slice(0,p)}f(qe,"bytePrefix");var he={read:["path"],search:["path"],select:["path"],replace:["path"],insert:["path"],delete:["path"],write:["path"],copy:["path","target"],move:["path","target"],undo:["file"],diff:["before","after"]};function ye(e){let l=Q(e),p=new Set,c=new K,r=f(t=>c.saveFile(t),"saveFullOutput"),m=new Set,h=new Map;Y(e,{protocol:H,apiVersion:X,id:"ide-output-retention",setup(t){t.setOutputSaver(r)}}),e.on("session_shutdown",()=>c.dispose());let v=f((t,i)=>{let o=i;return t!=="tool_call"?e.on(t,o):e.on("tool_call",async(a,d)=>{let x=await o(a,d);if(!x?.block||!p.has(a.toolName)||x.reason===void 0)return x;let b=await M([{type:"text",text:x.reason}],"",r);return m.add(a.toolCallId),{...x,reason:b.text+(b.notices.length?`
36
+ # Guide:`)),details:a.details,isError:i.isError})}}),e.on("message_end",i=>{if(i.message.role!=="toolResult")return;let n=o.get(i.message.toolCallId);if(!n)return;o.delete(i.message.toolCallId);for(let[r,c]of l)c===n.parentToolCallId&&l.delete(r);let h=n.calls.filter(r=>!r.batched),t={...n,parentToolName:i.message.toolName,calls:[],retention:{...n.retention,argumentsTruncated:h.some(r=>r.argumentsTruncated===!0),resultsOmitted:h.some(r=>r.resultOmitted===!0),resultsUnavailable:h.some(r=>!r.result)}},a=Buffer.byteLength(JSON.stringify(t));for(let r of h){let c=JSON.stringify(r);if(a+=Buffer.byteLength(c)+(t.calls.length>0?1:0),a>xe){t.retention.callsOmitted=!0;break}t.calls.push(JSON.parse(c))}e.appendEntry(K,t)}),e.registerEntryRenderer(K,u(function i(n,h,t){if(!Array.isArray(n.data?.calls))return;let a=s&&n.data.parentToolName==="codemode"&&!h.expanded,r=a?n.data.calls.filter(p=>p.result?.isError):n.data.calls;if(a&&r.length===0){let p=Ee(n.data);return p?new Y(t.fg("warning",p),0,0):new be}if(!g)return{render:u(p=>g?i(n,h,t)?.render(p)??[]:[],"render"),invalidate:u(()=>{n.data&&y.get(n.data)?.invalidate()},"invalidate")};let c=Ee(n.data),d=a?void 0:y.get(n.data);if(!d){d=new be;for(let p of r){let w=new ye(p.name,p.id,p.renderArgs??p.args,{showImages:!0},p.resultOmitted||p.omitted||!p.result?void 0:f.get(p.name),g,n.data.cwd);p.result?w.updateResult(p.result):w.updateResult({content:[{type:"text",text:"Result unavailable in this saved display."}],isError:!0}),d.addChild(new ze(1)),d.addChild(w)}c&&d.addChild(new Y(t.fg("warning",c),0,0)),a||y.set(n.data,d)}let b=d.children.at(-1);c&&b instanceof Y&&b.setText(t.fg("warning",c));for(let p of d.children)p instanceof ye&&p.setExpanded(h.expanded);return d},"renderEntry"));let x=u(()=>{e.events.on(ae,i=>{let n=i,h=o.get(n.parentToolCallId);if(!h)return;let t=H(n.result.details),a=n.calls.findLast(c=>!n.unchangedCopyCalls?.includes(c)),r="callIdsByResult"in t&&Array.isArray(t.callIdsByResult)?t.callIdsByResult:[];for(let c of n.calls){let d=h.calls.find(I=>I.id===c);if(!d)continue;let b=t.results?.filter((I,T)=>(r[T]===c||r.length===0&&n.calls.length===1)&&I.data.errors?.some(C=>C.code==="POST_WRITE_FAILED"||C.code==="POST_EDIT_FAILED"))??[];if(d.postWriteFailure=b.length>0,d.postWriteFailure){d.batched=!1,delete d.renderArgs,E(h,d,{content:n.result.content,details:{results:b,effect:"applied"},isError:!0});continue}let p=n.mutationResults?.get(c),w=p?.details.metadata?.copyRollback;if(d.name==="copy"&&p&&(w==="restored"||w==="failed")){d.copyRollback=w,d.batched=!1,E(h,d,{content:p.content,details:H(p.details),isError:!0});continue}if(d.unchangedCopy=d.name==="copy"&&n.unchangedCopyCalls?.includes(c)===!0,d.batched=!d.unchangedCopy&&c!==a,d.unchangedCopy)E(h,d,{content:[{type:"text",text:"No changes: destination already has this text."}],details:{},isError:!1});else if(d.batched)d.result=void 0;else{new Set(t.mutationRender?.map(T=>T.path)).size>1&&(d.renderArgs={}),d.rollback=t.results?.some(T=>T.data.rollback!==void 0)===!0;let I=d.result?.details?.metadata?.targetUnavailable;E(h,d,{content:n.result.content,details:typeof I=="string"?{...t,metadata:{...t.metadata,targetUnavailable:I}}:t,isError:n.result.isError===!0||d.rollback})}}}),e.on("tool_result",i=>{let n=i.details,h=o.get(i.toolCallId);if(h&&n&&typeof n=="object"&&"editorBatchResults"in n&&Array.isArray(n.editorBatchResults))for(let t of n.editorBatchResults)for(let a of t.data?.operations??[]){let r=h.calls.find(d=>d.id===a.id);if(!r)continue;let c=a.errors.map(d=>d.message);r.rollback||r.postWriteFailure||r.copyRollback!==void 0||r.unchangedCopy&&c.length===0&&a.effect==="not-applied"||(c.length>0||a.effect!=="applied")&&(r.batched=!1,delete r.renderArgs,E(h,r,{content:[{type:"text",text:`${r.name}: ${a.effect}.
37
+ ${c.join(`
38
+ `)}`}],details:void 0,isError:c.length>0||a.effect==="unknown"}))}})},"finalize");return{api:{...e,registerTool:u(i=>{f.set(i.name,i),e.registerTool(i)},"registerTool")},finalize:x}}u(Ie,"createNestedIdeRendering");import{createHash as nt}from"node:crypto";import{createCanvas as Ye,loadImage as Ke}from"@napi-rs/canvas";import{DEFAULT_MAX_BYTES as Qe,DEFAULT_MAX_LINES as Ze,truncateHead as et}from"@earendil-works/pi-coding-agent";var D={bytes:Qe,lines:Ze,pixels:4e6,images:20,imageBytes:20*1024*1024};async function j(e,s="",f){let l=typeof s=="string"?[s]:s,o=[],g=e.flatMap(r=>{if(r.type!=="text")return[];let c=l.find(d=>d.length>0&&r.text.endsWith(d));return c?(o.push(c),[r.text.slice(0,-c.length)]):[r.text]}).join(`
39
+ `),y=o.join(""),E=et(g,{maxBytes:D.bytes,maxLines:D.lines}),m=[],x;if(E.truncated&&f!==void 0)try{x=await f(g)}catch{m.push("[Full output could not be saved. Narrow the request to inspect it.]")}E.truncated&&m.push(`[Output truncated: useful content is limited to ${D.bytes} bytes / ${D.lines} lines. Narrow the request or read a smaller source range.]`),x!==void 0&&m.push(`[Full output: ${JSON.stringify(x)}. Read with offset/limit, or read ${JSON.stringify("raw:"+x)} for byte ranges. Available until this runtime is disposed.]`);let S=e.filter(r=>r.type==="image"),i=S.slice(0,D.images),n=[],h=Math.floor(D.pixels/Math.max(1,i.length)),t=0,a=S.length-i.length;for(let[r,c]of i.entries())try{let d=Buffer.from(c.data,"base64"),b=await Ke(d),p=Math.min(1,Math.sqrt(h/(b.width*b.height))),w=Math.min(h,Math.max(1,Math.floor(b.height*p))),I=Math.min(Math.floor(h/w),Math.max(1,Math.floor(b.width*p))),T=d,C=c.mimeType;if(p<1||t+T.byteLength>D.imageBytes){let P=Ye(I,w);P.getContext("2d").drawImage(b,0,0,I,w),T=await P.encode("png"),C="image/png"}if(t+T.byteLength>D.imageBytes){a++;continue}t+=T.byteLength,n.push({type:"image",data:T.toString("base64"),mimeType:C}),p<1&&m.push(`[Image ${r+1} resized from ${b.width}x${b.height} to ${I}x${w} to fit the shared media budget.]`)}catch{a++,m.push(`[Image ${r+1} could not be decoded and was not returned.]`)}return a>0&&m.push(`[${a} images omitted from the result. Read fewer frames or a smaller image region.]`),{text:E.firstLineExceedsLimit?tt(g):E.content,textTruncated:E.truncated,images:n,notices:m,metadataSuffix:y,fullOutput:x}}u(j,"limitIdeOutput");function tt(e){let s=0,f=0;for(let l of e){let o=Buffer.byteLength(l);if(s+o>D.bytes)break;s+=o,f+=l.length}return e.slice(0,f)}u(tt,"bytePrefix");var Te={read:["path"],search:["path"],select:["path"],replace:["path"],insert:["path"],delete:["path"],write:["path"],copy:["path","target"],move:["path","target"],undo:["file"],diff:["before","after"]};function Ae(e){let s=se(e),f=new Set,l=new oe,o=u(t=>l.saveFile(t),"saveFullOutput"),g=new Map,y=u(t=>nt("sha256").update(JSON.stringify(t)).digest("hex"),"signature"),E=u(async(t,a)=>{let r=y(a),c=g.get(t);if(c&&(c.source===r||y(await c.content)===r))return c.content;let d=j(a,"",o).then(b=>[{type:"text",text:b.text+(b.notices.length?`
11
40
 
12
41
  ${b.notices.join(`
13
- `)}`:"")}})},"on"),u=new Map,w=new Map,g=f(()=>{u.clear(),w.clear(),m.clear(),h.clear()},"clear");e.on("session_start",g),e.on("session_shutdown",g),e.on("before_agent_start",t=>({systemPrompt:`${t.systemPrompt}
42
+ `)}`:"")},...b.images]);return g.set(t,{source:r,content:d}),d},"limitError");ne(e,{protocol:ee,apiVersion:te,id:"ide-output-retention",setup(t){t.setOutputSaver(o)}}),e.on("session_shutdown",()=>l.dispose());let m=u((t,a)=>{if(t==="message_end"){let c=a;return e.on("message_end",async(d,b)=>{let p=await c(d,b),w=p?.message??d.message;return w.role!=="toolResult"||!w.isError||!f.has(w.toolName)||w.content.some(I=>I.type==="text"&&I.text.startsWith("<system-result"))?p:{...p,message:{...w,content:await E(w.toolCallId,w.content)}}})}let r=a;return t!=="tool_call"?e.on(t,r):e.on("tool_call",async(c,d)=>{let b=await r(c,d);if(!b?.block||!f.has(c.toolName)||b.reason===void 0)return b;let p=await j([{type:"text",text:b.reason}],"",o);return{...b,reason:p.text+(p.notices.length?`
43
+
44
+ ${p.notices.join(`
45
+ `)}`:"")}})},"on"),x=new Map,S=new Map,i=u(()=>{x.clear(),S.clear(),g.clear()},"clear");e.on("session_start",i),e.on("session_shutdown",i),e.on("before_agent_start",t=>({systemPrompt:`${t.systemPrompt}
14
46
 
15
47
  <ide_results>
16
48
  IDE tools return readable text. The leading system-result envelope is an internal reference, not file content; do not edit it. Compose tools by passing the unchanged result to a source parameter. Outside Codemode, pass the same text or its UUID. Store/load preserves these strings within the session. Use returned anchors to choose individual selections. Changed snapshots and previous sessions cannot be reused.
17
- </ide_results>`})),e.on("tool_execution_start",t=>{t.parentToolCallId!==void 0&&u.set(t.toolCallId,u.get(t.parentToolCallId)??t.parentToolCallId)}),v("tool_call",(t,i)=>{if(!p.has(t.toolName))return;let o={...t.input};try{for(let a of he[t.toolName]??[]){let d=o[a];if(d!==void 0)if(t.toolName==="diff"&&d!==null&&typeof d=="object"&&"path"in d)o[a]={...d,path:l.source(d.path,i.cwd,!0)};else{let x=l.source(d,i.cwd,t.toolName==="read"?!0:["write","insert","delete"].includes(t.toolName)?"live":!1);if(t.toolName==="read"&&Array.isArray(x)){let b=l.resolve(x,i.cwd);o[a]=l.register(b.targets,i.cwd,b.complete)}else o[a]=x}}t.toolName==="select"&&o.operation&&typeof o.operation=="object"&&"scopes"in o.operation&&(o.operation={...o.operation,scopes:l.source(o.operation.scopes,i.cwd)});for(let a of["text","content"]){let d=o[a];if(typeof d=="string"&&(d.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(d)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(t.input,o)}catch(a){return{block:!0,reason:a instanceof Error?a.message:String(a)}}});let n=f(t=>{p.add(t.name);let i={},o=Object.getOwnPropertyDescriptors(t);delete o.outputSchema;let a=f(async(...b)=>{let E=await t.execute(...b).catch(async A=>{let S=await M([{type:"text",text:A instanceof Error?A.message:String(A)}],"",r);throw m.add(b[0]),S.notices.length===0?A:new Error(S.text+`
49
+ </ide_results>`})),e.on("tool_execution_start",t=>{t.parentToolCallId!==void 0&&x.set(t.toolCallId,x.get(t.parentToolCallId)??t.parentToolCallId)}),m("tool_call",(t,a)=>{if(!f.has(t.toolName))return;let r={...t.input};try{for(let c of Te[t.toolName]??[]){let d=r[c];if(d!==void 0)if(t.toolName==="diff"&&d!==null&&typeof d=="object"&&"path"in d)r[c]={...d,path:s.source(d.path,a.cwd,!0)};else{let b=s.source(d,a.cwd,t.toolName==="read"?!0:["write","insert","delete"].includes(t.toolName)?"live":!1);if(t.toolName==="read"&&Array.isArray(b)){let p=s.resolve(b,a.cwd);r[c]=s.register(p.targets,a.cwd,p.complete)}else r[c]=b}}t.toolName==="select"&&r.operation&&typeof r.operation=="object"&&"scopes"in r.operation&&(r.operation={...r.operation,scopes:s.source(r.operation.scopes,a.cwd)});for(let c of["text","content"]){let d=r[c];if(typeof d=="string"&&(d.trimStart().startsWith("<system-result")||/<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>/iu.test(d)))return{block:!0,reason:"A system result reference is not file content. Do not insert it into a file."}}Object.assign(t.input,r)}catch(c){return{block:!0,reason:c instanceof Error?c.message:String(c)}}});let n=u(t=>{f.add(t.name);let a={},r=Object.getOwnPropertyDescriptors(t);delete r.outputSchema;let c=u(async(...p)=>{let w=await t.execute(...p).catch(async C=>{let P=await j([{type:"text",text:C instanceof Error?C.message:String(C)}],"",o);throw P.notices.length===0?C:new Error(P.text+`
18
50
 
19
- ${S.notices.join(`
20
- `)}`,{cause:A})}),I=await M(E.content,be(E.details),r),R=I.text+I.metadataSuffix;return{...E,content:[{type:"text",text:R+(I.notices.length?`
51
+ ${P.notices.join(`
52
+ `)}`,{cause:C})}),I=await j(w.content,Se(w.details),o),T=I.text+I.metadataSuffix;return{...w,content:[{type:"text",text:T+(I.notices.length?`
21
53
 
22
54
  ${I.notices.join(`
23
- `)}`:"")},...I.images]}},"execute");o.execute={value:a,enumerable:!0,configurable:!0,writable:!0};let d=t.renderCall;if(d){let b=f((E,I,R)=>d(Ge(t.name,E),I,R),"renderCall");o.renderCall={value:b,enumerable:!0,configurable:!0,writable:!0}}let x=t.renderResult;if(x){let b=f((E,I,R,A)=>x({...E,content:E.content.map(S=>S.type==="text"?{...S,text:S.text.replace(/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u,"")}:S)},I,R,A),"renderer");o.renderResult={value:b,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(i,o),e.registerTool(i)},"registerTool"),s=f(()=>{e.on("context",async t=>({messages:await Promise.all(t.messages.map(async i=>{if(i.role!=="toolResult"||!i.isError||!p.has(i.toolName)||m.has(i.toolCallId)||i.content.some(a=>a.type==="text"&&a.text.startsWith("<system-result")))return i;let o=h.get(i.toolCallId);return o===void 0&&(o=M(i.content,"",r).then(a=>[{type:"text",text:a.text+(a.notices.length?`
24
-
25
- ${a.notices.join(`
26
- `)}`:"")},...a.images]),h.set(i.toolCallId,o)),{...i,content:await o}}))})),e.on("tool_result",async(t,i)=>{if(t.toolName==="codemode"){l.refreshAll();let S=w.get(t.toolCallId)??[];w.delete(t.toolCallId);for(let[C,_]of u)_===t.toolCallId&&u.delete(C);let k=t.content.filter(C=>C.type==="text"&&C.text.startsWith(`
55
+ `)}`:"")},...I.images]}},"execute");r.execute={value:c,enumerable:!0,configurable:!0,writable:!0};let d=t.renderCall;if(d){let p=u((w,I,T)=>d(ot(t.name,w),I,T),"renderCall");r.renderCall={value:p,enumerable:!0,configurable:!0,writable:!0}}let b=t.renderResult;if(b){let p=u((w,I,T,C)=>b({...w,content:w.content.map(P=>P.type==="text"?{...P,text:P.text.replace(/^<system-result\b[^>]*><uuid>[a-f\d-]{36}<\/uuid><\/system-result>\n/u,"")}:P)},I,T,C),"renderer");r.renderResult={value:p,enumerable:!0,configurable:!0,writable:!0}}Object.defineProperties(a,r),e.registerTool(a)},"registerTool"),h=u(()=>{e.on("context",async t=>({messages:await Promise.all(t.messages.map(async a=>a.role!=="toolResult"||!a.isError||!f.has(a.toolName)||a.content.some(r=>r.type==="text"&&r.text.startsWith("<system-result"))?a:{...a,content:await E(a.toolCallId,a.content)}))})),e.on("tool_result",async(t,a)=>{if(t.toolName==="codemode"){s.refreshAll();let P=S.get(t.toolCallId)??[];S.delete(t.toolCallId);for(let[k,L]of x)L===t.toolCallId&&x.delete(k);let R=t.content.filter(k=>k.type==="text"&&k.text.startsWith(`
27
56
 
28
57
  ---
29
58
 
30
- # Guide:`)),P=t.content.filter(C=>!k.includes(C)),y=await M([...P,...S],"",r);return{content:[...y.textTruncated?[{type:"text",text:y.text}]:P.filter(C=>C.type==="text"),...y.images,...y.notices.length?[{type:"text",text:`
59
+ # Guide:`)),v=t.content.filter(k=>!R.includes(k)),_=await j([...v,...P],"",o);return{content:[..._.textTruncated?[{type:"text",text:_.text}]:v.filter(k=>k.type==="text"),..._.images,..._.notices.length?[{type:"text",text:`
31
60
 
32
- ${y.notices.join(`
33
- `)}`}]:[],...k]}}if(!p.has(t.toolName))return;let o=t.content.filter(S=>S.type==="text").map(S=>S.text).join(`
34
- `),a=t.structuredContent,d=a!==null&&typeof a=="object"&&"data"in a?a:{status:t.isError?"error":"success",data:a},x=d.data,b=x!==null&&typeof x=="object"&&"effect"in x&&x.effect==="applied"&&"targetUnavailable"in x&&typeof x.targetUnavailable=="string"?x.targetUnavailable:void 0,E=b===void 0?o:`${o}
61
+ ${_.notices.join(`
62
+ `)}`}]:[],...R]}}if(!f.has(t.toolName))return;let r=t.content.filter(P=>P.type==="text").map(P=>P.text).join(`
63
+ `),c=t.structuredContent,d=c!==null&&typeof c=="object"&&"data"in c?c:{status:t.isError?"error":"success",data:c},b=d.data,p=b!==null&&typeof b=="object"&&"effect"in b&&b.effect==="applied"&&"targetUnavailable"in b&&typeof b.targetUnavailable=="string"?b.targetUnavailable:void 0,w=p===void 0?r:`${r}
35
64
 
36
- This result has no verified text selection: ${b}
37
- Read/Search the file before the next edit; do not repeat the applied edit.`,I=xe(d),R=l.publish(d,E,i.cwd,I),A=u.get(t.toolCallId);if(u.delete(t.toolCallId),A!==void 0){let S=t.content.filter(k=>k.type==="image");S.length&&w.set(A,[...w.get(A)??[],...S])}return{content:[{type:"text",text:R},...t.content.filter(S=>S.type!=="text")]}})},"finalize");return{api:{...e,on:v,registerTool:n},finalize:s}}f(ye,"createIdeTextResults");function be(e){if(e===null||typeof e!="object")return[];let l="outputNotice"in e&&typeof e.outputNotice=="string"?[e.outputNotice]:[];if("resources"in e&&Array.isArray(e.resources)){let p=e.resources;for(let c of p)c!==null&&typeof c=="object"&&"details"in c&&l.push(...be(c.details))}return l}f(be,"outputNotices");function Ge(e,l){let p=f(r=>{if(Array.isArray(r))return r.map(p);if(typeof r!="string")return r;let m=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(r)?.[1];return m?`RESULT#${m}`:r},"label"),c={...l};for(let r of he[e]??[])Object.assign(c,{[r]:p(l[r])});return c}f(Ge,"displaySources");function xe(e){if(e===null||typeof e!="object"||!("data"in e))return[];let l=e.data;return l===null||typeof l!="object"?[]:"resources"in l&&Array.isArray(l.resources)?l.resources.flatMap(c=>xe({data:c})):"files"in l&&Array.isArray(l.files)?l.files.flatMap(c=>c!==null&&typeof c=="object"&&"source"in c&&typeof c.source=="string"&&/^(?:shell|debug):/u.test(c.source)?[c.source]:[]):"source"in l&&typeof l.source=="string"?[l.source]:[]}f(xe,"resultResources");function we(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}f(we,"isRecord");function Ee(e,l){if(!we(e)||!Array.isArray(e.tools))return e;let p=e.tools,c=p.map(r=>!we(r)||r.type!=="function"||typeof r.name!="string"||!l.has(r.name)||r.strict!==void 0?r:{...r,strict:!1});return c.some((r,m)=>r!==p[m])?{...e,tools:c}:e}f(Ee,"preserveResponsesToolOmission");import{VERSION as Je}from"@earendil-works/pi-coding-agent";import{getCurrentTools as ze}from"@earendil-works/pi-ai";function Ie(e){let l=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e),p=[0,99,1],r=l?.slice(1,4).map(Number)?.map((m,h)=>m-(p[h]??0)).find(m=>m!==0)??0;if(l===null||r<0||r===0&&l[4]!==void 0)throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${e}. Update Pi before loading the extension.`)}f(Ie,"assertSupportedHost");async function Ve(e){Ie(Je);let l=me(e),p=ye(l.api),c=le(p.api);e.on("before_provider_request",(u,w)=>{if(w.model?.api!=="openai-responses")return;let g=new Set(e.getAllTools().filter(n=>n.namespace?.name.startsWith("ide_")).map(n=>n.name));return Ee(u.payload,g)}),e.on("session_start",(u,w)=>{let g=u.reason==="reload"?[]:ze(w.sessionManager.getBranch().flatMap(n=>n.type==="message"?[n.message]:[])).map(n=>n.name);c.reconcile(!0,g)}),e.on("before_agent_start",u=>{c.reconcile();let w=u.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
38
- `,""),g=e.getAllTools().filter(a=>a.exposure!=="hidden"),n=e.getActiveTools(),s=n.includes("tool_search")?"Use tool_search to find":n.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",t=g.filter(a=>a.namespace?.name==="ide_git").map(a=>a.name),i=[...t.length===0?[]:[`${s} ${t.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...g.some(a=>a.name==="debug"&&a.namespace?.name==="ide_debug")?[`${s} debug in ide_debug when creating a debugger session.`]:[]],o=i.length===0?w:`${w}
65
+ This result has no verified text selection: ${p}
66
+ Read/Search the file before the next edit; do not repeat the applied edit.`,I=Re(d),T=s.publish(d,w,a.cwd,I),C=x.get(t.toolCallId);if(x.delete(t.toolCallId),C!==void 0){let P=t.content.filter(R=>R.type==="image");P.length&&S.set(C,[...S.get(C)??[],...P])}return{content:[{type:"text",text:T},...t.content.filter(P=>P.type!=="text")]}})},"finalize");return{api:{...e,on:m,registerTool:n},finalize:h}}u(Ae,"createIdeTextResults");function Se(e){if(e===null||typeof e!="object")return[];let s="outputNotice"in e&&typeof e.outputNotice=="string"?[e.outputNotice]:[];if("resources"in e&&Array.isArray(e.resources)){let f=e.resources;for(let l of f)l!==null&&typeof l=="object"&&"details"in l&&s.push(...Se(l.details))}return s}u(Se,"outputNotices");function ot(e,s){let f=u(o=>{if(Array.isArray(o))return o.map(f);if(typeof o!="string")return o;let g=/^<system-result\b[^>]*><uuid>([a-f\d-]{36})<\/uuid>/u.exec(o)?.[1];return g?`RESULT#${g}`:o},"label"),l={...s};for(let o of Te[e]??[])Object.assign(l,{[o]:f(s[o])});return l}u(ot,"displaySources");function Re(e){if(e===null||typeof e!="object"||!("data"in e))return[];let s=e.data;return s===null||typeof s!="object"?[]:"resources"in s&&Array.isArray(s.resources)?s.resources.flatMap(l=>Re({data:l})):"files"in s&&Array.isArray(s.files)?s.files.flatMap(l=>l!==null&&typeof l=="object"&&"source"in l&&typeof l.source=="string"&&/^(?:shell|debug):/u.test(l.source)?[l.source]:[]):"source"in s&&typeof s.source=="string"?[s.source]:[]}u(Re,"resultResources");function Pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}u(Pe,"isRecord");function Ce(e,s){if(!Pe(e)||!Array.isArray(e.tools))return e;let f=e.tools,l=f.map(o=>!Pe(o)||o.type!=="function"||typeof o.name!="string"||!s.has(o.name)||o.strict!==void 0?o:{...o,strict:!1});return l.some((o,g)=>o!==f[g])?{...e,tools:l}:e}u(Ce,"preserveResponsesToolOmission");import{VERSION as st}from"@earendil-works/pi-coding-agent";import{getCurrentTools as rt}from"@earendil-works/pi-ai";function ke(e){let s=/^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u.exec(e),f=[0,99,1],o=s?.slice(1,4).map(Number)?.map((g,y)=>g-(f[y]??0)).find(g=>g!==0)??0;if(s===null||o<0||o===0&&s[4]!==void 0)throw new Error(`Pi Agent IDE requires Pi 0.99.1 or newer; this host is ${e}. Update Pi before loading the extension.`)}u(ke,"assertSupportedHost");async function it(e){ke(st);let s=await re(U()),f=s.preferences?.["ui.codemode"]!=="on",l=Ie(e,f),o=Ae(l.api),g=he(o.api);e.on("before_provider_request",(x,S)=>{if(S.model?.api!=="openai-responses")return;let i=new Set(e.getAllTools().filter(n=>n.namespace?.name.startsWith("ide_")).map(n=>n.name));return Ce(x.payload,i)}),e.on("session_start",(x,S)=>{let i=x.reason==="reload"?[]:rt(S.sessionManager.getBranch().flatMap(n=>n.type==="message"?[n.message]:[])).map(n=>n.name);g.reconcile(!0,i)}),e.on("before_agent_start",x=>{g.reconcile();let S=x.systemPrompt.replace("- bash: Execute bash commands (ls, grep, find, etc.)","- bash: Execute Bash commands").replace(`- Use bash for file operations like ls, rg, find
67
+ `,""),i=e.getAllTools().filter(c=>c.exposure!=="hidden"),n=e.getActiveTools(),h=n.includes("tool_search")?"Use tool_search to find":n.includes("codemode")?"Use searchTools inside codemode to find":"Enable native tool_search to find",t=i.filter(c=>c.namespace?.name==="ide_git").map(c=>c.name),a=[...t.length===0?[]:[`${h} ${t.join(" and ")} in ide_git when staging or unstaging selected Git changes.`],...i.some(c=>c.name==="debug"&&c.namespace?.name==="ide_debug")?[`${h} debug in ide_debug when creating a debugger session.`]:[]],r=a.length===0?S:`${S}
39
68
 
40
69
  <ide_discovery>
41
- ${i.join(`
70
+ ${a.join(`
42
71
  `)}
43
- </ide_discovery>`;return o===u.systemPrompt?void 0:{systemPrompt:o}});let r=await ee(L()),m=de(e,{"pi-agent-ide-no-animations":r.noAnimations??!1,"pi-agent-ide-no-post-processing":r.noPostProcessing??!1,...r.flags});m.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),m.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}),m.register({id:"pi-agent-ide-vision-arbitrary-windows",name:"Capture arbitrary windows",description:"Allow window:PID capture for processes not owned by Agent IDE. Keep disabled unless the agent may inspect other desktop apps.",default:!1}),m.register({id:"pi-agent-ide-vision-displays",name:"Capture full displays",description:"Allow display screenshots through display: and display:#N resources. Keep disabled unless the agent may inspect the full desktop.",default:!1}),m.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}),m.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}),m.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}),ae(e,m.definitions,ne);let h=$(O,r.preset??"full"),{enabled:v}=U(O,[...h,...r.disabled],r.enabled);for(let u of v)await u.register(c.api,{preferences:r.preferences??{}});l.finalize(),p.finalize()}f(Ve,"registerUnifiedPiAgentIde");export{Ve as default};
72
+ </ide_discovery>`;return r===x.systemPrompt?void 0:{systemPrompt:r}});let y=ge(e,{"pi-agent-ide-no-animations":s.noAnimations??!1,"pi-agent-ide-no-post-processing":s.noPostProcessing??!1,...s.flags});y.register({id:"pi-agent-ide-developer-mode",name:"Developer mode",description:"Enable development commands, including manual setup-hint previews.",default:!1}),y.register({id:"pi-agent-ide-no-animations",name:"Static edit previews",group:"ui",description:"Show edit results immediately, without animated playback.",default:!1}),y.register({id:"pi-agent-ide-no-post-processing",name:"Skip automatic post-processing",description:"Skip automatic formatting and diagnostics after edits. Explicit diagnostic reads still work.",default:!1}),y.register({id:"pi-agent-ide-vision-arbitrary-windows",name:"Capture arbitrary windows",description:"Allow window:PID capture for processes not owned by Agent IDE. Keep disabled unless the agent may inspect other desktop apps.",default:!1}),y.register({id:"pi-agent-ide-vision-displays",name:"Capture full displays",description:"Allow display screenshots through display: and display:#N resources. Keep disabled unless the agent may inspect the full desktop.",default:!1}),y.register({id:"pi-agent-ide-no-diagnostic-buffer",name:"Immediate diagnostic notices",description:"Send findings immediately instead of combining reports received over five seconds.",group:"ui",default:!1}),y.register({id:"pi-agent-ide-code-review",name:"Jev code review",description:"Review saved edit fragments against project YAML rules in the background. Sends code to a connected Jev provider.",default:!1}),y.register({id:"pi-agent-ide-code-review-capture",name:"Capture code-review rules",description:"Use the packaged skill to propose reusable rules from user review feedback. Save only after confirmation.",default:!1}),fe(e,y.definitions,G),pe(e),Z(e,[me(y.definitions)]);let E=B(N,s.preset??"full"),{enabled:m}=q(N,[...E,...s.disabled],s.enabled);for(let x of m)await x.register(g.api,{preferences:s.preferences??{}});l.finalize(),o.finalize()}u(it,"registerUnifiedPiAgentIde");export{it as default};
@@ -3,3 +3,5 @@
3
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.
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
+
7
+ Use an SSH `cwd` to create a target-owned session. Relative program and source paths resolve on that workspace; returned source files and frames keep canonical SSH identities. Launch needs the selected native adapter on the target. Unsupported target recipes fail without using a controller adapter. Delete the session to stop its owned transport; do not signal a target PID as if it were local.
@@ -55,7 +55,7 @@ Independent calls share the original snapshots. Combine overlapping edits into o
55
55
 
56
56
  An omitted path can inherit the file identified by an anchor, the last read, or the preceding edit in the batch. Supply the path when that would be ambiguous.
57
57
 
58
- An ordinary `delete.path` without selectors deletes a complete regular file. A result input removes only selected text. Ordinary copy/move paths without selectors transfer whole files and replace an existing regular destination file.
58
+ An ordinary `delete.path` without selectors deletes a whole file, directory, or symlink. Directory and link deletion applies Git protection and may require a user dialog; no agent flag replaces approval. Links are unlinked without following their targets. A result input removes only selected text. Ordinary copy/move paths without selectors transfer whole regular files and replace an existing regular destination file.
59
59
 
60
60
  Inside Codemode, await independent edits on disjoint resources concurrently and overlapping resources in order. Pass a pending edit result directly to another source tool for dependent work; that boundary commits the batch before consuming the result.
61
61
 
@@ -26,6 +26,9 @@ If Search is interrupted or cancelled, do not treat it as zero matches or comple
26
26
 
27
27
  If a result has no local edit references, use its locations to inspect the source, not as an edit scope. For changed local files, repeat Search or Read to obtain a current selection before editing.
28
28
 
29
+ Use unchanged Read/Search/Select result text, its UUID, returned items, or `RESULT#` targets as Search scopes. These inputs keep exact source ranges and sparse gaps. Reconstructed coordinates do not grant access. Refresh stale snapshots before searching again.
30
+
31
+ Use `navigation: "references"` only for symbol searches that must follow declarations outside the input scope. Without navigation, symbol results stay inside the supplied ranges. Reference results retain the originating declaration identity; equal names do not establish that identity.
29
32
  Local text results expose `SEARCH#HASH:N:line` for its containing line and `SEARCH#HASH:N:match` for the exact match. Complete selections use `:all:line` or `:all:match`. Pass these references directly to read or editing tools; omit the file path when an all-selection spans files.
30
33
 
31
34
  A single-result reference becomes stale after its file changes. Re-run the search before reuse. A complete `:all` reference refreshes its original query when selected files change. Compacted output retains complete all-selections.
@@ -38,7 +41,7 @@ A replace/insert result searches only that call's resulting text, including an e
38
41
 
39
42
  Use a displayed item or capture reference for a subset. The whole result retains its complete stored scope; editing copied preview text never narrows that scope.
40
43
 
41
- Incomplete registered result scopes cannot authorize edits, even through non-empty subsets. A numbered local text Search reference remains editable while its file snapshot is current, even if collection was incomplete. Use it only for its containing line or exact match, not as a complete match set. Empty arrays select no sources; they do not default to the workspace. Result-scoped text Boolean queries and text include/exclude globs remain unsupported. AST and LSP providers retain their own path/glob filters. File/process and unsupported provider scopes fail without widening the scope.
44
+ Incomplete registered result scopes cannot authorize edits, even through non-empty subsets. A numbered local text Search reference remains editable while its file snapshot is current, even if collection was incomplete. Use it only for its containing line or exact match, not as a complete match set. Empty arrays select no sources; they do not default to the workspace. Result-scoped Boolean text queries check each line inside each selected range separately; conditions cannot borrow terms from gaps or neighboring text. Text include/exclude globs remain unsupported for result scopes. AST and LSP providers retain their own path/glob filters. File/process and unsupported provider scopes fail without widening the scope.
42
45
 
43
46
  ## AST search
44
47
 
@@ -66,6 +69,8 @@ Append `#name` to an exact symbol resource only for a native language-server ren
66
69
 
67
70
  ## Other search protocols
68
71
 
69
- Use an HTTP(S) URL as `path` to search converted page text with a literal or `regex:` query. No prior Read is needed. Web results keep the requested URL and do not expose editable `SEARCH#` references. Use Read on that URL for more context.
72
+ Use `path: "docs:all"` to search every available packaged guide body, or `path: "docs:<id>"` for one guide. Use a literal or `regex:` query with `caseSensitive`, `wholeWord`, and `limit` as needed. File globs and structural queries do not apply. Matches show the guide source, line, and excerpt without editable references. Read that `docs:<id>` source for context or the full guide; search excerpts do not count as reading it. Read `docs:` to list the available IDs. Search requires `docs:all` or `docs:<id>`; bare `docs:` is not a search scope.
73
+
74
+ Use an HTTP(S) URL as `path` for local web execution, or `web:ssh://target/https://example.com/page` for explicit target execution. Search converted page text with a literal or `regex:` query; no prior Read is needed. Web results keep the requested source and do not expose editable `SEARCH#` references. Use Read on that source for more context.
70
75
 
71
76
  Use `process:<query>` for running processes. Use `path: "shell:<session>"` to search retained terminal output beyond its current tail.
@@ -0,0 +1,58 @@
1
+ # SSH resources
2
+
3
+ ## Set up a target
4
+
5
+ When the user asks to connect to or work on a remote device or environment over SSH, set up a target before using remote resources. Use the existing tools; no separate SSH tool is needed.
6
+
7
+ 1. Read the current project's `.pi/pi-agent-ide/ssh.json` and reuse a matching target. If the file is missing, create it. Preserve unrelated targets and settings. Use project settings by default; use global settings only when the user explicitly asks. The global file is `~/.pi/agent/pi-agent-ide/ssh.json`, or `$PI_CODING_AGENT_DIR/pi-agent-ide/ssh.json` when that variable is set.
8
+ 2. Resolve the host from the user's request and existing OpenSSH configuration. Ask only for missing connection details or the remote workspace path when they cannot be established from the request or existing configuration. Keep keys, passwords and host-key trust in OpenSSH, not in IDE settings. Do not print credentials or disable host-key checks. Ask before changing authentication or trusting a new host key.
9
+ 3. Check access with local Bash: `ssh -o BatchMode=yes -o StrictHostKeyChecking=yes -o ConnectTimeout=10 HOST 'pwd; python3 --version'`. Add `-F /path/to/config` when using a custom OpenSSH config. Require Python 3 on the target. Inspect a failed connection before editing IDE settings; a target record cannot fix missing authentication or host trust.
10
+ 4. Add a target record with a unique `id`, a trusted OpenSSH `host` alias (optionally `user@alias`), and an absolute Linux `workspace` path. Use an existing workspace unless the task needs a new one. Use a short stable ID, such as `vps`. Optional `configFile` selects a local OpenSSH config; relative paths resolve beside `ssh.json`.
11
+ 5. Reload Pi extensions after adding or changing a target. Use the reload tool when available, or ask the user to run `/reload`. Reload can reset extension state; finish or stop owned live sessions first. Read `docs:ssh` again after reload to see the configured workspaces.
12
+ 6. Verify the target with `read` on its `ssh://` workspace and `bash` with that SSH `cwd`, for example `hostname; pwd`. Report the actual tool results. Do not claim remote IDE access from a successful plain SSH command alone.
13
+
14
+ Example project `.pi/pi-agent-ide/ssh.json`:
15
+
16
+ ```json
17
+ {
18
+ "targets": [{ "id": "vps", "host": "vps", "workspace": "/root" }]
19
+ }
20
+ ```
21
+
22
+ Project records replace complete global records with the same ID. Duplicate IDs in one file, unknown fields and invalid records fail startup. Keep machine-specific target settings out of shared Git history unless the user asks to share them.
23
+
24
+ ## Use remote resources
25
+
26
+ Use the existing read and text-editing tools with `ssh://target/absolute/path`. Select a target from the configured workspaces below. Unknown targets fail without falling back to local files. The workspace is a relative-path base, not a sandbox; absolute paths use the remote account's permissions.
27
+
28
+ Use `raw:ssh://target/absolute/path` to read original bytes with `offset` and `limit`. Raw reads do not convert content or accept views. Text snapshots have a 32 MiB transport limit; raw reads fetch bounded chunks instead. Separate byte windows are not an immutable snapshot.
29
+
30
+ Use `search` with an SSH `path` for text, `regex:` and `files:` queries. Ripgrep runs on that target; include/exclude globs, Boolean queries and fallback rules stay the same. Results use canonical SSH paths. `SEARCH#` selections keep their owning backend for stale checks, complete-selection refresh and observation after editing. Remote text snapshots for anchors have the same 32 MiB limit.
31
+
32
+ Use `search` with `ast:<pattern>` and an SSH `path` for structural matches. It needs `ast-grep` on that target. Returned `SEARCH#` ranges use the same owned snapshots and refresh rules as text search. Use `read` with `ast:ssh://target/path` for a compact outline, or `views: ["ast"]` for scope anchors on source text. These presentations parse the fetched snapshot locally; they do not read a local copy of the remote path. Explicit outlines keep the existing 256 KiB source limit.
33
+
34
+ Use `read` with `views: ["changes"]` on a tracked SSH file to get `CHANGE#` anchors. Use `stage` and `unstage` with that file and anchor to change its remote index; the worktree is kept. Use `undo` with a `CHANGE#` anchor to restore that change in worktree and index. Git must be installed on the target. Index publication holds Git’s index lock and checks HEAD, the index entry and expected worktree text before publishing. Worktree and index restoration are not one atomic operation; inspect both after a failure or an unknown effect.
35
+
36
+ Use whole-object `copy` and `move` with SSH paths, including local/SSH and target/target transfers. Regular files keep their original bytes; directory trees and source links are supported too. Copy merges compatible directories; Move replaces a compatible destination after removal checks. Destination symlinks, mismatched types, same-object transfers and overlapping trees are refused. Link bytes are preserved without following their targets. Directory and link receipts have no reusable text selection. Missing destination parents are created after endpoint checks. Directory/link Move checks both owners' Git protection, hooks and required user dialogs, then rechecks both trees after approval. Same-target, same-filesystem moves keep the inode. Other moves publish the destination before rechecking and removing the source. Partial copies and interrupted moves have no rollback and can leave unknown effects.
37
+
38
+ Whole-object `delete` also supports SSH directories and symlinks, including broken links. Directories are removed recursively; links are unlinked without following their targets. The safety check uses the selected target's Git worktree, never the controller's Git state. Hooks and user dialogs name canonical SSH paths. Tracked or staged directories and links and failed Git checks inside the project require a user dialog. External targets and missing Git worktrees require a dialog unless a temporary-directory exception applies. An unavailable required dialog blocks removal. Project roots, ancestors, filesystem roots, and Git control paths are always protected. The target identity and policy are checked again after approval. Changed targets need a new request. Recursive deletion has no rollback; a failure after removal starts can leave unknown effects.
39
+
40
+ Temporary-directory exceptions use the selected SSH account's home, system temp and `PI_CODING_AGENT_DIR`, plus that project's `.pi/pi-agent-ide/deletion.json`. Controller settings never grant remote permission. By default, an exact tmp, .tmp, temp, or .temp component in the resolved target path qualifies, as does its system temporary root. The named, system, and configured roots themselves are included. Replace settings override default names and roots; extend settings add to the current layer. Git-tracked entries, failed Git checks inside the project, protected paths, and hooks still block or require approval. Delete and Move reload the target settings during their final safety checks. Move checks each removed endpoint separately.
41
+
42
+ Use the standalone editing tools with writable SSH text resources and mixed local/SSH files. Use Codemode to compose those tools; Apply and Flush are not available. Check each operation's reported effect. Use `undo` with `last` for a saved text-editor transaction or a `CHANGE#` anchor for a Git change. Cross-backend writes and compensation are not distributed atomic operations.
43
+
44
+ Use `bash` with an SSH `cwd` to run Bash in the remote account's environment. Use the returned `shell:` resource for input, output and cleanup. Read `docs:terminal` before interacting with a session. Remote process IDs belong to the named target, not the local machine.
45
+
46
+ Use `search` with `process:<query>` and an SSH `path` for process discovery on a configured Linux target. Use each returned `process:ssh://target/PID` resource for metadata. Its kernel identity combines the target boot ID and native start ticks; discovery does not grant process control or controller window capture. Keep target PIDs separate from local PIDs. A missing native process facility fails without controller fallback.
47
+
48
+ Use `debug` with an SSH `cwd` for a target-owned debugger session. Read `docs:debugger` before setting anchored breakpoints or starting the program. Adapter source paths map to canonical SSH resources; document text and evaluation values are not rewritten. A missing or unsupported native adapter fails without controller fallback. Delete the session resource to stop its owned transport.
49
+
50
+ Use `read` or `search` with `web:ssh://target/https://example.com/page` for explicit target HTTP/browser execution. Ordinary HTTP(S) URLs still execute locally, regardless of the current SSH workspace. The target uses its own DNS and proxy environment. Read tries direct HTTP first, then rendered browser content when needed; web text has no editable file anchors. Image and PDF conversion uses the fetched bytes and existing local converters.
51
+
52
+ Use `image` or `sequence` views on the explicit web source for target browser screenshots, with the existing region, scale and grid parameters. Browser fallback and capture require Node, `playwright-core` and Chrome/Chromium on the target. They use a fresh temporary profile, enable page JavaScript and disable the Chromium sandbox, matching ordinary browser reads. Missing dependencies fail without launching a controller browser. No dependency is installed automatically. Capture is limited to 16 million pixels and 20 MiB of PNG per frame; requests have a 30-second deadline and cancellation waits for owned cleanup.
53
+
54
+ Use `/pi-agent-ide-doctor ssh://target/path` to inspect an explicitly selected target project. Target-sensitive checks use its native tools and project/user-global config; pure-content checks stay on the controller. Use `--no-apply` to inspect without suggested writes. `--apply` publishes suggested mappings only in that project's `.pi/pi-agent-ide/`, preserving existing entries. Agent setup and its recheck retain that same target. Ordinary startup tips remain local; an unused target is not probed.
55
+
56
+ Read the current source before editing it. A stale snapshot fails without overwriting the changed file. Check the reported effect after interrupted writes; do not replay a write whose effect is unknown. IDE writes are serialized, but external writers can still race the final check.
57
+
58
+ Do not assume that choosing an SSH resource routes every other IDE provider remotely. Check each provider's supported sources and errors before using it.
@@ -1,5 +1,11 @@
1
1
  # Visual capture workflow
2
2
 
3
+ Use `search` with `process:<query>` and an SSH `path` to inspect a configured Linux target. Read its returned `process:ssh://target/PID` for target metadata and kernel start identity. Use `window:ssh://target/PID` for that target's application window; never put a remote PID into local `window:PID`. Window capture requires an active IDE-owned process, an exact native executable allowlist match, or the arbitrary-window opt-in. Each frame checks the current target process and start identity, then verifies the X server's local client PID before reading pixels. A window's advertised PID alone never authorizes capture.
4
+
5
+ Use `display:ssh://target/` or `display:ssh://target/#N` for a target X11 screen only when display capture is enabled. Target capture needs Python and an accessible X11 session with libX11. Window capture also needs libX11-xcb, libxcb and X-Resource 1.2 native client identity support. A headless, inaccessible, ambiguous or obscured window fails without controller or root-image fallback. Target acquisition is bounded to 16 million pixels per frame and 20MB of PNG data. The ordinary region, scale, grid and sequence rules below still apply; transformations happen locally after target acquisition.
6
+
7
+ Use `web:ssh://target/https://example.com/page` with `image` or `sequence` views for target browser screenshots. Ordinary HTTP(S) sources still capture locally. The target needs Node, `playwright-core` and Chrome/Chromium; missing dependencies never select a controller browser. Browser capture uses a fresh profile with JavaScript enabled and the Chromium sandbox disabled. Crop, scale and grid apply to the fetched full-page PNG, just as for local URL capture.
8
+
3
9
  Discover a process first with `process:<query>`, then read `window:<PID>` for an allowed application window. Use `display:` or `display:#N` only when display capture is enabled. Add `views: ["image"]` for a still image or `views: ["sequence"]` when motion or timing requires multiple frames.
4
10
 
5
11
  Tune sequence duration, interval, scale, and region only when defaults do not fit. Region uses normalized `x,y,width,height` and is applied before scaling. For image grids, use `limit` as the square cell size and `offset` as a zero-based row-major cell index. Avoid capturing unrelated desktop content.