@mastra/server 1.58.0-alpha.1 → 1.58.0-alpha.13

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 (467) hide show
  1. package/CHANGELOG.md +215 -0
  2. package/dist/_types/@mastra_schema-compat/dist/provider-compats/anthropic.d.ts +1 -1
  3. package/dist/{a2a-CnU9zaGR.js → a2a-8C4O2dVJ.js} +41 -5
  4. package/dist/a2a-8C4O2dVJ.js.map +1 -0
  5. package/dist/{a2a-CHi9AJ0n.js → a2a-CUkzkdTZ.js} +268 -55
  6. package/dist/a2a-CUkzkdTZ.js.map +1 -0
  7. package/dist/{a2a-D3ZYeXIx.cjs → a2a-DzZHH3OH.cjs} +279 -54
  8. package/dist/a2a-DzZHH3OH.cjs.map +1 -0
  9. package/dist/{a2a-oM7aqLz4.cjs → a2a-MPoM5lzS.cjs} +41 -5
  10. package/dist/a2a-MPoM5lzS.cjs.map +1 -0
  11. package/dist/{agent-builder-BDYN3r89.cjs → agent-builder-D8JyDQ5J.cjs} +2 -2
  12. package/dist/{agent-builder-BDYN3r89.cjs.map → agent-builder-D8JyDQ5J.cjs.map} +1 -1
  13. package/dist/{agent-builder-Dqy_qumV.js → agent-builder-DNTFty1u.js} +2 -2
  14. package/dist/{agent-builder-Dqy_qumV.js.map → agent-builder-DNTFty1u.js.map} +1 -1
  15. package/dist/{agent-versions-Bsrpa_zb.js → agent-versions-CWEnD62A.js} +4 -4
  16. package/dist/{agent-versions-Bsrpa_zb.js.map → agent-versions-CWEnD62A.js.map} +1 -1
  17. package/dist/{agent-versions-CdQGF-3e.cjs → agent-versions-xeysPGel.cjs} +4 -4
  18. package/dist/{agent-versions-CdQGF-3e.cjs.map → agent-versions-xeysPGel.cjs.map} +1 -1
  19. package/dist/{agents-Dk2qoJi_.cjs → agents-0Tw3kkD_.cjs} +9 -5
  20. package/dist/agents-0Tw3kkD_.cjs.map +1 -0
  21. package/dist/{agents-CYvun9iI.js → agents-uT8ZDE4k.js} +9 -5
  22. package/dist/agents-uT8ZDE4k.js.map +1 -0
  23. package/dist/{api-schema-manifest-J5hfk5ZZ.cjs → api-schema-manifest-BPk3u4B-.cjs} +3 -3
  24. package/dist/{api-schema-manifest-J5hfk5ZZ.cjs.map → api-schema-manifest-BPk3u4B-.cjs.map} +1 -1
  25. package/dist/{api-schema-manifest-R8CsF6RX.js → api-schema-manifest-DSelT9XK.js} +3 -3
  26. package/dist/{api-schema-manifest-R8CsF6RX.js.map → api-schema-manifest-DSelT9XK.js.map} +1 -1
  27. package/dist/{background-tasks-DnmhLalp.js → background-tasks-BtWM0sZs.js} +2 -2
  28. package/dist/{background-tasks-DnmhLalp.js.map → background-tasks-BtWM0sZs.js.map} +1 -1
  29. package/dist/{background-tasks-CYgzzUnb.cjs → background-tasks-C5G2jJax.cjs} +2 -2
  30. package/dist/{background-tasks-CYgzzUnb.cjs.map → background-tasks-C5G2jJax.cjs.map} +1 -1
  31. package/dist/{builder-registry-DE5w7bNk.js → builder-registry-B8KyPAOP.js} +3 -3
  32. package/dist/{builder-registry-DE5w7bNk.js.map → builder-registry-B8KyPAOP.js.map} +1 -1
  33. package/dist/{builder-registry-BoaXBdm_.cjs → builder-registry-Dcou-kzd.cjs} +3 -3
  34. package/dist/{builder-registry-BoaXBdm_.cjs.map → builder-registry-Dcou-kzd.cjs.map} +1 -1
  35. package/dist/{channels-BqkOxxEk.js → channels-B9yt3a2P.js} +2 -2
  36. package/dist/{channels-BqkOxxEk.js.map → channels-B9yt3a2P.js.map} +1 -1
  37. package/dist/{channels-BonQBJT0.cjs → channels-BRoq3VKR.cjs} +2 -2
  38. package/dist/{channels-BonQBJT0.cjs.map → channels-BRoq3VKR.cjs.map} +1 -1
  39. package/dist/{common-CPNOpqxA.js → common-5ZZuR6wj.js} +19 -8
  40. package/dist/common-5ZZuR6wj.js.map +1 -0
  41. package/dist/{common-spbwhiWS.cjs → common-DQn8jX5T.cjs} +19 -8
  42. package/dist/common-DQn8jX5T.cjs.map +1 -0
  43. package/dist/{conversations-CebKjBfB.cjs → conversations-CcFLCCeF.cjs} +2 -2
  44. package/dist/{conversations-CebKjBfB.cjs.map → conversations-CcFLCCeF.cjs.map} +1 -1
  45. package/dist/{conversations-BDD46VBM.js → conversations-DtnawNGm.js} +2 -2
  46. package/dist/{conversations-BDD46VBM.js.map → conversations-DtnawNGm.js.map} +1 -1
  47. package/dist/{datasets-BMeFvFwT.cjs → datasets-D2JdQI44.cjs} +2 -2
  48. package/dist/{datasets-BMeFvFwT.cjs.map → datasets-D2JdQI44.cjs.map} +1 -1
  49. package/dist/{datasets-BeBH9Seg.js → datasets-Dr1pCC6P.js} +2 -2
  50. package/dist/{datasets-BeBH9Seg.js.map → datasets-Dr1pCC6P.js.map} +1 -1
  51. package/dist/{default-options-BcPyp2Gx.cjs → default-options-C9HZGjYi.cjs} +6 -3
  52. package/dist/{default-options-BcPyp2Gx.cjs.map → default-options-C9HZGjYi.cjs.map} +1 -1
  53. package/dist/{default-options-DGCDKR3I.js → default-options-C9JVjlto.js} +6 -3
  54. package/dist/{default-options-DGCDKR3I.js.map → default-options-C9JVjlto.js.map} +1 -1
  55. package/dist/{dist-IUXZtNBY.js → dist-CzzxT_L5.js} +237 -1384
  56. package/dist/dist-CzzxT_L5.js.map +1 -0
  57. package/dist/{dist-DgY0llRv.cjs → dist-TkFPtpuy.cjs} +246 -1396
  58. package/dist/dist-TkFPtpuy.cjs.map +1 -0
  59. package/dist/docs/SKILL.md +2 -1
  60. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  61. package/dist/docs/references/docs-agents-a2a.md +39 -0
  62. package/dist/docs/references/docs-server-custom-adapters.md +1 -1
  63. package/dist/docs/references/docs-server-custom-api-routes.md +375 -0
  64. package/dist/docs/references/reference-server-create-route.md +27 -1
  65. package/dist/docs/references/reference-server-routes.md +38 -24
  66. package/dist/{stored-workflows-OanG0TmB.js → dynamic-workflows-B0TE8mjA.js} +62 -62
  67. package/dist/dynamic-workflows-B0TE8mjA.js.map +1 -0
  68. package/dist/{stored-workflows-pCiWK305.cjs → dynamic-workflows-C-6vmau5.cjs} +71 -71
  69. package/dist/dynamic-workflows-C-6vmau5.cjs.map +1 -0
  70. package/dist/{editor-builder-Ct2nIbum.js → editor-builder-Byg6wbi6.js} +3 -3
  71. package/dist/{editor-builder-Ct2nIbum.js.map → editor-builder-Byg6wbi6.js.map} +1 -1
  72. package/dist/{editor-builder-CWTGCtNu.cjs → editor-builder-C3ZvffGu.cjs} +2 -2
  73. package/dist/{editor-builder-CWTGCtNu.cjs.map → editor-builder-C3ZvffGu.cjs.map} +1 -1
  74. package/dist/{editor-builder-fKbRRlK_.js → editor-builder-DJUxdzC8.js} +2 -2
  75. package/dist/{editor-builder-fKbRRlK_.js.map → editor-builder-DJUxdzC8.js.map} +1 -1
  76. package/dist/{editor-builder-BW4nlDcX.cjs → editor-builder-DT7ypWfa.cjs} +3 -3
  77. package/dist/{editor-builder-BW4nlDcX.cjs.map → editor-builder-DT7ypWfa.cjs.map} +1 -1
  78. package/dist/{logs-wBYi7UWL.cjs → logs-BDuGFqxu.cjs} +2 -2
  79. package/dist/{logs-wBYi7UWL.cjs.map → logs-BDuGFqxu.cjs.map} +1 -1
  80. package/dist/{logs-BzwWWl57.js → logs-Cz5NiwGP.js} +2 -2
  81. package/dist/{logs-BzwWWl57.js.map → logs-Cz5NiwGP.js.map} +1 -1
  82. package/dist/{mcp-DusNUBdz.cjs → mcp-Buvksst5.cjs} +2 -2
  83. package/dist/{mcp-DusNUBdz.cjs.map → mcp-Buvksst5.cjs.map} +1 -1
  84. package/dist/{mcp-client-versions-Db71zP8j.cjs → mcp-client-versions-CG7po4hq.cjs} +2 -2
  85. package/dist/{mcp-client-versions-Db71zP8j.cjs.map → mcp-client-versions-CG7po4hq.cjs.map} +1 -1
  86. package/dist/{mcp-client-versions-Dwbiav9P.js → mcp-client-versions-Co8d39A6.js} +2 -2
  87. package/dist/{mcp-client-versions-Dwbiav9P.js.map → mcp-client-versions-Co8d39A6.js.map} +1 -1
  88. package/dist/{mcp-BpC_5RhI.js → mcp-oOFVSK8L.js} +2 -2
  89. package/dist/{mcp-BpC_5RhI.js.map → mcp-oOFVSK8L.js.map} +1 -1
  90. package/dist/{memory-BjemiyZJ.js → memory-CBLqn9xl.js} +2 -2
  91. package/dist/{memory-BjemiyZJ.js.map → memory-CBLqn9xl.js.map} +1 -1
  92. package/dist/{memory-CxM2p78x.cjs → memory-D0prxytx.cjs} +2 -2
  93. package/dist/{memory-CxM2p78x.cjs.map → memory-D0prxytx.cjs.map} +1 -1
  94. package/dist/{observability-new-endpoints-Dk3oatL8.cjs → observability-new-endpoints-BC-dasRY.cjs} +2 -2
  95. package/dist/{observability-new-endpoints-Dk3oatL8.cjs.map → observability-new-endpoints-BC-dasRY.cjs.map} +1 -1
  96. package/dist/{observability-new-endpoints-YK2DjZto.js → observability-new-endpoints-Drx0C8uc.js} +2 -2
  97. package/dist/{observability-new-endpoints-YK2DjZto.js.map → observability-new-endpoints-Drx0C8uc.js.map} +1 -1
  98. package/dist/{probe-image-size-DYJVSL0b.cjs → probe-image-size-C2F59z8Z.cjs} +56 -1707
  99. package/dist/probe-image-size-C2F59z8Z.cjs.map +1 -0
  100. package/dist/{probe-image-size-BQgIJeY_.js → probe-image-size-mXCWYNrz.js} +22 -1673
  101. package/dist/probe-image-size-mXCWYNrz.js.map +1 -0
  102. package/dist/{prompt-block-versions-CIDwXWiC.js → prompt-block-versions-CBjHhMVK.js} +2 -2
  103. package/dist/{prompt-block-versions-CIDwXWiC.js.map → prompt-block-versions-CBjHhMVK.js.map} +1 -1
  104. package/dist/{prompt-block-versions-Bl3RmkTE.cjs → prompt-block-versions-Cgt_Grk2.cjs} +2 -2
  105. package/dist/{prompt-block-versions-Bl3RmkTE.cjs.map → prompt-block-versions-Cgt_Grk2.cjs.map} +1 -1
  106. package/dist/{route-builder-CgLVYL1c.cjs → route-builder-BAAedfru.cjs} +11 -2
  107. package/dist/route-builder-BAAedfru.cjs.map +1 -0
  108. package/dist/{route-builder-CIk5k35M.js → route-builder-YQ_gLIvW.js} +11 -2
  109. package/dist/route-builder-YQ_gLIvW.js.map +1 -0
  110. package/dist/{routes-BzR8iVj4.cjs → routes-0BEh3stO.cjs} +26 -25
  111. package/dist/routes-0BEh3stO.cjs.map +1 -0
  112. package/dist/{routes-C7iRCN_l.js → routes-BsMPy5bu.js} +27 -26
  113. package/dist/routes-BsMPy5bu.js.map +1 -0
  114. package/dist/{schedules-CK3-IE0h.cjs → schedules-DOK225ZZ.cjs} +2 -2
  115. package/dist/{schedules-CK3-IE0h.cjs.map → schedules-DOK225ZZ.cjs.map} +1 -1
  116. package/dist/{schedules-qxFoU-Tb.js → schedules-RjPcNOmY.js} +2 -2
  117. package/dist/{schedules-qxFoU-Tb.js.map → schedules-RjPcNOmY.js.map} +1 -1
  118. package/dist/{schema-Bv9OdW1f-BY6u3u8K.cjs → schema-Bv9OdW1f-CHHI-NTr.cjs} +2 -76
  119. package/dist/schema-Bv9OdW1f-CHHI-NTr.cjs.map +1 -0
  120. package/dist/{schema-Bv9OdW1f-CIOfv-3w.js → schema-Bv9OdW1f-DLSJSqQv.js} +2 -76
  121. package/dist/schema-Bv9OdW1f-DLSJSqQv.js.map +1 -0
  122. package/dist/schema-CGeYTFwm.js +2 -0
  123. package/dist/schema-DkBbires.cjs +1 -0
  124. package/dist/{scorer-versions-DpmAJKsY.cjs → scorer-versions-CYXtxMTU.cjs} +3 -3
  125. package/dist/{scorer-versions-DpmAJKsY.cjs.map → scorer-versions-CYXtxMTU.cjs.map} +1 -1
  126. package/dist/{scorer-versions-BA8N488c.js → scorer-versions-CdVjOtQO.js} +3 -3
  127. package/dist/{scorer-versions-BA8N488c.js.map → scorer-versions-CdVjOtQO.js.map} +1 -1
  128. package/dist/{scores-DU0o86rP.js → scores-B1IdMcDj.js} +2 -2
  129. package/dist/{scores-DU0o86rP.js.map → scores-B1IdMcDj.js.map} +1 -1
  130. package/dist/{scores-Bm_sUKY1.cjs → scores-C_Au9jSw.cjs} +2 -2
  131. package/dist/{scores-Bm_sUKY1.cjs.map → scores-C_Au9jSw.cjs.map} +1 -1
  132. package/dist/server/a2a/store.cjs +4 -0
  133. package/dist/server/a2a/store.cjs.map +1 -1
  134. package/dist/server/a2a/store.d.ts +3 -0
  135. package/dist/server/a2a/store.d.ts.map +1 -1
  136. package/dist/server/a2a/store.js +4 -0
  137. package/dist/server/a2a/store.js.map +1 -1
  138. package/dist/server/handlers/a2a.cjs +3 -1
  139. package/dist/server/handlers/a2a.d.ts +583 -401
  140. package/dist/server/handlers/a2a.d.ts.map +1 -1
  141. package/dist/server/handlers/a2a.js +2 -2
  142. package/dist/server/handlers/agent-builder.cjs +7 -7
  143. package/dist/server/handlers/agent-builder.d.ts +1069 -764
  144. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  145. package/dist/server/handlers/agent-builder.js +7 -7
  146. package/dist/server/handlers/agent-controller.cjs +86 -17
  147. package/dist/server/handlers/agent-controller.cjs.map +1 -1
  148. package/dist/server/handlers/agent-controller.d.ts +1548 -893
  149. package/dist/server/handlers/agent-controller.d.ts.map +1 -1
  150. package/dist/server/handlers/agent-controller.js +86 -17
  151. package/dist/server/handlers/agent-controller.js.map +1 -1
  152. package/dist/server/handlers/agent-versions.cjs +4 -4
  153. package/dist/server/handlers/agent-versions.d.ts +8504 -8312
  154. package/dist/server/handlers/agent-versions.d.ts.map +1 -1
  155. package/dist/server/handlers/agent-versions.js +4 -4
  156. package/dist/server/handlers/agents.cjs +6 -6
  157. package/dist/server/handlers/agents.d.ts +9984 -9826
  158. package/dist/server/handlers/agents.d.ts.map +1 -1
  159. package/dist/server/handlers/agents.js +6 -6
  160. package/dist/server/handlers/auth.cjs +1 -1
  161. package/dist/server/handlers/auth.d.ts +693 -297
  162. package/dist/server/handlers/auth.d.ts.map +1 -1
  163. package/dist/server/handlers/auth.js +1 -1
  164. package/dist/server/handlers/background-tasks.cjs +1 -1
  165. package/dist/server/handlers/background-tasks.d.ts +190 -130
  166. package/dist/server/handlers/background-tasks.d.ts.map +1 -1
  167. package/dist/server/handlers/background-tasks.js +1 -1
  168. package/dist/server/handlers/builder-registry.cjs +1 -1
  169. package/dist/server/handlers/builder-registry.d.ts +218 -121
  170. package/dist/server/handlers/builder-registry.d.ts.map +1 -1
  171. package/dist/server/handlers/builder-registry.js +1 -1
  172. package/dist/server/handlers/channels.cjs +1 -1
  173. package/dist/server/handlers/channels.d.ts +157 -77
  174. package/dist/server/handlers/channels.d.ts.map +1 -1
  175. package/dist/server/handlers/channels.js +1 -1
  176. package/dist/server/handlers/conversations.cjs +2 -2
  177. package/dist/server/handlers/conversations.d.ts +221 -141
  178. package/dist/server/handlers/conversations.d.ts.map +1 -1
  179. package/dist/server/handlers/conversations.js +2 -2
  180. package/dist/server/handlers/datasets.cjs +3 -3
  181. package/dist/server/handlers/datasets.d.ts +2669 -2234
  182. package/dist/server/handlers/datasets.d.ts.map +1 -1
  183. package/dist/server/handlers/datasets.js +3 -3
  184. package/dist/server/handlers/dynamic-workflows.cjs +6 -0
  185. package/dist/server/handlers/dynamic-workflows.d.ts +900 -0
  186. package/dist/server/handlers/{stored-workflows.d.ts.map → dynamic-workflows.d.ts.map} +1 -1
  187. package/dist/server/handlers/dynamic-workflows.js +2 -0
  188. package/dist/server/handlers/editor-builder.cjs +1 -1
  189. package/dist/server/handlers/editor-builder.d.ts +305 -245
  190. package/dist/server/handlers/editor-builder.d.ts.map +1 -1
  191. package/dist/server/handlers/editor-builder.js +1 -1
  192. package/dist/server/handlers/favorites-enrichment.cjs +1 -1
  193. package/dist/server/handlers/favorites-enrichment.js +1 -1
  194. package/dist/server/handlers/logs.cjs +3 -3
  195. package/dist/server/handlers/logs.d.ts +245 -185
  196. package/dist/server/handlers/logs.d.ts.map +1 -1
  197. package/dist/server/handlers/logs.js +3 -3
  198. package/dist/server/handlers/mcp-client-versions.cjs +3 -3
  199. package/dist/server/handlers/mcp-client-versions.d.ts +447 -307
  200. package/dist/server/handlers/mcp-client-versions.d.ts.map +1 -1
  201. package/dist/server/handlers/mcp-client-versions.js +3 -3
  202. package/dist/server/handlers/mcp.cjs +2 -2
  203. package/dist/server/handlers/mcp.d.ts +357 -156
  204. package/dist/server/handlers/mcp.d.ts.map +1 -1
  205. package/dist/server/handlers/mcp.js +2 -2
  206. package/dist/server/handlers/memory.cjs +2 -2
  207. package/dist/server/handlers/memory.d.ts +1723 -1223
  208. package/dist/server/handlers/memory.d.ts.map +1 -1
  209. package/dist/server/handlers/memory.js +2 -2
  210. package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
  211. package/dist/server/handlers/observability-new-endpoints.d.ts +3239 -2158
  212. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  213. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  214. package/dist/server/handlers/observability-shared.cjs +1 -1
  215. package/dist/server/handlers/observability-shared.js +1 -1
  216. package/dist/server/handlers/observability.cjs +2 -2
  217. package/dist/server/handlers/observability.d.ts +267 -149
  218. package/dist/server/handlers/observability.d.ts.map +1 -1
  219. package/dist/server/handlers/observability.js +2 -2
  220. package/dist/server/handlers/processor-providers.cjs +1 -1
  221. package/dist/server/handlers/processor-providers.d.ts +74 -34
  222. package/dist/server/handlers/processor-providers.d.ts.map +1 -1
  223. package/dist/server/handlers/processor-providers.js +1 -1
  224. package/dist/server/handlers/processors.cjs +1 -1
  225. package/dist/server/handlers/processors.d.ts +222 -173
  226. package/dist/server/handlers/processors.d.ts.map +1 -1
  227. package/dist/server/handlers/processors.js +1 -1
  228. package/dist/server/handlers/prompt-block-versions.cjs +3 -3
  229. package/dist/server/handlers/prompt-block-versions.d.ts +646 -506
  230. package/dist/server/handlers/prompt-block-versions.d.ts.map +1 -1
  231. package/dist/server/handlers/prompt-block-versions.js +3 -3
  232. package/dist/server/handlers/responses.cjs +1 -1
  233. package/dist/server/handlers/responses.d.ts +352 -362
  234. package/dist/server/handlers/responses.d.ts.map +1 -1
  235. package/dist/server/handlers/responses.js +1 -1
  236. package/dist/server/handlers/schedules.cjs +1 -1
  237. package/dist/server/handlers/schedules.d.ts +1190 -1028
  238. package/dist/server/handlers/schedules.d.ts.map +1 -1
  239. package/dist/server/handlers/schedules.js +1 -1
  240. package/dist/server/handlers/scorer-versions.cjs +3 -3
  241. package/dist/server/handlers/scorer-versions.d.ts +551 -411
  242. package/dist/server/handlers/scorer-versions.d.ts.map +1 -1
  243. package/dist/server/handlers/scorer-versions.js +3 -3
  244. package/dist/server/handlers/scores.cjs +3 -3
  245. package/dist/server/handlers/scores.d.ts +287 -167
  246. package/dist/server/handlers/scores.d.ts.map +1 -1
  247. package/dist/server/handlers/scores.js +3 -3
  248. package/dist/server/handlers/stored-agent-favorites.cjs +4 -4
  249. package/dist/server/handlers/stored-agent-favorites.d.ts +62 -22
  250. package/dist/server/handlers/stored-agent-favorites.d.ts.map +1 -1
  251. package/dist/server/handlers/stored-agent-favorites.js +4 -4
  252. package/dist/server/handlers/stored-agents.cjs +5 -5
  253. package/dist/server/handlers/stored-agents.d.ts +12056 -16152
  254. package/dist/server/handlers/stored-agents.d.ts.map +1 -1
  255. package/dist/server/handlers/stored-agents.js +5 -5
  256. package/dist/server/handlers/stored-mcp-clients.cjs +4 -4
  257. package/dist/server/handlers/stored-mcp-clients.d.ts +417 -324
  258. package/dist/server/handlers/stored-mcp-clients.d.ts.map +1 -1
  259. package/dist/server/handlers/stored-mcp-clients.js +4 -4
  260. package/dist/server/handlers/stored-prompt-blocks.cjs +4 -4
  261. package/dist/server/handlers/stored-prompt-blocks.d.ts +603 -555
  262. package/dist/server/handlers/stored-prompt-blocks.d.ts.map +1 -1
  263. package/dist/server/handlers/stored-prompt-blocks.js +4 -4
  264. package/dist/server/handlers/stored-scorers.cjs +4 -4
  265. package/dist/server/handlers/stored-scorers.d.ts +556 -472
  266. package/dist/server/handlers/stored-scorers.d.ts.map +1 -1
  267. package/dist/server/handlers/stored-scorers.js +4 -4
  268. package/dist/server/handlers/stored-skill-favorites.cjs +4 -4
  269. package/dist/server/handlers/stored-skill-favorites.d.ts +62 -22
  270. package/dist/server/handlers/stored-skill-favorites.d.ts.map +1 -1
  271. package/dist/server/handlers/stored-skill-favorites.js +4 -4
  272. package/dist/server/handlers/stored-skills.cjs +4 -4
  273. package/dist/server/handlers/stored-skills.d.ts +632 -515
  274. package/dist/server/handlers/stored-skills.d.ts.map +1 -1
  275. package/dist/server/handlers/stored-skills.js +4 -4
  276. package/dist/server/handlers/stored-workspaces.cjs +3 -3
  277. package/dist/server/handlers/stored-workspaces.d.ts +646 -546
  278. package/dist/server/handlers/stored-workspaces.d.ts.map +1 -1
  279. package/dist/server/handlers/stored-workspaces.js +3 -3
  280. package/dist/server/handlers/system.cjs +2 -2
  281. package/dist/server/handlers/system.d.ts +146 -106
  282. package/dist/server/handlers/system.d.ts.map +1 -1
  283. package/dist/server/handlers/system.js +2 -2
  284. package/dist/server/handlers/tool-providers.cjs +1 -1
  285. package/dist/server/handlers/tool-providers.d.ts +580 -331
  286. package/dist/server/handlers/tool-providers.d.ts.map +1 -1
  287. package/dist/server/handlers/tool-providers.js +1 -1
  288. package/dist/server/handlers/tools.cjs +6 -6
  289. package/dist/server/handlers/tools.d.ts +177 -77
  290. package/dist/server/handlers/tools.d.ts.map +1 -1
  291. package/dist/server/handlers/tools.js +6 -6
  292. package/dist/server/handlers/validate-agent-instructions.cjs +1 -1
  293. package/dist/server/handlers/validate-agent-instructions.js +1 -1
  294. package/dist/server/handlers/vector.cjs +2 -2
  295. package/dist/server/handlers/vector.d.ts +282 -126
  296. package/dist/server/handlers/vector.d.ts.map +1 -1
  297. package/dist/server/handlers/vector.js +2 -2
  298. package/dist/server/handlers/workflows.cjs +149 -27
  299. package/dist/server/handlers/workflows.cjs.map +1 -1
  300. package/dist/server/handlers/workflows.d.ts +1704 -1173
  301. package/dist/server/handlers/workflows.d.ts.map +1 -1
  302. package/dist/server/handlers/workflows.js +149 -29
  303. package/dist/server/handlers/workflows.js.map +1 -1
  304. package/dist/server/handlers/workspace.cjs +1 -1
  305. package/dist/server/handlers/workspace.d.ts +1936 -1150
  306. package/dist/server/handlers/workspace.d.ts.map +1 -1
  307. package/dist/server/handlers/workspace.js +1 -1
  308. package/dist/server/handlers.cjs +8 -8
  309. package/dist/server/handlers.d.ts +1 -1
  310. package/dist/server/handlers.d.ts.map +1 -1
  311. package/dist/server/handlers.js +3 -3
  312. package/dist/server/schemas/a2a.d.ts +70 -6
  313. package/dist/server/schemas/a2a.d.ts.map +1 -1
  314. package/dist/server/schemas/agent-versions.d.ts +70 -10
  315. package/dist/server/schemas/agent-versions.d.ts.map +1 -1
  316. package/dist/server/schemas/agents.d.ts +23 -3
  317. package/dist/server/schemas/agents.d.ts.map +1 -1
  318. package/dist/server/schemas/common.d.ts.map +1 -1
  319. package/dist/server/schemas/default-options.d.ts +7 -1
  320. package/dist/server/schemas/default-options.d.ts.map +1 -1
  321. package/dist/server/schemas/{stored-workflows.d.ts → dynamic-workflows.d.ts} +13 -13
  322. package/dist/server/schemas/dynamic-workflows.d.ts.map +1 -0
  323. package/dist/server/schemas/index.cjs +26 -26
  324. package/dist/server/schemas/index.js +26 -26
  325. package/dist/server/schemas/stored-agents.d.ts +140 -20
  326. package/dist/server/schemas/stored-agents.d.ts.map +1 -1
  327. package/dist/server/schemas/workflows.d.ts +10 -2
  328. package/dist/server/schemas/workflows.d.ts.map +1 -1
  329. package/dist/server/server-adapter/index.cjs +69 -7
  330. package/dist/server/server-adapter/index.cjs.map +1 -1
  331. package/dist/server/server-adapter/index.d.ts +51 -1
  332. package/dist/server/server-adapter/index.d.ts.map +1 -1
  333. package/dist/server/server-adapter/index.js +70 -9
  334. package/dist/server/server-adapter/index.js.map +1 -1
  335. package/dist/server/server-adapter/openapi-utils.d.ts.map +1 -1
  336. package/dist/server/server-adapter/routes/a2a.d.ts +546 -398
  337. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
  338. package/dist/server/server-adapter/routes/agent-builder.d.ts +1054 -749
  339. package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -1
  340. package/dist/server/server-adapter/routes/channels.d.ts +153 -73
  341. package/dist/server/server-adapter/routes/channels.d.ts.map +1 -1
  342. package/dist/server/server-adapter/routes/conversations.d.ts +218 -138
  343. package/dist/server/server-adapter/routes/conversations.d.ts.map +1 -1
  344. package/dist/server/server-adapter/routes/datasets.d.ts +2312 -1877
  345. package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
  346. package/dist/server/server-adapter/routes/dynamic-workflows.d.ts +16 -0
  347. package/dist/server/server-adapter/routes/dynamic-workflows.d.ts.map +1 -0
  348. package/dist/server/server-adapter/routes/editor-builder.d.ts +506 -349
  349. package/dist/server/server-adapter/routes/editor-builder.d.ts.map +1 -1
  350. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  351. package/dist/server/server-adapter/routes/legacy.d.ts +615 -629
  352. package/dist/server/server-adapter/routes/legacy.d.ts.map +1 -1
  353. package/dist/server/server-adapter/routes/logs.d.ts +243 -183
  354. package/dist/server/server-adapter/routes/logs.d.ts.map +1 -1
  355. package/dist/server/server-adapter/routes/mcp.d.ts +347 -147
  356. package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -1
  357. package/dist/server/server-adapter/routes/memory.d.ts +1699 -1199
  358. package/dist/server/server-adapter/routes/memory.d.ts.map +1 -1
  359. package/dist/server/server-adapter/routes/observability.d.ts +2761 -2103
  360. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  361. package/dist/server/server-adapter/routes/processor-providers.d.ts +70 -30
  362. package/dist/server/server-adapter/routes/processor-providers.d.ts.map +1 -1
  363. package/dist/server/server-adapter/routes/processors.d.ts +220 -171
  364. package/dist/server/server-adapter/routes/processors.d.ts.map +1 -1
  365. package/dist/server/server-adapter/routes/responses.d.ts +350 -360
  366. package/dist/server/server-adapter/routes/responses.d.ts.map +1 -1
  367. package/dist/server/server-adapter/routes/route-builder.d.ts +6 -2
  368. package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
  369. package/dist/server/server-adapter/routes/scorers.d.ts +282 -162
  370. package/dist/server/server-adapter/routes/scorers.d.ts.map +1 -1
  371. package/dist/server/server-adapter/routes/stored-mcp-clients.d.ts +821 -588
  372. package/dist/server/server-adapter/routes/stored-mcp-clients.d.ts.map +1 -1
  373. package/dist/server/server-adapter/routes/stored-prompt-blocks.d.ts +1252 -1064
  374. package/dist/server/server-adapter/routes/stored-prompt-blocks.d.ts.map +1 -1
  375. package/dist/server/server-adapter/routes/stored-scorers.d.ts +1046 -822
  376. package/dist/server/server-adapter/routes/stored-scorers.d.ts.map +1 -1
  377. package/dist/server/server-adapter/routes/stored-skills.d.ts +683 -526
  378. package/dist/server/server-adapter/routes/stored-skills.d.ts.map +1 -1
  379. package/dist/server/server-adapter/routes/stored-workspaces.d.ts +637 -537
  380. package/dist/server/server-adapter/routes/stored-workspaces.d.ts.map +1 -1
  381. package/dist/server/server-adapter/routes/system.d.ts +145 -105
  382. package/dist/server/server-adapter/routes/system.d.ts.map +1 -1
  383. package/dist/server/server-adapter/routes/tool-providers.d.ts +566 -317
  384. package/dist/server/server-adapter/routes/tool-providers.d.ts.map +1 -1
  385. package/dist/server/server-adapter/routes/tools.d.ts +103 -43
  386. package/dist/server/server-adapter/routes/tools.d.ts.map +1 -1
  387. package/dist/server/server-adapter/routes/vectors.d.ts +275 -119
  388. package/dist/server/server-adapter/routes/vectors.d.ts.map +1 -1
  389. package/dist/server/server-adapter/routes/workflows.d.ts +1586 -1098
  390. package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
  391. package/dist/server/server-adapter/routes/workspace.d.ts +1026 -613
  392. package/dist/server/server-adapter/routes/workspace.d.ts.map +1 -1
  393. package/dist/{stored-agents-D8ar1Pn7.js → stored-agents-BRBZM-Xl.js} +4 -4
  394. package/dist/{stored-agents-D8ar1Pn7.js.map → stored-agents-BRBZM-Xl.js.map} +1 -1
  395. package/dist/{stored-agents-DKd89v5z.cjs → stored-agents-CPxfYRH9.cjs} +4 -4
  396. package/dist/{stored-agents-DKd89v5z.cjs.map → stored-agents-CPxfYRH9.cjs.map} +1 -1
  397. package/dist/{stored-mcp-clients-CwA5_nZ9.cjs → stored-mcp-clients-CJJPe_09.cjs} +2 -2
  398. package/dist/{stored-mcp-clients-CwA5_nZ9.cjs.map → stored-mcp-clients-CJJPe_09.cjs.map} +1 -1
  399. package/dist/{stored-mcp-clients-DJ3E4g8-.js → stored-mcp-clients-CoCfZRhw.js} +2 -2
  400. package/dist/{stored-mcp-clients-DJ3E4g8-.js.map → stored-mcp-clients-CoCfZRhw.js.map} +1 -1
  401. package/dist/{stored-prompt-blocks-BlqcqnEX.js → stored-prompt-blocks-DcmkZaCm.js} +2 -2
  402. package/dist/{stored-prompt-blocks-BlqcqnEX.js.map → stored-prompt-blocks-DcmkZaCm.js.map} +1 -1
  403. package/dist/{stored-prompt-blocks-DR_Wts8r.cjs → stored-prompt-blocks-XI4frgZv.cjs} +2 -2
  404. package/dist/{stored-prompt-blocks-DR_Wts8r.cjs.map → stored-prompt-blocks-XI4frgZv.cjs.map} +1 -1
  405. package/dist/{stored-scorers-BIKumDRO.js → stored-scorers-B__LF0Cy.js} +3 -3
  406. package/dist/{stored-scorers-BIKumDRO.js.map → stored-scorers-B__LF0Cy.js.map} +1 -1
  407. package/dist/{stored-scorers-_dqFdh-G.cjs → stored-scorers-Cml7jPJv.cjs} +3 -3
  408. package/dist/{stored-scorers-_dqFdh-G.cjs.map → stored-scorers-Cml7jPJv.cjs.map} +1 -1
  409. package/dist/{stored-skills-CgwoCNNV.cjs → stored-skills-BqNK0ssS.cjs} +2 -2
  410. package/dist/{stored-skills-CgwoCNNV.cjs.map → stored-skills-BqNK0ssS.cjs.map} +1 -1
  411. package/dist/{stored-skills-B_aAMn5W.js → stored-skills-JTWbMybs.js} +2 -2
  412. package/dist/{stored-skills-B_aAMn5W.js.map → stored-skills-JTWbMybs.js.map} +1 -1
  413. package/dist/{stored-workspaces-Dib-ClOP.js → stored-workspaces-6PYE4Y3m.js} +2 -2
  414. package/dist/{stored-workspaces-Dib-ClOP.js.map → stored-workspaces-6PYE4Y3m.js.map} +1 -1
  415. package/dist/{stored-workspaces-CbJQaFuP.cjs → stored-workspaces-Dl8B20LD.cjs} +2 -2
  416. package/dist/{stored-workspaces-CbJQaFuP.cjs.map → stored-workspaces-Dl8B20LD.cjs.map} +1 -1
  417. package/dist/sync-BHatXKfg.cjs +1679 -0
  418. package/dist/sync-BHatXKfg.cjs.map +1 -0
  419. package/dist/sync-djJ8Lmds.js +1656 -0
  420. package/dist/sync-djJ8Lmds.js.map +1 -0
  421. package/dist/{utils-wESuBh27.cjs → utils-Bna_JCkb.cjs} +3 -3
  422. package/dist/{utils-wESuBh27.cjs.map → utils-Bna_JCkb.cjs.map} +1 -1
  423. package/dist/{utils-BUK03Frl.js → utils-QXKhjIm6.js} +3 -3
  424. package/dist/{utils-BUK03Frl.js.map → utils-QXKhjIm6.js.map} +1 -1
  425. package/dist/{vectors-CZY34X8R.js → vectors-Ck7Qu6yz.js} +2 -2
  426. package/dist/{vectors-CZY34X8R.js.map → vectors-Ck7Qu6yz.js.map} +1 -1
  427. package/dist/{vectors-Cj-SPxOy.cjs → vectors-D6uZn2f1.cjs} +2 -2
  428. package/dist/{vectors-Cj-SPxOy.cjs.map → vectors-D6uZn2f1.cjs.map} +1 -1
  429. package/dist/{version-common-CEBQY7M8.cjs → version-common-AtNRQ5xH.cjs} +2 -2
  430. package/dist/{version-common-CEBQY7M8.cjs.map → version-common-AtNRQ5xH.cjs.map} +1 -1
  431. package/dist/{version-common-Cmd1f9JX.js → version-common-CudZ_WuW.js} +2 -2
  432. package/dist/{version-common-Cmd1f9JX.js.map → version-common-CudZ_WuW.js.map} +1 -1
  433. package/dist/{workflows-XfiENvkF.cjs → workflows--79xhOOb.cjs} +14 -3
  434. package/dist/workflows--79xhOOb.cjs.map +1 -0
  435. package/dist/{workflows-DPW6FrY0.js → workflows-B2ooCiwN.js} +9 -4
  436. package/dist/workflows-B2ooCiwN.js.map +1 -0
  437. package/package.json +6 -6
  438. package/dist/a2a-CHi9AJ0n.js.map +0 -1
  439. package/dist/a2a-CnU9zaGR.js.map +0 -1
  440. package/dist/a2a-D3ZYeXIx.cjs.map +0 -1
  441. package/dist/a2a-oM7aqLz4.cjs.map +0 -1
  442. package/dist/agents-CYvun9iI.js.map +0 -1
  443. package/dist/agents-Dk2qoJi_.cjs.map +0 -1
  444. package/dist/common-CPNOpqxA.js.map +0 -1
  445. package/dist/common-spbwhiWS.cjs.map +0 -1
  446. package/dist/dist-DgY0llRv.cjs.map +0 -1
  447. package/dist/dist-IUXZtNBY.js.map +0 -1
  448. package/dist/probe-image-size-BQgIJeY_.js.map +0 -1
  449. package/dist/probe-image-size-DYJVSL0b.cjs.map +0 -1
  450. package/dist/route-builder-CIk5k35M.js.map +0 -1
  451. package/dist/route-builder-CgLVYL1c.cjs.map +0 -1
  452. package/dist/routes-BzR8iVj4.cjs.map +0 -1
  453. package/dist/routes-C7iRCN_l.js.map +0 -1
  454. package/dist/schema-B8-5YCsA.js +0 -2
  455. package/dist/schema-BieM1qrc.cjs +0 -1
  456. package/dist/schema-Bv9OdW1f-BY6u3u8K.cjs.map +0 -1
  457. package/dist/schema-Bv9OdW1f-CIOfv-3w.js.map +0 -1
  458. package/dist/server/handlers/stored-workflows.cjs +0 -6
  459. package/dist/server/handlers/stored-workflows.d.ts +0 -820
  460. package/dist/server/handlers/stored-workflows.js +0 -2
  461. package/dist/server/schemas/stored-workflows.d.ts.map +0 -1
  462. package/dist/server/server-adapter/routes/stored-workflows.d.ts +0 -16
  463. package/dist/server/server-adapter/routes/stored-workflows.d.ts.map +0 -1
  464. package/dist/stored-workflows-OanG0TmB.js.map +0 -1
  465. package/dist/stored-workflows-pCiWK305.cjs.map +0 -1
  466. package/dist/workflows-DPW6FrY0.js.map +0 -1
  467. package/dist/workflows-XfiENvkF.cjs.map +0 -1
