@mastra/client-js 0.0.0-bundle-dynamic-imports-20250424001248 → 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 +285 -2
- package/dist/index.cjs +576 -17
- package/dist/index.d.cts +222 -7
- package/dist/index.d.ts +222 -7
- package/dist/index.js +572 -17
- package/package.json +9 -7
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +56 -2
- package/src/index.test.ts +34 -4
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +27 -36
- package/src/resources/base.ts +1 -1
- package/src/resources/index.ts +2 -0
- package/src/resources/memory-thread.ts +13 -3
- package/src/resources/network.ts +6 -12
- package/src/resources/tool.ts +15 -3
- package/src/resources/vnext-workflow.ts +261 -0
- package/src/resources/workflow.ts +38 -2
- package/src/types.ts +48 -2
- package/src/utils/zod-to-json-schema.ts +10 -0
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
|
|
|
@@ -40,20 +42,24 @@ export interface GetAgentResponse {
|
|
|
40
42
|
name: string;
|
|
41
43
|
instructions: string;
|
|
42
44
|
tools: Record<string, GetToolResponse>;
|
|
45
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
43
46
|
provider: string;
|
|
44
47
|
modelId: string;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
48
51
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
49
|
-
} & Partial<AgentGenerateOptions<T>>;
|
|
52
|
+
} & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
|
|
50
53
|
|
|
51
54
|
export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
52
55
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
53
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
56
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
|
|
54
57
|
|
|
55
58
|
export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
56
59
|
evals: any[];
|
|
60
|
+
instructions: string;
|
|
61
|
+
name: string;
|
|
62
|
+
id: string;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
export interface GetToolResponse {
|
|
@@ -72,12 +78,43 @@ export interface GetWorkflowResponse {
|
|
|
72
78
|
workflowId?: string;
|
|
73
79
|
}
|
|
74
80
|
|
|
81
|
+
export interface GetWorkflowRunsParams {
|
|
82
|
+
fromDate?: Date;
|
|
83
|
+
toDate?: Date;
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
86
|
+
resourceId?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type GetWorkflowRunsResponse = WorkflowRuns;
|
|
90
|
+
|
|
75
91
|
export type WorkflowRunResult = {
|
|
76
92
|
activePaths: Record<string, { status: string; suspendPayload?: any; stepPath: string[] }>;
|
|
77
93
|
results: CoreWorkflowRunResult<any, any, any>['results'];
|
|
78
94
|
timestamp: number;
|
|
79
95
|
runId: string;
|
|
80
96
|
};
|
|
97
|
+
|
|
98
|
+
export interface GetVNextWorkflowResponse {
|
|
99
|
+
name: string;
|
|
100
|
+
steps: {
|
|
101
|
+
[key: string]: {
|
|
102
|
+
id: string;
|
|
103
|
+
description: string;
|
|
104
|
+
inputSchema: string;
|
|
105
|
+
outputSchema: string;
|
|
106
|
+
resumeSchema: string;
|
|
107
|
+
suspendSchema: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
stepGraph: NewWorkflow['serializedStepGraph'];
|
|
111
|
+
inputSchema: string;
|
|
112
|
+
outputSchema: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type VNextWorkflowWatchResult = WatchEvent & { runId: string };
|
|
116
|
+
|
|
117
|
+
export type VNextWorkflowRunResult = VNextWorkflowResult<any, any>;
|
|
81
118
|
export interface UpsertVectorParams {
|
|
82
119
|
indexName: string;
|
|
83
120
|
vectors: number[][];
|
|
@@ -138,6 +175,13 @@ export interface UpdateMemoryThreadParams {
|
|
|
138
175
|
resourceId: string;
|
|
139
176
|
}
|
|
140
177
|
|
|
178
|
+
export interface GetMemoryThreadMessagesParams {
|
|
179
|
+
/**
|
|
180
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
181
|
+
*/
|
|
182
|
+
limit?: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
141
185
|
export interface GetMemoryThreadMessagesResponse {
|
|
142
186
|
messages: CoreMessage[];
|
|
143
187
|
uiMessages: AiMessageType[];
|
|
@@ -206,6 +250,8 @@ export interface GetTelemetryParams {
|
|
|
206
250
|
page?: number;
|
|
207
251
|
perPage?: number;
|
|
208
252
|
attribute?: Record<string, string>;
|
|
253
|
+
fromDate?: Date;
|
|
254
|
+
toDate?: Date;
|
|
209
255
|
}
|
|
210
256
|
|
|
211
257
|
export interface GetNetworkResponse {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ZodSchema } from 'zod';
|
|
2
|
+
import originalZodToJsonSchema from 'zod-to-json-schema';
|
|
3
|
+
|
|
4
|
+
export function zodToJsonSchema<T extends ZodSchema | any>(zodSchema: T) {
|
|
5
|
+
if (!(zodSchema instanceof ZodSchema)) {
|
|
6
|
+
return zodSchema;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return originalZodToJsonSchema(zodSchema, { $refStrategy: 'none' });
|
|
10
|
+
}
|