@mastra/client-js 0.10.6-alpha.1 → 0.10.6-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.10.6-alpha.1",
3
+ "version": "0.10.6-alpha.3",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -31,9 +31,9 @@
31
31
  "@ai-sdk/ui-utils": "^1.2.11",
32
32
  "json-schema": "^0.4.0",
33
33
  "rxjs": "7.8.1",
34
- "zod": "^3.25.57",
34
+ "zod": "^3.25.67",
35
35
  "zod-to-json-schema": "^3.24.5",
36
- "@mastra/core": "0.10.7-alpha.1"
36
+ "@mastra/core": "0.10.7-alpha.3"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "zod": "^3.0.0"
@@ -41,7 +41,7 @@
41
41
  "devDependencies": {
42
42
  "@babel/preset-env": "^7.27.2",
43
43
  "@babel/preset-typescript": "^7.27.1",
44
- "@tsconfig/recommended": "^1.0.8",
44
+ "@tsconfig/recommended": "^1.0.9",
45
45
  "@types/json-schema": "^7.0.15",
46
46
  "@types/node": "^20.19.0",
47
47
  "tsup": "^8.5.0",
package/src/client.ts CHANGED
@@ -33,7 +33,13 @@ import type {
33
33
  McpServerListResponse,
34
34
  McpServerToolListResponse,
35
35
  GetLegacyWorkflowResponse,
36
+ GetVNextNetworkResponse,
37
+ GetNetworkMemoryThreadParams,
38
+ CreateNetworkMemoryThreadParams,
39
+ SaveNetworkMessageToMemoryParams,
36
40
  } from './types';
41
+ import { VNextNetwork } from './resources/vNextNetwork';
42
+ import { NetworkMemoryThread } from './resources/network-memory-thread';
37
43
 
38
44
  export class MastraClient extends BaseResource {
39
45
  constructor(options: ClientOptions) {
@@ -123,6 +129,53 @@ export class MastraClient extends BaseResource {
123
129
  return this.request(`/api/memory/status?agentId=${agentId}`);
124
130
  }
125
131
 
132
+ /**
133
+ * Retrieves memory threads for a resource
134
+ * @param params - Parameters containing the resource ID
135
+ * @returns Promise containing array of memory threads
136
+ */
137
+ public getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse> {
138
+ return this.request(`/api/memory/network/threads?resourceid=${params.resourceId}&networkId=${params.networkId}`);
139
+ }
140
+
141
+ /**
142
+ * Creates a new memory thread
143
+ * @param params - Parameters for creating the memory thread
144
+ * @returns Promise containing the created memory thread
145
+ */
146
+ public createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse> {
147
+ return this.request(`/api/memory/network/threads?networkId=${params.networkId}`, { method: 'POST', body: params });
148
+ }
149
+
150
+ /**
151
+ * Gets a memory thread instance by ID
152
+ * @param threadId - ID of the memory thread to retrieve
153
+ * @returns MemoryThread instance
154
+ */
155
+ public getNetworkMemoryThread(threadId: string, networkId: string) {
156
+ return new NetworkMemoryThread(this.options, threadId, networkId);
157
+ }
158
+
159
+ /**
160
+ * Saves messages to memory
161
+ * @param params - Parameters containing messages to save
162
+ * @returns Promise containing the saved messages
163
+ */
164
+ public saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse> {
165
+ return this.request(`/api/memory/network/save-messages?networkId=${params.networkId}`, {
166
+ method: 'POST',
167
+ body: params,
168
+ });
169
+ }
170
+
171
+ /**
172
+ * Gets the status of the memory system
173
+ * @returns Promise containing memory system status
174
+ */
175
+ public getNetworkMemoryStatus(networkId: string): Promise<{ result: boolean }> {
176
+ return this.request(`/api/memory/network/status?networkId=${networkId}`);
177
+ }
178
+
126
179
  /**
127
180
  * Retrieves all available tools
128
181
  * @returns Promise containing map of tool IDs to tool details
@@ -334,10 +387,18 @@ export class MastraClient extends BaseResource {
334
387
  * Retrieves all available networks
335
388
  * @returns Promise containing map of network IDs to network details
336
389
  */
337
- public getNetworks(): Promise<Record<string, GetNetworkResponse>> {
390
+ public getNetworks(): Promise<Array<GetNetworkResponse>> {
338
391
  return this.request('/api/networks');
339
392
  }
340
393
 
394
+ /**
395
+ * Retrieves all available vNext networks
396
+ * @returns Promise containing map of vNext network IDs to vNext network details
397
+ */
398
+ public getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>> {
399
+ return this.request('/api/networks/v-next');
400
+ }
401
+
341
402
  /**
342
403
  * Gets a network instance by ID
343
404
  * @param networkId - ID of the network to retrieve
@@ -347,6 +408,15 @@ export class MastraClient extends BaseResource {
347
408
  return new Network(this.options, networkId);
348
409
  }
349
410
 
411
+ /**
412
+ * Gets a vNext network instance by ID
413
+ * @param networkId - ID of the vNext network to retrieve
414
+ * @returns vNext Network instance
415
+ */
416
+ public getVNextNetwork(networkId: string) {
417
+ return new VNextNetwork(this.options, networkId);
418
+ }
419
+
350
420
  /**
351
421
  * Retrieves a list of available MCP servers.
352
422
  * @param params - Optional parameters for pagination (limit, offset).
package/src/example.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { MastraClient } from './client';
2
+ import z from 'zod';
2
3
  // import type { WorkflowRunResult } from './types';
3
4
 
4
5
  // Agent
5
-
6
6
  (async () => {
7
7
  const client = new MastraClient({
8
8
  baseUrl: 'http://localhost:4111',
@@ -29,6 +29,9 @@ import { MastraClient } from './client';
29
29
  onErrorPart: error => {
30
30
  console.error(error);
31
31
  },
32
+ onToolCallPart(streamPart) {
33
+ console.log(streamPart);
34
+ },
32
35
  });
33
36
  } catch (error) {
34
37
  console.error(error);