dsh-better-workplace 0.0.0-stage → 1.4.3

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