@mastra/client-js 0.1.21-alpha.0 → 0.1.21

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.21-alpha.0 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.1.21-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
- CJS dist/index.cjs 34.86 KB
13
- CJS ⚡️ Build success in 1418ms
14
- ESM dist/index.js 34.64 KB
15
- ESM ⚡️ Build success in 1423ms
12
+ CJS dist/index.cjs 35.18 KB
13
+ CJS ⚡️ Build success in 1096ms
14
+ ESM dist/index.js 34.95 KB
15
+ ESM ⚡️ Build success in 1096ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 13470ms
17
+ DTS ⚡️ Build success in 13790ms
18
18
  DTS dist/index.d.ts 25.12 KB
19
19
  DTS dist/index.d.cts 25.12 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.1.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 526c570: expose agent runtimeContext from clientSDK
8
+ - 36eb1aa: Fix AGUI text part
9
+ - 62c9e7d: Fix disappearing tool calls in streaming
10
+ - Updated dependencies [e450778]
11
+ - Updated dependencies [8902157]
12
+ - Updated dependencies [ca0dc88]
13
+ - Updated dependencies [526c570]
14
+ - Updated dependencies [d7a6a33]
15
+ - Updated dependencies [9cd1a46]
16
+ - Updated dependencies [b5d2de0]
17
+ - Updated dependencies [644f8ad]
18
+ - Updated dependencies [70dbf51]
19
+ - @mastra/core@0.9.3
20
+
21
+ ## 0.1.21-alpha.1
22
+
23
+ ### Patch Changes
24
+
25
+ - 36eb1aa: Fix AGUI text part
26
+ - 62c9e7d: Fix disappearing tool calls in streaming
27
+ - Updated dependencies [e450778]
28
+ - Updated dependencies [8902157]
29
+ - Updated dependencies [ca0dc88]
30
+ - Updated dependencies [9cd1a46]
31
+ - Updated dependencies [70dbf51]
32
+ - @mastra/core@0.9.3-alpha.1
33
+
3
34
  ## 0.1.21-alpha.0
4
35
 
5
36
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -44,6 +44,7 @@ var AGUIAdapter = class extends client.AbstractAgent {
44
44
  )
