deepccc 0.2.11 → 0.2.12

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/README.md CHANGED
@@ -8,6 +8,8 @@ DeepCCC 是一个本地优先的开源 Coding Agent,同时提供浏览器多
8
8
 
9
9
  ## 安装与快速开始
10
10
 
11
+ 模型原生流未收到完成事件、返回错误结束原因或达到输出长度限制时,会报告异常并保留已经输出的内容,不将不完整回复判为成功。没有回复且没有工具执行的空结果也会明确报错。用户主动取消仍按中断处理。
12
+
11
13
  全局安装:
12
14
 
13
15
  ```bash
package/dist/index.js CHANGED
@@ -478,16 +478,25 @@ export class ChatSession {
478
478
  messages: attemptMessages,
479
479
  };
480
480
  let stream;
481
+ let requiresFinish = false;
482
+ let receivedFinish = false;
483
+ let finishReason;
481
484
  if (this.streaming) {
482
485
  const result = streamText(generationOptions);
486
+ requiresFinish = result.fullStream != null;
483
487
  stream = result.fullStream ?? textStreamToFullStream(result.textStream);
484
488
  }
485
489
  else {
486
490
  const result = await generateText(generationOptions);
491
+ finishReason = result.finishReason;
487
492
  stream = generateResultToFullStream(result);
488
493
  }
489
494
  for await (const part of stream) {
490
495
  rawLog?.writeLine(safeRawStreamJson(part));
496
+ if (part.type === "finish") {
497
+ receivedFinish = true;
498
+ finishReason = part.finishReason;
499
+ }
491
500
  if (part.type === "reasoning-start" || part.type === "reasoning-delta") {
492
501
  // Reasoning content remains private. A throttled heartbeat is enough
493
502
  // for ChatCCC to distinguish active inference from a stalled stream.
@@ -561,6 +570,14 @@ export class ChatSession {
561
570
  throw new Error(message);
562
571
  }
563
572
  }
573
+ if (!signal?.aborted) {
574
+ if (requiresFinish && !receivedFinish)
575
+ throw new Error("DeepCCC 输出流中断:未收到模型完成事件,回复可能不完整");
576
+ if (finishReason === "error" || finishReason === "length")
577
+ throw new Error(`DeepCCC 未正常完成:finishReason=${finishReason},回复可能不完整`);
578
+ if (!fullText.trim() && toolCallOrder.length === 0)
579
+ throw new Error("DeepCCC 本轮未产生有效回复");
580
+ }
564
581
  if (hasMalformedToolProtocolText(fullText)) {
565
582
  console.warn(`[DeepCCC] malformed tool protocol text detected for ${this.context.sessionId} `
566
583
  + `(attempt ${attempt + 1}/2, structuredToolCalls=${toolCallOrder.length})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepccc",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "A lightweight coding agent with OpenAI-compatible and Anthropic Messages API support.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [