@sparkelf/dsh-patch-better-sidebar-main-view-session 0.2.0-rc.8

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
+ # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
+ # after editing either side, bring the other along and re-record with:
4
+ # pnpm run verify-translation-pairing --write patches/npm/better-sidebar-main-view-session/README.md
5
+ README.md: 93ecf89bac56550c1db5a6ef150125013e7416df
6
+ README.zh.md: 6ee9c9058dbc668a5906936d0a361179c3b764d7
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @sparkelf/dsh-patch-better-sidebar-main-view-session
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ This data-only package patches `dsh-better-sidebar@0.19.1`. The sidebar read the on-screen session from `sessions.list.current`; DSH 0.1.6-alpha.2 removed that field, so the read produced `undefined` and `store.setSession(undefined)` cleared the session. Every file click then ran `openFile` → `openTab`, which returns without opening anything when the store holds no session id — a click that opened no tab, made no request, and logged nothing, for every file type.
6
+
7
+ The payload changes only `lib/client.js`, adding `mainViewSessionId` and reading the session through it. The helper returns `list.current` when the runtime publishes it and otherwise mirrors the rule the runtime's own ui-session service uses to pick the main view: the row whose `retainedBy.mainView` count is positive. One build therefore serves both runtime generations. It deliberately does not fall back to the first listed id — catalog order is host order, so with several sessions open the sidebar would bind to a session the user is not looking at.
8
+
9
+ ## Model Experience
10
+
11
+ None. The patch changes which session the sidebar binds to; no model-visible input, tool result, prompt, or session event changes.
12
+
13
+ ## Known Limitations and Deferred Work
14
+
15
+ - **The patch pins `dsh-better-sidebar@0.19.1`.** A later release that adopts the alpha.2 rule itself makes this patch redundant rather than wrong; retire it then.
16
+ - **The helper reads `retainedBy` structurally.** A runtime that renames the retention field leaves the sidebar unbound again, exactly as it was before this patch, rather than failing loudly.
package/README.zh.md ADDED
@@ -0,0 +1,16 @@
1
+ # @sparkelf/dsh-patch-better-sidebar-main-view-session
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 这个纯数据包给 `dsh-better-sidebar@0.19.1` 打补丁。侧边栏从 `sessions.list.current` 读取当前会话;DSH 0.1.6-alpha.2 移除了该字段,于是这个读取得到 `undefined`,而 `store.setSession(undefined)` 清空了会话。此后每次点击文件都会走到 `openFile` → `openTab`,而后者在 store 没有会话 id 时不打开任何东西直接返回 —— 一次不打开标签、不发请求、不留日志的点击,对所有文件类型都是如此。
6
+
7
+ 载荷只改 `lib/client.js`:新增 `mainViewSessionId` 并经由它读取会话。运行时有 `list.current` 时该函数返回它,否则复刻运行时自身 ui-session 服务挑选主视图所用的规则:`retainedBy.mainView` 计数为正的那一行。因此同一份构建同时服务两代运行时。它刻意不回退到列表首行 —— 目录顺序即宿主顺序,多个会话打开时侧边栏会绑定到用户并未查看的那个会话。
8
+
9
+ ## Model Experience
10
+
11
+ 无。本补丁改变的是侧边栏绑定哪个会话;没有模型可见的输入、工具结果、提示词或会话事件发生变化。
12
+
13
+ ## Known Limitations and Deferred Work
14
+
15
+ - **本补丁钉住 `dsh-better-sidebar@0.19.1`。** 后续版本若自行采纳 alpha.2 的规则,本补丁会变得多余而非错误;届时退役它。
16
+ - **该函数按结构读取 `retainedBy`。** 运行时若重命名该保留字段,侧边栏会再次失去绑定,与打本补丁之前完全一样,而不会响亮地失败。
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "description": "Data-only patch resolving the on-screen session on DSH 0.1.6-alpha.2 in dsh-better-sidebar",
3
+ "dshPatch": {
4
+ "formatVersion": 1,
5
+ "variants": [
6
+ {
7
+ "dsh": ">=0.1.6-alpha.2",
8
+ "file": "./patches/better-sidebar-main-view-session.patch",
9
+ "id": "better-sidebar-main-view-session",
10
+ "target": {
11
+ "kind": "npm",
12
+ "name": "dsh-better-sidebar",
13
+ "range": "0.19.1"
14
+ }
15
+ }
16
+ ]
17
+ },
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ "./patches/better-sidebar-main-view-session.patch": "./patches/better-sidebar-main-view-session.patch"
21
+ },
22
+ "files": [
23
+ "patches/*.patch"
24
+ ],
25
+ "license": "MIT",
26
+ "name": "@sparkelf/dsh-patch-better-sidebar-main-view-session",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "directory": "patches/npm/better-sidebar-main-view-session",
32
+ "type": "git",
33
+ "url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
34
+ },
35
+ "type": "module",
36
+ "version": "0.2.0-rc.8"
37
+ }
@@ -0,0 +1,29 @@
1
+ diff --git a/lib/client.js b/lib/client.js
2
+ index f137630..baa732e 100644
3
+ --- a/lib/client.js
4
+ +++ b/lib/client.js
5
+ @@ -4,6 +4,15 @@ window.__ModuleLoader__.load({
6
+ var module = { exports: {} };
7
+ var exports = module.exports;
8
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
+ +/** Resolve the on-screen session on a runtime whose list snapshot has no current. */
10
+ +function mainViewSessionId(list) {
11
+ + if (list.current !== void 0) return list.current;
12
+ + for (const id of list.ids ?? []) {
13
+ + const retained = list.byId[id]?.retainedBy;
14
+ + if (retained !== void 0 && (retained.mainView ?? 0) > 0) return id;
15
+ + }
16
+ + return void 0;
17
+ +}
18
+ //#region \0rolldown/runtime.js
19
+ var __create = Object.create;
20
+ var __defProp = Object.defineProperty;
21
+ @@ -16015,7 +16024,7 @@ Mode: this is a continuable side conversation. Your answers stay in this side th
22
+ }, []);
23
+ const layoutViewportHeight = visualViewportHeight ?? viewport.height;
24
+ const sessionList = (0, react.useSyncExternalStore)((0, react.useMemo)(() => (callback) => ctx.sessions.list.subscribe(callback), [ctx]), (0, react.useCallback)(() => ctx.sessions.list.getSnapshot(), [ctx]));
25
+ - const current = sessionList.current;
26
+ + const current = mainViewSessionId(sessionList);
27
+ const snapshot = (0, react.useSyncExternalStore)((0, react.useCallback)((callback) => store.subscribe(callback), [store]), (0, react.useCallback)(() => store.getSnapshot(), [store]));
28
+ (0, react.useEffect)(() => {
29
+ store.setSession(current);