dsh-todo-float-ball 0.8.0 → 0.11.0

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
@@ -3,8 +3,274 @@
3
3
  All notable changes to this project are documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
+ ## [0.11.0] - 2026-09-13
7
+
8
+ > Client-half release. Pinned (📌) sessions now render exactly like the current
9
+ > view — one shared history renderer, per-session fold state, per-session
10
+ > controls — and the panel gained a two-column layout switch with captions.
11
+
12
+ ### Fixed
13
+
14
+ - **One shared history renderer for current and pinned lists**
15
+ (`lib/client.js`, `historySectionHtml(sid, list)`, Plan-A9). Pinned sessions
16
+ used to carry their own copy of the fold logic (Plan-A8) which had no
17
+ `🧹 Clear all history` row and no `♻️ Restore all hidden history` row. Both
18
+ list kinds are now produced by the same function, so the pinned panel and
19
+ the current panel are the same experience by construction, not by
20
+ duplication.
21
+ - **Snapshot / history split ignores the hidden filter**
22
+ (`lib/client.js`, `snapshotRowsOf()` + `historySectionHtml()`). The split
23
+ was taken on the already filtered list, so hiding one snapshot row pulled an
24
+ archived row up into the flat area and shifted every fold boundary. The raw
25
+ (unfiltered) list is now cut at `snapLen` first and each part is filtered
26
+ afterwards — fold counts and boundaries are stable while you hide rows.
27
+ - **Fold state is per session** (`lib/client.js`, `historyOpen` /
28
+ `historyOpenOpen` became sid-keyed maps). Expanding "已完成历史" in one
29
+ conversation no longer expands it in every other one; the pinned panels and
30
+ the current panel now share the same per-sid buckets (the Plan-A8
31
+ `pinnedHistOpen` / `pinnedOpenHistOpen` maps are gone).
32
+ - **Fold / 🧹 / ♻️ controls act on their own session**
33
+ (`lib/client.js`, `actionSid()` + `data-ownsid`). Those rows used to resolve
34
+ the *current* session, so a 🧹 clicked inside a pinned panel cleared the
35
+ wrong list. Every action row is tagged with the sid it was rendered for;
36
+ `ACT_ALIAS` keeps the legacy Plan-A8 action names working.
37
+ - **Pinned header counts report the current plan only**
38
+ (`lib/client.js`, `countsOf(snapshotRowsOf(sid))`). The pinned row's
39
+ done/total previously folded archived history into the numbers, breaking the
40
+ statistics rule established in 0.10.0.
41
+
42
+ ### Added
43
+
44
+ - **Panel layout switch (⇄)** (`lib/client.js`, Plan-A10). A new ⇄ button in
45
+ the panel header toggles between the stacked layout (current list above,
46
+ pinned sessions below) and a side-by-side layout (left column = current
47
+ list, right column = pinned sessions). The choice is persisted in
48
+ `localStorage["dsh-todo-float-ball-layout"]`, restored on load, and the
49
+ panel repositions itself after the switch.
50
+ - **Column captions in the side-by-side layout** (`lib/client.js`, Plan-A11).
51
+ Each column gets a caption line: the left one shows the current
52
+ conversation title (`▸ <title>`, kept in sync with the header title), the
53
+ right one shows `📌 固定会话`. In the stacked layout the captions are hidden,
54
+ so nothing changes there.
55
+
56
+ ### Changed
57
+
58
+ - `package.json` version 0.10.0 → 0.11.0.
59
+ - Client-half changes only; the host half (`lib/index.js`,
60
+ `cordis.patch.yml`, discipline injection, health routes) is unchanged.
61
+ - `lib/client.js` is stored with LF line endings from this release (it matches
62
+ the byte-for-byte copy that actually runs here); no content change beyond
63
+ the fixes above.
64
+ - Internal cleanup: the click dispatcher no longer carries an empty duplicate
65
+ `copyItem` branch that appeared while this batch was in flight (it never
66
+ shipped in a release; no user-visible effect).
67
+ - The `lib/client.js` header comment still reads `v0.9.1` (cosmetic drift; the
68
+ authoritative version is `package.json`, and this file is published exactly
69
+ as deployed).
70
+ - Regression baseline at release time: `node --check` clean, the local
71
+ DOM-stub probes passed 14/14 (refresh) and 59/59 (history merge / fold /
72
+ cleanup / restore) checks.
73
+
74
+ ## [0.10.0] - 2026-09-13
75
+
76
+ > Local-only release. A major client-half UX overhaul around session history:
77
+ > merged snapshots no longer wipe older todos, the ball's counters now mean
78
+ > "the current plan", and everything older is an archived, foldable,
79
+ > cleanable, restorable, copyable layer that never leaks into the numbers.
80
+
81
+ ### Fixed
82
+
83
+ - **History merge — old tasks no longer disappear** (`lib/client.js`,
84
+ `setSessionTodos`). Snapshots were merged into history by replacing the
85
+ per-session bucket with the newest snapshot wholesale, so any task absent
86
+ from the new snapshot vanished from the panel. A snapshot is now stored as
87
+ the leading `snapLen` items of the bucket and previous records whose items
88
+ are not contained in the new snapshot are appended after it — the current
89
+ plan always renders first and intact, older items survive as archive rows
90
+ and are never resurrected into the live counts. This also root-fixes the
91
+ user-reported regression introduced by the 0.9.1 removal of the
92
+ monotonic-progress guard (a legitimate "fewer done items" snapshot used to
93
+ erase history; it now simply re-defines the snapshot prefix).
94
+ - **Statistics — the ball counts only the current plan** (`lib/client.js`,
95
+ `snapshotList()` + all render paths). Ball-face `done/total`, the progress
96
+ ring, the header summary, and the "N items left" notice all previously
97
+ counted merged history rows, so finished archive entries inflated the
98
+ numbers and the ring never returned to 0/0 after a plan was replaced. All
99
+ four now read exclusively the latest snapshot; history is a pure archive
100
+ with no effect on any counter.
101
+ - **2s safety-net poll no longer undoes user hides** (`lib/client.js`).
102
+ Signature dedup moved ahead of the visibility filter application, so the
103
+ periodic `syncFromSessions()` refresh can no longer resurrect rows the
104
+ user hid a second earlier.
105
+ - Removed the panel-footer recommendation line for the third-party plugin
106
+ `dsh-client-auto-continue` (user request: no third-party plugin ads).
107
+
108
+ ### Added
109
+
110
+ - **Per-row hide (✕)** (`lib/client.js`, `HIDE_KEY`). Every history row gets
111
+ an ✕ button (shown on hover) that hides it at the display layer only.
112
+ Hidden ids are stored per session in
113
+ `localStorage["dsh-todo-float-ball-hidden-v1"]`; the data layer, the
114
+ signature and the merge logic see zero difference.
115
+ - **Independent history fold rows** (`lib/client.js`, Plan-A3/A3.1). Two
116
+ separate collapse rows — `▾ Completed history (N)` and
117
+ `▸ Abandoned history tasks (M)` — each counted from its own status set and
118
+ collapsed by default; the latest snapshot always renders fully expanded.
119
+ The per-session bucket gained a `snapLen` field to mark the snapshot
120
+ prefix (also used by the statistics fix above).
121
+ - **Batch cleanup (🧹)** (`lib/client.js`, Plan-A5). Each fold row carries a
122
+ 🧹 button that hides everything in that fold, plus a
123
+ `🧹 Clear all history (X)` row that hides both folds at once.
124
+ - **Row copy button (📋)** (`lib/client.js`, Plan-A6). Every row gets a 📋
125
+ button that copies the full task text from a `data-copy` attribute — not
126
+ the 80-char display truncation — via `execCommand('copy')` first with a
127
+ clipboard-API fallback, and gives a real ✓/⚠ feedback.
128
+ - **One-click restore (♻️)** (`lib/client.js`, Plan-A7). A
129
+ `♻️ Restore all hidden history (X)` row appears only while at least one
130
+ row of the session is hidden and unhides everything at once (the inverse
131
+ of ✕/🧹).
132
+ - **Pinned sessions: per-row hide without cross-session leaks**
133
+ (`lib/client.js`, Plan-A2.2). Rows inside a pinned (📌) session list can be
134
+ hidden independently: pinned `<ul>`s carry a `data-ownsid` attribute and
135
+ `sessionTodosVisible()` filters per owning session, so a hidden id stored
136
+ under session A can never hide a row rendered for session B.
137
+
138
+ ### Changed
139
+
140
+ - `package.json` version 0.9.1 → 0.10.0.
141
+ - Client-half changes only; the host half (`lib/index.js`,
142
+ `cordis.patch.yml`, discipline injection, health routes) is unchanged.
143
+ - The `lib/client.js` header comment still reads `v0.9.1` (cosmetic drift;
144
+ the authoritative version is `package.json`).
145
+
146
+ ## [0.9.1] - 2026-09-12
147
+
148
+ > Local-only release. Fixes the two ways the ball could sit on stale todo data,
149
+ > and makes the plugin usable straight after install with no configuration step.
150
+
151
+ ### Fixed
152
+
153
+ - **Refresh defect 1 — the progress-regression guard is gone**
154
+ (`lib/client.js`, `setSessionTodos`). `todo_write` is a whole-list
155
+ replacement, so a fresh snapshot may legitimately carry FEWER completed items
156
+ than the previously rendered one (list re-organised, a status re-adjusted, an
157
+ item re-opened, a round rewriting the plan). The old plan-aware monotonic
158
+ guard compared done-counts within an identical content set and silently
159
+ discarded those snapshots as "stale", which is exactly why the ball kept
160
+ showing outdated progress. A new snapshot now always wins; the existing
161
+ signature (`status|content` join) check remains the only dedupe, so an
162
+ unchanged payload still costs nothing.
163
+ - **Refresh defect 2 — the 2s watcher now pulls todo data**
164
+ (`lib/client.js`, `watchBallVisibility`). The interval only refreshed ball
165
+ visibility and the theme, never the todos: if the
166
+ `ctx.sessions.list.subscribe()` callback stopped firing (shell re-render,
167
+ dropped projection frame, remount), the ball stayed on stale data until a
168
+ manual page reload. `syncFromSessions()` is now called from that tick as a
169
+ safety net. It stays cheap by construction: `setSessionTodos()` returns early
170
+ on an identical signature and `syncFromSessions()` only re-renders when
171
+ something actually moved (`setSessionTodos` now reports whether it accepted a
172
+ snapshot).
173
+
174
+ ### Added
175
+
176
+ - **Install-and-go defaults** (`lib/client.js`: `DEFAULTS` + `getCfg` /
177
+ `peekCfg` / `ensureDefaultCfg`). Preferences live in `localStorage`, which is
178
+ per-origin — a fresh install, a new profile, a cleared browser profile, or a
179
+ changed port all start empty and used to require re-configuring by hand. Every
180
+ switch now carries a code default, seeded into `localStorage` once on first
181
+ run so the value also stays visible and editable afterwards:
182
+
183
+ | Key | Default |
184
+ |---|---|
185
+ | `dsh-tfb-ball-visible` | `1` (always visible) |
186
+ | `dsh-tfb-theme` | `graphite` |
187
+ | `dsh-todo-float-ball-capsule` | `0` (round ball, not pill) |
188
+ | `dsh-todo-float-ball-pos` | bottom-right for the current viewport |
189
+
190
+ `injectDiscipline` (host-side prompt section) already defaulted to `true` and
191
+ is unchanged. Seeding only ever writes an ABSENT key — an existing user's
192
+ stored choice is never overwritten (covered by a regression test). The seeded
193
+ position is clamped into the viewport, and the restore path still falls back to
194
+ the CSS default when a stored point no longer fits, so a stale seed cannot park
195
+ the ball off-screen.
196
+
197
+ ### Changed
198
+
199
+ - `lib/client.js` header comment `v0.3.0` → `v0.9.1` (it had drifted from
200
+ `package.json` while the data layer was rebuilt on the official `sessions`
201
+ service; the historical `v0.3.0 —` note below it is kept intentionally).
202
+ - Theme handling collapsed onto one `isTheme()` predicate and `getCfg`, replacing
203
+ three copies of the same skin whitelist (`loadTheme`, `setTheme`,
204
+ `applyThemeNow`).
205
+ - `package.json` version 0.9.0 → 0.9.1.
206
+
207
+ ### Verified
208
+
209
+ - `node --check lib/client.js` passes; the file stays UTF-8 **without BOM**
210
+ (BOM is what makes DSH report `Unexpected token '�'`).
211
+ - New `dev-verify-refresh.cjs` (run: `node dev-verify-refresh.cjs lib/client.js`)
212
+ drives the real browser bundle through its `__ModuleLoader__` factory under a
213
+ DOM/localStorage stub: 14/14 checks pass on 0.9.1, while the same probe on the
214
+ pre-0.9.1 build fails exactly on the two refresh defects and the missing seeds
215
+ (7/14) — so the tests demonstrably detect the bugs they fix. It also asserts
216
+ that stored preferences are never overwritten by the seeding.
217
+ - `injectDiscipline` (host prompt section) is unchanged and still `true` in
218
+ `cordis.patch.yml`.
219
+
220
+ ### Notes
221
+
222
+ - Client-half changes only (`lib/client.js`); the host half (`lib/index.js`,
223
+ the discipline prompt section and the loopback health routes) is untouched.
224
+ - `syncFromSessions()` gained a `currentSessions` null-guard, because the 2s
225
+ watcher now calls it unconditionally even when the sessions service is absent.
226
+
227
+
228
+ ## [0.9.0] - 2026-09-10
229
+
230
+ > Local-only release (not published to npm yet). Adds an optional, ON-by-default
231
+ > system-prompt injection so the todo rules are resident in every session even
232
+ > when the `todo-show-discipline` skill is never loaded.
233
+
234
+ ### Added
235
+
236
+ - **Host half now injects a "todo discipline" system-prompt section**
237
+ (user request: the todo 铁律 kept failing because skills are loaded on demand —
238
+ a session that never loads the skill never carries the rules). `lib/index.js`
239
+ adds `systemPrompt` to `inject` and registers
240
+ `ctx.systemPrompt.section({ name: "todo-discipline", order: 190, text })`,
241
+ disposed through `ctx.effect(...)` exactly like `dsh-taskboard`'s protocol
242
+ section (`order: 180`). Order 190 keeps the two work-discipline blocks
243
+ adjacent inside the built-in policy band (`DEPLOYMENT_PERSONA=0` →
244
+ `PLAN_POLICY=500`) and leaves 181..189 free for future sections.
245
+ The injected text is 362 characters (187 CJK) and carries only the 5 hardest
246
+ rules — the long-form rules stay in the `todo-show-discipline` skill.
247
+ Works on both the desktop and the web profile, and across presets, because it
248
+ is a plugin/host capability rather than a skill.
249
+ - **Config switch `injectDiscipline` (default `true`)**: set
250
+ `config: { injectDiscipline: false }` on the plugin's bundle-patch row to skip
251
+ the section entirely (no empty-text section is registered). Only an explicit
252
+ boolean `false` disables it. Ships as `config: { injectDiscipline: true }` in
253
+ `cordis.patch.yml`.
254
+ - `dev-verify-inject.cjs`: offline verifier that loads the real ESM host half and
255
+ drives `apply()` with a fake cordis context — asserts exports, inject list,
256
+ section name/order/text budget, the on/off switch behaviour, and that both
257
+ loopback health routes still register and answer 200/403.
258
+
259
+ ### Changed
260
+
261
+ - `package.json` version 0.8.0 → 0.9.0 (local build ahead of the published
262
+ 0.8.0, so a plugin-manager "update" cannot silently downgrade it).
263
+
264
+ ### Unchanged (verified)
265
+
266
+ - `lib/client.js` display logic untouched; `/dsh-todo-float-ball/health` and
267
+ `/dsh-todo-float-ball/client-alive` behaviour and the loopback-only guard
268
+ unchanged.
269
+
6
270
  ## [0.8.0] - 2026-09-08
