@cerbur/clutch-dsh-worktree 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +135 -23
  2. package/README.zh.md +107 -13
  3. package/cordis.patch.yml +21 -0
  4. package/lib/client/WorktreeContext.d.ts.map +1 -1
  5. package/lib/client/WorktreeContext.js +2 -2
  6. package/lib/client/WorktreeContext.js.map +1 -1
  7. package/lib/client/WorktreeSurface.d.ts +2 -2
  8. package/lib/client/WorktreeSurface.d.ts.map +1 -1
  9. package/lib/client/WorktreeSurface.js +291 -70
  10. package/lib/client/WorktreeSurface.js.map +1 -1
  11. package/lib/client/entry.d.ts.map +1 -1
  12. package/lib/client/entry.js +84 -2
  13. package/lib/client/entry.js.map +1 -1
  14. package/lib/client/index.d.ts +3 -0
  15. package/lib/client/index.d.ts.map +1 -1
  16. package/lib/client/index.js +2 -0
  17. package/lib/client/index.js.map +1 -1
  18. package/lib/client/locales.d.ts +70 -0
  19. package/lib/client/locales.d.ts.map +1 -1
  20. package/lib/client/locales.js +70 -0
  21. package/lib/client/locales.js.map +1 -1
  22. package/lib/client/session-view.d.ts +34 -0
  23. package/lib/client/session-view.d.ts.map +1 -1
  24. package/lib/client/session-view.js +119 -1
  25. package/lib/client/session-view.js.map +1 -1
  26. package/lib/client/worktree-connection.d.ts +4 -2
  27. package/lib/client/worktree-connection.d.ts.map +1 -1
  28. package/lib/client/worktree-connection.js +4 -0
  29. package/lib/client/worktree-connection.js.map +1 -1
  30. package/lib/client/worktree-context.js +1 -1
  31. package/lib/client/worktree-context.js.map +1 -1
  32. package/lib/client/worktree-error-copy.d.ts +2 -0
  33. package/lib/client/worktree-error-copy.d.ts.map +1 -1
  34. package/lib/client/worktree-error-copy.js +24 -0
  35. package/lib/client/worktree-error-copy.js.map +1 -1
  36. package/lib/client/worktree-permission-icon.d.ts +7 -0
  37. package/lib/client/worktree-permission-icon.d.ts.map +1 -0
  38. package/lib/client/worktree-permission-icon.js +119 -0
  39. package/lib/client/worktree-permission-icon.js.map +1 -0
  40. package/lib/client/worktree-permission.d.ts +21 -0
  41. package/lib/client/worktree-permission.d.ts.map +1 -0
  42. package/lib/client/worktree-permission.js +70 -0
  43. package/lib/client/worktree-permission.js.map +1 -0
  44. package/lib/client/worktree-session-fork.d.ts +65 -0
  45. package/lib/client/worktree-session-fork.d.ts.map +1 -0
  46. package/lib/client/worktree-session-fork.js +174 -0
  47. package/lib/client/worktree-session-fork.js.map +1 -0
  48. package/lib/client/worktree-session-order.d.ts +36 -0
  49. package/lib/client/worktree-session-order.d.ts.map +1 -0
  50. package/lib/client/worktree-session-order.js +215 -0
  51. package/lib/client/worktree-session-order.js.map +1 -0
  52. package/lib/client/worktree-session.d.ts +34 -1
  53. package/lib/client/worktree-session.d.ts.map +1 -1
  54. package/lib/client/worktree-session.js +101 -3
  55. package/lib/client/worktree-session.js.map +1 -1
  56. package/lib/client/worktree-surface-rows.d.ts +4 -4
  57. package/lib/client/worktree-surface-rows.d.ts.map +1 -1
  58. package/lib/client/worktree-surface-rows.js +139 -47
  59. package/lib/client/worktree-surface-rows.js.map +1 -1
  60. package/lib/client/worktree-surface-selectors.d.ts +2 -0
  61. package/lib/client/worktree-surface-selectors.d.ts.map +1 -1
  62. package/lib/client/worktree-surface-selectors.js +8 -0
  63. package/lib/client/worktree-surface-selectors.js.map +1 -1
  64. package/lib/client/worktree-surface-types.d.ts +46 -3
  65. package/lib/client/worktree-surface-types.d.ts.map +1 -1
  66. package/lib/client/worktree-view-actions.d.ts +8 -3
  67. package/lib/client/worktree-view-actions.d.ts.map +1 -1
  68. package/lib/client/worktree-view-actions.js +28 -2
  69. package/lib/client/worktree-view-actions.js.map +1 -1
  70. package/lib/client/worktree-view-errors.d.ts +10 -0
  71. package/lib/client/worktree-view-errors.d.ts.map +1 -1
  72. package/lib/client/worktree-view-errors.js +22 -1
  73. package/lib/client/worktree-view-errors.js.map +1 -1
  74. package/lib/client.js +1515 -207
  75. package/lib/client.js.map +1 -1
  76. package/lib/contract/index.contract.js +2 -0
  77. package/lib/contract/index.contract.js.map +1 -1
  78. package/lib/contract/index.d.ts +11 -3
  79. package/lib/contract/index.d.ts.map +1 -1
  80. package/lib/contract/index.js +8 -0
  81. package/lib/contract/index.js.map +1 -1
  82. package/lib/contract/worktree-permission.d.ts +73 -0
  83. package/lib/contract/worktree-permission.d.ts.map +1 -0
  84. package/lib/contract/worktree-permission.js +32 -0
  85. package/lib/contract/worktree-permission.js.map +1 -0
  86. package/lib/host/dsh-read-adapter.d.ts +1 -0
  87. package/lib/host/dsh-read-adapter.d.ts.map +1 -1
  88. package/lib/host/dsh-read-adapter.js +6 -0
  89. package/lib/host/dsh-read-adapter.js.map +1 -1
  90. package/lib/host/index.d.ts +4 -0
  91. package/lib/host/index.d.ts.map +1 -1
  92. package/lib/host/index.js +2 -0
  93. package/lib/host/index.js.map +1 -1
  94. package/lib/host/remote.d.ts +2 -2
  95. package/lib/host/remote.d.ts.map +1 -1
  96. package/lib/host/remote.js +7 -1
  97. package/lib/host/remote.js.map +1 -1
  98. package/lib/host/service.d.ts +5 -1
  99. package/lib/host/service.d.ts.map +1 -1
  100. package/lib/host/service.js +42 -3
  101. package/lib/host/service.js.map +1 -1
  102. package/lib/host/worktree-permission-manager.d.ts +14 -0
  103. package/lib/host/worktree-permission-manager.d.ts.map +1 -0
  104. package/lib/host/worktree-permission-manager.js +113 -0
  105. package/lib/host/worktree-permission-manager.js.map +1 -0
  106. package/lib/host/worktree-permission.d.ts +38 -0
  107. package/lib/host/worktree-permission.d.ts.map +1 -0
  108. package/lib/host/worktree-permission.js +156 -0
  109. package/lib/host/worktree-permission.js.map +1 -0
  110. package/lib/index.d.ts +6 -4
  111. package/lib/index.d.ts.map +1 -1
  112. package/lib/index.js +3 -1
  113. package/lib/index.js.map +1 -1
  114. package/lib/manage/manager-context.d.ts +2 -0
  115. package/lib/manage/manager-context.d.ts.map +1 -1
  116. package/lib/manage/manager-worktrees.d.ts +5 -0
  117. package/lib/manage/manager-worktrees.d.ts.map +1 -1
  118. package/lib/manage/manager-worktrees.js +125 -37
  119. package/lib/manage/manager-worktrees.js.map +1 -1
  120. package/lib/manage/manager.d.ts +20 -0
  121. package/lib/manage/manager.d.ts.map +1 -1
  122. package/lib/manage/manager.js +91 -13
  123. package/lib/manage/manager.js.map +1 -1
  124. package/lib/manage/types.d.ts +9 -1
  125. package/lib/manage/types.d.ts.map +1 -1
  126. package/lib/manage/worktree-permission.d.ts +3 -0
  127. package/lib/manage/worktree-permission.d.ts.map +1 -0
  128. package/lib/manage/worktree-permission.js +3 -0
  129. package/lib/manage/worktree-permission.js.map +1 -0
  130. package/lib/provider/git.d.ts +37 -9
  131. package/lib/provider/git.d.ts.map +1 -1
  132. package/lib/provider/git.js +162 -61
  133. package/lib/provider/git.js.map +1 -1
  134. package/lib/provider/index.d.ts +5 -1
  135. package/lib/provider/index.d.ts.map +1 -1
  136. package/lib/provider/index.js +4 -0
  137. package/lib/provider/index.js.map +1 -1
  138. package/lib/provider/mutation-lock.d.ts +37 -0
  139. package/lib/provider/mutation-lock.d.ts.map +1 -0
  140. package/lib/provider/mutation-lock.js +270 -0
  141. package/lib/provider/mutation-lock.js.map +1 -0
  142. package/lib/provider/mutation-token.d.ts +8 -0
  143. package/lib/provider/mutation-token.d.ts.map +1 -0
  144. package/lib/provider/mutation-token.js +20 -0
  145. package/lib/provider/mutation-token.js.map +1 -0
  146. package/lib/provider/repository-fingerprint.d.ts +8 -0
  147. package/lib/provider/repository-fingerprint.d.ts.map +1 -0
  148. package/lib/provider/repository-fingerprint.js +13 -0
  149. package/lib/provider/repository-fingerprint.js.map +1 -0
  150. package/lib/provider/sidecar-persistence.d.ts +7 -3
  151. package/lib/provider/sidecar-persistence.d.ts.map +1 -1
  152. package/lib/provider/sidecar-persistence.js +118 -44
  153. package/lib/provider/sidecar-persistence.js.map +1 -1
  154. package/lib/provider/sidecar-schema.d.ts +1 -1
  155. package/lib/provider/sidecar-schema.d.ts.map +1 -1
  156. package/lib/provider/sidecar-schema.js +140 -8
  157. package/lib/provider/sidecar-schema.js.map +1 -1
  158. package/lib/provider/sidecar.d.ts +3 -1
  159. package/lib/provider/sidecar.d.ts.map +1 -1
  160. package/lib/provider/sidecar.js +6 -1
  161. package/lib/provider/sidecar.js.map +1 -1
  162. package/lib/provider/subprocess.d.ts +37 -0
  163. package/lib/provider/subprocess.d.ts.map +1 -0
  164. package/lib/provider/subprocess.js +319 -0
  165. package/lib/provider/subprocess.js.map +1 -0
  166. package/lib/provider/transaction.d.ts +65 -0
  167. package/lib/provider/transaction.d.ts.map +1 -0
  168. package/lib/provider/transaction.js +1011 -0
  169. package/lib/provider/transaction.js.map +1 -0
  170. package/lib/provider/types.d.ts +98 -7
  171. package/lib/provider/types.d.ts.map +1 -1
  172. package/lib/provider/types.js +1 -1
  173. package/lib/provider/types.js.map +1 -1
  174. package/lib/typert.host.js +133 -30
  175. package/lib/typert.remote-client.d.ts +7 -3
  176. package/lib/typert.remote-client.d.ts.map +1 -1
  177. package/lib/typert.remote-client.js +133 -30
  178. package/package.json +3 -1
