@mastra/client-js 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloud-deployer-for-core-0.19.1-20251001164939

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