45
45
  }).then((response) => {
46
46
  let currentMessageId = void 0;
47
+ let isInTextMessage = false;
47
48
  return response.processDataStream({
48
49
  onTextPart: (text) => {
49
50
  if (currentMessageId === void 0) {
@@ -54,6 +55,7 @@ var AGUIAdapter = class extends client.AbstractAgent {
54
55
  role: "assistant"
55
56
  };
56
57
  subscriber.next(message2);
58
+ isInTextMessage = true;
57
59
  }
58
60
  const message = {
59
61
  type: client.EventType.TEXT_MESSAGE_CONTENT,
@@ -62,14 +64,14 @@ var AGUIAdapter = class extends client.AbstractAgent {
62
64
  };
63
65
  subscriber.next(message);
64
66
  },
65
- onFinishMessagePart: (message) => {
66
- console.log("onFinishMessagePart", message);
67
+ onFinishMessagePart: () => {
67
68
  if (currentMessageId !== void 0) {
68
- const message2 = {
69
+ const message = {
69
70
  type: client.EventType.TEXT_MESSAGE_END,
70
71
  messageId: currentMessageId
71
72
  };
72
- subscriber.next(message2);
73
+ subscriber.next(message);
74
+ isInTextMessage = false;
73
75
  }
74
76
  subscriber.next({
75
77
  type: client.EventType.RUN_FINISHED,
@@ -80,6 +82,14 @@ var AGUIAdapter = class extends client.AbstractAgent {
80
82
  },
81
83
  onToolCallPart(streamPart) {
82
84
  const parentMessageId = currentMessageId || generateUUID();
85
+ if (isInTextMessage) {
86
+ const message = {
87
+ type: client.EventType.TEXT_MESSAGE_END,
88
+ messageId: parentMessageId
89
+ };
90
+ subscriber.next(message);
91
+ isInTextMessage = false;
92
+ }
83
93
  subscriber.next({
84
94
  type: client.EventType.TOOL_CALL_START,
85
95
  toolCallId: streamPart.toolCallId,
@@ -100,7 +110,7 @@ var AGUIAdapter = class extends client.AbstractAgent {
100
110
  }
101
111
  });
102
112
  }).catch((error) => {
103
- console.log("error", error);
113
+ console.error("error", error);
104
114
  subscriber.error(error);
105
115
  });
106
116
  return () => {
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ var AGUIAdapter = class extends AbstractAgent {
42
42
  )
43
43
  }).then((response) => {
44
44
  let currentMessageId = void 0;
45
+ let isInTextMessage = false;
45
46
  return response.processDataStream({
46
47
  onTextPart: (text) => {
47
48
  if (currentMessageId === void 0) {
@@ -52,6 +53,7 @@ var AGUIAdapter = class extends AbstractAgent {
52
53
  role: "assistant"
53
54
  };
54
55
  subscriber.next(message2);
56
+ isInTextMessage = true;
55
57
  }
56
58
  const message = {
57
59
  type: EventType.TEXT_MESSAGE_CONTENT,
@@ -60,14 +62,14 @@ var AGUIAdapter = class extends AbstractAgent {
60
62
  };
61
63
  subscriber.next(message);
62
64
  },
63
- onFinishMessagePart: (message) => {
64
- console.log("onFinishMessagePart", message);
65
+ onFinishMessagePart: () => {
65
66
  if (currentMessageId !== void 0) {
66
- const message2 = {
67
+ const message = {
67
68
  type: EventType.TEXT_MESSAGE_END,
68
69
  messageId: currentMessageId
69
70
  };
70
- subscriber.next(message2);
71
+ subscriber.next(message);
72
+ isInTextMessage = false;
71
73
  }
72
74
  subscriber.next({
73
75
  type: EventType.RUN_FINISHED,
@@ -78,6 +80,14 @@ var AGUIAdapter = class extends AbstractAgent {
78
80
  },
79
81
  onToolCallPart(streamPart) {
80
82
  const parentMessageId = currentMessageId || generateUUID();
83
+ if (isInTextMessage) {
84
+ const message = {
85
+ type: EventType.TEXT_MESSAGE_END,
86
+ messageId: parentMessageId
87
+ };
88
+ subscriber.next(message);
89
+ isInTextMessage = false;
90
+ }
81
91
  subscriber.next({
82
92
  type: EventType.TOOL_CALL_START,
83
93
  toolCallId: streamPart.toolCallId,
@@ -98,7 +108,7 @@ var AGUIAdapter = class extends AbstractAgent {
98
108
  }
99
109
  });
100
110
  }).catch((error) => {
101
- console.log("error", error);
111
+ console.error("error", error);
102
112
  subscriber.error(error);
103
113
  });
104
114
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.1.21-alpha.0",
3
+ "version": "0.1.21",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -28,7 +28,7 @@
28
28
  "rxjs": "7.8.1",
29
29
  "zod": "^3.24.3",
30
30
  "zod-to-json-schema": "^3.24.5",
31
- "@mastra/core": "^0.9.3-alpha.0"
31
+ "@mastra/core": "^0.9.3"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "zod": "^3.24.2"
@@ -42,7 +42,7 @@
42
42
  "tsup": "^8.4.0",
43
43
  "typescript": "^5.8.2",
44
44
  "vitest": "^3.1.2",
45
- "@internal/lint": "0.0.3"
45
+ "@internal/lint": "0.0.4"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting",
@@ -66,17 +66,18 @@ export class AGUIAdapter extends AbstractAgent {
66
66
  })
67
67
  .then(response => {
68
68
  let currentMessageId: string | undefined = undefined;
69
+ let isInTextMessage = false;
69
70
  return response.processDataStream({
70
71
  onTextPart: text => {
71
72
  if (currentMessageId === undefined) {
72
73
  currentMessageId = generateUUID();
73
-
74
74
  const message: TextMessageStartEvent = {
75
75
  type: EventType.TEXT_MESSAGE_START,
76
76
  messageId: currentMessageId,
77
77
  role: 'assistant',
78
78
  };
79
79
  subscriber.next(message);
80
+ isInTextMessage = true;
80
81
  }
81
82
 
82
83
  const message: TextMessageContentEvent = {
@@ -86,14 +87,14 @@ export class AGUIAdapter extends AbstractAgent {
86
87
  };
87
88
  subscriber.next(message);
88
89
  },
89
- onFinishMessagePart: message => {
90
- console.log('onFinishMessagePart', message);
90
+ onFinishMessagePart: () => {
91
91
  if (currentMessageId !== undefined) {
92
92
  const message: TextMessageEndEvent = {
93
93
  type: EventType.TEXT_MESSAGE_END,
94
94
  messageId: currentMessageId,
95
95
  };
96
96
  subscriber.next(message);
97
+ isInTextMessage = false;
97
98
  }
98
99
  // Emit run finished event
99
100
  subscriber.next({
@@ -107,6 +108,15 @@ export class AGUIAdapter extends AbstractAgent {
107
108
  },
108
109
  onToolCallPart(streamPart) {
109
110
  const parentMessageId = currentMessageId || generateUUID();
111
+ if (isInTextMessage) {
112
+ const message: TextMessageEndEvent = {
113
+ type: EventType.TEXT_MESSAGE_END,
114
+ messageId: parentMessageId,
115
+ };
116
+ subscriber.next(message);
117
+ isInTextMessage = false;
118
+ }
119
+
110
120
  subscriber.next({
111
121
  type: EventType.TOOL_CALL_START,
112
122
  toolCallId: streamPart.toolCallId,
@@ -130,7 +140,7 @@ export class AGUIAdapter extends AbstractAgent {
130
140
  });
131
141
  })
132
142
  .catch(error => {
133
- console.log('error', error);
143
+ console.error('error', error);
134
144
  // Handle error
135
145
  subscriber.error(error);
136
146
  });