@@ -1,7 +1,8 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
2
- const require_schema_Bv9OdW1f = require("./schema-Bv9OdW1f-BY6u3u8K.cjs");
3
- require("./schema-BieM1qrc.cjs");
4
- const require_dist$1 = require("./dist-CAVC0nWG.cjs");
2
+ const require_schema_Bv9OdW1f = require("./schema-Bv9OdW1f-CHHI-NTr.cjs");
3
+ require("./schema-DkBbires.cjs");
4
+ const require_sync$1 = require("./sync-BHatXKfg.cjs");
5
+ const require_dist = require("./dist-CAVC0nWG.cjs");
5
6
  let zod_v4 = require("zod/v4");
6
7
  zod_v4 = require_rolldown_runtime.__toESM(zod_v4, 1);
7
8
  let _mastra_core_schema = require("@mastra/core/schema");
@@ -4083,1278 +4084,8 @@ function getCharacterCount(text) {
4083
4084
  return Array.from(text).length;
4084
4085
  }
4085
4086
  //#endregion
4086
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/inherits/2.0.4/3ed134d32829ca149a6c475be3507d0f5d7d58b7bb2c1b0fb4c43b3e2f7ba5d2/node_modules/inherits/inherits_browser.js
4087
- var require_inherits_browser = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
4088
- if (typeof Object.create === "function") module.exports = function inherits(ctor, superCtor) {
4089
- if (superCtor) {
4090
- ctor.super_ = superCtor;
4091
- ctor.prototype = Object.create(superCtor.prototype, { constructor: {
4092
- value: ctor,
4093
- enumerable: false,
4094
- writable: true,
4095
- configurable: true
4096
- } });
4097
- }
4098
- };
4099
- else module.exports = function inherits(ctor, superCtor) {
4100
- if (superCtor) {
4101
- ctor.super_ = superCtor;
4102
- var TempCtor = function() {};
4103
- TempCtor.prototype = superCtor.prototype;
4104
- ctor.prototype = new TempCtor();
4105
- ctor.prototype.constructor = ctor;
4106
- }
4107
- };
4108
- }));
4109
- //#endregion
4110
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/inherits/2.0.4/3ed134d32829ca149a6c475be3507d0f5d7d58b7bb2c1b0fb4c43b3e2f7ba5d2/node_modules/inherits/inherits.js
4111
- var require_inherits = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
4112
- try {
4113
- var util$1 = require("util");
4114
- /* istanbul ignore next */
4115
- if (typeof util$1.inherits !== "function") throw "";
4116
- module.exports = util$1.inherits;
4117
- } catch (e) {
4118
- /* istanbul ignore next */
4119
- module.exports = require_inherits_browser();
4120
- }
4121
- }));
4122
- //#endregion
4123
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/queue/6.0.2/1ff508d6efe0b00278160bee66f3e5c85b96dfb4a4e9ee9d48c68898ab3c428f/node_modules/queue/index.js
4124
- var require_queue = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
4125
- var inherits = require_inherits();
4126
- var EventEmitter = require("events").EventEmitter;
4127
- module.exports = Queue;
4128
- module.exports.default = Queue;
4129
- function Queue(options) {
4130
- if (!(this instanceof Queue)) return new Queue(options);
4131
- EventEmitter.call(this);
4132
- options = options || {};
4133
- this.concurrency = options.concurrency || Infinity;
4134
- this.timeout = options.timeout || 0;
4135
- this.autostart = options.autostart || false;
4136
- this.results = options.results || null;
4137
- this.pending = 0;
4138
- this.session = 0;
4139
- this.running = false;
4140
- this.jobs = [];
4141
- this.timers = {};
4142
- }
4143
- inherits(Queue, EventEmitter);
4144
- [
4145
- "pop",
4146
- "shift",
4147
- "indexOf",
4148
- "lastIndexOf"
4149
- ].forEach(function(method) {
4150
- Queue.prototype[method] = function() {
4151
- return Array.prototype[method].apply(this.jobs, arguments);
4152
- };
4153
- });
4154
- Queue.prototype.slice = function(begin, end) {
4155
- this.jobs = this.jobs.slice(begin, end);
4156
- return this;
4157
- };
4158
- Queue.prototype.reverse = function() {
4159
- this.jobs.reverse();
4160
- return this;
4161
- };
4162
- [
4163
- "push",
4164
- "unshift",
4165
- "splice"
4166
- ].forEach(function(method) {
4167
- Queue.prototype[method] = function() {
4168
- var methodResult = Array.prototype[method].apply(this.jobs, arguments);
4169
- if (this.autostart) this.start();
4170
- return methodResult;
4171
- };
4172
- });
4173
- Object.defineProperty(Queue.prototype, "length", { get: function() {
4174
- return this.pending + this.jobs.length;
4175
- } });
4176
- Queue.prototype.start = function(cb) {
4177
- if (cb) callOnErrorOrEnd.call(this, cb);
4178
- this.running = true;
4179
- if (this.pending >= this.concurrency) return;
4180
- if (this.jobs.length === 0) {
4181
- if (this.pending === 0) done.call(this);
4182
- return;
4183
- }
4184
- var self = this;
4185
- var job = this.jobs.shift();
4186
- var once = true;
4187
- var session = this.session;
4188
- var timeoutId = null;
4189
- var didTimeout = false;
4190
- var resultIndex = null;
4191
- var timeout = job.hasOwnProperty("timeout") ? job.timeout : this.timeout;
4192
- function next(err, result) {
4193
- if (once && self.session === session) {
4194
- once = false;
4195
- self.pending--;
4196
- if (timeoutId !== null) {
4197
- delete self.timers[timeoutId];
4198
- clearTimeout(timeoutId);
4199
- }
4200
- if (err) self.emit("error", err, job);
4201
- else if (didTimeout === false) {
4202
- if (resultIndex !== null) self.results[resultIndex] = Array.prototype.slice.call(arguments, 1);
4203
- self.emit("success", result, job);
4204
- }
4205
- if (self.session === session) {
4206
- if (self.pending === 0 && self.jobs.length === 0) done.call(self);
4207
- else if (self.running) self.start();
4208
- }
4209
- }
4210
- }
4211
- if (timeout) {
4212
- timeoutId = setTimeout(function() {
4213
- didTimeout = true;
4214
- if (self.listeners("timeout").length > 0) self.emit("timeout", next, job);
4215
- else next();
4216
- }, timeout);
4217
- this.timers[timeoutId] = timeoutId;
4218
- }
4219
- if (this.results) {
4220
- resultIndex = this.results.length;
4221
- this.results[resultIndex] = null;
4222
- }
4223
- this.pending++;
4224
- self.emit("start", job);
4225
- var promise = job(next);
4226
- if (promise && promise.then && typeof promise.then === "function") promise.then(function(result) {
4227
- return next(null, result);
4228
- }).catch(function(err) {
4229
- return next(err || true);
4230
- });
4231
- if (this.running && this.jobs.length > 0) this.start();
4232
- };
4233
- Queue.prototype.stop = function() {
4234
- this.running = false;
4235
- };
4236
- Queue.prototype.end = function(err) {
4237
- clearTimers.call(this);
4238
- this.jobs.length = 0;
4239
- this.pending = 0;
4240
- done.call(this, err);
4241
- };
4242
- function clearTimers() {
4243
- for (var key in this.timers) {
4244
- var timeoutId = this.timers[key];
4245
- delete this.timers[key];
4246
- clearTimeout(timeoutId);
4247
- }
4248
- }
4249
- function callOnErrorOrEnd(cb) {
4250
- var self = this;
4251
- this.on("error", onerror);
4252
- this.on("end", onend);
4253
- function onerror(err) {
4254
- self.end(err);
4255
- }
4256
- function onend(err) {
4257
- self.removeListener("error", onerror);
4258
- self.removeListener("end", onend);
4259
- cb(err, this.results);
4260
- }
4261
- }
4262
- function done(err) {
4263
- this.session++;
4264
- this.running = false;
4265
- this.emit("end", err);
4266
- }
4267
- }));
4268
- //#endregion
4269
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/utils.js
4270
- var require_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4271
- Object.defineProperty(exports, "__esModule", { value: true });
4272
- exports.findBox = exports.readUInt = exports.readUInt32LE = exports.readUInt32BE = exports.readInt32LE = exports.readUInt24LE = exports.readUInt16LE = exports.readUInt16BE = exports.readInt16LE = exports.toHexString = exports.toUTF8String = void 0;
4273
- const decoder = new TextDecoder();
4274
- const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
4275
- exports.toUTF8String = toUTF8String;
4276
- const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
4277
- exports.toHexString = toHexString;
4278
- const readInt16LE = (input, offset = 0) => {
4279
- const val = input[offset] + input[offset + 1] * 2 ** 8;
4280
- return val | (val & 2 ** 15) * 131070;
4281
- };
4282
- exports.readInt16LE = readInt16LE;
4283
- const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
4284
- exports.readUInt16BE = readUInt16BE;
4285
- const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8;
4286
- exports.readUInt16LE = readUInt16LE;
4287
- const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16;
4288
- exports.readUInt24LE = readUInt24LE;
4289
- const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24);
4290
- exports.readInt32LE = readInt32LE;
4291
- const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3];
4292
- exports.readUInt32BE = readUInt32BE;
4293
- const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24;
4294
- exports.readUInt32LE = readUInt32LE;
4295
- const methods = {
4296
- readUInt16BE: exports.readUInt16BE,
4297
- readUInt16LE: exports.readUInt16LE,
4298
- readUInt32BE: exports.readUInt32BE,
4299
- readUInt32LE: exports.readUInt32LE
4300
- };
4301
- function readUInt(input, bits, offset, isBigEndian) {
4302
- offset = offset || 0;
4303
- const endian = isBigEndian ? "BE" : "LE";
4304
- const methodName = "readUInt" + bits + endian;
4305
- return methods[methodName](input, offset);
4306
- }
4307
- exports.readUInt = readUInt;
4308
- function readBox(input, offset) {
4309
- if (input.length - offset < 4) return;
4310
- const boxSize = (0, exports.readUInt32BE)(input, offset);
4311
- if (input.length - offset < boxSize) return;
4312
- return {
4313
- name: (0, exports.toUTF8String)(input, 4 + offset, 8 + offset),
4314
- offset,
4315
- size: boxSize
4316
- };
4317
- }
4318
- function findBox(input, boxName, offset) {
4319
- while (offset < input.length) {
4320
- const box = readBox(input, offset);
4321
- if (!box) break;
4322
- if (box.name === boxName) return box;
4323
- offset += box.size > 0 ? box.size : 8;
4324
- }
4325
- }
4326
- exports.findBox = findBox;
4327
- }));
4328
- //#endregion
4329
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/bmp.js
4330
- var require_bmp = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4331
- Object.defineProperty(exports, "__esModule", { value: true });
4332
- exports.BMP = void 0;
4333
- const utils_1 = require_utils();
4334
- exports.BMP = {
4335
- validate: (input) => (0, utils_1.toUTF8String)(input, 0, 2) === "BM",
4336
- calculate: (input) => ({
4337
- height: Math.abs((0, utils_1.readInt32LE)(input, 22)),
4338
- width: (0, utils_1.readUInt32LE)(input, 18)
4339
- })
4340
- };
4341
- }));
4342
- //#endregion
4343
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/ico.js
4344
- var require_ico = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4345
- Object.defineProperty(exports, "__esModule", { value: true });
4346
- exports.ICO = void 0;
4347
- const utils_1 = require_utils();
4348
- const TYPE_ICON = 1;
4349
- /**
4350
- * ICON Header
4351
- *
4352
- * | Offset | Size | Purpose |
4353
- * | 0 | 2 | Reserved. Must always be 0. |
4354
- * | 2 | 2 | Image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid. |
4355
- * | 4 | 2 | Number of images in the file. |
4356
- *
4357
- */
4358
- const SIZE_HEADER = 6;
4359
- /**
4360
- * Image Entry
4361
- *
4362
- * | Offset | Size | Purpose |
4363
- * | 0 | 1 | Image width in pixels. Can be any number between 0 and 255. Value 0 means width is 256 pixels. |
4364
- * | 1 | 1 | Image height in pixels. Can be any number between 0 and 255. Value 0 means height is 256 pixels. |
4365
- * | 2 | 1 | Number of colors in the color palette. Should be 0 if the image does not use a color palette. |
4366
- * | 3 | 1 | Reserved. Should be 0. |
4367
- * | 4 | 2 | ICO format: Color planes. Should be 0 or 1. |
4368
- * | | | CUR format: The horizontal coordinates of the hotspot in number of pixels from the left. |
4369
- * | 6 | 2 | ICO format: Bits per pixel. |
4370
- * | | | CUR format: The vertical coordinates of the hotspot in number of pixels from the top. |
4371
- * | 8 | 4 | The size of the image's data in bytes |
4372
- * | 12 | 4 | The offset of BMP or PNG data from the beginning of the ICO/CUR file |
4373
- *
4374
- */
4375
- const SIZE_IMAGE_ENTRY = 16;
4376
- function getSizeFromOffset(input, offset) {
4377
- const value = input[offset];
4378
- return value === 0 ? 256 : value;
4379
- }
4380
- function getImageSize(input, imageIndex) {
4381
- const offset = SIZE_HEADER + imageIndex * SIZE_IMAGE_ENTRY;
4382
- return {
4383
- height: getSizeFromOffset(input, offset + 1),
4384
- width: getSizeFromOffset(input, offset)
4385
- };
4386
- }
4387
- exports.ICO = {
4388
- validate(input) {
4389
- const reserved = (0, utils_1.readUInt16LE)(input, 0);
4390
- const imageCount = (0, utils_1.readUInt16LE)(input, 4);
4391
- if (reserved !== 0 || imageCount === 0) return false;
4392
- return (0, utils_1.readUInt16LE)(input, 2) === TYPE_ICON;
4393
- },
4394
- calculate(input) {
4395
- const nbImages = (0, utils_1.readUInt16LE)(input, 4);
4396
- const imageSize = getImageSize(input, 0);
4397
- if (nbImages === 1) return imageSize;
4398
- const imgs = [imageSize];
4399
- for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) imgs.push(getImageSize(input, imageIndex));
4400
- return {
4401
- height: imageSize.height,
4402
- images: imgs,
4403
- width: imageSize.width
4404
- };
4405
- }
4406
- };
4407
- }));
4408
- //#endregion
4409
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/cur.js
4410
- var require_cur = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4411
- Object.defineProperty(exports, "__esModule", { value: true });
4412
- exports.CUR = void 0;
4413
- const ico_1 = require_ico();
4414
- const utils_1 = require_utils();
4415
- const TYPE_CURSOR = 2;
4416
- exports.CUR = {
4417
- validate(input) {
4418
- const reserved = (0, utils_1.readUInt16LE)(input, 0);
4419
- const imageCount = (0, utils_1.readUInt16LE)(input, 4);
4420
- if (reserved !== 0 || imageCount === 0) return false;
4421
- return (0, utils_1.readUInt16LE)(input, 2) === TYPE_CURSOR;
4422
- },
4423
- calculate: (input) => ico_1.ICO.calculate(input)
4424
- };
4425
- }));
4426
- //#endregion
4427
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/dds.js
4428
- var require_dds = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4429
- Object.defineProperty(exports, "__esModule", { value: true });
4430
- exports.DDS = void 0;
4431
- const utils_1 = require_utils();
4432
- exports.DDS = {
4433
- validate: (input) => (0, utils_1.readUInt32LE)(input, 0) === 542327876,
4434
- calculate: (input) => ({
4435
- height: (0, utils_1.readUInt32LE)(input, 12),
4436
- width: (0, utils_1.readUInt32LE)(input, 16)
4437
- })
4438
- };
4439
- }));
4440
- //#endregion
4441
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/gif.js
4442
- var require_gif = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4443
- Object.defineProperty(exports, "__esModule", { value: true });
4444
- exports.GIF = void 0;
4445
- const utils_1 = require_utils();
4446
- const gifRegexp = /^GIF8[79]a/;
4447
- exports.GIF = {
4448
- validate: (input) => gifRegexp.test((0, utils_1.toUTF8String)(input, 0, 6)),
4449
- calculate: (input) => ({
4450
- height: (0, utils_1.readUInt16LE)(input, 8),
4451
- width: (0, utils_1.readUInt16LE)(input, 6)
4452
- })
4453
- };
4454
- }));
4455
- //#endregion
4456
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/heif.js
4457
- var require_heif = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4458
- Object.defineProperty(exports, "__esModule", { value: true });
4459
- exports.HEIF = void 0;
4460
- const utils_1 = require_utils();
4461
- const brandMap = {
4462
- avif: "avif",
4463
- mif1: "heif",
4464
- msf1: "heif",
4465
- heic: "heic",
4466
- heix: "heic",
4467
- hevc: "heic",
4468
- hevx: "heic"
4469
- };
4470
- exports.HEIF = {
4471
- validate(input) {
4472
- if ((0, utils_1.toUTF8String)(input, 4, 8) !== "ftyp") return false;
4473
- const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
4474
- if (!ftypBox) return false;
4475
- return (0, utils_1.toUTF8String)(input, ftypBox.offset + 8, ftypBox.offset + 12) in brandMap;
4476
- },
4477
- calculate(input) {
4478
- const metaBox = (0, utils_1.findBox)(input, "meta", 0);
4479
- const iprpBox = metaBox && (0, utils_1.findBox)(input, "iprp", metaBox.offset + 12);
4480
- const ipcoBox = iprpBox && (0, utils_1.findBox)(input, "ipco", iprpBox.offset + 8);
4481
- const ispeBox = ipcoBox && (0, utils_1.findBox)(input, "ispe", ipcoBox.offset + 8);
4482
- if (ispeBox) return {
4483
- height: (0, utils_1.readUInt32BE)(input, ispeBox.offset + 16),
4484
- width: (0, utils_1.readUInt32BE)(input, ispeBox.offset + 12),
4485
- type: (0, utils_1.toUTF8String)(input, 8, 12)
4486
- };
4487
- throw new TypeError("Invalid HEIF, no size found");
4488
- }
4489
- };
4490
- }));
4491
- //#endregion
4492
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/icns.js
4493
- var require_icns = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4494
- Object.defineProperty(exports, "__esModule", { value: true });
4495
- exports.ICNS = void 0;
4496
- const utils_1 = require_utils();
4497
- /**
4498
- * ICNS Header
4499
- *
4500
- * | Offset | Size | Purpose |
4501
- * | 0 | 4 | Magic literal, must be "icns" (0x69, 0x63, 0x6e, 0x73) |
4502
- * | 4 | 4 | Length of file, in bytes, msb first. |
4503
- *
4504
- */
4505
- const SIZE_HEADER = 8;
4506
- const FILE_LENGTH_OFFSET = 4;
4507
- /**
4508
- * Image Entry
4509
- *
4510
- * | Offset | Size | Purpose |
4511
- * | 0 | 4 | Icon type, see OSType below. |
4512
- * | 4 | 4 | Length of data, in bytes (including type and length), msb first. |
4513
- * | 8 | n | Icon data |
4514
- */
4515
- const ENTRY_LENGTH_OFFSET = 4;
4516
- const ICON_TYPE_SIZE = {
4517
- ICON: 32,
4518
- "ICN#": 32,
4519
- "icm#": 16,
4520
- icm4: 16,
4521
- icm8: 16,
4522
- "ics#": 16,
4523
- ics4: 16,
4524
- ics8: 16,
4525
- is32: 16,
4526
- s8mk: 16,
4527
- icp4: 16,
4528
- icl4: 32,
4529
- icl8: 32,
4530
- il32: 32,
4531
- l8mk: 32,
4532
- icp5: 32,
4533
- ic11: 32,
4534
- ich4: 48,
4535
- ich8: 48,
4536
- ih32: 48,
4537
- h8mk: 48,
4538
- icp6: 64,
4539
- ic12: 32,
4540
- it32: 128,
4541
- t8mk: 128,
4542
- ic07: 128,
4543
- ic08: 256,
4544
- ic13: 256,
4545
- ic09: 512,
4546
- ic14: 512,
4547
- ic10: 1024
4548
- };
4549
- function readImageHeader(input, imageOffset) {
4550
- const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
4551
- return [(0, utils_1.toUTF8String)(input, imageOffset, imageLengthOffset), (0, utils_1.readUInt32BE)(input, imageLengthOffset)];
4552
- }
4553
- function getImageSize(type) {
4554
- const size = ICON_TYPE_SIZE[type];
4555
- return {
4556
- width: size,
4557
- height: size,
4558
- type
4559
- };
4560
- }
4561
- exports.ICNS = {
4562
- validate: (input) => (0, utils_1.toUTF8String)(input, 0, 4) === "icns",
4563
- calculate(input) {
4564
- const inputLength = input.length;
4565
- const fileLength = (0, utils_1.readUInt32BE)(input, FILE_LENGTH_OFFSET);
4566
- let imageOffset = SIZE_HEADER;
4567
- let imageHeader = readImageHeader(input, imageOffset);
4568
- let imageSize = getImageSize(imageHeader[0]);
4569
- imageOffset += imageHeader[1];
4570
- if (imageOffset === fileLength) return imageSize;
4571
- const result = {
4572
- height: imageSize.height,
4573
- images: [imageSize],
4574
- width: imageSize.width
4575
- };
4576
- while (imageOffset < fileLength && imageOffset < inputLength) {
4577
- imageHeader = readImageHeader(input, imageOffset);
4578
- imageSize = getImageSize(imageHeader[0]);
4579
- imageOffset += imageHeader[1];
4580
- result.images.push(imageSize);
4581
- }
4582
- return result;
4583
- }
4584
- };
4585
- }));
4586
- //#endregion
4587
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/j2c.js
4588
- var require_j2c = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4589
- Object.defineProperty(exports, "__esModule", { value: true });
4590
- exports.J2C = void 0;
4591
- const utils_1 = require_utils();
4592
- exports.J2C = {
4593
- validate: (input) => (0, utils_1.readUInt32BE)(input, 0) === 4283432785,
4594
- calculate: (input) => ({
4595
- height: (0, utils_1.readUInt32BE)(input, 12),
4596
- width: (0, utils_1.readUInt32BE)(input, 8)
4597
- })
4598
- };
4599
- }));
4600
- //#endregion
4601
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jp2.js
4602
- var require_jp2 = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4603
- Object.defineProperty(exports, "__esModule", { value: true });
4604
- exports.JP2 = void 0;
4605
- const utils_1 = require_utils();
4606
- exports.JP2 = {
4607
- validate(input) {
4608
- if ((0, utils_1.toUTF8String)(input, 4, 8) !== "jP ") return false;
4609
- const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
4610
- if (!ftypBox) return false;
4611
- return (0, utils_1.toUTF8String)(input, ftypBox.offset + 8, ftypBox.offset + 12) === "jp2 ";
4612
- },
4613
- calculate(input) {
4614
- const jp2hBox = (0, utils_1.findBox)(input, "jp2h", 0);
4615
- const ihdrBox = jp2hBox && (0, utils_1.findBox)(input, "ihdr", jp2hBox.offset + 8);
4616
- if (ihdrBox) return {
4617
- height: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 8),
4618
- width: (0, utils_1.readUInt32BE)(input, ihdrBox.offset + 12)
4619
- };
4620
- throw new TypeError("Unsupported JPEG 2000 format");
4621
- }
4622
- };
4623
- }));
4624
- //#endregion
4625
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jpg.js
4626
- var require_jpg = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4627
- Object.defineProperty(exports, "__esModule", { value: true });
4628
- exports.JPG = void 0;
4629
- const utils_1 = require_utils();
4630
- const EXIF_MARKER = "45786966";
4631
- const APP1_DATA_SIZE_BYTES = 2;
4632
- const EXIF_HEADER_BYTES = 6;
4633
- const BIG_ENDIAN_BYTE_ALIGN = "4d4d";
4634
- const LITTLE_ENDIAN_BYTE_ALIGN = "4949";
4635
- const IDF_ENTRY_BYTES = 12;
4636
- function isEXIF(input) {
4637
- return (0, utils_1.toHexString)(input, 2, 6) === EXIF_MARKER;
4638
- }
4639
- function extractSize(input, index) {
4640
- return {
4641
- height: (0, utils_1.readUInt16BE)(input, index),
4642
- width: (0, utils_1.readUInt16BE)(input, index + 2)
4643
- };
4644
- }
4645
- function extractOrientation(exifBlock, isBigEndian) {
4646
- const idfDirectoryEntries = (0, utils_1.readUInt)(exifBlock, 16, 14, isBigEndian);
4647
- for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
4648
- const start = 16 + directoryEntryNumber * IDF_ENTRY_BYTES;
4649
- const end = start + IDF_ENTRY_BYTES;
4650
- if (start > exifBlock.length) return;
4651
- const block = exifBlock.slice(start, end);
4652
- if ((0, utils_1.readUInt)(block, 16, 0, isBigEndian) === 274) {
4653
- if ((0, utils_1.readUInt)(block, 16, 2, isBigEndian) !== 3) return;
4654
- if ((0, utils_1.readUInt)(block, 32, 4, isBigEndian) !== 1) return;
4655
- return (0, utils_1.readUInt)(block, 16, 8, isBigEndian);
4656
- }
4657
- }
4658
- }
4659
- function validateExifBlock(input, index) {
4660
- const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
4661
- const byteAlign = (0, utils_1.toHexString)(exifBlock, EXIF_HEADER_BYTES, 8);
4662
- const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
4663
- if (isBigEndian || byteAlign === LITTLE_ENDIAN_BYTE_ALIGN) return extractOrientation(exifBlock, isBigEndian);
4664
- }
4665
- function validateInput(input, index) {
4666
- if (index > input.length) throw new TypeError("Corrupt JPG, exceeded buffer limits");
4667
- }
4668
- exports.JPG = {
4669
- validate: (input) => (0, utils_1.toHexString)(input, 0, 2) === "ffd8",
4670
- calculate(input) {
4671
- input = input.slice(4);
4672
- let orientation;
4673
- let next;
4674
- while (input.length) {
4675
- const i = (0, utils_1.readUInt16BE)(input, 0);
4676
- if (input[i] !== 255) {
4677
- input = input.slice(1);
4678
- continue;
4679
- }
4680
- if (isEXIF(input)) orientation = validateExifBlock(input, i);
4681
- validateInput(input, i);
4682
- next = input[i + 1];
4683
- if (next === 192 || next === 193 || next === 194) {
4684
- const size = extractSize(input, i + 5);
4685
- if (!orientation) return size;
4686
- return {
4687
- height: size.height,
4688
- orientation,
4689
- width: size.width
4690
- };
4691
- }
4692
- input = input.slice(i + 2);
4693
- }
4694
- throw new TypeError("Invalid JPG, no size found");
4695
- }
4696
- };
4697
- }));
4698
- //#endregion
4699
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/utils/bit-reader.js
4700
- var require_bit_reader = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4701
- Object.defineProperty(exports, "__esModule", { value: true });
4702
- exports.BitReader = void 0;
4703
- /** This class helps read Uint8Array bit-by-bit */
4704
- var BitReader = class {
4705
- constructor(input, endianness) {
4706
- this.input = input;
4707
- this.endianness = endianness;
4708
- this.byteOffset = 2;
4709
- this.bitOffset = 0;
4710
- }
4711
- /** Reads a specified number of bits, and move the offset */
4712
- getBits(length = 1) {
4713
- let result = 0;
4714
- let bitsRead = 0;
4715
- while (bitsRead < length) {
4716
- if (this.byteOffset >= this.input.length) throw new Error("Reached end of input");
4717
- const currentByte = this.input[this.byteOffset];
4718
- const bitsLeft = 8 - this.bitOffset;
4719
- const bitsToRead = Math.min(length - bitsRead, bitsLeft);
4720
- if (this.endianness === "little-endian") {
4721
- const mask = (1 << bitsToRead) - 1;
4722
- const bits = currentByte >> this.bitOffset & mask;
4723
- result |= bits << bitsRead;
4724
- } else {
4725
- const bits = (currentByte & (1 << bitsToRead) - 1 << 8 - this.bitOffset - bitsToRead) >> 8 - this.bitOffset - bitsToRead;
4726
- result = result << bitsToRead | bits;
4727
- }
4728
- bitsRead += bitsToRead;
4729
- this.bitOffset += bitsToRead;
4730
- if (this.bitOffset === 8) {
4731
- this.byteOffset++;
4732
- this.bitOffset = 0;
4733
- }
4734
- }
4735
- return result;
4736
- }
4737
- };
4738
- exports.BitReader = BitReader;
4739
- }));
4740
- //#endregion
4741
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jxl-stream.js
4742
- var require_jxl_stream = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4743
- Object.defineProperty(exports, "__esModule", { value: true });
4744
- exports.JXLStream = void 0;
4745
- const utils_1 = require_utils();
4746
- const bit_reader_1 = require_bit_reader();
4747
- function calculateImageDimension(reader, isSmallImage) {
4748
- if (isSmallImage) return 8 * (1 + reader.getBits(5));
4749
- else {
4750
- const extraBits = [
4751
- 9,
4752
- 13,
4753
- 18,
4754
- 30
4755
- ][reader.getBits(2)];
4756
- return 1 + reader.getBits(extraBits);
4757
- }
4758
- }
4759
- function calculateImageWidth(reader, isSmallImage, widthMode, height) {
4760
- if (isSmallImage && widthMode === 0) return 8 * (1 + reader.getBits(5));
4761
- else if (widthMode === 0) return calculateImageDimension(reader, false);
4762
- else return Math.floor(height * [
4763
- 1,
4764
- 1.2,
4765
- 4 / 3,
4766
- 1.5,
4767
- 16 / 9,
4768
- 5 / 4,
4769
- 2
4770
- ][widthMode - 1]);
4771
- }
4772
- exports.JXLStream = {
4773
- validate: (input) => {
4774
- return (0, utils_1.toHexString)(input, 0, 2) === "ff0a";
4775
- },
4776
- calculate(input) {
4777
- const reader = new bit_reader_1.BitReader(input, "little-endian");
4778
- const isSmallImage = reader.getBits(1) === 1;
4779
- const height = calculateImageDimension(reader, isSmallImage);
4780
- return {
4781
- width: calculateImageWidth(reader, isSmallImage, reader.getBits(3), height),
4782
- height
4783
- };
4784
- }
4785
- };
4786
- }));
4787
- //#endregion
4788
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/jxl.js
4789
- var require_jxl = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4790
- Object.defineProperty(exports, "__esModule", { value: true });
4791
- exports.JXL = void 0;
4792
- const utils_1 = require_utils();
4793
- const jxl_stream_1 = require_jxl_stream();
4794
- /** Extracts the codestream from a containerized JPEG XL image */
4795
- function extractCodestream(input) {
4796
- const jxlcBox = (0, utils_1.findBox)(input, "jxlc", 0);
4797
- if (jxlcBox) return input.slice(jxlcBox.offset + 8, jxlcBox.offset + jxlcBox.size);
4798
- const partialStreams = extractPartialStreams(input);
4799
- if (partialStreams.length > 0) return concatenateCodestreams(partialStreams);
4800
- }
4801
- /** Extracts partial codestreams from jxlp boxes */
4802
- function extractPartialStreams(input) {
4803
- const partialStreams = [];
4804
- let offset = 0;
4805
- while (offset < input.length) {
4806
- const jxlpBox = (0, utils_1.findBox)(input, "jxlp", offset);
4807
- if (!jxlpBox) break;
4808
- partialStreams.push(input.slice(jxlpBox.offset + 12, jxlpBox.offset + jxlpBox.size));
4809
- offset = jxlpBox.offset + jxlpBox.size;
4810
- }
4811
- return partialStreams;
4812
- }
4813
- /** Concatenates partial codestreams into a single codestream */
4814
- function concatenateCodestreams(partialCodestreams) {
4815
- const totalLength = partialCodestreams.reduce((acc, curr) => acc + curr.length, 0);
4816
- const codestream = new Uint8Array(totalLength);
4817
- let position = 0;
4818
- for (const partial of partialCodestreams) {
4819
- codestream.set(partial, position);
4820
- position += partial.length;
4821
- }
4822
- return codestream;
4823
- }
4824
- exports.JXL = {
4825
- validate: (input) => {
4826
- if ((0, utils_1.toUTF8String)(input, 4, 8) !== "JXL ") return false;
4827
- const ftypBox = (0, utils_1.findBox)(input, "ftyp", 0);
4828
- if (!ftypBox) return false;
4829
- return (0, utils_1.toUTF8String)(input, ftypBox.offset + 8, ftypBox.offset + 12) === "jxl ";
4830
- },
4831
- calculate(input) {
4832
- const codestream = extractCodestream(input);
4833
- if (codestream) return jxl_stream_1.JXLStream.calculate(codestream);
4834
- throw new Error("No codestream found in JXL container");
4835
- }
4836
- };
4837
- }));
4838
- //#endregion
4839
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/ktx.js
4840
- var require_ktx = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4841
- Object.defineProperty(exports, "__esModule", { value: true });
4842
- exports.KTX = void 0;
4843
- const utils_1 = require_utils();
4844
- exports.KTX = {
4845
- validate: (input) => {
4846
- const signature = (0, utils_1.toUTF8String)(input, 1, 7);
4847
- return ["KTX 11", "KTX 20"].includes(signature);
4848
- },
4849
- calculate: (input) => {
4850
- const type = input[5] === 49 ? "ktx" : "ktx2";
4851
- const offset = type === "ktx" ? 36 : 20;
4852
- return {
4853
- height: (0, utils_1.readUInt32LE)(input, offset + 4),
4854
- width: (0, utils_1.readUInt32LE)(input, offset),
4855
- type
4856
- };
4857
- }
4858
- };
4859
- }));
4860
- //#endregion
4861
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/png.js
4862
- var require_png = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4863
- Object.defineProperty(exports, "__esModule", { value: true });
4864
- exports.PNG = void 0;
4865
- const utils_1 = require_utils();
4866
- const pngSignature = "PNG\r\n\n";
4867
- const pngImageHeaderChunkName = "IHDR";
4868
- const pngFriedChunkName = "CgBI";
4869
- exports.PNG = {
4870
- validate(input) {
4871
- if (pngSignature === (0, utils_1.toUTF8String)(input, 1, 8)) {
4872
- let chunkName = (0, utils_1.toUTF8String)(input, 12, 16);
4873
- if (chunkName === pngFriedChunkName) chunkName = (0, utils_1.toUTF8String)(input, 28, 32);
4874
- if (chunkName !== pngImageHeaderChunkName) throw new TypeError("Invalid PNG");
4875
- return true;
4876
- }
4877
- return false;
4878
- },
4879
- calculate(input) {
4880
- if ((0, utils_1.toUTF8String)(input, 12, 16) === pngFriedChunkName) return {
4881
- height: (0, utils_1.readUInt32BE)(input, 36),
4882
- width: (0, utils_1.readUInt32BE)(input, 32)
4883
- };
4884
- return {
4885
- height: (0, utils_1.readUInt32BE)(input, 20),
4886
- width: (0, utils_1.readUInt32BE)(input, 16)
4887
- };
4888
- }
4889
- };
4890
- }));
4891
- //#endregion
4892
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/pnm.js
4893
- var require_pnm = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4894
- Object.defineProperty(exports, "__esModule", { value: true });
4895
- exports.PNM = void 0;
4896
- const utils_1 = require_utils();
4897
- const PNMTypes = {
4898
- P1: "pbm/ascii",
4899
- P2: "pgm/ascii",
4900
- P3: "ppm/ascii",
4901
- P4: "pbm",
4902
- P5: "pgm",
4903
- P6: "ppm",
4904
- P7: "pam",
4905
- PF: "pfm"
4906
- };
4907
- const handlers = {
4908
- default: (lines) => {
4909
- let dimensions = [];
4910
- while (lines.length > 0) {
4911
- const line = lines.shift();
4912
- if (line[0] === "#") continue;
4913
- dimensions = line.split(" ");
4914
- break;
4915
- }
4916
- if (dimensions.length === 2) return {
4917
- height: parseInt(dimensions[1], 10),
4918
- width: parseInt(dimensions[0], 10)
4919
- };
4920
- else throw new TypeError("Invalid PNM");
4921
- },
4922
- pam: (lines) => {
4923
- const size = {};
4924
- while (lines.length > 0) {
4925
- const line = lines.shift();
4926
- if (line.length > 16 || line.charCodeAt(0) > 128) continue;
4927
- const [key, value] = line.split(" ");
4928
- if (key && value) size[key.toLowerCase()] = parseInt(value, 10);
4929
- if (size.height && size.width) break;
4930
- }
4931
- if (size.height && size.width) return {
4932
- height: size.height,
4933
- width: size.width
4934
- };
4935
- else throw new TypeError("Invalid PAM");
4936
- }
4937
- };
4938
- exports.PNM = {
4939
- validate: (input) => (0, utils_1.toUTF8String)(input, 0, 2) in PNMTypes,
4940
- calculate(input) {
4941
- const signature = (0, utils_1.toUTF8String)(input, 0, 2);
4942
- const type = PNMTypes[signature];
4943
- const lines = (0, utils_1.toUTF8String)(input, 3).split(/[\r\n]+/);
4944
- return (handlers[type] || handlers.default)(lines);
4945
- }
4946
- };
4947
- }));
4948
- //#endregion
4949
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/psd.js
4950
- var require_psd = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4951
- Object.defineProperty(exports, "__esModule", { value: true });
4952
- exports.PSD = void 0;
4953
- const utils_1 = require_utils();
4954
- exports.PSD = {
4955
- validate: (input) => (0, utils_1.toUTF8String)(input, 0, 4) === "8BPS",
4956
- calculate: (input) => ({
4957
- height: (0, utils_1.readUInt32BE)(input, 14),
4958
- width: (0, utils_1.readUInt32BE)(input, 18)
4959
- })
4960
- };
4961
- }));
4962
- //#endregion
4963
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/svg.js
4964
- var require_svg = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
4965
- Object.defineProperty(exports, "__esModule", { value: true });
4966
- exports.SVG = void 0;
4967
- const utils_1 = require_utils();
4968
- const svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
4969
- const extractorRegExps = {
4970
- height: /\sheight=(['"])([^%]+?)\1/,
4971
- root: svgReg,
4972
- viewbox: /\sviewBox=(['"])(.+?)\1/i,
4973
- width: /\swidth=(['"])([^%]+?)\1/
4974
- };
4975
- const INCH_CM = 2.54;
4976
- const units = {
4977
- in: 96,
4978
- cm: 96 / INCH_CM,
4979
- em: 16,
4980
- ex: 8,
4981
- m: 96 / INCH_CM * 100,
4982
- mm: 96 / INCH_CM / 10,
4983
- pc: 96 / 72 / 12,
4984
- pt: 96 / 72,
4985
- px: 1
4986
- };
4987
- const unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
4988
- function parseLength(len) {
4989
- const m = unitsReg.exec(len);
4990
- if (!m) return;
4991
- return Math.round(Number(m[1]) * (units[m[2]] || 1));
4992
- }
4993
- function parseViewbox(viewbox) {
4994
- const bounds = viewbox.split(" ");
4995
- return {
4996
- height: parseLength(bounds[3]),
4997
- width: parseLength(bounds[2])
4998
- };
4999
- }
5000
- function parseAttributes(root) {
5001
- const width = root.match(extractorRegExps.width);
5002
- const height = root.match(extractorRegExps.height);
5003
- const viewbox = root.match(extractorRegExps.viewbox);
5004
- return {
5005
- height: height && parseLength(height[2]),
5006
- viewbox: viewbox && parseViewbox(viewbox[2]),
5007
- width: width && parseLength(width[2])
5008
- };
5009
- }
5010
- function calculateByDimensions(attrs) {
5011
- return {
5012
- height: attrs.height,
5013
- width: attrs.width
5014
- };
5015
- }
5016
- function calculateByViewbox(attrs, viewbox) {
5017
- const ratio = viewbox.width / viewbox.height;
5018
- if (attrs.width) return {
5019
- height: Math.floor(attrs.width / ratio),
5020
- width: attrs.width
5021
- };
5022
- if (attrs.height) return {
5023
- height: attrs.height,
5024
- width: Math.floor(attrs.height * ratio)
5025
- };
5026
- return {
5027
- height: viewbox.height,
5028
- width: viewbox.width
5029
- };
5030
- }
5031
- exports.SVG = {
5032
- validate: (input) => svgReg.test((0, utils_1.toUTF8String)(input, 0, 1e3)),
5033
- calculate(input) {
5034
- const root = (0, utils_1.toUTF8String)(input).match(extractorRegExps.root);
5035
- if (root) {
5036
- const attrs = parseAttributes(root[0]);
5037
- if (attrs.width && attrs.height) return calculateByDimensions(attrs);
5038
- if (attrs.viewbox) return calculateByViewbox(attrs, attrs.viewbox);
5039
- }
5040
- throw new TypeError("Invalid SVG");
5041
- }
5042
- };
5043
- }));
5044
- //#endregion
5045
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/tga.js
5046
- var require_tga = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
5047
- Object.defineProperty(exports, "__esModule", { value: true });
5048
- exports.TGA = void 0;
5049
- const utils_1 = require_utils();
5050
- exports.TGA = {
5051
- validate(input) {
5052
- return (0, utils_1.readUInt16LE)(input, 0) === 0 && (0, utils_1.readUInt16LE)(input, 4) === 0;
5053
- },
5054
- calculate(input) {
5055
- return {
5056
- height: (0, utils_1.readUInt16LE)(input, 14),
5057
- width: (0, utils_1.readUInt16LE)(input, 12)
5058
- };
5059
- }
5060
- };
5061
- }));
5062
- //#endregion
5063
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/tiff.js
5064
- var require_tiff = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
5065
- Object.defineProperty(exports, "__esModule", { value: true });
5066
- exports.TIFF = void 0;
5067
- const fs$2 = require("fs");
5068
- const utils_1 = require_utils();
5069
- function readIFD(input, filepath, isBigEndian) {
5070
- const ifdOffset = (0, utils_1.readUInt)(input, 32, 4, isBigEndian);
5071
- let bufferSize = 1024;
5072
- const fileSize = fs$2.statSync(filepath).size;
5073
- if (ifdOffset + bufferSize > fileSize) bufferSize = fileSize - ifdOffset - 10;
5074
- const endBuffer = new Uint8Array(bufferSize);
5075
- const descriptor = fs$2.openSync(filepath, "r");
5076
- fs$2.readSync(descriptor, endBuffer, 0, bufferSize, ifdOffset);
5077
- fs$2.closeSync(descriptor);
5078
- return endBuffer.slice(2);
5079
- }
5080
- function readValue(input, isBigEndian) {
5081
- const low = (0, utils_1.readUInt)(input, 16, 8, isBigEndian);
5082
- return ((0, utils_1.readUInt)(input, 16, 10, isBigEndian) << 16) + low;
5083
- }
5084
- function nextTag(input) {
5085
- if (input.length > 24) return input.slice(12);
5086
- }
5087
- function extractTags(input, isBigEndian) {
5088
- const tags = {};
5089
- let temp = input;
5090
- while (temp && temp.length) {
5091
- const code = (0, utils_1.readUInt)(temp, 16, 0, isBigEndian);
5092
- const type = (0, utils_1.readUInt)(temp, 16, 2, isBigEndian);
5093
- const length = (0, utils_1.readUInt)(temp, 32, 4, isBigEndian);
5094
- if (code === 0) break;
5095
- else {
5096
- if (length === 1 && (type === 3 || type === 4)) tags[code] = readValue(temp, isBigEndian);
5097
- temp = nextTag(temp);
5098
- }
5099
- }
5100
- return tags;
5101
- }
5102
- function determineEndianness(input) {
5103
- const signature = (0, utils_1.toUTF8String)(input, 0, 2);
5104
- if ("II" === signature) return "LE";
5105
- else if ("MM" === signature) return "BE";
5106
- }
5107
- const signatures = ["49492a00", "4d4d002a"];
5108
- exports.TIFF = {
5109
- validate: (input) => signatures.includes((0, utils_1.toHexString)(input, 0, 4)),
5110
- calculate(input, filepath) {
5111
- if (!filepath) throw new TypeError("Tiff doesn't support buffer");
5112
- const isBigEndian = determineEndianness(input) === "BE";
5113
- const tags = extractTags(readIFD(input, filepath, isBigEndian), isBigEndian);
5114
- const width = tags[256];
5115
- const height = tags[257];
5116
- if (!width || !height) throw new TypeError("Invalid Tiff. Missing tags");
5117
- return {
5118
- height,
5119
- width
5120
- };
5121
- }
5122
- };
5123
- }));
5124
- //#endregion
5125
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/webp.js
5126
- var require_webp = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
5127
- Object.defineProperty(exports, "__esModule", { value: true });
5128
- exports.WEBP = void 0;
5129
- const utils_1 = require_utils();
5130
- function calculateExtended(input) {
5131
- return {
5132
- height: 1 + (0, utils_1.readUInt24LE)(input, 7),
5133
- width: 1 + (0, utils_1.readUInt24LE)(input, 4)
5134
- };
5135
- }
5136
- function calculateLossless(input) {
5137
- return {
5138
- height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
5139
- width: 1 + ((input[2] & 63) << 8 | input[1])
5140
- };
5141
- }
5142
- function calculateLossy(input) {
5143
- return {
5144
- height: (0, utils_1.readInt16LE)(input, 8) & 16383,
5145
- width: (0, utils_1.readInt16LE)(input, 6) & 16383
5146
- };
5147
- }
5148
- exports.WEBP = {
5149
- validate(input) {
5150
- const riffHeader = "RIFF" === (0, utils_1.toUTF8String)(input, 0, 4);
5151
- const webpHeader = "WEBP" === (0, utils_1.toUTF8String)(input, 8, 12);
5152
- const vp8Header = "VP8" === (0, utils_1.toUTF8String)(input, 12, 15);
5153
- return riffHeader && webpHeader && vp8Header;
5154
- },
5155
- calculate(input) {
5156
- const chunkHeader = (0, utils_1.toUTF8String)(input, 12, 16);
5157
- input = input.slice(20, 30);
5158
- if (chunkHeader === "VP8X") {
5159
- const extendedHeader = input[0];
5160
- const validStart = (extendedHeader & 192) === 0;
5161
- const validEnd = (extendedHeader & 1) === 0;
5162
- if (validStart && validEnd) return calculateExtended(input);
5163
- else throw new TypeError("Invalid WebP");
5164
- }
5165
- if (chunkHeader === "VP8 " && input[0] !== 47) return calculateLossy(input);
5166
- const signature = (0, utils_1.toHexString)(input, 3, 6);
5167
- if (chunkHeader === "VP8L" && signature !== "9d012a") return calculateLossless(input);
5168
- throw new TypeError("Invalid WebP");
5169
- }
5170
- };
5171
- }));
5172
- //#endregion
5173
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/types/index.js
5174
- var require_types = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
5175
- Object.defineProperty(exports, "__esModule", { value: true });
5176
- exports.typeHandlers = void 0;
5177
- const bmp_1 = require_bmp();
5178
- const cur_1 = require_cur();
5179
- const dds_1 = require_dds();
5180
- const gif_1 = require_gif();
5181
- const heif_1 = require_heif();
5182
- const icns_1 = require_icns();
5183
- const ico_1 = require_ico();
5184
- const j2c_1 = require_j2c();
5185
- const jp2_1 = require_jp2();
5186
- const jpg_1 = require_jpg();
5187
- const jxl_1 = require_jxl();
5188
- const jxl_stream_1 = require_jxl_stream();
5189
- const ktx_1 = require_ktx();
5190
- const png_1 = require_png();
5191
- const pnm_1 = require_pnm();
5192
- const psd_1 = require_psd();
5193
- const svg_1 = require_svg();
5194
- const tga_1 = require_tga();
5195
- const tiff_1 = require_tiff();
5196
- const webp_1 = require_webp();
5197
- exports.typeHandlers = {
5198
- bmp: bmp_1.BMP,
5199
- cur: cur_1.CUR,
5200
- dds: dds_1.DDS,
5201
- gif: gif_1.GIF,
5202
- heif: heif_1.HEIF,
5203
- icns: icns_1.ICNS,
5204
- ico: ico_1.ICO,
5205
- j2c: j2c_1.J2C,
5206
- jp2: jp2_1.JP2,
5207
- jpg: jpg_1.JPG,
5208
- jxl: jxl_1.JXL,
5209
- "jxl-stream": jxl_stream_1.JXLStream,
5210
- ktx: ktx_1.KTX,
5211
- png: png_1.PNG,
5212
- pnm: pnm_1.PNM,
5213
- psd: psd_1.PSD,
5214
- svg: svg_1.SVG,
5215
- tga: tga_1.TGA,
5216
- tiff: tiff_1.TIFF,
5217
- webp: webp_1.WEBP
5218
- };
5219
- }));
5220
- //#endregion
5221
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/detector.js
5222
- var require_detector = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
5223
- Object.defineProperty(exports, "__esModule", { value: true });
5224
- exports.detector = void 0;
5225
- const index_1 = require_types();
5226
- const keys = Object.keys(index_1.typeHandlers);
5227
- const firstBytes = {
5228
- 56: "psd",
5229
- 66: "bmp",
5230
- 68: "dds",
5231
- 71: "gif",
5232
- 73: "tiff",
5233
- 77: "tiff",
5234
- 82: "webp",
5235
- 105: "icns",
5236
- 137: "png",
5237
- 255: "jpg"
5238
- };
5239
- function detector(input) {
5240
- const byte = input[0];
5241
- if (byte in firstBytes) {
5242
- const type = firstBytes[byte];
5243
- if (type && index_1.typeHandlers[type].validate(input)) return type;
5244
- }
5245
- const finder = (key) => index_1.typeHandlers[key].validate(input);
5246
- return keys.find(finder);
5247
- }
5248
- exports.detector = detector;
5249
- }));
5250
- //#endregion
5251
- //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/image-size/1.2.1/9bf0036384935b954c14e11e917ababb8784279feffccfde373a89bf4fb7a87e/node_modules/image-size/dist/index.js
5252
- var require_dist = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
5253
- Object.defineProperty(exports, "__esModule", { value: true });
5254
- exports.types = exports.setConcurrency = exports.disableTypes = exports.disableFS = exports.imageSize = void 0;
5255
- const fs$1 = require("fs");
5256
- const path$1 = require("path");
5257
- const queue_1 = require_queue();
5258
- const index_1 = require_types();
5259
- const detector_1 = require_detector();
5260
- const MaxInputSize = 512 * 1024;
5261
- const queue = new queue_1.default({
5262
- concurrency: 100,
5263
- autostart: true
5264
- });
5265
- const globalOptions = {
5266
- disabledFS: false,
5267
- disabledTypes: []
5268
- };
5269
- /**
5270
- * Return size information based on an Uint8Array
5271
- *
5272
- * @param {Uint8Array} input
5273
- * @param {String} filepath
5274
- * @returns {Object}
5275
- */
5276
- function lookup(input, filepath) {
5277
- const type = (0, detector_1.detector)(input);
5278
- if (typeof type !== "undefined") {
5279
- if (globalOptions.disabledTypes.indexOf(type) > -1) throw new TypeError("disabled file type: " + type);
5280
- if (type in index_1.typeHandlers) {
5281
- const size = index_1.typeHandlers[type].calculate(input, filepath);
5282
- if (size !== void 0) {
5283
- size.type = size.type ?? type;
5284
- return size;
5285
- }
5286
- }
5287
- }
5288
- throw new TypeError("unsupported file type: " + type + " (file: " + filepath + ")");
5289
- }
5290
- /**
5291
- * Reads a file into an Uint8Array.
5292
- * @param {String} filepath
5293
- * @returns {Promise<Uint8Array>}
5294
- */
5295
- async function readFileAsync(filepath) {
5296
- const handle = await fs$1.promises.open(filepath, "r");
5297
- try {
5298
- const { size } = await handle.stat();
5299
- if (size <= 0) throw new Error("Empty file");
5300
- const inputSize = Math.min(size, MaxInputSize);
5301
- const input = new Uint8Array(inputSize);
5302
- await handle.read(input, 0, inputSize, 0);
5303
- return input;
5304
- } finally {
5305
- await handle.close();
5306
- }
5307
- }
5308
- /**
5309
- * Synchronously reads a file into an Uint8Array, blocking the nodejs process.
5310
- *
5311
- * @param {String} filepath
5312
- * @returns {Uint8Array}
5313
- */
5314
- function readFileSync(filepath) {
5315
- const descriptor = fs$1.openSync(filepath, "r");
5316
- try {
5317
- const { size } = fs$1.fstatSync(descriptor);
5318
- if (size <= 0) throw new Error("Empty file");
5319
- const inputSize = Math.min(size, MaxInputSize);
5320
- const input = new Uint8Array(inputSize);
5321
- fs$1.readSync(descriptor, input, 0, inputSize, 0);
5322
- return input;
5323
- } finally {
5324
- fs$1.closeSync(descriptor);
5325
- }
5326
- }
5327
- module.exports = exports = imageSize;
5328
- exports.default = imageSize;
5329
- /**
5330
- * @param {Uint8Array|string} input - Uint8Array or relative/absolute path of the image file
5331
- * @param {Function=} [callback] - optional function for async detection
5332
- */
5333
- function imageSize(input, callback) {
5334
- if (input instanceof Uint8Array) return lookup(input);
5335
- if (typeof input !== "string" || globalOptions.disabledFS) throw new TypeError("invalid invocation. input should be a Uint8Array");
5336
- const filepath = path$1.resolve(input);
5337
- if (typeof callback === "function") queue.push(() => readFileAsync(filepath).then((input) => process.nextTick(callback, null, lookup(input, filepath))).catch(callback));
5338
- else return lookup(readFileSync(filepath), filepath);
5339
- }
5340
- exports.imageSize = imageSize;
5341
- const disableFS = (v) => {
5342
- globalOptions.disabledFS = v;
5343
- };
5344
- exports.disableFS = disableFS;
5345
- const disableTypes = (types) => {
5346
- globalOptions.disabledTypes = types;
5347
- };
5348
- exports.disableTypes = disableTypes;
5349
- const setConcurrency = (c) => {
5350
- queue.concurrency = c;
5351
- };
5352
- exports.setConcurrency = setConcurrency;
5353
- exports.types = Object.keys(index_1.typeHandlers);
5354
- }));
5355
- //#endregion
5356
4087
  //#region ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/diff/8.0.4/6781cdda9837821c30a1f4c4db1d9286b838fe139b78d9658b2471e961b45953/node_modules/diff/libesm/diff/base.js
