@cerbur/clutch-dsh-worktree 0.1.9 → 0.1.12

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 (565) hide show
  1. package/README.md +230 -231
  2. package/README.zh.md +184 -225
  3. package/assets/screenshots/screenshots-dashboard.webp +0 -0
  4. package/assets/screenshots/screenshots-en.png +0 -0
  5. package/assets/screenshots/screenshots-import.png +0 -0
  6. package/assets/screenshots/screenshots-zh.png +0 -0
  7. package/lib/client/WorktreeSurface.d.ts +4 -7
  8. package/lib/client/WorktreeSurface.d.ts.map +1 -1
  9. package/lib/client/WorktreeSurface.js +179 -1418
  10. package/lib/client/WorktreeSurface.js.map +1 -1
  11. package/lib/client/{WorktreeContext.d.ts → context/WorktreeContext.d.ts} +1 -1
  12. package/lib/client/context/WorktreeContext.d.ts.map +1 -0
  13. package/lib/client/context/WorktreeContext.js.map +1 -0
  14. package/lib/client/{WorktreeHeroContext.d.ts → context/WorktreeHeroContext.d.ts} +1 -1
  15. package/lib/client/context/WorktreeHeroContext.d.ts.map +1 -0
  16. package/lib/client/context/WorktreeHeroContext.js.map +1 -0
  17. package/lib/client/{worktree-context-store.d.ts → context/worktree-context-store.d.ts} +1 -1
  18. package/lib/client/context/worktree-context-store.d.ts.map +1 -0
  19. package/lib/client/{worktree-context-store.js → context/worktree-context-store.js} +2 -2
  20. package/lib/client/context/worktree-context-store.js.map +1 -0
  21. package/lib/client/{worktree-context.d.ts → context/worktree-context.d.ts} +1 -1
  22. package/lib/client/context/worktree-context.d.ts.map +1 -0
  23. package/lib/client/{worktree-context.js → context/worktree-context.js} +5 -3
  24. package/lib/client/context/worktree-context.js.map +1 -0
  25. package/lib/client/dashboard/DashboardHeaderAction.d.ts +20 -0
  26. package/lib/client/dashboard/DashboardHeaderAction.d.ts.map +1 -0
  27. package/lib/client/dashboard/DashboardHeaderAction.js +19 -0
  28. package/lib/client/dashboard/DashboardHeaderAction.js.map +1 -0
  29. package/lib/client/dashboard/OpenInAppButton.d.ts +9 -0
  30. package/lib/client/dashboard/OpenInAppButton.d.ts.map +1 -0
  31. package/lib/client/dashboard/OpenInAppButton.js +123 -0
  32. package/lib/client/dashboard/OpenInAppButton.js.map +1 -0
  33. package/lib/client/dashboard/WorktreeDashboard.d.ts +21 -0
  34. package/lib/client/dashboard/WorktreeDashboard.d.ts.map +1 -0
  35. package/lib/client/dashboard/WorktreeDashboard.js +211 -0
  36. package/lib/client/dashboard/WorktreeDashboard.js.map +1 -0
  37. package/lib/client/dashboard/WorktreeInstructions.d.ts +8 -0
  38. package/lib/client/dashboard/WorktreeInstructions.d.ts.map +1 -0
  39. package/lib/client/dashboard/WorktreeInstructions.js +53 -0
  40. package/lib/client/dashboard/WorktreeInstructions.js.map +1 -0
  41. package/lib/client/dashboard/dashboard-icon.d.ts +7 -0
  42. package/lib/client/dashboard/dashboard-icon.d.ts.map +1 -0
  43. package/lib/client/dashboard/dashboard-icon.js +6 -0
  44. package/lib/client/dashboard/dashboard-icon.js.map +1 -0
  45. package/lib/client/dashboard/dashboard-overlay.d.ts +11 -0
  46. package/lib/client/dashboard/dashboard-overlay.d.ts.map +1 -0
  47. package/lib/client/dashboard/dashboard-overlay.js +120 -0
  48. package/lib/client/dashboard/dashboard-overlay.js.map +1 -0
  49. package/lib/client/dashboard/dashboard-selection.d.ts +32 -0
  50. package/lib/client/dashboard/dashboard-selection.d.ts.map +1 -0
  51. package/lib/client/dashboard/dashboard-selection.js +31 -0
  52. package/lib/client/dashboard/dashboard-selection.js.map +1 -0
  53. package/lib/client/dashboard/dashboard-sessions.d.ts +6 -0
  54. package/lib/client/dashboard/dashboard-sessions.d.ts.map +1 -0
  55. package/lib/client/dashboard/dashboard-sessions.js +21 -0
  56. package/lib/client/dashboard/dashboard-sessions.js.map +1 -0
  57. package/lib/client/dashboard/open-in-app-controller.d.ts +30 -0
  58. package/lib/client/dashboard/open-in-app-controller.d.ts.map +1 -0
  59. package/lib/client/dashboard/open-in-app-controller.js +94 -0
  60. package/lib/client/dashboard/open-in-app-controller.js.map +1 -0
  61. package/lib/client/dashboard/vscode-url.d.ts +3 -0
  62. package/lib/client/dashboard/vscode-url.d.ts.map +1 -0
  63. package/lib/client/dashboard/vscode-url.js +9 -0
  64. package/lib/client/dashboard/vscode-url.js.map +1 -0
  65. package/lib/client/dashboard/worktree-acquisition-facts.d.ts +16 -0
  66. package/lib/client/dashboard/worktree-acquisition-facts.d.ts.map +1 -0
  67. package/lib/client/dashboard/worktree-acquisition-facts.js +14 -0
  68. package/lib/client/dashboard/worktree-acquisition-facts.js.map +1 -0
  69. package/lib/client/dsh-slot-contract.d.ts +5 -0
  70. package/lib/client/dsh-slot-contract.d.ts.map +1 -1
  71. package/lib/client/entry.d.ts +1 -1
  72. package/lib/client/entry.d.ts.map +1 -1
  73. package/lib/client/entry.js +90 -13
  74. package/lib/client/entry.js.map +1 -1
  75. package/lib/client/index.d.ts +3 -3
  76. package/lib/client/index.d.ts.map +1 -1
  77. package/lib/client/index.js +2 -2
  78. package/lib/client/index.js.map +1 -1
  79. package/lib/client/locales.d.ts +204 -0
  80. package/lib/client/locales.d.ts.map +1 -1
  81. package/lib/client/locales.js +214 -10
  82. package/lib/client/locales.js.map +1 -1
  83. package/lib/client/{WorktreeOverlay.d.ts → overlay/WorktreeOverlay.d.ts} +2 -2
  84. package/lib/client/overlay/WorktreeOverlay.d.ts.map +1 -0
  85. package/lib/client/{WorktreeOverlay.js → overlay/WorktreeOverlay.js} +2 -2
  86. package/lib/client/overlay/WorktreeOverlay.js.map +1 -0
  87. package/lib/client/overlay/overlay-bounds.d.ts.map +1 -0
  88. package/lib/client/overlay/overlay-bounds.js.map +1 -0
  89. package/lib/client/overlay/sidebar-overlay-geometry.d.ts.map +1 -0
  90. package/lib/client/overlay/sidebar-overlay-geometry.js.map +1 -0
  91. package/lib/client/permission/worktree-permission-icon.d.ts.map +1 -0
  92. package/lib/client/permission/worktree-permission-icon.js.map +1 -0
  93. package/lib/client/permission/worktree-permission.d.ts.map +1 -0
  94. package/lib/client/permission/worktree-permission.js.map +1 -0
  95. package/lib/client/session/session-labels.d.ts +9 -0
  96. package/lib/client/session/session-labels.d.ts.map +1 -0
  97. package/lib/client/session/session-labels.js +44 -0
  98. package/lib/client/session/session-labels.js.map +1 -0
  99. package/lib/client/session/session-view.d.ts.map +1 -0
  100. package/lib/client/session/session-view.js.map +1 -0
  101. package/lib/client/{virtual-workspace-membership.d.ts → session/virtual-workspace-membership.d.ts} +1 -1
  102. package/lib/client/session/virtual-workspace-membership.d.ts.map +1 -0
  103. package/lib/client/{virtual-workspace-membership.js → session/virtual-workspace-membership.js} +1 -1
  104. package/lib/client/session/virtual-workspace-membership.js.map +1 -0
  105. package/lib/client/{worktree-session-fork.d.ts → session/worktree-session-fork.d.ts} +7 -1
  106. package/lib/client/session/worktree-session-fork.d.ts.map +1 -0
  107. package/lib/client/{worktree-session-fork.js → session/worktree-session-fork.js} +50 -4
  108. package/lib/client/session/worktree-session-fork.js.map +1 -0
  109. package/lib/client/session/worktree-session-order.d.ts.map +1 -0
  110. package/lib/client/session/worktree-session-order.js.map +1 -0
  111. package/lib/client/session/worktree-session-position.d.ts.map +1 -0
  112. package/lib/client/session/worktree-session-position.js.map +1 -0
  113. package/lib/client/{worktree-session.d.ts → session/worktree-session.d.ts} +3 -3
  114. package/lib/client/session/worktree-session.d.ts.map +1 -0
  115. package/lib/client/{worktree-session.js → session/worktree-session.js} +3 -3
  116. package/lib/client/session/worktree-session.js.map +1 -0
  117. package/lib/client/surface/actions/lifecycle-commands.d.ts +9 -0
  118. package/lib/client/surface/actions/lifecycle-commands.d.ts.map +1 -0
  119. package/lib/client/surface/actions/lifecycle-commands.js +243 -0
  120. package/lib/client/surface/actions/lifecycle-commands.js.map +1 -0
  121. package/lib/client/surface/actions/useDragActions.d.ts +26 -0
  122. package/lib/client/surface/actions/useDragActions.d.ts.map +1 -0
  123. package/lib/client/surface/actions/useDragActions.js +125 -0
  124. package/lib/client/surface/actions/useDragActions.js.map +1 -0
  125. package/lib/client/surface/actions/useLifecycleActions.d.ts +30 -0
  126. package/lib/client/surface/actions/useLifecycleActions.d.ts.map +1 -0
  127. package/lib/client/surface/actions/useLifecycleActions.js +140 -0
  128. package/lib/client/surface/actions/useLifecycleActions.js.map +1 -0
  129. package/lib/client/surface/actions/useNativeActions.d.ts +48 -0
  130. package/lib/client/surface/actions/useNativeActions.d.ts.map +1 -0
  131. package/lib/client/surface/actions/useNativeActions.js +182 -0
  132. package/lib/client/surface/actions/useNativeActions.js.map +1 -0
  133. package/lib/client/surface/actions/useSessionActions.d.ts +24 -0
  134. package/lib/client/surface/actions/useSessionActions.d.ts.map +1 -0
  135. package/lib/client/surface/actions/useSessionActions.js +116 -0
  136. package/lib/client/surface/actions/useSessionActions.js.map +1 -0
  137. package/lib/client/surface/actions/useSurfaceMutation.d.ts +15 -0
  138. package/lib/client/surface/actions/useSurfaceMutation.d.ts.map +1 -0
  139. package/lib/client/surface/actions/useSurfaceMutation.js +24 -0
  140. package/lib/client/surface/actions/useSurfaceMutation.js.map +1 -0
  141. package/lib/client/surface/actions/useWorktreeRegistration.d.ts +31 -0
  142. package/lib/client/surface/actions/useWorktreeRegistration.d.ts.map +1 -0
  143. package/lib/client/surface/actions/useWorktreeRegistration.js +203 -0
  144. package/lib/client/surface/actions/useWorktreeRegistration.js.map +1 -0
  145. package/lib/client/surface/actions/worktree-cleanup-flow.d.ts +10 -0
  146. package/lib/client/surface/actions/worktree-cleanup-flow.d.ts.map +1 -0
  147. package/lib/client/surface/actions/worktree-cleanup-flow.js +19 -0
  148. package/lib/client/surface/actions/worktree-cleanup-flow.js.map +1 -0
  149. package/lib/client/surface/components/AccessConfirmation.d.ts +9 -0
  150. package/lib/client/surface/components/AccessConfirmation.d.ts.map +1 -0
  151. package/lib/client/surface/components/AccessConfirmation.js +18 -0
  152. package/lib/client/surface/components/AccessConfirmation.js.map +1 -0
  153. package/lib/client/surface/components/ActiveWorktree.d.ts +28 -0
  154. package/lib/client/surface/components/ActiveWorktree.d.ts.map +1 -0
  155. package/lib/client/surface/components/ActiveWorktree.js +155 -0
  156. package/lib/client/surface/components/ActiveWorktree.js.map +1 -0
  157. package/lib/client/surface/components/ArchivedWorktree.d.ts +24 -0
  158. package/lib/client/surface/components/ArchivedWorktree.d.ts.map +1 -0
  159. package/lib/client/surface/components/ArchivedWorktree.js +146 -0
  160. package/lib/client/surface/components/ArchivedWorktree.js.map +1 -0
  161. package/lib/client/surface/components/ArchivedWorktrees.d.ts +25 -0
  162. package/lib/client/surface/components/ArchivedWorktrees.d.ts.map +1 -0
  163. package/lib/client/surface/components/ArchivedWorktrees.js +20 -0
  164. package/lib/client/surface/components/ArchivedWorktrees.js.map +1 -0
  165. package/lib/client/surface/components/LifecycleDialogs.d.ts +20 -0
  166. package/lib/client/surface/components/LifecycleDialogs.d.ts.map +1 -0
  167. package/lib/client/surface/components/LifecycleDialogs.js +31 -0
  168. package/lib/client/surface/components/LifecycleDialogs.js.map +1 -0
  169. package/lib/client/surface/components/NativeDialogs.d.ts +9 -0
  170. package/lib/client/surface/components/NativeDialogs.d.ts.map +1 -0
  171. package/lib/client/surface/components/NativeDialogs.js +14 -0
  172. package/lib/client/surface/components/NativeDialogs.js.map +1 -0
  173. package/lib/client/surface/components/NotificationToasts.d.ts +7 -0
  174. package/lib/client/surface/components/NotificationToasts.d.ts.map +1 -0
  175. package/lib/client/surface/components/NotificationToasts.js +24 -0
  176. package/lib/client/surface/components/NotificationToasts.js.map +1 -0
  177. package/lib/client/surface/components/RegistrationDialog.d.ts +15 -0
  178. package/lib/client/surface/components/RegistrationDialog.d.ts.map +1 -0
  179. package/lib/client/surface/components/RegistrationDialog.js +22 -0
  180. package/lib/client/surface/components/RegistrationDialog.js.map +1 -0
  181. package/lib/client/surface/components/SurfaceContent.d.ts +31 -0
  182. package/lib/client/surface/components/SurfaceContent.d.ts.map +1 -0
  183. package/lib/client/surface/components/SurfaceContent.js +65 -0
  184. package/lib/client/surface/components/SurfaceContent.js.map +1 -0
  185. package/lib/client/surface/components/SurfaceHeader.d.ts +15 -0
  186. package/lib/client/surface/components/SurfaceHeader.d.ts.map +1 -0
  187. package/lib/client/surface/components/SurfaceHeader.js +42 -0
  188. package/lib/client/surface/components/SurfaceHeader.js.map +1 -0
  189. package/lib/client/surface/components/WorkspaceTree.d.ts +32 -0
  190. package/lib/client/surface/components/WorkspaceTree.d.ts.map +1 -0
  191. package/lib/client/surface/components/WorkspaceTree.js +149 -0
  192. package/lib/client/surface/components/WorkspaceTree.js.map +1 -0
  193. package/lib/client/{worktree-surface-dialogs.d.ts → surface/components/dialogs.d.ts} +5 -2
  194. package/lib/client/surface/components/dialogs.d.ts.map +1 -0
  195. package/lib/client/{worktree-surface-dialogs.js → surface/components/dialogs.js} +67 -24
  196. package/lib/client/surface/components/dialogs.js.map +1 -0
  197. package/lib/client/{worktree-surface-rows.d.ts → surface/components/rows.d.ts} +3 -3
  198. package/lib/client/surface/components/rows.d.ts.map +1 -0
  199. package/lib/client/{worktree-surface-rows.js → surface/components/rows.js} +180 -20
  200. package/lib/client/surface/components/rows.js.map +1 -0
  201. package/lib/client/surface/notification-queue.d.ts +11 -0
  202. package/lib/client/surface/notification-queue.d.ts.map +1 -0
  203. package/lib/client/surface/notification-queue.js +19 -0
  204. package/lib/client/surface/notification-queue.js.map +1 -0
  205. package/lib/client/{worktree-surface-selectors.d.ts → surface/selectors.d.ts} +10 -5
  206. package/lib/client/surface/selectors.d.ts.map +1 -0
  207. package/lib/client/{worktree-surface-selectors.js → surface/selectors.js} +23 -6
  208. package/lib/client/surface/selectors.js.map +1 -0
  209. package/lib/client/surface/shared.d.ts +40 -0
  210. package/lib/client/surface/shared.d.ts.map +1 -0
  211. package/lib/client/surface/shared.js +53 -0
  212. package/lib/client/surface/shared.js.map +1 -0
  213. package/lib/client/surface/state/useLifecycleState.d.ts +34 -0
  214. package/lib/client/surface/state/useLifecycleState.d.ts.map +1 -0
  215. package/lib/client/surface/state/useLifecycleState.js +39 -0
  216. package/lib/client/surface/state/useLifecycleState.js.map +1 -0
  217. package/lib/client/surface/state/useRegistrationState.d.ts +34 -0
  218. package/lib/client/surface/state/useRegistrationState.d.ts.map +1 -0
  219. package/lib/client/surface/state/useRegistrationState.js +44 -0
  220. package/lib/client/surface/state/useRegistrationState.js.map +1 -0
  221. package/lib/client/surface/state/useSessionExpansion.d.ts +39 -0
  222. package/lib/client/surface/state/useSessionExpansion.d.ts.map +1 -0
  223. package/lib/client/surface/state/useSessionExpansion.js +230 -0
  224. package/lib/client/surface/state/useSessionExpansion.js.map +1 -0
  225. package/lib/client/surface/state/useSessionOrdering.d.ts +15 -0
  226. package/lib/client/surface/state/useSessionOrdering.d.ts.map +1 -0
  227. package/lib/client/surface/state/useSessionOrdering.js +68 -0
  228. package/lib/client/surface/state/useSessionOrdering.js.map +1 -0
  229. package/lib/client/surface/state/useSurfaceMenus.d.ts +9 -0
  230. package/lib/client/surface/state/useSurfaceMenus.d.ts.map +1 -0
  231. package/lib/client/surface/state/useSurfaceMenus.js +15 -0
  232. package/lib/client/surface/state/useSurfaceMenus.js.map +1 -0
  233. package/lib/client/surface/state/useSurfaceRefresh.d.ts +39 -0
  234. package/lib/client/surface/state/useSurfaceRefresh.d.ts.map +1 -0
  235. package/lib/client/surface/state/useSurfaceRefresh.js +274 -0
  236. package/lib/client/surface/state/useSurfaceRefresh.js.map +1 -0
  237. package/lib/client/surface/state/useSurfaceSources.d.ts +31 -0
  238. package/lib/client/surface/state/useSurfaceSources.d.ts.map +1 -0
  239. package/lib/client/surface/state/useSurfaceSources.js +63 -0
  240. package/lib/client/surface/state/useSurfaceSources.js.map +1 -0
  241. package/lib/client/{worktree-surface-types.d.ts → surface/types.d.ts} +58 -13
  242. package/lib/client/surface/types.d.ts.map +1 -0
  243. package/lib/client/surface/types.js +2 -0
  244. package/lib/client/surface/types.js.map +1 -0
  245. package/lib/client/{WorktreeModeAction.d.ts → view/WorktreeModeAction.d.ts} +1 -1
  246. package/lib/client/view/WorktreeModeAction.d.ts.map +1 -0
  247. package/lib/client/{WorktreeModeAction.js → view/WorktreeModeAction.js} +9 -1
  248. package/lib/client/view/WorktreeModeAction.js.map +1 -0
  249. package/lib/client/view/navigation.d.ts.map +1 -0
  250. package/lib/client/view/navigation.js.map +1 -0
  251. package/lib/client/view/view-mode-dispatch.d.ts +7 -0
  252. package/lib/client/view/view-mode-dispatch.d.ts.map +1 -0
  253. package/lib/client/view/view-mode-dispatch.js +11 -0
  254. package/lib/client/view/view-mode-dispatch.js.map +1 -0
  255. package/lib/client/view/view-mode-store.d.ts.map +1 -0
  256. package/lib/client/view/view-mode-store.js.map +1 -0
  257. package/lib/client/view/view-mode.d.ts.map +1 -0
  258. package/lib/client/view/view-mode.js.map +1 -0
  259. package/lib/client/{worktree-error-copy.d.ts → view/worktree-error-copy.d.ts} +2 -2
  260. package/lib/client/view/worktree-error-copy.d.ts.map +1 -0
  261. package/lib/client/view/worktree-error-copy.js.map +1 -0
  262. package/lib/client/{worktree-expand-state.d.ts → view/worktree-expand-state.d.ts} +1 -0
  263. package/lib/client/view/worktree-expand-state.d.ts.map +1 -0
  264. package/lib/client/{worktree-expand-state.js → view/worktree-expand-state.js} +11 -0
  265. package/lib/client/view/worktree-expand-state.js.map +1 -0
  266. package/lib/client/{worktree-view-actions.d.ts → view/worktree-view-actions.d.ts} +11 -5
  267. package/lib/client/view/worktree-view-actions.d.ts.map +1 -0
  268. package/lib/client/{worktree-view-actions.js → view/worktree-view-actions.js} +13 -11
  269. package/lib/client/view/worktree-view-actions.js.map +1 -0
  270. package/lib/client/view/worktree-view-errors.d.ts.map +1 -0
  271. package/lib/client/view/worktree-view-errors.js.map +1 -0
  272. package/lib/client/{worktree-view-read.d.ts → view/worktree-view-read.d.ts} +4 -2
  273. package/lib/client/view/worktree-view-read.d.ts.map +1 -0
  274. package/lib/client/{worktree-view-read.js → view/worktree-view-read.js} +4 -1
  275. package/lib/client/view/worktree-view-read.js.map +1 -0
  276. package/lib/client/view/worktree-view.d.ts.map +1 -0
  277. package/lib/client/view/worktree-view.js.map +1 -0
  278. package/lib/client/worktree-connection.d.ts +6 -0
  279. package/lib/client/worktree-connection.d.ts.map +1 -1
  280. package/lib/client/worktree-connection.js +20 -0
  281. package/lib/client/worktree-connection.js.map +1 -1
  282. package/lib/client.js +5869 -2648
  283. package/lib/client.js.map +1 -1
  284. package/lib/contract/index.contract.js +12 -0
  285. package/lib/contract/index.contract.js.map +1 -1
  286. package/lib/contract/index.d.ts +64 -3
  287. package/lib/contract/index.d.ts.map +1 -1
  288. package/lib/contract/index.js +8 -0
  289. package/lib/contract/index.js.map +1 -1
  290. package/lib/host/dsh-read-adapter.d.ts +13 -2
  291. package/lib/host/dsh-read-adapter.d.ts.map +1 -1
  292. package/lib/host/dsh-read-adapter.js +23 -3
  293. package/lib/host/dsh-read-adapter.js.map +1 -1
  294. package/lib/host/remote.d.ts.map +1 -1
  295. package/lib/host/remote.js +15 -0
  296. package/lib/host/remote.js.map +1 -1
  297. package/lib/host/service.d.ts +30 -0
  298. package/lib/host/service.d.ts.map +1 -1
  299. package/lib/host/service.js +47 -1
  300. package/lib/host/service.js.map +1 -1
  301. package/lib/host/worktree-activity.d.ts +13 -0
  302. package/lib/host/worktree-activity.d.ts.map +1 -0
  303. package/lib/host/worktree-activity.js +23 -0
  304. package/lib/host/worktree-activity.js.map +1 -0
  305. package/lib/host/worktree-instructions.d.ts +41 -0
  306. package/lib/host/worktree-instructions.d.ts.map +1 -0
  307. package/lib/host/worktree-instructions.js +65 -0
  308. package/lib/host/worktree-instructions.js.map +1 -0
  309. package/lib/host/worktree-permission-manager.js +2 -2
  310. package/lib/host/worktree-permission-manager.js.map +1 -1
  311. package/lib/index.d.ts +3 -3
  312. package/lib/index.d.ts.map +1 -1
  313. package/lib/index.js +2 -2
  314. package/lib/index.js.map +1 -1
  315. package/lib/manage/manager-context.d.ts +2 -1
  316. package/lib/manage/manager-context.d.ts.map +1 -1
  317. package/lib/manage/manager-sessions.js +4 -4
  318. package/lib/manage/manager-sessions.js.map +1 -1
  319. package/lib/manage/manager-worktree-lifecycle.d.ts +23 -0
  320. package/lib/manage/manager-worktree-lifecycle.d.ts.map +1 -0
  321. package/lib/manage/manager-worktree-lifecycle.js +165 -0
  322. package/lib/manage/manager-worktree-lifecycle.js.map +1 -0
  323. package/lib/manage/manager-worktrees.d.ts +1 -6
  324. package/lib/manage/manager-worktrees.d.ts.map +1 -1
  325. package/lib/manage/manager-worktrees.js +81 -112
  326. package/lib/manage/manager-worktrees.js.map +1 -1
  327. package/lib/manage/manager.d.ts +24 -1
  328. package/lib/manage/manager.d.ts.map +1 -1
  329. package/lib/manage/manager.js +70 -6
  330. package/lib/manage/manager.js.map +1 -1
  331. package/lib/manage/types.d.ts +1 -0
  332. package/lib/manage/types.d.ts.map +1 -1
  333. package/lib/provider/generated-name.d.ts +8 -0
  334. package/lib/provider/generated-name.d.ts.map +1 -0
  335. package/lib/provider/generated-name.js +29 -0
  336. package/lib/provider/generated-name.js.map +1 -0
  337. package/lib/provider/{git.d.ts → git/adapter.d.ts} +2 -2
  338. package/lib/provider/git/adapter.d.ts.map +1 -0
  339. package/lib/provider/{git.js → git/adapter.js} +11 -2
  340. package/lib/provider/git/adapter.js.map +1 -0
  341. package/lib/provider/{repository-fingerprint.d.ts → git/repository-fingerprint.d.ts} +1 -1
  342. package/lib/provider/git/repository-fingerprint.d.ts.map +1 -0
  343. package/lib/provider/git/repository-fingerprint.js.map +1 -0
  344. package/lib/provider/{subprocess.d.ts → git/subprocess.d.ts} +1 -1
  345. package/lib/provider/git/subprocess.d.ts.map +1 -0
  346. package/lib/provider/git/subprocess.js.map +1 -0
  347. package/lib/provider/git/worktree-status.d.ts +5 -0
  348. package/lib/provider/git/worktree-status.d.ts.map +1 -0
  349. package/lib/provider/git/worktree-status.js +23 -0
  350. package/lib/provider/git/worktree-status.js.map +1 -0
  351. package/lib/provider/index.d.ts +5 -5
  352. package/lib/provider/index.d.ts.map +1 -1
  353. package/lib/provider/index.js +5 -5
  354. package/lib/provider/index.js.map +1 -1
  355. package/lib/provider/mutation-token.d.ts +1 -1
  356. package/lib/provider/mutation-token.d.ts.map +1 -1
  357. package/lib/provider/mutation-token.js +1 -0
  358. package/lib/provider/mutation-token.js.map +1 -1
  359. package/lib/provider/sidecar/mutation-lock.d.ts.map +1 -0
  360. package/lib/provider/{mutation-lock.js → sidecar/mutation-lock.js} +1 -1
  361. package/lib/provider/sidecar/mutation-lock.js.map +1 -0
  362. package/lib/provider/{sidecar.d.ts → sidecar/repository.d.ts} +3 -3
  363. package/lib/provider/sidecar/repository.d.ts.map +1 -0
  364. package/lib/provider/{sidecar.js → sidecar/repository.js} +16 -5
  365. package/lib/provider/sidecar/repository.js.map +1 -0
  366. package/lib/provider/{sidecar-persistence.d.ts → sidecar/sidecar-persistence.d.ts} +1 -1
  367. package/lib/provider/sidecar/sidecar-persistence.d.ts.map +1 -0
  368. package/lib/provider/{sidecar-persistence.js → sidecar/sidecar-persistence.js} +29 -2
  369. package/lib/provider/sidecar/sidecar-persistence.js.map +1 -0
  370. package/lib/provider/{sidecar-schema.d.ts → sidecar/sidecar-schema.d.ts} +1 -1
  371. package/lib/provider/sidecar/sidecar-schema.d.ts.map +1 -0
  372. package/lib/provider/{sidecar-schema.js → sidecar/sidecar-schema.js} +59 -16
  373. package/lib/provider/sidecar/sidecar-schema.js.map +1 -0
  374. package/lib/provider/transaction/dependencies.d.ts +10 -0
  375. package/lib/provider/transaction/dependencies.d.ts.map +1 -0
  376. package/lib/provider/transaction/dependencies.js +2 -0
  377. package/lib/provider/transaction/dependencies.js.map +1 -0
  378. package/lib/provider/transaction/index.d.ts +17 -0
  379. package/lib/provider/transaction/index.d.ts.map +1 -0
  380. package/lib/provider/transaction/index.js +44 -0
  381. package/lib/provider/transaction/index.js.map +1 -0
  382. package/lib/provider/transaction/operations/adopt-branch.d.ts +6 -0
  383. package/lib/provider/transaction/operations/adopt-branch.d.ts.map +1 -0
  384. package/lib/provider/transaction/operations/adopt-branch.js +59 -0
  385. package/lib/provider/transaction/operations/adopt-branch.js.map +1 -0
  386. package/lib/provider/transaction/operations/clean.d.ts +4 -0
  387. package/lib/provider/transaction/operations/clean.d.ts.map +1 -0
  388. package/lib/provider/transaction/operations/clean.js +168 -0
  389. package/lib/provider/transaction/operations/clean.js.map +1 -0
  390. package/lib/provider/transaction/operations/create.d.ts +5 -0
  391. package/lib/provider/transaction/operations/create.d.ts.map +1 -0
  392. package/lib/provider/transaction/operations/create.js +136 -0
  393. package/lib/provider/transaction/operations/create.js.map +1 -0
  394. package/lib/provider/transaction/operations/import.d.ts +5 -0
  395. package/lib/provider/transaction/operations/import.d.ts.map +1 -0
  396. package/lib/provider/transaction/operations/import.js +93 -0
  397. package/lib/provider/transaction/operations/import.js.map +1 -0
  398. package/lib/provider/transaction/operations/remove.d.ts +4 -0
  399. package/lib/provider/transaction/operations/remove.d.ts.map +1 -0
  400. package/lib/provider/transaction/operations/remove.js +164 -0
  401. package/lib/provider/transaction/operations/remove.js.map +1 -0
  402. package/lib/provider/transaction/recovery/failure-recovery.d.ts +32 -0
  403. package/lib/provider/transaction/recovery/failure-recovery.d.ts.map +1 -0
  404. package/lib/provider/transaction/recovery/failure-recovery.js +147 -0
  405. package/lib/provider/transaction/recovery/failure-recovery.js.map +1 -0
  406. package/lib/provider/transaction/recovery/recover.d.ts +4 -0
  407. package/lib/provider/transaction/recovery/recover.d.ts.map +1 -0
  408. package/lib/provider/transaction/recovery/recover.js +164 -0
  409. package/lib/provider/transaction/recovery/recover.js.map +1 -0
  410. package/lib/provider/transaction/support/admission.d.ts +7 -0
  411. package/lib/provider/transaction/support/admission.d.ts.map +1 -0
  412. package/lib/provider/transaction/support/admission.js +90 -0
  413. package/lib/provider/transaction/support/admission.js.map +1 -0
  414. package/lib/provider/transaction/support/inspection.d.ts +11 -0
  415. package/lib/provider/transaction/support/inspection.d.ts.map +1 -0
  416. package/lib/provider/transaction/support/inspection.js +51 -0
  417. package/lib/provider/transaction/support/inspection.js.map +1 -0
  418. package/lib/provider/transaction/support/journal.d.ts +12 -0
  419. package/lib/provider/transaction/support/journal.d.ts.map +1 -0
  420. package/lib/provider/transaction/support/journal.js +74 -0
  421. package/lib/provider/transaction/support/journal.js.map +1 -0
  422. package/lib/provider/transaction/support/locking.d.ts +4 -0
  423. package/lib/provider/transaction/support/locking.d.ts.map +1 -0
  424. package/lib/provider/transaction/support/locking.js +11 -0
  425. package/lib/provider/transaction/support/locking.js.map +1 -0
  426. package/lib/provider/transaction/support/path-safety.d.ts +11 -0
  427. package/lib/provider/transaction/support/path-safety.d.ts.map +1 -0
  428. package/lib/provider/transaction/support/path-safety.js +82 -0
  429. package/lib/provider/transaction/support/path-safety.js.map +1 -0
  430. package/lib/provider/transaction/support/paths.d.ts +10 -0
  431. package/lib/provider/transaction/support/paths.d.ts.map +1 -0
  432. package/lib/provider/transaction/support/paths.js +68 -0
  433. package/lib/provider/transaction/support/paths.js.map +1 -0
  434. package/lib/provider/transaction/support/publication.d.ts +9 -0
  435. package/lib/provider/transaction/support/publication.d.ts.map +1 -0
  436. package/lib/provider/transaction/support/publication.js +92 -0
  437. package/lib/provider/transaction/support/publication.js.map +1 -0
  438. package/lib/provider/transaction/types.d.ts +38 -0
  439. package/lib/provider/transaction/types.d.ts.map +1 -0
  440. package/lib/provider/transaction/types.js +2 -0
  441. package/lib/provider/transaction/types.js.map +1 -0
  442. package/lib/provider/types.d.ts +22 -3
  443. package/lib/provider/types.d.ts.map +1 -1
  444. package/lib/provider/types.js +1 -1
  445. package/lib/provider/types.js.map +1 -1
  446. package/lib/provider/worktree-lifecycle.d.ts +19 -0
  447. package/lib/provider/worktree-lifecycle.d.ts.map +1 -0
  448. package/lib/provider/worktree-lifecycle.js +44 -0
  449. package/lib/provider/worktree-lifecycle.js.map +1 -0
  450. package/lib/typert.host.js +330 -36
  451. package/lib/typert.remote-client.d.ts +12 -0
  452. package/lib/typert.remote-client.d.ts.map +1 -1
  453. package/lib/typert.remote-client.js +330 -36
  454. package/package.json +21 -20
  455. package/lib/client/WorktreeContext.d.ts.map +0 -1
  456. package/lib/client/WorktreeContext.js.map +0 -1
  457. package/lib/client/WorktreeHeroContext.d.ts.map +0 -1
  458. package/lib/client/WorktreeHeroContext.js.map +0 -1
  459. package/lib/client/WorktreeModeAction.d.ts.map +0 -1
  460. package/lib/client/WorktreeModeAction.js.map +0 -1
  461. package/lib/client/WorktreeOverlay.d.ts.map +0 -1
  462. package/lib/client/WorktreeOverlay.js.map +0 -1
  463. package/lib/client/dsh-rc1-slot-contract.d.ts +0 -43
  464. package/lib/client/dsh-rc1-slot-contract.d.ts.map +0 -1
  465. package/lib/client/dsh-rc1-slot-contract.js +0 -2
  466. package/lib/client/dsh-rc1-slot-contract.js.map +0 -1
  467. package/lib/client/navigation.d.ts.map +0 -1
  468. package/lib/client/navigation.js.map +0 -1
  469. package/lib/client/overlay-bounds.d.ts.map +0 -1
  470. package/lib/client/overlay-bounds.js.map +0 -1
  471. package/lib/client/session-view.d.ts.map +0 -1
  472. package/lib/client/session-view.js.map +0 -1
  473. package/lib/client/sidebar-overlay-geometry.d.ts.map +0 -1
  474. package/lib/client/sidebar-overlay-geometry.js.map +0 -1
  475. package/lib/client/view-mode-store.d.ts.map +0 -1
  476. package/lib/client/view-mode-store.js.map +0 -1
  477. package/lib/client/view-mode.d.ts.map +0 -1
  478. package/lib/client/view-mode.js.map +0 -1
  479. package/lib/client/virtual-workspace-membership.d.ts.map +0 -1
  480. package/lib/client/virtual-workspace-membership.js.map +0 -1
  481. package/lib/client/worktree-context-store.d.ts.map +0 -1
  482. package/lib/client/worktree-context-store.js.map +0 -1
  483. package/lib/client/worktree-context.d.ts.map +0 -1
  484. package/lib/client/worktree-context.js.map +0 -1
  485. package/lib/client/worktree-error-copy.d.ts.map +0 -1
  486. package/lib/client/worktree-error-copy.js.map +0 -1
  487. package/lib/client/worktree-expand-state.d.ts.map +0 -1
  488. package/lib/client/worktree-expand-state.js.map +0 -1
  489. package/lib/client/worktree-permission-icon.d.ts.map +0 -1
  490. package/lib/client/worktree-permission-icon.js.map +0 -1
  491. package/lib/client/worktree-permission.d.ts.map +0 -1
  492. package/lib/client/worktree-permission.js.map +0 -1
  493. package/lib/client/worktree-session-fork.d.ts.map +0 -1
  494. package/lib/client/worktree-session-fork.js.map +0 -1
  495. package/lib/client/worktree-session-order.d.ts.map +0 -1
  496. package/lib/client/worktree-session-order.js.map +0 -1
  497. package/lib/client/worktree-session-position.d.ts.map +0 -1
  498. package/lib/client/worktree-session-position.js.map +0 -1
  499. package/lib/client/worktree-session.d.ts.map +0 -1
  500. package/lib/client/worktree-session.js.map +0 -1
  501. package/lib/client/worktree-surface-dialogs.d.ts.map +0 -1
  502. package/lib/client/worktree-surface-dialogs.js.map +0 -1
  503. package/lib/client/worktree-surface-rows.d.ts.map +0 -1
  504. package/lib/client/worktree-surface-rows.js.map +0 -1
  505. package/lib/client/worktree-surface-selectors.d.ts.map +0 -1
  506. package/lib/client/worktree-surface-selectors.js.map +0 -1
  507. package/lib/client/worktree-surface-types.d.ts.map +0 -1
  508. package/lib/client/worktree-surface-types.js +0 -2
  509. package/lib/client/worktree-surface-types.js.map +0 -1
  510. package/lib/client/worktree-view-actions.d.ts.map +0 -1
  511. package/lib/client/worktree-view-actions.js.map +0 -1
  512. package/lib/client/worktree-view-errors.d.ts.map +0 -1
  513. package/lib/client/worktree-view-errors.js.map +0 -1
  514. package/lib/client/worktree-view-read.d.ts.map +0 -1
  515. package/lib/client/worktree-view-read.js.map +0 -1
  516. package/lib/client/worktree-view.d.ts.map +0 -1
  517. package/lib/client/worktree-view.js.map +0 -1
  518. package/lib/provider/git.d.ts.map +0 -1
  519. package/lib/provider/git.js.map +0 -1
  520. package/lib/provider/mutation-lock.d.ts.map +0 -1
  521. package/lib/provider/mutation-lock.js.map +0 -1
  522. package/lib/provider/repository-fingerprint.d.ts.map +0 -1
  523. package/lib/provider/repository-fingerprint.js.map +0 -1
  524. package/lib/provider/sidecar-persistence.d.ts.map +0 -1
  525. package/lib/provider/sidecar-persistence.js.map +0 -1
  526. package/lib/provider/sidecar-schema.d.ts.map +0 -1
  527. package/lib/provider/sidecar-schema.js.map +0 -1
  528. package/lib/provider/sidecar.d.ts.map +0 -1
  529. package/lib/provider/sidecar.js.map +0 -1
  530. package/lib/provider/subprocess.d.ts.map +0 -1
  531. package/lib/provider/subprocess.js.map +0 -1
  532. package/lib/provider/transaction.d.ts +0 -65
  533. package/lib/provider/transaction.d.ts.map +0 -1
  534. package/lib/provider/transaction.js +0 -1011
  535. package/lib/provider/transaction.js.map +0 -1
  536. /package/lib/client/{WorktreeContext.js → context/WorktreeContext.js} +0 -0
  537. /package/lib/client/{WorktreeHeroContext.js → context/WorktreeHeroContext.js} +0 -0
  538. /package/lib/client/{overlay-bounds.d.ts → overlay/overlay-bounds.d.ts} +0 -0
  539. /package/lib/client/{overlay-bounds.js → overlay/overlay-bounds.js} +0 -0
  540. /package/lib/client/{sidebar-overlay-geometry.d.ts → overlay/sidebar-overlay-geometry.d.ts} +0 -0
  541. /package/lib/client/{sidebar-overlay-geometry.js → overlay/sidebar-overlay-geometry.js} +0 -0
  542. /package/lib/client/{worktree-permission-icon.d.ts → permission/worktree-permission-icon.d.ts} +0 -0
  543. /package/lib/client/{worktree-permission-icon.js → permission/worktree-permission-icon.js} +0 -0
  544. /package/lib/client/{worktree-permission.d.ts → permission/worktree-permission.d.ts} +0 -0
  545. /package/lib/client/{worktree-permission.js → permission/worktree-permission.js} +0 -0
  546. /package/lib/client/{session-view.d.ts → session/session-view.d.ts} +0 -0
  547. /package/lib/client/{session-view.js → session/session-view.js} +0 -0
  548. /package/lib/client/{worktree-session-order.d.ts → session/worktree-session-order.d.ts} +0 -0
  549. /package/lib/client/{worktree-session-order.js → session/worktree-session-order.js} +0 -0
  550. /package/lib/client/{worktree-session-position.d.ts → session/worktree-session-position.d.ts} +0 -0
  551. /package/lib/client/{worktree-session-position.js → session/worktree-session-position.js} +0 -0
  552. /package/lib/client/{navigation.d.ts → view/navigation.d.ts} +0 -0
  553. /package/lib/client/{navigation.js → view/navigation.js} +0 -0
  554. /package/lib/client/{view-mode-store.d.ts → view/view-mode-store.d.ts} +0 -0
  555. /package/lib/client/{view-mode-store.js → view/view-mode-store.js} +0 -0
  556. /package/lib/client/{view-mode.d.ts → view/view-mode.d.ts} +0 -0
  557. /package/lib/client/{view-mode.js → view/view-mode.js} +0 -0
  558. /package/lib/client/{worktree-error-copy.js → view/worktree-error-copy.js} +0 -0
  559. /package/lib/client/{worktree-view-errors.d.ts → view/worktree-view-errors.d.ts} +0 -0
  560. /package/lib/client/{worktree-view-errors.js → view/worktree-view-errors.js} +0 -0
  561. /package/lib/client/{worktree-view.d.ts → view/worktree-view.d.ts} +0 -0
  562. /package/lib/client/{worktree-view.js → view/worktree-view.js} +0 -0
  563. /package/lib/provider/{repository-fingerprint.js → git/repository-fingerprint.js} +0 -0
  564. /package/lib/provider/{subprocess.js → git/subprocess.js} +0 -0
  565. /package/lib/provider/{mutation-lock.d.ts → sidecar/mutation-lock.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failure-recovery.js","sourceRoot":"","sources":["../../../../src/provider/transaction/recovery/failure-recovery.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,2BAA2B,CAAC;AAGnC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,YAAkD,EAClD,OAQC;IAED,IAAI,IAAgC,CAAC;IACrC,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,C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,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY;YACvC,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC;SAC/B,CACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,cAAc,CAClB,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,OAAO,CAAC,EAAE,EAClB,OAAO,CAAC,KAAK,CAAC,UAAU,EACxB,OAAO,CAAC,UAAU,CACnB,CAAC;QACF,OAAO;IACT,CAAC;IACD,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,2BAA2B,CAAC,CAAC;IACjF,MAAM,aAAa,CACjB,mDAAmD,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,EAChF;QACE,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,WAAW;QACtC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;QAC/B,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY;KACxC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RecoverWorktreesInput } from '../types.js';
