@mastra/client-js 0.10.6 → 0.10.7-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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @mastra/client-js@0.10.6-alpha.6 build /home/runner/work/mastra/mastra/client-sdks/client-js
2
+ > @mastra/client-js@0.10.7-alpha.0 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 66.73 KB
13
- CJS ⚡️ Build success in 2682ms
14
- ESM dist/index.js 66.44 KB
15
- ESM ⚡️ Build success in 2684ms
12
+ ESM dist/index.js 67.20 KB
13
+ ESM ⚡️ Build success in 1632ms
14
+ CJS dist/index.cjs 67.49 KB
15
+ CJS ⚡️ Build success in 1635ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 17264ms
18
- DTS dist/index.d.ts 39.17 KB
19
- DTS dist/index.d.cts 39.17 KB
17
+ DTS ⚡️ Build success in 16093ms
18
+ DTS dist/index.d.ts 39.62 KB
19
+ DTS dist/index.d.cts 39.62 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 0.10.7-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - a344ac7: Fix tool streaming in agent network
8
+ - Updated dependencies [a344ac7]
9
+ - @mastra/core@0.10.8-alpha.0
10
+
3
11
  ## 0.10.6
4
12
 
5
13
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1708,6 +1708,31 @@ var VNextNetwork = class extends BaseResource {
1708
1708
  }
1709
1709
  }
1710
1710
  }
1711
+ /**
1712
+ * Streams a response from the v-next network loop
1713
+ * @param params - Stream parameters including message
1714
+ * @returns Promise containing the results
1715
+ */
1716
+ async loopStream(params, onRecord) {
1717
+ const response = await this.request(`/api/networks/v-next/${this.networkId}/loop-stream`, {
1718
+ method: "POST",
1719
+ body: params,
1720
+ stream: true
1721
+ });
1722
+ if (!response.ok) {
1723
+ throw new Error(`Failed to stream vNext network loop: ${response.statusText}`);
1724
+ }
1725
+ if (!response.body) {
1726
+ throw new Error("Response body is null");
1727
+ }
1728
+ for await (const record of this.streamProcessor(response.body)) {
1729
+ if (typeof record === "string") {
1730
+ onRecord(JSON.parse(record));
1731
+ } else {
1732
+ onRecord(record);
1733
+ }
1734
+ }
1735
+ }
1711
1736
  };
1712
1737
 
1713
1738
  // src/resources/network-memory-thread.ts
package/dist/index.d.cts CHANGED
@@ -318,6 +318,12 @@ interface GenerateOrStreamVNextNetworkParams {
318
318
  threadId?: string;
319
319
  resourceId?: string;
320
320
  }
