@mastra/client-js 0.12.2 → 0.12.3-alpha.0
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 +11 -0
- package/dist/index.cjs +46 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -4
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts +7 -2
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/process-mastra-stream.d.ts +5 -1
- package/dist/utils/process-mastra-stream.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ function zodToJsonSchema(zodSchema) {
|
|
|
26
26
|
const fn = "toJSONSchema";
|
|
27
27
|
return z[fn].call(z, zodSchema);
|
|
28
28
|
}
|
|
29
|
-
return originalZodToJsonSchema(zodSchema, { $refStrategy: "
|
|
29
|
+
return originalZodToJsonSchema(zodSchema, { $refStrategy: "relative" });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// src/utils/process-client-tools.ts
|
|
@@ -59,7 +59,7 @@ function processClientTools(clientTools) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
// src/utils/process-mastra-stream.ts
|
|
62
|
-
async function
|
|
62
|
+
async function sharedProcessMastraStream({
|
|
63
63
|
stream,
|
|
64
64
|
onChunk
|
|
65
65
|
}) {
|
|
@@ -93,6 +93,24 @@ async function processMastraStream({
|
|
|
93
93
|
reader.releaseLock();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
+
async function processMastraNetworkStream({
|
|
97
|
+
stream,
|
|
98
|
+
onChunk
|
|
99
|
+
}) {
|
|
100
|
+
return sharedProcessMastraStream({
|
|
101
|
+
stream,
|
|
102
|
+
onChunk
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async function processMastraStream({
|
|
106
|
+
stream,
|
|
107
|
+
onChunk
|
|
108
|
+
}) {
|
|
109
|
+
return sharedProcessMastraStream({
|
|
110
|
+
stream,
|
|
111
|
+
onChunk
|
|
112
|
+
});
|
|
113
|
+
}
|
|
96
114
|
|
|
97
115
|
// src/resources/base.ts
|
|
98
116
|
var BaseResource = class {
|
|
@@ -284,7 +302,7 @@ var Agent = class extends BaseResource {
|
|
|
284
302
|
}
|
|
285
303
|
async generate(params) {
|
|
286
304
|
console.warn(
|
|
287
|
-
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September 16th. Please use generateLegacy if you don't want to upgrade just yet."
|
|
305
|
+
"Deprecation NOTICE:Generate method will switch to use generateVNext implementation September 16th, 2025. Please use generateLegacy if you don't want to upgrade just yet."
|
|
288
306
|
);
|
|
289
307
|
return this.generateLegacy(params);
|
|
290
308
|
}
|
|
@@ -654,7 +672,7 @@ var Agent = class extends BaseResource {
|
|
|
654
672
|
*/
|
|
655
673
|
async stream(params) {
|
|
656
674
|
console.warn(
|
|
657
|
-
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September 16th. Please use streamLegacy if you don't want to upgrade just yet."
|
|
675
|
+
"Deprecation NOTICE:\nStream method will switch to use streamVNext implementation September 16th, 2025. Please use streamLegacy if you don't want to upgrade just yet."
|
|
658
676
|
);
|
|
659
677
|
return this.streamLegacy(params);
|
|
660
678
|
}
|
|
@@ -1058,6 +1076,30 @@ var Agent = class extends BaseResource {
|
|
|
1058
1076
|
}
|
|
1059
1077
|
return response;
|
|
1060
1078
|
}
|
|
1079
|
+
async network(params) {
|
|
1080
|
+
const response = await this.request(`/api/agents/${this.agentId}/network`, {
|
|
1081
|
+
method: "POST",
|
|
1082
|
+
body: params,
|
|
1083
|
+
stream: true
|
|
1084
|
+
});
|
|
1085
|
+
if (!response.body) {
|
|
1086
|
+
throw new Error("No response body");
|
|
1087
|
+
}
|
|
1088
|
+
const streamResponse = new Response(response.body, {
|
|
1089
|
+
status: response.status,
|
|
1090
|
+
statusText: response.statusText,
|
|
1091
|
+
headers: response.headers
|
|
1092
|
+
});
|
|
1093
|
+
streamResponse.processDataStream = async ({
|
|
1094
|
+
onChunk
|
|
1095
|
+
}) => {
|
|
1096
|
+
await processMastraNetworkStream({
|
|
1097
|
+
stream: streamResponse.body,
|
|
1098
|
+
onChunk
|
|
1099
|
+
});
|
|
1100
|
+
};
|
|
1101
|
+
return streamResponse;
|
|
1102
|
+
}
|
|
1061
1103
|
async streamVNext(params) {
|
|
1062
1104
|
const processedParams = {
|
|
1063
1105
|
...params,
|