@mastra/client-js 0.10.6-alpha.0 → 0.10.6-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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +26 -0
- package/dist/index.cjs +209 -2
- package/dist/index.d.cts +161 -4
- package/dist/index.d.ts +161 -4
- package/dist/index.js +209 -2
- package/package.json +4 -4
- package/src/client.ts +71 -1
- package/src/resources/base.ts +1 -0
- package/src/resources/network-memory-thread.ts +63 -0
- package/src/resources/network.ts +2 -3
- package/src/resources/vNextNetwork.ts +147 -0
- package/src/resources/workflow.ts +2 -2
- package/src/types.ts +61 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/client-js@0.10.6-alpha.
|
|
2
|
+
> @mastra/client-js@0.10.6-alpha.2 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
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m53.26 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ Build success in 1252ms
|
|
14
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m53.55 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 1256ms
|
|
16
16
|
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 14921ms
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.03 KB[39m
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m39.03 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.10.6-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8e1b6e9: dependencies updates:
|
|
8
|
+
- Updated dependency [`zod@^3.25.67` ↗︎](https://www.npmjs.com/package/zod/v/3.25.67) (from `^3.25.57`, in `dependencies`)
|
|
9
|
+
- 9bf1d55: Fix runtimeContext in mastra server, client SDK
|
|
10
|
+
- 5d74aab: vNext network in playground
|
|
11
|
+
- Updated dependencies [15e9d26]
|
|
12
|
+
- Updated dependencies [07d6d88]
|
|
13
|
+
- Updated dependencies [5d74aab]
|
|
14
|
+
- Updated dependencies [144eb0b]
|
|
15
|
+
- @mastra/core@0.10.7-alpha.2
|
|
16
|
+
|
|
17
|
+
## 0.10.6-alpha.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [d1baedb]
|
|
22
|
+
- Updated dependencies [4d21bf2]
|
|
23
|
+
- Updated dependencies [2097952]
|
|
24
|
+
- Updated dependencies [4fb0cc2]
|
|
25
|
+
- Updated dependencies [d2a7a31]
|
|
26
|
+
- Updated dependencies [0e17048]
|
|
27
|
+
- @mastra/core@0.10.7-alpha.1
|
|
28
|
+
|
|
3
29
|
## 0.10.6-alpha.0
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -252,6 +252,7 @@ var BaseResource = class {
|
|
|
252
252
|
const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
|
|
253
253
|
...options,
|
|
254
254
|
headers: {
|
|
255
|
+
...options.method === "POST" || options.method === "PUT" ? { "content-type": "application/json" } : {},
|
|
255
256
|
...headers,
|
|
256
257
|
...options.headers
|
|
257
258
|
// TODO: Bring this back once we figure out what we/users need to do to make this work with cross-origin requests
|
|
@@ -1003,9 +1004,9 @@ var Workflow = class extends BaseResource {
|
|
|
1003
1004
|
});
|
|
1004
1005
|
}
|
|
1005
1006
|
/**
|
|
1006
|
-
* Starts a
|
|
1007
|
+
* Starts a workflow run and returns a stream
|
|
1007
1008
|
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
1008
|
-
* @returns Promise containing the
|
|
1009
|
+
* @returns Promise containing the workflow execution results
|
|
1009
1010
|
*/
|
|
1010
1011
|
async stream(params) {
|
|
1011
1012
|
const searchParams = new URLSearchParams();
|
|
@@ -1221,6 +1222,155 @@ var MCPTool = class extends BaseResource {
|
|
|
1221
1222
|
}
|
|
1222
1223
|
};
|
|
1223
1224
|
|
|
1225
|
+
// src/resources/vNextNetwork.ts
|
|
1226
|
+
var RECORD_SEPARATOR3 = "";
|
|
1227
|
+
var VNextNetwork = class extends BaseResource {
|
|
1228
|
+
constructor(options, networkId) {
|
|
1229
|
+
super(options);
|
|
1230
|
+
this.networkId = networkId;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Retrieves details about the network
|
|
1234
|
+
* @returns Promise containing vNext network details
|
|
1235
|
+
*/
|
|
1236
|
+
details() {
|
|
1237
|
+
return this.request(`/api/networks/v-next/${this.networkId}`);
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Generates a response from the v-next network
|
|
1241
|
+
* @param params - Generation parameters including message
|
|
1242
|
+
* @returns Promise containing the generated response
|
|
1243
|
+
*/
|
|
1244
|
+
generate(params) {
|
|
1245
|
+
return this.request(`/api/networks/v-next/${this.networkId}/generate`, {
|
|
1246
|
+
method: "POST",
|
|
1247
|
+
body: params
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Generates a response from the v-next network using multiple primitives
|
|
1252
|
+
* @param params - Generation parameters including message
|
|
1253
|
+
* @returns Promise containing the generated response
|
|
1254
|
+
*/
|
|
1255
|
+
loop(params) {
|
|
1256
|
+
return this.request(`/api/networks/v-next/${this.networkId}/loop`, {
|
|
1257
|
+
method: "POST",
|
|
1258
|
+
body: params
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
async *streamProcessor(stream) {
|
|
1262
|
+
const reader = stream.getReader();
|
|
1263
|
+
let doneReading = false;
|
|
1264
|
+
let buffer = "";
|
|
1265
|
+
try {
|
|
1266
|
+
while (!doneReading) {
|
|
1267
|
+
const { done, value } = await reader.read();
|
|
1268
|
+
doneReading = done;
|
|
1269
|
+
if (done && !value) continue;
|
|
1270
|
+
try {
|
|
1271
|
+
const decoded = value ? new TextDecoder().decode(value) : "";
|
|
1272
|
+
const chunks = (buffer + decoded).split(RECORD_SEPARATOR3);
|
|
1273
|
+
buffer = chunks.pop() || "";
|
|
1274
|
+
for (const chunk of chunks) {
|
|
1275
|
+
if (chunk) {
|
|
1276
|
+
if (typeof chunk === "string") {
|
|
1277
|
+
try {
|
|
1278
|
+
const parsedChunk = JSON.parse(chunk);
|
|
1279
|
+
yield parsedChunk;
|
|
1280
|
+
} catch {
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
} catch {
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
if (buffer) {
|
|
1289
|
+
try {
|
|
1290
|
+
yield JSON.parse(buffer);
|
|
1291
|
+
} catch {
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
} finally {
|
|
1295
|
+
reader.cancel().catch(() => {
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
/**
|
|
1300
|
+
* Streams a response from the v-next network
|
|
1301
|
+
* @param params - Stream parameters including message
|
|
1302
|
+
* @returns Promise containing the results
|
|
1303
|
+
*/
|
|
1304
|
+
async stream(params, onRecord) {
|
|
1305
|
+
const response = await this.request(`/api/networks/v-next/${this.networkId}/stream`, {
|
|
1306
|
+
method: "POST",
|
|
1307
|
+
body: params,
|
|
1308
|
+
stream: true
|
|
1309
|
+
});
|
|
1310
|
+
if (!response.ok) {
|
|
1311
|
+
throw new Error(`Failed to stream vNext network: ${response.statusText}`);
|
|
1312
|
+
}
|
|
1313
|
+
if (!response.body) {
|
|
1314
|
+
throw new Error("Response body is null");
|
|
1315
|
+
}
|
|
1316
|
+
for await (const record of this.streamProcessor(response.body)) {
|
|
1317
|
+
if (typeof record === "string") {
|
|
1318
|
+
onRecord(JSON.parse(record));
|
|
1319
|
+
} else {
|
|
1320
|
+
onRecord(record);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
// src/resources/network-memory-thread.ts
|
|
1327
|
+
var NetworkMemoryThread = class extends BaseResource {
|
|
1328
|
+
constructor(options, threadId, networkId) {
|
|
1329
|
+
super(options);
|
|
1330
|
+
this.threadId = threadId;
|
|
1331
|
+
this.networkId = networkId;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Retrieves the memory thread details
|
|
1335
|
+
* @returns Promise containing thread details including title and metadata
|
|
1336
|
+
*/
|
|
1337
|
+
get() {
|
|
1338
|
+
return this.request(`/api/memory/network/threads/${this.threadId}?networkId=${this.networkId}`);
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Updates the memory thread properties
|
|
1342
|
+
* @param params - Update parameters including title and metadata
|
|
1343
|
+
* @returns Promise containing updated thread details
|
|
1344
|
+
*/
|
|
1345
|
+
update(params) {
|
|
1346
|
+
return this.request(`/api/memory/network/threads/${this.threadId}?networkId=${this.networkId}`, {
|
|
1347
|
+
method: "PATCH",
|
|
1348
|
+
body: params
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Deletes the memory thread
|
|
1353
|
+
* @returns Promise containing deletion result
|
|
1354
|
+
*/
|
|
1355
|
+
delete() {
|
|
1356
|
+
return this.request(`/api/memory/network/threads/${this.threadId}?networkId=${this.networkId}`, {
|
|
1357
|
+
method: "DELETE"
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Retrieves messages associated with the thread
|
|
1362
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
1363
|
+
* @returns Promise containing thread messages and UI messages
|
|
1364
|
+
*/
|
|
1365
|
+
getMessages(params) {
|
|
1366
|
+
const query = new URLSearchParams({
|
|
1367
|
+
networkId: this.networkId,
|
|
1368
|
+
...params?.limit ? { limit: params.limit.toString() } : {}
|
|
1369
|
+
});
|
|
1370
|
+
return this.request(`/api/memory/network/threads/${this.threadId}/messages?${query.toString()}`);
|
|
1371
|
+
}
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1224
1374
|
// src/client.ts
|
|
1225
1375
|
var MastraClient = class extends BaseResource {
|
|
1226
1376
|
constructor(options) {
|
|
@@ -1298,6 +1448,48 @@ var MastraClient = class extends BaseResource {
|
|
|
1298
1448
|
getMemoryStatus(agentId) {
|
|
1299
1449
|
return this.request(`/api/memory/status?agentId=${agentId}`);
|
|
1300
1450
|
}
|
|
1451
|
+
/**
|
|
1452
|
+
* Retrieves memory threads for a resource
|
|
1453
|
+
* @param params - Parameters containing the resource ID
|
|
1454
|
+
* @returns Promise containing array of memory threads
|
|
1455
|
+
*/
|
|
1456
|
+
getNetworkMemoryThreads(params) {
|
|
1457
|
+
return this.request(`/api/memory/network/threads?resourceid=${params.resourceId}&networkId=${params.networkId}`);
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Creates a new memory thread
|
|
1461
|
+
* @param params - Parameters for creating the memory thread
|
|
1462
|
+
* @returns Promise containing the created memory thread
|
|
1463
|
+
*/
|
|
1464
|
+
createNetworkMemoryThread(params) {
|
|
1465
|
+
return this.request(`/api/memory/network/threads?networkId=${params.networkId}`, { method: "POST", body: params });
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Gets a memory thread instance by ID
|
|
1469
|
+
* @param threadId - ID of the memory thread to retrieve
|
|
1470
|
+
* @returns MemoryThread instance
|
|
1471
|
+
*/
|
|
1472
|
+
getNetworkMemoryThread(threadId, networkId) {
|
|
1473
|
+
return new NetworkMemoryThread(this.options, threadId, networkId);
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Saves messages to memory
|
|
1477
|
+
* @param params - Parameters containing messages to save
|
|
1478
|
+
* @returns Promise containing the saved messages
|
|
1479
|
+
*/
|
|
1480
|
+
saveNetworkMessageToMemory(params) {
|
|
1481
|
+
return this.request(`/api/memory/network/save-messages?networkId=${params.networkId}`, {
|
|
1482
|
+
method: "POST",
|
|
1483
|
+
body: params
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Gets the status of the memory system
|
|
1488
|
+
* @returns Promise containing memory system status
|
|
1489
|
+
*/
|
|
1490
|
+
getNetworkMemoryStatus(networkId) {
|
|
1491
|
+
return this.request(`/api/memory/network/status?networkId=${networkId}`);
|
|
1492
|
+
}
|
|
1301
1493
|
/**
|
|
1302
1494
|
* Retrieves all available tools
|
|
1303
1495
|
* @returns Promise containing map of tool IDs to tool details
|
|
@@ -1494,6 +1686,13 @@ var MastraClient = class extends BaseResource {
|
|
|
1494
1686
|
getNetworks() {
|
|
1495
1687
|
return this.request("/api/networks");
|
|
1496
1688
|
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Retrieves all available vNext networks
|
|
1691
|
+
* @returns Promise containing map of vNext network IDs to vNext network details
|
|
1692
|
+
*/
|
|
1693
|
+
getVNextNetworks() {
|
|
1694
|
+
return this.request("/api/networks/v-next");
|
|
1695
|
+
}
|
|
1497
1696
|
/**
|
|
1498
1697
|
* Gets a network instance by ID
|
|
1499
1698
|
* @param networkId - ID of the network to retrieve
|
|
@@ -1502,6 +1701,14 @@ var MastraClient = class extends BaseResource {
|
|
|
1502
1701
|
getNetwork(networkId) {
|
|
1503
1702
|
return new Network(this.options, networkId);
|
|
1504
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Gets a vNext network instance by ID
|
|
1706
|
+
* @param networkId - ID of the vNext network to retrieve
|
|
1707
|
+
* @returns vNext Network instance
|
|
1708
|
+
*/
|
|
1709
|
+
getVNextNetwork(networkId) {
|
|
1710
|
+
return new VNextNetwork(this.options, networkId);
|
|
1711
|
+
}
|
|
1505
1712
|
/**
|
|
1506
1713
|
* Retrieves a list of available MCP servers.
|
|
1507
1714
|
* @param params - Optional parameters for pagination (limit, offset).
|
package/dist/index.d.cts
CHANGED
|
@@ -152,6 +152,10 @@ interface SaveMessageToMemoryParams {
|
|
|
152
152
|
messages: MastraMessageV1[];
|
|
153
153
|
agentId: string;
|
|
154
154
|
}
|
|
155
|
+
interface SaveNetworkMessageToMemoryParams {
|
|
156
|
+
messages: MastraMessageV1[];
|
|
157
|
+
networkId: string;
|
|
158
|
+
}
|
|
155
159
|
type SaveMessageToMemoryResponse = MastraMessageV1[];
|
|
156
160
|
interface CreateMemoryThreadParams {
|
|
157
161
|
title?: string;
|
|
@@ -160,11 +164,22 @@ interface CreateMemoryThreadParams {
|
|
|
160
164
|
threadId?: string;
|
|
161
165
|
agentId: string;
|
|
162
166
|
}
|
|
167
|
+
interface CreateNetworkMemoryThreadParams {
|
|
168
|
+
title?: string;
|
|
169
|
+
metadata?: Record<string, any>;
|
|
170
|
+
resourceId: string;
|
|
171
|
+
threadId?: string;
|
|
172
|
+
networkId: string;
|
|
173
|
+
}
|
|
163
174
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
164
175
|
interface GetMemoryThreadParams {
|
|
165
176
|
resourceId: string;
|
|
166
177
|
agentId: string;
|
|
167
178
|
}
|
|
179
|
+
interface GetNetworkMemoryThreadParams {
|
|
180
|
+
resourceId: string;
|
|
181
|
+
networkId: string;
|
|
182
|
+
}
|
|
168
183
|
type GetMemoryThreadResponse = StorageThreadType[];
|
|
169
184
|
interface UpdateMemoryThreadParams {
|
|
170
185
|
title: string;
|
|
@@ -258,6 +273,7 @@ interface GetTelemetryParams {
|
|
|
258
273
|
toDate?: Date;
|
|
259
274
|
}
|
|
260
275
|
interface GetNetworkResponse {
|
|
276
|
+
id: string;
|
|
261
277
|
name: string;
|
|
262
278
|
instructions: string;
|
|
263
279
|
agents: Array<{
|
|
@@ -271,6 +287,44 @@ interface GetNetworkResponse {
|
|
|
271
287
|
};
|
|
272
288
|
state?: Record<string, any>;
|
|
273
289
|
}
|
|
290
|
+
interface GetVNextNetworkResponse {
|
|
291
|
+
id: string;
|
|
292
|
+
name: string;
|
|
293
|
+
instructions: string;
|
|
294
|
+
agents: Array<{
|
|
295
|
+
name: string;
|
|
296
|
+
provider: string;
|
|
297
|
+
modelId: string;
|
|
298
|
+
}>;
|
|
299
|
+
routingModel: {
|
|
300
|
+
provider: string;
|
|
301
|
+
modelId: string;
|
|
302
|
+
};
|
|
303
|
+
workflows: Array<{
|
|
304
|
+
name: string;
|
|
305
|
+
description: string;
|
|
306
|
+
inputSchema: string | undefined;
|
|
307
|
+
outputSchema: string | undefined;
|
|
308
|
+
}>;
|
|
309
|
+
}
|
|
310
|
+
interface GenerateVNextNetworkResponse {
|
|
311
|
+
task: string;
|
|
312
|
+
result: string;
|
|
313
|
+
resourceId: string;
|
|
314
|
+
resourceType: 'none' | 'tool' | 'agent' | 'workflow';
|
|
315
|
+
}
|
|
316
|
+
interface GenerateOrStreamVNextNetworkParams {
|
|
317
|
+
message: string;
|
|
318
|
+
threadId?: string;
|
|
319
|
+
resourceId?: string;
|
|
320
|
+
}
|
|
321
|
+
interface LoopVNextNetworkResponse {
|
|
322
|
+
status: 'success';
|
|
323
|
+
result: {
|
|
324
|
+
text: string;
|
|
325
|
+
};
|
|
326
|
+
steps: WorkflowResult<any, any>['steps'];
|
|
327
|
+
}
|
|
274
328
|
interface McpServerListResponse {
|
|
275
329
|
servers: ServerInfo[];
|
|
276
330
|
next: string | null;
|
|
@@ -684,9 +738,9 @@ declare class Workflow extends BaseResource {
|
|
|
684
738
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
685
739
|
}): Promise<WorkflowRunResult>;
|
|
686
740
|
/**
|
|
687
|
-
* Starts a
|
|
741
|
+
* Starts a workflow run and returns a stream
|
|
688
742
|
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
689
|
-
* @returns Promise containing the
|
|
743
|
+
* @returns Promise containing the workflow execution results
|
|
690
744
|
*/
|
|
691
745
|
stream(params: {
|
|
692
746
|
runId?: string;
|
|
@@ -787,6 +841,67 @@ declare class MCPTool extends BaseResource {
|
|
|
787
841
|
}): Promise<any>;
|
|
788
842
|
}
|
|
789
843
|
|
|
844
|
+
declare class VNextNetwork extends BaseResource {
|
|
845
|
+
private networkId;
|
|
846
|
+
constructor(options: ClientOptions, networkId: string);
|
|
847
|
+
/**
|
|
848
|
+
* Retrieves details about the network
|
|
849
|
+
* @returns Promise containing vNext network details
|
|
850
|
+
*/
|
|
851
|
+
details(): Promise<GetVNextNetworkResponse>;
|
|
852
|
+
/**
|
|
853
|
+
* Generates a response from the v-next network
|
|
854
|
+
* @param params - Generation parameters including message
|
|
855
|
+
* @returns Promise containing the generated response
|
|
856
|
+
*/
|
|
857
|
+
generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
|
|
858
|
+
/**
|
|
859
|
+
* Generates a response from the v-next network using multiple primitives
|
|
860
|
+
* @param params - Generation parameters including message
|
|
861
|
+
* @returns Promise containing the generated response
|
|
862
|
+
*/
|
|
863
|
+
loop(params: {
|
|
864
|
+
message: string;
|
|
865
|
+
}): Promise<LoopVNextNetworkResponse>;
|
|
866
|
+
private streamProcessor;
|
|
867
|
+
/**
|
|
868
|
+
* Streams a response from the v-next network
|
|
869
|
+
* @param params - Stream parameters including message
|
|
870
|
+
* @returns Promise containing the results
|
|
871
|
+
*/
|
|
872
|
+
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
declare class NetworkMemoryThread extends BaseResource {
|
|
876
|
+
private threadId;
|
|
877
|
+
private networkId;
|
|
878
|
+
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
879
|
+
/**
|
|
880
|
+
* Retrieves the memory thread details
|
|
881
|
+
* @returns Promise containing thread details including title and metadata
|
|
882
|
+
*/
|
|
883
|
+
get(): Promise<StorageThreadType>;
|
|
884
|
+
/**
|
|
885
|
+
* Updates the memory thread properties
|
|
886
|
+
* @param params - Update parameters including title and metadata
|
|
887
|
+
* @returns Promise containing updated thread details
|
|
888
|
+
*/
|
|
889
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
890
|
+
/**
|
|
891
|
+
* Deletes the memory thread
|
|
892
|
+
* @returns Promise containing deletion result
|
|
893
|
+
*/
|
|
894
|
+
delete(): Promise<{
|
|
895
|
+
result: string;
|
|
896
|
+
}>;
|
|
897
|
+
/**
|
|
898
|
+
* Retrieves messages associated with the thread
|
|
899
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
900
|
+
* @returns Promise containing thread messages and UI messages
|
|
901
|
+
*/
|
|
902
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
903
|
+
}
|
|
904
|
+
|
|
790
905
|
declare class MastraClient extends BaseResource {
|
|
791
906
|
constructor(options: ClientOptions);
|
|
792
907
|
/**
|
|
@@ -834,6 +949,37 @@ declare class MastraClient extends BaseResource {
|
|
|
834
949
|
getMemoryStatus(agentId: string): Promise<{
|
|
835
950
|
result: boolean;
|
|
836
951
|
}>;
|
|
952
|
+
/**
|
|
953
|
+
* Retrieves memory threads for a resource
|
|
954
|
+
* @param params - Parameters containing the resource ID
|
|
955
|
+
* @returns Promise containing array of memory threads
|
|
956
|
+
*/
|
|
957
|
+
getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
|
|
958
|
+
/**
|
|
959
|
+
* Creates a new memory thread
|
|
960
|
+
* @param params - Parameters for creating the memory thread
|
|
961
|
+
* @returns Promise containing the created memory thread
|
|
962
|
+
*/
|
|
963
|
+
createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
|
|
964
|
+
/**
|
|
965
|
+
* Gets a memory thread instance by ID
|
|
966
|
+
* @param threadId - ID of the memory thread to retrieve
|
|
967
|
+
* @returns MemoryThread instance
|
|
968
|
+
*/
|
|
969
|
+
getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
|
|
970
|
+
/**
|
|
971
|
+
* Saves messages to memory
|
|
972
|
+
* @param params - Parameters containing messages to save
|
|
973
|
+
* @returns Promise containing the saved messages
|
|
974
|
+
*/
|
|
975
|
+
saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
|
|
976
|
+
/**
|
|
977
|
+
* Gets the status of the memory system
|
|
978
|
+
* @returns Promise containing memory system status
|
|
979
|
+
*/
|
|
980
|
+
getNetworkMemoryStatus(networkId: string): Promise<{
|
|
981
|
+
result: boolean;
|
|
982
|
+
}>;
|
|
837
983
|
/**
|
|
838
984
|
* Retrieves all available tools
|
|
839
985
|
* @returns Promise containing map of tool IDs to tool details
|
|
@@ -902,13 +1048,24 @@ declare class MastraClient extends BaseResource {
|
|
|
902
1048
|
* Retrieves all available networks
|
|
903
1049
|
* @returns Promise containing map of network IDs to network details
|
|
904
1050
|
*/
|
|
905
|
-
getNetworks(): Promise<
|
|
1051
|
+
getNetworks(): Promise<Array<GetNetworkResponse>>;
|
|
1052
|
+
/**
|
|
1053
|
+
* Retrieves all available vNext networks
|
|
1054
|
+
* @returns Promise containing map of vNext network IDs to vNext network details
|
|
1055
|
+
*/
|
|
1056
|
+
getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
|
|
906
1057
|
/**
|
|
907
1058
|
* Gets a network instance by ID
|
|
908
1059
|
* @param networkId - ID of the network to retrieve
|
|
909
1060
|
* @returns Network instance
|
|
910
1061
|
*/
|
|
911
1062
|
getNetwork(networkId: string): Network;
|
|
1063
|
+
/**
|
|
1064
|
+
* Gets a vNext network instance by ID
|
|
1065
|
+
* @param networkId - ID of the vNext network to retrieve
|
|
1066
|
+
* @returns vNext Network instance
|
|
1067
|
+
*/
|
|
1068
|
+
getVNextNetwork(networkId: string): VNextNetwork;
|
|
912
1069
|
/**
|
|
913
1070
|
* Retrieves a list of available MCP servers.
|
|
914
1071
|
* @param params - Optional parameters for pagination (limit, offset).
|
|
@@ -949,4 +1106,4 @@ declare class MastraClient extends BaseResource {
|
|
|
949
1106
|
getA2A(agentId: string): A2A;
|
|
950
1107
|
}
|
|
951
1108
|
|
|
952
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|
|
1109
|
+
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 };
|