@mastra/client-js 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE +201 -0
  3. package/README.md +291 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +908 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +876 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +47 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +113 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +97 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +121 -0
  87. package/index.d.ts +121 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +131 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +88 -0
  92. package/index.mjs.map +1 -0
  93. package/package.json +103 -0
  94. package/resource.d.ts +6 -0
  95. package/resource.d.ts.map +1 -0
  96. package/resource.js +11 -0
  97. package/resource.js.map +1 -0
  98. package/resource.mjs +7 -0
  99. package/resource.mjs.map +1 -0
  100. package/resources/agents/agents.d.ts +40 -0
  101. package/resources/agents/agents.d.ts.map +1 -0
  102. package/resources/agents/agents.js +74 -0
  103. package/resources/agents/agents.js.map +1 -0
  104. package/resources/agents/agents.mjs +47 -0
  105. package/resources/agents/agents.mjs.map +1 -0
  106. package/resources/agents/index.d.ts +3 -0
  107. package/resources/agents/index.d.ts.map +1 -0
  108. package/resources/agents/index.js +9 -0
  109. package/resources/agents/index.js.map +1 -0
  110. package/resources/agents/index.mjs +4 -0
  111. package/resources/agents/index.mjs.map +1 -0
  112. package/resources/agents/tools.d.ts +17 -0
  113. package/resources/agents/tools.d.ts.map +1 -0
  114. package/resources/agents/tools.js +19 -0
  115. package/resources/agents/tools.js.map +1 -0
  116. package/resources/agents/tools.mjs +15 -0
  117. package/resources/agents/tools.mjs.map +1 -0
  118. package/resources/index.d.ts +8 -0
  119. package/resources/index.d.ts.map +1 -0
  120. package/resources/index.js +19 -0
  121. package/resources/index.js.map +1 -0
  122. package/resources/index.mjs +9 -0
  123. package/resources/index.mjs.map +1 -0
  124. package/resources/logs.d.ts +13 -0
  125. package/resources/logs.d.ts.map +1 -0
  126. package/resources/logs.js +24 -0
  127. package/resources/logs.js.map +1 -0
  128. package/resources/logs.mjs +20 -0
  129. package/resources/logs.mjs.map +1 -0
  130. package/resources/memory/index.d.ts +4 -0
  131. package/resources/memory/index.d.ts.map +1 -0
  132. package/resources/memory/index.js +11 -0
  133. package/resources/memory/index.js.map +1 -0
  134. package/resources/memory/index.mjs +5 -0
  135. package/resources/memory/index.mjs.map +1 -0
  136. package/resources/memory/memory.d.ts +23 -0
  137. package/resources/memory/memory.d.ts.map +1 -0
  138. package/resources/memory/memory.js +53 -0
  139. package/resources/memory/memory.js.map +1 -0
  140. package/resources/memory/memory.mjs +26 -0
  141. package/resources/memory/memory.mjs.map +1 -0
  142. package/resources/memory/status.d.ts +9 -0
  143. package/resources/memory/status.d.ts.map +1 -0
  144. package/resources/memory/status.js +18 -0
  145. package/resources/memory/status.js.map +1 -0
  146. package/resources/memory/status.mjs +14 -0
  147. package/resources/memory/status.mjs.map +1 -0
  148. package/resources/memory/threads/index.d.ts +3 -0
  149. package/resources/memory/threads/index.d.ts.map +1 -0
  150. package/resources/memory/threads/index.js +9 -0
  151. package/resources/memory/threads/index.js.map +1 -0
  152. package/resources/memory/threads/index.mjs +4 -0
  153. package/resources/memory/threads/index.mjs.map +1 -0
  154. package/resources/memory/threads/messages.d.ts +9 -0
  155. package/resources/memory/threads/messages.d.ts.map +1 -0
  156. package/resources/memory/threads/messages.js +18 -0
  157. package/resources/memory/threads/messages.js.map +1 -0
  158. package/resources/memory/threads/messages.mjs +14 -0
  159. package/resources/memory/threads/messages.mjs.map +1 -0
  160. package/resources/memory/threads/threads.d.ts +45 -0
  161. package/resources/memory/threads/threads.d.ts.map +1 -0
  162. package/resources/memory/threads/threads.js +104 -0
  163. package/resources/memory/threads/threads.js.map +1 -0
  164. package/resources/memory/threads/threads.mjs +77 -0
  165. package/resources/memory/threads/threads.mjs.map +1 -0
  166. package/resources/syncs.d.ts +15 -0
  167. package/resources/syncs.d.ts.map +1 -0
  168. package/resources/syncs.js +19 -0
  169. package/resources/syncs.js.map +1 -0
  170. package/resources/syncs.mjs +15 -0
  171. package/resources/syncs.mjs.map +1 -0
  172. package/resources/system.d.ts +9 -0
  173. package/resources/system.d.ts.map +1 -0
  174. package/resources/system.js +15 -0
  175. package/resources/system.js.map +1 -0
  176. package/resources/system.mjs +11 -0
  177. package/resources/system.mjs.map +1 -0
  178. package/resources/tools/index.d.ts +3 -0
  179. package/resources/tools/index.d.ts.map +1 -0
  180. package/resources/tools/index.js +9 -0
  181. package/resources/tools/index.js.map +1 -0
  182. package/resources/tools/index.mjs +4 -0
  183. package/resources/tools/index.mjs.map +1 -0
  184. package/resources/tools/result.d.ts +9 -0
  185. package/resources/tools/result.d.ts.map +1 -0
  186. package/resources/tools/result.js +18 -0
  187. package/resources/tools/result.js.map +1 -0
  188. package/resources/tools/result.mjs +14 -0
  189. package/resources/tools/result.mjs.map +1 -0
  190. package/resources/tools/tools.d.ts +29 -0
  191. package/resources/tools/tools.d.ts.map +1 -0
  192. package/resources/tools/tools.js +64 -0
  193. package/resources/tools/tools.js.map +1 -0
  194. package/resources/tools/tools.mjs +37 -0
  195. package/resources/tools/tools.mjs.map +1 -0
  196. package/resources/workflows.d.ts +23 -0
  197. package/resources/workflows.d.ts.map +1 -0
  198. package/resources/workflows.js +37 -0
  199. package/resources/workflows.js.map +1 -0
  200. package/resources/workflows.mjs +33 -0
  201. package/resources/workflows.mjs.map +1 -0
  202. package/shims/node.d.ts +30 -0
  203. package/shims/node.d.ts.map +1 -0
  204. package/shims/node.js +31 -0
  205. package/shims/node.js.map +1 -0
  206. package/shims/node.mjs +5 -0
  207. package/shims/node.mjs.map +1 -0
  208. package/shims/web.d.ts +26 -0
  209. package/shims/web.d.ts.map +1 -0
  210. package/shims/web.js +31 -0
  211. package/shims/web.js.map +1 -0
  212. package/shims/web.mjs +5 -0
  213. package/shims/web.mjs.map +1 -0
  214. package/src/_shims/MultipartBody.ts +9 -0
  215. package/src/_shims/README.md +46 -0
  216. package/src/_shims/auto/runtime-bun.ts +4 -0
  217. package/src/_shims/auto/runtime-node.ts +4 -0
  218. package/src/_shims/auto/runtime.ts +4 -0
  219. package/src/_shims/auto/types-node.ts +4 -0
  220. package/src/_shims/auto/types.d.ts +101 -0
  221. package/src/_shims/auto/types.js +3 -0
  222. package/src/_shims/auto/types.mjs +3 -0
  223. package/src/_shims/bun-runtime.ts +14 -0
  224. package/src/_shims/index.d.ts +81 -0
  225. package/src/_shims/index.js +13 -0
  226. package/src/_shims/index.mjs +7 -0
  227. package/src/_shims/manual-types.d.ts +12 -0
  228. package/src/_shims/manual-types.js +3 -0
  229. package/src/_shims/manual-types.mjs +3 -0
  230. package/src/_shims/node-runtime.ts +81 -0
  231. package/src/_shims/node-types.d.ts +42 -0
  232. package/src/_shims/node-types.js +3 -0
  233. package/src/_shims/node-types.mjs +3 -0
  234. package/src/_shims/registry.ts +67 -0
  235. package/src/_shims/web-runtime.ts +103 -0
  236. package/src/_shims/web-types.d.ts +83 -0
  237. package/src/_shims/web-types.js +3 -0
  238. package/src/_shims/web-types.mjs +3 -0
  239. package/src/core.ts +1201 -0
  240. package/src/error.ts +130 -0
  241. package/src/index.ts +194 -0
  242. package/src/lib/.keep +4 -0
  243. package/src/resource.ts +11 -0
  244. package/src/resources/agents/agents.ts +77 -0
  245. package/src/resources/agents/index.ts +4 -0
  246. package/src/resources/agents/tools.ts +34 -0
  247. package/src/resources/index.ts +9 -0
  248. package/src/resources/logs.ts +23 -0
  249. package/src/resources/memory/index.ts +5 -0
  250. package/src/resources/memory/memory.ts +43 -0
  251. package/src/resources/memory/status.ts +16 -0
  252. package/src/resources/memory/threads/index.ts +4 -0
  253. package/src/resources/memory/threads/messages.ts +16 -0
  254. package/src/resources/memory/threads/threads.ts +105 -0
  255. package/src/resources/syncs.ts +25 -0
  256. package/src/resources/system.ts +13 -0
  257. package/src/resources/tools/index.ts +4 -0
  258. package/src/resources/tools/result.ts +16 -0
  259. package/src/resources/tools/tools.ts +54 -0
  260. package/src/resources/workflows.ts +49 -0
  261. package/src/shims/node.ts +50 -0
  262. package/src/shims/web.ts +50 -0
  263. package/src/tsconfig.json +11 -0
  264. package/src/uploads.ts +255 -0
  265. package/src/version.ts +1 -0
  266. package/uploads.d.ts +75 -0
  267. package/uploads.d.ts.map +1 -0
  268. package/uploads.js +171 -0
  269. package/uploads.js.map +1 -0
  270. package/uploads.mjs +158 -0
  271. package/uploads.mjs.map +1 -0
  272. package/version.d.ts +2 -0
  273. package/version.d.ts.map +1 -0
  274. package/version.js +5 -0
  275. package/version.js.map +1 -0
  276. package/version.mjs +2 -0
  277. package/version.mjs.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0-alpha.1 (2025-01-24)
