@mastra/client-js 0.0.0-add-runtime-context-to-openai-realtime-20250516201052 → 0.0.0-add-save-score-validation-on-stores-20250911031242

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 (77) hide show
  1. package/CHANGELOG.md +1555 -2
  2. package/LICENSE.md +11 -42
  3. package/README.md +7 -4
  4. package/dist/client.d.ts +280 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/example.d.ts +2 -0
  7. package/dist/example.d.ts.map +1 -0
  8. package/dist/index.cjs +2411 -450
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.ts +4 -883
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +2413 -452
  13. package/dist/index.js.map +1 -0
  14. package/dist/resources/a2a.d.ts +41 -0
  15. package/dist/resources/a2a.d.ts.map +1 -0
  16. package/dist/resources/agent-builder.d.ts +161 -0
  17. package/dist/resources/agent-builder.d.ts.map +1 -0
  18. package/dist/resources/agent.d.ts +160 -0
  19. package/dist/resources/agent.d.ts.map +1 -0
  20. package/dist/resources/base.d.ts +13 -0
  21. package/dist/resources/base.d.ts.map +1 -0
  22. package/dist/resources/index.d.ts +13 -0
  23. package/dist/resources/index.d.ts.map +1 -0
  24. package/dist/resources/legacy-workflow.d.ts +87 -0
  25. package/dist/resources/legacy-workflow.d.ts.map +1 -0
  26. package/dist/resources/mcp-tool.d.ts +27 -0
  27. package/dist/resources/mcp-tool.d.ts.map +1 -0
  28. package/dist/resources/memory-thread.d.ts +53 -0
  29. package/dist/resources/memory-thread.d.ts.map +1 -0
  30. package/dist/resources/network-memory-thread.d.ts +47 -0
  31. package/dist/resources/network-memory-thread.d.ts.map +1 -0
  32. package/dist/resources/network.d.ts +30 -0
  33. package/dist/resources/network.d.ts.map +1 -0
  34. package/dist/resources/observability.d.ts +19 -0
  35. package/dist/resources/observability.d.ts.map +1 -0
  36. package/dist/resources/tool.d.ts +23 -0
  37. package/dist/resources/tool.d.ts.map +1 -0
  38. package/dist/resources/vNextNetwork.d.ts +42 -0
  39. package/dist/resources/vNextNetwork.d.ts.map +1 -0
  40. package/dist/resources/vector.d.ts +48 -0
  41. package/dist/resources/vector.d.ts.map +1 -0
  42. package/dist/resources/workflow.d.ts +169 -0
  43. package/dist/resources/workflow.d.ts.map +1 -0
  44. package/dist/types.d.ts +469 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/utils/index.d.ts +3 -0
  47. package/dist/utils/index.d.ts.map +1 -0
  48. package/dist/utils/process-client-tools.d.ts +3 -0
  49. package/dist/utils/process-client-tools.d.ts.map +1 -0
  50. package/dist/utils/process-mastra-stream.d.ts +11 -0
  51. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  52. package/dist/utils/zod-to-json-schema.d.ts +3 -0
  53. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  54. package/package.json +38 -20
  55. package/dist/index.d.cts +0 -883
  56. package/eslint.config.js +0 -6
  57. package/src/adapters/agui.test.ts +0 -180
  58. package/src/adapters/agui.ts +0 -239
  59. package/src/client.ts +0 -335
  60. package/src/example.ts +0 -64
  61. package/src/index.test.ts +0 -830
  62. package/src/index.ts +0 -2
  63. package/src/resources/a2a.ts +0 -88
  64. package/src/resources/agent.ts +0 -196
  65. package/src/resources/base.ts +0 -70
  66. package/src/resources/index.ts +0 -10
  67. package/src/resources/mcp-tool.ts +0 -48
  68. package/src/resources/memory-thread.ts +0 -63
  69. package/src/resources/network.ts +0 -86
  70. package/src/resources/tool.ts +0 -44
  71. package/src/resources/vector.ts +0 -83
  72. package/src/resources/vnext-workflow.ts +0 -261
  73. package/src/resources/workflow.ts +0 -251
  74. package/src/types.ts +0 -308
  75. package/src/utils/zod-to-json-schema.ts +0 -10
  76. package/tsconfig.json +0 -5
  77. package/vitest.config.js +0 -8
