@mastra/client-js 0.0.0-agui-20250501191909 → 0.0.0-cloud-transporter-20250513033346
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 +160 -2
- package/dist/index.cjs +218 -28
- package/dist/index.d.cts +97 -29
- package/dist/index.d.ts +97 -29
- package/dist/index.js +214 -28
- package/package.json +6 -6
- package/src/adapters/agui.test.ts +19 -6
- package/src/adapters/agui.ts +31 -11
- package/src/client.ts +20 -4
- package/src/index.test.ts +30 -0
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +26 -34
- package/src/resources/index.ts +1 -0
- package/src/resources/memory-thread.ts +13 -3
- package/src/resources/network.ts +5 -11
- package/src/resources/tool.ts +8 -2
- package/src/resources/vnext-workflow.ts +34 -7
- package/src/resources/workflow.ts +31 -3
- package/src/types.ts +20 -2
- package/src/utils/zod-to-json-schema.ts +10 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { AbstractAgent
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
3
2
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
4
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
5
4
|
import { JSONSchema7 } from 'json-schema';
|
|
6
5
|
import { ZodSchema } from 'zod';
|
|
7
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
8
7
|
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
9
|
-
import { RuntimeContext } from '@mastra/core/
|
|
8
|
+
import { RuntimeContext } from '@mastra/core/di';
|
|
9
|
+
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/runtime-context';
|
|
10
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
10
11
|
|
|
11
12
|
interface ClientOptions {
|
|
12
13
|
/** Base URL for API requests */
|
|
@@ -31,15 +32,16 @@ interface GetAgentResponse {
|
|
|
31
32
|
name: string;
|
|
32
33
|
instructions: string;
|
|
33
34
|
tools: Record<string, GetToolResponse>;
|
|
35
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
34
36
|
provider: string;
|
|
35
37
|
modelId: string;
|
|
36
38
|
}
|
|
37
39
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
38
40
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
39
|
-
} & Partial<AgentGenerateOptions<T>>;
|
|
41
|
+
} & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
|
|
40
42
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
41
43
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
42
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
44
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
|
|
43
45
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
44
46
|
evals: any[];
|
|
45
47
|
instructions: string;
|
|
@@ -60,6 +62,13 @@ interface GetWorkflowResponse {
|
|
|
60
62
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
61
63
|
workflowId?: string;
|
|
62
64
|
}
|
|
65
|
+
interface GetWorkflowRunsParams {
|
|
66
|
+
fromDate?: Date;
|
|
67
|
+
toDate?: Date;
|
|
68
|
+
limit?: number;
|
|
69
|
+
offset?: number;
|
|
70
|
+
resourceId?: string;
|
|
71
|
+
}
|
|
63
72
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
64
73
|
type WorkflowRunResult = {
|
|
65
74
|
activePaths: Record<string, {
|
|
@@ -140,6 +149,12 @@ interface UpdateMemoryThreadParams {
|
|
|
140
149
|
metadata: Record<string, any>;
|
|
141
150
|
resourceId: string;
|
|
142
151
|
}
|
|
152
|
+
interface GetMemoryThreadMessagesParams {
|
|
153
|
+
/**
|
|
154
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
155
|
+
*/
|
|
156
|
+
limit?: number;
|
|
157
|
+
}
|
|
143
158
|
interface GetMemoryThreadMessagesResponse {
|
|
144
159
|
messages: CoreMessage[];
|
|
145
160
|
uiMessages: AiMessageType[];
|
|
@@ -199,6 +214,8 @@ interface GetTelemetryParams {
|
|
|
199
214
|
page?: number;
|
|
200
215
|
perPage?: number;
|
|
201
216
|
attribute?: Record<string, string>;
|
|
217
|
+
fromDate?: Date;
|
|
218
|
+
toDate?: Date;
|
|
202
219
|
}
|
|
203
220
|
interface GetNetworkResponse {
|
|
204
221
|
name: string;
|
|
@@ -246,7 +263,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
246
263
|
* @param options - Optional provider-specific options
|
|
247
264
|
* @returns Promise containing the transcribed text
|
|
248
265
|
*/
|
|
249
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
266
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
267
|
+
text: string;
|
|
268
|
+
}>;
|
|
250
269
|
/**
|
|
251
270
|
* Get available speakers for the agent's voice provider
|
|
252
271
|
* @returns Promise containing list of available speakers
|
|
@@ -285,6 +304,16 @@ declare class Agent extends BaseResource {
|
|
|
285
304
|
* @returns Promise containing tool details
|
|
286
305
|
*/
|
|
287
306
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
307
|
+
/**
|
|
308
|
+
* Executes a tool for the agent
|
|
309
|
+
* @param toolId - ID of the tool to execute
|
|
310
|
+
* @param params - Parameters required for tool execution
|
|
311
|
+
* @returns Promise containing the tool execution results
|
|
312
|
+
*/
|
|
313
|
+
executeTool(toolId: string, params: {
|
|
314
|
+
data: any;
|
|
315
|
+
runtimeContext?: RuntimeContext;
|
|
316
|
+
}): Promise<any>;
|
|
288
317
|
/**
|
|
289
318
|
* Retrieves evaluation results for the agent
|
|
290
319
|
* @returns Promise containing agent evaluations
|
|
@@ -297,18 +326,6 @@ declare class Agent extends BaseResource {
|
|
|
297
326
|
liveEvals(): Promise<GetEvalsByAgentIdResponse>;
|
|
298
327
|
}
|
|
299
328
|
|
|
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
|
-
|
|
312
329
|
declare class Network extends BaseResource {
|
|
313
330
|
private networkId;
|
|
314
331
|
constructor(options: ClientOptions, networkId: string);
|
|
@@ -357,9 +374,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
357
374
|
}>;
|
|
358
375
|
/**
|
|
359
376
|
* Retrieves messages associated with the thread
|
|
377
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
360
378
|
* @returns Promise containing thread messages and UI messages
|
|
361
379
|
*/
|
|
362
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
380
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
363
381
|
}
|
|
364
382
|
|
|
365
383
|
declare class Vector extends BaseResource {
|
|
@@ -418,9 +436,10 @@ declare class Workflow extends BaseResource {
|
|
|
418
436
|
details(): Promise<GetWorkflowResponse>;
|
|
419
437
|
/**
|
|
420
438
|
* Retrieves all runs for a workflow
|
|
439
|
+
* @param params - Parameters for filtering runs
|
|
421
440
|
* @returns Promise containing workflow runs array
|
|
422
441
|
*/
|
|
423
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
442
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
424
443
|
/**
|
|
425
444
|
* @deprecated Use `startAsync` instead
|
|
426
445
|
* Executes the workflow with the provided parameters
|
|
@@ -515,6 +534,7 @@ declare class Tool extends BaseResource {
|
|
|
515
534
|
execute(params: {
|
|
516
535
|
data: any;
|
|
517
536
|
runId?: string;
|
|
537
|
+
runtimeContext?: RuntimeContext;
|
|
518
538
|
}): Promise<any>;
|
|
519
539
|
}
|
|
520
540
|
|
|
@@ -536,9 +556,10 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
536
556
|
details(): Promise<GetVNextWorkflowResponse>;
|
|
537
557
|
/**
|
|
538
558
|
* Retrieves all runs for a vNext workflow
|
|
559
|
+
* @param params - Parameters for filtering runs
|
|
539
560
|
* @returns Promise containing vNext workflow runs array
|
|
540
561
|
*/
|
|
541
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
562
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
542
563
|
/**
|
|
543
564
|
* Creates a new vNext workflow run
|
|
544
565
|
* @param params - Optional object containing the optional runId
|
|
@@ -557,7 +578,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
557
578
|
start(params: {
|
|
558
579
|
runId: string;
|
|
559
580
|
inputData: Record<string, any>;
|
|
560
|
-
runtimeContext?: RuntimeContext;
|
|
581
|
+
runtimeContext?: RuntimeContext$1;
|
|
561
582
|
}): Promise<{
|
|
562
583
|
message: string;
|
|
563
584
|
}>;
|
|
@@ -566,11 +587,11 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
566
587
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
567
588
|
* @returns Promise containing success message
|
|
568
589
|
*/
|
|
569
|
-
resume({ step, runId, resumeData,
|
|
590
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
570
591
|
step: string | string[];
|
|
571
592
|
runId: string;
|
|
572
593
|
resumeData?: Record<string, any>;
|
|
573
|
-
runtimeContext?: RuntimeContext;
|
|
594
|
+
runtimeContext?: RuntimeContext$1;
|
|
574
595
|
}): Promise<{
|
|
575
596
|
message: string;
|
|
576
597
|
}>;
|
|
@@ -582,7 +603,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
582
603
|
startAsync(params: {
|
|
583
604
|
runId?: string;
|
|
584
605
|
inputData: Record<string, any>;
|
|
585
|
-
runtimeContext?: RuntimeContext;
|
|
606
|
+
runtimeContext?: RuntimeContext$1;
|
|
586
607
|
}): Promise<VNextWorkflowRunResult>;
|
|
587
608
|
/**
|
|
588
609
|
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
@@ -593,7 +614,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
593
614
|
runId: string;
|
|
594
615
|
step: string | string[];
|
|
595
616
|
resumeData?: Record<string, any>;
|
|
596
|
-
runtimeContext?: RuntimeContext;
|
|
617
|
+
runtimeContext?: RuntimeContext$1;
|
|
597
618
|
}): Promise<VNextWorkflowRunResult>;
|
|
598
619
|
/**
|
|
599
620
|
* Watches vNext workflow transitions in real-time
|
|
@@ -605,6 +626,47 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
605
626
|
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
606
627
|
}
|
|
607
628
|
|
|
629
|
+
/**
|
|
630
|
+
* Class for interacting with an agent via the A2A protocol
|
|
631
|
+
*/
|
|
632
|
+
declare class A2A extends BaseResource {
|
|
633
|
+
private agentId;
|
|
634
|
+
constructor(options: ClientOptions, agentId: string);
|
|
635
|
+
/**
|
|
636
|
+
* Get the agent card with metadata about the agent
|
|
637
|
+
* @returns Promise containing the agent card information
|
|
638
|
+
*/
|
|
639
|
+
getCard(): Promise<AgentCard>;
|
|
640
|
+
/**
|
|
641
|
+
* Send a message to the agent and get a response
|
|
642
|
+
* @param params - Parameters for the task
|
|
643
|
+
* @returns Promise containing the task response
|
|
644
|
+
*/
|
|
645
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
646
|
+
task: Task;
|
|
647
|
+
}>;
|
|
648
|
+
/**
|
|
649
|
+
* Get the status and result of a task
|
|
650
|
+
* @param params - Parameters for querying the task
|
|
651
|
+
* @returns Promise containing the task response
|
|
652
|
+
*/
|
|
653
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
654
|
+
/**
|
|
655
|
+
* Cancel a running task
|
|
656
|
+
* @param params - Parameters identifying the task to cancel
|
|
657
|
+
* @returns Promise containing the task response
|
|
658
|
+
*/
|
|
659
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
660
|
+
task: Task;
|
|
661
|
+
}>;
|
|
662
|
+
/**
|
|
663
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
664
|
+
* @param params - Parameters for the task
|
|
665
|
+
* @returns Promise containing the task response
|
|
666
|
+
*/
|
|
667
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
668
|
+
}
|
|
669
|
+
|
|
608
670
|
declare class MastraClient extends BaseResource {
|
|
609
671
|
constructor(options: ClientOptions);
|
|
610
672
|
/**
|
|
@@ -614,7 +676,7 @@ declare class MastraClient extends BaseResource {
|
|
|
614
676
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
615
677
|
getAGUI({ resourceId }: {
|
|
616
678
|
resourceId: string;
|
|
617
|
-
}): Promise<Record<string,
|
|
679
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
618
680
|
/**
|
|
619
681
|
* Gets an agent instance by ID
|
|
620
682
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -727,6 +789,12 @@ declare class MastraClient extends BaseResource {
|
|
|
727
789
|
* @returns Network instance
|
|
728
790
|
*/
|
|
729
791
|
getNetwork(networkId: string): Network;
|
|
792
|
+
/**
|
|
793
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
794
|
+
* @param agentId - ID of the agent to interact with
|
|
795
|
+
* @returns A2A client instance
|
|
796
|
+
*/
|
|
797
|
+
getA2A(agentId: string): A2A;
|
|
730
798
|
}
|
|
731
799
|
|
|
732
|
-
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 };
|
|
800
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, 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,12 +1,13 @@
|
|
|
1
|
-
import { AbstractAgent
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
3
2
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
4
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
5
4
|
import { JSONSchema7 } from 'json-schema';
|
|
6
5
|
import { ZodSchema } from 'zod';
|
|
7
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
8
7
|
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
9
|
-
import { RuntimeContext } from '@mastra/core/
|
|
8
|
+
import { RuntimeContext } from '@mastra/core/di';
|
|
9
|
+
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/runtime-context';
|
|
10
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
10
11
|
|
|
11
12
|
interface ClientOptions {
|
|
12
13
|
/** Base URL for API requests */
|
|
@@ -31,15 +32,16 @@ interface GetAgentResponse {
|
|
|
31
32
|
name: string;
|
|
32
33
|
instructions: string;
|
|
33
34
|
tools: Record<string, GetToolResponse>;
|
|
35
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
34
36
|
provider: string;
|
|
35
37
|
modelId: string;
|
|
36
38
|
}
|
|
37
39
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
38
40
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
39
|
-
} & Partial<AgentGenerateOptions<T>>;
|
|
41
|
+
} & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
|
|
40
42
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
41
43
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
42
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
44
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
|
|
43
45
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
44
46
|
evals: any[];
|
|
45
47
|
instructions: string;
|
|
@@ -60,6 +62,13 @@ interface GetWorkflowResponse {
|
|
|
60
62
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
61
63
|
workflowId?: string;
|
|
62
64
|
}
|
|
65
|
+
interface GetWorkflowRunsParams {
|
|
66
|
+
fromDate?: Date;
|
|
67
|
+
toDate?: Date;
|
|
68
|
+
limit?: number;
|
|
69
|
+
offset?: number;
|
|
70
|
+
resourceId?: string;
|
|
71
|
+
}
|
|
63
72
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
64
73
|
type WorkflowRunResult = {
|
|
65
74
|
activePaths: Record<string, {
|
|
@@ -140,6 +149,12 @@ interface UpdateMemoryThreadParams {
|
|
|
140
149
|
metadata: Record<string, any>;
|
|
141
150
|
resourceId: string;
|
|
142
151
|
}
|
|
152
|
+
interface GetMemoryThreadMessagesParams {
|
|
153
|
+
/**
|
|
154
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
155
|
+
*/
|
|
156
|
+
limit?: number;
|
|
157
|
+
}
|
|
143
158
|
interface GetMemoryThreadMessagesResponse {
|
|
144
159
|
messages: CoreMessage[];
|
|
145
160
|
uiMessages: AiMessageType[];
|
|
@@ -199,6 +214,8 @@ interface GetTelemetryParams {
|
|
|
199
214
|
page?: number;
|
|
200
215
|
perPage?: number;
|
|
201
216
|
attribute?: Record<string, string>;
|
|
217
|
+
fromDate?: Date;
|
|
218
|
+
toDate?: Date;
|
|
202
219
|
}
|
|
203
220
|
interface GetNetworkResponse {
|
|
204
221
|
name: string;
|
|
@@ -246,7 +263,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
246
263
|
* @param options - Optional provider-specific options
|
|
247
264
|
* @returns Promise containing the transcribed text
|
|
248
265
|
*/
|
|
249
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
266
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
267
|
+
text: string;
|
|
268
|
+
}>;
|
|
250
269
|
/**
|
|
251
270
|
* Get available speakers for the agent's voice provider
|
|
252
271
|
* @returns Promise containing list of available speakers
|
|
@@ -285,6 +304,16 @@ declare class Agent extends BaseResource {
|
|
|
285
304
|
* @returns Promise containing tool details
|
|
286
305
|
*/
|
|
287
306
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
307
|
+
/**
|
|
308
|
+
* Executes a tool for the agent
|
|
309
|
+
* @param toolId - ID of the tool to execute
|
|
310
|
+
* @param params - Parameters required for tool execution
|
|
311
|
+
* @returns Promise containing the tool execution results
|
|
312
|
+
*/
|
|
313
|
+
executeTool(toolId: string, params: {
|
|
314
|
+
data: any;
|
|
315
|
+
runtimeContext?: RuntimeContext;
|
|
316
|
+
}): Promise<any>;
|
|
288
317
|
/**
|
|
289
318
|
* Retrieves evaluation results for the agent
|
|
290
319
|
* @returns Promise containing agent evaluations
|
|
@@ -297,18 +326,6 @@ declare class Agent extends BaseResource {
|
|
|
297
326
|
liveEvals(): Promise<GetEvalsByAgentIdResponse>;
|
|
298
327
|
}
|
|
299
328
|
|
|
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
|
-
|
|
312
329
|
declare class Network extends BaseResource {
|
|
313
330
|
private networkId;
|
|
314
331
|
constructor(options: ClientOptions, networkId: string);
|
|
@@ -357,9 +374,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
357
374
|
}>;
|
|
358
375
|
/**
|
|
359
376
|
* Retrieves messages associated with the thread
|
|
377
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
360
378
|
* @returns Promise containing thread messages and UI messages
|
|
361
379
|
*/
|
|
362
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
380
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
363
381
|
}
|
|
364
382
|
|
|
365
383
|
declare class Vector extends BaseResource {
|
|
@@ -418,9 +436,10 @@ declare class Workflow extends BaseResource {
|
|
|
418
436
|
details(): Promise<GetWorkflowResponse>;
|
|
419
437
|
/**
|
|
420
438
|
* Retrieves all runs for a workflow
|
|
439
|
+
* @param params - Parameters for filtering runs
|
|
421
440
|
* @returns Promise containing workflow runs array
|
|
422
441
|
*/
|
|
423
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
442
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
424
443
|
/**
|
|
425
444
|
* @deprecated Use `startAsync` instead
|
|
426
445
|
* Executes the workflow with the provided parameters
|
|
@@ -515,6 +534,7 @@ declare class Tool extends BaseResource {
|
|
|
515
534
|
execute(params: {
|
|
516
535
|
data: any;
|
|
517
536
|
runId?: string;
|
|
537
|
+
runtimeContext?: RuntimeContext;
|
|
518
538
|
}): Promise<any>;
|
|
519
539
|
}
|
|
520
540
|
|
|
@@ -536,9 +556,10 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
536
556
|
details(): Promise<GetVNextWorkflowResponse>;
|
|
537
557
|
/**
|
|
538
558
|
* Retrieves all runs for a vNext workflow
|
|
559
|
+
* @param params - Parameters for filtering runs
|
|
539
560
|
* @returns Promise containing vNext workflow runs array
|
|
540
561
|
*/
|
|
541
|
-
runs(): Promise<GetWorkflowRunsResponse>;
|
|
562
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
542
563
|
/**
|
|
543
564
|
* Creates a new vNext workflow run
|
|
544
565
|
* @param params - Optional object containing the optional runId
|
|
@@ -557,7 +578,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
557
578
|
start(params: {
|
|
558
579
|
runId: string;
|
|
559
580
|
inputData: Record<string, any>;
|
|
560
|
-
runtimeContext?: RuntimeContext;
|
|
581
|
+
runtimeContext?: RuntimeContext$1;
|
|
561
582
|
}): Promise<{
|
|
562
583
|
message: string;
|
|
563
584
|
}>;
|
|
@@ -566,11 +587,11 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
566
587
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
567
588
|
* @returns Promise containing success message
|
|
568
589
|
*/
|
|
569
|
-
resume({ step, runId, resumeData,
|
|
590
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
570
591
|
step: string | string[];
|
|
571
592
|
runId: string;
|
|
572
593
|
resumeData?: Record<string, any>;
|
|
573
|
-
runtimeContext?: RuntimeContext;
|
|
594
|
+
runtimeContext?: RuntimeContext$1;
|
|
574
595
|
}): Promise<{
|
|
575
596
|
message: string;
|
|
576
597
|
}>;
|
|
@@ -582,7 +603,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
582
603
|
startAsync(params: {
|
|
583
604
|
runId?: string;
|
|
584
605
|
inputData: Record<string, any>;
|
|
585
|
-
runtimeContext?: RuntimeContext;
|
|
606
|
+
runtimeContext?: RuntimeContext$1;
|
|
586
607
|
}): Promise<VNextWorkflowRunResult>;
|
|
587
608
|
/**
|
|
588
609
|
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
@@ -593,7 +614,7 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
593
614
|
runId: string;
|
|
594
615
|
step: string | string[];
|
|
595
616
|
resumeData?: Record<string, any>;
|
|
596
|
-
runtimeContext?: RuntimeContext;
|
|
617
|
+
runtimeContext?: RuntimeContext$1;
|
|
597
618
|
}): Promise<VNextWorkflowRunResult>;
|
|
598
619
|
/**
|
|
599
620
|
* Watches vNext workflow transitions in real-time
|
|
@@ -605,6 +626,47 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
605
626
|
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
606
627
|
}
|
|
607
628
|
|
|
629
|
+
/**
|
|
630
|
+
* Class for interacting with an agent via the A2A protocol
|
|
631
|
+
*/
|
|
632
|
+
declare class A2A extends BaseResource {
|
|
633
|
+
private agentId;
|
|
634
|
+
constructor(options: ClientOptions, agentId: string);
|
|
635
|
+
/**
|
|
636
|
+
* Get the agent card with metadata about the agent
|
|
637
|
+
* @returns Promise containing the agent card information
|
|
638
|
+
*/
|
|
639
|
+
getCard(): Promise<AgentCard>;
|
|
640
|
+
/**
|
|
641
|
+
* Send a message to the agent and get a response
|
|
642
|
+
* @param params - Parameters for the task
|
|
643
|
+
* @returns Promise containing the task response
|
|
644
|
+
*/
|
|
645
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
646
|
+
task: Task;
|
|
647
|
+
}>;
|
|
648
|
+
/**
|
|
649
|
+
* Get the status and result of a task
|
|
650
|
+
* @param params - Parameters for querying the task
|
|
651
|
+
* @returns Promise containing the task response
|
|
652
|
+
*/
|
|
653
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
654
|
+
/**
|
|
655
|
+
* Cancel a running task
|
|
656
|
+
* @param params - Parameters identifying the task to cancel
|
|
657
|
+
* @returns Promise containing the task response
|
|
658
|
+
*/
|
|
659
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
660
|
+
task: Task;
|
|
661
|
+
}>;
|
|
662
|
+
/**
|
|
663
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
664
|
+
* @param params - Parameters for the task
|
|
665
|
+
* @returns Promise containing the task response
|
|
666
|
+
*/
|
|
667
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
668
|
+
}
|
|
669
|
+
|
|
608
670
|
declare class MastraClient extends BaseResource {
|
|
609
671
|
constructor(options: ClientOptions);
|
|
610
672
|
/**
|
|
@@ -614,7 +676,7 @@ declare class MastraClient extends BaseResource {
|
|
|
614
676
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
615
677
|
getAGUI({ resourceId }: {
|
|
616
678
|
resourceId: string;
|
|
617
|
-
}): Promise<Record<string,
|
|
679
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
618
680
|
/**
|
|
619
681
|
* Gets an agent instance by ID
|
|
620
682
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -727,6 +789,12 @@ declare class MastraClient extends BaseResource {
|
|
|
727
789
|
* @returns Network instance
|
|
728
790
|
*/
|
|
729
791
|
getNetwork(networkId: string): Network;
|
|
792
|
+
/**
|
|
793
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
794
|
+
* @param agentId - ID of the agent to interact with
|
|
795
|
+
* @returns A2A client instance
|
|
796
|
+
*/
|
|
797
|
+
getA2A(agentId: string): A2A;
|
|
730
798
|
}
|
|
731
799
|
|
|
732
|
-
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 };
|
|
800
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, 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 };
|