@mastra/react 1.7.3-alpha.3 → 1.8.0-alpha.4

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 (510) hide show
  1. package/dist/accumulator-B1MuNX3j.js +1668 -0
  2. package/dist/accumulator-B1MuNX3j.js.map +1 -0
  3. package/dist/accumulator-CsUGDUHk.cjs +1709 -0
  4. package/dist/accumulator-CsUGDUHk.cjs.map +1 -0
  5. package/dist/agent/hooks.d.ts.map +1 -1
  6. package/dist/agent/user-message.d.ts +4 -0
  7. package/dist/agent/user-message.d.ts.map +1 -0
  8. package/dist/chat/index.cjs +3 -0
  9. package/dist/chat/index.d.ts +3 -0
  10. package/dist/chat/index.d.ts.map +1 -0
  11. package/dist/chat/index.js +2 -0
  12. package/dist/feedback-refetch-interval-DLHzQoVV.js +12 -0
  13. package/dist/feedback-refetch-interval-DLHzQoVV.js.map +1 -0
  14. package/dist/feedback-refetch-interval-XD5FVc2k.cjs +17 -0
  15. package/dist/feedback-refetch-interval-XD5FVc2k.cjs.map +1 -0
  16. package/dist/hooks/agents/index.cjs +988 -0
  17. package/dist/hooks/agents/index.cjs.map +1 -0
  18. package/dist/hooks/agents/index.d.ts +19 -0
  19. package/dist/hooks/agents/index.d.ts.map +1 -0
  20. package/dist/hooks/agents/index.js +952 -0
  21. package/dist/hooks/agents/index.js.map +1 -0
  22. package/dist/hooks/agents/is-model-not-allowed.d.ts +15 -0
  23. package/dist/hooks/agents/is-model-not-allowed.d.ts.map +1 -0
  24. package/dist/hooks/agents/use-agent-messages.d.ts +18 -0
  25. package/dist/hooks/agents/use-agent-messages.d.ts.map +1 -0
  26. package/dist/hooks/agents/use-agent-plan.d.ts +14 -0
  27. package/dist/hooks/agents/use-agent-plan.d.ts.map +1 -0
  28. package/dist/hooks/agents/use-agent-skills.d.ts +2021 -0
  29. package/dist/hooks/agents/use-agent-skills.d.ts.map +1 -0
  30. package/dist/hooks/agents/use-agent-versions.d.ts +72 -0
  31. package/dist/hooks/agents/use-agent-versions.d.ts.map +1 -0
  32. package/dist/hooks/agents/use-agent-working-memory.d.ts +11 -0
  33. package/dist/hooks/agents/use-agent-working-memory.d.ts.map +1 -0
  34. package/dist/hooks/agents/use-agent-workspace.d.ts +2022 -0
  35. package/dist/hooks/agents/use-agent-workspace.d.ts.map +1 -0
  36. package/dist/hooks/agents/use-agent.d.ts +12 -0
  37. package/dist/hooks/agents/use-agent.d.ts.map +1 -0
  38. package/dist/hooks/agents/use-agents-model-providers.d.ts +9 -0
  39. package/dist/hooks/agents/use-agents-model-providers.d.ts.map +1 -0
  40. package/dist/hooks/agents/use-agents.d.ts +28 -0
  41. package/dist/hooks/agents/use-agents.d.ts.map +1 -0
  42. package/dist/hooks/agents/use-background-tasks.d.ts +51 -0
  43. package/dist/hooks/agents/use-background-tasks.d.ts.map +1 -0
  44. package/dist/hooks/agents/use-browser-session-probe.d.ts +34 -0
  45. package/dist/hooks/agents/use-browser-session-probe.d.ts.map +1 -0
  46. package/dist/hooks/agents/use-channels.d.ts +34 -0
  47. package/dist/hooks/agents/use-channels.d.ts.map +1 -0
  48. package/dist/hooks/agents/use-close-browser.d.ts +17 -0
  49. package/dist/hooks/agents/use-close-browser.d.ts.map +1 -0
  50. package/dist/hooks/agents/use-execute-agent-tool.d.ts +14 -0
  51. package/dist/hooks/agents/use-execute-agent-tool.d.ts.map +1 -0
  52. package/dist/hooks/agents/use-preview-instructions.d.ts +20 -0
  53. package/dist/hooks/agents/use-preview-instructions.d.ts.map +1 -0
  54. package/dist/hooks/agents/use-stored-agents.d.ts +8023 -0
  55. package/dist/hooks/agents/use-stored-agents.d.ts.map +1 -0
  56. package/dist/hooks/agents/use-stored-skills.d.ts +8 -0
  57. package/dist/hooks/agents/use-stored-skills.d.ts.map +1 -0
  58. package/dist/hooks/auth/fetch-with-refresh.d.ts +28 -0
  59. package/dist/hooks/auth/fetch-with-refresh.d.ts.map +1 -0
  60. package/dist/hooks/auth/get-client-query-key.d.ts +7 -0
  61. package/dist/hooks/auth/get-client-query-key.d.ts.map +1 -0
  62. package/dist/hooks/auth/index.cjs +492 -0
  63. package/dist/hooks/auth/index.cjs.map +1 -0
  64. package/dist/hooks/auth/index.d.ts +11 -0
  65. package/dist/hooks/auth/index.d.ts.map +1 -0
  66. package/dist/hooks/auth/index.js +474 -0
  67. package/dist/hooks/auth/index.js.map +1 -0
  68. package/dist/hooks/auth/sso-login.d.ts +8 -0
  69. package/dist/hooks/auth/sso-login.d.ts.map +1 -0
  70. package/dist/hooks/auth/types.d.ts +107 -0
  71. package/dist/hooks/auth/types.d.ts.map +1 -0
  72. package/dist/hooks/auth/use-auth-actions.d.ts +99 -0
  73. package/dist/hooks/auth/use-auth-actions.d.ts.map +1 -0
  74. package/dist/hooks/auth/use-auth-capabilities.d.ts +43 -0
  75. package/dist/hooks/auth/use-auth-capabilities.d.ts.map +1 -0
  76. package/dist/hooks/auth/use-credentials-login.d.ts +63 -0
  77. package/dist/hooks/auth/use-credentials-login.d.ts.map +1 -0
  78. package/dist/hooks/auth/use-credentials-signup.d.ts +66 -0
  79. package/dist/hooks/auth/use-credentials-signup.d.ts.map +1 -0
  80. package/dist/hooks/auth/use-current-user.d.ts +40 -0
  81. package/dist/hooks/auth/use-current-user.d.ts.map +1 -0
  82. package/dist/hooks/auth/use-permission-patterns.d.ts +24 -0
  83. package/dist/hooks/auth/use-permission-patterns.d.ts.map +1 -0
  84. package/dist/hooks/capabilities/index.cjs +47 -0
  85. package/dist/hooks/capabilities/index.cjs.map +1 -0
  86. package/dist/hooks/capabilities/index.d.ts +4 -0
  87. package/dist/hooks/capabilities/index.d.ts.map +1 -0
  88. package/dist/hooks/capabilities/index.js +44 -0
  89. package/dist/hooks/capabilities/index.js.map +1 -0
  90. package/dist/hooks/capabilities/use-feedback-available.d.ts +9 -0
  91. package/dist/hooks/capabilities/use-feedback-available.d.ts.map +1 -0
  92. package/dist/hooks/capabilities/use-observability-capabilities.d.ts +9 -0
  93. package/dist/hooks/capabilities/use-observability-capabilities.d.ts.map +1 -0
  94. package/dist/hooks/capabilities/use-trace-query-available.d.ts +9 -0
  95. package/dist/hooks/capabilities/use-trace-query-available.d.ts.map +1 -0
  96. package/dist/hooks/configuration/index.cjs +18 -0
  97. package/dist/hooks/configuration/index.cjs.map +1 -0
  98. package/dist/hooks/configuration/index.d.ts +2 -0
  99. package/dist/hooks/configuration/index.d.ts.map +1 -0
  100. package/dist/hooks/configuration/index.js +17 -0
  101. package/dist/hooks/configuration/index.js.map +1 -0
  102. package/dist/hooks/configuration/use-mastra-packages.d.ts +9 -0
  103. package/dist/hooks/configuration/use-mastra-packages.d.ts.map +1 -0
  104. package/dist/hooks/datasets/index.cjs +615 -0
  105. package/dist/hooks/datasets/index.cjs.map +1 -0
  106. package/dist/hooks/datasets/index.d.ts +10 -0
  107. package/dist/hooks/datasets/index.d.ts.map +1 -0
  108. package/dist/hooks/datasets/index.js +600 -0
  109. package/dist/hooks/datasets/index.js.map +1 -0
  110. package/dist/hooks/datasets/use-compare-experiments.d.ts +23 -0
  111. package/dist/hooks/datasets/use-compare-experiments.d.ts.map +1 -0
  112. package/dist/hooks/datasets/use-dataset-experiments.d.ts +49 -0
  113. package/dist/hooks/datasets/use-dataset-experiments.d.ts.map +1 -0
  114. package/dist/hooks/datasets/use-dataset-item-versions.d.ts +31 -0
  115. package/dist/hooks/datasets/use-dataset-item-versions.d.ts.map +1 -0
  116. package/dist/hooks/datasets/use-dataset-items.d.ts +38 -0
  117. package/dist/hooks/datasets/use-dataset-items.d.ts.map +1 -0
  118. package/dist/hooks/datasets/use-dataset-mutations.d.ts +362 -0
  119. package/dist/hooks/datasets/use-dataset-mutations.d.ts.map +1 -0
  120. package/dist/hooks/datasets/use-dataset-versions.d.ts +23 -0
  121. package/dist/hooks/datasets/use-dataset-versions.d.ts.map +1 -0
  122. package/dist/hooks/datasets/use-datasets.d.ts +44 -0
  123. package/dist/hooks/datasets/use-datasets.d.ts.map +1 -0
  124. package/dist/hooks/datasets/use-experiments.d.ts +16 -0
  125. package/dist/hooks/datasets/use-experiments.d.ts.map +1 -0
  126. package/dist/hooks/datasets/use-workflow-schema.d.ts +16 -0
  127. package/dist/hooks/datasets/use-workflow-schema.d.ts.map +1 -0
  128. package/dist/hooks/embedders/index.cjs +19 -0
  129. package/dist/hooks/embedders/index.cjs.map +1 -0
  130. package/dist/hooks/embedders/index.d.ts +2 -0
  131. package/dist/hooks/embedders/index.d.ts.map +1 -0
  132. package/dist/hooks/embedders/index.js +18 -0
  133. package/dist/hooks/embedders/index.js.map +1 -0
  134. package/dist/hooks/embedders/use-embedders.d.ts +17 -0
  135. package/dist/hooks/embedders/use-embedders.d.ts.map +1 -0
  136. package/dist/hooks/experiments/index.cjs +152 -0
  137. package/dist/hooks/experiments/index.cjs.map +1 -0
  138. package/dist/hooks/experiments/index.d.ts +5 -0
  139. package/dist/hooks/experiments/index.d.ts.map +1 -0
  140. package/dist/hooks/experiments/index.js +146 -0
  141. package/dist/hooks/experiments/index.js.map +1 -0
  142. package/dist/hooks/experiments/use-experiment-metrics.d.ts +30 -0
  143. package/dist/hooks/experiments/use-experiment-metrics.d.ts.map +1 -0
  144. package/dist/hooks/experiments/use-experiment-trace.d.ts +13 -0
  145. package/dist/hooks/experiments/use-experiment-trace.d.ts.map +1 -0
  146. package/dist/hooks/experiments/use-experiments-for-dataset-filter.d.ts +22 -0
  147. package/dist/hooks/experiments/use-experiments-for-dataset-filter.d.ts.map +1 -0
  148. package/dist/hooks/experiments/use-infinite-experiments.d.ts +22 -0
  149. package/dist/hooks/experiments/use-infinite-experiments.d.ts.map +1 -0
  150. package/dist/hooks/feedback/feedback-refetch-interval.d.ts +7 -0
  151. package/dist/hooks/feedback/feedback-refetch-interval.d.ts.map +1 -0
  152. package/dist/hooks/feedback/index.cjs +22 -0
  153. package/dist/hooks/feedback/index.cjs.map +1 -0
  154. package/dist/hooks/feedback/index.d.ts +3 -0
  155. package/dist/hooks/feedback/index.d.ts.map +1 -0
  156. package/dist/hooks/feedback/index.js +20 -0
  157. package/dist/hooks/feedback/index.js.map +1 -0
  158. package/dist/hooks/feedback/use-feedback.d.ts +56 -0
  159. package/dist/hooks/feedback/use-feedback.d.ts.map +1 -0
  160. package/dist/hooks/llm/index.cjs +17 -0
  161. package/dist/hooks/llm/index.cjs.map +1 -0
  162. package/dist/hooks/llm/index.d.ts +2 -0
  163. package/dist/hooks/llm/index.d.ts.map +1 -0
  164. package/dist/hooks/llm/index.js +16 -0
  165. package/dist/hooks/llm/index.js.map +1 -0
  166. package/dist/hooks/llm/use-llm-providers.d.ts +7 -0
  167. package/dist/hooks/llm/use-llm-providers.d.ts.map +1 -0
  168. package/dist/hooks/logs/index.cjs +84 -0
  169. package/dist/hooks/logs/index.cjs.map +1 -0
  170. package/dist/hooks/logs/index.d.ts +4 -0
  171. package/dist/hooks/logs/index.d.ts.map +1 -0
  172. package/dist/hooks/logs/index.js +82 -0
  173. package/dist/hooks/logs/index.js.map +1 -0
  174. package/dist/hooks/logs/types.d.ts +36 -0
  175. package/dist/hooks/logs/types.d.ts.map +1 -0
  176. package/dist/hooks/logs/use-logs.d.ts +79 -0
  177. package/dist/hooks/logs/use-logs.d.ts.map +1 -0
  178. package/dist/hooks/mcps/index.cjs +215 -0
  179. package/dist/hooks/mcps/index.cjs.map +1 -0
  180. package/dist/hooks/mcps/index.d.ts +7 -0
  181. package/dist/hooks/mcps/index.d.ts.map +1 -0
  182. package/dist/hooks/mcps/index.js +208 -0
  183. package/dist/hooks/mcps/index.js.map +1 -0
  184. package/dist/hooks/mcps/use-mcp-app-tools.d.ts +21 -0
  185. package/dist/hooks/mcps/use-mcp-app-tools.d.ts.map +1 -0
  186. package/dist/hooks/mcps/use-mcp-server-tool.d.ts +25 -0
  187. package/dist/hooks/mcps/use-mcp-server-tool.d.ts.map +1 -0
  188. package/dist/hooks/mcps/use-mcp-server-tools-by-id.d.ts +13 -0
  189. package/dist/hooks/mcps/use-mcp-server-tools-by-id.d.ts.map +1 -0
  190. package/dist/hooks/mcps/use-mcp-server-tools.d.ts +9 -0
  191. package/dist/hooks/mcps/use-mcp-server-tools.d.ts.map +1 -0
  192. package/dist/hooks/mcps/use-mcp-servers.d.ts +8 -0
  193. package/dist/hooks/mcps/use-mcp-servers.d.ts.map +1 -0
  194. package/dist/hooks/mcps/use-try-connect-mcp.d.ts +15 -0
  195. package/dist/hooks/mcps/use-try-connect-mcp.d.ts.map +1 -0
  196. package/dist/hooks/memory/index.cjs +328 -0
  197. package/dist/hooks/memory/index.cjs.map +1 -0
  198. package/dist/hooks/memory/index.d.ts +5 -0
  199. package/dist/hooks/memory/index.d.ts.map +1 -0
  200. package/dist/hooks/memory/index.js +312 -0
  201. package/dist/hooks/memory/index.js.map +1 -0
  202. package/dist/hooks/memory/use-memory-status.d.ts +12 -0
  203. package/dist/hooks/memory/use-memory-status.d.ts.map +1 -0
  204. package/dist/hooks/memory/use-memory-thread-messages.d.ts +13 -0
  205. package/dist/hooks/memory/use-memory-thread-messages.d.ts.map +1 -0
  206. package/dist/hooks/memory/use-memory.d.ts +159 -0
  207. package/dist/hooks/memory/use-memory.d.ts.map +1 -0
  208. package/dist/hooks/memory/use-observational-memory.d.ts +13 -0
  209. package/dist/hooks/memory/use-observational-memory.d.ts.map +1 -0
  210. package/dist/hooks/metrics/index.cjs +997 -0
  211. package/dist/hooks/metrics/index.cjs.map +1 -0
  212. package/dist/hooks/metrics/index.d.ts +16 -0
  213. package/dist/hooks/metrics/index.d.ts.map +1 -0
  214. package/dist/hooks/metrics/index.js +981 -0
  215. package/dist/hooks/metrics/index.js.map +1 -0
  216. package/dist/hooks/metrics/metrics-interval.d.ts +8 -0
  217. package/dist/hooks/metrics/metrics-interval.d.ts.map +1 -0
  218. package/dist/hooks/metrics/metrics-query-filters.d.ts +62 -0
  219. package/dist/hooks/metrics/metrics-query-filters.d.ts.map +1 -0
  220. package/dist/hooks/metrics/use-active-resources-kpi-metrics.d.ts +12 -0
  221. package/dist/hooks/metrics/use-active-resources-kpi-metrics.d.ts.map +1 -0
  222. package/dist/hooks/metrics/use-active-threads-kpi-metrics.d.ts +12 -0
  223. package/dist/hooks/metrics/use-active-threads-kpi-metrics.d.ts.map +1 -0
  224. package/dist/hooks/metrics/use-agent-runs-kpi-metrics.d.ts +9 -0
  225. package/dist/hooks/metrics/use-agent-runs-kpi-metrics.d.ts.map +1 -0
  226. package/dist/hooks/metrics/use-latency-metrics.d.ts +23 -0
  227. package/dist/hooks/metrics/use-latency-metrics.d.ts.map +1 -0
  228. package/dist/hooks/metrics/use-model-cost-kpi-metrics.d.ts +14 -0
  229. package/dist/hooks/metrics/use-model-cost-kpi-metrics.d.ts.map +1 -0
  230. package/dist/hooks/metrics/use-model-usage-cost-metrics.d.ts +16 -0
  231. package/dist/hooks/metrics/use-model-usage-cost-metrics.d.ts.map +1 -0
  232. package/dist/hooks/metrics/use-scores-metrics.d.ts +24 -0
  233. package/dist/hooks/metrics/use-scores-metrics.d.ts.map +1 -0
  234. package/dist/hooks/metrics/use-token-usage-by-agent-metrics.d.ts +15 -0
  235. package/dist/hooks/metrics/use-token-usage-by-agent-metrics.d.ts.map +1 -0
  236. package/dist/hooks/metrics/use-token-usage-timeseries.d.ts +22 -0
  237. package/dist/hooks/metrics/use-token-usage-timeseries.d.ts.map +1 -0
  238. package/dist/hooks/metrics/use-top-active-threads-metrics.d.ts +21 -0
  239. package/dist/hooks/metrics/use-top-active-threads-metrics.d.ts.map +1 -0
  240. package/dist/hooks/metrics/use-top-resources-by-threads-metrics.d.ts +20 -0
  241. package/dist/hooks/metrics/use-top-resources-by-threads-metrics.d.ts.map +1 -0
  242. package/dist/hooks/metrics/use-total-tokens-kpi-metrics.d.ts +13 -0
  243. package/dist/hooks/metrics/use-total-tokens-kpi-metrics.d.ts.map +1 -0
  244. package/dist/hooks/metrics/use-trace-volume-metrics.d.ts +17 -0
  245. package/dist/hooks/metrics/use-trace-volume-metrics.d.ts.map +1 -0
  246. package/dist/hooks/processors/index.cjs +43 -0
  247. package/dist/hooks/processors/index.cjs.map +1 -0
  248. package/dist/hooks/processors/index.d.ts +2 -0
  249. package/dist/hooks/processors/index.d.ts.map +1 -0
  250. package/dist/hooks/processors/index.js +40 -0
  251. package/dist/hooks/processors/index.js.map +1 -0
  252. package/dist/hooks/processors/use-processors.d.ts +64 -0
  253. package/dist/hooks/processors/use-processors.d.ts.map +1 -0
  254. package/dist/hooks/prompt-blocks/index.cjs +181 -0
  255. package/dist/hooks/prompt-blocks/index.cjs.map +1 -0
  256. package/dist/hooks/prompt-blocks/index.d.ts +3 -0
  257. package/dist/hooks/prompt-blocks/index.d.ts.map +1 -0
  258. package/dist/hooks/prompt-blocks/index.js +172 -0
  259. package/dist/hooks/prompt-blocks/index.js.map +1 -0
  260. package/dist/hooks/prompt-blocks/use-prompt-block-versions.d.ts +59 -0
  261. package/dist/hooks/prompt-blocks/use-prompt-block-versions.d.ts.map +1 -0
  262. package/dist/hooks/prompt-blocks/use-stored-prompt-blocks.d.ts +180 -0
  263. package/dist/hooks/prompt-blocks/use-stored-prompt-blocks.d.ts.map +1 -0
  264. package/dist/hooks/query/index.cjs +34 -0
  265. package/dist/hooks/query/index.cjs.map +1 -0
  266. package/dist/hooks/query/index.d.ts +4 -0
  267. package/dist/hooks/query/index.d.ts.map +1 -0
  268. package/dist/hooks/query/index.js +25 -0
  269. package/dist/hooks/query/index.js.map +1 -0
  270. package/dist/hooks/query/query-client-provider.d.ts +8 -0
  271. package/dist/hooks/query/query-client-provider.d.ts.map +1 -0
  272. package/dist/hooks/query/query-utils.d.ts +48 -0
  273. package/dist/hooks/query/query-utils.d.ts.map +1 -0
  274. package/dist/hooks/review/index.cjs +89 -0
  275. package/dist/hooks/review/index.cjs.map +1 -0
  276. package/dist/hooks/review/index.d.ts +4 -0
  277. package/dist/hooks/review/index.d.ts.map +1 -0
  278. package/dist/hooks/review/index.js +86 -0
  279. package/dist/hooks/review/index.js.map +1 -0
  280. package/dist/hooks/review/types.d.ts +21 -0
  281. package/dist/hooks/review/types.d.ts.map +1 -0
  282. package/dist/hooks/review/use-dataset-review-items.d.ts +19 -0
  283. package/dist/hooks/review/use-dataset-review-items.d.ts.map +1 -0
  284. package/dist/hooks/review/use-review-summary.d.ts +9 -0
  285. package/dist/hooks/review/use-review-summary.d.ts.map +1 -0
  286. package/dist/hooks/schedules/index.cjs +110 -0
  287. package/dist/hooks/schedules/index.cjs.map +1 -0
  288. package/dist/hooks/schedules/index.d.ts +5 -0
  289. package/dist/hooks/schedules/index.d.ts.map +1 -0
  290. package/dist/hooks/schedules/index.js +106 -0
  291. package/dist/hooks/schedules/index.js.map +1 -0
  292. package/dist/hooks/schedules/use-schedule-triggers.d.ts +18 -0
  293. package/dist/hooks/schedules/use-schedule-triggers.d.ts.map +1 -0
  294. package/dist/hooks/schedules/use-schedule.d.ts +11 -0
  295. package/dist/hooks/schedules/use-schedule.d.ts.map +1 -0
  296. package/dist/hooks/schedules/use-schedules.d.ts +7 -0
  297. package/dist/hooks/schedules/use-schedules.d.ts.map +1 -0
  298. package/dist/hooks/schedules/use-toggle-schedule.d.ts +13 -0
  299. package/dist/hooks/schedules/use-toggle-schedule.d.ts.map +1 -0
  300. package/dist/hooks/scores/index.cjs +339 -0
  301. package/dist/hooks/scores/index.cjs.map +1 -0
  302. package/dist/hooks/scores/index.d.ts +6 -0
  303. package/dist/hooks/scores/index.d.ts.map +1 -0
  304. package/dist/hooks/scores/index.js +323 -0
  305. package/dist/hooks/scores/index.js.map +1 -0
  306. package/dist/hooks/scores/use-scorer-versions.d.ts +71 -0
  307. package/dist/hooks/scores/use-scorer-versions.d.ts.map +1 -0
  308. package/dist/hooks/scores/use-scorers.d.ts +34 -0
  309. package/dist/hooks/scores/use-scorers.d.ts.map +1 -0
  310. package/dist/hooks/scores/use-stored-scorers.d.ts +151 -0
  311. package/dist/hooks/scores/use-stored-scorers.d.ts.map +1 -0
  312. package/dist/hooks/scores/use-trace-span-scores.d.ts +20 -0
  313. package/dist/hooks/scores/use-trace-span-scores.d.ts.map +1 -0
  314. package/dist/hooks/scores/use-trigger-scorer.d.ts +17 -0
  315. package/dist/hooks/scores/use-trigger-scorer.d.ts.map +1 -0
  316. package/dist/hooks/shared/cost.d.ts +7 -0
  317. package/dist/hooks/shared/cost.d.ts.map +1 -0
  318. package/dist/hooks/shared/date-format.d.ts +30 -0
  319. package/dist/hooks/shared/date-format.d.ts.map +1 -0
  320. package/dist/hooks/shared/map.d.ts +2 -0
  321. package/dist/hooks/shared/map.d.ts.map +1 -0
  322. package/dist/hooks/shared/query-options.d.ts +19 -0
  323. package/dist/hooks/shared/query-options.d.ts.map +1 -0
  324. package/dist/hooks/shared/use-in-view.d.ts +23 -0
  325. package/dist/hooks/shared/use-in-view.d.ts.map +1 -0
  326. package/dist/hooks/templates/index.cjs +464 -0
  327. package/dist/hooks/templates/index.cjs.map +1 -0
  328. package/dist/hooks/templates/index.d.ts +2 -0
  329. package/dist/hooks/templates/index.d.ts.map +1 -0
  330. package/dist/hooks/templates/index.js +456 -0
  331. package/dist/hooks/templates/index.js.map +1 -0
  332. package/dist/hooks/templates/use-templates.d.ts +139 -0
  333. package/dist/hooks/templates/use-templates.d.ts.map +1 -0
  334. package/dist/hooks/tool-providers/index.cjs +342 -0
  335. package/dist/hooks/tool-providers/index.cjs.map +1 -0
  336. package/dist/hooks/tool-providers/index.d.ts +10 -0
  337. package/dist/hooks/tool-providers/index.d.ts.map +1 -0
  338. package/dist/hooks/tool-providers/index.js +332 -0
  339. package/dist/hooks/tool-providers/index.js.map +1 -0
  340. package/dist/hooks/tool-providers/use-all-connections.d.ts +41 -0
  341. package/dist/hooks/tool-providers/use-all-connections.d.ts.map +1 -0
  342. package/dist/hooks/tool-providers/use-all-provider-tools.d.ts +25 -0
  343. package/dist/hooks/tool-providers/use-all-provider-tools.d.ts.map +1 -0
  344. package/dist/hooks/tool-providers/use-authorize.d.ts +45 -0
  345. package/dist/hooks/tool-providers/use-authorize.d.ts.map +1 -0
  346. package/dist/hooks/tool-providers/use-disconnect-connection.d.ts +24 -0
  347. package/dist/hooks/tool-providers/use-disconnect-connection.d.ts.map +1 -0
  348. package/dist/hooks/tool-providers/use-existing-connections.d.ts +33 -0
  349. package/dist/hooks/tool-providers/use-existing-connections.d.ts.map +1 -0
  350. package/dist/hooks/tool-providers/use-provider-tools.d.ts +17 -0
  351. package/dist/hooks/tool-providers/use-provider-tools.d.ts.map +1 -0
  352. package/dist/hooks/tool-providers/use-tool-providers.d.ts +23 -0
  353. package/dist/hooks/tool-providers/use-tool-providers.d.ts.map +1 -0
  354. package/dist/hooks/tool-providers/use-toolkits.d.ts +13 -0
  355. package/dist/hooks/tool-providers/use-toolkits.d.ts.map +1 -0
  356. package/dist/hooks/tool-providers/use-update-connection.d.ts +24 -0
  357. package/dist/hooks/tool-providers/use-update-connection.d.ts.map +1 -0
  358. package/dist/hooks/tools/index.cjs +49 -0
  359. package/dist/hooks/tools/index.cjs.map +1 -0
  360. package/dist/hooks/tools/index.d.ts +3 -0
  361. package/dist/hooks/tools/index.d.ts.map +1 -0
  362. package/dist/hooks/tools/index.js +46 -0
  363. package/dist/hooks/tools/index.js.map +1 -0
  364. package/dist/hooks/tools/use-all-tools.d.ts +16 -0
  365. package/dist/hooks/tools/use-all-tools.d.ts.map +1 -0
  366. package/dist/hooks/tools/use-execute-tool.d.ts +13 -0
  367. package/dist/hooks/tools/use-execute-tool.d.ts.map +1 -0
  368. package/dist/hooks/traces/discovery-cache.d.ts +12 -0
  369. package/dist/hooks/traces/discovery-cache.d.ts.map +1 -0
  370. package/dist/hooks/traces/index.cjs +1168 -0
  371. package/dist/hooks/traces/index.cjs.map +1 -0
  372. package/dist/hooks/traces/index.d.ts +22 -0
  373. package/dist/hooks/traces/index.d.ts.map +1 -0
  374. package/dist/hooks/traces/index.js +1129 -0
  375. package/dist/hooks/traces/index.js.map +1 -0
  376. package/dist/hooks/traces/types.d.ts +20 -0
  377. package/dist/hooks/traces/types.d.ts.map +1 -0
  378. package/dist/hooks/traces/use-branch.d.ts +18 -0
  379. package/dist/hooks/traces/use-branch.d.ts.map +1 -0
  380. package/dist/hooks/traces/use-create-feedback.d.ts +21 -0
  381. package/dist/hooks/traces/use-create-feedback.d.ts.map +1 -0
  382. package/dist/hooks/traces/use-delete-feedback.d.ts +21 -0
  383. package/dist/hooks/traces/use-delete-feedback.d.ts.map +1 -0
  384. package/dist/hooks/traces/use-entity-names.d.ts +14 -0
  385. package/dist/hooks/traces/use-entity-names.d.ts.map +1 -0
  386. package/dist/hooks/traces/use-environments.d.ts +10 -0
  387. package/dist/hooks/traces/use-environments.d.ts.map +1 -0
  388. package/dist/hooks/traces/use-service-names.d.ts +10 -0
  389. package/dist/hooks/traces/use-service-names.d.ts.map +1 -0
  390. package/dist/hooks/traces/use-span-detail.d.ts +14 -0
  391. package/dist/hooks/traces/use-span-detail.d.ts.map +1 -0
  392. package/dist/hooks/traces/use-span-feedback.d.ts +19 -0
  393. package/dist/hooks/traces/use-span-feedback.d.ts.map +1 -0
  394. package/dist/hooks/traces/use-tags.d.ts +10 -0
  395. package/dist/hooks/traces/use-tags.d.ts.map +1 -0
  396. package/dist/hooks/traces/use-thread-has-other-traces.d.ts +17 -0
  397. package/dist/hooks/traces/use-thread-has-other-traces.d.ts.map +1 -0
  398. package/dist/hooks/traces/use-trace-column-preferences-storage-key.d.ts +6 -0
  399. package/dist/hooks/traces/use-trace-column-preferences-storage-key.d.ts.map +1 -0
  400. package/dist/hooks/traces/use-trace-feedback.d.ts +16 -0
  401. package/dist/hooks/traces/use-trace-feedback.d.ts.map +1 -0
  402. package/dist/hooks/traces/use-trace-light-spans.d.ts +16 -0
  403. package/dist/hooks/traces/use-trace-light-spans.d.ts.map +1 -0
  404. package/dist/hooks/traces/use-trace-metadata-filter-fields.d.ts +36 -0
  405. package/dist/hooks/traces/use-trace-metadata-filter-fields.d.ts.map +1 -0
  406. package/dist/hooks/traces/use-trace-or-branch-spans.d.ts +39 -0
  407. package/dist/hooks/traces/use-trace-or-branch-spans.d.ts.map +1 -0
  408. package/dist/hooks/traces/use-trace-query.d.ts +57 -0
  409. package/dist/hooks/traces/use-trace-query.d.ts.map +1 -0
  410. package/dist/hooks/traces/use-trace-spans.d.ts +46 -0
  411. package/dist/hooks/traces/use-trace-spans.d.ts.map +1 -0
  412. package/dist/hooks/traces/use-trace-usage.d.ts +10 -0
  413. package/dist/hooks/traces/use-trace-usage.d.ts.map +1 -0
  414. package/dist/hooks/traces/use-traces.d.ts +292 -0
  415. package/dist/hooks/traces/use-traces.d.ts.map +1 -0
  416. package/dist/hooks/vectors/index.cjs +19 -0
  417. package/dist/hooks/vectors/index.cjs.map +1 -0
  418. package/dist/hooks/vectors/index.d.ts +2 -0
  419. package/dist/hooks/vectors/index.d.ts.map +1 -0
  420. package/dist/hooks/vectors/index.js +18 -0
  421. package/dist/hooks/vectors/index.js.map +1 -0
  422. package/dist/hooks/vectors/use-vectors.d.ts +14 -0
  423. package/dist/hooks/vectors/use-vectors.d.ts.map +1 -0
  424. package/dist/hooks/voice/index.cjs +87 -0
  425. package/dist/hooks/voice/index.cjs.map +1 -0
  426. package/dist/hooks/voice/index.d.ts +2 -0
  427. package/dist/hooks/voice/index.d.ts.map +1 -0
  428. package/dist/hooks/voice/index.js +86 -0
  429. package/dist/hooks/voice/index.js.map +1 -0
  430. package/dist/hooks/voice/use-read-aloud.d.ts +20 -0
  431. package/dist/hooks/voice/use-read-aloud.d.ts.map +1 -0
  432. package/dist/hooks/workflows/index.cjs +173 -0
  433. package/dist/hooks/workflows/index.cjs.map +1 -0
  434. package/dist/hooks/workflows/index.d.ts +7 -0
  435. package/dist/hooks/workflows/index.d.ts.map +1 -0
  436. package/dist/hooks/workflows/index.js +157 -0
  437. package/dist/hooks/workflows/index.js.map +1 -0
  438. package/dist/hooks/workflows/use-workflow-runs.d.ts +51 -0
  439. package/dist/hooks/workflows/use-workflow-runs.d.ts.map +1 -0
  440. package/dist/hooks/workflows/use-workflow.d.ts +14 -0
  441. package/dist/hooks/workflows/use-workflow.d.ts.map +1 -0
  442. package/dist/hooks/workflows/use-workflows-run-counts.d.ts +25 -0
  443. package/dist/hooks/workflows/use-workflows-run-counts.d.ts.map +1 -0
  444. package/dist/hooks/workflows/use-workflows.d.ts +10 -0
  445. package/dist/hooks/workflows/use-workflows.d.ts.map +1 -0
  446. package/dist/hooks/workspace/client-utils.d.ts +5 -0
  447. package/dist/hooks/workspace/client-utils.d.ts.map +1 -0
  448. package/dist/hooks/workspace/compatibility.d.ts +22 -0
  449. package/dist/hooks/workspace/compatibility.d.ts.map +1 -0
  450. package/dist/hooks/workspace/file-type.d.ts +7 -0
  451. package/dist/hooks/workspace/file-type.d.ts.map +1 -0
  452. package/dist/hooks/workspace/index.cjs +624 -0
  453. package/dist/hooks/workspace/index.cjs.map +1 -0
  454. package/dist/hooks/workspace/index.d.ts +11 -0
  455. package/dist/hooks/workspace/index.d.ts.map +1 -0
  456. package/dist/hooks/workspace/index.js +594 -0
  457. package/dist/hooks/workspace/index.js.map +1 -0
  458. package/dist/hooks/workspace/types.d.ts +199 -0
  459. package/dist/hooks/workspace/types.d.ts.map +1 -0
  460. package/dist/hooks/workspace/use-skills-sh.d.ts +104 -0
  461. package/dist/hooks/workspace/use-skills-sh.d.ts.map +1 -0
  462. package/dist/hooks/workspace/use-stored-workspaces.d.ts +12 -0
  463. package/dist/hooks/workspace/use-stored-workspaces.d.ts.map +1 -0
  464. package/dist/hooks/workspace/use-workspace-directory.d.ts +13 -0
  465. package/dist/hooks/workspace/use-workspace-directory.d.ts.map +1 -0
  466. package/dist/hooks/workspace/use-workspace-file-content.d.ts +15 -0
  467. package/dist/hooks/workspace/use-workspace-file-content.d.ts.map +1 -0
  468. package/dist/hooks/workspace/use-workspace-search.d.ts +20 -0
  469. package/dist/hooks/workspace/use-workspace-search.d.ts.map +1 -0
  470. package/dist/hooks/workspace/use-workspace-skills.d.ts +23 -0
  471. package/dist/hooks/workspace/use-workspace-skills.d.ts.map +1 -0
  472. package/dist/hooks/workspace/use-workspace.d.ts +56 -0
  473. package/dist/hooks/workspace/use-workspace.d.ts.map +1 -0
  474. package/dist/hooks-BFQK_s4g.js +1231 -0
  475. package/dist/hooks-BFQK_s4g.js.map +1 -0
  476. package/dist/hooks-CMjizg6y.cjs +1248 -0
  477. package/dist/hooks-CMjizg6y.cjs.map +1 -0
  478. package/dist/hooks-CjULNHpJ.js +252 -0
  479. package/dist/hooks-CjULNHpJ.js.map +1 -0
  480. package/dist/hooks-DsDYaJ3T.cjs +269 -0
  481. package/dist/hooks-DsDYaJ3T.cjs.map +1 -0
  482. package/dist/index.cjs +21 -3434
  483. package/dist/index.cjs.map +1 -1
  484. package/dist/index.d.ts +1 -0
  485. package/dist/index.d.ts.map +1 -1
  486. package/dist/index.js +6 -3419
  487. package/dist/index.js.map +1 -1
  488. package/dist/lib/mastra-db/fromCoreUserMessage.d.ts +3 -4
  489. package/dist/lib/mastra-db/fromCoreUserMessage.d.ts.map +1 -1
  490. package/dist/map-CDv4fbu4.js +12 -0
  491. package/dist/map-CDv4fbu4.js.map +1 -0
  492. package/dist/map-wjmL1y5O.cjs +17 -0
  493. package/dist/map-wjmL1y5O.cjs.map +1 -0
  494. package/dist/mastra-client-context-Bx_g84YB.js +50 -0
  495. package/dist/mastra-client-context-Bx_g84YB.js.map +1 -0
  496. package/dist/mastra-client-context-DzX3f0RF.cjs +61 -0
  497. package/dist/mastra-client-context-DzX3f0RF.cjs.map +1 -0
  498. package/dist/query-utils-CcrChYgz.cjs +174 -0
  499. package/dist/query-utils-CcrChYgz.cjs.map +1 -0
  500. package/dist/query-utils-D1NgFnWU.js +127 -0
  501. package/dist/query-utils-D1NgFnWU.js.map +1 -0
  502. package/dist/use-in-view-B6eJO9Zi.cjs +37 -0
  503. package/dist/use-in-view-B6eJO9Zi.cjs.map +1 -0
  504. package/dist/use-in-view-C9sYPGRm.js +32 -0
  505. package/dist/use-in-view-C9sYPGRm.js.map +1 -0
  506. package/dist/voice-BOtUdMi8.cjs +281 -0
  507. package/dist/voice-BOtUdMi8.cjs.map +1 -0
  508. package/dist/voice-DgirjEyH.js +264 -0
  509. package/dist/voice-DgirjEyH.js.map +1 -0
  510. package/package.json +32 -3
