dsh-better-workplace 0.0.0-stage → 1.4.2

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 ADDED
@@ -0,0 +1,57 @@
1
+ # 更新记录
2
+
3
+ ## 1.4.2
4
+
5
+ - 新增发布流水线:推送 `v*` 标签后,GitHub Actions 会核对语法、打出 `dsh-better-workplace-<版本>.tgz` 与源码 `zip`、生成 `SHA256SUMS`,并创建 Release。配置 `NPM_TOKEN` 后同一条流水线还会发布到 npm。
6
+ - 新增 `CHANGELOG.md`、许可证与发布徽章;仓库行尾统一为 LF。
7
+ - 安装文档重写:说明「添加插件」要填仓库地址(`github:Alail691/dsh-better-workplace`)而不是裸包名,并给出命令行、Release 压缩包、手工挂载三条路径。
8
+ - 记录 `ERR_PNPM_NO_MATCHING_VERSION` 这个会静默阻断任何插件安装的陷阱。
9
+
10
+ ## 1.4.1
11
+
12
+ - 修复:空白会话(还没发过消息)的 hover 卡片会显示上一次的时间。空白会话现在显示读取时刻,发出第一条消息后显示该会话目录名对应的绝对时刻。
13
+ - 修复:宿主路由不再把「刚建好、仍为空」的目录误判成废弃草稿。
14
+
15
+ ## 1.4.0
16
+
17
+ - 新行为:新开对话不再立刻建目录。目录在**第一条消息到达时**创建,用那一刻的时间命名,所以误建的空白对话不会留下任何目录。
18
+ - 新行为:空目录会被回收——会话关闭时若目录里只有空的分类子目录,直接删除;只要里面有一个真实文件就保留。
19
+ - 新行为:恢复历史会话时,若其映射指向的目录已被清空,同样回收并重新建。
20
+ - 会话事件的 `time` 字段被用作目录时间戳,替代不可靠的 `header.createdAt`。
21
+
22
+ ## 1.3.4
23
+
24
+ - 修复:从 DSH 自己的会话投影缓存里回填的创建时刻只留在内存,重启后又丢失。现在回填后会写回 sidecar。
25
+
26
+ ## 1.3.3
27
+
28
+ - 修复:恢复的会话不触发 `session/created` 与 `agent/created`,导致 hover 卡片拿不到时间。改为三个来源——sidecar、每轮 prompt 装配时的回填、DSH 的 `session_projcache` 投影缓存。
29
+
30
+ ## 1.3.2
31
+
32
+ - 修复:hover 卡片时间此前从目录名反解析,语义命名的目录解析不出时间。现在宿主直接下发 `at`,sidecar 里也持久化该字段。
33
+
34
+ ## 1.3.1
35
+
36
+ - 修复:`/better-workplace/api/sessions` 一直 404。`webServer` 服务晚于插件装配,`ctx.get('webServer')` 在 `apply` 阶段必然返回 `undefined`,改为 `ctx.inject(['webServer'], …)` 等待服务就绪后再注册路由。
37
+
38
+ ## 1.3.0
39
+
40
+ - 新功能:侧栏会话 hover 卡片显示 `YYYY-MM-DD HH:mm:ss` 绝对时间,与工作目录名逐位对应。通过 `sidebar.session.row.hover` 插槽注入,并用 CSS 隐藏原生相对时间那一行;工作区卡片保持原样。
41
+
42
+ ## 1.2.0
43
+
44
+ - 目录命名改为 `YYYYMMDDHHmmss`(会话开始的本地时间),不再使用语义 slug 作为默认策略,也不再使用任何路径片段。
45
+ - 语义命名仍可用:`namingStrategy: 'semantic'`。
46
+ - 修复:`session-store.loadSync` 在挂第二个工作区根目录时会清空已注册映射。
47
+ - 修复:目录名冲突后缀改为递增序号 `-2` / `-3`。
48
+
49
+ ## 1.1.0
50
+
51
+ - 完全重写:旧版调用了三个不存在的 API(`agent.inject(string)`、`session.header.title`、把 `fs/write-intent` 当成拒绝钩子),因此从未生效。
52
+ - 新实现基于真实 API:`session/created`、`session/event`、`agent/created`、`session/disposed` 事件,`systemPrompt.context` 注入,`tools.guard` 拦截。
53
+ - 工具层拦截覆盖 `write` / `edit` / `ops_write_file` / `ops_apply_patch` 等写工具;shell 类工具不拦截。
54
+
55
+ ## 1.0.0
56
+
57
+ - 首版。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alail691
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.
package/README.en.md ADDED
@@ -0,0 +1,421 @@
1
+ # dsh-better-workplace
2
+
3
+ > Per-session isolated workspace subdirectories for DeepSeek Harness (DSH).
4
+ > Every chat gets its own organized folder — no more cluttered workplace root.
5
+
6
+ **[简体中文](README.md) | English**
7
+
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ [![node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](package.json)
10
+ [![release](https://img.shields.io/github/v/release/Alail691/dsh-better-workplace)](https://github.com/Alail691/dsh-better-workplace/releases)
11
+
12
+ ![Workspace layout: a cluttered root before, one timestamped folder per conversation after](assets/en/overview.png)
13
+
14
+ ## Problem
15
+
16
+ DSH agents dump every generated file into the workplace root directory, creating a flat, unmanageable mess:
17
+
18
+ ```
19
+ workplace/ # Before
20
+ ├── script.py
21
+ ├── output.csv
22
+ ├── data.json
23
+ ├── report.md
24
+ ├── image.png
25
+ ├── temp.log
26
+ ├── test.py
27
+ ├── result.txt
28
+ └── ... (dozens more)
29
+ ```
30
+
31
+ ## Solution
32
+
33
+ Every conversation gets one folder named after the second its first message
34
+ arrived (`YYYYMMDDHHmmss`), and everything that conversation produces goes
35
+ inside it, sorted by kind:
36
+
37
+ ```
38
+ workplace/ # After
39
+ ├── 20261130145430/ # conversation started 14:54:30
40
+ │ ├── docs/ # reports, notes, plans
41
+ │ ├── src/ # code, scripts
42
+ │ ├── data/ # CSV, JSON, datasets
43
+ │ ├── assets/ # images, media
44
+ │ └── tmp/ # scratch, logs
45
+ ├── 20261130150712/
46
+ │ ├── docs/
47
+ │ └── src/
48
+ └── .dsh-better-workplace.json # SessionId → folder mapping
49
+ ```
50
+
51
+ Opening a new conversation does **not** create anything: the folder appears with
52
+ the first message, so a window you opened by mistake and closed leaves nothing
53
+ behind — no stray folder, and no later conversation inheriting its timestamp.
54
+
55
+ Hovering that conversation in the sidebar then shows the same instant in a
56
+ readable form — `2026-11-30 14:54:30` instead of the card's usual "3 分钟前" —
57
+ so the card and the folder always agree.
58
+
59
+ ![Sidebar session card: the relative distance replaced by an absolute instant](assets/en/hover-card.png)
60
+
61
+ ## How It Works
62
+
63
+ Three parts: two enforce, one informs — and the browser half makes the folder
64
+ name legible in the one place you look for a conversation's age.
65
+
66
+ | Layer | Mechanism | What it catches |
67
+ |-------|-----------|-----------------|
68
+ | 1 | `tools.guard()` | Every `write` / `edit` / `ops_write_file` / `apply_patch` call whose target lands on the bare workspace root or inside a sibling session's directory |
69
+ | 2 | `systemPrompt.context()` | Not enforcement — it tells *this* agent, on every assembly, exactly which directory is its own and which category folder each kind of file belongs in |
70
+ | 3 | Browser half (`lib/client.js`) | The sidebar's session hover card: the folder's `YYYYMMDDHHmmss` instant is rendered as `YYYY-MM-DD HH:mm:ss`, replacing the relative distance the card normally shows |
71
+
72
+ A folder lives exactly as long as a conversation does. `session/created` and
73
+ `agent/created` only *park* a session: it is remembered as pending and told the
74
+ folder is not there yet. The first `user/message` allocates it, and that
75
+ event's own `time` — not `header.createdAt` — names it, so a window left open
76
+ for an hour is not named an hour in the past. A pending session that goes away
77
+ allocates nothing at all. If a sidecar row still points at the empty shell of a
78
+ draft (an abandoned window, a DSH restart mid-draft), it is recycled on
79
+ adoption, on disposal, or at the next assembly: a folder holding only empty
80
+ category directories is deleted, while a folder with any real file in it is
81
+ never touched.
82
+
83
+ ![Folder lifecycle](assets/en/lifecycle.png)
84
+
85
+ The guard resolves relative paths against the workplace root (the session's
86
+ `cwd`), not against the DSH process cwd, and normalizes Windows drive-letter
87
+ casing and separators before comparing. Shell commands are not parsed: path
88
+ literals inside `ops_bash` / `pwsh` strings are out of reach at this layer, and
89
+ this DSH build exposes no veto hook on the filesystem itself.
90
+
91
+ The hover card's own stamp is a relative distance ("3 分钟前") built from the
92
+ client's session summary, which carries no creation time. The absolute instant
93
+ therefore travels from the host: `/better-workplace/api/sessions` publishes
94
+ `sessionId → { dir, at }`, where `at` is the session's `header.createdAt`, and
95
+ the browser half renders `at` as `YYYY-MM-DD HH:mm:ss`. The folder name alone is
96
+ not enough — a `semantic` directory carries no digits at all — so the instant is
97
+ published alongside it instead of being re-parsed from it. Three sources feed
98
+ `at`, in order: the sidecar row, `header.createdAt` read at assembly, and DSH's
99
+ own `session_projcache` for a row that predates the field. The card's relative
100
+ line is hidden for session cards only — the Workspace card has no session folder
101
+ and keeps its wording.
102
+
103
+ A conversation you have not written in yet has no folder, and DSH reports its
104
+ `updatedAt` as `Math.max(header.createdAt, lastPromptAt ?? 0)` — for a blank
105
+ session that is the moment the window was *first* opened, because DSH hands the
106
+ same blank session back until a prompt is sent. Printing it would date a
107
+ conversation opened today in the past, so a blank session is stamped with the
108
+ moment the card is read, which is also the instant its folder will be named
109
+ after once the first message lands.
110
+
111
+ ## Installation
112
+
113
+ This is a standard DSH plugin package (`package.json` declares `dsh.bundle.patch`). Pick whichever of the three routes you prefer.
114
+
115
+ ### 1. From the DSH panel (least work)
116
+
117
+ 1. Open the plugins panel in the sidebar, then **Add plugin**.
118
+ 2. Paste the **repository address** — a repository, not a bare package name:
119
+
120
+ ```
121
+ github:Alail691/dsh-better-workplace
122
+ ```
123
+
124
+ `https://github.com/Alail691/dsh-better-workplace` works too.
125
+ 3. Confirm. DSH clones the repository and registers the plugin in the active profile.
126
+
127
+ Typing just `dsh-better-workplace` answers "plugin not found": that is an npm package name, and this project lives on GitHub only — it is not published to npm.
128
+
129
+ ### 2. From the command line
130
+
131
+ ```bash
132
+ dsh plugin --profile web add github:Alail691/dsh-better-workplace
133
+ ```
134
+
135
+ Everything after `add` is handed to pnpm unchanged, so a repository address, an `https://` link, a local directory, or a `.tgz` all work:
136
+
137
+ ```bash
138
+ # From the .tgz attached to a release (no git required; replace <version> with the file name on the release page)
139
+ dsh plugin --profile web add https://github.com/Alail691/dsh-better-workplace/releases/latest/download/dsh-better-workplace-<version>.tgz
140
+
141
+ # From a local checkout
142
+ dsh plugin --profile web add /path/to/dsh-better-workplace
143
+ ```
144
+
145
+ ### 3. Mount the checkout by hand (fully offline)
146
+
147
+ ```bash
148
+ git clone https://github.com/Alail691/dsh-better-workplace.git
149
+ ```
150
+
151
+ Point the profile's `node_modules` at it — no copy needed:
152
+
153
+ ```powershell
154
+ # Windows
155
+ cmd /c mklink /J "%USERPROFILE%\.dsh\profiles\web\node_modules\dsh-better-workplace" "path\to\dsh-better-workplace"
156
+ ```
157
+
158
+ ```bash
159
+ # macOS / Linux
160
+ ln -s /path/to/dsh-better-workplace ~/.dsh/profiles/web/node_modules/dsh-better-workplace
161
+ ```
162
+
163
+ Then name the package in the profile's `package.json`:
164
+
165
+ ```jsonc
166
+ {
167
+ "dsh": {
168
+ "profile": {
169
+ "bundles": [
170
+ // …the other bundles
171
+ "dsh-better-workplace"
172
+ ]
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ Every [release](https://github.com/Alail691/dsh-better-workplace/releases) ships three files, so the download can be checked before it is installed:
179
+
180
+ | File | Purpose |
181
+ | --- | --- |
182
+ | `dsh-better-workplace-<version>.tgz` | the npm artifact, installable by pnpm or `dsh plugin add` |
183
+ | `dsh-better-workplace-<version>.zip` | the source archive, for reading or diffing |
184
+ | `SHA256SUMS` | SHA-256 of both files above |
185
+
186
+ ```bash
187
+ sha256sum -c SHA256SUMS # expect OK for both files
188
+ ```
189
+
190
+ ### Make sure the profile can install anything at all
191
+
192
+ When a profile pins a version that no longer exists on the registry, pnpm fails during resolution and no plugin can be installed. The usual culprit:
193
+
194
+ ```
195
+ ERR_PNPM_NO_MATCHING_VERSION No matching version found for dsh-purge@^1.2.1
196
+ (that package now publishes 0.0.0-stage only)
197
+ ```
198
+
199
+ Repair or drop that dependency first, then install this plugin.
200
+
201
+ ### After installing
202
+
203
+ Restart DSH (or let it hot-reload). Open a **new** conversation: its directory appears when the first message arrives, named after that moment. Existing conversations are untouched — their directory was fixed when it was created.
204
+
205
+ ## Configuration
206
+
207
+ Add to your profile's `cordis.patch.yml`:
208
+
209
+ ```yaml
210
+ - id: better-workplace
211
+ config:
212
+ guardEnabled: true # reject writes into the workplace root
213
+ namingStrategy: datetime # datetime | semantic | timestamp
214
+ categoryDirs: # Subdirectory categories
215
+ - docs
216
+ - src
217
+ - data
218
+ - assets
219
+ - tmp
220
+ # workplaceRoot: /custom/path # Optional: override workplace root
221
+ ```
222
+
223
+ ### Options
224
+
225
+ | Option | Type | Default | Description |
226
+ |--------|------|---------|-------------|
227
+ | `guardEnabled` | `boolean` | `true` | Reject file writes that land in the workplace root or in another session's directory. Set `false` for prompt-only mode. |
228
+ | `categoryDirs` | `string[]` | `['docs','src','data','assets','tmp']` | Subdirectory categories inside each session workspace. |
229
+ | `namingStrategy` | `'datetime' \| 'semantic' \| 'timestamp'` | `'datetime'` | `datetime`: `YYYYMMDDHHmmss` at session start; `semantic`: slug from the first user message; `timestamp`: `YYYY-MM-DD-hash6`. |
230
+ | `namingScript` | `'auto' \| 'zh' \| 'en'` | `'auto'` | Alphabet allowed in a `semantic` name. |
231
+ | `allowRootFiles` | `string[]` | `[]` | Filenames still allowed at the root, e.g. `[README.md]`. Dotfiles and the sidecar are always allowed. |
232
+ | `locale` | `'zh' \| 'en'` | `'zh'` | Language of the injected prompt text. |
233
+ | `workplaceRoot` | `string` | auto-detected | Override the workplace root. Leave empty for auto-detection. |
234
+ | `verbose` | `boolean` | `false` | Log directory renames. |
235
+
236
+ ## Directory Naming
237
+
238
+ ### `datetime` strategy (default)
239
+
240
+ The folder is named after the **moment the conversation started**, to the
241
+ second: `YYYYMMDDHHmmss`, local time.
242
+
243
+ - session started 2026-11-30 14:54:30 → `20261130145430/`
244
+
245
+ Properties:
246
+
247
+ - stable for the whole session — nothing is renamed later, so paths you saw
248
+ earlier keep working;
249
+ - no slug, no transliteration, no path fragment, no random hash;
250
+ - sorts chronologically in any file manager;
251
+ - if two conversations start inside the same second (a script opening several
252
+ sessions), the second gets `-2`, the third `-3`, and so on.
253
+
254
+ ### `semantic` strategy
255
+
256
+ Opt-in. Builds a readable slug from the first user message and renames the
257
+ timestamp folder once that message arrives.
258
+
259
+ - "Build a Python web scraper for product data" → `build-python-scraper-product`
260
+ - 中文消息优先取中文关键词(`namingScript: zh`),英文消息取英文词
261
+
262
+ ### `timestamp` strategy
263
+
264
+ `YYYY-MM-DD-hash6`, stable, e.g. `2026-11-28-a1b2c3`.
265
+
266
+ ## Category Subdirectories
267
+
268
+ | Directory | Purpose |
269
+ |-----------|---------|
270
+ | `docs/` | Documentation, reports, markdown, text files |
271
+ | `src/` | Source code, scripts, executables |
272
+ | `data/` | Datasets, CSVs, JSON, data files |
273
+ | `assets/` | Images, media, static assets |
274
+ | `tmp/` | Temporary files, logs, scratch work |
275
+
276
+ ## Architecture
277
+
278
+ ```
279
+ dsh-better-workplace/
280
+ ├── index.js # Host entry: name, inject, apply(ctx, config)
281
+ ├── lib/
282
+ │ ├── dir-namer.js # datetime (default), semantic slug, timestamp hash
283
+ │ ├── path-utils.js # Path extraction, resolution, containment checks
284
+ │ ├── session-store.js # Persistent SessionId → dirPath mapping (sidecar)
285
+ │ └── client.js # Browser half: session hover card stamp (web bundle)
286
+ ├── test/
287
+ │ ├── harness.mjs # 58 assertions, no DSH needed: node test/harness.mjs
288
+ │ └── client.mjs # 41 assertions on the bundle, no browser: node test/client.mjs
289
+ ├── locale/
290
+ │ ├── en.json # Plugin metadata (title, description)
291
+ │ └── zh.json # Chinese metadata
292
+ ├── assets/
293
+ │ ├── zh/ # Chinese illustrations (README.md)
294
+ │ ├── en/ # English illustrations (this file)
295
+ │ ├── render.py # renders all six (zh/en × 3)
296
+ │ └── check.py # overlap and edge audit
297
+ ├── cordis.patch.yml # Plugin registration with default config
298
+ ├── package.json # DSH bundle + dsh.client declarations
299
+ ├── icon.svg # Plugin icon
300
+ ├── CHANGELOG.md # Release notes
301
+ ├── LICENSE # MIT licence
302
+ ├── README.md # Simplified Chinese (default, GitHub landing page)
303
+ ├── README.en.md # English
304
+ └── .github/workflows/ # builds a release on every tag
305
+ ```
306
+
307
+ ### Flow
308
+
309
+ ```
310
+ New conversation opened
311
+ │
312
+ ▼
313
+ session/created → adopt() → parked: no folder, prompt says "not created yet"
314
+ │ (a sidecar row pointing at an empty shell is recycled here)
315
+ │
316
+ ▼
317
+ first user/message → its own event.time T names the folder
318
+ │
319
+ ▼
320
+ mkdir workplace/T/{docs,src,data,assets,tmp}/
321
+ │
322
+ ▼
323
+ (namingStrategy: semantic only) the same message renames it once to a slug
324
+ │ "帮我用 python 写个网页爬虫" → "python-web-scraper"
325
+ │ datetime folders are final and never renamed
326
+ │
327
+ ▼
328
+ draft closed without a message → folder removed, sidecar row dropped
329
+ │
330
+ ▼
331
+ every prompt assembly → systemPrompt.context() names THIS session's folder
332
+ │
333
+ ▼
334
+ Model writes file → tools.guard() checks the resolved target
335
+ │ write(file_path="output.txt") → workplace/output.txt → DENY
336
+ │ write(file_path="src/main.py") → workplace/<own>/src/... → ALLOW
337
+ │ write(file_path="my-repo/x.md") → workplace/my-repo/x.md → ALLOW
338
+ │ write(file_path="<other-session>/x.md") → DENY
339
+ │
340
+ ▼
341
+ sidebar session hover card → host route /better-workplace/api/sessions
342
+ │ sessionId → { dir: "20261130145430", at: <epoch ms> }
343
+ ▼
344
+ lib/client.js → slot 'sidebar.session.row.hover' → "2026-11-30 14:54:30"
345
+ │ (CSS hides the card's own relative line for session cards only)
346
+ ```
347
+
348
+ Shell redirection is **not** intercepted: this DSH build offers no veto hook on
349
+ the filesystem layer (`fs/write-intent` carries an optimistic-concurrency
350
+ version, not a decision), so the prompt rules cover `echo x > file` instead.
351
+
352
+ ## Known Limitations
353
+
354
+ 1. **Session cwd is immutable.** DSH's `SessionHeader.cwd` is set at creation and cannot change. This plugin does NOT change cwd — it uses soft isolation (prompt + guards). Shell tools (`ops_bash`, `pwsh`) still default to the workplace root; the prompt rules guide the model to `cd` into the session directory.
355
+
356
+ 2. **A directory name is fixed when the first message arrives.** With the
357
+ default `datetime` strategy the folder is named for the second that message
358
+ was recorded; nothing renames it later, so a path you saw at any point still
359
+ works. `semantic` mode is the only one that renames, and only once, at that
360
+ same moment.
361
+
362
+ 3. **No cross-session file sharing.** Sessions cannot write into each other's directories. Pre-existing directories in the root (a checkout, a notes folder) stay writable — only the shallow root surface and sibling session directories are policed.
363
+
364
+ 4. **`.dsh-better-workplace.json` sidecar file.** The session→directory mapping persists in this file. It is stored in the workplace root (the one file the plugin is allowed to write there). Deleting it loses the mapping for restored sessions; they then get a fresh directory.
365
+
366
+ 5. **Only the root surface is policed.** Writes are blocked when they land directly in the workplace root (`workplace/output.csv`) or inside another session's directory. Anything nested deeper in a pre-existing project folder passes through, so keeping a repo in the workspace keeps working. Writes outside the workplace root are never touched.
367
+
368
+ 6. **The hover stamp degrades without an HTTP host.** The absolute time comes from the host over `/better-workplace/api/sessions` as `{ dir, at }`. The route is registered from a `ctx.inject(['webServer'], …)` child fiber — not from this plugin's own `inject`, which would take the guard down on a carrier without HTTP, and not with a `ctx.get('webServer')` probe, which returns `undefined` at apply time because the service materializes later. A host with no `webServer` keeps the guard and the prompt context and registers no route; the card then falls back to the session's `updatedAt`, which is the last activity, not the creation instant.
369
+
370
+ 7. **The hover stamp matches on generated class substrings.** DSH emits CSS-module names with a hash prefix (`wnFoaW_hoverTime`), so the replacement line is scoped with `[class*="hoverTime"]` plus `:has([class*="hoverStatus"])` / `:has([class*="hoverArchived"])` to leave the Workspace card untouched. A future DSH release that renames those classes drops the stamp back to the native relative wording instead of breaking the sidebar.
371
+
372
+ 8. **Shell redirection is unchecked.** `echo x > file`, `python script.py --out out.csv` and similar paths are invisible to the tool guard. The injected prompt rules ask the model to `cd` into its session directory first; that is the only defence at this layer.
373
+
374
+
375
+ 9. **Folder recycling only ever removes empty folders.** A folder is deleted only when it holds nothing but empty category directories — the shell an unused draft leaves behind. One real file anywhere inside it, at any depth, protects the whole folder. Nothing else is ever deleted.
376
+ 10. **A blank conversation shows the time you hover it, not a stored time.** DSH keeps one blank session alive and reuses it until you send a prompt, so the session has no meaningful timestamp of its own — its `updatedAt` is the moment that window was first opened, however long ago. The card is therefore stamped with the current instant until the first message arrives; from then on it shows the folder's exact instant, and both agree with the folder name character for character.
377
+
378
+ ## DSH API Signatures Used
379
+
380
+ All of these were verified against the running desktop build (`app.asar` sources
381
+ plus `cordis_inspect_query`), not inferred from older docs.
382
+
383
+ | API | Signature |
384
+ |-----|-----------|
385
+ | `session/created` | `(this: Scoped<Session>, session: Session): void` |
386
+ | `session/event` | `(this: Scoped<Session>, session: Session, event: SessionEvent): void` |
387
+ | `agent/created` | `({ agent, source, signal? }): void \| Promise<void>` |
388
+ | `session/disposed` | `(this: Scoped<Session>, session: Session): void` |
389
+ | `systemPrompt.context()` | `context({ name, order, text: string \| ((ac: AssembleContext) => string), required? }): () => void` |
390
+ | `tools.guard()` | `guard(fn: (execution: Readonly<ToolExecution>) => string \| { reason, info? } \| undefined): () => void` |
391
+ | `ctx.get(name)` | optional service lookup (`workingDirectory`, `webServer`) |
392
+ | `ctx.effect()` | `effect(() => () => void): Disposable<Promise<void>>` |
393
+ | `webServer.register()` | `register({ kind: 'exact' \| 'prefix', path: string, handler: (req, res) => void }): () => void` |
394
+ | `slots.inject()` | `inject(slot: string, fn: () => Disposable): () => void` |
395
+ | `slots.register()` | `register({ name, id, order, registrant, inject: (props) => object }, Component): () => void` |
396
+ | `__ModuleLoader__.load()` | `load({ id: string, factory: (require) => { apply, inject } }): void` |
397
+
398
+ Two details worth keeping in mind when extending this plugin:
399
+
400
+ - `AssembleContext` is built by `assembleContextFor(agent)` as `{ agent, scope: agent }`, so a context provider reads the live `Agent` — and therefore the `SessionId` — from `ac.agent`. That is how the prompt names the right directory per session.
401
+ - `SessionHeader` has **no `title` field** in this build (`{ version, id, createdAt, cwd?, parentSession?, isSeeded, origin?, delegationDepth?, agentPreset? }`), so the directory name comes from the first user message, never from a session title.
402
+ - `SessionEvent` carries its own `time: number` (`{ type, seq, time, data, ignorable? }`), so the first `user/message` answers "when did this conversation actually begin" without trusting `header.createdAt`, which is the moment the window was opened.
403
+ - `SessionSummary` — the only per-session object the client half can read — has **no creation time** either (`{ agentAvailable, formatStatus?, sessionId, updatedAt, running, blank, parentSessionId?, origin?, cwd?, projections? }`). That is why the hover stamp is delivered from the host side over HTTP rather than computed in the browser.
404
+
405
+ ## Compatible DSH Versions
406
+
407
+ - DSH desktop ≥ 0.9 (verified on the `deepseek-v4.1-flash-1017` desktop build)
408
+ - No `@deepseek-ai/*` runtime imports: the host half only uses the injected
409
+ `tools` and `systemPrompt` services plus optional `ctx.get('workingDirectory')`
410
+ and a `ctx.inject(['webServer'], …)` child fiber for the map route; the
411
+ browser half only touches `slots` and the
412
+ global `__ModuleLoader__` / `react` provided by the shell.
413
+ - `engines.node >= 22` (ESM, `import.meta.dirname`)
414
+
415
+ ## License
416
+
417
+ [MIT](LICENSE) © 2026 Alail691
418
+
419
+ Free to use, modify, and redistribute, including commercially, as long as the
420
+ copyright and permission notice above stay in all copies. Provided as is,
421
+ without warranty of any kind.