@mastra/server 1.20.0 → 1.21.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/{chunk-NCCK5NVX.cjs → chunk-22YG2467.cjs} +3 -3
  3. package/dist/{chunk-NCCK5NVX.cjs.map → chunk-22YG2467.cjs.map} +1 -1
  4. package/dist/chunk-3VVDBDS5.cjs +694 -0
  5. package/dist/chunk-3VVDBDS5.cjs.map +1 -0
  6. package/dist/{chunk-3W54ZNYP.cjs → chunk-5IKQNFW5.cjs} +3 -3
  7. package/dist/{chunk-3W54ZNYP.cjs.map → chunk-5IKQNFW5.cjs.map} +1 -1
  8. package/dist/chunk-6MFKRF4K.cjs +176 -0
  9. package/dist/chunk-6MFKRF4K.cjs.map +1 -0
  10. package/dist/{chunk-G726SOOJ.cjs → chunk-7G44ZSFS.cjs} +3 -3
  11. package/dist/{chunk-G726SOOJ.cjs.map → chunk-7G44ZSFS.cjs.map} +1 -1
  12. package/dist/{chunk-TYYGY4H4.cjs → chunk-7HOYCW7S.cjs} +3 -3
  13. package/dist/{chunk-TYYGY4H4.cjs.map → chunk-7HOYCW7S.cjs.map} +1 -1
  14. package/dist/{chunk-MH2WUZWZ.js → chunk-7KJ4NUEH.js} +3 -3
  15. package/dist/{chunk-MH2WUZWZ.js.map → chunk-7KJ4NUEH.js.map} +1 -1
  16. package/dist/chunk-AJYJ4H7P.js +438 -0
  17. package/dist/chunk-AJYJ4H7P.js.map +1 -0
  18. package/dist/{chunk-ULLR3RN3.cjs → chunk-AYD7DM5U.cjs} +3 -3
  19. package/dist/{chunk-ULLR3RN3.cjs.map → chunk-AYD7DM5U.cjs.map} +1 -1
  20. package/dist/chunk-B6HNPO67.cjs +195 -0
  21. package/dist/chunk-B6HNPO67.cjs.map +1 -0
  22. package/dist/chunk-BQXQZPYZ.js +189 -0
  23. package/dist/chunk-BQXQZPYZ.js.map +1 -0
  24. package/dist/{chunk-UE4FGLA3.cjs → chunk-EDP2Y6XD.cjs} +21 -21
  25. package/dist/{chunk-UE4FGLA3.cjs.map → chunk-EDP2Y6XD.cjs.map} +1 -1
  26. package/dist/chunk-FCCXLAOT.js +153 -0
  27. package/dist/chunk-FCCXLAOT.js.map +1 -0
  28. package/dist/chunk-FURWD3DL.cjs +180 -0
  29. package/dist/chunk-FURWD3DL.cjs.map +1 -0
  30. package/dist/{chunk-23U24RPR.cjs → chunk-G5IQN5ZG.cjs} +3 -3
  31. package/dist/{chunk-23U24RPR.cjs.map → chunk-G5IQN5ZG.cjs.map} +1 -1
  32. package/dist/{chunk-UFK5THVP.cjs → chunk-GANMD6GP.cjs} +3 -3
  33. package/dist/{chunk-UFK5THVP.cjs.map → chunk-GANMD6GP.cjs.map} +1 -1
  34. package/dist/chunk-GWPNQNXF.cjs +45 -0
  35. package/dist/chunk-GWPNQNXF.cjs.map +1 -0
  36. package/dist/{chunk-G2ZZKKQI.js → chunk-L7PDVJZD.js} +3 -3
  37. package/dist/{chunk-G2ZZKKQI.js.map → chunk-L7PDVJZD.js.map} +1 -1
  38. package/dist/{chunk-K6RNBFGH.js → chunk-M4BZ2B7D.js} +3 -3
  39. package/dist/{chunk-K6RNBFGH.js.map → chunk-M4BZ2B7D.js.map} +1 -1
  40. package/dist/{chunk-4D7KSU4X.js → chunk-MWRVCCZE.js} +3 -3
  41. package/dist/{chunk-4D7KSU4X.js.map → chunk-MWRVCCZE.js.map} +1 -1
  42. package/dist/{chunk-MKW43AJ3.js → chunk-NL7Y763D.js} +3 -3
  43. package/dist/{chunk-MKW43AJ3.js.map → chunk-NL7Y763D.js.map} +1 -1
  44. package/dist/{chunk-XDFOXO76.js → chunk-O7CC4J2Y.js} +6 -6
  45. package/dist/{chunk-XDFOXO76.js.map → chunk-O7CC4J2Y.js.map} +1 -1
  46. package/dist/chunk-OJ72T77G.cjs +452 -0
  47. package/dist/chunk-OJ72T77G.cjs.map +1 -0
  48. package/dist/{chunk-5YMAXL54.js → chunk-QSA443WV.js} +3 -3
  49. package/dist/{chunk-5YMAXL54.js.map → chunk-QSA443WV.js.map} +1 -1
  50. package/dist/{chunk-4NRXB7VI.js → chunk-SNGR4M5I.js} +3 -3
  51. package/dist/{chunk-4NRXB7VI.js.map → chunk-SNGR4M5I.js.map} +1 -1
  52. package/dist/{chunk-WPBRQTMO.js → chunk-VCA6BSYU.js} +3 -3
  53. package/dist/{chunk-WPBRQTMO.js.map → chunk-VCA6BSYU.js.map} +1 -1
  54. package/dist/chunk-VGHQI3X3.js +689 -0
  55. package/dist/chunk-VGHQI3X3.js.map +1 -0
  56. package/dist/{chunk-HHF4VF75.js → chunk-VHUB2TYN.js} +3 -3
  57. package/dist/{chunk-HHF4VF75.js.map → chunk-VHUB2TYN.js.map} +1 -1
  58. package/dist/chunk-VKIIGA2F.js +35 -0
  59. package/dist/chunk-VKIIGA2F.js.map +1 -0
  60. package/dist/{chunk-2QCTUEHS.cjs → chunk-VVWHCAF2.cjs} +3 -3
  61. package/dist/{chunk-2QCTUEHS.cjs.map → chunk-VVWHCAF2.cjs.map} +1 -1
  62. package/dist/{chunk-A5J2TY2W.cjs → chunk-XKKTZVZX.cjs} +3 -3
  63. package/dist/{chunk-A5J2TY2W.cjs.map → chunk-XKKTZVZX.cjs.map} +1 -1
  64. package/dist/chunk-ZA3NGM3L.js +174 -0
  65. package/dist/chunk-ZA3NGM3L.js.map +1 -0
  66. package/dist/docs/SKILL.md +1 -1
  67. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  68. package/dist/docs/references/reference-server-routes.md +22 -1
  69. package/dist/server/handlers/agent-builder.cjs +16 -16
  70. package/dist/server/handlers/agent-builder.js +1 -1
  71. package/dist/server/handlers/conversations.cjs +24 -0
  72. package/dist/server/handlers/conversations.cjs.map +1 -0
  73. package/dist/server/handlers/conversations.d.ts +153 -0
  74. package/dist/server/handlers/conversations.d.ts.map +1 -0
  75. package/dist/server/handlers/conversations.js +3 -0
  76. package/dist/server/handlers/conversations.js.map +1 -0
  77. package/dist/server/handlers/datasets.cjs +26 -26
  78. package/dist/server/handlers/datasets.js +1 -1
  79. package/dist/server/handlers/logs.cjs +4 -4
  80. package/dist/server/handlers/logs.js +1 -1
  81. package/dist/server/handlers/responses.adapter.cjs +60 -0
  82. package/dist/server/handlers/responses.adapter.cjs.map +1 -0
  83. package/dist/server/handlers/responses.adapter.d.ts +98 -0
  84. package/dist/server/handlers/responses.adapter.d.ts.map +1 -0
  85. package/dist/server/handlers/responses.adapter.js +3 -0
  86. package/dist/server/handlers/responses.adapter.js.map +1 -0
  87. package/dist/server/handlers/responses.cjs +20 -0
  88. package/dist/server/handlers/responses.cjs.map +1 -0
  89. package/dist/server/handlers/responses.d.ts +387 -0
  90. package/dist/server/handlers/responses.d.ts.map +1 -0
  91. package/dist/server/handlers/responses.js +3 -0
  92. package/dist/server/handlers/responses.js.map +1 -0
  93. package/dist/server/handlers/responses.storage.cjs +28 -0
  94. package/dist/server/handlers/responses.storage.cjs.map +1 -0
  95. package/dist/server/handlers/responses.storage.d.ts +97 -0
  96. package/dist/server/handlers/responses.storage.d.ts.map +1 -0
  97. package/dist/server/handlers/responses.storage.js +3 -0
  98. package/dist/server/handlers/responses.storage.js.map +1 -0
  99. package/dist/server/handlers/scores.cjs +7 -7
  100. package/dist/server/handlers/scores.js +1 -1
  101. package/dist/server/handlers/stored-agents.cjs +7 -7
  102. package/dist/server/handlers/stored-agents.js +1 -1
  103. package/dist/server/handlers/stored-mcp-clients.cjs +6 -6
  104. package/dist/server/handlers/stored-mcp-clients.js +1 -1
  105. package/dist/server/handlers/stored-prompt-blocks.cjs +6 -6
  106. package/dist/server/handlers/stored-prompt-blocks.js +1 -1
  107. package/dist/server/handlers/stored-scorers.cjs +6 -6
  108. package/dist/server/handlers/stored-scorers.js +1 -1
  109. package/dist/server/handlers/tools.cjs +6 -6
  110. package/dist/server/handlers/tools.js +1 -1
  111. package/dist/server/handlers/workflows.cjs +24 -24
  112. package/dist/server/handlers/workflows.js +1 -1
  113. package/dist/server/handlers.cjs +26 -16
  114. package/dist/server/handlers.d.ts +2 -0
  115. package/dist/server/handlers.d.ts.map +1 -1
  116. package/dist/server/handlers.js +8 -6
  117. package/dist/server/schemas/conversations.d.ts +74 -0
  118. package/dist/server/schemas/conversations.d.ts.map +1 -0
  119. package/dist/server/schemas/index.cjs +185 -91
  120. package/dist/server/schemas/index.d.ts +2 -0
  121. package/dist/server/schemas/index.d.ts.map +1 -1
  122. package/dist/server/schemas/index.js +5 -3
  123. package/dist/server/schemas/responses.d.ts +341 -0
  124. package/dist/server/schemas/responses.d.ts.map +1 -0
  125. package/dist/server/server-adapter/index.cjs +123 -108
  126. package/dist/server/server-adapter/index.cjs.map +1 -1
  127. package/dist/server/server-adapter/index.js +29 -14
  128. package/dist/server/server-adapter/index.js.map +1 -1
  129. package/dist/server/server-adapter/routes/conversations.d.ts +150 -0
  130. package/dist/server/server-adapter/routes/conversations.d.ts.map +1 -0
  131. package/dist/server/server-adapter/routes/index.d.ts +4 -0
  132. package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
  133. package/dist/server/server-adapter/routes/responses.d.ts +385 -0
  134. package/dist/server/server-adapter/routes/responses.d.ts.map +1 -0
  135. package/package.json +5 -5
