@michengai/dsh-im-connect 1.0.43 → 1.0.45
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/CHANGELOG.md +14 -0
- package/CHANGELOG.zh-CN.md +14 -0
- package/README.en.md +1 -1
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/client.js +162 -24
- package/lib/client.js +162 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.45] - 2026-11-18
|
|
4
|
+
|
|
5
|
+
### Sidebar Tab Strip & Layout Stability
|
|
6
|
+
|
|
7
|
+
- **Sidebar single-strip layout fix (#73)**: Resolved an issue where multiple stacked tab bars could occasionally appear in the sidebar under duplicate plugin initialization or repeated view re-entry, which compressed and truncated the workspace and session list. The sidebar now strictly maintains a single unified tab strip across all view transitions, ensuring uninterrupted visibility for workspace sessions.
|
|
8
|
+
|
|
9
|
+
## [1.0.44] - 2026-11-17
|
|
10
|
+
|
|
11
|
+
### Feishu & Lark Thread Session Settings Experience
|
|
12
|
+
|
|
13
|
+
- **Standard dropdown picker & tooltip**: The "Thread session isolation" setting in Feishu and Lark account details has been upgraded to a standard select picker (with "Off" and "Isolated sessions" options), accompanied by a helpful tooltip explaining that threads maintain isolated conversation context when enabled and share group context when disabled.
|
|
14
|
+
- **Full multilingual localization**: Added localized labels and explanation tooltips for thread session isolation across all 8 supported languages (German, English, Spanish, French, Japanese, Portuguese, Russian, and Simplified Chinese).
|
|
15
|
+
- **Reliable account settings synchronization**: Refined account detail saving and configuration synchronization to ensure platform-specific options (such as thread session isolation and thinking process display) take effect reliably with smooth account reloading.
|
|
16
|
+
|
|
3
17
|
## [1.0.43] - 2026-11-17
|
|
4
18
|
|
|
5
19
|
### Feishu & Lark Thinking Process
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.0.45] - 2026-11-18
|
|
4
|
+
|
|
5
|
+
### 侧栏页签单层布局与可视高度修复
|
|
6
|
+
|
|
7
|
+
- **侧栏页签防多层堆叠优化(#73)**:修复在插件重复加载或界面重入时,侧栏偶现渲染多层页签条、挤压下方工作区与会话列表可视高度的问题。侧栏页签条在任何刷新与视图切换场景下均严格保持为单层分段栏,会话列表展示完整不被遮挡。
|
|
8
|
+
|
|
9
|
+
## [1.0.44] - 2026-11-17
|
|
10
|
+
|
|
11
|
+
### 飞书与 Lark 会话隔离设置体验
|
|
12
|
+
|
|
13
|
+
- **设置下拉选择器与说明提示**:飞书与 Lark 账号详情中的「群回复串会话隔离」选项优化为标准下拉选择器(提供「关闭」与「独立会话」两档),并在设置项旁提供气泡提示,清晰说明开启后回复串将按话题独立隔离上下文、关闭时与群聊大厅共享上下文。
|
|
14
|
+
- **多语言完整支持**:补齐群回复串会话隔离选项与提示说明在德语、英语、西班牙语、法语、日语、葡萄牙语、俄语、中文共 8 种语言的本地化文案。
|
|
15
|
+
- **账号设置即时生效保障**:完善账号详情保存与配置同步流程,确保飞书与 Lark 的会话隔离及思考过程展示等渠道专有配置在保存后稳定生效并平滑重载。
|
|
16
|
+
|
|
3
17
|
## [1.0.43] - 2026-11-17
|
|
4
18
|
|
|
5
19
|
### 飞书与 Lark 思考过程展示
|
package/README.en.md
CHANGED
|
@@ -317,7 +317,7 @@ Native configuration options are provided here. Their values are persisted in `c
|
|
|
317
317
|
### 5. Feishu thread session isolation (`threadSessions`)
|
|
318
318
|
- **Default**: disabled (`false`)
|
|
319
319
|
- **Description**: When enabled, message threads in Feishu group chats maintain independent sessions and conversation context bounded by their root message ID. When disabled, all threads share the main group session context.
|
|
320
|
-
- **UI Configuration**:
|
|
320
|
+
- **UI Configuration**: Configure **Thread session isolation** directly in **Settings → IM Assistant → Feishu / Lark Account Settings** (select **Isolated sessions**); takes effect dynamically via account restart upon saving.
|
|
321
321
|
- **Example** (account or plugin configuration):
|
|
322
322
|
```json
|
|
323
323
|
{
|
package/README.md
CHANGED
|
@@ -317,7 +317,7 @@ dsh --profile web --dump-config
|
|
|
317
317
|
### 5. 飞书群回复串会话隔离 (`threadSessions`)
|
|
318
318
|
- **默认状态**:关闭(`false`)
|
|
319
319
|
- **功能说明**:开启后,飞书群聊中的消息回复串(Thread / 话题)将以根消息 ID 为边界建立独立的会话与上下文;关闭时,群聊内所有回复串与大厅消息共享同一个群聊会话上下文。
|
|
320
|
-
- **界面配置**:在「设置 → IM助理 → 飞书 / Lark
|
|
320
|
+
- **界面配置**:在「设置 → IM助理 → 飞书 / Lark 账号设置」中,可直接在「群回复串会话隔离」下拉选择器中切换为「独立会话」,保存后动态重启账号生效。
|
|
321
321
|
- **配置示例**(账号配置或插件配置):
|
|
322
322
|
```json
|
|
323
323
|
{
|
|
@@ -351,7 +351,7 @@ dsh --profile web --dump-config
|
|
|
351
351
|
| 批准陌生人私聊 | 打开「设置 → IM助理」,在待批准列表点「批准」或「拒绝」 | 只影响私聊准入,不影响群聊 |
|
|
352
352
|
| 回答交互问题 | 直接回复选项序号或文字;多选用逗号分隔,也可以输入自定义答案 | 多个问题会按顺序发送;群聊只接受任务发起者回答 |
|
|
353
353
|
| 批准工具 | 在私聊回复「批准」或「拒绝」 | 也接受 `yes` / `no` / `allow` / `reject`;群聊无效 |
|
|
354
|
-
| 飞书回复串隔离 | 点击飞书 / Lark
|
|
354
|
+
| 飞书回复串隔离 | 点击飞书 / Lark 账号右侧「设置」,在弹窗的「群回复串会话隔离」下拉选择器中切换为「独立会话」 | 开启后群聊回复串按话题独立隔离会话与上下文;默认关闭(保持大厅共享上下文) |
|
|
355
355
|
| 静默回复协议 | 在模型输出中包含 `NO_REPLY` 或 `<<<NO_REPLY>>>` | 当 Agent 判断当前场景无需向用户回复时,插件静默完成回合,不发送「未返回可投递的结果」占位卡片 |
|
|
356
356
|
| 在网页里回看 | 打开工作区「频道」页签 | IM 会话不会出现在「任务」里 |
|
|
357
357
|
|
package/README.zh-CN.md
CHANGED
|
@@ -317,7 +317,7 @@ dsh --profile web --dump-config
|
|
|
317
317
|
### 5. 飞书群回复串会话隔离 (`threadSessions`)
|
|
318
318
|
- **默认状态**:关闭(`false`)
|
|
319
319
|
- **功能说明**:开启后,飞书群聊中的消息回复串(Thread / 话题)将以根消息 ID 为边界建立独立的会话与上下文;关闭时,群聊内所有回复串与大厅消息共享同一个群聊会话上下文。
|
|
320
|
-
- **界面配置**:在「设置 → IM助理 → 飞书 / Lark
|
|
320
|
+
- **界面配置**:在「设置 → IM助理 → 飞书 / Lark 账号设置」中,可直接在「群回复串会话隔离」下拉选择器中切换为「独立会话」,保存后动态重启账号生效。
|
|
321
321
|
- **配置示例**(账号配置或插件配置):
|
|
322
322
|
```json
|
|
323
323
|
{
|
|
@@ -351,7 +351,7 @@ dsh --profile web --dump-config
|
|
|
351
351
|
| 批准陌生人私聊 | 打开「设置 → IM助理」,在待批准列表点「批准」或「拒绝」 | 只影响私聊准入,不影响群聊 |
|
|
352
352
|
| 回答交互问题 | 直接回复选项序号或文字;多选用逗号分隔,也可以输入自定义答案 | 多个问题会按顺序发送;群聊只接受任务发起者回答 |
|
|
353
353
|
| 批准工具 | 在私聊回复「批准」或「拒绝」 | 也接受 `yes` / `no` / `allow` / `reject`;群聊无效 |
|
|
354
|
-
| 飞书回复串隔离 | 点击飞书 / Lark
|
|
354
|
+
| 飞书回复串隔离 | 点击飞书 / Lark 账号右侧「设置」,在弹窗的「群回复串会话隔离」下拉选择器中切换为「独立会话」 | 开启后群聊回复串按话题独立隔离会话与上下文;默认关闭(保持大厅共享上下文) |
|
|
355
355
|
| 静默回复协议 | 在模型输出中包含 `NO_REPLY` 或 `<<<NO_REPLY>>>` | 当 Agent 判断当前场景无需向用户回复时,插件静默完成回合,不发送「未返回可投递的结果」占位卡片 |
|
|
356
356
|
| 在网页里回看 | 打开工作区「频道」页签 | IM 会话不会出现在「任务」里 |
|
|
357
357
|
|
package/client.js
CHANGED
|
@@ -654,7 +654,9 @@ window.__ModuleLoader__.load({
|
|
|
654
654
|
"account.telegramThinkingDisplayNote": "开启后,模型的思考过程会以可折叠引用块单独发送,点击可展开查看。群聊中所有成员均可展开,请在允许分享思考的部署开启。",
|
|
655
655
|
"account.telegramThinkingDisplayOff": "关闭",
|
|
656
656
|
"account.threadSessions": "群回复串会话隔离",
|
|
657
|
+
"account.threadSessionsIsolated": "独立会话",
|
|
657
658
|
"account.threadSessionsNote": "开启后飞书群聊回复串将按话题独立会话与上下文;默认关闭。",
|
|
659
|
+
"account.threadSessionsOff": "关闭",
|
|
658
660
|
"account.workspace": "工作区",
|
|
659
661
|
"action.addAccount": "添加账号",
|
|
660
662
|
"action.approve": "批准",
|
|
@@ -958,7 +960,9 @@ window.__ModuleLoader__.load({
|
|
|
958
960
|
"account.telegramThinkingDisplayNote": "When enabled, reasoning is sent as an expandable quote block that users can tap to expand. All group members can view expanded reasoning.",
|
|
959
961
|
"account.telegramThinkingDisplayOff": "Off",
|
|
960
962
|
"account.threadSessions": "Thread session isolation",
|
|
963
|
+
"account.threadSessionsIsolated": "Isolated sessions",
|
|
961
964
|
"account.threadSessionsNote": "When enabled, group message threads are isolated into separate sessions; disabled by default.",
|
|
965
|
+
"account.threadSessionsOff": "Off",
|
|
962
966
|
"account.workspace": "Workspace",
|
|
963
967
|
"action.addAccount": "Add account",
|
|
964
968
|
"action.approve": "Approve",
|
|
@@ -1262,7 +1266,9 @@ window.__ModuleLoader__.load({
|
|
|
1262
1266
|
"account.telegramThinkingDisplayNote": "有効にすると、思考過程が折りたたみ可能な引用ブロックとして送信され、タップして展開できます。グループ内の全員が展開して閲覧可能です。",
|
|
1263
1267
|
"account.telegramThinkingDisplayOff": "オフ",
|
|
1264
1268
|
"account.threadSessions": "スレッドセッション分離",
|
|
1269
|
+
"account.threadSessionsIsolated": "スレッドごとに分離",
|
|
1265
1270
|
"account.threadSessionsNote": "有効にすると、グループ返信スレッドごとに独立したセッションとコンテキストが保持されます。デフォルトは無効です。",
|
|
1271
|
+
"account.threadSessionsOff": "オフ",
|
|
1266
1272
|
"account.workspace": "ワークスペース",
|
|
1267
1273
|
"action.addAccount": "アカウントを追加",
|
|
1268
1274
|
"action.approve": "承認",
|
|
@@ -1566,7 +1572,9 @@ window.__ModuleLoader__.load({
|
|
|
1566
1572
|
"account.telegramThinkingDisplayNote": "Cuando está habilitado, el razonamiento se envía como un bloque de cita desplegable que los usuarios pueden tocar para expandir. Todos los miembros pueden verlo.",
|
|
1567
1573
|
"account.telegramThinkingDisplayOff": "Desactivado",
|
|
1568
1574
|
"account.threadSessions": "Aislamiento de sesiones de hilos",
|
|
1575
|
+
"account.threadSessionsIsolated": "Sesiones aisladas",
|
|
1569
1576
|
"account.threadSessionsNote": "Al activarse, los hilos de mensajes en grupos se aíslan en sesiones independientes; desactivado por defecto.",
|
|
1577
|
+
"account.threadSessionsOff": "Desactivado",
|
|
1570
1578
|
"account.workspace": "Espacio de trabajo",
|
|
1571
1579
|
"action.addAccount": "Añadir cuenta",
|
|
1572
1580
|
"action.approve": "Aprobar",
|
|
@@ -1870,7 +1878,9 @@ window.__ModuleLoader__.load({
|
|
|
1870
1878
|
"account.telegramThinkingDisplayNote": "Si activé, le raisonnement est envoyé sous forme de bloc de citation pliable pouvant être déroulé au toucher. Visible par tous les membres du groupe.",
|
|
1871
1879
|
"account.telegramThinkingDisplayOff": "Désactivé",
|
|
1872
1880
|
"account.threadSessions": "Isolation des sessions de fil",
|
|
1881
|
+
"account.threadSessionsIsolated": "Sessions isolées",
|
|
1873
1882
|
"account.threadSessionsNote": "Une fois activé, les fils de messages de groupe sont isolés dans des sessions distinctes ; désactivé par défaut.",
|
|
1883
|
+
"account.threadSessionsOff": "Désactivé",
|
|
1874
1884
|
"account.workspace": "Espace de travail",
|
|
1875
1885
|
"action.addAccount": "Ajouter un compte",
|
|
1876
1886
|
"action.approve": "Approuver",
|
|
@@ -2174,7 +2184,9 @@ window.__ModuleLoader__.load({
|
|
|
2174
2184
|
"account.telegramThinkingDisplayNote": "Wenn aktiviert, wird das Reasoning als einklappbarer Zitatblock gesendet, der angetippt werden kann. Alle Gruppenmitglieder können ihn einsehen.",
|
|
2175
2185
|
"account.telegramThinkingDisplayOff": "Aus",
|
|
2176
2186
|
"account.threadSessions": "Thread-Sitzungsisolation",
|
|
2187
|
+
"account.threadSessionsIsolated": "Isolierte Sitzungen",
|
|
2177
2188
|
"account.threadSessionsNote": "Wenn aktiviert, werden Gruppen-Nachrichten-Threads in separate Sitzungen isoliert; standardmäßig deaktiviert.",
|
|
2189
|
+
"account.threadSessionsOff": "Aus",
|
|
2178
2190
|
"account.workspace": "Arbeitsbereich",
|
|
2179
2191
|
"action.addAccount": "Konto hinzufügen",
|
|
2180
2192
|
"action.approve": "Genehmigen",
|
|
@@ -2478,7 +2490,9 @@ window.__ModuleLoader__.load({
|
|
|
2478
2490
|
"account.telegramThinkingDisplayNote": "Если включено, ход мыслей отправляется в виде сворачиваемого цитатного блока. Все участники группы могут развернуть и просмотреть его.",
|
|
2479
2491
|
"account.telegramThinkingDisplayOff": "Выкл",
|
|
2480
2492
|
"account.threadSessions": "Изоляция сессий тредов",
|
|
2493
|
+
"account.threadSessionsIsolated": "Изолированные сессии",
|
|
2481
2494
|
"account.threadSessionsNote": "При включении цепочки ответов в группах изолируются в отдельные сессии; по умолчанию выключено.",
|
|
2495
|
+
"account.threadSessionsOff": "Выкл",
|
|
2482
2496
|
"account.workspace": "Рабочая область",
|
|
2483
2497
|
"action.addAccount": "Добавить аккаунт",
|
|
2484
2498
|
"action.approve": "Одобрить",
|
|
@@ -2782,7 +2796,9 @@ window.__ModuleLoader__.load({
|
|
|
2782
2796
|
"account.telegramThinkingDisplayNote": "Quando ativado, o raciocínio é enviado como um bloco de citação expansível que pode ser aberto com um toque. Visível para todos no grupo.",
|
|
2783
2797
|
"account.telegramThinkingDisplayOff": "Desactivado",
|
|
2784
2798
|
"account.threadSessions": "Isolamento de sessões de tópicos",
|
|
2799
|
+
"account.threadSessionsIsolated": "Sessões isoladas",
|
|
2785
2800
|
"account.threadSessionsNote": "Quando ativado, os tópicos de mensagens em grupos são isolados em sessões separadas; desativado por padrão.",
|
|
2801
|
+
"account.threadSessionsOff": "Desativado",
|
|
2786
2802
|
"account.workspace": "Espaço de trabalho",
|
|
2787
2803
|
"action.addAccount": "Adicionar conta",
|
|
2788
2804
|
"action.approve": "Aprovar",
|
|
@@ -4064,6 +4080,29 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4064
4080
|
);
|
|
4065
4081
|
}
|
|
4066
4082
|
|
|
4083
|
+
function resolveThreadSessionsSelect(value) {
|
|
4084
|
+
return Boolean(value && value.threadSessions) ? "isolated" : "off";
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
function threadSessionsPatch(next) {
|
|
4088
|
+
return { threadSessions: next === "isolated" };
|
|
4089
|
+
}
|
|
4090
|
+
|
|
4091
|
+
function filterAccountPlatformPayload(platform, patch, payload) {
|
|
4092
|
+
const result = payload || {};
|
|
4093
|
+
if (platform === "telegram" || platform === "feishu" || platform === "lark") {
|
|
4094
|
+
if (Object.prototype.hasOwnProperty.call(patch, "thinkingDisplay")) {
|
|
4095
|
+
result.thinkingDisplay = patch.thinkingDisplay;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
if (platform === "feishu" || platform === "lark") {
|
|
4099
|
+
if (Object.prototype.hasOwnProperty.call(patch, "threadSessions")) {
|
|
4100
|
+
result.threadSessions = patch.threadSessions;
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
return result;
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4067
4106
|
function AccountSettingsPicker(props) {
|
|
4068
4107
|
const t = props.t || fallbackT;
|
|
4069
4108
|
const modelT = props.modelT || ((key) => key);
|
|
@@ -4268,6 +4307,29 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4268
4307
|
: thinkingTipAnchor,
|
|
4269
4308
|
);
|
|
4270
4309
|
|
|
4310
|
+
const threadSessionsTip = t("account.threadSessionsNote");
|
|
4311
|
+
const threadSessionsTipAnchor = h("span", {
|
|
4312
|
+
className: "ima-label-tip",
|
|
4313
|
+
title: HostTooltip ? undefined : threadSessionsTip,
|
|
4314
|
+
"aria-label": threadSessionsTip,
|
|
4315
|
+
role: "button",
|
|
4316
|
+
tabIndex: 0,
|
|
4317
|
+
style: {
|
|
4318
|
+
display: "inline-flex",
|
|
4319
|
+
alignItems: "center",
|
|
4320
|
+
cursor: "help",
|
|
4321
|
+
color: "var(--dsw-alias-label-tertiary, var(--ima-muted))",
|
|
4322
|
+
marginLeft: 2,
|
|
4323
|
+
},
|
|
4324
|
+
}, h(IconInfoOutline, { size: 12 }));
|
|
4325
|
+
|
|
4326
|
+
const threadSessionsLabel = h("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 } },
|
|
4327
|
+
h("span", null, t("account.threadSessions")),
|
|
4328
|
+
HostTooltip
|
|
4329
|
+
? h(HostTooltip, { label: threadSessionsTip, portal: true, side: "top" }, threadSessionsTipAnchor)
|
|
4330
|
+
: threadSessionsTipAnchor,
|
|
4331
|
+
);
|
|
4332
|
+
|
|
4271
4333
|
const sessionIdleLabel = h("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 } },
|
|
4272
4334
|
h("span", null, t("account.sessionIdle")),
|
|
4273
4335
|
HostTooltip
|
|
@@ -4399,6 +4461,16 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4399
4461
|
],
|
|
4400
4462
|
onChange: (next) => update({ thinkingDisplay: next === "collapsed" }),
|
|
4401
4463
|
})),
|
|
4464
|
+
props.threadSessionsSupported && field("threadSessions", threadSessionsLabel, h(Select, {
|
|
4465
|
+
className: "ima-account-picker",
|
|
4466
|
+
value: resolveThreadSessionsSelect(value),
|
|
4467
|
+
"aria-label": t("account.threadSessions"),
|
|
4468
|
+
options: [
|
|
4469
|
+
{ value: "off", label: t("account.threadSessionsOff") },
|
|
4470
|
+
{ value: "isolated", label: t("account.threadSessionsIsolated") },
|
|
4471
|
+
],
|
|
4472
|
+
onChange: (next) => update(threadSessionsPatch(next)),
|
|
4473
|
+
})),
|
|
4402
4474
|
segmentSupported && field("segmentReply", segmentReplyLabel, h(Select, {
|
|
4403
4475
|
className: "ima-account-picker",
|
|
4404
4476
|
value: segmentReply ? "segmented" : "full",
|
|
@@ -4622,15 +4694,22 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4622
4694
|
payload.mentionPolicy = Object.prototype.hasOwnProperty.call(patch, "mentionPolicy") ? patch.mentionPolicy : (mentionPolicyDraft === "always" ? "always" : "addressed");
|
|
4623
4695
|
payload.freeChatGroups = Object.prototype.hasOwnProperty.call(patch, "freeChatGroups") ? patch.freeChatGroups : freeChatGroupsDraft;
|
|
4624
4696
|
}
|
|
4625
|
-
if (Object.prototype.hasOwnProperty.call(patch, "thinkingDisplay")) {
|
|
4626
|
-
payload.thinkingDisplay = patch.thinkingDisplay;
|
|
4627
|
-
}
|
|
4628
4697
|
}
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4698
|
+
const filterPayload = typeof filterAccountPlatformPayload === "function" ? filterAccountPlatformPayload : (platform, patch, target) => {
|
|
4699
|
+
const res = target || {};
|
|
4700
|
+
if (platform === "telegram" || platform === "feishu" || platform === "lark") {
|
|
4701
|
+
if (Object.prototype.hasOwnProperty.call(patch, "thinkingDisplay")) {
|
|
4702
|
+
res.thinkingDisplay = patch.thinkingDisplay;
|
|
4703
|
+
}
|
|
4632
4704
|
}
|
|
4633
|
-
|
|
4705
|
+
if (platform === "feishu" || platform === "lark") {
|
|
4706
|
+
if (Object.prototype.hasOwnProperty.call(patch, "threadSessions")) {
|
|
4707
|
+
res.threadSessions = patch.threadSessions;
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
return res;
|
|
4711
|
+
};
|
|
4712
|
+
filterPayload(account.platform, patch, payload);
|
|
4634
4713
|
return onSave(account.id, payload).then((ok) => {
|
|
4635
4714
|
if (seq === saveSeq.current) setNote(ok ? "status.saved" : "error.save");
|
|
4636
4715
|
return ok;
|
|
@@ -4672,6 +4751,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4672
4751
|
value: draft,
|
|
4673
4752
|
onChange: applySettings,
|
|
4674
4753
|
thinkingDisplaySupported: account.platform === "telegram" || account.platform === "feishu" || account.platform === "lark",
|
|
4754
|
+
threadSessionsSupported: account.platform === "feishu" || account.platform === "lark",
|
|
4675
4755
|
segmentReplySupported: account.segmentReplySupported !== false,
|
|
4676
4756
|
catalog,
|
|
4677
4757
|
permissions,
|
|
@@ -4770,22 +4850,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4770
4850
|
})(),
|
|
4771
4851
|
h("div", { className: "ima-picker-note" }, t("account.telegramGroupPolicyNote")),
|
|
4772
4852
|
),
|
|
4773
|
-
(account.platform === "feishu" || account.platform === "lark") && h("div", { className: "ima-thread-sessions-settings" },
|
|
4774
|
-
h("div", { className: "ima-picker-field wide" },
|
|
4775
|
-
h("span", { className: "ima-picker-label" }, t("account.threadSessions")),
|
|
4776
|
-
h(Switch, {
|
|
4777
|
-
role: "switch",
|
|
4778
|
-
checked: Boolean(draft.threadSessions ?? account.threadSessions),
|
|
4779
|
-
"aria-checked": Boolean(draft.threadSessions ?? account.threadSessions),
|
|
4780
|
-
"aria-label": t("account.threadSessions"),
|
|
4781
|
-
onChange: (checked) => {
|
|
4782
|
-
setDraft({ ...draft, threadSessions: checked });
|
|
4783
|
-
save({ threadSessions: checked });
|
|
4784
|
-
},
|
|
4785
|
-
}),
|
|
4786
|
-
),
|
|
4787
|
-
h("div", { className: "ima-picker-note" }, t("account.threadSessionsNote")),
|
|
4788
|
-
),
|
|
4789
4853
|
h(CommandPermissionSettings, { value: draft.commandPermissions, onSave: commandPermissions => save({ commandPermissions }), t }),
|
|
4790
4854
|
note && h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" }, t(note)),
|
|
4791
4855
|
h("div", { className: "ima-inspector-actions" },
|
|
@@ -6150,6 +6214,8 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
6150
6214
|
function pickOfficialWorkspaces(ctx) {
|
|
6151
6215
|
const read = ctx.slots.entriesOfSlot || ctx.slots.entries;
|
|
6152
6216
|
const entries = (read && read.call(ctx.slots, "sidebar.workspaces")) || [];
|
|
6217
|
+
const active = entries.find((item) => item && item.component);
|
|
6218
|
+
if (active && isWrappedWorkspaceComponent(active.component)) return null;
|
|
6153
6219
|
for (const item of entries) {
|
|
6154
6220
|
if (!item || !item.component) continue;
|
|
6155
6221
|
if (isWrappedWorkspaceComponent(item.component)) continue;
|
|
@@ -6167,6 +6233,25 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
6167
6233
|
|| component.__dshAutomationOriginal !== undefined);
|
|
6168
6234
|
}
|
|
6169
6235
|
|
|
6236
|
+
function resolveOfficialTreeComponent(component) {
|
|
6237
|
+
const seen = new Set();
|
|
6238
|
+
let current = component;
|
|
6239
|
+
while (current !== undefined && current !== null && !seen.has(current)) {
|
|
6240
|
+
seen.add(current);
|
|
6241
|
+
const flags = current;
|
|
6242
|
+
const next = flags.__dshNativeTabOriginal || flags.__dshAutomationOriginal || flags.__imConnectOriginal;
|
|
6243
|
+
if (next !== undefined && next !== current) {
|
|
6244
|
+
current = next;
|
|
6245
|
+
continue;
|
|
6246
|
+
}
|
|
6247
|
+
if (flags.__dshNativeTabWrapped === true || flags.__dshAutomationWrapped === true || flags.__imConnectWrapped === true) {
|
|
6248
|
+
return null;
|
|
6249
|
+
}
|
|
6250
|
+
return current;
|
|
6251
|
+
}
|
|
6252
|
+
return null;
|
|
6253
|
+
}
|
|
6254
|
+
|
|
6170
6255
|
const BUNDLE_KEY = "@michengai/dsh-im-connect";
|
|
6171
6256
|
const SIDEBAR_PANEL_ID = "im-connect";
|
|
6172
6257
|
const SIDEBAR_PANEL_ORDER = 3;
|
|
@@ -6967,6 +7052,22 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
6967
7052
|
let stopInsertedTabLocale = () => {};
|
|
6968
7053
|
let insertedTabRegistry = null;
|
|
6969
7054
|
let syncing = false;
|
|
7055
|
+
const globalStore = typeof window !== "undefined" ? window : globalThis;
|
|
7056
|
+
const SIDEBAR_OWNER_KEY = "__dshImConnectSidebarOwner__";
|
|
7057
|
+
const instanceId = { id: "im-" + Math.random().toString(36).slice(2) };
|
|
7058
|
+
let warnedDuplicate = false;
|
|
7059
|
+
const isDuplicateOwner = () => {
|
|
7060
|
+
const owner = globalStore[SIDEBAR_OWNER_KEY];
|
|
7061
|
+
return !!(owner && owner !== instanceId);
|
|
7062
|
+
};
|
|
7063
|
+
const claimOwnership = () => {
|
|
7064
|
+
globalStore[SIDEBAR_OWNER_KEY] = instanceId;
|
|
7065
|
+
};
|
|
7066
|
+
const releaseOwnership = () => {
|
|
7067
|
+
if (globalStore[SIDEBAR_OWNER_KEY] === instanceId) {
|
|
7068
|
+
delete globalStore[SIDEBAR_OWNER_KEY];
|
|
7069
|
+
}
|
|
7070
|
+
};
|
|
6970
7071
|
// 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
|
|
6971
7072
|
const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
|
|
6972
7073
|
const clearFilter = () => {
|
|
@@ -7040,6 +7141,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7040
7141
|
};
|
|
7041
7142
|
const unwrap = () => {
|
|
7042
7143
|
clearInsertedTab();
|
|
7144
|
+
releaseOwnership();
|
|
7043
7145
|
clearFilter();
|
|
7044
7146
|
activeFilterRegistry = null;
|
|
7045
7147
|
if (wrappedEntry) {
|
|
@@ -7101,6 +7203,13 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7101
7203
|
};
|
|
7102
7204
|
const sync = () => {
|
|
7103
7205
|
if (syncing) return;
|
|
7206
|
+
if (isDuplicateOwner()) {
|
|
7207
|
+
if (!warnedDuplicate) {
|
|
7208
|
+
warnedDuplicate = true;
|
|
7209
|
+
console.warn("[dsh-im-connect] 检测到同模块已有活跃的侧栏实例,跳过重复包装与页签注入");
|
|
7210
|
+
}
|
|
7211
|
+
return;
|
|
7212
|
+
}
|
|
7104
7213
|
syncing = true;
|
|
7105
7214
|
try {
|
|
7106
7215
|
const combo = hasDshCodexUiSidebar(ctx);
|
|
@@ -7115,12 +7224,37 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7115
7224
|
if (!occupant) { clearInsertedTab(); return; }
|
|
7116
7225
|
if (insertedTabRegistry && findNativeTabRegistry(occupant) !== insertedTabRegistry) clearInsertedTab();
|
|
7117
7226
|
if (occupant && (occupant.component.__dshNativeTabHost || occupant.component.__dshNativeTabWrapped || occupant.component.__dshAutomationWrapped || findNativeTabRegistry(occupant))) {
|
|
7227
|
+
claimOwnership();
|
|
7118
7228
|
insertChannelTab(occupant);
|
|
7119
7229
|
return;
|
|
7120
7230
|
}
|
|
7121
7231
|
const official = pickOfficialWorkspaces(ctx);
|
|
7122
7232
|
if (!official) return;
|
|
7123
|
-
|
|
7233
|
+
const resolveRealOfficialTree = (comp) => {
|
|
7234
|
+
const seen = new Set();
|
|
7235
|
+
let current = comp;
|
|
7236
|
+
while (current !== undefined && current !== null && !seen.has(current)) {
|
|
7237
|
+
seen.add(current);
|
|
7238
|
+
const flags = current;
|
|
7239
|
+
const next = flags.__dshNativeTabOriginal || flags.__dshAutomationOriginal || flags.__imConnectOriginal;
|
|
7240
|
+
if (next !== undefined && next !== current) {
|
|
7241
|
+
current = next;
|
|
7242
|
+
continue;
|
|
7243
|
+
}
|
|
7244
|
+
if (flags.__dshNativeTabWrapped === true || flags.__dshAutomationWrapped === true || flags.__imConnectWrapped === true) {
|
|
7245
|
+
return null;
|
|
7246
|
+
}
|
|
7247
|
+
return current;
|
|
7248
|
+
}
|
|
7249
|
+
return null;
|
|
7250
|
+
};
|
|
7251
|
+
const resolvedComp = resolveRealOfficialTree(official.component);
|
|
7252
|
+
if (!resolvedComp) {
|
|
7253
|
+
console.warn("[dsh-im-connect] 目标条目已被包裹且无法解析原始底层组件,放弃包裹以防嵌套");
|
|
7254
|
+
return;
|
|
7255
|
+
}
|
|
7256
|
+
originalComp = resolvedComp;
|
|
7257
|
+
claimOwnership();
|
|
7124
7258
|
const registry = createNativeTabRegistry(originalComp);
|
|
7125
7259
|
ownedRegistry = registry;
|
|
7126
7260
|
removeInsertedOpener = installSessionOpener(registry);
|
|
@@ -7166,6 +7300,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7166
7300
|
unsubSidebar();
|
|
7167
7301
|
window.removeEventListener("dsh-native-sidebar-change", sync);
|
|
7168
7302
|
unwrap();
|
|
7303
|
+
releaseOwnership();
|
|
7169
7304
|
};
|
|
7170
7305
|
});
|
|
7171
7306
|
}
|
|
@@ -7174,6 +7309,9 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7174
7309
|
exports.inject = inject;
|
|
7175
7310
|
exports.resolveApiUrl = resolveApiUrl;
|
|
7176
7311
|
exports.setupSidebarEntry = setupSidebarEntry;
|
|
7312
|
+
exports.resolveThreadSessionsSelect = resolveThreadSessionsSelect;
|
|
7313
|
+
exports.threadSessionsPatch = threadSessionsPatch;
|
|
7314
|
+
exports.filterAccountPlatformPayload = filterAccountPlatformPayload;
|
|
7177
7315
|
return module.exports;
|
|
7178
7316
|
},
|
|
7179
7317
|
});
|
package/lib/client.js
CHANGED
|
@@ -700,7 +700,9 @@ function resolveApiUrl(path) {
|
|
|
700
700
|
"account.telegramThinkingDisplayNote": "开启后,模型的思考过程会以可折叠引用块单独发送,点击可展开查看。群聊中所有成员均可展开,请在允许分享思考的部署开启。",
|
|
701
701
|
"account.telegramThinkingDisplayOff": "关闭",
|
|
702
702
|
"account.threadSessions": "群回复串会话隔离",
|
|
703
|
+
"account.threadSessionsIsolated": "独立会话",
|
|
703
704
|
"account.threadSessionsNote": "开启后飞书群聊回复串将按话题独立会话与上下文;默认关闭。",
|
|
705
|
+
"account.threadSessionsOff": "关闭",
|
|
704
706
|
"account.workspace": "工作区",
|
|
705
707
|
"action.addAccount": "添加账号",
|
|
706
708
|
"action.approve": "批准",
|
|
@@ -1004,7 +1006,9 @@ function resolveApiUrl(path) {
|
|
|
1004
1006
|
"account.telegramThinkingDisplayNote": "When enabled, reasoning is sent as an expandable quote block that users can tap to expand. All group members can view expanded reasoning.",
|
|
1005
1007
|
"account.telegramThinkingDisplayOff": "Off",
|
|
1006
1008
|
"account.threadSessions": "Thread session isolation",
|
|
1009
|
+
"account.threadSessionsIsolated": "Isolated sessions",
|
|
1007
1010
|
"account.threadSessionsNote": "When enabled, group message threads are isolated into separate sessions; disabled by default.",
|
|
1011
|
+
"account.threadSessionsOff": "Off",
|
|
1008
1012
|
"account.workspace": "Workspace",
|
|
1009
1013
|
"action.addAccount": "Add account",
|
|
1010
1014
|
"action.approve": "Approve",
|
|
@@ -1308,7 +1312,9 @@ function resolveApiUrl(path) {
|
|
|
1308
1312
|
"account.telegramThinkingDisplayNote": "有効にすると、思考過程が折りたたみ可能な引用ブロックとして送信され、タップして展開できます。グループ内の全員が展開して閲覧可能です。",
|
|
1309
1313
|
"account.telegramThinkingDisplayOff": "オフ",
|
|
1310
1314
|
"account.threadSessions": "スレッドセッション分離",
|
|
1315
|
+
"account.threadSessionsIsolated": "スレッドごとに分離",
|
|
1311
1316
|
"account.threadSessionsNote": "有効にすると、グループ返信スレッドごとに独立したセッションとコンテキストが保持されます。デフォルトは無効です。",
|
|
1317
|
+
"account.threadSessionsOff": "オフ",
|
|
1312
1318
|
"account.workspace": "ワークスペース",
|
|
1313
1319
|
"action.addAccount": "アカウントを追加",
|
|
1314
1320
|
"action.approve": "承認",
|
|
@@ -1612,7 +1618,9 @@ function resolveApiUrl(path) {
|
|
|
1612
1618
|
"account.telegramThinkingDisplayNote": "Cuando está habilitado, el razonamiento se envía como un bloque de cita desplegable que los usuarios pueden tocar para expandir. Todos los miembros pueden verlo.",
|
|
1613
1619
|
"account.telegramThinkingDisplayOff": "Desactivado",
|
|
1614
1620
|
"account.threadSessions": "Aislamiento de sesiones de hilos",
|
|
1621
|
+
"account.threadSessionsIsolated": "Sesiones aisladas",
|
|
1615
1622
|
"account.threadSessionsNote": "Al activarse, los hilos de mensajes en grupos se aíslan en sesiones independientes; desactivado por defecto.",
|
|
1623
|
+
"account.threadSessionsOff": "Desactivado",
|
|
1616
1624
|
"account.workspace": "Espacio de trabajo",
|
|
1617
1625
|
"action.addAccount": "Añadir cuenta",
|
|
1618
1626
|
"action.approve": "Aprobar",
|
|
@@ -1916,7 +1924,9 @@ function resolveApiUrl(path) {
|
|
|
1916
1924
|
"account.telegramThinkingDisplayNote": "Si activé, le raisonnement est envoyé sous forme de bloc de citation pliable pouvant être déroulé au toucher. Visible par tous les membres du groupe.",
|
|
1917
1925
|
"account.telegramThinkingDisplayOff": "Désactivé",
|
|
1918
1926
|
"account.threadSessions": "Isolation des sessions de fil",
|
|
1927
|
+
"account.threadSessionsIsolated": "Sessions isolées",
|
|
1919
1928
|
"account.threadSessionsNote": "Une fois activé, les fils de messages de groupe sont isolés dans des sessions distinctes ; désactivé par défaut.",
|
|
1929
|
+
"account.threadSessionsOff": "Désactivé",
|
|
1920
1930
|
"account.workspace": "Espace de travail",
|
|
1921
1931
|
"action.addAccount": "Ajouter un compte",
|
|
1922
1932
|
"action.approve": "Approuver",
|
|
@@ -2220,7 +2230,9 @@ function resolveApiUrl(path) {
|
|
|
2220
2230
|
"account.telegramThinkingDisplayNote": "Wenn aktiviert, wird das Reasoning als einklappbarer Zitatblock gesendet, der angetippt werden kann. Alle Gruppenmitglieder können ihn einsehen.",
|
|
2221
2231
|
"account.telegramThinkingDisplayOff": "Aus",
|
|
2222
2232
|
"account.threadSessions": "Thread-Sitzungsisolation",
|
|
2233
|
+
"account.threadSessionsIsolated": "Isolierte Sitzungen",
|
|
2223
2234
|
"account.threadSessionsNote": "Wenn aktiviert, werden Gruppen-Nachrichten-Threads in separate Sitzungen isoliert; standardmäßig deaktiviert.",
|
|
2235
|
+
"account.threadSessionsOff": "Aus",
|
|
2224
2236
|
"account.workspace": "Arbeitsbereich",
|
|
2225
2237
|
"action.addAccount": "Konto hinzufügen",
|
|
2226
2238
|
"action.approve": "Genehmigen",
|
|
@@ -2524,7 +2536,9 @@ function resolveApiUrl(path) {
|
|
|
2524
2536
|
"account.telegramThinkingDisplayNote": "Если включено, ход мыслей отправляется в виде сворачиваемого цитатного блока. Все участники группы могут развернуть и просмотреть его.",
|
|
2525
2537
|
"account.telegramThinkingDisplayOff": "Выкл",
|
|
2526
2538
|
"account.threadSessions": "Изоляция сессий тредов",
|
|
2539
|
+
"account.threadSessionsIsolated": "Изолированные сессии",
|
|
2527
2540
|
"account.threadSessionsNote": "При включении цепочки ответов в группах изолируются в отдельные сессии; по умолчанию выключено.",
|
|
2541
|
+
"account.threadSessionsOff": "Выкл",
|
|
2528
2542
|
"account.workspace": "Рабочая область",
|
|
2529
2543
|
"action.addAccount": "Добавить аккаунт",
|
|
2530
2544
|
"action.approve": "Одобрить",
|
|
@@ -2828,7 +2842,9 @@ function resolveApiUrl(path) {
|
|
|
2828
2842
|
"account.telegramThinkingDisplayNote": "Quando ativado, o raciocínio é enviado como um bloco de citação expansível que pode ser aberto com um toque. Visível para todos no grupo.",
|
|
2829
2843
|
"account.telegramThinkingDisplayOff": "Desactivado",
|
|
2830
2844
|
"account.threadSessions": "Isolamento de sessões de tópicos",
|
|
2845
|
+
"account.threadSessionsIsolated": "Sessões isoladas",
|
|
2831
2846
|
"account.threadSessionsNote": "Quando ativado, os tópicos de mensagens em grupos são isolados em sessões separadas; desativado por padrão.",
|
|
2847
|
+
"account.threadSessionsOff": "Desativado",
|
|
2832
2848
|
"account.workspace": "Espaço de trabalho",
|
|
2833
2849
|
"action.addAccount": "Adicionar conta",
|
|
2834
2850
|
"action.approve": "Aprovar",
|
|
@@ -4110,6 +4126,29 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4110
4126
|
);
|
|
4111
4127
|
}
|
|
4112
4128
|
|
|
4129
|
+
function resolveThreadSessionsSelect(value) {
|
|
4130
|
+
return Boolean(value && value.threadSessions) ? "isolated" : "off";
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
function threadSessionsPatch(next) {
|
|
4134
|
+
return { threadSessions: next === "isolated" };
|
|
4135
|
+
}
|
|
4136
|
+
|
|
4137
|
+
function filterAccountPlatformPayload(platform, patch, payload) {
|
|
4138
|
+
const result = payload || {};
|
|
4139
|
+
if (platform === "telegram" || platform === "feishu" || platform === "lark") {
|
|
4140
|
+
if (Object.prototype.hasOwnProperty.call(patch, "thinkingDisplay")) {
|
|
4141
|
+
result.thinkingDisplay = patch.thinkingDisplay;
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
if (platform === "feishu" || platform === "lark") {
|
|
4145
|
+
if (Object.prototype.hasOwnProperty.call(patch, "threadSessions")) {
|
|
4146
|
+
result.threadSessions = patch.threadSessions;
|
|
4147
|
+
}
|
|
4148
|
+
}
|
|
4149
|
+
return result;
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4113
4152
|
function AccountSettingsPicker(props) {
|
|
4114
4153
|
const t = props.t || fallbackT;
|
|
4115
4154
|
const modelT = props.modelT || ((key) => key);
|
|
@@ -4314,6 +4353,29 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4314
4353
|
: thinkingTipAnchor,
|
|
4315
4354
|
);
|
|
4316
4355
|
|
|
4356
|
+
const threadSessionsTip = t("account.threadSessionsNote");
|
|
4357
|
+
const threadSessionsTipAnchor = h("span", {
|
|
4358
|
+
className: "ima-label-tip",
|
|
4359
|
+
title: HostTooltip ? undefined : threadSessionsTip,
|
|
4360
|
+
"aria-label": threadSessionsTip,
|
|
4361
|
+
role: "button",
|
|
4362
|
+
tabIndex: 0,
|
|
4363
|
+
style: {
|
|
4364
|
+
display: "inline-flex",
|
|
4365
|
+
alignItems: "center",
|
|
4366
|
+
cursor: "help",
|
|
4367
|
+
color: "var(--dsw-alias-label-tertiary, var(--ima-muted))",
|
|
4368
|
+
marginLeft: 2,
|
|
4369
|
+
},
|
|
4370
|
+
}, h(IconInfoOutline, { size: 12 }));
|
|
4371
|
+
|
|
4372
|
+
const threadSessionsLabel = h("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 } },
|
|
4373
|
+
h("span", null, t("account.threadSessions")),
|
|
4374
|
+
HostTooltip
|
|
4375
|
+
? h(HostTooltip, { label: threadSessionsTip, portal: true, side: "top" }, threadSessionsTipAnchor)
|
|
4376
|
+
: threadSessionsTipAnchor,
|
|
4377
|
+
);
|
|
4378
|
+
|
|
4317
4379
|
const sessionIdleLabel = h("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 } },
|
|
4318
4380
|
h("span", null, t("account.sessionIdle")),
|
|
4319
4381
|
HostTooltip
|
|
@@ -4445,6 +4507,16 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4445
4507
|
],
|
|
4446
4508
|
onChange: (next) => update({ thinkingDisplay: next === "collapsed" }),
|
|
4447
4509
|
})),
|
|
4510
|
+
props.threadSessionsSupported && field("threadSessions", threadSessionsLabel, h(Select, {
|
|
4511
|
+
className: "ima-account-picker",
|
|
4512
|
+
value: resolveThreadSessionsSelect(value),
|
|
4513
|
+
"aria-label": t("account.threadSessions"),
|
|
4514
|
+
options: [
|
|
4515
|
+
{ value: "off", label: t("account.threadSessionsOff") },
|
|
4516
|
+
{ value: "isolated", label: t("account.threadSessionsIsolated") },
|
|
4517
|
+
],
|
|
4518
|
+
onChange: (next) => update(threadSessionsPatch(next)),
|
|
4519
|
+
})),
|
|
4448
4520
|
segmentSupported && field("segmentReply", segmentReplyLabel, h(Select, {
|
|
4449
4521
|
className: "ima-account-picker",
|
|
4450
4522
|
value: segmentReply ? "segmented" : "full",
|
|
@@ -4668,15 +4740,22 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4668
4740
|
payload.mentionPolicy = Object.prototype.hasOwnProperty.call(patch, "mentionPolicy") ? patch.mentionPolicy : (mentionPolicyDraft === "always" ? "always" : "addressed");
|
|
4669
4741
|
payload.freeChatGroups = Object.prototype.hasOwnProperty.call(patch, "freeChatGroups") ? patch.freeChatGroups : freeChatGroupsDraft;
|
|
4670
4742
|
}
|
|
4671
|
-
if (Object.prototype.hasOwnProperty.call(patch, "thinkingDisplay")) {
|
|
4672
|
-
payload.thinkingDisplay = patch.thinkingDisplay;
|
|
4673
|
-
}
|
|
4674
4743
|
}
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4744
|
+
const filterPayload = typeof filterAccountPlatformPayload === "function" ? filterAccountPlatformPayload : (platform, patch, target) => {
|
|
4745
|
+
const res = target || {};
|
|
4746
|
+
if (platform === "telegram" || platform === "feishu" || platform === "lark") {
|
|
4747
|
+
if (Object.prototype.hasOwnProperty.call(patch, "thinkingDisplay")) {
|
|
4748
|
+
res.thinkingDisplay = patch.thinkingDisplay;
|
|
4749
|
+
}
|
|
4678
4750
|
}
|
|
4679
|
-
|
|
4751
|
+
if (platform === "feishu" || platform === "lark") {
|
|
4752
|
+
if (Object.prototype.hasOwnProperty.call(patch, "threadSessions")) {
|
|
4753
|
+
res.threadSessions = patch.threadSessions;
|
|
4754
|
+
}
|
|
4755
|
+
}
|
|
4756
|
+
return res;
|
|
4757
|
+
};
|
|
4758
|
+
filterPayload(account.platform, patch, payload);
|
|
4680
4759
|
return onSave(account.id, payload).then((ok) => {
|
|
4681
4760
|
if (seq === saveSeq.current) setNote(ok ? "status.saved" : "error.save");
|
|
4682
4761
|
return ok;
|
|
@@ -4718,6 +4797,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4718
4797
|
value: draft,
|
|
4719
4798
|
onChange: applySettings,
|
|
4720
4799
|
thinkingDisplaySupported: account.platform === "telegram" || account.platform === "feishu" || account.platform === "lark",
|
|
4800
|
+
threadSessionsSupported: account.platform === "feishu" || account.platform === "lark",
|
|
4721
4801
|
segmentReplySupported: account.segmentReplySupported !== false,
|
|
4722
4802
|
catalog,
|
|
4723
4803
|
permissions,
|
|
@@ -4816,22 +4896,6 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
4816
4896
|
})(),
|
|
4817
4897
|
h("div", { className: "ima-picker-note" }, t("account.telegramGroupPolicyNote")),
|
|
4818
4898
|
),
|
|
4819
|
-
(account.platform === "feishu" || account.platform === "lark") && h("div", { className: "ima-thread-sessions-settings" },
|
|
4820
|
-
h("div", { className: "ima-picker-field wide" },
|
|
4821
|
-
h("span", { className: "ima-picker-label" }, t("account.threadSessions")),
|
|
4822
|
-
h(Switch, {
|
|
4823
|
-
role: "switch",
|
|
4824
|
-
checked: Boolean(draft.threadSessions ?? account.threadSessions),
|
|
4825
|
-
"aria-checked": Boolean(draft.threadSessions ?? account.threadSessions),
|
|
4826
|
-
"aria-label": t("account.threadSessions"),
|
|
4827
|
-
onChange: (checked) => {
|
|
4828
|
-
setDraft({ ...draft, threadSessions: checked });
|
|
4829
|
-
save({ threadSessions: checked });
|
|
4830
|
-
},
|
|
4831
|
-
}),
|
|
4832
|
-
),
|
|
4833
|
-
h("div", { className: "ima-picker-note" }, t("account.threadSessionsNote")),
|
|
4834
|
-
),
|
|
4835
4899
|
h(CommandPermissionSettings, { value: draft.commandPermissions, onSave: commandPermissions => save({ commandPermissions }), t }),
|
|
4836
4900
|
note && h("div", { className: note === "status.saved" ? "ima-save-note ok" : "ima-save-note" }, t(note)),
|
|
4837
4901
|
h("div", { className: "ima-inspector-actions" },
|
|
@@ -6196,6 +6260,8 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
6196
6260
|
function pickOfficialWorkspaces(ctx) {
|
|
6197
6261
|
const read = ctx.slots.entriesOfSlot || ctx.slots.entries;
|
|
6198
6262
|
const entries = (read && read.call(ctx.slots, "sidebar.workspaces")) || [];
|
|
6263
|
+
const active = entries.find((item) => item && item.component);
|
|
6264
|
+
if (active && isWrappedWorkspaceComponent(active.component)) return null;
|
|
6199
6265
|
for (const item of entries) {
|
|
6200
6266
|
if (!item || !item.component) continue;
|
|
6201
6267
|
if (isWrappedWorkspaceComponent(item.component)) continue;
|
|
@@ -6213,6 +6279,25 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
6213
6279
|
|| component.__dshAutomationOriginal !== undefined);
|
|
6214
6280
|
}
|
|
6215
6281
|
|
|
6282
|
+
function resolveOfficialTreeComponent(component) {
|
|
6283
|
+
const seen = new Set();
|
|
6284
|
+
let current = component;
|
|
6285
|
+
while (current !== undefined && current !== null && !seen.has(current)) {
|
|
6286
|
+
seen.add(current);
|
|
6287
|
+
const flags = current;
|
|
6288
|
+
const next = flags.__dshNativeTabOriginal || flags.__dshAutomationOriginal || flags.__imConnectOriginal;
|
|
6289
|
+
if (next !== undefined && next !== current) {
|
|
6290
|
+
current = next;
|
|
6291
|
+
continue;
|
|
6292
|
+
}
|
|
6293
|
+
if (flags.__dshNativeTabWrapped === true || flags.__dshAutomationWrapped === true || flags.__imConnectWrapped === true) {
|
|
6294
|
+
return null;
|
|
6295
|
+
}
|
|
6296
|
+
return current;
|
|
6297
|
+
}
|
|
6298
|
+
return null;
|
|
6299
|
+
}
|
|
6300
|
+
|
|
6216
6301
|
const BUNDLE_KEY = "@michengai/dsh-im-connect";
|
|
6217
6302
|
const SIDEBAR_PANEL_ID = "im-connect";
|
|
6218
6303
|
const SIDEBAR_PANEL_ORDER = 3;
|
|
@@ -7013,6 +7098,22 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7013
7098
|
let stopInsertedTabLocale = () => {};
|
|
7014
7099
|
let insertedTabRegistry = null;
|
|
7015
7100
|
let syncing = false;
|
|
7101
|
+
const globalStore = typeof window !== "undefined" ? window : globalThis;
|
|
7102
|
+
const SIDEBAR_OWNER_KEY = "__dshImConnectSidebarOwner__";
|
|
7103
|
+
const instanceId = { id: "im-" + Math.random().toString(36).slice(2) };
|
|
7104
|
+
let warnedDuplicate = false;
|
|
7105
|
+
const isDuplicateOwner = () => {
|
|
7106
|
+
const owner = globalStore[SIDEBAR_OWNER_KEY];
|
|
7107
|
+
return !!(owner && owner !== instanceId);
|
|
7108
|
+
};
|
|
7109
|
+
const claimOwnership = () => {
|
|
7110
|
+
globalStore[SIDEBAR_OWNER_KEY] = instanceId;
|
|
7111
|
+
};
|
|
7112
|
+
const releaseOwnership = () => {
|
|
7113
|
+
if (globalStore[SIDEBAR_OWNER_KEY] === instanceId) {
|
|
7114
|
+
delete globalStore[SIDEBAR_OWNER_KEY];
|
|
7115
|
+
}
|
|
7116
|
+
};
|
|
7016
7117
|
// 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
|
|
7017
7118
|
const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
|
|
7018
7119
|
const clearFilter = () => {
|
|
@@ -7086,6 +7187,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7086
7187
|
};
|
|
7087
7188
|
const unwrap = () => {
|
|
7088
7189
|
clearInsertedTab();
|
|
7190
|
+
releaseOwnership();
|
|
7089
7191
|
clearFilter();
|
|
7090
7192
|
activeFilterRegistry = null;
|
|
7091
7193
|
if (wrappedEntry) {
|
|
@@ -7147,6 +7249,13 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7147
7249
|
};
|
|
7148
7250
|
const sync = () => {
|
|
7149
7251
|
if (syncing) return;
|
|
7252
|
+
if (isDuplicateOwner()) {
|
|
7253
|
+
if (!warnedDuplicate) {
|
|
7254
|
+
warnedDuplicate = true;
|
|
7255
|
+
console.warn("[dsh-im-connect] 检测到同模块已有活跃的侧栏实例,跳过重复包装与页签注入");
|
|
7256
|
+
}
|
|
7257
|
+
return;
|
|
7258
|
+
}
|
|
7150
7259
|
syncing = true;
|
|
7151
7260
|
try {
|
|
7152
7261
|
const combo = hasDshCodexUiSidebar(ctx);
|
|
@@ -7161,12 +7270,37 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7161
7270
|
if (!occupant) { clearInsertedTab(); return; }
|
|
7162
7271
|
if (insertedTabRegistry && findNativeTabRegistry(occupant) !== insertedTabRegistry) clearInsertedTab();
|
|
7163
7272
|
if (occupant && (occupant.component.__dshNativeTabHost || occupant.component.__dshNativeTabWrapped || occupant.component.__dshAutomationWrapped || findNativeTabRegistry(occupant))) {
|
|
7273
|
+
claimOwnership();
|
|
7164
7274
|
insertChannelTab(occupant);
|
|
7165
7275
|
return;
|
|
7166
7276
|
}
|
|
7167
7277
|
const official = pickOfficialWorkspaces(ctx);
|
|
7168
7278
|
if (!official) return;
|
|
7169
|
-
|
|
7279
|
+
const resolveRealOfficialTree = (comp) => {
|
|
7280
|
+
const seen = new Set();
|
|
7281
|
+
let current = comp;
|
|
7282
|
+
while (current !== undefined && current !== null && !seen.has(current)) {
|
|
7283
|
+
seen.add(current);
|
|
7284
|
+
const flags = current;
|
|
7285
|
+
const next = flags.__dshNativeTabOriginal || flags.__dshAutomationOriginal || flags.__imConnectOriginal;
|
|
7286
|
+
if (next !== undefined && next !== current) {
|
|
7287
|
+
current = next;
|
|
7288
|
+
continue;
|
|
7289
|
+
}
|
|
7290
|
+
if (flags.__dshNativeTabWrapped === true || flags.__dshAutomationWrapped === true || flags.__imConnectWrapped === true) {
|
|
7291
|
+
return null;
|
|
7292
|
+
}
|
|
7293
|
+
return current;
|
|
7294
|
+
}
|
|
7295
|
+
return null;
|
|
7296
|
+
};
|
|
7297
|
+
const resolvedComp = resolveRealOfficialTree(official.component);
|
|
7298
|
+
if (!resolvedComp) {
|
|
7299
|
+
console.warn("[dsh-im-connect] 目标条目已被包裹且无法解析原始底层组件,放弃包裹以防嵌套");
|
|
7300
|
+
return;
|
|
7301
|
+
}
|
|
7302
|
+
originalComp = resolvedComp;
|
|
7303
|
+
claimOwnership();
|
|
7170
7304
|
const registry = createNativeTabRegistry(originalComp);
|
|
7171
7305
|
ownedRegistry = registry;
|
|
7172
7306
|
removeInsertedOpener = installSessionOpener(registry);
|
|
@@ -7212,6 +7346,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7212
7346
|
unsubSidebar();
|
|
7213
7347
|
window.removeEventListener("dsh-native-sidebar-change", sync);
|
|
7214
7348
|
unwrap();
|
|
7349
|
+
releaseOwnership();
|
|
7215
7350
|
};
|
|
7216
7351
|
});
|
|
7217
7352
|
}
|
|
@@ -7220,5 +7355,8 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
|
|
|
7220
7355
|
exports.inject = inject;
|
|
7221
7356
|
exports.resolveApiUrl = resolveApiUrl;
|
|
7222
7357
|
exports.setupSidebarEntry = setupSidebarEntry;
|
|
7358
|
+
exports.resolveThreadSessionsSelect = resolveThreadSessionsSelect;
|
|
7359
|
+
exports.threadSessionsPatch = threadSessionsPatch;
|
|
7360
|
+
exports.filterAccountPlatformPayload = filterAccountPlatformPayload;
|
|
7223
7361
|
return module.exports;
|
|
7224
7362
|
} });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-im-connect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"description": "DSH IM Connect — 将主流即时通讯平台接入本机 DeepSeek Harness · Connect major messaging platforms to local DeepSeek Harness agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.22.0",
|