package/README.md CHANGED
@@ -26,16 +26,46 @@ the adjacent Import tab, and a standard dropdown containing safe example branch/
26
26
  - Remove plugin-created and imported Worktrees through real `git worktree remove`; removing an imported Worktree can delete its linked directory and is called out in the confirmation dialog.
27
27
  - Create a normal Session from Main or a Session whose runtime cwd is an active Worktree, then
28
28
  open it directly.
29
+ - For active Worktree Sessions, request the named `worktree-full-access` preset after an
30
+ explicit confirmation. It combines DSH `danger-full-access` with `ask`: it removes filesystem
31
+ confinement for linked Git metadata while keeping approval prompts enabled; network and
32
+ process policy are unchanged. The native Access menu marks `Worktree Full Access` with a
33
+ Worktree branch icon.
34
+ - Preserve an explicit restriction selected in DSH's native Access UI. If the custom preset is
35
+ unavailable, fall back to `workspace-write + ask` when possible; if the permission capability
36
+ cannot be verified, show a retryable degraded state instead of claiming Full Access.
37
+ - Reuse the native `StateDot` for Session status indicators. Running, running-subagent, warning,
38
+ and completed states occupy the trailing slot; idle Sessions show native relative time for the
39
+ last human-authored message there. Hover or an open menu gives the trailing slot back to the
40
+ existing actions menu.
41
+ - Show the native DSH Session hover detail card with the complete title, relative time, and current
42
+ status; the card yields to the Session actions menu and row dragging.
43
+ - Cover native waiting-for-approval, plan-review, question, completed, idle, and running-subagent
44
+ states without copying the animation implementation into the plugin.
45
+ - Show one native running indicator on a collapsed Workspace, Main, or Worktree when any of its
46
+ non-archived Sessions is active; expanded groups keep their normal action rail instead.
47
+ - Promote a Session to the head of its Main or Worktree visual group after a newer user message.
48
+ This ordering is browser-local and does not mutate DSH Workspace order or the Worktree sidecar.
49
+ - Fork a Session from the native DSH Workspace tab, the Worktree view, or the Conversation fork
50
+ action. When the parent has an active Worktree binding, the child is bound to the same Worktree,
51
+ then added to the browser-local Workspace membership projection after the binding refresh; the
52
+ child remains a normal DSH Session. The refresh ordering keeps it from briefly appearing in
53
+ Main/Local. A sidecar failure keeps the child available and exposes retryable binding recovery.
29
54
  - See ready, repair, active, and detached Worktree states, including retryable operation errors.
30
- - Remove an active Worktree from its options menu with confirmation. Main and detached rows do
31
- not expose that menu.
55
+ - Use the shared Main and Worktree row options menu to copy the selected row's absolute path.
56
+ Main and detached rows show only `Copy path`; active Worktree rows also show `Remove Worktree`
57
+ with confirmation.
58
+ - Create a new Worktree from the Local or an active Worktree's options menu. The Create dialog
59
+ uses the selected row's current branch as its base and suggests the next available numbered
60
+ name, such as `feature-2` or `feature-3`; detached Worktrees do not expose this action.
32
61
  - Continue using DSH-native Workspace rename/delete/reorder and Session menus. Worktree rows can
33
62
  be reordered within their owning Workspace; order is stored in the plugin sidecar and Main is
34
63
  fixed first.
35
64
  - Persist Workspace, Main, and Worktree expansion choices in browser-local storage; the five-row Session overflow state remains transient and resets after refresh or parent collapse.
36
- - Highlight the DSH current Session in Worktree view; entering Worktree mode or switching the current Session temporarily reveals its Workspace/Main/Worktree path, expands Session overflow, clears a hiding search, and scrolls the row into view; this browser-local behavior does not change persisted expansion choices.
65
+ - Highlight the DSH current Session in Worktree view; entering Worktree mode or switching the current Session temporarily reveals its Workspace/Main/Worktree path, expands Session overflow only when the row is outside the first five, clears a hiding search, and scrolls the row into view; this browser-local behavior does not change persisted expansion choices.
37
66
  - Keep the current local branch or Worktree branch visible as read-only context in the existing