7
271
 
272
+ > Published: 2026-09-08. Repository first created 2026-09-06 (v0.1.0 skeleton); v0.8.0 ships six skins, multi-session monitoring, inline rename, capsule mode and durable persistence.
273
+
8
274
  ### Added
9
275
 
10
276
  - **Nebula triple-variant** (user: 都保留 — keep all three texture
package/README.md CHANGED
@@ -29,6 +29,66 @@ It is a pure, read-only companion: the plugin never modifies the official panel,
29
29
  | Shadow DOM isolation | All UI lives inside an open Shadow DOM with `all:initial` — no style leaks in or out, immune to theme/skin plugins |
30
30
  | Dual-end support | Works in DSH Desktop (Electron window) and the web UI (browser) with the same code, because both render the same page; the UI mounts on `<html>` to dodge `transform`-related `position:fixed` breakage |
31
31
  | Privacy-friendly | Zero telemetry, zero data upload. The only host-side surface is a loopback-only health route (`/dsh-todo-float-ball/health`) |
32
+ | **Discipline injection (v0.9.0)** | The host injects 5 hardest todo rules (~340 chars, `order=190`) into the system prompt of **every session** — **works as soon as the plugin is installed, no skill needs to be loaded**; turn it off with `injectDiscipline: false` |
33
+ | **History archive & panel tools (v0.10.0)** | Merged snapshots no longer wipe older todos — they become a foldable history archive; per-row ✕ hide, two independent fold rows, 🧹 batch cleanup, ♻️ one-click restore, 📋 full-text copy; all counters reflect only the latest snapshot |
34
+ | **Pinned-panel parity & layout switch (v0.11.0)** | 📌 pinned sessions render through the *same* history renderer as the current view (folds, 🧹, ♻️, per-session state and per-session action scoping); the panel header gained a ⇄ button to flip between a stacked layout and a side-by-side layout (left = current list, right = pinned sessions) with per-column captions |
35
+
36
+ ## Pinned sessions & panel layout (v0.11.0)
37
+
38
+ - **One renderer, two lists** — the current conversation and every pinned (📌)
39
+ conversation are rendered by the same `historySectionHtml()` function: latest
40
+ snapshot flat, then `▾ Completed history (N)` and
41
+ `▸ Abandoned history tasks (M)`, each fold with its own 🧹, plus
42
+ `🧹 Clear all history` and `♻️ Restore all hidden history`. Pinned panels got
43
+ the last two rows for the first time in this release.
44
+ - **Per-session state** — fold open/closed and hidden rows are keyed by session
45
+ id, so expanding or cleaning one conversation never moves another one; every
46
+ control carries the id of the list it was rendered for (`data-ownsid`).
47
+ - **Stable snapshot boundary** — the snapshot/history split is taken on the raw
48
+ list and the hidden-row filter is applied afterwards, so hiding a snapshot row
49
+ can no longer drag an archived row into the live area or shift a fold count.
50
+ - **⇄ layout switch** — stacked (current list above, pinned below) or
51
+ side-by-side (left current, right pinned). The preference is stored in
52
+ `localStorage["dsh-todo-float-ball-layout"]` and restored on load.
53
+ - **Column captions** — in side-by-side mode the left column is captioned with
54
+ the current conversation title and the right one with `📌 固定会话`; in stacked
55
+ mode the captions stay hidden and nothing about the old layout changes.
56
+
57
+
58
+ ## History & panel management (v0.10.0)
59
+
60
+ A plan is rewritten many times during a long task. From v0.10.0 the panel keeps
61
+ the **latest snapshot** as the live list and archives everything older instead
62
+ of discarding it:
63
+
64
+ - **Merge, not replace** — a fresh snapshot updates the leading `snapLen` rows
65
+ of the session bucket; previous items that are not part of the new snapshot
66
+ are appended after it, so old tasks never disappear.
67
+ - **Statistics mean "the current plan"** — the ball face (`done/total`), the
68
+ progress ring, the header summary and the "N items left" notice count only
69
+ the latest snapshot (`snapshotList()`); history is a pure archive.
70
+ - **Per-row hide (✕)** — hover a history row and click ✕ to hide it. Hidden
71
+ rows live in `localStorage` (`dsh-todo-float-ball-hidden-v1`, per session);
72
+ the data layer is untouched. Pinned (📌) sessions hide rows independently —
73
+ a hidden row in session A can never hide a row in session B (`data-ownsid`).
74
+ - **Two fold rows** — `▾ Completed history (N)` and `▸ Abandoned history
75
+ tasks (M)` are independent collapsible rows (collapsed by default); the
76
+ latest snapshot always renders fully expanded.
77
+ - **Batch cleanup (🧹)** — each fold row has a 🧹 button to clear that fold,
78
+ plus a `🧹 Clear all history (X)` row that hides both folds at once.
79
+ - **One-click restore (♻️)** — `♻️ Restore all hidden history (X)` appears
80
+ only while something is hidden and unhides everything in the session.
81
+ - **Row copy (📋)** — copies the *full* task text (not the 80-char display
82
+ truncation), with a real ✓/⚠ feedback.
83
+
84
+ ## Discipline injection (v0.9.0)
85
+
86
+ DSH skills are **loaded on demand**: a session that never loads the `todo-show-discipline` skill carries no todo rules at all. Since v0.9.0 the host half injects a stable "todo discipline" section into every session's system prompt, so **installing the plugin is enough** — independent of which skill got loaded, which preset is active, and whether you run Desktop or the web UI.
87
+
88
+ - **ON by default** (no `config` row means ON).
89
+ - To turn it off: add `config: { injectDiscipline: false }` to this plugin's row in `cordis.patch.yml` (or your profile's patch layer), then **restart DSH**.
90
+ - Only an explicit boolean `false` disables it; `"false"` / `0` / typos / a missing `config` all keep it ON (guards against accidental shutdown).
91
+ - The injected text is deliberately short (a system-prompt section costs tokens in every session); the full rules stay in the `todo-show-discipline` skill, which is disabled for model invocation by default once this plugin is installed, and can be re-enabled if you uninstall the plugin.
32
92
 
