@x-otto/interchange 0.1.0-alpha.15 → 0.1.0-alpha.18
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.
- package/dist/message.d.ts +11 -1
- package/package.json +1 -1
package/dist/message.d.ts
CHANGED
|
@@ -5,7 +5,17 @@ type KnownApi = 'openai-completions' | 'openai-responses' | 'azure-openai-respon
|
|
|
5
5
|
type Api = KnownApi | (string & {});
|
|
6
6
|
type KnownProvider = 'anthropic' | 'openai' | 'google' | 'amazon-bedrock' | 'github-copilot' | 'xai' | 'groq' | 'openrouter' | 'deepseek' | 'ollama' | 'moonshot' | 'custom';
|
|
7
7
|
type Provider = KnownProvider | (string & {});
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* RFC-421(新发现,会话 fe6bc77e 事故复盘):`'incomplete'` — SSE 流在未产出任何终止帧
|
|
10
|
+
* (`finish_reason` / `message_delta.stop_reason` / `response.completed|incomplete`)的
|
|
11
|
+
* 情况下就结束(`[DONE]` 或对端正常关闭连接,非网络异常,不触发 NetworkError 重试)。
|
|
12
|
+
* 常见根因:上游网关的输出侧内容审查在生成中途静默关流。此前各 wire 协议在这种情况下把
|
|
13
|
+
* `stopReason` 悄悄留在初始默认值 `'end_turn'`,与"模型自己决定说完了"完全不可区分——
|
|
14
|
+
* 残缺文本被当作正常完成上抛,用户看到的是"回复说到一半突然停了"且无任何诊断信号。
|
|
15
|
+
* 新增该值使 wire 层能诚实标注"流未正常终止",供 agent 层的 handleIncompleteStream
|
|
16
|
+
* 识别并注入续写引导(而非静默终止或误判为空转/空响应)。
|
|
17
|
+
*/
|
|
18
|
+
type StopReason = 'end_turn' | 'max_tokens' | 'tool_use' | 'stop_sequence' | 'refusal' | 'incomplete';
|
|
9
19
|
interface Usage {
|
|
10
20
|
inputTokens: number;
|
|
11
21
|
outputTokens: number;
|