38
67
  Conversation title row and in the blank-session Hero.
68
+ - Copy the ID of any non-blank Worktree Session from its Session actions menu.
39
69
  - Keep Conversation and Hero context stable across same-Session snapshot updates and Session
40
70
  switches, while retaining the last valid context during replacement reads.
41
71
  - Truncate long branch labels to fit their chips and reveal the complete value through a native
@@ -43,6 +73,10 @@ the adjacent Import tab, and a standard dropdown containing safe example branch/
43
73
  `WT` button when the Sidebar is collapsed.
44
74
  - Keep Worktree Sessions in the original DSH Project/Workspace view; the plugin does not copy
45
75
  Session content or modify messages, prompts, transcripts, or history.
76
+ - Worktree fork membership is not written to DSH's durable `Workspace.sessionIds`. While this
77
+ plugin is loaded, the browser can show the child through its local projection; without the
78
+ plugin, the child remains in DSH's global Session management but is not durably attached to the
79
+ native Workspace root membership.
46
80
 
47
81
  ### Compatibility and prerequisites
48
82
 
@@ -200,12 +234,15 @@ blank-session Hero. The displayed language follows DSH's current language settin
200
234
 
201
235
  1. Select a Workspace, press its `+`, choose a baseline local branch, and enter a Worktree name.
202
236
  The default branch name is `dsh/<8-character-random-string>`.
203
- 2. The target Worktree path must be absolute, belong to the same Project, and differ from the
237
+ 2. To create a sibling from an existing Worktree, open that active Worktree's options menu and
238
+ choose `Create new Worktree`. The dialog preselects the Worktree branch as the base and
239
+ chooses the next available numeric suffix for the name; existing names are skipped.
240
+ 3. The target Worktree path must be absolute, belong to the same Project, and differ from the
204
241
  Project root. Relative paths, a different Project, or the Project root are rejected.
205
- 3. Git must be installed and available on `PATH`. A missing Git executable shows install guidance
242
+ 4. Git must be installed and available on `PATH`. A missing Git executable shows install guidance
206
243
  and no command block; install Git, restart DSH, and retry. If the repository, initial commit,
207
- or local branch is missing, follow the copyable setup commands in the dialog. The plugin only
208
- renders this guidance; it does not run setup or installation commands or edit business files.
244
+ or local branch is missing, follow the copyable setup commands in the dialog. The plugin only
245
+ renders this guidance; it does not run setup or installation commands or edit business files.
209
246
 
210
247
  ### Import an existing Worktree
211
248
 
@@ -217,8 +254,9 @@ blank-session Hero. The displayed language follows DSH's current language settin
217
254
  diagnostic text.
218
255
  3. Choose an option and select `Import Worktree`. Registration writes only the plugin sidecar;
219
256
  the existing Worktree directory and Git working state remain in place. Import then creates or
220
- reuses a Session at that Worktree cwd and runs the same bind → membership projection open
221
- refresh flow as Create.
257
+ reuses a Session at that Worktree cwd and runs the same bind → openbinding refresh flow as
258
+ Create. Newly created Sessions are not projected into native Workspace membership before the
259
+ binding refresh.
222
260
  4. An active external import for the same Workspace and physical path is idempotent. A path already
223
261
  managed by the plugin returns `WORKTREE_ALREADY_MANAGED`; invalid or stale candidates return
224
262
  `WORKTREE_IMPORT_INVALID` and can be retried after the repository state is fixed.
@@ -228,31 +266,78 @@ blank-session Hero. The displayed language follows DSH's current language settin
228
266
  - Use Main's `+` to create a normal DSH Session in the Project-root view.
229
267
  - Use a Worktree's `+` to create or reuse a Session with that Worktree as its runtime cwd. The
230
268
  plugin calls the upstream runtime with `session.create({ cwd: worktreePath })`, then saves the
231
- external binding, applies a browser-local `{ workspaceId, sessionId }` membership projection,
232
- and opens the Session.
269
+ external binding and opens the Session. The browser-local `{ workspaceId, sessionId }` membership
270
+ projection is refreshed afterward, so the newly created Session does not briefly appear in Main.
233
271
  - The connector reuses an unarchived blank Session with the exact target cwd when possible. An
234
272
  already-bound Session opens directly; an unbound candidate is bound before projection and
235
- opening. Otherwise the flow is `create → bind → projectopen`, and concurrent clicks for the
236
- same Worktree are coalesced.
273
+ opening. Otherwise the new-Session flow is `create → bind → openrefresh`, and concurrent
274
+ clicks for the same Worktree are coalesced.
237
275
  - If binding fails after DSH has created the Session, the Session ID remains available for Retry
238
276
  or Open recovery. The plugin does not delete or mutate that DSH Session.
277
+ - Before opening an active Worktree Session, the plugin explains in a DSH-styled in-page dialog why
278
+ linked Git metadata may need access outside the Session directory. The dialog requires an explicit
279
+ risk acknowledgement; cancelling keeps the Session and binding, does not change permissions, and
280
+ leaves a retryable pending state. The native DSH Access selector remains the way to switch to
281
+ another permission mode.
239
282
  - A provisional blank Session follows DSH's native display rules: it is shown only in the
240
283
  selected view, uses the localized `New Session` label, hides its generated ID, and has no
241
284
  Rename, Fork, or Archive menu. After the first prompt is accepted, it becomes an ordinary
242
285
  Session row; hiding the blank row does not delete the Session or its Worktree binding.
243
286
 
287
+ ### Session activity and ordering
288
+
289
+ - Session rows reuse DSH's native `StateDot`: running Sessions, Sessions with running subagents,
290
+ waiting approval, plan review, question, and completed states show their status dot in the
291
+ trailing slot instead of relative time. Idle Sessions use that slot for the native compact
292
+ relative-time label.
293
+ - The trailing metadata uses the native compact buckets (`now`, minutes, hours, days, months, and
294
+ years). It is based on DSH's `updatedAt`, which advances with the latest human-authored message;
295
+ blank New Session rows have no time label. The display follows snapshot renders and does not add
296
+ an independent minute ticker.
297
+ - Hovering a Worktree Session row opens the native detail card after 500 ms with its full title,
298
+ relative time, and status; the card is suppressed while the Session menu is open or a row is
299
+ being dragged.
300
+ - A collapsed Workspace, Main group, or Worktree group shows the same running dot when any
301
+ non-archived member is ongoing, including activity hidden by search. Expanding the group hides
302
+ the aggregate dot; hover, focus, or an open menu reveals the existing action controls.
303
+ - A newer user message promotes its Session to the head of the current Main or Worktree visual
304
+ group. The promotion, observed timestamps, and per-group order live only in browser-local state;
305
+ successful manual drag still uses the native DSH ordering API before updating that local order.
306
+
307
+ ### Fork Worktree Sessions
308
+
309
+ - Use any native DSH fork entry point: a Session-list tab, a Worktree Session menu, or the
310
+ Conversation fork action. The plugin wraps the shared DSH `sessions.fork` service, so the
311
+ original fork cut, title increment, and child lineage stay native.
312
+ - After DSH creates the child, the plugin looks up the parent's active sidecar binding, writes the
313
+ child binding through the existing `/api` Manager. The Worktree view refreshes the binding before
314
+ replaying the browser-local Workspace membership projection, so the child does not briefly appear
315
+ in Main/Local; ready content is retained during that refresh.
316
+ - If the child is created but sidecar lookup or binding fails, DSH keeps the child and the plugin
317
+ shows Retry Binding/Open Created Session recovery. A later plugin initialization also retries
318
+ recoverable fork children from native Session lineage summaries; it never binds unrelated
319
+ subagents automatically.
320
+ - This flow does not persist the child into DSH `Workspace.sessionIds`. The native DSH Workspace
321
+ view can only see the temporary browser projection while the plugin is loaded; the durable native
322
+ Workspace data is unchanged.
323
+
244
324
  ### Reorder and manage Worktrees
