@mastra/client-js 0.1.0-alpha.2 → 0.1.0-alpha.3

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 (292) hide show
  1. package/.eslintrc.js +10 -0
  2. package/.prettierignore +3 -0
  3. package/.prettierrc.json +26 -0
  4. package/LICENSE +44 -201
  5. package/README.md +90 -271
  6. package/dist/index.d.mts +346 -0
  7. package/dist/index.mjs +399 -0
  8. package/package.json +28 -95
  9. package/src/client.ts +201 -0
  10. package/src/index.test.ts +507 -0
  11. package/src/index.ts +2 -200
  12. package/src/resources/agent.ts +94 -0
  13. package/src/resources/index.ts +5 -14
  14. package/src/resources/memory-thread.ts +51 -0
  15. package/src/resources/tool.ts +28 -0
  16. package/src/resources/vector.ts +79 -0
  17. package/src/resources/workflow.ts +28 -0
  18. package/src/types.ts +121 -0
  19. package/tsconfig.json +29 -0
  20. package/vitest.config.js +8 -0
  21. package/CHANGELOG.md +0 -29
  22. package/_shims/MultipartBody.d.ts +0 -9
  23. package/_shims/MultipartBody.d.ts.map +0 -1
  24. package/_shims/MultipartBody.js +0 -16
  25. package/_shims/MultipartBody.js.map +0 -1
  26. package/_shims/MultipartBody.mjs +0 -12
  27. package/_shims/MultipartBody.mjs.map +0 -1
  28. package/_shims/README.md +0 -46
  29. package/_shims/auto/runtime-bun.d.ts +0 -5
  30. package/_shims/auto/runtime-bun.d.ts.map +0 -1
  31. package/_shims/auto/runtime-bun.js +0 -21
  32. package/_shims/auto/runtime-bun.js.map +0 -1
  33. package/_shims/auto/runtime-bun.mjs +0 -2
  34. package/_shims/auto/runtime-bun.mjs.map +0 -1
  35. package/_shims/auto/runtime-node.d.ts +0 -5
  36. package/_shims/auto/runtime-node.d.ts.map +0 -1
  37. package/_shims/auto/runtime-node.js +0 -21
  38. package/_shims/auto/runtime-node.js.map +0 -1
  39. package/_shims/auto/runtime-node.mjs +0 -2
  40. package/_shims/auto/runtime-node.mjs.map +0 -1
  41. package/_shims/auto/runtime.d.ts +0 -5
  42. package/_shims/auto/runtime.d.ts.map +0 -1
  43. package/_shims/auto/runtime.js +0 -21
  44. package/_shims/auto/runtime.js.map +0 -1
  45. package/_shims/auto/runtime.mjs +0 -2
  46. package/_shims/auto/runtime.mjs.map +0 -1
  47. package/_shims/auto/types-node.d.ts +0 -5
  48. package/_shims/auto/types-node.d.ts.map +0 -1
  49. package/_shims/auto/types-node.js +0 -21
  50. package/_shims/auto/types-node.js.map +0 -1
  51. package/_shims/auto/types-node.mjs +0 -2
  52. package/_shims/auto/types-node.mjs.map +0 -1
  53. package/_shims/auto/types.d.ts +0 -101
  54. package/_shims/auto/types.js +0 -3
  55. package/_shims/auto/types.mjs +0 -3
  56. package/_shims/bun-runtime.d.ts +0 -6
  57. package/_shims/bun-runtime.d.ts.map +0 -1
  58. package/_shims/bun-runtime.js +0 -14
  59. package/_shims/bun-runtime.js.map +0 -1
  60. package/_shims/bun-runtime.mjs +0 -10
  61. package/_shims/bun-runtime.mjs.map +0 -1
  62. package/_shims/index.d.ts +0 -81
  63. package/_shims/index.js +0 -13
  64. package/_shims/index.mjs +0 -7
  65. package/_shims/manual-types.d.ts +0 -12
  66. package/_shims/manual-types.js +0 -3
  67. package/_shims/manual-types.mjs +0 -3
  68. package/_shims/node-runtime.d.ts +0 -3
  69. package/_shims/node-runtime.d.ts.map +0 -1
  70. package/_shims/node-runtime.js +0 -89
  71. package/_shims/node-runtime.js.map +0 -1
  72. package/_shims/node-runtime.mjs +0 -56
  73. package/_shims/node-runtime.mjs.map +0 -1
  74. package/_shims/node-types.d.ts +0 -42
  75. package/_shims/node-types.js +0 -3
  76. package/_shims/node-types.mjs +0 -3
  77. package/_shims/registry.d.ts +0 -37
  78. package/_shims/registry.d.ts.map +0 -1
  79. package/_shims/registry.js +0 -41
  80. package/_shims/registry.js.map +0 -1
  81. package/_shims/registry.mjs +0 -37
  82. package/_shims/registry.mjs.map +0 -1
  83. package/_shims/web-runtime.d.ts +0 -5
  84. package/_shims/web-runtime.d.ts.map +0 -1
  85. package/_shims/web-runtime.js +0 -78
  86. package/_shims/web-runtime.js.map +0 -1
  87. package/_shims/web-runtime.mjs +0 -71
  88. package/_shims/web-runtime.mjs.map +0 -1
  89. package/_shims/web-types.d.ts +0 -83
  90. package/_shims/web-types.js +0 -3
  91. package/_shims/web-types.mjs +0 -3
  92. package/core.d.ts +0 -241
  93. package/core.d.ts.map +0 -1
  94. package/core.js +0 -908
  95. package/core.js.map +0 -1
  96. package/core.mjs +0 -876
  97. package/core.mjs.map +0 -1
  98. package/error.d.ts +0 -47
  99. package/error.d.ts.map +0 -1
  100. package/error.js +0 -113
  101. package/error.js.map +0 -1
  102. package/error.mjs +0 -97
  103. package/error.mjs.map +0 -1
  104. package/index.d.mts +0 -121
  105. package/index.d.ts +0 -121
  106. package/index.d.ts.map +0 -1
  107. package/index.js +0 -131
  108. package/index.js.map +0 -1
  109. package/index.mjs +0 -88
  110. package/index.mjs.map +0 -1
  111. package/resource.d.ts +0 -6
  112. package/resource.d.ts.map +0 -1
  113. package/resource.js +0 -11
  114. package/resource.js.map +0 -1
  115. package/resource.mjs +0 -7
  116. package/resource.mjs.map +0 -1
  117. package/resources/agents/agents.d.ts +0 -41
  118. package/resources/agents/agents.d.ts.map +0 -1
  119. package/resources/agents/agents.js +0 -74
  120. package/resources/agents/agents.js.map +0 -1
  121. package/resources/agents/agents.mjs +0 -47
  122. package/resources/agents/agents.mjs.map +0 -1
  123. package/resources/agents/index.d.ts +0 -3
  124. package/resources/agents/index.d.ts.map +0 -1
  125. package/resources/agents/index.js +0 -9
  126. package/resources/agents/index.js.map +0 -1
  127. package/resources/agents/index.mjs +0 -4
  128. package/resources/agents/index.mjs.map +0 -1
  129. package/resources/agents/tools.d.ts +0 -17
  130. package/resources/agents/tools.d.ts.map +0 -1
  131. package/resources/agents/tools.js +0 -19
  132. package/resources/agents/tools.js.map +0 -1
  133. package/resources/agents/tools.mjs +0 -15
  134. package/resources/agents/tools.mjs.map +0 -1
  135. package/resources/index.d.ts +0 -8
  136. package/resources/index.d.ts.map +0 -1
  137. package/resources/index.js +0 -19
  138. package/resources/index.js.map +0 -1
  139. package/resources/index.mjs +0 -9
  140. package/resources/index.mjs.map +0 -1
  141. package/resources/logs.d.ts +0 -13
  142. package/resources/logs.d.ts.map +0 -1
  143. package/resources/logs.js +0 -24
  144. package/resources/logs.js.map +0 -1
  145. package/resources/logs.mjs +0 -20
  146. package/resources/logs.mjs.map +0 -1
  147. package/resources/memory/index.d.ts +0 -4
  148. package/resources/memory/index.d.ts.map +0 -1
  149. package/resources/memory/index.js +0 -11
  150. package/resources/memory/index.js.map +0 -1
  151. package/resources/memory/index.mjs +0 -5
  152. package/resources/memory/index.mjs.map +0 -1
  153. package/resources/memory/memory.d.ts +0 -23
  154. package/resources/memory/memory.d.ts.map +0 -1
  155. package/resources/memory/memory.js +0 -53
  156. package/resources/memory/memory.js.map +0 -1
  157. package/resources/memory/memory.mjs +0 -26
  158. package/resources/memory/memory.mjs.map +0 -1
  159. package/resources/memory/status.d.ts +0 -9
  160. package/resources/memory/status.d.ts.map +0 -1
  161. package/resources/memory/status.js +0 -18
  162. package/resources/memory/status.js.map +0 -1
  163. package/resources/memory/status.mjs +0 -14
  164. package/resources/memory/status.mjs.map +0 -1
  165. package/resources/memory/threads/index.d.ts +0 -3
  166. package/resources/memory/threads/index.d.ts.map +0 -1
  167. package/resources/memory/threads/index.js +0 -9
  168. package/resources/memory/threads/index.js.map +0 -1
  169. package/resources/memory/threads/index.mjs +0 -4
  170. package/resources/memory/threads/index.mjs.map +0 -1
  171. package/resources/memory/threads/messages.d.ts +0 -9
  172. package/resources/memory/threads/messages.d.ts.map +0 -1
  173. package/resources/memory/threads/messages.js +0 -18
  174. package/resources/memory/threads/messages.js.map +0 -1
  175. package/resources/memory/threads/messages.mjs +0 -14
  176. package/resources/memory/threads/messages.mjs.map +0 -1
  177. package/resources/memory/threads/threads.d.ts +0 -45
  178. package/resources/memory/threads/threads.d.ts.map +0 -1
  179. package/resources/memory/threads/threads.js +0 -104
  180. package/resources/memory/threads/threads.js.map +0 -1
  181. package/resources/memory/threads/threads.mjs +0 -77
  182. package/resources/memory/threads/threads.mjs.map +0 -1
  183. package/resources/syncs.d.ts +0 -15
  184. package/resources/syncs.d.ts.map +0 -1
  185. package/resources/syncs.js +0 -19
  186. package/resources/syncs.js.map +0 -1
  187. package/resources/syncs.mjs +0 -15
  188. package/resources/syncs.mjs.map +0 -1
  189. package/resources/system.d.ts +0 -9
  190. package/resources/system.d.ts.map +0 -1
  191. package/resources/system.js +0 -15
  192. package/resources/system.js.map +0 -1
  193. package/resources/system.mjs +0 -11
  194. package/resources/system.mjs.map +0 -1
  195. package/resources/tools/index.d.ts +0 -3
  196. package/resources/tools/index.d.ts.map +0 -1
  197. package/resources/tools/index.js +0 -9
  198. package/resources/tools/index.js.map +0 -1
  199. package/resources/tools/index.mjs +0 -4
  200. package/resources/tools/index.mjs.map +0 -1
  201. package/resources/tools/result.d.ts +0 -9
  202. package/resources/tools/result.d.ts.map +0 -1
  203. package/resources/tools/result.js +0 -18
  204. package/resources/tools/result.js.map +0 -1
  205. package/resources/tools/result.mjs +0 -14
  206. package/resources/tools/result.mjs.map +0 -1
  207. package/resources/tools/tools.d.ts +0 -29
  208. package/resources/tools/tools.d.ts.map +0 -1
  209. package/resources/tools/tools.js +0 -64
  210. package/resources/tools/tools.js.map +0 -1
  211. package/resources/tools/tools.mjs +0 -37
  212. package/resources/tools/tools.mjs.map +0 -1
  213. package/resources/workflows.d.ts +0 -23
  214. package/resources/workflows.d.ts.map +0 -1
  215. package/resources/workflows.js +0 -37
  216. package/resources/workflows.js.map +0 -1
  217. package/resources/workflows.mjs +0 -33
  218. package/resources/workflows.mjs.map +0 -1
  219. package/shims/node.d.ts +0 -30
  220. package/shims/node.d.ts.map +0 -1
  221. package/shims/node.js +0 -31
  222. package/shims/node.js.map +0 -1
  223. package/shims/node.mjs +0 -5
  224. package/shims/node.mjs.map +0 -1
  225. package/shims/web.d.ts +0 -26
  226. package/shims/web.d.ts.map +0 -1
  227. package/shims/web.js +0 -31
  228. package/shims/web.js.map +0 -1
  229. package/shims/web.mjs +0 -5
  230. package/shims/web.mjs.map +0 -1
  231. package/src/_shims/MultipartBody.ts +0 -9
  232. package/src/_shims/README.md +0 -46
  233. package/src/_shims/auto/runtime-bun.ts +0 -4
  234. package/src/_shims/auto/runtime-node.ts +0 -4
  235. package/src/_shims/auto/runtime.ts +0 -4
  236. package/src/_shims/auto/types-node.ts +0 -4
  237. package/src/_shims/auto/types.d.ts +0 -101
  238. package/src/_shims/auto/types.js +0 -3
  239. package/src/_shims/auto/types.mjs +0 -3
  240. package/src/_shims/bun-runtime.ts +0 -14
  241. package/src/_shims/index.d.ts +0 -81
  242. package/src/_shims/index.js +0 -13
  243. package/src/_shims/index.mjs +0 -7
  244. package/src/_shims/manual-types.d.ts +0 -12
  245. package/src/_shims/manual-types.js +0 -3
  246. package/src/_shims/manual-types.mjs +0 -3
  247. package/src/_shims/node-runtime.ts +0 -81
  248. package/src/_shims/node-types.d.ts +0 -42
  249. package/src/_shims/node-types.js +0 -3
  250. package/src/_shims/node-types.mjs +0 -3
  251. package/src/_shims/registry.ts +0 -67
  252. package/src/_shims/web-runtime.ts +0 -103
  253. package/src/_shims/web-types.d.ts +0 -83
  254. package/src/_shims/web-types.js +0 -3
  255. package/src/_shims/web-types.mjs +0 -3
  256. package/src/core.ts +0 -1201
  257. package/src/error.ts +0 -130
  258. package/src/lib/.keep +0 -4
  259. package/src/resource.ts +0 -11
  260. package/src/resources/agents/agents.ts +0 -83
  261. package/src/resources/agents/index.ts +0 -4
  262. package/src/resources/agents/tools.ts +0 -34
  263. package/src/resources/logs.ts +0 -23
  264. package/src/resources/memory/index.ts +0 -5
  265. package/src/resources/memory/memory.ts +0 -43
  266. package/src/resources/memory/status.ts +0 -16
  267. package/src/resources/memory/threads/index.ts +0 -4
  268. package/src/resources/memory/threads/messages.ts +0 -16
  269. package/src/resources/memory/threads/threads.ts +0 -105
  270. package/src/resources/syncs.ts +0 -25
  271. package/src/resources/system.ts +0 -13
  272. package/src/resources/tools/index.ts +0 -4
  273. package/src/resources/tools/result.ts +0 -16
  274. package/src/resources/tools/tools.ts +0 -54
  275. package/src/resources/workflows.ts +0 -49
  276. package/src/shims/node.ts +0 -50
  277. package/src/shims/web.ts +0 -50
  278. package/src/tsconfig.json +0 -11
  279. package/src/uploads.ts +0 -255
  280. package/src/version.ts +0 -1
  281. package/uploads.d.ts +0 -75
  282. package/uploads.d.ts.map +0 -1
  283. package/uploads.js +0 -171
  284. package/uploads.js.map +0 -1
  285. package/uploads.mjs +0 -158
  286. package/uploads.mjs.map +0 -1
  287. package/version.d.ts +0 -2
  288. package/version.d.ts.map +0 -1
  289. package/version.js +0 -5
  290. package/version.js.map +0 -1
  291. package/version.mjs +0 -2
  292. package/version.mjs.map +0 -1
