pi-agent-ide 0.7.0 → 0.7.2

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 (323) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/chunk-6U5OU77O.js +3 -0
  3. package/dist/{chunk-6CZO43OH.js → chunk-BU7IZLKB.js} +1 -1
  4. package/dist/chunk-EURHXLN3.js +2 -0
  5. package/dist/{chunk-PYPPV2F5.js → chunk-F6IWZKOG.js} +6 -6
  6. package/dist/{chunk-GBLKIB6O.js → chunk-H445SHSJ.js} +2 -2
  7. package/dist/chunk-IG56UGSO.js +2 -0
  8. package/dist/chunk-IICJXZBU.js +6 -0
  9. package/dist/{chunk-XYS4FSCC.js → chunk-IM24DB3K.js} +1 -1
  10. package/dist/{chunk-YRF7OATP.js → chunk-KOVPDKSJ.js} +1 -1
  11. package/dist/chunk-MXLSGMRZ.js +3 -0
  12. package/dist/chunk-NRZO5KJT.js +9 -0
  13. package/dist/chunk-OB46OPMZ.js +1 -0
  14. package/dist/chunk-PKSQT6TC.js +1 -0
  15. package/dist/{chunk-PNU3E7IO.js → chunk-Q6CZ6GBR.js} +2 -2
  16. package/dist/{chunk-EDURPQAV.js → chunk-QRJLIV6P.js} +6 -6
  17. package/dist/chunk-QUYXINGZ.js +7 -0
  18. package/dist/{chunk-OBNING2A.js → chunk-S5PL5DFQ.js} +1 -1
  19. package/dist/chunk-SBP3ABH4.js +5 -0
  20. package/dist/{chunk-FXNKMNSJ.js → chunk-SJ4UZ4GU.js} +1 -1
  21. package/dist/chunk-SNF7PDDX.js +11 -0
  22. package/dist/{chunk-AJRIASPQ.js → chunk-STBJO3Z3.js} +1 -1
  23. package/dist/{chunk-3HYXQ4YA.js → chunk-TQGE7RH6.js} +13 -13
  24. package/dist/{chunk-S5LXX32D.js → chunk-XDG7EQRN.js} +3 -3
  25. package/dist/{chunk-F5YZG77W.js → chunk-XH5WN5XA.js} +1 -1
  26. package/dist/chunk-YWQS33DF.js +1 -0
  27. package/dist/chunk-ZIWPKIBZ.js +1 -0
  28. package/dist/entry-11.js +1 -1
  29. package/dist/entry-13.js +1 -1
  30. package/dist/entry-14.js +1 -1
  31. package/dist/entry-15.js +1 -1
  32. package/dist/entry-17.js +1 -1
  33. package/dist/entry-25.js +2 -2
  34. package/dist/entry-26.js +1 -1
  35. package/dist/entry-27.js +2 -2
  36. package/dist/entry-28.js +1 -1
  37. package/dist/entry-29.js +1 -1
  38. package/dist/entry-31.js +15 -13
  39. package/dist/entry-33.js +2 -1
  40. package/dist/entry-37.js +6 -6
  41. package/dist/entry-41.js +1 -1
  42. package/dist/entry-42.js +1 -1
  43. package/dist/entry-43.js +1 -1
  44. package/dist/entry-44.js +1 -1
  45. package/dist/entry-45.js +20 -13
  46. package/dist/entry-46.js +1 -1
  47. package/dist/entry-49.js +1 -1
  48. package/dist/entry-50.js +1 -1
  49. package/dist/entry-51.js +8 -7
  50. package/dist/entry-52.js +1 -1
  51. package/dist/entry-53.js +1 -1
  52. package/dist/entry-54.js +1 -1
  53. package/dist/entry-56.js +1 -1
  54. package/dist/entry-57.js +1 -1
  55. package/dist/entry-58.js +1 -1
  56. package/dist/entry-60.js +1 -1
  57. package/dist/entry-62.js +1 -1
  58. package/dist/entry-65.js +1 -1
  59. package/dist/entry-66.js +1 -1
  60. package/dist/entry-68.js +1 -1
  61. package/dist/entry-70.js +1 -1
  62. package/dist/entry-75.js +1 -1
  63. package/dist/entry-77.js +51 -43
  64. package/dist/entry-78.js +14 -14
  65. package/dist/entry-79.js +1 -1
  66. package/dist/entry-80.js +1 -1
  67. package/dist/entry-82.js +5 -5
  68. package/dist/entry-83.js +1 -1
  69. package/dist/entry-84.js +1 -1
  70. package/dist/entry-85.js +1 -1
  71. package/dist/entry-86.js +1 -1
  72. package/dist/pi-agent-ide.js +37 -9
  73. package/docs/agent-guides/editing.md +35 -46
  74. package/docs/agent-guides/git-changes.md +10 -0
  75. package/docs/agent-guides/read-resources.md +9 -50
  76. package/docs/agent-guides/search-code.md +18 -17
  77. package/docs/agent-guides/select-code.md +62 -140
  78. package/docs/agent-guides/terminal.md +9 -1
  79. package/docs/configuration.md +1 -1
  80. package/docs/releases.md +4 -0
  81. package/docs/research/native-codemode-batch-decision.md +2 -0
  82. package/docs/structured-results.md +27 -62
  83. package/docs/tools.md +15 -11
  84. package/node_modules/pi-agent-doctor/package.json +1 -1
  85. package/node_modules/pi-agent-documentation/package.json +1 -1
  86. package/node_modules/pi-agent-filesystem/index.ts +7 -6
  87. package/node_modules/pi-agent-filesystem/package.json +7 -7
  88. package/node_modules/pi-agent-filesystem-image/package.json +3 -3
  89. package/node_modules/pi-agent-filesystem-jq/index.ts +4 -3
  90. package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
  91. package/node_modules/pi-agent-filesystem-jq/src/jq.ts +4 -1
  92. package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
  93. package/node_modules/pi-agent-filesystem-text/package.json +3 -3
  94. package/node_modules/pi-agent-ide-ast/package.json +13 -13
  95. package/node_modules/pi-agent-ide-ast/src/extension.ts +5 -4
  96. package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  97. package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +35 -9
  98. package/node_modules/pi-agent-ide-ast/src/select-presentation.ts +1 -1
  99. package/node_modules/pi-agent-ide-ast/src/select-schema.ts +10 -8
  100. package/node_modules/pi-agent-ide-ast/src/tool-select.ts +28 -3
  101. package/node_modules/pi-agent-ide-changes/index.ts +4 -3
  102. package/node_modules/pi-agent-ide-changes/package.json +8 -8
  103. package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  104. package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  105. package/node_modules/pi-agent-ide-formatter/package.json +3 -3
  106. package/node_modules/pi-agent-ide-languages/package.json +2 -2
  107. package/node_modules/pi-agent-ide-lint/package.json +7 -7
  108. package/node_modules/pi-agent-ide-lsp/index.ts +3 -3
  109. package/node_modules/pi-agent-ide-lsp/package.json +9 -9
  110. package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
  111. package/node_modules/pi-agent-image/package.json +2 -2
  112. package/node_modules/pi-agent-invariant/package.json +1 -1
  113. package/node_modules/pi-agent-pdf/package.json +2 -2
  114. package/node_modules/pi-agent-read/package.json +7 -7
  115. package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  116. package/node_modules/pi-agent-read/src/api/read-parameters.ts +38 -1
  117. package/node_modules/pi-agent-read/src/api/tools/read.ts +18 -1
  118. package/node_modules/pi-agent-read/src/core/extension.ts +8 -2
  119. package/node_modules/pi-agent-read/src/core/read-core.ts +54 -35
  120. package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  121. package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  122. package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  123. package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  124. package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
  125. package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +108 -46
  126. package/node_modules/pi-agent-resource/package.json +1 -1
  127. package/node_modules/pi-agent-resource/src/index.ts +1 -0
  128. package/node_modules/pi-agent-resource/src/result-targets.ts +186 -9
  129. package/node_modules/{pi-agent-read/src/core/tools/read → pi-agent-resource/src}/temp-resource-store.ts +17 -7
  130. package/node_modules/pi-agent-resource/src/tool-result.ts +13 -1
  131. package/node_modules/pi-agent-search/package.json +5 -5
  132. package/node_modules/pi-agent-search/src/api/fuzzy.ts +5 -1
  133. package/node_modules/pi-agent-search/src/api/search-parameters.ts +3 -3
  134. package/node_modules/pi-agent-search/src/core/extension.ts +2 -1
  135. package/node_modules/pi-agent-search/src/core/search-core.ts +13 -4
  136. package/node_modules/pi-agent-search-text/index.ts +1 -1
  137. package/node_modules/pi-agent-search-text/package.json +7 -7
  138. package/node_modules/pi-agent-search-text/src/resolvers.ts +11 -1
  139. package/node_modules/pi-agent-search-text/src/scoped-search.ts +1 -1
  140. package/node_modules/pi-agent-search-text/src/search-presentation.ts +42 -32
  141. package/node_modules/pi-agent-search-text/src/search-recipe.ts +1 -1
  142. package/node_modules/pi-agent-search-text/src/search-renderer.ts +6 -0
  143. package/node_modules/pi-agent-search-text/src/search-result.ts +17 -3
  144. package/node_modules/pi-agent-text/package.json +2 -2
  145. package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
  146. package/node_modules/pi-agent-text-anchor-exact/index.ts +65 -4
  147. package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
  148. package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  149. package/node_modules/pi-agent-text-anchor-line-hash/index.ts +4 -3
  150. package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
  151. package/node_modules/pi-agent-text-editor/package.json +9 -9
  152. package/node_modules/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  153. package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
  154. package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  155. package/node_modules/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  156. package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  157. package/node_modules/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  158. package/node_modules/pi-agent-text-editor/src/core/extension.ts +10 -3
  159. package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +3 -13
  160. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  161. package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  162. package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  163. package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
  164. package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  165. package/node_modules/pi-agent-text-editor/src/core/result-input.ts +24 -4
  166. package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  167. package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +49 -214
  168. package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  169. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  170. package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  171. package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  172. package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
  173. package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  174. package/node_modules/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
  175. package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
  176. package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  177. package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  178. package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  179. package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  180. package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  181. package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
  182. package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  183. package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  184. package/node_modules/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  185. package/node_modules/pi-agent-text-editor-stale-anchor/package.json +4 -4
  186. package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
  187. package/node_modules/pi-agent-tool-call-interception/src/index.ts +3 -0
  188. package/node_modules/pi-agent-tool-ui/package.json +1 -1
  189. package/node_modules/pi-agent-web/index.ts +4 -3
  190. package/node_modules/pi-agent-web/package.json +7 -7
  191. package/node_modules/pi-agent-web/src/resolver.ts +11 -13
  192. package/node_modules/pi-agent-web-html/package.json +2 -2
  193. package/node_modules/pi-agent-web-image/package.json +3 -3
  194. package/node_modules/pi-agent-web-pdf/package.json +3 -3
  195. package/node_modules/pi-agent-web-text/package.json +3 -3
  196. package/package.json +35 -35
  197. package/src/composite/nested-tool-rendering.ts +64 -6
  198. package/src/composite/output-limits.ts +125 -0
  199. package/src/composite/responses-tools.ts +25 -0
  200. package/src/composite/text-results.ts +372 -0
  201. package/src/documentation/extension.ts +11 -9
  202. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +7 -6
  203. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
  204. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
  205. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +4 -3
  206. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
  207. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/jq.ts +4 -1
  208. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
  209. package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
  210. package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +4 -3
  211. package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
  212. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
  213. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
  214. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
  215. package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
  216. package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +11 -13
  217. package/src/extensions/pi-agent-read/package.json +7 -7
  218. package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
  219. package/src/extensions/pi-agent-read/src/api/read-parameters.ts +38 -1
  220. package/src/extensions/pi-agent-read/src/api/tools/read.ts +18 -1
  221. package/src/extensions/pi-agent-read/src/core/extension.ts +8 -2
  222. package/src/extensions/pi-agent-read/src/core/read-core.ts +54 -35
  223. package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +91 -18
  224. package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +8 -2
  225. package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +38 -1
  226. package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +57 -2
  227. package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +3 -3
  228. package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +108 -46
  229. package/src/extensions/pi-agent-search/package.json +5 -5
  230. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +1 -1
  231. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +7 -7
  232. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +11 -1
  233. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +1 -1
  234. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +42 -32
  235. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +1 -1
  236. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +6 -0
  237. package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +17 -3
  238. package/src/extensions/pi-agent-search/src/api/fuzzy.ts +5 -1
  239. package/src/extensions/pi-agent-search/src/api/search-parameters.ts +3 -3
  240. package/src/extensions/pi-agent-search/src/core/extension.ts +2 -1
  241. package/src/extensions/pi-agent-search/src/core/search-core.ts +13 -4
  242. package/src/extensions/pi-agent-text-editor/package.json +9 -9
  243. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
  244. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +65 -4
  245. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
  246. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +12 -2
  247. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +4 -3
  248. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
  249. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
  250. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +11 -0
  251. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +54 -5
  252. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/status-summary.ts +18 -3
  253. package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +4 -4
  254. package/src/extensions/pi-agent-text-editor/src/api/edit-completion.ts +2 -2
  255. package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +2 -1
  256. package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +4 -0
  257. package/src/extensions/pi-agent-text-editor/src/api/stale-anchor-message.ts +1 -1
  258. package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +54 -12
  259. package/src/extensions/pi-agent-text-editor/src/core/editing-guidelines.ts +1 -1
  260. package/src/extensions/pi-agent-text-editor/src/core/extension.ts +10 -3
  261. package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +3 -13
  262. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +35 -6
  263. package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-result.ts +19 -1
  264. package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +132 -11
  265. package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +232 -144
  266. package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +34 -10
  267. package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +24 -4
  268. package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +7 -2
  269. package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +49 -214
  270. package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +5 -1
  271. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +152 -22
  272. package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -0
  273. package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +76 -32
  274. package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +409 -209
  275. package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +1 -1
  276. package/src/extensions/pi-agent-text-editor/src/tools/text-tool-schema-properties.ts +6 -9
  277. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +10 -3
  278. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +9 -4
  279. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +7 -8
  280. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +1 -1
  281. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +3 -4
  282. package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +10 -4
  283. package/src/pi-agent-ide.ts +15 -1
  284. package/src/plugins/pi-agent-ide-ast/package.json +13 -13
  285. package/src/plugins/pi-agent-ide-ast/src/extension.ts +5 -4
  286. package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +2 -2
  287. package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +35 -9
  288. package/src/plugins/pi-agent-ide-ast/src/select-presentation.ts +1 -1
  289. package/src/plugins/pi-agent-ide-ast/src/select-schema.ts +10 -8
  290. package/src/plugins/pi-agent-ide-ast/src/tool-select.ts +28 -3
  291. package/src/plugins/pi-agent-ide-changes/index.ts +4 -3
  292. package/src/plugins/pi-agent-ide-changes/package.json +8 -8
  293. package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +66 -4
  294. package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +8 -11
  295. package/src/plugins/pi-agent-ide-debugger/index.ts +22 -10
  296. package/src/plugins/pi-agent-ide-debugger/src/dap-client.ts +5 -0
  297. package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +93 -38
  298. package/src/plugins/pi-agent-ide-diagnostics/src/extension.ts +6 -3
  299. package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
  300. package/src/plugins/pi-agent-ide-languages/package.json +2 -2
  301. package/src/plugins/pi-agent-ide-lint/package.json +7 -7
  302. package/src/plugins/pi-agent-ide-lsp/index.ts +3 -3
  303. package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
  304. package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +5 -2
  305. package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +3 -3
  306. package/src/plugins/pi-agent-ide-terminal/src/resources.ts +8 -6
  307. package/src/plugins/pi-agent-ide-terminal/src/tools.ts +3 -3
  308. package/src/plugins/pi-agent-ide-vision/index.ts +13 -4
  309. package/src/post-edit/gate.ts +13 -2
  310. package/dist/chunk-3JO7QFIL.js +0 -1
  311. package/dist/chunk-4NIFBFFR.js +0 -11
  312. package/dist/chunk-64M3SQPG.js +0 -3
  313. package/dist/chunk-7LZKOHH2.js +0 -1
  314. package/dist/chunk-EAZGN5ND.js +0 -7
  315. package/dist/chunk-FK42RSF4.js +0 -1
  316. package/dist/chunk-KBP3QUDT.js +0 -2
  317. package/dist/chunk-KR36BT5E.js +0 -1
  318. package/dist/chunk-MBUXFKIW.js +0 -3
  319. package/dist/chunk-OE7QVAI2.js +0 -5
  320. package/dist/chunk-SILJ3OL4.js +0 -9
  321. package/dist/chunk-SQKAXYIR.js +0 -2
  322. package/dist/chunk-VCGNVTXQ.js +0 -1
  323. package/src/extensions/pi-agent-read/src/core/tools/read/temp-resource-store.ts +0 -105
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pi-agent-ide-formatter",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.7.0"
6
+ "pi-agent-doctor": "0.7.2"
7
7
  },
