@mastra/server 0.19.1 → 0.20.0-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.
- package/CHANGELOG.md +17 -0
- package/dist/{chunk-GIM2ZSPB.cjs → chunk-4HS3I2TI.cjs} +91 -12
- package/dist/chunk-4HS3I2TI.cjs.map +1 -0
- package/dist/{chunk-QGW2VHZU.js → chunk-AX5SCBJL.js} +91 -13
- package/dist/chunk-AX5SCBJL.js.map +1 -0
- package/dist/{chunk-2QPKCXLB.cjs → chunk-FYZHFAFB.cjs} +76 -36
- package/dist/chunk-FYZHFAFB.cjs.map +1 -0
- package/dist/{chunk-6QZD7S52.js → chunk-HRG5HN4U.js} +74 -34
- package/dist/chunk-HRG5HN4U.js.map +1 -0
- package/dist/{chunk-BNNUFPA7.cjs → chunk-JOXMWFM6.cjs} +33 -33
- package/dist/{chunk-BNNUFPA7.cjs.map → chunk-JOXMWFM6.cjs.map} +1 -1
- package/dist/{chunk-OZLRIVC4.cjs → chunk-LHGBI76Y.cjs} +19 -39
- package/dist/chunk-LHGBI76Y.cjs.map +1 -0
- package/dist/{chunk-JHH2BWAB.js → chunk-QDPOVUS4.js} +19 -19
- package/dist/{chunk-JHH2BWAB.js.map → chunk-QDPOVUS4.js.map} +1 -1
- package/dist/{chunk-SQY4T6EJ.js → chunk-SZUAJANR.js} +19 -39
- package/dist/chunk-SZUAJANR.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +25 -25
- package/dist/server/handlers/agents.d.ts +24 -21
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/memory.cjs +16 -16
- package/dist/server/handlers/memory.d.ts +14 -15
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/workflows.cjs +22 -18
- package/dist/server/handlers/workflows.d.ts +2 -1
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +13 -13
- package/dist/server/handlers.js +5 -5
- package/package.json +5 -5
- package/dist/chunk-2QPKCXLB.cjs.map +0 -1
- package/dist/chunk-6QZD7S52.js.map +0 -1
- package/dist/chunk-GIM2ZSPB.cjs.map +0 -1
- package/dist/chunk-OZLRIVC4.cjs.map +0 -1
- package/dist/chunk-QGW2VHZU.js.map +0 -1
- package/dist/chunk-SQY4T6EJ.js.map +0 -1
- package/dist/server/handlers/vNextNetwork.cjs +0 -220
- package/dist/server/handlers/vNextNetwork.cjs.map +0 -1
- package/dist/server/handlers/vNextNetwork.d.ts +0 -246
- package/dist/server/handlers/vNextNetwork.d.ts.map +0 -1
- package/dist/server/handlers/vNextNetwork.js +0 -213
- package/dist/server/handlers/vNextNetwork.js.map +0 -1
|
@@ -26,33 +26,26 @@ __export(memory_exports, {
|
|
|
26
26
|
async function getMemoryFromContext({
|
|
27
27
|
mastra,
|
|
28
28
|
agentId,
|
|
29
|
-
networkId,
|
|
30
29
|
runtimeContext
|
|
31
30
|
}) {
|
|
32
31
|
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
33
32
|
if (agentId && !agent) {
|
|
34
33
|
throw new HTTPException(404, { message: "Agent not found" });
|
|
35
34
|
}
|
|
36
|
-
const network = networkId ? mastra.vnext_getNetwork(networkId) : null;
|
|
37
|
-
if (networkId && !network) {
|
|
38
|
-
throw new HTTPException(404, { message: "Network not found" });
|
|
39
|
-
}
|
|
40
35
|
if (agent) {
|
|
41
|
-
return await agent?.getMemory(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return await network?.getMemory({ runtimeContext }) || mastra.getMemory();
|
|
36
|
+
return await agent?.getMemory({
|
|
37
|
+
runtimeContext
|
|
38
|
+
}) || mastra.getMemory();
|
|
45
39
|
}
|
|
46
40
|
return mastra.getMemory();
|
|
47
41
|
}
|
|
48
42
|
async function getMemoryStatusHandler({
|
|
49
43
|
mastra,
|
|
50
44
|
agentId,
|
|
51
|
-
networkId,
|
|
52
45
|
runtimeContext
|
|
53
46
|
}) {
|
|
54
47
|
try {
|
|
55
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
48
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
56
49
|
if (!memory) {
|
|
57
50
|
return { result: false };
|
|
58
51
|
}
|
|
@@ -64,11 +57,10 @@ async function getMemoryStatusHandler({
|
|
|
64
57
|
async function getMemoryConfigHandler({
|
|
65
58
|
mastra,
|
|
66
59
|
agentId,
|
|
67
|
-
networkId,
|
|
68
60
|
runtimeContext
|
|
69
61
|
}) {
|
|
70
62
|
try {
|
|
71
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
63
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
72
64
|
if (!memory) {
|
|
73
65
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
74
66
|
}
|
|
@@ -82,13 +74,12 @@ async function getThreadsHandler({
|
|
|
82
74
|
mastra,
|
|
83
75
|
agentId,
|
|
84
76
|
resourceId,
|
|
85
|
-
networkId,
|
|
86
77
|
runtimeContext,
|
|
87
78
|
orderBy,
|
|
88
79
|
sortDirection
|
|
89
80
|
}) {
|
|
90
81
|
try {
|
|
91
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
82
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
92
83
|
if (!memory) {
|
|
93
84
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
94
85
|
}
|
|
@@ -107,7 +98,6 @@ async function getThreadsPaginatedHandler({
|
|
|
107
98
|
mastra,
|
|
108
99
|
agentId,
|
|
109
100
|
resourceId,
|
|
110
|
-
networkId,
|
|
111
101
|
runtimeContext,
|
|
112
102
|
page,
|
|
113
103
|
perPage,
|
|
@@ -115,7 +105,7 @@ async function getThreadsPaginatedHandler({
|
|
|
115
105
|
sortDirection
|
|
116
106
|
}) {
|
|
117
107
|
try {
|
|
118
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
108
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
119
109
|
if (!memory) {
|
|
120
110
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
121
111
|
}
|
|
@@ -136,12 +126,11 @@ async function getThreadByIdHandler({
|
|
|
136
126
|
mastra,
|
|
137
127
|
agentId,
|
|
138
128
|
threadId,
|
|
139
|
-
networkId,
|
|
140
129
|
runtimeContext
|
|
141
130
|
}) {
|
|
142
131
|
try {
|
|
143
132
|
validateBody({ threadId });
|
|
144
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
133
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
145
134
|
if (!memory) {
|
|
146
135
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
147
136
|
}
|
|
@@ -158,11 +147,10 @@ async function saveMessagesHandler({
|
|
|
158
147
|
mastra,
|
|
159
148
|
agentId,
|
|
160
149
|
body,
|
|
161
|
-
networkId,
|
|
162
150
|
runtimeContext
|
|
163
151
|
}) {
|
|
164
152
|
try {
|
|
165
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
153
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
166
154
|
if (!memory) {
|
|
167
155
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
168
156
|
}
|
|
@@ -193,11 +181,10 @@ async function createThreadHandler({
|
|
|
193
181
|
mastra,
|
|
194
182
|
agentId,
|
|
195
183
|
body,
|
|
196
|
-
networkId,
|
|
197
184
|
runtimeContext
|
|
198
185
|
}) {
|
|
199
186
|
try {
|
|
200
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
187
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
201
188
|
if (!memory) {
|
|
202
189
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
203
190
|
}
|
|
@@ -218,11 +205,10 @@ async function updateThreadHandler({
|
|
|
218
205
|
agentId,
|
|
219
206
|
threadId,
|
|
220
207
|
body,
|
|
221
|
-
networkId,
|
|
222
208
|
runtimeContext
|
|
223
209
|
}) {
|
|
224
210
|
try {
|
|
225
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
211
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
226
212
|
if (!body) {
|
|
227
213
|
throw new HTTPException(400, { message: "Body is required" });
|
|
228
214
|
}
|
|
@@ -254,12 +240,11 @@ async function deleteThreadHandler({
|
|
|
254
240
|
mastra,
|
|
255
241
|
agentId,
|
|
256
242
|
threadId,
|
|
257
|
-
networkId,
|
|
258
243
|
runtimeContext
|
|
259
244
|
}) {
|
|
260
245
|
try {
|
|
261
246
|
validateBody({ threadId });
|
|
262
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
247
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
263
248
|
if (!memory) {
|
|
264
249
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
265
250
|
}
|
|
@@ -301,7 +286,6 @@ async function getMessagesHandler({
|
|
|
301
286
|
agentId,
|
|
302
287
|
threadId,
|
|
303
288
|
limit,
|
|
304
|
-
networkId,
|
|
305
289
|
runtimeContext
|
|
306
290
|
}) {
|
|
307
291
|
if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
|
|
@@ -309,7 +293,7 @@ async function getMessagesHandler({
|
|
|
309
293
|
}
|
|
310
294
|
try {
|
|
311
295
|
validateBody({ threadId });
|
|
312
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
296
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
313
297
|
if (!memory) {
|
|
314
298
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
315
299
|
}
|
|
@@ -331,12 +315,11 @@ async function getWorkingMemoryHandler({
|
|
|
331
315
|
agentId,
|
|
332
316
|
threadId,
|
|
333
317
|
resourceId,
|
|
334
|
-
networkId,
|
|
335
318
|
runtimeContext,
|
|
336
319
|
memoryConfig
|
|
337
320
|
}) {
|
|
338
321
|
try {
|
|
339
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
322
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
340
323
|
validateBody({ threadId });
|
|
341
324
|
if (!memory) {
|
|
342
325
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
@@ -358,12 +341,11 @@ async function updateWorkingMemoryHandler({
|
|
|
358
341
|
agentId,
|
|
359
342
|
threadId,
|
|
360
343
|
body,
|
|
361
|
-
networkId,
|
|
362
344
|
runtimeContext
|
|
363
345
|
}) {
|
|
364
346
|
try {
|
|
365
347
|
validateBody({ threadId });
|
|
366
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
348
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
367
349
|
const { resourceId, memoryConfig, workingMemory } = body;
|
|
368
350
|
if (!memory) {
|
|
369
351
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
@@ -382,14 +364,13 @@ async function deleteMessagesHandler({
|
|
|
382
364
|
mastra,
|
|
383
365
|
agentId,
|
|
384
366
|
messageIds,
|
|
385
|
-
networkId,
|
|
386
367
|
runtimeContext
|
|
387
368
|
}) {
|
|
388
369
|
try {
|
|
389
370
|
if (messageIds === void 0 || messageIds === null) {
|
|
390
371
|
throw new HTTPException(400, { message: "messageIds is required" });
|
|
391
372
|
}
|
|
392
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
373
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
393
374
|
if (!memory) {
|
|
394
375
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
395
376
|
}
|
|
@@ -410,13 +391,12 @@ async function searchMemoryHandler({
|
|
|
410
391
|
resourceId,
|
|
411
392
|
threadId,
|
|
412
393
|
limit = 20,
|
|
413
|
-
networkId,
|
|
414
394
|
runtimeContext,
|
|
415
395
|
memoryConfig
|
|
416
396
|
}) {
|
|
417
397
|
try {
|
|
418
398
|
validateBody({ searchQuery, resourceId });
|
|
419
|
-
const memory = await getMemoryFromContext({ mastra, agentId,
|
|
399
|
+
const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
|
|
420
400
|
if (!memory) {
|
|
421
401
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
422
402
|
}
|
|
@@ -567,5 +547,5 @@ async function searchMemoryHandler({
|
|
|
567
547
|
}
|
|
568
548
|
|
|
569
549
|
export { createThreadHandler, deleteMessagesHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getMessagesHandler, getMessagesPaginatedHandler, getThreadByIdHandler, getThreadsHandler, getThreadsPaginatedHandler, getWorkingMemoryHandler, memory_exports, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler };
|
|
570
|
-
//# sourceMappingURL=chunk-
|
|
571
|
-
//# sourceMappingURL=chunk-
|
|
550
|
+
//# sourceMappingURL=chunk-SZUAJANR.js.map
|
|
551
|
+
//# sourceMappingURL=chunk-SZUAJANR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/memory.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,cAAA,GAAA;AAAA,QAAA,CAAA,cAAA,EAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,2BAAA,EAAA,MAAA,2BAAA;AA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AAAA,WACJ;AAAA,QACF;AAEA,QAAA,aAAA,CAAc,KAAK,YAAY,CAAA;AAAA,MACjC,CAAC,CAAA;AAAA,IACH;AAGA,IAAA,MAAM,aAAA,GAAgB,cACnB,IAAA,CAAK,CAAC,GAAG,CAAA,KAAM,IAAI,IAAA,CAAK,CAAA,CAAE,SAAS,CAAA,CAAE,SAAQ,GAAI,IAAI,IAAA,CAAK,CAAA,CAAE,SAAS,CAAA,CAAE,SAAS,CAAA,CAChF,KAAA,CAAM,CAAA,EAAG,KAAK,CAAA;AAEjB,IAAA,OAAO;AAAA,MACL,OAAA,EAAS,aAAA;AAAA,MACT,OAAO,aAAA,CAAc,MAAA;AAAA,MACrB,KAAA,EAAO,WAAA;AAAA,MACP,WAAA,EAAa,gBAAgB,UAAA,GAAa,QAAA;AAAA,MAC1C,UAAA,EAAY,oBAAoB,UAAA,GAAa;AAAA,KAC/C;AAAA,EACF,SAAS,KAAA,EAAO;AACd,IAAA,OAAO,WAAA,CAAY,OAAO,wBAAwB,CAAA;AAAA,EACpD;AACF","file":"chunk-SZUAJANR.js","sourcesContent":["import type { RuntimeContext } from '@mastra/core/di';\nimport type { MastraMemory } from '@mastra/core/memory';\nimport type { StorageGetMessagesArg, ThreadSortOptions } from '@mastra/core/storage';\nimport { generateEmptyFromSchema } from '@mastra/core/utils';\nimport { HTTPException } from '../http-exception';\nimport type { Context } from '../types';\n\nimport { handleError } from './error';\nimport { validateBody } from './utils';\n\ninterface MemoryContext extends Context {\n agentId?: string;\n resourceId?: string;\n threadId?: string;\n runtimeContext?: RuntimeContext;\n}\n\nasync function getMemoryFromContext({\n mastra,\n agentId,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'>): Promise<MastraMemory | null | undefined> {\n const agent = agentId ? mastra.getAgent(agentId) : null;\n if (agentId && !agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n\n if (agent) {\n return (\n (await agent?.getMemory({\n runtimeContext,\n })) || mastra.getMemory()\n );\n }\n\n return mastra.getMemory();\n}\n\n// Memory handlers\nexport async function getMemoryStatusHandler({\n mastra,\n agentId,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'>) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n return { result: false };\n }\n\n return { result: true };\n } catch (error) {\n return handleError(error, 'Error getting memory status');\n }\n}\n\nexport async function getMemoryConfigHandler({\n mastra,\n agentId,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'>) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Get the merged configuration (defaults + custom)\n const config = memory.getMergedThreadConfig({});\n\n return { config };\n } catch (error) {\n return handleError(error, 'Error getting memory configuration');\n }\n}\n\nexport async function getThreadsHandler({\n mastra,\n agentId,\n resourceId,\n runtimeContext,\n orderBy,\n sortDirection,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'runtimeContext'> & ThreadSortOptions) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n validateBody({ resourceId });\n\n const threads = await memory.getThreadsByResourceId({\n resourceId: resourceId!,\n orderBy,\n sortDirection,\n });\n return threads;\n } catch (error) {\n return handleError(error, 'Error getting threads');\n }\n}\n\nexport async function getThreadsPaginatedHandler({\n mastra,\n agentId,\n resourceId,\n runtimeContext,\n page,\n perPage,\n orderBy,\n sortDirection,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'runtimeContext'> & {\n page: number;\n perPage: number;\n} & ThreadSortOptions) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n validateBody({ resourceId });\n\n const result = await memory.getThreadsByResourceIdPaginated({\n resourceId: resourceId!,\n page,\n perPage,\n orderBy,\n sortDirection,\n });\n return result;\n } catch (error) {\n return handleError(error, 'Error getting paginated threads');\n }\n}\n\nexport async function getThreadByIdHandler({\n mastra,\n agentId,\n threadId,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'runtimeContext'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n return thread;\n } catch (error) {\n return handleError(error, 'Error getting thread');\n }\n}\n\nexport async function saveMessagesHandler({\n mastra,\n agentId,\n body,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'> & {\n body: {\n messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];\n };\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n if (!body?.messages) {\n throw new HTTPException(400, { message: 'Messages are required' });\n }\n\n if (!Array.isArray(body.messages)) {\n throw new HTTPException(400, { message: 'Messages should be an array' });\n }\n\n // Validate that all messages have threadId and resourceId\n const invalidMessages = body.messages.filter(message => !message.threadId || !message.resourceId);\n if (invalidMessages.length > 0) {\n throw new HTTPException(400, {\n message: `All messages must have threadId and resourceId fields. Found ${invalidMessages.length} invalid message(s).`,\n });\n }\n\n const processedMessages = body.messages.map(message => ({\n ...message,\n id: message.id || memory.generateId(),\n createdAt: message.createdAt ? new Date(message.createdAt) : new Date(),\n }));\n\n const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });\n return result;\n } catch (error) {\n return handleError(error, 'Error saving messages');\n }\n}\n\nexport async function createThreadHandler({\n mastra,\n agentId,\n body,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'> & {\n body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & { resourceId?: string };\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n validateBody({ resourceId: body?.resourceId });\n\n const result = await memory.createThread({\n resourceId: body?.resourceId!,\n title: body?.title,\n metadata: body?.metadata,\n threadId: body?.threadId,\n });\n return result;\n } catch (error) {\n return handleError(error, 'Error saving thread to memory');\n }\n}\n\nexport async function updateThreadHandler({\n mastra,\n agentId,\n threadId,\n body,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'runtimeContext'> & {\n body?: Parameters<MastraMemory['saveThread']>[0]['thread'];\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!body) {\n throw new HTTPException(400, { message: 'Body is required' });\n }\n\n const { title, metadata, resourceId } = body;\n const updatedAt = new Date();\n\n validateBody({ threadId });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n const updatedThread = {\n ...thread,\n title: title || thread.title,\n metadata: metadata || thread.metadata,\n resourceId: resourceId || thread.resourceId,\n createdAt: thread.createdAt,\n updatedAt,\n };\n\n const result = await memory.saveThread({ thread: updatedThread });\n return result;\n } catch (error) {\n return handleError(error, 'Error updating thread');\n }\n}\n\nexport async function deleteThreadHandler({\n mastra,\n agentId,\n threadId,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'runtimeContext'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n await memory.deleteThread(threadId!);\n return { result: 'Thread deleted' };\n } catch (error) {\n return handleError(error, 'Error deleting thread');\n }\n}\n\nexport async function getMessagesPaginatedHandler({\n mastra,\n threadId,\n resourceId,\n selectBy,\n format,\n}: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>) {\n try {\n validateBody({ threadId });\n\n const storage = mastra.getStorage();\n\n if (!storage) {\n throw new HTTPException(400, { message: 'Storage is not initialized' });\n }\n\n const thread = await storage.getThreadById({ threadId: threadId! });\n\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n const result = await storage.getMessagesPaginated({ threadId: threadId!, resourceId, selectBy, format });\n return result;\n } catch (error) {\n return handleError(error, 'Error getting messages');\n }\n}\n\nexport async function getMessagesHandler({\n mastra,\n agentId,\n threadId,\n limit,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'runtimeContext'> & {\n limit?: number;\n}) {\n if (limit !== undefined && (!Number.isInteger(limit) || limit <= 0)) {\n throw new HTTPException(400, { message: 'Invalid limit: must be a positive integer' });\n }\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n const result = await memory.query({\n threadId: threadId!,\n ...(limit && { selectBy: { last: limit } }),\n });\n return { messages: result.messages, uiMessages: result.uiMessages };\n } catch (error) {\n return handleError(error, 'Error getting messages');\n }\n}\n\n/**\n * Handler to get the working memory for a thread (optionally resource-scoped).\n * @returns workingMemory - the working memory for the thread\n * @returns source - thread or resource\n */\nexport async function getWorkingMemoryHandler({\n mastra,\n agentId,\n threadId,\n resourceId,\n runtimeContext,\n memoryConfig,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'runtimeContext'> & {\n resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];\n memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n validateBody({ threadId });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n const thread = await memory.getThreadById({ threadId: threadId! });\n const threadExists = !!thread;\n const template = await memory.getWorkingMemoryTemplate({ memoryConfig });\n const workingMemoryTemplate =\n template?.format === 'json'\n ? { ...template, content: JSON.stringify(generateEmptyFromSchema(template.content)) }\n : template;\n const workingMemory = await memory.getWorkingMemory({ threadId: threadId!, resourceId, memoryConfig });\n const config = memory.getMergedThreadConfig(memoryConfig || {});\n const source = config.workingMemory?.scope === 'resource' && resourceId ? 'resource' : 'thread';\n return { workingMemory, source, workingMemoryTemplate, threadExists };\n } catch (error) {\n return handleError(error, 'Error getting working memory');\n }\n}\n\n/**\n * Handler to update the working memory for a thread (optionally resource-scoped).\n * @param threadId - the thread id\n * @param body - the body containing the working memory to update and the resource id (optional)\n */\nexport async function updateWorkingMemoryHandler({\n mastra,\n agentId,\n threadId,\n body,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'runtimeContext'> & {\n body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;\n}) {\n try {\n validateBody({ threadId });\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n const { resourceId, memoryConfig, workingMemory } = body;\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n const thread = await memory.getThreadById({ threadId: threadId! });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n\n await memory.updateWorkingMemory({ threadId: threadId!, resourceId, workingMemory, memoryConfig });\n return { success: true };\n } catch (error) {\n return handleError(error, 'Error updating working memory');\n }\n}\n\ninterface SearchResult {\n id: string;\n role: string;\n content: any;\n createdAt: Date;\n threadId?: string;\n threadTitle?: string;\n score?: number;\n context?: {\n before?: SearchResult[];\n after?: SearchResult[];\n };\n}\n\ninterface SearchResponse {\n results: SearchResult[];\n count: number;\n query: string;\n searchScope?: string;\n searchType?: string;\n}\n\n/**\n * Handler to delete one or more messages.\n * @param messageIds - Can be a single ID, array of IDs, or objects with ID property\n */\nexport async function deleteMessagesHandler({\n mastra,\n agentId,\n messageIds,\n runtimeContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'> & {\n messageIds: string | string[] | { id: string } | { id: string }[];\n}) {\n try {\n if (messageIds === undefined || messageIds === null) {\n throw new HTTPException(400, { message: 'messageIds is required' });\n }\n\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Delete the messages - let the memory method handle validation\n await memory.deleteMessages(messageIds as any);\n\n // Count messages for response\n let count = 1;\n if (Array.isArray(messageIds)) {\n count = messageIds.length;\n }\n\n return { success: true, message: `${count} message${count === 1 ? '' : 's'} deleted successfully` };\n } catch (error) {\n return handleError(error, 'Error deleting messages');\n }\n}\n\nexport async function searchMemoryHandler({\n mastra,\n agentId,\n searchQuery,\n resourceId,\n threadId,\n limit = 20,\n runtimeContext,\n memoryConfig,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'runtimeContext'> & {\n searchQuery: string;\n resourceId: string;\n threadId?: string;\n limit?: number;\n memoryConfig?: any;\n}): Promise<SearchResponse | ReturnType<typeof handleError>> {\n try {\n validateBody({ searchQuery, resourceId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Get memory configuration first to check scope\n const config = memory.getMergedThreadConfig(memoryConfig || {});\n const hasSemanticRecall = !!config?.semanticRecall;\n const resourceScope = typeof config?.semanticRecall === 'object' && config?.semanticRecall?.scope === 'resource';\n\n // Only validate thread ownership if we're in thread scope\n if (threadId && !resourceScope) {\n const thread = await memory.getThreadById({ threadId });\n if (!thread) {\n throw new HTTPException(404, { message: 'Thread not found' });\n }\n if (thread.resourceId !== resourceId) {\n throw new HTTPException(403, { message: 'Thread does not belong to the specified resource' });\n }\n }\n\n const searchResults: SearchResult[] = [];\n const messageMap = new Map<string, boolean>(); // For deduplication\n\n // If threadId is provided and scope is thread-based, check if the thread exists\n if (threadId && !resourceScope) {\n const thread = await memory.getThreadById({ threadId });\n if (!thread) {\n // Thread doesn't exist yet (new unsaved thread) - return empty results\n return {\n results: [],\n count: 0,\n query: searchQuery,\n searchScope: 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n }\n\n // If resource scope is enabled or no threadId provided, search across all threads\n if (!threadId || resourceScope) {\n // Search across all threads for this resource\n const threads = await memory.getThreadsByResourceId({ resourceId });\n\n // If no threads exist yet, return empty results\n if (threads.length === 0) {\n return {\n results: [],\n count: 0,\n query: searchQuery,\n searchScope: 'resource',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n\n for (const thread of threads) {\n // Use rememberMessages for semantic search\n const result = await memory.rememberMessages({\n threadId: thread.id,\n resourceId,\n vectorMessageSearch: searchQuery,\n config,\n });\n\n // Get thread messages for context\n const threadMessages = (await memory.query({ threadId: thread.id })).uiMessages;\n\n // Process results\n result.messagesV2.forEach(msg => {\n if (messageMap.has(msg.id)) return;\n messageMap.set(msg.id, true);\n\n const content =\n msg.content.content || msg.content.parts?.map(p => (p.type === 'text' ? p.text : '')).join(' ') || '';\n\n if (!hasSemanticRecall && !content.toLowerCase().includes(searchQuery.toLowerCase())) {\n return;\n }\n\n const messageIndex = threadMessages.findIndex(m => m.id === msg.id);\n\n const searchResult: SearchResult = {\n id: msg.id,\n role: msg.role,\n content,\n createdAt: msg.createdAt,\n threadId: msg.threadId || thread.id,\n threadTitle: thread.title || msg.threadId || thread.id,\n };\n\n if (messageIndex !== -1) {\n searchResult.context = {\n before: threadMessages.slice(Math.max(0, messageIndex - 2), messageIndex).map(m => ({\n id: m.id,\n role: m.role,\n content: m.content,\n createdAt: m.createdAt || new Date(),\n })),\n after: threadMessages.slice(messageIndex + 1, messageIndex + 3).map(m => ({\n id: m.id,\n role: m.role,\n content: m.content,\n createdAt: m.createdAt || new Date(),\n })),\n };\n }\n\n searchResults.push(searchResult);\n });\n }\n } else if (threadId) {\n // Search in specific thread only\n const thread = await memory.getThreadById({ threadId });\n if (!thread) {\n // Thread doesn't exist yet - return empty results\n return {\n results: [],\n count: 0,\n query: searchQuery,\n searchScope: 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n\n const result = await memory.rememberMessages({\n threadId,\n resourceId,\n vectorMessageSearch: searchQuery,\n config,\n });\n\n const threadMessages = (await memory.query({ threadId })).uiMessages;\n\n result.messagesV2.forEach(msg => {\n // Skip duplicates\n if (messageMap.has(msg.id)) return;\n messageMap.set(msg.id, true);\n\n // Extract content\n const content =\n msg.content.content || msg.content.parts?.map(p => (p.type === 'text' ? p.text : '')).join(' ') || '';\n\n // If not using semantic recall, filter by text search\n if (!hasSemanticRecall && !content.toLowerCase().includes(searchQuery.toLowerCase())) {\n return;\n }\n\n // Find message index for context\n const messageIndex = threadMessages.findIndex(m => m.id === msg.id);\n\n const searchResult: SearchResult = {\n id: msg.id,\n role: msg.role,\n content,\n createdAt: msg.createdAt,\n threadId: threadId,\n threadTitle: thread?.title || threadId,\n };\n\n // Add context if found\n if (messageIndex !== -1) {\n searchResult.context = {\n before: threadMessages.slice(Math.max(0, messageIndex - 2), messageIndex).map(m => ({\n id: m.id,\n role: m.role,\n content: m.content,\n createdAt: m.createdAt || new Date(),\n })),\n after: threadMessages.slice(messageIndex + 1, messageIndex + 3).map(m => ({\n id: m.id,\n role: m.role,\n content: m.content,\n createdAt: m.createdAt || new Date(),\n })),\n };\n }\n\n searchResults.push(searchResult);\n });\n }\n\n // Sort by date (newest first) and limit\n const sortedResults = searchResults\n .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())\n .slice(0, limit);\n\n return {\n results: sortedResults,\n count: sortedResults.length,\n query: searchQuery,\n searchScope: resourceScope ? 'resource' : 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n } catch (error) {\n return handleError(error, 'Error searching memory');\n }\n}\n"]}
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJOXMWFM6_cjs = require('../../chunk-JOXMWFM6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "cancelAgentBuilderActionRunHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkJOXMWFM6_cjs.cancelAgentBuilderActionRunHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "createAgentBuilderActionRunHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkJOXMWFM6_cjs.createAgentBuilderActionRunHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getAgentBuilderActionByIdHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkJOXMWFM6_cjs.getAgentBuilderActionByIdHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getAgentBuilderActionRunByIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkJOXMWFM6_cjs.getAgentBuilderActionRunByIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getAgentBuilderActionRunExecutionResultHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkJOXMWFM6_cjs.getAgentBuilderActionRunExecutionResultHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getAgentBuilderActionRunsHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkJOXMWFM6_cjs.getAgentBuilderActionRunsHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getAgentBuilderActionsHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkJOXMWFM6_cjs.getAgentBuilderActionsHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "resumeAgentBuilderActionHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkJOXMWFM6_cjs.resumeAgentBuilderActionHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "resumeAsyncAgentBuilderActionHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkJOXMWFM6_cjs.resumeAsyncAgentBuilderActionHandler; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "sendAgentBuilderActionRunEventHandler", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkJOXMWFM6_cjs.sendAgentBuilderActionRunEventHandler; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "startAgentBuilderActionRunHandler", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkJOXMWFM6_cjs.startAgentBuilderActionRunHandler; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "startAsyncAgentBuilderActionHandler", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkJOXMWFM6_cjs.startAsyncAgentBuilderActionHandler; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "streamAgentBuilderActionHandler", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkJOXMWFM6_cjs.streamAgentBuilderActionHandler; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "streamVNextAgentBuilderActionHandler", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkJOXMWFM6_cjs.streamVNextAgentBuilderActionHandler; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "watchAgentBuilderActionHandler", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkJOXMWFM6_cjs.watchAgentBuilderActionHandler; }
|
|
66
66
|
});
|
|
67
67
|
//# sourceMappingURL=agent-builder.cjs.map
|
|
68
68
|
//# sourceMappingURL=agent-builder.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-builder.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/agent-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,UAAU,mBAAoB,SAAQ,OAAO;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAoDD,eAAO,MAAM,6BAA6B,6EAcP,CAAC;AAEpC,eAAO,MAAM,gCAAgC,yFAG5C,CAAC;AAEF,eAAO,MAAM,mCAAmC,wKAG/C,CAAC;AAEF,eAAO,MAAM,8CAA8C;;;;cA2DuuB,CAAC;eAA8C,CAAC;qBAAoD,CAAC;aAA4C,CAAC;;;mBAAiH,CAAC;iBAAmC,CAAC;;;;;EAxDzkC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;EAG9C,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;yFA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;;;wEAG5C,CAAC;AAEF,eAAO,MAAM,kCAAkC;;EAG9C,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;EAGjD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler } from '../../chunk-
|
|
1
|
+
export { cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler } from '../../chunk-QDPOVUS4.js';
|
|
2
2
|
//# sourceMappingURL=agent-builder.js.map
|
|
3
3
|
//# sourceMappingURL=agent-builder.js.map
|
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFYZHFAFB_cjs = require('../../chunk-FYZHFAFB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
Object.defineProperty(exports, "
|
|
7
|
+
Object.defineProperty(exports, "approveToolCallHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkFYZHFAFB_cjs.approveToolCallHandler; }
|
|
10
10
|
});
|
|
11
|
-
Object.defineProperty(exports, "
|
|
11
|
+
Object.defineProperty(exports, "declineToolCallHandler", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkFYZHFAFB_cjs.declineToolCallHandler; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "generateHandler", {
|
|
12
16
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkFYZHFAFB_cjs.generateHandler; }
|
|
14
18
|
});
|
|
15
|
-
Object.defineProperty(exports, "
|
|
19
|
+
Object.defineProperty(exports, "generateLegacyHandler", {
|
|
16
20
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkFYZHFAFB_cjs.generateLegacyHandler; }
|
|
18
22
|
});
|
|
19
23
|
Object.defineProperty(exports, "getAgentByIdHandler", {
|
|
20
24
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkFYZHFAFB_cjs.getAgentByIdHandler; }
|
|
22
26
|
});
|
|
23
27
|
Object.defineProperty(exports, "getAgentsHandler", {
|
|
24
28
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkFYZHFAFB_cjs.getAgentsHandler; }
|
|
26
30
|
});
|
|
27
31
|
Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
|
|
28
32
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkFYZHFAFB_cjs.getEvalsByAgentIdHandler; }
|
|
30
34
|
});
|
|
31
35
|
Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
|
|
32
36
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkFYZHFAFB_cjs.getLiveEvalsByAgentIdHandler; }
|
|
34
38
|
});
|
|
35
39
|
Object.defineProperty(exports, "getProvidersHandler", {
|
|
36
40
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkFYZHFAFB_cjs.getProvidersHandler; }
|
|
38
42
|
});
|
|
39
43
|
Object.defineProperty(exports, "getSerializedAgentTools", {
|
|
40
44
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkFYZHFAFB_cjs.getSerializedAgentTools; }
|
|
42
46
|
});
|
|
43
47
|
Object.defineProperty(exports, "reorderAgentModelListHandler", {
|
|
44
48
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkFYZHFAFB_cjs.reorderAgentModelListHandler; }
|
|
46
50
|
});
|
|
47
51
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
48
52
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkFYZHFAFB_cjs.streamGenerateHandler; }
|
|
50
54
|
});
|
|
51
55
|
Object.defineProperty(exports, "streamGenerateLegacyHandler", {
|
|
52
56
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkFYZHFAFB_cjs.streamGenerateLegacyHandler; }
|
|
54
58
|
});
|
|
55
59
|
Object.defineProperty(exports, "streamNetworkHandler", {
|
|
56
60
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(exports, "streamVNextGenerateHandler", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function () { return chunk2QPKCXLB_cjs.streamVNextGenerateHandler; }
|
|
61
|
+
get: function () { return chunkFYZHFAFB_cjs.streamNetworkHandler; }
|
|
62
62
|
});
|
|
63
|
-
Object.defineProperty(exports, "
|
|
63
|
+
Object.defineProperty(exports, "streamUIMessageHandler", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkFYZHFAFB_cjs.streamUIMessageHandler; }
|
|
66
66
|
});
|
|
67
67
|
Object.defineProperty(exports, "updateAgentModelHandler", {
|
|
68
68
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkFYZHFAFB_cjs.updateAgentModelHandler; }
|
|
70
70
|
});
|
|
71
71
|
Object.defineProperty(exports, "updateAgentModelInModelListHandler", {
|
|
72
72
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkFYZHFAFB_cjs.updateAgentModelInModelListHandler; }
|
|
74
74
|
});
|
|
75
75
|
//# sourceMappingURL=agents.cjs.map
|
|
76
76
|
//# sourceMappingURL=agents.cjs.map
|
|
@@ -7,6 +7,9 @@ type GetBody<T extends keyof Agent & {
|
|
|
7
7
|
}[keyof Agent]> = {
|
|
8
8
|
messages: Parameters<Agent[T]>[0];
|
|
9
9
|
} & Parameters<Agent[T]>[1];
|
|
10
|
+
type GetHITLBody<T extends keyof Agent & {
|
|
11
|
+
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
12
|
+
}[keyof Agent]> = Parameters<Agent[T]>[0];
|
|
10
13
|
export declare function getSerializedAgentTools(tools: Record<string, any>): Promise<any>;
|
|
11
14
|
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
12
15
|
runtimeContext: RuntimeContext;
|
|
@@ -77,15 +80,6 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
|
|
|
77
80
|
instructions: import("@mastra/core").SystemMessage;
|
|
78
81
|
evals: import("@mastra/core").EvalRow[];
|
|
79
82
|
}>;
|
|
80
|
-
export declare function generateHandler({ mastra, ...args }: Context & {
|
|
81
|
-
runtimeContext: RuntimeContext;
|
|
82
|
-
agentId: string;
|
|
83
|
-
body: GetBody<'generate'> & {
|
|
84
|
-
resourceid?: string;
|
|
85
|
-
runtimeContext?: Record<string, unknown>;
|
|
86
|
-
};
|
|
87
|
-
abortSignal?: AbortSignal;
|
|
88
|
-
}): Promise<import("@mastra/core").GenerateTextResult<any, undefined>>;
|
|
89
83
|
export declare function generateLegacyHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
90
84
|
runtimeContext: RuntimeContext;
|
|
91
85
|
agentId: string;
|
|
@@ -95,16 +89,16 @@ export declare function generateLegacyHandler({ mastra, runtimeContext, agentId,
|
|
|
95
89
|
};
|
|
96
90
|
abortSignal?: AbortSignal;
|
|
97
91
|
}): Promise<import("@mastra/core").GenerateTextResult<any, undefined>>;
|
|
98
|
-
export declare function
|
|
92
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
99
93
|
runtimeContext: RuntimeContext;
|
|
100
94
|
agentId: string;
|
|
101
|
-
body: GetBody<'
|
|
95
|
+
body: GetBody<'generate'> & {
|
|
102
96
|
runtimeContext?: Record<string, unknown>;
|
|
103
97
|
format?: 'mastra' | 'aisdk';
|
|
104
98
|
};
|
|
105
99
|
abortSignal?: AbortSignal;
|
|
106
|
-
}): Promise<ReturnType<Agent['
|
|
107
|
-
export declare function
|
|
100
|
+
}): Promise<ReturnType<Agent['generate']>>;
|
|
101
|
+
export declare function streamGenerateLegacyHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
108
102
|
runtimeContext: RuntimeContext;
|
|
109
103
|
agentId: string;
|
|
110
104
|
body: GetBody<'stream'> & {
|
|
@@ -113,24 +107,33 @@ export declare function streamGenerateHandler({ mastra, ...args }: Context & {
|
|
|
113
107
|
};
|
|
114
108
|
abortSignal?: AbortSignal;
|
|
115
109
|
}): Promise<Response | undefined>;
|
|
116
|
-
export declare function
|
|
110
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
117
111
|
runtimeContext: RuntimeContext;
|
|
118
112
|
agentId: string;
|
|
119
113
|
body: GetBody<'stream'> & {
|
|
120
|
-
resourceid?: string;
|
|
121
114
|
runtimeContext?: string;
|
|
115
|
+
format?: 'aisdk' | 'mastra';
|
|
122
116
|
};
|
|
123
117
|
abortSignal?: AbortSignal;
|
|
124
|
-
}):
|
|
125
|
-
export declare function
|
|
118
|
+
}): ReturnType<Agent['stream']>;
|
|
119
|
+
export declare function approveToolCallHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
126
120
|
runtimeContext: RuntimeContext;
|
|
127
121
|
agentId: string;
|
|
128
|
-
body:
|
|
122
|
+
body: GetHITLBody<'approveToolCall'> & {
|
|
129
123
|
runtimeContext?: string;
|
|
130
124
|
format?: 'aisdk' | 'mastra';
|
|
131
125
|
};
|
|
132
126
|
abortSignal?: AbortSignal;
|
|
133
|
-
}): ReturnType<Agent['
|
|
127
|
+
}): ReturnType<Agent['approveToolCall']>;
|
|
128
|
+
export declare function declineToolCallHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
129
|
+
runtimeContext: RuntimeContext;
|
|
130
|
+
agentId: string;
|
|
131
|
+
body: GetHITLBody<'declineToolCall'> & {
|
|
132
|
+
runtimeContext?: string;
|
|
133
|
+
format?: 'aisdk' | 'mastra';
|
|
134
|
+
};
|
|
135
|
+
abortSignal?: AbortSignal;
|
|
136
|
+
}): ReturnType<Agent['declineToolCall']>;
|
|
134
137
|
export declare function streamNetworkHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
135
138
|
runtimeContext: RuntimeContext;
|
|
136
139
|
agentId: string;
|
|
@@ -139,10 +142,10 @@ export declare function streamNetworkHandler({ mastra, runtimeContext, agentId,
|
|
|
139
142
|
resourceId?: string;
|
|
140
143
|
};
|
|
141
144
|
}): ReturnType<Agent['network']>;
|
|
142
|
-
export declare function
|
|
145
|
+
export declare function streamUIMessageHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
|
|
143
146
|
runtimeContext: RuntimeContext;
|
|
144
147
|
agentId: string;
|
|
145
|
-
body:
|
|
148
|
+
body: GetBody<'stream'> & {
|
|
146
149
|
runtimeContext?: string;
|
|
147
150
|
onStepFinish?: StreamTextOnStepFinishCallback<any>;
|
|
148
151
|
onFinish?: StreamTextOnFinishCallback<any>;
|