245
325
 
246
326
  - Drag Worktrees within their owning Workspace. The ordered `worktrees` array is persisted in
247
327
  the plugin sidecar; Main is a fixed first row and Worktrees cannot move across Workspaces.
248
- - Use the active Worktree options menu and confirmation dialog to remove a Worktree. Main and
249
- detached Worktrees do not show this menu.
328
+ - Open the shared Main and Worktree options menu to copy the selected row's absolute path. Main
329
+ and detached/removed Worktrees show only `Copy path`; active Worktrees also show `Remove
330
+ Worktree` with a confirmation dialog.
250
331
  - Imported Worktrees expose the same active options menu as plugin-created Worktrees. Removing
251
332
  either source runs real `git worktree remove`; for an imported Worktree, the confirmation warns
252
333
  that the linked Worktree directory may be deleted. Sessions are retained as detached bindings.
253
334
  - Removing a Worktree does not delete its Sessions. The relationship remains detached until it
254
335
  is explicitly unbound. Deleting a Workspace removes only DSH's Workspace registration; its
255
336
  directory, Sessions, Git Worktrees, and plugin sidecar remain.
337
+ - After a successful removal, detached Sessions that still have Full Access are normalized to
338
+ `workspace-write + ask` when the public DSH permission service is available. An unavailable
339
+ service is reported as an unverified, retryable warning; it never grants Full Access to a
340
+ detached Session.
256
341
  - DSH-native Workspace rename/delete/reorder and Session menus remain available. Session drag
257
342
  ordering is limited to the current visual Main or Worktree group.
258
343
  - The Main group shows the current local branch as `Local (branch)` and falls back to `Local` if
@@ -270,14 +355,18 @@ blank-session Hero. The displayed language follows DSH's current language settin
270
355
  ### Understand status and recovery messages
271
356
 
272
357
  - `ready` means the Worktree is available. `repair` identifies a missing or invalid Worktree,
273
- Session, binding, or cwd. `detached` means the Git Worktree was removed while the relationship
274
- was retained. An active binding pointing to a missing Worktree produces an explicit repair
275
- warning or error; it never silently falls back to another Worktree.
358
+ Session, binding, or cwd. `recovery-needed` means a Git/sidecar operation or identity check is
359
+ unresolved and destructive actions are blocked. `detached` means the Git Worktree was removed
360
+ while the relationship was retained. An active binding pointing to a missing Worktree produces
361
+ an explicit repair warning or error; it never silently falls back to another Worktree.
276
362
  - Worktree health is a runtime Git projection and is not written to the sidecar. Git readiness
277
363
  failures are shown per Workspace: a missing Git executable shows installation guidance without
278
364
  commands, while repository, initial commit, or local branch failures show copyable setup
279
365
  commands. Connection, Gateway, and unexpected Worktree-domain failures remain visible as
280
366
  retryable errors rather than empty lists.
367
+ - Permission status is also explicit: Full Access, fallback `workspace-write`, preserved user
368
+ restriction, unverified capability, confirmation pending, and retryable setup failure are not
369
+ silently collapsed into an empty or falsely successful Worktree state.
281
370
  - Refreshing an already-ready view preserves its current projection until replacement data is
282
371
  available. Same-Session snapshot updates do not blank the context or trigger redundant reads;
283
372
  initial entry and explicit Retry may show a loading state when no cached view is available.
@@ -311,17 +400,35 @@ store a copy of `projectRoot` or any Session content. If the sidecar is unavaila
311
400
  the native Project/Session view remains readable and the plugin becomes degraded/read-only; an
312
401
  empty index must never overwrite the native DSH lists.
313
402
 
403
+ The sidecar accepts v1 and v2 snapshots for backwards-compatible reads. Legacy records are
404
+ normalized in memory, and the first successful mutation atomically upgrades the shard to v3.
405
+ New v3 snapshots use a revision, an opaque repository fingerprint, and durable pending-operation
406
+ metadata for Git create/remove. A transitional v3 snapshot containing an older raw repository
407
+ field is read and cleaned on its next stable write. Invalid JSON, unknown schema versions, and
408
+ invariant violations are reported as corruption rather than reset to an empty index.
409
+
314
410
  Each Session has at most one active Worktree binding, while a Worktree may have multiple bound
315
411
  Sessions. Rebinding the same Session to the same Worktree is idempotent; binding it to two active
316
412
  Worktrees is a conflict. A Session with no binding, a Main binding, or a detached binding runs
317
413
  with the Project root as cwd. An active Worktree binding runs with that Worktree path. The cwd is
318
414
  derived for each execution and is never persisted back into DSH Session metadata.
319
415
 
320
- Worktree creation creates the Git Worktree before recording its external relationship. If the
321
- sidecar write fails, the new Git Worktree is cleaned up when possible. A failed Worktree deletion
322
- does not change the sidecar state, so the relationship remains retryable. Session creation uses
323
- the native DSH API before binding; a binding failure never deletes or modifies the already-created
324
- Session.
416
+ Worktree creation creates the Git Worktree before recording its external relationship. Git
417
+ create/remove mutations are serialized across Host processes per Workspace and repository,
418
+ record a durable pending operation, and verify the actual Git result before publishing stable
419
+ sidecar state. If a create cannot be reconciled or a path/repository identity changes, the
420
+ operation remains explicitly recoverable; the plugin never uses force removal or deletes an
421
+ unknown directory. If a sidecar write fails, the new Git Worktree is cleaned up when possible. A
422
+ failed Worktree deletion does not silently change the relation, so it remains retryable or is
423
+ marked `recovery-needed`. Session creation uses the native DSH API before binding; a binding
424
+ failure never deletes or modifies the already-created Session.
425
+
426
+ On Host startup, the plugin performs a best-effort safe recovery for known DSH Workspaces. It may
427
+ finalize a pending create/remove only when Git path and repository identity are certain; otherwise
428
+ it retains the marker and surfaces `WORKTREE_RECOVERY_REQUIRED` or
429
+ `WORKTREE_IDENTITY_CHANGED`. It never guesses at destructive cleanup. A destructive action may
430
+ also carry an opaque mutation token from the latest Worktree projection so a stale UI cannot act
431
+ on a changed record.
325
432
 
326
433
  The Worktree session flow sends the independent Worktree cwd through the upstream DSH runtime and
327
434
  keeps `{ workspaceId, sessionId }` as a browser-local membership projection rather than a
@@ -329,6 +436,11 @@ persistent DSH attach. It does not modify DSH source, Session metadata, or nativ
329
436
  storage. The projection is replayed after native list refreshes and removed when the binding
330
437
  disappears or the Client is disposed.
331
438
 
439
+ Permission changes use only the public DSH per-Session permission service and its
440
+ `permission/preset`, `sandbox/mode`, and `approval/policy` records. The plugin does not write
441
+ messages, prompts, transcripts, Workspace data, or Session metadata, and cannot enlarge a
442
+ filesystem sandbox imposed by the host running DSH.
443
+
332
444
  The blank Hero context is visual only. Because the current upstream DSH source checkout has no
