@michengai/dsh-im-connect 0.1.47 → 0.1.49
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 +8 -0
- package/CHANGELOG.zh-CN.md +8 -0
- package/README.md +16 -5
- package/README.zh-CN.md +16 -5
- package/client.js +25 -9
- package/lib/client.js +25 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
Recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
|
|
6
6
|
|
|
7
|
+
## 0.1.49 - 2026-09-14
|
|
8
|
+
|
|
9
|
+
- Fix an older sidebar tab registration removing its replacement during cleanup, preserving shared tabs when plugins hand over ownership.
|
|
10
|
+
|
|
11
|
+
## 0.1.48 - 2026-09-14
|
|
12
|
+
|
|
13
|
+
- Fix the Channels sidebar entry disappearing when used with the archive and automation plugins.
|
|
14
|
+
|
|
7
15
|
## 0.1.47 - 2026-09-13
|
|
8
16
|
|
|
9
17
|
- Diagnose account connections through platform APIs or an existing connection heartbeat. Results distinguish passed, failed and unverified checks, with specific guidance for credentials, local state, network failures and Telegram Webhook conflicts; no test messages are sent.
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
以下记录近期发布的版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
|
|
6
6
|
|
|
7
|
+
## 0.1.49 - 2026-09-14
|
|
8
|
+
|
|
9
|
+
- 修复侧栏旧页签注册在清理时误删同名新页签的问题,确保插件交接时保留共享页签。
|
|
10
|
+
|
|
11
|
+
## 0.1.48 - 2026-09-14
|
|
12
|
+
|
|
13
|
+
- 修复与归档、定时任务插件组合使用时,侧栏频道入口可能消失的问题。
|
|
14
|
+
|
|
7
15
|
## 0.1.47 - 2026-09-13
|
|
8
16
|
|
|
9
17
|
- 新增账号连接诊断,通过平台接口或现有连接心跳检查,区分通过、失败和未验证,并针对凭据、本地状态、网络故障及 Telegram Webhook 冲突给出建议;不发送测试消息。
|
package/README.md
CHANGED
|
@@ -174,18 +174,21 @@ After connecting, drive the local assistant from each IM:
|
|
|
174
174
|
|
|
175
175
|
## DSH product ecosystem
|
|
176
176
|
|
|
177
|
-
For a
|
|
177
|
+
For a desktop workbench, download [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop/releases). Existing [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) installations can add plugins as needed by following each project's README. Below are 11 first-party plugins; consult the corresponding desktop release notes and bundled catalog for what that version includes.
|
|
178
178
|
|
|
179
179
|
| Plugin | What you can do |
|
|
180
180
|
| --- | --- |
|
|
181
181
|
| [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | Organize projects and conversations, search tasks, and navigate chat turns |
|
|
182
|
-
| [
|
|
183
|
-
| [Automation](https://github.com/MichengAI/dsh-automation) | Schedule tasks and review each run |
|
|
182
|
+
| [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | Choose and summon specialists for your task |
|
|
184
183
|
| [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | Find, enable, create, and import local skills |
|
|
185
184
|
| [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | Search, restore, or clean up archived conversations |
|
|
186
|
-
| [
|
|
185
|
+
| [IM Connect](https://github.com/MichengAI/dsh-im-connect) | Send tasks and receive replies through messaging platforms |
|
|
186
|
+
| [Automation](https://github.com/MichengAI/dsh-automation) | Schedule tasks and review each run |
|
|
187
187
|
| [BTW](https://github.com/MichengAI/dsh-btw) | Ask side questions without interrupting the main task |
|
|
188
|
-
| [Simplify](https://github.com/MichengAI/dsh-simplify) | Use
|
|
188
|
+
| [Simplify](https://github.com/MichengAI/dsh-simplify) | Use `/simplify` to improve code within your Git changes |
|
|
189
|
+
| [PUA](https://github.com/MichengAI/dsh-pua) | Guide the Agent to try new approaches after failures, investigate causes, and verify results before completion |
|
|
190
|
+
| [Code Review](https://github.com/MichengAI/dsh-code-review) | Use `/review` to request an independent Agent code review and receive the report in the current conversation |
|
|
191
|
+
| [Codex Pet](https://github.com/MichengAI/dsh-codex-pet) | View conversation notifications and respond to tool approvals and questions through a desktop pet |
|
|
189
192
|
|
|
190
193
|
## Prerequisites
|
|
191
194
|
|
|
@@ -324,6 +327,12 @@ dsh plugin --profile web add .
|
|
|
324
327
|
|
|
325
328
|
When changing channel or session logic, keep the engine platform-agnostic, keep adapters from creating agents, and keep web tasks separate from IM channels.
|
|
326
329
|
|
|
330
|
+
### Native sidebar coordination protocol
|
|
331
|
+
|
|
332
|
+
IM and Automation share tabs through the active `sidebar.workspaces` entry and the `__dshNativeTabs` registry on the entry or component. This is an inter-plugin convention, not an official stable DSH API. When replacing or restoring a sidebar component or handing over a registry without a host slot notification, the changing plugin should dispatch `dsh-native-sidebar-change` on `window` in a microtask after updating its state (a plain `Event`, with no payload). Receivers reread the active entry. Inserting a tab alone must not forward the event, to avoid notification loops.
|
|
333
|
+
|
|
334
|
+
Cleanup restores only components still owned by the plugin, removes its own registry and tabs, and releases event, slot, and tab subscriptions. Changes to the event name, registry structure, or notification semantics require coordinated compatibility updates. IM retries startup every 250ms for at most 20 attempts and stops early after inserting a tab. This only covers startup ordering; it cannot guarantee reconnection when an older plugin silently replaces a component after retries end.
|
|
335
|
+
|
|
327
336
|
## Validation
|
|
328
337
|
|
|
329
338
|
For real management-authentication tests, set `DSH_CONNECTION_CONTRACT_ROOT` to the isolated `@deepseek-ai/dsh-client-connection` package root. The Gateway-coexistence case also uses `DSH_CHAT_CONTRACT_ROOT` from the image contracts. Local runs skip these contracts when unconfigured; CI supplies both. Tests use temporary HTTP servers and credentials, not a live Cloudflare deployment.
|
|
@@ -336,6 +345,8 @@ npm test
|
|
|
336
345
|
|
|
337
346
|
`prepublishOnly` runs the tests before publishing.
|
|
338
347
|
|
|
348
|
+
Sidebar tests read the built `lib/client.js`; run `npm run build` before invoking individual tests directly. The lifecycle harness verifies attachment and disposal with simulated slots, notifications, and timers. It does not render React or replace validation of real messages, archiving, scheduled tasks, or Desktop.
|
|
349
|
+
|
|
339
350
|
|
|
340
351
|
## Result recovery after disconnects and restarts
|
|
341
352
|
|
package/README.zh-CN.md
CHANGED
|
@@ -174,18 +174,21 @@ IM 消息发起的处理结束后,会在正文和文件投递完成后给出
|
|
|
174
174
|
|
|
175
175
|
## DSH 产品生态
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
想使用桌面工作台,可下载 [DSH Codex Desktop](https://github.com/MichengAI/dsh-codex-desktop/releases);已有 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 环境,可按各项目 README 按需安装。以下列出 11 个自研插件;桌面端实际随附范围以对应版本的发行说明和内置清单为准。
|
|
178
178
|
|
|
179
179
|
| 插件 | 你可以用它做什么 |
|
|
180
180
|
| --- | --- |
|
|
181
181
|
| [Codex UI](https://github.com/MichengAI/dsh-codex-ui) | 整理项目与会话、搜索任务、跳转对话轮次 |
|
|
182
|
-
| [
|
|
183
|
-
| [Automation](https://github.com/MichengAI/dsh-automation) | 按计划执行任务,查看每次运行的结果 |
|
|
182
|
+
| [Agency Agents](https://github.com/MichengAI/dsh-agency-agents) | 按任务选择并召唤专业角色 |
|
|
184
183
|
| [Skills Manager](https://github.com/MichengAI/dsh-skills-manager) | 统一查找、启停、创建和导入本机技能 |
|
|
185
184
|
| [Archive Manager](https://github.com/MichengAI/dsh-archive-manager) | 搜索、恢复或清理已归档会话 |
|
|
186
|
-
| [
|
|
185
|
+
| [IM Connect](https://github.com/MichengAI/dsh-im-connect) | 从消息平台下任务、收回复 |
|
|
186
|
+
| [Automation](https://github.com/MichengAI/dsh-automation) | 按计划执行任务,查看每次运行的结果 |
|
|
187
187
|
| [BTW](https://github.com/MichengAI/dsh-btw) | 在当前上下文中临时旁问,不打断主任务 |
|
|
188
|
-
| [Simplify](https://github.com/MichengAI/dsh-simplify) | 用
|
|
188
|
+
| [Simplify](https://github.com/MichengAI/dsh-simplify) | 用 `/simplify` 整理 Git 改动范围内的代码 |
|
|
189
|
+
| [PUA](https://github.com/MichengAI/dsh-pua) | 引导 Agent 在失败时换方法、查原因,并在完成前验证结果 |
|
|
190
|
+
| [Code Review](https://github.com/MichengAI/dsh-code-review) | 用 `/review` 发起独立 Agent 代码审查,在当前会话接收报告 |
|
|
191
|
+
| [Codex Pet](https://github.com/MichengAI/dsh-codex-pet) | 通过桌面宠物查看会话提醒、处理工具审批和问题回答 |
|
|
189
192
|
|
|
190
193
|
## 前置条件
|
|
191
194
|
|
|
@@ -324,6 +327,12 @@ dsh plugin --profile web add .
|
|
|
324
327
|
|
|
325
328
|
修改渠道或会话逻辑时,必须保持:引擎不写死平台名、渠道不创建 agent、网页任务与 IM 频道分列。
|
|
326
329
|
|
|
330
|
+
### 原生侧栏协作协议
|
|
331
|
+
|
|
332
|
+
IM 与定时插件通过 `sidebar.workspaces` 当前显示项及条目/组件上的 `__dshNativeTabs` 注册表共享页签。这是插件间约定,不是 DSH 官方稳定 API。直接替换或恢复侧栏组件、交接注册表且宿主不会发送槽位通知时,变更方应在状态更新完成后通过微任务派发 `window` 事件 `dsh-native-sidebar-change`(普通 `Event`,无负载)。接收方重新读取当前显示项;仅插入页签不转发该事件,避免通知循环。
|
|
333
|
+
|
|
334
|
+
清理时只恢复自己仍持有的组件、移除自己拥有的注册表和页签,并解除事件、槽位及页签订阅。事件名、注册表结构或通知语义变更需要协作插件同步兼容。IM 每 250ms、最多 20 次的启动重试在成功插入页签后提前结束;它只兼容启动加载顺序,不能保证旧插件在重试结束后无声替换组件时重新接入。
|
|
335
|
+
|
|
327
336
|
## 验证
|
|
328
337
|
|
|
329
338
|
真实管理认证测试需要把 `DSH_CONNECTION_CONTRACT_ROOT` 指向隔离安装的 `@deepseek-ai/dsh-client-connection` 包根目录;与 Gateway 共存的用例同时使用图片契约的 `DSH_CHAT_CONTRACT_ROOT`。未配置时本地会跳过对应契约测试,CI 已配置执行。测试使用临时 HTTP 服务和临时凭据,不代表真实 Cloudflare 部署联调。
|
|
@@ -336,6 +345,8 @@ npm test
|
|
|
336
345
|
|
|
337
346
|
`prepublishOnly` 会在发布前自动执行测试。
|
|
338
347
|
|
|
348
|
+
侧栏测试读取构建后的 `lib/client.js`;直接运行单项测试前先执行 `npm run build`。生命周期 Harness 验证模拟插槽、通知与计时器下的接入和卸载,不执行 React 渲染,也不代替真实消息、归档、定时任务或 Desktop 验收。
|
|
349
|
+
|
|
339
350
|
|
|
340
351
|
## 断线与重启后的结果补发
|
|
341
352
|
|
package/client.js
CHANGED
|
@@ -1968,7 +1968,11 @@ window.__ModuleLoader__.load({
|
|
|
1968
1968
|
tabs.set(tab.id, tab);
|
|
1969
1969
|
rebuild();
|
|
1970
1970
|
emit();
|
|
1971
|
-
return () => {
|
|
1971
|
+
return () => {
|
|
1972
|
+
// 同名页签可能已被其他注册替换,旧清理函数只能移除自己持有的项。
|
|
1973
|
+
if (tabs.get(tab.id) !== tab) return;
|
|
1974
|
+
tabs.delete(tab.id); rebuild(); emit();
|
|
1975
|
+
};
|
|
1972
1976
|
},
|
|
1973
1977
|
addSessionFilter(filter) {
|
|
1974
1978
|
sessionFilters.push(filter);
|
|
@@ -2216,10 +2220,14 @@ window.__ModuleLoader__.load({
|
|
|
2216
2220
|
ctx.slots.inject("sidebar.workspaces", () => {
|
|
2217
2221
|
let wrappedEntry = null;
|
|
2218
2222
|
let originalComp = null;
|
|
2223
|
+
let ownedWrapper = null;
|
|
2224
|
+
let ownedRegistry = null;
|
|
2219
2225
|
let removeInsertedTab = () => {};
|
|
2220
2226
|
let stopInsertedTabLocale = () => {};
|
|
2221
2227
|
let insertedTabRegistry = null;
|
|
2222
2228
|
let syncing = false;
|
|
2229
|
+
// 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
|
|
2230
|
+
const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
|
|
2223
2231
|
const clearInsertedTab = () => {
|
|
2224
2232
|
stopInsertedTabLocale();
|
|
2225
2233
|
stopInsertedTabLocale = () => {};
|
|
@@ -2229,11 +2237,15 @@ window.__ModuleLoader__.load({
|
|
|
2229
2237
|
};
|
|
2230
2238
|
const unwrap = () => {
|
|
2231
2239
|
clearInsertedTab();
|
|
2232
|
-
if (wrappedEntry
|
|
2233
|
-
|
|
2240
|
+
if (wrappedEntry) {
|
|
2241
|
+
if (originalComp && wrappedEntry.component === ownedWrapper) wrappedEntry.component = originalComp;
|
|
2242
|
+
if (wrappedEntry.__dshNativeTabs === ownedRegistry) delete wrappedEntry.__dshNativeTabs;
|
|
2243
|
+
notifyPeers();
|
|
2234
2244
|
}
|
|
2235
2245
|
wrappedEntry = null;
|
|
2236
2246
|
originalComp = null;
|
|
2247
|
+
ownedWrapper = null;
|
|
2248
|
+
ownedRegistry = null;
|
|
2237
2249
|
};
|
|
2238
2250
|
const insertChannelTab = (entry) => {
|
|
2239
2251
|
const registry = findNativeTabRegistry(entry);
|
|
@@ -2276,21 +2288,21 @@ window.__ModuleLoader__.load({
|
|
|
2276
2288
|
const read = ctx.slots.entriesOfSlot || ctx.slots.entries;
|
|
2277
2289
|
const entries = (read && read.call(ctx.slots, "sidebar.workspaces")) || [];
|
|
2278
2290
|
const occupant = entries.find((item) => item && item.component);
|
|
2291
|
+
if (wrappedEntry && (occupant !== wrappedEntry || occupant.component !== ownedWrapper)) unwrap();
|
|
2292
|
+
if (!occupant) { clearInsertedTab(); return; }
|
|
2279
2293
|
if (occupant && (occupant.component.__dshNativeTabHost || occupant.component.__dshAutomationWrapped || findNativeTabRegistry(occupant))) {
|
|
2280
2294
|
insertChannelTab(occupant);
|
|
2281
2295
|
return;
|
|
2282
2296
|
}
|
|
2283
|
-
if (wrappedEntry && wrappedEntry.component && wrappedEntry.component.__imConnectWrapped) {
|
|
2284
|
-
insertChannelTab(wrappedEntry);
|
|
2285
|
-
return;
|
|
2286
|
-
}
|
|
2287
2297
|
const official = pickOfficialWorkspaces(ctx);
|
|
2288
2298
|
if (!official || official.component.__imConnectWrapped || official.component.__dshNativeTabHost) return;
|
|
2289
2299
|
originalComp = official.component;
|
|
2290
2300
|
const registry = createNativeTabRegistry(originalComp);
|
|
2301
|
+
ownedRegistry = registry;
|
|
2302
|
+
const tree = originalComp;
|
|
2291
2303
|
attachNativeTabRegistry(official, registry);
|
|
2292
2304
|
function ImNativeWorkspaceShell(innerProps) {
|
|
2293
|
-
return h(LocalizedSessionSwitcher, Object.assign({}, innerProps, { officialTree:
|
|
2305
|
+
return h(LocalizedSessionSwitcher, Object.assign({}, innerProps, { officialTree: tree, nativeTabs: registry }));
|
|
2294
2306
|
}
|
|
2295
2307
|
ImNativeWorkspaceShell.displayName = "ImNativeWorkspaceShell";
|
|
2296
2308
|
ImNativeWorkspaceShell.__imConnectWrapped = true;
|
|
@@ -2298,7 +2310,9 @@ window.__ModuleLoader__.load({
|
|
|
2298
2310
|
ImNativeWorkspaceShell.__dshNativeTabHost = true;
|
|
2299
2311
|
attachNativeTabRegistry(ImNativeWorkspaceShell, registry);
|
|
2300
2312
|
official.component = ImNativeWorkspaceShell;
|
|
2313
|
+
ownedWrapper = ImNativeWorkspaceShell;
|
|
2301
2314
|
wrappedEntry = official;
|
|
2315
|
+
notifyPeers();
|
|
2302
2316
|
} catch (error) {
|
|
2303
2317
|
console.warn("[dsh-im-connect] 包裹官方任务树失败", error);
|
|
2304
2318
|
} finally {
|
|
@@ -2307,13 +2321,15 @@ window.__ModuleLoader__.load({
|
|
|
2307
2321
|
};
|
|
2308
2322
|
sync();
|
|
2309
2323
|
const unsub = typeof ctx.slots.subscribe === "function" ? ctx.slots.subscribe("sidebar.workspaces", sync) : () => {};
|
|
2324
|
+
const unsubSidebar = typeof ctx.slots.subscribe === "function" ? ctx.slots.subscribe("sidebar", sync) : () => {};
|
|
2325
|
+
window.addEventListener("dsh-native-sidebar-change", sync);
|
|
2310
2326
|
// 其他插件直接替换 component/注册表时不一定触发槽位通知,短暂重试兼容加载顺序。
|
|
2311
2327
|
let retries = 0;
|
|
2312
2328
|
const retryTimer = window.setInterval(() => {
|
|
2313
2329
|
sync();
|
|
2314
2330
|
if (insertedTabRegistry || ++retries >= 20) window.clearInterval(retryTimer);
|
|
2315
2331
|
}, 250);
|
|
2316
|
-
return () => { window.clearInterval(retryTimer); unsub(); unwrap(); };
|
|
2332
|
+
return () => { window.clearInterval(retryTimer); unsub(); unsubSidebar(); window.removeEventListener("dsh-native-sidebar-change", sync); unwrap(); };
|
|
2317
2333
|
});
|
|
2318
2334
|
}
|
|
2319
2335
|
|
package/lib/client.js
CHANGED
|
@@ -2262,7 +2262,11 @@ window.__ModuleLoader__.load({
|
|
|
2262
2262
|
tabs.set(tab.id, tab);
|
|
2263
2263
|
rebuild();
|
|
2264
2264
|
emit();
|
|
2265
|
-
return () => {
|
|
2265
|
+
return () => {
|
|
2266
|
+
// 同名页签可能已被其他注册替换,旧清理函数只能移除自己持有的项。
|
|
2267
|
+
if (tabs.get(tab.id) !== tab) return;
|
|
2268
|
+
tabs.delete(tab.id); rebuild(); emit();
|
|
2269
|
+
};
|
|
2266
2270
|
},
|
|
2267
2271
|
addSessionFilter(filter) {
|
|
2268
2272
|
sessionFilters.push(filter);
|
|
@@ -2510,10 +2514,14 @@ window.__ModuleLoader__.load({
|
|
|
2510
2514
|
ctx.slots.inject("sidebar.workspaces", () => {
|
|
2511
2515
|
let wrappedEntry = null;
|
|
2512
2516
|
let originalComp = null;
|
|
2517
|
+
let ownedWrapper = null;
|
|
2518
|
+
let ownedRegistry = null;
|
|
2513
2519
|
let removeInsertedTab = () => {};
|
|
2514
2520
|
let stopInsertedTabLocale = () => {};
|
|
2515
2521
|
let insertedTabRegistry = null;
|
|
2516
2522
|
let syncing = false;
|
|
2523
|
+
// 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
|
|
2524
|
+
const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
|
|
2517
2525
|
const clearInsertedTab = () => {
|
|
2518
2526
|
stopInsertedTabLocale();
|
|
2519
2527
|
stopInsertedTabLocale = () => {};
|
|
@@ -2523,11 +2531,15 @@ window.__ModuleLoader__.load({
|
|
|
2523
2531
|
};
|
|
2524
2532
|
const unwrap = () => {
|
|
2525
2533
|
clearInsertedTab();
|
|
2526
|
-
if (wrappedEntry
|
|
2527
|
-
|
|
2534
|
+
if (wrappedEntry) {
|
|
2535
|
+
if (originalComp && wrappedEntry.component === ownedWrapper) wrappedEntry.component = originalComp;
|
|
2536
|
+
if (wrappedEntry.__dshNativeTabs === ownedRegistry) delete wrappedEntry.__dshNativeTabs;
|
|
2537
|
+
notifyPeers();
|
|
2528
2538
|
}
|
|
2529
2539
|
wrappedEntry = null;
|
|
2530
2540
|
originalComp = null;
|
|
2541
|
+
ownedWrapper = null;
|
|
2542
|
+
ownedRegistry = null;
|
|
2531
2543
|
};
|
|
2532
2544
|
const insertChannelTab = (entry) => {
|
|
2533
2545
|
const registry = findNativeTabRegistry(entry);
|
|
@@ -2570,21 +2582,21 @@ window.__ModuleLoader__.load({
|
|
|
2570
2582
|
const read = ctx.slots.entriesOfSlot || ctx.slots.entries;
|
|
2571
2583
|
const entries = (read && read.call(ctx.slots, "sidebar.workspaces")) || [];
|
|
2572
2584
|
const occupant = entries.find((item) => item && item.component);
|
|
2585
|
+
if (wrappedEntry && (occupant !== wrappedEntry || occupant.component !== ownedWrapper)) unwrap();
|
|
2586
|
+
if (!occupant) { clearInsertedTab(); return; }
|
|
2573
2587
|
if (occupant && (occupant.component.__dshNativeTabHost || occupant.component.__dshAutomationWrapped || findNativeTabRegistry(occupant))) {
|
|
2574
2588
|
insertChannelTab(occupant);
|
|
2575
2589
|
return;
|
|
2576
2590
|
}
|
|
2577
|
-
if (wrappedEntry && wrappedEntry.component && wrappedEntry.component.__imConnectWrapped) {
|
|
2578
|
-
insertChannelTab(wrappedEntry);
|
|
2579
|
-
return;
|
|
2580
|
-
}
|
|
2581
2591
|
const official = pickOfficialWorkspaces(ctx);
|
|
2582
2592
|
if (!official || official.component.__imConnectWrapped || official.component.__dshNativeTabHost) return;
|
|
2583
2593
|
originalComp = official.component;
|
|
2584
2594
|
const registry = createNativeTabRegistry(originalComp);
|
|
2595
|
+
ownedRegistry = registry;
|
|
2596
|
+
const tree = originalComp;
|
|
2585
2597
|
attachNativeTabRegistry(official, registry);
|
|
2586
2598
|
function ImNativeWorkspaceShell(innerProps) {
|
|
2587
|
-
return h(LocalizedSessionSwitcher, Object.assign({}, innerProps, { officialTree:
|
|
2599
|
+
return h(LocalizedSessionSwitcher, Object.assign({}, innerProps, { officialTree: tree, nativeTabs: registry }));
|
|
2588
2600
|
}
|
|
2589
2601
|
ImNativeWorkspaceShell.displayName = "ImNativeWorkspaceShell";
|
|
2590
2602
|
ImNativeWorkspaceShell.__imConnectWrapped = true;
|
|
@@ -2592,7 +2604,9 @@ window.__ModuleLoader__.load({
|
|
|
2592
2604
|
ImNativeWorkspaceShell.__dshNativeTabHost = true;
|
|
2593
2605
|
attachNativeTabRegistry(ImNativeWorkspaceShell, registry);
|
|
2594
2606
|
official.component = ImNativeWorkspaceShell;
|
|
2607
|
+
ownedWrapper = ImNativeWorkspaceShell;
|
|
2595
2608
|
wrappedEntry = official;
|
|
2609
|
+
notifyPeers();
|
|
2596
2610
|
} catch (error) {
|
|
2597
2611
|
console.warn("[dsh-im-connect] 包裹官方任务树失败", error);
|
|
2598
2612
|
} finally {
|
|
@@ -2601,13 +2615,15 @@ window.__ModuleLoader__.load({
|
|
|
2601
2615
|
};
|
|
2602
2616
|
sync();
|
|
2603
2617
|
const unsub = typeof ctx.slots.subscribe === "function" ? ctx.slots.subscribe("sidebar.workspaces", sync) : () => {};
|
|
2618
|
+
const unsubSidebar = typeof ctx.slots.subscribe === "function" ? ctx.slots.subscribe("sidebar", sync) : () => {};
|
|
2619
|
+
window.addEventListener("dsh-native-sidebar-change", sync);
|
|
2604
2620
|
// 其他插件直接替换 component/注册表时不一定触发槽位通知,短暂重试兼容加载顺序。
|
|
2605
2621
|
let retries = 0;
|
|
2606
2622
|
const retryTimer = window.setInterval(() => {
|
|
2607
2623
|
sync();
|
|
2608
2624
|
if (insertedTabRegistry || ++retries >= 20) window.clearInterval(retryTimer);
|
|
2609
2625
|
}, 250);
|
|
2610
|
-
return () => { window.clearInterval(retryTimer); unsub(); unwrap(); };
|
|
2626
|
+
return () => { window.clearInterval(retryTimer); unsub(); unsubSidebar(); window.removeEventListener("dsh-native-sidebar-change", sync); unwrap(); };
|
|
2611
2627
|
});
|
|
2612
2628
|
}
|
|
2613
2629
|
|