dsh-git-worktree 0.6.0 → 0.7.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/NOTICE +14 -0
  3. package/README.en.md +74 -286
  4. package/README.md +78 -307
  5. package/cordis.patch.yml +7 -3
  6. package/lib/adapters/registry.js +29 -0
  7. package/lib/adapters/registry.js.map +1 -1
  8. package/lib/client/WorktreeReviewRow.d.ts +1 -1
  9. package/lib/client/WorktreeReviewRow.js +8 -0
  10. package/lib/client/WorktreeReviewRow.js.map +1 -1
  11. package/lib/client/console-remote/adapter.js +1 -0
  12. package/lib/client/console-remote/adapter.js.map +1 -1
  13. package/lib/client/index.d.ts +1 -1
  14. package/lib/client/index.js +3 -1
  15. package/lib/client/index.js.map +1 -1
  16. package/lib/client/pre-session/PreSessionWorktreeToggle.js +27 -11
  17. package/lib/client/pre-session/PreSessionWorktreeToggle.js.map +1 -1
  18. package/lib/client/pre-session/controller.js +9 -0
  19. package/lib/client/pre-session/controller.js.map +1 -1
  20. package/lib/client/review-console/ReviewActions.js +14 -12
  21. package/lib/client/review-console/ReviewActions.js.map +1 -1
  22. package/lib/client/styles.js +61 -0
  23. package/lib/client/styles.js.map +1 -1
  24. package/lib/client/target-console/TargetStatusAction.js +2 -2
  25. package/lib/client/target-console/TargetStatusAction.js.map +1 -1
  26. package/lib/client/target-console/WorktreeReviewStatus.js +6 -6
  27. package/lib/client/target-console/WorktreeReviewStatus.js.map +1 -1
  28. package/lib/client/workspace-sidebar/index.d.ts +33 -0
  29. package/lib/client/workspace-sidebar/index.js +127 -0
  30. package/lib/client/workspace-sidebar/index.js.map +1 -0
  31. package/lib/client/workspace-sidebar/model.d.ts +37 -0
  32. package/lib/client/workspace-sidebar/model.js +88 -0
  33. package/lib/client/workspace-sidebar/model.js.map +1 -0
  34. package/lib/client.js +2907 -32
  35. package/lib/console-contract.d.ts +19 -0
  36. package/lib/console-contract.js.map +1 -1
  37. package/lib/console-host/control-plane.d.ts +2 -1
  38. package/lib/console-host/control-plane.js +53 -1
  39. package/lib/console-host/control-plane.js.map +1 -1
  40. package/lib/console-host/projection.js +1 -1
  41. package/lib/console-host/projection.js.map +1 -1
  42. package/lib/console-host/service.d.ts +2 -1
  43. package/lib/console-host/service.js +6 -0
  44. package/lib/console-host/service.js.map +1 -1
  45. package/lib/console-remote/descriptors.js +4 -3
  46. package/lib/console-remote/descriptors.js.map +1 -1
  47. package/lib/console-remote/remote.d.ts +2 -1
  48. package/lib/console-remote/remote.js.map +1 -1
  49. package/lib/console-remote/schemas.d.ts +2 -1
  50. package/lib/console-remote/schemas.js +14 -0
  51. package/lib/console-remote/schemas.js.map +1 -1
  52. package/lib/session-checkout-module.js +11 -4
  53. package/lib/session-checkout-module.js.map +1 -1
  54. package/lib/tools.js +1 -1
  55. package/lib/tools.js.map +1 -1
  56. package/package.json +28 -11
  57. package/scripts/check-publish.mjs +48 -8
  58. package/scripts/check-workspace-sidebar-version.mjs +14 -0
  59. package/scripts/dev-dsh-lib.mjs +1 -1
  60. package/scripts/workspace-sidebar-upstream.d.mts +8 -0
  61. package/scripts/workspace-sidebar-upstream.mjs +160 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,56 @@
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.7.2] - 2026-08-30
8
+
9
+ `0.7.2` 修复 Review 历史提交信息的持久化上限、DSH Host singleton 包的依赖边界,以及非 Git Workspace 的 Worktree 入口显示,避免 registry 写入失败、重复 Host 实例和无效创建入口。
10
+
11
+ ### Fixed
12
+
13
+ - `previousReview.suggestedCommitMessage` 在投影和 registry 加载修复阶段限制为 500 字符,并安全处理 UTF-16 高代理项,避免超长建议提交信息使后续状态无法持久化;已有受影响记录会在读取时自动收敛。
14
+ - 将 Cordis、Session、Agent、Commands、Subprocess、Tools、Typert 等 DSH Host singleton 包从运行时 dependencies 移至 peerDependencies,并以精确 devDependencies 保持构建测试可复现;发布门禁会拒绝 singleton 回流 dependencies、缺少 peer 或测试版本漂移。
15
+ - pre-session 在仓库检测完成前不再显示 Worktree 开关,非 Git Workspace 检测完成后保持隐藏;Host 对 `unversioned` 目标同步关闭 create capability,避免渲染竞态或绕过 Client 入口。
16
+
17
+ ## [0.7.1] - 2026-08-28
18
+
19
+ `0.7.1` 修正项目聚合侧边栏的 Managed owner 菜单边界:恢复安全的会话整理操作,隐藏尚不具备 Worktree 生命周期语义的普通 Fork,并继续阻止会破坏唯一 owner 不变量的入口。
20
+
21
+ ### Fixed
22
+
23
+ - Managed owner 恢复官方重命名与归档;归档仅影响侧边栏可见性,不放弃任务、不清理 Worktree,也不改变交付状态。
24
+ - 普通 Fork 从 Managed 菜单隐藏;Managed Workspace 的“新会话”和跨归属拖动继续被阻止,非法操作不再弹出浏览器原生提示框。
25
+ - 强化冲突 Workspace 的 fail-open 防护,并更新项目聚合、Ready 界面截图与双语使用说明。
26
+
27
+ ## [0.7.0] - 2026-08-28
28
+
29
+ `0.7.0` 新增项目聚合侧边栏,将 Managed Worktree 的唯一 owner Session 直接显示为原 Local 项目下的任务行,同时以 fail-open 拓扑、生命周期操作限制和上游版本门禁保持官方 Workspace 行为兼容。
30
+
31
+ ### Added
32
+
33
+ - 新增项目聚合侧边栏:Local Workspace 继续承载普通多会话,每个 Managed Worktree 则直接显示为唯一 owner Session 任务行,并展示进行中、待验收、预览、恢复、已完成或已放弃状态。
34
+
35
+ ### Changed
36
+
37
+ - Managed Workspace 不再以 UUID 长路径重复占用顶级项目;cleanup 后的历史 owner Session 继续依据插件 Registry 归入原 Local 项目。
38
+ - Managed 任务行仅用于打开 owner Session,普通重命名、Fork、归档和拖动会被阻止,避免产生第二个会话或绕过 Worktree 生命周期;非托管 Workspace 保留官方操作,拓扑不可用时完整回退到原 Workspace 列表。
39
+ - 修复项目聚合 Browser 的两阶段真实启动回归:先消除重复 `sidebar.workspaces.directoryFlow` 声明,再改为版本与 SHA-256 门禁的官方 Workspace Client 单次衍生加载,保留 `renderSlot`/目录选择授权,避免 shadow 崩溃后静默回退官方侧栏。
40
+ - Managed Workspace 中可证明为空的预会话 launcher 不再阻止聚合;真实第二个 Session 仍 fail-open,物理 Workspace 未归并时也会禁止通过官方“新会话”入口创建第二个 Session。
41
+ - Managed owner 行改用官方 Branch Icon 与独立状态 Badge,任务标题保持原文;窄侧栏会优先保留 Worktree 身份和交付状态,而不是把状态截断在标题末尾。
42
+
43
+ ## [0.6.1] - 2026-08-28
44
+
45
+ `0.6.1` 统一 Preview 与最终保存的用户文案,修复 pre-session source launcher 对并发 Worktree 创建的阻塞,并让普通 Local Checkout 正确使用正常助手回复结束任务;同时将项目首页和完整使用指南重新分层。
46
+
47
+ ### Changed
48
+
49
+ - Review 主操作改为更直接的任务文案:Ready 使用“预览修改”,Preview 使用“确认并保存”,Direct Finish 使用“跳过预览并保存”;同步更新恢复、Checkpoint 与确认弹窗文案,不改变 Host 交付语义。
50
+ - 将中英文 README 收敛为 Mermaid 驱动的项目首页,新增双语 Usage 指南承接完整操作、恢复、命令与排错;同时修正 Checkpoint 迁移状态,并明确项目级 Worktree 插件与 Domi 桌面工作台之间的产品边界。
51
+
52
+ ### Fixed
53
+
54
+ - pre-session handoff 成功后自动归档已清空的 Local source launcher,防止 Harness 的 New Session 复用该 reserved source 并错误阻塞下一项并发 Worktree 任务;owner Session 与项目级 Preview 串行约束保持不变。
55
+ - 普通 Local Checkout 现在明确使用正常助手回复结束,不再被引导调用 Worktree-only Ready 工具;若模型仍误调用,Client 会隐藏预期的 `target_unselected` 结果,同时保留其他真实 Worktree 错误。
56
+
7
57
  ## [0.6.0] - 2026-08-25
