@vibe-lark/larkpal 0.1.39 → 0.1.40

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 +13 -3
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -6280,7 +6280,7 @@ const CC_INTERNAL_PLACEHOLDER = "No response requested.";
6280
6280
  *
6281
6281
  * 内部维护文本累积状态,将增量事件转换为控制器需要的累积文本回调。
6282
6282
  */
6283
- var CCStreamBridge = class {
6283
+ var CCStreamBridge = class CCStreamBridge {
6284
6284
  /** 累积的文本输出(textDelta 逐步拼接) */
6285
6285
  accumulatedText = "";
6286
6286
  /** 累积的思考输出(thinkingDelta 逐步拼接) */
@@ -6303,14 +6303,24 @@ var CCStreamBridge = class {
6303
6303
  sessionKey: this.options.sessionKey ?? "(none)"
6304
6304
  });
6305
6305
  }
6306
- /** 文本增量 累积后调用 controller.onPartialReply */
6306
+ /** 交互式标记前缀 用于流式过滤 */
6307
+ static INTERACTIVE_MARKER_PREFIXES = ["[ASK_USER]", "[PERMISSION_REQUEST]"];
6308
+ /** 文本增量 → 累积后调用 controller.onPartialReply(实时过滤交互式标记) */
6307
6309
  onTextDelta(text) {
6308
6310
  this.accumulatedText += text;
6309
6311
  log$18.debug("textDelta 事件", {
6310
6312
  deltaLen: text.length,
6311
6313
  totalLen: this.accumulatedText.length
6312
6314
  });
6313
- this.controller.onPartialReply({ text: this.accumulatedText });
6315
+ let displayText = this.accumulatedText;
6316
+ for (const prefix of CCStreamBridge.INTERACTIVE_MARKER_PREFIXES) {
6317
+ const idx = displayText.indexOf(prefix);
6318
+ if (idx !== -1) {
6319
+ displayText = displayText.substring(0, idx).trimEnd();
6320
+ break;
6321
+ }
6322
+ }
6323
+ this.controller.onPartialReply({ text: displayText });
6314
6324
  }
6315
6325
  /** 思考增量 → 累积后调用 controller.onReasoningStream */
6316
6326
  onThinkingDelta(text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-lark/larkpal",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "LarkPal - Lark/Feishu bot service",
5
5
  "type": "module",
6
6
  "main": "./dist/main.mjs",