33
93
  ## Install
34
94
 
@@ -50,7 +110,7 @@ After the restart you should see the ball in the bottom-right corner. Verify the
50
110
 
51
111
  ```
52
112
  http://127.0.0.1:43120/dsh-todo-float-ball/health
53
- → {"ok":true,"plugin":"dsh-todo-float-ball","version":"0.1.0"}
113
+ → {"ok":true,"plugin":"dsh-todo-float-ball","version":"<the installed package.json version>"}
54
114
  ```
55
115
 
56
116
  ## How it works
package/README.zh.md CHANGED
@@ -29,6 +29,43 @@ DSH 里的 AI 在推进多步骤任务时,会用内置的 `todo_write` 工具
29
29
  | Shadow DOM 样式隔离 | 全部 UI 在 open Shadow DOM 内并加 `all:initial`——样式不进不出,主题/皮肤插件互不干扰 |
30
30
  | 双端可用 | DSH Desktop 桌面端(Electron 窗口)与网页端(浏览器)同一份代码通用;UI 挂载在 `<html>` 根节点,规避 `transform` 导致的 `position:fixed` 失效 |
31
31
  | 隐私友好 | 零遥测、零数据上传。宿主端只注册一个仅限本机回环访问的健康检查路由(`/dsh-todo-float-ball/health`) |