8
58
 
9
59
  `0.6.0` 为长任务增加 Host-authoritative Worktree Checkpoint:用户可以把精确 Ready/Preview 阶段保存为隔离 Worktree 内部 Commit,清理当前施工状态后继续开发,同时保持 Local 完全不参与阶段提交,最终仍只交付一个累计任务 Commit。
@@ -194,6 +244,10 @@
194
244
 
195
245
  - 发布初版生产级 Worktree 管理、基础 apply/finish/discard 生命周期和安全清理。
196
246
 
247
+ [0.7.2]: https://github.com/wloops/dsh-git-worktree/compare/v0.7.1...v0.7.2
248
+ [0.7.1]: https://github.com/wloops/dsh-git-worktree/compare/v0.7.0...v0.7.1
249
+ [0.7.0]: https://github.com/wloops/dsh-git-worktree/compare/v0.6.1...v0.7.0
250
+ [0.6.1]: https://github.com/wloops/dsh-git-worktree/compare/v0.6.0...v0.6.1
197
251
  [0.6.0]: https://github.com/wloops/dsh-git-worktree/compare/v0.5.0...v0.6.0
198
252
  [0.5.0]: https://github.com/wloops/dsh-git-worktree/compare/v0.4.0...v0.5.0
199
253
  [0.4.0]: https://github.com/wloops/dsh-git-worktree/compare/v0.3.2...v0.4.0
