@mastra/client-js 0.0.0-fix-tool-call-history-20250731222019 → 0.0.0-fix-message-list-args-missing-20250807205055

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.
@@ -0,0 +1,18 @@
1
+
2
+ > @mastra/client-js@0.10.21-alpha.0 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
+ > tsup --config tsup.config.ts
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.0
8
+ CLI Using tsup config: /home/runner/work/mastra/mastra/client-sdks/client-js/tsup.config.ts
9
+ CLI Target: es2022
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
+ CJS Build start
13
+ CJS dist/index.cjs 76.11 KB
14
+ CJS dist/index.cjs.map 163.02 KB
15
+ CJS ⚡️ Build success in 2625ms
16
+ ESM dist/index.js 75.80 KB
17
+ ESM dist/index.js.map 162.83 KB
18
+ ESM ⚡️ Build success in 2628ms
package/CHANGELOG.md CHANGED
@@ -1,11 +1,102 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-fix-tool-call-history-20250731222019
3
+ ## 0.0.0-fix-message-list-args-missing-20250807205055
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [bd0471e]
8
- - @mastra/core@0.0.0-fix-tool-call-history-20250731222019
7
+ - Updated dependencies [903dfec]
8
+ - Updated dependencies [8388649]
9
+ - Updated dependencies [dd94a26]
10
+ - Updated dependencies [3ba6772]
11
+ - Updated dependencies [2fff911]
12
+ - Updated dependencies [63449d0]
13
+ - @mastra/core@0.0.0-fix-message-list-args-missing-20250807205055
14
+
15
+ ## 0.10.21-alpha.0
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [8388649]
20
+ - Updated dependencies [dd94a26]
21
+ - Updated dependencies [3ba6772]
22
+ - Updated dependencies [2fff911]
23
+ - @mastra/core@0.13.2-alpha.0
24
+
25
+ ## 0.10.20
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [cd0042e]
30
+ - @mastra/core@0.13.1
31
+
32
+ ## 0.10.20-alpha.0
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [cd0042e]
37
+ - @mastra/core@0.13.1-alpha.0
38
+
39
+ ## 0.10.19
40
+
41
+ ### Patch Changes
42
+
43
+ - 42dfc48: Fix tool messages structure in agui adapter
44
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
45
+ - Updated dependencies [cb36de0]
46
+ - Updated dependencies [d0496e6]
47
+ - Updated dependencies [a82b851]
48
+ - Updated dependencies [ea0c5f2]
49
+ - Updated dependencies [41a0a0e]
50
+ - Updated dependencies [2871020]
51
+ - Updated dependencies [94f4812]
52
+ - Updated dependencies [e202b82]
53
+ - Updated dependencies [e00f6a0]
54
+ - Updated dependencies [4a406ec]
55
+ - Updated dependencies [b0e43c1]
56
+ - Updated dependencies [5d377e5]
57
+ - Updated dependencies [1fb812e]
58
+ - Updated dependencies [35c5798]
59
+ - @mastra/core@0.13.0
60
+
61
+ ## 0.10.19-alpha.3
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [d0496e6]
66
+ - @mastra/core@0.13.0-alpha.3
67
+
68
+ ## 0.10.19-alpha.2
69
+
70
+ ### Patch Changes
71
+
72
+ - 42dfc48: Fix tool messages structure in agui adapter
73
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
74
+ - Updated dependencies [cb36de0]
75
+ - Updated dependencies [a82b851]
76
+ - Updated dependencies [41a0a0e]
77
+ - Updated dependencies [2871020]
78
+ - Updated dependencies [4a406ec]
79
+ - Updated dependencies [5d377e5]
80
+ - @mastra/core@0.13.0-alpha.2
81
+
82
+ ## 0.10.19-alpha.1
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [ea0c5f2]
87
+ - Updated dependencies [b0e43c1]
88
+ - Updated dependencies [1fb812e]
89
+ - Updated dependencies [35c5798]
90
+ - @mastra/core@0.13.0-alpha.1
91
+
92
+ ## 0.10.19-alpha.0
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [94f4812]
97
+ - Updated dependencies [e202b82]
98
+ - Updated dependencies [e00f6a0]
99
+ - @mastra/core@0.12.2-alpha.0
9
100
 
10
101
  ## 0.10.18
11
102
 
@@ -2,7 +2,7 @@ import type { AgentConfig, BaseEvent, Message, RunAgentInput } from '@ag-ui/clie
2
2
  import { AbstractAgent } from '@ag-ui/client';
3
3
  import type { CoreMessage } from '@mastra/core';
4
4
  import { Observable } from 'rxjs';
