@xmanrui/dsh-im 4.7.0 → 4.8.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/README.en.md CHANGED
@@ -140,7 +140,7 @@ See the [Proactive Delivery Guide](PROACTIVE_DELIVERY.en.md) ([简体中文](PRO
140
140
 
141
141
  ### Context enhancement
142
142
 
143
- Open **Context enhancement** on a bot card to configure separate enable switches, source fields, and guidance for group and direct chats, then **Save** to apply the complete configuration atomically. The two scopes do not share settings. Each offers `channel`, `conversationType`, `senderId`, `senderName`, and `botId`, with only `senderId` selected by default. Only values selected for the current scope and already available in the incoming message are included; no platform profile API is queried. Weixin currently supports DMs only.
143
+ Open **Context enhancement** on a bot card to configure separate enable switches, source fields, and guidance for group and direct chats, then **Save** to apply the complete configuration atomically. The two scopes do not share settings. Each offers `channel`, `conversationType`, `senderId`, `senderName`, `conversationTitle`, `chatId`, `threadId`, and `botId`, with only `senderId` selected by default. `chatId` lets the model know which group or direct chat a message came from, and Feishu topic chats additionally carry `threadId` to tell different topics inside the same group apart. Only values selected for the current scope and already available in the incoming message are included; no platform profile API is queried. Weixin currently supports DMs only.
144
144
 
145
145
  When enabled, ordinary user messages receive the current scope's `<dsh_im_source>` prefix. Nonempty guidance for that scope is automatically wrapped in `<dsh_im_source_guidance>` tags. Both guidance fields start empty and have their own instructions, example, **Use example**, and **Clear** actions. No fields selected in the current scope means no source block. Commands, approvals and question answers keep their existing control paths.
146
146
 
package/README.md CHANGED
@@ -143,7 +143,7 @@ dsh web
143
143
 
144
144
  ### 上下文增强
145
145
 
146
- 点击机器人卡片中的「上下文增强」,分别设置群聊和私聊的启用开关、来源字段与增强提示词,点击「保存」后原子生效。两个场景互不共用配置;五个可选字段均为 `channel`、`conversationType`、`senderId`、`senderName`、`botId`,各自默认只选择 `senderId`。插件只发送当前场景勾选且当前消息已有的值,不查询平台 API 补全。微信当前只支持私聊。
146
+ 点击机器人卡片中的「上下文增强」,分别设置群聊和私聊的启用开关、来源字段与增强提示词,点击「保存」后原子生效。两个场景互不共用配置;八个可选字段均为 `channel`、`conversationType`、`senderId`、`senderName`、`conversationTitle`、`chatId`、`threadId`、`botId`,各自默认只选择 `senderId`。`chatId` 用于让模型知道消息来自哪个群组或私聊,飞书话题群的消息还会带上 `threadId` 以区分同一群组内的不同话题。插件只发送当前场景勾选且当前消息已有的值,不查询平台 API 补全。微信当前只支持私聊。
147
147
 
148
148
  开启后,插件在普通用户消息前附加当前场景的 `<dsh_im_source>` 来源块;当前场景非空的增强提示词自动包裹为 `<dsh_im_source_guidance>`。两个场景的提示词默认留空,并分别提供说明、示例、「填入示例」和「清空」;当前场景字段全部取消时不生成来源块。命令、审批和问题回答继续走原有控制链路。
149
149
 
package/lib/client.js CHANGED
@@ -571,7 +571,7 @@ var React23 = __toESM(require("react"), 1);
571
571
  // package.json
572
572
  var package_default = {
573
573
  name: "@xmanrui/dsh-im",
574
- version: "4.7.0",
574
+ version: "4.8.0",
575
575
  description: "\u628A\u4E5D\u79CD IM \u673A\u5668\u4EBA\u548C\u516C\u7F51 AI Office \u63A5\u5165\u672C\u673A DeepSeek Harness\u3002 Connect nine IM channels and a public AI Office to a local DeepSeek Harness.",
576
576
  keywords: [
577
577
  "deepseek-harness",
@@ -605,6 +605,10 @@ var package_default = {
605
605
  {
606
606
  name: "divingleee",
607
607
  url: "https://github.com/divingleee"
608
+ },
609
+ {
610
+ name: "Chan-0312",
611
+ url: "https://github.com/Chan-0312"
608
612
  }
609
613
  ],
610
614
  license: "MIT",
@@ -1126,6 +1130,14 @@ var EN = Object.freeze({
1126
1130
  "\u67E5\u770B\u7FA4\u804A\u4F1A\u8BDD\u6807\u9898\u5B57\u6BB5\u8BF4\u660E": "View group conversation title field details",
1127
1131
  "\u67E5\u770B\u79C1\u804A\u4F1A\u8BDD\u6807\u9898\u5B57\u6BB5\u8BF4\u660E": "View direct conversation title field details",
1128
1132
  "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u6BCF\u4E2A\u6E20\u9053\u90FD\u80FD\u63D0\u4F9B\u3002\u9489\u9489\u7FA4\u804A\u4F1A\u5E26\u4E0A\u7FA4\u540D\u3002\u5F53\u524D\u6D88\u606F\u6CA1\u6709\u4F1A\u8BDD\u6807\u9898\u65F6\uFF0C\u5373\u4F7F\u5DF2\u9009\u62E9\u8BE5\u5B57\u6BB5\uFF0C<dsh_im_source> \u4E2D\u4E5F\u4F1A\u7701\u7565 conversationTitle\u3002": "This field is not available on every channel. DingTalk group chats include the group name. If the current message has no conversation title, <dsh_im_source> omits conversationTitle even when the field is selected.",
1133
+ "\u4F1A\u8BDD\u6807\u8BC6": "Chat ID",
1134
+ "\u67E5\u770B\u7FA4\u804A\u4F1A\u8BDD\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E": "View group chat ID field details",
1135
+ "\u67E5\u770B\u79C1\u804A\u4F1A\u8BDD\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E": "View direct chat ID field details",
1136
+ "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u6BCF\u4E2A\u6E20\u9053\u90FD\u80FD\u63D0\u4F9B\u3002\u4F1A\u8BDD\u6807\u8BC6\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u7684\u7FA4\u7EC4\u6216\u79C1\u804A\uFF0C\u98DE\u4E66\u7FA4\u804A\u4F1A\u5E26\u4E0A\u7FA4 ID\u3002\u5F53\u524D\u6D88\u606F\u6CA1\u6709\u4F1A\u8BDD\u6807\u8BC6\u65F6\uFF0C\u5373\u4F7F\u5DF2\u9009\u62E9\u8BE5\u5B57\u6BB5\uFF0C<dsh_im_source> \u4E2D\u4E5F\u4F1A\u7701\u7565 chatId\u3002": "This field is not available on every channel. The chat ID distinguishes different groups or direct chats, and Feishu group chats include the group ID. If the current message has no chat ID, <dsh_im_source> omits chatId even when the field is selected.",
1137
+ "\u8BDD\u9898\u6807\u8BC6": "Topic ID",
1138
+ "\u67E5\u770B\u7FA4\u804A\u8BDD\u9898\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E": "View group topic ID field details",
1139
+ "\u67E5\u770B\u79C1\u804A\u8BDD\u9898\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E": "View direct topic ID field details",
1140
+ "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u6BCF\u4E2A\u6E20\u9053\u90FD\u80FD\u63D0\u4F9B\u3002\u98DE\u4E66\u8BDD\u9898\u7FA4\u7684\u6D88\u606F\u4F1A\u5E26\u4E0A\u8BDD\u9898 ID\uFF0C\u7528\u4E8E\u533A\u5206\u540C\u4E00\u7FA4\u7EC4\u5185\u7684\u4E0D\u540C\u8BDD\u9898\uFF1B\u5F53\u524D\u6D88\u606F\u4E0D\u5728\u8BDD\u9898\u4E2D\u65F6\uFF0C\u5373\u4F7F\u5DF2\u9009\u62E9\u8BE5\u5B57\u6BB5\uFF0C<dsh_im_source> \u4E2D\u4E5F\u4F1A\u7701\u7565 threadId\u3002": "This field is not available on every channel. Messages in a Feishu topic chat carry the topic ID, which distinguishes different topics inside the same group. If the current message is not inside a topic, <dsh_im_source> omits threadId even when the field is selected.",
1129
1141
  "\u673A\u5668\u4EBA\u6807\u8BC6": "Bot ID",
1130
1142
  "\u589E\u5F3A\u63D0\u793A\u8BCD": "Guidance",
1131
1143
  "\u67E5\u770B\u589E\u5F3A\u63D0\u793A\u8BCD\u4F7F\u7528\u8BF4\u660E": "View guidance instructions",
@@ -1153,7 +1165,7 @@ var EN = Object.freeze({
1153
1165
  "\u4E0A\u4E0B\u6587\u589E\u5F3A\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002": "Could not save context enhancement. Try again.",
1154
1166
  "\u8BF7\u63D0\u4EA4\u5B8C\u6574\u7684\u4E0A\u4E0B\u6587\u589E\u5F3A\u8BBE\u7F6E\u3002": "Submit the complete context enhancement settings.",
1155
1167
  "\u7FA4\u804A\u548C\u79C1\u804A\u5F00\u5173\u5FC5\u987B\u662F\u5E03\u5C14\u503C\u3002": "Group and direct switches must be booleans.",
1156
- "\u6765\u6E90\u5B57\u6BB5\u53EA\u80FD\u9009\u62E9\u5DF2\u5B9A\u4E49\u7684\u516D\u4E2A\u5B57\u6BB5\u3002": "Source fields must be chosen from the six defined fields.",
1168
+ "\u6765\u6E90\u5B57\u6BB5\u53EA\u80FD\u9009\u62E9\u5DF2\u5B9A\u4E49\u7684\u516B\u4E2A\u5B57\u6BB5\u3002": "Source fields must be chosen from the eight defined fields.",
1157
1169
  "\u4FDD\u5B58\u4E2D\u2026": "Saving\u2026",
1158
1170
  "\u672A\u8BBE\u7F6E": "Not set",
1159
1171
  "\u5DE5\u4F5C\u533A\u4FEE\u6539\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002": "Could not update the workspace. Try again.",
@@ -2080,6 +2092,8 @@ var CONTEXT_ENHANCEMENT_FIELDS = Object.freeze([
2080
2092
  "senderId",
2081
2093
  "senderName",
2082
2094
  "conversationTitle",
2095
+ "chatId",
2096
+ "threadId",
2083
2097
  "botId"
2084
2098
  ]);
2085
2099
  var CONTEXT_ENHANCEMENT_GUIDANCE_MAX_LENGTH = 8e3;
@@ -2119,7 +2133,7 @@ function validateContextEnhancementScope(input) {
2119
2133
  throw invalidConfig("\u7FA4\u804A\u548C\u79C1\u804A\u5F00\u5173\u5FC5\u987B\u662F\u5E03\u5C14\u503C\u3002");
2120
2134
  }
2121
2135
  if (!Array.isArray(fields) || ![...fields].every((field) => CONTEXT_ENHANCEMENT_FIELDS.includes(field))) {
2122
- throw invalidConfig("\u6765\u6E90\u5B57\u6BB5\u53EA\u80FD\u9009\u62E9\u5DF2\u5B9A\u4E49\u7684\u516D\u4E2A\u5B57\u6BB5\u3002");
2136
+ throw invalidConfig("\u6765\u6E90\u5B57\u6BB5\u53EA\u80FD\u9009\u62E9\u5DF2\u5B9A\u4E49\u7684\u516B\u4E2A\u5B57\u6BB5\u3002");
2123
2137
  }
2124
2138
  if (typeof guidance !== "string" || guidance.length > CONTEXT_ENHANCEMENT_GUIDANCE_MAX_LENGTH) {
2125
2139
  throw invalidConfig(`\u589E\u5F3A\u63D0\u793A\u8BCD\u4E0D\u5F97\u8D85\u8FC7 ${CONTEXT_ENHANCEMENT_GUIDANCE_MAX_LENGTH} \u4E2A\u5B57\u7B26\u3002`);
@@ -2526,6 +2540,15 @@ var import_react_dom = require("react-dom");
2526
2540
  function pickerErrorCode(error) {
2527
2541
  return error?.rpcError?.code ?? error?.code;
2528
2542
  }
2543
+ var PICKER_ERROR_KINDS = /* @__PURE__ */ new Map([
2544
+ ["directory-picker/unavailable", "unavailable"],
2545
+ ["directory-picker-unavailable", "unavailable"],
2546
+ ["directory-picker/unreadable", "unreadable"],
2547
+ ["directory-unreadable", "unreadable"]
2548
+ ]);
2549
+ function pickerErrorKind(error) {
2550
+ return PICKER_ERROR_KINDS.get(pickerErrorCode(error));
2551
+ }
2529
2552
  function pickerErrorDetails(error) {
2530
2553
  return error?.rpcError?.details ?? error?.details;
2531
2554
  }
@@ -2633,9 +2656,9 @@ function WorkspaceDirectoryPicker({
2633
2656
  const initialPath = initialPathRef.current;
2634
2657
  const initial = await loadDirectory(initialPath || void 0, { reportError: false });
2635
2658
  if (!active || initial.aborted || initial.value) return;
2636
- const code = pickerErrorCode(initial.error);
2659
+ const kind = pickerErrorKind(initial.error);
2637
2660
  const details = pickerErrorDetails(initial.error);
2638
- if (code === "directory-picker-unavailable" && details?.capability === "native" && typeof picker.pickDirectory === "function") {
2661
+ if (kind === "unavailable" && details?.capability === "native" && typeof picker.pickDirectory === "function") {
2639
2662
  setLoading(true);
2640
2663
  try {
2641
2664
  const selected = await picker.pickDirectory();
@@ -2649,7 +2672,7 @@ function WorkspaceDirectoryPicker({
2649
2672
  }
2650
2673
  return;
2651
2674
  }
2652
- if (initialPath && code === "directory-unreadable") {
2675
+ if (initialPath && kind === "unreadable") {
2653
2676
  const home = await loadDirectory(void 0, { reportError: false });
2654
2677
  if (!active || home.aborted || home.value) return;
2655
2678
  setError(pickerErrorMessage(home.error));
@@ -2901,6 +2924,8 @@ var FIELD_LABELS = Object.freeze({
2901
2924
  senderId: "\u53D1\u9001\u8005\u6807\u8BC6",
2902
2925
  senderName: "\u53D1\u9001\u8005\u6635\u79F0",
2903
2926
  conversationTitle: "\u4F1A\u8BDD\u6807\u9898",
2927
+ chatId: "\u4F1A\u8BDD\u6807\u8BC6",
2928
+ threadId: "\u8BDD\u9898\u6807\u8BC6",
2904
2929
  botId: "\u673A\u5668\u4EBA\u6807\u8BC6"
2905
2930
  });
2906
2931
  var FIELD_HELP = Object.freeze({
@@ -2911,6 +2936,14 @@ var FIELD_HELP = Object.freeze({
2911
2936
  conversationTitle: Object.freeze({
2912
2937
  labelKey: "conversationTitleHelpLabel",
2913
2938
  text: "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u6BCF\u4E2A\u6E20\u9053\u90FD\u80FD\u63D0\u4F9B\u3002\u9489\u9489\u7FA4\u804A\u4F1A\u5E26\u4E0A\u7FA4\u540D\u3002\u5F53\u524D\u6D88\u606F\u6CA1\u6709\u4F1A\u8BDD\u6807\u9898\u65F6\uFF0C\u5373\u4F7F\u5DF2\u9009\u62E9\u8BE5\u5B57\u6BB5\uFF0C<dsh_im_source> \u4E2D\u4E5F\u4F1A\u7701\u7565 conversationTitle\u3002"
2939
+ }),
2940
+ chatId: Object.freeze({
2941
+ labelKey: "chatIdHelpLabel",
2942
+ text: "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u6BCF\u4E2A\u6E20\u9053\u90FD\u80FD\u63D0\u4F9B\u3002\u4F1A\u8BDD\u6807\u8BC6\u7528\u4E8E\u533A\u5206\u4E0D\u540C\u7684\u7FA4\u7EC4\u6216\u79C1\u804A\uFF0C\u98DE\u4E66\u7FA4\u804A\u4F1A\u5E26\u4E0A\u7FA4 ID\u3002\u5F53\u524D\u6D88\u606F\u6CA1\u6709\u4F1A\u8BDD\u6807\u8BC6\u65F6\uFF0C\u5373\u4F7F\u5DF2\u9009\u62E9\u8BE5\u5B57\u6BB5\uFF0C<dsh_im_source> \u4E2D\u4E5F\u4F1A\u7701\u7565 chatId\u3002"
2943
+ }),
2944
+ threadId: Object.freeze({
2945
+ labelKey: "threadIdHelpLabel",
2946
+ text: "\u8BE5\u5B57\u6BB5\u4E0D\u662F\u6BCF\u4E2A\u6E20\u9053\u90FD\u80FD\u63D0\u4F9B\u3002\u98DE\u4E66\u8BDD\u9898\u7FA4\u7684\u6D88\u606F\u4F1A\u5E26\u4E0A\u8BDD\u9898 ID\uFF0C\u7528\u4E8E\u533A\u5206\u540C\u4E00\u7FA4\u7EC4\u5185\u7684\u4E0D\u540C\u8BDD\u9898\uFF1B\u5F53\u524D\u6D88\u606F\u4E0D\u5728\u8BDD\u9898\u4E2D\u65F6\uFF0C\u5373\u4F7F\u5DF2\u9009\u62E9\u8BE5\u5B57\u6BB5\uFF0C<dsh_im_source> \u4E2D\u4E5F\u4F1A\u7701\u7565 threadId\u3002"
2914
2947
  })
2915
2948
  });
2916
2949
  var SCOPE_COPY = Object.freeze({
@@ -2920,6 +2953,8 @@ var SCOPE_COPY = Object.freeze({
2920
2953
  fieldsHelpLabel: "\u67E5\u770B\u7FA4\u804A\u6765\u6E90\u5B57\u6BB5\u8BF4\u660E",
2921
2954
  senderNameHelpLabel: "\u67E5\u770B\u7FA4\u804A\u53D1\u9001\u8005\u6635\u79F0\u5B57\u6BB5\u8BF4\u660E",
2922
2955
  conversationTitleHelpLabel: "\u67E5\u770B\u7FA4\u804A\u4F1A\u8BDD\u6807\u9898\u5B57\u6BB5\u8BF4\u660E",
2956
+ chatIdHelpLabel: "\u67E5\u770B\u7FA4\u804A\u4F1A\u8BDD\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E",
2957
+ threadIdHelpLabel: "\u67E5\u770B\u7FA4\u804A\u8BDD\u9898\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E",
2923
2958
  guidanceLabel: "\u589E\u5F3A\u63D0\u793A\u8BCD",
2924
2959
  guidanceHelpLabel: "\u67E5\u770B\u7FA4\u804A\u589E\u5F3A\u63D0\u793A\u8BCD\u4F7F\u7528\u8BF4\u660E",
2925
2960
  guidanceUsage: "\u7528\u4E8E\u544A\u8BC9\u6A21\u578B\u5982\u4F55\u4F7F\u7528\u5F53\u524D\u7FA4\u804A\u6D88\u606F\u7684 <dsh_im_source> \u6765\u6E90\u5B57\u6BB5\u3002\u53EA\u586B\u5199\u6B63\u6587\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u6DFB\u52A0 <dsh_im_source_guidance> \u6210\u5BF9\u6807\u7B7E\u3002",
@@ -2931,6 +2966,8 @@ var SCOPE_COPY = Object.freeze({
2931
2966
  fieldsHelpLabel: "\u67E5\u770B\u79C1\u804A\u6765\u6E90\u5B57\u6BB5\u8BF4\u660E",
2932
2967
  senderNameHelpLabel: "\u67E5\u770B\u79C1\u804A\u53D1\u9001\u8005\u6635\u79F0\u5B57\u6BB5\u8BF4\u660E",
2933
2968
  conversationTitleHelpLabel: "\u67E5\u770B\u79C1\u804A\u4F1A\u8BDD\u6807\u9898\u5B57\u6BB5\u8BF4\u660E",
2969
+ chatIdHelpLabel: "\u67E5\u770B\u79C1\u804A\u4F1A\u8BDD\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E",
2970
+ threadIdHelpLabel: "\u67E5\u770B\u79C1\u804A\u8BDD\u9898\u6807\u8BC6\u5B57\u6BB5\u8BF4\u660E",
2934
2971
  guidanceLabel: "\u589E\u5F3A\u63D0\u793A\u8BCD",
2935
2972
  guidanceHelpLabel: "\u67E5\u770B\u79C1\u804A\u589E\u5F3A\u63D0\u793A\u8BCD\u4F7F\u7528\u8BF4\u660E",
2936
2973
  guidanceUsage: "\u7528\u4E8E\u544A\u8BC9\u6A21\u578B\u5982\u4F55\u4F7F\u7528\u5F53\u524D\u79C1\u804A\u6D88\u606F\u7684 <dsh_im_source> \u6765\u6E90\u5B57\u6BB5\u3002\u53EA\u586B\u5199\u6B63\u6587\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u6DFB\u52A0 <dsh_im_source_guidance> \u6210\u5BF9\u6807\u7B7E\u3002",