5357
- var import_dist = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_dist(), 1);
4088
+ var import_sync = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_sync$1.require_sync(), 1);
5358
4089
  var Diff = class {
5359
4090
  diff(oldStr, newStr, options = {}) {
5360
4091
  let callback;
@@ -5962,7 +4693,7 @@ function splitLines(text) {
5962
4693
  return result;
5963
4694
  }
5964
4695
  //#endregion
5965
- //#region ../memory/dist/src-Iw-V5CfD.js
4696
+ //#region ../memory/dist/src-B_n15_Xg.js
5966
4697
  var __defProp$3 = Object.defineProperty;
5967
4698
  var __exportAll = (all, no_symbols) => {
5968
4699
  let target = {};
@@ -21488,6 +20219,16 @@ function sanitizeToolResultValue(value, seen = /* @__PURE__ */ new WeakMap()) {
21488
20219
  }
21489
20220
  return sanitizedObject;
21490
20221
  }
20222
+ /**
20223
+ * Serializes a tool result without truncating it.
20224
+ *
20225
+ * Token accounting must see the full result: the truncation applied by
20226
+ * {@link formatToolResultForObserver} exists to bound what the Observer LLM reads,
20227
+ * not to describe what the agent's provider context actually holds.
20228
+ */
20229
+ function serializeToolResultForTokenCounting(value) {
20230
+ return stringifyToolResult(value);
20231
+ }
21491
20232
  function stringifyToolResult(value) {
21492
20233
  if (typeof value === "string") return value;
21493
20234
  const sanitized = sanitizeToolResultValue(value);
@@ -23198,6 +21939,40 @@ var ObserverRunner = class {
23198
21939
  };
23199
21940
  }
23200
21941
  };
21942
+ /**
21943
+ * Synchronous image dimension lookup for in-memory image buffers.
21944
+ *
21945
+ * Uses `probe-image-size`'s sync parsers rather than `image-size`, which has unfixed
21946
+ * denial-of-service advisories (GHSA-w3rx-r6r6-pgpr / CVE-2025-71330 and
21947
+ * GHSA-5p2g-fcmc-qvqq) affecting every published version, on an archived repository
21948
+ * with no fixed release coming. A malformed 32-byte ICNS buffer was enough to hang the
21949
+ * parse loop and exhaust the heap, and image bytes reaching agent memory are untrusted.
21950
+ *
21951
+ * `probe-image-size` covers the formats models actually accept (PNG, JPEG, WebP, GIF,
21952
+ * AVIF, BMP, ICO, PSD, SVG, TIFF). Anything else returns `undefined`, which callers
21953
+ * already handle as "dimensions unknown".
21954
+ */
21955
+ const probeBuffer = import_sync.default;
21956
+ /**
21957
+ * Read the pixel dimensions of an image buffer.
21958
+ *
21959
+ * @returns The dimensions, or `undefined` if the buffer isn't a recognized image.
21960
+ */
21961
+ function measureImageBuffer(buffer) {
21962
+ let probed;
21963
+ try {
21964
+ probed = probeBuffer(buffer);
21965
+ } catch {
21966
+ return;
21967
+ }
21968
+ if (!probed) return;
21969
+ const { width, height } = probed;
21970
+ if (typeof width !== "number" || !Number.isFinite(width) || typeof height !== "number" || !Number.isFinite(height)) return;
21971
+ return {
21972
+ width,
21973
+ height
21974
+ };
21975
+ }
23201
21976
  const IMAGE_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
23202
21977
  "png",
23203
21978
  "jpg",
@@ -23470,7 +22245,7 @@ async function resolveImageDimensionsAsync(part) {
23470
22245
  const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
23471
22246
  if (!url) return existing;
23472
22247
  try {
23473
- const probeImageSize = (await Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./probe-image-size-DYJVSL0b.cjs").default, 1))).default;
22248
+ const probeImageSize = (await Promise.resolve().then(() => /* @__PURE__ */ require_rolldown_runtime.__toESM(require("./probe-image-size-C2F59z8Z.cjs").default, 1))).default;
23474
22249
  const probed = await probeImageSize(url, {
23475
22250
  open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
23476
22251
  response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
@@ -23503,26 +22278,23 @@ function resolveImageDimensions(part) {
23503
22278
  width,
23504
22279
  height
23505
22280
  };
23506
- try {
23507
- const measured = (0, import_dist.default)(buffer);
23508
- const measuredWidth = getFiniteNumber(measured.width);
23509
- const measuredHeight = getFiniteNumber(measured.height);
23510
- if (!measuredWidth || !measuredHeight) return {
23511
- width,
23512
- height
23513
- };
23514
- const resolved = {
23515
- width: width ?? measuredWidth,
23516
- height: height ?? measuredHeight
23517
- };
23518
- persistImageDimensions(part, resolved);
23519
- return resolved;
23520
- } catch {
23521
- return {
23522
- width,
23523
- height
23524
- };
23525
- }
22281
+ const measured = measureImageBuffer(buffer);
22282
+ if (!measured) return {
22283
+ width,
22284
+ height
22285
+ };
22286
+ const measuredWidth = getFiniteNumber(measured.width);
22287
+ const measuredHeight = getFiniteNumber(measured.height);
22288
+ if (!measuredWidth || !measuredHeight) return {
22289
+ width,
22290
+ height
22291
+ };
22292
+ const resolved = {
22293
+ width: width ?? measuredWidth,
22294
+ height: height ?? measuredHeight
22295
+ };
22296
+ persistImageDimensions(part, resolved);
22297
+ return resolved;
23526
22298
  }
23527
22299
  function getBase64Size(base64) {
23528
22300
  const sanitized = base64.replace(/\s+/g, "");
@@ -23818,9 +22590,9 @@ function createTimeoutSignal(timeoutMs) {
23818
22590
  };
23819
22591
  }
23820
22592
  function getNumericResponseField(value, paths) {
23821
- for (const path$4 of paths) {
22593
+ for (const path$3 of paths) {
23822
22594
  let current = value;
23823
- for (const segment of path$4) {
22595
+ for (const segment of path$3) {
23824
22596
  current = getObjectValue(current, segment);
23825
22597
  if (current === void 0) break;
23826
22598
  }
@@ -24081,7 +22853,7 @@ var TokenCounter = class TokenCounter {
24081
22853
  let tokens = 0;
24082
22854
  const cacheParts = [];
24083
22855
  const countJsonContentPart = (contentPart) => {
24084
- const formatted = formatToolResultForObserver(contentPart);
22856
+ const formatted = serializeToolResultForTokenCounting(contentPart);
24085
22857
  tokens += this.countString(formatted);
24086
22858
  cacheParts.push({
24087
22859
  type: "json",
@@ -24383,39 +23155,68 @@ var TokenCounter = class TokenCounter {
24383
23155
  if (isImageAttachment) await resolveImageDimensionsAsync(part);
24384
23156
  return this.countAttachmentPartSync(part);
24385
23157
  }
23158
+ /**
23159
+ * Count the name and the arguments of a tool call. Every state before the tool produces an
23160
+ * output holds the same call signature in the context window, so all of those states share
23161
+ * these cache kinds. `buildEstimateKey` hashes the text, so a shared kind stays correct and
23162
+ * keeps the estimate warm while the invocation moves from one state to the next.
23163
+ */
23164
+ countToolCallSignature(part, invocation) {
23165
+ let tokens = 0;
23166
+ let overheadDelta = 0;
23167
+ if (invocation.toolName) tokens += this.readOrPersistPartEstimate(part, "tool-call-name", invocation.toolName);
23168
+ if (invocation.args) if (typeof invocation.args === "string") tokens += this.readOrPersistPartEstimate(part, "tool-call-args", invocation.args);
23169
+ else {
23170
+ const argsJson = JSON.stringify(invocation.args);
23171
+ tokens += this.readOrPersistPartEstimate(part, "tool-call-args-json", argsJson);
23172
+ overheadDelta -= 12;
23173
+ }
23174
+ return {
23175
+ tokens,
23176
+ overheadDelta
23177
+ };
23178
+ }
24386
23179
  countNonAttachmentPart(part) {
24387
23180
  let overheadDelta = 0;
24388
- let toolResultDelta = 0;
23181
+ let extraMessageDelta = 0;
24389
23182
  if (part.type === "text") return {
24390
23183
  tokens: this.readOrPersistPartEstimate(part, "text", part.text),
24391
23184
  overheadDelta,
24392
- toolResultDelta
23185
+ extraMessageDelta
24393
23186
  };
24394
23187
  if (part.type === "tool-invocation") {
24395
23188
  const invocation = part.toolInvocation;
23189
+ const state = invocation.state;
24396
23190
  let tokens = 0;
24397
- if (invocation.state === "call" || invocation.state === "partial-call") {
24398
- if (invocation.toolName) tokens += this.readOrPersistPartEstimate(part, `tool-${invocation.state}-name`, invocation.toolName);
24399
- if (invocation.args) if (typeof invocation.args === "string") tokens += this.readOrPersistPartEstimate(part, `tool-${invocation.state}-args`, invocation.args);
24400
- else {
24401
- const argsJson = JSON.stringify(invocation.args);
24402
- tokens += this.readOrPersistPartEstimate(part, `tool-${invocation.state}-args-json`, argsJson);
24403
- overheadDelta -= 12;
24404
- }
23191
+ if (state === "call" || state === "partial-call" || state === "approval-requested") {
23192
+ const signature = this.countToolCallSignature(part, invocation);
23193
+ return {
23194
+ tokens: signature.tokens,
23195
+ overheadDelta: overheadDelta + signature.overheadDelta,
23196
+ extraMessageDelta
23197
+ };
23198
+ }
23199
+ if (state === "approval-responded") {
23200
+ extraMessageDelta++;
23201
+ const signature = this.countToolCallSignature(part, invocation);
23202
+ tokens += signature.tokens;
23203
+ overheadDelta += signature.overheadDelta;
23204
+ const reason = invocation.approval?.reason;
23205
+ if (reason) tokens += this.readOrPersistPartEstimate(part, "tool-approval-reason", reason);
24405
23206
  return {
24406
23207
  tokens,
24407
23208
  overheadDelta,
24408
- toolResultDelta
23209
+ extraMessageDelta
24409
23210
  };
24410
23211
  }
24411
- if (invocation.state === "result") {
24412
- toolResultDelta++;
23212
+ if (state === "result") {
23213
+ extraMessageDelta++;
24413
23214
  const { value: resultForCounting, usingStoredModelOutput } = this.resolveToolResultForTokenCounting(part, invocation.result);
24414
23215
  if (resultForCounting !== void 0) {
24415
23216
  const contentTokens = this.countMultimodalToolResultContent(part, resultForCounting);
24416
23217
  if (contentTokens !== void 0) tokens += contentTokens;
24417
23218
  else {
24418
- const formattedResult = formatToolResultForObserver(resultForCounting);
23219
+ const formattedResult = serializeToolResultForTokenCounting(resultForCounting);
24419
23220
  tokens += this.readOrPersistPartEstimate(part, usingStoredModelOutput ? "tool-result-model-output-json" : "tool-result-json", formattedResult);
24420
23221
  }
24421
23222
  if (typeof resultForCounting !== "string") overheadDelta -= 12;
@@ -24423,47 +23224,45 @@ var TokenCounter = class TokenCounter {
24423
23224
  return {
24424
23225
  tokens,
24425
23226
  overheadDelta,
24426
- toolResultDelta
23227
+ extraMessageDelta
24427
23228
  };
24428
23229
  }
24429
- if (invocation.state === "output-denied") {
24430
- toolResultDelta++;
23230
+ if (state === "output-denied") {
23231
+ extraMessageDelta++;
24431
23232
  const reason = invocation.approval?.reason ?? "Tool call was not approved by the user";
24432
23233
  tokens += this.readOrPersistPartEstimate(part, "tool-result-denied", reason);
24433
23234
  return {
24434
23235
  tokens,
24435
23236
  overheadDelta,
24436
- toolResultDelta
23237
+ extraMessageDelta
24437
23238
  };
24438
23239
  }
24439
- if (invocation.state === "output-error") {
24440
- toolResultDelta++;
24441
- const errorText = invocation.errorText;
24442
- const errorMessage = typeof errorText === "string" ? errorText : "Tool execution failed";
23240
+ if (state === "output-error") {
23241
+ extraMessageDelta++;
23242
+ const errorMessage = typeof invocation.errorText === "string" ? invocation.errorText : "Tool execution failed";
24443
23243
  tokens += this.readOrPersistPartEstimate(part, "tool-result-error", errorMessage);
24444
23244
  return {
24445
23245
  tokens,
24446
23246
  overheadDelta,
24447
- toolResultDelta
23247
+ extraMessageDelta
24448
23248
  };
24449
23249
  }
24450
- throw new Error(`Unhandled tool-invocation state '${part.toolInvocation?.state}' in token counting for part type '${part.type}'`);
24451
23250
  }
24452
23251
  if (typeof part.type === "string" && part.type.startsWith("data-")) return {
24453
23252
  tokens: 0,
24454
23253
  overheadDelta,
24455
- toolResultDelta
23254
+ extraMessageDelta
24456
23255
  };
24457
23256
  if (part.type === "reasoning") return {
24458
23257
  tokens: 0,
24459
23258
  overheadDelta,
24460
- toolResultDelta
23259
+ extraMessageDelta
24461
23260
  };
24462
23261
  const serialized = serializePartForTokenCounting(part);
24463
23262
  return {
24464
23263
  tokens: this.readOrPersistPartEstimate(part, `part-${part.type}`, serialized),
24465
23264
  overheadDelta,
24466
- toolResultDelta
23265
+ extraMessageDelta
24467
23266
  };
24468
23267
  }
24469
23268
  /**
@@ -24472,7 +23271,7 @@ var TokenCounter = class TokenCounter {
24472
23271
  countMessage(message) {
24473
23272
  let payloadTokens = this.countString(message.role);
24474
23273
  let overhead = TokenCounter.TOKENS_PER_MESSAGE;
24475
- let toolResultCount = 0;
23274
+ let extraMessageCount = 0;
24476
23275
  if (typeof message.content === "string") payloadTokens += this.readOrPersistMessageEstimate(message, "message-content", message.content);
24477
23276
  else if (message.content && typeof message.content === "object") {
24478
23277
  if (message.content.content && !Array.isArray(message.content.parts)) payloadTokens += this.readOrPersistMessageEstimate(message, "content-content", message.content.content);
@@ -24485,16 +23284,16 @@ var TokenCounter = class TokenCounter {
24485
23284
  const result = this.countNonAttachmentPart(part);
24486
23285
  payloadTokens += result.tokens;
24487
23286
  overhead += result.overheadDelta;
24488
- toolResultCount += result.toolResultDelta;
23287
+ extraMessageCount += result.extraMessageDelta;
24489
23288
  }
24490
23289
  }
24491
- if (toolResultCount > 0) overhead += toolResultCount * TokenCounter.TOKENS_PER_MESSAGE;
23290
+ if (extraMessageCount > 0) overhead += extraMessageCount * TokenCounter.TOKENS_PER_MESSAGE;
24492
23291
  return Math.round(payloadTokens + overhead);
24493
23292
  }
24494
23293
  async countMessageAsync(message) {
24495
23294
  let payloadTokens = this.countString(message.role);
24496
23295
  let overhead = TokenCounter.TOKENS_PER_MESSAGE;
24497
- let toolResultCount = 0;
23296
+ let extraMessageCount = 0;
24498
23297
  if (typeof message.content === "string") payloadTokens += this.readOrPersistMessageEstimate(message, "message-content", message.content);
24499
23298
  else if (message.content && typeof message.content === "object") {
24500
23299
  if (message.content.content && !Array.isArray(message.content.parts)) payloadTokens += this.readOrPersistMessageEstimate(message, "content-content", message.content.content);
@@ -24507,10 +23306,10 @@ var TokenCounter = class TokenCounter {
24507
23306
  const result = this.countNonAttachmentPart(part);
24508
23307
  payloadTokens += result.tokens;
24509
23308
  overhead += result.overheadDelta;
24510
- toolResultCount += result.toolResultDelta;
23309
+ extraMessageCount += result.extraMessageDelta;
24511
23310
  }
24512
23311
  }
24513
- if (toolResultCount > 0) overhead += toolResultCount * TokenCounter.TOKENS_PER_MESSAGE;
23312
+ if (extraMessageCount > 0) overhead += extraMessageCount * TokenCounter.TOKENS_PER_MESSAGE;
24514
23313
  return Math.round(payloadTokens + overhead);
24515
23314
  }
24516
23315
  /**
@@ -24815,9 +23614,10 @@ async function listThreadsForResource({ memory, resourceId, currentThreadId, pag
24815
23614
  hasMore
24816
23615
  };
24817
23616
  }
23617
+ const SEARCH_NOT_CONFIGURED_MESSAGE = "Search is not configured. Enable it with `retrieval: { vector: true }` and configure a vector store and embedder on your Memory instance.";
24818
23618
  async function searchMessagesForResource({ memory, resourceId, currentThreadId, query, topK = 10, maxTokens = DEFAULT_MAX_RESULT_TOKENS, before, after, threadScope }) {
24819
23619
  if (!memory.searchMessages) return {
24820
- results: "Search is not configured. Enable it with `retrieval: { vector: true }` and configure a vector store and embedder on your Memory instance.",
23620
+ results: SEARCH_NOT_CONFIGURED_MESSAGE,
24821
23621
  count: 0
24822
23622
  };
24823
23623
  const MAX_TOPK = 20;
@@ -25363,9 +24163,16 @@ async function recallThreadFromStart({ memory, threadId, resourceId, page = 1, l
25363
24163
  }
25364
24164
  const recallTool = (_memoryConfig, options) => {
25365
24165
  const isResourceScope = (options?.retrievalScope ?? "thread") === "resource";
24166
+ const searchEnabled = options?.searchEnabled ?? true;
24167
+ const description = isResourceScope ? `Browse conversation history. Use mode="threads" to list all threads for the current user. Use mode="messages" (default) to browse messages in the current thread or pass threadId to browse another thread in the active resource. When mode="messages" has no cursor or threadId, it defaults to the current thread and says so at the top of the result. If you pass only a cursor, it must belong to the current thread.${searchEnabled ? " Use mode=\"search\" to find messages by content across all threads." : ""}` : `Browse conversation history in the current thread. Use mode="messages" (default) to page through messages near a cursor.${searchEnabled ? " Use mode=\"search\" to find messages by content in this thread." : ""} Use mode="threads" to get the current thread's ID and title.`;
24168
+ const modeEnum = searchEnabled ? [
24169
+ "messages",
24170
+ "threads",
24171
+ "search"
24172
+ ] : ["messages", "threads"];
25366
24173
  return (0, _mastra_core_tools.createTool)({
25367
24174
  id: "recall",
25368
- description: isResourceScope ? "Browse conversation history. Use mode=\"threads\" to list all threads for the current user. Use mode=\"messages\" (default) to browse messages in the current thread or pass threadId to browse another thread in the active resource. When mode=\"messages\" has no cursor or threadId, it defaults to the current thread and says so at the top of the result. If you pass only a cursor, it must belong to the current thread. Use mode=\"search\" to find messages by content across all threads." : "Browse conversation history in the current thread. Use mode=\"messages\" (default) to page through messages near a cursor. Use mode=\"search\" to find messages by content in this thread. Use mode=\"threads\" to get the current thread's ID and title.",
24175
+ description,
25369
24176
  inputSchema: {
25370
24177
  $schema: "http://json-schema.org/draft-07/schema#",
25371
24178
  type: "object",
@@ -25373,12 +24180,8 @@ const recallTool = (_memoryConfig, options) => {
25373
24180
  ...isResourceScope ? {
25374
24181
  mode: {
25375
24182
  type: "string",
25376
- enum: [
25377
- "messages",
25378
- "threads",
25379
- "search"
25380
- ],
25381
- description: "What to retrieve. \"messages\" (default) pages through message history. \"threads\" lists all threads for the current user. \"search\" finds messages by semantic similarity across all threads."
24183
+ enum: modeEnum,
24184
+ description: `What to retrieve. "messages" (default) pages through message history. "threads" lists all threads for the current user.${searchEnabled ? " \"search\" finds messages by semantic similarity across all threads." : ""}`
25382
24185
  },
25383
24186
  threadId: {
25384
24187
  type: "string",
@@ -25395,18 +24198,14 @@ const recallTool = (_memoryConfig, options) => {
25395
24198
  }
25396
24199
  } : { mode: {
25397
24200
  type: "string",
25398
- enum: [
25399
- "messages",
25400
- "threads",
25401
- "search"
25402
- ],
25403
- description: "What to retrieve. \"messages\" (default) pages through message history. \"threads\" returns info about the current thread. \"search\" finds messages by semantic similarity in this thread."
24201
+ enum: modeEnum,
24202
+ description: `What to retrieve. "messages" (default) pages through message history. "threads" returns info about the current thread.${searchEnabled ? " \"search\" finds messages by semantic similarity in this thread." : ""}`
25404
24203
  } },
25405
- query: {
24204
+ ...searchEnabled ? { query: {
25406
24205
  type: "string",
25407
24206
  minLength: 1,
25408
24207
  description: "Search query for mode=\"search\". Finds messages semantically similar to this text."
25409
- },
24208
+ } } : {},
25410
24209
  cursor: {
25411
24210
  type: "string",
25412
24211
  minLength: 1,
@@ -25467,6 +24266,10 @@ const recallTool = (_memoryConfig, options) => {
25467
24266
  if (!memory) throw new Error("Memory instance is required for recall");
25468
24267
  if (explicitThreadId === "current" && !currentThreadId) throw new Error("Could not resolve current thread.");
25469
24268
  if (mode === "search") {
24269
+ if (!searchEnabled) return {
24270
+ results: SEARCH_NOT_CONFIGURED_MESSAGE,
24271
+ count: 0
24272
+ };
25470
24273
  if (!query) throw new Error("query is required for mode=\"search\"");
25471
24274
  if (!resourceId) throw new Error("Resource ID is required for recall");
25472
24275
  return searchMessagesForResource({
@@ -25601,6 +24404,7 @@ function deepMergeWorkingMemory(existing, update) {
25601
24404
  for (const key of Object.keys(update)) {
25602
24405
  const updateValue = update[key];
25603
24406
  const existingValue = result[key];
24407
+ if (updateValue === void 0) continue;
25604
24408
  if (updateValue === null) delete result[key];
25605
24409
  else if (Array.isArray(updateValue)) result[key] = updateValue;
25606
24410
  else if (typeof updateValue === "object" && updateValue !== null && typeof existingValue === "object" && existingValue !== null && !Array.isArray(existingValue)) result[key] = deepMergeWorkingMemory(existingValue, updateValue);
@@ -25653,7 +24457,7 @@ const updateWorkingMemoryTool = (memoryConfig) => {
25653
24457
  version: 1,
25654
24458
  vendor: "mastra",
25655
24459
  validate: (value) => {
25656
- const memoryValue = !!value && typeof value === "object" && !Array.isArray(value) && "memory" in value ? value.memory : stripNullsFromOptional(value, jsonSchema);
24460
+ const memoryValue = stripNullsFromOptional(!!value && typeof value === "object" && !Array.isArray(value) && "memory" in value ? value.memory : value, jsonSchema);
25657
24461
  const result = validateMemory(memoryValue);
25658
24462
  return result instanceof Promise ? result.then(toWrappedResult) : toWrappedResult(result);
25659
24463
  },
@@ -25670,6 +24474,7 @@ const updateWorkingMemoryTool = (memoryConfig) => {
25670
24474
  id: "update-working-memory",
25671
24475
  description: schema ? useStateSignals ? `${stateSignalsPreamble} Data is merged with existing memory — only include fields you want to add or update.` : `Update the working memory with new information. Data is merged with existing memory - only include fields you want to add or update. To preserve existing data, omit the field entirely. Arrays are replaced entirely when provided, so pass the complete array or omit it to keep the existing values.` : useStateSignals ? `${stateSignalsPreamble} Pass the full updated Markdown blob as a string in the memory field.` : `Update the working memory with new information. Any data not included will be overwritten. Always pass data as string to the memory field. Never pass an object.`,
25672
24476
  inputSchema,
24477
+ ...usesMergeSemantics ? { strict: false } : {},
25673
24478
  execute: async (inputData, context) => {
25674
24479
  const workingMemoryInput = inputData;
25675
24480
  const threadId = context?.agent?.threadId;
@@ -26410,6 +25215,24 @@ function getUnobservedPartsPreservingToolCallPairs(message) {
26410
25215
  return preservedCalls.length > 0 ? [...preservedCalls, ...unobservedParts] : unobservedParts;
26411
25216
  }
26412
25217
  /**
25218
+ * Get the messages Observational Memory is allowed to work with.
25219
+ *
25220
+ * Messages supplied through the `context` option are per-run ephemeral input. Core's
25221
+ * persistence contract already treats them as never-persist: `MessageStateManager` routes
25222
+ * them into `userContextMessages`, and `drainUnsavedMessages` only drains input/response.
25223
+ *
25224
+ * OM builds its windows from `get.all.db()`, which includes context messages, and then
25225
+ * seals and persists candidates directly — turning ephemeral context into durable user
25226
+ * messages. Excluding them here keeps OM's window, sealing, persistence and token
25227
+ * accounting consistent with that contract.
25228
+ */
25229
+ function getObservableMessages(messageList) {
25230
+ const allMessages = messageList.get.all.db();
25231
+ const contextMessageIds = messageList.makeMessageSourceChecker().context;
25232
+ if (contextMessageIds.size === 0) return allMessages;
25233
+ return allMessages.filter((message) => !contextMessageIds.has(message.id));
25234
+ }
25235
+ /**
26413
25236
  * Safely extract buffered observation chunks from a record.
26414
25237
  * Handles both array and JSON-string formats, returning empty array if malformed.
26415
25238
  */
@@ -26422,7 +25245,7 @@ function getUnobservedPartsPreservingToolCallPairs(message) {
26422
25245
  */
26423
25246
  function filterObservedMessages(opts) {
26424
25247
  const { messageList, record } = opts;
26425
- const allMessages = messageList.get.all.db();
25248
+ const allMessages = getObservableMessages(messageList);
26426
25249
  const useMarkerBoundaryPruning = opts.useMarkerBoundaryPruning ?? true;
26427
25250
  const preserveMessageIds = opts.preserveMessageIds ?? /* @__PURE__ */ new Set();
26428
25251
  const observedIds = new Set(Array.isArray(record?.observedMessageIds) ? record.observedMessageIds : []);
@@ -26969,7 +25792,7 @@ var ObservationStrategy = class ObservationStrategy {
26969
25792
  */
26970
25793
  async persistMarkerToMessage(marker, messageList, threadId, resourceId) {
26971
25794
  if (!messageList) return false;
26972
- const allMsgs = messageList.get.all.db();
25795
+ const allMsgs = getObservableMessages(messageList);
26973
25796
  for (let i = allMsgs.length - 1; i >= 0; i--) {
26974
25797
  const msg = allMsgs[i];
26975
25798
  if (msg?.role === "assistant" && msg.content?.parts && Array.isArray(msg.content.parts)) {
@@ -27150,7 +25973,7 @@ var SyncObservationStrategy = class extends ObservationStrategy {
27150
25973
  });
27151
25974
  await this.storage.updateThread({
27152
25975
  id: threadId,
27153
- title: shouldUpdateThreadTitle ? newTitle : thread.title ?? "",
25976
+ ...shouldUpdateThreadTitle ? { title: newTitle } : {},
27154
25977
  metadata: newMetadata
27155
25978
  });
27156
25979
  if (shouldUpdateThreadTitle) threadUpdateMarker = createThreadUpdateMarker({
@@ -27340,7 +26163,7 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
27340
26163
  });
27341
26164
  await this.storage.updateThread({
27342
26165
  id: threadId,
27343
- title: shouldUpdateThreadTitle ? newTitle : thread.title ?? "",
26166
+ ...shouldUpdateThreadTitle ? { title: newTitle } : {},
27344
26167
  metadata: newMetadata
27345
26168
  });
27346
26169
  if (shouldUpdateThreadTitle) {
@@ -27683,7 +26506,7 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
27683
26506
  });
27684
26507
  await this.storage.updateThread({
27685
26508
  id: update.threadId,
27686
- title: shouldUpdateThreadTitle ? newTitle : thread.title ?? "",
26509
+ ...shouldUpdateThreadTitle ? { title: newTitle } : {},
27687
26510
  metadata: newMetadata
27688
26511
  });
27689
26512
  if (shouldUpdateThreadTitle) threadUpdateMarkers.push(createThreadUpdateMarker({
@@ -27836,7 +26659,7 @@ var ObservationStep = class {
27836
26659
  let didThresholdCleanup = false;
27837
26660
  let observerExchange;
27838
26661
  if (this.stepNumber === 0) {
27839
- const step0Messages = messageList.get.all.db();
26662
+ const step0Messages = getObservableMessages(messageList);
27840
26663
  const activation = await om.activate({
27841
26664
  threadId,
27842
26665
  resourceId,
@@ -27868,7 +26691,7 @@ var ObservationStep = class {
27868
26691
  currentModel: this.turn.actorModelContext,
27869
26692
  requestContext: this.turn.requestContext,
27870
26693
  observabilityContext: this.turn.observabilityContext,
27871
- lastActivityAt: getLastActivityFromMessages(messageList.get.all.db()),
26694
+ lastActivityAt: getLastActivityFromMessages(getObservableMessages(messageList)),
27872
26695
  reflectionHooks: om.composeHooks(void 0, {
27873
26696
  threadId,
27874
26697
  resourceId,
@@ -27878,7 +26701,7 @@ var ObservationStep = class {
27878
26701
  await this.turn.refreshRecord();
27879
26702
  if (this.turn.record.generationCount > preReflectGeneration) reflected = true;
27880
26703
  }
27881
- const allMsgsForToolCheck = messageList.get.all.db();
26704
+ const allMsgsForToolCheck = getObservableMessages(messageList);
27882
26705
  const lastMessage = allMsgsForToolCheck[allMsgsForToolCheck.length - 1];
27883
26706
  const pendingStepMessages = [...messageList.get.input.db(), ...messageList.get.response.db()];
27884
26707
  const latestStepParts = [...getLatestStepParts(lastMessage?.content?.parts ?? []), ...pendingStepMessages.flatMap((msg) => getLatestStepParts(msg.content?.parts ?? []))];
@@ -27887,10 +26710,10 @@ var ObservationStep = class {
27887
26710
  let statusSnapshot = await om.getStatus({
27888
26711
  threadId,
27889
26712
  resourceId,
27890
- messages: messageList.get.all.db()
26713
+ messages: getObservableMessages(messageList)
27891
26714
  });
27892
26715
  if (statusSnapshot.shouldBuffer && !hasIncompleteToolCalls) {
27893
- const allMessages = messageList.get.all.db();
26716
+ const allMessages = getObservableMessages(messageList);
27894
26717
  const unobservedMessages = om.getUnobservedMessages(allMessages, statusSnapshot.record);
27895
26718
  const candidates = om.getUnobservedMessages(unobservedMessages, statusSnapshot.record, { excludeBuffered: true });
27896
26719
  if (candidates.length > 0) {
@@ -27982,7 +26805,7 @@ var ObservationStep = class {
27982
26805
  statusSnapshot = await om.getStatus({
27983
26806
  threadId,
27984
26807
  resourceId,
27985
- messages: messageList.get.all.db()
26808
+ messages: getObservableMessages(messageList)
27986
26809
  });
27987
26810
  }
27988
26811
  const otherThreadsContext = await this.turn.refreshOtherThreadsContext();
@@ -28031,7 +26854,7 @@ var ObservationStep = class {
28031
26854
  const { threadId, resourceId, messageList } = this.turn;
28032
26855
  const om = this.turn.om;
28033
26856
  await om.waitForBuffering(threadId, resourceId);
28034
- const observableMessages = this.seededResponseMessage ? messageList.get.all.db().filter((msg) => msg.id !== this.turn.responseMessageId) : messageList.get.all.db();
26857
+ const observableMessages = this.seededResponseMessage ? getObservableMessages(messageList).filter((msg) => msg.id !== this.turn.responseMessageId) : getObservableMessages(messageList);
28035
26858
  const freshStatus = await om.getStatus({
28036
26859
  threadId,
28037
26860
  resourceId,
@@ -28061,7 +26884,7 @@ var ObservationStep = class {
28061
26884
  currentModel: this.turn.actorModelContext,
28062
26885
  requestContext: this.turn.requestContext,
28063
26886
  observabilityContext: this.turn.observabilityContext,
28064
- lastActivityAt: getLastActivityFromMessages(messageList.get.all.db()),
26887
+ lastActivityAt: getLastActivityFromMessages(getObservableMessages(messageList)),
28065
26888
  reflectionHooks: om.composeHooks(void 0, {
28066
26889
  threadId,
28067
26890
  resourceId,
@@ -28087,7 +26910,7 @@ var ObservationStep = class {
28087
26910
  });
28088
26911
  if (obsResult.observed) {
28089
26912
  const observedMessageIds = new Set(obsResult.record.observedMessageIds ?? []);
28090
- const liveMessages = messageList.get.all.db();
26913
+ const liveMessages = getObservableMessages(messageList);
28091
26914
  let latestObservedIndex = -1;
28092
26915
  for (let i = liveMessages.length - 1; i >= 0; i--) {
28093
26916
  const message = liveMessages[i];
@@ -28260,7 +27083,7 @@ var ObservationTurn = class {
28260
27083
  const asyncObservationEnabled = this.om.buffering.isAsyncObservationEnabled();
28261
27084
  const bufferOnIdle = this.om.getObservationConfig().bufferOnIdle;
28262
27085
  if (asyncObservationEnabled && bufferOnIdle) {
28263
- const allMessages = this.messageList.get.all.db();
27086
+ const allMessages = getObservableMessages(this.messageList);
28264
27087
  const record = this._record;
28265
27088
  const unobservedMessages = this.om.getUnobservedMessages(allMessages, record);
28266
27089
  if (unobservedMessages.length > 0) this.om.buffer({
@@ -28614,7 +27437,6 @@ async function persistThreadExtractedValues(storage, extractors, threadId, value
28614
27437
  });
28615
27438
  await storage.updateThread({
28616
27439
  id: threadId,
28617
- title: thread.title ?? "",
28618
27440
  metadata: newMetadata
28619
27441
  });
28620
27442
  }
@@ -28626,7 +27448,7 @@ function getCurrentModel$1(model) {
28626
27448
  return formatModelContext$1(model?.provider, model?.modelId);
28627
27449
  }
28628
27450
  function getLastModelFromMessageList(messageList) {
28629
- const messages = messageList?.get.all.db();
27451
+ const messages = messageList ? getObservableMessages(messageList) : void 0;
28630
27452
  if (!messages) return void 0;
28631
27453
  for (let i = messages.length - 1; i >= 0; i--) {
28632
27454
  const message = messages[i];
@@ -30206,7 +29028,7 @@ var ObservationalMemory = class ObservationalMemory {
30206
29028
  */
30207
29029
  async persistMarkerToMessage(marker, messageList, threadId, resourceId) {
30208
29030
  if (!messageList) return;
30209
- const allMsgs = messageList.get.all.db();
29031
+ const allMsgs = getObservableMessages(messageList);
30210
29032
  for (let i = allMsgs.length - 1; i >= 0; i--) {
30211
29033
  const msg = allMsgs[i];
30212
29034
  if (msg?.role === "assistant" && msg.content?.parts && Array.isArray(msg.content.parts)) {
@@ -30884,7 +29706,7 @@ ${formattedMessages}
30884
29706
  async cleanupMessages(opts) {
30885
29707
  const { threadId, resourceId, observedMessageIds, retentionFloor, preserveMessageIds } = opts;
30886
29708
  const messageList = this.isMessageList(opts.messages) ? opts.messages : void 0;
30887
- const allMsgs = messageList ? messageList.get.all.db() : opts.messages;
29709
+ const allMsgs = messageList ? getObservableMessages(messageList) : opts.messages;
30888
29710
  let markerIdx = -1;
30889
29711
  let markerMsg = null;
30890
29712
  for (let i = allMsgs.length - 1; i >= 0; i--) {
@@ -31582,7 +30404,7 @@ ${formattedMessages}
31582
30404
  const shouldUpdateThreadTitle = !!newTitle && newTitle.length >= 3 && newTitle !== oldTitle;
31583
30405
  await this.storage.updateThread({
31584
30406
  id: threadId,
31585
- title: shouldUpdateThreadTitle ? newTitle : thread.title ?? "",
30407
+ ...shouldUpdateThreadTitle ? { title: newTitle } : {},
31586
30408
  metadata: newMetadata
31587
30409
  });
31588
30410
  }
@@ -31800,7 +30622,6 @@ ${formattedMessages}
31800
30622
  });
31801
30623
  await this.storage.updateThread({
31802
30624
  id: threadId,
31803
- title: thread.title ?? "",
31804
30625
  metadata: newMetadata
31805
30626
  });
31806
30627
  }
@@ -31998,7 +30819,7 @@ function isTemporalGapMarkerForMessage(message, targetMessageId) {
31998
30819
  async function insertTemporalGapMarkers({ messageList, sendSignal }) {
31999
30820
  const latestInputMessage = messageList.get.input.db().filter((message) => Boolean(message)).at(-1);
32000
30821
  if (!latestInputMessage || isTemporalGapMarker(latestInputMessage)) return;
32001
- const allMessages = messageList.get.all.db().filter((message) => Boolean(message));
30822
+ const allMessages = getObservableMessages(messageList).filter((message) => Boolean(message));
32002
30823
  const latestInputIndex = allMessages.findIndex((message) => message.id === latestInputMessage.id);
32003
30824
  if (latestInputIndex <= 0) return;
32004
30825
  if (allMessages.some((message) => isTemporalGapMarkerForMessage(message, latestInputMessage.id))) return;
@@ -32220,7 +31041,7 @@ var ObservationalMemoryProcessor = class {
32220
31041
  threadId,
32221
31042
  resourceId
32222
31043
  });
32223
- const allDbMsgs = messageList.get.all.db();
31044
+ const allDbMsgs = getObservableMessages(messageList);
32224
31045
  const tokenCounter = this.engine.getTokenCounter();
32225
31046
  const contextTokens = await tokenCounter.countMessagesAsync(allDbMsgs);
32226
31047
  const otherThreadsContext = this.turn.context.otherThreadsContext;
@@ -32567,6 +31388,18 @@ var Memory = class extends _mastra_core_memory.MastraMemory {
32567
31388
  _omEngine;
32568
31389
  _omEngineInstance;
32569
31390
  _mastraInstance;
31391
+ /**
31392
+ * Every vector cleanup that deleteThread or deleteMessages started in the background.
31393
+ * Callers do not wait for the cleanup, so this handle is the only join point.
31394
+ */
31395
+ pendingVectorCleanup = Promise.resolve();
31396
+ /**
31397
+ * Adds a background vector cleanup to the join handle.
31398
+ * The handle keeps the earlier cleanups, so it settles only after all of them end.
31399
+ */
31400
+ trackVectorCleanup(cleanup) {
31401
+ this.pendingVectorCleanup = Promise.allSettled([this.pendingVectorCleanup, cleanup]).then(() => void 0);
31402
+ }
32570
31403
  /** The shared ObservationalMemory engine. Lazily created on first access. */
32571
31404
  get omEngine() {
32572
31405
  if (!this._omEngine) this._omEngine = this._initOMEngine().then((engine) => {
@@ -32831,26 +31664,40 @@ var Memory = class extends _mastra_core_memory.MastraMemory {
32831
31664
  const thread = await memoryStore.getThreadById({ threadId });
32832
31665
  await memoryStore.deleteThread({ threadId });
32833
31666
  if (thread?.resourceId && memoryStore.supportsObservationalMemory) await memoryStore.clearObservationalMemory(threadId, thread.resourceId);
32834
- if (this.vector) this.deleteThreadVectors(threadId);
31667
+ if (this.vector) this.trackVectorCleanup(this.deleteThreadVectors(threadId));
31668
+ }
31669
+ /**
31670
+ * Prefix shared by every message index. The index for the default embedding
31671
+ * dimension is named with the bare prefix; other dimensions add a suffix.
31672
+ */
31673
+ get messageIndexPrefix() {
31674
+ return this.getEmbeddingIndexName();
32835
31675
  }
32836
31676
  /**
32837
- * Lists all vector indexes that match the memory messages prefix.
32838
- * Handles separator differences across vector store backends (e.g. '_' vs '-').
31677
+ * Prefix shared by every observation index. Each observation index adds a dimension suffix.
32839
31678
  */
32840
- async getMemoryVectorIndexes() {
31679
+ get observationIndexPrefix() {
31680
+ return `memory${this.vector?.indexSeparator ?? "_"}observations`;
31681
+ }
31682
+ /**
31683
+ * Lists the vector indexes whose name starts with one of the given prefixes.
31684
+ * Index names can carry a dimension suffix, so discovery matches on the prefix.
31685
+ */
31686
+ async getMemoryVectorIndexes(prefixes) {
32841
31687
  if (!this.vector) return [];
32842
- const prefix = `memory${this.vector.indexSeparator ?? "_"}messages`;
32843
- return (await this.vector.listIndexes()).filter((name) => name.startsWith(prefix));
31688
+ return (await this.vector.listIndexes()).filter((name) => prefixes.some((prefix) => name.startsWith(prefix)));
32844
31689
  }
32845
31690
  /**
32846
31691
  * Deletes all vector embeddings associated with a thread.
32847
31692
  * This is called internally by deleteThread to clean up orphaned vectors.
31693
+ * Both message and observation vectors are removed, so no text of the deleted
31694
+ * thread stays reachable through resource-scoped retrieval.
32848
31695
  *
32849
31696
  * @param threadId - The ID of the thread whose vectors should be deleted
32850
31697
  */
32851
31698
  async deleteThreadVectors(threadId) {
32852
31699
  try {
32853
- const memoryIndexes = await this.getMemoryVectorIndexes();
31700
+ const memoryIndexes = await this.getMemoryVectorIndexes([this.messageIndexPrefix, this.observationIndexPrefix]);
32854
31701
  await Promise.all(memoryIndexes.map(async (indexName) => {
32855
31702
  try {
32856
31703
  await this.vector.deleteVectors({
@@ -32858,14 +31705,14 @@ var Memory = class extends _mastra_core_memory.MastraMemory {
32858
31705
  filter: { thread_id: threadId }
32859
31706
  });
32860
31707
  } catch {
32861
- this.logger.debug("Failed to delete vectors for thread, skipping", {
31708
+ this.logger.warn("Failed to delete vectors of the deleted thread from index", {
32862
31709
  threadId,
32863
31710
  indexName
32864
31711
  });
32865
31712
  }
32866
31713
  }));
32867
31714
  } catch {
32868
- this.logger.debug("Failed to clean up vectors for thread", { threadId });
31715
+ this.logger.warn("Failed to clean up vectors of the deleted thread", { threadId });
32869
31716
  }
32870
31717
  }
32871
31718
  async updateWorkingMemory({ threadId, resourceId, workingMemory, memoryConfig, observabilityContext }) {
@@ -32893,7 +31740,6 @@ var Memory = class extends _mastra_core_memory.MastraMemory {
32893
31740
  if (!thread) throw new Error(`Thread ${threadId} not found`);
32894
31741
  await memoryStore.updateThread({
32895
31742
  id: threadId,
32896
- title: thread.title || "",
32897
31743
  metadata: {
32898
31744
  ...thread.metadata,
32899
31745
  workingMemory
@@ -32982,7 +31828,6 @@ ${workingMemory}`;
32982
31828
  if (!thread) throw new Error(`Thread ${threadId} not found`);
32983
31829
  await memoryStore.updateThread({
32984
31830
  id: threadId,
32985
- title: thread.title || "",
32986
31831
  metadata: {
32987
31832
  ...thread.metadata,
32988
31833
  workingMemory
@@ -33538,7 +32383,7 @@ Notes:
33538
32383
  getObservationEmbeddingIndexName(dimensions) {
33539
32384
  const usedDimensions = dimensions ?? 384;
33540
32385
  const separator = this.vector?.indexSeparator ?? "_";
33541
- return `memory${separator}observations${separator}${usedDimensions}`;
32386
+ return `${this.observationIndexPrefix}${separator}${usedDimensions}`;
33542
32387
  }
33543
32388
  async createObservationEmbeddingIndex(dimensions) {
33544
32389
  const usedDimensions = dimensions ?? 384;
@@ -33784,7 +32629,10 @@ Notes:
33784
32629
  tools[name] = tool;
33785
32630
  }
33786
32631
  const omConfig = normalizeObservationalMemoryConfig(mergedConfig.observationalMemory);
33787
- if (omConfig?.retrieval) tools.recall = recallTool(mergedConfig, { retrievalScope: typeof omConfig.retrieval === "object" ? omConfig.retrieval.scope ?? "resource" : "resource" });
32632
+ if (omConfig?.retrieval) tools.recall = recallTool(mergedConfig, {
32633
+ retrievalScope: typeof omConfig.retrieval === "object" ? omConfig.retrieval.scope ?? "resource" : "resource",
32634
+ searchEnabled: this.hasRetrievalSearch(omConfig.retrieval)
32635
+ });
33788
32636
  return tools;
33789
32637
  }
33790
32638
  /**
@@ -33840,7 +32688,7 @@ Notes:
33840
32688
  }));
33841
32689
  const messageIdsNeedingDeletion = /* @__PURE__ */ new Set([...messageIdsWithClearedContent, ...messageIdsWithNewEmbeddings]);
33842
32690
  if (messageIdsNeedingDeletion.size > 0) try {
33843
- const memoryIndexes = await this.getMemoryVectorIndexes();
32691
+ const memoryIndexes = await this.getMemoryVectorIndexes([this.messageIndexPrefix]);
33844
32692
  const idsToDelete = [...messageIdsNeedingDeletion];
33845
32693
  await Promise.all(memoryIndexes.map(async (indexName) => {
33846
32694
  for (let i = 0; i < idsToDelete.length; i += VECTOR_DELETE_BATCH_SIZE) {
@@ -33899,7 +32747,7 @@ Notes:
33899
32747
  const span = this.createMemorySpan("delete", observabilityContext, void 0, { messageCount: messageIds.length });
33900
32748
  try {
33901
32749
  await (await this.getMemoryStore()).deleteMessages(messageIds);
33902
- if (this.vector) this.deleteMessageVectors(messageIds);
32750
+ if (this.vector) this.trackVectorCleanup(this.deleteMessageVectors(messageIds));
33903
32751
  span?.end({
33904
32752
  output: { success: true },
33905
32753
  attributes: { messageCount: messageIds.length }
@@ -33915,12 +32763,14 @@ Notes:
33915
32763
  /**
33916
32764
  * Deletes vector embeddings for specific messages.
33917
32765
  * This is called internally by deleteMessages to clean up orphaned vectors.
32766
+ * Only the message indexes are touched, because observation vectors can hold
32767
+ * text of other messages of the thread.
33918
32768
  *
33919
32769
  * @param messageIds - The IDs of the messages whose vectors should be deleted
33920
32770
  */
33921
32771
  async deleteMessageVectors(messageIds) {
33922
32772
  try {
33923
- const memoryIndexes = await this.getMemoryVectorIndexes();
32773
+ const memoryIndexes = await this.getMemoryVectorIndexes([this.messageIndexPrefix]);
33924
32774
  await Promise.all(memoryIndexes.map(async (indexName) => {
33925
32775
  for (let i = 0; i < messageIds.length; i += VECTOR_DELETE_BATCH_SIZE) {
33926
32776
  const batch = messageIds.slice(i, i + VECTOR_DELETE_BATCH_SIZE);
@@ -37109,8 +35959,8 @@ export const mastra = new Mastra({
37109
35959
  if (fileTypes.length > 0) fileTypes.forEach((ft) => {
37110
35960
  rgArgs.push("--type-add", `custom:*.${ft}`, "-t", "custom");
37111
35961
  });
37112
- excludePaths.forEach((path$2) => {
37113
- rgArgs.push("--glob", `!${path$2}`);
35962
+ excludePaths.forEach((path$1) => {
35963
+ rgArgs.push("--glob", `!${path$1}`);
37114
35964
  });
37115
35965
  rgArgs.push("-m", maxResults.toString());
37116
35966
  rgArgs.push(query);
@@ -37232,7 +36082,7 @@ export const mastra = new Mastra({
37232
36082
  */
37233
36083
  static async listDirectory(context) {
37234
36084
  try {
37235
- const { path: path$3, recursive = false, includeHidden = false, pattern, maxDepth = 10, includeMetadata = true, projectPath } = context;
36085
+ const { path: path$2, recursive = false, includeHidden = false, pattern, maxDepth = 10, includeMetadata = true, projectPath } = context;
37236
36086
  const gitignorePath = (0, path.join)(projectPath || process.cwd(), ".gitignore");
37237
36087
  let gitignoreFilter;
37238
36088
  try {
@@ -37241,7 +36091,7 @@ export const mastra = new Mastra({
37241
36091
  } catch (err) {
37242
36092
  if (err.code !== "ENOENT") console.error(`Error reading .gitignore file:`, err);
37243
36093
  }
37244
- const resolvedPath = (0, path.isAbsolute)(path$3) ? path$3 : (0, path.resolve)(projectPath || process.cwd(), path$3);
36094
+ const resolvedPath = (0, path.isAbsolute)(path$2) ? path$2 : (0, path.resolve)(projectPath || process.cwd(), path$2);
37245
36095
  const items = [];
37246
36096
  async function processDirectory(dirPath, currentDepth = 0) {
37247
36097
  const relativeToProject = (0, path.relative)(projectPath || process.cwd(), dirPath);
@@ -37703,7 +36553,7 @@ const discoverUnitsStep = (0, _mastra_core_workflows.createStep)({
37703
36553
  const model = await resolveModel({
37704
36554
  requestContext,
37705
36555
  projectPath: targetPath,
37706
- defaultModel: require_dist$1.openai("gpt-4.1")
36556
+ defaultModel: require_dist.openai("gpt-4.1")
37707
36557
  });
37708
36558
  try {
37709
36559
  const agent = new _mastra_core_agent.Agent({
@@ -38398,7 +37248,7 @@ const intelligentMergeStep = (0, _mastra_core_workflows.createStep)({
38398
37248
  const model = await resolveModel({
38399
37249
  requestContext,
38400
37250
  projectPath: targetPath,
38401
- defaultModel: require_dist$1.openai("gpt-4.1")
37251
+ defaultModel: require_dist.openai("gpt-4.1")
38402
37252
  });
38403
37253
  const copyFileTool = (0, _mastra_core_tools.createTool)({
38404
37254
  id: "copy-file",
@@ -38674,7 +37524,7 @@ const validationAndFixStep = (0, _mastra_core_workflows.createStep)({
38674
37524
  const model = await resolveModel({
38675
37525
  requestContext,
38676
37526
  projectPath: targetPath,
38677
- defaultModel: require_dist$1.openai("gpt-4.1")
37527
+ defaultModel: require_dist.openai("gpt-4.1")
38678
37528
  });
38679
37529
  const allTools = await AgentBuilderDefaults.listToolsForMode(targetPath, "template");
38680
37530
  const validationAgent = new _mastra_core_agent.Agent({
@@ -44696,4 +43546,4 @@ const agentBuilderWorkflows = {
44696
43546
  //#endregion
44697
43547
  exports.agentBuilderWorkflows = agentBuilderWorkflows;
44698
43548
 
44699
- //# sourceMappingURL=dist-DgY0llRv.cjs.map
43549
+ //# sourceMappingURL=dist-TkFPtpuy.cjs.map