@mastra/client-js 0.0.0-generate-message-id-20250512171942 → 0.0.0-gl-test-20250917080133

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