@mastra/client-js 0.0.0-fix-fetching-workflow-snapshots-20250625000954 → 0.0.0-fix-traces-pagination-plus-share-for-cloud-20250717084908
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +283 -2
- package/LICENSE.md +11 -42
- package/dist/index.cjs +468 -324
- package/dist/index.d.cts +119 -39
- package/dist/index.d.ts +119 -39
- package/dist/index.js +469 -325
- package/package.json +6 -5
- package/src/client.ts +48 -2
- package/src/example.ts +45 -17
- package/src/resources/agent.ts +382 -317
- package/src/resources/base.ts +1 -0
- package/src/resources/vNextNetwork.ts +51 -4
- package/src/resources/workflow.ts +34 -6
- package/src/types.ts +31 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
|
-
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
+
import { processDataStream, processTextStream } from '@ai-sdk/ui-utils';
|
|
4
4
|
import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn } from '@mastra/core';
|
|
5
5
|
import { JSONSchema7 } from 'json-schema';
|
|
6
6
|
import { ZodSchema } from 'zod';
|
|
@@ -23,13 +23,14 @@ interface ClientOptions {
|
|
|
23
23
|
maxBackoffMs?: number;
|
|
24
24
|
/** Custom headers to include with requests */
|
|
25
25
|
headers?: Record<string, string>;
|
|
26
|
+
/** Abort signal for request */
|
|
27
|
+
abortSignal?: AbortSignal;
|
|
26
28
|
}
|
|
27
29
|
interface RequestOptions {
|
|
28
30
|
method?: string;
|
|
29
31
|
headers?: Record<string, string>;
|
|
30
32
|
body?: any;
|
|
31
33
|
stream?: boolean;
|
|
32
|
-
signal?: AbortSignal;
|
|
33
34
|
}
|
|
34
35
|
type WithoutMethods<T> = {
|
|
35
36
|
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
@@ -52,14 +53,14 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
|
|
|
52
53
|
experimental_output?: T;
|
|
53
54
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
54
55
|
clientTools?: ToolsInput;
|
|
55
|
-
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
|
|
56
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
56
57
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
57
58
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
58
59
|
output?: T;
|
|
59
60
|
experimental_output?: T;
|
|
60
61
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
61
62
|
clientTools?: ToolsInput;
|
|
62
|
-
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
|
|
63
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
63
64
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
64
65
|
evals: any[];
|
|
65
66
|
instructions: string;
|
|
@@ -114,6 +115,17 @@ interface GetWorkflowResponse {
|
|
|
114
115
|
suspendSchema: string;
|
|
115
116
|
};
|
|
116
117
|
};
|
|
118
|
+
allSteps: {
|
|
119
|
+
[key: string]: {
|
|
120
|
+
id: string;
|
|
121
|
+
description: string;
|
|
122
|
+
inputSchema: string;
|
|
123
|
+
outputSchema: string;
|
|
124
|
+
resumeSchema: string;
|
|
125
|
+
suspendSchema: string;
|
|
126
|
+
isWorkflow: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
117
129
|
stepGraph: Workflow$1['serializedStepGraph'];
|
|
118
130
|
inputSchema: string;
|
|
119
131
|
outputSchema: string;
|
|
@@ -306,6 +318,10 @@ interface GetVNextNetworkResponse {
|
|
|
306
318
|
inputSchema: string | undefined;
|
|
307
319
|
outputSchema: string | undefined;
|
|
308
320
|
}>;
|
|
321
|
+
tools: Array<{
|
|
322
|
+
id: string;
|
|
323
|
+
description: string;
|
|
324
|
+
}>;
|
|
309
325
|
}
|
|
310
326
|
interface GenerateVNextNetworkResponse {
|
|
311
327
|
task: string;
|
|
@@ -317,6 +333,14 @@ interface GenerateOrStreamVNextNetworkParams {
|
|
|
317
333
|
message: string;
|
|
318
334
|
threadId?: string;
|
|
319
335
|
resourceId?: string;
|
|
336
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
337
|
+
}
|
|
338
|
+
interface LoopStreamVNextNetworkParams {
|
|
339
|
+
message: string;
|
|
340
|
+
threadId?: string;
|
|
341
|
+
resourceId?: string;
|
|
342
|
+
maxIterations?: number;
|
|
343
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
320
344
|
}
|
|
321
345
|
interface LoopVNextNetworkResponse {
|
|
322
346
|
status: 'success';
|
|
@@ -418,18 +442,19 @@ declare class Agent extends BaseResource {
|
|
|
418
442
|
experimental_output: T;
|
|
419
443
|
}): Promise<GenerateReturn<T>>;
|
|
420
444
|
private processChatResponse;
|
|
445
|
+
/**
|
|
446
|
+
* Processes the stream response and handles tool calls
|
|
447
|
+
*/
|
|
448
|
+
private processStreamResponse;
|
|
421
449
|
/**
|
|
422
450
|
* Streams a response from the agent
|
|
423
451
|
* @param params - Stream parameters including prompt
|
|
424
|
-
* @returns Promise containing the enhanced Response object with processDataStream
|
|
452
|
+
* @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
|
|
425
453
|
*/
|
|
426
454
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
427
455
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
456
|
+
processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
|
|
428
457
|
}>;
|
|
429
|
-
/**
|
|
430
|
-
* Processes the stream response and handles tool calls
|
|
431
|
-
*/
|
|
432
|
-
private processStreamResponse;
|
|
433
458
|
/**
|
|
434
459
|
* Gets details about a specific tool available to the agent
|
|
435
460
|
* @param toolId - ID of the tool to retrieve
|
|
@@ -697,6 +722,26 @@ declare class Workflow extends BaseResource {
|
|
|
697
722
|
* @returns Promise containing the workflow run execution result
|
|
698
723
|
*/
|
|
699
724
|
runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
725
|
+
/**
|
|
726
|
+
* Cancels a specific workflow run by its ID
|
|
727
|
+
* @param runId - The ID of the workflow run to cancel
|
|
728
|
+
* @returns Promise containing a success message
|
|
729
|
+
*/
|
|
730
|
+
cancelRun(runId: string): Promise<{
|
|
731
|
+
message: string;
|
|
732
|
+
}>;
|
|
733
|
+
/**
|
|
734
|
+
* Sends an event to a specific workflow run by its ID
|
|
735
|
+
* @param params - Object containing the runId, event and data
|
|
736
|
+
* @returns Promise containing a success message
|
|
737
|
+
*/
|
|
738
|
+
sendRunEvent(params: {
|
|
739
|
+
runId: string;
|
|
740
|
+
event: string;
|
|
741
|
+
data: unknown;
|
|
742
|
+
}): Promise<{
|
|
743
|
+
message: string;
|
|
744
|
+
}>;
|
|
700
745
|
/**
|
|
701
746
|
* Creates a new workflow run
|
|
702
747
|
* @param params - Optional object containing the optional runId
|
|
@@ -751,7 +796,10 @@ declare class Workflow extends BaseResource {
|
|
|
751
796
|
runId?: string;
|
|
752
797
|
inputData: Record<string, any>;
|
|
753
798
|
runtimeContext?: RuntimeContext;
|
|
754
|
-
}): Promise<stream_web.ReadableStream<
|
|
799
|
+
}): Promise<stream_web.ReadableStream<{
|
|
800
|
+
type: string;
|
|
801
|
+
payload: any;
|
|
802
|
+
}>>;
|
|
755
803
|
/**
|
|
756
804
|
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
757
805
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
@@ -846,6 +894,36 @@ declare class MCPTool extends BaseResource {
|
|
|
846
894
|
}): Promise<any>;
|
|
847
895
|
}
|
|
848
896
|
|
|
897
|
+
declare class NetworkMemoryThread extends BaseResource {
|
|
898
|
+
private threadId;
|
|
899
|
+
private networkId;
|
|
900
|
+
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
901
|
+
/**
|
|
902
|
+
* Retrieves the memory thread details
|
|
903
|
+
* @returns Promise containing thread details including title and metadata
|
|
904
|
+
*/
|
|
905
|
+
get(): Promise<StorageThreadType>;
|
|
906
|
+
/**
|
|
907
|
+
* Updates the memory thread properties
|
|
908
|
+
* @param params - Update parameters including title and metadata
|
|
909
|
+
* @returns Promise containing updated thread details
|
|
910
|
+
*/
|
|
911
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
912
|
+
/**
|
|
913
|
+
* Deletes the memory thread
|
|
914
|
+
* @returns Promise containing deletion result
|
|
915
|
+
*/
|
|
916
|
+
delete(): Promise<{
|
|
917
|
+
result: string;
|
|
918
|
+
}>;
|
|
919
|
+
/**
|
|
920
|
+
* Retrieves messages associated with the thread
|
|
921
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
922
|
+
* @returns Promise containing thread messages and UI messages
|
|
923
|
+
*/
|
|
924
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
925
|
+
}
|
|
926
|
+
|
|
849
927
|
declare class VNextNetwork extends BaseResource {
|
|
850
928
|
private networkId;
|
|
851
929
|
constructor(options: ClientOptions, networkId: string);
|
|
@@ -867,6 +945,7 @@ declare class VNextNetwork extends BaseResource {
|
|
|
867
945
|
*/
|
|
868
946
|
loop(params: {
|
|
869
947
|
message: string;
|
|
948
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
870
949
|
}): Promise<LoopVNextNetworkResponse>;
|
|
871
950
|
private streamProcessor;
|
|
872
951
|
/**
|
|
@@ -875,36 +954,12 @@ declare class VNextNetwork extends BaseResource {
|
|
|
875
954
|
* @returns Promise containing the results
|
|
876
955
|
*/
|
|
877
956
|
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
declare class NetworkMemoryThread extends BaseResource {
|
|
881
|
-
private threadId;
|
|
882
|
-
private networkId;
|
|
883
|
-
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
884
957
|
/**
|
|
885
|
-
*
|
|
886
|
-
* @
|
|
887
|
-
|
|
888
|
-
get(): Promise<StorageThreadType>;
|
|
889
|
-
/**
|
|
890
|
-
* Updates the memory thread properties
|
|
891
|
-
* @param params - Update parameters including title and metadata
|
|
892
|
-
* @returns Promise containing updated thread details
|
|
893
|
-
*/
|
|
894
|
-
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
895
|
-
/**
|
|
896
|
-
* Deletes the memory thread
|
|
897
|
-
* @returns Promise containing deletion result
|
|
898
|
-
*/
|
|
899
|
-
delete(): Promise<{
|
|
900
|
-
result: string;
|
|
901
|
-
}>;
|
|
902
|
-
/**
|
|
903
|
-
* Retrieves messages associated with the thread
|
|
904
|
-
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
905
|
-
* @returns Promise containing thread messages and UI messages
|
|
958
|
+
* Streams a response from the v-next network loop
|
|
959
|
+
* @param params - Stream parameters including message
|
|
960
|
+
* @returns Promise containing the results
|
|
906
961
|
*/
|
|
907
|
-
|
|
962
|
+
loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
908
963
|
}
|
|
909
964
|
|
|
910
965
|
declare class MastraClient extends BaseResource {
|
|
@@ -1109,6 +1164,31 @@ declare class MastraClient extends BaseResource {
|
|
|
1109
1164
|
* @returns A2A client instance
|
|
1110
1165
|
*/
|
|
1111
1166
|
getA2A(agentId: string): A2A;
|
|
1167
|
+
/**
|
|
1168
|
+
* Retrieves the working memory for a specific thread (optionally resource-scoped).
|
|
1169
|
+
* @param agentId - ID of the agent.
|
|
1170
|
+
* @param threadId - ID of the thread.
|
|
1171
|
+
* @param resourceId - Optional ID of the resource.
|
|
1172
|
+
* @returns Working memory for the specified thread or resource.
|
|
1173
|
+
*/
|
|
1174
|
+
getWorkingMemory({ agentId, threadId, resourceId, }: {
|
|
1175
|
+
agentId: string;
|
|
1176
|
+
threadId: string;
|
|
1177
|
+
resourceId?: string;
|
|
1178
|
+
}): Promise<unknown>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Updates the working memory for a specific thread (optionally resource-scoped).
|
|
1181
|
+
* @param agentId - ID of the agent.
|
|
1182
|
+
* @param threadId - ID of the thread.
|
|
1183
|
+
* @param workingMemory - The new working memory content.
|
|
1184
|
+
* @param resourceId - Optional ID of the resource.
|
|
1185
|
+
*/
|
|
1186
|
+
updateWorkingMemory({ agentId, threadId, workingMemory, resourceId, }: {
|
|
1187
|
+
agentId: string;
|
|
1188
|
+
threadId: string;
|
|
1189
|
+
workingMemory: string;
|
|
1190
|
+
resourceId?: string;
|
|
1191
|
+
}): Promise<unknown>;
|
|
1112
1192
|
}
|
|
1113
1193
|
|
|
1114
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|
|
1194
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
|
-
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
+
import { processDataStream, processTextStream } from '@ai-sdk/ui-utils';
|
|
4
4
|
import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn } from '@mastra/core';
|
|
5
5
|
import { JSONSchema7 } from 'json-schema';
|
|
6
6
|
import { ZodSchema } from 'zod';
|
|
@@ -23,13 +23,14 @@ interface ClientOptions {
|
|
|
23
23
|
maxBackoffMs?: number;
|
|
24
24
|
/** Custom headers to include with requests */
|
|
25
25
|
headers?: Record<string, string>;
|
|
26
|
+
/** Abort signal for request */
|
|
27
|
+
abortSignal?: AbortSignal;
|
|
26
28
|
}
|
|
27
29
|
interface RequestOptions {
|
|
28
30
|
method?: string;
|
|
29
31
|
headers?: Record<string, string>;
|
|
30
32
|
body?: any;
|
|
31
33
|
stream?: boolean;
|
|
32
|
-
signal?: AbortSignal;
|
|
33
34
|
}
|
|
34
35
|
type WithoutMethods<T> = {
|
|
35
36
|
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
@@ -52,14 +53,14 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
|
|
|
52
53
|
experimental_output?: T;
|
|
53
54
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
54
55
|
clientTools?: ToolsInput;
|
|
55
|
-
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
|
|
56
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
56
57
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
57
58
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
58
59
|
output?: T;
|
|
59
60
|
experimental_output?: T;
|
|
60
61
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
61
62
|
clientTools?: ToolsInput;
|
|
62
|
-
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
|
|
63
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
63
64
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
64
65
|
evals: any[];
|
|
65
66
|
instructions: string;
|
|
@@ -114,6 +115,17 @@ interface GetWorkflowResponse {
|
|
|
114
115
|
suspendSchema: string;
|
|
115
116
|
};
|
|
116
117
|
};
|
|
118
|
+
allSteps: {
|
|
119
|
+
[key: string]: {
|
|
120
|
+
id: string;
|
|
121
|
+
description: string;
|
|
122
|
+
inputSchema: string;
|
|
123
|
+
outputSchema: string;
|
|
124
|
+
resumeSchema: string;
|
|
125
|
+
suspendSchema: string;
|
|
126
|
+
isWorkflow: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
117
129
|
stepGraph: Workflow$1['serializedStepGraph'];
|
|
118
130
|
inputSchema: string;
|
|
119
131
|
outputSchema: string;
|
|
@@ -306,6 +318,10 @@ interface GetVNextNetworkResponse {
|
|
|
306
318
|
inputSchema: string | undefined;
|
|
307
319
|
outputSchema: string | undefined;
|
|
308
320
|
}>;
|
|
321
|
+
tools: Array<{
|
|
322
|
+
id: string;
|
|
323
|
+
description: string;
|
|
324
|
+
}>;
|
|
309
325
|
}
|
|
310
326
|
interface GenerateVNextNetworkResponse {
|
|
311
327
|
task: string;
|
|
@@ -317,6 +333,14 @@ interface GenerateOrStreamVNextNetworkParams {
|
|
|
317
333
|
message: string;
|
|
318
334
|
threadId?: string;
|
|
319
335
|
resourceId?: string;
|
|
336
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
337
|
+
}
|
|
338
|
+
interface LoopStreamVNextNetworkParams {
|
|
339
|
+
message: string;
|
|
340
|
+
threadId?: string;
|
|
341
|
+
resourceId?: string;
|
|
342
|
+
maxIterations?: number;
|
|
343
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
320
344
|
}
|
|
321
345
|
interface LoopVNextNetworkResponse {
|
|
322
346
|
status: 'success';
|
|
@@ -418,18 +442,19 @@ declare class Agent extends BaseResource {
|
|
|
418
442
|
experimental_output: T;
|
|
419
443
|
}): Promise<GenerateReturn<T>>;
|
|
420
444
|
private processChatResponse;
|
|
445
|
+
/**
|
|
446
|
+
* Processes the stream response and handles tool calls
|
|
447
|
+
*/
|
|
448
|
+
private processStreamResponse;
|
|
421
449
|
/**
|
|
422
450
|
* Streams a response from the agent
|
|
423
451
|
* @param params - Stream parameters including prompt
|
|
424
|
-
* @returns Promise containing the enhanced Response object with processDataStream
|
|
452
|
+
* @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
|
|
425
453
|
*/
|
|
426
454
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
427
455
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
456
|
+
processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
|
|
428
457
|
}>;
|
|
429
|
-
/**
|
|
430
|
-
* Processes the stream response and handles tool calls
|
|
431
|
-
*/
|
|
432
|
-
private processStreamResponse;
|
|
433
458
|
/**
|
|
434
459
|
* Gets details about a specific tool available to the agent
|
|
435
460
|
* @param toolId - ID of the tool to retrieve
|
|
@@ -697,6 +722,26 @@ declare class Workflow extends BaseResource {
|
|
|
697
722
|
* @returns Promise containing the workflow run execution result
|
|
698
723
|
*/
|
|
699
724
|
runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
725
|
+
/**
|
|
726
|
+
* Cancels a specific workflow run by its ID
|
|
727
|
+
* @param runId - The ID of the workflow run to cancel
|
|
728
|
+
* @returns Promise containing a success message
|
|
729
|
+
*/
|
|
730
|
+
cancelRun(runId: string): Promise<{
|
|
731
|
+
message: string;
|
|
732
|
+
}>;
|
|
733
|
+
/**
|
|
734
|
+
* Sends an event to a specific workflow run by its ID
|
|
735
|
+
* @param params - Object containing the runId, event and data
|
|
736
|
+
* @returns Promise containing a success message
|
|
737
|
+
*/
|
|
738
|
+
sendRunEvent(params: {
|
|
739
|
+
runId: string;
|
|
740
|
+
event: string;
|
|
741
|
+
data: unknown;
|
|
742
|
+
}): Promise<{
|
|
743
|
+
message: string;
|
|
744
|
+
}>;
|
|
700
745
|
/**
|
|
701
746
|
* Creates a new workflow run
|
|
702
747
|
* @param params - Optional object containing the optional runId
|
|
@@ -751,7 +796,10 @@ declare class Workflow extends BaseResource {
|
|
|
751
796
|
runId?: string;
|
|
752
797
|
inputData: Record<string, any>;
|
|
753
798
|
runtimeContext?: RuntimeContext;
|
|
754
|
-
}): Promise<stream_web.ReadableStream<
|
|
799
|
+
}): Promise<stream_web.ReadableStream<{
|
|
800
|
+
type: string;
|
|
801
|
+
payload: any;
|
|
802
|
+
}>>;
|
|
755
803
|
/**
|
|
756
804
|
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
757
805
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
@@ -846,6 +894,36 @@ declare class MCPTool extends BaseResource {
|
|
|
846
894
|
}): Promise<any>;
|
|
847
895
|
}
|
|
848
896
|
|
|
897
|
+
declare class NetworkMemoryThread extends BaseResource {
|
|
898
|
+
private threadId;
|
|
899
|
+
private networkId;
|
|
900
|
+
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
901
|
+
/**
|
|
902
|
+
* Retrieves the memory thread details
|
|
903
|
+
* @returns Promise containing thread details including title and metadata
|
|
904
|
+
*/
|
|
905
|
+
get(): Promise<StorageThreadType>;
|
|
906
|
+
/**
|
|
907
|
+
* Updates the memory thread properties
|
|
908
|
+
* @param params - Update parameters including title and metadata
|
|
909
|
+
* @returns Promise containing updated thread details
|
|
910
|
+
*/
|
|
911
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
912
|
+
/**
|
|
913
|
+
* Deletes the memory thread
|
|
914
|
+
* @returns Promise containing deletion result
|
|
915
|
+
*/
|
|
916
|
+
delete(): Promise<{
|
|
917
|
+
result: string;
|
|
918
|
+
}>;
|
|
919
|
+
/**
|
|
920
|
+
* Retrieves messages associated with the thread
|
|
921
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
922
|
+
* @returns Promise containing thread messages and UI messages
|
|
923
|
+
*/
|
|
924
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
925
|
+
}
|
|
926
|
+
|
|
849
927
|
declare class VNextNetwork extends BaseResource {
|
|
850
928
|
private networkId;
|
|
851
929
|
constructor(options: ClientOptions, networkId: string);
|
|
@@ -867,6 +945,7 @@ declare class VNextNetwork extends BaseResource {
|
|
|
867
945
|
*/
|
|
868
946
|
loop(params: {
|
|
869
947
|
message: string;
|
|
948
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
870
949
|
}): Promise<LoopVNextNetworkResponse>;
|
|
871
950
|
private streamProcessor;
|
|
872
951
|
/**
|
|
@@ -875,36 +954,12 @@ declare class VNextNetwork extends BaseResource {
|
|
|
875
954
|
* @returns Promise containing the results
|
|
876
955
|
*/
|
|
877
956
|
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
declare class NetworkMemoryThread extends BaseResource {
|
|
881
|
-
private threadId;
|
|
882
|
-
private networkId;
|
|
883
|
-
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
884
957
|
/**
|
|
885
|
-
*
|
|
886
|
-
* @
|
|
887
|
-
|
|
888
|
-
get(): Promise<StorageThreadType>;
|
|
889
|
-
/**
|
|
890
|
-
* Updates the memory thread properties
|
|
891
|
-
* @param params - Update parameters including title and metadata
|
|
892
|
-
* @returns Promise containing updated thread details
|
|
893
|
-
*/
|
|
894
|
-
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
895
|
-
/**
|
|
896
|
-
* Deletes the memory thread
|
|
897
|
-
* @returns Promise containing deletion result
|
|
898
|
-
*/
|
|
899
|
-
delete(): Promise<{
|
|
900
|
-
result: string;
|
|
901
|
-
}>;
|
|
902
|
-
/**
|
|
903
|
-
* Retrieves messages associated with the thread
|
|
904
|
-
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
905
|
-
* @returns Promise containing thread messages and UI messages
|
|
958
|
+
* Streams a response from the v-next network loop
|
|
959
|
+
* @param params - Stream parameters including message
|
|
960
|
+
* @returns Promise containing the results
|
|
906
961
|
*/
|
|
907
|
-
|
|
962
|
+
loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
908
963
|
}
|
|
909
964
|
|
|
910
965
|
declare class MastraClient extends BaseResource {
|
|
@@ -1109,6 +1164,31 @@ declare class MastraClient extends BaseResource {
|
|
|
1109
1164
|
* @returns A2A client instance
|
|
1110
1165
|
*/
|
|
1111
1166
|
getA2A(agentId: string): A2A;
|
|
1167
|
+
/**
|
|
1168
|
+
* Retrieves the working memory for a specific thread (optionally resource-scoped).
|
|
1169
|
+
* @param agentId - ID of the agent.
|
|
1170
|
+
* @param threadId - ID of the thread.
|
|
1171
|
+
* @param resourceId - Optional ID of the resource.
|
|
1172
|
+
* @returns Working memory for the specified thread or resource.
|
|
1173
|
+
*/
|
|
1174
|
+
getWorkingMemory({ agentId, threadId, resourceId, }: {
|
|
1175
|
+
agentId: string;
|
|
1176
|
+
threadId: string;
|
|
1177
|
+
resourceId?: string;
|
|
1178
|
+
}): Promise<unknown>;
|
|
1179
|
+
/**
|
|
1180
|
+
* Updates the working memory for a specific thread (optionally resource-scoped).
|
|
1181
|
+
* @param agentId - ID of the agent.
|
|
1182
|
+
* @param threadId - ID of the thread.
|
|
1183
|
+
* @param workingMemory - The new working memory content.
|
|
1184
|
+
* @param resourceId - Optional ID of the resource.
|
|
1185
|
+
*/
|
|
1186
|
+
updateWorkingMemory({ agentId, threadId, workingMemory, resourceId, }: {
|
|
1187
|
+
agentId: string;
|
|
1188
|
+
threadId: string;
|
|
1189
|
+
workingMemory: string;
|
|
1190
|
+
resourceId?: string;
|
|
1191
|
+
}): Promise<unknown>;
|
|
1112
1192
|
}
|
|
1113
1193
|
|
|
1114
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|
|
1194
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|