@mastra/client-js 1.0.0-beta.9 → 1.0.0
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.
- package/CHANGELOG.md +1638 -0
- package/README.md +1 -3
- package/dist/_types/@ai-sdk_ui-utils/dist/index.d.ts +820 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +8511 -0
- package/dist/client.d.ts +56 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/README.md +33 -0
- package/dist/docs/SKILL.md +34 -0
- package/dist/docs/SOURCE_MAP.json +6 -0
- package/dist/docs/ai-sdk/01-reference.md +358 -0
- package/dist/docs/client-js/01-reference.md +1180 -0
- package/dist/docs/server/01-mastra-client.md +256 -0
- package/dist/docs/server/02-jwt.md +99 -0
- package/dist/docs/server/03-clerk.md +143 -0
- package/dist/docs/server/04-supabase.md +128 -0
- package/dist/docs/server/05-firebase.md +286 -0
- package/dist/docs/server/06-workos.md +201 -0
- package/dist/docs/server/07-auth0.md +233 -0
- package/dist/index.cjs +1690 -596
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1688 -594
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +10 -26
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +43 -8
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/memory-thread.d.ts +18 -3
- package/dist/resources/memory-thread.d.ts.map +1 -1
- package/dist/resources/observability.d.ts +58 -15
- package/dist/resources/observability.d.ts.map +1 -1
- package/dist/resources/processor.d.ts +20 -0
- package/dist/resources/processor.d.ts.map +1 -0
- package/dist/resources/run.d.ts +210 -0
- package/dist/resources/run.d.ts.map +1 -0
- package/dist/resources/workflow.d.ts +19 -224
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +141 -36
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +13 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { TracingOptions } from '@mastra/core/observability';
|
|
2
1
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
3
|
-
import type { ClientOptions, GetWorkflowResponse, ListWorkflowRunsResponse, ListWorkflowRunsParams,
|
|
2
|
+
import type { ClientOptions, GetWorkflowResponse, ListWorkflowRunsResponse, ListWorkflowRunsParams, GetWorkflowRunByIdResponse } from '../types.js';
|
|
4
3
|
import { BaseResource } from './base.js';
|
|
4
|
+
import { Run } from './run.js';
|
|
5
5
|
export declare class Workflow extends BaseResource {
|
|
6
6
|
private workflowId;
|
|
7
7
|
constructor(options: ClientOptions, workflowId: string);
|
|
@@ -21,184 +21,35 @@ export declare class Workflow extends BaseResource {
|
|
|
21
21
|
/**
|
|
22
22
|
* Retrieves a specific workflow run by its ID
|
|
23
23
|
* @param runId - The ID of the workflow run to retrieve
|
|
24
|
-
* @param
|
|
25
|
-
* @
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
24
|
+
* @param options - Optional configuration
|
|
25
|
+
* @param options.requestContext - Optional request context to pass as query parameter
|
|
26
|
+
* @param options.fields - Optional array of fields to return (e.g., ['result', 'steps']). Available fields: result, error, payload, steps, activeStepsPath, serializedStepGraph. Metadata fields (runId, workflowName, resourceId, createdAt, updatedAt) and status are always included.
|
|
27
|
+
* @param options.withNestedWorkflows - Whether to include nested workflow data in steps. Defaults to true. Set to false for better performance when you don't need nested workflow details.
|
|
28
|
+
* @returns Promise containing the workflow run details with metadata and processed execution state
|
|
33
29
|
*/
|
|
34
|
-
|
|
30
|
+
runById(runId: string, options?: {
|
|
31
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
32
|
+
fields?: string[];
|
|
33
|
+
withNestedWorkflows?: boolean;
|
|
34
|
+
}): Promise<GetWorkflowRunByIdResponse>;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param runId - The ID of the workflow run to
|
|
36
|
+
* Deletes a specific workflow run by its ID
|
|
37
|
+
* @param runId - The ID of the workflow run to delete
|
|
38
38
|
* @returns Promise containing a success message
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
deleteRunById(runId: string): Promise<{
|
|
41
41
|
message: string;
|
|
42
42
|
}>;
|
|
43
43
|
/**
|
|
44
44
|
* Creates a new workflow run
|
|
45
45
|
* @param params - Optional object containing the optional runId
|
|
46
|
-
* @returns Promise containing the
|
|
46
|
+
* @returns Promise containing the Run instance
|
|
47
47
|
*/
|
|
48
48
|
createRun(params?: {
|
|
49
49
|
runId?: string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
inputData: Record<string, any>;
|
|
54
|
-
initialState?: Record<string, any>;
|
|
55
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
56
|
-
tracingOptions?: TracingOptions;
|
|
57
|
-
}) => Promise<{
|
|
58
|
-
message: string;
|
|
59
|
-
}>;
|
|
60
|
-
resume: (params: {
|
|
61
|
-
step?: string | string[];
|
|
62
|
-
resumeData?: Record<string, any>;
|
|
63
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
64
|
-
tracingOptions?: TracingOptions;
|
|
65
|
-
}) => Promise<{
|
|
66
|
-
message: string;
|
|
67
|
-
}>;
|
|
68
|
-
stream: (params: {
|
|
69
|
-
inputData: Record<string, any>;
|
|
70
|
-
initialState?: Record<string, any>;
|
|
71
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
72
|
-
}) => Promise<ReadableStream>;
|
|
73
|
-
startAsync: (params: {
|
|
74
|
-
inputData: Record<string, any>;
|
|
75
|
-
initialState?: Record<string, any>;
|
|
76
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
77
|
-
tracingOptions?: TracingOptions;
|
|
78
|
-
}) => Promise<WorkflowRunResult>;
|
|
79
|
-
resumeAsync: (params: {
|
|
80
|
-
step?: string | string[];
|
|
81
|
-
resumeData?: Record<string, any>;
|
|
82
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
83
|
-
tracingOptions?: TracingOptions;
|
|
84
|
-
}) => Promise<WorkflowRunResult>;
|
|
85
|
-
resumeStreamVNext: (params: {
|
|
86
|
-
step?: string | string[];
|
|
87
|
-
resumeData?: Record<string, any>;
|
|
88
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
89
|
-
}) => Promise<ReadableStream<StreamVNextChunkType>>;
|
|
90
|
-
}>;
|
|
91
|
-
/**
|
|
92
|
-
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
93
|
-
* @param params - Object containing the runId, inputData, initialState and requestContext
|
|
94
|
-
* @returns Promise containing success message
|
|
95
|
-
*/
|
|
96
|
-
start(params: {
|
|
97
|
-
runId: string;
|
|
98
|
-
inputData: Record<string, any>;
|
|
99
|
-
initialState?: Record<string, any>;
|
|
100
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
101
|
-
tracingOptions?: TracingOptions;
|
|
102
|
-
}): Promise<{
|
|
103
|
-
message: string;
|
|
104
|
-
}>;
|
|
105
|
-
/**
|
|
106
|
-
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
107
|
-
* @param params - Object containing the runId, step, resumeData and requestContext
|
|
108
|
-
* @returns Promise containing success message
|
|
109
|
-
*/
|
|
110
|
-
resume({ step, runId, resumeData, tracingOptions, ...rest }: {
|
|
111
|
-
step?: string | string[];
|
|
112
|
-
runId: string;
|
|
113
|
-
resumeData?: Record<string, any>;
|
|
114
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
115
|
-
tracingOptions?: TracingOptions;
|
|
116
|
-
}): Promise<{
|
|
117
|
-
message: string;
|
|
118
|
-
}>;
|
|
119
|
-
/**
|
|
120
|
-
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
121
|
-
* @param params - Object containing the optional runId, inputData, initialState and requestContext
|
|
122
|
-
* @returns Promise containing the workflow execution results
|
|
123
|
-
*/
|
|
124
|
-
startAsync(params: {
|
|
125
|
-
runId?: string;
|
|
126
|
-
inputData: Record<string, any>;
|
|
127
|
-
initialState?: Record<string, any>;
|
|
128
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
129
|
-
tracingOptions?: TracingOptions;
|
|
130
|
-
}): Promise<WorkflowRunResult>;
|
|
131
|
-
/**
|
|
132
|
-
* Starts a workflow run and returns a stream
|
|
133
|
-
* @param params - Object containing the optional runId, inputData, initialState and requestContext
|
|
134
|
-
* @returns Promise containing the workflow execution results
|
|
135
|
-
*/
|
|
136
|
-
stream(params: {
|
|
137
|
-
runId?: string;
|
|
138
|
-
inputData: Record<string, any>;
|
|
139
|
-
initialState?: Record<string, any>;
|
|
140
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
141
|
-
tracingOptions?: TracingOptions;
|
|
142
|
-
}): Promise<import("stream/web").ReadableStream<{
|
|
143
|
-
type: string;
|
|
144
|
-
payload: any;
|
|
145
|
-
}>>;
|
|
146
|
-
/**
|
|
147
|
-
* Observes workflow stream for a workflow run
|
|
148
|
-
* @param params - Object containing the runId
|
|
149
|
-
* @returns Promise containing the workflow execution results
|
|
150
|
-
*/
|
|
151
|
-
observeStream(params: {
|
|
152
|
-
runId: string;
|
|
153
|
-
}): Promise<import("stream/web").ReadableStream<{
|
|
154
|
-
type: string;
|
|
155
|
-
payload: any;
|
|
156
|
-
}>>;
|
|
157
|
-
/**
|
|
158
|
-
* Starts a workflow run and returns a stream
|
|
159
|
-
* @param params - Object containing the optional runId, inputData, initialState and requestContext
|
|
160
|
-
* @returns Promise containing the workflow execution results
|
|
161
|
-
*/
|
|
162
|
-
streamVNext(params: {
|
|
163
|
-
runId?: string;
|
|
164
|
-
inputData?: Record<string, any>;
|
|
165
|
-
initialState?: Record<string, any>;
|
|
166
|
-
requestContext?: RequestContext;
|
|
167
|
-
closeOnSuspend?: boolean;
|
|
168
|
-
tracingOptions?: TracingOptions;
|
|
169
|
-
}): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
|
|
170
|
-
/**
|
|
171
|
-
* Observes workflow vNext stream for a workflow run
|
|
172
|
-
* @param params - Object containing the runId
|
|
173
|
-
* @returns Promise containing the workflow execution results
|
|
174
|
-
*/
|
|
175
|
-
observeStreamVNext(params: {
|
|
176
|
-
runId: string;
|
|
177
|
-
}): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
|
|
178
|
-
/**
|
|
179
|
-
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
180
|
-
* @param params - Object containing the runId, step, resumeData and requestContext
|
|
181
|
-
* @returns Promise containing the workflow resume results
|
|
182
|
-
*/
|
|
183
|
-
resumeAsync(params: {
|
|
184
|
-
runId: string;
|
|
185
|
-
step?: string | string[];
|
|
186
|
-
resumeData?: Record<string, any>;
|
|
187
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
188
|
-
tracingOptions?: TracingOptions;
|
|
189
|
-
}): Promise<WorkflowRunResult>;
|
|
190
|
-
/**
|
|
191
|
-
* Resumes a suspended workflow step that uses streamVNext asynchronously and returns a promise that resolves when the workflow is complete
|
|
192
|
-
* @param params - Object containing the runId, step, resumeData and requestContext
|
|
193
|
-
* @returns Promise containing the workflow resume results
|
|
194
|
-
*/
|
|
195
|
-
resumeStreamVNext(params: {
|
|
196
|
-
runId: string;
|
|
197
|
-
step?: string | string[];
|
|
198
|
-
resumeData?: Record<string, any>;
|
|
199
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
200
|
-
tracingOptions?: TracingOptions;
|
|
201
|
-
}): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
|
|
50
|
+
resourceId?: string;
|
|
51
|
+
disableScorers?: boolean;
|
|
52
|
+
}): Promise<Run>;
|
|
202
53
|
/**
|
|
203
54
|
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
204
55
|
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
@@ -207,61 +58,5 @@ export declare class Workflow extends BaseResource {
|
|
|
207
58
|
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
208
59
|
*/
|
|
209
60
|
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
210
|
-
/**
|
|
211
|
-
* Restarts an active workflow run synchronously without waiting for the workflow to complete
|
|
212
|
-
* @param params - Object containing the runId and requestContext
|
|
213
|
-
* @returns Promise containing success message
|
|
214
|
-
*/
|
|
215
|
-
restart(params: {
|
|
216
|
-
runId: string;
|
|
217
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
218
|
-
tracingOptions?: TracingOptions;
|
|
219
|
-
}): Promise<{
|
|
220
|
-
message: string;
|
|
221
|
-
}>;
|
|
222
|
-
/**
|
|
223
|
-
* Restarts an active workflow run asynchronously
|
|
224
|
-
* @param params - Object containing the runId and requestContext
|
|
225
|
-
* @returns Promise containing the workflow restart results
|
|
226
|
-
*/
|
|
227
|
-
restartAsync(params: {
|
|
228
|
-
runId: string;
|
|
229
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
230
|
-
tracingOptions?: TracingOptions;
|
|
231
|
-
}): Promise<WorkflowRunResult>;
|
|
232
|
-
/**
|
|
233
|
-
* Restart all active workflow runs synchronously without waiting for the workflow to complete
|
|
234
|
-
* @returns Promise containing success message
|
|
235
|
-
*/
|
|
236
|
-
restartAllActiveWorkflowRuns(): Promise<{
|
|
237
|
-
message: string;
|
|
238
|
-
}>;
|
|
239
|
-
/**
|
|
240
|
-
* Restart all active workflow runs asynchronously
|
|
241
|
-
* @returns Promise containing success message
|
|
242
|
-
*/
|
|
243
|
-
restartAllActiveWorkflowRunsAsync(): Promise<{
|
|
244
|
-
message: string;
|
|
245
|
-
}>;
|
|
246
|
-
/**
|
|
247
|
-
* Time travels a workflow run synchronously without waiting for the workflow to complete
|
|
248
|
-
* @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
249
|
-
* @returns Promise containing success message
|
|
250
|
-
*/
|
|
251
|
-
timeTravel({ runId, requestContext: paramsRequestContext, ...params }: TimeTravelParams): Promise<{
|
|
252
|
-
message: string;
|
|
253
|
-
}>;
|
|
254
|
-
/**
|
|
255
|
-
* Time travels a workflow run asynchronously
|
|
256
|
-
* @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
257
|
-
* @returns Promise containing the workflow time travel results
|
|
258
|
-
*/
|
|
259
|
-
timeTravelAsync({ runId, requestContext: paramsRequestContext, ...params }: TimeTravelParams): Promise<WorkflowRunResult>;
|
|
260
|
-
/**
|
|
261
|
-
* Time travels a workflow run and returns a stream
|
|
262
|
-
* @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
263
|
-
* @returns Promise containing the workflow execution results
|
|
264
|
-
*/
|
|
265
|
-
timeTravelStream({ runId, requestContext: paramsRequestContext, ...params }: TimeTravelParams): Promise<import("stream/web").ReadableStream<StreamVNextChunkType>>;
|
|
266
61
|
}
|
|
267
62
|
//# sourceMappingURL=workflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/resources/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/resources/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC3B,MAAM,UAAU,CAAC;AAGlB,OA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4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ToolCallOptions } from './_types/@internal_ai-sdk-v5/dist/index.js';
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
export interface ClientToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> {
|
|
4
4
|
context: TSchemaIn extends z.ZodSchema ? z.infer<TSchemaIn> : unknown;
|
|
@@ -8,7 +8,7 @@ export interface ClientToolAction<TSchemaIn extends z.ZodSchema | undefined = un
|
|
|
8
8
|
description: string;
|
|
9
9
|
inputSchema?: TSchemaIn;
|
|
10
10
|
outputSchema?: TSchemaOut;
|
|
11
|
-
execute?: (context: ClientToolExecutionContext<TSchemaIn>, options?:
|
|
11
|
+
execute?: (context: ClientToolExecutionContext<TSchemaIn>, options?: ToolCallOptions) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
12
12
|
}
|
|
13
13
|
export declare class ClientTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined> implements ClientToolAction<TSchemaIn, TSchemaOut> {
|
|
14
14
|
id: string;
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,MAAM,WAAW,0BAA0B,CAAC,SAAS,SAAS,CAAC,CAAC,SAAS,GAAG,SAAS,GAAG,SAAS;IAC/F,OAAO,EAAE,SAAS,SAAS,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;C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package/dist/types.d.ts
CHANGED
|
@@ -7,10 +7,9 @@ import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
|
|
|
7
7
|
import type { AiMessageType, MastraMessageV1, MastraDBMessage, MemoryConfig, StorageThreadType } from '@mastra/core/memory';
|
|
8
8
|
import type { TracingOptions } from '@mastra/core/observability';
|
|
9
9
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
10
|
-
import type {
|
|
11
|
-
import type { OutputSchema } from '@mastra/core/stream';
|
|
10
|
+
import type { PaginationInfo, WorkflowRuns, StorageListMessagesInput } from '@mastra/core/storage';
|
|
12
11
|
import type { QueryResult } from '@mastra/core/vector';
|
|
13
|
-
import type { TimeTravelContext, Workflow, WorkflowResult, WorkflowState } from '@mastra/core/workflows';
|
|
12
|
+
import type { TimeTravelContext, Workflow, WorkflowResult, WorkflowRunStatus, WorkflowState } from '@mastra/core/workflows';
|
|
14
13
|
import type { JSONSchema7 } from 'json-schema';
|
|
15
14
|
import type { ZodSchema } from 'zod';
|
|
16
15
|
export interface ClientOptions {
|
|
@@ -72,6 +71,14 @@ export interface GetAgentResponse {
|
|
|
72
71
|
modelVersion: string;
|
|
73
72
|
};
|
|
74
73
|
}> | undefined;
|
|
74
|
+
inputProcessors?: Array<{
|
|
75
|
+
id: string;
|
|
76
|
+
name: string;
|
|
77
|
+
}>;
|
|
78
|
+
outputProcessors?: Array<{
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
}>;
|
|
75
82
|
defaultOptions: WithoutMethods<AgentExecutionOptions>;
|
|
76
83
|
defaultGenerateOptionsLegacy: WithoutMethods<AgentGenerateOptions>;
|
|
77
84
|
defaultStreamOptionsLegacy: WithoutMethods<AgentStreamOptions>;
|
|
@@ -90,13 +97,19 @@ export type StreamLegacyParams<T extends JSONSchema7 | ZodSchema | undefined = u
|
|
|
90
97
|
requestContext?: RequestContext | Record<string, any>;
|
|
91
98
|
clientTools?: ToolsInput;
|
|
92
99
|
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'requestContext' | 'clientTools' | 'abortSignal'>>;
|
|
93
|
-
export type
|
|
94
|
-
messages: MessageListInput;
|
|
100
|
+
export type StreamParamsBase<OUTPUT = undefined> = {
|
|
95
101
|
tracingOptions?: TracingOptions;
|
|
96
|
-
|
|
97
|
-
requestContext?: RequestContext | Record<string, any>;
|
|
102
|
+
requestContext?: RequestContext;
|
|
98
103
|
clientTools?: ToolsInput;
|
|
99
104
|
} & WithoutMethods<Omit<AgentExecutionOptions<OUTPUT>, 'requestContext' | 'clientTools' | 'options' | 'abortSignal' | 'structuredOutput'>>;
|
|
105
|
+
export type StreamParamsBaseWithoutMessages<OUTPUT = undefined> = StreamParamsBase<OUTPUT>;
|
|
106
|
+
export type StreamParams<OUTPUT = undefined> = StreamParamsBase<OUTPUT> & {
|
|
107
|
+
messages: MessageListInput;
|
|
108
|
+
} & (OUTPUT extends undefined ? {
|
|
109
|
+
structuredOutput?: never;
|
|
110
|
+
} : {
|
|
111
|
+
structuredOutput: SerializableStructuredOutputOptions<OUTPUT>;
|
|
112
|
+
});
|
|
100
113
|
export type UpdateModelParams = {
|
|
101
114
|
modelId: string;
|
|
102
115
|
provider: 'openai' | 'anthropic' | 'groq' | 'xai' | 'google';
|
|
@@ -125,14 +138,14 @@ export interface ListWorkflowRunsParams {
|
|
|
125
138
|
page?: number;
|
|
126
139
|
perPage?: number;
|
|
127
140
|
resourceId?: string;
|
|
141
|
+
status?: WorkflowRunStatus;
|
|
128
142
|
/** @deprecated Use page instead */
|
|
129
143
|
offset?: number;
|
|
130
144
|
/** @deprecated Use perPage instead */
|
|
131
145
|
limit?: number | false;
|
|
132
146
|
}
|
|
133
147
|
export type ListWorkflowRunsResponse = WorkflowRuns;
|
|
134
|
-
export type GetWorkflowRunByIdResponse =
|
|
135
|
-
export type GetWorkflowRunExecutionResultResponse = WorkflowState;
|
|
148
|
+
export type GetWorkflowRunByIdResponse = WorkflowState;
|
|
136
149
|
export interface GetWorkflowResponse {
|
|
137
150
|
name: string;
|
|
138
151
|
description?: string;
|
|
@@ -144,6 +157,7 @@ export interface GetWorkflowResponse {
|
|
|
144
157
|
outputSchema: string;
|
|
145
158
|
resumeSchema: string;
|
|
146
159
|
suspendSchema: string;
|
|
160
|
+
stateSchema: string;
|
|
147
161
|
};
|
|
148
162
|
};
|
|
149
163
|
allSteps: {
|
|
@@ -154,12 +168,16 @@ export interface GetWorkflowResponse {
|
|
|
154
168
|
outputSchema: string;
|
|
155
169
|
resumeSchema: string;
|
|
156
170
|
suspendSchema: string;
|
|
171
|
+
stateSchema: string;
|
|
157
172
|
isWorkflow: boolean;
|
|
158
173
|
};
|
|
159
174
|
};
|
|
160
175
|
stepGraph: Workflow['serializedStepGraph'];
|
|
161
176
|
inputSchema: string;
|
|
162
177
|
outputSchema: string;
|
|
178
|
+
stateSchema: string;
|
|
179
|
+
/** Whether this workflow is a processor workflow (auto-generated from agent processors) */
|
|
180
|
+
isProcessorWorkflow?: boolean;
|
|
163
181
|
}
|
|
164
182
|
export type WorkflowRunResult = WorkflowResult<any, any, any, any>;
|
|
165
183
|
export interface UpsertVectorParams {
|
|
@@ -210,8 +228,19 @@ export interface CreateMemoryThreadParams {
|
|
|
210
228
|
}
|
|
211
229
|
export type CreateMemoryThreadResponse = StorageThreadType;
|
|
212
230
|
export interface ListMemoryThreadsParams {
|
|
213
|
-
|
|
214
|
-
|
|
231
|
+
/**
|
|
232
|
+
* Optional resourceId to filter threads. When not provided, returns all threads.
|
|
233
|
+
*/
|
|
234
|
+
resourceId?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Optional metadata filter. Threads must match all specified key-value pairs (AND logic).
|
|
237
|
+
*/
|
|
238
|
+
metadata?: Record<string, unknown>;
|
|
239
|
+
/**
|
|
240
|
+
* Optional agentId. When not provided and storage is configured on the server,
|
|
241
|
+
* threads will be retrieved using storage directly.
|
|
242
|
+
*/
|
|
243
|
+
agentId?: string;
|
|
215
244
|
page?: number;
|
|
216
245
|
perPage?: number;
|
|
217
246
|
orderBy?: 'createdAt' | 'updatedAt';
|
|
@@ -238,6 +267,25 @@ export type ListMemoryThreadMessagesParams = Omit<StorageListMessagesInput, 'thr
|
|
|
238
267
|
export type ListMemoryThreadMessagesResponse = {
|
|
239
268
|
messages: MastraDBMessage[];
|
|
240
269
|
};
|
|
270
|
+
export interface CloneMemoryThreadParams {
|
|
271
|
+
newThreadId?: string;
|
|
272
|
+
resourceId?: string;
|
|
273
|
+
title?: string;
|
|
274
|
+
metadata?: Record<string, any>;
|
|
275
|
+
options?: {
|
|
276
|
+
messageLimit?: number;
|
|
277
|
+
messageFilter?: {
|
|
278
|
+
startDate?: Date;
|
|
279
|
+
endDate?: Date;
|
|
280
|
+
messageIds?: string[];
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
284
|
+
}
|
|
285
|
+
export type CloneMemoryThreadResponse = {
|
|
286
|
+
thread: StorageThreadType;
|
|
287
|
+
clonedMessages: MastraDBMessage[];
|
|
288
|
+
};
|
|
241
289
|
export interface GetLogsParams {
|
|
242
290
|
transportId: string;
|
|
243
291
|
fromDate?: Date;
|
|
@@ -340,11 +388,19 @@ export interface McpToolInfo {
|
|
|
340
388
|
export interface McpServerToolListResponse {
|
|
341
389
|
tools: McpToolInfo[];
|
|
342
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Client version of ScoreRowData with dates serialized as strings (from JSON)
|
|
393
|
+
*/
|
|
343
394
|
export type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
|
|
344
395
|
createdAt: string;
|
|
345
396
|
updatedAt: string;
|
|
346
|
-
}
|
|
347
|
-
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Response for listing scores (client version with serialized dates)
|
|
400
|
+
*/
|
|
401
|
+
export type ListScoresResponse = {
|
|
402
|
+
pagination: PaginationInfo;
|
|
403
|
+
scores: ClientScoreRowData[];
|
|
348
404
|
};
|
|
349
405
|
export interface ListScoresByRunIdParams {
|
|
350
406
|
runId: string;
|
|
@@ -364,24 +420,9 @@ export interface ListScoresByEntityIdParams {
|
|
|
364
420
|
page?: number;
|
|
365
421
|
perPage?: number;
|
|
366
422
|
}
|
|
367
|
-
export interface ListScoresBySpanParams {
|
|
368
|
-
traceId: string;
|
|
369
|
-
spanId: string;
|
|
370
|
-
page?: number;
|
|
371
|
-
perPage?: number;
|
|
372
|
-
}
|
|
373
423
|
export interface SaveScoreParams {
|
|
374
424
|
score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
|
|
375
425
|
}
|
|
376
|
-
export interface ListScoresResponse {
|
|
377
|
-
pagination: {
|
|
378
|
-
total: number;
|
|
379
|
-
page: number;
|
|
380
|
-
perPage: number;
|
|
381
|
-
hasMore: boolean;
|
|
382
|
-
};
|
|
383
|
-
scores: ClientScoreRowData[];
|
|
384
|
-
}
|
|
385
426
|
export interface SaveScoreResponse {
|
|
386
427
|
score: ClientScoreRowData;
|
|
387
428
|
}
|
|
@@ -406,13 +447,6 @@ export interface TemplateInstallationRequest {
|
|
|
406
447
|
/** Environment variables for template */
|
|
407
448
|
variables?: Record<string, string>;
|
|
408
449
|
}
|
|
409
|
-
export interface GetTraceResponse {
|
|
410
|
-
trace: TraceRecord;
|
|
411
|
-
}
|
|
412
|
-
export interface GetTracesResponse {
|
|
413
|
-
spans: SpanRecord[];
|
|
414
|
-
pagination: PaginationInfo;
|
|
415
|
-
}
|
|
416
450
|
export interface StreamVNextChunkType {
|
|
417
451
|
type: string;
|
|
418
452
|
payload: any;
|
|
@@ -449,7 +483,6 @@ export interface MemorySearchResult {
|
|
|
449
483
|
};
|
|
450
484
|
}
|
|
451
485
|
export interface TimeTravelParams {
|
|
452
|
-
runId: string;
|
|
453
486
|
step: string | string[];
|
|
454
487
|
inputData?: Record<string, any>;
|
|
455
488
|
resumeData?: Record<string, any>;
|
|
@@ -458,6 +491,7 @@ export interface TimeTravelParams {
|
|
|
458
491
|
nestedStepsContext?: Record<string, TimeTravelContext<any, any, any, any>>;
|
|
459
492
|
requestContext?: RequestContext | Record<string, any>;
|
|
460
493
|
tracingOptions?: TracingOptions;
|
|
494
|
+
perStep?: boolean;
|
|
461
495
|
}
|
|
462
496
|
/**
|
|
463
497
|
* Scorer config for stored agents
|
|
@@ -566,5 +600,76 @@ export interface Provider {
|
|
|
566
600
|
docUrl?: string;
|
|
567
601
|
models: string[];
|
|
568
602
|
}
|
|
603
|
+
export interface MastraPackage {
|
|
604
|
+
name: string;
|
|
605
|
+
version: string;
|
|
606
|
+
}
|
|
607
|
+
export interface GetSystemPackagesResponse {
|
|
608
|
+
packages: MastraPackage[];
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Processor phase types
|
|
612
|
+
*/
|
|
613
|
+
export type ProcessorPhase = 'input' | 'inputStep' | 'outputStream' | 'outputResult' | 'outputStep';
|
|
614
|
+
/**
|
|
615
|
+
* Processor configuration showing how it's attached to an agent
|
|
616
|
+
*/
|
|
617
|
+
export interface ProcessorConfiguration {
|
|
618
|
+
agentId: string;
|
|
619
|
+
agentName: string;
|
|
620
|
+
type: 'input' | 'output';
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Processor in list response
|
|
624
|
+
*/
|
|
625
|
+
export interface GetProcessorResponse {
|
|
626
|
+
id: string;
|
|
627
|
+
name?: string;
|
|
628
|
+
description?: string;
|
|
629
|
+
phases: ProcessorPhase[];
|
|
630
|
+
agentIds: string[];
|
|
631
|
+
isWorkflow: boolean;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Detailed processor response
|
|
635
|
+
*/
|
|
636
|
+
export interface GetProcessorDetailResponse {
|
|
637
|
+
id: string;
|
|
638
|
+
name?: string;
|
|
639
|
+
description?: string;
|
|
640
|
+
phases: ProcessorPhase[];
|
|
641
|
+
configurations: ProcessorConfiguration[];
|
|
642
|
+
isWorkflow: boolean;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Parameters for executing a processor
|
|
646
|
+
*/
|
|
647
|
+
export interface ExecuteProcessorParams {
|
|
648
|
+
phase: ProcessorPhase;
|
|
649
|
+
messages: MastraDBMessage[];
|
|
650
|
+
agentId?: string;
|
|
651
|
+
requestContext?: RequestContext | Record<string, any>;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Tripwire result from processor execution
|
|
655
|
+
*/
|
|
656
|
+
export interface ProcessorTripwireResult {
|
|
657
|
+
triggered: boolean;
|
|
658
|
+
reason?: string;
|
|
659
|
+
metadata?: unknown;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Response from processor execution
|
|
663
|
+
*/
|
|
664
|
+
export interface ExecuteProcessorResponse {
|
|
665
|
+
success: boolean;
|
|
666
|
+
phase: string;
|
|
667
|
+
messages?: MastraDBMessage[];
|
|
668
|
+
messageList?: {
|
|
669
|
+
messages: MastraDBMessage[];
|
|
670
|
+
};
|
|
671
|
+
tripwire?: ProcessorTripwireResult;
|
|
672
|
+
error?: string;
|
|
673
|
+
}
|
|
569
674
|
export {};
|
|
570
675
|
//# sourceMappingURL=types.d.ts.map
|