@mastra/client-js 0.0.0-llamaindex-switch-core-20250424001624 → 0.0.0-main-test-20251105183450

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 (65) hide show
  1. package/CHANGELOG.md +2696 -2
  2. package/LICENSE.md +11 -42
  3. package/README.md +12 -15
  4. package/dist/client.d.ts +254 -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 +2722 -268
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.ts +5 -585
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +2717 -269
  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 +186 -0
  17. package/dist/resources/agent-builder.d.ts.map +1 -0
  18. package/dist/resources/agent.d.ts +181 -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/observability.d.ts +35 -0
  29. package/dist/resources/observability.d.ts.map +1 -0
  30. package/dist/resources/tool.d.ts +24 -0
  31. package/dist/resources/tool.d.ts.map +1 -0
  32. package/dist/resources/vector.d.ts +51 -0
  33. package/dist/resources/vector.d.ts.map +1 -0
  34. package/dist/resources/workflow.d.ts +216 -0
  35. package/dist/resources/workflow.d.ts.map +1 -0
  36. package/dist/tools.d.ts +22 -0
  37. package/dist/tools.d.ts.map +1 -0
  38. package/dist/types.d.ts +450 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/utils/index.d.ts +11 -0
  41. package/dist/utils/index.d.ts.map +1 -0
  42. package/dist/utils/process-client-tools.d.ts +3 -0
  43. package/dist/utils/process-client-tools.d.ts.map +1 -0
  44. package/dist/utils/process-mastra-stream.d.ts +11 -0
  45. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  46. package/dist/utils/zod-to-json-schema.d.ts +3 -0
  47. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  48. package/package.json +42 -19
  49. package/dist/index.d.cts +0 -585
  50. package/eslint.config.js +0 -6
  51. package/src/client.ts +0 -214
  52. package/src/example.ts +0 -65
  53. package/src/index.test.ts +0 -710
  54. package/src/index.ts +0 -2
  55. package/src/resources/agent.ts +0 -205
  56. package/src/resources/base.ts +0 -70
  57. package/src/resources/index.ts +0 -7
  58. package/src/resources/memory-thread.ts +0 -53
  59. package/src/resources/network.ts +0 -92
  60. package/src/resources/tool.ts +0 -32
  61. package/src/resources/vector.ts +0 -83
  62. package/src/resources/workflow.ts +0 -215
  63. package/src/types.ts +0 -224
  64. package/tsconfig.json +0 -5
  65. package/vitest.config.js +0 -8