2
+ import type { TransactionDependencies } from '../dependencies.js';
3
+ export declare function recoverWorktreeTransaction(dependencies: Pick<TransactionDependencies, 'dshHome' | 'git' | 'repositoryLock' | 'sidecar'>, input: RecoverWorktreesInput): Promise<void>;
4
+ //# sourceMappingURL=recover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recover.d.ts","sourceRoot":"","sources":["../../../../src/provider/transaction/recovery/recover.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAQzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,KAAK,GAAG,gBAAgB,GAAG,SAAS,CAAC,EAC7F,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA4Kf"}
@@ -0,0 +1,164 @@
1
+ import { createRepositoryFingerprint } from '../../git/repository-fingerprint.js';
2
+ import { pathExists } from '../support/paths.js';
3
+ import { recoveryError } from '../support/journal.js';
4
+ import { withShardLock } from '../support/locking.js';
5
+ import { resolveRepository, findExactWorktree, isExactCreatedWorktree } from '../support/inspection.js';
6
+ import { cleanLegacyObservations, assertRepositoryCompatible } from '../support/admission.js';
7
+ import { assertRecoverableCreatePath } from '../support/path-safety.js';
8
+ import { publishCreated, publishCleaned, clearPending, markRecovery } from '../support/publication.js';
9
+ import { WorktreeProviderError, providerError } from '../../types.js';
10
+ export async function recoverWorktreeTransaction(dependencies, input) {
11
+ return withShardLock(dependencies, input.workspaceId, async (locked) => {
12
+ await cleanLegacyObservations(locked);
13
+ await dependencies.git.validateRepository(input.workspaceRoot);
14
+ const repository = await resolveRepository(dependencies, input.workspaceRoot);
15
+ return dependencies.repositoryLock.run(`repository:${createRepositoryFingerprint(repository.identity)}`, async (lock) => {
16
+ lock.assertHeld();
17
+ const gitRoot = repository.identity.topLevel;
18
+ const current = await locked.read();
19
+ assertRepositoryCompatible(current, repository.identity, input.workspaceId, true);
20
+ const pending = current.pendingOperation;
21
+ let live;
22
+ try {
23
+ live = await dependencies.git.listWorktrees(gitRoot);
24
+ }
25
+ catch (inspectionError) {
26
+ if (pending)
27
+ await markRecovery(locked, pending, 'WORKTREE_RECOVERY_REQUIRED');
28
+ throw recoveryError(`Unable to inspect Git during Worktree recovery`, {
29
+ workspaceId: input.workspaceId,
30
+ ...(pending ? { operationId: pending.id } : {}),
31
+ cause: String(inspectionError),
32
+ });
33
+ }
34
+ // Without a journal there is no interrupted mutation to recover. Missing
35
+ // registrations remain runtime repair facts, including active records.
36
+ if (!pending)
37
+ return;
38
+ const pendingFingerprint = pending.repositoryFingerprint ??
39
+ (pending.repository ? createRepositoryFingerprint(pending.repository) : undefined);
40
+ if (pendingFingerprint !== createRepositoryFingerprint(repository.identity)) {
41
+ await markRecovery(locked, pending, 'WORKTREE_IDENTITY_CHANGED');
42
+ throw providerError('WORKTREE_IDENTITY_CHANGED', 'Pending operation belongs to another repository', {
43
+ workspaceId: input.workspaceId,
44
+ operationId: pending.id,
45
+ });
46
+ }
47
+ if (pending.type === 'create-worktree') {
48
+ try {
49
+ await assertRecoverableCreatePath(dependencies, pending, input.workspaceRoot);
50
+ }
51
+ catch (error) {
52
+ await markRecovery(locked, pending, 'WORKTREE_IDENTITY_CHANGED');
53
+ if (error instanceof WorktreeProviderError)
54
+ throw error;
55
+ throw recoveryError(`Unable to validate the pending Worktree path: ${pending.targetPath}`, {
56
+ workspaceId: input.workspaceId,
57
+ operationId: pending.id,
58
+ targetPath: pending.targetPath,
59
+ cause: String(error),
60
+ });
61
+ }
62
+ const exact = await isExactCreatedWorktree(live, {
63
+ workspaceId: input.workspaceId,
64
+ workspaceRoot: input.workspaceRoot,
65
+ targetPath: pending.targetPath,
66
+ worktreeId: pending.worktreeId,
67
+ baseBranch: pending.baseRef ?? pending.branch,
68
+ newBranch: pending.baseRef !== undefined ? pending.branch : undefined,
69
+ targetBranch: pending.branch,
70
+ });
71
+ if (exact) {
72
+ const record = {
73
+ worktreeId: pending.worktreeId,
74
+ workspaceId: input.workspaceId,
75
+ absolutePath: pending.targetPath,
76
+ branch: pending.branch,
77
+ createdAt: pending.startedAt,
78
+ baseBranch: pending.baseRef ?? pending.branch,
79
+ source: 'plugin',
80
+ status: 'active',
81
+ };
82
+ await publishCreated(dependencies, locked, pending.id, record, repository.identity);
83
+ return;
84
+ }
85
+ let branches;
86
+ try {
87
+ branches = await dependencies.git.listBranches(gitRoot);
88
+ }
89
+ catch (inspectionError) {
90
+ await markRecovery(locked, pending, 'WORKTREE_RECOVERY_REQUIRED');
91
+ throw recoveryError(`Unable to inspect branches during pending create recovery`, {
92
+ workspaceId: input.workspaceId,
93
+ operationId: pending.id,
94
+ targetPath: pending.targetPath,
95
+ cause: String(inspectionError),
96
+ });
97
+ }
98
+ const ambiguousNewBranch = pending.baseRef !== undefined && branches.includes(pending.branch);
99
+ let pendingTargetExists;
100
+ try {
101
+ pendingTargetExists = await pathExists(pending.targetPath);
102
+ }
103
+ catch (inspectionError) {
104
+ await markRecovery(locked, pending, 'WORKTREE_RECOVERY_REQUIRED');
105
+ throw recoveryError(`Unable to inspect the pending Worktree path: ${pending.targetPath}`, {
106
+ workspaceId: input.workspaceId,
107
+ operationId: pending.id,
108
+ targetPath: pending.targetPath,
109
+ cause: String(inspectionError),
110
+ });
111
+ }
112
+ if (!ambiguousNewBranch && !pendingTargetExists) {
113
+ await clearPending(locked, pending.id);
114
+ return;
115
+ }
116
+ await markRecovery(locked, pending, 'WORKTREE_RECOVERY_REQUIRED');
117
+ throw recoveryError(`Unable to reconcile pending create: ${pending.targetPath}`, {
118
+ workspaceId: input.workspaceId,
119
+ operationId: pending.id,
120
+ targetPath: pending.targetPath,
121
+ });
122
+ }
123
+ const exact = await findExactWorktree(live, pending.targetPath, pending.branch);
124
+ let pendingTargetExists;
125
+ try {
126
+ pendingTargetExists = await pathExists(pending.targetPath);
127
+ }
128
+ catch (inspectionError) {
129
+ await markRecovery(locked, pending, 'WORKTREE_RECOVERY_REQUIRED');
130
+ throw recoveryError(`Unable to inspect the pending Worktree path: ${pending.targetPath}`, {
131
+ workspaceId: input.workspaceId,
132
+ operationId: pending.id,
133
+ targetPath: pending.targetPath,
134
+ cause: String(inspectionError),
135
+ });
136
+ }
137
+ if (pending.type === 'clean-worktree' &&
138
+ pending.phase === 'recovery-needed' &&
139
+ !exact &&
140
+ !pendingTargetExists) {
141
+ throw recoveryError('Clean operation lacks sufficient completion evidence', {
142
+ workspaceId: input.workspaceId,
143
+ operationId: pending.id,
144
+ worktreeId: pending.worktreeId,
145
+ });
146
+ }
147
+ if (!exact && !pendingTargetExists) {
148
+ await publishCleaned(locked, pending.id, pending.worktreeId, repository.identity);
149
+ return;
150
+ }
151
+ if (exact) {
152
+ await clearPending(locked, pending.id);
153
+ return;
154
+ }
155
+ await markRecovery(locked, pending, 'WORKTREE_IDENTITY_CHANGED');
156
+ throw providerError('WORKTREE_IDENTITY_CHANGED', `Unable to reconcile pending ${pending.type}: ${pending.targetPath}`, {
157
+ workspaceId: input.workspaceId,
158
+ operationId: pending.id,
159
+ targetPath: pending.targetPath,
160
+ });
161
+ });
162
+ });
163
+ }
164
+ //# sourceMappingURL=recover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recover.js","sourceRoot":"","sources":["../../../../src/provider/transaction/recovery/recover.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEvG,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,YAA6F,EAC7F,KAA4B;IAE5B,OAAO,aAAa,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACrE,MAAM,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC/D,MAAM,U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ACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { WorktreeRecord } from '../../../contract/index.js';
2
+ import type { LockedSidecarStore, RepositoryIdentity, SidecarSnapshot } from '../../types.js';
3
+ export declare function cleanLegacyObservations(locked: LockedSidecarStore): Promise<void>;
4
+ export declare function assertMutationAdmitted(snapshot: SidecarSnapshot, workspaceId: string): void;
5
+ export declare function assertMutationToken(snapshot: Pick<SidecarSnapshot, 'schemaVersion' | 'workspaceId' | 'revision'>, record: WorktreeRecord, token: string | undefined): void;
6
+ export declare function assertRepositoryCompatible(snapshot: SidecarSnapshot, identity: RepositoryIdentity, workspaceId: string, allowMissing?: boolean): void;
7
+ //# sourceMappingURL=admission.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.d.ts","sourceRoot":"","sources":["../../../../src/provider/transaction/support/admission.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,OAAO,KAAK,EACV,kBAAkB,EAElB,kBAAkB,EAClB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAuBxB,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBvF;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAiB3F;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,GAAG,UAAU,CAAC,EAC7E,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,IAAI,CAQN;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,EAAE,MAAM,EACnB,YAAY,UAAQ,GACnB,IAAI,CAuBN"}
@@ -0,0 +1,90 @@
1
+ import { createWorktreeMutationToken } from '../../mutation-token.js';
2
+ import { createRepositoryFingerprint } from '../../git/repository-fingerprint.js';
3
+ import { sameRepository } from './paths.js';
4
+ import { recoveryError } from './journal.js';
5
+ import { providerError } from '../../types.js';
6
+ /** Only legacy observations of known, uncleaned records may be retired. */
7
+ function recoveryBlocker(worktrees) {
8
+ const records = new Map();
9
+ for (const record of worktrees) {
10
+ // Preserve the previous first-match lookup even for an injected legacy store.
11
+ if (!records.has(record.worktreeId))
12
+ records.set(record.worktreeId, record);
13
+ }
14
+ return (issue) => {
15
+ const record = issue.worktreeId === undefined ? undefined : records.get(issue.worktreeId);
16
+ return !(issue.operationId === undefined &&
17
+ issue.code === 'WORKTREE_RECOVERY_REQUIRED' &&
18
+ record !== undefined &&
19
+ record.diskCleanup !== 'completed');
20
+ };
21
+ }
22
+ export async function cleanLegacyObservations(locked) {
23
+ const snapshot = await locked.read();
24
+ if (snapshot.pendingOperation !== undefined ||
25
+ !snapshot.recoveryIssues ||
26
+ snapshot.recoveryIssues.length === 0) {
27
+ return;
28
+ }
29
+ const remainingIssues = snapshot.recoveryIssues.filter(recoveryBlocker(snapshot.worktrees));
30
+ if (remainingIssues.length !== snapshot.recoveryIssues.length) {
31
+ await locked.mutate((current) => {
32
+ const { repository: _repository, recoveryIssues: _oldRecovery, ...stableFields } = current;
33
+ void _repository;
34
+ void _oldRecovery;
35
+ return {
36
+ result: undefined,
37
+ changed: true,
38
+ snapshot: {
39
+ ...stableFields,
40
+ ...(remainingIssues.length > 0 ? { recoveryIssues: remainingIssues } : {}),
41
+ },
42
+ };
43
+ });
44
+ }
45
+ }
46
+ export function assertMutationAdmitted(snapshot, workspaceId) {
47
+ if (snapshot.pendingOperation) {
48
+ throw recoveryError(`Workspace has a pending Worktree operation: ${snapshot.pendingOperation.id}`, {
49
+ workspaceId,
50
+ operationId: snapshot.pendingOperation.id,
51
+ });
52
+ }
53
+ if (snapshot.recoveryIssues && snapshot.recoveryIssues.length > 0) {
54
+ if (snapshot.recoveryIssues.some(recoveryBlocker(snapshot.worktrees))) {
55
+ throw recoveryError(`Workspace has unresolved Worktree recovery issues: ${workspaceId}`, {
56
+ workspaceId,
57
+ });
58
+ }
59
+ }
60
+ }
61
+ export function assertMutationToken(snapshot, record, token) {
62
+ const expected = createWorktreeMutationToken(snapshot, record);
63
+ if (token === undefined || token !== expected) {
64
+ throw providerError('WORKTREE_STATE_CONFLICT', 'Worktree state changed after it was loaded', {
65
+ workspaceId: record.workspaceId,
66
+ worktreeId: record.worktreeId,
67
+ });
68
+ }
69
+ }
70
+ export function assertRepositoryCompatible(snapshot, identity, workspaceId, allowMissing = false) {
71
+ const actualFingerprint = createRepositoryFingerprint(identity);
72
+ if (snapshot.repositoryFingerprint && snapshot.repositoryFingerprint !== actualFingerprint) {
73
+ throw providerError('WORKTREE_IDENTITY_CHANGED', 'Workspace repository identity changed', {
74
+ workspaceId,
75
+ expectedFingerprint: snapshot.repositoryFingerprint,
76
+ actualFingerprint,
77
+ });
78
+ }
79
+ if (snapshot.repository && !sameRepository(snapshot.repository, identity)) {
80
+ throw providerError('WORKTREE_IDENTITY_CHANGED', 'Workspace repository identity changed', {
81
+ workspaceId,
82
+ expectedCommonDirectory: snapshot.repository.commonDirectory,
83
+ actualCommonDirectory: identity.commonDirectory,
84
+ });
85
+ }
86
+ if (!allowMissing && !identity.commonDirectory) {
87
+ throw providerError('WORKTREE_IDENTITY_CHANGED', 'Unable to resolve Workspace repository identity', { workspaceId });
88
+ }
89
+ }
90
+ //# sourceMappingURL=admission.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admission.js","sourceRoot":"","sources":["../../../../src/provider/transaction/support/admission.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAOlF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,aAA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,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,aAAa,CAAC,yBAAyB,EAAE,4CAA4C,EAAE;YAC3F,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,QAAyB,EACzB,QAA4B,EAC5B,WAAmB,EACnB,YAAY,GAAG,KAAK;IAEpB,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAChE,IAAI,QAAQ,CAAC,qBAAqB,IAAI,QAAQ,CAAC,qBAAqB,KAAK,iBAAiB,EAAE,CAAC;QAC3F,MAAM,aAAa,CAAC,2BAA2B,EAAE,uCAAuC,EAAE;YACxF,WAAW;YACX,mBAAmB,EAAE,QAAQ,CAAC,qBAAqB;YACnD,iBAAiB;SAClB,CAAC,CAAC;IACL,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC1E,MAAM,aAAa,CAAC,2BAA2B,EAAE,uCAAuC,EAAE;YACxF,WAAW;YACX,uBAAuB,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe;YAC5D,qBAAqB,EAAE,QAAQ,CAAC,eAAe;SAChD,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,YAAY,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;QAC/C,MAAM,aAAa,CACjB,2BAA2B,EAC3B,iDAAiD,EACjD,EAAE,WAAW,EAAE,CAChB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { WorktreeRecord } from '../../../contract/index.js';
2
+ import type { GitRepositoryInspection, GitWorktreeInfo, SidecarSnapshot } from '../../types.js';
3
+ import type { CreateWorktreeTransactionInput } from '../types.js';
4
+ import type { TransactionDependencies } from '../dependencies.js';
5
+ export declare function resolveRepository(dependencies: Pick<TransactionDependencies, 'git'>, workspaceRoot: string): Promise<GitRepositoryInspection>;
6
+ export declare function findActiveBranchConflict(dependencies: Pick<TransactionDependencies, 'git'>, snapshot: SidecarSnapshot, branch: string, gitRoot: string, worktreeId?: string): Promise<WorktreeRecord | undefined>;
7
+ export declare function findExactWorktree(worktrees: readonly GitWorktreeInfo[], targetPath: string, branch: string): Promise<GitWorktreeInfo | undefined>;
8
+ export declare function findWorktreeByPhysicalPath(worktrees: readonly GitWorktreeInfo[], targetPath: string): Promise<GitWorktreeInfo | undefined>;
9
+ export declare function findSidecarWorktreeByPhysicalPath(worktrees: readonly WorktreeRecord[], targetPath: string): Promise<WorktreeRecord | undefined>;
10
+ export declare function isExactCreatedWorktree(worktrees: readonly GitWorktreeInfo[], input: CreateWorktreeTransactionInput): Promise<boolean>;
11
+ //# sourceMappingURL=inspection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../../../src/provider/transaction/support/inspection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,wBAAsB,iBAAiB,CACrC,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,KAAK,CAAC,EAClD,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,uBAAuB,CAAC,CASlC;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,KAAK,CAAC,EAClD,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAcrC;AAED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAMtC;AAED,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAKtC;AAED,wBAAsB,iCAAiC,CACrD,SAAS,EAAE,SAAS,cAAc,EAAE,EACpC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAKrC;AAED,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,SAAS,eAAe,EAAE,EACrC,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,OAAO,CAAC,CAGlB"}
@@ -0,0 +1,51 @@
1
+ import path from 'node:path';
2
+ import { canonicalPath, samePhysicalPath } from './paths.js';
3
+ export async function resolveRepository(dependencies, workspaceRoot) {
4
+ if (dependencies.git.resolveRepositoryIdentity)
5
+ return dependencies.git.resolveRepositoryIdentity(workspaceRoot);
6
+ const topLevel = dependencies.git.resolveRepositoryRoot
7
+ ? await dependencies.git.resolveRepositoryRoot(workspaceRoot)
8
+ : workspaceRoot;
9
+ const canonicalTopLevel = await canonicalPath(topLevel);
10
+ const commonDirectory = await canonicalPath(path.join(canonicalTopLevel, '.git'));
11
+ return { identity: { topLevel: canonicalTopLevel, commonDirectory } };
12
+ }
13
+ export async function findActiveBranchConflict(dependencies, snapshot, branch, gitRoot, worktreeId) {
14
+ const candidates = snapshot.worktrees.filter((record) => record.status === 'active' && record.branch === branch && record.worktreeId !== worktreeId);
15
+ if (candidates.length === 0)
16
+ return undefined;
17
+ const live = await dependencies.git.listWorktrees(gitRoot);
18
+ for (const candidate of candidates) {
19
+ const actual = await findWorktreeByPhysicalPath(live, candidate.absolutePath);
20
+ // Only positive evidence of a different live branch releases a stale claim.
21
+ if (!actual || (!actual.detached && (!actual.branch || actual.branch === branch)))
22
+ return candidate;
23
+ }
24
+ return undefined;
25
+ }
26
+ export async function findExactWorktree(worktrees, targetPath, branch) {
27
+ for (const worktree of worktrees) {
28
+ if (worktree.branch === branch && (await samePhysicalPath(worktree.absolutePath, targetPath)))
29
+ return worktree;
30
+ }
31
+ return undefined;
32
+ }
33
+ export async function findWorktreeByPhysicalPath(worktrees, targetPath) {
34
+ for (const worktree of worktrees) {
35
+ if (await samePhysicalPath(worktree.absolutePath, targetPath))
36
+ return worktree;
37
+ }
38
+ return undefined;
39
+ }
40
+ export async function findSidecarWorktreeByPhysicalPath(worktrees, targetPath) {
41
+ for (const worktree of worktrees) {
42
+ if (await samePhysicalPath(worktree.absolutePath, targetPath))
43
+ return worktree;
44
+ }
45
+ return undefined;
46
+ }
47
+ export async function isExactCreatedWorktree(worktrees, input) {
48
+ const exact = await findExactWorktree(worktrees, input.targetPath, input.targetBranch);
49
+ return exact !== undefined && exact.detached !== true;
50
+ }
51
+ //# sourceMappingURL=inspection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspection.js","sourceRoot":"","sources":["../../../../src/provider/transaction/support/inspection.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG7D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,YAAkD,EAClD,aAAqB;IAErB,IAAI,YAAY,CAAC,GAAG,CAAC,yBAAyB;QAC5C,OAAO,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,qBAAqB;QACrD,CAAC,CAAC,MAAM,YAAY,CAAC,G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EAClB,MAAc;IAEd,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,IAAI,CAAC,MAAM,gBAAgB,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;YAC3F,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,SAAqC,EACrC,UAAkB;IAElB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,MAAM,gBAAgB,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;YAAE,OAAO,QAAQ,CAAC;IACjF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,SAAoC,EACpC,UAAkB;IAElB,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,MAAM,gBAAgB,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;YAAE,OAAO,QAAQ,CAAC;IACjF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,SAAqC,EACrC,KAAqC;IAErC,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACvF,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC;AACxD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { WorktreeRecord } from '../../../contract/index.js';
2
+ import type { CleanWorktreePendingOperation, PendingOperation, RecoveryIssue, RepositoryIdentity } from '../../types.js';
3
+ import type { CreateWorktreeTransactionInput, RemoveWorktreeTransactionInput, CleanWorktreeTransactionInput } from '../types.js';
4
+ import { WorktreeProviderError } from '../../types.js';
5
+ export declare function removeRecoveryIssue(issues: readonly RecoveryIssue[] | undefined, operationId: string, worktreeId?: string): readonly RecoveryIssue[];
6
+ export declare function recoveryError(message: string, details?: Record<string, string | number | readonly string[]>): WorktreeProviderError;
7
+ export declare function normalizeGitError(operation: string, workspaceRoot: string, targetPath: string, error: unknown): WorktreeProviderError;
8
+ export declare function recordForCreate(input: CreateWorktreeTransactionInput): WorktreeRecord;
9
+ export declare function pendingCreate(input: CreateWorktreeTransactionInput, repository: RepositoryIdentity): PendingOperation;
10
+ export declare function pendingRemove(input: RemoveWorktreeTransactionInput, record: WorktreeRecord, repository: RepositoryIdentity): PendingOperation;
11
+ export declare function pendingClean(input: CleanWorktreeTransactionInput, record: WorktreeRecord, repository: RepositoryIdentity): CleanWorktreePendingOperation;
12
+ //# sourceMappingURL=journal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.d.ts","sourceRoot":"","sources":["../../../../src/provider/transaction/support/journal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAiB,MAAM,gBAAgB,CAAC;AAEtE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,EAC5C,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,SAAS,aAAa,EAAE,CAM1B;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAM,GAChE,qBAAqB,CAEvB;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,OAAO,GACb,qBAAqB,CAOvB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,8BAA8B,GAAG,cAAc,CAWrF;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,8BAA8B,EACrC,UAAU,EAAE,kBAAkB,GAC7B,gBAAgB,CAalB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,8BAA8B,EACrC,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,kBAAkB,GAC7B,gBAAgB,CAalB;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,6BAA6B,EACpC,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,kBAAkB,GAC7B,6BAA6B,CAa/B"}
@@ -0,0 +1,74 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { createRepositoryFingerprint } from '../../git/repository-fingerprint.js';
3
+ import { WorktreeProviderError, providerError } from '../../types.js';
4
+ export function removeRecoveryIssue(issues, operationId, worktreeId) {
5
+ return (issues ?? []).filter((issue) => issue.operationId !== operationId &&
6
+ (worktreeId === undefined || issue.worktreeId !== worktreeId));
7
+ }
8
+ export function recoveryError(message, details = {}) {
9
+ return providerError('WORKTREE_RECOVERY_REQUIRED', message, details);
10
+ }
11
+ export function normalizeGitError(operation, workspaceRoot, targetPath, error) {
12
+ if (error instanceof WorktreeProviderError)
13
+ return error;
14
+ return providerError('GIT_OPERATION_FAILED', `Git ${operation} failed: ${String(error)}`, {
15
+ operation,
16
+ workspaceRoot,
17
+ targetPath,
18
+ });
19
+ }
20
+ export function recordForCreate(input) {
21
+ return {
22
+ worktreeId: input.worktreeId,
23
+ workspaceId: input.workspaceId,
24
+ absolutePath: input.targetPath,
25
+ branch: input.targetBranch,
26
+ createdAt: new Date().toISOString(),
27
+ baseBranch: input.baseBranch,
28
+ source: 'plugin',
29
+ status: 'active',
30
+ };
31
+ }
32
+ export function pendingCreate(input, repository) {
33
+ return {
34
+ id: randomUUID(),
35
+ type: 'create-worktree',
36
+ phase: 'executing',
37
+ workspaceId: input.workspaceId,
38
+ worktreeId: input.worktreeId,
39
+ targetPath: input.targetPath,
40
+ branch: input.targetBranch,
41
+ ...(input.newBranch !== undefined ? { baseRef: input.baseBranch } : {}),
42
+ repositoryFingerprint: createRepositoryFingerprint(repository),
43
+ startedAt: new Date().toISOString(),
44
+ };
45
+ }
46
+ export function pendingRemove(input, record, repository) {
47
+ return {
48
+ id: randomUUID(),
49
+ type: 'remove-worktree',
50
+ phase: 'executing',
51
+ workspaceId: input.workspaceId,
52
+ worktreeId: input.worktreeId,
53
+ targetPath: record.absolutePath,
54
+ branch: record.branch,
55
+ source: record.source,
56
+ repositoryFingerprint: createRepositoryFingerprint(repository),
57
+ startedAt: new Date().toISOString(),
58
+ };
59
+ }
60
+ export function pendingClean(input, record, repository) {
61
+ return {
62
+ id: randomUUID(),
63
+ type: 'clean-worktree',
64
+ phase: 'executing',
65
+ workspaceId: input.workspaceId,
66
+ worktreeId: input.worktreeId,
67
+ targetPath: record.absolutePath,
68
+ branch: record.branch,
69
+ source: record.source,
70
+ repositoryFingerprint: createRepositoryFingerprint(repository),
71
+ startedAt: new Date().toISOString(),
72
+ };
73
+ }
74
+ //# sourceMappingURL=journal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal.js","sourceRoot":"","sources":["../../../../src/provider/transaction/support/journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAYlF,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEtE,MAAM,UAAU,mBAAmB,CACjC,MAA4C,EAC5C,WAAmB,EACnB,UAAmB;IAEnB,OAAO,CAAC,MAAM,IAAI,E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
@@ -0,0 +1,4 @@
1
+ import type { LockedSidecarStore } from '../../types.js';
2
+ import type { TransactionDependencies } from '../dependencies.js';
3
+ export declare function withShardLock<T>(dependencies: Pick<TransactionDependencies, 'sidecar'>, workspaceId: string, operation: (locked: LockedSidecarStore) => Promise<T>): Promise<T>;
4
+ //# sourceMappingURL=locking.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locking.d.ts","sourceRoot":"","sources":["../../../../src/provider/transaction/support/locking.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,wBAAsB,aAAa,CAAC,CAAC,EACnC,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,EACtD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,GACpD,OAAO,CAAC,CAAC,CAAC,CASZ"}
@@ -0,0 +1,11 @@
1
+ export async function withShardLock(dependencies, workspaceId, operation) {
2
+ if (dependencies.sidecar.runExclusive)
3
+ return dependencies.sidecar.runExclusive(workspaceId, operation);
4
+ // Injected legacy stores remain usable for tests and older compositions, but
5
+ // cannot provide the cross-process shard lock until they implement the seam.
6
+ return operation({
7
+ read: () => dependencies.sidecar.read(workspaceId),
8
+ mutate: (mutation) => dependencies.sidecar.mutate(workspaceId, mutation),
9
+ });
10
+ }
11
+ //# sourceMappingURL=locking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locking.js","sourceRoot":"","sources":["../../../../src/provider/transaction/support/locking.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,YAAsD,EACtD,WAAmB,EACnB,SAAqD;IAErD,IAAI,YAAY,CAAC,OAAO,CAAC,YAAY;QACnC,OAAO,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACnE,6EAA6E;IAC7E,6EAA6E;IAC7E,OAAO,SAAS,CAAC;QACf,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;QAClD,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC;KACzE,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { WorktreeRecord } from '../../../contract/index.js';
2
+ import type { PendingOperation } from '../../types.js';
3
+ import type { CreateWorktreeTransactionInput } from '../types.js';
4
+ import type { TransactionDependencies } from '../dependencies.js';
5
+ export declare function assertGeneratedTarget(dependencies: Pick<TransactionDependencies, 'dshHome'>, input: CreateWorktreeTransactionInput): void;
6
+ export declare function assertSafeRemovalPath(dependencies: Pick<TransactionDependencies, 'dshHome'>, record: WorktreeRecord, workspaceRoot: string): Promise<void>;
7
+ export declare function assertRecoverableCreatePath(dependencies: Pick<TransactionDependencies, 'dshHome'>, pending: Extract<PendingOperation, {
8
+ readonly type: 'create-worktree';
9
+ }>, workspaceRoot: string): Promise<void>;
10
+ export declare function assertNotSymlink(pathname: string, record: WorktreeRecord): Promise<void>;
11
+ //# sourceMappingURL=path-safety.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-safety.d.ts","sourceRoot":"","sources":["../../../../src/provider/transaction/support/path-safety.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAGlE,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,EACtD,KAAK,EAAE,8BAA8B,GACpC,IAAI,CAgBN;AAED,wBAAsB,qBAAqB,CACzC,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,EACtD,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED,wBAAsB,2BAA2B,CAC/C,YAAY,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,EACtD,OAAO,EAAE,OAAO,CAAC,gBAAgB,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,CAAC,EACxE,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9F"}
@@ -0,0 +1,82 @@
1
+ import path from 'node:path';
2
+ import { lstat } from 'node:fs/promises';
3
+ import { isMissing, isInside } from './paths.js';
4
+ import { providerError } from '../../types.js';
5
+ export function assertGeneratedTarget(dependencies, input) {
6
+ const generatedRoot = path.join(dependencies.dshHome, 'clutch-dsh-worktree', 'worktree');
7
+ if (!path.isAbsolute(input.targetPath) ||
8
+ !isInside(generatedRoot, input.targetPath) ||
9
+ isInside(input.workspaceRoot, input.targetPath)) {
10
+ throw providerError('WORKTREE_STATE_CONFLICT', 'Generated Worktree path is outside the managed boundary', {
11
+ workspaceId: input.workspaceId,
12
+ targetPath: input.targetPath,
13
+ });
14
+ }
15
+ }
16
+ export async function assertSafeRemovalPath(dependencies, record, workspaceRoot) {
17
+ const targetPath = path.resolve(record.absolutePath);
18
+ if (record.source === 'plugin') {
19
+ const generatedRoot = path.join(dependencies.dshHome, 'clutch-dsh-worktree', 'worktree');
20
+ if (!isInside(generatedRoot, targetPath) || isInside(workspaceRoot, targetPath)) {
21
+ throw providerError('WORKTREE_IDENTITY_CHANGED', 'Managed Worktree path moved outside its trusted root', {
22
+ worktreeId: record.worktreeId,
23
+ targetPath: record.absolutePath,
24
+ });
25
+ }
26
+ for (const trustedPath of [
27
+ dependencies.dshHome,
28
+ path.join(dependencies.dshHome, 'clutch-dsh-worktree'),
29
+ generatedRoot,
30
+ targetPath,
31
+ ]) {
32
+ await assertNotSymlink(trustedPath, record);
33
+ }
34
+ return;
35
+ }
36
+ // Imported records are canonicalized at registration time. Refusing a
37
+ // symlink here prevents a later path replacement from redirecting Git's
38
+ // destructive command to an unrelated directory.
39
+ await assertNotSymlink(targetPath, record);
40
+ }
41
+ export async function assertRecoverableCreatePath(dependencies, pending, workspaceRoot) {
42
+ const targetPath = path.resolve(pending.targetPath);
43
+ const generatedRoot = path.join(dependencies.dshHome, 'clutch-dsh-worktree', 'worktree');
44
+ if (!isInside(generatedRoot, targetPath) || isInside(workspaceRoot, targetPath)) {
45
+ throw providerError('WORKTREE_IDENTITY_CHANGED', 'Pending Worktree path moved outside its trusted root', {
46
+ worktreeId: pending.worktreeId,
47
+ targetPath: pending.targetPath,
48
+ });
49
+ }
50
+ const record = {
51
+ worktreeId: pending.worktreeId,
52
+ workspaceId: pending.workspaceId,
53
+ absolutePath: pending.targetPath,
54
+ branch: pending.branch,
55
+ source: 'plugin',
56
+ status: 'active',
57
+ };
58
+ for (const trustedPath of [
59
+ dependencies.dshHome,
60
+ path.join(dependencies.dshHome, 'clutch-dsh-worktree'),
61
+ generatedRoot,
62
+ targetPath,
63
+ ]) {
64
+ await assertNotSymlink(trustedPath, record);
65
+ }
66
+ }
67
+ export async function assertNotSymlink(pathname, record) {
68
+ try {
69
+ if ((await lstat(pathname)).isSymbolicLink()) {
70
+ throw providerError('WORKTREE_IDENTITY_CHANGED', `Worktree path is a symlink: ${pathname}`, {
71
+ worktreeId: record.worktreeId,
72
+ targetPath: record.absolutePath,
73
+ });
74
+ }
75
+ }
76
+ catch (error) {
77
+ if (isMissing(error))
78
+ return;
79
+ throw error;
80
+ }
81
+ }
82
+ //# sourceMappingURL=path-safety.js.map