liangzimixin 0.3.92 → 0.3.94

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/index.cjs CHANGED
@@ -31038,45 +31038,8 @@ var TTLMap = class {
31038
31038
  };
31039
31039
 
31040
31040
  // src/utils/msg-type-detect.ts
31041
- var MARKDOWN_PATTERNS = [
31042
- // ── 块级元素 (高置信度) ──
31043
- // 围栏代码块: ```language
31044
- { pattern: /^```/m, label: "fenced-code-block" },
31045
- // 标题: # Title (行首,# 后必须跟空格)
31046
- { pattern: /^#{1,6}\s+\S/m, label: "heading" },
31047
- // 表格: | cell | cell | (行首行尾都有 |,且至少有 2 个分隔符)
31048
- { pattern: /^\|.+\|.+\|\s*$/m, label: "table" },
31049
- // 引用块: > text (行首)
31050
- { pattern: /^>\s+\S/m, label: "blockquote" },
31051
- // 分隔线: --- 或 *** (独占一行,至少 3 个)
31052
- { pattern: /^[-*]{3,}\s*$/m, label: "horizontal-rule" },
31053
- // ── 内联元素 (中置信度) ──
31054
- // 粗体: **text** 或 __text__
31055
- { pattern: /\*\*[^*]+\*\*/, label: "bold-asterisk" },
31056
- { pattern: /__[^_]+__/, label: "bold-underscore" },
31057
- // 链接: [text](url)
31058
- { pattern: /\[[^\]]+\]\([^)]+\)/, label: "link" },
31059
- // 图片: ![alt](url)
31060
- { pattern: /!\[[^\]]*\]\([^)]+\)/, label: "image" },
31061
- // 行内代码: `code` (但不是 ```)
31062
- { pattern: /(?<!`)`[^`\n]+`(?!`)/, label: "inline-code" },
31063
- // ── 列表 (需行首匹配) ──
31064
- // 有序列表: 1. text
31065
- { pattern: /^\d+\.\s+\S/m, label: "ordered-list" },
31066
- // 无序列表: - text 或 * text (行首,后跟空格和非空字符)
31067
- { pattern: /^[-*]\s+\S/m, label: "unordered-list" }
31068
- ];
31069
- function isMarkdownContent(text) {
31070
- if (!text) return false;
31071
- for (const { pattern } of MARKDOWN_PATTERNS) {
31072
- if (pattern.test(text)) {
31073
- return true;
31074
- }
31075
- }
31076
- return false;
31077
- }
31078
31041
  function resolveTextMsgType(text) {
31079
- return isMarkdownContent(text) ? "markdown" : "text";
31042
+ return "markdown";
31080
31043
  }
31081
31044
 
31082
31045
  // src/channel/outbound.ts
@@ -31655,7 +31618,9 @@ var InboundPipeline = class {
31655
31618
  async handle(msg) {
31656
31619
  const startMs = Date.now();
31657
31620
  const semaphore = this.deps.messagePipe.semaphore;
31621
+ const semaphoreStartMs = Date.now();
31658
31622
  const acquireResult = await semaphore.acquire();
31623
+ metrics.recordLatency("inbound.semaphore_wait", Date.now() - semaphoreStartMs);
31659
31624
  if (acquireResult === "rejected") {
31660
31625
  metrics.increment("inbound.semaphore_rejected");
31661
31626
  log15.warn("\u{1F6AB} \u6D88\u606F\u88AB\u62D2\u7EDD (Semaphore \u6EA2\u51FA)", {
@@ -31815,6 +31780,7 @@ var InboundPipeline = class {
31815
31780
  }).catch((err) => {
31816
31781
  log15.warn("\u26A0\uFE0F \u5373\u65F6\u53CD\u9988\u53D1\u9001\u5931\u8D25", { error: err.message });
31817
31782
  });
31783
+ const contentResolveStartMs = Date.now();
31818
31784
  const resolvedContent = await resolveContent(context, {
31819
31785
  tokenManager: this.deps.tokenManager,
31820
31786
  fileServerUrl: this.deps.pluginConfig.file.fileServiceBaseUrl,
@@ -31825,6 +31791,7 @@ var InboundPipeline = class {
31825
31791
  messagePipe: this.deps.messagePipe,
31826
31792
  fileEncryptionMeta: msg.fileEncryptionMeta
31827
31793
  });
31794
+ metrics.recordLatency("inbound.content_resolve", Date.now() - contentResolveStartMs);
31828
31795
  const payload = buildInboundPayload(msg, resolvedContent, this.deps.pluginConfig);
31829
31796
  const { sdkConfig } = this.deps;
31830
31797
  const ctx = core.channel.reply.finalizeInboundContext(payload);
@@ -31852,6 +31819,7 @@ var InboundPipeline = class {
31852
31819
  chatId: msg.chatId,
31853
31820
  \u5185\u5BB9\u9884\u89C8: String(payload.Body ?? "").slice(0, 200)
31854
31821
  });
31822
+ const aiStartMs = Date.now();
31855
31823
  const { counts } = await core.channel.reply.dispatchReplyFromConfig({
31856
31824
  ctx,
31857
31825
  cfg: sdkConfig,
@@ -31861,12 +31829,16 @@ var InboundPipeline = class {
31861
31829
  if (typeof dispatcher.waitForIdle === "function") {
31862
31830
  await dispatcher.waitForIdle();
31863
31831
  }
31832
+ metrics.recordLatency("inbound.ai_reply", Date.now() - aiStartMs);
31833
+ const aiDurationMs = Date.now() - aiStartMs;
31864
31834
  const durationMs = Date.now() - startMs;
31865
31835
  log15.info("\u2705 \u6D88\u606F\u5904\u7406\u5B8C\u6210", {
31866
31836
  messageId: msg.messageId,
31867
31837
  chatId: msg.chatId,
31868
31838
  \u56DE\u590D\u6570: counts?.final ?? 0,
31869
- \u8017\u65F6ms: durationMs
31839
+ \u8017\u65F6ms: durationMs,
31840
+ AI\u56DE\u590Dms: aiDurationMs,
31841
+ \u63D2\u4EF6\u5904\u7406ms: durationMs - aiDurationMs
31870
31842
  });
31871
31843
  clearInboundEncryptionStatus(msg.chatId, msg.messageId);
31872
31844
  } catch (err) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liangzimixin",
3
- "version": "0.3.92",
3
+ "version": "0.3.94",
4
4
  "description": "Quantum-encrypted IM channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "index.cjs",
@@ -17103,45 +17103,8 @@ var TTLMap = class {
17103
17103
  };
17104
17104
 
17105
17105
  // src/utils/msg-type-detect.ts
17106
- var MARKDOWN_PATTERNS = [
17107
- // ── 块级元素 (高置信度) ──
17108
- // 围栏代码块: ```language
17109
- { pattern: /^```/m, label: "fenced-code-block" },
17110
- // 标题: # Title (行首,# 后必须跟空格)
17111
- { pattern: /^#{1,6}\s+\S/m, label: "heading" },
17112
- // 表格: | cell | cell | (行首行尾都有 |,且至少有 2 个分隔符)
17113
- { pattern: /^\|.+\|.+\|\s*$/m, label: "table" },
17114
- // 引用块: > text (行首)
17115
- { pattern: /^>\s+\S/m, label: "blockquote" },
17116
- // 分隔线: --- 或 *** (独占一行,至少 3 个)
17117
- { pattern: /^[-*]{3,}\s*$/m, label: "horizontal-rule" },
17118
- // ── 内联元素 (中置信度) ──
17119
- // 粗体: **text** 或 __text__
17120
- { pattern: /\*\*[^*]+\*\*/, label: "bold-asterisk" },
17121
- { pattern: /__[^_]+__/, label: "bold-underscore" },
17122
- // 链接: [text](url)
17123
- { pattern: /\[[^\]]+\]\([^)]+\)/, label: "link" },
17124
- // 图片: ![alt](url)
17125
- { pattern: /!\[[^\]]*\]\([^)]+\)/, label: "image" },
17126
- // 行内代码: `code` (但不是 ```)
17127
- { pattern: /(?<!`)`[^`\n]+`(?!`)/, label: "inline-code" },
17128
- // ── 列表 (需行首匹配) ──
17129
- // 有序列表: 1. text
17130
- { pattern: /^\d+\.\s+\S/m, label: "ordered-list" },
17131
- // 无序列表: - text 或 * text (行首,后跟空格和非空字符)
17132
- { pattern: /^[-*]\s+\S/m, label: "unordered-list" }
17133
- ];
17134
- function isMarkdownContent(text) {
17135
- if (!text) return false;
17136
- for (const { pattern } of MARKDOWN_PATTERNS) {
17137
- if (pattern.test(text)) {
17138
- return true;
17139
- }
17140
- }
17141
- return false;
17142
- }
17143
17106
  function resolveTextMsgType(text) {
17144
- return isMarkdownContent(text) ? "markdown" : "text";
17107
+ return "markdown";
17145
17108
  }
17146
17109
 
17147
17110
  // src/channel/outbound.ts
@@ -34097,7 +34060,9 @@ var InboundPipeline = class {
34097
34060
  async handle(msg) {
34098
34061
  const startMs = Date.now();
34099
34062
  const semaphore = this.deps.messagePipe.semaphore;
34063
+ const semaphoreStartMs = Date.now();
34100
34064
  const acquireResult = await semaphore.acquire();
34065
+ metrics.recordLatency("inbound.semaphore_wait", Date.now() - semaphoreStartMs);
34101
34066
  if (acquireResult === "rejected") {
34102
34067
  metrics.increment("inbound.semaphore_rejected");
34103
34068
  log28.warn("\u{1F6AB} \u6D88\u606F\u88AB\u62D2\u7EDD (Semaphore \u6EA2\u51FA)", {
@@ -34257,6 +34222,7 @@ var InboundPipeline = class {
34257
34222
  }).catch((err) => {
34258
34223
  log28.warn("\u26A0\uFE0F \u5373\u65F6\u53CD\u9988\u53D1\u9001\u5931\u8D25", { error: err.message });
34259
34224
  });
34225
+ const contentResolveStartMs = Date.now();
34260
34226
  const resolvedContent = await resolveContent(context, {
34261
34227
  tokenManager: this.deps.tokenManager,
34262
34228
  fileServerUrl: this.deps.pluginConfig.file.fileServiceBaseUrl,
@@ -34267,6 +34233,7 @@ var InboundPipeline = class {
34267
34233
  messagePipe: this.deps.messagePipe,
34268
34234
  fileEncryptionMeta: msg.fileEncryptionMeta
34269
34235
  });
34236
+ metrics.recordLatency("inbound.content_resolve", Date.now() - contentResolveStartMs);
34270
34237
  const payload = buildInboundPayload(msg, resolvedContent, this.deps.pluginConfig);
34271
34238
  const { sdkConfig } = this.deps;
34272
34239
  const ctx = core.channel.reply.finalizeInboundContext(payload);
@@ -34294,6 +34261,7 @@ var InboundPipeline = class {
34294
34261
  chatId: msg.chatId,
34295
34262
  \u5185\u5BB9\u9884\u89C8: String(payload.Body ?? "").slice(0, 200)
34296
34263
  });
34264
+ const aiStartMs = Date.now();
34297
34265
  const { counts } = await core.channel.reply.dispatchReplyFromConfig({
34298
34266
  ctx,
34299
34267
  cfg: sdkConfig,
@@ -34303,12 +34271,16 @@ var InboundPipeline = class {
34303
34271
  if (typeof dispatcher.waitForIdle === "function") {
34304
34272
  await dispatcher.waitForIdle();
34305
34273
  }
34274
+ metrics.recordLatency("inbound.ai_reply", Date.now() - aiStartMs);
34275
+ const aiDurationMs = Date.now() - aiStartMs;
34306
34276
  const durationMs = Date.now() - startMs;
34307
34277
  log28.info("\u2705 \u6D88\u606F\u5904\u7406\u5B8C\u6210", {
34308
34278
  messageId: msg.messageId,
34309
34279
  chatId: msg.chatId,
34310
34280
  \u56DE\u590D\u6570: counts?.final ?? 0,
34311
- \u8017\u65F6ms: durationMs
34281
+ \u8017\u65F6ms: durationMs,
34282
+ AI\u56DE\u590Dms: aiDurationMs,
34283
+ \u63D2\u4EF6\u5904\u7406ms: durationMs - aiDurationMs
34312
34284
  });
34313
34285
  clearInboundEncryptionStatus(msg.chatId, msg.messageId);
34314
34286
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liangzimixin",
3
- "version": "0.3.92",
3
+ "version": "0.3.94",
4
4
  "description": "Quantum-encrypted IM channel plugin for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -18,7 +18,7 @@ REM liangzimixin install script (Windows)
18
18
  REM Usage: liangzimixin_install.bat <appId> <appSecret> [quantumAccount]
19
19
  REM ============================================================
20
20
 
21
- set "SCRIPT_VERSION=0.3.92"
21
+ set "SCRIPT_VERSION=0.3.94"
22
22
  set "NPM_PACKAGE=liangzimixin"
23
23
 
24
24
  set "SKIP_SELF_UPDATE=0"
@@ -34,6 +34,8 @@ for %%a in (%*) do (
34
34
  set "SKIP_SELF_UPDATE=1"
35
35
  ) else if "%%a"=="--beta" (
36
36
  set "USE_BETA=1"
37
+ ) else if "%%a"=="--internal-logged" (
38
+ REM skip internal flag
37
39
  ) else (
38
40
  set /a IDX+=1
39
41
  if !IDX!==1 set "APP_ID=%%a"
@@ -14,7 +14,7 @@ echo -e "\033[0;36m▸\033[0m Deployment log will be saved to $LOG_FILE"
14
14
  # 用法: ./liangzimixin_install.sh <appId> <appSecret> [quantumAccount]
15
15
  # ============================================================
16
16
 
17
- SCRIPT_VERSION="0.3.92"
17
+ SCRIPT_VERSION="0.3.94"
18
18
  NPM_PACKAGE="liangzimixin"
19
19
 
20
20
  # ── 颜色 ──────────────────────────────────────────────────────