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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1 — 2026-10-11
4
+
5
+ ### Settings and help
6
+
7
+ - Ask the agent to explain Pi Agent IDE or configure it for your workflow. The new setup skill uses the registered settings catalog, asks for Project or Global scope and preserves unrelated settings.
8
+ - Open `/agent-ide-help` for a short, scrollable settings guide. A one-time setup hint appears across the installation without entering the model's context.
9
+ - Choose **Show tool results from Codemode**, an Off/On setting that defaults to Off. It controls extra successful IDE panels, not Codemode's script or output. On follows each tool's presentation setting; errors and expanded history remain available.
10
+ - Add **Developer mode**, off by default. It enables `/agent-ide-tip` for manually previewing the setup hint; automatic startup hints remain independent.
11
+
12
+ ### Search and editing
13
+
14
+ - Search packaged guides through `docs:all` or one `docs:<id>`, with literal or regex queries, case and whole-word options, and bounded results. Guide matches are read-only.
15
+ - Keep result-scoped Search inside selected source ranges, including Boolean queries and text containing colons. Reject changed numbered Search references while preserving query refresh for complete all-match references.
16
+ - Preserve issued selections when Codemode batches same-file edits. Return verified follow-up targets for Replace and Insert after formatting, keep unrelated edits concurrent and count grouped replacements per file correctly.
17
+ - Preserve blocked-edit recovery feedback and bound errors even when a later guard replaces them. Explain failed writes and require rereading resources before retrying uncertain effects.
18
+
19
+ ### Filesystem guards
20
+
21
+ - Apply temporary-directory cleanup rules consistently to Delete and removed Move endpoints. Recognize exact `tmp`, `.tmp`, `temp` and `.temp` path components while preserving protected-path, tracked-content and hook checks. Show Herdr's waiting state during filesystem approval dialogs.
22
+
23
+ ## 0.8.0 — 2026-10-09
24
+
25
+ ### SSH workspaces
26
+
27
+ - Add configured Linux SSH targets to the existing IDE tools through `ssh://target/path`. Use project settings by default and global settings only when requested. Keep authentication and host-key trust in OpenSSH; unused targets open no startup connections.
28
+ - Read remote files, directories and raw byte ranges. Search remote text, file paths and AST patterns with the target's installed tools. Keep returned anchors and source selections usable across follow-up calls and native Codemode.
29
+ - Edit remote files with snapshot checks and text undo. Copy and Move files, directories and symlinks between local and remote locations or between configured targets. Apply deletion and transfer guards on the machine that owns each path.
30
+ - Run Bash with a remote `cwd` and a real PTY. Keep shell output, interactive input, screen reads and completion notifications available through ordinary `shell:` resources.
31
+ - Run language servers, linters and formatters on the selected target using its project settings and installed tools. Keep diagnostic paths, symbol navigation and semantic rename tied to that target.
32
+ - Read remote Git changes and use Stage, Unstage and Undo against the target's worktree and index.
33
+ - Launch target-owned debugger sessions with an SSH `cwd`. Keep source paths and breakpoint locations remote, and require the selected adapter on that target.
34
+ - Add remote process discovery and metadata, native Linux window/display capture, and explicit `web:ssh://target/https://...` reads and browser captures. Missing target facilities fail without a local fallback; ordinary web URLs still run locally.
35
+ - Let `/pi-agent-ide-doctor ssh://target/path` inspect and configure an explicitly selected remote project. Add `docs:ssh` setup guidance before any target exists and direct agents to read it when asked to work over SSH.
36
+
37
+ ### Remote safety and cleanup
38
+
39
+ - Keep file selections, diagnostics, Git operations and process identities separated by target. Reject unknown targets and unsupported source combinations instead of silently using local files or tools.
40
+ - Resolve temporary-deletion settings from the remote account and project. Local settings do not grant remote deletion permission; protected paths, tracked contents and hooks remain guarded.
41
+ - Clean up only processes owned by each SSH command channel, including descendants that start new sessions. Report interrupted operations and uncertain cleanup honestly rather than claiming rollback or successful termination.
42
+
43
+ ### Known limits
44
+
45
+ - `fwcd/kotlin-debug-adapter` 0.4.4 can run past verified breakpoints; a verified breakpoint does not guarantee a stop.
46
+
3
47
  ## 0.7.3 — 2026-10-09
4
48
 
5
49
  ### Directories and symlinks
@@ -18,16 +62,10 @@
18
62
  - Delete declarations through direct `symbol:` paths. Route `symbol:<file>#<selector>#name` replacement through semantic rename in native Codemode rather than declaration-text replacement.
19
63
  - Keep original source selections behind compact AST Read overviews. Follow-up tools use the requested source range, not the displayed outline.
20
64
 
21
- ### Display and verification
65
+ ### Display
22
66
 
23
67
  - Explain shortened arguments, omitted result displays, omitted call panels and unavailable results separately in saved nested IDE displays.
24
68
  - Hide internal result references from Stage's user-facing output and retain breakpoint-removal labels after deletion.
25
- - Add an opt-in real-model capability matrix for direct and native Codemode routes. Free coverage checks do not call models or prove model execution; paid runs retain their evidence.
26
- - Reuse recent full CI evidence only for identical trees and verification conditions. Promotion and versioned candidates still run their required full checks.
27
- - Permit Bubblewrap user namespaces through a per-binary AppArmor profile on restricted Ubuntu CI runners. Keep the runner-wide restriction enabled and require a real sandbox launch before unit checks.
28
- - Keep links to excluded tests and benchmarks usable in the public npm package by linking to the public repository.
29
- - Update integration checks for compact Write receipts while retaining saved-byte, formatting, hook, output-recovery and native-panel contracts. Run sandbox semantic rename with the pinned Pi host and CI language-server toolchain.
30
- - Reduce shared-runner integration concurrency to three processes to keep Pi startup within existing run limits and the complete suite within the unchanged job budget. Retain native Codemode failure traces.
31
69
 
32
70
  ## 0.7.2 — 2026-10-08
33
71
 
@@ -60,12 +98,6 @@
60
98
  - Refresh debugger state when delayed stop or exit events arrive. Track adapter-relocated breakpoints and later binding changes, and refresh displayed local variables after evaluation.
61
99
  - Preserve omitted optional IDE tool arguments on Copilot's Responses route instead of letting implicit strictness turn them into required fields. Explicit strictness and other tools remain unchanged.
62
100
 
63
- ### Verification and maintenance
64
-
65
- - Add real-Pi stress coverage for every callable IDE tool, direct and nested output, provider text and images, limit/view/offset/scope combinations and complete saved-output recovery. Include the reported Search case of 10,114 matches across 1,725 files with `limit=80`.
66
- - Keep real debugger checks running in separate, non-blocking jobs with their own reports, outside shared CI totals. Pure debugger unit tests and editor checks, including Delete, still block the release.
67
- - Automatically import newly opened GitHub issues into Linear, with stable issue IDs to avoid duplicate imports.
68
-
69
101
  ## 0.7.1 — 2026-10-05
70
102
 
71
103
  - Reduced prompt size by keeping internal result structures out of agent-facing tool schemas.
@@ -99,18 +131,6 @@
99
131
 
100
132
  - Keep whole replacements visible when old and new blocks share no trimmed line. Avoid unnecessary character refinement while preserving the existing time, pairing and size limits, precise small-edit highlights and truthful unavailable state for unfinished comparisons.
101
133
 
102
- ### Packaging
103
-
104
- - Fix a documentation link to excluded tests so public package validation succeeds.
105
-
106
- ### Verification
107
-
108
- - Run the full integration suite in four standalone CI shards with separate reports and retained logs, without raising timeouts or skipping tests. Close each scenario's Pi process instead of accumulating shared fixture hosts.
109
- - Check that each final file is formatted once without requiring independent files to finish in a fixed order.
110
- - Make the shell-result scenario independent of background completion timing while keeping separate completion-delivery coverage.
111
- - Run Windows source and installed-package checks without a retained shared harness workspace, avoiding locks on the shared cleanup directory.
112
- - Retry transient Windows test-workspace removal locks a bounded number of times after the Pi process tree exits; persistent locks still fail. Retain Windows host traces on failure without changing test timeouts or assertions.
113
-
114
134
  ## 0.6.4 — 2026-10-03
115
135
 
116
136
  ### Native Pi integration
@@ -122,11 +142,10 @@
122
142
  - Run disjoint Read, Search, and editing operations concurrently while preserving ordering and rollback protection for shared resources.
123
143
  - Attach first-use guides without blocking or replaying tool calls, and preserve guidance across nested calls and session navigation.
124
144
  - Keep IDE panels visible for nested calls, show final batch diffs without duplicate bookkeeping panels, and preserve bounded history and native usage accounting.
125
- - Verify IDE tool coexistence with native MCP tools and resources.
126
145
 
127
- ### Packaging
146
+ ### Installation
128
147
 
129
- - Fix Windows release entrypoint resolution, npm packing, and archive extraction.
148
+ - Fix Windows package entrypoint resolution and installation from npm archives.
130
149
 
131
150
  ### Editing and reading
132
151
 
@@ -135,7 +154,7 @@
135
154
  - Bound large committed Apply results before serialization and keep full results addressable.
136
155
  - Preserve structured source data when AST output exceeds the preview budget.
137
156
  - Run independent post-read handlers concurrently while applying their transforms in order.
138
- - Document and verify jq views for JSONL inspection.
157
+ - Document jq views for JSONL inspection.
139
158
 
140
159
  ### Search and presentation
141
160
 
@@ -165,11 +184,6 @@
165
184
  - Bound replayable DAP events so noisy debug targets do not grow the queue without limit.
166
185
  - Check each debugger's own executable or configured adapter path instead of applying Python or JavaScript probes to unrelated adapters.
167
186
 
168
- ### Verification
169
-
170
- - Temporarily skip the flaky Windows Java public-Pi startup test. Keep Linux public-Pi and native Windows Java lifecycle checks enabled.
171
- - Retain unit test reports immediately and stop before integration tests when the unit suite fails. Keep content checks independent of wall-clock load and allow independent formatters to finish in either order.
172
-
173
187
  ## 0.6.3 — 2026-09-27
174
188
 
175
189
  ### Editing
@@ -402,7 +416,6 @@
402
416
  - Fix CSharpier detection and diagnostic commands or parsers for .NET, Go, PHP, HTML, CSS, and Java. Keep project-wide lint findings attached to the correct file.
403
417
  - Treat a failed linter with no parsed findings as a failure, not a clean check.
404
418
  - Use the language server's advertised diagnostic mode, fixing Java and Go servers that publish diagnostics without supporting pull requests.
405
- - Verify native mini-projects with real formatting, lint, language diagnostics, and separate compiler or behavior checks before and after formatting.
406
419
 
407
420
  ## 0.2.0 — 2026-09-05
408
421
 
package/README.md CHANGED
@@ -28,11 +28,37 @@
28
28
 
29
29
  </div>
30
30
 
31
+ Ask your agent to explain Pi Agent IDE or configure it for your workflow. For example: “Help me configure Pi Agent IDE for my tasks.” The agent checks the available settings and asks whether to save changes for this project or globally.
32
+
33
+ To configure it yourself, read the [short settings guide](./docs/settings-help.md), run `/agent-ide-help`, or open `/agent-ide-settings` inside Pi.
34
+
31
35
  ## Summary
32
36
 
