@mastra/client-js 0.0.0-switch-to-core-20250424015131 → 0.0.0-vnext-inngest-20250506123700

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/dist/index.d.cts CHANGED
@@ -1,8 +1,11 @@
1
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
1
+ import { AbstractAgent } from '@ag-ui/client';
2
+ import { processDataStream } from '@ai-sdk/ui-utils';
3
+ import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
2
4
  import { JSONSchema7 } from 'json-schema';
3
5
  import { ZodSchema } from 'zod';
4
- import { processDataStream } from '@ai-sdk/ui-utils';
5
6
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
8
+ import { RuntimeContext } from '@mastra/core/runtime-context';
6
9
 
7
10
  interface ClientOptions {
8
11
  /** Base URL for API requests */
@@ -38,6 +41,9 @@ type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
38
41
  } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
39
42
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
40
43
  evals: any[];
44
+ instructions: string;
45
+ name: string;
46
+ id: string;
41
47
  }
42
48
  interface GetToolResponse {
43
49
  id: string;
@@ -53,6 +59,14 @@ interface GetWorkflowResponse {
53
59
  stepSubscriberGraph: Record<string, StepGraph>;
54
60
  workflowId?: string;
55
61
  }
62
+ interface GetWorkflowRunsParams {
63
+ fromDate?: Date;
64
+ toDate?: Date;
65
+ limit?: number;
66
+ offset?: number;
67
+ resourceId?: string;
68
+ }
69
+ type GetWorkflowRunsResponse = WorkflowRuns;
56
70
  type WorkflowRunResult = {
57
71
  activePaths: Record<string, {
58
72
  status: string;
@@ -63,6 +77,26 @@ type WorkflowRunResult = {
63
77
  timestamp: number;
64
78
  runId: string;
65
79
  };
80
+ interface GetVNextWorkflowResponse {
81
+ name: string;
82
+ steps: {
83
+ [key: string]: {
84
+ id: string;
85
+ description: string;
86
+ inputSchema: string;
87
+ outputSchema: string;
88
+ resumeSchema: string;
89
+ suspendSchema: string;
90
+ };
91
+ };
92
+ stepGraph: NewWorkflow['serializedStepGraph'];
93
+ inputSchema: string;
94
+ outputSchema: string;
95
+ }
96
+ type VNextWorkflowWatchResult = WatchEvent & {
97
+ runId: string;
98
+ };
99
+ type VNextWorkflowRunResult = WorkflowResult<any, any>;
66
100
  interface UpsertVectorParams {
67
101
  indexName: string;
68
102
  vectors: number[][];
@@ -171,6 +205,8 @@ interface GetTelemetryParams {
171
205
  page?: number;
172
206
  perPage?: number;
173
207
  attribute?: Record<string, string>;
208
+ fromDate?: Date;
209
+ toDate?: Date;
174
210
  }
175
211
  interface GetNetworkResponse {
176
212
  name: string;
@@ -376,6 +412,12 @@ declare class Workflow extends BaseResource {
376
412
  * @returns Promise containing workflow details including steps and graphs
377
413
  */
378
414
  details(): Promise<GetWorkflowResponse>;
415
+ /**
416
+ * Retrieves all runs for a workflow
417
+ * @param params - Parameters for filtering runs
418
+ * @returns Promise containing workflow runs array
419
+ */
420
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
379
421
  /**
380
422
  * @deprecated Use `startAsync` instead
381
423
  * Executes the workflow with the provided parameters
@@ -469,9 +511,98 @@ declare class Tool extends BaseResource {
469
511
  */
470
512
  execute(params: {
471
513
  data: any;
514
+ runId?: string;
472
515
  }): Promise<any>;
473
516
  }
474
517
 
518
+ declare class VNextWorkflow extends BaseResource {
519
+ private workflowId;
520
+ constructor(options: ClientOptions, workflowId: string);
521
+ /**
522
+ * Creates an async generator that processes a readable stream and yields vNext workflow records
523
+ * separated by the Record Separator character (\x1E)
524
+ *
525
+ * @param stream - The readable stream to process
526
+ * @returns An async generator that yields parsed records
527
+ */
528
+ private streamProcessor;
529
+ /**
530
+ * Retrieves details about the vNext workflow
531
+ * @returns Promise containing vNext workflow details including steps and graphs
532
+ */
533
+ details(): Promise<GetVNextWorkflowResponse>;
534
+ /**
535
+ * Retrieves all runs for a vNext workflow
536
+ * @param params - Parameters for filtering runs
537
+ * @returns Promise containing vNext workflow runs array
538
+ */
539
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
540
+ /**
541
+ * Creates a new vNext workflow run
542
+ * @param params - Optional object containing the optional runId
543
+ * @returns Promise containing the runId of the created run
544
+ */
545
+ createRun(params?: {
546
+ runId?: string;
547
+ }): Promise<{
548
+ runId: string;
549
+ }>;
550
+ /**
551
+ * Starts a vNext workflow run synchronously without waiting for the workflow to complete
552
+ * @param params - Object containing the runId, inputData and runtimeContext
553
+ * @returns Promise containing success message
554
+ */
555
+ start(params: {
556
+ runId: string;
557
+ inputData: Record<string, any>;
558
+ runtimeContext?: RuntimeContext;
559
+ }): Promise<{
560
+ message: string;
561
+ }>;
562
+ /**
563
+ * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
564
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
565
+ * @returns Promise containing success message
566
+ */
567
+ resume({ step, runId, resumeData, runtimeContext, }: {
568
+ step: string | string[];
569
+ runId: string;
570
+ resumeData?: Record<string, any>;
571
+ runtimeContext?: RuntimeContext;
572
+ }): Promise<{
573
+ message: string;
574
+ }>;
575
+ /**
576
+ * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
577
+ * @param params - Object containing the optional runId, inputData and runtimeContext
578
+ * @returns Promise containing the vNext workflow execution results
579
+ */
580
+ startAsync(params: {
581
+ runId?: string;
582
+ inputData: Record<string, any>;
583
+ runtimeContext?: RuntimeContext;
584
+ }): Promise<VNextWorkflowRunResult>;
585
+ /**
586
+ * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
587
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
588
+ * @returns Promise containing the vNext workflow resume results
589
+ */
590
+ resumeAsync(params: {
591
+ runId: string;
592
+ step: string | string[];
593
+ resumeData?: Record<string, any>;
594
+ runtimeContext?: RuntimeContext;
595
+ }): Promise<VNextWorkflowRunResult>;
596
+ /**
597
+ * Watches vNext workflow transitions in real-time
598
+ * @param runId - Optional run ID to filter the watch stream
599
+ * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
600
+ */
601
+ watch({ runId }: {
602
+ runId?: string;
603
+ }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
604
+ }
605
+
475
606
  declare class MastraClient extends BaseResource {
476
607
  constructor(options: ClientOptions);
477
608
  /**
@@ -479,6 +610,9 @@ declare class MastraClient extends BaseResource {
479
610
  * @returns Promise containing map of agent IDs to agent details
480
611
  */
481
612
  getAgents(): Promise<Record<string, GetAgentResponse>>;
613
+ getAGUI({ resourceId }: {
614
+ resourceId: string;
615
+ }): Promise<Record<string, AbstractAgent>>;
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 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,8 +1,11 @@
1
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
1
+ import { AbstractAgent } from '@ag-ui/client';
2
+ import { processDataStream } from '@ai-sdk/ui-utils';
3
+ import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
2
4
  import { JSONSchema7 } from 'json-schema';
3
5
  import { ZodSchema } from 'zod';
4
- import { processDataStream } from '@ai-sdk/ui-utils';
5
6
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
8
+ import { RuntimeContext } from '@mastra/core/runtime-context';
6
9
 
7
10
  interface ClientOptions {
8
11
  /** Base URL for API requests */
@@ -38,6 +41,9 @@ type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
38
41
  } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
39
42
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
40
43
  evals: any[];
44
+ instructions: string;
45
+ name: string;
46
+ id: string;
41
47
  }
42
48
  interface GetToolResponse {
43
49
  id: string;
@@ -53,6 +59,14 @@ interface GetWorkflowResponse {
53
59
  stepSubscriberGraph: Record<string, StepGraph>;
54
60
  workflowId?: string;
55
61
  }
62
+ interface GetWorkflowRunsParams {
63
+ fromDate?: Date;
64
+ toDate?: Date;
65
+ limit?: number;
66
+ offset?: number;
67
+ resourceId?: string;
68
+ }
69
+ type GetWorkflowRunsResponse = WorkflowRuns;
56
70
  type WorkflowRunResult = {
57
71
  activePaths: Record<string, {
58
72
  status: string;
@@ -63,6 +77,26 @@ type WorkflowRunResult = {
63
77
  timestamp: number;
64
78
  runId: string;
65
79
  };
80
+ interface GetVNextWorkflowResponse {
81
+ name: string;
82
+ steps: {
83
+ [key: string]: {
84
+ id: string;
85
+ description: string;
86
+ inputSchema: string;
87
+ outputSchema: string;
88
+ resumeSchema: string;
89
+ suspendSchema: string;
90
+ };
91
+ };
92
+ stepGraph: NewWorkflow['serializedStepGraph'];
93
+ inputSchema: string;
94
+ outputSchema: string;
95
+ }
96
+ type VNextWorkflowWatchResult = WatchEvent & {
97
+ runId: string;
98
+ };
99
+ type VNextWorkflowRunResult = WorkflowResult<any, any>;
66
100
  interface UpsertVectorParams {
67
101
  indexName: string;
68
102
  vectors: number[][];
@@ -171,6 +205,8 @@ interface GetTelemetryParams {
171
205
  page?: number;
172
206
  perPage?: number;
173
207
  attribute?: Record<string, string>;
208
+ fromDate?: Date;
209
+ toDate?: Date;
174
210
  }
175
211
  interface GetNetworkResponse {
176
212
  name: string;
@@ -376,6 +412,12 @@ declare class Workflow extends BaseResource {
376
412
  * @returns Promise containing workflow details including steps and graphs
377
413
  */
378
414
  details(): Promise<GetWorkflowResponse>;
415
+ /**
416
+ * Retrieves all runs for a workflow
417
+ * @param params - Parameters for filtering runs
418
+ * @returns Promise containing workflow runs array
419
+ */
420
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
379
421
  /**
380
422
  * @deprecated Use `startAsync` instead
381
423
  * Executes the workflow with the provided parameters
@@ -469,9 +511,98 @@ declare class Tool extends BaseResource {
469
511
  */
470
512
  execute(params: {
471
513
  data: any;
514
+ runId?: string;
472
515
  }): Promise<any>;
473
516
  }
474
517
 
518
+ declare class VNextWorkflow extends BaseResource {
519
+ private workflowId;
520
+ constructor(options: ClientOptions, workflowId: string);
521
+ /**
522
+ * Creates an async generator that processes a readable stream and yields vNext workflow records
523
+ * separated by the Record Separator character (\x1E)
524
+ *
525
+ * @param stream - The readable stream to process
526
+ * @returns An async generator that yields parsed records
527
+ */
528
+ private streamProcessor;
529
+ /**
530
+ * Retrieves details about the vNext workflow
531
+ * @returns Promise containing vNext workflow details including steps and graphs
532
+ */
533
+ details(): Promise<GetVNextWorkflowResponse>;
534
+ /**
535
+ * Retrieves all runs for a vNext workflow
536
+ * @param params - Parameters for filtering runs
537
+ * @returns Promise containing vNext workflow runs array
538
+ */
539
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
540
+ /**
541
+ * Creates a new vNext workflow run
542
+ * @param params - Optional object containing the optional runId
543
+ * @returns Promise containing the runId of the created run
544
+ */
545
+ createRun(params?: {
546
+ runId?: string;
547
+ }): Promise<{
548
+ runId: string;
549
+ }>;
550
+ /**
551
+ * Starts a vNext workflow run synchronously without waiting for the workflow to complete
552
+ * @param params - Object containing the runId, inputData and runtimeContext
553
+ * @returns Promise containing success message
554
+ */
555
+ start(params: {
556
+ runId: string;
557
+ inputData: Record<string, any>;
558
+ runtimeContext?: RuntimeContext;
559
+ }): Promise<{
560
+ message: string;
561
+ }>;
562
+ /**
563
+ * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
564
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
565
+ * @returns Promise containing success message
566
+ */
567
+ resume({ step, runId, resumeData, runtimeContext, }: {
568
+ step: string | string[];
569
+ runId: string;
570
+ resumeData?: Record<string, any>;
571
+ runtimeContext?: RuntimeContext;
572
+ }): Promise<{
573
+ message: string;
574
+ }>;
575
+ /**
576
+ * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
577
+ * @param params - Object containing the optional runId, inputData and runtimeContext
578
+ * @returns Promise containing the vNext workflow execution results
579
+ */
580
+ startAsync(params: {
581
+ runId?: string;
582
+ inputData: Record<string, any>;
583
+ runtimeContext?: RuntimeContext;
584
+ }): Promise<VNextWorkflowRunResult>;
585
+ /**
586
+ * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
587
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
588
+ * @returns Promise containing the vNext workflow resume results
589
+ */
590
+ resumeAsync(params: {
591
+ runId: string;
592
+ step: string | string[];
593
+ resumeData?: Record<string, any>;
594
+ runtimeContext?: RuntimeContext;
595
+ }): Promise<VNextWorkflowRunResult>;
596
+ /**
597
+ * Watches vNext workflow transitions in real-time
598
+ * @param runId - Optional run ID to filter the watch stream
599
+ * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
600
+ */
601
+ watch({ runId }: {
602
+ runId?: string;
603
+ }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
604
+ }
605
+
475
606
  declare class MastraClient extends BaseResource {
476
607
  constructor(options: ClientOptions);
477
608
  /**
@@ -479,6 +610,9 @@ declare class MastraClient extends BaseResource {
479
610
  * @returns Promise containing map of agent IDs to agent details
480
611
  */
481
612
  getAgents(): Promise<Record<string, GetAgentResponse>>;
613
+ getAGUI({ resourceId }: {
614
+ resourceId: string;
615
+ }): Promise<Record<string, AbstractAgent>>;
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 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 };