@mastra/client-js 0.15.1-alpha.0 → 0.15.1-alpha.2
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 +18 -0
- package/dist/index.cjs +15 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/process-mastra-stream.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -784,6 +784,14 @@ var Agent = class extends BaseResource {
|
|
|
784
784
|
// but this is completely wrong and this fn is probably broken. Remove ":any" and you'll see a bunch of type errors
|
|
785
785
|
onChunk: async (chunk) => {
|
|
786
786
|
switch (chunk.type) {
|
|
787
|
+
case "tripwire": {
|
|
788
|
+
message.parts.push({
|
|
789
|
+
type: "text",
|
|
790
|
+
text: chunk.payload.tripwireReason
|
|
791
|
+
});
|
|
792
|
+
execUpdate();
|
|
793
|
+
break;
|
|
794
|
+
}
|
|
787
795
|
case "step-start": {
|
|
788
796
|
if (!replaceLastMessage) {
|
|
789
797
|
message.id = chunk.payload.messageId;
|
|
@@ -980,18 +988,17 @@ var Agent = class extends BaseResource {
|
|
|
980
988
|
streamForWritable.pipeTo(
|
|
981
989
|
new WritableStream({
|
|
982
990
|
async write(chunk) {
|
|
991
|
+
let writer;
|
|
983
992
|
try {
|
|
993
|
+
writer = writable.getWriter();
|
|
984
994
|
const text = new TextDecoder().decode(chunk);
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
995
|
+
const lines = text.split("\n\n");
|
|
996
|
+
const readableLines = lines.filter((line) => line !== "[DONE]").join("\n\n");
|
|
997
|
+
await writer.write(new TextEncoder().encode(readableLines));
|
|
988
998
|
} catch {
|
|
989
|
-
|
|
990
|
-
const writer = writable.getWriter();
|
|
991
|
-
try {
|
|
992
|
-
await writer.write(chunk);
|
|
999
|
+
await writer?.write(chunk);
|
|
993
1000
|
} finally {
|
|
994
|
-
writer
|
|
1001
|
+
writer?.releaseLock();
|
|
995
1002
|
}
|
|
996
1003
|
}
|
|
997
1004
|
}),
|