@mastra/client-js 0.0.0-pass-headers-for-create-mastra-client-20250530010057 → 0.0.0-pgvector-index-fix-20250905222058

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 (79) hide show
  1. package/CHANGELOG.md +1358 -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 +2062 -286
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.ts +4 -900
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +2064 -288
  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 +155 -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 +154 -0
  43. package/dist/resources/workflow.d.ts.map +1 -0
  44. package/dist/types.d.ts +461 -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 +7 -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 -21
  55. package/.turbo/turbo-build.log +0 -19
  56. package/dist/index.d.cts +0 -900
  57. package/eslint.config.js +0 -6
  58. package/src/adapters/agui.test.ts +0 -180
  59. package/src/adapters/agui.ts +0 -239
  60. package/src/client.ts +0 -334
  61. package/src/example.ts +0 -64
  62. package/src/index.test.ts +0 -830
  63. package/src/index.ts +0 -2
  64. package/src/resources/a2a.ts +0 -88
  65. package/src/resources/agent.ts +0 -197
  66. package/src/resources/base.ts +0 -70
  67. package/src/resources/index.ts +0 -10
  68. package/src/resources/legacy-workflow.ts +0 -242
  69. package/src/resources/mcp-tool.ts +0 -48
  70. package/src/resources/memory-thread.ts +0 -63
  71. package/src/resources/network.ts +0 -86
  72. package/src/resources/tool.ts +0 -45
  73. package/src/resources/vector.ts +0 -83
  74. package/src/resources/workflow.ts +0 -353
  75. package/src/types.ts +0 -314
  76. package/src/utils/index.ts +0 -11
  77. package/src/utils/zod-to-json-schema.ts +0 -10
  78. package/tsconfig.json +0 -5
  79. package/vitest.config.js +0 -8