8
8
  "pi": {
9
9
  "extensions": [
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "peerDependencies": {
14
14
  "@earendil-works/pi-coding-agent": "*",
15
- "pi-agent-ide": "0.7.0"
15
+ "pi-agent-ide": "0.7.2"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "pi-agent-ide": {
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pi-agent-ide-languages",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.7.0"
6
+ "pi-agent-doctor": "0.7.2"
7
7
  },
8
8
  "pi": {
9
9
  "extensions": [
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-agent-ide-lint",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
- "pi-agent-doctor": "0.7.0",
7
- "pi-agent-invariant": "0.7.0",
8
- "pi-agent-read": "0.7.0",
9
- "pi-agent-resource": "0.7.0",
10
- "pi-agent-text": "0.7.0"
6
+ "pi-agent-doctor": "0.7.2",
7
+ "pi-agent-invariant": "0.7.2",
8
+ "pi-agent-read": "0.7.2",
9
+ "pi-agent-resource": "0.7.2",
10
+ "pi-agent-text": "0.7.2"
11
11
  },
12
12
  "pi": {
13
13
  "extensions": [
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@earendil-works/pi-coding-agent": "*",
19
- "pi-agent-ide": "0.7.0"
19
+ "pi-agent-ide": "0.7.2"
20
20
  },
21
21
  "peerDependenciesMeta": {
22
22
  "pi-agent-ide": {
@@ -112,9 +112,9 @@ export default async function registerLsp(pi: ExtensionAPI): Promise<void> {
112
112
  when: { resolvedBy: "any", contentKind: "text" },
113
113
  handler: createSourceMappedTextReadHandler(),
114
114
  });
115
- api.describe(
116
- "symbol:<file>#<selector> — declaration source, e.g. symbol:src/catalog.ts#Catalog/find. graph:<file> — top-level declarations, references and calls; members include selectors. graph:<file>#<selector> — references and incoming/outgoing calls for that declaration or member.",
117
- );
115
+ api.describe({
116
+ path: "symbol:<file>#<selector> — declaration source, e.g. symbol:src/catalog.ts#Catalog/find. graph:<file> — top-level declarations, references and calls; members include selectors. graph:<file>#<selector> — references and incoming/outgoing calls for that declaration or member.",
117
+ });
118
118
  },
119
119
  } satisfies ReadPlugin;
120
120
 
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "pi-agent-ide-lsp",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "cross-spawn": "^7.0.6",
7
- "pi-agent-doctor": "0.7.0",
8
- "pi-agent-invariant": "0.7.0",
9
- "pi-agent-read": "0.7.0",
10
- "pi-agent-resource": "0.7.0",
11
- "pi-agent-search": "0.7.0",
12
- "pi-agent-text": "0.7.0",
13
- "pi-agent-text-editor": "0.7.0",
7
+ "pi-agent-doctor": "0.7.2",
8
+ "pi-agent-invariant": "0.7.2",
9
+ "pi-agent-read": "0.7.2",
10
+ "pi-agent-resource": "0.7.2",
11
+ "pi-agent-search": "0.7.2",
12
+ "pi-agent-text": "0.7.2",
13
+ "pi-agent-text-editor": "0.7.2",
14
14
  "vscode-jsonrpc": "^9.0.0",
15
15
  "vscode-uri": "^3.1.0"
16
16
  },
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@earendil-works/pi-coding-agent": "*",
24
- "pi-agent-ide": "0.7.0"
24
+ "pi-agent-ide": "0.7.2"
25
25
  },
26
26
  "peerDependenciesMeta": {
27
27
  "pi-agent-ide": {
@@ -52,6 +52,7 @@ export function createLspSearchResolver(
52
52
  payload: {
53
53
  query,
54
54
  hits: found.hits,
55
+ sessionId: session.id,
55
56
  complete: found.complete,
56
57
  navigation: request.navigation,
57
58
  data: {
@@ -87,6 +88,7 @@ export function createLspSearchResolver(
87
88
  format(payload, context) {
88
89
  const result = payload as {
89
90
  readonly query: string;
91
+ readonly sessionId: string;
90
92
  readonly hits: readonly SymbolHit[];
91
93
  readonly complete: boolean;
92
94
  readonly navigation?: "references";
@@ -102,9 +104,10 @@ export function createLspSearchResolver(
102
104
  .slice(0, 100)
103
105
  .map(
104
106
  (hit, index) =>
105
- `${String(index + 1)}. ${path.relative(context.cwd, hit.source)}:${String(hit.lineNumber)}:${String(hit.startColumn + 1)} ${hit.role} ${hit.symbol.name}`,
107
+ `SEARCH#${result.sessionId}:${index + 1}:match ${path.relative(context.cwd, hit.source)}:${hit.lineNumber}:${hit.startColumn + 1} ${hit.role} ${hit.symbol.name} · declared at ${path.relative(context.cwd, hit.symbol.source)}:${hit.symbol.range.startLine}:${hit.symbol.range.startColumn + 1}`,
106
108
  );
107
- if (!result.complete) lines.push("Incomplete results; not a complete edit scope.");
109
+ if (result.complete && result.hits.length)
110
+ lines.unshift(`SEARCH#${result.sessionId}:all:match selects all exact symbol matches.`);
108
111
  if (result.hits.length > 100) lines.push("Preview shortened; full source targets retained.");
109
112
  return {
110
113
  content: [{ type: "text", text: [heading, ...lines].join("\n") }],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-image",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -10,7 +10,7 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "pi-agent-resource": "0.7.0"
13
+ "pi-agent-resource": "0.7.2"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@earendil-works/pi-coding-agent": "*"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-invariant",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-pdf",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "types": "./src/index.ts",
6
6
  "exports": {
@@ -11,6 +11,6 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "pdfjs-dist": "^6.2.108",
14
- "pi-agent-resource": "0.7.0"
14
+ "pi-agent-resource": "0.7.2"
15
15
  }
16
16
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-read",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "#src/*": "./src/*"
@@ -24,12 +24,12 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "pi-agent-documentation": "0.7.0",
28
- "pi-agent-invariant": "0.7.0",
29
- "pi-agent-resource": "0.7.0",
30
- "pi-agent-text": "0.7.0",
31
- "pi-agent-tool-call-interception": "0.7.0",
32
- "pi-agent-tool-ui": "0.7.0"
27
+ "pi-agent-documentation": "0.7.2",
28
+ "pi-agent-invariant": "0.7.2",
29
+ "pi-agent-resource": "0.7.2",
30
+ "pi-agent-text": "0.7.2",
31
+ "pi-agent-tool-call-interception": "0.7.2",
32
+ "pi-agent-tool-ui": "0.7.2"
33
33
  },
34
34
  "pi": {
35
35
  "extensions": [
@@ -5,7 +5,7 @@ import type { ReadToolPluginApi } from "#src/api/tools/read.js";
5
5
 
6
6
  export const READ_PROTOCOL = "pi-agent-read";
7
7
 
8
- export const READ_API_VERSION = 13;
8
+ export const READ_API_VERSION = 14;
9
9
 
10
10
  export const READ_CORE_READY_EVENT = `${READ_PROTOCOL}/core/ready`;
11
11
 
@@ -1,4 +1,5 @@
1
- import { Type } from "typebox";
1
+ import { Type, type TSchema } from "typebox";
2
+ import type { ReadRequest } from "#src/api/tools/read.js";
2
3
 
3
4
  /** Canonical arguments shared by standalone and composed operations. */
4
5
  export const readParameters = Type.Object({
@@ -27,3 +28,39 @@ export const readParameters = Type.Object({
27
28
  }),
28
29
  ),
29
30
  });
31
+
32
+ /** Rendered plugin syntax grouped by Read parameter. */
33
+ export type ReadParameterText = Partial<Record<keyof ReadRequest, string>>;
34
+
35
+ // Keep the shared schema's metadata stable for Diff; these descriptions belong to Read.
36
+ const coreDescriptions: Record<keyof ReadRequest, string> = {
37
+ path: "Source to read: a resource path, unchanged source result or its UUID. Supply a source; an empty call cannot select one. temp:<id> reads saved output. raw:<local-file> reads original bytes from a regular file; relative, absolute and file:// paths are accepted.",
38
+ offset:
39
+ "For raw: sources, a zero-based integer byte offset; negative offsets count from the file end. For text sources, the first line to return, numbered from 1. Omit or use 0 to start at line 1; -1 starts at the last line, -10 at the tenth line from the end.",
40
+ limit:
41
+ "For raw: sources, a non-negative integer byte count (0 reads no bytes). For text sources, the maximum lines from the selected starting position. Omit for the default read. For other non-text sources, use only a range form described for that source.",
42
+ views:
43
+ "Source-specific presentations. Omit for the source's default presentation. Supply settings after a colon using the syntax below. Combine views only when their contracts allow it. raw: sources do not accept views.",
44
+ };
45
+
46
+ /** Build a fresh Read schema snapshot without changing the shared schema or accepted types. */
47
+ export function describeReadParameters(descriptions: ReadParameterText): typeof readParameters {
48
+ const describe = <Schema extends TSchema>(
49
+ schema: Schema,
50
+ parameter: keyof ReadRequest,
51
+ ): Schema => ({
52
+ ...schema,
53
+ description: [coreDescriptions[parameter], descriptions[parameter]]
54
+ .filter((value) => value !== undefined)
55
+ .join("\n"),
56
+ });
57
+ return {
58
+ ...readParameters,
59
+ properties: {
60
+ path: describe(readParameters.properties.path, "path"),
61
+ offset: describe(readParameters.properties.offset, "offset"),
62
+ limit: describe(readParameters.properties.limit, "limit"),
63
+ views: describe(readParameters.properties.views, "views"),
64
+ },
65
+ };
66
+ }
@@ -107,6 +107,8 @@ export interface FragmentResolverRegistration {
107
107
  */
108
108
  export interface ReadViewRegistration {
109
109
  readonly view: string;
110
+ /** Text views require source lines; native handlers may register views for any content. */
111
+ readonly contentKind?: "text" | "any";
110
112
  /** Requested views whose complete presentation this view already provides. */
111
113
  readonly includes?: readonly string[];
112
114
  readonly presenter: TextLinePresenter;
@@ -164,6 +166,8 @@ export interface UnsupportedContentDetails {
164
166
  }
165
167
 
166
168
  export interface ReadResultDetails extends UnsupportedContentDetails {
169
+ /** Diagnostic readiness shown separately from canonical source lines. */
170
+ readonly diagnosticStatus?: string;
167
171
  /** Explicit diagnostic checks; completed empty reports need no content panel. */
168
172
  readonly diagnosticCheck?: {
169
173
  readonly complete: boolean;
@@ -182,9 +186,13 @@ export interface ReadResultDetails extends UnsupportedContentDetails {
182
186
  readonly totalLines?: number;
183
187
  readonly truncation?: TruncationResult;
184
188
  readonly temporarySource?: string;
189
+ /** Exact appended notice, outside the useful-output budget. */
190
+ readonly outputNotice?: string;
185
191
  readonly lines?: readonly ReadTextLine[];
186
192
  /** Requested view names that no registration backed; they were ignored. */
187
193
  readonly ignoredViews?: readonly string[];
194
+ /** Situational presentation messages, kept outside source lines and script data. */
195
+ readonly viewWarnings?: readonly string[];
188
196
  readonly failure?: ReadFailure;
189
197
  }
190
198
 
@@ -269,6 +277,11 @@ export type ReadHandlerRegistration =
269
277
 
270
278
  export type PromptDescriptionSource = string | (() => string | undefined);
271
279
 
280
+ /** Source and view syntax attached to the matching Read parameter. Callbacks are evaluated for each schema snapshot; undefined omits that contribution. */
281
+ export type ReadParameterDescriptions = {
282
+ readonly [Parameter in keyof ReadRequest]?: PromptDescriptionSource;
283
+ };
284
+
272
285
  /** Remaining text budget for a format-aware view of already-read data. */
273
286
  export interface ReadOutputBudget {
274
287
  readonly maxBytes: number;
@@ -311,6 +324,8 @@ export interface ReadToolPluginApi {
311
324
  ): Promise<ReadToolResult | undefined>;
312
325
  /** Stores complete output for follow-up read access until this runtime is disposed. */
313
326
  saveTemporary(text: string): Promise<string>;
327
+ /** Sets the saver used before the shared text budget truncates a Read result. */
328
+ setOutputSaver(saver: (text: string) => Promise<string>): void;
314
329
  /** Executes the shared pipeline; script results are not clipped to the agent output budget. */
315
330
  read(
316
331
  request: ReadRequest,
@@ -325,7 +340,8 @@ export interface ReadToolPluginApi {
325
340
  /** Registers a named view whose presenter runs when a request lists the view. */
326
341
  addView(registration: ReadViewRegistration): void;
327
342
  addFragmentResolver(registration: FragmentResolverRegistration): void;
328
- describe(description: PromptDescriptionSource): void;
343
+ /** Adds one parameter-description map per plugin. This documents capabilities without changing validation or registering them. */
344
+ describe(descriptions: ReadParameterDescriptions): void;
329
345
 
330
346
  /** Adds an operational rule to the read tool's system-prompt guidelines. */
331
347
  addPromptGuideline(guideline: PromptDescriptionSource): void;
@@ -351,6 +367,7 @@ const fragmentResolverRegistrationSchema = Type.Object({
351
367
  });
352
368
  const viewRegistrationSchema = Type.Object({
353
369
  view: Type.String({ pattern: "\\S" }),
370
+ contentKind: Type.Optional(Type.Union([Type.Literal("text"), Type.Literal("any")])),
354
371
  includes: Type.Optional(Type.Array(Type.String({ pattern: "\\S" }))),
355
372
  presenter: Type.Object({ id: Type.String(), present: functionSchema }),
356
373
  priority: Type.Optional(Type.Number()),
@@ -32,7 +32,7 @@ export default async function registerReadCore(
32
32
  connectAgentDocumentation(pi, [
33
33
  await loadPackagedAgentGuide({
34
34
  id: "read-resources",
35
- description: "Resource selection, windows, views, raw bytes, and continuation",
35
+ description: "Read results, selection boundaries, and composition",
36
36
  triggers: [{ tool: "read" }],
37
37
  }),
38
38
  ]);
@@ -60,7 +60,13 @@ export default async function registerReadCore(
60
60
  });
61
61
 
62
62
  const interceptionRendering = new ToolCallInterceptionRenderStore();
63
- pi.registerTool(withToolCallInterceptionRendering(core.read.tool, interceptionRendering));
63
+ const definition = withToolCallInterceptionRendering(core.read.tool, interceptionRendering);
64
+ pi.registerTool(definition);
65
+ pi.on("before_agent_start", async () => {
66
+ await core.waitForPendingPlugins();
67
+ // Pi snapshots schemas when it wraps definitions. Refresh current plugin metadata for this run.
68
+ if (pi.getActiveTools().includes("read")) pi.registerTool(definition);
69
+ });
64
70
  pi.on("tool_result", (event) => {
65
71
  if (event.toolName !== "read" || !isRecord(event.details)) {
66
72
  return;
@@ -12,6 +12,7 @@ import {
12
12
  isTextTargetResolverRegistration,
13
13
  type FragmentResolverRegistration,
14
14
  type PromptDescriptionSource,
15
+ type ReadParameterDescriptions,
15
16
  type ReadHandlerRegistration,
16
17
  type ReadOutputReducer,
17
18
  type ReadResourceGuardRegistration,
@@ -20,6 +21,7 @@ import {
20
21
  type TextTargetResolverRegistration,
21
22
  } from "#src/api/tools/read.js";
22
23
  import { createReadTool, type ReadTool } from "#src/core/tools/tool-read.js";
24
+ import { readParameters, type ReadParameterText } from "#src/api/read-parameters.js";
23
25
 
24
26
  type PluginStatus = "active" | "pending";
25
27
 
@@ -30,7 +32,7 @@ interface PluginLifecycle {
30
32
  interface RegisteredPlugin {
31
33
  readonly lifecycle: PluginLifecycle;
32
34
  readonly plugin: ReadPlugin;
33
- readonly promptContributions: PromptDescriptionSource[];
35
+ readonly parameterDescriptions: ReadParameterDescriptions[];
34
36
 
35
37
  readonly promptGuidelines: PromptDescriptionSource[];
36
38
  readonly ready: Promise<void>;
@@ -46,7 +48,6 @@ export interface ReadCore {
46
48
  readonly read: ReadTool;
47
49
  registerPlugin(plugin: ReadPlugin): Promise<void>;
48
50
  waitForPendingPlugins(): Promise<void>;
49
- renderPluginPromptGuideline(): string | undefined;
50
51
  }
51
52
 
52
53
  export function createReadCore(
@@ -55,7 +56,11 @@ export function createReadCore(
55
56
  const outputReducers: ReadOutputReducer[] = [];
56
57
  const pendingPlugins = new Set<Promise<void>>();
57
58
  const plugins = new Map<string, RegisteredPlugin>();
58
- const read = createReadTool(() => renderPromptGuidelines(plugins), presentation);
59
+ const read = createReadTool(
60
+ () => renderPromptGuidelines(plugins),
61
+ presentation,
62
+ () => renderParameterDescriptions(plugins),
63
+ );
59
64
  let registrationQueue = Promise.resolve();
60
65
 
61
66
  return {
@@ -78,14 +83,14 @@ export function createReadCore(
78
83
  }
79
84
 
80
85
  const lifecycle: PluginLifecycle = { status: "pending" };
81
- const promptContributions: PromptDescriptionSource[] = [];
86
+ const parameterDescriptions: ReadParameterDescriptions[] = [];
82
87
 
83
88
  const promptGuidelines: PromptDescriptionSource[] = [];
84
89
  const contributions = createPluginContributionController(
85
90
  plugin.id,
86
91
  read,
87
92
  promptGuidelines,
88
- promptContributions,
93
+ parameterDescriptions,
89
94
  outputReducers,
90
95
  );
91
96
  const ready = registrationQueue.then(async () => {
@@ -103,7 +108,7 @@ export function createReadCore(
103
108
  lifecycle,
104
109
  plugin,
105
110
  promptGuidelines,
106
- promptContributions,
111
+ parameterDescriptions,
107
112
  ready,
108
113
  };
109
114
 
@@ -128,7 +133,6 @@ export function createReadCore(
128
133
 
129
134
  return ready;
130
135
  },
131
- renderPluginPromptGuideline: () => renderPluginPromptGuideline(plugins),
132
136
  async waitForPendingPlugins(): Promise<void> {
133
137
  await Promise.all(pendingPlugins);
134
138
  },
@@ -159,11 +163,11 @@ function createPluginContributionController(
159
163
  pluginId: string,
160
164
  read: ReadTool,
161
165
  promptGuidelines: PromptDescriptionSource[],
162
- promptContributions: PromptDescriptionSource[],
166
+ parameterDescriptions: ReadParameterDescriptions[],
163
167
  outputReducers: ReadOutputReducer[],
164
168
  ): PluginContributionController {
165
169
  const setupOutputReducers: ReadOutputReducer[] = [];
166
- const setupPromptContributions: PromptDescriptionSource[] = [];
170
+ const setupParameterDescriptions: ReadParameterDescriptions[] = [];
167
171
 
168
172
  const setupPromptGuidelines: PromptDescriptionSource[] = [];
169
173
  const setupResourceGuards: ReadResourceGuardRegistration[] = [];
@@ -197,6 +201,10 @@ function createPluginContributionController(
197
201
  assertAvailable();
198
202
  return read.saveTemporary(text);
199
203
  },
204
+ setOutputSaver(saver) {
205
+ assertAvailable();
206
+ read.setOutputSaver(saver);
207
+ },
200
208
  read(request, context, audience) {
201
209
  assertAvailable();
202
210
  return read.execute(request, context, audience);
@@ -273,18 +281,18 @@ function createPluginContributionController(
273
281
  describe(description): void {
274
282
  assertAvailable();
275
283
 
276
- if (setupPromptContributions.length > 0 || promptContributions.length > 0) {
284
+ if (setupParameterDescriptions.length > 0 || parameterDescriptions.length > 0) {
277
285
  throw new Error(`Plugin ${pluginId} provides more than one description`);
278
286
  }
279
287
 
280
- const normalized = normalizeDescriptionSource(description);
288
+ const normalized = normalizeParameterDescriptions(description);
281
289
 
282
290
  if (state === "setup") {
283
- setupPromptContributions.push(normalized);
291
+ setupParameterDescriptions.push(normalized);
284
292
  return;
285
293
  }
286
294
 
287
- promptContributions.push(normalized);
295
+ parameterDescriptions.push(normalized);
288
296
  },
289
297
 
290
298
  addPromptGuideline(guideline): void {
@@ -318,7 +326,7 @@ function createPluginContributionController(
318
326
  views: setupViews,
319
327
  fragments: setupFragmentResolvers,
320
328
  });
321
- promptContributions.push(...setupPromptContributions);
329
+ parameterDescriptions.push(...setupParameterDescriptions);
322
330
  outputReducers.push(...setupOutputReducers);
323
331
 
324
332
  promptGuidelines.push(...setupPromptGuidelines);
@@ -346,32 +354,43 @@ function renderPromptGuidelines(plugins: ReadonlyMap<string, RegisteredPlugin>):
346
354
  return guidelines;
347
355
  }
348
356
 
349
- function renderPluginPromptGuideline(
357
+ function renderParameterDescriptions(
350
358
  plugins: ReadonlyMap<string, RegisteredPlugin>,
351
- ): string | undefined {
352
- const entries: string[] = [];
353
-
354
- for (const registeredPlugin of plugins.values()) {
355
- if (registeredPlugin.lifecycle.status !== "active") {
356
- continue;
357
- }
358
-
359
- const source = registeredPlugin.promptContributions[0];
360
-
361
- if (source === undefined) {
362
- continue;
359
+ ): ReadParameterText {
360
+ const entries: Partial<Record<keyof ReadParameterDescriptions, string[]>> = {};
361
+ for (const plugin of plugins.values()) {
362
+ if (plugin.lifecycle.status !== "active") continue;
363
+ for (const descriptions of plugin.parameterDescriptions) {
364
+ for (const parameter of Object.keys(descriptions) as (keyof ReadParameterDescriptions)[]) {
365
+ const source = descriptions[parameter];
366
+ if (source === undefined) continue;
367
+ const description = renderDescriptionSource(source);
368
+ if (description !== undefined) (entries[parameter] ??= []).push(description);
369
+ }
363
370
  }
371
+ }
372
+ return Object.fromEntries(
373
+ Object.entries(entries).map(([parameter, descriptions]) => [
374
+ parameter,
375
+ [...new Set(descriptions.flatMap((description) => description.split("\n")))].join("\n"),
376
+ ]),
377
+ );
378
+ }
364
379
 
365
- const description = renderDescriptionSource(source);
366
-
367
- if (description !== undefined) {
368
- entries.push(description);
380
+ function normalizeParameterDescriptions(value: unknown): ReadParameterDescriptions {
381
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
382
+ throw new TypeError("Read plugin parameter descriptions must be an object");
383
+ }
384
+ const entries = Object.entries(value);
385
+ if (entries.length === 0) throw new Error("Read plugin parameter descriptions are empty");
386
+ const normalized: Partial<Record<keyof ReadParameterDescriptions, PromptDescriptionSource>> = {};
387
+ for (const [parameter, source] of entries) {
388
+ if (!Object.hasOwn(readParameters.properties, parameter)) {
389
+ throw new Error(`Read plugin description names an unknown parameter: ${parameter}`);
369
390
  }
391
+ normalized[parameter as keyof ReadParameterDescriptions] = normalizeDescriptionSource(source);
370
392
  }
371
-
372
- return entries.length === 0
373
- ? undefined
374
- : [...new Set(entries.flatMap((entry) => entry.split("\n")))].join("\n");
393
+ return normalized;
375
394
  }
376
395
 
377
396
  function normalizeDescriptionSource(value: unknown): PromptDescriptionSource {