@@ -0,0 +1,51 @@
1
+ import type { RequestContext } from '@mastra/core/request-context';
2
+ import type { CreateIndexParams, GetVectorIndexResponse, QueryVectorParams, QueryVectorResponse, ClientOptions, UpsertVectorParams } from '../types.js';
3
+ import { BaseResource } from './base.js';
4
+ export declare class Vector extends BaseResource {
5
+ private vectorName;
6
+ constructor(options: ClientOptions, vectorName: string);
7
+ /**
8
+ * Retrieves details about a specific vector index
9
+ * @param indexName - Name of the index to get details for
10
+ * @param requestContext - Optional request context to pass as query parameter
11
+ * @returns Promise containing vector index details
12
+ */
13
+ details(indexName: string, requestContext?: RequestContext | Record<string, any>): Promise<GetVectorIndexResponse>;
14
+ /**
15
+ * Deletes a vector index
16
+ * @param indexName - Name of the index to delete
17
+ * @returns Promise indicating deletion success
18
+ */
19
+ delete(indexName: string): Promise<{
20
+ success: boolean;
21
+ }>;
22
+ /**
23
+ * Retrieves a list of all available indexes
24
+ * @param requestContext - Optional request context to pass as query parameter
25
+ * @returns Promise containing array of index names
26
+ */
27
+ getIndexes(requestContext?: RequestContext | Record<string, any>): Promise<{
28
+ indexes: string[];
29
+ }>;
30
+ /**
31
+ * Creates a new vector index
32
+ * @param params - Parameters for index creation including dimension and metric
33
+ * @returns Promise indicating creation success
34
+ */
35
+ createIndex(params: CreateIndexParams): Promise<{
36
+ success: boolean;
37
+ }>;
38
+ /**
39
+ * Upserts vectors into an index
40
+ * @param params - Parameters containing vectors, metadata, and optional IDs
41
+ * @returns Promise containing array of vector IDs
42
+ */
43
+ upsert(params: UpsertVectorParams): Promise<string[]>;
44
+ /**
45
+ * Queries vectors in an index
46
+ * @param params - Query parameters including query vector and search options
47
+ * @returns Promise containing query results
48
+ */
49
+ query(params: QueryVectorParams): Promise<QueryVectorResponse>;
50
+ }
51
+ //# sourceMappingURL=vector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../src/resources/vector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,qBAAa,MAAO,SAAQ,YAAY;IAGpC,OAAO,CAAC,UAAU;gBADlB,OAAO,EAAE,aAAa,EACd,UAAU,EAAE,MAAM;IAK5B;;;;;OAKG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAMlH;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAMxD;;;;OAIG;IACH,UAAU,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAIjG;;;;OAIG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAOrE;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAOrD;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAM/D"}
@@ -0,0 +1,216 @@
1
+ import type { TracingOptions } from '@mastra/core/observability';
2
+ import type { RequestContext } from '@mastra/core/request-context';
3
+ import type { ClientOptions, GetWorkflowResponse, ListWorkflowRunsResponse, ListWorkflowRunsParams, WorkflowRunResult, GetWorkflowRunByIdResponse, GetWorkflowRunExecutionResultResponse, StreamVNextChunkType } from '../types.js';
4
+ import { BaseResource } from './base.js';
5
+ export declare class Workflow extends BaseResource {
6
+ private workflowId;
7
+ constructor(options: ClientOptions, workflowId: string);
8
+ /**
9
+ * Retrieves details about the workflow
10
+ * @param requestContext - Optional request context to pass as query parameter
11
+ * @returns Promise containing workflow details including steps and graphs
12
+ */
13
+ details(requestContext?: RequestContext | Record<string, any>): Promise<GetWorkflowResponse>;
14
+ /**
15
+ * Retrieves all runs for a workflow
16
+ * @param params - Parameters for filtering runs
17
+ * @param requestContext - Optional request context to pass as query parameter
18
+ * @returns Promise containing workflow runs array
19
+ */
20
+ runs(params?: ListWorkflowRunsParams, requestContext?: RequestContext | Record<string, any>): Promise<ListWorkflowRunsResponse>;
21
+ /**
22
+ * Retrieves a specific workflow run by its ID
23
+ * @param runId - The ID of the workflow run to retrieve
24
+ * @param requestContext - Optional request context to pass as query parameter
25
+ * @returns Promise containing the workflow run details
26
+ */
27
+ runById(runId: string, requestContext?: RequestContext | Record<string, any>): Promise<GetWorkflowRunByIdResponse>;
28
+ /**
29
+ * Retrieves the execution result for a specific workflow run by its ID
30
+ * @param runId - The ID of the workflow run to retrieve the execution result for
31
+ * @param requestContext - Optional request context to pass as query parameter
32
+ * @returns Promise containing the workflow run execution result
33
+ */
34
+ runExecutionResult(runId: string, requestContext?: RequestContext | Record<string, any>): Promise<GetWorkflowRunExecutionResultResponse>;
35
+ /**
36
+ * Cancels a specific workflow run by its ID
37
+ * @param runId - The ID of the workflow run to cancel
38
+ * @returns Promise containing a success message
39
+ */
40
+ cancelRun(runId: string): Promise<{
41
+ message: string;
42
+ }>;
43
+ /**
44
+ * Sends an event to a specific workflow run by its ID
45
+ * @param params - Object containing the runId, event and data
46
+ * @returns Promise containing a success message
47
+ */
48
+ sendRunEvent(params: {
49
+ runId: string;
50
+ event: string;
51
+ data: unknown;
52
+ }): Promise<{
53
+ message: string;
54
+ }>;
55
+ /**
56
+ * Creates a new workflow run
57
+ * @param params - Optional object containing the optional runId
58
+ * @returns Promise containing the runId of the created run with methods to control execution
59
+ */
60
+ createRun(params?: {
61
+ runId?: string;
62
+ }): Promise<{
63
+ runId: string;
64
+ start: (params: {
65
+ inputData: Record<string, any>;
66
+ requestContext?: RequestContext | Record<string, any>;
67
+ tracingOptions?: TracingOptions;
68
+ }) => Promise<{
69
+ message: string;
70
+ }>;
71
+ resume: (params: {
72
+ step?: string | string[];
73
+ resumeData?: Record<string, any>;
74
+ requestContext?: RequestContext | Record<string, any>;
75
+ tracingOptions?: TracingOptions;
76
+ }) => Promise<{
77
+ message: string;
78
+ }>;
79
+ stream: (params: {
80
+ inputData: Record<string, any>;
81
+ requestContext?: RequestContext | Record<string, any>;
82
+ }) => Promise<ReadableStream>;
83
+ startAsync: (params: {
84
+ inputData: Record<string, any>;
85
+ requestContext?: RequestContext | Record<string, any>;
86
+ tracingOptions?: TracingOptions;
87
+ }) => Promise<WorkflowRunResult>;
88
+ resumeAsync: (params: {
89
+ step?: string | string[];
90
+ resumeData?: Record<string, any>;
91
+ requestContext?: RequestContext | Record<string, any>;
92
+ tracingOptions?: TracingOptions;
93
+ }) => Promise<WorkflowRunResult>;
94
+ resumeStreamVNext: (params: {
95
+ step?: string | string[];
96
+ resumeData?: Record<string, any>;
97
+ requestContext?: RequestContext | Record<string, any>;
98
+ }) => Promise<ReadableStream>;
99
+ }>;
100
+ /**
101
+ * Starts a workflow run synchronously without waiting for the workflow to complete
102
+ * @param params - Object containing the runId, inputData and requestContext
103
+ * @returns Promise containing success message
104
+ */
105
+ start(params: {
106
+ runId: string;
107
+ inputData: Record<string, any>;
108
+ requestContext?: RequestContext | Record<string, any>;
109
+ tracingOptions?: TracingOptions;
110
+ }): Promise<{
111
+ message: string;
112
+ }>;
113
+ /**
114
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
115
+ * @param params - Object containing the runId, step, resumeData and requestContext
116
+ * @returns Promise containing success message
117
+ */
118
+ resume({ step, runId, resumeData, tracingOptions, ...rest }: {
119
+ step?: string | string[];
120
+ runId: string;
121
+ resumeData?: Record<string, any>;
122
+ requestContext?: RequestContext | Record<string, any>;
123
+ tracingOptions?: TracingOptions;
124
+ }): Promise<{
125
+ message: string;
126
+ }>;
127
+ /**
128
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
129
+ * @param params - Object containing the optional runId, inputData and requestContext
130
+ * @returns Promise containing the workflow execution results
131
+ */
132
+ startAsync(params: {
133
+ runId?: string;
134
+ inputData: Record<string, any>;
135
+ requestContext?: RequestContext | Record<string, any>;
136
+ tracingOptions?: TracingOptions;
137
+ }): Promise<WorkflowRunResult>;
138
+ /**
139
+ * Starts a workflow run and returns a stream
140
+ * @param params - Object containing the optional runId, inputData and requestContext
141
+ * @returns Promise containing the workflow execution results
142
+ */
143
+ stream(params: {
144
+ runId?: string;
145
+ inputData: Record<string, any>;
146
+ requestContext?: RequestContext | Record<string, any>;
147
+ tracingOptions?: TracingOptions;
148
+ }): Promise<import("stream/web").ReadableStream<{
149
+ type: string;
150
+ payload: any;
151
+ }>>;
152
+ /**
153
+ * Observes workflow stream for a workflow run
154
+ * @param params - Object containing the runId
155
+ * @returns Promise containing the workflow execution results
156
+ */
157
+ observeStream(params: {
158
+ runId: string;
159
+ }): Promise<import("stream/web").ReadableStream<{
160
+ type: string;
161
+ payload: any;
162
+ }>>;
163
+ /**
164
+ * Starts a workflow run and returns a stream
165
+ * @param params - Object containing the optional runId, inputData and requestContext
166
+ * @returns Promise containing the workflow execution results
167
+ */
168
+ streamVNext(params: {
169
+ runId?: string;
170
+ inputData?: Record<string, any>;
171
+ requestContext?: RequestContext;
172
+ closeOnSuspend?: boolean;
173
+ tracingOptions?: TracingOptions;
174
+ }): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
175
+ /**
176
+ * Observes workflow vNext stream for a workflow run
177
+ * @param params - Object containing the runId
178
+ * @returns Promise containing the workflow execution results
179
+ */
180
+ observeStreamVNext(params: {
181
+ runId: string;
182
+ }): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
183
+ /**
184
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
185
+ * @param params - Object containing the runId, step, resumeData and requestContext
186
+ * @returns Promise containing the workflow resume results
187
+ */
188
+ resumeAsync(params: {
189
+ runId: string;
190
+ step?: string | string[];
191
+ resumeData?: Record<string, any>;
192
+ requestContext?: RequestContext | Record<string, any>;
193
+ tracingOptions?: TracingOptions;
194
+ }): Promise<WorkflowRunResult>;
195
+ /**
196
+ * Resumes a suspended workflow step that uses streamVNext asynchronously and returns a promise that resolves when the workflow is complete
197
+ * @param params - Object containing the runId, step, resumeData and requestContext
198
+ * @returns Promise containing the workflow resume results
199
+ */
200
+ resumeStreamVNext(params: {
201
+ runId: string;
202
+ step?: string | string[];
203
+ resumeData?: Record<string, any>;
204
+ requestContext?: RequestContext | Record<string, any>;
205
+ tracingOptions?: TracingOptions;
206
+ }): Promise<ReadableStream>;
207
+ /**
208
+ * Creates a new ReadableStream from an iterable or async iterable of objects,
209
+ * serializing each as JSON and separating them with the record separator (\x1E).
210
+ *
211
+ * @param records - An iterable or async iterable of objects to stream
212
+ * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
213
+ */
214
+ static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
215
+ }
216
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/resources/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,qCAAqC,EACrC,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAItC,qBAAa,QAAS,SAAQ,YAAY;IAGtC,OAAO,CAAC,UAAU;gBADlB,OAAO,EAAE,aAAa,EACd,UAAU,EAAE,MAAM;IAK5B;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI5F;;;;;OAKG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,sBAAsB,EAC/B,cAAc,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACpD,OAAO,CAAC,wBAAwB,CAAC;IAkCpC;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,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kB,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,cAAc;CAgBvF"}
@@ -0,0 +1,22 @@
1
+ import type { ToolExecutionOptions } from 'ai';
2
+ import type { z } from 'zod';
3
+ export interface ClientToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> {
4
+ context: TSchemaIn extends z.ZodSchema ? z.infer<TSchemaIn> : unknown;
5
+ }
6
+ export interface ClientToolAction<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined> {
7
+ id: string;
8
+ description: string;
9
+ inputSchema?: TSchemaIn;
10
+ outputSchema?: TSchemaOut;
11
+ execute?: (context: ClientToolExecutionContext<TSchemaIn>, options?: ToolExecutionOptions) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
12
+ }
13
+ export declare class ClientTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined> implements ClientToolAction<TSchemaIn, TSchemaOut> {
14
+ id: string;
15
+ description: string;
16
+ inputSchema?: TSchemaIn;
17
+ outputSchema?: TSchemaOut;
18
+ execute?: ClientToolAction<TSchemaIn, TSchemaOut>['execute'];
19
+ constructor(opts: ClientToolAction<TSchemaIn, TSchemaOut>);
20
+ }
21
+ export declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined>(opts: ClientToolAction<TSchemaIn, TSchemaOut>): ClientTool<TSchemaIn, TSchemaOut>;
22
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,MAAM,WAAW,0BAA0B,CAA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