333
445
  additive Hero headline slot, its placement depends on the native `[data-phase="hero"]` and title
334
446
  anchors; it disappears when those anchors are unavailable and should move to a formal DSH slot
package/README.zh.md CHANGED
@@ -25,20 +25,49 @@ Session 元数据、原生列表和会话历史的唯一事实来源。插件只
25
25
  - 导入只登记已有 Worktree,不移动、复制或编辑其目录;记录使用 `source: external`,之后与 plugin 创建的记录共享 Session、binding、health、排序、cwd、projection、刷新和恢复流程。
26
26
  - plugin 创建和导入的 Worktree 都通过真实的 `git worktree remove` 移除;移除导入的 Worktree 可能删除其关联目录,确认弹窗会明确提示。
27
27
  - 在 Main 或 active Worktree 下创建普通 Session 或 Worktree Session,并直接打开新会话。
28
+ - 对 active Worktree Session,先经明确确认,再请求命名的 `worktree-full-access` 预设。它将
29
+ DSH 的 `danger-full-access` 与 `ask` 组合:关闭关联 Git 元数据的文件系统限制,但保留
30
+ 审批提示;网络和进程策略不变。原生 Access 菜单中的 `Worktree Full Access` 会显示
31
+ Worktree branch 图标。
32
+ - 保留用户在 DSH 原生 Access 界面中选择的限制。如果自定义预设不可用,在可能时回退到
33
+ `workspace-write + ask`;如果无法验证权限能力,则显示可重试的降级状态,不伪称已获得完全访问。
34
+ - 复用原生动画 `StateDot` 展示运行中的 Session,并为最近一条用户发送的 Session 消息显示
35
+ 原生相对时间;hover 或打开菜单时,右侧位置让位给已有的操作菜单。
36
+ - 使用 DSH 原生 Session hover 详情卡片展示完整标题、相对时间和当前状态;打开 Session 操作
37
+ 菜单或拖拽行时,详情卡片让位。
38
+ - 补齐原生的等待审批、计划待审、等待回答、已完成、空闲和运行中子代理状态;插件不会复制
39
+ 原生动画实现。
40
+ - 当折叠的 Workspace、Main 或 Worktree 中存在任一未归档的活动 Session 时,在其右侧显示
41
+ 一个原生运行指示器;展开后恢复普通操作栏。
42
+ - 用户在 Session 中发送新消息后,该 Session 会移动到当前 Main 或 Worktree 视觉分组的队首。
43
+ 该排序只保存在浏览器本地,不修改 DSH Workspace 顺序或 Worktree sidecar。
44
+ - 从 DSH 原生 Workspace session list tab、Worktree view 或 Conversation fork 操作 fork
45
+ Session。parent 有 active Worktree binding 时,child 会先绑定到同一个 Worktree,再在 binding
46
+ refresh 完成后加入浏览器本地 Workspace membership projection;child 仍然是普通 DSH Session。
47
+ 这一时序避免 child 短暂出现在 Main/Local。sidecar 失败时 child 会保留,并显示可重试的
48
+ binding 恢复操作。
28
49
  - 查看 ready、repair、active 和 detached Worktree 状态,包括可重试的操作错误。
29
- - 通过 active Worktree 的选项菜单和确认弹窗移除 Worktree;Main 和 detached 行不显示该菜单。
50
+ - 通过 Main Worktree 共用的选项菜单复制所选行的绝对路径;Main 和 detached 行只显示“复制路径”,
51
+ active Worktree 额外显示“移除 Worktree”并要求确认。
52
+ - 通过 Local 或 active Worktree 的选项菜单创建新的 Worktree。创建弹窗会以所选行的当前 branch
53
+ 为基线,并预填下一个可用的递增名称,例如 `feature-2` 或 `feature-3`;detached Worktree
54
+ 不显示该动作。
30
55
  - 继续使用 DSH 原生的 Workspace rename/delete/reorder 和 Session 菜单。Worktree 可以在所属
31
56
  Workspace 内排序;顺序保存在插件 sidecar 中,Main 固定在第一位。
32
57
  - 将 Workspace、Main 和 Worktree 的展开选择保存到浏览器本地存储;Session 五行溢出展开保持临时状态,并在刷新或父级折叠后重置。
33
- - 在 Worktree view 高亮 DSH 当前 Session;进入 Worktree 模式或切换当前会话时,临时展开其 Workspace/Main/Worktree 路径和 Session 五行溢出,清空隐藏它的搜索并滚动定位;这一浏览器本地行为不改变已保存的展开选择。
58
+ - 在 Worktree view 高亮 DSH 当前 Session;进入 Worktree 模式或切换当前会话时,临时展开其 Workspace/Main/Worktree 路径;只有当前行不在前五行时才展开 Session 五行溢出,随后清空隐藏它的搜索并滚动定位;这一浏览器本地行为不改变已保存的展开选择。
34
59
  - 在已有 Conversation 的标题行以及新会话空白 Hero 中,以只读方式显示当前 local branch 或
35
60
  Worktree branch 上下文。
61
+ - 在普通 Worktree Session 的 Session 操作菜单中复制 Session ID。
36
62
  - 在同一个 Session 的 snapshot 更新以及 Session 切换期间保持 Conversation 和 Hero 上下文
37
63
  稳定;替换读取进行时保留上一次有效上下文。
38
64
  - 过长的 branch 名称在 chip 中折叠,并通过原生 hover card 展示完整值;Sidebar footer action
39
65
  对齐原生字体和排版,Sidebar 折叠后不再额外显示 `WT` 按钮。
40
66
  - Worktree Session 仍出现在原始 DSH Project/Workspace 视角中;插件不复制 Session 内容,
41
67
  也不修改消息、prompt、transcript 或历史记录。
68
+ - Worktree fork 的 membership 不会写入 DSH 持久化的 `Workspace.sessionIds`。plugin 加载期间,
69
+ 浏览器可以通过本地 projection 显示 child;不加载 plugin 时,child 仍在 DSH 全局 Session 管理中,
70
+ 但不会被持久化挂到 native Workspace root membership 下。
42
71
 
43
72
  ### 兼容性与前置条件
44
73
 
@@ -190,9 +219,12 @@ pnpm dsh plugin --profile web remove @cerbur/clutch-dsh-worktree
190
219
 
191
220
  1. 选择 Workspace,点击它旁边的 `+`,选择基线 local branch,并填写 Worktree name。默认
192
221
  branch 名称为 `dsh/<8-character-random-string>`。
193
- 2. 目标 Worktree 路径必须是绝对路径,属于同一个 Project,且不能是 Project 根目录。相对
222
+ 2. 如果要从已有 Worktree 创建同级 Worktree,打开该 active Worktree 的选项菜单并选择
223
+ `创建新的 Worktree`。弹窗会以当前 Worktree branch 作为基线,并为名称选择下一个可用的
224
+ 递增序号;已有名称会被跳过。
225
+ 3. 目标 Worktree 路径必须是绝对路径,属于同一个 Project,且不能是 Project 根目录。相对
194
226
  路径、其他 Project 的路径或 Project 根目录都会被拒绝。
195
- 3. Git 必须已安装且可在 PATH 中使用。Git 可执行文件缺失时显示安装提示且不显示命令块;请
227
+ 4. Git 必须已安装且可在 PATH 中使用。Git 可执行文件缺失时显示安装提示且不显示命令块;请
196
228
  安装 Git、重启 DSH 后重试。如果缺少 repository、初始 commit 或本地 branch,按照弹窗中
