@michengai/dsh-im-connect 1.0.33 → 1.0.34

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.34] - 2026-11-09
4
+
5
+ ### Mobile sidebar interaction & channel session routing improvements
6
+
7
+ - Fix session opening from inserted channel tabs on mobile: clicking an IM channel session row in mobile drawers or external sidebar shells now properly restores and switches into the IM conversation, instead of falling back to a regular task session (#65).
8
+ - Fix duplicate icon display in mobile drawer navigation: when viewing sidebar shortcuts within mobile drawer sheets, the IM assistant entry cleanly displays its single icon with natural spacing, avoiding duplicate icon rendering.
9
+
3
10
  ## [1.0.33] - 2026-11-09
4
11
 
5
12
  ### Clean header navigation & documentation streamlining
@@ -1,5 +1,12 @@
1
1
  # 更新日志
2
2
 
3
+ ## [1.0.34] - 2026-11-09
4
+
5
+ ### 移动端侧栏交互与频道会话打开体验优化
6
+
7
+ - 修复移动端下频道会话点击无法进入的问题:在手机端或抽屉外壳中展开「频道」页签时,点击任意即时通讯会话行,能够准确唤起并进入对应的通讯对话,不再被误当成普通任务会话(#65)。
8
+ - 修复移动端抽屉下侧栏快捷入口显示双图标的问题:在移动端或浮层抽屉中展开左侧导航时,即时通讯管理入口恢复单枚专属图标与自然文字间距,不再重复渲染两个图标。
9
+
3
10
  ## [1.0.33] - 2026-11-09
4
11
 
5
12
  ### 文档导航布局优化与内部入口精简
package/client.js CHANGED
@@ -5787,6 +5787,18 @@ window.__ModuleLoader__.load({
5787
5787
  }
5788
5788
  }
5789
5789
 
5790
+ function createImSessionOpener(registry, hostOpen, getSessionById) {
5791
+ return (id) => {
5792
+ if (registry && Array.isArray(registry.sessionOpeners)
5793
+ && registry.sessionOpeners.some((item) => item && item.id === "im-connect")) {
5794
+ openRegisteredSession(id, registry, hostOpen);
5795
+ return;
5796
+ }
5797
+ const byId = typeof getSessionById === "function" ? getSessionById() : getSessionById;
5798
+ openListedSession(resolveHostSessionId(id, byId), hostOpen);
5799
+ };
5800
+ }
5801
+
5790
5802
  function createNativeTabRegistry(officialTree) {
5791
5803
  const tabs = new Map();
5792
5804
  const sessionFilters = [];
@@ -5926,18 +5938,10 @@ window.__ModuleLoader__.load({
5926
5938
  previousCurrentId.current = followed.previousId;
5927
5939
  if (followed.tab) setTab(followed.tab);
5928
5940
  }, [currentId, extraTabs, membershipRevision]);
5929
- const hostOpen = props.openSession || props.open;
5930
- const openListed = (id) => {
5931
- openListedSession(resolveHostSessionId(id, sessionById), hostOpen);
5932
- };
5933
- const openSession = (id) => {
5934
- if (nativeTabs && Array.isArray(nativeTabs.sessionOpeners)
5935
- && nativeTabs.sessionOpeners.some((item) => item && item.id === "im-connect")) {
5936
- openRegisteredSession(id, nativeTabs, hostOpen);
5937
- return;
5938
- }
5939
- openListed(id);
5940
- };
5941
+ const hostOpen = typeof props.openSession === "function"
5942
+ ? props.openSession
5943
+ : (typeof props.open === "function" ? props.open : undefined);
5944
+ const openSession = createImSessionOpener(nativeTabs, hostOpen, sessionById);
5941
5945
  const safeExpandSidebar = useCallback(() => {}, []);
5942
5946
  const rawUseWorkspaceShortcuts = typeof props.useWorkspaceShortcuts === "function" ? props.useWorkspaceShortcuts : undefined;
5943
5947
  const useIsolatedWorkspaceShortcuts = useCallback((select, equals) => {
@@ -6612,7 +6616,7 @@ window.__ModuleLoader__.load({
6612
6616
  const QUEUE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">${QUEUE_ICON_PATHS}</svg>`;
6613
6617
  const QUEUE_ICON_MASK = `url("data:image/svg+xml,${encodeURIComponent(QUEUE_ICON_SVG)}")`;
6614
6618
 
6615
- const NAV_ICON_CSS = `[${NAV_ICON_MARKER}]>svg{display:none!important}[${NAV_ICON_MARKER}]::before{content:'';flex:none;width:16px;height:16px;background-color:currentColor;-webkit-mask:${QUEUE_ICON_MASK} center/contain no-repeat;mask:${QUEUE_ICON_MASK} center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}`;
6619
+ const NAV_ICON_CSS = `[${NAV_ICON_MARKER}]>svg{display:none!important}[${NAV_ICON_MARKER}]::before{content:'';flex:none;width:16px;height:16px;background-color:currentColor;-webkit-mask:${QUEUE_ICON_MASK} center/contain no-repeat;mask:${QUEUE_ICON_MASK} center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}.dcu-sb-row[${NAV_ICON_MARKER}]::before{content:none!important}`;
6616
6620
 
6617
6621
  function ensureNavIconStyle(doc) {
6618
6622
  const targetDoc = doc || (typeof document !== "undefined" ? document : null);
@@ -6635,6 +6639,20 @@ window.__ModuleLoader__.load({
6635
6639
  return String(label ?? "").trim();
6636
6640
  }
6637
6641
 
6642
+ function isSidebarNavButton(button) {
6643
+ if (!button) return false;
6644
+ if (typeof button.matches === "function") {
6645
+ if (button.matches('.dcu-sb-row, [data-dcu-panel-id], button[class*="panelRow"]')) return true;
6646
+ }
6647
+ if (typeof button.closest === "function") {
6648
+ if (button.closest('.dcu-sidebar-nav-root, .dcu-sb-root, [data-dcu-managed], [data-dcu-sidebar-active], [data-slot="sidebar"], div[class*="SidebarRoot_root"]')) return true;
6649
+ }
6650
+ const cls = String(button.className || "");
6651
+ if (cls.includes("dcu-sb-row") || cls.includes("panelRow")) return true;
6652
+ if (typeof button.hasAttribute === "function" && button.hasAttribute("data-dcu-panel-id")) return true;
6653
+ return false;
6654
+ }
6655
+
6638
6656
  function isOwnNavRow(rowText, wantedLabel) {
6639
6657
  const normRow = String(rowText ?? "").replace(/\s+/g, "").toLowerCase();
6640
6658
  if (normRow.length === 0) return false;
@@ -6647,11 +6665,21 @@ window.__ModuleLoader__.load({
6647
6665
  }
6648
6666
 
6649
6667
  function applySettingsNavIcon(button, wantedLabel) {
6668
+ if (isSidebarNavButton(button)) {
6669
+ if (button.hasAttribute(NAV_ICON_MARKER)) {
6670
+ button.removeAttribute(NAV_ICON_MARKER);
6671
+ return true;
6672
+ }
6673
+ return false;
6674
+ }
6650
6675
  const isOwn = isOwnNavRow(getNavButtonText(button), typeof wantedLabel === "function" ? wantedLabel() : wantedLabel);
6651
6676
  if (isOwn) {
6652
- const hasSlotIcon = Array.from((button && button.children) || []).some((child) =>
6653
- child.tagName === "SPAN" && child.className && String(child.className).includes("navIcon")
6654
- ) || Boolean(button && typeof button.querySelector === "function" && button.querySelector('span[class*="navIcon"]'));
6677
+ const hasSlotIcon = Array.from((button && button.children) || []).some((child) => {
6678
+ if (!child || child.tagName !== "SPAN") return false;
6679
+ const cls = String(child.className || "");
6680
+ const ariaHidden = typeof child.getAttribute === "function" ? child.getAttribute("aria-hidden") : null;
6681
+ return cls.includes("navIcon") || cls.includes("glyph") || cls.includes("dcu-sb-") || ariaHidden === "true";
6682
+ }) || Boolean(button && typeof button.querySelector === "function" && button.querySelector('span[class*="navIcon"], span[class*="glyph"], [class*="dcu-sb-glyph"]'));
6655
6683
  if (hasSlotIcon) {
6656
6684
  if (button.hasAttribute(NAV_ICON_MARKER)) {
6657
6685
  button.removeAttribute(NAV_ICON_MARKER);
@@ -6992,19 +7020,29 @@ window.__ModuleLoader__.load({
6992
7020
  label: t("rail.channels"),
6993
7021
  order: 20,
6994
7022
  matchSession: isChannelSession,
6995
- render: (props) => h(ImSidebarFallbackBoundary, {
6996
- officialTree: () => h(ChannelUnavailable, { t }),
6997
- hostProps: props,
6998
- }, h(ChannelOfficialView, Object.assign({}, props, {
6999
- officialTree: registry.officialTree,
7000
- hostProps: props,
7001
- hostT: props.officialT || props.t,
7002
- t,
7003
- openChannelSettings,
7004
- openImSettings,
7005
- archiveSession: props.archiveSession || ((id, options) => archiveHostSession(ctx, id, options)),
7006
- unarchiveSession: props.unarchiveSession || ((id) => unarchiveHostSession(ctx, id)),
7007
- }))),
7023
+ render: (props) => {
7024
+ const hostOpen = typeof props.openSession === "function"
7025
+ ? props.openSession
7026
+ : (typeof props.open === "function" ? props.open : undefined);
7027
+ const openSession = createImSessionOpener(registry, hostOpen, () => {
7028
+ try { return ctx.sessions && ctx.sessions.list && ctx.sessions.list.getSnapshot ? ctx.sessions.list.getSnapshot().byId : undefined; } catch { return undefined; }
7029
+ });
7030
+ return h(ImSidebarFallbackBoundary, {
7031
+ officialTree: () => h(ChannelUnavailable, { t }),
7032
+ hostProps: props,
7033
+ }, h(ChannelOfficialView, Object.assign({}, props, {
7034
+ officialTree: registry.officialTree,
7035
+ hostProps: props,
7036
+ hostT: props.officialT || props.t,
7037
+ t,
7038
+ openSession,
7039
+ open: openSession,
7040
+ openChannelSettings,
7041
+ openImSettings,
7042
+ archiveSession: props.archiveSession || ((id, options) => archiveHostSession(ctx, id, options)),
7043
+ unarchiveSession: props.unarchiveSession || ((id) => unarchiveHostSession(ctx, id)),
7044
+ })));
7045
+ },
7008
7046
  });
7009
7047
  };
7010
7048
  refreshInsertedTab();
package/lib/client.js CHANGED
@@ -5833,6 +5833,18 @@ function resolveApiUrl(path) {
5833
5833
  }
5834
5834
  }
5835
5835
 
5836
+ function createImSessionOpener(registry, hostOpen, getSessionById) {
5837
+ return (id) => {
5838
+ if (registry && Array.isArray(registry.sessionOpeners)
5839
+ && registry.sessionOpeners.some((item) => item && item.id === "im-connect")) {
5840
+ openRegisteredSession(id, registry, hostOpen);
5841
+ return;
5842
+ }
5843
+ const byId = typeof getSessionById === "function" ? getSessionById() : getSessionById;
5844
+ openListedSession(resolveHostSessionId(id, byId), hostOpen);
5845
+ };
5846
+ }
5847
+
5836
5848
  function createNativeTabRegistry(officialTree) {
5837
5849
  const tabs = new Map();
5838
5850
  const sessionFilters = [];
@@ -5972,18 +5984,10 @@ function resolveApiUrl(path) {
5972
5984
  previousCurrentId.current = followed.previousId;
5973
5985
  if (followed.tab) setTab(followed.tab);
5974
5986
  }, [currentId, extraTabs, membershipRevision]);
5975
- const hostOpen = props.openSession || props.open;
5976
- const openListed = (id) => {
5977
- openListedSession(resolveHostSessionId(id, sessionById), hostOpen);
5978
- };
5979
- const openSession = (id) => {
5980
- if (nativeTabs && Array.isArray(nativeTabs.sessionOpeners)
5981
- && nativeTabs.sessionOpeners.some((item) => item && item.id === "im-connect")) {
5982
- openRegisteredSession(id, nativeTabs, hostOpen);
5983
- return;
5984
- }
5985
- openListed(id);
5986
- };
5987
+ const hostOpen = typeof props.openSession === "function"
5988
+ ? props.openSession
5989
+ : (typeof props.open === "function" ? props.open : undefined);
5990
+ const openSession = createImSessionOpener(nativeTabs, hostOpen, sessionById);
5987
5991
  const safeExpandSidebar = useCallback(() => {}, []);
5988
5992
  const rawUseWorkspaceShortcuts = typeof props.useWorkspaceShortcuts === "function" ? props.useWorkspaceShortcuts : undefined;
5989
5993
  const useIsolatedWorkspaceShortcuts = useCallback((select, equals) => {
@@ -6658,7 +6662,7 @@ function resolveApiUrl(path) {
6658
6662
  const QUEUE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" stroke="black" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round">${QUEUE_ICON_PATHS}</svg>`;
6659
6663
  const QUEUE_ICON_MASK = `url("data:image/svg+xml,${encodeURIComponent(QUEUE_ICON_SVG)}")`;
6660
6664
 
6661
- const NAV_ICON_CSS = `[${NAV_ICON_MARKER}]>svg{display:none!important}[${NAV_ICON_MARKER}]::before{content:'';flex:none;width:16px;height:16px;background-color:currentColor;-webkit-mask:${QUEUE_ICON_MASK} center/contain no-repeat;mask:${QUEUE_ICON_MASK} center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}`;
6665
+ const NAV_ICON_CSS = `[${NAV_ICON_MARKER}]>svg{display:none!important}[${NAV_ICON_MARKER}]::before{content:'';flex:none;width:16px;height:16px;background-color:currentColor;-webkit-mask:${QUEUE_ICON_MASK} center/contain no-repeat;mask:${QUEUE_ICON_MASK} center/contain no-repeat;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:16px 16px;mask-size:16px 16px}.dcu-sb-row[${NAV_ICON_MARKER}]::before{content:none!important}`;
6662
6666
 
6663
6667
  function ensureNavIconStyle(doc) {
6664
6668
  const targetDoc = doc || (typeof document !== "undefined" ? document : null);
@@ -6681,6 +6685,20 @@ function resolveApiUrl(path) {
6681
6685
  return String(label ?? "").trim();
6682
6686
  }
6683
6687
 
6688
+ function isSidebarNavButton(button) {
6689
+ if (!button) return false;
6690
+ if (typeof button.matches === "function") {
6691
+ if (button.matches('.dcu-sb-row, [data-dcu-panel-id], button[class*="panelRow"]')) return true;
6692
+ }
6693
+ if (typeof button.closest === "function") {
6694
+ if (button.closest('.dcu-sidebar-nav-root, .dcu-sb-root, [data-dcu-managed], [data-dcu-sidebar-active], [data-slot="sidebar"], div[class*="SidebarRoot_root"]')) return true;
6695
+ }
6696
+ const cls = String(button.className || "");
6697
+ if (cls.includes("dcu-sb-row") || cls.includes("panelRow")) return true;
6698
+ if (typeof button.hasAttribute === "function" && button.hasAttribute("data-dcu-panel-id")) return true;
6699
+ return false;
6700
+ }
6701
+
6684
6702
  function isOwnNavRow(rowText, wantedLabel) {
6685
6703
  const normRow = String(rowText ?? "").replace(/\s+/g, "").toLowerCase();
6686
6704
  if (normRow.length === 0) return false;
@@ -6693,11 +6711,21 @@ function resolveApiUrl(path) {
6693
6711
  }
6694
6712
 
6695
6713
  function applySettingsNavIcon(button, wantedLabel) {
6714
+ if (isSidebarNavButton(button)) {
6715
+ if (button.hasAttribute(NAV_ICON_MARKER)) {
6716
+ button.removeAttribute(NAV_ICON_MARKER);
6717
+ return true;
6718
+ }
6719
+ return false;
6720
+ }
6696
6721
  const isOwn = isOwnNavRow(getNavButtonText(button), typeof wantedLabel === "function" ? wantedLabel() : wantedLabel);
6697
6722
  if (isOwn) {
6698
- const hasSlotIcon = Array.from((button && button.children) || []).some((child) =>
6699
- child.tagName === "SPAN" && child.className && String(child.className).includes("navIcon")
6700
- ) || Boolean(button && typeof button.querySelector === "function" && button.querySelector('span[class*="navIcon"]'));
6723
+ const hasSlotIcon = Array.from((button && button.children) || []).some((child) => {
6724
+ if (!child || child.tagName !== "SPAN") return false;
6725
+ const cls = String(child.className || "");
6726
+ const ariaHidden = typeof child.getAttribute === "function" ? child.getAttribute("aria-hidden") : null;
6727
+ return cls.includes("navIcon") || cls.includes("glyph") || cls.includes("dcu-sb-") || ariaHidden === "true";
6728
+ }) || Boolean(button && typeof button.querySelector === "function" && button.querySelector('span[class*="navIcon"], span[class*="glyph"], [class*="dcu-sb-glyph"]'));
6701
6729
  if (hasSlotIcon) {
6702
6730
  if (button.hasAttribute(NAV_ICON_MARKER)) {
6703
6731
  button.removeAttribute(NAV_ICON_MARKER);
@@ -7038,19 +7066,29 @@ function resolveApiUrl(path) {
7038
7066
  label: t("rail.channels"),
7039
7067
  order: 20,
7040
7068
  matchSession: isChannelSession,
7041
- render: (props) => h(ImSidebarFallbackBoundary, {
7042
- officialTree: () => h(ChannelUnavailable, { t }),
7043
- hostProps: props,
7044
- }, h(ChannelOfficialView, Object.assign({}, props, {
7045
- officialTree: registry.officialTree,
7046
- hostProps: props,
7047
- hostT: props.officialT || props.t,
7048
- t,
7049
- openChannelSettings,
7050
- openImSettings,
7051
- archiveSession: props.archiveSession || ((id, options) => archiveHostSession(ctx, id, options)),
7052
- unarchiveSession: props.unarchiveSession || ((id) => unarchiveHostSession(ctx, id)),
7053
- }))),
7069
+ render: (props) => {
7070
+ const hostOpen = typeof props.openSession === "function"
7071
+ ? props.openSession
7072
+ : (typeof props.open === "function" ? props.open : undefined);
7073
+ const openSession = createImSessionOpener(registry, hostOpen, () => {
7074
+ try { return ctx.sessions && ctx.sessions.list && ctx.sessions.list.getSnapshot ? ctx.sessions.list.getSnapshot().byId : undefined; } catch { return undefined; }
7075
+ });
7076
+ return h(ImSidebarFallbackBoundary, {
7077
+ officialTree: () => h(ChannelUnavailable, { t }),
7078
+ hostProps: props,
7079
+ }, h(ChannelOfficialView, Object.assign({}, props, {
7080
+ officialTree: registry.officialTree,
7081
+ hostProps: props,
7082
+ hostT: props.officialT || props.t,
7083
+ t,
7084
+ openSession,
7085
+ open: openSession,
7086
+ openChannelSettings,
7087
+ openImSettings,
7088
+ archiveSession: props.archiveSession || ((id, options) => archiveHostSession(ctx, id, options)),
7089
+ unarchiveSession: props.unarchiveSession || ((id) => unarchiveHostSession(ctx, id)),
7090
+ })));
7091
+ },
7054
7092
  });
7055
7093
  };
7056
7094
  refreshInsertedTab();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-im-connect",
3
- "version": "1.0.33",
3
+ "version": "1.0.34",
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",