@xmanrui/dsh-im 4.13.0 → 4.14.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmanrui/dsh-im",
3
- "version": "4.13.0",
3
+ "version": "4.14.0",
4
4
  "description": "把九种 IM 机器人和公网 AI Office 接入本机 DeepSeek Harness。 Connect nine IM channels and a public AI Office to a local DeepSeek Harness.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -32,6 +32,7 @@ export const FEISHU_ENDPOINTS = Object.freeze({
32
32
  setAccessPolicy: "bot.access-policy.set",
33
33
  setGroupResponseMode: "bot.group-response-mode.set",
34
34
  setGroupTopicReply: "bot.group-topic-reply.set",
35
+ setStepPush: "bot.step-push.set",
35
36
  // Kept for rolling upgrades. The multi-bot UI never calls these endpoints.
36
37
  testConnection: "connection.test",
37
38
  disconnect: "connection.disconnect",
@@ -217,6 +218,7 @@ export function normalizeBotConnection(value, fallbackBotId) {
217
218
  : {}),
218
219
  groupResponseMode: normalizeGroupResponseMode(value.groupResponseMode),
219
220
  groupTopicReply: value.groupTopicReply === true,
221
+ stepPush: value.stepPush === true,
220
222
  groupMessagePermissionGranted: value.groupMessagePermissionGranted === true,
221
223
  bot: normalizeBot(value.bot),
222
224
  health: normalizeHealth(value.health, connected),
@@ -464,6 +464,53 @@ function RemoveConfirmation({ bot, busy, onConfirm, onCancel }) {
464
464
  );
465
465
  }
466
466
 