197
229
  的可复制 setup 命令修复后重试。插件只展示这些提示,不会执行 setup 或安装命令或编辑
198
230
  业务文件。
@@ -206,7 +238,8 @@ pnpm dsh plugin --profile web remove @cerbur/clutch-dsh-worktree
206
238
  作为诊断信息。
207
239
  3. 在下拉框中选择一个选项并点击 `导入 Worktree`。登记只写入 plugin sidecar,已有 Worktree 目录和 Git
208
240
  工作状态保持不变。随后会在该 Worktree cwd 创建或复用 Session,并执行与创建相同的
209
- `bind → membership projection open refresh` 流程。
241
+ `bind → openbinding refresh` 流程;新建 Session 不会在 binding 刷新前投影到原生
242
+ Workspace membership。
210
243
  4. 同一 Workspace、同一物理路径的 active external 导入是幂等的。已经由 plugin 管理的路径
211
244
  返回 `WORKTREE_ALREADY_MANAGED`;无效或过期候选项返回 `WORKTREE_IMPORT_INVALID`,修复
212
245
  repository 状态后可以重试。
@@ -215,29 +248,67 @@ pnpm dsh plugin --profile web remove @cerbur/clutch-dsh-worktree
215
248
 
216
249
  - 使用 Main 的 `+`,在 Project 根目录视角中创建普通 DSH Session。
217
250
  - 使用 Worktree 的 `+`,创建或复用 runtime cwd 指向该 Worktree 的 Session。插件通过 upstream
218
- runtime 调用 `session.create({ cwd: worktreePath })`,随后保存外部 binding,在当前浏览器内
219
- 应用 `{ workspaceId, sessionId }` membership projection,并打开该 Session。
251
+ runtime 调用 `session.create({ cwd: worktreePath })`,随后保存外部 binding 并打开该 Session。
252
+ 当前浏览器内的 `{ workspaceId, sessionId }` membership projection 会在之后刷新,因此新建
253
+ Session 不会短暂出现在 Main 中。
220
254
  - 如果存在目标 cwd 完全匹配的未归档 blank Session,连接器会优先复用它。已绑定的 Session
221
255
  会直接打开;未绑定的候选会先 binding,再 projection 和打开。否则执行
222
- `create → bind → projectopen`,同一个 Worktree 的并发点击会合并。
256
+ 新建路径执行 `create → bind → openrefresh`,同一个 Worktree 的并发点击会合并。
223
257
  - 如果 DSH 创建 Session 后 binding 失败,Session ID 仍会保留,可用于 Retry 或 Open 恢复。
224
258
  插件不会删除或修改该 DSH Session。
259
+ - 打开 active Worktree Session 前,插件会在 DSH 风格的页面内弹窗中说明关联 Git 元数据为什么
260
+ 可能需要访问 Session 目录之外的内容。弹窗要求明确勾选风险确认;取消会保留 Session 和
261
+ binding,不改变权限,并留下可重试的待处理状态。需要切换到其他权限模式时,继续使用 DSH
262
+ 原生 Access 选择器。
225
263
  - provisional blank Session 遵循 DSH 原生显示规则:只在当前选中的视角中显示,使用本地化
226
264
  的 `New Session` 文案,不显示生成的 ID,也没有 Rename、Fork 或 Archive 菜单。接受第一条
227
265
  prompt 后,它会变为普通 Session 行;隐藏 blank 行不会删除 Session 或 Worktree binding。
228
266
 
267
+ ### Session 活动与排序
268
+
269
+ - Session 行复用 DSH 原生 `StateDot`:运行中的 Session 以及存在运行中子代理的 Session,使用
270
+ 右侧动画点替代相对时间。等待审批、计划待审和等待回答使用原生 warning 点;已完成 Session
271
+ 保留原生 completed 点。
272
+ - 右侧元数据使用原生紧凑时间单位(刚刚、分钟、小时、天、月、年),来源是 DSH 的
273
+ `updatedAt`,该字段随最近一条用户消息推进;空白 New Session 不显示时间。时间只在 snapshot
274
+ render 时按原生规则重新计算,不额外增加每分钟 ticker。
275
+ - 将鼠标悬停在 Worktree Session 行上 500 毫秒后,会打开原生详情卡片,展示完整标题、相对时间
276
+ 和状态;Session 菜单打开或行正在拖拽时不显示卡片。
277
+ - 折叠的 Workspace、Main 或 Worktree 分组,只要任一未归档成员正在运行就显示相同的原生运行点,
278
+ 即使该 Session 被搜索隐藏也会计入。展开后隐藏聚合点;hover、focus 或打开菜单时显示原有
279
+ 操作控件。
280
+ - 用户发送新消息后,Session 会移动到当前 Main 或 Worktree 视觉分组队首。promotion、已观察
281
+ 时间戳和每组顺序只存在浏览器本地;手动拖动仍先调用 DSH 原生排序 API,成功后再更新本地顺序。
282
+
283
+ ### Fork Worktree Session
284
+
285
+ - 可以使用任意 DSH 原生 fork 入口:Session list 中的 tab、Worktree Session 菜单或
286
+ Conversation fork 操作。插件包装共享的 DSH `sessions.fork` service,因此原生的 fork cut、
287
+ 标题递增和 child lineage 语义保持不变。
288
+ - DSH 创建 child 后,插件读取 parent 的 active sidecar binding,通过现有 `/api` Manager 写入
289
+ child binding。随后 Worktree view 先刷新 binding,再重放浏览器本地 Workspace membership
290
+ projection,因此 child 不会短暂出现在 Main/Local;刷新期间保留 ready 内容。
291
+ - 如果 child 已创建但 sidecar 查询或 binding 失败,DSH 仍保留 child,plugin 显示 Retry Binding/
292
+ Open Created Session 恢复操作。后续 plugin 初始化也会根据原生 Session lineage summary 重试可恢复
293
+ 的 fork child;不会自动绑定无关的 subagent。
294
+ - 这一流程不会把 child 持久化写入 DSH `Workspace.sessionIds`。native DSH Workspace view 只有在
295
+ plugin 加载期间才能看到临时浏览器 projection;native Workspace 持久化数据保持不变。
296
+
229
297
  ### 排序与管理 Worktree
230
298
 
231
299
  - 在所属 Workspace 内拖动 Worktree。排序持久化在 plugin sidecar 的有序 `worktrees` 数组中;
232
300
  Main 是固定的第一行,Worktree 不能跨 Workspace 移动。
233
- - 使用 active Worktree 的选项菜单和确认弹窗移除 Worktree。Main 和 detached Worktree 不显示
234
- 该菜单。
301
+ - 打开 Main Worktree 共用的选项菜单复制所选行的绝对路径。Main 和 detached/removed Worktree
302
+ 只显示“复制路径”;active Worktree 还显示“移除 Worktree”并要求确认。
235
303
  - 导入的 Worktree 与 plugin 创建的 Worktree 显示相同的 active 选项菜单。两种来源都执行真实
236
304
  `git worktree remove`;导入项的确认文案会警告关联 Worktree 目录可能被删除。Session 会
237
305
  保留为 detached binding。
238
306
  - 移除 Worktree 不会删除其 Session。关系会保留为 detached,直到显式解绑。删除 Workspace
239
307
  只会删除 DSH 的 Workspace registration;其目录、Session、Git Worktree 和 plugin
240
308
  sidecar 会保留。
309
+ - Worktree 成功移除后,如果公共 DSH 权限服务可用,仍处于完全访问的 detached Session 会
310
+ 归一化为 `workspace-write + ask`。权限服务不可用时显示未验证且可重试的警告;不会向
311
+ detached Session 自动授予完全访问。
241
312
  - DSH 原生的 Workspace rename/delete/reorder 和 Session 菜单继续可用。Session 拖动排序