321
+ interface LoopStreamVNextNetworkParams {
322
+ message: string;
323
+ threadId?: string;
324
+ resourceId?: string;
325
+ maxIterations?: number;
326
+ }
321
327
  interface LoopVNextNetworkResponse {
322
328
  status: 'success';
323
329
  result: {
@@ -875,6 +881,12 @@ declare class VNextNetwork extends BaseResource {
875
881
  * @returns Promise containing the results
876
882
  */
877
883
  stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
884
+ /**
885
+ * Streams a response from the v-next network loop
886
+ * @param params - Stream parameters including message
887
+ * @returns Promise containing the results
888
+ */
889
+ loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
878
890
  }
879
891
 
880
892
  declare class NetworkMemoryThread extends BaseResource {
@@ -1111,4 +1123,4 @@ declare class MastraClient extends BaseResource {
1111
1123
  getA2A(agentId: string): A2A;
1112
1124
  }
1113
1125
 
1114
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
1126
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
package/dist/index.d.ts CHANGED
@@ -318,6 +318,12 @@ interface GenerateOrStreamVNextNetworkParams {
318
318
  threadId?: string;
319
319
  resourceId?: string;
320
320
  }
321
+ interface LoopStreamVNextNetworkParams {
322
+ message: string;
323
+ threadId?: string;
324
+ resourceId?: string;
325
+ maxIterations?: number;
326
+ }
321
327
  interface LoopVNextNetworkResponse {
322
328
  status: 'success';
323
329
  result: {
@@ -875,6 +881,12 @@ declare class VNextNetwork extends BaseResource {
875
881
  * @returns Promise containing the results
876
882
  */
877
883
  stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
884
+ /**
885
+ * Streams a response from the v-next network loop
886
+ * @param params - Stream parameters including message
887
+ * @returns Promise containing the results
888
+ */
889
+ loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
878
890
  }
879
891
 
880
892
  declare class NetworkMemoryThread extends BaseResource {
@@ -1111,4 +1123,4 @@ declare class MastraClient extends BaseResource {
1111
1123
  getA2A(agentId: string): A2A;
1112
1124
  }
1113
1125
 
1114
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
1126
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
package/dist/index.js CHANGED
@@ -1702,6 +1702,31 @@ var VNextNetwork = class extends BaseResource {
1702
1702
  }
1703
1703
  }
1704
1704
  }
1705
+ /**
1706
+ * Streams a response from the v-next network loop
1707
+ * @param params - Stream parameters including message
1708
+ * @returns Promise containing the results
1709
+ */
1710
+ async loopStream(params, onRecord) {
1711
+ const response = await this.request(`/api/networks/v-next/${this.networkId}/loop-stream`, {
1712
+ method: "POST",
1713
+ body: params,
1714
+ stream: true
1715
+ });
1716
+ if (!response.ok) {
1717
+ throw new Error(`Failed to stream vNext network loop: ${response.statusText}`);
1718
+ }
1719
+ if (!response.body) {
1720
+ throw new Error("Response body is null");
1721
+ }
1722
+ for await (const record of this.streamProcessor(response.body)) {
1723
+ if (typeof record === "string") {
1724
+ onRecord(JSON.parse(record));
1725
+ } else {
1726
+ onRecord(record);
1727
+ }
1728
+ }
1729
+ }
1705
1730
  };
1706
1731
 
1707
1732
  // src/resources/network-memory-thread.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.10.6",
3
+ "version": "0.10.7-alpha.0",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "rxjs": "7.8.1",
34
34
  "zod": "^3.25.67",
35
35
  "zod-to-json-schema": "^3.24.5",
36
- "@mastra/core": "0.10.7"
36
+ "@mastra/core": "0.10.8-alpha.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "zod": "^3.0.0"
@@ -6,6 +6,7 @@ import type {
6
6
  GenerateVNextNetworkResponse,
7
7
  LoopVNextNetworkResponse,
8
8
  GenerateOrStreamVNextNetworkParams,
9
+ LoopStreamVNextNetworkParams,
9
10
  } from '../types';
10
11
 
11
12
  import { BaseResource } from './base';
@@ -144,4 +145,33 @@ export class VNextNetwork extends BaseResource {
144
145
  }
145
146
  }
146
147
  }
148
+
149
+ /**
150
+ * Streams a response from the v-next network loop
151
+ * @param params - Stream parameters including message
152
+ * @returns Promise containing the results
153
+ */
154
+ async loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void) {
155
+ const response: Response = await this.request(`/api/networks/v-next/${this.networkId}/loop-stream`, {
156
+ method: 'POST',
157
+ body: params,
158
+ stream: true,
159
+ });
160
+
161
+ if (!response.ok) {
162
+ throw new Error(`Failed to stream vNext network loop: ${response.statusText}`);
163
+ }
164
+
165
+ if (!response.body) {
166
+ throw new Error('Response body is null');
167
+ }
168
+
169
+ for await (const record of this.streamProcessor(response.body)) {
170
+ if (typeof record === 'string') {
171
+ onRecord(JSON.parse(record));
172
+ } else {
173
+ onRecord(record);
174
+ }
175
+ }
176
+ }
147
177
  }
package/src/types.ts CHANGED
@@ -373,6 +373,13 @@ export interface GenerateOrStreamVNextNetworkParams {
373
373
  resourceId?: string;
374
374
  }
375
375
 
376
+ export interface LoopStreamVNextNetworkParams {
377
+ message: string;
378
+ threadId?: string;
379
+ resourceId?: string;
380
+ maxIterations?: number;
381
+ }
382
+
376
383
  export interface LoopVNextNetworkResponse {
377
384
  status: 'success';
378
385
  result: {