467
+ /** Toggle row for 分步直推, mirroring the group-topic reply toggle pattern. */
468
+ function StepPushEditor({ value = false, disabled = false, onSave }) {
469
+ const titleId = React.useId();
470
+ const current = value === true ? "on" : "off";
471
+ const [saving, setSaving] = React.useState(false);
472
+ const [error, setError] = React.useState(null);
473
+
474
+ const change = async (event) => {
475
+ const next = event.target.value === "on";
476
+ if ((next ? "on" : "off") === current || saving || disabled) return;
477
+ setSaving(true);
478
+ setError(null);
479
+ try {
480
+ await onSave?.(next);
481
+ } catch (cause) {
482
+ setError(cause?.message ?? "分步直推设置保存失败,请重试。");
483
+ } finally {
484
+ setSaving(false);
485
+ }
486
+ };
487
+
488
+ return h("section", {
489
+ className: "dim-feishuGroupControl",
490
+ "aria-labelledby": titleId,
491
+ },
492
+ h("div", { className: "dim-feishuGroupControlHeader" },
493
+ h("h3", { id: titleId }, "分步直推"),
494
+ saving
495
+ ? h("span", { className: "dim-feishuGroupControlStatus", role: "status" }, "保存中…")
496
+ : null),
497
+ h("select", {
498
+ className: "dim-feishuGroupSelect",
499
+ value: current,
500
+ disabled: disabled || saving,
501
+ "aria-label": "分步直推",
502
+ onChange: (event) => { void change(event); },
503
+ },
504
+ h("option", { value: "off" }, "关闭(保持流式卡模式)"),
505
+ h("option", { value: "on" }, "开启(逐步推送工具调用与过程说明)")),
506
+ h("p", { className: "dim-feishuGroupHelp" },
507
+ "开启后逐步推送工具调用与过程说明"),
508
+ error ? h("p", {
509
+ className: "dim-feishuGroupError",
510
+ role: "alert",
511
+ }, error) : null);
512
+ }
513
+
467
514
  export function BotCard({
468
515
  connection,
469
516
  busy,
@@ -479,6 +526,7 @@ export function BotCard({
479
526
  onModelSave,
480
527
  onAgentPresetSave,
481
528
  onContextEnhancementSave,
529
+ onStepPushSave,
482
530
  onRequestRemove,
483
531
  onConfirmRemove,
484
532
  onCancelRemove,
@@ -565,6 +613,11 @@ export function BotCard({
565
613
  disabled: Boolean(busy),
566
614
  onSave: onContextEnhancementSave,
567
615
  }),
616
+ h(StepPushEditor, {
617
+ value: connection.stepPush,
618
+ disabled: Boolean(busy),
619
+ onSave: onStepPushSave,
620
+ }),
568
621
  provisionContent
569
622
  ? h("section", {
570
623
  className: "bxf-botProvision dim-botProvision",
@@ -657,6 +710,7 @@ function BotList(props) {
657
710
  onModelSave: (model) => props.onModelSave(bot, model),
658
711
  onAgentPresetSave: (agentPreset) => props.onAgentPresetSave(bot, agentPreset),
659
712
  onContextEnhancementSave: (config) => props.onContextEnhancementSave(bot, config),
713
+ onStepPushSave: (stepPush) => props.onStepPushSave(bot, stepPush),
660
714
  onRequestRemove: () => props.onRequestRemove(bot),
661
715
  onConfirmRemove: () => props.onConfirmRemove(bot),
662
716
  onCancelRemove: props.onCancelRemove,
@@ -1431,6 +1485,9 @@ export function FeishuSettingsTab({ rpcCall }) {
1431
1485
  onContextEnhancementSave: (connection, config) => saveBotSetting(
1432
1486
  connection, "context-enhancement", FEISHU_ENDPOINTS.setContextEnhancement, { config },
1433
1487
  ),
1488
+ onStepPushSave: (connection, stepPush) => saveBotSetting(
1489
+ connection, "step-push", FEISHU_ENDPOINTS.setStepPush, { stepPush },
1490
+ ),
1434
1491
  onRequestRemove: requestRemove,
1435
1492
  onConfirmRemove: (bot) => void confirmRemove(bot),
1436
1493
  onCancelRemove: cancelRemove,
@@ -220,6 +220,11 @@ const EN = Object.freeze({
220
220
  '关闭(群内直接回复)': 'Off (reply in the group feed)',
221
221
  '开启(自动开启独立飞书话题)': 'On (auto-open a dedicated Feishu topic)',
222
222
  '开启后,群聊中向机器人提问会自动开启独立飞书话题,回复落在话题内;每个话题是 dsh 会话列表里一条独立会话,上下文互不串。私聊不受影响。': 'When enabled, questions to the bot in a group auto-open a dedicated Feishu topic and replies stay inside it. Each topic is an independent conversation in dsh with its own context. Private chats are unaffected.',
223
+ '分步直推': 'Step push',
224
+ '开启后逐步推送工具调用与过程说明': 'Push tool calls and process notes step by step',
225
+ '关闭(保持流式卡模式)': 'Off (keep the streaming card)',
226
+ '开启(逐步推送工具调用与过程说明)': 'On (push tool calls and process notes step by step)',
227
+ '分步直推设置保存失败,请重试。': 'Could not save the step push setting. Try again.',
223
228
  '钉钉设置': 'DingTalk settings',
224
229
  '企业微信设置': 'WeCom settings',
225
230
  '扫码接入机器人': 'Scan QR code',
@@ -218,6 +218,7 @@ export async function createProductionController(ctx, config = {}, internals = {
218
218
  botOpenId: botConfig.botOpenId,
219
219
  groupResponseMode: botConfig.groupResponseMode,
220
220
  groupTopicReply: botConfig.groupTopicReply,
221
+ stepPush: botConfig.stepPush,
221
222
  ownerOpenIds: botConfig.ownerOpenIds ?? [botConfig.ownerOpenId],
222
223
  harness: workspaceScope.harness,
223
224
  state: workspaceScope.state,
@@ -294,6 +294,7 @@ function publicBotEntry(entry) {
294
294
  accessPolicy: normalizeAccessPolicy(source.accessPolicy),
295
295
  groupResponseMode: normalizeFeishuGroupResponseMode(source.groupResponseMode),
296
296
  groupTopicReply: source.groupTopicReply === true,
297
+ stepPush: source.stepPush === true,
297
298
  groupMessagePermissionGranted: source.groupMessagePermissionGranted === true,
298
299
  bot: publicBot(source.bot),
299
300
  health: publicHealth(source, connected),
@@ -458,6 +459,13 @@ function validPayload(endpoint, payload) {
458
459
  ? null
459
460
  : '请选择是否以话题方式回复。';
460
461
  }
462
+ if (endpoint === FEISHU_ENDPOINTS.setStepPush) {
463
+ return hasOnlyKeys(payload, new Set(['botId', 'stepPush']))
464
+ && safeOpaqueId(payload.botId)
465
+ && typeof payload.stepPush === 'boolean'
466
+ ? null
467
+ : '请选择是否分步直推。';
468
+ }
461
469
  return 'Unknown Feishu endpoint.';
462
470
  }
463
471
 
@@ -742,6 +750,14 @@ export function createFeishuRpcHandler(controller, { encodeQr = qrCodeDataUrl }
742
750
  await controller.updateGroupTopicReply(payload.botId, payload.groupTopicReply),
743
751
  { encodeQr: cachedEncodeQr },
744
752
  );
753
+ } else if (endpoint === FEISHU_ENDPOINTS.setStepPush) {
754
+ if (typeof controller.updateStepPush !== 'function') {
755
+ throw new Error('Step push update is unavailable');
756
+ }
757
+ value = await toPublicFeishuStatus(
758
+ await controller.updateStepPush(payload.botId, payload.stepPush),
759
+ { encodeQr: cachedEncodeQr },
760
+ );
745
761
  } else {
746
762
  if (typeof controller.deleteBot !== 'function') throw new Error('Multi-bot delete is unavailable');
747
763
  value = await toPublicFeishuStatus(await controller.deleteBot(payload.botId), { encodeQr: cachedEncodeQr });