@xmanrui/dsh-im 5.9.1 → 5.11.0

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 (135) hide show
  1. package/PROACTIVE_DELIVERY.en.md +33 -9
  2. package/PROACTIVE_DELIVERY.md +33 -9
  3. package/README.en.md +42 -7
  4. package/README.md +46 -8
  5. package/bin/dsh-im.mjs +65 -0
  6. package/docs/client-integration.md +4 -0
  7. package/lib/client.js +1735 -203
  8. package/lib/index.js +367 -341
  9. package/package.json +7 -6
  10. package/plugin-src/client/access-policy-settings.js +210 -12
  11. package/plugin-src/client/bot-general-settings.js +44 -3
  12. package/plugin-src/client/delivery-settings.js +2 -0
  13. package/plugin-src/client/delivery-sync-settings.js +269 -0
  14. package/plugin-src/client/global-settings.js +45 -7
  15. package/plugin-src/client/i18n-ru.js +112 -0
  16. package/plugin-src/client/i18n.js +110 -0
  17. package/plugin-src/client/im-channels.js +419 -0
  18. package/plugin-src/client/index.js +50 -2
  19. package/plugin-src/client/model-setting.js +6 -3
  20. package/plugin-src/client/styles.js +23 -7
  21. package/plugin-src/client/update-panel.js +2 -1
  22. package/plugin-src/host/channel-list-rpc.mjs +280 -0
  23. package/plugin-src/host/channels/dingtalk/production.mjs +28 -10
  24. package/plugin-src/host/channels/dingtalk/rpc.mjs +10 -1
  25. package/plugin-src/host/channels/feishu/production.mjs +50 -37
  26. package/plugin-src/host/channels/feishu/rpc.mjs +10 -1
  27. package/plugin-src/host/channels/matrix/production.mjs +28 -10
  28. package/plugin-src/host/channels/matrix/rpc.mjs +10 -0
  29. package/plugin-src/host/channels/qq/production.mjs +30 -11
  30. package/plugin-src/host/channels/qq/rpc.mjs +10 -1
  31. package/plugin-src/host/channels/shared/access-policy-production.mjs +9 -0
  32. package/plugin-src/host/channels/shared/binding-events.mjs +109 -0
  33. package/plugin-src/host/channels/shared/production.mjs +14 -1
  34. package/plugin-src/host/channels/shared/reply-content-rpc.mjs +17 -0
  35. package/plugin-src/host/channels/shared/rpc.mjs +9 -0
  36. package/plugin-src/host/channels/shared/workspace-rpc.mjs +1 -0
  37. package/plugin-src/host/channels/slack/production.mjs +28 -10
  38. package/plugin-src/host/channels/slack/rpc.mjs +10 -0
  39. package/plugin-src/host/channels/telegram/production.mjs +5 -0
  40. package/plugin-src/host/channels/wecom/production.mjs +28 -10
  41. package/plugin-src/host/channels/wecom/rpc.mjs +10 -1
  42. package/plugin-src/host/channels/wecom-app/production.mjs +28 -10
  43. package/plugin-src/host/channels/wecom-app/rpc.mjs +9 -0
  44. package/plugin-src/host/channels/weixin/production.mjs +28 -10
  45. package/plugin-src/host/channels/weixin/rpc.mjs +10 -1
  46. package/plugin-src/host/channels/whatsapp/production.mjs +28 -10
  47. package/plugin-src/host/channels/whatsapp/rpc.mjs +10 -1
  48. package/plugin-src/host/delivery-adapter.mjs +35 -20
  49. package/plugin-src/host/delivery-service.mjs +99 -1
  50. package/plugin-src/host/delivery-suggestions.mjs +31 -1
  51. package/plugin-src/host/delivery-sync-rpc.mjs +100 -0
  52. package/plugin-src/host/harness-connection.mjs +2 -1
  53. package/plugin-src/host/harness-peer.mjs +3 -1
  54. package/plugin-src/host/host-language-rpc.mjs +16 -2
  55. package/plugin-src/host/host-language.mjs +29 -0
  56. package/plugin-src/host/index.mjs +30 -1
  57. package/plugin-src/host/modern-harness-api.mjs +5 -1
  58. package/plugin-src/host/root-scope.mjs +32 -0
  59. package/plugin-src/host/session-sync-coordinator.mjs +290 -122
  60. package/plugin-src/host/session-sync-targets.mjs +71 -0
  61. package/plugin-src/management-rpc.mjs +18 -2
  62. package/scripts/verify-package.mjs +48 -10
  63. package/src/channels/dingtalk/dingtalk-bridge.mjs +50 -6
  64. package/src/channels/dingtalk/state-store.mjs +56 -0
  65. package/src/channels/discord/discord-api.mjs +2 -1
  66. package/src/channels/feishu/bridge.mjs +154 -58
  67. package/src/channels/feishu/feishu-cards.mjs +10 -4
  68. package/src/channels/feishu/feishu-runtime.mjs +11 -3
  69. package/src/channels/feishu/message-utils.mjs +106 -30
  70. package/src/channels/feishu/slash-command-panel.mjs +26 -0
  71. package/src/channels/feishu/state-store.mjs +14 -0
  72. package/src/channels/matrix/matrix-api.mjs +2 -1
  73. package/src/channels/qq/qq-bridge.mjs +114 -14
  74. package/src/channels/qq/state-store.mjs +55 -1
  75. package/src/channels/shared/access-policy.mjs +60 -7
  76. package/src/channels/shared/action-card.mjs +83 -7
  77. package/src/channels/shared/bot-workspace-store.mjs +255 -11
  78. package/src/channels/shared/busy-message-dispatcher.mjs +2 -2
  79. package/src/channels/shared/channel-capabilities.mjs +44 -0
  80. package/src/channels/shared/command-catalog.mjs +68 -3
  81. package/src/channels/shared/command-permission.mjs +6 -2
  82. package/src/channels/shared/conversation-state-store.mjs +16 -0
  83. package/src/channels/shared/deferred-delivery-coordinator.mjs +6 -1
  84. package/src/channels/shared/deferred-delivery.mjs +4 -0
  85. package/src/channels/shared/delivery-sync-settings-store.mjs +86 -0
  86. package/src/channels/shared/delivery-sync-settings.mjs +122 -0
  87. package/src/channels/shared/diagnostic-details.mjs +6 -1
  88. package/src/channels/shared/failure-log-file.mjs +79 -0
  89. package/src/channels/shared/harness-client.mjs +259 -96
  90. package/src/channels/shared/i18n-en/diagnostics.mjs +1 -0
  91. package/src/channels/shared/i18n-en/feishu.mjs +2 -2
  92. package/src/channels/shared/i18n-en/shared-a.mjs +13 -2
  93. package/src/channels/shared/i18n-en/shared-b.mjs +73 -4
  94. package/src/channels/shared/i18n-en/shared-d.mjs +144 -0
  95. package/src/channels/shared/i18n-en/weixin.mjs +4 -0
  96. package/src/channels/shared/i18n-en.mjs +2 -0
  97. package/src/channels/shared/i18n-ru/diagnostics.mjs +1 -0
  98. package/src/channels/shared/i18n-ru/feishu.mjs +2 -2
  99. package/src/channels/shared/i18n-ru/shared-a.mjs +13 -2
  100. package/src/channels/shared/i18n-ru/shared-b.mjs +72 -4
  101. package/src/channels/shared/i18n-ru/shared-d.mjs +144 -0
  102. package/src/channels/shared/i18n-ru/weixin.mjs +4 -0
  103. package/src/channels/shared/i18n-ru.mjs +2 -0
  104. package/src/channels/shared/inbound-access.mjs +10 -0
  105. package/src/channels/shared/interface-language-store.mjs +49 -10
  106. package/src/channels/shared/interface-language.mjs +19 -1
  107. package/src/channels/shared/markdown-chunks.mjs +5 -0
  108. package/src/channels/shared/message-failure.mjs +22 -1
  109. package/src/channels/shared/model-setting.mjs +6 -3
  110. package/src/channels/shared/new-command.mjs +158 -4
  111. package/src/channels/shared/plan-goal-command.mjs +132 -0
  112. package/src/channels/shared/qrcode.mjs +5 -0
  113. package/src/channels/shared/reply-content.mjs +102 -0
  114. package/src/channels/shared/reset-command.mjs +46 -0
  115. package/src/channels/shared/semantic/artifact.mjs +133 -29
  116. package/src/channels/shared/semantic/reply-reference.mjs +18 -3
  117. package/src/channels/shared/session-nav-command.mjs +999 -0
  118. package/src/channels/shared/session-ring-support.mjs +184 -0
  119. package/src/channels/shared/session-ring.mjs +202 -0
  120. package/src/channels/shared/session-title.mjs +11 -0
  121. package/src/channels/shared/status-command.mjs +2 -1
  122. package/src/channels/shared/text-harness-bridge.mjs +166 -7
  123. package/src/channels/shared/workspace-command.mjs +567 -31
  124. package/src/channels/shared/workspace-session.mjs +52 -4
  125. package/src/channels/slack/slack-api.mjs +2 -1
  126. package/src/channels/telegram/config-store.mjs +10 -2
  127. package/src/channels/telegram/telegram-api.mjs +19 -1
  128. package/src/channels/telegram/telegram-rich-message.mjs +17 -5
  129. package/src/channels/telegram/telegram-runtime.mjs +14 -1
  130. package/src/channels/wecom/state-store.mjs +13 -1
  131. package/src/channels/wecom/wecom-bridge.mjs +183 -26
  132. package/src/channels/wecom-app/state-store.mjs +13 -1
  133. package/src/channels/wecom-app/wecom-app-bridge.mjs +44 -4
  134. package/src/channels/weixin/state-store.mjs +13 -1
  135. package/src/channels/weixin/weixin-bridge.mjs +71 -4