package/NOTICE ADDED
@@ -0,0 +1,14 @@
1
+ dsh-git-worktree
2
+
3
+ The generated browser bundle includes software derived at build time from:
4
+
5
+ @deepseek-ai/dsh-client-ui-workspace 0.1.1-rc.2
6
+ Copyright (c) 2026 DeepSeek
7
+ Licensed under the MIT License
8
+ https://www.npmjs.com/package/@deepseek-ai/dsh-client-ui-workspace
9
+
10
+ The upstream browser bundle is version- and SHA-256-gated by
11
+ scripts/workspace-sidebar-upstream.mjs. Its official Workspace Browser,
12
+ WorkspacePicker, locale dictionaries, stores, and directory-flow declarations
13
+ are preserved. dsh-git-worktree wraps the Browser projection and applies
14
+ fail-closed Managed owner row decorations for Worktree identity and status.
package/README.en.md CHANGED
@@ -1,324 +1,127 @@
1
1
  # dsh-git-worktree
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/dsh-git-worktree)](https://www.npmjs.com/package/dsh-git-worktree)
4
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-git-worktree)](https://www.npmjs.com/package/dsh-git-worktree)
4
5
  [![CI](https://github.com/wloops/dsh-git-worktree/actions/workflows/ci.yml/badge.svg)](https://github.com/wloops/dsh-git-worktree/actions/workflows/ci.yml)
5
6
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
7
 
7
- **Let agents work in real Git worktrees, preview the result in Local, and commit only after explicit human approval.**
8
+ **Let agents work in real Git worktrees, preview changes in Local, and save only after explicit human confirmation.**
8
9
 
9
- `dsh-git-worktree` is an experimental Session Target plugin for [DeepSeek Harness](https://github.com/deepseek-ai/DeepSeek-Harness). Each coding task runs in its own checkout and Session, so the Local workspace controlled by the user does not become the agent's construction site.
10
+ `dsh-git-worktree` is an experimental Session Target plugin for [DeepSeek Harness](https://github.com/deepseek-ai/DeepSeek-Harness). Each coding task receives an independent checkout, Workspace, and Session so agent construction state does not leak into the user-controlled Local checkout.
10
11
 
11
- This is an independent community plugin. It is not an official DeepSeek project and does not imply endorsement, partnership, or authorization.
12
+ This is an independently maintained community plugin. It is not an official DeepSeek project and does not imply endorsement, partnership, or authorization.
12
13
 
13
- This is more than a wrapper around `git worktree`. It provides a complete delivery lifecycle: create an isolated environment, iterate safely, prepare a review, preview the task in Local without committing, finalize one task-only commit, and preserve recovery evidence when safety cannot be proven.
14
+ [中文](README.md) · [Full usage guide](docs/USAGE.en.md) · [Architecture](docs/WORKTREE-CONSOLE-ARCHITECTURE.md)
14
15
 
15
- > Its Worktree safety foundation originates from workflows used in the author's internal desktop project **Domi**. This plugin is independently adapted for Harness and does not require Domi to install or run.
16
+ ## Why use it?
16
17
 
17
- [中文文档](README.md)
18
+ When an agent edits Local directly, task changes can mix with existing staged, unstaged, and untracked work. Multiple tasks may also compete for the same checkout. This plugin separates construction from delivery:
18
19
 
19
- ## What problem does it solve?
20
-
21
- When an agent edits the current working tree directly, several concerns become entangled:
22
-
23
- - task changes mix with existing staged, unstaged, and untracked Local state;
24
- - multiple agent tasks sharing one checkout can overwrite files, switch branches, or contaminate each other's commit boundaries;
25
- - multiple tasks writing results into Local at the same time can interfere with Preview, conflict handling, and cleanup;
26
- - it becomes difficult to tell which bytes belong to the current task;
27
- - “show me the result” may already mean an irreversible write into Local;
28
- - commit, cleanup, and recovery decisions may depend too heavily on model judgment;
29
- - starting another coding round often means losing the original conversation or rebuilding its context.
30
-
31
- This plugin separates a coding task into two explicit boundaries:
32
-
33
- 1. **The agent implements and validates in an Isolated Worktree.**
34
- 2. **The user reviews the result in Local and decides whether to commit it.**
20
+ - the agent edits and tests only inside an isolated Worktree;
21
+ - the user first inspects a reversible Local Preview;
22
+ - the Host saves only the current task delta, excluding unrelated Local work;
23
+ - if safety cannot be proven, writes stop and recovery evidence is preserved.
35
24
 
36
25
  ## Highlights
37
26
 
38
- - **Real isolation** — every task gets a distinct Git worktree, Harness Workspace, cwd, and Session ID.
39
- - **Human-gated delivery** — the model may prepare a review, but it cannot Preview, Commit, Discard, or delete the Worktree by itself.
40
- - **Reversible Local Preview** — inspect the task in Local without creating a commit, then accept it or remove only that Preview.
41
- - **Local state preservation** — existing staged, unstaged, and untracked Local changes are not automatically folded into the task commit.
42
- - **Parallel preparation, serialized acceptance** — multiple Isolated Worktrees may prepare tasks concurrently, while one active Preview per Local project prevents review drafts from being written over each other.
43
- - **Stop on conflict instead of overwriting** — overlapping changes, Local drift, branch movement, or an inseparable delta enters conflict/recovery rather than silently choosing one side.
44
- - **Task-only commit** — acceptance creates one commit for the isolated task while preserving separable Local work.
45
- - **Save stage and continue** — a Ready or active Preview can be explicitly saved as a managed-Worktree-only Checkpoint. The stage commit never enters Local; development resumes from a clean worktree, and final delivery still creates one cumulative Local task commit.
46
- - **Continuous Session iterations** — after delivery and cleanup, iteration + 1 can start in the same Session with the full conversation intact.
47
- - **Automatic read-only Preflight** — once Ready, the Review card and composer dock show Local/Worktree HEAD, effective base, sync conditions, conflicts, and the acceptance slot without writing Local.
48
- - **Agent recovery continuation** — a conflict resumes Working only after an explicit user click, then sends the Local HEAD and conflict files to the exact owner Agent through the official Harness Session API; `stale_isolated` stays strictly read-only and only regenerates the review.
49
- - **Host-authoritative Detached Preview recovery** — when Local drift moves a Preview into `preview_detached`, the Host read-only checks the receipt, retained refs, HEAD/ref, index, working tree, and acceptance slot. Rollback or Finalize appears only when a fresh proof marks it safe; the user may also request read-only Agent analysis or hand off from the latest Local HEAD into a fresh Worktree.
50
- - **Verifiable Delivery Proof** — after Finalize, the UI shows the Commit OID, Local branch/HEAD, file and validation summaries, and cleanup/retention results.
51
- - **Fail-closed recovery** — stale reviews, Local drift, branch changes, concurrent Previews, and uncertain cleanup stop instead of overwriting data.
52
-
53
- > The current scope is a project-scoped Worktree Session workflow, not a cross-project global Worktree Manager. The project is still experimental; use it first in Git repositories that you can recover independently.
27
+ - **Project-grouped sidebar**: each Managed owner appears under its original Local project with a Branch Icon and status Badge; ordinary Local Sessions keep the official behavior.
28
+ - **Real isolation**: every task gets its own Git Worktree, Workspace, and unique owner Session.
29
+ - **Human acceptance**: Ready lets the user choose **Preview changes**, **Confirm and save**, or another explicit action.
30
+ - **Reversible Preview**: changes reach Local without an immediate Commit and can be rolled back safely.
31
+ - **Task-only save**: final delivery creates one Commit for the accumulated task delta.
32
+ - **Save checkpoint and continue**: checkpoints remain inside the managed Worktree and still collapse into one final delivery.
33
+ - **Safe recovery**: handles Local drift, conflicts, `preview_detached`, restarts, and interrupted cleanup.
34
+ - **Parallel construction, serialized acceptance**: many Worktrees can run concurrently while each Local project accepts one Preview at a time.
35
+ - **Continuous iterations**: after delivery and cleanup, the same Session and conversation can begin another round.
54
36
 
55
- ### Parallel tasks and conflict boundaries
56
-
57
- Multiple tasks can edit, test, and prepare reviews concurrently in separate Worktrees, Workspaces, and Sessions without sharing one checkout. Local acceptance is deliberately serialized: one canonical Local project has one acceptance slot. Until the active Preview is committed or rolled back, another task receives `project_acceptance_busy` instead of layering another write into Local.
58
-
59
- “Parallel tasks” does not mean “automatically merge every conflict.” If a task overlaps Local changes, its review becomes stale, the branch moves non-fast-forward, or the Host cannot prove that Rollback/Finalize will preserve unrelated work, the operation stops and retains recovery evidence for the user to resolve.
37
+ > The scope is a **project-scoped Worktree Session delivery plugin**, not a cross-project global Worktree Manager.
60
38
 
61
39
  ## Workflow
62
40
 
63
- ```text
64
- Local Session
65
- │
66
- ├─ Create isolated Worktree Session
67
- ▼
68
- Agent edits and validates in the Worktree
69
- │
70
- ├─ worktree_ready_for_review
71
- ▼
72
- Ready for Review
73
- │
74
- ├─ Save stage and continue ── Worktree-only Checkpoint
75
- ├─ Sync to Local Preview ── Accept and commit
76
- │ ├─ Roll back and continue editing
77
- │ └─ Roll back Preview, save stage, continue
78
- ├─ Skip Preview and commit directly
79
- └─ Discard
80
- │
81
- └─ After cleanup: start iteration + 1 in the same Session
41
+ ```mermaid
42
+ flowchart LR
43
+ A[Local Session] -->|Create Worktree| B[Worktree Session]
44
+ B --> C[Agent edits and validates]
45
+ C --> D[Ready for Review]
46
+ D -->|Preview changes| E[Local Preview]
47
+ E -->|Confirm and save| F[Iteration delivered]
48
+ F -->|cleanup| G[Start next iteration]
49
+
50
+ D -.->|Save checkpoint and continue| H[Save checkpoint<br/>Return to editing]
51
+ E -.->|Undo this preview| I[Return to editing]
52
+ D -.->|Skip preview and save| F
82
53
  ```
83
54
 
84
- ### 1. Create an isolated Session
85
-
86
- In a blank/new Local Session, enable **Worktree** and confirm creation. Nothing is created before confirmation. After confirmation, the unsent text and image draft is transferred to the new isolated Session.
87
-
88
- An existing Local Session may also ask the model to call `worktree_create`. The source Session remains Local and is never silently switched to another cwd.
89
-
90
- ### 2. Work inside the Worktree
91
-
92
- The agent reads, edits, and validates only inside the isolated cwd. That cwd is a real Git worktree and is registered as a Harness Workspace, so Harness Workspace and Session boundaries remain authoritative.
93
-
94
- ### 3. Prepare the review
95
-
96
- When implementation and validation are complete, the agent calls `worktree_ready_for_review` with:
97
-
98
- - a change summary;
99
- - changed files;
100
- - validation status and test commands;
101
- - a suggested commit message.
102
-
103
- This stores a review report. It does not write to Local and does not create a commit. Once Ready appears, the dedicated Review card and composer dock automatically run a strictly read-only Preflight that shows Local/Worktree HEAD, effective base, changed-file count, conflicts, and the acceptance slot. Both surfaces share the same read result, but Preview and direct Finalize always force a fresh check; cached display state is never write authorization.
104
-
105
- ### 4. Choose how to deliver
106
-
107
- The user can then:
108
-
109
- - **Save stage and continue** — commit the reviewed snapshot only inside the managed Worktree, clean the construction state, and resume Working;
110
- - **Sync to Local for review** — create an uncommitted, reversible Preview;
111
- - **Accept and commit** — commit only the cumulative task delta;
112
- - **Roll back and continue editing** — remove the Preview and return to the Worktree;
113
- - **Skip review and commit directly** — use the guarded direct-delivery path after explicit confirmation;
114
- - **Discard** — clean up the task environment when all safety conditions pass.
115
-
116
- Checkpoint is available only to the exact owner when the current Review, revision, generation, and acceptance slot still match. Under the Host lock it creates a Worktree-only commit, persists the operation journal and internal artifact, performs post-write verification, and invalidates the old Review/Preview/proof. An exact completed request ID can be replayed safely. For an active Preview, the same Host operation first performs a safe rollback; if rollback cannot be proven, recovery evidence is retained and the operation stops. Local branch/HEAD, index, staged, unstaged, untracked, and working-tree state never enter the Checkpoint commit, and multiple Checkpoints still deliver one final Local commit.
117
-
118
- If Preflight reports `stale_local`, `stale_isolated`, or a conflict, old Preview/Finalize actions are disabled immediately. `stale_local` only refreshes read-only facts. A conflict resumes Working only after the user clicks **Let Agent resolve conflicts**: under the mutation lock, the Host reruns conflict Preflight/CAS, generates and persists an exact recovery proof, and only then lets the Client use the official Harness `ISession.prompt()` face to send structured Local HEAD and conflict-file context to the exact owner Session. **Regenerate review result** for `stale_isolated` keeps the target Ready and strictly read-only; the Host performs another read-only check and persists a separate, non-interchangeable proof without resuming Working or modifying files. Sending waits for the Session to load and stop streaming, then rechecks the Host proof field by field together with checkout/review/revision/cwd; duplicate clicks remain single-flight. Unsent requests survive a page refresh, but browser storage is untrusted context and must pass exhaustive kind, exact-field, OID, safe-relative-path, and Host-authority validation. An unknown in-flight result or an explicit failure requires a user-triggered retry. `project_acceptance_busy` exposes only a path-free holder summary; navigation happens only after the Host re-proves checkout, owner Session, and canonical cwd identity. After Finalize, the Review surface retains a Delivery Proof rather than collapsing to a generic success message.
119
-
120
- #### Detached Preview recovery
121
-
122
- When the Preview receipt is still intact but the Local branch/HEAD, index, or working tree has changed, delivery enters `preview_detached`. Here, detached is a delivery state, not Git detached HEAD. The Review surface automatically runs a strictly read-only Recovery Preflight and shows the Host generation, current Local HEAD/ref, and structured Rollback and Finalize conclusions.
123
-
124
- - The recovery proof binds the exact Session, checkout, revision, Review, Preview, receipt fingerprint, four retained artifacts, Local fingerprint/trees, and acceptance-slot holder. It is deterministic revalidation context, not bearer permission.
125
- - Safe Rollback, Finalize, read-only analysis, and fresh-Worktree handoff each bypass the display cache and fetch another proof. The Host then recomputes and compares it under the binding lock; any revision, Local, artifact, or slot change rejects the action before a write.
126
- - On a provable same-branch fast-forward, Rollback removes only the Preview and Finalize commits only the task delta onto the latest Local HEAD. Later staged, unstaged, untracked, and committed Local work remains. Branch switches, non-fast-forward history, committed Preview bytes, hunk conflicts, or missing artifacts fail closed.
127
- - **Let Agent analyze read-only** cannot modify the old Worktree, Local, refs/index, or artifacts. **Hand off to a fresh Worktree** creates a new managed checkout from the latest Local HEAD; failure leaves the old detached delivery, receipt, retained refs, Local state, and old Worktree unchanged.
128
- - If an exact post-write check cannot prove the target HEAD/ref/index/tree/fingerprint, the checkout enters `recovery_required` and preserves its journal and evidence. A matching Commit HEAD alone is never treated as sufficient proof of completion, and the write is not retried automatically.
129
-
130
- ### 5. Start the next round in the same conversation
131
-
132
- After a successful commit and cleanup, the current Worktree cwd is removed, but the Session and conversation remain. When the user requests more code or file changes, the plugin can recreate the immutable cwd from the latest Local HEAD and start the next iteration safely.
133
-
134
- Retained, cleanup-pending, and recovery states are never removed silently. They must be handled before another iteration can begin.
135
-
136
- ## Screenshots
137
-
138
- The following screenshots show the primary delivery flow in the order a task normally follows it.
139
-
140
- ### Create a Worktree Session
141
-
142
- After Worktree is enabled in a new Local Session, Harness explains the Session-switch boundary. The isolated Session is created and selected only after explicit confirmation.
143
-
144
- ![Confirm creation and switch to a Worktree Session](docs/screenshots/01-create-worktree.png)
145
-
146
- ### Prepare the review
147
-
148
- When implementation and validation finish, the agent prepares a Ready for Review report. The user can inspect the summary and validation evidence before syncing anything to Local.
149
-
150
- ![Worktree changes ready for review](docs/screenshots/02-ready-for-review.png)
151
-
152
- ### Review the Local Preview
55
+ ### Which action should I choose?
153
56
 
154
- After synchronization, the task delta waits in Local as a reversible Preview. The user can commit it, roll it back and continue editing, or discard the task.
155
-
156
- ![Task changes waiting for acceptance in Local Preview](docs/screenshots/03-local-preview.png)
157
-
158
- ### Confirm the commit and choose retention
159
-
160
- The default path confirms the Commit Message and cleans up the Worktree after submission. When further investigation is useful, the frozen runtime environment can instead be retained for the selected period.
161
-
162
- | Commit and clean up | Commit and retain the runtime environment |
57
+ | Goal | Action |
163
58
  | --- | --- |
164
- | ![Confirm the task-only commit and clean up the Worktree](docs/screenshots/04-commit-confirmation.png) | ![Confirm the task-only commit and retain the runtime environment](docs/screenshots/06-retain-environment.png) |
165
-
166
- ### Start the next iteration in the same Session
167
-
168
- After delivery and cleanup succeed, the conversation remains available and can begin another iteration from the latest Local HEAD.
169
-
170
- ![Delivered Session ready to start the next iteration](docs/screenshots/05-next-iteration.png)
171
-
172
- ## Design foundation and Harness adaptation
173
-
174
- The Worktree lifecycle and Git delivery engine are adapted from a mature desktop implementation that has been exercised in real workflows. The goal is not to copy its UI, but to preserve proven safety invariants:
59
+ | Inspect the result in Local first | **Preview changes** |
60
+ | The Preview looks correct | **Confirm and save** |
61
+ | Preserve progress during a long task | **Save checkpoint and continue** |
62
+ | Ask the agent for more edits | **Continue editing** or **Undo this preview** |
63
+ | Deliver without a Preview | **Skip preview and save** |
175
64
 
176
- - managed checkout registry and revision CAS;
177
- - canonical path, Git common-dir, and git-dir identity checks;
178
- - complete fingerprints for staged, unstaged, untracked, binary, and deleted files;
179
- - receipt-first Local Preview, Rollback, and Finalize;
180
- - task-only commits that preserve unrelated Local work;
181
- - internal refs, journal recovery, retention, quarantine, and conservative cleanup;
182
- - fail closed whenever the Host cannot prove that a write is safe.
65
+ See the [full usage guide](docs/USAGE.en.md) for detailed actions, recovery scenarios, and commands.
183
66
 
184
- DeepSeek Harness has a different Host and Session model from the original desktop host, so the integration was adapted rather than copied mechanically:
67
+ ## Quick start
185
68
 
186
- - Harness Workspace and Session cwd are authoritative; the plugin registry is supporting state only;
187
- - Host capabilities are exposed through strict Typert Remote, while browser UI uses public Harness Client Slots;
188
- - Local source and Isolated target always use separate Sessions;
189
- - cleanup does not mutate Harness's persisted Session cwd; the next iteration recreates the same path only after strict identity checks;
190
- - the model creates targets, resolves conflicts only after explicit authorization, regenerates stale reviews read-only, and prepares reviews, while user-controlled surfaces own Local writes, commits, and cleanup.
69
+ ### Requirements
191
70
 
192
- See [Session Target porting notes](docs/PORTING.md) for the detailed identity, state, and recovery boundary mapping.
71
+ - Node.js `^22.19.0 || >=24.0.0`
72
+ - DeepSeek Harness `0.1.1-rc.2` package line
73
+ - Harness Web Client
74
+ - A Git Workspace
193
75
 
194
- ## Requirements
195
-
196
- - Node.js `^22.19.0 || >=24.0.0`;
197
- - DeepSeek Harness `0.1.1-rc.2` package line;
198
- - Harness Web Client for the complete Worktree creation and acceptance UI;
199
- - a Git repository as the current Workspace.
200
-
201
- ## Install
202
-
203
- Install the npm package:
76
+ ### Install
204
77
 
205
78
  ```bash
206
79
  dsh plugin --profile web add dsh-git-worktree
207
80
  ```
208
81
 
209
- Or install a specific Git tag:
82
+ Or install a specific version:
210
83
 
211
84
  ```bash
212
- dsh plugin --profile web add github:wloops/dsh-git-worktree#v0.6.0
213
- ```
214
-
215
- With pnpm 10 or newer, a Git install may require this entry in the profile's `pnpm-workspace.yaml` before retrying:
216
-
217
- ```yaml
218
- allowBuilds:
219
- dsh-git-worktree: true
220
- ```
221
-
222
- Start Harness normally after installation and open a Git repository as the Workspace.
223
-
224
- ## Model tools and user controls
225
-
226
- ### Model tools
227
-
228
- | Tool | Purpose |
229
- | --- | --- |
230
- | `worktree_create` | Create a managed Worktree from a Local Session and reserve a distinct target Session |
231
- | `worktree_list` | List Worktrees visible to the current Session in the original project |
232
- | `worktree_resume_revision` | Invalidate an unsynced review and resume the current iteration without touching Local |
233
- | `worktree_begin_next_iteration` | Recreate the Worktree cwd for a delivered and successfully cleaned Session |
234
- | `worktree_ready_for_review` | Save the delivery report and stop for explicit human acceptance |
235
-
236
- Finish, Discard, Remove, and Local Preview are not model tools. Ordinary discussion leaves a Ready review unchanged; only new code or file work needs to resume Working.
237
-
238
- ### User controls
239
-
240
- The Web UI provides the normal create, Preview, rollback, commit, retention, continue-editing, and discard actions. The `Local / Worktree · status` capsule in the Session Header opens the current-target controls and the Linked Worktrees manager directly; a source Session or any linked target Session can view the same source-linked tasks, navigate to their Sessions, and manage its own Worktree without returning to the original project. The manager stays focused on status, navigation, and owner lifecycle actions and does not regain inspect/review expansion. Automatic Preflight, stale/conflict recovery, acceptance-slot navigation, and Delivery Proof remain in the dedicated Review card and composer dock. Equivalent Host-controlled operations are also available through `/worktree` commands:
241
-
242
- ```text
243
- /worktree status
244
- /worktree list
245
- /worktree continue
246
- /worktree next
247
- /worktree finalize [<reviewId> <revision>] [cleanup|retain_24h|retain_3d|retain_manual]
248
- /worktree finish <commit message>
249
- /worktree discard
250
- /worktree remove <checkoutId>
85
+ dsh plugin --profile web add github:wloops/dsh-git-worktree#v0.7.2
251
86
  ```
252
87
 
253
- `finalize` uses the suggested commit message from the current review. `finish` is the explicit direct-commit path with a user-provided message.
88
+ Open a Git Workspace and enable **Worktree** when creating a Session. An existing Local Session can also let the model call `worktree_create`.
254
89
 
255
- ## Safety model
90
+ For the first run, complete one full create → Preview changes → Confirm and save → cleanup cycle.
256
91
 
257
- Every acceptance operation is revalidated by the Host. Browser display state and model-provided identity data are never treated as authority.
92
+ If pnpm build approval blocks a Git-source install, or you need complete commands and troubleshooting, see [Installation and troubleshooting](docs/USAGE.en.md#installation-and-troubleshooting).
258
93
 
259
- Important rules include:
260
-
261
- - Local source and Isolated target use different Session IDs;
262
- - an active target Workspace must canonicalize to the managed root recorded by the Host;
263
- - one canonical Local project can have only one active Preview; a waiting owner keeps read-only Preflight but loses Preview/Finalize capability;
264
- - an acceptance-slot blocker exposes only a path-free checkout/Session/state summary; opening it requires a fresh inspect plus owner and canonical-cwd verification;
265
- - automatic Preflight creates no plan, slot, Git ref, or Local write; Preview and direct Finalize bypass display caches and check again; a waiting-to-available slot transition invalidates the old busy result, while automatic errors require an explicit retry;
266
- - Preview receipts and internal refs are persisted before Local writes;
267
- - Checkpoint binds exact owner, checkout, revision, review, generation, request ID, and acceptance slot. The Host atomically rolls back an active Preview, commits only the managed Worktree snapshot, verifies the write, invalidates old Review/Preview/proof state, and exposes neither paths nor internal refs through Remote;
268
- - `preview_detached` Recovery Preflight is strictly read-only and rechecks all four retained artifacts before and after assessment; Remote proof stays path-free and never exposes Local or Worktree paths;
269
- - Preview, Rollback, Finalize, Discard, and resume-editing paths bind checkout, revision, review, and fingerprint identity; detached mutation additionally requires a fresh generation that the Host recomputes under lock before journaling;
270
- - Rollback removes only the delta proven to belong to the Preview and preserves separable Local changes made during review; Finalize commits only the task delta onto the latest same-branch Local HEAD;
271
- - the final Local CAS occurs immediately before the first write, followed by exact HEAD/ref/index/tree/fingerprint verification; uncertain results enter `recovery_required` with the journal preserved and cannot be inferred successful from Commit HEAD alone;
272
- - branch switches, non-fast-forward history, overlapping conflicts, committed Preview bytes, or additional drift enter recovery instead of being overwritten;
273
- - cleanup verifies managed-path identity, Git metadata, and the final fingerprint; uncertain residue is retained or quarantined;
274
- - durable Delivery Proof is bound to the exact Review and records Commit, Local branch/HEAD, changed files, and validation evidence; dynamic history evidence grants no mutation capability;
275
- - historical records from the old irreversible Apply flow are not automatically finished or discarded.
94
+ ## Screenshots
276
95
 
277
- See [Worktree Console architecture](docs/WORKTREE-CONSOLE-ARCHITECTURE.md) for the complete state model and authorization matrix.
96
+ ### Project grouping and task status
278
97
 
279
- ## Current limitations
98
+ ![Managed Worktrees grouped under the original Local project](docs/screenshots/00-project-sidebar.png)
280
99
 
281
- - There is no cross-project global Worktree Manager yet.
282
- - The linked Worktree Manager opens from the Session Header control; a persistent `conversation.view` tab is still not mounted.
283
- - Harness still presents Local and Worktree Sessions as separate Workspaces by canonical cwd. The plugin manager shows the `sourceSessionId` relationship without changing native sidebar grouping.
284
- - Workflow `agent({ isolation })` integration is not available in the verified Harness `0.1.1-rc.2` line.
285
- - Subagents inherit their parent Session cwd; they share the isolated boundary only when the parent is already a Worktree Session.
286
- - Dependency snapshot/restore and the complete collaborator handoff UI have not yet been implemented.
287
- - Checkpoint history is currently append-only metadata: editing, deleting, reordering, and arbitrary rollback are not supported.
288
- - An Isolated Session cannot yet request a bounded transaction to repair the real Local checkout directly.
289
- - Cleanup removes the current Worktree cwd, but a delivered Session can recreate the path and start another iteration after strict validation.
100
+ ### Prepare the review
290
101
 
291
- ## Roadmap
102
+ ![Agent completes the task and prepares Preview changes](docs/screenshots/02-ready-for-review.png)
292
103
 
293
- The following items describe possible directions for continuing the project. They are not release-date commitments.
104
+ See the [full usage guide](docs/USAGE.en.md#complete-delivery-example) for the complete flow.
294
105
 
295
- ### Near term
106
+ ## Safety boundary
296
107
 
297
- - Continue improving marketplace presentation and end-to-end examples.
298
- - Continue hardening Ready, Preview, Rollback, Finalize, cleanup, and iteration recovery.
299
- - Improve error categories, recovery guidance, and compatibility across real Harness releases.
300
- - Re-evaluate whether a persistent Worktrees tab is still useful in addition to the Header Manager.
108
+ The Host rechecks every Local write at execution time. Browser caches and model output are never write authority. The plugin validates Session, checkout, revision, Git identity, Preview receipt, and Local state; branch switches, overlapping conflicts, unknown residue, or insufficient recovery evidence fail closed.
301
109
 
302
- ### Medium term
110
+ For the full state machine, CAS, and recovery invariants, see:
303
111
 
304
- - Continue improving Checkpoint history presentation from real long-running Harness task feedback.
305
- - Evaluate a bounded Local repair transaction: a user-approved temporary authorization tied to the current Local state, allowing an Isolated Session to repair Local through restricted tools without changing its Session Target, then automatically resume the original task.
306
- - Port dependency snapshot/restore to reduce repeated setup across Worktrees.
307
- - Complete the collaborator/subagent handoff lifecycle so delegated work can be released and delivered safely.
308
- - Continue enriching linked Worktree listing, inspection, retention, and cleanup management.
309
- - Improve review presentation with clearer diff and validation information without weakening Host authority.
112
+ - [Worktree Console architecture](docs/WORKTREE-CONSOLE-ARCHITECTURE.md)
113
+ - [Session Target porting notes](docs/PORTING.md)
310
114
 
311
- ### Long term
115
+ ## Current boundaries
312
116
 
313
- - Build a cross-project global Worktree Manager.
314
- - Integrate Workflow-level `agent({ isolation })` when Harness exposes a stable seam.
315
- - Add richer audit, runtime metrics, and recovery diagnostics.
316
- - Explore richer multi-task orchestration, serialized acceptance, and cross-Session handoff while preserving explicit human approval for every Local write.
117
+ - A normal Managed owner is grouped under its original Local project. If the owner is missing, another Session exists, or membership conflicts, the original Workspace remains visible instead of hiding uncertain data.
118
+ - Managed owners can be renamed and archived. Worktree-aware Fork is not implemented yet, so the ordinary Fork action is hidden in this release.
119
+ - Child agents inherit the parent Session cwd; the plugin does not create per-child Worktrees.
120
+ - Checkpoint does not support editing, deleting, reordering, or arbitrary rollback of history.
121
+ - Domi's global Manager, Local Maintenance, dependency snapshots, and full collaborator lifecycle are outside this plugin's scope.
317
122
 
318
123
  ## Local development
319
124
 
320
- Install dependencies and run the standard checks:
321
-
322
125
  ```bash
323
126
  pnpm install
324
127
  pnpm run typecheck
@@ -327,34 +130,19 @@ pnpm run build
327
130
  pnpm run check:publish
328
131
  ```
329
132
 
330
- For an end-to-end local Harness run:
133
+ Run the local end-to-end environment:
331
134
 
332
135
  ```bash
333
136
  pnpm run dev:dsh
334
137
  ```
335
138
 
336
- This command builds the current checkout, packs a temporary tarball, installs it into the `web` profile, validates the composed configuration, prepares a marker-protected disposable Git fixture, and starts `dsh web` at `http://127.0.0.1:3081` by default. It does not publish packages or push Git refs.
337
-
338
- Useful variants:
339
-
340
- ```bash
341
- # Install and verify the snapshot without starting Web
342
- pnpm run dev:dsh:install
343
-
344
- # Verify the already-installed profile
345
- pnpm run dev:dsh:smoke
346
-
347
- # Select another Git root, port, profile, or Harness source checkout
348
- pnpm run dev:dsh -- --repo G:/path/to/repo --port 4090 --profile web
349
-
350
- # Remove the development install and cached local archives
351
- pnpm run dev:dsh:remove
352
- ```
139
+ See the [full usage guide](docs/USAGE.en.md#local-development) for more development commands and the [release checklist](docs/RELEASE.md) before publishing.
353
140
 
354
141
  ## Documentation
355
142
 
356
- - [Session Target porting notes](docs/PORTING.md)
143
+ - [Full usage guide](docs/USAGE.en.md)
357
144
  - [Worktree Console architecture](docs/WORKTREE-CONSOLE-ARCHITECTURE.md)
145
+ - [Session Target porting notes](docs/PORTING.md)
358
146
  - [UI development notes](docs/UI-DEVELOPMENT.md)
359
147
  - [Release checklist](docs/RELEASE.md)
360
148
  - [Changelog](CHANGELOG.md)