242
313
  限定在当前视觉 Main 或 Worktree 分组中。
243
314
  - Main 分组显示当前 local branch:有分支时为 `本地(branch)`,DSH 没有返回当前分支时
@@ -254,6 +325,7 @@ pnpm dsh plugin --profile web remove @cerbur/clutch-dsh-worktree
254
325
  ### 理解状态与恢复提示
255
326
 
256
327
  - `ready` 表示 Worktree 可用。`repair` 表示 Worktree、Session、binding 或 cwd 缺失/无效。
328
+ `recovery-needed` 表示 Git/sidecar 操作或身份校验尚未解决,破坏性操作会被阻止。
257
329
  `detached` 表示 Git Worktree 已被移除,但关系仍然保留。active binding 指向缺失
258
330
  Worktree 时会显示明确的 repair 警告或错误,不会静默切换到其他 Worktree。
259
331
  - Worktree health 是 Git 的运行时 projection,不写入 sidecar。Git 前置条件失败按
@@ -263,6 +335,8 @@ pnpm dsh plugin --profile web remove @cerbur/clutch-dsh-worktree
263
335
  - 已经 ready 的视角刷新时会保留当前 projection,直到替换数据可用。同一个 Session 的
264
336
  snapshot 更新不会清空上下文,也不会触发重复读取;没有缓存视角时,首次进入和显式 Retry
265
337
  可以显示 loading 状态。
338
+ - 权限状态会明确显示为完全访问、回退到 `workspace-write`、保留用户限制、能力未验证、
339
+ 等待确认或可重试的设置失败,不会静默折叠为空列表或伪造成功。
266
340
 
267
341
  ## 界面语言
268
342
 
@@ -289,20 +363,40 @@ DSH 管理原始 Project/Workspace 身份和根目录、Session 身份和元数
289
363
  Session 内容。如果 sidecar 不可用或损坏,原生 Project/Session 视角仍然可读,插件进入
290
364
  degraded/read-only 状态;不能用空索引覆盖 DSH 原生列表。
291
365
 
366
+ sidecar 兼容读取 v1 和 v2 snapshot。旧记录会先在内存中归一化,第一次成功 mutation 会
367
+ 以原子方式将 shard 升级为 v3。新的 v3 snapshot 使用 revision、不可逆向还原的 repository
368
+ fingerprint,以及为 Git create/remove 保存的 durable pending-operation metadata。早期 v3
369
+ 实现可能写入的 raw repository 字段也可以读取,并会在下一次稳定写入时清理。无效 JSON、
370
+ 未知 schema version 和关系不变量错误都会报告为 corruption,不会静默重置为空索引。
371
+
292
372
  一个 Session 最多绑定一个 active Worktree,一个 Worktree 可以绑定多个 Session。Session
293
373
  重复绑定同一个 Worktree 是幂等的,绑定两个 active Worktree 会产生 conflict。没有 binding、
294
374
  使用 Main binding 或处于 detached binding 的 Session 使用 Project 根目录作为 cwd;active
295
375
  Worktree binding 使用对应的 Worktree 路径。cwd 在每次执行时派生,不会写回 DSH Session 元数据。
296
376
 
297
- 创建 Worktree 时先创建 Git Worktree,再记录外部关系。sidecar 写入失败时会尽可能清理刚
298
- 创建的 Git Worktree。删除 Worktree 失败时不会改变 sidecar 状态,因此关系仍可重试。创建
299
- Session 时先调用 DSH 原生 API,再写入 binding;binding 失败不会删除或修改已创建的 Session。
377
+ 创建 Worktree 时先创建 Git Worktree,再记录外部关系。Git create/remove mutation 会按
378
+ Workspace repository 串行化跨 Host 进程执行,写入 durable pending operation,并在确认
379
+ 实际 Git 结果后才发布稳定 sidecar 状态。如果 create 无法对账,或 path/repository identity
380
+ 发生变化,操作会明确保留为可恢复状态;插件不会使用 force remove,也不会删除未知目录。
381
+ sidecar 写入失败时会尽可能清理刚创建的 Git Worktree。删除 Worktree 失败时不会静默改变
382
+ 关系,因此关系仍可重试,或会标记为 `recovery-needed`。创建 Session 时先调用 DSH 原生
383
+ API,再写入 binding;binding 失败不会删除或修改已创建的 Session。
384
+
385
+ Host 启动时,插件会针对已知 DSH Workspace 执行一次尽力而为的安全恢复。只有在 Git path
386
+ 和 repository identity 都能确认时,才会完成 pending create/remove;否则保留 marker,并
387
+ 显示 `WORKTREE_RECOVERY_REQUIRED` 或 `WORKTREE_IDENTITY_CHANGED`。它不会猜测性清理破坏性
388
+ 状态。破坏性操作还可以携带最新 Worktree projection 生成的 opaque mutation token,避免
389
+ 过期 UI 对已变化的记录执行操作。
300
390
 
301
391
  Worktree Session 流程将独立的 Worktree cwd 交给 upstream DSH runtime,并将
302
392
  `{ workspaceId, sessionId }` 保持为浏览器本地 membership projection,而不是持久化的 DSH
303
393
  attach。它不会修改 DSH 源码、Session metadata 或原生 Workspace 存储。native list 刷新后会
304
394
  重放 projection;binding 消失或 Client dispose 时会移除 projection。
305
395
 
396
+ 权限变更只使用 DSH 公共的 per-Session 权限服务及其 `permission/preset`、`sandbox/mode`、
397
+ `approval/policy` 记录。插件不会写入消息、prompt、transcript、Workspace 数据或 Session
398
+ metadata,也不能扩大运行 DSH 的宿主沙箱边界。
399
+
306
400
  空白 Hero 上下文只用于展示。由于当前 upstream DSH source checkout 没有 additive Hero
307
401
  headline slot,它的位置依赖原生 `[data-phase="hero"]` 和标题锚点;锚点不可用时浮层会消失,
308
402
  未来有正式 DSH slot 时应迁移到该 slot。
package/cordis.patch.yml CHANGED
@@ -1,3 +1,24 @@
1
+ - id: permission
2
+ # DSH patch rows replace the whole config. Keep the upstream presets and add
3
+ # one named bundle; the plugin applies it only after an active Worktree
4
+ # binding is confirmed by the Host.
5
+ config:
6
+ presets:
7
+ read-only:
8
+ sandbox: read-only
9
+ approval: ask
10
+ workspace-write:
11
+ sandbox: workspace-write
12
+ approval: ask
13
+ danger-full-access:
14
+ sandbox: danger-full-access
15
+ approval: never
16
+ worktree-full-access:
17
+ sandbox: danger-full-access
18
+ approval: ask
19
+ name: Worktree Full Access
20
+ description: Full file access for Worktree metadata while keeping approval prompts enabled.
21
+
1
22
  - insert:
2
23
  - id: clutch-dsh-worktree-host
3
24
  name: '@cerbur/clutch-dsh-worktree'