@@ -1,4 +1,5 @@
1
1
  import { deferredStateAccess, normalizeDeferredState } from '../shared/deferred-state.mjs';
2
+ import { createSessionRingSupport, normalizePendingTitles, normalizeSessionRings } from '../shared/session-ring-support.mjs';
2
3
  import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
3
4
  import { dirname } from 'node:path';
4
5
 
@@ -12,6 +13,10 @@ function normalizeState(value) {
12
13
  if (typeof key === 'string' && typeof sessionId === 'string' && sessionId) sessions[key] = sessionId;
13
14
  }
14
15
  }
16
+ // A file written before the navigation ring existed loads unchanged: the keys
17
+ // are only added when they hold something.
18
+ const rings = normalizeSessionRings(value.rings);
19
+ const pendingTitles = normalizePendingTitles(value.pendingTitles);
15
20
  return {
16
21
  version: 1,
17
22
  sessions,
@@ -19,6 +24,8 @@ function normalizeState(value) {
19
24
  seenMessageIds: Array.isArray(value.seenMessageIds)
20
25
  ? value.seenMessageIds.filter((id) => typeof id === 'string').slice(-1_000)
21
26
  : [],
27
+ ...(Object.keys(rings).length ? { rings } : {}),
28
+ ...(Object.keys(pendingTitles).length ? { pendingTitles } : {}),
22
29
  };
23
30
  }
