@mastra/client-js 0.1.19 → 0.1.20-alpha.1

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.1.19-alpha.8 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.1.20-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
3
  > tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -9,11 +9,11 @@
9
9
  CLI Cleaning output folder
10
10
  ESM Build start
11
11
  CJS Build start
12
- ESM dist/index.js 27.12 KB
13
- ESM ⚡️ Build success in 881ms
14
- CJS dist/index.cjs 27.30 KB
15
- CJS ⚡️ Build success in 882ms
12
+ CJS dist/index.cjs 27.80 KB
13
+ CJS ⚡️ Build success in 843ms
14
+ ESM dist/index.js 27.62 KB
15
+ ESM ⚡️ Build success in 844ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 13378ms
18
- DTS dist/index.d.ts 23.89 KB
19
- DTS dist/index.d.cts 23.89 KB
17
+ DTS ⚡️ Build success in 11136ms
18
+ DTS dist/index.d.ts 24.60 KB
19
+ DTS dist/index.d.cts 24.60 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.1.20-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 254f5c3: Audit, cleanup MastraClient
8
+ - 2429c74: Add get workflow runs api to client-js
9
+ - Updated dependencies [b804723]
10
+ - @mastra/core@0.9.2-alpha.1
11
+
12
+ ## 0.1.20-alpha.0
13
+
14
+ ### Patch Changes
15
+
16
+ - 0097d50: Add serializedStepGraph to vNext workflow
17
+ Return serializedStepGraph from vNext workflow
18
+ Use serializedStepGraph in vNext workflow graph
19
+ - Updated dependencies [0097d50]
20
+ - @mastra/core@0.9.2-alpha.0
21
+
3
22
  ## 0.1.19
4
23
 
5
24
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ var uiUtils = require('@ai-sdk/ui-utils');
3
4
  var zod = require('zod');
4
5
  var zodToJsonSchema = require('zod-to-json-schema');
5
- var uiUtils = require('@ai-sdk/ui-utils');
6
6
 
7
7
  // src/resources/agent.ts
8
8
 
@@ -373,6 +373,13 @@ var Workflow = class extends BaseResource {
373
373
  details() {
374
374
  return this.request(`/api/workflows/${this.workflowId}`);
375
375
  }
376
+ /**
377
+ * Retrieves all runs for a workflow
378
+ * @returns Promise containing workflow runs array
379
+ */
380
+ runs() {
381
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
382
+ }
376
383
  /**
377
384
  * @deprecated Use `startAsync` instead
378
385
  * Executes the workflow with the provided parameters
@@ -489,7 +496,7 @@ var Workflow = class extends BaseResource {
489
496
  }
490
497
  }
491
498
  }
492
- } catch (error) {
499
+ } catch {
493
500
  }
494
501
  }
495
502
  if (buffer) {
@@ -543,9 +550,13 @@ var Tool = class extends BaseResource {
543
550
  * @returns Promise containing the tool execution results
544
551
  */
545
552
  execute(params) {
546
- return this.request(`/api/tools/${this.toolId}/execute`, {
553
+ const url = new URLSearchParams();
554
+ if (params.runId) {
555
+ url.set("runId", params.runId);
556
+ }
557
+ return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
547
558
  method: "POST",
548
- body: params
559
+ body: params.data
549
560
  });
550
561
  }
551
562
  };
@@ -588,7 +599,7 @@ var VNextWorkflow = class extends BaseResource {
588
599
  }
589
600
  }
590
601
  }
591
- } catch (error) {
602
+ } catch {
592
603
  }
593
604
  }
