@mastra/client-js 0.0.0-afterToolExecute-20250414225911 → 0.0.0-agui-20250501182100
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 +247 -2
- package/dist/index.cjs +372 -4
- package/dist/index.d.cts +151 -6
- package/dist/index.d.ts +151 -6
- package/dist/index.js +372 -4
- package/package.json +9 -4
- package/src/adapters/agui.test.ts +167 -0
- package/src/adapters/agui.ts +219 -0
- package/src/client.ts +37 -9
- package/src/index.test.ts +4 -4
- package/src/resources/agent.ts +0 -1
- package/src/resources/base.ts +1 -1
- package/src/resources/index.ts +1 -0
- package/src/resources/memory-thread.ts +1 -8
- package/src/resources/network.ts +1 -1
- package/src/resources/tool.ts +9 -3
- package/src/resources/vnext-workflow.ts +234 -0
- package/src/resources/workflow.ts +10 -2
- package/src/types.ts +32 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { AbstractAgent, AgentConfig, RunAgentInput, BaseEvent } from '@ag-ui/client';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
1
3
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
2
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
4
|
+
import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
3
5
|
import { JSONSchema7 } from 'json-schema';
|
|
4
6
|
import { ZodSchema } from 'zod';
|
|
5
7
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
8
|
+
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
9
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
6
10
|
|
|
7
11
|
interface ClientOptions {
|
|
8
12
|
/** Base URL for API requests */
|
|
@@ -32,12 +36,15 @@ interface GetAgentResponse {
|
|
|
32
36
|
}
|
|
33
37
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
34
38
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
35
|
-
} & Partial<
|
|
39
|
+
} & Partial<AgentGenerateOptions<T>>;
|
|
36
40
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
41
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'
|
|
42
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
39
43
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
40
44
|
evals: any[];
|
|
45
|
+
instructions: string;
|
|
46
|
+
name: string;
|
|
47
|
+
id: string;
|
|
41
48
|
}
|
|
42
49
|
interface GetToolResponse {
|
|
43
50
|
id: string;
|
|
@@ -53,6 +60,7 @@ interface GetWorkflowResponse {
|
|
|
53
60
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
61
|
workflowId?: string;
|
|
55
62
|
}
|
|
63
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
56
64
|
type WorkflowRunResult = {
|
|
57
65
|
activePaths: Record<string, {
|
|
58
66
|
status: string;
|
|
@@ -63,6 +71,26 @@ type WorkflowRunResult = {
|
|
|
63
71
|
timestamp: number;
|
|
64
72
|
runId: string;
|
|
65
73
|
};
|
|
74
|
+
interface GetVNextWorkflowResponse {
|
|
75
|
+
name: string;
|
|
76
|
+
steps: {
|
|
77
|
+
[key: string]: {
|
|
78
|
+
id: string;
|
|
79
|
+
description: string;
|
|
80
|
+
inputSchema: string;
|
|
81
|
+
outputSchema: string;
|
|
82
|
+
resumeSchema: string;
|
|
83
|
+
suspendSchema: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
stepGraph: NewWorkflow['serializedStepGraph'];
|
|
87
|
+
inputSchema: string;
|
|
88
|
+
outputSchema: string;
|
|
89
|
+
}
|
|
90
|
+
type VNextWorkflowWatchResult = WatchEvent & {
|
|
91
|
+
runId: string;
|
|
92
|
+
};
|
|
93
|
+
type VNextWorkflowRunResult = WorkflowResult<any, any>;
|
|
66
94
|
interface UpsertVectorParams {
|
|
67
95
|
indexName: string;
|
|
68
96
|
vectors: number[][];
|
|
@@ -97,7 +125,7 @@ type SaveMessageToMemoryResponse = MessageType[];
|
|
|
97
125
|
interface CreateMemoryThreadParams {
|
|
98
126
|
title: string;
|
|
99
127
|
metadata: Record<string, any>;
|
|
100
|
-
|
|
128
|
+
resourceId: string;
|
|
101
129
|
threadId: string;
|
|
102
130
|
agentId: string;
|
|
103
131
|
}
|
|
@@ -110,7 +138,7 @@ type GetMemoryThreadResponse = StorageThreadType[];
|
|
|
110
138
|
interface UpdateMemoryThreadParams {
|
|
111
139
|
title: string;
|
|
112
140
|
metadata: Record<string, any>;
|
|
113
|
-
|
|
141
|
+
resourceId: string;
|
|
114
142
|
}
|
|
115
143
|
interface GetMemoryThreadMessagesResponse {
|
|
116
144
|
messages: CoreMessage[];
|
|
@@ -269,6 +297,18 @@ declare class Agent extends BaseResource {
|
|
|
269
297
|
liveEvals(): Promise<GetEvalsByAgentIdResponse>;
|
|
270
298
|
}
|
|
271
299
|
|
|
300
|
+
interface MastraAgentConfig extends AgentConfig {
|
|
301
|
+
agent: Agent;
|
|
302
|
+
agentId: string;
|
|
303
|
+
resourceId?: string;
|
|
304
|
+
}
|
|
305
|
+
declare class AGUIAdapter extends AbstractAgent {
|
|
306
|
+
agent: Agent;
|
|
307
|
+
resourceId?: string;
|
|
308
|
+
constructor({ agent, agentId, resourceId, ...rest }: MastraAgentConfig);
|
|
309
|
+
protected run(input: RunAgentInput): Observable<BaseEvent>;
|
|
310
|
+
}
|
|
311
|
+
|
|
272
312
|
declare class Network extends BaseResource {
|
|
273
313
|
private networkId;
|
|
274
314
|
constructor(options: ClientOptions, networkId: string);
|
|
@@ -376,6 +416,11 @@ declare class Workflow extends BaseResource {
|
|
|
376
416
|
* @returns Promise containing workflow details including steps and graphs
|
|
377
417
|
*/
|
|
378
418
|
details(): Promise<GetWorkflowResponse>;
|
|
419
|
+
/**
|
|
420
|
+
* Retrieves all runs for a workflow
|
|
421
|
+
* @returns Promise containing workflow runs array
|
|
422
|
+
*/
|
|
423
|
+
runs(): Promise<GetWorkflowRunsResponse>;
|
|
379
424
|
/**
|
|
380
425
|
* @deprecated Use `startAsync` instead
|
|
381
426
|
* Executes the workflow with the provided parameters
|
|
@@ -469,9 +514,97 @@ declare class Tool extends BaseResource {
|
|
|
469
514
|
*/
|
|
470
515
|
execute(params: {
|
|
471
516
|
data: any;
|
|
517
|
+
runId?: string;
|
|
472
518
|
}): Promise<any>;
|
|
473
519
|
}
|
|
474
520
|
|
|
521
|
+
declare class VNextWorkflow extends BaseResource {
|
|
522
|
+
private workflowId;
|
|
523
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
524
|
+
/**
|
|
525
|
+
* Creates an async generator that processes a readable stream and yields vNext workflow records
|
|
526
|
+
* separated by the Record Separator character (\x1E)
|
|
527
|
+
*
|
|
528
|
+
* @param stream - The readable stream to process
|
|
529
|
+
* @returns An async generator that yields parsed records
|
|
530
|
+
*/
|
|
531
|
+
private streamProcessor;
|
|
532
|
+
/**
|
|
533
|
+
* Retrieves details about the vNext workflow
|
|
534
|
+
* @returns Promise containing vNext workflow details including steps and graphs
|
|
535
|
+
*/
|
|
536
|
+
details(): Promise<GetVNextWorkflowResponse>;
|
|
537
|
+
/**
|
|
538
|
+
* Retrieves all runs for a vNext workflow
|
|
539
|
+
* @returns Promise containing vNext workflow runs array
|
|
540
|
+
*/
|
|
541
|
+
runs(): Promise<GetWorkflowRunsResponse>;
|
|
542
|
+
/**
|
|
543
|
+
* Creates a new vNext workflow run
|
|
544
|
+
* @param params - Optional object containing the optional runId
|
|
545
|
+
* @returns Promise containing the runId of the created run
|
|
546
|
+
*/
|
|
547
|
+
createRun(params?: {
|
|
548
|
+
runId?: string;
|
|
549
|
+
}): Promise<{
|
|
550
|
+
runId: string;
|
|
551
|
+
}>;
|
|
552
|
+
/**
|
|
553
|
+
* Starts a vNext workflow run synchronously without waiting for the workflow to complete
|
|
554
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
555
|
+
* @returns Promise containing success message
|
|
556
|
+
*/
|
|
557
|
+
start(params: {
|
|
558
|
+
runId: string;
|
|
559
|
+
inputData: Record<string, any>;
|
|
560
|
+
runtimeContext?: RuntimeContext;
|
|
561
|
+
}): Promise<{
|
|
562
|
+
message: string;
|
|
563
|
+
}>;
|
|
564
|
+
/**
|
|
565
|
+
* Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
|
|
566
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
567
|
+
* @returns Promise containing success message
|
|
568
|
+
*/
|
|
569
|
+
resume({ step, runId, resumeData, runtimeContext, }: {
|
|
570
|
+
step: string | string[];
|
|
571
|
+
runId: string;
|
|
572
|
+
resumeData?: Record<string, any>;
|
|
573
|
+
runtimeContext?: RuntimeContext;
|
|
574
|
+
}): Promise<{
|
|
575
|
+
message: string;
|
|
576
|
+
}>;
|
|
577
|
+
/**
|
|
578
|
+
* Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
579
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
580
|
+
* @returns Promise containing the vNext workflow execution results
|
|
581
|
+
*/
|
|
582
|
+
startAsync(params: {
|
|
583
|
+
runId?: string;
|
|
584
|
+
inputData: Record<string, any>;
|
|
585
|
+
runtimeContext?: RuntimeContext;
|
|
586
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
587
|
+
/**
|
|
588
|
+
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
589
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
590
|
+
* @returns Promise containing the vNext workflow resume results
|
|
591
|
+
*/
|
|
592
|
+
resumeAsync(params: {
|
|
593
|
+
runId: string;
|
|
594
|
+
step: string | string[];
|
|
595
|
+
resumeData?: Record<string, any>;
|
|
596
|
+
runtimeContext?: RuntimeContext;
|
|
597
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
598
|
+
/**
|
|
599
|
+
* Watches vNext workflow transitions in real-time
|
|
600
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
601
|
+
* @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
|
|
602
|
+
*/
|
|
603
|
+
watch({ runId }: {
|
|
604
|
+
runId?: string;
|
|
605
|
+
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
606
|
+
}
|
|
607
|
+
|
|
475
608
|
declare class MastraClient extends BaseResource {
|
|
476
609
|
constructor(options: ClientOptions);
|
|
477
610
|
/**
|
|
@@ -479,6 +612,7 @@ declare class MastraClient extends BaseResource {
|
|
|
479
612
|
* @returns Promise containing map of agent IDs to agent details
|
|
480
613
|
*/
|
|
481
614
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
615
|
+
getAGUI(): Promise<Record<string, AGUIAdapter>>;
|
|
482
616
|
/**
|
|
483
617
|
* Gets an agent instance by ID
|
|
484
618
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -538,6 +672,17 @@ declare class MastraClient extends BaseResource {
|
|
|
538
672
|
* @returns Workflow instance
|
|
539
673
|
*/
|
|
540
674
|
getWorkflow(workflowId: string): Workflow;
|
|
675
|
+
/**
|
|
676
|
+
* Retrieves all available vNext workflows
|
|
677
|
+
* @returns Promise containing map of vNext workflow IDs to vNext workflow details
|
|
678
|
+
*/
|
|
679
|
+
getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
|
|
680
|
+
/**
|
|
681
|
+
* Gets a vNext workflow instance by ID
|
|
682
|
+
* @param workflowId - ID of the vNext workflow to retrieve
|
|
683
|
+
* @returns vNext Workflow instance
|
|
684
|
+
*/
|
|
685
|
+
getVNextWorkflow(workflowId: string): VNextWorkflow;
|
|
541
686
|
/**
|
|
542
687
|
* Gets a vector instance by name
|
|
543
688
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -582,4 +727,4 @@ declare class MastraClient extends BaseResource {
|
|
|
582
727
|
getNetwork(networkId: string): Network;
|
|
583
728
|
}
|
|
584
729
|
|
|
585
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult };
|
|
730
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { AbstractAgent, AgentConfig, RunAgentInput, BaseEvent } from '@ag-ui/client';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
1
3
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
2
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
4
|
+
import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
3
5
|
import { JSONSchema7 } from 'json-schema';
|
|
4
6
|
import { ZodSchema } from 'zod';
|
|
5
7
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
8
|
+
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
9
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
6
10
|
|
|
7
11
|
interface ClientOptions {
|
|
8
12
|
/** Base URL for API requests */
|
|
@@ -32,12 +36,15 @@ interface GetAgentResponse {
|
|
|
32
36
|
}
|
|
33
37
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
34
38
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
35
|
-
} & Partial<
|
|
39
|
+
} & Partial<AgentGenerateOptions<T>>;
|
|
36
40
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
41
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'
|
|
42
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
39
43
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
40
44
|
evals: any[];
|
|
45
|
+
instructions: string;
|
|
46
|
+
name: string;
|
|
47
|
+
id: string;
|
|
41
48
|
}
|
|
42
49
|
interface GetToolResponse {
|
|
43
50
|
id: string;
|
|
@@ -53,6 +60,7 @@ interface GetWorkflowResponse {
|
|
|
53
60
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
61
|
workflowId?: string;
|
|
55
62
|
}
|
|
63
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
56
64
|
type WorkflowRunResult = {
|
|
57
65
|
activePaths: Record<string, {
|
|
58
66
|
status: string;
|
|
@@ -63,6 +71,26 @@ type WorkflowRunResult = {
|
|
|
63
71
|
timestamp: number;
|
|
64
72
|
runId: string;
|
|
65
73
|
};
|
|
74
|
+
interface GetVNextWorkflowResponse {
|
|
75
|
+
name: string;
|
|
76
|
+
steps: {
|
|
77
|
+
[key: string]: {
|
|
78
|
+
id: string;
|
|
79
|
+
description: string;
|
|
80
|
+
inputSchema: string;
|
|
81
|
+
outputSchema: string;
|
|
82
|
+
resumeSchema: string;
|
|
83
|
+
suspendSchema: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
stepGraph: NewWorkflow['serializedStepGraph'];
|
|
87
|
+
inputSchema: string;
|
|
88
|
+
outputSchema: string;
|
|
89
|
+
}
|
|
90
|
+
type VNextWorkflowWatchResult = WatchEvent & {
|
|
91
|
+
runId: string;
|
|
92
|
+
};
|
|
93
|
+
type VNextWorkflowRunResult = WorkflowResult<any, any>;
|
|
66
94
|
interface UpsertVectorParams {
|
|
67
95
|
indexName: string;
|
|
68
96
|
vectors: number[][];
|
|
@@ -97,7 +125,7 @@ type SaveMessageToMemoryResponse = MessageType[];
|
|
|
97
125
|
interface CreateMemoryThreadParams {
|
|
98
126
|
title: string;
|
|
99
127
|
metadata: Record<string, any>;
|
|
100
|
-
|
|
128
|
+
resourceId: string;
|
|
101
129
|
threadId: string;
|
|
102
130
|
agentId: string;
|
|
103
131
|
}
|
|
@@ -110,7 +138,7 @@ type GetMemoryThreadResponse = StorageThreadType[];
|
|
|
110
138
|
interface UpdateMemoryThreadParams {
|
|
111
139
|
title: string;
|
|
112
140
|
metadata: Record<string, any>;
|
|
113
|
-
|
|
141
|
+
resourceId: string;
|
|
114
142
|
}
|
|
115
143
|
interface GetMemoryThreadMessagesResponse {
|
|
116
144
|
messages: CoreMessage[];
|
|
@@ -269,6 +297,18 @@ declare class Agent extends BaseResource {
|
|
|
269
297
|
liveEvals(): Promise<GetEvalsByAgentIdResponse>;
|
|
270
298
|
}
|
|
271
299
|
|
|
300
|
+
interface MastraAgentConfig extends AgentConfig {
|
|
301
|
+
agent: Agent;
|
|
302
|
+
agentId: string;
|
|
303
|
+
resourceId?: string;
|
|
304
|
+
}
|
|
305
|
+
declare class AGUIAdapter extends AbstractAgent {
|
|
306
|
+
agent: Agent;
|
|
307
|
+
resourceId?: string;
|
|
308
|
+
constructor({ agent, agentId, resourceId, ...rest }: MastraAgentConfig);
|
|
309
|
+
protected run(input: RunAgentInput): Observable<BaseEvent>;
|
|
310
|
+
}
|
|
311
|
+
|
|
272
312
|
declare class Network extends BaseResource {
|
|
273
313
|
private networkId;
|
|
274
314
|
constructor(options: ClientOptions, networkId: string);
|
|
@@ -376,6 +416,11 @@ declare class Workflow extends BaseResource {
|
|
|
376
416
|
* @returns Promise containing workflow details including steps and graphs
|
|
377
417
|
*/
|
|
378
418
|
details(): Promise<GetWorkflowResponse>;
|
|
419
|
+
/**
|
|
420
|
+
* Retrieves all runs for a workflow
|
|
421
|
+
* @returns Promise containing workflow runs array
|
|
422
|
+
*/
|
|
423
|
+
runs(): Promise<GetWorkflowRunsResponse>;
|
|
379
424
|
/**
|
|
380
425
|
* @deprecated Use `startAsync` instead
|
|
381
426
|
* Executes the workflow with the provided parameters
|
|
@@ -469,9 +514,97 @@ declare class Tool extends BaseResource {
|
|
|
469
514
|
*/
|
|
470
515
|
execute(params: {
|
|
471
516
|
data: any;
|
|
517
|
+
runId?: string;
|
|
472
518
|
}): Promise<any>;
|
|
473
519
|
}
|
|
474
520
|
|
|
521
|
+
declare class VNextWorkflow extends BaseResource {
|
|
522
|
+
private workflowId;
|
|
523
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
524
|
+
/**
|
|
525
|
+
* Creates an async generator that processes a readable stream and yields vNext workflow records
|
|
526
|
+
* separated by the Record Separator character (\x1E)
|
|
527
|
+
*
|
|
528
|
+
* @param stream - The readable stream to process
|
|
529
|
+
* @returns An async generator that yields parsed records
|
|
530
|
+
*/
|
|
531
|
+
private streamProcessor;
|
|
532
|
+
/**
|
|
533
|
+
* Retrieves details about the vNext workflow
|
|
534
|
+
* @returns Promise containing vNext workflow details including steps and graphs
|
|
535
|
+
*/
|
|
536
|
+
details(): Promise<GetVNextWorkflowResponse>;
|
|
537
|
+
/**
|
|
538
|
+
* Retrieves all runs for a vNext workflow
|
|
539
|
+
* @returns Promise containing vNext workflow runs array
|
|
540
|
+
*/
|
|
541
|
+
runs(): Promise<GetWorkflowRunsResponse>;
|
|
542
|
+
/**
|
|
543
|
+
* Creates a new vNext workflow run
|
|
544
|
+
* @param params - Optional object containing the optional runId
|
|
545
|
+
* @returns Promise containing the runId of the created run
|
|
546
|
+
*/
|
|
547
|
+
createRun(params?: {
|
|
548
|
+
runId?: string;
|
|
549
|
+
}): Promise<{
|
|
550
|
+
runId: string;
|
|
551
|
+
}>;
|
|
552
|
+
/**
|
|
553
|
+
* Starts a vNext workflow run synchronously without waiting for the workflow to complete
|
|
554
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
555
|
+
* @returns Promise containing success message
|
|
556
|
+
*/
|
|
557
|
+
start(params: {
|
|
558
|
+
runId: string;
|
|
559
|
+
inputData: Record<string, any>;
|
|
560
|
+
runtimeContext?: RuntimeContext;
|
|
561
|
+
}): Promise<{
|
|
562
|
+
message: string;
|
|
563
|
+
}>;
|
|
564
|
+
/**
|
|
565
|
+
* Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
|
|
566
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
567
|
+
* @returns Promise containing success message
|
|
568
|
+
*/
|
|
569
|
+
resume({ step, runId, resumeData, runtimeContext, }: {
|
|
570
|
+
step: string | string[];
|
|
571
|
+
runId: string;
|
|
572
|
+
resumeData?: Record<string, any>;
|
|
573
|
+
runtimeContext?: RuntimeContext;
|
|
574
|
+
}): Promise<{
|
|
575
|
+
message: string;
|
|
576
|
+
}>;
|
|
577
|
+
/**
|
|
578
|
+
* Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
579
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
580
|
+
* @returns Promise containing the vNext workflow execution results
|
|
581
|
+
*/
|
|
582
|
+
startAsync(params: {
|
|
583
|
+
runId?: string;
|
|
584
|
+
inputData: Record<string, any>;
|
|
585
|
+
runtimeContext?: RuntimeContext;
|
|
586
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
587
|
+
/**
|
|
588
|
+
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
589
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
590
|
+
* @returns Promise containing the vNext workflow resume results
|
|
591
|
+
*/
|
|
592
|
+
resumeAsync(params: {
|
|
593
|
+
runId: string;
|
|
594
|
+
step: string | string[];
|
|
595
|
+
resumeData?: Record<string, any>;
|
|
596
|
+
runtimeContext?: RuntimeContext;
|
|
597
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
598
|
+
/**
|
|
599
|
+
* Watches vNext workflow transitions in real-time
|
|
600
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
601
|
+
* @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
|
|
602
|
+
*/
|
|
603
|
+
watch({ runId }: {
|
|
604
|
+
runId?: string;
|
|
605
|
+
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
606
|
+
}
|
|
607
|
+
|
|
475
608
|
declare class MastraClient extends BaseResource {
|
|
476
609
|
constructor(options: ClientOptions);
|
|
477
610
|
/**
|
|
@@ -479,6 +612,7 @@ declare class MastraClient extends BaseResource {
|
|
|
479
612
|
* @returns Promise containing map of agent IDs to agent details
|
|
480
613
|
*/
|
|
481
614
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
615
|
+
getAGUI(): Promise<Record<string, AGUIAdapter>>;
|
|
482
616
|
/**
|
|
483
617
|
* Gets an agent instance by ID
|
|
484
618
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -538,6 +672,17 @@ declare class MastraClient extends BaseResource {
|
|
|
538
672
|
* @returns Workflow instance
|
|
539
673
|
*/
|
|
540
674
|
getWorkflow(workflowId: string): Workflow;
|
|
675
|
+
/**
|
|
676
|
+
* Retrieves all available vNext workflows
|
|
677
|
+
* @returns Promise containing map of vNext workflow IDs to vNext workflow details
|
|
678
|
+
*/
|
|
679
|
+
getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
|
|
680
|
+
/**
|
|
681
|
+
* Gets a vNext workflow instance by ID
|
|
682
|
+
* @param workflowId - ID of the vNext workflow to retrieve
|
|
683
|
+
* @returns vNext Workflow instance
|
|
684
|
+
*/
|
|
685
|
+
getVNextWorkflow(workflowId: string): VNextWorkflow;
|
|
541
686
|
/**
|
|
542
687
|
* Gets a vector instance by name
|
|
543
688
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -582,4 +727,4 @@ declare class MastraClient extends BaseResource {
|
|
|
582
727
|
getNetwork(networkId: string): Network;
|
|
583
728
|
}
|
|
584
729
|
|
|
585
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult };
|
|
730
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|