@@ -0,0 +1,346 @@
1
+ import { StorageThreadType, CoreMessage, AiMessageType, MessageType, StepAction, StepGraph, QueryResult, BaseLogMessage, GenerateReturn, StreamReturn } from '@mastra/core';
2
+ import { StorageThreadType as StorageThreadType$1 } from '@mastra/core/memory';
3
+
4
+ interface ClientOptions {
5
+ baseUrl: string;
6
+ retries?: number;
7
+ backoffMs?: number;
8
+ maxBackoffMs?: number;
9
+ headers?: Record<string, string>;
10
+ }
11
+ interface RequestOptions {
12
+ method?: string;
13
+ headers?: Record<string, string>;
14
+ body?: any;
15
+ }
16
+ interface GetAgentResponse {
17
+ name: string;
18
+ model: string;
19
+ instructions: string;
20
+ tools: Record<string, GetToolResponse>;
21
+ }
22
+ interface GetEvalsByAgentIdResponse extends GetAgentResponse {
23
+ evals: any[];
24
+ }
25
+ interface GetToolResponse {
26
+ id: string;
27
+ description: string;
28
+ inputSchema: string;
29
+ outputSchema: string;
30
+ }
31
+ interface GetWorkflowResponse {
32
+ name: string;
33
+ triggerSchema: string;
34
+ steps: Record<string, StepAction<any, any, any, any>>;
35
+ stepGraph: StepGraph;
36
+ stepSubscriberGraph: Record<string, StepGraph>;
37
+ }
38
+ interface UpsertVectorParams {
39
+ indexName: string;
40
+ vectors: number[][];
41
+ metadata?: Record<string, any>[];
42
+ ids?: string[];
43
+ }
44
+ interface CreateIndexParams {
45
+ indexName: string;
46
+ dimension: number;
47
+ metric?: 'cosine' | 'euclidean' | 'dotproduct';
48
+ }
49
+ interface QueryVectorParams {
50
+ indexName: string;
51
+ queryVector: number[];
52
+ topK?: number;
53
+ filter?: Record<string, any>;
54
+ includeVector?: boolean;
55
+ }
56
+ interface QueryVectorResponse {
57
+ results: QueryResult[];
58
+ }
59
+ interface GetVectorIndexResponse {
60
+ dimension: number;
61
+ metric: 'cosine' | 'euclidean' | 'dotproduct';
62
+ count: number;
63
+ }
64
+ interface SaveMessageToMemoryParams {
65
+ messages: MessageType[];
66
+ }
67
+ type SaveMessageToMemoryResponse = MessageType[];
68
+ interface CreateMemoryThreadParams {
69
+ title: string;
70
+ metadata: Record<string, any>;
71
+ resourceid: string;
72
+ threadId: string;
73
+ }
74
+ type CreateMemoryThreadResponse = StorageThreadType;
75
+ interface GetMemoryThreadParams {
76
+ resourceId: string;
77
+ }
78
+ type GetMemoryThreadResponse = StorageThreadType[];
79
+ interface UpdateMemoryThreadParams {
80
+ title: string;
81
+ metadata: Record<string, any>;
82
+ resourceid: string;
83
+ }
84
+ interface GetMemoryThreadMessagesResponse {
85
+ messages: CoreMessage[];
86
+ uiMessages: AiMessageType[];
87
+ }
88
+ interface GetLogsParams {
89
+ transportId: string;
90
+ }
91
+ interface GetLogParams {
92
+ runId: string;
93
+ transportId: string;
94
+ }
95
+ type GetLogsResponse = BaseLogMessage[];
96
+ type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
97
+
98
+ declare class Agent {
99
+ private request;
100
+ private agentId;
101
+ constructor(request: RequestFunction, agentId: string);
102
+ /**
103
+ * Retrieves details about the agent
104
+ * @returns Promise containing agent details including model and instructions
105
+ */
106
+ details(): Promise<GetAgentResponse>;
107
+ /**
108
+ * Generates a response from the agent
109
+ * @param params - Generation parameters including prompt
110
+ * @returns Promise containing the generated response
111
+ */
112
+ generate<T>(params: any): Promise<GenerateReturn<T>>;
113
+ /**
114
+ * Streams a response from the agent
115
+ * @param params - Stream parameters including prompt
116
+ * @returns Promise containing the streamed response
117
+ */
118
+ stream<T>(params: any): Promise<StreamReturn<T>>;
119
+ /**
120
+ * Gets details about a specific tool available to the agent
121
+ * @param toolId - ID of the tool to retrieve
122
+ * @returns Promise containing tool details
123
+ */
124
+ getTool(toolId: string): Promise<GetToolResponse>;
125
+ /**
126
+ * Retrieves evaluation results for the agent
127
+ * @returns Promise containing agent evaluations
128
+ */
129
+ evals(): Promise<GetEvalsByAgentIdResponse>;
130
+ /**
131
+ * Retrieves live evaluation results for the agent
132
+ * @returns Promise containing live agent evaluations
133
+ */
134
+ liveEvals(): Promise<GetEvalsByAgentIdResponse>;
135
+ }
136
+
137
+ declare class MemoryThread {
138
+ private request;
139
+ private threadId;
140
+ constructor(request: RequestFunction, threadId: string);
141
+ /**
142
+ * Retrieves the memory thread details
143
+ * @returns Promise containing thread details including title and metadata
144
+ */
145
+ get(): Promise<StorageThreadType$1>;
146
+ /**
147
+ * Updates the memory thread properties
148
+ * @param params - Update parameters including title and metadata
149
+ * @returns Promise containing updated thread details
150
+ */
151
+ update(params: UpdateMemoryThreadParams): Promise<StorageThreadType$1>;
152
+ /**
153
+ * Deletes the memory thread
154
+ * @returns Promise containing deletion result
155
+ */
156
+ delete(): Promise<{
157
+ result: string;
158
+ }>;
159
+ /**
160
+ * Retrieves messages associated with the thread
161
+ * @returns Promise containing thread messages and UI messages
162
+ */
163
+ getMessages(): Promise<GetMemoryThreadMessagesResponse>;
164
+ }
165
+
166
+ declare class Tool {
167
+ private request;
168
+ private toolId;
169
+ constructor(request: RequestFunction, toolId: string);
170
+ /**
171
+ * Retrieves details about the tool
172
+ * @returns Promise containing tool details including description and schemas
173
+ */
174
+ details(): Promise<GetToolResponse>;
175
+ /**
176
+ * Executes the tool with the provided parameters
177
+ * @param params - Parameters required for tool execution
178
+ * @returns Promise containing the tool execution results
179
+ */
180
+ execute(params: Record<string, any>): Promise<Record<string, any>>;
181
+ }
182
+
183
+ declare class Workflow {
184
+ private request;
185
+ private workflowId;
186
+ constructor(request: RequestFunction, workflowId: string);
187
+ /**
188
+ * Retrieves details about the workflow
189
+ * @returns Promise containing workflow details including steps and graphs
190
+ */
191
+ details(): Promise<GetWorkflowResponse>;
192
+ /**
193
+ * Executes the workflow with the provided parameters
194
+ * @param params - Parameters required for workflow execution
195
+ * @returns Promise containing the workflow execution results
196
+ */
197
+ execute(params: Record<string, any>): Promise<Record<string, any>>;
198
+ }
199
+
200
+ declare class Vector {
201
+ private request;
202
+ private vectorName;
203
+ constructor(request: RequestFunction, vectorName: string);
204
+ /**
205
+ * Retrieves details about a specific vector index
206
+ * @param indexName - Name of the index to get details for
207
+ * @returns Promise containing vector index details
208
+ */
209
+ details(indexName: string): Promise<GetVectorIndexResponse>;
210
+ /**
211
+ * Deletes a vector index
212
+ * @param indexName - Name of the index to delete
213
+ * @returns Promise indicating deletion success
214
+ */
215
+ delete(indexName: string): Promise<{
216
+ success: boolean;
217
+ }>;
218
+ /**
219
+ * Retrieves a list of all available indexes
220
+ * @returns Promise containing array of index names
221
+ */
222
+ getIndexes(): Promise<{
223
+ indexes: string[];
224
+ }>;
225
+ /**
226
+ * Creates a new vector index
227
+ * @param params - Parameters for index creation including dimension and metric
228
+ * @returns Promise indicating creation success
229
+ */
230
+ createIndex(params: CreateIndexParams): Promise<{
231
+ success: boolean;
232
+ }>;
233
+ /**
234
+ * Upserts vectors into an index
235
+ * @param params - Parameters containing vectors, metadata, and optional IDs
236
+ * @returns Promise containing array of vector IDs
237
+ */
238
+ upsert(params: UpsertVectorParams): Promise<string[]>;
239
+ /**
240
+ * Queries vectors in an index
241
+ * @param params - Query parameters including query vector and search options
242
+ * @returns Promise containing query results
243
+ */
244
+ query(params: QueryVectorParams): Promise<QueryVectorResponse>;
245
+ }
246
+
247
+ declare class MastraClient {
248
+ readonly baseUrl: string;
249
+ private readonly retries;
250
+ private readonly backoffMs;
251
+ private readonly maxBackoffMs;
252
+ private readonly headers;
253
+ constructor(options: ClientOptions);
254
+ /**
255
+ * Makes an HTTP request to the Mastra API
256
+ * @param path - API endpoint path
257
+ * @param options - Request options including method, headers, and body
258
+ * @returns Promise containing the API response
259
+ * @throws Error if the request fails after all retries
260
+ */
261
+ request(path: string, options?: RequestOptions): Promise<any>;
262
+ /**
263
+ * Retrieves all available agents
264
+ * @returns Promise containing map of agent IDs to agent details
265
+ */
266
+ getAgents(): Promise<Record<string, GetAgentResponse>>;
267
+ /**
268
+ * Gets an agent instance by ID
269
+ * @param agentId - ID of the agent to retrieve
270
+ * @returns Agent instance
271
+ */
272
+ getAgent(agentId: string): Agent;
273
+ /**
274
+ * Retrieves memory threads for a resource
275
+ * @param params - Parameters containing the resource ID
276
+ * @returns Promise containing array of memory threads
277
+ */
278
+ getMemoryThreads(params: GetMemoryThreadParams): Promise<GetMemoryThreadResponse>;
279
+ /**
280
+ * Creates a new memory thread
281
+ * @param params - Parameters for creating the memory thread
282
+ * @returns Promise containing the created memory thread
283
+ */
284
+ createMemoryThread(params: CreateMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
285
+ /**
286
+ * Gets a memory thread instance by ID
287
+ * @param threadId - ID of the memory thread to retrieve
288
+ * @returns MemoryThread instance
289
+ */
290
+ getMemoryThread(threadId: string): MemoryThread;
291
+ /**
292
+ * Saves messages to memory
293
+ * @param params - Parameters containing messages to save
294
+ * @returns Promise containing the saved messages
295
+ */
296
+ saveMessageToMemory(params: SaveMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
297
+ /**
298
+ * Gets the status of the memory system
299
+ * @returns Promise containing memory system status
300
+ */
301
+ getMemoryStatus(): Promise<{
302
+ result: boolean;
303
+ }>;
304
+ /**
305
+ * Retrieves all available tools
306
+ * @returns Promise containing map of tool IDs to tool details
307
+ */
308
+ getTools(): Promise<Record<string, GetToolResponse>>;
309
+ /**
310
+ * Gets a tool instance by ID
311
+ * @param toolId - ID of the tool to retrieve
312
+ * @returns Tool instance
313
+ */
314
+ getTool(toolId: string): Tool;
315
+ /**
316
+ * Retrieves all available workflows
317
+ * @returns Promise containing map of workflow IDs to workflow details
318
+ */
319
+ getWorkflows(): Promise<Record<string, GetWorkflowResponse>>;
320
+ /**
321
+ * Gets a workflow instance by ID
322
+ * @param workflowId - ID of the workflow to retrieve
323
+ * @returns Workflow instance
324
+ */
325
+ getWorkflow(workflowId: string): Workflow;
326
+ /**
327
+ * Gets a vector instance by name
328
+ * @param vectorName - Name of the vector to retrieve
329
+ * @returns Vector instance
330
+ */
331
+ getVector(vectorName: string): Vector;
332
+ /**
333
+ * Retrieves logs
334
+ * @param params - Parameters for filtering logs
335
+ * @returns Promise containing array of log messages
336
+ */
337
+ getLogs(params: GetLogsParams): Promise<GetLogsResponse>;
338
+ /**
339
+ * Gets logs for a specific run
340
+ * @param params - Parameters containing run ID to retrieve
341
+ * @returns Promise containing array of log messages
342
+ */
343
+ getLogForRun(params: GetLogParams): Promise<GetLogsResponse>;
344
+ }
345
+
346
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type UpdateMemoryThreadParams, type UpsertVectorParams };