4
+
5
+ Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/mastra-ai/client-js/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([377c39d](https://github.com/mastra-ai/client-js/commit/377c39db0ccbc5a3470cc3bb89c0f422c6006cdd))
10
+ * **api:** update via SDK Studio ([ea76249](https://github.com/mastra-ai/client-js/commit/ea76249925f0d8c050ab9c6395ae348a317a5249))
11
+ * **api:** update via SDK Studio ([#3](https://github.com/mastra-ai/client-js/issues/3)) ([2bffdc1](https://github.com/mastra-ai/client-js/commit/2bffdc11f7598e32fd4c1708c62a328767040879))
12
+ * **api:** update via SDK Studio ([#5](https://github.com/mastra-ai/client-js/issues/5)) ([23197c9](https://github.com/mastra-ai/client-js/commit/23197c9df2f49e17b225614ee1be46003683e6d9))
13
+ * **api:** update via SDK Studio ([#6](https://github.com/mastra-ai/client-js/issues/6)) ([bccd0b5](https://github.com/mastra-ai/client-js/commit/bccd0b53bdac6496aaabe143b24f9d1b2488ceff))
14
+ * **api:** update via SDK Studio ([#7](https://github.com/mastra-ai/client-js/issues/7)) ([ef9d08b](https://github.com/mastra-ai/client-js/commit/ef9d08b0905118589cc158059579170f0e8c78d6))
15
+
16
+
17
+ ### Chores
18
+
19
+ * go live ([#1](https://github.com/mastra-ai/client-js/issues/1)) ([344c629](https://github.com/mastra-ai/client-js/commit/344c629987c03d842f1b4389c1ab277d3351e859))
20
+ * go live ([#4](https://github.com/mastra-ai/client-js/issues/4)) ([fc11d38](https://github.com/mastra-ai/client-js/commit/fc11d38ef54611ffb23102912c3daf0c203e8490))
21
+ * update SDK settings ([c8936bb](https://github.com/mastra-ai/client-js/commit/c8936bba1b979cf858f0ebcb89ca181372993fc9))
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Mastra Client
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,291 @@
1
+ # Mastra Client Node API Library
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@mastra/client-js.svg)](https://npmjs.org/package/@mastra/client-js) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@mastra/client-js)
4
+
5
+ This library provides convenient access to the Mastra Client REST API from server-side TypeScript or JavaScript.
6
+
7
+ The REST API documentation can be found on [mastra.ai](https://mastra.ai/docs). The full API of this library can be found in [api.md](api.md).
8
+
9
+ It is generated with [Stainless](https://www.stainlessapi.com/).
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ npm install @mastra/client-js
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ The full API of this library can be found in [api.md](api.md).
20
+
21
+ <!-- prettier-ignore -->
22
+ ```js
23
+ import MastraClient from '@mastra/client-js';
24
+
25
+ const client = new MastraClient();
26
+
27
+ async function main() {
28
+ await client.agents.list();
29
+ }
30
+
31
+ main();
32
+ ```
33
+
34
+ ### Request & Response types
35
+
36
+ This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
37
+
38
+ <!-- prettier-ignore -->
39
+ ```ts
40
+ import MastraClient from '@mastra/client-js';
41
+
42
+ const client = new MastraClient();
43
+
44
+ async function main() {
45
+ await client.agents.list();
46
+ }
47
+
48
+ main();
49
+ ```
50
+
51
+ Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
52
+
53
+ ## Handling errors
54
+
55
+ When the library is unable to connect to the API,
56
+ or if the API returns a non-success status code (i.e., 4xx or 5xx response),
57
+ a subclass of `APIError` will be thrown:
58
+
59
+ <!-- prettier-ignore -->
60
+ ```ts
61
+ async function main() {
62
+ const response = await client.agents.list().catch(async (err) => {
63
+ if (err instanceof MastraClient.APIError) {
64
+ console.log(err.status); // 400
65
+ console.log(err.name); // BadRequestError
66
+ console.log(err.headers); // {server: 'nginx', ...}
67
+ } else {
68
+ throw err;
69
+ }
70
+ });
71
+ }
72
+
73
+ main();
74
+ ```
75
+
76
+ Error codes are as followed:
77
+
78
+ | Status Code | Error Type |
79
+ | ----------- | -------------------------- |
80
+ | 400 | `BadRequestError` |
81
+ | 401 | `AuthenticationError` |
82
+ | 403 | `PermissionDeniedError` |
83
+ | 404 | `NotFoundError` |
84
+ | 422 | `UnprocessableEntityError` |
85
+ | 429 | `RateLimitError` |
86
+ | >=500 | `InternalServerError` |
87
+ | N/A | `APIConnectionError` |
88
+
89
+ ### Retries
90
+
91
+ Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
92
+ Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
93
+ 429 Rate Limit, and >=500 Internal errors will all be retried by default.
94
+
95
+ You can use the `maxRetries` option to configure or disable this:
96
+
97
+ <!-- prettier-ignore -->
98
+ ```js
99
+ // Configure the default for all requests:
100
+ const client = new MastraClient({
101
+ maxRetries: 0, // default is 2
102
+ });
103
+
104
+ // Or, configure per-request:
105
+ await client.agents.list({
106
+ maxRetries: 5,
107
+ });
108
+ ```
109
+
110
+ ### Timeouts
111
+
112
+ Requests time out after 1 minute by default. You can configure this with a `timeout` option:
113
+
114
+ <!-- prettier-ignore -->
115
+ ```ts
116
+ // Configure the default for all requests:
117
+ const client = new MastraClient({
118
+ timeout: 20 * 1000, // 20 seconds (default is 1 minute)
119
+ });
120
+
121
+ // Override per-request:
122
+ await client.agents.list({
123
+ timeout: 5 * 1000,
124
+ });
125
+ ```
126
+
127
+ On timeout, an `APIConnectionTimeoutError` is thrown.
128
+
129
+ Note that requests which time out will be [retried twice by default](#retries).
130
+
131
+ ## Advanced Usage
132
+
133
+ ### Accessing raw Response data (e.g., headers)
134
+
135
+ The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
136
+
137
+ You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
138
+
139
+ <!-- prettier-ignore -->
140
+ ```ts
141
+ const client = new MastraClient();
142
+
143
+ const response = await client.agents.list().asResponse();
144
+ console.log(response.headers.get('X-My-Header'));
145
+ console.log(response.statusText); // access the underlying Response object
146
+
147
+ const { data: result, response: raw } = await client.agents.list().withResponse();
148
+ console.log(raw.headers.get('X-My-Header'));
149
+ console.log(result);
150
+ ```
151
+
152
+ ### Making custom/undocumented requests
153
+
154
+ This library is typed for convenient access to the documented API. If you need to access undocumented
155
+ endpoints, params, or response properties, the library can still be used.
156
+
157
+ #### Undocumented endpoints
158
+
159
+ To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
160
+ Options on the client, such as retries, will be respected when making these requests.
161
+
162
+ ```ts
163
+ await client.post('/some/path', {
164
+ body: { some_prop: 'foo' },
165
+ query: { some_query_arg: 'bar' },
166
+ });
167
+ ```
168
+
169
+ #### Undocumented request params
170
+
171
+ To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
172
+ parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
173
+ send will be sent as-is.
174
+
175
+ ```ts
176
+ client.foo.create({
177
+ foo: 'my_param',
178
+ bar: 12,
179
+ // @ts-expect-error baz is not yet public
180
+ baz: 'undocumented option',
181
+ });
182
+ ```
183
+
184
+ For requests with the `GET` verb, any extra params will be in the query, all other requests will send the
185
+ extra param in the body.
186
+
187
+ If you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request
188
+ options.
189
+
190
+ #### Undocumented response properties
191
+
192
+ To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
193
+ the response object, or cast the response object to the requisite type. Like the request params, we do not
194
+ validate or strip extra properties from the response from the API.
195
+
196
+ ### Customizing the fetch client
197
+
198
+ By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments.
199
+
200
+ If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment,
201
+ (for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`),
202
+ add the following import before your first import `from "MastraClient"`:
203
+
204
+ ```ts
205
+ // Tell TypeScript and the package to use the global web fetch instead of node-fetch.
206
+ // Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
207
+ import '@mastra/client-js/shims/web';
208
+ import MastraClient from '@mastra/client-js';
209
+ ```
210
+
211
+ To do the inverse, add `import "@mastra/client-js/shims/node"` (which does import polyfills).
212
+ This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/mastra-ai/client-js/tree/main/src/_shims#readme)).
213
+
214
+ ### Logging and middleware
215
+
216
+ You may also provide a custom `fetch` function when instantiating the client,
217
+ which can be used to inspect or alter the `Request` or `Response` before/after each request:
218
+
219
+ ```ts
220
+ import { fetch } from 'undici'; // as one example
221
+ import MastraClient from '@mastra/client-js';
222
+
223
+ const client = new MastraClient({
224
+ fetch: async (url: RequestInfo, init?: RequestInit): Promise<Response> => {
225
+ console.log('About to make a request', url, init);
226
+ const response = await fetch(url, init);
227
+ console.log('Got response', response);
228
+ return response;
229
+ },
230
+ });
231
+ ```
232
+
233
+ Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically.
234
+ This is intended for debugging purposes only and may change in the future without notice.
235
+
236
+ ### Configuring an HTTP(S) Agent (e.g., for proxies)
237
+
238
+ By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests.
239
+
240
+ If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example:
241
+
242
+ <!-- prettier-ignore -->
243
+ ```ts
244
+ import http from 'http';
245
+ import { HttpsProxyAgent } from 'https-proxy-agent';
246
+
247
+ // Configure the default for all requests:
248
+ const client = new MastraClient({
249
+ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL),
250
+ });
251
+
252
+ // Override per-request:
253
+ await client.agents.list({
254
+ httpAgent: new http.Agent({ keepAlive: false }),
255
+ });
256
+ ```
257
+
258
+ ## Semantic versioning
259
+
260
+ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
261
+
262
+ 1. Changes that only affect static types, without breaking runtime behavior.
263
+ 2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
264
+ 3. Changes that we do not expect to impact the vast majority of users in practice.
265
+
266
+ We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
267
+
268
+ We are keen for your feedback; please open an [issue](https://www.github.com/mastra-ai/client-js/issues) with questions, bugs, or suggestions.
269
+
270
+ ## Requirements
271
+
272
+ TypeScript >= 4.5 is supported.
273
+
274
+ The following runtimes are supported:
275
+
276
+ - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)
277
+ - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.
278
+ - Deno v1.28.0 or higher.
279
+ - Bun 1.0 or later.
280
+ - Cloudflare Workers.
281
+ - Vercel Edge Runtime.
282
+ - Jest 28 or greater with the `"node"` environment (`"jsdom"` is not supported at this time).
283
+ - Nitro v2.6 or greater.
284
+
285
+ Note that React Native is not supported at this time.
286
+
287
+ If you are interested in other runtime environments, please open or upvote an issue on GitHub.
288
+
289
+ ## Contributing
290
+
291
+ See [the contributing documentation](./CONTRIBUTING.md).
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export declare class MultipartBody {
5
+ body: any;
6
+ constructor(body: any);
7
+ get [Symbol.toStringTag](): string;
8
+ }
9
+ //# sourceMappingURL=MultipartBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.d.ts","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAa;IACL,IAAI,EAAE,GAAG;gBAAT,IAAI,EAAE,GAAG;IAC5B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;CACF"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultipartBody = void 0;
4
+ /**
5
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
6
+ */
7
+ class MultipartBody {
8
+ constructor(body) {
9
+ this.body = body;
10
+ }
11
+ get [Symbol.toStringTag]() {
12
+ return 'MultipartBody';
13
+ }
14
+ }
15
+ exports.MultipartBody = MultipartBody;
16
+ //# sourceMappingURL=MultipartBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.js","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AALD,sCAKC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export class MultipartBody {
5
+ constructor(body) {
6
+ this.body = body;
7
+ }
8
+ get [Symbol.toStringTag]() {
9
+ return 'MultipartBody';
10
+ }
11
+ }
12
+ //# sourceMappingURL=MultipartBody.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipartBody.mjs","sourceRoot":"","sources":["../src/_shims/MultipartBody.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,aAAa;IACxB,YAAmB,IAAS;QAAT,SAAI,GAAJ,IAAI,CAAK;IAAG,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,46 @@
1
+ # 👋 Wondering what everything in here does?
2
+
3
+ `@mastra/client-js` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
4
+ edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
5
+
6
+ To do this, `@mastra/client-js` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
7
+
8
+ It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
9
+ automatically select the correct shims for each environment. However, conditional exports are a fairly new
10
+ feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"`
11
+
12
+ setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does.
13
+ Unfortunately that's still the default setting, and it can result in errors like
14
+ getting the wrong raw `Response` type from `.asResponse()`, for example.
15
+
16
+ The user can work around these issues by manually importing one of:
17
+
18
+ - `import '@mastra/client-js/shims/node'`
19
+ - `import '@mastra/client-js/shims/web'`
20
+
21
+ All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
22
+
23
+ ### How it works - Runtime
24
+
25
+ Runtime shims get installed by calling `setShims` exported by `@mastra/client-js/_shims/registry`.
26
+
27
+ Manually importing `@mastra/client-js/shims/node` or `@mastra/client-js/shims/web`, calls `setShims` with the respective runtime shims.
28
+
29
+ All client code imports shims from `@mastra/client-js/_shims/index`, which:
30
+
31
+ - checks if shims have been set manually
32
+ - if not, calls `setShims` with the shims from `@mastra/client-js/_shims/auto/runtime`
33
+ - re-exports the installed shims from `@mastra/client-js/_shims/registry`.
34
+
35
+ `@mastra/client-js/_shims/auto/runtime` exports web runtime shims.
36
+ If the `node` export condition is set, the export map replaces it with `@mastra/client-js/_shims/auto/runtime-node`.
37
+
38
+ ### How it works - Type time
39
+
40
+ All client code imports shim types from `@mastra/client-js/_shims/index`, which selects the manual types from `@mastra/client-js/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `@mastra/client-js/_shims/auto/types`.
41
+
42
+ `@mastra/client-js/_shims/manual-types` exports an empty namespace.
43
+ Manually importing `@mastra/client-js/shims/node` or `@mastra/client-js/shims/web` merges declarations into this empty namespace, so they get picked up by `@mastra/client-js/_shims/index`.
44
+
45
+ `@mastra/client-js/_shims/auto/types` exports web type definitions.
46
+ If the `node` export condition is set, the export map replaces it with `@mastra/client-js/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../bun-runtime.js";
5
+ //# sourceMappingURL=runtime-bun.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
19
+ */
20
+ __exportStar(require("../bun-runtime.js"), exports);
21
+ //# sourceMappingURL=runtime-bun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.js","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,oDAA+B"}
@@ -0,0 +1,2 @@
1
+ export * from "../bun-runtime.mjs";
2
+ //# sourceMappingURL=runtime-bun.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-bun.mjs","sourceRoot":"","sources":["../../src/_shims/auto/runtime-bun.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Disclaimer: modules in _shims aren't intended to be imported by SDK users.
3
+ */
4
+ export * from "../node-runtime.js";
5
+ //# sourceMappingURL=runtime-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-node.d.ts","sourceRoot":"","sources":["../../src/_shims/auto/runtime-node.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,iBAAiB,CAAC"}