@@ -0,0 +1,594 @@
1
+ import { n as useMastraClient } from "../../mastra-client-context-Bx_g84YB.js";
2
+ import { a as isNonRetryableError } from "../../query-utils-D1NgFnWU.js";
3
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
+ import { coreFeatures } from "@mastra/core/features";
5
+ //#region src/hooks/workspace/client-utils.ts
6
+ /**
7
+ * Checks if a method exists on an object and is callable.
8
+ */
9
+ function hasMethod(obj, method) {
10
+ return method in obj && typeof obj[method] === "function";
11
+ }
12
+ //#endregion
13
+ //#region src/hooks/workspace/compatibility.ts
14
+ /**
15
+ * Checks if workspace v1 features are supported by both core and client.
16
+ * This guards against version mismatches between playground-ui, core, and client-js.
17
+ */
18
+ const isWorkspaceV1Supported = (client) => {
19
+ const workspaceClientMethods = ["listWorkspaces", "getWorkspace"];
20
+ const coreSupported = coreFeatures.has("workspaces-v1");
21
+ const clientSupported = workspaceClientMethods.every((method) => hasMethod(client, method));
22
+ return coreSupported && clientSupported;
23
+ };
24
+ /**
25
+ * Gets the HTTP status code from an error if present.
26
+ * Supports MastraClientError, fetch Response, and other HTTP client error formats.
27
+ */
28
+ const getStatusCode = (error) => {
29
+ if (!error || typeof error !== "object") return void 0;
30
+ if ("status" in error && typeof error.status === "number") return error.status;
31
+ if ("statusCode" in error && typeof error.statusCode === "number") return error.statusCode;
32
+ };
33
+ /**
34
+ * Checks if an error has a specific HTTP status code.
35
+ * Supports MastraClientError, fetch Response, and other HTTP client error formats.
36
+ */
37
+ const hasStatusCode = (error, statusCode) => {
38
+ return getStatusCode(error) === statusCode;
39
+ };
40
+ /**
41
+ * Checks if an error is a 4xx client error (e.g., 400, 401, 403, 404).
42
+ * Client errors won't resolve with retries.
43
+ */
44
+ const isClientError = (error) => {
45
+ const status = getStatusCode(error);
46
+ return status !== void 0 && status >= 400 && status < 500;
47
+ };
48
+ /**
49
+ * Checks if an error is a "Not Implemented" (501) error from the server.
50
+ * This indicates the server's @mastra/core version doesn't support workspaces.
51
+ */
52
+ const isWorkspaceNotSupportedError = (error) => {
53
+ if (hasStatusCode(error, 501)) return true;
54
+ if (error && typeof error === "object" && "message" in error) {
55
+ const message = error.message;
56
+ return message.includes("Workspace v1 not supported") || message.includes("501");
57
+ }
58
+ return false;
59
+ };
60
+ /**
61
+ * React Query retry function that doesn't retry on client errors (4xx) or 501 errors.
62
+ * Use this to prevent infinite retries when resources don't exist, access is denied, or workspaces aren't supported.
63
+ */
64
+ const shouldRetryWorkspaceQuery = (failureCount, error) => {
65
+ if (isClientError(error)) return false;
66
+ if (isWorkspaceNotSupportedError(error)) return false;
67
+ if (isNonRetryableError(error)) return false;
68
+ return failureCount < 3;
69
+ };
70
+ //#endregion
71
+ //#region src/hooks/workspace/file-type.ts
72
+ const IMAGE_EXTENSIONS = [
73
+ "png",
74
+ "jpg",
75
+ "jpeg",
76
+ "gif",
77
+ "svg",
78
+ "webp",
79
+ "bmp",
80
+ "avif",
81
+ "tiff",
82
+ "tif"
83
+ ];
84
+ const VIDEO_MIME_TYPES = {
85
+ mp4: "video/mp4",
86
+ webm: "video/webm",
87
+ mov: "video/quicktime",
88
+ m4v: "video/mp4",
89
+ ogv: "video/ogg"
90
+ };
91
+ const extension = (path) => path.split("/").pop()?.split(".").pop()?.toLowerCase() ?? "";
92
+ const isImageFile = (path, mimeType) => mimeType?.startsWith("image/") || IMAGE_EXTENSIONS.includes(extension(path));
93
+ const isVideoFile = (path, mimeType) => mimeType?.startsWith("video/") || extension(path) in VIDEO_MIME_TYPES;
94
+ /** Media must be read as base64: reading it as utf-8 corrupts the bytes. */
95
+ const isMediaFile = (path) => isImageFile(path) || isVideoFile(path);
96
+ const videoMimeType = (path, mimeType) => mimeType?.startsWith("video/") ? mimeType : VIDEO_MIME_TYPES[extension(path)] ?? "video/mp4";
97
+ const isMarkdownFile = (path) => /\.mdx?$/i.test(path);
98
+ //#endregion
99
+ //#region src/hooks/workspace/use-skills-sh.ts
100
+ /**
101
+ * Search skills on skills.sh (via server proxy)
102
+ */
103
+ const useSearchSkillsSh = ({ workspaceId, queryOptions }) => {
104
+ const client = useMastraClient();
105
+ return useMutation({
106
+ mutationFn: (query) => {
107
+ if (!workspaceId) throw new Error("Workspace ID is required");
108
+ return client.getWorkspace(workspaceId).searchSkillsSh({
109
+ q: query,
110
+ limit: 10
111
+ });
112
+ },
113
+ ...queryOptions
114
+ });
115
+ };
116
+ /**
117
+ * Get popular skills from skills.sh (via server proxy, cached for 5 minutes)
118
+ *
119
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
120
+ */
121
+ const usePopularSkillsSh = ({ workspaceId, queryOptions }) => {
122
+ const client = useMastraClient();
123
+ return useQuery({
124
+ queryKey: [
125
+ "skills-sh",
126
+ "popular",
127
+ workspaceId
128
+ ],
129
+ queryFn: () => {
130
+ if (!workspaceId) throw new Error("Workspace ID is required");
131
+ return client.getWorkspace(workspaceId).listPopularSkillsSh({
132
+ limit: 10,
133
+ offset: 0
134
+ });
135
+ },
136
+ staleTime: 300 * 1e3,
137
+ ...queryOptions
138
+ });
139
+ };
140
+ /**
141
+ * Preview a skill by fetching its SKILL.md (via server proxy to avoid CORS)
142
+ *
143
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
144
+ */
145
+ const useSkillPreview = ({ workspaceId, owner, repo, skillPath, queryOptions }) => {
146
+ const client = useMastraClient();
147
+ return useQuery({
148
+ queryKey: [
149
+ "skills-sh",
150
+ "preview",
151
+ workspaceId,
152
+ owner,
153
+ repo,
154
+ skillPath
155
+ ],
156
+ queryFn: async () => {
157
+ if (!workspaceId || !owner || !repo || !skillPath) throw new Error("workspaceId, owner, repo, and skillPath are required");
158
+ const { content } = await client.getWorkspace(workspaceId).previewSkillsSh({
159
+ owner,
160
+ repo,
161
+ path: skillPath
162
+ });
163
+ return content;
164
+ },
165
+ retry: false,
166
+ ...queryOptions
167
+ });
168
+ };
169
+ /**
170
+ * Parse a skill's topSource field to extract GitHub repository info
171
+ *
172
+ * skills.sh topSource formats:
173
+ * - "owner/repo" (e.g., "vercel-labs/agent-skills")
174
+ * - "owner/repo/path" (e.g., "anthropics/skills/frontend-design")
175
+ * - "github.com/owner/repo/path" (full URL format)
176
+ *
177
+ * The skill name is used as the path within the repo when not specified
178
+ */
179
+ function parseSkillSource(topSource, skillName) {
180
+ let cleanSource = topSource.replace(/^https?:\/\//, "");
181
+ cleanSource = cleanSource.replace(/^github\.com\//, "");
182
+ cleanSource = cleanSource.replace(/\/$/, "");
183
+ const parts = cleanSource.split("/").filter(Boolean);
184
+ const [owner, repo] = parts;
185
+ if (!owner || !repo) return null;
186
+ let skillPath;
187
+ if (parts.length > 2) skillPath = parts.slice(2).join("/");
188
+ else if (skillName) skillPath = skillName;
189
+ else return null;
190
+ return {
191
+ owner,
192
+ repo,
193
+ skillPath
194
+ };
195
+ }
196
+ /**
197
+ * Install a skill by fetching from GitHub and writing to workspace filesystem.
198
+ */
199
+ const useInstallSkill = ({ queryOptions } = {}) => {
200
+ const client = useMastraClient();
201
+ const queryClient = useQueryClient();
202
+ return useMutation({
203
+ mutationFn: (params) => {
204
+ const [owner, repo] = params.repository.split("/");
205
+ if (!owner || !repo) throw new Error("Invalid repository format. Expected owner/repo");
206
+ return client.getWorkspace(params.workspaceId).installSkillsSh({
207
+ owner,
208
+ repo,
209
+ skillName: params.skillName,
210
+ mount: params.mount
211
+ });
212
+ },
213
+ onSuccess: (_, variables) => {
214
+ queryClient.invalidateQueries({ queryKey: [
215
+ "workspace",
216
+ "skills",
217
+ variables.workspaceId
218
+ ] });
219
+ },
220
+ ...queryOptions
221
+ });
222
+ };
223
+ /**
224
+ * Update installed skills by re-fetching from GitHub.
225
+ */
226
+ const useUpdateSkills = ({ queryOptions } = {}) => {
227
+ const client = useMastraClient();
228
+ const queryClient = useQueryClient();
229
+ return useMutation({
230
+ mutationFn: (params) => client.getWorkspace(params.workspaceId).updateSkillsSh({ skillName: params.skillName }),
231
+ onSuccess: (_, variables) => {
232
+ queryClient.invalidateQueries({ queryKey: [
233
+ "workspace",
234
+ "skills",
235
+ variables.workspaceId
236
+ ] });
237
+ },
238
+ ...queryOptions
239
+ });
240
+ };
241
+ /**
242
+ * Remove an installed skill by deleting its directory.
243
+ */
244
+ const useRemoveSkill = ({ queryOptions } = {}) => {
245
+ const client = useMastraClient();
246
+ const queryClient = useQueryClient();
247
+ return useMutation({
248
+ mutationFn: (params) => client.getWorkspace(params.workspaceId).removeSkillsSh({ skillName: params.skillName }),
249
+ onSuccess: (_, variables) => {
250
+ queryClient.invalidateQueries({ queryKey: [
251
+ "workspace",
252
+ "skills",
253
+ variables.workspaceId
254
+ ] });
255
+ },
256
+ ...queryOptions
257
+ });
258
+ };
259
+ //#endregion
260
+ //#region src/hooks/workspace/use-stored-workspaces.ts
261
+ /**
262
+ * Hook to list stored workspaces from the database.
263
+ * These are workspaces that have been persisted via the stored workspaces API,
264
+ * as opposed to runtime-registered workspaces from code-defined agents.
265
+ */
266
+ const useStoredWorkspaces = ({ queryOptions, ...params } = {}) => {
267
+ const client = useMastraClient();
268
+ return useQuery({
269
+ queryKey: ["stored-workspaces", params],
270
+ queryFn: async () => {
271
+ return client.listStoredWorkspaces(params);
272
+ },
273
+ ...queryOptions
274
+ });
275
+ };
276
+ //#endregion
277
+ //#region src/hooks/workspace/use-workspace.ts
278
+ function getParentPath(path) {
279
+ return path.split("/").slice(0, -1).join("/") || (path.startsWith("/") ? "/" : ".");
280
+ }
281
+ /**
282
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
283
+ */
284
+ const useWorkspaceInfo = ({ workspaceId, queryOptions } = {}) => {
285
+ const client = useMastraClient();
286
+ return useQuery({
287
+ queryKey: [
288
+ "workspace",
289
+ "info",
290
+ workspaceId
291
+ ],
292
+ queryFn: async () => {
293
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
294
+ if (!workspaceId) throw new Error("workspaceId is required");
295
+ return client.getWorkspace(workspaceId).info();
296
+ },
297
+ retry: shouldRetryWorkspaceQuery,
298
+ ...queryOptions,
299
+ enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
300
+ });
301
+ };
302
+ const useWorkspaces = ({ queryOptions } = {}) => {
303
+ const client = useMastraClient();
304
+ return useQuery({
305
+ queryKey: ["workspaces"],
306
+ queryFn: async () => {
307
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
308
+ return client.listWorkspaces();
309
+ },
310
+ retry: shouldRetryWorkspaceQuery,
311
+ ...queryOptions
312
+ });
313
+ };
314
+ /**
315
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
316
+ */
317
+ const useWorkspaceFileStat = ({ path, workspaceId, queryOptions }) => {
318
+ const client = useMastraClient();
319
+ return useQuery({
320
+ queryKey: [
321
+ "workspace",
322
+ "stat",
323
+ path,
324
+ workspaceId
325
+ ],
326
+ queryFn: async () => {
327
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
328
+ if (!workspaceId) throw new Error("workspaceId is required");
329
+ return client.getWorkspace(workspaceId).stat(path);
330
+ },
331
+ retry: shouldRetryWorkspaceQuery,
332
+ ...queryOptions,
333
+ enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
334
+ });
335
+ };
336
+ const useWriteWorkspaceFile = ({ queryOptions } = {}) => {
337
+ const client = useMastraClient();
338
+ const queryClient = useQueryClient();
339
+ return useMutation({
340
+ mutationFn: async (params) => {
341
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
342
+ return client.getWorkspace(params.workspaceId).writeFile(params.path, params.content, {
343
+ encoding: params.encoding,
344
+ recursive: params.recursive ?? true
345
+ });
346
+ },
347
+ onSuccess: (_, variables) => {
348
+ const parentPath = getParentPath(variables.path);
349
+ queryClient.invalidateQueries({ queryKey: [
350
+ "workspace",
351
+ "files",
352
+ parentPath
353
+ ] });
354
+ queryClient.invalidateQueries({ queryKey: [
355
+ "workspace",
356
+ "file",
357
+ variables.path
358
+ ] });
359
+ },
360
+ ...queryOptions
361
+ });
362
+ };
363
+ const useWriteWorkspaceFileFromFile = ({ queryOptions } = {}) => {
364
+ const client = useMastraClient();
365
+ const queryClient = useQueryClient();
366
+ return useMutation({
367
+ mutationFn: async (params) => {
368
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
369
+ const arrayBuffer = await params.file.arrayBuffer();
370
+ const base64 = btoa(new Uint8Array(arrayBuffer).reduce((data, byte) => data + String.fromCharCode(byte), ""));
371
+ return client.getWorkspace(params.workspaceId).writeFile(params.path, base64, {
372
+ encoding: "base64",
373
+ recursive: params.recursive ?? true
374
+ });
375
+ },
376
+ onSuccess: (_, variables) => {
377
+ const parentPath = getParentPath(variables.path);
378
+ queryClient.invalidateQueries({ queryKey: [
379
+ "workspace",
380
+ "files",
381
+ parentPath
382
+ ] });
383
+ queryClient.invalidateQueries({ queryKey: [
384
+ "workspace",
385
+ "file",
386
+ variables.path
387
+ ] });
388
+ },
389
+ ...queryOptions
390
+ });
391
+ };
392
+ const useDeleteWorkspaceFile = ({ queryOptions } = {}) => {
393
+ const client = useMastraClient();
394
+ const queryClient = useQueryClient();
395
+ return useMutation({
396
+ mutationFn: async (params) => {
397
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
398
+ return client.getWorkspace(params.workspaceId).delete(params.path, {
399
+ recursive: params.recursive,
400
+ force: params.force
401
+ });
402
+ },
403
+ onSuccess: (_, variables) => {
404
+ const parentPath = getParentPath(variables.path);
405
+ queryClient.invalidateQueries({ queryKey: [
406
+ "workspace",
407
+ "files",
408
+ parentPath
409
+ ] });
410
+ queryClient.invalidateQueries({ queryKey: [
411
+ "workspace",
412
+ "file",
413
+ variables.path
414
+ ] });
415
+ },
416
+ ...queryOptions
417
+ });
418
+ };
419
+ const useCreateWorkspaceDirectory = ({ queryOptions } = {}) => {
420
+ const client = useMastraClient();
421
+ const queryClient = useQueryClient();
422
+ return useMutation({
423
+ mutationFn: async (params) => {
424
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
425
+ return client.getWorkspace(params.workspaceId).mkdir(params.path, params.recursive);
426
+ },
427
+ onSuccess: (_, variables) => {
428
+ const parentPath = getParentPath(variables.path);
429
+ queryClient.invalidateQueries({ queryKey: [
430
+ "workspace",
431
+ "files",
432
+ parentPath
433
+ ] });
434
+ },
435
+ ...queryOptions
436
+ });
437
+ };
438
+ const useIndexWorkspaceContent = ({ queryOptions } = {}) => {
439
+ const client = useMastraClient();
440
+ return useMutation({
441
+ mutationFn: async (params) => {
442
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
443
+ return client.getWorkspace(params.workspaceId).index({
444
+ path: params.path,
445
+ content: params.content,
446
+ metadata: params.metadata
447
+ });
448
+ },
449
+ ...queryOptions
450
+ });
451
+ };
452
+ //#endregion
453
+ //#region src/hooks/workspace/use-workspace-directory.ts
454
+ const WORKSPACE_REFETCH_INTERVAL = 1e4;
455
+ function useWorkspaceDirectory({ workspaceId, path, queryOptions }) {
456
+ const client = useMastraClient();
457
+ return useQuery({
458
+ queryKey: [
459
+ "workspace",
460
+ workspaceId,
461
+ "fs",
462
+ "list",
463
+ path
464
+ ],
465
+ queryFn: async () => (await client.getWorkspace(workspaceId).listFiles(path, false)).entries,
466
+ refetchInterval: WORKSPACE_REFETCH_INTERVAL,
467
+ ...queryOptions
468
+ });
469
+ }
470
+ //#endregion
471
+ //#region src/hooks/workspace/use-workspace-file-content.ts
472
+ /**
473
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
474
+ */
475
+ function useWorkspaceFileContent({ workspaceId, path, queryOptions }) {
476
+ const client = useMastraClient();
477
+ const encoding = path && isMediaFile(path) ? "base64" : void 0;
478
+ return useQuery({
479
+ queryKey: [
480
+ "workspace",
481
+ workspaceId,
482
+ "fs",
483
+ "read",
484
+ path,
485
+ encoding
486
+ ],
487
+ queryFn: () => client.getWorkspace(workspaceId).readFile(path ?? "", encoding),
488
+ refetchInterval: WORKSPACE_REFETCH_INTERVAL,
489
+ ...queryOptions
490
+ });
491
+ }
492
+ //#endregion
493
+ //#region src/hooks/workspace/use-workspace-search.ts
494
+ const filePathFromId = (id) => id.replace(/#chunk-\d+$/, "");
495
+ const basename = (path) => path.split("/").filter(Boolean).pop() ?? path;
496
+ const skillFilePath = (result) => result.skillPath ? `${result.skillPath.replace(/\/$/, "")}/SKILL.md` : result.source;
497
+ /** Searches files and skills in parallel; one failing source (e.g. 501 not configured) keeps the other's hits. */
498
+ /**
499
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
500
+ */
501
+ function useWorkspaceSearch({ workspaceId, query, files: searchFiles = true, skills: searchSkills = true, queryOptions }) {
502
+ const client = useMastraClient();
503
+ const trimmed = query.trim();
504
+ return useQuery({
505
+ queryKey: [
506
+ "workspace",
507
+ workspaceId,
508
+ "search",
509
+ trimmed,
510
+ searchFiles,
511
+ searchSkills
512
+ ],
513
+ queryFn: async () => {
514
+ const workspace = client.getWorkspace(workspaceId);
515
+ const [files, skills] = await Promise.allSettled([searchFiles ? workspace.search({ query: trimmed }) : Promise.reject(/* @__PURE__ */ new Error("File search disabled")), searchSkills ? workspace.searchSkills({ query: trimmed }) : Promise.reject(/* @__PURE__ */ new Error("Skill search disabled"))]);
516
+ if (files.status === "rejected" && skills.status === "rejected") throw (searchFiles ? files : skills).reason;
517
+ const hits = /* @__PURE__ */ new Map();
518
+ const add = (hit) => {
519
+ const existing = hits.get(hit.path);
520
+ if (!existing || existing.score < hit.score) hits.set(hit.path, hit);
521
+ };
522
+ if (files.status === "fulfilled") for (const result of files.value.results) {
523
+ const path = filePathFromId(result.id);
524
+ add({
525
+ kind: "file",
526
+ path,
527
+ label: basename(path),
528
+ score: result.score
529
+ });
530
+ }
531
+ if (skills.status === "fulfilled") for (const result of skills.value.results) add({
532
+ kind: "skill",
533
+ path: skillFilePath(result),
534
+ label: result.skillName,
535
+ score: result.score
536
+ });
537
+ return [...hits.values()].sort((a, b) => b.score - a.score);
538
+ },
539
+ ...queryOptions
540
+ });
541
+ }
542
+ //#endregion
543
+ //#region src/hooks/workspace/use-workspace-skills.ts
544
+ /**
545
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
546
+ */
547
+ const useWorkspaceSkills = ({ workspaceId, queryOptions } = {}) => {
548
+ const client = useMastraClient();
549
+ return useQuery({
550
+ queryKey: [
551
+ "workspace",
552
+ "skills",
553
+ workspaceId
554
+ ],
555
+ queryFn: async () => {
556
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
557
+ if (!workspaceId) throw new Error("workspaceId is required");
558
+ return client.getWorkspace(workspaceId).listSkills();
559
+ },
560
+ retry: shouldRetryWorkspaceQuery,
561
+ ...queryOptions,
562
+ enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
563
+ });
564
+ };
565
+ /**
566
+ * Hook to get a specific skill from an agent's workspace
567
+ *
568
+ * Does not guard on empty ids; pass `queryOptions: { enabled }` to skip the fetch.
569
+ */
570
+ const useAgentSkill = ({ agentId, skillName, workspaceId, path, queryOptions }) => {
571
+ const client = useMastraClient();
572
+ return useQuery({
573
+ queryKey: [
574
+ "agents",
575
+ agentId,
576
+ "skills",
577
+ skillName,
578
+ path,
579
+ workspaceId
580
+ ],
581
+ queryFn: async () => {
582
+ if (!isWorkspaceV1Supported(client)) throw new Error("Workspace v1 not supported by core or client");
583
+ if (!workspaceId) throw new Error("workspaceId is required");
584
+ return client.getWorkspace(workspaceId).getSkill(skillName, path).details();
585
+ },
586
+ retry: shouldRetryWorkspaceQuery,
587
+ ...queryOptions,
588
+ enabled: isWorkspaceV1Supported(client) && (queryOptions?.enabled ?? true)
589
+ });
590
+ };
591
+ //#endregion
592
+ export { WORKSPACE_REFETCH_INTERVAL, isImageFile, isMarkdownFile, isMediaFile, isVideoFile, isWorkspaceNotSupportedError, isWorkspaceV1Supported, parseSkillSource, shouldRetryWorkspaceQuery, useAgentSkill, useCreateWorkspaceDirectory, useDeleteWorkspaceFile, useIndexWorkspaceContent, useInstallSkill, usePopularSkillsSh, useRemoveSkill, useSearchSkillsSh, useSkillPreview, useStoredWorkspaces, useUpdateSkills, useWorkspaceDirectory, useWorkspaceFileContent, useWorkspaceFileStat, useWorkspaceInfo, useWorkspaceSearch, useWorkspaceSkills, useWorkspaces, useWriteWorkspaceFile, useWriteWorkspaceFileFromFile, videoMimeType };
593
+
594
+ //# sourceMappingURL=index.js.map