@@ -0,0 +1,98 @@
1
+ import type { MastraDBMessage } from '@mastra/core/agent';
2
+ import type { ConversationItem, ResponseInputMessage, ResponseObject, ResponseOutputItem, ResponseTextConfig, ResponseTool } from '../schemas/responses.js';
3
+ import type { ProviderMetadataLike, ResponseTurnRecord, UsageLike } from './responses.storage.js';
4
+ export type ResponseExecutionMessage = {
5
+ role: 'system' | 'user' | 'assistant';
6
+ content: string;
7
+ };
8
+ /**
9
+ * Maps configured Mastra tools into Responses API tool definitions.
10
+ */
11
+ export declare function mapMastraToolsToResponseTools(tools: Record<string, unknown> | undefined): ResponseTool[];
12
+ /**
13
+ * Maps Mastra thread messages into OpenAI-style conversation items.
14
+ */
15
+ export declare function mapMastraMessagesToConversationItems(messages: MastraDBMessage[]): ConversationItem[];
16
+ /**
17
+ * Maps the stored Mastra messages for one response turn back into OpenAI-style
18
+ * `response.output` items, preserving tool/message ordering from the thread.
19
+ */
20
+ export declare function mapMastraMessagesToResponseOutputItems({ messages, outputMessageId, status, fallbackText, }: {
21
+ messages: MastraDBMessage[] | undefined;
22
+ outputMessageId: string;
23
+ status: ResponseObject['status'];
24
+ fallbackText: string;
25
+ }): ResponseOutputItem[];
26
+ /**
27
+ * Creates a stable assistant-message-backed response identifier.
28
+ */
29
+ export declare function createMessageId(): string;
30
+ /**
31
+ * Maps Responses API input into the plain execution messages Mastra agents expect.
32
+ */
33
+ export declare function mapResponseInputToExecutionMessages(input: ResponseInputMessage[] | string): ResponseExecutionMessage[];
34
+ /**
35
+ * Converts usage details to the Responses API usage shape.
36
+ */
37
+ export declare function toResponseUsage(usage: UsageLike): ResponseObject['usage'];
38
+ /**
39
+ * Maps model finish reasons onto the Responses API status field.
40
+ */
41
+ export declare function toResponseStatus(finishReason: string | undefined): ResponseObject['status'];
42
+ /**
43
+ * Formats a text response part using the OpenAI-compatible Responses shape.
44
+ */
45
+ export declare function createOutputTextPart(text: string): {
46
+ type: "output_text";
47
+ text: string;
48
+ annotations: unknown[];
49
+ logprobs: unknown[];
50
+ };
51
+ /**
52
+ * Builds a completed Responses API object from Mastra execution state.
53
+ */
54
+ export declare function buildCompletedResponse({ responseId, outputMessageId, model, createdAt, completedAt, status, text, usage, instructions, textConfig, previousResponseId, conversationId, providerOptions, tools, store, messages, }: {
55
+ responseId: string;
56
+ outputMessageId: string;
57
+ model: string;
58
+ createdAt: number;
59
+ completedAt: number | null;
60
+ status: ResponseObject['status'];
61
+ text: string;
62
+ usage: UsageLike;
63
+ instructions?: string;
64
+ textConfig?: ResponseTextConfig;
65
+ previousResponseId?: string;
66
+ conversationId?: string;
67
+ providerOptions?: ProviderMetadataLike;
68
+ tools: ResponseTool[];
69
+ store: boolean;
70
+ messages?: MastraDBMessage[];
71
+ }): ResponseObject;
72
+ /**
73
+ * Builds the initial in-progress Responses API object emitted at stream start.
74
+ */
75
+ export declare function buildInProgressResponse({ responseId, model, createdAt, instructions, textConfig, previousResponseId, conversationId, tools, store, }: {
76
+ responseId: string;
77
+ model: string;
78
+ createdAt: number;
79
+ instructions?: string;
80
+ textConfig?: ResponseTextConfig;
81
+ previousResponseId?: string;
82
+ conversationId?: string;
83
+ store: boolean;
84
+ tools?: ResponseTool[];
85
+ }): ResponseObject;
86
+ /**
87
+ * Reconstructs a Responses API object from a stored response-turn record.
88
+ */
89
+ export declare function mapResponseTurnRecordToResponse(match: ResponseTurnRecord): ResponseObject;
90
+ /**
91
+ * Formats an SSE event line for the streaming Responses route.
92
+ */
93
+ export declare function formatSseEvent(event: string, data: unknown): Uint8Array;
94
+ /**
95
+ * Extracts text deltas from the Mastra stream chunk variants used by the route.
96
+ */
97
+ export declare function extractTextDelta(value: unknown): string | null;
98
+ //# sourceMappingURL=responses.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.adapter.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/responses.adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE/F,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0DF;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,YAAY,EAAE,CAqCxG;AAmLD;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,gBAAgB,EAAE,CAmDpG;AAED;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,EACrD,QAAQ,EACR,eAAe,EACf,MAAM,EACN,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,kBAAkB,EAAE,CAsCvB;AAED;;GAEG;AACH,wBAAgB,eAAe,WAE9B;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,oBAAoB,EAAE,GAAG,MAAM,GACrC,wBAAwB,EAAE,CAS5B;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,CAoBzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,CAM3F;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM;;;iBAI1B,OAAO,EAAE;cACZ,OAAO,EAAE;EAE5B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,UAAU,EACV,eAAe,EACf,KAAK,EACL,SAAS,EACT,WAAW,EACX,MAAM,EACN,IAAI,EACJ,KAAK,EACL,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,KAAK,EACL,KAAK,EACL,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B,GAAG,cAAc,CAyBjB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,KAAK,EACL,KAAK,GACN,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB,GAAG,cAAc,CAmBjB;AAED;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,kBAAkB,GAAG,cAAc,CAyBzF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,UAAU,CAEvE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAyB9D"}
@@ -0,0 +1,3 @@
1
+ export { buildCompletedResponse, buildInProgressResponse, createMessageId, createOutputTextPart, extractTextDelta, formatSseEvent, mapMastraMessagesToConversationItems, mapMastraMessagesToResponseOutputItems, mapMastraToolsToResponseTools, mapResponseInputToExecutionMessages, mapResponseTurnRecordToResponse, toResponseStatus, toResponseUsage } from '../../chunk-AJYJ4H7P.js';
2
+ //# sourceMappingURL=responses.adapter.js.map
3
+ //# sourceMappingURL=responses.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"responses.adapter.js"}
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var chunk3VVDBDS5_cjs = require('../../chunk-3VVDBDS5.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "CREATE_RESPONSE_ROUTE", {
8
+ enumerable: true,
9
+ get: function () { return chunk3VVDBDS5_cjs.CREATE_RESPONSE_ROUTE; }
10
+ });
11
+ Object.defineProperty(exports, "DELETE_RESPONSE_ROUTE", {
12
+ enumerable: true,
13
+ get: function () { return chunk3VVDBDS5_cjs.DELETE_RESPONSE_ROUTE; }
14
+ });
15
+ Object.defineProperty(exports, "GET_RESPONSE_ROUTE", {
16
+ enumerable: true,
17
+ get: function () { return chunk3VVDBDS5_cjs.GET_RESPONSE_ROUTE; }
18
+ });
19
+ //# sourceMappingURL=responses.cjs.map
20
+ //# sourceMappingURL=responses.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"responses.cjs"}
@@ -0,0 +1,387 @@
1
+ export declare const CREATE_RESPONSE_ROUTE: import("../server-adapter").ServerRoute<{
2
+ [x: string]: unknown;
3
+ model: string;
4
+ input: string | {
5
+ role: "system" | "user" | "assistant" | "developer";
6
+ content: string | {
7
+ type: "text" | "input_text" | "output_text";
8
+ text: string;
9
+ }[];
10
+ }[];
11
+ stream: boolean;
12
+ store: boolean;
13
+ agent_id?: string | undefined;
14
+ instructions?: string | undefined;
15
+ text?: {
16
+ format: {
17
+ type: "json_object";
18
+ } | {
19
+ type: "json_schema";
20
+ name: string;
21
+ schema: Record<string, unknown>;
22
+ description?: string | undefined;
23
+ strict?: boolean | undefined;
24
+ };
25
+ } | undefined;
26
+ conversation_id?: string | undefined;
27
+ providerOptions?: {
28
+ [x: string]: unknown;
29
+ openai?: Record<string, unknown> | undefined;
30
+ } | undefined;
31
+ previous_response_id?: string | undefined;
32
+ }, {
33
+ id: string;
34
+ object: "response";
35
+ created_at: number;
36
+ completed_at: number | null;
37
+ model: string;
38
+ status: "completed" | "in_progress" | "incomplete";
39
+ output: ({
40
+ id: string;
41
+ type: "message";
42
+ role: "assistant";
43
+ status: "completed" | "in_progress" | "incomplete";
44
+ content: {
45
+ type: "output_text";
46
+ text: string;
47
+ annotations?: unknown[] | undefined;
48
+ logprobs?: unknown[] | undefined;
49
+ }[];
50
+ } | {
51
+ id: string;
52
+ type: "function_call";
53
+ call_id: string;
54
+ name: string;
55
+ arguments: string;
56
+ status?: "completed" | "in_progress" | "incomplete" | undefined;
57
+ } | {
58
+ id: string;
59
+ type: "function_call_output";
60
+ call_id: string;
61
+ output: string;
62
+ })[];
63
+ usage: {
64
+ input_tokens: number;
65
+ output_tokens: number;
66
+ total_tokens: number;
67
+ input_tokens_details?: {
68
+ cached_tokens: number;
69
+ } | undefined;
70
+ output_tokens_details?: {
71
+ reasoning_tokens: number;
72
+ } | undefined;
73
+ } | null;
74
+ error?: null | undefined;
75
+ incomplete_details?: null | undefined;
76
+ instructions?: string | null | undefined;
77
+ text?: {
78
+ format: {
79
+ type: "json_object";
80
+ } | {
81
+ type: "json_schema";
82
+ name: string;
83
+ schema: Record<string, unknown>;
84
+ description?: string | undefined;
85
+ strict?: boolean | undefined;
86
+ };
87
+ } | null | undefined;
88
+ previous_response_id?: string | null | undefined;
89
+ conversation_id?: string | null | undefined;
90
+ providerOptions?: {
91
+ [x: string]: unknown;
92
+ openai?: Record<string, unknown> | undefined;
93
+ } | undefined;
94
+ tools?: {
95
+ type: "function";
96
+ name: string;
97
+ description?: string | undefined;
98
+ parameters?: unknown;
99
+ }[] | undefined;
100
+ store?: boolean | undefined;
101
+ }, "datastream-response", import("../server-adapter").RouteSchemas<undefined, undefined, import("zod").ZodObject<{
102
+ model: import("zod").ZodString;
103
+ agent_id: import("zod").ZodOptional<import("zod").ZodString>;
104
+ input: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodObject<{
105
+ role: import("zod").ZodEnum<{
106
+ system: "system";
107
+ user: "user";
108
+ assistant: "assistant";
109
+ developer: "developer";
110
+ }>;
111
+ content: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodObject<{
112
+ type: import("zod").ZodEnum<{
113
+ text: "text";
114
+ input_text: "input_text";
115
+ output_text: "output_text";
116
+ }>;
117
+ text: import("zod").ZodString;
118
+ }, import("zod/v4/core").$strip>>]>;
119
+ }, import("zod/v4/core").$strip>>]>;
120
+ instructions: import("zod").ZodOptional<import("zod").ZodString>;
121
+ text: import("zod").ZodOptional<import("zod").ZodObject<{
122
+ format: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
123
+ type: import("zod").ZodLiteral<"json_object">;
124
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
125
+ type: import("zod").ZodLiteral<"json_schema">;
126
+ name: import("zod").ZodString;
127
+ description: import("zod").ZodOptional<import("zod").ZodString>;
128
+ schema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
129
+ strict: import("zod").ZodOptional<import("zod").ZodBoolean>;
130
+ }, import("zod/v4/core").$strip>]>;
131
+ }, import("zod/v4/core").$strip>>;
132
+ conversation_id: import("zod").ZodOptional<import("zod").ZodString>;
133
+ providerOptions: import("zod").ZodOptional<import("zod").ZodObject<{
134
+ openai: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
135
+ }, import("zod/v4/core").$loose>>;
136
+ stream: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
137
+ store: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
138
+ previous_response_id: import("zod").ZodOptional<import("zod").ZodString>;
139
+ }, import("zod/v4/core").$loose>, import("zod").ZodObject<{
140
+ id: import("zod").ZodString;
141
+ object: import("zod").ZodLiteral<"response">;
142
+ created_at: import("zod").ZodNumber;
143
+ completed_at: import("zod").ZodNullable<import("zod").ZodNumber>;
144
+ model: import("zod").ZodString;
145
+ status: import("zod").ZodEnum<{
146
+ completed: "completed";
147
+ in_progress: "in_progress";
148
+ incomplete: "incomplete";
149
+ }>;
150
+ output: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
151
+ id: import("zod").ZodString;
152
+ type: import("zod").ZodLiteral<"message">;
153
+ role: import("zod").ZodLiteral<"assistant">;
154
+ status: import("zod").ZodEnum<{
155
+ completed: "completed";
156
+ in_progress: "in_progress";
157
+ incomplete: "incomplete";
158
+ }>;
159
+ content: import("zod").ZodArray<import("zod").ZodObject<{
160
+ type: import("zod").ZodLiteral<"output_text">;
161
+ text: import("zod").ZodString;
162
+ annotations: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnknown>>;
163
+ logprobs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnknown>>;
164
+ }, import("zod/v4/core").$strip>>;
165
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
166
+ id: import("zod").ZodString;
167
+ type: import("zod").ZodLiteral<"function_call">;
168
+ call_id: import("zod").ZodString;
169
+ name: import("zod").ZodString;
170
+ arguments: import("zod").ZodString;
171
+ status: import("zod").ZodOptional<import("zod").ZodEnum<{
172
+ completed: "completed";
173
+ in_progress: "in_progress";
174
+ incomplete: "incomplete";
175
+ }>>;
176
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
177
+ id: import("zod").ZodString;
178
+ type: import("zod").ZodLiteral<"function_call_output">;
179
+ call_id: import("zod").ZodString;
180
+ output: import("zod").ZodString;
181
+ }, import("zod/v4/core").$strip>]>>;
182
+ usage: import("zod").ZodNullable<import("zod").ZodObject<{
183
+ input_tokens: import("zod").ZodNumber;
184
+ output_tokens: import("zod").ZodNumber;
185
+ total_tokens: import("zod").ZodNumber;
186
+ input_tokens_details: import("zod").ZodOptional<import("zod").ZodObject<{
187
+ cached_tokens: import("zod").ZodNumber;
188
+ }, import("zod/v4/core").$strip>>;
189
+ output_tokens_details: import("zod").ZodOptional<import("zod").ZodObject<{
190
+ reasoning_tokens: import("zod").ZodNumber;
191
+ }, import("zod/v4/core").$strip>>;
192
+ }, import("zod/v4/core").$strip>>;
193
+ error: import("zod").ZodOptional<import("zod").ZodNull>;
194
+ incomplete_details: import("zod").ZodOptional<import("zod").ZodNull>;
195
+ instructions: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
196
+ text: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
197
+ format: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
198
+ type: import("zod").ZodLiteral<"json_object">;
199
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
200
+ type: import("zod").ZodLiteral<"json_schema">;
201
+ name: import("zod").ZodString;
202
+ description: import("zod").ZodOptional<import("zod").ZodString>;
203
+ schema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
204
+ strict: import("zod").ZodOptional<import("zod").ZodBoolean>;
205
+ }, import("zod/v4/core").$strip>]>;
206
+ }, import("zod/v4/core").$strip>>>;
207
+ previous_response_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
208
+ conversation_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
209
+ providerOptions: import("zod").ZodOptional<import("zod").ZodObject<{
210
+ openai: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
211
+ }, import("zod/v4/core").$loose>>;
212
+ tools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
213
+ type: import("zod").ZodLiteral<"function">;
214
+ name: import("zod").ZodString;
215
+ description: import("zod").ZodOptional<import("zod").ZodString>;
216
+ parameters: import("zod").ZodOptional<import("zod").ZodUnknown>;
217
+ }, import("zod/v4/core").$strip>>>;
218
+ store: import("zod").ZodOptional<import("zod").ZodBoolean>;
219
+ }, import("zod/v4/core").$strip>>, "POST", "/v1/responses">;
220
+ export declare const GET_RESPONSE_ROUTE: import("../server-adapter").ServerRoute<{
221
+ responseId: string;
222
+ }, {
223
+ id: string;
224
+ object: "response";
225
+ created_at: number;
226
+ completed_at: number | null;
227
+ model: string;
228
+ status: "completed" | "in_progress" | "incomplete";
229
+ output: ({
230
+ id: string;
231
+ type: "message";
232
+ role: "assistant";
233
+ status: "completed" | "in_progress" | "incomplete";
234
+ content: {
235
+ type: "output_text";
236
+ text: string;
237
+ annotations?: unknown[] | undefined;
238
+ logprobs?: unknown[] | undefined;
239
+ }[];
240
+ } | {
241
+ id: string;
242
+ type: "function_call";
243
+ call_id: string;
244
+ name: string;
245
+ arguments: string;
246
+ status?: "completed" | "in_progress" | "incomplete" | undefined;
247
+ } | {
248
+ id: string;
249
+ type: "function_call_output";
250
+ call_id: string;
251
+ output: string;
252
+ })[];
253
+ usage: {
254
+ input_tokens: number;
255
+ output_tokens: number;
256
+ total_tokens: number;
257
+ input_tokens_details?: {
258
+ cached_tokens: number;
259
+ } | undefined;
260
+ output_tokens_details?: {
261
+ reasoning_tokens: number;
262
+ } | undefined;
263
+ } | null;
264
+ error?: null | undefined;
265
+ incomplete_details?: null | undefined;
266
+ instructions?: string | null | undefined;
267
+ text?: {
268
+ format: {
269
+ type: "json_object";
270
+ } | {
271
+ type: "json_schema";
272
+ name: string;
273
+ schema: Record<string, unknown>;
274
+ description?: string | undefined;
275
+ strict?: boolean | undefined;
276
+ };
277
+ } | null | undefined;
278
+ previous_response_id?: string | null | undefined;
279
+ conversation_id?: string | null | undefined;
280
+ providerOptions?: {
281
+ [x: string]: unknown;
282
+ openai?: Record<string, unknown> | undefined;
283
+ } | undefined;
284
+ tools?: {
285
+ type: "function";
286
+ name: string;
287
+ description?: string | undefined;
288
+ parameters?: unknown;
289
+ }[] | undefined;
290
+ store?: boolean | undefined;
291
+ }, "json", import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
292
+ responseId: import("zod").ZodString;
293
+ }, import("zod/v4/core").$strip>, undefined, undefined, import("zod").ZodObject<{
294
+ id: import("zod").ZodString;
295
+ object: import("zod").ZodLiteral<"response">;
296
+ created_at: import("zod").ZodNumber;
297
+ completed_at: import("zod").ZodNullable<import("zod").ZodNumber>;
298
+ model: import("zod").ZodString;
299
+ status: import("zod").ZodEnum<{
300
+ completed: "completed";
301
+ in_progress: "in_progress";
302
+ incomplete: "incomplete";
303
+ }>;
304
+ output: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
305
+ id: import("zod").ZodString;
306
+ type: import("zod").ZodLiteral<"message">;
307
+ role: import("zod").ZodLiteral<"assistant">;
308
+ status: import("zod").ZodEnum<{
309
+ completed: "completed";
310
+ in_progress: "in_progress";
311
+ incomplete: "incomplete";
312
+ }>;
313
+ content: import("zod").ZodArray<import("zod").ZodObject<{
314
+ type: import("zod").ZodLiteral<"output_text">;
315
+ text: import("zod").ZodString;
316
+ annotations: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnknown>>;
317
+ logprobs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnknown>>;
318
+ }, import("zod/v4/core").$strip>>;
319
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
320
+ id: import("zod").ZodString;
321
+ type: import("zod").ZodLiteral<"function_call">;
322
+ call_id: import("zod").ZodString;
323
+ name: import("zod").ZodString;
324
+ arguments: import("zod").ZodString;
325
+ status: import("zod").ZodOptional<import("zod").ZodEnum<{
326
+ completed: "completed";
327
+ in_progress: "in_progress";
328
+ incomplete: "incomplete";
329
+ }>>;
330
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
331
+ id: import("zod").ZodString;
332
+ type: import("zod").ZodLiteral<"function_call_output">;
333
+ call_id: import("zod").ZodString;
334
+ output: import("zod").ZodString;
335
+ }, import("zod/v4/core").$strip>]>>;
336
+ usage: import("zod").ZodNullable<import("zod").ZodObject<{
337
+ input_tokens: import("zod").ZodNumber;
338
+ output_tokens: import("zod").ZodNumber;
339
+ total_tokens: import("zod").ZodNumber;
340
+ input_tokens_details: import("zod").ZodOptional<import("zod").ZodObject<{
341
+ cached_tokens: import("zod").ZodNumber;
342
+ }, import("zod/v4/core").$strip>>;
343
+ output_tokens_details: import("zod").ZodOptional<import("zod").ZodObject<{
344
+ reasoning_tokens: import("zod").ZodNumber;
345
+ }, import("zod/v4/core").$strip>>;
346
+ }, import("zod/v4/core").$strip>>;
347
+ error: import("zod").ZodOptional<import("zod").ZodNull>;
348
+ incomplete_details: import("zod").ZodOptional<import("zod").ZodNull>;
349
+ instructions: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
350
+ text: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodObject<{
351
+ format: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
352
+ type: import("zod").ZodLiteral<"json_object">;
353
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
354
+ type: import("zod").ZodLiteral<"json_schema">;
355
+ name: import("zod").ZodString;
356
+ description: import("zod").ZodOptional<import("zod").ZodString>;
357
+ schema: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
358
+ strict: import("zod").ZodOptional<import("zod").ZodBoolean>;
359
+ }, import("zod/v4/core").$strip>]>;
360
+ }, import("zod/v4/core").$strip>>>;
361
+ previous_response_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
362
+ conversation_id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
363
+ providerOptions: import("zod").ZodOptional<import("zod").ZodObject<{
364
+ openai: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
365
+ }, import("zod/v4/core").$loose>>;
366
+ tools: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
367
+ type: import("zod").ZodLiteral<"function">;
368
+ name: import("zod").ZodString;
369
+ description: import("zod").ZodOptional<import("zod").ZodString>;
370
+ parameters: import("zod").ZodOptional<import("zod").ZodUnknown>;
371
+ }, import("zod/v4/core").$strip>>>;
372
+ store: import("zod").ZodOptional<import("zod").ZodBoolean>;
373
+ }, import("zod/v4/core").$strip>>, "GET", "/v1/responses/:responseId">;
374
+ export declare const DELETE_RESPONSE_ROUTE: import("../server-adapter").ServerRoute<{
375
+ responseId: string;
376
+ }, {
377
+ id: string;
378
+ object: "response";
379
+ deleted: true;
380
+ }, "json", import("../server-adapter").RouteSchemas<import("zod").ZodObject<{
381
+ responseId: import("zod").ZodString;
382
+ }, import("zod/v4/core").$strip>, undefined, undefined, import("zod").ZodObject<{
383
+ id: import("zod").ZodString;
384
+ object: import("zod").ZodLiteral<"response">;
385
+ deleted: import("zod").ZodLiteral<true>;
386
+ }, import("zod/v4/core").$strip>>, "DELETE", "/v1/responses/:responseId">;
387
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/responses.ts"],"names":[],"mappings":"AA+yBA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DA8FhC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sEAuB7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;yEA6BhC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { CREATE_RESPONSE_ROUTE, DELETE_RESPONSE_ROUTE, GET_RESPONSE_ROUTE } from '../../chunk-VGHQI3X3.js';
2
+ //# sourceMappingURL=responses.js.map
3
+ //# sourceMappingURL=responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"responses.js"}
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var chunkB6HNPO67_cjs = require('../../chunk-B6HNPO67.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "deleteResponseTurnRecord", {
8
+ enumerable: true,
9
+ get: function () { return chunkB6HNPO67_cjs.deleteResponseTurnRecord; }
10
+ });
11
+ Object.defineProperty(exports, "findResponseTurnRecord", {
12
+ enumerable: true,
13
+ get: function () { return chunkB6HNPO67_cjs.findResponseTurnRecord; }
14
+ });
15
+ Object.defineProperty(exports, "getResponseMemoryStore", {
16
+ enumerable: true,
17
+ get: function () { return chunkB6HNPO67_cjs.getResponseMemoryStore; }
18
+ });
19
+ Object.defineProperty(exports, "persistResponseTurnRecord", {
20
+ enumerable: true,
21
+ get: function () { return chunkB6HNPO67_cjs.persistResponseTurnRecord; }
22
+ });
23
+ Object.defineProperty(exports, "resolveResponseTurnMessagesForStorage", {
24
+ enumerable: true,
25
+ get: function () { return chunkB6HNPO67_cjs.resolveResponseTurnMessagesForStorage; }
26
+ });
27
+ //# sourceMappingURL=responses.storage.cjs.map
28
+ //# sourceMappingURL=responses.storage.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"responses.storage.cjs"}
@@ -0,0 +1,97 @@
1
+ import type { MastraDBMessage } from '@mastra/core/agent';
2
+ import type { Mastra } from '@mastra/core/mastra';
3
+ import type { StorageThreadType } from '@mastra/core/memory';
4
+ import type { RequestContext } from '@mastra/core/request-context';
5
+ import type { MemoryStorage } from '@mastra/core/storage';
6
+ import type { ResponseObject, ResponseTextConfig, ResponseTool, ResponseUsage } from '../schemas/responses.js';
7
+ export type ThreadExecutionContext = {
8
+ threadId: string;
9
+ resourceId: string;
10
+ };
11
+ export type UsageLike = {
12
+ inputTokens?: number;
13
+ outputTokens?: number;
14
+ totalTokens?: number;
15
+ promptTokens?: number;
16
+ completionTokens?: number;
17
+ } | null;
18
+ export type ProviderMetadataLike = Record<string, Record<string, unknown> | undefined> | undefined;
19
+ export type ResponseTurnRecordMetadata = {
20
+ agentId: string;
21
+ model: string;
22
+ createdAt: number;
23
+ completedAt: number | null;
24
+ status: ResponseObject['status'];
25
+ usage: ResponseUsage | null;
26
+ instructions?: string;
27
+ text?: ResponseTextConfig;
28
+ previousResponseId?: string;
29
+ providerOptions?: ProviderMetadataLike;
30
+ tools: ResponseTool[];
31
+ store: boolean;
32
+ messageIds: string[];
33
+ };
34
+ export type ResponseTurnRecord = {
35
+ metadata: ResponseTurnRecordMetadata;
36
+ message: MastraDBMessage;
37
+ messages: MastraDBMessage[];
38
+ thread: StorageThreadType;
39
+ memoryStore: MemoryStorage;
40
+ };
41
+ type ResponseResultLike = {
42
+ response?: Promise<{
43
+ dbMessages?: MastraDBMessage[];
44
+ }> | {
45
+ dbMessages?: MastraDBMessage[];
46
+ };
47
+ };
48
+ /**
49
+ * Resolves the memory storage used by response-turn records.
50
+ */
51
+ export declare function getResponseMemoryStore(mastra: Mastra | undefined): Promise<MemoryStorage | null>;
52
+ /**
53
+ * Looks up a stored response-turn record by response id.
54
+ *
55
+ * Response ids are assistant message ids, so this reconstructs the record by
56
+ * loading that persisted assistant message, reading its response metadata, then
57
+ * reloading the full set of stored turn messages referenced by the metadata.
58
+ */
59
+ export declare function findResponseTurnRecord({ mastra, responseId, requestContext, }: {
60
+ mastra: Mastra | undefined;
61
+ responseId: string;
62
+ requestContext: RequestContext;
63
+ }): Promise<ResponseTurnRecord | null>;
64
+ /**
65
+ * Resolves the Mastra messages that belong to the response turn being stored.
66
+ */
67
+ export declare function resolveResponseTurnMessagesForStorage({ result, responseId, text, threadContext, }: {
68
+ result: ResponseResultLike;
69
+ responseId: string;
70
+ text: string;
71
+ threadContext: ThreadExecutionContext | null;
72
+ }): Promise<MastraDBMessage[]>;
73
+ /**
74
+ * Persists a response-turn record by anchoring it on the final assistant
75
+ * message in the stored turn.
76
+ *
77
+ * The response id becomes that assistant message id, and the response-specific
78
+ * metadata is written onto the assistant message so later retrieval can rebuild
79
+ * the Responses object from thread-backed storage.
80
+ */
81
+ export declare function persistResponseTurnRecord({ mastra, responseId, metadata, threadContext, messages, }: {
82
+ mastra: Mastra | undefined;
83
+ responseId: string;
84
+ metadata: ResponseTurnRecordMetadata;
85
+ threadContext: ThreadExecutionContext;
86
+ messages: MastraDBMessage[];
87
+ }): Promise<void>;
88
+ /**
89
+ * Removes all persisted messages for a stored response-turn record.
90
+ */
91
+ export declare function deleteResponseTurnRecord({ mastra, responseId, requestContext, }: {
92
+ mastra: Mastra | undefined;
93
+ responseId: string;
94
+ requestContext: RequestContext;
95
+ }): Promise<boolean>;
96
+ export {};
97
+ //# sourceMappingURL=responses.storage.d.ts.map