33
- Pi Agent IDE gives the [Pi coding agent](https://pi.dev/) a unified set of first-class development tools. Each tool represents an intent instead of one particular implementation. The agent uses the same small set of semantic interfaces across files, source code, terminals, debuggers, web pages, images, processes, application windows, and displays.
37
+ Pi Agent IDE gives the [Pi coding agent](https://pi.dev/) a small set of development tools for understanding, changing, running, debugging, and observing software. The same tools work with local resources and configured Linux SSH targets.
38
+
39
+ | Work | Interfaces |
40
+ | ------------------------------------ | ------------------------------------------------------------- |
41
+ | Inspect content and state | `read` with source-specific views |
42
+ | Find text, paths, code and processes | `search` |
43
+ | Derive exact text and AST selections | `select` |
44
+ | Change text and filesystem objects | `write`, `replace`, `insert`, `delete`, `copy`, `move` |
45
+ | Compare, stage and restore changes | `diff`, `stage`, `unstage`, `undo` |
46
+ | Run and interact with commands | `bash` or `powershell`, then `shell:` resources |
47
+ | Debug programs | `debug`, then `debug:` resources |
48
+ | Work remotely | The same supported tools with `ssh://` paths and remote `cwd` |
49
+
50
+ ### Combine tools through direct calls or native Codemode
51
+
52
+ All IDE tools support direct calls and Pi's built-in Codemode. The agent can combine reading, search, selection and editing into one workflow, with the same source checks in both modes.
34
53
 
35
- The interfaces are designed to combine. A search result can become an edit selection. A running process can become a terminal, debugger, or visual resource. A source read can expose anchors, syntax, diagnostics, or language-server information without sending the agent through a separate workflow for each capability.
54
+ For example, this script finds a checklist item, selects its complete line, and marks it done:
55
+
56
+ ```js
57
+ const source = await tools.read({ path: "notes.md" });
58
+ const matches = await tools.search({ path: source, query: "- [ ] Update docs" });
59
+ const lines = await tools.select({ path: matches, operation: { kind: "linesOf" } });
60
+ text(await tools.replace({ path: lines, text: "- [x] Update docs\n" }));
61
+ ```
36
62
 
37
63
  ### Read anything through `read`
38
64
 
@@ -55,7 +81,7 @@ Views change how the same resource is presented. The agent can request source st
55
81
 
56
82
  ### Find anything through `search`
57
83
 
58
- `search` provides one interface for paths, exact text, regular expressions, AST patterns, symbols, references, code relationships, process discovery, and retained terminal output. Results are reusable guarded references, so the agent can find an intended target once and pass that selection directly to `read` or an editing tool.
84
+ `search` provides one interface for paths, exact text, regular expressions, AST patterns, symbols, references, code relationships, process discovery, and retained terminal output. File matches are reusable guarded references, so the agent can pass a selection directly to `read` or an editing tool. Search packaged guides through `docs:all` or one `docs:<id>`; guide matches are read-only and do not authorize edits.
59
85
 
60
86
  <div align="center">
61
87
 
@@ -63,6 +89,12 @@ Views change how the same resource is presented. The agent can request source st
63
89
 
64
90
  </div>
65
91
 
92
+ ### Select and change exactly what you mean
93
+
94
+ `select` helps the agent change the intended part of a file: a line, a function body, a parameter list, or the overlap between selections. JavaScript and TypeScript structure is supported without JSX/TSX, so the agent can work with code boundaries rather than guessing line numbers.
95
+
96
+ Language-server support adds declarations, references, call graphs, diagnostics, and semantic rename across references. Available features depend on the project's language server. See [selection](docs/agent-guides/select-code.md) and [code navigation](docs/agent-guides/search-code.md).
97
+
66
98
  ### Review edits against your own rules
67
99
 
68
100
  Optional [Jev code review](docs/code-review.md) checks small saved diffs against natural-language YAML rules you supply. It delivers background hints without replacing normal diagnostics. A separately enabled skill helps turn your review feedback into proposed rules, saved only after confirmation. Both features are off by default.
@@ -80,8 +112,6 @@ Editing uses direct semantic operations:
80
112
 
81
113
  See [directory and symlink operations](docs/directory-operations.md) for merge/replace behavior, guards, and failure effects.
82
114
 
83
- Independent edits can be submitted together as a tool-call batch. For conditional or dependent work, native Codemode composes the same guarded tools with Read, Search and Select results. Check each operation's status and final effects; a script error does not roll back accepted edits. Diffing and staging are first-class tools too.
84
-
85
115
  <div align="center">
86
116
 
87
117
  [![Pi Agent IDE editing examples](assets/summary/thumbs/editing.png)](assets/summary/editing.png)
@@ -96,6 +126,10 @@ Selections can come from exact text, anchors, search results, AST matches, or la
96
126
 
97
127
  </div>
98
128
 
129
+ ### Review and restore Git changes
130
+
131
+ The agent can compare changes, stage or unstage individual Git changes, and restore a selected change without discarding the rest of the file. Text edits also have their own undo. You can see what changed and recover at the level of the operation, rather than resetting all the work.
132
+
99
133
  ### Run through persistent terminal sessions
100
134
 
101
135
  The terminal is a first-class cross-platform interface. The agent can run commands, keep interactive sessions and background tasks alive across turns and extension reloads, read retained output, send exact input or named keys, and inspect terminal applications through images and sequences.
@@ -120,11 +154,19 @@ Debugger sessions use the same resource model. The agent can set breakpoints, in
120
154
 
121
155
  The agent can render websites as images, observe changing interfaces over time, and inspect windows opened by its own processes. Arbitrary windows and full displays require separate explicit opt-in settings. Images can be downscaled, limited to normalized regions, or divided into grid cells so the model receives the useful area instead of every source pixel.
122
156
 
157
+ ### Use the same tools over SSH
158
+
159
+ Ask the agent to work on a remote Linux environment. It can read, search and edit files, copy between your machine and the server, work with Git, and run interactive commands through the same IDE tools. Language servers, linters, formatters and debugger adapters use the remote machine's tools and project settings.
160
+
161
+ Remote process inspection, supported window/display capture and remote web reads are available too. Missing remote dependencies are reported rather than silently replaced by local tools.
162
+
163
+ SSH uses your existing OpenSSH authentication and host-key trust. The remote machine needs Python 3; no permanent agent is installed there. Operations have the permissions of the SSH account. The agent sets up project-local access by default unless you ask for global settings. See [SSH configuration](docs/configuration.md#ssh-targets).
164
+
123
165
  ### Keep context focused through progressive disclosure
124
166
 
125
- Pi Agent IDE does not load every capability guide into the system prompt. Detailed instructions are disclosed when the agent first uses the relevant tool and remain available as readable documentation through `read`.
167
+ The agent gets detailed guides and optional tools when it needs them, instead of carrying every instruction throughout the task.
126
168
 
127
- The agent receives the complete contract when it needs it. Unrelated capabilities do not consume context throughout the rest of the task, and large results remain progressively readable instead of flooding the context or terminal.
169
+ Large results stay readable without losing the full text or the exact source selection. Compact edit receipts keep the agent's context small while you still see the full diff. See [tools and workflow](docs/tools.md) for the details.
128
170
 
129
171
  ### Extend the interfaces through protocols
130
172
 
@@ -134,7 +176,7 @@ Filesystem and HTTP reads, resource views, content converters, search backends,
134
176
 
135
177
  A person can see the agent's edits, diffs, diagnostics, running processes, debugger state, and failures. Bounded presentation keeps live output readable without discarding the underlying result. Guarded snapshots and first-class undo make mistakes visible and recovery inexpensive.
136
178
 
137
- IDE tools called from native Codemode keep their custom panels in a separate block below the script, even when the script prints no results. Successful edits in one batch show one final diff per file, without intermediate edit cards or an extra block title. The panels survive session restore and tree navigation. Oversized or missing display data is marked as incomplete; rendering never repeats an operation or adds its cost again.
179
+ Direct calls show tool panels and diffs using each tool's presentation setting. Extra successful IDE panels from Codemode are off by default; turn on **Show tool results from Codemode** in `/agent-ide-settings` to show them. Codemode's own script and output are unchanged. Errors and expanded history remain available, and a batch of edits shows the final diff for each file rather than intermediate cards.
138
180
 
139
181
  <div align="center">
140
182
 
@@ -146,11 +188,13 @@ IDE tools called from native Codemode keep their custom panels in a separate blo
146
188
 
147
189
  Built-in debugger recipes cover C, C++, C#, Dart, Elixir, Go, Java, JavaScript, Julia, Kotlin, Lua, PHP, PowerShell, Python, R, Ruby, Rust, shell scripts, Swift, TypeScript, and Zig. Formatting, linting, AST, language-server, and debugger support follows the tools and configuration available in each project.
148
190
 
191
+ Known issue: the Kotlin adapter (`fwcd/kotlin-debug-adapter` 0.4.4) can run past verified breakpoints. This was reproduced with JDK 17 and 21 both locally and over SSH. Its recipe remains available, but a verified breakpoint is not proof that execution will stop there. Java uses `java-debug / JDT LS`, not this adapter.
192
+
149
193
  Windows and WSL are first-class supported environments alongside Linux. Run `/pi-agent-ide-doctor` to see the exact capabilities available on the current machine.
150
194
 
151
195
  ### Built through data-driven development
152
196
 
153
- Pi Agent IDE is developed through daily use on real software and measured with the [Explicit Edit Benchmark](https://github.com/alexshpunt/explicit-edit-benchmark). Every release is exercised against real editing tasks, and the measured result becomes part of the release evidence. The badge above links to the [latest accepted observation](https://huggingface.co/spaces/alexshpunt/benchmark-explorer?card=harness%3Api-agent-ide%40latest), with its score and run details; the underlying observations are available in the [published dataset](https://huggingface.co/datasets/alexshpunt/explicit-edit-benchmark).
197
+ Pi Agent IDE is developed through daily use on real software and measured with the [Explicit Edit Benchmark](https://github.com/alexshpunt/explicit-edit-benchmark). Published benchmark observations record performance on real editing tasks; not every release has a benchmark run. The badge above links to the [latest accepted observation](https://huggingface.co/spaces/alexshpunt/benchmark-explorer?card=harness%3Api-agent-ide%40latest), with its score and run details; the underlying observations are available in the [published dataset](https://huggingface.co/datasets/alexshpunt/explicit-edit-benchmark).
154
198
 
155
199
  The project is also used to develop itself. Weak interactions, missing affordances, and agent failure modes appear in real work instead of remaining theoretical. Problems are fixed as they are found, and the tools evolve through regular releases.
156
200
 
@@ -158,7 +202,7 @@ Pi Agent IDE is experimental and under active development. Interfaces and behavi
158
202
 
159
203
  ## Installation
160
204
 
161
- Install [Pi](https://pi.dev/) **0.99.1 or newer** first, then install Pi Agent IDE from npm. Development and integration tests use Pi 1.0.0. Older hosts are rejected with an upgrade message.
205
+ Install [Pi](https://pi.dev/) **0.99.1 or newer** first, then install Pi Agent IDE from npm. Development and integration tests use Pi 1.1.0. Older hosts are rejected with an upgrade message.
162
206
 
163
207
  ```bash
164
208
  pi install npm:pi-agent-ide
@@ -192,6 +236,8 @@ Doctor reports the effective project, global, and built-in mappings, their sourc
192
236
 
193
237
  Doctor shows its report before changing anything. If project evidence points to a different installed tool, it can write a project-only override under `.pi/pi-agent-ide/`. It never changes global or built-in configuration. Native files such as `eslint.config.js`, `.clang-format`, and `pyproject.toml` remain unchanged.
194
238
 
239
+ For a configured remote project, use `/pi-agent-ide-doctor ssh://target/path`. Target checks use that machine's tools and settings; suggested overrides stay in that remote project.
240
+
195
241
  Run `/pi-agent-ide-doctor` again after installing or changing project tools. For configuration paths, precedence, and command flags, see [Configuration](./docs/configuration.md#doctor).
196
242
 
197
243
  ## Customization
@@ -216,15 +262,20 @@ If something breaks, behaves badly, or does not fit your workflow, please [open
216
262
 
217
263
  ## Documentation
218
264
 
219
- | Document | Contents |
220
- | ------------------------------------------ | ------------------------------------------------------------------------------------ |
221
- | [Tools and workflow](./docs/tools.md) | Read, vision, search, editing, anchors, and feedback |
222
- | [Architecture](./docs/architecture.md) | Module boundaries, protocols, and the umbrella extension |
223
- | [Configuration](./docs/configuration.md) | Run `/pi-agent-ide-doctor`, configure project tools and search, or disable built-ins |
224
- | [File hooks](./docs/user-hooks.md) | Inspect, change, or deny reads and edits |
225
- | [Writing extensions](./docs/extensions.md) | Add resolvers, views, anchors, search backends, and IDE plugins |
226
- | [Development](./docs/development.md) | Work from a checkout, test, and run modular mode |
227
- | [Releases](./docs/releases.md) | Nightly builds, release branches, verification, and npm publication |
265
+ | Document | Contents |
266
+ | ------------------------------------------------------ | ------------------------------------------------------------------------ |
267
+ | [Tools and workflow](./docs/tools.md) | Reading, search, selections, editing, terminals, and feedback |
268
+ | [Result composition](./docs/structured-results.md) | Passing results between tools, reference lifetime, and commit boundaries |
269
+ | [Selection](./docs/agent-guides/select-code.md) | Text ranges, AST parts, and combining selections |
270
+ | [Directory operations](./docs/directory-operations.md) | Copy, Move, Delete, symlinks, guards, and partial failures |
271
+ | [Settings guide](./docs/settings-help.md) | Choosing settings, scope, saving and output presentation |
272
+ | [Configuration](./docs/configuration.md) | Project tools, SSH targets, Doctor, and presentation settings |
273
+ | [SSH guide](./docs/agent-guides/ssh.md) | Agent setup and supported remote operations |
274
+ | [File hooks](./docs/user-hooks.md) | Inspect, change, or deny reads and edits |
275
+ | [Writing extensions](./docs/extensions.md) | Resolvers, views, anchors, search backends, and IDE plugins |
276
+ | [Architecture](./docs/architecture.md) | Module boundaries, protocols, and the umbrella extension |
277
+ | [Development](./docs/development.md) | Checkout setup, tests, and package builds |
278
+ | [Releases](./docs/releases.md) | Nightly builds, release candidates, verification, and publication |
228
279
 
229
280
  ## License
230
281
 
@@ -0,0 +1 @@
1
+ import{a as O}from"./chunk-AKNHSDGV.js";import{a as R}from"./chunk-N56WAVYA.js";import{a as v,b as S}from"./chunk-GEMDU6XW.js";import{b as y}from"./chunk-WPBQ45ZL.js";import"./chunk-WXGTU2M6.js";import{a as w,b as E,c as b}from"./chunk-LLRUJD62.js";import"./chunk-Q5X6OXNS.js";import{g as s}from"./chunk-4HWKBCBH.js";import{a as p,b as k,d as C}from"./chunk-6EDOLYOV.js";import{c as g}from"./chunk-W7CASEO3.js";import"./chunk-TOYN4W4F.js";import"./chunk-YJ6T3PEP.js";import"./chunk-S72FVLUX.js";import"./chunk-DXONCYWF.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import{c as u,l as h,m as P}from"./chunk-IMGIDBCC.js";import"./chunk-BXGMMZT3.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import{a as c}from"./chunk-EI7MMDWY.js";import T from"node:path";function A(i){let l=v(i),U=R(i),d=new Map;return{async resolveProject(r,o){if(r.startsWith("ssh://")||o.startsWith("ssh://")){let e=i.resolve(r,o);if(!e)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let t=i.resolve(o);if(t&&t.location.target!==e.location.target)throw new s("UNSUPPORTED_SOURCE",r,"not-applied");return O(e.backend,e.location.path,t?.location.path,"formatters",p)}if(r.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",r,"not-applied");let n=await u(o,r,"formatters",p);return n===void 0?void 0:{cwd:n,external:n!==T.resolve(o)}},async loadRegistry(r,o){let n=JSON.stringify([r,o]),e=d.get(n);if(!e){let t=i.resolve(r);e=k.fromDirectory(r,{includeGlobal:!o,requireBuiltInEvidence:!0,...t?{layerAccess:l,executableAvailability:c(a=>y(t.backend,t.location.path,a),"executableAvailability"),recipeEvidence:c(a=>S(t.backend,t.location.path,a),"recipeEvidence")}:{}}),d.set(n,e)}return e},async run(r,o,n){let e=i.resolve(n);if(!e){if(n.includes("://")||o.includes("://"))throw new s("UNSUPPORTED_SOURCE",n,"not-applied");return P(r,{projectRoot:o,filePath:n})}let t=await e.backend.read(e.location.path),a=await h(r.run,{projectRoot:o,filePath:n,processAccess:U}),m=await e.backend.read(e.location.path);if(!a.ok)return{ok:!1,changed:!m.bytes.equals(t.bytes)};if(r.output==="stdout"){if(m.version!==t.version)throw new s("CONFLICT",n,"not-applied");let f=Buffer.from(a.stdout);return f.equals(t.bytes)||await e.backend.write(e.location.path,f,t.version),{ok:!0,changed:!f.equals(t.bytes)}}return{ok:!0,changed:!m.bytes.equals(t.bytes)}}}}c(A,"createOwnedFormatterRuntime");async function F(i){let l=new b(await E(w(g())));await C(i,A(l))}c(F,"registerOwnedFormatter");export{A as createOwnedFormatterRuntime,F as default};
@@ -0,0 +1 @@
1
+ import{a as I}from"./chunk-JKMXND6V.js";import{g as r}from"./chunk-4HWKBCBH.js";import{a as l}from"./chunk-EI7MMDWY.js";import{readFile as S}from"node:fs/promises";async function m(h,t,o){o?.throwIfAborted(),w??=S(new URL("./vision-capture-worker.py",new URL("../src/backend/vision-capture.ts",import.meta.url).href),"utf8");let s=await I(h,"python3",["-c",await w,JSON.stringify({kind:"probe"})],t,{signal:o,timeoutMs:5e3,maxBytes:128*1024});if(o?.throwIfAborted(),s.exitCode!==0)throw new r("CAPABILITY_UNAVAILABLE",t,"not-applied");let e;try{e=JSON.parse(s.stdout.toString("utf8"))}catch{throw new r("INVALID_RESPONSE",t,"not-applied")}if(typeof e!="object"||e===null)throw new r("INVALID_RESPONSE",t,"not-applied");if("display"in e&&e.display===!0&&"window"in e&&typeof e.window=="boolean"&&(e.window||"error"in e&&e.error==="CAPABILITY_UNAVAILABLE"))return{display:{ok:!0,detail:"Target X11 connection opened without pixels; capture opt-in unchanged"},window:{ok:e.window,detail:e.window?"Target X-Resource 1.2 is available; individual window authorization is not checked":`CAPABILITY_UNAVAILABLE: ${t} (trusted X11 client identity unavailable)`}};let n="error"in e&&typeof e.error=="string"&&y.has(e.error)?e.error:"INVALID_RESPONSE";throw new r(n,t,"not-applied")}l(m,"probeSshCapture");var w,E=Buffer.from([137,80,78,71,13,10,26,10]),y=new Set(["DESKTOP_UNAVAILABLE","CAPABILITY_UNAVAILABLE","ENOENT","EACCES","STALE_PROCESS","AMBIGUOUS_WINDOW","WINDOW_OBSCURED","CONTENT_LIMIT","PIXEL_LIMIT","BYTE_LIMIT"]);async function g(h,t,o,s){s?.throwIfAborted();let e=o.kind==="window"?"window:":"display:";if(!t.startsWith(`${e}ssh://`))throw new r("INVALID_SOURCE",t,"not-applied");let n=new URL(t.slice(e.length)),p=o.kind==="window"?o.pid:o.index;if(n.username||n.password||n.port||n.search||!Number.isSafeInteger(p)||(o.kind==="window"?p<1||n.pathname!==`/${p}`||n.hash!=="":p<0||n.pathname!=="/"||n.hash!==`#${p}`&&!(p===0&&n.hash==="")))throw new r("INVALID_SOURCE",t,"not-applied");try{let a=h.resolve(`ssh://${n.hostname}/`);if(!a)throw new r("UNSUPPORTED_SOURCE",t,"not-applied");w??=S(new URL("./vision-capture-worker.py",new URL("../src/backend/vision-capture.ts",import.meta.url).href),"utf8");let i=await I(a.backend.target,"python3",["-c",await w,JSON.stringify(o)],t,{signal:s,timeoutMs:1e4,maxBytes:20*1024*1024});if(s?.throwIfAborted(),i.exitCode!==0)throw new r("CAPABILITY_UNAVAILABLE",t,"not-applied");if(i.stdout.subarray(0,8).equals(E)){if(i.stdout.length<33||i.stdout.length>20*1024*1024||i.stdout.toString("ascii",12,16)!=="IHDR")throw new r("INVALID_RESPONSE",t,"not-applied");let A=i.stdout.readUInt32BE(16),f=i.stdout.readUInt32BE(20);if(A<1||f<1||A*f>16*1024*1024)throw new r("PIXEL_LIMIT",t,"not-applied");return i.stdout}let d;try{d=JSON.parse(i.stdout.toString("utf8"))}catch{throw new r("INVALID_RESPONSE",t,"not-applied")}let c=typeof d=="object"&&d!==null&&"error"in d&&typeof d.error=="string"&&y.has(d.error)?d.error:"INVALID_RESPONSE";throw new r(c,t,"not-applied")}catch(a){throw a instanceof r?new r(a.code,t,a.effect):a}}l(g,"captureSshFrame");export{m as a,g as b};
@@ -0,0 +1 @@
1
+ import{a as b}from"./chunk-AKNHSDGV.js";import{a as y}from"./chunk-HCK7OIQ3.js";import"./chunk-7LOVUWNI.js";import{a as k,b as E}from"./chunk-GEMDU6XW.js";import{b as S}from"./chunk-WPBQ45ZL.js";import"./chunk-BQAKA3FU.js";import{a as u,b as w,c as v}from"./chunk-LLRUJD62.js";import{g as c}from"./chunk-4HWKBCBH.js";import{a as p,b as h,d as P}from"./chunk-TXG2H7YQ.js";import"./chunk-47SPPIXK.js";import"./chunk-VAXLSPPU.js";import"./chunk-OI3HBIPK.js";import"./chunk-YTYLS2UM.js";import{c as f}from"./chunk-W7CASEO3.js";import"./chunk-TOYN4W4F.js";import"./chunk-YJ6T3PEP.js";import"./chunk-S72FVLUX.js";import"./chunk-M4TVRCMZ.js";import"./chunk-TGC2ZACO.js";import"./chunk-NNCZYO4Q.js";import"./chunk-IICJXZBU.js";import"./chunk-PS2B6THP.js";import"./chunk-BU7IZLKB.js";import"./chunk-S5PL5DFQ.js";import"./chunk-DXONCYWF.js";import"./chunk-DUUOCBS3.js";import"./chunk-T4FTT3U4.js";import"./chunk-ZPT5D4VP.js";import"./chunk-ZAWRSA7N.js";import"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import{c as m}from"./chunk-IMGIDBCC.js";import"./chunk-BXGMMZT3.js";import"./chunk-756K3LJY.js";import"./chunk-ZC65Z3CK.js";import{a as i}from"./chunk-EI7MMDWY.js";import R from"node:path";function g(d){let n=i(o=>{let e=d.resolve(o);if(!e)throw new c("UNSUPPORTED_SOURCE",o,"not-applied");return e},"resolve");return{transport:i(o=>y(d,o),"transport"),async readText(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes.toString("utf8")},async readSnapshot(o,e){let r=n(o),t=await r.backend.read(r.location.path,{signal:e});return{content:t.bytes.toString("utf8"),version:t.version}},async readBytes(o,e){let r=n(o);return(await r.backend.read(r.location.path,{signal:e})).bytes},async exists(o,e){let r=n(o);try{return await r.backend.stat(r.location.path,{signal:e}),!0}catch(t){if(t instanceof c&&t.code==="ENOENT")return!1;throw t}},async isFile(o,e){let r=n(o);return(await r.backend.stat(r.location.path,{signal:e})).kind==="file"},async entries(o,e){let r=n(o);return(await r.backend.list(r.location.path,{signal:e})).map(t=>({name:t.name,kind:t.kind==="symlink"?"other":t.kind}))}}}i(g,"createSshLspWorkspaceOwner");async function O(d){let n=new v(await w(u(f()))),o=g(n);await P(d,{workspace:i(e=>e.startsWith("ssh://")?o:void 0,"workspace"),async loadRegistry(e,r,t){t?.throwIfAborted();let s=n.resolve(e);if(s)return h.fromPackageDir(e,{signal:t,layerAccess:k(n,t),includeGlobal:!r,requireBuiltInEvidence:r,recipes:p,recipeEvidence:i(a=>E(s.backend,s.location.path,a,t),"recipeEvidence"),executableAvailability:i(a=>S(s.backend,s.location.path,a,t),"executableAvailability")});if(e.includes("://"))throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return h.fromPackageDir(r?e:process.env.PI_AGENT_IDE_CONFIG_DIR??e,{signal:t,includeGlobal:!r,requireBuiltInEvidence:r,recipes:p})},async resolveProject(e,r,t){if(t?.throwIfAborted(),e.startsWith("ssh://")||r.startsWith("ssh://")){let a=n.resolve(e,r);if(!a)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");let l=n.resolve(r);if(l&&l.location.target!==a.location.target)throw new c("UNSUPPORTED_SOURCE",e,"not-applied");return b(a.backend,a.location.path,l?.location.path,"lsp-servers",p,t)}let s=await m(r,e,"lsp-servers",p,t);return s===void 0?void 0:{cwd:s,external:s!==R.resolve(r)}}})}i(O,"registerOwnedLsp");export{O as default};
@@ -1 +1 @@
1
- import{c,d,e as u}from"./chunk-7UGNGK7Y.js";import{a as r}from"./chunk-EI7MMDWY.js";function E(t,o){let s=r(()=>{let e,i={plugin:o,accept(g){if(e!==void 0)throw new Error(`Plugin ${o.id} registration was accepted more than once`);e=g}};return t.events.emit(d,i),e},"announce"),n=r(()=>{},"unsubscribe");n=t.events.on(c,e=>{if(!u(e))throw new Error("Invalid pi-agent-search core readiness event");let i=s();if(i===void 0)throw new Error("pi-agent-search core announced readiness without accepting the plugin");n(),i.catch(()=>{})}),t.on("session_shutdown",n);let a=s();if(a!==void 0)return n(),a}r(E,"connectSearchPlugin");export{E as a};
1
+ import{c,d,e as u}from"./chunk-VAXLSPPU.js";import{a as r}from"./chunk-EI7MMDWY.js";function E(t,o){let s=r(()=>{let e,i={plugin:o,accept(g){if(e!==void 0)throw new Error(`Plugin ${o.id} registration was accepted more than once`);e=g}};return t.events.emit(d,i),e},"announce"),n=r(()=>{},"unsubscribe");n=t.events.on(c,e=>{if(!u(e))throw new Error("Invalid pi-agent-search core readiness event");let i=s();if(i===void 0)throw new Error("pi-agent-search core announced readiness without accepting the plugin");n(),i.catch(()=>{})}),t.on("session_shutdown",n);let a=s();if(a!==void 0)return n(),a}r(E,"connectSearchPlugin");export{E as a};
@@ -0,0 +1 @@
1
+ import{k as f}from"./chunk-DXONCYWF.js";import{a}from"./chunk-EI7MMDWY.js";import k from"node:path";function p(i,t){if(!/^[a-z0-9][a-z0-9_-]*$/u.test(i))throw new TypeError("SSH target IDs must contain lowercase letters, digits, underscores or hyphens");if(!t.startsWith("/")||t.includes("\0"))throw new TypeError("Remote paths must be absolute and contain no NUL characters");let r=k.posix.normalize(t),e=r.split("/").map(encodeURIComponent).join("/");return{target:i,path:r,source:`ssh://${i}${e}`}}a(p,"remoteLocation");function O(i,t){if(i.startsWith("ssh:")){let e=new URL(i);if(!i.startsWith("ssh://")||!e.hostname||e.username||e.password||e.port||e.search||e.hash||i.includes("?")||i.includes("#"))throw new TypeError("SSH references require a configured target and an absolute path, without credentials or selectors");return p(e.hostname,decodeURIComponent(e.pathname))}if(!t?.startsWith("ssh:")||/^[A-Za-z][A-Za-z\d+.-]*:/u.test(i))return;let r=O(t);if(!r)throw new TypeError("Invalid remote workspace");return p(r.target,k.posix.resolve(r.path,i))}a(O,"resolveRemoteLocation");import{readFile as C}from"node:fs/promises";function S(i){if(p(i.id,i.workspace),!/^(?:[A-Za-z0-9_][A-Za-z0-9_.-]*@)?[A-Za-z0-9_][A-Za-z0-9_.-]*$/u.test(i.host))throw new TypeError("SSH host must be an OpenSSH host alias, not a command or URI")}a(S,"validateSshTarget");async function y(i){return`exec(__import__("base64").b64decode("${(await C(i)).toString("base64")}"))`}a(y,"sshWorkerProgram");async function F(i){return`python3 -c '${await y(i)}'`}a(F,"sshWorkerCommand");function D(i,t){let r=["-T","-o","BatchMode=yes","-o","StrictHostKeyChecking=yes","-o","ForwardAgent=no","-o","PermitLocalCommand=no","-o","ClearAllForwardings=yes"];return i.configFile!==void 0&&r.push("-F",i.configFile),r.push("--",i.host,t),r}a(D,"systemSshArguments");function H(i,t){return/Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED|No .* host key is known/u.test(t)?"HOST_KEY_FAILED":/Permission denied \([^)]*\)/u.test(t)?"AUTH_FAILED":i===127&&/\bpython3:\s*(?:command\s+)?not found\b/u.test(t)?"DEPENDENCY_UNAVAILABLE":"TRANSPORT_FAILED"}a(H,"sshFailureCode");import{createHash as I}from"node:crypto";import{Type as n}from"typebox";import{Value as x}from"typebox/value";var d=class extends f{static{a(this,"SshBackendError")}constructor(t,r,e,o){super(t,r,e,o),this.name=t==="CANCELLED"?"AbortError":"SshBackendError"}},L=n.Object({bytes:n.String(),version:n.String({pattern:"^[a-f0-9]{64}$"})}),v=n.Object({directory:n.String(),path:n.String(),revision:n.String({pattern:"^[a-f0-9]{64}$"}),sourceRevision:n.String({pattern:"^[a-f0-9]{64}$"}),sha256:n.String({pattern:"^[a-f0-9]{64}$"})}),E=n.Object({revision:n.String({pattern:"^[a-f0-9]{64}$"}),bytes:n.String(),offset:n.Integer({minimum:0}),totalBytes:n.Integer({minimum:0})}),T=n.Array(n.Object({name:n.String(),kind:n.Union([n.Literal("file"),n.Literal("directory"),n.Literal("symlink"),n.Literal("other")])})),B=n.Object({kind:n.Union([n.Literal("file"),n.Literal("directory"),n.Literal("other")]),size:n.Integer({minimum:0}),mode:n.Integer({minimum:0})}),m=n.Object({kind:n.Union([n.Literal("file"),n.Literal("directory"),n.Literal("symlink"),n.Literal("other")]),size:n.Integer({minimum:0}),mode:n.Integer({minimum:0}),links:n.Integer({minimum:0}),identity:n.Object({device:n.String({pattern:"^[0-9]+$"}),inode:n.String({pattern:"^[0-9]+$"})}),revision:n.String({pattern:"^[a-f0-9]{64}$"})}),N=n.Object({path:n.String({minLength:1}),entries:n.Array(n.Object({relativePath:n.String(),kind:m.properties.kind,revision:m.properties.revision,identity:m.properties.identity,mode:n.Integer({minimum:0}),link:n.Optional(n.String())}))}),A=n.Union([n.Object({ok:n.Literal(!0),data:n.Unknown()}),n.Object({ok:n.Literal(!1),code:n.String({pattern:"^[A-Z][A-Z0-9_]*$"}),effect:n.Union([n.Literal("not-applied"),n.Literal("applied"),n.Literal("unknown")])})]),w=class{static{a(this,"SshBackend")}target;constructor(t){S(t),this.target={...t}}async stat(t,r={}){let e=await this.request({operation:"stat",path:t},!1,r);return this.checked(B,e,t,!1),e}async lstat(t,r={}){let e=await this.request({operation:"lstat",path:t},!1,r);return this.checked(m,e,t,!1),e}async temporaryEnvironment(t={}){let r=await this.request({operation:"temporary-environment",path:this.target.workspace},!1,t);return this.checked(n.Object({home:n.String({minLength:1,pattern:"^/"}),temporary:n.String({minLength:1,pattern:"^/"}),agentDirectory:n.Optional(n.String({minLength:1,pattern:"^/"}))}),r,this.target.workspace,!1),r}async objectSnapshot(t,r={}){let e=await this.request({operation:"object-snapshot",path:t},!1,r);return this.checked(N,e,t,!1),e}async ensureObjectDirectory(t,r,e,o={}){let s=await this.request({operation:"mkdir-object",path:t,mode:r,revision:e},!0,o);this.checked(n.Null(),s,t,!0)}async createObjectLink(t,r,e={}){let o=await this.request({operation:"symlink-object",path:t,link:r,revision:null},!0,e);this.checked(n.Null(),o,t,!0)}async setObjectMode(t,r,e,o={}){let s=await this.request({operation:"chmod-object",path:t,mode:r,revision:e},!0,o);this.checked(n.Null(),s,t,!0)}async moveObject(t,r,e={}){let o=await this.request({operation:"move-object",path:t.path,destination:r.path,sourceSnapshot:t,targetSnapshot:r},!0,e);return this.checked(n.Boolean(),o,t.path,!0),o}async captureJournal(t,r={}){let e=await this.request({operation:"journal",path:t},!1,r);return this.checked(v,e,t,!1),e}async releaseJournal(t,r={}){let e=await this.request({operation:"journal-release",path:t},!1,r);this.checked(n.Null(),e,t,!1)}async read(t,r={}){let e=await this.request({operation:"read",path:t},!1,r);return this.checked(L,e,t,!1),{bytes:Buffer.from(e.bytes,"base64"),version:e.version}}async readRange(t,r,e,o={}){if(!Number.isSafeInteger(r)||!Number.isSafeInteger(e)||e<0)throw new TypeError("Byte offset and limit must be safe integers; limit must be nonnegative");let s=await this.request({operation:"range",path:t,offset:r,limit:e},!1,o);return this.checked(E,s,t,!1),{bytes:Buffer.from(s.bytes,"base64"),offset:s.offset,totalBytes:s.totalBytes,revision:s.revision}}async list(t,r={}){let e=await this.request({operation:"list",path:t},!1,r);return this.checked(T,e,t,!1),e}async write(t,r,e,o={}){let s=await this.request({operation:"write",path:t,bytes:Buffer.from(r).toString("base64"),expected:e},!0,o);return this.checked(n.String({pattern:"^[a-f0-9]{64}$"}),s,t,!0),s}async copy(t,r,e,o,s={}){return this.copyEntry("copy",t,r,e,o,s)}async restoreJournal(t,r,e,o,s={}){return this.copyEntry("restore",t,r,e,o,s)}async copyEntry(t,r,e,o,s,c){let u=await this.request({operation:t,path:r,destination:e,sourceRevision:o,targetRevision:s},!0,c);this.checked(n.Null(),u,r,!0)}async move(t,r,e,o,s={}){let c=await this.request({operation:"move",path:t,destination:r,sourceRevision:e,targetRevision:o},!0,s);this.checked(n.Null(),c,t,!0)}async realpath(t,r={}){let e=await this.request({operation:"realpath",path:t},!1,r);if(this.checked(n.String({minLength:1}),e,t,!1),!e.startsWith("/"))throw new d("INVALID_RESPONSE",t,"not-applied");return e}async queryGit(t,r,e={}){let o=await this.request({operation:"git-query",path:t,args:r},!1,{...e,timeoutMs:5e3});return this.checked(n.String(),o,t,!1),o}async removeObject(t,r,e={}){let o=await this.request({operation:"delete-object",path:t,revision:r},!0,e);this.checked(n.Null(),o,t,!0)}async removeEntry(t,r,e={}){let o=await this.request({operation:"unlink",path:t,revision:r},!0,e);this.checked(n.Null(),o,t,!0)}async remove(t,r,e={}){let o=await this.request({operation:"remove",path:t,expected:r},!0,e);this.checked(n.Null(),o,t,!0)}async writeGitIndex(t,r,e={}){let o=Buffer.from(r.text,"utf8");if(o.length>32*1024*1024)throw new d("CONTENT_LIMIT",p(this.target.id,t).source,"not-applied");let{text:s,expectedIndexText:c,expectedWorktreeText:u,...g}=r,l=a(b=>I("sha256").update(b,"utf8").digest("hex"),"digest"),h=await this.request({operation:"gitIndex",path:t,...g,bytes:o.toString("base64"),expectedIndexHash:l(c),...u!==void 0&&{expectedWorktreeHash:l(u)}},!0,e);this.checked(n.Null(),h,t,!0)}async execute(t,r,e,o={}){let{runOwnedSshCommand:s}=await import("./chunk-Z2QGNTGQ.js");return s({...this.target,workspace:e},t,r,p(this.target.id,e).source,{signal:o.signal,timeoutMs:o.timeoutMs??3e4,maxBytes:32*1024*1024,limitCode:"CONTENT_LIMIT",closeInput:!0,effect:"unknown"})}async startProcess(t,r,e,o={}){let{startSshProcess:s}=await import("./chunk-W3YFF6OO.js");return s(this.target,t,r,e,o)}checked(t,r,e,o){if(!x.Check(t,r))throw new d("INVALID_RESPONSE",p(this.target.id,e).source,o?"unknown":"not-applied")}async request(t,r,e){let o=typeof t.path=="string"?t.path:typeof t.cwd=="string"?t.cwd:this.target.workspace,s=p(this.target.id,o).source,c=e.timeoutMs??3e4;if(!Number.isFinite(c)||c<=0)throw new TypeError("SSH operation deadline must be positive");e.signal?.throwIfAborted();let{runOwnedSshCommand:u}=await import("./chunk-Z2QGNTGQ.js"),g=await y(new URL("./ssh-worker.py",new URL("../src/backend/ssh.ts",import.meta.url).href)),l=await u({...this.target,workspace:t.operation==="gitIndex"?o:"/"},"python3",["-c",g],s,{signal:e.signal,timeoutMs:c,maxBytes:48*1024*1024,limitCode:"CONTENT_LIMIT",effect:r?"unknown":"not-applied",input:Buffer.from(JSON.stringify(t))});if(l.exitCode!==0)throw new d("REMOTE_OPERATION_FAILED",s,r?"unknown":"not-applied");let h;try{h=JSON.parse(l.stdout.toString("utf8"))}catch{throw new d("INVALID_RESPONSE",s,r?"unknown":"not-applied")}if(!j(h))throw new d("INVALID_RESPONSE",s,r?"unknown":"not-applied");if(!h.ok)throw new d(h.code,s,h.effect);return h.data}};function j(i){return x.Check(A,i)}a(j,"isReply");export{p as a,O as b,S as c,F as d,D as e,H as f,d as g,w as h};
@@ -0,0 +1,10 @@
1
+ import{b as N}from"./chunk-LEKC4GQK.js";import{a as k,b as E,c as v}from"./chunk-UEVGZUII.js";import{f as I,g as S}from"./chunk-DUUOCBS3.js";import"./chunk-T4FTT3U4.js";import"./chunk-ZPT5D4VP.js";import"./chunk-KINKBPPX.js";import{a as b}from"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";import h from"node:path";import{readdir as Y}from"node:fs/promises";import K from"node:path";async function P(e){let n=[],t=await Y(e,{withFileTypes:!0});for(let i of t){let o=K.join(e,i.name);i.isDirectory()?n.push(...await P(o)):(i.isFile()||i.isSymbolicLink())&&n.push(o)}return n}a(P,"collectFiles");var W=new Set([...Object.keys(k),".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".py",".pyi",".rs",".c",".cc",".hh",".hxx",".cpp",".cxx",".h",".hpp",".json",".jsonc",".yaml",".yml",".toml"]),H=new Set([".json",".jsonc",".yaml",".yml",".toml"]),j=new Set(["class_declaration","class_definition","class_specifier","enum_declaration","enum_definition","enum_item","enum_specifier","export_statement","function_declaration","function_definition","function_item","impl_item","interface_declaration","lexical_declaration","namespace_definition","mod_item","public_field_definition","method_definition","method_signature","property_signature","field_declaration","struct_item","struct_specifier","trait_item","type_alias_declaration","type_item","variable_declaration","assignment"]),X=new Set(["module","program","source_file"]),G=new Set(["import_declaration","import_from_statement","import_statement","use_declaration"]),A=new Set(["arrow_function","function_declaration","function_definition","function_item","function_expression","method_definition"]),q=new Set(["public_field_definition","variable_declarator","assignment"]),F=new Set(["field_identifier","identifier","property_identifier","shorthand_property_identifier_pattern","type_identifier"]);function w(e){return W.has(h.extname(e).toLowerCase())}a(w,"isSupportedOutlinePath");var L={failureLabel:"PEEK_FAILED",emptyReason:"no entries to peek.",recovery:['Call peek with { peers: [{ path: "path/to/file.ts" }, ...] }.']},Z={failureLabel:"AST_OUTLINE_FAILED",emptyReason:"no AST outline was produced."};function Ie(e){return S([e],Z)}a(Ie,"formatAstOutline");var M=class{constructor(n=Number.POSITIVE_INFINITY){this.maxDepth=n}static{a(this,"AstOutlineManager")}fallbackScopeManager=new v;async readFileOutline(n,t){let i=T(n,t),o=i.includes("://")?i:h.relative(t,i)||i;if(!w(i))throw new Error(`AST outline is not supported for ${o}.`);let r=await N(i);return this.readDocumentOutline(i,t,r.lines)}async readDocumentOutline(n,t,i,o){let r=T(n,t),c=r.includes("://")?r:h.relative(t,r)||r;if(!w(r))throw new Error(`AST outline is not supported for ${c}.`);let s=await E(r,t,i);if(!s)throw new Error(`No AST parser is available for ${c}.`);if(Number.isFinite(this.maxDepth)&&s.rootNode.hasError)throw new Error(`Cannot build an automatic outline from invalid syntax in ${c}.`);let u=i.join(`
2
+ `);for(let d=this.maxDepth;;d-=1){let l=await this.createSourceViewBlock(s.rootNode,r,c,t,i,u,h.extname(r).toLowerCase(),void 0,void 0,d);if(o===void 0||o(l)||d<=0||!Number.isFinite(d))return l}}async formatFile(n,t){let i=T(n,t),o=i.includes("://")?i:h.relative(t,i)||i;if(!w(i)){let r=await N(i);return S([z(i,o,r.lines)],L)}try{return S([await this.readFileOutline(i,t)],L)}catch(r){let c=r instanceof Error?r.message:String(r);return S([R(o,c)],L)}}async formatSymbol(n,t){let o=(await P(t)).filter(r=>w(r)).sort();for(let r of o){let c;try{c=await N(r)}catch{continue}let s;try{s=await E(r,t,c.lines)}catch{continue}if(!s)continue;let u=ee(s.rootNode,n);if(!u)continue;let d=h.relative(t,r)||r,l=await this.createSourceViewBlock(u,r,d,t,c.lines,c.content,h.extname(r).toLowerCase(),n,[`defined in: ${d}:${u.startPosition.row+1}`]);return S([l],L)}return S([R("",`symbol not found: ${n}`,"PEEK_NOT_FOUND")],L)}async createSourceViewBlock(n,t,i,o,r,c,s,u,d,l=this.maxDepth){let f=re(n,c,s,l),m=await J(this.fallbackScopeManager,t,o,r),_=Q(m),g=f.map(y=>{let p=y.sourceLine,x=p===void 0?void 0:r[p-1]??"",O=(p===void 0?void 0:_.get(p))?.map(U=>` <!-- ${U} -->`).join("")??"";return I({content:y.content,...!(p===void 0||x===void 0)&&{sourceLine:{source:t,lineNumber:p,content:x}},...O.length>0&&{suffix:O}})});return{path:i,...u!==void 0&&{heading:u},...d!==void 0&&{details:d},startLine:n.startPosition.row+1,endLine:n.endPosition.row+1,totalLines:r.length,renderedLines:g}}};function z(e,n,t){return{path:n,startLine:t.length>0?1:0,endLine:t.length,totalLines:t.length,renderedLines:t.map((i,o)=>I({content:i,sourceLine:{source:e,lineNumber:o+1,content:i}}))}}a(z,"formatUnsupportedSourceBlock");function R(e,n,t="PEEK_FAILED"){return{path:e,startLine:0,endLine:0,totalLines:0,renderedLines:[],status:"failed",error:n,code:t}}a(R,"failedSourceViewBlock");function J(e,n,t,i){return e.getDocumentScopes(n,t,i)}a(J,"getOutlineScopes");function Q(e){let n=new Map;for(let t of e){let i=n.get(t.startLine)??[];i.push(t.beginAnchor.value),n.set(t.startLine,i);let o=n.get(t.endLine)??[];o.push(t.endScopeAnchor.value),n.set(t.endLine,o)}return n}a(Q,"buildScopeMarkers");function T(e,n){return e.startsWith("ssh://")?e:e.startsWith("file://")?decodeURIComponent(e.slice(7)):h.isAbsolute(e)?e:h.resolve(n,e)}a(T,"resolvePath");function ee(e,n){let t,i=a(o=>{if(!t){if(j.has(o.type)&&te(o)===n){t=ne(o);return}for(let r of o.namedChildren)i(r)}},"visit");return i(e),t}a(ee,"findSymbol");function te(e){let n=e.childForFieldName("name");if(n&&F.has(n.type))return n.text;for(let t of e.namedChildren)if(F.has(t.type))return t.text;if(e.type==="lexical_declaration"||e.type==="variable_declaration")return e.namedChildren.find(o=>o.type==="variable_declarator")?.childForFieldName("name")?.text;if(e.type==="function_definition"){let t=e.childForFieldName("declarator");return t?B(t):void 0}}a(te,"getNodeName");function B(e){if(F.has(e.type))return e.text;for(let n of e.namedChildren){let t=B(n);if(t)return t}}a(B,"findNestedName");function ne(e){let n=e.parent;return n&&(n.type==="export_statement"||n.type==="decorated_definition"||n.type==="template_declaration")?n:e}a(ne,"unwrapDeclaration");function re(e,n,t,i){let o=[];H.has(t)?D(e,t,o,i):$(e,t,o,!1,i);let r=ie(n,e.startIndex),c=oe(n,e.endIndex),s=o.filter(l=>l.start>=r&&l.end<=c).sort((l,f)=>f.start-l.start),u=se(n,r,c);for(let l of s){let f=l.start-r,m=l.end-r,_=ae(l);u.splice(f,m-f,..._)}for(;u.length>0&&/\s/u.test(b(u.at(-1)).char);)u.pop();let d=[[]];for(let l of u)l.char===`
3
+ `?d.push([]):b(d.at(-1)).push(l);return d.map(l=>{let f=[...new Set(l.flatMap(m=>m.sourceLine===void 0?[]:[m.sourceLine]))];return{content:l.map(m=>m.char).join(""),...f.length===1&&{sourceLine:f[0]}}})}a(re,"renderNodeLines");function ie(e,n){return e.lastIndexOf(`
4
+ `,Math.max(0,n-1))+1}a(ie,"lineStartAt");function oe(e,n){let t=e.indexOf(`
5
+ `,n);return t===-1?e.length:t}a(oe,"lineEndAt");function se(e,n,t){let i=e.slice(0,n).split(`
6
+ `).length,o=[];for(let r=n;r<t;r+=1){let c=b(e[r]);o.push({char:c,sourceLine:i}),c===`
7
+ `&&(i+=1)}return o}a(se,"mapSourceRange");function ae(e){let n=e.lineSourceLines??[],t=0,i=[];for(let o=0;o<e.text.length;o+=1){let r=b(e.text[o]),c=n[t];i.push(c===void 0?{char:r}:{char:r,sourceLine:c}),r===`
8
+ `&&(t+=1)}return i}a(ae,"mapReplacement");function V(e,n,t,i){return t<i||e.namedChildCount===0?!1:(n.push({start:e.startIndex,end:e.endIndex,text:"\u2026",lineSourceLines:[e.startPosition.row+1]}),!0)}a(V,"collapseDeepNode");function D(e,n,t,i,o=0){if(!V(e,t,o,i))for(let r of e.namedChildren){if(ce(r,n)){le(r)||t.push({start:r.startIndex,end:r.endIndex,text:"\u2026",lineSourceLines:[r.startPosition.row+1]});continue}D(r,n,t,i,o+1)}}a(D,"collectDataReplacements");function ce(e,n){return(n===".json"||n===".jsonc"?["string","number","true","false","null"]:n===".yaml"||n===".yml"?["string_scalar","integer_scalar","float_scalar","boolean_scalar","null_scalar","block_scalar"]:["string","integer","float","boolean","date_time","offset_date_time","local_date_time","local_date","local_time"]).includes(e.type)}a(ce,"isDataScalar");function le(e){let n=e.parent;for(;n&&!n.type.endsWith("pair")&&n.type!=="pair"&&n.type!=="table";)n=n.parent;let t=n?.namedChildren[0];return t!==void 0&&t.startIndex<=e.startIndex&&t.endIndex>=e.endIndex}a(le,"isDataKey");function $(e,n,t,i,o,r=0){if(V(e,t,r,o))return;let c=Number.isFinite(o)&&e.type==="expression_statement";if(i&&!ue(e)&&!c){t.push({start:e.startIndex,end:e.endIndex,text:"\u2026",lineSourceLines:[e.startPosition.row+1]});return}if(A.has(e.type)){let s=de(e);if(s){let u=pe(s,n);t.push({start:s.startIndex,end:s.endIndex,text:u.text,lineSourceLines:u.lineSourceLines});return}}if(q.has(e.type)){let s=e.childForFieldName("value");if(s&&!A.has(s.type)){t.push({start:s.startIndex,end:s.endIndex,text:"\u2026",lineSourceLines:[s.startPosition.row+1]});return}}for(let s of e.namedChildren)$(s,n,t,X.has(e.type),o,r+1)}a($,"collectReplacements");function ue(e){return j.has(e.type)||G.has(e.type)||e.type==="comment"||e.type.startsWith("preproc")}a(ue,"isTopLevelInterfaceNode");function de(e){let n=e.childForFieldName("body");return n||e.namedChildren.find(t=>t.type==="block"||t.type==="compound_statement"||t.type==="statement_block")}a(de,"findBody");function pe(e,n){let t=e.startPosition.row+1,i=e.endPosition.row+1;if(n===".py")return{text:"...",lineSourceLines:[t]};let o=e.text.split(`
9
+ `),r=o[0]??"",c=o.at(-1)??"",s=r.indexOf("{"),u=c.lastIndexOf("}");if(s===-1||u===-1)return{text:"\u2026",lineSourceLines:[t]};if(o.length===1){let p=r.slice(s+1,u);return p.trim()===""?{text:e.text,lineSourceLines:[t]}:{text:r.slice(0,s+1)+C(p)+r.slice(u),lineSourceLines:[t]}}let d=r.slice(s+1),l=c.slice(0,u),f=o.slice(1,-1).some(p=>p.trim()!==""),m=d.trim()!=="",_=l.trim()!=="";if(!f&&!m&&!_)return{text:e.text,lineSourceLines:o.map((p,x)=>t+x)};let g=[],y=[];if(g.push(m?r.slice(0,s+1)+C(d):r),y.push(t),!m&&f){let p=o.slice(1,-1).find(x=>x.trim()!=="")?.match(/^\s*/u)?.[0]??"";g.push(`${p}\u2026`),y.push(void 0)}return g.push(_?C(l)+c.slice(u):c),y.push(i),{text:g.join(`
10
+ `),lineSourceLines:y}}a(pe,"renderBodyPlaceholder");function C(e){let n=/^\s*/u.exec(e)?.[0]??"",t=/\s*$/u.exec(e)?.[0]??"";return`${n}\u2026${t}`}a(C,"maskSegment");export{M as AstOutlineManager,Ie as formatAstOutline,w as isSupportedOutlinePath};
@@ -1 +1 @@
1
- import{a as r}from"./chunk-EI7MMDWY.js";var a="pi-agent-ide-tips",c=1,T="pi-agent-ide-tips/core/ready",f="pi-agent-ide-tips/provider/register";function P(e){return t(e)&&e.protocol===a&&e.apiVersion===c}r(P,"isTipCoreReady");function u(e){return!t(e)||typeof e.accept!="function"||!t(e.provider)?!1:e.provider.protocol===a&&e.provider.apiVersion===c&&typeof e.provider.id=="string"&&e.provider.id.length>0&&typeof e.provider.getTip=="function"}r(u,"isTipProviderRegistrationRequest");function t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(t,"isRecord");function y(e,d){let s=r(()=>{let o,n={provider:d,accept(R){if(o!==void 0)throw new Error(`Tip provider ${d.id} was accepted more than once`);o=R}};return e.events.emit(f,n),o},"announce"),i=r(()=>{},"unsubscribe");i=e.events.on(T,o=>{if(!P(o))throw new Error("Invalid tip core readiness event");let n=s();if(n===void 0)throw new Error("Tip core did not accept the provider");i(),n.catch(()=>{})}),e.on("session_shutdown",i);let p=s();if(p!==void 0)return i(),p}r(y,"connectTipProvider");export{y as a,a as b,c,T as d,f as e,P as f,u as g};
1
+ import{a as r}from"./chunk-EI7MMDWY.js";var a="pi-agent-ide-tips",c=1,T="pi-agent-ide-tips/core/ready",f="pi-agent-ide-tips/provider/register";function P(e){return t(e)&&e.protocol===a&&e.apiVersion===c}r(P,"isTipCoreReady");function u(e){return!t(e)||typeof e.accept!="function"||!t(e.provider)?!1:e.provider.protocol===a&&e.provider.apiVersion===c&&typeof e.provider.id=="string"&&e.provider.id.length>0&&typeof e.provider.getTip=="function"}r(u,"isTipProviderRegistrationRequest");function t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(t,"isRecord");function R(e,d){let s=r(()=>{let o,n={provider:d,accept(y){if(o!==void 0)throw new Error(`Tip provider ${d.id} was accepted more than once`);o=y}};return e.events.emit(f,n),o},"announce"),i=r(()=>{},"unsubscribe");i=e.events.on(T,o=>{if(!P(o))throw new Error("Invalid tip core readiness event");let n=s();if(n===void 0)throw new Error("Tip core did not accept the provider");i(),n.catch(()=>{})}),e.on("session_shutdown",i);let p=s();if(p!==void 0)return i(),p}r(R,"connectTipProvider");export{R as a,a as b,c,T as d,f as e,P as f,u as g};
@@ -0,0 +1 @@
1
+ import{a as g,c as x,d as P}from"./chunk-TOYN4W4F.js";import{a as T}from"./chunk-YJ6T3PEP.js";import{b as E,c as F}from"./chunk-S72FVLUX.js";import{a as w}from"./chunk-ZAWRSA7N.js";import{a as y,b as h}from"./chunk-OFILFO6D.js";import{b,c as j,g as v,i as C,k,m as d,n as R}from"./chunk-IMGIDBCC.js";import{a as f}from"./chunk-EI7MMDWY.js";var A=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".html",".md",".yaml",".yml",".vue",".svelte"],z=[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css",".scss",".less",".html",".htm",".md",".markdown",".mdx",".yaml",".yml",".toml"],p=[e("dart-format",["dart"],["dart"],["pubspec.yaml","analysis_options.yaml"],[".dart"],["dart","format","{file}"],"https://dart.dev/tools/dart-format"),e("zig-format",["zig"],["zig"],["build.zig","build.zig.zon","zls.json"],[".zig",".zon"],["zig","fmt","{file}"],"https://ziglang.org/documentation/master/"),e("styler",["r"],["Rscript"],[".Rprofile","DESCRIPTION"],[".r"],["Rscript","-e","styler::style_file(commandArgs(TRUE)[1])","{file}"],"https://styler.r-lib.org/"),e("clang-format",["c","cpp"],["clang-format"],[".clang-format","_clang-format"],[".c",".h",".cc",".cpp",".cxx",".hh",".hpp",".hxx"],["clang-format","-i","{file}"],"https://clang.llvm.org/docs/ClangFormat.html"),e("prettier",["javascript","typescript","html","css","json","yaml","markdown","vue","svelte"],["prettier"],[".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yaml",".prettierrc.yml",".prettierrc.toml",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs","prettier.config.js","prettier.config.cjs","prettier.config.mjs","prettier.config.ts","prettier.config.mts","prettier.config.cts"],A,["prettier","--write","{file}"],"https://prettier.io/docs/",["prettier"],{"package.json":["prettier"]}),e("biome",["javascript","typescript","json","css"],["biome"],["biome.json","biome.jsonc"],[".js",".jsx",".mjs",".cjs",".ts",".tsx",".mts",".cts",".json",".jsonc",".css"],["biome","format","--write","{file}"],"https://biomejs.dev/",["@biomejs/biome"]),e("oxfmt",["javascript","typescript","json","css","html","markdown","yaml","toml"],["oxfmt"],[".oxfmtrc.json",".oxfmtrc.jsonc","oxfmt.config.ts","oxfmt.config.mts"],z,["oxfmt","--write","{file}"],"https://oxc.rs/docs/guide/usage/formatter.html",["oxfmt"]),e("ruff-format",["python"],["ruff"],["ruff.toml",".ruff.toml"],[".py",".pyi"],["ruff","format","{file}"],"https://docs.astral.sh/ruff/formatter/",["ruff"],{"pyproject.toml":["tool.ruff"]}),e("black",["python"],["black"],[],[".py",".pyi"],["black","--quiet","{file}"],"https://black.readthedocs.io/",["black"],{"pyproject.toml":["tool.black"]}),e("gofmt",["go"],["gofmt"],["go.mod"],[".go"],["gofmt","-w","{file}"],"https://pkg.go.dev/cmd/gofmt"),e("goimports",["go"],["goimports"],["go.mod"],[".go"],["goimports","-w","{file}"],"https://pkg.go.dev/golang.org/x/tools/cmd/goimports"),e("rustfmt",["rust"],["rustfmt"],["rustfmt.toml",".rustfmt.toml","Cargo.toml"],[".rs"],["rustfmt","{file}"],"https://github.com/rust-lang/rustfmt"),e("csharpier",["csharp"],["csharpier"],[".csharpierrc",".csharpierrc.json",".csharpierrc.yaml",".csharpierrc.yml"],[".cs"],["csharpier","format","{file}"],"https://csharpier.com/"),e("google-java-format",["java"],["google-java-format"],["pom.xml","build.gradle"],[".java"],["google-java-format","--replace","{file}"],"https://github.com/google/google-java-format"),e("ktlint-format",["kotlin"],["ktlint"],[".editorconfig","build.gradle.kts"],[".kt",".kts"],["ktlint","-F","{file}"],"https://pinterest.github.io/ktlint/"),e("rubocop-format",["ruby"],["rubocop"],[".rubocop.yml","Gemfile"],[".rb",".rake"],["rubocop","--fix-layout","{file}"],"https://docs.rubocop.org/"),e("pint",["php"],["pint"],["pint.json","composer.json"],[".php"],["pint","{file}"],"https://laravel.com/docs/pint"),e("swift-format",["swift"],["swift-format"],[".swift-format","Package.swift"],[".swift"],["swift-format","format","--in-place","{file}"],"https://github.com/swiftlang/swift-format"),e("stylua",["lua"],["stylua"],["stylua.toml",".stylua.toml"],[".lua"],["stylua","{file}"],"https://github.com/JohnnyMorganz/StyLua"),e("shfmt",["shell"],["shfmt"],[".editorconfig"],[".sh",".bash",".zsh"],["shfmt","-w","{file}"],"https://github.com/mvdan/sh"),e("taplo",["toml"],["taplo"],["taplo.toml"],[".toml"],["taplo","format","{file}"],"https://taplo.tamasfe.dev/"),e("sqlfluff-format",["sql"],["sqlfluff"],[".sqlfluff","pyproject.toml"],[".sql"],["sqlfluff","format","{file}"],"https://docs.sqlfluff.com/"),e("terraform-fmt",["terraform"],["terraform"],[".terraform.lock.hcl"],[".tf",".tfvars"],["terraform","fmt","{file}"],"https://developer.hashicorp.com/terraform/cli/commands/fmt"),e("cmake-format",["cmake"],["cmake-format"],[".cmake-format.py","CMakeLists.txt"],[".cmake"],["cmake-format","-i","{file}"],"https://cmake-format.readthedocs.io/",void 0,void 0,["CMakeLists.txt"]),e("xmlformat",["xml"],["xmlformat"],[".xmlformat.conf"],[".xml",".xsd",".xsl"],["xmlformat","--overwrite","{file}"],"https://github.com/pamoller/xmlformatter"),e("mix-format",["elixir"],["mix"],["mix.exs",".formatter.exs"],[".ex",".exs"],["mix","format","{file}"],"https://hexdocs.pm/mix/Mix.Tasks.Format.html"),e("scalafmt",["scala"],["scalafmt"],[".scalafmt.conf"],[".scala",".sc",".sbt"],["scalafmt","{file}"],"https://scalameta.org/scalafmt/"),e("julia-format",["julia"],["julia"],[".JuliaFormatter.toml","Project.toml"],[".jl"],["julia","--startup-file=no","--history-file=no","-e","using JuliaFormatter; format_file(ARGS[1])","{file}"],"https://github.com/domluna/JuliaFormatter.jl"),e("powershell-format",["powershell"],["pwsh"],["PSScriptAnalyzerSettings.psd1"],[".ps1",".psm1",".psd1"],["pwsh","-NoProfile","-NonInteractive","-CommandWithArgs",'$ErrorActionPreference="Stop";$p=$args[0];$options=@{};if(Test-Path -LiteralPath PSScriptAnalyzerSettings.psd1){$options.Settings="PSScriptAnalyzerSettings.psd1"};[IO.File]::WriteAllText($p,(Invoke-Formatter -ScriptDefinition ([IO.File]::ReadAllText($p)) @options))',"{file}"],"https://learn.microsoft.com/powershell/module/psscriptanalyzer/invoke-formatter"),e("dockfmt",["dockerfile"],["dockfmt"],["Dockerfile","Containerfile"],[".dockerfile"],["dockfmt","fmt","--write","{file}"],"https://github.com/jessfraz/dockfmt",void 0,void 0,["Dockerfile","Containerfile"])];function e(r,t,o,i,a,l,n,s,m,u){return{id:r,name:r,kind:"formatter",languages:t,executables:o,configFiles:i,documentation:n,...s&&{dependencies:s},...m&&{configSections:m},formatter:{extensions:a,...u&&{fileNames:u},run:{command:l},output:"in-place"}}}f(e,"recipe");var c=class r{constructor(t,o,i=new Map){this.formatters=t;this.availableBuiltIns=o;this.evidence=i}static{f(this,"FormatterCommandRegistry")}static async fromDirectory(t,o={}){let i=await v(t,"formatters",s=>R(s).formatters,o),{available:a,evidence:l}=await k(t,i.entries.filter(s=>s.layer==="built-in").map(s=>({id:s.id,config:s.config.run})),p,o),n=[...i.entries].sort((s,m)=>s.layer==="built-in"&&m.layer==="built-in"?(l.get(m.id)?.score??0)-(l.get(s.id)?.score??0):0);return new r(n,a,l)}static fromConfig(t){return new r(Object.entries(t.formatters).map(([o,i])=>({id:o,config:i,layer:"project",sourcePath:"<memory>"})),new Set)}resolve(t,o){return this.resolveEntry(t,o)?.config}resolveEntry(t,o){return C(this.formatters,this.availableBuiltIns,this.evidence,t,o)}get entries(){return this.formatters}};var I={protocol:E,apiVersion:F,id:"formatter",setup(r){for(let t of p)r.addToolRecipe(t);r.addSetupCheck({id:"effective-config",inspect:$}),r.addCheck({id:"config",title:"Formatter",async run(t){try{let o=await c.fromDirectory(t.cwd,g(t)),i=M(o,t.files,t.cwd);return i.length===0?[{status:"skip",message:"No formatter matches the inspected project files"}]:await Promise.all(i.map(async({entry:a,source:l})=>{let n=`${a.id} [${a.layer}] command ${JSON.stringify(a.config.run.command)}`;return P(t,l,async s=>{try{let m=t.workspace?await t.workspace.run(a.config.run,s,t.signal):await d(a.config,{projectRoot:t.cwd,filePath:s,env:t.env});return t.signal?.throwIfAborted(),m.ok?{status:"pass",message:`${n}: probe passed`,detail:a.sourcePath}:{status:"fail",message:`${n}: probe failed`,detail:a.sourcePath}}catch(m){return t.signal?.throwIfAborted(),{status:"fail",message:`${n}: ${m instanceof Error?m.message:String(m)}`,detail:a.sourcePath}}})}))}catch(o){return t.signal?.throwIfAborted(),[{status:"fail",message:o instanceof Error?o.message:String(o)}]}}})}};async function $(r){try{let t=await c.fromDirectory(r.cwd,g(r)),o=[],i=new Map;for(let[a,l]of r.detectedLanguages){let n=l.map(s=>t.resolveEntry(s,r.cwd)).find(s=>s!==void 0);n!==void 0&&(o.push({kind:"formatter",languageId:a,toolId:n.id}),await x(r,n.config.run)||i.set(n.id,{id:`formatter-${n.id}-unavailable`,message:`Configured formatter ${n.id} cannot run ${JSON.stringify(n.config.run.command)}`}))}return{selections:o,actions:[...i.values()]}}catch(t){return r.signal?.throwIfAborted(),{actions:[{id:"formatter-config-invalid",message:`Formatter configuration cannot load: ${t instanceof Error?t.message:String(t)}`}]}}}f($,"inspectFormatterSetup");function M(r,t,o){let i=new Map;for(let a of t){let l=r.resolveEntry(a,o);l!==void 0&&!i.has(l.id)&&i.set(l.id,{entry:l,source:a})}return[...i.values()]}f(M,"applicableFormatters");import _ from"node:path";var S=new Map;function D(r){return{kind:"formatter",name:"formatter",priority:100,extensions:["*"],detect:f(async t=>(r?await r.loadRegistry(t.cwd,!1):await O(t.cwd),!0),"detect"),async format({filePath:t},o){if(!r&&(t.includes("://")||o.cwd.includes("://")))throw Object.assign(new Error("Formatter requires its resource owner"),{code:"UNSUPPORTED_SOURCE"});let i=r?await r.resolveProject(t,o.cwd):await j(o.cwd,t,"formatters",p).then(m=>m===void 0?void 0:{cwd:m,external:m!==_.resolve(o.cwd)});if(i===void 0)return{ok:!0,edits:0,formatter:null};let a=i.cwd,n=(r?await r.loadRegistry(a,i.external):await O(a,i.external)).resolve(t,a);if(n===void 0)return{ok:!0,edits:0,formatter:null};let s=b(n.run.command);if(r){let m=await r.run(n,a,t);return{ok:m.ok,edits:m.changed?1:0,formatter:s}}try{let m=await d(n,{projectRoot:a,filePath:t});return{ok:m.ok,edits:m.changed?1:0,formatter:s}}catch{return{ok:!1,edits:0,formatter:s}}}}}f(D,"createFormatter");async function O(r,t=!1){let o=JSON.stringify([r,t]),i=S.get(o);return i===void 0&&(i=c.fromDirectory(r,{includeGlobal:!t,requireBuiltInEvidence:!0}),S.set(o,i)),i}f(O,"loadRegistry");async function q(r){await N(r)}f(q,"registerFormatter");async function N(r,t){let o=D(t),i={kind:"formatter",name:"pi-agent-ide-formatter",priority:200,extensions:["*"],detect:f(()=>Promise.resolve(!0),"detect"),async format(l,n){return o.format(l,n)}},a={protocol:y,apiVersion:5,id:"formatter",setup(l){l.addTool(i)}};await Promise.all([w(r,a),T(r,I)])}f(N,"registerFormatterWithOwner");export{p as a,c as b,q as c,N as d};
@@ -0,0 +1 @@
1
+ import{a as c}from"./chunk-EI7MMDWY.js";import S from"cross-spawn";import{constants as g}from"node:fs";import{access as x,stat as T}from"node:fs/promises";import d from"node:path";function h(e){let o=process.platform==="win32"?"Scripts":"bin";return["node_modules/.bin",`.venv/${o}`,`venv/${o}`,"vendor/bin"].map(r=>d.resolve(e,r))}c(h,"projectExecutableDirectories");function y(e){return process.platform!=="win32"?{...e}:Object.fromEntries(Object.entries(e).map(([o,r])=>[o.toUpperCase(),r]))}c(y,"normalizeProcessEnvironment");function P(e,o){let r=y(o);return r.PATH=[...h(e),r.PATH].filter(Boolean).join(d.delimiter),r}c(P,"projectProcessEnvironment");async function J(e,o,r,a){a?.throwIfAborted();let n=P(o,r),u=d.isAbsolute(e)||d.dirname(e)!=="."?[d.resolve(o,e)]:(n.PATH??"").split(d.delimiter).filter(Boolean).map(t=>d.join(process.platform==="win32"?t.replace(/^"|"$/gu,""):t,e)),p=process.platform==="win32"?[...new Set((n.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean).flatMap(t=>[t,t.toLowerCase()]))]:[],i=u.flatMap(t=>[t,...p.map(l=>`${t}${l}`)]);for(let t of i){a?.throwIfAborted();try{await x(t,g.X_OK),a?.throwIfAborted();let l=await T(t);if(a?.throwIfAborted(),!l.isFile())continue;return!0}catch{a?.throwIfAborted()}}return!1}c(J,"isExecutableAvailable");function N(e,o,r,a,n){return n?.aborted?Promise.reject(n.reason):new Promise((u,p)=>{let i=S(e,o,{cwd:r,env:P(r,a),stdio:["ignore","pipe","pipe"],windowsHide:!0}),t="",l="",E=!1,v=!1,m,b,f=c(()=>{v||(v=!0,i.kill(),b=setTimeout(()=>i.kill("SIGKILL"),1e3),b.unref())},"stop"),w=setTimeout(()=>{E=!0,f()},5e3);n?.addEventListener("abort",f,{once:!0}),i.stdout?.setEncoding("utf8"),i.stderr?.setEncoding("utf8"),i.stdout?.on("data",s=>t+=s),i.stderr?.on("data",s=>l+=s),i.once("error",s=>{m=s.message}),i.once("close",s=>{if(clearTimeout(w),clearTimeout(b),n?.removeEventListener("abort",f),n?.aborted){p(n.reason);return}if(E){u({ok:!1,detail:`${e} did not respond within 5 seconds`});return}let A=(t.trim()||l.trim()).split(/\r?\n/u)[0];u({ok:m===void 0&&s===0,detail:m??(A||`${e} exited with code ${String(s)}`)})}),n?.aborted&&f(),w.unref()})}c(N,"probeExecutable");export{h as a,y as b,P as c,J as d,N as e};
@@ -0,0 +1 @@
1
+ import{b as n}from"./chunk-BQAKA3FU.js";import{g as s}from"./chunk-4HWKBCBH.js";import{a as o}from"./chunk-EI7MMDWY.js";async function h(r,c,d){try{await r.stop()}catch(t){if(!(t instanceof s)||t.code!=="TRANSPORT_FAILED"||!r.identity)throw t;let e;try{e=await n(c,d,r.pid)}catch(i){throw new AggregateError([t,i],"Owned SSH cleanup could not be reconciled",{cause:i})}if(e===void 0||e.identity!==r.identity)return;throw t}}o(h,"stopOwnedSshProcess");export{h as a};
@@ -0,0 +1 @@
1
+ import{c as h,g as w,m as P}from"./chunk-TGC2ZACO.js";import{a as E,c as T}from"./chunk-DXONCYWF.js";import{a as x}from"./chunk-ZC65Z3CK.js";import{a as o}from"./chunk-EI7MMDWY.js";import{AsyncLocalStorage as S}from"node:async_hooks";var p=new S,m=new S;function C(t){let e=m.getStore();e?e.push(t):t()}o(C,"afterPostEditScope");async function O(t){if(m.getStore())return t();let e=[];try{return await m.run(e,t)}finally{for(let r of e)r()}}o(O,"collectPostEditNotifications");function q(t,e){let r=p.getStore();return r?r.immediate?(r.pending.delete(t),!1):(r.pending.set(t,e),!0):!1}o(q,"deferPostEdit");function D(t){return p.getStore()?.pending.has(t)??!1}o(D,"hasDeferredPostEdit");function F(t){p.getStore()?.pending.delete(t)}o(F,"forgetDeferredPostEdit");function L(t=process.cwd()){let e=new Map;return{run(r,a=!1){return p.run({pending:e,immediate:a},r)},forget(r){e.delete(r)},sources(){return[...e.keys()]},async finish(r,a){let s=[...e];e.clear();let c=[],i=[];if(await O(async()=>{let u=new E,b=await Promise.allSettled(s.map(([g,d])=>u.run(T(g,t,"write"),d)));for(let[g,d]of b.entries()){let y=x(s[g])[0];if(d.status==="rejected"){i.push(d.reason);try{a?.(y,d.reason)}catch(l){i.push(l)}continue}c.push(d.value);try{r?.(d.value)}catch(l){i.push(l);try{a?.(y,l)}catch(k){i.push(k)}}}}),i.length>0)throw new AggregateError(i,`Some final post-processing failed; completed edits remain applied. ${i.map(u=>u instanceof Error?u.message:String(u)).join("; ")}`);return c}}}o(L,"createPostEditScope");import{Type as n}from"typebox";import{Value as f}from"typebox/value";var A=`${h}/post-edit/register`;function $(t){return f.Check(n.Object({formatting:n.Object({status:n.Union(["disabled","unavailable","skipped-syntax","unchanged","changed","failed","not-reported","deferred"].map(e=>n.Literal(e))),formatter:n.Optional(n.String())})}),t)}o($,"isFormattingContribution");function W(t){return f.Check(n.Object({diffStatuses:n.Array(n.Object({text:n.String({minLength:1}),origin:n.Optional(n.Literal("after-edit")),formatter:n.Optional(n.String()),tone:n.Optional(n.Union(["muted","success","warning","error"].map(e=>n.Literal(e))))}))}),t)}o(W,"isDiffStatusContribution");var R=n.Function([],n.Unknown()),v=n.Object({id:n.String({minLength:1}),handler:R}),H=n.Object({registration:v,accept:R});function j(t){return f.Check(v,t)}o(j,"isTextPostEditHandlerRegistration");function B(t){return f.Check(H,t)}o(B,"isTextPostEditHandlerRegistrationRequest");function G(t){if(typeof t!="object"||t===null)return!1;let e=t;return Array.isArray(e.hints)&&typeof e.scopeMarkers=="object"&&e.scopeMarkers!==null&&Array.isArray(e.warnings)}o(G,"isTextMutationResultContributionData");function K(t,e){if(!j(e))throw new TypeError("Invalid text editor post-edit handler registration");let r,a=o(()=>{let c={registration:e,accept(i){if(r!==void 0)throw new Error(`Post-edit handler ${e.id} was accepted more than once`);r=i}};return t.events.emit(A,c),r!==void 0},"announce"),s=o(()=>{},"unsubscribeReady");s=t.events.on(w,c=>{if(!P(c))throw new Error("Invalid pi-agent-text-editor core readiness event");if(!a())throw new Error("pi-agent-text-editor core announced readiness without accepting the post-edit handler");s()}),t.on("session_shutdown",()=>{s(),r?.()}),a()&&s()}o(K,"connectTextEditorPostEditHandler");export{C as a,O as b,q as c,D as d,F as e,L as f,A as g,$ as h,W as i,j,B as k,G as l,K as m};
@@ -0,0 +1,3 @@
1
+ import{a as N,b as B}from"./chunk-VDP5CQHM.js";import{a as O}from"./chunk-47SPPIXK.js";import{a as A,b as k}from"./chunk-VAXLSPPU.js";import{a as $,c as b,e as D,f as _,g as L,h as y,i as H}from"./chunk-OI3HBIPK.js";import{e as I}from"./chunk-YTYLS2UM.js";import{a as z}from"./chunk-YJ6T3PEP.js";import{b as S,c as v}from"./chunk-S72FVLUX.js";import{d as T}from"./chunk-IICJXZBU.js";import{a as C}from"./chunk-BU7IZLKB.js";import{a as P,b as x}from"./chunk-S5PL5DFQ.js";import{F as E,l as W}from"./chunk-DXONCYWF.js";import{e as R}from"./chunk-756K3LJY.js";import{a as i}from"./chunk-EI7MMDWY.js";var M={protocol:S,apiVersion:v,id:"web-browser",setup(r){r.addCheck({id:"system-browser",title:"Browser web reads",async run(e){try{e.signal?.throwIfAborted();let t=e.workspace?await V(e.workspace,e.signal):await R(await N(e.env.PI_AGENT_IDE_BROWSER_PATH,e.env),["--version"],e.cwd,e.env,e.signal);return e.signal?.throwIfAborted(),[t.ok?{status:"pass",message:"Chrome/Chromium is available",detail:t.detail}:{status:"warn",message:"Chrome/Chromium cannot start",detail:t.detail}]}catch(t){return e.signal?.throwIfAborted(),[{status:"warn",message:"Browser reads are unavailable",detail:t instanceof Error?t.message:String(t)}]}}})}};async function V(r,e){if(!r.probeBrowser)throw new Error("Project owner does not provide a browser probe");return r.probeBrowser(e)}i(V,"probeOwnerBrowser");function F(r){return{id:"web",readResources:i(e=>e.path!==void 0&&/^https?:/iu.test(e.path)?[e.path]:[],"readResources"),async tryResolve(e,t){let o=e.path;if(o===void 0||!/^(?:https?:|web:)/iu.test(o))return{kind:"not-handled"};if(e.include!==void 0||e.exclude!==void 0)return{kind:"failed",error:new Error("File include/exclude globs do not apply to a web page.")};let s=q(e),a=await r.tryResolve(o,t);if(a.kind!=="resolved")return a;if(a.resource.read===void 0)return{kind:"failed",error:new Error(`Cannot read ${o}`)};let n=await a.resource.read({signal:t.signal});if(n.some(l=>l.type!=="text"))return{kind:"failed",error:new Error(`Web search requires text content: ${o}`)};let u=n.map(l=>l.type==="text"?l.text:"").join(`
2
+ `),d=[],h=e.limit??50;for(let[l,m]of u.split(/\r\n|\n|\r/u).entries()){t.signal?.throwIfAborted();for(let c of m.matchAll(s)){if(c[0].length===0)continue;let p=c.index,f=p+c[0].length;if(!(e.wholeWord===!0&&(new RegExp("\\p{L}|\\p{N}|_","u").test(m[p-1]??"")||new RegExp("\\p{L}|\\p{N}|_","u").test(m[f]??"")))){if(d.length===h)return{kind:"resolved",payload:{source:o,matches:d,complete:!1}};d.push({source:o,lineNumber:l+1,startColumn:p,endColumn:f,matchedText:c[0],lineText:m})}}}let g=d.length===0&&D(e.query)?U(u,o,e.query,t.signal):void 0;return{kind:"resolved",payload:{source:o,matches:d,complete:!0,...g===void 0?{}:{fuzzy:g}}}},toScriptData(e){let t=e;return{...I(t.matches,t.complete),...t.fuzzy===void 0?{}:{fuzzy:{...t.fuzzy,candidates:t.fuzzy.candidates.map(o=>y(o))}}}},renderResult(e,t,o){let s=e.details;return $(s.matches,s.complete,o,t.expanded,void 0,["Web page \xB7 read-only",...s.complete?[]:["Limit reached \xB7 incomplete results"]])},format(e){let t=e,o=t.matches.length===0?`No matches in ${t.source}`:`${t.matches.length}${t.complete?"":"+"} matches in ${t.source}${t.complete?"":" (limit reached)"}`,s=[o];t.fuzzy?.status==="skipped"&&s.push(`Possible-name fallback skipped: ${t.fuzzy.message}`),t.fuzzy?.candidates.length&&s.push("Possible names \u2014 spelling suggestions, not equivalent behavior.",...t.fuzzy.candidates.map(n=>H(y(n))));let a=Buffer.byteLength(o);for(let n of t.matches){let u=`${t.source}:${n.lineNumber}:${n.startColumn+1} ${j(n)}`;if(a+=Buffer.byteLength(u)+1,a>48*1024){s.push("Output shortened. Narrow the query or lower the limit.");break}s.push(u)}return{content:[{type:"text",text:s.join(`
3
+ `)}],details:t}}}}i(F,"createWebSearchResolver");function U(r,e,t,o){o?.throwIfAborted();let s=performance.now(),a=new _;if(a.addText(r),a.limited)return{status:"skipped",message:"name collection reached its byte or unique-name budget",candidates:[]};let n=[];for(let u of L(t,a.names)){if(o?.throwIfAborted(),performance.now()-s>b.timeoutMs)return{status:"skipped",message:"extra search reached its time budget",candidates:[]};let d=new RegExp(u.identifier.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),"gu"),h=[],g=!0,l=0;e:for(let[m,c]of r.split(/\r\n|\n|\r/u).entries()){if(performance.now()-s>b.timeoutMs)return{status:"skipped",message:"extra search reached its time budget",candidates:[]};o?.throwIfAborted();for(let p of c.matchAll(d)){let f=p.index,w=f+p[0].length;if(!(/[\p{L}\p{N}_$]/u.test(c[f-1]??"")||/[\p{L}\p{N}_$]/u.test(c[w]??""))){if(l+=Buffer.byteLength(c),h.length===b.matchesPerCandidate||l>b.verificationBytes){g=!1;break e}h.push({source:e,lineNumber:m+1,startColumn:f,endColumn:w,matchedText:p[0],lineText:c})}}}h.length>0&&n.push({...u,matches:h,complete:g})}return n.length===0?void 0:{status:"ready",candidates:n}}i(U,"searchFuzzyText");function j(r){let e=Math.max(0,r.startColumn-64),t=Math.min(r.lineText.length,r.startColumn+192);return`${e>0?"\u2026":""}${r.lineText.slice(e,t)}${t<r.lineText.length?"\u2026":""}`}i(j,"previewMatch");function q(r){let e=r.query,t=e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e,o=e.startsWith("regex:")?e.slice(6):t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(o,r.caseSensitive===!0?"gu":"giu")}i(q,"searchPattern");var G={provider:"web",capability:"read"},J=T({kind:"markdown",label:"WEB"});async function Q(r){await K(r)}i(Q,"registerWeb");async function K(r,e){let t=E(r,G),o=B(t,{owner:e?.(t)}),s={protocol:P,apiVersion:x,id:"web",setup(n){n.addResolver({resolver:o,renderResult:J,preserveTruncatedOutput:!0}),n.describe({path:i(()=>W(e?"HTTP(S) URLs use local HTTP/browser execution; web:ssh://target/https://\u2026 explicitly uses the configured target. Web content is read-only. Target browser fallback requires target-installed Node, playwright-core and Chrome/Chromium. Browser reads enable page JavaScript and disable the Chromium sandbox, using a fresh temporary profile.":"HTTP(S) URL \u2014 remote content.",t.listDescriptions()),"path")})}},a={protocol:A,apiVersion:k,id:"web",setup(n){n.addResolver({resolver:F(o),priority:-100}),n.describe("HTTP(S) Search reuses converted page text for zero-result identifier spelling suggestions. Candidate groups carry the URL and line ranges, never editable SEARCH references."),n.addPromptGuideline(e?"Use search with an HTTP(S) path for local web execution or web:ssh://target/https://\u2026 for explicit target execution; no prior read is required.":"Use search with an HTTP(S) path to find text on a web page; no prior read is required.")}};await Promise.all([C(r,s),O(r,a),Promise.resolve(z(r,M))])}i(K,"registerWebWithOwner");export{Q as a,K as b};
@@ -0,0 +1 @@
1
+ import{b as y}from"./chunk-GEMDU6XW.js";import{a as c,g as m}from"./chunk-4HWKBCBH.js";import{q as w}from"./chunk-IMGIDBCC.js";import{a as p}from"./chunk-EI7MMDWY.js";import a from"node:path";async function C(e,f,t,v,h,n){n?.throwIfAborted();let i=c(e.target.id,f).path;if(t&&x(t,i))return{cwd:c(e.target.id,t).source,external:!1};let d=!1;try{d=(await e.stat(i,{signal:n})).kind==="directory"}catch(r){if(!(r instanceof m)||r.code!=="ENOENT")throw r}let g=d?h:h.filter(r=>w(r,i)),T=t===void 0&&x(e.target.workspace,i)?e.target.workspace:void 0,o=d?i:a.posix.dirname(i);for(;;){n?.throwIfAborted();let r=a.posix.join(o,".pi","pi-agent-ide",`${v}.json`),l=!1;try{await e.stat(r,{signal:n}),l=!0}catch(s){if(!(s instanceof m)||s.code!=="ENOENT")throw s}let E=!l&&g.length>0?[...(await y(e,o,g,n)).values()].some(s=>s.score>0):!1;if(l||E||o===T)return{cwd:c(e.target.id,o).source,external:t!==void 0};let u=a.posix.dirname(o);if(u===o)return;o=u}}p(C,"resolveSshToolProject");function x(e,f){let t=a.posix.relative(e,f);return t===""||t!==".."&&!t.startsWith("../")&&!a.posix.isAbsolute(t)}p(x,"inside");export{C as a};
@@ -0,0 +1,2 @@
1
+ import{e as E,f as b}from"./chunk-T7I2VX3J.js";import{d as q}from"./chunk-A64JRDZK.js";import"./chunk-TGC2ZACO.js";import"./chunk-NNCZYO4Q.js";import{d as S}from"./chunk-IICJXZBU.js";import"./chunk-PS2B6THP.js";import{a as T}from"./chunk-BU7IZLKB.js";import{a as N,b as O}from"./chunk-S5PL5DFQ.js";import"./chunk-DXONCYWF.js";import{a as h,b as w,c as P,d as k,e as y,h as I}from"./chunk-DUUOCBS3.js";import"./chunk-T4FTT3U4.js";import"./chunk-ZPT5D4VP.js";import{a as A}from"./chunk-ZAWRSA7N.js";import{a as v,b as C}from"./chunk-OFILFO6D.js";import"./chunk-KINKBPPX.js";import"./chunk-ZC65Z3CK.js";import{a as l}from"./chunk-EI7MMDWY.js";import H from"node:path";var M="diagnostics",L=S({kind:"code-view",label:"Diagnostics"});async function V(r){b(r,[await E({id:"diagnostics",description:"Diagnostic resources, readiness, and verification",triggers:[{tool:"read",resourcePrefixes:["diagnostics:"]}]})]);let n,t=l((c,f,e)=>{if(n===void 0)throw new Error("IDE diagnostics are not connected");return n(c,{cwd:f,...e})},"collect"),i={protocol:v,apiVersion:5,id:"diagnostics",setup(c){n=c.readDiagnostics}},o=new WeakMap,s=new WeakMap,a=new WeakMap,u=new WeakMap,W={protocol:N,apiVersion:O,id:"diagnostics",setup(c){c.addResolver({resolver:j(t,s),renderResult:L});let f=I();c.addView({view:"diagnostics",priority:100,presenter:B(t,u)}),c.addHandler({stage:"read",when:{resolvedBy:"any",contentKind:"text"},handler(e){if(e.state?.resolvedBy==="diagnostics"){let p=e.state.content[0],g=s.get(p);return g&&o.set(e.request,g),f(e)}return e.state?.contentKind==="text"&&e.request.views?.includes("diagnostics")&&a.set(e.request,e.state.text),{kind:"continue",context:e}}}),c.addHandler({stage:"post-read",handler(e){let p=o.get(e.request);if(p&&e.result)return{kind:"continue",context:e,transform:l(d=>({...d,details:{...d.details,diagnosticCheck:p}}),"transform")};let g=a.get(e.request),R=g&&u.get(g),m=e.result,_=m?.content[0];return!R||!m||_?.type!=="text"?{kind:"continue",context:e}:{kind:"continue",context:e,transform(d){let D=d.content[0];return D?.type!=="text"?d:{...d,content:[{...D,text:`${R}
2
+ ${D.text}`},...d.content.slice(1)],details:{...d.details,diagnosticStatus:R}}}}}}),c.describe({path:"diagnostics:<path> \u2014 lint and language-server diagnostics with reporting tool and readiness.",views:"diagnostics \u2014 diagnostics alongside source text, with reporting tool and readiness."})}};await Promise.all([A(r,i),T(r,W)])}l(V,"registerDiagnostics");function j(r,n){return{id:"diagnostics",tryResolve(t,i){return Promise.resolve(x(t,i.cwd,r,n,{signal:i.signal,...i.audience==="script"&&{mode:"complete"}}))}}}l(j,"createDiagnosticResolver");function x(r,n,t,i,o){let s;try{s=h(r,M,n)}catch(a){return{kind:"failed",error:a}}return s===void 0?{kind:"not-handled"}:{kind:"resolved",resource:{source:w(M,s),async read(){let a=await t(s,n,o),u=P(s,a.content,a.results);return i.set(u,u.diagnosticCheck),[u]}}}}l(x,"resolveDiagnosticSource");function B(r,n){return{id:"diagnostics",async present(t,i){if(i.purpose!=="read"||!H.isAbsolute(t.source)&&!t.source.startsWith("ssh://"))return t;let o=i.audience==="script"&&!i.requestedViews?.includes("diagnostics");if(o&&q(t.source))return t;let s=await r(t.source,i.cwd,{signal:i.signal,...i.audience==="script"&&{mode:o?"snapshot":"complete"}}).catch(a=>{if(i.signal?.throwIfAborted(),!o)throw a});if(s===void 0||o&&s.content!==t.content)return t;if(s.content!==t.content)throw new Error("File changed during diagnostic read; read it again for current source lines.");return n.set(t,y(s.results)),k(t,s.results)}}}l(B,"createDiagnosticPresenter");export{V as default};
@@ -0,0 +1,5 @@
1
+ import{b as g,c as y,d as _,e as C,g as k}from"./chunk-57F5GTHO.js";import{a as i}from"./chunk-EI7MMDWY.js";import{truncateToWidth as N,wrapTextWithAnsi as L}from"@earendil-works/pi-tui";var x="PI AGENT IDE",U=/\/[a-z][\w-]*/giu,m=class{constructor(t,n){this.tip=t;this.theme=n}static{i(this,"TipCallout")}cached;render(t){if(this.cached?.width===t)return this.cached.lines;let n=$(this.tip,this.theme,t);return this.cached={width:t,lines:n},n}invalidate(){this.cached=void 0}};function $(e,t,n){if(n<=0)return[];if(n<=2)return[t.fg("accent",n===1?"\u2502":"\u2502 ")];let s=n-2,r=t.fg("accent",t.bold(x))+t.fg("dim"," \xB7 ")+t.bold(e.title),o=e.body.split(`
2
+ `).map(c=>c.length===0?"":z(c,t)),d=[r,...o].flatMap(c=>M(c,s)),a=t.fg("accent","\u2502");return d.map(c=>N(`${a} ${c}`,n))}i($,"renderTip");function M(e,t){return e.length===0?[""]:L(e,t)}i(M,"wrapLine");function z(e,t){let n="",s=0;for(let r of e.matchAll(U)){let o=r.index;n+=t.fg("muted",e.slice(s,o)),n+=t.fg("accent",t.bold(r[0])),s=o+r[0].length}return n+t.fg("muted",e.slice(s))}i(z,"styleBodyLine");var h=class{static{i(this,"TipCore")}providers=new Map;registerProvider(t){if(!/^[a-z0-9][a-z0-9.-]*$/u.test(t.id))return Promise.reject(new Error(`Invalid tip provider ID: ${t.id}`));let n=this.providers.get(t.id);return n!==void 0?n===t?Promise.resolve():Promise.reject(new Error(`Tip provider ${t.id} is already registered`)):(this.providers.set(t.id,t),Promise.resolve())}get isEmpty(){return this.providers.size===0}async collectTips(t){let n=[];for(let s of this.providers.values()){if(t.signal?.aborted)break;try{let r=await V(s,t);r!==void 0&&Y(r)&&n.push({providerId:s.id,tip:r})}catch{}}return n}};async function V(e,t){let n=t.signal;if(n===void 0)return e.getTip(t);if(n.aborted)return;let s=i(()=>{},"abort"),r=new Promise(o=>{s=i(()=>o(void 0),"abort"),n.addEventListener("abort",s,{once:!0})});try{return await Promise.race([e.getTip(t),r])}finally{n.removeEventListener("abort",s)}}i(V,"collectTip");function Y(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.id=="string"&&/^[a-z0-9][a-z0-9.-]*$/u.test(t.id)&&typeof t.title=="string"&&t.title.trim().length>0&&typeof t.body=="string"&&t.body.trim().length>0&&(t.scope===void 0||t.scope==="project"||t.scope==="global")}i(Y,"isTip");import{randomUUID as F}from"node:crypto";import{mkdir as I,readFile as G,rename as H,rm as S,stat as J,writeFile as K}from"node:fs/promises";import{setTimeout as W}from"node:timers/promises";import{homedir as B}from"node:os";import f from"node:path";var O=1,Q=10,X=5e3,q=6e4,p=Promise.resolve();function Z(e=process.env){let t=e.PI_CODING_AGENT_DIR??f.join(B(),".pi","agent");return f.join(t,"pi-agent-ide","tips.json")}i(Z,"resolveTipStatePath");var P=class{constructor(t=Z()){this.statePath=t}static{i(this,"TipStateStore")}async shownFor(t){let n=await T(this.statePath);return new Set(w(n,t))}async claimIfUnseen(t,n,s){let r=p.then(async()=>{try{return await v(this.statePath,async()=>{let o=await T(this.statePath),d=new Set(w(o,t));return d.has(n)||s!==void 0&&d.has(s)?!1:(d.add(n),await E(this.statePath,b(o,t,[...d])),!0)})}catch{return!0}});return p=r.then(()=>{},()=>{}),r}async markShown(t,n){if(n.length===0)return;p=p.then(async()=>{await v(this.statePath,async()=>{let r=await T(this.statePath),o=new Set(w(r,t));for(let d of n)o.add(d);await E(this.statePath,b(r,t,[...o]))})}).catch(()=>{}),await p}async unmarkShown(t,n){p=p.then(async()=>{try{await v(this.statePath,async()=>{let r=await T(this.statePath),o=new Set(w(r,t));o.delete(n)&&await E(this.statePath,b(r,t,[...o]))})}catch{}}).catch(()=>{}),await p}};function w(e,t){return t===void 0?e.global??[]:e.projects[t]??[]}i(w,"shownIds");function b(e,t,n){return t===void 0?{...e,global:n}:{...e,projects:{...e.projects,[t]:n}}}i(b,"withShown");function j(e){return f.resolve(e)}i(j,"normalizeProjectPath");async function T(e){try{let t=JSON.parse(await G(e,"utf8"));return et(t)?t:R()}catch{return R()}}i(T,"readState");async function v(e,t){let n=`${e}.lock`;await I(f.dirname(e),{recursive:!0});let s=Date.now();for(;;)try{await I(n);break}catch(r){if(tt(r)!=="EEXIST")throw r;try{if(Date.now()-(await J(n)).mtimeMs>q){await S(n,{recursive:!0,force:!0});continue}}catch{}if(Date.now()-s>=X)throw new Error(`Timed out waiting for startup-tip state lock: ${n}`,{cause:r});await W(Q)}try{return await t()}finally{await S(n,{recursive:!0,force:!0})}}i(v,"withStateLock");function tt(e){return typeof e=="object"&&e!==null&&"code"in e?String(e.code):void 0}i(tt,"errorCode");async function E(e,t){try{await I(f.dirname(e),{recursive:!0});let n=`${e}.${process.pid}.${F()}.tmp`;try{await K(n,`${JSON.stringify(t,null,2)}
3
+ `,"utf8"),await H(n,e)}finally{await S(n,{force:!0})}}catch{}}i(E,"writeState");function R(){return{version:O,projects:{}}}i(R,"emptyState");function et(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e;return t.version!==O||typeof t.projects!="object"||t.projects===null||Array.isArray(t.projects)||t.global!==void 0&&(!Array.isArray(t.global)||!t.global.every(n=>typeof n=="string"))?!1:Object.values(t.projects).every(n=>Array.isArray(n)&&n.every(s=>typeof s=="string"))}i(et,"isState");function D(e){return{protocol:g,apiVersion:y,id:"agent-setup",getTip(t){if(!(t.mode!=="tui"||!t.hasUI||!e()))return{id:"agent-setup-v1",scope:"global",title:"Agent-assisted setup",body:`You can ask your agent to configure Pi Agent IDE.
4
+ Try: \u201CHelp me configure Pi Agent IDE for this project.\u201D
5
+ Or open /agent-ide-settings.`}}}}i(D,"createSetupHintProvider");var A="pi-agent-ide-startup-tip";async function nt(e){let t=new h,n=D(()=>e.getCommands().some(a=>a.source==="skill"&&a.name==="skill:configure-agent-ide"));await t.registerProvider(n),e.getFlag("pi-agent-ide-developer-mode")===!0&&e.registerCommand("agent-ide-tip",{description:"Show the Agent IDE setup hint again without resetting its one-time state",async handler(a,u){if(u.mode!=="tui"||!u.hasUI)return;let c=await n.getTip({cwd:u.cwd,mode:u.mode,hasUI:u.hasUI,signal:u.signal,reason:"startup"});c?e.appendEntry(A,c):u.ui.notify("The Agent IDE setup skill is not available in this session.","info")}});let s=new P;e.registerEntryRenderer(A,(a,u,c)=>{let l=a.data;if(!(typeof l.title!="string"||typeof l.body!="string"))return new m({title:l.title,body:l.body},c)});let r=e.events.on(C,a=>{if(!k(a))throw new Error("Invalid tip provider registration request");a.accept(t.registerProvider(a.provider))});e.on("session_shutdown",r);let o,d=Promise.resolve();e.on("session_start",(a,u)=>{o?.abort(),o=new AbortController;let c=o.signal;d=d.then(()=>rt(e,t,s,a.reason,u,c)).catch(()=>{})}),e.on("session_shutdown",async()=>{o?.abort(),await d}),e.events.emit(_,{protocol:g,apiVersion:y})}i(nt,"registerTips");async function rt(e,t,n,s,r,o){if(r.mode!=="tui"||(o.throwIfAborted(),t.isEmpty))return;let d=await t.collectTips({cwd:r.cwd,mode:r.mode,hasUI:r.hasUI,signal:o,reason:s});if(o.throwIfAborted(),d.length!==0)for(let a of d){let u=a.tip.scope==="global"?void 0:j(r.cwd),c=it(a.providerId,a.tip.id);if(await n.claimIfUnseen(u,c,a.tip.id)){if(o.aborted){await n.unmarkShown(u,c);return}try{e.appendEntry(A,a.tip);return}catch(l){throw await n.unmarkShown(u,c),l}}}}i(rt,"displayTip");function it(e,t){return JSON.stringify([e,t])}i(it,"tipIdentity");export{nt as default};
@@ -0,0 +1 @@
1
+ import{g as a}from"./chunk-4HWKBCBH.js";import{a as c}from"./chunk-EI7MMDWY.js";import{readFile as l}from"node:fs/promises";import{Type as t}from"typebox";import{Value as p}from"typebox/value";var m=t.Object({pid:t.Integer({minimum:1}),parentPid:t.Integer({minimum:0}),command:t.String(),started:t.String(),identity:t.String({pattern:"^[a-f0-9-]+:[0-9]+$"}),executable:t.Union([t.String(),t.Null()])}),w=t.Object({processes:t.Array(m)}),f;async function P(i,n,r,o){return h(i,n,r,o,!1)}c(P,"readSshProcessMetadata");async function E(i,n,r,o){return(await h(i,n,r,o,!0))[0]}c(E,"findSshProcessMetadata");async function h(i,n,r,o,u){if(o?.throwIfAborted(),r!==void 0&&(!Number.isSafeInteger(r)||r<1))throw new Error("Invalid process PID");let d=i.resolve(n);if(!d)throw new a("UNSUPPORTED_SOURCE",n,"not-applied");f??=l(new URL("./process-metadata-worker.py",new URL("../src/backend/process-metadata.ts",import.meta.url).href),"utf8");let S=await d.backend.execute("python3",["-c",await f,...r===void 0?[]:[String(r)]],d.location.path,{signal:o});if(o?.throwIfAborted(),S.exitCode!==0)throw new a("CAPABILITY_UNAVAILABLE",n,"not-applied");let e;try{e=JSON.parse(S.stdout.toString("utf8"))}catch{throw new a("INVALID_RESPONSE",n,"not-applied")}if(typeof e=="object"&&e!==null&&"error"in e){if(u&&r!==void 0&&e.error==="ENOENT")return[];let s=new Set(["CAPABILITY_UNAVAILABLE","ENOENT","EACCES","BYTE_LIMIT"]);throw new a(typeof e.error=="string"&&s.has(e.error)?e.error:"INVALID_RESPONSE",n,"not-applied")}if(!p.Check(w,e)||r!==void 0&&(e.processes.length!==1||e.processes[0]?.pid!==r)||new Set(e.processes.map(s=>s.pid)).size!==e.processes.length)throw new a("INVALID_RESPONSE",n,"not-applied");return e.processes.map(s=>({...s,target:d.location.target,host:"ssh",owned:!1,resource:`process:ssh://${d.location.target}/${s.pid}`}))}c(h,"readSshProcessRows");export{P as a,E as b};