@vibe-lark/larkpal 0.1.40 → 0.1.41

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.
Files changed (2) hide show
  1. package/dist/main.mjs +12 -1
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -6305,6 +6305,14 @@ var CCStreamBridge = class CCStreamBridge {
6305
6305
  }
6306
6306
  /** 交互式标记前缀 — 用于流式过滤 */
6307
6307
  static INTERACTIVE_MARKER_PREFIXES = ["[ASK_USER]", "[PERMISSION_REQUEST]"];
6308
+ /** 检查文本末尾是否可能是标记的不完整前缀 */
6309
+ static getPartialMarkerCutoff(text) {
6310
+ for (const marker of CCStreamBridge.INTERACTIVE_MARKER_PREFIXES) for (let len = marker.length - 1; len >= 2; len--) {
6311
+ const partial = marker.substring(0, len);
6312
+ if (text.endsWith(partial)) return text.length - len;
6313
+ }
6314
+ return -1;
6315
+ }
6308
6316
  /** 文本增量 → 累积后调用 controller.onPartialReply(实时过滤交互式标记) */
6309
6317
  onTextDelta(text) {
6310
6318
  this.accumulatedText += text;
@@ -6317,9 +6325,12 @@ var CCStreamBridge = class CCStreamBridge {
6317
6325
  const idx = displayText.indexOf(prefix);
6318
6326
  if (idx !== -1) {
6319
6327
  displayText = displayText.substring(0, idx).trimEnd();
6320
- break;
6328
+ this.controller.onPartialReply({ text: displayText });
6329
+ return;
6321
6330
  }
6322
6331
  }
6332
+ const cutoff = CCStreamBridge.getPartialMarkerCutoff(displayText);
6333
+ if (cutoff !== -1) displayText = displayText.substring(0, cutoff);
6323
6334
  this.controller.onPartialReply({ text: displayText });
6324
6335
  }
6325
6336
  /** 思考增量 → 累积后调用 controller.onReasoningStream */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-lark/larkpal",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "LarkPal - Lark/Feishu bot service",
5
5
  "type": "module",
6
6
  "main": "./dist/main.mjs",