@michengai/dsh-im-connect 0.1.66 → 0.1.68
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 +10 -0
- package/CHANGELOG.zh-CN.md +10 -0
- package/client.js +49 -14
- package/lib/client.js +56 -15
- package/package.json +1 -1
- package/src/plugin-update-ui.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ Recent published versions are listed below. Git tags and GitHub Releases now mir
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.1.68 - 2026-10-08
|
|
10
|
+
|
|
11
|
+
- The channel sidebar keeps its layout when another plugin reloads. Its runtime styles now belong to this plugin.
|
|
12
|
+
- Restart DSH and refresh the page after upgrading.
|
|
13
|
+
|
|
14
|
+
## 0.1.67 - 2026-10-08
|
|
15
|
+
|
|
16
|
+
- 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).
|
|
17
|
+
- Restart DSH and refresh the page after upgrading.
|
|
18
|
+
|
|
9
19
|
## 0.1.66 - 2026-10-07
|
|
10
20
|
|
|
11
21
|
- 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.
|
package/CHANGELOG.zh-CN.md
CHANGED
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
## 未发布
|
|
8
8
|
|
|
9
|
+
## 0.1.68 - 2026-10-08
|
|
10
|
+
|
|
11
|
+
- 其它插件重载后,频道侧栏不再丢失排版。运行期样式表现在归属本插件。
|
|
12
|
+
- 升级后请重启 DSH 并刷新页面。
|
|
13
|
+
|
|
14
|
+
## 0.1.67 - 2026-10-08
|
|
15
|
+
|
|
16
|
+
- 在频道页签里新建会话后,侧栏会回到「任务」,包括宿主的「新会话」按钮。频道里不能放新建的普通会话;刷新后也不会再把这条任务藏在「频道」里(#23)。
|
|
17
|
+
- 升级后请重启 DSH 并刷新页面。
|
|
18
|
+
|
|
9
19
|
## 0.1.66 - 2026-10-07
|
|
10
20
|
|
|
11
21
|
- 设置页可以为每个已接入账号填写名称备注,账号行点击名称即可修改。备注只在本机显示,用来区分使用者;留空恢复原来的自动序号,不会按当前账号数重编。超过 40 个字符或包含换行会被拒绝。
|
package/client.js
CHANGED
|
@@ -568,8 +568,12 @@ window.__ModuleLoader__.load({
|
|
|
568
568
|
|
|
569
569
|
let styleEl = null;
|
|
570
570
|
const ensureStyle = () => {
|
|
571
|
-
if (styleEl && styleEl.isConnected)
|
|
571
|
+
if (styleEl && styleEl.isConnected) {
|
|
572
|
+
styleEl.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
572
575
|
styleEl = document.createElement("style");
|
|
576
|
+
styleEl.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
573
577
|
styleEl.textContent = CSS + TITLE_LINK_CSS;
|
|
574
578
|
document.head.appendChild(styleEl);
|
|
575
579
|
};
|
|
@@ -591,6 +595,29 @@ window.__ModuleLoader__.load({
|
|
|
591
595
|
};
|
|
592
596
|
const channelMembershipSnapshot = () => channelMembershipRevision;
|
|
593
597
|
|
|
598
|
+
/** 频道不能新建普通会话。当前会话决定侧栏该停在哪一页;定时页签自己认领的不抢。 */
|
|
599
|
+
function sidebarTabForSession(currentId, extraTabs) {
|
|
600
|
+
if (typeof currentId !== "string" || currentId === "") return null;
|
|
601
|
+
const matched = (extraTabs || []).find((item) => item && item.matchSession && item.matchSession(currentId));
|
|
602
|
+
if (matched && matched.id !== "schedule") return matched.id;
|
|
603
|
+
if (isChannelSession(currentId)) return "channels";
|
|
604
|
+
if (matched) return null;
|
|
605
|
+
return "tasks";
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
function followSidebarTab(state, currentId, extraTabs) {
|
|
609
|
+
const ready = !!(state && state.ready);
|
|
610
|
+
const next = sidebarTabForSession(currentId, extraTabs);
|
|
611
|
+
if (!ready) return { ready: true, previousId: currentId, tab: next };
|
|
612
|
+
if (typeof currentId !== "string" || currentId === "") return { ready: true, previousId: currentId, tab: null };
|
|
613
|
+
if (currentId === state.previousId && !isChannelSession(currentId)) return { ready: true, previousId: currentId, tab: null };
|
|
614
|
+
return { ready: true, previousId: currentId, tab: next };
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
function isHostNewSessionControl(label) {
|
|
618
|
+
return /新会话|新建任务|New chat|New session/i.test(String(label || ""));
|
|
619
|
+
}
|
|
620
|
+
|
|
594
621
|
const api = (path, opts) => {
|
|
595
622
|
// 管理路由复用宿主登录 Cookie,不缓存账号状态或认证错误。
|
|
596
623
|
const request = Object.assign({}, opts || {}, { credentials: "same-origin", cache: "no-store" });
|
|
@@ -2888,7 +2915,9 @@ window.__ModuleLoader__.load({
|
|
|
2888
2915
|
const sessionSnap = typeof rawUseSessions === "function"
|
|
2889
2916
|
? rawUseSessions((state) => state)
|
|
2890
2917
|
: undefined;
|
|
2891
|
-
const currentId =
|
|
2918
|
+
const currentId = typeof rawUseSessions === "function"
|
|
2919
|
+
? rawUseSessions((state) => currentSessionId(state))
|
|
2920
|
+
: (props.selectedId || null);
|
|
2892
2921
|
const sessionById = (sessionSnap && sessionSnap.byId) || {};
|
|
2893
2922
|
const useTaskSessions = useCallback((selector, eq) => {
|
|
2894
2923
|
if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
|
|
@@ -2900,21 +2929,27 @@ window.__ModuleLoader__.load({
|
|
|
2900
2929
|
}, [rawUseSessions, membershipRevision]);
|
|
2901
2930
|
useEffect(() => { ensureStyle(); }, []);
|
|
2902
2931
|
useEffect(() => { try { localStorage.setItem(TAB_KEY, tab); } catch { /* ignore */ } }, [tab]);
|
|
2932
|
+
useEffect(() => {
|
|
2933
|
+
const onClick = (event) => {
|
|
2934
|
+
const target = event.target && event.target.closest ? event.target.closest("button") : null;
|
|
2935
|
+
if (!target) return;
|
|
2936
|
+
const label = (target.innerText || "") + " " + (target.getAttribute("aria-label") || "");
|
|
2937
|
+
if (isHostNewSessionControl(label)) setTab("tasks");
|
|
2938
|
+
};
|
|
2939
|
+
document.addEventListener("click", onClick, true);
|
|
2940
|
+
return () => document.removeEventListener("click", onClick, true);
|
|
2941
|
+
}, []);
|
|
2903
2942
|
const previousCurrentId = useRef(currentId);
|
|
2904
2943
|
const tabFollowReady = useRef(false);
|
|
2905
2944
|
useEffect(() => {
|
|
2906
|
-
|
|
2907
|
-
tabFollowReady.current
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
previousCurrentId.current =
|
|
2913
|
-
if (
|
|
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);
|
|
2945
|
+
const followed = followSidebarTab(
|
|
2946
|
+
{ ready: tabFollowReady.current, previousId: previousCurrentId.current },
|
|
2947
|
+
currentId,
|
|
2948
|
+
extraTabs,
|
|
2949
|
+
);
|
|
2950
|
+
tabFollowReady.current = followed.ready;
|
|
2951
|
+
previousCurrentId.current = followed.previousId;
|
|
2952
|
+
if (followed.tab) setTab(followed.tab);
|
|
2918
2953
|
}, [currentId, extraTabs, membershipRevision]);
|
|
2919
2954
|
const openSession = (id) => {
|
|
2920
2955
|
openListedSession(resolveHostSessionId(id, sessionById), props.openSession || props.open);
|
package/lib/client.js
CHANGED
|
@@ -120,10 +120,16 @@ function createUpdateFlow(request, initial, onPayload) {
|
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
function ensurePluginUpdateStyle() {
|
|
123
|
-
|
|
123
|
+
const existing = document.getElementById(STYLE_ID);
|
|
124
|
+
if (existing !== null) {
|
|
125
|
+
// 这张表的 id 被多个插件共用。已有归属时不改写,避免本插件重载删掉别人的表。
|
|
126
|
+
if (existing.getAttribute("data-plugin") === null) existing.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
124
129
|
const style = document.createElement("style");
|
|
125
130
|
style.id = STYLE_ID;
|
|
126
131
|
style.textContent = PLUGIN_UPDATE_CSS;
|
|
132
|
+
style.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
127
133
|
(document.head ?? document.documentElement).append(style);
|
|
128
134
|
}
|
|
129
135
|
function validPayload(value) {
|
|
@@ -1084,8 +1090,12 @@ react-is/cjs/react-is.production.js:
|
|
|
1084
1090
|
|
|
1085
1091
|
let styleEl = null;
|
|
1086
1092
|
const ensureStyle = () => {
|
|
1087
|
-
if (styleEl && styleEl.isConnected)
|
|
1093
|
+
if (styleEl && styleEl.isConnected) {
|
|
1094
|
+
styleEl.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1088
1097
|
styleEl = document.createElement("style");
|
|
1098
|
+
styleEl.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
1089
1099
|
styleEl.textContent = CSS + TITLE_LINK_CSS;
|
|
1090
1100
|
document.head.appendChild(styleEl);
|
|
1091
1101
|
};
|
|
@@ -1107,6 +1117,29 @@ react-is/cjs/react-is.production.js:
|
|
|
1107
1117
|
};
|
|
1108
1118
|
const channelMembershipSnapshot = () => channelMembershipRevision;
|
|
1109
1119
|
|
|
1120
|
+
/** 频道不能新建普通会话。当前会话决定侧栏该停在哪一页;定时页签自己认领的不抢。 */
|
|
1121
|
+
function sidebarTabForSession(currentId, extraTabs) {
|
|
1122
|
+
if (typeof currentId !== "string" || currentId === "") return null;
|
|
1123
|
+
const matched = (extraTabs || []).find((item) => item && item.matchSession && item.matchSession(currentId));
|
|
1124
|
+
if (matched && matched.id !== "schedule") return matched.id;
|
|
1125
|
+
if (isChannelSession(currentId)) return "channels";
|
|
1126
|
+
if (matched) return null;
|
|
1127
|
+
return "tasks";
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
function followSidebarTab(state, currentId, extraTabs) {
|
|
1131
|
+
const ready = !!(state && state.ready);
|
|
1132
|
+
const next = sidebarTabForSession(currentId, extraTabs);
|
|
1133
|
+
if (!ready) return { ready: true, previousId: currentId, tab: next };
|
|
1134
|
+
if (typeof currentId !== "string" || currentId === "") return { ready: true, previousId: currentId, tab: null };
|
|
1135
|
+
if (currentId === state.previousId && !isChannelSession(currentId)) return { ready: true, previousId: currentId, tab: null };
|
|
1136
|
+
return { ready: true, previousId: currentId, tab: next };
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
function isHostNewSessionControl(label) {
|
|
1140
|
+
return /新会话|新建任务|New chat|New session/i.test(String(label || ""));
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1110
1143
|
const api = (path, opts) => {
|
|
1111
1144
|
// 管理路由复用宿主登录 Cookie,不缓存账号状态或认证错误。
|
|
1112
1145
|
const request = Object.assign({}, opts || {}, { credentials: "same-origin", cache: "no-store" });
|
|
@@ -3404,7 +3437,9 @@ react-is/cjs/react-is.production.js:
|
|
|
3404
3437
|
const sessionSnap = typeof rawUseSessions === "function"
|
|
3405
3438
|
? rawUseSessions((state) => state)
|
|
3406
3439
|
: undefined;
|
|
3407
|
-
const currentId =
|
|
3440
|
+
const currentId = typeof rawUseSessions === "function"
|
|
3441
|
+
? rawUseSessions((state) => currentSessionId(state))
|
|
3442
|
+
: (props.selectedId || null);
|
|
3408
3443
|
const sessionById = (sessionSnap && sessionSnap.byId) || {};
|
|
3409
3444
|
const useTaskSessions = useCallback((selector, eq) => {
|
|
3410
3445
|
if (typeof rawUseSessions !== "function") return selector({ ids: [], byId: {}, current: null });
|
|
@@ -3416,21 +3451,27 @@ react-is/cjs/react-is.production.js:
|
|
|
3416
3451
|
}, [rawUseSessions, membershipRevision]);
|
|
3417
3452
|
useEffect(() => { ensureStyle(); }, []);
|
|
3418
3453
|
useEffect(() => { try { localStorage.setItem(TAB_KEY, tab); } catch { /* ignore */ } }, [tab]);
|
|
3454
|
+
useEffect(() => {
|
|
3455
|
+
const onClick = (event) => {
|
|
3456
|
+
const target = event.target && event.target.closest ? event.target.closest("button") : null;
|
|
3457
|
+
if (!target) return;
|
|
3458
|
+
const label = (target.innerText || "") + " " + (target.getAttribute("aria-label") || "");
|
|
3459
|
+
if (isHostNewSessionControl(label)) setTab("tasks");
|
|
3460
|
+
};
|
|
3461
|
+
document.addEventListener("click", onClick, true);
|
|
3462
|
+
return () => document.removeEventListener("click", onClick, true);
|
|
3463
|
+
}, []);
|
|
3419
3464
|
const previousCurrentId = useRef(currentId);
|
|
3420
3465
|
const tabFollowReady = useRef(false);
|
|
3421
3466
|
useEffect(() => {
|
|
3422
|
-
|
|
3423
|
-
tabFollowReady.current
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
previousCurrentId.current =
|
|
3429
|
-
if (
|
|
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);
|
|
3467
|
+
const followed = followSidebarTab(
|
|
3468
|
+
{ ready: tabFollowReady.current, previousId: previousCurrentId.current },
|
|
3469
|
+
currentId,
|
|
3470
|
+
extraTabs,
|
|
3471
|
+
);
|
|
3472
|
+
tabFollowReady.current = followed.ready;
|
|
3473
|
+
previousCurrentId.current = followed.previousId;
|
|
3474
|
+
if (followed.tab) setTab(followed.tab);
|
|
3434
3475
|
}, [currentId, extraTabs, membershipRevision]);
|
|
3435
3476
|
const openSession = (id) => {
|
|
3436
3477
|
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.
|
|
3
|
+
"version": "0.1.68",
|
|
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",
|
package/src/plugin-update-ui.js
CHANGED
|
@@ -119,10 +119,16 @@ function createUpdateFlow(request, initial, onPayload) {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
function ensureStyle() {
|
|
122
|
-
|
|
122
|
+
const existing = document.getElementById(STYLE_ID);
|
|
123
|
+
if (existing !== null) {
|
|
124
|
+
// 这张表的 id 被多个插件共用。已有归属时不改写,避免本插件重载删掉别人的表。
|
|
125
|
+
if (existing.getAttribute("data-plugin") === null) existing.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
123
128
|
const style = document.createElement("style");
|
|
124
129
|
style.id = STYLE_ID;
|
|
125
130
|
style.textContent = CSS;
|
|
131
|
+
style.setAttribute("data-plugin", "@michengai/dsh-im-connect");
|
|
126
132
|
(document.head ?? document.documentElement).append(style);
|
|
127
133
|
}
|
|
128
134
|
function validPayload(value) {
|