@zenmux/rosetta-ai 1.0.26 → 1.0.27

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.
@@ -412,38 +412,26 @@ class ChatCompletionToResponsesConverter {
412
412
  convertReasoningInput(message) {
413
413
  const items = [];
414
414
  const details = message.reasoning_details;
415
- if (Array.isArray(details) && details.length > 0) {
416
- let summary = [];
417
- const flush = (id, encrypted) => {
418
- if (summary.length === 0 && !encrypted)
419
- return;
415
+ if (!Array.isArray(details) || details.length === 0)
416
+ return items;
417
+ // Only reasoning that carries encrypted_content can be sent back: the
418
+ // Responses backend either matches a real stored id or reconstructs from
419
+ // encrypted_content. A summary-only item with a fabricated id is rejected
420
+ // ("item with id rs_... not found"), so drop those groups.
421
+ let summary = [];
422
+ for (const d of details) {
423
+ if (d?.type === "reasoning.summary" && typeof d.summary === "string") {
424
+ summary.push({ type: "summary_text", text: d.summary });
425
+ }
426
+ else if (d?.type === "reasoning.encrypted" && typeof d.data === "string") {
420
427
  items.push({
421
428
  type: "reasoning",
422
- id: id ?? `rs_${this.generateId()}`,
429
+ id: typeof d.id === "string" ? d.id : `rs_${this.generateId()}`,
423
430
  summary,
424
- ...(encrypted ? { encrypted_content: encrypted } : {}),
431
+ encrypted_content: d.data,
425
432
  });
426
433
  summary = [];
427
- };
428
- for (const d of details) {
429
- if (d?.type === "reasoning.summary" && typeof d.summary === "string") {
430
- summary.push({ type: "summary_text", text: d.summary });
431
- }
432
- else if (d?.type === "reasoning.encrypted" && typeof d.data === "string") {
433
- flush(typeof d.id === "string" ? d.id : undefined, d.data);
434
- }
435
434
  }
436
- flush();
437
- return items;
438
- }
439
- // Fallback: only a plain `reasoning` string, no structured details.
440
- const reasoning = message.reasoning;
441
- if (typeof reasoning === "string" && reasoning.length > 0) {
442
- items.push({
443
- type: "reasoning",
444
- id: `rs_${this.generateId()}`,
445
- summary: [{ type: "summary_text", text: reasoning }],
446
- });
447
435
  }
448
436
  return items;
449
437
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenmux/rosetta-ai",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Universal translator between AI provider protocols",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",