594
605
  if (buffer) {
@@ -609,6 +620,13 @@ var VNextWorkflow = class extends BaseResource {
609
620
  details() {
610
621
  return this.request(`/api/workflows/v-next/${this.workflowId}`);
611
622
  }
623
+ /**
624
+ * Retrieves all runs for a vNext workflow
625
+ * @returns Promise containing vNext workflow runs array
626
+ */
627
+ runs() {
628
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
629
+ }
612
630
  /**
613
631
  * Creates a new vNext workflow run
614
632
  * @param params - Optional object containing the optional runId
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
1
+ import { processDataStream } from '@ai-sdk/ui-utils';
2
+ import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
2
3
  import { JSONSchema7 } from 'json-schema';
3
4
  import { ZodSchema } from 'zod';
4
- import { processDataStream } from '@ai-sdk/ui-utils';
5
5
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
6
6
  import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
7
7
  import { RuntimeContext } from '@mastra/core/runtime-context';
@@ -40,6 +40,9 @@ type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
40
40
  } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
41
41
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
42
42
  evals: any[];
43
+ instructions: string;
44
+ name: string;
45
+ id: string;
43
46
  }
44
47
  interface GetToolResponse {
45
48
  id: string;
@@ -55,6 +58,7 @@ interface GetWorkflowResponse {
55
58
  stepSubscriberGraph: Record<string, StepGraph>;
56
59
  workflowId?: string;
57
60
  }
61
+ type GetWorkflowRunsResponse = WorkflowRuns;
58
62
  type WorkflowRunResult = {
59
63
  activePaths: Record<string, {
60
64
  status: string;
@@ -67,8 +71,17 @@ type WorkflowRunResult = {
67
71
  };
68
72
  interface GetVNextWorkflowResponse {
69
73
  name: string;
70
- steps: NewWorkflow['steps'];
71
- stepGraph: NewWorkflow['stepGraph'];
74
+ steps: {
75
+ [key: string]: {
76
+ id: string;
77
+ description: string;
78
+ inputSchema: string;
79
+ outputSchema: string;
80
+ resumeSchema: string;
81
+ suspendSchema: string;
82
+ };
83
+ };
84
+ stepGraph: NewWorkflow['serializedStepGraph'];
72
85
  inputSchema: string;
73
86
  outputSchema: string;
74
87
  }
@@ -389,6 +402,11 @@ declare class Workflow extends BaseResource {
389
402
  * @returns Promise containing workflow details including steps and graphs
390
403
  */
391
404
  details(): Promise<GetWorkflowResponse>;
405
+ /**
406
+ * Retrieves all runs for a workflow
407
+ * @returns Promise containing workflow runs array
408
+ */
409
+ runs(): Promise<GetWorkflowRunsResponse>;
392
410
  /**
393
411
  * @deprecated Use `startAsync` instead
394
412
  * Executes the workflow with the provided parameters
@@ -482,6 +500,7 @@ declare class Tool extends BaseResource {
482
500
  */
483
501
  execute(params: {
484
502
  data: any;
503
+ runId?: string;
485
504
  }): Promise<any>;
486
505
  }
487
506
 
@@ -501,6 +520,11 @@ declare class VNextWorkflow extends BaseResource {
501
520
  * @returns Promise containing vNext workflow details including steps and graphs
502
521
  */
503
522
  details(): Promise<GetVNextWorkflowResponse>;
523
+ /**
524
+ * Retrieves all runs for a vNext workflow
525
+ * @returns Promise containing vNext workflow runs array
526
+ */
527
+ runs(): Promise<GetWorkflowRunsResponse>;
504
528
  /**
505
529
  * Creates a new vNext workflow run
506
530
  * @param params - Optional object containing the optional runId
@@ -688,4 +712,4 @@ declare class MastraClient extends BaseResource {
688
712
  getNetwork(networkId: string): Network;
689
713
  }
690
714
 
691
- 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, 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 };
715
+ 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,7 +1,7 @@
1
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
1
+ import { processDataStream } from '@ai-sdk/ui-utils';
2
+ import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
2
3
  import { JSONSchema7 } from 'json-schema';
3
4
  import { ZodSchema } from 'zod';
4
- import { processDataStream } from '@ai-sdk/ui-utils';
5
5
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
6
6
  import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
7
7
  import { RuntimeContext } from '@mastra/core/runtime-context';
@@ -40,6 +40,9 @@ type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
40
40
  } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
41
41
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
42
42
  evals: any[];
43
+ instructions: string;
44
+ name: string;
45
+ id: string;
43
46
  }
44
47
  interface GetToolResponse {
45
48
  id: string;
@@ -55,6 +58,7 @@ interface GetWorkflowResponse {
55
58
  stepSubscriberGraph: Record<string, StepGraph>;
56
59
  workflowId?: string;
57
60
  }
61
+ type GetWorkflowRunsResponse = WorkflowRuns;
58
62
  type WorkflowRunResult = {
59
63
  activePaths: Record<string, {
60
64
  status: string;
@@ -67,8 +71,17 @@ type WorkflowRunResult = {
67
71
  };
68
72
  interface GetVNextWorkflowResponse {
69
73
  name: string;
70
- steps: NewWorkflow['steps'];
71
- stepGraph: NewWorkflow['stepGraph'];
74
+ steps: {
75
+ [key: string]: {
76
+ id: string;
77
+ description: string;
78
+ inputSchema: string;
79
+ outputSchema: string;
80
+ resumeSchema: string;
81
+ suspendSchema: string;
82
+ };
83
+ };
84
+ stepGraph: NewWorkflow['serializedStepGraph'];
72
85
  inputSchema: string;
73
86
  outputSchema: string;
74
87
  }
@@ -389,6 +402,11 @@ declare class Workflow extends BaseResource {
389
402
  * @returns Promise containing workflow details including steps and graphs
390
403
  */
391
404
  details(): Promise<GetWorkflowResponse>;
405
+ /**
406
+ * Retrieves all runs for a workflow
407
+ * @returns Promise containing workflow runs array
408
+ */
409
+ runs(): Promise<GetWorkflowRunsResponse>;
392
410
  /**
393
411
  * @deprecated Use `startAsync` instead
394
412
  * Executes the workflow with the provided parameters
@@ -482,6 +500,7 @@ declare class Tool extends BaseResource {
482
500
  */
483
501
  execute(params: {
484
502
  data: any;
503
+ runId?: string;
485
504
  }): Promise<any>;
486
505
  }
487
506
 
@@ -501,6 +520,11 @@ declare class VNextWorkflow extends BaseResource {
501
520
  * @returns Promise containing vNext workflow details including steps and graphs
502
521
  */
503
522
  details(): Promise<GetVNextWorkflowResponse>;
523
+ /**
524
+ * Retrieves all runs for a vNext workflow
525
+ * @returns Promise containing vNext workflow runs array
526
+ */
527
+ runs(): Promise<GetWorkflowRunsResponse>;
504
528
  /**
505
529
  * Creates a new vNext workflow run
506
530
  * @param params - Optional object containing the optional runId
@@ -688,4 +712,4 @@ declare class MastraClient extends BaseResource {
688
712
  getNetwork(networkId: string): Network;
689
713
  }
690
714
 
691
- 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, 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 };
715
+ 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.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { processDataStream } from '@ai-sdk/ui-utils';
1
2
  import { ZodSchema } from 'zod';
2
3
  import { zodToJsonSchema } from 'zod-to-json-schema';
3
- import { processDataStream } from '@ai-sdk/ui-utils';
4
4
 
5
5
  // src/resources/agent.ts
6
6
 
@@ -371,6 +371,13 @@ var Workflow = class extends BaseResource {
371
371
  details() {
372
372
  return this.request(`/api/workflows/${this.workflowId}`);
373
373
  }
374
+ /**
375
+ * Retrieves all runs for a workflow
376
+ * @returns Promise containing workflow runs array
377
+ */
378
+ runs() {
379
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
380
+ }
374
381
  /**
375
382
  * @deprecated Use `startAsync` instead
376
383
  * Executes the workflow with the provided parameters
@@ -487,7 +494,7 @@ var Workflow = class extends BaseResource {
487
494
  }
488
495
  }
489
496
  }
490
- } catch (error) {
497
+ } catch {
491
498
  }
492
499
  }
493
500
  if (buffer) {
@@ -541,9 +548,13 @@ var Tool = class extends BaseResource {
541
548
  * @returns Promise containing the tool execution results
542
549
  */
543
550
  execute(params) {
544
- return this.request(`/api/tools/${this.toolId}/execute`, {
551
+ const url = new URLSearchParams();
552
+ if (params.runId) {
553
+ url.set("runId", params.runId);
554
+ }
555
+ return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
545
556
  method: "POST",
546
- body: params
557
+ body: params.data
547
558
  });
548
559
  }
549
560
  };
@@ -586,7 +597,7 @@ var VNextWorkflow = class extends BaseResource {
586
597
  }
587
598
  }
