@ai-sdk/openai 2.0.35 → 2.0.37

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.
@@ -2156,26 +2156,40 @@ async function convertToOpenAIResponsesInput({
2156
2156
  });
2157
2157
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
2158
2158
  if (reasoningId != null) {
2159
- const existingReasoningMessage = reasoningMessages[reasoningId];
2160
- const summaryParts = [];
2161
- if (part.text.length > 0) {
2162
- summaryParts.push({ type: "summary_text", text: part.text });
2163
- } else if (existingReasoningMessage !== void 0) {
2164
- warnings.push({
2165
- type: "other",
2166
- message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2167
- });
2168
- }
2169
- if (existingReasoningMessage === void 0) {
2170
- reasoningMessages[reasoningId] = {
2171
- type: "reasoning",
2172
- id: reasoningId,
2173
- encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2174
- summary: summaryParts
2175
- };
2176
- input.push(reasoningMessages[reasoningId]);
2159
+ const reasoningMessage = reasoningMessages[reasoningId];
2160
+ if (store) {
2161
+ if (reasoningMessage === void 0) {
2162
+ input.push({ type: "item_reference", id: reasoningId });
2163
+ reasoningMessages[reasoningId] = {
2164
+ type: "reasoning",
2165
+ id: reasoningId,
2166
+ summary: []
2167
+ };
2168
+ }
2177
2169
  } else {
2178
- existingReasoningMessage.summary.push(...summaryParts);
2170
+ const summaryParts = [];
2171
+ if (part.text.length > 0) {
2172
+ summaryParts.push({
2173
+ type: "summary_text",
2174
+ text: part.text
2175
+ });
2176
+ } else if (reasoningMessage !== void 0) {
2177
+ warnings.push({
2178
+ type: "other",
2179
+ message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
2180
+ });
2181
+ }
2182
+ if (reasoningMessage === void 0) {
2183
+ reasoningMessages[reasoningId] = {
2184
+ type: "reasoning",
2185
+ id: reasoningId,
2186
+ encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
2187
+ summary: summaryParts
2188
+ };
2189
+ input.push(reasoningMessages[reasoningId]);
2190
+ } else {
2191
+ reasoningMessage.summary.push(...summaryParts);
2192
+ }
2179
2193
  }
2180
2194
  } else {
2181
2195
  warnings.push({