Skip to content

Commit f42074f

Browse files
committed
fix(streaming): repair sparse Responses snapshots
1 parent 1b62026 commit f42074f

11 files changed

Lines changed: 834 additions & 7 deletions

File tree

‎docs-site/src/content/docs/ja/reference/configuration/providers.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ description: プロバイダー エントリ、認証、エンドポイント、
7777
| `noPenaltyModels?` | `string[]` |存在/周波数ペナルティを拒否するモデル。 |
7878
| `parallelToolCalls?` | `boolean` |並列ツール呼び出しを切り替えます。 OpenAI Chat はデフォルトでオンになっています。非チャット アダプターは明示的な `true` でのみアドバタイズします。 |
7979
| `responsesItemIdRepair?` | `{ message?: string[]; reasoning?: string[]; repairMissingTerminalIds?: boolean }` |正確なプレースホルダー ID および欠落している端末 ID に対するダウンストリーム SSE 修復はデフォルトで無効になっています。関数呼び出し ID は決して書き換えられません。 |
80+
| `responsesSnapshotRepair?` | `boolean` | デフォルトで無効のクライアント向け修復です。SSE と JSON の Responses ライフサイクルで欠落した status、output、ツールメタデータを補完し、raw 検査と永続化は変更しません。 |
8081
| `autoToolChoiceOnlyModels?` | `string[]` | `tool_choice` が `auto` または `none` のみを受け入れるモデル。強制的な選択は格下げされます。 |
8182
| `preserveReasoningContentModels?` | `string[]` |チャット履歴に以前のアシスタント `reasoning_content` が必要なモデル。 |
8283
| `thinkingToggleModels?` | `string[]` |エフォート ラダーではなく `thinking.enabled` を使用してモデルをチャットします。 |
@@ -190,7 +191,8 @@ Anthropic アカウント ポリシーのリスクを理解していない限り
190191
"reasoning": ["rs_0"],
191192
"message": ["msg_0"],
192193
"repairMissingTerminalIds": true
193-
}
194+
},
195+
"responsesSnapshotRepair": true
194196
}
195197
}
196198
}

‎docs-site/src/content/docs/ko/reference/configuration/providers.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ description: 공급자 항목, 인증, 엔드포인트, 모델 카탈로그, 할
7777
| `noPenaltyModels?` | `string[]` | presence/frequency penalty를 허용하지 않는 모델입니다. |
7878
| `parallelToolCalls?` | `boolean` | 병렬 도구 호출을 켜거나 끕니다. OpenAI Chat은 기본으로 켜져 있고, 비-chat 어댑터는 명시적으로 `true`일 때만 이를 노출합니다. |
7979
| `responsesItemIdRepair?` | `{ message?: string[]; reasoning?: string[]; repairMissingTerminalIds?: boolean }` | 기본값이 꺼진 downstream SSE 복구입니다. 정확한 자리표시자 id와 누락된 종료 id를 복구합니다. function-call id는 다시 쓰지 않습니다. |
80+
| `responsesSnapshotRepair?` | `boolean` | 기본값이 꺼진 클라이언트용 복구입니다. SSE와 JSON의 Responses 수명 주기에서 누락된 status, output, 도구 메타데이터를 채우며 raw 검사와 영속화는 변경하지 않습니다. |
8081
| `autoToolChoiceOnlyModels?` | `string[]` | `tool_choice`가 `auto` 또는 `none`만 받는 모델입니다. 강제 선택은 낮은 수준으로 바뀝니다. |
8182
| `preserveReasoningContentModels?` | `string[]` | chat 기록에서 이전 assistant `reasoning_content`가 필요한 모델입니다. |
8283
| `thinkingToggleModels?` | `string[]` | effort 계층 대신 `thinking.enabled`를 쓰는 chat 모델입니다. |
@@ -193,7 +194,8 @@ Anthropic 계정 정책 위험을 이해하지 못한다면 이 기능은 꺼두
193194
"reasoning": ["rs_0"],
194195
"message": ["msg_0"],
195196
"repairMissingTerminalIds": true
196-
}
197+
},
198+
"responsesSnapshotRepair": true
197199
}
198200
}
199201
}