package/src/types.ts DELETED
@@ -1,314 +0,0 @@
1
- import type {
2
- MessageType,
3
- AiMessageType,
4
- CoreMessage,
5
- QueryResult,
6
- StorageThreadType,
7
- WorkflowRuns,
8
- LegacyWorkflowRuns,
9
- } from '@mastra/core';
10
- import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
11
- import type { BaseLogMessage } 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
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
73
-
74
- export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
75
- messages: string | string[] | CoreMessage[] | AiMessageType[];
76
- output?: T;
77
- experimental_output?: T;
78
- runtimeContext?: RuntimeContext | Record<string, any>;
79
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
80
-
81
- export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
82
- evals: any[];
83
- instructions: string;
84
- name: string;
85
- id: string;
86
- }
87
-
88
- export interface GetToolResponse {
89
- id: string;
90
- description: string;
91
- inputSchema: string;
92
- outputSchema: string;
93
- }
94
-
95
- export interface GetLegacyWorkflowResponse {
96
- name: string;
97
- triggerSchema: string;
98
- steps: Record<string, StepAction<any, any, any, any>>;
99
- stepGraph: StepGraph;
100
- stepSubscriberGraph: Record<string, StepGraph>;
101
- workflowId?: string;
102
- }
103
-
104
- export interface GetWorkflowRunsParams {
105
- fromDate?: Date;
106
- toDate?: Date;
107
- limit?: number;
108
- offset?: number;
109
- resourceId?: string;
110
- }
111
-
112
- export type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
113
-
114
- export type GetWorkflowRunsResponse = WorkflowRuns;
115
-
116
- export type LegacyWorkflowRunResult = {
117
- activePaths: Record<string, { status: string; suspendPayload?: any; stepPath: string[] }>;
118
- results: CoreLegacyWorkflowRunResult<any, any, any>['results'];
119
- timestamp: number;
120
- runId: string;
121
- };
122
-
123
- export interface GetWorkflowResponse {
124
- name: string;
125
- description?: string;
126
- steps: {
127
- [key: string]: {
128
- id: string;
129
- description: string;
130
- inputSchema: string;
131
- outputSchema: string;
132
- resumeSchema: string;
133
- suspendSchema: string;
134
- };
135
- };
136
- stepGraph: Workflow['serializedStepGraph'];
137
- inputSchema: string;
138
- outputSchema: string;
139
- }
140
-
141
- export type WorkflowWatchResult = WatchEvent & { runId: string };
142
-
143
- export type WorkflowRunResult = WorkflowResult<any, any>;
144
- export interface UpsertVectorParams {
145
- indexName: string;
146
- vectors: number[][];
147
- metadata?: Record<string, any>[];
148
- ids?: string[];
149
- }
150
- export interface CreateIndexParams {
151
- indexName: string;
152
- dimension: number;
153
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
154
- }
155
-
156
- export interface QueryVectorParams {
157
- indexName: string;
158
- queryVector: number[];
159
- topK?: number;
160
- filter?: Record<string, any>;
161
- includeVector?: boolean;
162
- }
163
-
164
- export interface QueryVectorResponse {
165
- results: QueryResult[];
166
- }
167
-
168
- export interface GetVectorIndexResponse {
169
- dimension: number;
170
- metric: 'cosine' | 'euclidean' | 'dotproduct';
171
- count: number;
172
- }
173
-
174
- export interface SaveMessageToMemoryParams {
175
- messages: MessageType[];
176
- agentId: string;
177
- }
178
-
179
- export type SaveMessageToMemoryResponse = MessageType[];
180
-
181
- export interface CreateMemoryThreadParams {
182
- title?: string;
183
- metadata?: Record<string, any>;
184
- resourceId: string;
185
- threadId?: string;
186
- agentId: string;
187
- }
188
-
189
- export type CreateMemoryThreadResponse = StorageThreadType;
190
-
191
- export interface GetMemoryThreadParams {
192
- resourceId: string;
193
- agentId: string;
194
- }
195
-
196
- export type GetMemoryThreadResponse = StorageThreadType[];
197
-
198
- export interface UpdateMemoryThreadParams {
199
- title: string;
200
- metadata: Record<string, any>;
201
- resourceId: string;
202
- }
203
-
204
- export interface GetMemoryThreadMessagesParams {
205
- /**
206
- * Limit the number of messages to retrieve (default: 40)
207
- */
208
- limit?: number;
209
- }
210
-
211
- export interface GetMemoryThreadMessagesResponse {
212
- messages: CoreMessage[];
213
- uiMessages: AiMessageType[];
214
- }
215
-
216
- export interface GetLogsParams {
217
- transportId: string;
218
- }
219
-
220
- export interface GetLogParams {
221
- runId: string;
222
- transportId: string;
223
- }
224
-
225
- export type GetLogsResponse = BaseLogMessage[];
226
-
227
- export type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
228
-
229
- type SpanStatus = {
230
- code: number;
231
- };
232
-
233
- type SpanOther = {
234
- droppedAttributesCount: number;
235
- droppedEventsCount: number;
236
- droppedLinksCount: number;
237
- };
238
-
239
- type SpanEventAttributes = {
240
- key: string;
241
- value: { [key: string]: string | number | boolean | null };
242
- };
243
-
244
- type SpanEvent = {
245
- attributes: SpanEventAttributes[];
246
- name: string;
247
- timeUnixNano: string;
248
- droppedAttributesCount: number;
249
- };
250
-
251
- type Span = {
252
- id: string;
253
- parentSpanId: string | null;
254
- traceId: string;
255
- name: string;
256
- scope: string;
257
- kind: number;
258
- status: SpanStatus;
259
- events: SpanEvent[];
260
- links: any[];
261
- attributes: Record<string, string | number | boolean | null>;
262
- startTime: number;
263
- endTime: number;
264
- duration: number;
265
- other: SpanOther;
266
- createdAt: string;
267
- };
268
-
269
- export interface GetTelemetryResponse {
270
- traces: Span[];
271
- }
272
-
273
- export interface GetTelemetryParams {
274
- name?: string;
275
- scope?: string;
276
- page?: number;
277
- perPage?: number;
278
- attribute?: Record<string, string>;
279
- fromDate?: Date;
280
- toDate?: Date;
281
- }
282
-
283
- export interface GetNetworkResponse {
284
- name: string;
285
- instructions: string;
286
- agents: Array<{
287
- name: string;
288
- provider: string;
289
- modelId: string;
290
- }>;
291
- routingModel: {
292
- provider: string;
293
- modelId: string;
294
- };
295
- state?: Record<string, any>;
296
- }
297
-
298
- export interface McpServerListResponse {
299
- servers: ServerInfo[];
300
- next: string | null;
301
- total_count: number;
302
- }
303
-
304
- export interface McpToolInfo {
305
- id: string;
306
- name: string;
307
- description?: string;
308
- inputSchema: string;
309
- toolType?: MCPToolType;
310
- }
311
-
312
- export interface McpServerToolListResponse {
313
- tools: McpToolInfo[];
314
- }
@@ -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,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
- });