32
+ | **纪律注入(v0.9.0)** | 宿主端向**每次会话的系统提示**注入 5 条最硬的 todo 纪律(约 340 字,`order=190`)——**装上插件即生效,无需加载任何技能**;可用 `injectDiscipline: false` 关闭 |
33
+ | **历史归档与面板管理(v0.10.0)** | 快照合并不再冲掉旧任务——旧任务进入可折叠的历史归档;行级 ✕ 隐藏、两个独立折叠行、🧹 批量清理、♻️ 一键恢复、📋 整行复制;球面计数只反映最新快照 |
34
+ | **固定会话同款体验 + 面板布局切换(v0.11.0)** | 📌 固定会话与当前对话走**同一个历史渲染器**(两个折叠行、🧹、♻️、按会话独立的开合与操作归属);面板头部新增 ⇄ 按钮,可在【上下堆叠】与【左右并排】之间切换,并带列标题 |
35
+
36
+ ## 固定会话与面板布局(v0.11.0)
37
+
38
+ - **一套渲染器,两种清单**——当前对话与每个 📌 固定会话都由同一个
39
+ `historySectionHtml()` 渲染:最新快照平铺,其后是 `▾ 已完成历史(N 条)` 与
40
+ `▸ 被抛弃的历史任务(M 条)`,每个折叠行自带 🧹,另有
41
+ `🧹 一键清理全部历史` 与 `♻️ 一键恢复全部隐藏的历史`。固定会话面板是从本版本起才拿到后两行的。
42
+ - **状态按会话隔离**——折叠开合与隐藏记录都以会话 id 为键,在 A 会话里展开或清理不会影响 B 会话;每个操作行都带着它所属会话的 `data-ownsid`。
43
+ - **快照边界稳定**——快照/历史的切分先按未过滤的原始列表取 `snapLen`,再各自过滤隐藏行,隐藏一条快照行不会再把历史行顶进快照区、也不会改变折叠计数。
44
+ - **⇄ 布局切换**——上下堆叠(当前清单在上、固定会话在下)⇄ 左右并排(左列当前清单、右列固定会话);偏好写入 `localStorage["dsh-todo-float-ball-layout"]`,下次打开自动恢复。
45
+ - **列标题**——左右并排时左列显示当前对话标题(与头部同源同步),右列显示 `📌 固定会话`;上下堆叠时列标题隐藏,视觉与之前完全一致。
46
+
47
+
48
+ ## 历史归档与面板管理(v0.10.0)
49
+
50
+ 一个长任务里计划会被反复重写。v0.10.0 起面板把**最新快照**作为当前清单,
51
+ 更早的条目不再被丢弃,而是归档进历史:
52
+
53
+ - **合并而非替换**——新快照更新会话桶开头 `snapLen` 行,旧记录里不属于新快照的条目追加在其后,旧任务永不消失。
54
+ - **统计口径 = 当前计划**——球面 `完成数/总数`、进度环、头部汇总、「还有 N 项未完成」提示全部只统计最新快照(`snapshotList()`);历史是纯档案,不进任何计数。
55
+ - **行级隐藏(✕)**——悬停历史行点 ✕ 即隐藏。隐藏记录按会话存在 `localStorage`(`dsh-todo-float-ball-hidden-v1`),数据层零改动。固定会话(📌)的行独立隐藏——会话 A 的隐藏记录绝不会隐藏会话 B 的行(`data-ownsid` 归属过滤)。
56
+ - **两个折叠行**——`▾ 已完成历史(N 条)` 与 `▸ 被抛弃的历史任务(M 条)` 是独立折叠行(默认收起);最新快照始终完整平铺。
57
+ - **批量清理(🧹)**——每个折叠行带 🧹 清本区按钮,另有 `🧹 一键清理全部历史(X 条)` 一行同时清两区。
58
+ - **一键恢复(♻️)**——`♻️ 一键恢复全部隐藏的历史(X 条)` 仅在有隐藏条目时出现,一次恢复本会话全部隐藏行。
59
+ - **整行复制(📋)**——复制**完整**任务文本(非 80 字显示截断),带真实 ✓/⚠ 反馈。
60
+
61
+ ## 纪律注入(v0.9.0)
62
+
63
+ DSH 的技能是**按需加载**的:一个会话若从未加载 `todo-show-discipline` 技能,就完全不带 todo 纪律。v0.9.0 起,宿主端会向每次会话的系统提示注入一段稳定的「todo 纪律」段落,因此**装上插件就等于纪律常驻**——与技能是否加载、用哪个预设、桌面端还是网页端都无关。
64
+
65
+ - 默认**开启**(不写 `config` 即为开)。
66
+ - 关闭:在 `cordis.patch.yml`(或 profile 的 patch 层)给本插件加 `config: { injectDiscipline: false }`,**重启 DSH 生效**。
67
+ - 只有**显式布尔 `false`** 才关闭;`"false"` / `0` / 拼错 / 缺 `config` 一律保持开启(防误关)。
68
+ - 注入文本刻意精简(系统提示每会话都占 token),完整规则仍留在 `todo-show-discipline` 技能里;该技能在装了本插件后默认不再随会话加载(`disable-model-invocation: true`)以避免重复占 token,未装本插件时可恢复启用。
32
69
 