@@ -1 +1 @@
1
- {"version":3,"file":"WorktreeContext.d.ts","sourceRoot":"","sources":["../../src/client/WorktreeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,YAAY,EAEb,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,mEAAmE;AACnE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC/D,CAAC;CACH;AAID,0DAA0D;AAC1D,MAAM,MAAM,0BAA0B,GACpC,YAAY,CAAC,qCAAqC,CAAC,GACnD,WAAW,CAAC,OAAO,WAAW,CAAC,GAC/B,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAqBtC,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,kBAAkB,EAClB,CAAC,GACF,EAAE,0BAA0B,sCAI5B"}
1
+ {"version":3,"file":"WorktreeContext.d.ts","sourceRoot":"","sources":["../../src/client/WorktreeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,YAAY,EAEb,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,mEAAmE;AACnE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC/D,CAAC;CACH;AAID,0DAA0D;AAC1D,MAAM,MAAM,0BAA0B,GACpC,YAAY,CAAC,qCAAqC,CAAC,GACnD,WAAW,CAAC,OAAO,WAAW,CAAC,GAC/B,UAAU,CAAC,uBAAuB,CAAC,CAAC;AA2BtC,oFAAoF;AACpF,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,kBAAkB,EAClB,CAAC,GACF,EAAE,0BAA0B,sCAI5B"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { IconBranchOutline16 } from '@deepseek-ai/dsh-client-ui-primitives';
2
+ import { HoverCard, IconBranchOutline16 } from '@deepseek-ai/dsh-client-ui-primitives';
3
3
  import styles from './worktree-context.css';
4
4
  function WorktreeContextLabel({ value, t, }) {
5
5
  if (value.kind === 'none')
@@ -7,7 +7,7 @@ function WorktreeContextLabel({ value, t, }) {
7
7
  const ariaLabel = value.kind === 'main'
8
8
  ? t('context.main', { name: value.label })
9
9
  : t('context.worktree', { name: value.label });
10
- return (_jsxs("span", { className: styles.headerContext, title: value.label, "aria-label": ariaLabel, children: [_jsx(IconBranchOutline16, { size: 14, className: styles.contextIcon, "aria-hidden": "true" }), _jsx("span", { className: styles.contextLabel, children: value.label })] }));
10
+ return (_jsx(HoverCard, { anchor: _jsxs("span", { className: styles.headerContext, title: value.label, "aria-label": ariaLabel, children: [_jsx(IconBranchOutline16, { size: 14, className: styles.contextIcon, "aria-hidden": "true" }), _jsx("span", { className: styles.contextLabel, children: value.label })] }), content: _jsx("div", { className: styles.contextHoverTitle, children: value.label }), openDelayMs: 500 }));
11
11
  }
12
12
  /** Render the current branch or active Worktree branch beside the Session title. */
13
13
  export function WorktreeHeaderContext({ sessionId, useWorktreeContext, t, }) {
@@ -1 +1 @@
1
- {"version":3,"file":"WorktreeContext.js","sourceRoot":"","sources":["../../src/client/WorktreeContext.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAK5E,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAiB5C,SAAS,oBAAoB,CAAC,EAC5B,KAAK,EACL,CAAC,GAIF;IACC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,KAAK,MAAM;QACrC,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAC1C,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACjD,OAAO,CACL,gBAAM,SAAS,EAAE,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,gBAAc,SAAS,aAC9E,KAAC,mBAAmB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,iBAAc,MAAM,GAAG,EACnF,eAAM,SAAS,EAAE,MAAM,CAAC,YAAY,YAAG,KAAK,CAAC,KAAK,GAAQ,IACrD,CACR,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,qBAAqB,CAAC,EACpC,SAAS,EACT,kBAAkB,EAClB,CAAC,GAC0B;IAC3B,MAAM,KAAK,GAAG,kBAAkB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACzD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAI,CAAC;AAC5D,CAAC"}
1
+ {"version":3,"file":"WorktreeContext.js","sourceRoot":"","sources":["../../src/client/WorktreeContext.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAKvF,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAiB5C,SAAS,oBAAoB,CAAC,EAC5B,KAAK,EACL,CAAC,GAIF;IACC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,KAAK,MAAM;QACrC,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAC1C,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACjD,OAAO,CACL,KAAC,SAAS,IACR,MAAM,EACJ,gBAAM,SAAS,EAAE,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,gBAAc,SAAS,aAC9E,KAAC,mBAAmB,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,iBAAc,MAAM,GAAG,EACnF,eAAM,SAAS,EAAE,MAAM,CAAC,YAAY,YAAG,KAAK,CAAC,KAAK,GAAQ,IACrD,EAET,OAAO,EAAE,cAAK,SAAS,EAAE,MAAM,CAAC,iBAAiB,YAAG,KAAK,CAAC,KAAK,GAAO,EACtE,WAAW,EAAE,GAAG,GAChB,CACH,CAAC;AACJ,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,qBAAqB,CAAC,EACpC,SAAS,EACT,kBAAkB,EAClB,CAAC,GAC0B;IAC3B,MAAM,KAAK,GAAG,kBAAkB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACzD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,KAAC,oBAAoB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAI,CAAC;AAC5D,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import type { WorktreeSurfaceProps } from './worktree-surface-types.js';
2
- export type { WorktreeSurfaceInjected, WorktreeSurfaceProps, } from './worktree-surface-types.js';
2
+ export type { WorktreeSurfaceInjected, WorktreeSurfaceProps } from './worktree-surface-types.js';
3
3
  /**
4
4
  * Peer Worktree navigation surface. It keeps the original DSH Workspace mode
5
5
  * intact and renders a browser-local Workspace → Worktree → Session projection.
6
6
  */
7
- export declare function WorktreeSurface({ useStore, actions, useSessions, useWorkspaces, t, available, expandState, manager, invalidateWorktreeContext, createWorkspace, createSessionForWorktree: createSessionCallback, createMainSession, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, insertSessionBefore, insertWorktreeBefore, renameSession, forkSession, archiveSession, ensureSessionWorkspace, syncSessionWorkspaces, openSession, }: WorktreeSurfaceProps): import("react").JSX.Element | null;
7
+ export declare function WorktreeSurface({ useStore, actions, useSessions, useWorkspaces, t, available, expandState, sessionOrder, manager, permission, confirmFullAccess, fullAccessConfirmation, onPermissionResult, onPermissionNotice, permissionNotice, invalidateWorktreeContext, createWorkspace, createSessionForWorktree: createSessionCallback, createMainSession, renameWorkspace, deleteWorkspace, insertWorkspaceBefore, insertSessionBefore, insertWorktreeBefore, renameSession, forkSession, archiveSession, forkRecovery, retryForkSession, ensureSessionWorkspace, syncSessionWorkspaces, openSession, }: WorktreeSurfaceProps): import("react").JSX.Element | null;
8
8
  //# sourceMappingURL=WorktreeSurface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorktreeSurface.d.ts","sourceRoot":"","sources":["../../src/client/WorktreeSurface.tsx"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EAQV,oBAAoB,EAQrB,MAAM,6BAA6B,CAAC;AAsBrC,YAAY,EACV,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAwBrC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,aAAa,EACb,CAAC,EACD,SAAS,EACT,WAAW,EACX,OAAO,EACP,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EAAE,qBAAqB,EAC/C,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,GACZ,EAAE,oBAAoB,sCAu5CtB"}
1
+ {"version":3,"file":"WorktreeSurface.d.ts","sourceRoot":"","sources":["../../src/client/WorktreeSurface.tsx"],"names":[],"mappings":"AAiEA,OAAO,KAAK,EAQV,oBAAoB,EASrB,MAAM,6BAA6B,CAAC;AA6BrC,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAoEjG;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,EACP,WAAW,EACX,aAAa,EACb,CAAC,EACD,SAAS,EACT,WAAW,EACX,YAAY,EACZ,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,eAAe,EACf,wBAAwB,EAAE,qBAAqB,EAC/C,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,WAAW,GACZ,EAAE,oBAAoB,sCA4uDtB"}