package/src/types.ts DELETED
@@ -1,308 +0,0 @@
1
- import type {
2
- MessageType,
3
- AiMessageType,
4
- CoreMessage,
5
- QueryResult,
6
- StepAction,
7
- StepGraph,
8
- StorageThreadType,
9
- BaseLogMessage,
10
- WorkflowRunResult as CoreWorkflowRunResult,
11
- VNextWorkflowRuns,
12
- WorkflowRuns,
13
- } from '@mastra/core';
14
-
15
- import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
16
- import type { RuntimeContext } from '@mastra/core/runtime-context';
17
- import type { ServerInfo } from '@mastra/core/mcp';
18
- import type { NewWorkflow, WatchEvent, WorkflowResult as VNextWorkflowResult } from '@mastra/core/workflows/vNext';
19
- import type { JSONSchema7 } from 'json-schema';
20
- import type { ZodSchema } from 'zod';
21
-
22
- export interface ClientOptions {
23
- /** Base URL for API requests */
24
- baseUrl: string;
25
- /** Number of retry attempts for failed requests */
26
- retries?: number;
27
- /** Initial backoff time in milliseconds between retries */
28
- backoffMs?: number;
29
- /** Maximum backoff time in milliseconds between retries */
30
- maxBackoffMs?: number;
31
- /** Custom headers to include with requests */
32
- headers?: Record<string, string>;
33
- /** Abort signal for request */
34
- }
35
-
36
- export interface RequestOptions {
37
- method?: string;
38
- headers?: Record<string, string>;
39
- body?: any;
40
- stream?: boolean;
41
- signal?: AbortSignal;
42
- }
43
-
44
- type WithoutMethods<T> = {
45
- [K in keyof T as T[K] extends (...args: any[]) => any
46
- ? never
47
- : T[K] extends { (): any }
48
- ? never
49
- : T[K] extends undefined | ((...args: any[]) => any)
50
- ? never
51
- : K]: T[K];
52
- };
53
-
54
- export interface GetAgentResponse {
55
- name: string;
56
- instructions: string;
57
- tools: Record<string, GetToolResponse>;
58
- workflows: Record<string, GetWorkflowResponse>;
59
- provider: string;
60
- modelId: string;
61
- }
62
-
63
- export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
64
- messages: string | string[] | CoreMessage[] | AiMessageType[];
65
- output?: T;
66
- experimental_output?: T;
67
- runtimeContext?: RuntimeContext;
68
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
69
-
70
- export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
71
- messages: string | string[] | CoreMessage[] | AiMessageType[];
72
- output?: T;
73
- experimental_output?: T;
74
- runtimeContext?: RuntimeContext;
75
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
76
-
77
- export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
78
- evals: any[];
79
- instructions: string;
80
- name: string;
81
- id: string;
82
- }
83
-
84
- export interface GetToolResponse {
85
- id: string;
86
- description: string;
87
- inputSchema: string;
88
- outputSchema: string;
89
- }
90
-
91
- export interface GetWorkflowResponse {
92
- name: string;
93
- triggerSchema: string;
94
- steps: Record<string, StepAction<any, any, any, any>>;
95
- stepGraph: StepGraph;
96
- stepSubscriberGraph: Record<string, StepGraph>;
97
- workflowId?: string;
98
- }
99
-
100
- export interface GetWorkflowRunsParams {
101
- fromDate?: Date;
102
- toDate?: Date;
103
- limit?: number;
104
- offset?: number;
105
- resourceId?: string;
106
- }
107
-
108
- export type GetWorkflowRunsResponse = WorkflowRuns;
109
-
110
- export type GetVNextWorkflowRunsResponse = VNextWorkflowRuns;
111
-
112
- export type WorkflowRunResult = {
113
- activePaths: Record<string, { status: string; suspendPayload?: any; stepPath: string[] }>;
114
- results: CoreWorkflowRunResult<any, any, any>['results'];
115
- timestamp: number;
116
- runId: string;
117
- };
118
-
119
- export interface GetVNextWorkflowResponse {
120
- name: string;
121
- steps: {
122
- [key: string]: {
123
- id: string;
124
- description: string;
125
- inputSchema: string;
126
- outputSchema: string;
127
- resumeSchema: string;
128
- suspendSchema: string;
129
- };
130
- };
131
- stepGraph: NewWorkflow['serializedStepGraph'];
132
- inputSchema: string;
133
- outputSchema: string;
134
- }
135
-
136
- export type VNextWorkflowWatchResult = WatchEvent & { runId: string };
137
-
138
- export type VNextWorkflowRunResult = VNextWorkflowResult<any, any>;
139
- export interface UpsertVectorParams {
140
- indexName: string;
141
- vectors: number[][];
142
- metadata?: Record<string, any>[];
143
- ids?: string[];
144
- }
145
- export interface CreateIndexParams {
146
- indexName: string;
147
- dimension: number;
148
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
149
- }
150
-
151
- export interface QueryVectorParams {
152
- indexName: string;
153
- queryVector: number[];
154
- topK?: number;
155
- filter?: Record<string, any>;
156
- includeVector?: boolean;
157
- }
158
-
159
- export interface QueryVectorResponse {
160
- results: QueryResult[];
161
- }
162
-
163
- export interface GetVectorIndexResponse {
164
- dimension: number;
165
- metric: 'cosine' | 'euclidean' | 'dotproduct';
166
- count: number;
167
- }
168
-
169
- export interface SaveMessageToMemoryParams {
170
- messages: MessageType[];
171
- agentId: string;
172
- }
173
-
174
- export type SaveMessageToMemoryResponse = MessageType[];
175
-
176
- export interface CreateMemoryThreadParams {
177
- title: string;
178
- metadata: Record<string, any>;
179
- resourceId: string;
180
- threadId: string;
181
- agentId: string;
182
- }
183
-
184
- export type CreateMemoryThreadResponse = StorageThreadType;
185
-
186
- export interface GetMemoryThreadParams {
187
- resourceId: string;
188
- agentId: string;
189
- }
190
-
191
- export type GetMemoryThreadResponse = StorageThreadType[];
192
-
193
- export interface UpdateMemoryThreadParams {
194
- title: string;
195
- metadata: Record<string, any>;
196
- resourceId: string;
197
- }
198
-
199
- export interface GetMemoryThreadMessagesParams {
200
- /**
201
- * Limit the number of messages to retrieve (default: 40)
202
- */
203
- limit?: number;
204
- }
205
-
206
- export interface GetMemoryThreadMessagesResponse {
207
- messages: CoreMessage[];
208
- uiMessages: AiMessageType[];
209
- }
210
-
211
- export interface GetLogsParams {
212
- transportId: string;
213
- }
214
-
215
- export interface GetLogParams {
216
- runId: string;
217
- transportId: string;
218
- }
219
-
220
- export type GetLogsResponse = BaseLogMessage[];
221
-
222
- export type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
223
-
224
- type SpanStatus = {
225
- code: number;
226
- };
227
-
228
- type SpanOther = {
229
- droppedAttributesCount: number;
230
- droppedEventsCount: number;
231
- droppedLinksCount: number;
232
- };
233
-
234
- type SpanEventAttributes = {
235
- key: string;
236
- value: { [key: string]: string | number | boolean | null };
237
- };
238
-
239
- type SpanEvent = {
240
- attributes: SpanEventAttributes[];
241
- name: string;
242
- timeUnixNano: string;
243
- droppedAttributesCount: number;
244
- };
245
-
246
- type Span = {
247
- id: string;
248
- parentSpanId: string | null;
249
- traceId: string;
250
- name: string;
251
- scope: string;
252
- kind: number;
253
- status: SpanStatus;
254
- events: SpanEvent[];
255
- links: any[];
256
- attributes: Record<string, string | number | boolean | null>;
257
- startTime: number;
258
- endTime: number;
259
- duration: number;
260
- other: SpanOther;
261
- createdAt: string;
262
- };
263
-
264
- export interface GetTelemetryResponse {
265
- traces: Span[];
266
- }
267
-
268
- export interface GetTelemetryParams {
269
- name?: string;
270
- scope?: string;
271
- page?: number;
272
- perPage?: number;
273
- attribute?: Record<string, string>;
274
- fromDate?: Date;
275
- toDate?: Date;
276
- }
277
-
278
- export interface GetNetworkResponse {
279
- name: string;
280
- instructions: string;
281
- agents: Array<{
282
- name: string;
283
- provider: string;
284
- modelId: string;
285
- }>;
286
- routingModel: {
287
- provider: string;
288
- modelId: string;
289
- };
290
- state?: Record<string, any>;
291
- }
292
-
293
- export interface McpServerListResponse {
294
- servers: ServerInfo[];
295
- next: string | null;
296
- total_count: number;
297
- }
298
-
299
- export interface McpToolInfo {
300
- id: string;
301
- name: string;
302
- description?: string;
303
- inputSchema: string;
304
- }
305
-
306
- export interface McpServerToolListResponse {
307
- tools: McpToolInfo[];
308
- }
@@ -1,10 +0,0 @@
1
- import { ZodSchema } from 'zod';
2
- import originalZodToJsonSchema from 'zod-to-json-schema';
3
-
4
- export function zodToJsonSchema<T extends ZodSchema | any>(zodSchema: T) {
5
- if (!(zodSchema instanceof ZodSchema)) {
6
- return zodSchema;
7
- }
8
-
9
- return originalZodToJsonSchema(zodSchema, { $refStrategy: 'none' });
10
- }
package/tsconfig.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.node.json",
3
- "include": ["src/**/*"],
4
- "exclude": ["node_modules", "**/*.test.ts"]
5
- }
package/vitest.config.js DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- environment: 'node',
6
- include: ['src/**/*.test.ts'],
7
- },
8
- });