5
- import type { Agent } from '../resources/agent';
5
+ import type { Agent } from '../resources/agent.js';
6
6
  interface MastraAgentConfig extends AgentConfig {
7
7
  agent: Agent;
8
8
  agentId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"agui.d.ts","sourceRoot":"","sources":["../../src/adapters/agui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EASd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAa,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,WAAY,SAAQ,aAAa;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;gBACR,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB;IAStE,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC;CA+G3D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAgCrC;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAkDlF"}
1
+ {"version":3,"file":"agui.d.ts","sourceRoot":"","sources":["../../src/adapters/agui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EASd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAa,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,WAAY,SAAQ,aAAa;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;gBACR,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB;IAStE,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC;CA+G3D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAgCrC;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAoElF"}
package/dist/client.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { AbstractAgent } from '@ag-ui/client';
2
2
  import type { ServerDetailInfo } from '@mastra/core/mcp';
3
- import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, Network, A2A, MCPTool, LegacyWorkflow } from './resources';
4
- import { NetworkMemoryThread } from './resources/network-memory-thread';
5
- import { VNextNetwork } from './resources/vNextNetwork';
6
- import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetMemoryThreadParams, GetMemoryThreadResponse, GetNetworkResponse, GetTelemetryParams, GetTelemetryResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetLegacyWorkflowResponse, GetVNextNetworkResponse, GetNetworkMemoryThreadParams, CreateNetworkMemoryThreadParams, SaveNetworkMessageToMemoryParams, GetScorerResponse, GetScoresByScorerIdParams, GetScoresResponse, GetScoresByRunIdParams, GetScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse } from './types';
3
+ import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, Network, A2A, MCPTool, LegacyWorkflow } from './resources/index.js';
4
+ import { NetworkMemoryThread } from './resources/network-memory-thread.js';
5
+ import { VNextNetwork } from './resources/vNextNetwork.js';
6
+ import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetMemoryThreadParams, GetMemoryThreadResponse, GetNetworkResponse, GetTelemetryParams, GetTelemetryResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetLegacyWorkflowResponse, GetVNextNetworkResponse, GetNetworkMemoryThreadParams, CreateNetworkMemoryThreadParams, SaveNetworkMessageToMemoryParams, GetScorerResponse, GetScoresByScorerIdParams, GetScoresResponse, GetScoresByRunIdParams, GetScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse } from './types.js';
7
7
  export declare class MastraClient extends BaseResource {
8
8
  constructor(options: ClientOptions);
9
9
  /**
package/dist/index.cjs CHANGED
@@ -151,6 +151,12 @@ function generateUUID() {
151
151
  }
152
152
  function convertMessagesToMastraMessages(messages) {
153
153
  const result = [];
154
+ const toolCallsWithResults = /* @__PURE__ */ new Set();
155
+ for (const message of messages) {
156
+ if (message.role === "tool" && message.toolCallId) {
157
+ toolCallsWithResults.add(message.toolCallId);
158
+ }
159
+ }
154
160
  for (const message of messages) {
155
161
  if (message.role === "assistant") {
156
162
  const parts = message.content ? [{ type: "text", text: message.content }] : [];
@@ -167,15 +173,22 @@ function convertMessagesToMastraMessages(messages) {
167
173
  content: parts
168
174
  });
169
175
  if (message.toolCalls?.length) {
170
- result.push({
171
- role: "tool",
172
- content: message.toolCalls.map((toolCall) => ({
173
- type: "tool-result",
174
- toolCallId: toolCall.id,
175
- toolName: toolCall.function.name,
176
- result: JSON.parse(toolCall.function.arguments)
177
- }))
178
- });
176
+ for (const toolCall of message.toolCalls) {
177
+ if (!toolCallsWithResults.has(toolCall.id)) {
178
+ result.push({
179
+ role: "tool",
180
+ content: [
181
+ {
182
+ type: "tool-result",
183
+ toolCallId: toolCall.id,
184
+ toolName: toolCall.function.name,
185
+ result: JSON.parse(toolCall.function.arguments)
186
+ // This is still wrong but matches test expectations
187
+ }
188
+ ]
189
+ });
190
+ }
191
+ }
179
192
  }
180
193
  } else if (message.role === "user") {
181
194
  result.push({
@@ -188,8 +201,9 @@ function convertMessagesToMastraMessages(messages) {
188
201
  content: [
189
202
  {
190
203
  type: "tool-result",
191
- toolCallId: message.toolCallId,
204
+ toolCallId: message.toolCallId || "unknown",
192
205
  toolName: "unknown",
206
+ // toolName is not available in tool messages from CopilotKit
193
207
  result: message.content
194
208
  }
195
209
  ]