‎docs-site/src/content/docs/reference/configuration/providers.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ differing backup and rewrites known legacy namespaced selected ids to bare ids.
8888
| `noPenaltyModels?` | `string[]` | Models that reject presence/frequency penalties. |
8989
| `parallelToolCalls?` | `boolean` | Toggle parallel tool calls. OpenAI Chat defaults on; non-chat adapters advertise only on explicit `true`. |
9090
| `responsesItemIdRepair?` | `{ message?: string[]; reasoning?: string[]; repairMissingTerminalIds?: boolean }` | Disabled-by-default downstream SSE repair for exact placeholder ids and missing terminal ids. Function-call ids are never rewritten. |
91+
| `responsesSnapshotRepair?` | `boolean` | Disabled-by-default client-facing repair for sparse Responses lifecycle snapshots in SSE and JSON. Fills missing canonical status, output, and tool metadata while raw inspection and persistence remain unchanged. |
9192
| `autoToolChoiceOnlyModels?` | `string[]` | Models whose `tool_choice` accepts only `auto` or `none`; forced choices are downgraded. |
9293
| `preserveReasoningContentModels?` | `string[]` | Models requiring prior assistant `reasoning_content` in chat history. |
9394
| `thinkingToggleModels?` | `string[]` | Chat models using `thinking.enabled` rather than an effort ladder. |
@@ -234,7 +235,8 @@ For a broken `openai-responses` gateway, repair belongs on the provider object:
234235
"reasoning": ["rs_0"],
235236
"message": ["msg_0"],
236237
"repairMissingTerminalIds": true
237-
}
238+
},
239+
"responsesSnapshotRepair": true
238240
}
239241
}
240242
}

‎docs-site/src/content/docs/ru/reference/configuration/providers.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ cross-route credential fallback не существует. Строки API GPT-
9393
| `noPenaltyModels?` | `string[]` | Модели, отвергающие penalty presence/frequency. |
9494
| `parallelToolCalls?` | `boolean` | Переключатель parallel tool call'ов. Для OpenAI Chat по умолчанию включено; не-chat adapter'ы рекламируют это только при явном `true`. |
9595
| `responsesItemIdRepair?` | `{ message?: string[]; reasoning?: string[]; repairMissingTerminalIds?: boolean }` | По умолчанию выключенная downstream SSE-repair для exact placeholder-id и отсутствующих terminal-id. Function-call id никогда не переписываются. |
96+
| `responsesSnapshotRepair?` | `boolean` | По умолчанию выключенная клиентская repair для неполных lifecycle snapshot'ов Responses в SSE и JSON. Добавляет отсутствующие status, output и tool metadata, не меняя raw inspection и persistence. |
9697
| `autoToolChoiceOnlyModels?` | `string[]` | Модели, у которых `tool_choice` принимает только `auto` или `none`; forced choice понижается. |
9798
| `preserveReasoningContentModels?` | `string[]` | Модели, которым нужен предыдущий assistant `reasoning_content` в chat history. |
9899
| `thinkingToggleModels?` | `string[]` | Chat-модели, использующие `thinking.enabled` вместо effort-ladder. |
@@ -244,7 +245,8 @@ Beijing, а `alibaba-token-plan-intl` обслуживает междунаро
244245
"reasoning": ["rs_0"],
245246
"message": ["msg_0"],
246247
"repairMissingTerminalIds": true
247-
}
248+
},
249+
"responsesSnapshotRepair": true
248250
}
249251
}
250252
}

‎docs-site/src/content/docs/zh-cn/reference/configuration/providers.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ description: 提供者条目、身份验证、端点、模型目录、配额、
7777
| `noPenaltyModels?` | `string[]` | 会拒绝 presence/frequency penalty 的模型。 |
7878
| `parallelToolCalls?` | `boolean` | 切换并行工具调用。OpenAI Chat 默认开启;非 chat 适配器只有显式 `true` 时才会声明支持。 |
7979
| `responsesItemIdRepair?` | `{ message?: string[]; reasoning?: string[]; repairMissingTerminalIds?: boolean }` | 默认关闭的下游 SSE 修复,用于精确占位 id 和缺失的终止 id。function-call id 永远不会被重写。 |
80+
| `responsesSnapshotRepair?` | `boolean` | 默认关闭的客户端修复,用于补全 SSE 与 JSON 中稀疏 Responses 生命周期快照缺失的 status、output 和工具元数据;原始检查与持久化保持不变。 |
8081
| `autoToolChoiceOnlyModels?` | `string[]` | `tool_choice` 只接受 `auto` 或 `none` 的模型;强制选择会被降级。 |
8182
| `preserveReasoningContentModels?` | `string[]` | 需要在聊天历史中保留先前 assistant `reasoning_content` 的模型。 |
8283
| `thinkingToggleModels?` | `string[]` | 使用 `thinking.enabled` 而不是 effort 阶梯的 chat 模型。 |
@@ -187,7 +188,8 @@ affinity。这些策略不能规避 provider enforcement。
187188
"reasoning": ["rs_0"],
188189
"message": ["msg_0"],
189190
"repairMissingTerminalIds": true
190-
}
191+
},
192+
"responsesSnapshotRepair": true
191193
}
192194
}
193195
}

‎src/config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ const providerConfigSchema = z.object({
560560
reasoning: z.array(z.string().min(1)).optional(),
561561
repairMissingTerminalIds: z.boolean().optional(),
562562
}).strict().optional(),
563+
responsesSnapshotRepair: z.boolean().optional(),
563564
}).passthrough();
564565

565566
const RESERVED_PROVIDER_NAMES = new Set(["__proto__", "prototype", "constructor"]);

0 commit comments

Comments
 (0)