24
31
 
@@ -30,8 +37,13 @@ export class WecomAppStateStore {
30
37
 
31
38
  constructor(path) {
32
39
  this.#path = path;
40
+ // The navigation ring is a view over this store's state, shared with the
41
+ // channels that inherit `ConversationStateStore`.
42
+ Object.assign(this, createSessionRingSupport({
43
+ state: () => this.#state,
44
+ persist: () => this.#persist(),
45
+ }));
33
46
  }
34
-
35
47
  async load() {
36
48
  try {
37
49
  this.#state = normalizeState(JSON.parse(await readFile(this.#path, 'utf8')));
@@ -1,4 +1,5 @@
1
1
  import { BusyMessageDispatcher, canAutomaticallySteer } from '../shared/busy-message-dispatcher.mjs';
2
+ import { SESSION_NAV_HELP_LINES } from '../shared/command-catalog.mjs';
2
3
  import { createDeferredDeliveryCoordinator, deferredOutcomeText } from '../shared/deferred-delivery-coordinator.mjs';
3
4
  import {
4
5
  harnessAnswerForQuestion,
@@ -13,6 +14,7 @@ import {
13
14
  } from '../shared/batch-input.mjs';
14
15
  import { runCompactCommand } from '../shared/compact-command.mjs';
15
16
  import { isClearCommand, runClearCommand } from '../shared/clear-command.mjs';
17
+ import { isResetCommand, runResetCommand } from '../shared/reset-command.mjs';
16
18
  import { isHistoryCommand, runHistoryCommand } from '../shared/history-command.mjs';
17
19
  import {
18
20
  isControlCommand,
@@ -28,6 +30,11 @@ import {
28
30
  } from '../shared/preset-command.mjs';
29
31
  import { runWorkspaceCommand } from '../shared/workspace-command.mjs';
30
32
  import { askInWorkspaceSession } from '../shared/workspace-session.mjs';
33
+ import {
34
+ isSessionNavCommand,
35
+ runSessionNavTextCommand,
36
+ } from '../shared/session-nav-command.mjs';
37
+ import { createConversationSession, isNewCommand, newCommandTitle } from '../shared/new-command.mjs';
31
38
  import {
32
39
  captureContextEnhancement,
33
40
  captureContextEnhancementSource,
@@ -83,8 +90,10 @@ const HELP_TEXT = () => [
83
90
  t('/workspacelist 列出工作区绝对路径'),
84
91
  t('/ws、/wsl、/workspaces 工作区命令别名'),
85
92
  t('/sessionlist 或 /sessions [工作区序号或绝对路径] 列出会话 ID 和标题'),
93
+ t('/sessionlist --all 跨工作区汇总会话(每个工作区默认显示 10 个,可用 --limit N 调整)'),
86
94
  t('/sessionlist --limit N 仅列出当前工作区前 N 个会话'),
87
- t('/session Session ID 或当前工作区序号 将当前聊天绑定到指定会话'),
95
+ t('/session Session ID、当前工作区序号或标题关键词 将当前聊天绑定到指定会话'),
96
+ ...SESSION_NAV_HELP_LINES.map((line) => t(line)),
88
97
  t('/models 按序号列出所有可用模型'),
89
98
  t('/reasoninglist 或 /reasonings 按序号列出当前模型可用推理等级'),
90
99
  t('/reasoning [序号、等级ID或 --default] 查看或切换当前推理等级'),
@@ -316,6 +325,7 @@ export class WecomAppBridge {
316
325
  }
317
326
  }
318
327
  const commandRunner = isClearCommand(commandText) ? runClearCommand
328
+ : isResetCommand(commandText) ? runResetCommand
319
329
  : isHistoryCommand(commandText) ? runHistoryCommand
320
330
  : isControlCommand(commandText)
321
331
  ? runControlCommand
@@ -588,9 +598,39 @@ export class WecomAppBridge {
588
598
  await this.#state.markSeen(messageId);
589
599
  return;
590
600
  }
591
- if (!hasImages && !hasFiles && command === '/new') {
592
- await this.#state.clearSession(key);
593
- await this.#send(sender, t('已开启新会话。请发送你的问题。'));
601
+ if (!hasImages && !hasFiles && isNewCommand(text)) {
602
+ const created = await createConversationSession({ state: this.#state, harness: this.#harness, key, title: newCommandTitle(text) });
603
+ await this.#send(sender, created.failed ? t('暂时无法创建新会话,请稍后重试。') : t('已开启新会话。请发送你的问题。'));
604
+ await this.#state.markSeen(messageId);
605
+ return;
606
+ }
607
+ if (!hasImages && !hasFiles && isSessionNavCommand(text)) {
608
+ const nav = await runSessionNavTextCommand(text, this.#harness, this.#state, key, {
609
+ signal: this.#signal,
610
+ });
611
+ if (nav) {
612
+ for (const reply of nav.messages ?? [nav.message]) {
613
+ await this.#send(sender, reply);
614
+ }
615
+ if (nav.askText) {
616
+ const followUp = this.#enqueueMessage(
617
+ {
618
+ ...message,
619
+ msgtype: 'text',
620
+ text: { content: nav.askText },
621
+ image: undefined,
622
+ mediaId: undefined,
623
+ },
624
+ `${messageId}-ask`,
625
+ key,
626
+ { sink },
627
+ );
628
+ followUp.catch((error) => {
629
+ this.#logger.warn?.(`[dsh-im:wecom-app] follow-up ask after a nav command failed:`, error?.message ?? error);
630
+ this.#send(sender, t('切换后的提问发送失败,请重试。')).catch(() => undefined);
631
+ });
632
+ }
633
+ }
594
634
  await this.#state.markSeen(messageId);
595
635
  return;
596
636
  }
@@ -1,5 +1,6 @@
1
1
  import { weixinStageError } from './connection-error.mjs';
2
2
  import { deferredStateAccess, normalizeDeferredState } from '../shared/deferred-state.mjs';
3
+ import { createSessionRingSupport, normalizePendingTitles, normalizeSessionRings } from '../shared/session-ring-support.mjs';
3
4
  import { createHash } from 'node:crypto';
4
5
  import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
5
6
  import { dirname } from 'node:path';
@@ -97,6 +98,10 @@ function normalizeState(value) {
97
98
  }
98
99
  }
99
100
  const contextTokens = normalizeContextTokens(value.contextTokens);
101
+ // A file written before the navigation ring existed loads unchanged: the keys
102
+ // are only added when they hold something.
103
+ const rings = normalizeSessionRings(value.rings);
104
+ const pendingTitles = normalizePendingTitles(value.pendingTitles);
100
105
  return {
101
106
  version: 1,
102
107
  sessions,
@@ -107,6 +112,8 @@ function normalizeState(value) {
107
112
  getUpdatesBuf: typeof value.getUpdatesBuf === 'string' ? value.getUpdatesBuf : '',
108
113
  recentOutboundMessages: recentOutboundMessages(value.recentOutboundMessages),
109
114
  ...(contextTokens ? { contextTokens } : {}),
115
+ ...(Object.keys(rings).length ? { rings } : {}),
116
+ ...(Object.keys(pendingTitles).length ? { pendingTitles } : {}),
110
117
  };
111
118
  }
112
119
 
@@ -118,8 +125,13 @@ export class WeixinStateStore {
118
125
 
119
126
  constructor(path) {
120
127
  this.#path = path;
128
+ // The navigation ring is a view over this store's state, shared with the
129
+ // channels that inherit `ConversationStateStore`.
130
+ Object.assign(this, createSessionRingSupport({
131
+ state: () => this.#state,
132
+ persist: () => this.#persist(),
133
+ }));
121
134
  }
122
-
123
135
  async load() {
124
136
  try {
125
137
  this.#state = normalizeState(JSON.parse(await readFile(this.#path, 'utf8')));
@@ -1,4 +1,5 @@
1
1
  import { BusyMessageDispatcher, canAutomaticallySteer } from '../shared/busy-message-dispatcher.mjs';
2
+ import { SESSION_NAV_HELP_LINES } from '../shared/command-catalog.mjs';
2
3
  import { createDeferredDeliveryCoordinator, deferredOutcomeText } from '../shared/deferred-delivery-coordinator.mjs';
3
4
  import {
4
5
  DEFAULT_WEIXIN_MAX_MESSAGE_CHARS,
@@ -22,7 +23,9 @@ import {
22
23
  isBatchInputCommand,
23
24
  } from '../shared/batch-input.mjs';
24
25
  import { runCompactCommand } from '../shared/compact-command.mjs';
26
+ import { runPlanCommand, runGoalCommand } from '../shared/plan-goal-command.mjs';
25
27
  import { isClearCommand, runClearCommand } from '../shared/clear-command.mjs';
28
+ import { isResetCommand, runResetCommand } from '../shared/reset-command.mjs';
26
29
  import { isHistoryCommand, runHistoryCommand } from '../shared/history-command.mjs';
27
30
  import {
28
31
  isControlCommand,
@@ -38,6 +41,11 @@ import {
38
41
  } from '../shared/preset-command.mjs';
39
42
  import { runWorkspaceCommand } from '../shared/workspace-command.mjs';
40
43
  import { askInWorkspaceSession } from '../shared/workspace-session.mjs';
44
+ import {
45
+ isSessionNavCommand,
46
+ runSessionNavTextCommand,
47
+ } from '../shared/session-nav-command.mjs';
48
+ import { createConversationSession, isNewCommand, newCommandTitle } from '../shared/new-command.mjs';
41
49
  import {
42
50
  captureContextEnhancement,
43
51
  captureContextEnhancementSource,
@@ -94,13 +102,17 @@ const HELP_TEXT = () => [
94
102
  t('/new 开启一个全新会话'),
95
103
  t('/compact 压缩当前会话的较早上下文'),
96
104
  t('/clear 清空当前会话上下文(保留 Session 绑定和历史记录)'),
105
+ t('/plan 进入计划模式(/plan off 退出,可附带说明文字)'),
106
+ t('/goal [目标] 设置目标(clear 清除、edit 修改、pause 暂停、resume 恢复;不带参数查看)'),
97
107
  t('/history [数量] 查看最近历史消息(默认 3 条,最多 5 条)'),
98
108
  t('/workspace 工作区序号或绝对路径 切换工作区'),
99
109
  t('/workspacelist 列出工作区绝对路径'),
100
110
  t('/ws、/wsl、/workspaces 工作区命令别名'),
101
111
  t('/sessionlist 或 /sessions [工作区序号或绝对路径] 列出会话 ID 和标题'),
112
+ t('/sessionlist --all 跨工作区汇总会话(每个工作区默认显示 10 个,可用 --limit N 调整)'),
102
113
  t('/sessionlist --limit N 仅列出当前工作区前 N 个会话'),
103
- t('/session Session ID 或当前工作区序号 将当前聊天绑定到指定会话'),
114
+ t('/session Session ID、当前工作区序号或标题关键词 将当前聊天绑定到指定会话'),
115
+ ...SESSION_NAV_HELP_LINES.map((line) => t(line)),
104
116
  t('/models 按序号列出所有可用模型'),
105
117
  t('/reasoninglist 或 /reasonings 按序号列出当前模型可用推理等级'),
106
118
  t('/reasoning [序号、等级ID或 --default] 查看或切换当前推理等级'),
@@ -462,6 +474,7 @@ export class WeixinHarnessBridge {
462
474
  }
463
475
  }
464
476
  const commandRunner = isClearCommand(commandText) ? runClearCommand
477
+ : isResetCommand(commandText) ? runResetCommand
465
478
  : isHistoryCommand(commandText) ? runHistoryCommand
466
479
  : hasWeixinFileItems(message) ? null : isControlCommand(commandText)
467
480
  ? runControlCommand
@@ -559,6 +572,7 @@ export class WeixinHarnessBridge {
559
572
  isQueued: () => this.#queues.has(key),
560
573
  enqueue: (options) => this.#enqueueMessage(message, messageId, key, options),
561
574
  send: (reply) => this.#sendOutOfBand(key, sender, reply, contextToken, runId),
575
+ steerReceipt: false,
562
576
  onError: (error) => this.#handleInteractionFailure(message, messageId, error),
563
577
  });
564
578
  }
@@ -818,9 +832,32 @@ export class WeixinHarnessBridge {
818
832
  await this.#state.markSeen(messageId);
819
833
  return;
820
834
  }
821
- if (!hasImages && !hasFiles && command === '/new') {
822
- await this.#state.clearSession(key);
823
- await this.#send(sender, t('已开启新会话。请发送你的问题。'), contextToken, runId);
835
+ if (!hasImages && !hasFiles && isNewCommand(text)) {
836
+ const created = await createConversationSession({ state: this.#state, harness: this.#harness, key, title: newCommandTitle(text) });
837
+ await this.#send(sender, created.failed ? t('暂时无法创建新会话,请稍后重试。') : t('已开启新会话。请发送你的问题。'), contextToken, runId);
838
+ await this.#state.markSeen(messageId);
839
+ return;
840
+ }
841
+ if (!hasImages && !hasFiles && isSessionNavCommand(text)) {
842
+ const nav = await runSessionNavTextCommand(text, this.#harness, this.#state, key, {
843
+ signal: this.#signal,
844
+ });
845
+ if (nav) {
846
+ for (const reply of nav.messages ?? [nav.message]) {
847
+ await this.#send(sender, reply, contextToken, runId);
848
+ }
849
+ if (nav.askText) {
850
+ const followUp = this.#enqueueMessage(
851
+ { ...message, item_list: [{ type: 1, text_item: { text: nav.askText } }] },
852
+ `${messageId}-ask`,
853
+ key,
854
+ );
855
+ followUp.catch((error) => {
856
+ this.#logger.warn?.(`[dsh-im:weixin] follow-up ask after a nav command failed:`, error?.message ?? error);
857
+ this.#send(sender, t('切换后的提问发送失败,请重试。'), contextToken, runId).catch(() => undefined);
858
+ });
859
+ }
860
+ }
824
861
  await this.#state.markSeen(messageId);
825
862
  return;
826
863
  }
@@ -849,6 +886,36 @@ export class WeixinHarnessBridge {
849
886
  return;
850
887
  }
851
888
 
889
+ const planCommand = hasImages || hasFiles
890
+ ? null
891
+ : await runPlanCommand(
892
+ text,
893
+ this.#harness,
894
+ this.#state,
895
+ key,
896
+ { signal: this.#signal },
897
+ );
898
+ if (planCommand) {
899
+ await this.#send(sender, planCommand.message, contextToken, runId);
900
+ await this.#state.markSeen(messageId);
901
+ return;
902
+ }
903
+
904
+ const goalCommand = hasImages || hasFiles
905
+ ? null
906
+ : await runGoalCommand(
907
+ text,
908
+ this.#harness,
909
+ this.#state,
910
+ key,
911
+ { signal: this.#signal },
912
+ );
913
+ if (goalCommand) {
914
+ await this.#send(sender, goalCommand.message, contextToken, runId);
915
+ await this.#state.markSeen(messageId);
916
+ return;
917
+ }
918
+
852
919
  let answer;
853
920
  let artifacts = [];
854
921
  await this.#startTyping(sender, contextToken);