@michengai/dsh-im-connect 1.0.44 → 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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## [1.0.44] - 2026-11-17
4
10
 
5
11
  ### Feishu & Lark Thread Session Settings Experience
@@ -1,5 +1,11 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.0.45] - 2026-11-18
4
+
5
+ ### 侧栏页签单层布局与可视高度修复
6
+
7
+ - **侧栏页签防多层堆叠优化(#73)**:修复在插件重复加载或界面重入时,侧栏偶现渲染多层页签条、挤压下方工作区与会话列表可视高度的问题。侧栏页签条在任何刷新与视图切换场景下均严格保持为单层分段栏,会话列表展示完整不被遮挡。
8
+
3
9
  ## [1.0.44] - 2026-11-17
4
10
 
5
11
  ### 飞书与 Lark 会话隔离设置体验
package/client.js CHANGED
@@ -6214,6 +6214,8 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
6214
6214
  function pickOfficialWorkspaces(ctx) {
6215
6215
  const read = ctx.slots.entriesOfSlot || ctx.slots.entries;
6216
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;
6217
6219
  for (const item of entries) {
6218
6220
  if (!item || !item.component) continue;
6219
6221
  if (isWrappedWorkspaceComponent(item.component)) continue;
@@ -6231,6 +6233,25 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
6231
6233
  || component.__dshAutomationOriginal !== undefined);
6232
6234
  }
6233
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
+
6234
6255
  const BUNDLE_KEY = "@michengai/dsh-im-connect";
6235
6256
  const SIDEBAR_PANEL_ID = "im-connect";
6236
6257
  const SIDEBAR_PANEL_ORDER = 3;
@@ -7031,6 +7052,22 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7031
7052
  let stopInsertedTabLocale = () => {};
7032
7053
  let insertedTabRegistry = null;
7033
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
+ };
7034
7071
  // 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
7035
7072
  const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
7036
7073
  const clearFilter = () => {
@@ -7104,6 +7141,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7104
7141
  };
7105
7142
  const unwrap = () => {
7106
7143
  clearInsertedTab();
7144
+ releaseOwnership();
7107
7145
  clearFilter();
7108
7146
  activeFilterRegistry = null;
7109
7147
  if (wrappedEntry) {
@@ -7165,6 +7203,13 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7165
7203
  };
7166
7204
  const sync = () => {
7167
7205
  if (syncing) return;
7206
+ if (isDuplicateOwner()) {
7207
+ if (!warnedDuplicate) {
7208
+ warnedDuplicate = true;
7209
+ console.warn("[dsh-im-connect] 检测到同模块已有活跃的侧栏实例,跳过重复包装与页签注入");
7210
+ }
7211
+ return;
7212
+ }
7168
7213
  syncing = true;
7169
7214
  try {
7170
7215
  const combo = hasDshCodexUiSidebar(ctx);
@@ -7179,12 +7224,37 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7179
7224
  if (!occupant) { clearInsertedTab(); return; }
7180
7225
  if (insertedTabRegistry && findNativeTabRegistry(occupant) !== insertedTabRegistry) clearInsertedTab();
7181
7226
  if (occupant && (occupant.component.__dshNativeTabHost || occupant.component.__dshNativeTabWrapped || occupant.component.__dshAutomationWrapped || findNativeTabRegistry(occupant))) {
7227
+ claimOwnership();
7182
7228
  insertChannelTab(occupant);
7183
7229
  return;
7184
7230
  }
7185
7231
  const official = pickOfficialWorkspaces(ctx);
7186
7232
  if (!official) return;
7187
- originalComp = official.component;
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();
7188
7258
  const registry = createNativeTabRegistry(originalComp);
7189
7259
  ownedRegistry = registry;
7190
7260
  removeInsertedOpener = installSessionOpener(registry);
@@ -7230,6 +7300,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7230
7300
  unsubSidebar();
7231
7301
  window.removeEventListener("dsh-native-sidebar-change", sync);
7232
7302
  unwrap();
7303
+ releaseOwnership();
7233
7304
  };
7234
7305
  });
7235
7306
  }
package/lib/client.js CHANGED
@@ -6260,6 +6260,8 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
6260
6260
  function pickOfficialWorkspaces(ctx) {
6261
6261
  const read = ctx.slots.entriesOfSlot || ctx.slots.entries;
6262
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;
6263
6265
  for (const item of entries) {
6264
6266
  if (!item || !item.component) continue;
6265
6267
  if (isWrappedWorkspaceComponent(item.component)) continue;
@@ -6277,6 +6279,25 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
6277
6279
  || component.__dshAutomationOriginal !== undefined);
6278
6280
  }
6279
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
+
6280
6301
  const BUNDLE_KEY = "@michengai/dsh-im-connect";
6281
6302
  const SIDEBAR_PANEL_ID = "im-connect";
6282
6303
  const SIDEBAR_PANEL_ORDER = 3;
@@ -7077,6 +7098,22 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7077
7098
  let stopInsertedTabLocale = () => {};
7078
7099
  let insertedTabRegistry = null;
7079
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
+ };
7080
7117
  // 与定时插件共享通知,补足直接替换 component 不触发宿主插槽通知的情况。
7081
7118
  const notifyPeers = () => { queueMicrotask(() => window.dispatchEvent(new Event("dsh-native-sidebar-change"))); };
7082
7119
  const clearFilter = () => {
@@ -7150,6 +7187,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7150
7187
  };
7151
7188
  const unwrap = () => {
7152
7189
  clearInsertedTab();
7190
+ releaseOwnership();
7153
7191
  clearFilter();
7154
7192
  activeFilterRegistry = null;
7155
7193
  if (wrappedEntry) {
@@ -7211,6 +7249,13 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7211
7249
  };
7212
7250
  const sync = () => {
7213
7251
  if (syncing) return;
7252
+ if (isDuplicateOwner()) {
7253
+ if (!warnedDuplicate) {
7254
+ warnedDuplicate = true;
7255
+ console.warn("[dsh-im-connect] 检测到同模块已有活跃的侧栏实例,跳过重复包装与页签注入");
7256
+ }
7257
+ return;
7258
+ }
7214
7259
  syncing = true;
7215
7260
  try {
7216
7261
  const combo = hasDshCodexUiSidebar(ctx);
@@ -7225,12 +7270,37 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7225
7270
  if (!occupant) { clearInsertedTab(); return; }
7226
7271
  if (insertedTabRegistry && findNativeTabRegistry(occupant) !== insertedTabRegistry) clearInsertedTab();
7227
7272
  if (occupant && (occupant.component.__dshNativeTabHost || occupant.component.__dshNativeTabWrapped || occupant.component.__dshAutomationWrapped || findNativeTabRegistry(occupant))) {
7273
+ claimOwnership();
7228
7274
  insertChannelTab(occupant);
7229
7275
  return;
7230
7276
  }
7231
7277
  const official = pickOfficialWorkspaces(ctx);
7232
7278
  if (!official) return;
7233
- originalComp = official.component;
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();
7234
7304
  const registry = createNativeTabRegistry(originalComp);
7235
7305
  ownedRegistry = registry;
7236
7306
  removeInsertedOpener = installSessionOpener(registry);
@@ -7276,6 +7346,7 @@ body:not([data-ds-dark-theme]) .ima-section-card{background:var(--dsw-alias-bg-l
7276
7346
  unsubSidebar();
7277
7347
  window.removeEventListener("dsh-native-sidebar-change", sync);
7278
7348
  unwrap();
7349
+ releaseOwnership();
7279
7350
  };
7280
7351
  });
7281
7352
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-im-connect",
3
- "version": "1.0.44",
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",