@mastra/client-js 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-fix-message-embedding-20250506021742

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,4 +1,10 @@
1
- import type { GetWorkflowResponse, ClientOptions, WorkflowRunResult } from '../types';
1
+ import type {
2
+ GetWorkflowResponse,
3
+ ClientOptions,
4
+ WorkflowRunResult,
5
+ GetWorkflowRunsResponse,
6
+ GetWorkflowRunsParams,
7
+ } from '../types';
2
8
 
3
9
  import { BaseResource } from './base';
4
10
 
@@ -20,6 +26,36 @@ export class Workflow extends BaseResource {
20
26
  return this.request(`/api/workflows/${this.workflowId}`);
21
27
  }
22
28
 
29
+ /**
30
+ * Retrieves all runs for a workflow
31
+ * @param params - Parameters for filtering runs
32
+ * @returns Promise containing workflow runs array
33
+ */
34
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse> {
35
+ const searchParams = new URLSearchParams();
36
+ if (params?.fromDate) {
37
+ searchParams.set('fromDate', params.fromDate.toISOString());
38
+ }
39
+ if (params?.toDate) {
40
+ searchParams.set('toDate', params.toDate.toISOString());
41
+ }
42
+ if (params?.limit) {
43
+ searchParams.set('limit', String(params.limit));
44
+ }
45
+ if (params?.offset) {
46
+ searchParams.set('offset', String(params.offset));
47
+ }
48
+ if (params?.resourceId) {
49
+ searchParams.set('resourceId', params.resourceId);
50
+ }
51
+
52
+ if (searchParams.size) {
53
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
54
+ } else {
55
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
56
+ }
57
+ }
58
+
23
59
  /**
24
60
  * @deprecated Use `startAsync` instead
25
61
  * Executes the workflow with the provided parameters
@@ -168,7 +204,7 @@ export class Workflow extends BaseResource {
168
204
  }
169
205
  }
170
206
  }
171
- } catch (error) {
207
+ } catch {
172
208
  // Silently ignore parsing errors to maintain stream processing
173
209
  // This allows the stream to continue even if one record is malformed
174
210
  }
package/src/types.ts CHANGED
@@ -8,9 +8,11 @@ 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';
15
+ import type { NewWorkflow, WatchEvent, WorkflowResult as VNextWorkflowResult } from '@mastra/core/workflows/vNext';
14
16
  import type { JSONSchema7 } from 'json-schema';
15
17
  import type { ZodSchema } from 'zod';
16
18
 
@@ -54,6 +56,9 @@ export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefin
54
56
 
55
57
  export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
56
58
  evals: any[];
59
+ instructions: string;
60
+ name: string;
61
+ id: string;
57
62
  }
58
63
 
59
64
  export interface GetToolResponse {
@@ -72,12 +77,43 @@ export interface GetWorkflowResponse {
72
77
  workflowId?: string;
73
78
  }
74
79
 
80
+ export interface GetWorkflowRunsParams {
81
+ fromDate?: Date;
82
+ toDate?: Date;
83
+ limit?: number;
84
+ offset?: number;
85
+ resourceId?: string;
86
+ }
87
+
88
+ export type GetWorkflowRunsResponse = WorkflowRuns;
89
+
75
90
  export type WorkflowRunResult = {
76
91
  activePaths: Record<string, { status: string; suspendPayload?: any; stepPath: string[] }>;
77
92
  results: CoreWorkflowRunResult<any, any, any>['results'];
78
93
  timestamp: number;
79
94
  runId: string;
80
95
  };
96
+
97
+ export interface GetVNextWorkflowResponse {
98
+ name: string;
99
+ steps: {
100
+ [key: string]: {
101
+ id: string;
102
+ description: string;
103
+ inputSchema: string;
104
+ outputSchema: string;
105
+ resumeSchema: string;
106
+ suspendSchema: string;
107
+ };
108
+ };
109
+ stepGraph: NewWorkflow['serializedStepGraph'];
110
+ inputSchema: string;
111
+ outputSchema: string;
112
+ }
113
+
114
+ export type VNextWorkflowWatchResult = WatchEvent & { runId: string };
115
+
116
+ export type VNextWorkflowRunResult = VNextWorkflowResult<any, any>;
81
117
  export interface UpsertVectorParams {
82
118
  indexName: string;
83
119
  vectors: number[][];
@@ -118,7 +154,7 @@ export type SaveMessageToMemoryResponse = MessageType[];
118
154
  export interface CreateMemoryThreadParams {
119
155
  title: string;
120
156
  metadata: Record<string, any>;
121
- resourceid: string;
157
+ resourceId: string;
122
158
  threadId: string;
123
159
  agentId: string;
124
160
  }
@@ -135,7 +171,7 @@ export type GetMemoryThreadResponse = StorageThreadType[];
135
171
  export interface UpdateMemoryThreadParams {
136
172
  title: string;
137
173
  metadata: Record<string, any>;
138
- resourceid: string;
174
+ resourceId: string;
139
175
  }
140
176
 
141
177
  export interface GetMemoryThreadMessagesResponse {
@@ -197,7 +233,7 @@ type Span = {
197
233
  };
198
234
 
199
235
  export interface GetTelemetryResponse {
200
- traces: { traces: Span[] };
236
+ traces: Span[];
201
237
  }
202
238
 
203
239
  export interface GetTelemetryParams {
@@ -206,6 +242,8 @@ export interface GetTelemetryParams {
206
242
  page?: number;
207
243
  perPage?: number;
208
244
  attribute?: Record<string, string>;
245
+ fromDate?: Date;
246
+ toDate?: Date;
209
247
  }
210
248
 
211
249
  export interface GetNetworkResponse {