@mastra/server 0.0.0-playground-studio-cloud-20251031080052 → 0.0.0-playground-studio-again-20251114102707

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.
Files changed (149) hide show
  1. package/CHANGELOG.md +685 -3
  2. package/README.md +1 -1
  3. package/dist/{chunk-7HCPO76Z.js → chunk-2IS5WICF.js} +4505 -1017
  4. package/dist/chunk-2IS5WICF.js.map +1 -0
  5. package/dist/{chunk-SPRRK3P7.cjs → chunk-2YZH5PH6.cjs} +47 -47
  6. package/dist/chunk-2YZH5PH6.cjs.map +1 -0
  7. package/dist/{chunk-BATEJLED.js → chunk-3AMNUUZF.js} +20 -20
  8. package/dist/chunk-3AMNUUZF.js.map +1 -0
  9. package/dist/{chunk-AW5BU3RQ.js → chunk-3F52QCI4.js} +40 -40
  10. package/dist/chunk-3F52QCI4.js.map +1 -0
  11. package/dist/{chunk-7NADHFD2.cjs → chunk-64ITUOXI.cjs} +2 -2
  12. package/dist/chunk-64ITUOXI.cjs.map +1 -0
  13. package/dist/{chunk-MMROOK5J.js → chunk-6QWQZI4Q.js} +2 -2
  14. package/dist/{chunk-7NADHFD2.cjs.map → chunk-6QWQZI4Q.js.map} +1 -1
  15. package/dist/{chunk-ABRFV4XP.js → chunk-73PAWDM5.js} +13 -13
  16. package/dist/chunk-73PAWDM5.js.map +1 -0
  17. package/dist/{chunk-2S4IMB6E.cjs → chunk-A24TSVEZ.cjs} +39 -39
  18. package/dist/chunk-A24TSVEZ.cjs.map +1 -0
  19. package/dist/{chunk-QQXMIP6C.js → chunk-B3Z6J745.js} +17 -17
  20. package/dist/chunk-B3Z6J745.js.map +1 -0
  21. package/dist/{chunk-G4PUALCE.cjs → chunk-BTWIR2B7.cjs} +4 -4
  22. package/dist/{chunk-G4PUALCE.cjs.map → chunk-BTWIR2B7.cjs.map} +1 -1
  23. package/dist/{chunk-KSFLUEWV.js → chunk-D7T74TVR.js} +4 -5
  24. package/dist/chunk-D7T74TVR.js.map +1 -0
  25. package/dist/{chunk-YSHNCC6F.cjs → chunk-EHACNWDL.cjs} +169 -201
  26. package/dist/chunk-EHACNWDL.cjs.map +1 -0
  27. package/dist/{chunk-MN2TZQ7I.js → chunk-FPBYKMIS.js} +13 -13
  28. package/dist/chunk-FPBYKMIS.js.map +1 -0
  29. package/dist/{chunk-3SNGNFUJ.cjs → chunk-GLAZTMX3.cjs} +37 -37
  30. package/dist/chunk-GLAZTMX3.cjs.map +1 -0
  31. package/dist/{chunk-KDUHLUK4.cjs → chunk-ID6JYDNL.cjs} +4387 -896
  32. package/dist/chunk-ID6JYDNL.cjs.map +1 -0
  33. package/dist/{chunk-TRGAMKHX.cjs → chunk-KF3RI45U.cjs} +46 -41
  34. package/dist/chunk-KF3RI45U.cjs.map +1 -0
  35. package/dist/{chunk-K5T5A3AL.cjs → chunk-KJIDZQRA.cjs} +14 -14
  36. package/dist/chunk-KJIDZQRA.cjs.map +1 -0
  37. package/dist/{chunk-MYR4PVGN.js → chunk-KWH5QBXP.js} +4 -4
  38. package/dist/{chunk-MYR4PVGN.js.map → chunk-KWH5QBXP.js.map} +1 -1
  39. package/dist/{chunk-AHB4JCIQ.js → chunk-ND5OKOMT.js} +31 -26
  40. package/dist/chunk-ND5OKOMT.js.map +1 -0
  41. package/dist/{chunk-XN74I6VW.cjs → chunk-PPMIB3FQ.cjs} +20 -20
  42. package/dist/chunk-PPMIB3FQ.cjs.map +1 -0
  43. package/dist/{chunk-EP3JQDPD.cjs → chunk-S54HNARD.cjs} +18 -18
  44. package/dist/{chunk-EP3JQDPD.cjs.map → chunk-S54HNARD.cjs.map} +1 -1
  45. package/dist/{chunk-4QCXUEAT.js → chunk-SZIFSF4T.js} +3 -3
  46. package/dist/{chunk-4QCXUEAT.js.map → chunk-SZIFSF4T.js.map} +1 -1
  47. package/dist/{chunk-Y7SH5ZKM.cjs → chunk-U7GLIXYO.cjs} +157 -172
  48. package/dist/chunk-U7GLIXYO.cjs.map +1 -0
  49. package/dist/{chunk-CY4TP3FK.js → chunk-UXGQZUYZ.js} +3 -3
  50. package/dist/{chunk-CY4TP3FK.js.map → chunk-UXGQZUYZ.js.map} +1 -1
  51. package/dist/{chunk-RE4RPXT2.cjs → chunk-V5WWQN7P.cjs} +4 -4
  52. package/dist/{chunk-RE4RPXT2.cjs.map → chunk-V5WWQN7P.cjs.map} +1 -1
  53. package/dist/{chunk-OGK26QPW.js → chunk-V6JYJS7O.js} +109 -123
  54. package/dist/chunk-V6JYJS7O.js.map +1 -0
  55. package/dist/{chunk-CJFKRVED.cjs → chunk-W2KMU354.cjs} +4 -5
  56. package/dist/chunk-W2KMU354.cjs.map +1 -0
  57. package/dist/{chunk-B7QWVGQQ.cjs → chunk-X3MICMI2.cjs} +140 -249
  58. package/dist/chunk-X3MICMI2.cjs.map +1 -0
  59. package/dist/{chunk-6VPAV4ZV.js → chunk-Z2O5YVHY.js} +134 -165
  60. package/dist/chunk-Z2O5YVHY.js.map +1 -0
  61. package/dist/{chunk-ZLBL4NQC.js → chunk-ZJ6KEY6H.js} +67 -174
  62. package/dist/chunk-ZJ6KEY6H.js.map +1 -0
  63. package/dist/server/handlers/a2a.cjs +7 -7
  64. package/dist/server/handlers/a2a.d.ts +10 -10
  65. package/dist/server/handlers/a2a.d.ts.map +1 -1
  66. package/dist/server/handlers/a2a.js +1 -1
  67. package/dist/server/handlers/agent-builder.cjs +31 -19
  68. package/dist/server/handlers/agent-builder.d.ts +38 -47
  69. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  70. package/dist/server/handlers/agent-builder.js +1 -1
  71. package/dist/server/handlers/agents.cjs +25 -29
  72. package/dist/server/handlers/agents.d.ts +41 -55
  73. package/dist/server/handlers/agents.d.ts.map +1 -1
  74. package/dist/server/handlers/agents.js +1 -1
  75. package/dist/server/handlers/error.cjs +2 -2
  76. package/dist/server/handlers/error.js +1 -1
  77. package/dist/server/handlers/logs.cjs +7 -7
  78. package/dist/server/handlers/logs.d.ts +3 -3
  79. package/dist/server/handlers/logs.d.ts.map +1 -1
  80. package/dist/server/handlers/logs.js +1 -1
  81. package/dist/server/handlers/memory.cjs +19 -23
  82. package/dist/server/handlers/memory.d.ts +30 -35
  83. package/dist/server/handlers/memory.d.ts.map +1 -1
  84. package/dist/server/handlers/memory.js +1 -1
  85. package/dist/server/handlers/observability.cjs +8 -8
  86. package/dist/server/handlers/observability.d.ts +12 -12
  87. package/dist/server/handlers/observability.d.ts.map +1 -1
  88. package/dist/server/handlers/observability.js +1 -1
  89. package/dist/server/handlers/scores.cjs +11 -11
  90. package/dist/server/handlers/scores.d.ts +24 -24
  91. package/dist/server/handlers/scores.d.ts.map +1 -1
  92. package/dist/server/handlers/scores.js +1 -1
  93. package/dist/server/handlers/tools.cjs +7 -7
  94. package/dist/server/handlers/tools.d.ts +8 -8
  95. package/dist/server/handlers/tools.d.ts.map +1 -1
  96. package/dist/server/handlers/tools.js +1 -1
  97. package/dist/server/handlers/utils.cjs +3 -3
  98. package/dist/server/handlers/utils.js +1 -1
  99. package/dist/server/handlers/vector.cjs +7 -7
  100. package/dist/server/handlers/vector.js +1 -1
  101. package/dist/server/handlers/voice.cjs +5 -5
  102. package/dist/server/handlers/voice.d.ts +6 -6
  103. package/dist/server/handlers/voice.js +1 -1
  104. package/dist/server/handlers/workflows.cjs +21 -29
  105. package/dist/server/handlers/workflows.d.ts +27 -36
  106. package/dist/server/handlers/workflows.d.ts.map +1 -1
  107. package/dist/server/handlers/workflows.js +1 -1
  108. package/dist/server/handlers.cjs +23 -28
  109. package/dist/server/handlers.d.ts +0 -1
  110. package/dist/server/handlers.d.ts.map +1 -1
  111. package/dist/server/handlers.js +11 -12
  112. package/dist/server/http-exception.d.ts +0 -5
  113. package/dist/server/http-exception.d.ts.map +1 -1
  114. package/dist/server/utils.d.ts +3 -2
  115. package/dist/server/utils.d.ts.map +1 -1
  116. package/package.json +13 -8
  117. package/dist/chunk-2S4IMB6E.cjs.map +0 -1
  118. package/dist/chunk-3SNGNFUJ.cjs.map +0 -1
  119. package/dist/chunk-6VPAV4ZV.js.map +0 -1
  120. package/dist/chunk-7HCPO76Z.js.map +0 -1
  121. package/dist/chunk-ABRFV4XP.js.map +0 -1
  122. package/dist/chunk-AHB4JCIQ.js.map +0 -1
  123. package/dist/chunk-AW5BU3RQ.js.map +0 -1
  124. package/dist/chunk-B7QWVGQQ.cjs.map +0 -1
  125. package/dist/chunk-BATEJLED.js.map +0 -1
  126. package/dist/chunk-CJFKRVED.cjs.map +0 -1
  127. package/dist/chunk-I3C4ODGV.cjs +0 -335
  128. package/dist/chunk-I3C4ODGV.cjs.map +0 -1
  129. package/dist/chunk-K5T5A3AL.cjs.map +0 -1
  130. package/dist/chunk-KDUHLUK4.cjs.map +0 -1
  131. package/dist/chunk-KSFLUEWV.js.map +0 -1
  132. package/dist/chunk-LLUOPR3J.js +0 -323
  133. package/dist/chunk-LLUOPR3J.js.map +0 -1
  134. package/dist/chunk-MMROOK5J.js.map +0 -1
  135. package/dist/chunk-MN2TZQ7I.js.map +0 -1
  136. package/dist/chunk-OGK26QPW.js.map +0 -1
  137. package/dist/chunk-QQXMIP6C.js.map +0 -1
  138. package/dist/chunk-SPRRK3P7.cjs.map +0 -1
  139. package/dist/chunk-TRGAMKHX.cjs.map +0 -1
  140. package/dist/chunk-XN74I6VW.cjs.map +0 -1
  141. package/dist/chunk-Y7SH5ZKM.cjs.map +0 -1
  142. package/dist/chunk-YSHNCC6F.cjs.map +0 -1
  143. package/dist/chunk-ZLBL4NQC.js.map +0 -1
  144. package/dist/server/handlers/legacyWorkflows.cjs +0 -48
  145. package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
  146. package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
  147. package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
  148. package/dist/server/handlers/legacyWorkflows.js +0 -3
  149. package/dist/server/handlers/legacyWorkflows.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/handlers/memory.ts"],"names":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,MAC1C,UAAA,EAAY,oBAAoB,UAAA,GAAa;AAAA,KAC/C;AAAA,EACF,SAAS,KAAA,EAAO;AACd,IAAA,OAAOE,6BAAA,CAAY,OAAO,wBAAwB,CAAA;AAAA,EACpD;AACF","file":"chunk-U7GLIXYO.cjs","sourcesContent":["import type { MastraDBMessage } from '@mastra/core/agent';\nimport { RequestContext } from '@mastra/core/di';\nimport type { MastraMemory } from '@mastra/core/memory';\nimport type { StorageListMessagesInput, StorageOrderBy } 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 requestContext?: RequestContext;\n}\n\nexport function getTextContent(message: MastraDBMessage): string {\n if (typeof message.content === 'string') {\n return message.content;\n }\n if (message.content && typeof message.content === 'object' && 'parts' in message.content) {\n const textPart = message.content.parts.find(p => p.type === 'text');\n return textPart?.text || '';\n }\n return '';\n}\n\nasync function getMemoryFromContext({\n mastra,\n agentId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'>): Promise<MastraMemory | null | undefined> {\n const logger = mastra.getLogger();\n let agent;\n if (agentId) {\n try {\n agent = mastra.getAgentById(agentId);\n } catch (error) {\n logger.debug('Error getting agent from mastra, searching agents for agent', error);\n }\n }\n if (agentId && !agent) {\n logger.debug('Agent not found, searching agents for agent', { agentId });\n const agents = mastra.listAgents();\n if (Object.keys(agents || {}).length) {\n for (const [_, ag] of Object.entries(agents)) {\n try {\n const agents = await ag.listAgents();\n\n if (agents[agentId]) {\n agent = agents[agentId];\n break;\n }\n } catch (error) {\n logger.debug('Error getting agent from agent', error);\n }\n }\n }\n\n if (!agent) {\n throw new HTTPException(404, { message: 'Agent not found' });\n }\n }\n\n if (agent) {\n return await agent?.getMemory({\n requestContext: requestContext ?? new RequestContext(),\n });\n }\n}\n\n// Memory handlers\nexport async function getMemoryStatusHandler({\n mastra,\n agentId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'>) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'>) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 listThreadsHandler({\n mastra,\n agentId,\n resourceId,\n requestContext,\n page,\n perPage,\n orderBy,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'requestContext'> & {\n page: number;\n perPage: number | false;\n orderBy?: StorageOrderBy;\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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.listThreadsByResourceId({\n resourceId: resourceId!,\n page,\n perPage,\n orderBy,\n });\n return result;\n } catch (error) {\n return handleError(error, 'Error listing threads');\n }\n}\n\nexport async function getThreadByIdHandler({\n mastra,\n agentId,\n threadId,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\n body: {\n messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];\n };\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\n body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & { resourceId?: string };\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> & {\n body?: Parameters<MastraMemory['saveThread']>[0]['thread'];\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 listMessagesHandler({\n mastra,\n agentId,\n threadId,\n resourceId,\n perPage,\n page,\n orderBy,\n include,\n filter,\n requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> &\n Omit<StorageListMessagesInput, 'threadId'>) {\n try {\n validateBody({ threadId });\n\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\n\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n if (!threadId) {\n throw new HTTPException(400, { message: 'No threadId found' });\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.recall({\n threadId: threadId,\n resourceId,\n perPage,\n page,\n orderBy,\n include,\n filter,\n });\n return result;\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 requestContext,\n memoryConfig,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> & {\n resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];\n memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];\n}) {\n try {\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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 !== 'thread' && 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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'requestContext'> & {\n body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;\n}) {\n try {\n validateBody({ threadId });\n const memory = await getMemoryFromContext({ mastra, agentId, requestContext });\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: string;\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 requestContext,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\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, requestContext });\n if (!memory) {\n throw new HTTPException(400, { message: 'Memory is not initialized' });\n }\n\n // Normalize messageIds to the format expected by deleteMessages\n // Convert single values to arrays and extract IDs from objects\n let normalizedIds: string[] | { id: string }[];\n\n if (Array.isArray(messageIds)) {\n // Already an array - keep as is (could be string[] or { id: string }[])\n normalizedIds = messageIds;\n } else if (typeof messageIds === 'string') {\n // Single string ID - wrap in array\n normalizedIds = [messageIds];\n } else {\n // Single object with id property - wrap in array\n normalizedIds = [messageIds];\n }\n\n await memory.deleteMessages(normalizedIds);\n\n // Count messages for response\n const count = Array.isArray(messageIds) ? messageIds.length : 1;\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 requestContext,\n memoryConfig,\n}: Pick<MemoryContext, 'mastra' | 'agentId' | 'requestContext'> & {\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, requestContext });\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 =\n typeof config?.semanticRecall === 'object' ? config?.semanticRecall?.scope !== 'thread' : true;\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\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: resourceScope ? 'resource' : 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n }\n\n // If no threadId provided, get one from the resource\n if (!threadId) {\n const { threads } = await memory.listThreadsByResourceId({\n resourceId,\n page: 0,\n perPage: 1,\n orderBy: { field: 'updatedAt', direction: 'DESC' },\n });\n\n if (threads.length === 0) {\n return {\n results: [],\n count: 0,\n query: searchQuery,\n searchScope: resourceScope ? 'resource' : 'thread',\n searchType: hasSemanticRecall ? 'semantic' : 'text',\n };\n }\n\n // Use first thread - Memory class will handle scope internally\n threadId = threads[0]!.id;\n }\n\n const beforeRange =\n typeof config.semanticRecall === `boolean`\n ? 2\n : typeof config.semanticRecall?.messageRange === `number`\n ? config.semanticRecall.messageRange\n : config.semanticRecall?.messageRange.before || 2;\n const afterRange =\n typeof config.semanticRecall === `boolean`\n ? 2\n : typeof config.semanticRecall?.messageRange === `number`\n ? config.semanticRecall.messageRange\n : config.semanticRecall?.messageRange.after || 2;\n\n if (resourceScope && config.semanticRecall) {\n config.semanticRecall =\n typeof config.semanticRecall === `boolean`\n ? // make message range 0 so we can highlight the matches in search, message range will include other messages, not the matching ones\n // and we add prev/next messages in a special section on each message anyway\n { messageRange: 0, topK: 2, scope: 'resource' }\n : { ...config.semanticRecall, messageRange: 0 };\n }\n\n // Single call to recall - just like the agent does\n // The Memory class handles scope (thread vs resource) internally\n const threadConfig = memory.getMergedThreadConfig(config || {});\n if (!threadConfig.lastMessages && !threadConfig.semanticRecall) {\n return { results: [], count: 0, query: searchQuery };\n }\n\n const result = await memory.recall({\n threadId,\n resourceId,\n perPage: threadConfig.lastMessages,\n threadConfig: config,\n vectorSearchString: threadConfig.semanticRecall && searchQuery ? searchQuery : undefined,\n });\n\n // Get all threads to build context and show which thread each message is from\n // Fetch threads by IDs from the actual messages to avoid truncation\n const threadIds = Array.from(\n new Set(result.messages.map((m: MastraDBMessage) => m.threadId || threadId!).filter(Boolean)),\n );\n const fetched = await Promise.all(threadIds.map((id: string) => memory.getThreadById({ threadId: id })));\n const threadMap = new Map(fetched.filter(Boolean).map(t => [t!.id, t!]));\n\n // Process each message in the results\n for (const msg of result.messages) {\n const content = getTextContent(msg);\n\n const msgThreadId = msg.threadId || threadId;\n const thread = threadMap.get(msgThreadId);\n\n // Get thread messages for context\n const threadMessages = (await memory.recall({ threadId: msgThreadId })).messages;\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: msgThreadId,\n threadTitle: thread?.title || msgThreadId,\n };\n\n if (messageIndex !== -1) {\n searchResult.context = {\n before: threadMessages.slice(Math.max(0, messageIndex - beforeRange), messageIndex).map(m => ({\n id: m.id,\n role: m.role,\n content: getTextContent(m),\n createdAt: m.createdAt || new Date(),\n })),\n after: threadMessages.slice(messageIndex + 1, messageIndex + afterRange + 1).map(m => ({\n id: m.id,\n role: m.role,\n content: getTextContent(m),\n createdAt: m.createdAt || new Date(),\n })),\n };\n }\n\n searchResults.push(searchResult);\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,4 +1,4 @@
1
- import { HTTPException } from './chunk-MMROOK5J.js';
1
+ import { HTTPException } from './chunk-6QWQZI4Q.js';
2
2
 
3
3
  // src/server/handlers/error.ts
4
4
  function handleError(error, defaultMessage) {
@@ -12,5 +12,5 @@ function handleError(error, defaultMessage) {
12
12
  }
13
13
 
14
14
  export { handleError };
15
- //# sourceMappingURL=chunk-CY4TP3FK.js.map
16
- //# sourceMappingURL=chunk-CY4TP3FK.js.map
15
+ //# sourceMappingURL=chunk-UXGQZUYZ.js.map
16
+ //# sourceMappingURL=chunk-UXGQZUYZ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server/handlers/error.ts"],"names":[],"mappings":";;;AAKO,SAAS,WAAA,CAAY,OAAgB,cAAA,EAA+B;AACzE,EAAA,MAAM,QAAA,GAAW,KAAA;AAEjB,EAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,MAAA,IAAU,QAAA,CAAS,SAAS,MAAA,IAAU,GAAA;AAEtE,EAAA,MAAM,IAAI,cAAc,cAAA,EAA8B;AAAA,IACpD,OAAA,EAAS,SAAS,OAAA,IAAW,cAAA;AAAA,IAC7B,OAAO,QAAA,CAAS,KAAA;AAAA,IAChB,OAAO,QAAA,CAAS;AAAA,GACjB,CAAA;AACH","file":"chunk-CY4TP3FK.js","sourcesContent":["import { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/server/handlers/error.ts"],"names":[],"mappings":";;;AAKO,SAAS,WAAA,CAAY,OAAgB,cAAA,EAA+B;AACzE,EAAA,MAAM,QAAA,GAAW,KAAA;AAEjB,EAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,MAAA,IAAU,QAAA,CAAS,SAAS,MAAA,IAAU,GAAA;AAEtE,EAAA,MAAM,IAAI,cAAc,cAAA,EAA8B;AAAA,IACpD,OAAA,EAAS,SAAS,OAAA,IAAW,cAAA;AAAA,IAC7B,OAAO,QAAA,CAAS,KAAA;AAAA,IAChB,OAAO,QAAA,CAAS;AAAA,GACjB,CAAA;AACH","file":"chunk-UXGQZUYZ.js","sourcesContent":["import { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunk7NADHFD2_cjs = require('./chunk-7NADHFD2.cjs');
3
+ var chunk64ITUOXI_cjs = require('./chunk-64ITUOXI.cjs');
4
4
 
5
5
  // src/server/handlers/error.ts
6
6
  function handleError(error, defaultMessage) {
7
7
  const apiError = error;
8
8
  const apiErrorStatus = apiError.status || apiError.details?.status || 500;
9
- throw new chunk7NADHFD2_cjs.HTTPException(apiErrorStatus, {
9
+ throw new chunk64ITUOXI_cjs.HTTPException(apiErrorStatus, {
10
10
  message: apiError.message || defaultMessage,
11
11
  stack: apiError.stack,
12
12
  cause: apiError.cause
@@ -14,5 +14,5 @@ function handleError(error, defaultMessage) {
14
14
  }
15
15
 
16
16
  exports.handleError = handleError;
17
- //# sourceMappingURL=chunk-RE4RPXT2.cjs.map
18
- //# sourceMappingURL=chunk-RE4RPXT2.cjs.map
17
+ //# sourceMappingURL=chunk-V5WWQN7P.cjs.map
18
+ //# sourceMappingURL=chunk-V5WWQN7P.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server/handlers/error.ts"],"names":["HTTPException"],"mappings":";;;;;AAKO,SAAS,WAAA,CAAY,OAAgB,cAAA,EAA+B;AACzE,EAAA,MAAM,QAAA,GAAW,KAAA;AAEjB,EAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,MAAA,IAAU,QAAA,CAAS,SAAS,MAAA,IAAU,GAAA;AAEtE,EAAA,MAAM,IAAIA,gCAAc,cAAA,EAA8B;AAAA,IACpD,OAAA,EAAS,SAAS,OAAA,IAAW,cAAA;AAAA,IAC7B,OAAO,QAAA,CAAS,KAAA;AAAA,IAChB,OAAO,QAAA,CAAS;AAAA,GACjB,CAAA;AACH","file":"chunk-RE4RPXT2.cjs","sourcesContent":["import { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/server/handlers/error.ts"],"names":["HTTPException"],"mappings":";;;;;AAKO,SAAS,WAAA,CAAY,OAAgB,cAAA,EAA+B;AACzE,EAAA,MAAM,QAAA,GAAW,KAAA;AAEjB,EAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,MAAA,IAAU,QAAA,CAAS,SAAS,MAAA,IAAU,GAAA;AAEtE,EAAA,MAAM,IAAIA,gCAAc,cAAA,EAA8B;AAAA,IACpD,OAAA,EAAS,SAAS,OAAA,IAAW,cAAA;AAAA,IAC7B,OAAO,QAAA,CAAS,KAAA;AAAA,IAChB,OAAO,QAAA,CAAS;AAAA,GACjB,CAAA;AACH","file":"chunk-V5WWQN7P.cjs","sourcesContent":["import { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { validateBody } from './chunk-4QCXUEAT.js';
2
- import { handleError } from './chunk-CY4TP3FK.js';
3
- import { HTTPException } from './chunk-MMROOK5J.js';
1
+ import { validateBody } from './chunk-SZIFSF4T.js';
2
+ import { handleError } from './chunk-UXGQZUYZ.js';
3
+ import { HTTPException } from './chunk-6QWQZI4Q.js';
4
4
  import { __export } from './chunk-PR4QN5HX.js';
5
- import { convertMessages } from '@mastra/core/agent';
5
+ import { RequestContext } from '@mastra/core/di';
6
6
  import { generateEmptyFromSchema } from '@mastra/core/utils';
7
7
 
8
8
  // src/server/handlers/memory.ts
@@ -13,34 +13,43 @@ __export(memory_exports, {
13
13
  deleteThreadHandler: () => deleteThreadHandler,
14
14
  getMemoryConfigHandler: () => getMemoryConfigHandler,
15
15
  getMemoryStatusHandler: () => getMemoryStatusHandler,
16
- getMessagesHandler: () => getMessagesHandler,
17
- getMessagesPaginatedHandler: () => getMessagesPaginatedHandler,
16
+ getTextContent: () => getTextContent,
18
17
  getThreadByIdHandler: () => getThreadByIdHandler,
19
- getThreadsHandler: () => getThreadsHandler,
20
- getThreadsPaginatedHandler: () => getThreadsPaginatedHandler,
21
18
  getWorkingMemoryHandler: () => getWorkingMemoryHandler,
19
+ listMessagesHandler: () => listMessagesHandler,
20
+ listThreadsHandler: () => listThreadsHandler,
22
21
  saveMessagesHandler: () => saveMessagesHandler,
23
22
  searchMemoryHandler: () => searchMemoryHandler,
24
23
  updateThreadHandler: () => updateThreadHandler,
25
24
  updateWorkingMemoryHandler: () => updateWorkingMemoryHandler
26
25
  });
26
+ function getTextContent(message) {
27
+ if (typeof message.content === "string") {
28
+ return message.content;
29
+ }
30
+ if (message.content && typeof message.content === "object" && "parts" in message.content) {
31
+ const textPart = message.content.parts.find((p) => p.type === "text");
32
+ return textPart?.text || "";
33
+ }
34
+ return "";
35
+ }
27
36
  async function getMemoryFromContext({
28
37
  mastra,
29
38
  agentId,
30
- runtimeContext
39
+ requestContext
31
40
  }) {
32
41
  const logger = mastra.getLogger();
33
42
  let agent;
34
43
  if (agentId) {
35
44
  try {
36
- agent = mastra.getAgent(agentId);
45
+ agent = mastra.getAgentById(agentId);
37
46
  } catch (error) {
38
47
  logger.debug("Error getting agent from mastra, searching agents for agent", error);
39
48
  }
40
49
  }
41
50
  if (agentId && !agent) {
42
51
  logger.debug("Agent not found, searching agents for agent", { agentId });
43
- const agents = mastra.getAgents();
52
+ const agents = mastra.listAgents();
44
53
  if (Object.keys(agents || {}).length) {
45
54
  for (const [_, ag] of Object.entries(agents)) {
46
55
  try {
@@ -60,18 +69,17 @@ async function getMemoryFromContext({
60
69
  }
61
70
  if (agent) {
62
71
  return await agent?.getMemory({
63
- runtimeContext
64
- }) || mastra.getMemory();
72
+ requestContext: requestContext ?? new RequestContext()
73
+ });
65
74
  }
66
- return mastra.getMemory();
67
75
  }
68
76
  async function getMemoryStatusHandler({
69
77
  mastra,
70
78
  agentId,
71
- runtimeContext
79
+ requestContext
72
80
  }) {
73
81
  try {
74
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
82
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
75
83
  if (!memory) {
76
84
  return { result: false };
77
85
  }
@@ -83,10 +91,10 @@ async function getMemoryStatusHandler({
83
91
  async function getMemoryConfigHandler({
84
92
  mastra,
85
93
  agentId,
86
- runtimeContext
94
+ requestContext
87
95
  }) {
88
96
  try {
89
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
97
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
90
98
  if (!memory) {
91
99
  throw new HTTPException(400, { message: "Memory is not initialized" });
92
100
  }
@@ -96,67 +104,41 @@ async function getMemoryConfigHandler({
96
104
  return handleError(error, "Error getting memory configuration");
97
105
  }
98
106
  }
99
- async function getThreadsHandler({
100
- mastra,
101
- agentId,
102
- resourceId,
103
- runtimeContext,
104
- orderBy,
105
- sortDirection
106
- }) {
107
- try {
108
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
109
- if (!memory) {
110
- throw new HTTPException(400, { message: "Memory is not initialized" });
111
- }
112
- validateBody({ resourceId });
113
- const threads = await memory.getThreadsByResourceId({
114
- resourceId,
115
- orderBy,
116
- sortDirection
117
- });
118
- return threads;
119
- } catch (error) {
120
- return handleError(error, "Error getting threads");
121
- }
122
- }
123
- async function getThreadsPaginatedHandler({
107
+ async function listThreadsHandler({
124
108
  mastra,
125
109
  agentId,
126
110
  resourceId,
127
- runtimeContext,
111
+ requestContext,
128
112
  page,
129
113
  perPage,
130
- orderBy,
131
- sortDirection
114
+ orderBy
132
115
  }) {
133
116
  try {
134
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
117
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
135
118
  if (!memory) {
136
119
  throw new HTTPException(400, { message: "Memory is not initialized" });
137
120
  }
138
121
  validateBody({ resourceId });
139
- const result = await memory.getThreadsByResourceIdPaginated({
122
+ const result = await memory.listThreadsByResourceId({
140
123
  resourceId,
141
124
  page,
142
125
  perPage,
143
- orderBy,
144
- sortDirection
126
+ orderBy
145
127
  });
146
128
  return result;
147
129
  } catch (error) {
148
- return handleError(error, "Error getting paginated threads");
130
+ return handleError(error, "Error listing threads");
149
131
  }
150
132
  }
151
133
  async function getThreadByIdHandler({
152
134
  mastra,
153
135
  agentId,
154
136
  threadId,
155
- runtimeContext
137
+ requestContext
156
138
  }) {
157
139
  try {
158
140
  validateBody({ threadId });
159
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
141
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
160
142
  if (!memory) {
161
143
  throw new HTTPException(400, { message: "Memory is not initialized" });
162
144
  }
@@ -173,10 +155,10 @@ async function saveMessagesHandler({
173
155
  mastra,
174
156
  agentId,
175
157
  body,
176
- runtimeContext
158
+ requestContext
177
159
  }) {
178
160
  try {
179
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
161
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
180
162
  if (!memory) {
181
163
  throw new HTTPException(400, { message: "Memory is not initialized" });
182
164
  }
@@ -207,10 +189,10 @@ async function createThreadHandler({
207
189
  mastra,
208
190
  agentId,
209
191
  body,
210
- runtimeContext
192
+ requestContext
211
193
  }) {
212
194
  try {
213
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
195
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
214
196
  if (!memory) {
215
197
  throw new HTTPException(400, { message: "Memory is not initialized" });
216
198
  }
@@ -231,10 +213,10 @@ async function updateThreadHandler({
231
213
  agentId,
232
214
  threadId,
233
215
  body,
234
- runtimeContext
216
+ requestContext
235
217
  }) {
236
218
  try {
237
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
219
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
238
220
  if (!body) {
239
221
  throw new HTTPException(400, { message: "Body is required" });
240
222
  }
@@ -266,11 +248,11 @@ async function deleteThreadHandler({
266
248
  mastra,
267
249
  agentId,
268
250
  threadId,
269
- runtimeContext
251
+ requestContext
270
252
  }) {
271
253
  try {
272
254
  validateBody({ threadId });
273
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
255
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
274
256
  if (!memory) {
275
257
  throw new HTTPException(400, { message: "Memory is not initialized" });
276
258
  }
@@ -284,55 +266,41 @@ async function deleteThreadHandler({
284
266
  return handleError(error, "Error deleting thread");
285
267
  }
286
268
  }
287
- async function getMessagesPaginatedHandler({
288
- mastra,
289
- threadId,
290
- resourceId,
291
- selectBy,
292
- format
293
- }) {
294
- try {
295
- validateBody({ threadId });
296
- const storage = mastra.getStorage();
297
- if (!storage) {
298
- throw new HTTPException(400, { message: "Storage is not initialized" });
299
- }
300
- const thread = await storage.getThreadById({ threadId });
301
- if (!thread) {
302
- throw new HTTPException(404, { message: "Thread not found" });
303
- }
304
- const result = await storage.getMessagesPaginated({ threadId, resourceId, selectBy, format });
305
- return result;
306
- } catch (error) {
307
- return handleError(error, "Error getting messages");
308
- }
309
- }
310
- async function getMessagesHandler({
269
+ async function listMessagesHandler({
311
270
  mastra,
312
271
  agentId,
313
272
  threadId,
314
- limit,
315
- runtimeContext
273
+ resourceId,
274
+ perPage,
275
+ page,
276
+ orderBy,
277
+ include,
278
+ filter,
279
+ requestContext
316
280
  }) {
317
- if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
318
- throw new HTTPException(400, { message: "Invalid limit: must be a positive integer" });
319
- }
320
281
  try {
321
282
  validateBody({ threadId });
322
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
283
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
323
284
  if (!memory) {
324
285
  throw new HTTPException(400, { message: "Memory is not initialized" });
325
286
  }
287
+ if (!threadId) {
288
+ throw new HTTPException(400, { message: "No threadId found" });
289
+ }
326
290
  const thread = await memory.getThreadById({ threadId });
327
291
  if (!thread) {
328
292
  throw new HTTPException(404, { message: "Thread not found" });
329
293
  }
330
- const result = await memory.query({
294
+ const result = await memory.recall({
331
295
  threadId,
332
- ...limit && { selectBy: { last: limit } }
296
+ resourceId,
297
+ perPage,
298
+ page,
299
+ orderBy,
300
+ include,
301
+ filter
333
302
  });
334
- const uiMessages = convertMessages(result.messagesV2).to("AIV5.UI");
335
- return { messages: result.messages, uiMessages, legacyMessages: result.uiMessages };
303
+ return result;
336
304
  } catch (error) {
337
305
  return handleError(error, "Error getting messages");
338
306
  }
@@ -342,11 +310,11 @@ async function getWorkingMemoryHandler({
342
310
  agentId,
343
311
  threadId,
344
312
  resourceId,
345
- runtimeContext,
313
+ requestContext,
346
314
  memoryConfig
347
315
  }) {
348
316
  try {
349
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
317
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
350
318
  validateBody({ threadId });
351
319
  if (!memory) {
352
320
  throw new HTTPException(400, { message: "Memory is not initialized" });
@@ -368,11 +336,11 @@ async function updateWorkingMemoryHandler({
368
336
  agentId,
369
337
  threadId,
370
338
  body,
371
- runtimeContext
339
+ requestContext
372
340
  }) {
373
341
  try {
374
342
  validateBody({ threadId });
375
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
343
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
376
344
  const { resourceId, memoryConfig, workingMemory } = body;
377
345
  if (!memory) {
378
346
  throw new HTTPException(400, { message: "Memory is not initialized" });
@@ -391,21 +359,26 @@ async function deleteMessagesHandler({
391
359
  mastra,
392
360
  agentId,
393
361
  messageIds,
394
- runtimeContext
362
+ requestContext
395
363
  }) {
396
364
  try {
397
365
  if (messageIds === void 0 || messageIds === null) {
398
366
  throw new HTTPException(400, { message: "messageIds is required" });
399
367
  }
400
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
368
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
401
369
  if (!memory) {
402
370
  throw new HTTPException(400, { message: "Memory is not initialized" });
403
371
  }
404
- await memory.deleteMessages(messageIds);
405
- let count = 1;
372
+ let normalizedIds;
406
373
  if (Array.isArray(messageIds)) {
407
- count = messageIds.length;
408
- }
374
+ normalizedIds = messageIds;
375
+ } else if (typeof messageIds === "string") {
376
+ normalizedIds = [messageIds];
377
+ } else {
378
+ normalizedIds = [messageIds];
379
+ }
380
+ await memory.deleteMessages(normalizedIds);
381
+ const count = Array.isArray(messageIds) ? messageIds.length : 1;
409
382
  return { success: true, message: `${count} message${count === 1 ? "" : "s"} deleted successfully` };
410
383
  } catch (error) {
411
384
  return handleError(error, "Error deleting messages");
@@ -418,12 +391,12 @@ async function searchMemoryHandler({
418
391
  resourceId,
419
392
  threadId,
420
393
  limit = 20,
421
- runtimeContext,
394
+ requestContext,
422
395
  memoryConfig
423
396
  }) {
424
397
  try {
425
398
  validateBody({ searchQuery, resourceId });
426
- const memory = await getMemoryFromContext({ mastra, agentId, runtimeContext });
399
+ const memory = await getMemoryFromContext({ mastra, agentId, requestContext });
427
400
  if (!memory) {
428
401
  throw new HTTPException(400, { message: "Memory is not initialized" });
429
402
  }
@@ -453,8 +426,13 @@ async function searchMemoryHandler({
453
426
  }
454
427
  }
455
428
  if (!threadId) {
456
- const threads2 = await memory.getThreadsByResourceId({ resourceId });
457
- if (threads2.length === 0) {
429
+ const { threads } = await memory.listThreadsByResourceId({
430
+ resourceId,
431
+ page: 0,
432
+ perPage: 1,
433
+ orderBy: { field: "updatedAt", direction: "DESC" }
434
+ });
435
+ if (threads.length === 0) {
458
436
  return {
459
437
  results: [],
460
438
  count: 0,
@@ -463,7 +441,7 @@ async function searchMemoryHandler({
463
441
  searchType: hasSemanticRecall ? "semantic" : "text"
464
442
  };
465
443
  }
466
- threadId = threads2[0].id;
444
+ threadId = threads[0].id;
467
445
  }
468
446
  const beforeRange = typeof config.semanticRecall === `boolean` ? 2 : typeof config.semanticRecall?.messageRange === `number` ? config.semanticRecall.messageRange : config.semanticRecall?.messageRange.before || 2;
469
447
  const afterRange = typeof config.semanticRecall === `boolean` ? 2 : typeof config.semanticRecall?.messageRange === `number` ? config.semanticRecall.messageRange : config.semanticRecall?.messageRange.after || 2;
@@ -474,19 +452,27 @@ async function searchMemoryHandler({
474
452
  { messageRange: 0, topK: 2, scope: "resource" }
475
453
  ) : { ...config.semanticRecall, messageRange: 0 };
476
454
  }
477
- const result = await memory.rememberMessages({
455
+ const threadConfig = memory.getMergedThreadConfig(config || {});
456
+ if (!threadConfig.lastMessages && !threadConfig.semanticRecall) {
457
+ return { results: [], count: 0, query: searchQuery };
458
+ }
459
+ const result = await memory.recall({
478
460
  threadId,
479
461
  resourceId,
480
- vectorMessageSearch: searchQuery,
481
- config
462
+ perPage: threadConfig.lastMessages,
463
+ threadConfig: config,
464
+ vectorSearchString: threadConfig.semanticRecall && searchQuery ? searchQuery : void 0
482
465
  });
483
- const threads = await memory.getThreadsByResourceId({ resourceId });
484
- const threadMap = new Map(threads.map((t) => [t.id, t]));
485
- for (const msg of result.messagesV2) {
486
- const content = typeof msg.content.content === `string` ? msg.content.content : msg.content.parts?.map((p) => p.type === "text" ? p.text : "").join(" ") || "";
466
+ const threadIds = Array.from(
467
+ new Set(result.messages.map((m) => m.threadId || threadId).filter(Boolean))
468
+ );
469
+ const fetched = await Promise.all(threadIds.map((id) => memory.getThreadById({ threadId: id })));
470
+ const threadMap = new Map(fetched.filter(Boolean).map((t) => [t.id, t]));
471
+ for (const msg of result.messages) {
472
+ const content = getTextContent(msg);
487
473
  const msgThreadId = msg.threadId || threadId;
488
474
  const thread = threadMap.get(msgThreadId);
489
- const threadMessages = (await memory.query({ threadId: msgThreadId })).uiMessages;
475
+ const threadMessages = (await memory.recall({ threadId: msgThreadId })).messages;
490
476
  const messageIndex = threadMessages.findIndex((m) => m.id === msg.id);
491
477
  const searchResult = {
492
478
  id: msg.id,
@@ -501,13 +487,13 @@ async function searchMemoryHandler({
501
487
  before: threadMessages.slice(Math.max(0, messageIndex - beforeRange), messageIndex).map((m) => ({
502
488
  id: m.id,
503
489
  role: m.role,
504
- content: m.content,
490
+ content: getTextContent(m),
505
491
  createdAt: m.createdAt || /* @__PURE__ */ new Date()
506
492
  })),
507
493
  after: threadMessages.slice(messageIndex + 1, messageIndex + afterRange + 1).map((m) => ({
508
494
  id: m.id,
509
495
  role: m.role,
510
- content: m.content,
496
+ content: getTextContent(m),
511
497
  createdAt: m.createdAt || /* @__PURE__ */ new Date()
512
498
  }))
513
499
  };
@@ -527,6 +513,6 @@ async function searchMemoryHandler({
527
513
  }
528
514
  }
529
515
 
530
- export { createThreadHandler, deleteMessagesHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getMessagesHandler, getMessagesPaginatedHandler, getThreadByIdHandler, getThreadsHandler, getThreadsPaginatedHandler, getWorkingMemoryHandler, memory_exports, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler };
531
- //# sourceMappingURL=chunk-OGK26QPW.js.map
532
- //# sourceMappingURL=chunk-OGK26QPW.js.map
516
+ export { createThreadHandler, deleteMessagesHandler, deleteThreadHandler, getMemoryConfigHandler, getMemoryStatusHandler, getTextContent, getThreadByIdHandler, getWorkingMemoryHandler, listMessagesHandler, listThreadsHandler, memory_exports, saveMessagesHandler, searchMemoryHandler, updateThreadHandler, updateWorkingMemoryHandler };
517
+ //# sourceMappingURL=chunk-V6JYJS7O.js.map
518
+ //# sourceMappingURL=chunk-V6JYJS7O.js.map