588
599
  }
589
- } catch (error) {
600
+ } catch {
590
601
  }
591
602
  }
592
603
  if (buffer) {
@@ -607,6 +618,13 @@ var VNextWorkflow = class extends BaseResource {
607
618
  details() {
608
619
  return this.request(`/api/workflows/v-next/${this.workflowId}`);
609
620
  }
621
+ /**
622
+ * Retrieves all runs for a vNext workflow
623
+ * @returns Promise containing vNext workflow runs array
624
+ */
625
+ runs() {
626
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
627
+ }
610
628
  /**
611
629
  * Creates a new vNext workflow run
612
630
  * @param params - Optional object containing the optional runId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.1.19",
3
+ "version": "0.1.20-alpha.1",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "json-schema": "^0.4.0",
27
27
  "zod": "^3.24.2",
28
28
  "zod-to-json-schema": "^3.24.3",
29
- "@mastra/core": "^0.9.1"
29
+ "@mastra/core": "^0.9.2-alpha.1"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "zod": "^3.24.2"
package/src/index.test.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { MessageType } from '@mastra/core';
2
1
  import { describe, expect, beforeEach, it, vi } from 'vitest';
3
2
 
4
3
  import { MastraClient } from './client';
@@ -489,7 +488,7 @@ describe('MastraClient Resources', () => {
489
488
  const result = await memoryThread.update({
490
489
  title: 'Updated Thread',
491
490
  metadata: { updated: true },
492
- resourceid: 'test-resource',
491
+ resourceId: 'test-resource',
493
492
  });
494
493
  expect(result).toEqual(mockResponse);
495
494
  expect(global.fetch).toHaveBeenCalledWith(
@@ -536,6 +535,7 @@ describe('MastraClient Resources', () => {
536
535
  content: 'test',
537
536
  role: 'user' as const,
538
537
  threadId: 'test-thread',
538
+ resourceId: 'test-resource',
539
539
  createdAt: new Date('2025-03-26T10:40:55.116Z'),
540
540
  },
541
541
  ];
@@ -584,10 +584,10 @@ describe('MastraClient Resources', () => {
584
584
  it('should execute tool', async () => {
585
585
  const mockResponse = { data: 'test' };
586
586
  mockFetchResponse(mockResponse);
587
- const result = await tool.execute({ data: '' });
587
+ const result = await tool.execute({ data: '', runId: 'test-run-id' });
588
588
  expect(result).toEqual(mockResponse);
589
589
  expect(global.fetch).toHaveBeenCalledWith(
590
- `${clientOptions.baseUrl}/api/tools/test-tool/execute`,
590
+ `${clientOptions.baseUrl}/api/tools/test-tool/execute?runId=test-run-id`,
591
591
  expect.objectContaining({
592
592
  method: 'POST',
593
593
  headers: expect.objectContaining({
@@ -1,8 +1,8 @@
1
+ import { processDataStream } from '@ai-sdk/ui-utils';
1
2
  import type { GenerateReturn } from '@mastra/core';
2
3
  import type { JSONSchema7 } from 'json-schema';
3
4
  import { ZodSchema } from 'zod';
4
5
  import { zodToJsonSchema } from 'zod-to-json-schema';
5
- import { processDataStream } from '@ai-sdk/ui-utils';
6
6
 
7
7
  import type {
8
8
  GenerateParams,
@@ -29,7 +29,6 @@ export class AgentTool extends BaseResource {
29
29
  * @param params - Parameters required for tool execution
30
30
  * @returns Promise containing tool execution results
31
31
  */
32
- /** @deprecated use CreateRun/startRun */
33
32
  execute(params: { data: any }): Promise<any> {
34
33
  return this.request(`/api/agents/${this.agentId}/tools/${this.toolId}/execute`, {
35
34
  method: 'POST',
@@ -1,4 +1,4 @@
1
- import type { RequestFunction, RequestOptions, ClientOptions } from '../types';
1
+ import type { RequestOptions, ClientOptions } from '../types';
2
2
 
3
3
  export class BaseResource {
4
4
  readonly options: ClientOptions;
@@ -1,3 +1,4 @@
1
+ import { processDataStream } from '@ai-sdk/ui-utils';
1
2
  import type { GenerateReturn } from '@mastra/core';
2
3
  import type { JSONSchema7 } from 'json-schema';
3
4
  import { ZodSchema } from 'zod';
@@ -6,7 +7,6 @@ import { zodToJsonSchema } from 'zod-to-json-schema';
6
7
  import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types';
7
8
 
8
9
  import { BaseResource } from './base';
9
- import { processDataStream } from '@ai-sdk/ui-utils';
10
10
 
11
11
  export class Network extends BaseResource {
12
12
  constructor(
@@ -23,10 +23,16 @@ export class Tool extends BaseResource {
23
23
  * @param params - Parameters required for tool execution
24
24
  * @returns Promise containing the tool execution results
25
25
  */
26
- execute(params: { data: any }): Promise<any> {
27
- return this.request(`/api/tools/${this.toolId}/execute`, {
26
+ execute(params: { data: any; runId?: string }): Promise<any> {
27
+ const url = new URLSearchParams();
28
+
29
+ if (params.runId) {
30
+ url.set('runId', params.runId);
31
+ }
32
+
33
+ return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
28
34
  method: 'POST',
29
- body: params,
35
+ body: params.data,
30
36
  });
31
37
  }
32
38
  }
@@ -2,6 +2,7 @@ import type { RuntimeContext } from '@mastra/core/runtime-context';
2
2
  import type {
3
3
  ClientOptions,
4
4
  GetVNextWorkflowResponse,
5
+ GetWorkflowRunsResponse,
5
6
  VNextWorkflowRunResult,
6
7
  VNextWorkflowWatchResult,
7
8
  } from '../types';
@@ -67,7 +68,7 @@ export class VNextWorkflow extends BaseResource {
67
68
  }
68
69
  }
69
70
  }
70
- } catch (error) {
71
+ } catch {
71
72
  // Silently ignore parsing errors to maintain stream processing
72
73
  // This allows the stream to continue even if one record is malformed
73
74
  }
@@ -97,6 +98,14 @@ export class VNextWorkflow extends BaseResource {
97
98
  return this.request(`/api/workflows/v-next/${this.workflowId}`);
98
99
  }
99
100
 
101
+ /**
102
+ * Retrieves all runs for a vNext workflow
103
+ * @returns Promise containing vNext workflow runs array
104
+ */
105
+ runs(): Promise<GetWorkflowRunsResponse> {
106
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
107
+ }
108
+
100
109
  /**
101
110
  * Creates a new vNext workflow run
102
111
  * @param params - Optional object containing the optional runId
@@ -1,4 +1,4 @@
1
- import type { GetWorkflowResponse, ClientOptions, WorkflowRunResult } from '../types';
1
+ import type { GetWorkflowResponse, ClientOptions, WorkflowRunResult, GetWorkflowRunsResponse } from '../types';
2
2
 
3
3
  import { BaseResource } from './base';
4
4
 
@@ -20,6 +20,14 @@ export class Workflow extends BaseResource {
20
20
  return this.request(`/api/workflows/${this.workflowId}`);
21
21
  }
22
22
 
23
+ /**
24
+ * Retrieves all runs for a workflow
25
+ * @returns Promise containing workflow runs array
26
+ */
27
+ runs(): Promise<GetWorkflowRunsResponse> {
28
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
29
+ }
30
+
23
31
  /**
24
32
  * @deprecated Use `startAsync` instead
25
33
  * Executes the workflow with the provided parameters
@@ -168,7 +176,7 @@ export class Workflow extends BaseResource {
168
176
  }
169
177
  }
170
178
  }
171
- } catch (error) {
179
+ } catch {
172
180
  // Silently ignore parsing errors to maintain stream processing
173
181
  // This allows the stream to continue even if one record is malformed
174
182
  }
package/src/types.ts CHANGED
@@ -8,6 +8,7 @@ import type {
8
8
  StorageThreadType,
9
9
  BaseLogMessage,
10
10
  WorkflowRunResult as CoreWorkflowRunResult,
11
+ WorkflowRuns,
11
12
  } from '@mastra/core';
12
13
 
13
14
  import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
@@ -55,6 +56,9 @@ export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefin
55
56
 
56
57
  export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
57
58
  evals: any[];
59
+ instructions: string;
60
+ name: string;
61
+ id: string;
58
62
  }
59
63
 
60
64
  export interface GetToolResponse {
@@ -73,6 +77,8 @@ export interface GetWorkflowResponse {
73
77
  workflowId?: string;
74
78
  }
75
79
 
80
+ export type GetWorkflowRunsResponse = WorkflowRuns;
81
+
76
82
  export type WorkflowRunResult = {
77
83
  activePaths: Record<string, { status: string; suspendPayload?: any; stepPath: string[] }>;
78
84
  results: CoreWorkflowRunResult<any, any, any>['results'];
@@ -82,8 +88,17 @@ export type WorkflowRunResult = {
82
88
 
83
89
  export interface GetVNextWorkflowResponse {
84
90
  name: string;
85
- steps: NewWorkflow['steps'];
86
- stepGraph: NewWorkflow['stepGraph'];
91
+ steps: {
92
+ [key: string]: {
93
+ id: string;
94
+ description: string;
95
+ inputSchema: string;
96
+ outputSchema: string;
97
+ resumeSchema: string;
98
+ suspendSchema: string;
99
+ };
100
+ };
101
+ stepGraph: NewWorkflow['serializedStepGraph'];
87
102
  inputSchema: string;
88
103
  outputSchema: string;
89
104
  }