@michengai/dsh-im-connect 0.1.66 → 0.1.67

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
@@ -6,6 +6,11 @@ Recent published versions are listed below. Git tags and GitHub Releases now mir
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 0.1.67 - 2026-10-08
10
+
11
+ - Creating a session from the channels tab returns the sidebar to Tasks, including the host New session button. Channels cannot hold a newly created task, and a refresh no longer leaves that task hidden on Channels (#23).
12
+ - Restart DSH and refresh the page after upgrading.
13
+
9
14
  ## 0.1.66 - 2026-10-07
10
15
 
11
16
  - Each connected account can have a local name remark. Click the account name on the settings row, or edit it in account settings. The remark is display-only. Leaving it blank restores the original automatic number instead of renumbering by the current account count. Remarks longer than 40 characters or containing line breaks are rejected.
@@ -6,6 +6,11 @@
6
6
 
7
7
  ## 未发布
8
8
 
9
+ ## 0.1.67 - 2026-10-08
10
+
11
+ - 在频道页签里新建会话后,侧栏会回到「任务」,包括宿主的「新会话」按钮。频道里不能放新建的普通会话;刷新后也不会再把这条任务藏在「频道」里(#23)。
12
+ - 升级后请重启 DSH 并刷新页面。
13
+
9
14
  ## 0.1.66 - 2026-10-07
10
15
 
11
16
  - 设置页可以为每个已接入账号填写名称备注,账号行点击名称即可修改。备注只在本机显示,用来区分使用者;留空恢复原来的自动序号,不会按当前账号数重编。超过 40 个字符或包含换行会被拒绝。
package/client.js CHANGED
@@ -591,6 +591,29 @@ window.__ModuleLoader__.load({
591
591
  };
592
592
  const channelMembershipSnapshot = () => channelMembershipRevision;
593
593
 
594
+ /** 频道不能新建普通会话。当前会话决定侧栏该停在哪一页;定时页签自己认领的不抢。 */
595
+ function sidebarTabForSession(currentId, extraTabs) {
596
+ if (typeof currentId !== "string" || currentId === "") return null;
597
+ const matched = (extraTabs || []).find((item) => item && item.matchSession && item.matchSession(currentId));
598
+ if (matched && matched.id !== "schedule") return matched.id;
599
+ if (isChannelSession(currentId)) return "channels";
600
+ if (matched) return null;
601
+ return "tasks";
602
+ }
603
+
604
+ function followSidebarTab(state, currentId, extraTabs) {
605
+ const ready = !!(state && state.ready);
606
+ const next = sidebarTabForSession(currentId, extraTabs);
607
+ if (!ready) return { ready: true, previousId: currentId, tab: next };
608
+ if (typeof currentId !== "string" || currentId === "") return { ready: true, previousId: currentId, tab: null };
609
+ if (currentId === state.previousId && !isChannelSession(currentId)) return { ready: true, previousId: currentId, tab: null };
610
+ return { ready: true, previousId: currentId, tab: next };
611
+ }
612
+
613
+ function isHostNewSessionControl(label) {
614
+ return /新会话|新建任务|New chat|New session/i.test(String(label || ""));
615
+ }
616
+
594
617
  const api = (path, opts) => {
595
618
  // 管理路由复用宿主登录 Cookie,不缓存账号状态或认证错误。
596
619
  const request = Object.assign({}, opts || {}, { credentials: "same-origin", cache: "no-store" });
@@ -2888,7 +2911,9 @@ window.__ModuleLoader__.load({
2888
2911
  const sessionSnap = typeof rawUseSessions === "function"
2889
2912
  ? rawUseSessions((state) => state)
2890
2913
  : undefined;
2891
- const currentId = sessionSnap ? currentSessionId(sessionSnap) : (props.selectedId || null);
2914
+ const currentId = typeof rawUseSessions === "function"
2915
+ ? rawUseSessions((state) => currentSessionId(state))
2916
+ : (props.selectedId || null);
2892
2917
  const sessionById = (sessionSnap && sessionSnap.byId) || {};
2893
2918
  const useTaskSessions = useCallback((selector, eq) => {
2894
2919
  if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
@@ -2900,21 +2925,27 @@ window.__ModuleLoader__.load({
2900
2925
  }, [rawUseSessions, membershipRevision]);
2901
2926
  useEffect(() => { ensureStyle(); }, []);
2902
2927
  useEffect(() => { try { localStorage.setItem(TAB_KEY, tab); } catch { /* ignore */ } }, [tab]);
2928
+ useEffect(() => {
2929
+ const onClick = (event) => {
2930
+ const target = event.target && event.target.closest ? event.target.closest("button") : null;
2931
+ if (!target) return;
2932
+ const label = (target.innerText || "") + " " + (target.getAttribute("aria-label") || "");
2933
+ if (isHostNewSessionControl(label)) setTab("tasks");
2934
+ };
2935
+ document.addEventListener("click", onClick, true);
2936
+ return () => document.removeEventListener("click", onClick, true);
2937
+ }, []);
2903
2938
  const previousCurrentId = useRef(currentId);
2904
2939
  const tabFollowReady = useRef(false);
2905
2940
  useEffect(() => {
2906
- if (!tabFollowReady.current) {
2907
- tabFollowReady.current = true;
2908
- previousCurrentId.current = currentId;
2909
- return;
2910
- }
2911
- const previous = previousCurrentId.current;
2912
- previousCurrentId.current = currentId;
2913
- if (typeof currentId !== "string" || currentId === "") return;
2914
- if (currentId === previous && !isChannelSession(currentId)) return;
2915
- if (isChannelSession(currentId)) setTab("channels");
2916
- const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
2917
- if (matched && matched.id !== "schedule") setTab(matched.id);
2941
+ const followed = followSidebarTab(
2942
+ { ready: tabFollowReady.current, previousId: previousCurrentId.current },
2943
+ currentId,
2944
+ extraTabs,
2945
+ );
2946
+ tabFollowReady.current = followed.ready;
2947
+ previousCurrentId.current = followed.previousId;
2948
+ if (followed.tab) setTab(followed.tab);
2918
2949
  }, [currentId, extraTabs, membershipRevision]);
2919
2950
  const openSession = (id) => {
2920
2951
  openListedSession(resolveHostSessionId(id, sessionById), props.openSession || props.open);
package/lib/client.js CHANGED
@@ -1107,6 +1107,29 @@ react-is/cjs/react-is.production.js:
1107
1107
  };
1108
1108
  const channelMembershipSnapshot = () => channelMembershipRevision;
1109
1109
 
1110
+ /** 频道不能新建普通会话。当前会话决定侧栏该停在哪一页;定时页签自己认领的不抢。 */
1111
+ function sidebarTabForSession(currentId, extraTabs) {
1112
+ if (typeof currentId !== "string" || currentId === "") return null;
1113
+ const matched = (extraTabs || []).find((item) => item && item.matchSession && item.matchSession(currentId));
1114
+ if (matched && matched.id !== "schedule") return matched.id;
1115
+ if (isChannelSession(currentId)) return "channels";
1116
+ if (matched) return null;
1117
+ return "tasks";
1118
+ }
1119
+
1120
+ function followSidebarTab(state, currentId, extraTabs) {
1121
+ const ready = !!(state && state.ready);
1122
+ const next = sidebarTabForSession(currentId, extraTabs);
1123
+ if (!ready) return { ready: true, previousId: currentId, tab: next };
1124
+ if (typeof currentId !== "string" || currentId === "") return { ready: true, previousId: currentId, tab: null };
1125
+ if (currentId === state.previousId && !isChannelSession(currentId)) return { ready: true, previousId: currentId, tab: null };
1126
+ return { ready: true, previousId: currentId, tab: next };
1127
+ }
1128
+
1129
+ function isHostNewSessionControl(label) {
1130
+ return /新会话|新建任务|New chat|New session/i.test(String(label || ""));
1131
+ }
1132
+
1110
1133
  const api = (path, opts) => {
1111
1134
  // 管理路由复用宿主登录 Cookie,不缓存账号状态或认证错误。
1112
1135
  const request = Object.assign({}, opts || {}, { credentials: "same-origin", cache: "no-store" });
@@ -3404,7 +3427,9 @@ react-is/cjs/react-is.production.js:
3404
3427
  const sessionSnap = typeof rawUseSessions === "function"
3405
3428
  ? rawUseSessions((state) => state)
3406
3429
  : undefined;
3407
- const currentId = sessionSnap ? currentSessionId(sessionSnap) : (props.selectedId || null);
3430
+ const currentId = typeof rawUseSessions === "function"
3431
+ ? rawUseSessions((state) => currentSessionId(state))
3432
+ : (props.selectedId || null);
3408
3433
  const sessionById = (sessionSnap && sessionSnap.byId) || {};
3409
3434
  const useTaskSessions = useCallback((selector, eq) => {
3410
3435
  if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
@@ -3416,21 +3441,27 @@ react-is/cjs/react-is.production.js:
3416
3441
  }, [rawUseSessions, membershipRevision]);
3417
3442
  useEffect(() => { ensureStyle(); }, []);
3418
3443
  useEffect(() => { try { localStorage.setItem(TAB_KEY, tab); } catch { /* ignore */ } }, [tab]);
3444
+ useEffect(() => {
3445
+ const onClick = (event) => {
3446
+ const target = event.target && event.target.closest ? event.target.closest("button") : null;
3447
+ if (!target) return;
3448
+ const label = (target.innerText || "") + " " + (target.getAttribute("aria-label") || "");
3449
+ if (isHostNewSessionControl(label)) setTab("tasks");
3450
+ };
3451
+ document.addEventListener("click", onClick, true);
3452
+ return () => document.removeEventListener("click", onClick, true);
3453
+ }, []);
3419
3454
  const previousCurrentId = useRef(currentId);
3420
3455
  const tabFollowReady = useRef(false);
3421
3456
  useEffect(() => {
3422
- if (!tabFollowReady.current) {
3423
- tabFollowReady.current = true;
3424
- previousCurrentId.current = currentId;
3425
- return;
3426
- }
3427
- const previous = previousCurrentId.current;
3428
- previousCurrentId.current = currentId;
3429
- if (typeof currentId !== "string" || currentId === "") return;
3430
- if (currentId === previous && !isChannelSession(currentId)) return;
3431
- if (isChannelSession(currentId)) setTab("channels");
3432
- const matched = extraTabs.find((item) => item.matchSession && item.matchSession(currentId));
3433
- if (matched && matched.id !== "schedule") setTab(matched.id);
3457
+ const followed = followSidebarTab(
3458
+ { ready: tabFollowReady.current, previousId: previousCurrentId.current },
3459
+ currentId,
3460
+ extraTabs,
3461
+ );
3462
+ tabFollowReady.current = followed.ready;
3463
+ previousCurrentId.current = followed.previousId;
3464
+ if (followed.tab) setTab(followed.tab);
3434
3465
  }, [currentId, extraTabs, membershipRevision]);
3435
3466
  const openSession = (id) => {
3436
3467
  openListedSession(resolveHostSessionId(id, sessionById), props.openSession || props.open);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-im-connect",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
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",