33
70
  ## 安装
34
71
 
@@ -50,7 +87,7 @@ npm install dsh-todo-float-ball
50
87
 
51
88
  ```
52
89
  http://127.0.0.1:43120/dsh-todo-float-ball/health
53
- → {"ok":true,"plugin":"dsh-todo-float-ball","version":"0.1.0"}
90
+ → {"ok":true,"plugin":"dsh-todo-float-ball","version":"<已安装 package.json 里的版本号>"}
54
91
  ```
55
92
 
56
93
  ## 实现原理
package/cordis.patch.yml CHANGED
@@ -1,8 +1,29 @@
1
1
  # dsh-todo-float-ball — floating ball showing live todo_write progress.
2
- # Pure client-side plugin: the visual work lives in lib/client.js (mounted by
3
- # the client-modules system once the host activates). The host half only
4
- # registers a loopback-only health route so the bundle has a real cordis
5
- # activate. No host services are required at runtime.
2
+ # Dual-half plugin:
3
+ # * the host half (lib/index.js) registers a loopback-only health route AND a
4
+ # short "todo discipline" system-prompt section (ctx.systemPrompt.section),
5
+ # so the todo rules are resident in every session/preset without loading the
6
+ # `todo-show-discipline` skill (skills load on demand, a prompt section does
7
+ # not);
8
+ # * the client half (lib/client.js) draws the floating ball, mounted by the
9
+ # client-modules system once the host activates.
10
+ #
11
+ # Config switch `injectDiscipline` (default: true — also the explicit value
12
+ # below, so this row is the single place to flip it).
13
+ # Set it to false to stop injecting the prompt section, e.g. when you prefer the
14
+ # `todo-show-discipline` skill to be the only discipline source:
15
+ #
16
+ # - insert:
17
+ # - id: dsh-todo-float-ball
18
+ # name: dsh-todo-float-ball
19
+ # config:
20
+ # injectDiscipline: false
21
+ #
22
+ # Only an explicit boolean false disables the section (no empty-text section is
23
+ # registered in that case); any other value, or no config row at all, keeps the
24
+ # injection ON. The floating ball and the health routes are unaffected either way.
6
25
  - insert:
7
26
  - id: dsh-todo-float-ball
8
27
  name: dsh-todo-float-ball
28
+ config:
29
+ injectDiscipline: true