@cerbur/clutch-dsh-worktree 0.1.15 → 0.1.17

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 (367) hide show
  1. package/README.md +243 -22
  2. package/README.zh.md +203 -20
  3. package/assets/screenshots/screenshots-dashboard.png +0 -0
  4. package/assets/screenshots/screenshots-en.png +0 -0
  5. package/assets/screenshots/screenshots-git-reviewer.png +0 -0
  6. package/assets/screenshots/screenshots-import.png +0 -0
  7. package/assets/screenshots/screenshots-worktree-tool.png +0 -0
  8. package/assets/screenshots/screenshots-zh.png +0 -0
  9. package/cordis.patch.yml +6 -19
  10. package/lib/client/WorktreeSurface.d.ts.map +1 -1
  11. package/lib/client/WorktreeSurface.js +35 -11
  12. package/lib/client/WorktreeSurface.js.map +1 -1
  13. package/lib/client/command-activity.d.ts +11 -0
  14. package/lib/client/command-activity.d.ts.map +1 -0
  15. package/lib/client/command-activity.js +71 -0
  16. package/lib/client/command-activity.js.map +1 -0
  17. package/lib/client/dashboard/DashboardRequest.d.ts +11 -0
  18. package/lib/client/dashboard/DashboardRequest.d.ts.map +1 -0
  19. package/lib/client/dashboard/DashboardRequest.js +38 -0
  20. package/lib/client/dashboard/DashboardRequest.js.map +1 -0
  21. package/lib/client/dashboard/WorktreeDashboard.d.ts +2 -1
  22. package/lib/client/dashboard/WorktreeDashboard.d.ts.map +1 -1
  23. package/lib/client/dashboard/WorktreeDashboard.js +89 -59
  24. package/lib/client/dashboard/WorktreeDashboard.js.map +1 -1
  25. package/lib/client/dashboard/WorktreeInstructions.d.ts +2 -1
  26. package/lib/client/dashboard/WorktreeInstructions.d.ts.map +1 -1
  27. package/lib/client/dashboard/WorktreeInstructions.js +27 -8
  28. package/lib/client/dashboard/WorktreeInstructions.js.map +1 -1
  29. package/lib/client/dashboard/dashboard-overlay.d.ts.map +1 -1
  30. package/lib/client/dashboard/dashboard-overlay.js +38 -42
  31. package/lib/client/dashboard/dashboard-overlay.js.map +1 -1
  32. package/lib/client/dashboard/dashboard-selection.d.ts +1 -0
  33. package/lib/client/dashboard/dashboard-selection.d.ts.map +1 -1
  34. package/lib/client/dashboard/dashboard-selection.js.map +1 -1
  35. package/lib/client/dashboard/git/WorktreeGitPanel.d.ts +2 -1
  36. package/lib/client/dashboard/git/WorktreeGitPanel.d.ts.map +1 -1
  37. package/lib/client/dashboard/git/WorktreeGitPanel.js +54 -8
  38. package/lib/client/dashboard/git/WorktreeGitPanel.js.map +1 -1
  39. package/lib/client/dashboard/git/file-address.d.ts +2 -1
  40. package/lib/client/dashboard/git/file-address.d.ts.map +1 -1
  41. package/lib/client/dashboard/git/file-address.js +8 -13
  42. package/lib/client/dashboard/git/file-address.js.map +1 -1
  43. package/lib/client/dashboard/git/useWorktreeGitState.d.ts.map +1 -1
  44. package/lib/client/dashboard/git/useWorktreeGitState.js +4 -1
  45. package/lib/client/dashboard/git/useWorktreeGitState.js.map +1 -1
  46. package/lib/client/dsh-icons.d.ts +2 -0
  47. package/lib/client/dsh-icons.d.ts.map +1 -1
  48. package/lib/client/dsh-icons.js +3 -1
  49. package/lib/client/dsh-icons.js.map +1 -1
  50. package/lib/client/dsh-slot-contract.d.ts +9 -1
  51. package/lib/client/dsh-slot-contract.d.ts.map +1 -1
  52. package/lib/client/entry.d.ts.map +1 -1
  53. package/lib/client/entry.js +57 -1
  54. package/lib/client/entry.js.map +1 -1
  55. package/lib/client/layout/app-frame.d.ts +12 -0
  56. package/lib/client/layout/app-frame.d.ts.map +1 -0
  57. package/lib/client/layout/app-frame.js +82 -0
  58. package/lib/client/layout/app-frame.js.map +1 -0
  59. package/lib/client/locales.d.ts +150 -0
  60. package/lib/client/locales.d.ts.map +1 -1
  61. package/lib/client/locales.js +208 -58
  62. package/lib/client/locales.js.map +1 -1
  63. package/lib/client/overlay/overlay-bounds.d.ts.map +1 -1
  64. package/lib/client/overlay/overlay-bounds.js +8 -3
  65. package/lib/client/overlay/overlay-bounds.js.map +1 -1
  66. package/lib/client/overlay/sidebar-overlay-geometry.d.ts +6 -0
  67. package/lib/client/overlay/sidebar-overlay-geometry.d.ts.map +1 -1
  68. package/lib/client/overlay/sidebar-overlay-geometry.js +180 -32
  69. package/lib/client/overlay/sidebar-overlay-geometry.js.map +1 -1
  70. package/lib/client/restart-notice.d.ts +25 -0
  71. package/lib/client/restart-notice.d.ts.map +1 -0
  72. package/lib/client/restart-notice.js +97 -0
  73. package/lib/client/restart-notice.js.map +1 -0
  74. package/lib/client/session/session-view.d.ts +16 -2
  75. package/lib/client/session/session-view.d.ts.map +1 -1
  76. package/lib/client/session/session-view.js +24 -10
  77. package/lib/client/session/session-view.js.map +1 -1
  78. package/lib/client/session/worktree-session.d.ts +1 -0
  79. package/lib/client/session/worktree-session.d.ts.map +1 -1
  80. package/lib/client/session/worktree-session.js +3 -1
  81. package/lib/client/session/worktree-session.js.map +1 -1
  82. package/lib/client/settings/ToolSettings.d.ts +9 -0
  83. package/lib/client/settings/ToolSettings.d.ts.map +1 -0
  84. package/lib/client/settings/ToolSettings.js +77 -0
  85. package/lib/client/settings/ToolSettings.js.map +1 -0
  86. package/lib/client/settings/WorktreeSettings.d.ts +8 -0
  87. package/lib/client/settings/WorktreeSettings.d.ts.map +1 -0
  88. package/lib/client/settings/WorktreeSettings.js +46 -0
  89. package/lib/client/settings/WorktreeSettings.js.map +1 -0
  90. package/lib/client/settings/WorktreeSettingsNavIcon.d.ts +6 -0
  91. package/lib/client/settings/WorktreeSettingsNavIcon.d.ts.map +1 -0
  92. package/lib/client/settings/WorktreeSettingsNavIcon.js +51 -0
  93. package/lib/client/settings/WorktreeSettingsNavIcon.js.map +1 -0
  94. package/lib/client/settings/diagnostics.d.ts +24 -0
  95. package/lib/client/settings/diagnostics.d.ts.map +1 -0
  96. package/lib/client/settings/diagnostics.js +63 -0
  97. package/lib/client/settings/diagnostics.js.map +1 -0
  98. package/lib/client/settings/settings-navigation.d.ts +7 -0
  99. package/lib/client/settings/settings-navigation.d.ts.map +1 -0
  100. package/lib/client/settings/settings-navigation.js +12 -0
  101. package/lib/client/settings/settings-navigation.js.map +1 -0
  102. package/lib/client/surface/actions/useLifecycleActions.d.ts +2 -1
  103. package/lib/client/surface/actions/useLifecycleActions.d.ts.map +1 -1
  104. package/lib/client/surface/actions/useLifecycleActions.js +14 -5
  105. package/lib/client/surface/actions/useLifecycleActions.js.map +1 -1
  106. package/lib/client/surface/actions/useSessionActions.d.ts.map +1 -1
  107. package/lib/client/surface/actions/useSessionActions.js +6 -6
  108. package/lib/client/surface/actions/useSessionActions.js.map +1 -1
  109. package/lib/client/surface/actions/useWorktreeRegistration.d.ts.map +1 -1
  110. package/lib/client/surface/actions/useWorktreeRegistration.js +4 -2
  111. package/lib/client/surface/actions/useWorktreeRegistration.js.map +1 -1
  112. package/lib/client/surface/components/AnimatedTree.d.ts +32 -0
  113. package/lib/client/surface/components/AnimatedTree.d.ts.map +1 -0
  114. package/lib/client/surface/components/AnimatedTree.js +139 -0
  115. package/lib/client/surface/components/AnimatedTree.js.map +1 -0
  116. package/lib/client/surface/components/NotificationToasts.d.ts +19 -3
  117. package/lib/client/surface/components/NotificationToasts.d.ts.map +1 -1
  118. package/lib/client/surface/components/NotificationToasts.js +73 -7
  119. package/lib/client/surface/components/NotificationToasts.js.map +1 -1
  120. package/lib/client/surface/components/OverlayScrollbar.d.ts +6 -0
  121. package/lib/client/surface/components/OverlayScrollbar.d.ts.map +1 -0
  122. package/lib/client/surface/components/OverlayScrollbar.js +84 -0
  123. package/lib/client/surface/components/OverlayScrollbar.js.map +1 -0
  124. package/lib/client/surface/components/RestartToast.d.ts +6 -0
  125. package/lib/client/surface/components/RestartToast.d.ts.map +1 -0
  126. package/lib/client/surface/components/RestartToast.js +11 -0
  127. package/lib/client/surface/components/RestartToast.js.map +1 -0
  128. package/lib/client/surface/components/SurfaceContent.d.ts.map +1 -1
  129. package/lib/client/surface/components/SurfaceContent.js +110 -39
  130. package/lib/client/surface/components/SurfaceContent.js.map +1 -1
  131. package/lib/client/surface/components/WorkspaceTree.d.ts.map +1 -1
  132. package/lib/client/surface/components/WorkspaceTree.js +7 -2
  133. package/lib/client/surface/components/WorkspaceTree.js.map +1 -1
  134. package/lib/client/surface/components/dialogs.d.ts.map +1 -1
  135. package/lib/client/surface/components/dialogs.js +16 -10
  136. package/lib/client/surface/components/dialogs.js.map +1 -1
  137. package/lib/client/surface/components/rows.d.ts +1 -1
  138. package/lib/client/surface/components/rows.d.ts.map +1 -1
  139. package/lib/client/surface/components/rows.js +24 -101
  140. package/lib/client/surface/components/rows.js.map +1 -1
  141. package/lib/client/surface/notification-queue.d.ts +15 -0
  142. package/lib/client/surface/notification-queue.d.ts.map +1 -1
  143. package/lib/client/surface/notification-queue.js +13 -2
  144. package/lib/client/surface/notification-queue.js.map +1 -1
  145. package/lib/client/surface/state/useSurfaceRefresh.d.ts +1 -1
  146. package/lib/client/surface/state/useSurfaceRefresh.d.ts.map +1 -1
  147. package/lib/client/surface/state/useSurfaceRefresh.js +13 -1
  148. package/lib/client/surface/state/useSurfaceRefresh.js.map +1 -1
  149. package/lib/client/surface/state/useSurfaceSources.d.ts +2 -1
  150. package/lib/client/surface/state/useSurfaceSources.d.ts.map +1 -1
  151. package/lib/client/surface/state/useSurfaceSources.js +7 -5
  152. package/lib/client/surface/state/useSurfaceSources.js.map +1 -1
  153. package/lib/client/surface/state/useTitleMarquee.d.ts +7 -0
  154. package/lib/client/surface/state/useTitleMarquee.d.ts.map +1 -0
  155. package/lib/client/surface/state/useTitleMarquee.js +60 -0
  156. package/lib/client/surface/state/useTitleMarquee.js.map +1 -0
  157. package/lib/client/surface/types.d.ts +8 -1
  158. package/lib/client/surface/types.d.ts.map +1 -1
  159. package/lib/client/view/worktree-error-copy.d.ts.map +1 -1
  160. package/lib/client/view/worktree-error-copy.js +69 -8
  161. package/lib/client/view/worktree-error-copy.js.map +1 -1
  162. package/lib/client/view/worktree-view-errors.d.ts.map +1 -1
  163. package/lib/client/view/worktree-view-errors.js +13 -5
  164. package/lib/client/view/worktree-view-errors.js.map +1 -1
  165. package/lib/client/view/worktree-view-read.d.ts +3 -0
  166. package/lib/client/view/worktree-view-read.d.ts.map +1 -1
  167. package/lib/client/view/worktree-view-read.js +9 -0
  168. package/lib/client/view/worktree-view-read.js.map +1 -1
  169. package/lib/client/worktree-connection.d.ts +14 -2
  170. package/lib/client/worktree-connection.d.ts.map +1 -1
  171. package/lib/client/worktree-connection.js +20 -2
  172. package/lib/client/worktree-connection.js.map +1 -1
  173. package/lib/client/worktree-tool-changes.d.ts +13 -0
  174. package/lib/client/worktree-tool-changes.d.ts.map +1 -0
  175. package/lib/client/worktree-tool-changes.js +64 -0
  176. package/lib/client/worktree-tool-changes.js.map +1 -0
  177. package/lib/client.js +2791 -1131
  178. package/lib/client.js.map +1 -1
  179. package/lib/contract/index.d.ts +12 -2
  180. package/lib/contract/index.d.ts.map +1 -1
  181. package/lib/contract/index.js +10 -0
  182. package/lib/contract/index.js.map +1 -1
  183. package/lib/contract/tool-settings.d.ts +28 -0
  184. package/lib/contract/tool-settings.d.ts.map +1 -0
  185. package/lib/contract/tool-settings.js +10 -0
  186. package/lib/contract/tool-settings.js.map +1 -0
  187. package/lib/contract/worktree-tool-changes.d.ts +10 -0
  188. package/lib/contract/worktree-tool-changes.d.ts.map +1 -0
  189. package/lib/contract/worktree-tool-changes.js +2 -0
  190. package/lib/contract/worktree-tool-changes.js.map +1 -0
  191. package/lib/host/permission-preset-append.d.ts +15 -0
  192. package/lib/host/permission-preset-append.d.ts.map +1 -0
  193. package/lib/host/permission-preset-append.js +63 -0
  194. package/lib/host/permission-preset-append.js.map +1 -0
  195. package/lib/host/service.d.ts +17 -0
  196. package/lib/host/service.d.ts.map +1 -1
  197. package/lib/host/service.js +67 -11
  198. package/lib/host/service.js.map +1 -1
  199. package/lib/host/tool-settings.d.ts +14 -0
  200. package/lib/host/tool-settings.d.ts.map +1 -0
  201. package/lib/host/tool-settings.js +98 -0
  202. package/lib/host/tool-settings.js.map +1 -0
  203. package/lib/host/worktree-permission-manager.d.ts.map +1 -1
  204. package/lib/host/worktree-permission-manager.js +2 -4
  205. package/lib/host/worktree-permission-manager.js.map +1 -1
  206. package/lib/host/worktree-tool-changes.d.ts +12 -0
  207. package/lib/host/worktree-tool-changes.d.ts.map +1 -0
  208. package/lib/host/worktree-tool-changes.js +60 -0
  209. package/lib/host/worktree-tool-changes.js.map +1 -0
  210. package/lib/manage/manager-git-history.d.ts.map +1 -1
  211. package/lib/manage/manager-git-history.js +43 -38
  212. package/lib/manage/manager-git-history.js.map +1 -1
  213. package/lib/manage/manager-sessions.d.ts +5 -0
  214. package/lib/manage/manager-sessions.d.ts.map +1 -1
  215. package/lib/manage/manager-sessions.js +35 -12
  216. package/lib/manage/manager-sessions.js.map +1 -1
  217. package/lib/manage/manager-support.d.ts +10 -2
  218. package/lib/manage/manager-support.d.ts.map +1 -1
  219. package/lib/manage/manager-support.js +90 -14
  220. package/lib/manage/manager-support.js.map +1 -1
  221. package/lib/manage/manager-worktree-lifecycle.d.ts.map +1 -1
  222. package/lib/manage/manager-worktree-lifecycle.js +5 -4
  223. package/lib/manage/manager-worktree-lifecycle.js.map +1 -1
  224. package/lib/manage/manager-worktrees.d.ts +1 -0
  225. package/lib/manage/manager-worktrees.d.ts.map +1 -1
  226. package/lib/manage/manager-worktrees.js +80 -26
  227. package/lib/manage/manager-worktrees.js.map +1 -1
  228. package/lib/manage/manager.d.ts +10 -0
  229. package/lib/manage/manager.d.ts.map +1 -1
  230. package/lib/manage/manager.js +14 -3
  231. package/lib/manage/manager.js.map +1 -1
  232. package/lib/manage/types.d.ts +10 -1
  233. package/lib/manage/types.d.ts.map +1 -1
  234. package/lib/provider/generated-name.d.ts.map +1 -1
  235. package/lib/provider/generated-name.js +5 -4
  236. package/lib/provider/generated-name.js.map +1 -1
  237. package/lib/provider/git/adapter.d.ts.map +1 -1
  238. package/lib/provider/git/adapter.js +5 -2
  239. package/lib/provider/git/adapter.js.map +1 -1
  240. package/lib/provider/mutation-token.d.ts +1 -1
  241. package/lib/provider/mutation-token.d.ts.map +1 -1
  242. package/lib/provider/mutation-token.js +1 -0
  243. package/lib/provider/mutation-token.js.map +1 -1
  244. package/lib/provider/sidecar/repository.d.ts.map +1 -1
  245. package/lib/provider/sidecar/repository.js +1 -0
  246. package/lib/provider/sidecar/repository.js.map +1 -1
  247. package/lib/provider/sidecar/sidecar-schema.d.ts.map +1 -1
  248. package/lib/provider/sidecar/sidecar-schema.js +24 -4
  249. package/lib/provider/sidecar/sidecar-schema.js.map +1 -1
  250. package/lib/provider/transaction/operations/adopt-branch.d.ts.map +1 -1
  251. package/lib/provider/transaction/operations/adopt-branch.js +6 -5
  252. package/lib/provider/transaction/operations/adopt-branch.js.map +1 -1
  253. package/lib/provider/transaction/operations/clean.d.ts.map +1 -1
  254. package/lib/provider/transaction/operations/clean.js +20 -19
  255. package/lib/provider/transaction/operations/clean.js.map +1 -1
  256. package/lib/provider/transaction/operations/create.d.ts +1 -1
  257. package/lib/provider/transaction/operations/create.d.ts.map +1 -1
  258. package/lib/provider/transaction/operations/create.js +23 -13
  259. package/lib/provider/transaction/operations/create.js.map +1 -1
  260. package/lib/provider/transaction/operations/import.d.ts.map +1 -1
  261. package/lib/provider/transaction/operations/import.js +7 -1
  262. package/lib/provider/transaction/operations/import.js.map +1 -1
  263. package/lib/provider/transaction/operations/remove.d.ts.map +1 -1
  264. package/lib/provider/transaction/operations/remove.js +20 -19
  265. package/lib/provider/transaction/operations/remove.js.map +1 -1
  266. package/lib/provider/transaction/recovery/failure-recovery.d.ts.map +1 -1
  267. package/lib/provider/transaction/recovery/failure-recovery.js +19 -18
  268. package/lib/provider/transaction/recovery/failure-recovery.js.map +1 -1
  269. package/lib/provider/transaction/recovery/recover.d.ts.map +1 -1
  270. package/lib/provider/transaction/recovery/recover.js +6 -2
  271. package/lib/provider/transaction/recovery/recover.js.map +1 -1
  272. package/lib/provider/transaction/support/inspection.d.ts.map +1 -1
  273. package/lib/provider/transaction/support/inspection.js +3 -2
  274. package/lib/provider/transaction/support/inspection.js.map +1 -1
  275. package/lib/provider/transaction/support/journal.d.ts.map +1 -1
  276. package/lib/provider/transaction/support/journal.js +8 -5
  277. package/lib/provider/transaction/support/journal.js.map +1 -1
  278. package/lib/provider/transaction/support/path-safety.d.ts.map +1 -1
  279. package/lib/provider/transaction/support/path-safety.js +4 -3
  280. package/lib/provider/transaction/support/path-safety.js.map +1 -1
  281. package/lib/provider/transaction/types.d.ts +2 -1
  282. package/lib/provider/transaction/types.d.ts.map +1 -1
  283. package/lib/provider/types.d.ts +3 -1
  284. package/lib/provider/types.d.ts.map +1 -1
  285. package/lib/provider/types.js +1 -1
  286. package/lib/provider/types.js.map +1 -1
  287. package/lib/provider/worktree-path.d.ts +10 -0
  288. package/lib/provider/worktree-path.d.ts.map +1 -0
  289. package/lib/provider/worktree-path.js +47 -0
  290. package/lib/provider/worktree-path.js.map +1 -0
  291. package/lib/tool/context.d.ts +14 -0
  292. package/lib/tool/context.d.ts.map +1 -0
  293. package/lib/tool/context.js +95 -0
  294. package/lib/tool/context.js.map +1 -0
  295. package/lib/tool/delegation.d.ts +41 -0
  296. package/lib/tool/delegation.d.ts.map +1 -0
  297. package/lib/tool/delegation.js +196 -0
  298. package/lib/tool/delegation.js.map +1 -0
  299. package/lib/tool/errors.d.ts +3 -0
  300. package/lib/tool/errors.d.ts.map +1 -0
  301. package/lib/tool/errors.js +63 -0
  302. package/lib/tool/errors.js.map +1 -0
  303. package/lib/tool/guidance.d.ts +5 -0
  304. package/lib/tool/guidance.d.ts.map +1 -0
  305. package/lib/tool/guidance.js +48 -0
  306. package/lib/tool/guidance.js.map +1 -0
  307. package/lib/tool/history.d.ts +27 -0
  308. package/lib/tool/history.d.ts.map +1 -0
  309. package/lib/tool/history.js +157 -0
  310. package/lib/tool/history.js.map +1 -0
  311. package/lib/tool/index.d.ts +8 -0
  312. package/lib/tool/index.d.ts.map +1 -0
  313. package/lib/tool/index.js +296 -0
  314. package/lib/tool/index.js.map +1 -0
  315. package/lib/tool/inputs.d.ts +12 -0
  316. package/lib/tool/inputs.d.ts.map +1 -0
  317. package/lib/tool/inputs.js +24 -0
  318. package/lib/tool/inputs.js.map +1 -0
  319. package/lib/tool/list-models.d.ts +3 -0
  320. package/lib/tool/list-models.d.ts.map +1 -0
  321. package/lib/tool/list-models.js +38 -0
  322. package/lib/tool/list-models.js.map +1 -0
  323. package/lib/tool/list-sessions.d.ts +3 -0
  324. package/lib/tool/list-sessions.d.ts.map +1 -0
  325. package/lib/tool/list-sessions.js +70 -0
  326. package/lib/tool/list-sessions.js.map +1 -0
  327. package/lib/tool/list-worktrees.d.ts +3 -0
  328. package/lib/tool/list-worktrees.d.ts.map +1 -0
  329. package/lib/tool/list-worktrees.js +39 -0
  330. package/lib/tool/list-worktrees.js.map +1 -0
  331. package/lib/tool/native-session.d.ts +74 -0
  332. package/lib/tool/native-session.d.ts.map +1 -0
  333. package/lib/tool/native-session.js +248 -0
  334. package/lib/tool/native-session.js.map +1 -0
  335. package/lib/tool/new-worktree.d.ts +3 -0
  336. package/lib/tool/new-worktree.d.ts.map +1 -0
  337. package/lib/tool/new-worktree.js +81 -0
  338. package/lib/tool/new-worktree.js.map +1 -0
  339. package/lib/tool/outputs.d.ts +50 -0
  340. package/lib/tool/outputs.d.ts.map +1 -0
  341. package/lib/tool/outputs.js +65 -0
  342. package/lib/tool/outputs.js.map +1 -0
  343. package/lib/tool/report-result.d.ts +3 -0
  344. package/lib/tool/report-result.d.ts.map +1 -0
  345. package/lib/tool/report-result.js +83 -0
  346. package/lib/tool/report-result.js.map +1 -0
  347. package/lib/tool/schema.d.ts +7 -0
  348. package/lib/tool/schema.d.ts.map +1 -0
  349. package/lib/tool/schema.js +92 -0
  350. package/lib/tool/schema.js.map +1 -0
  351. package/lib/tool/send-message.d.ts +3 -0
  352. package/lib/tool/send-message.d.ts.map +1 -0
  353. package/lib/tool/send-message.js +64 -0
  354. package/lib/tool/send-message.js.map +1 -0
  355. package/lib/tool/span-worktree.d.ts +3 -0
  356. package/lib/tool/span-worktree.d.ts.map +1 -0
  357. package/lib/tool/span-worktree.js +114 -0
  358. package/lib/tool/span-worktree.js.map +1 -0
  359. package/lib/tool/types.d.ts +54 -0
  360. package/lib/tool/types.d.ts.map +1 -0
  361. package/lib/tool/types.js +2 -0
  362. package/lib/tool/types.js.map +1 -0
  363. package/lib/typert.host.js +237 -66
  364. package/lib/typert.remote-client.d.ts +7 -1
  365. package/lib/typert.remote-client.d.ts.map +1 -1
  366. package/lib/typert.remote-client.js +237 -66
  367. package/package.json +55 -43
@@ -0,0 +1,92 @@
1
+ import { z } from 'zod';
2
+ const supported = new Set([
3
+ 'type',
4
+ 'oneOf',
5
+ 'properties',
6
+ 'required',
7
+ 'additionalProperties',
8
+ 'items',
9
+ 'enum',
10
+ 'const',
11
+ 'description',
12
+ 'title',
13
+ 'default',
14
+ 'examples',
15
+ ]);
16
+ function node(value) {
17
+ if (!value || typeof value !== 'object' || Array.isArray(value))
18
+ throw new Error('Worktree tool parameters must use object schema nodes');
19
+ return value;
20
+ }
21
+ /** anyOf and oneOf are equivalent only when the alternatives cannot overlap. */
22
+ function disjointObjects(alternatives) {
23
+ return (alternatives.length >= 2 &&
24
+ alternatives.every((value, index) => {
25
+ const left = node(value);
26
+ if (left.type !== 'object' || left.additionalProperties !== false)
27
+ return false;
28
+ const leftProperties = node(left.properties);
29
+ return alternatives.slice(index + 1).every((other) => {
30
+ const right = node(other);
31
+ if (right.type !== 'object' || right.additionalProperties !== false)
32
+ return false;
33
+ const rightProperties = node(right.properties);
34
+ return (Array.isArray(left.required) &&
35
+ Array.isArray(right.required) &&
36
+ left.required.some((key) => typeof key === 'string' && !Object.hasOwn(rightProperties, key)) &&
37
+ right.required.some((key) => typeof key === 'string' && !Object.hasOwn(leftProperties, key)));
38
+ });
39
+ }));
40
+ }
41
+ function project(value) {
42
+ const source = node(value);
43
+ const result = {};
44
+ const limits = [];
45
+ for (const [key, field] of Object.entries(source)) {
46
+ if (key === '$schema')
47
+ continue;
48
+ if (key === 'minLength' || key === 'maxLength') {
49
+ if (source.type !== 'string' || !Number.isInteger(field) || field < 0)
50
+ throw new Error(`Unsupported Worktree tool string constraint: ${key}`);
51
+ limits.push(`${key === 'minLength' ? 'Minimum' : 'Maximum'} length: ${field} characters (checked by the tool).`);
52
+ continue;
53
+ }
54
+ if (key === 'anyOf') {
55
+ if (!Array.isArray(field) || !disjointObjects(field))
56
+ throw new Error('Worktree tool anyOf requires disjoint closed object alternatives');
57
+ result.oneOf = field.map(project);
58
+ continue;
59
+ }
60
+ if (!supported.has(key))
61
+ throw new Error(`Unsupported Worktree tool schema keyword: ${key}`);
62
+ if (key === 'additionalProperties' && typeof field !== 'boolean')
63
+ throw new Error('Worktree tool additionalProperties must be a boolean');
64
+ if (key === 'type' && typeof field !== 'string')
65
+ throw new Error('Worktree tool schema type must be a single type string');
66
+ if (key === 'properties') {
67
+ result.properties = Object.fromEntries(Object.entries(node(field)).map(([name, child]) => [name, project(child)]));
68
+ }
69
+ else if (key === 'oneOf') {
70
+ if (!Array.isArray(field))
71
+ throw new Error('Worktree tool oneOf must be an array');
72
+ result.oneOf = field.map(project);
73
+ }
74
+ else if (key === 'items') {
75
+ result.items = project(field);
76
+ }
77
+ else {
78
+ result[key] = field;
79
+ }
80
+ }
81
+ if (limits.length)
82
+ result.description = [source.description, ...limits].filter(Boolean).join(' ');
83
+ return result;
84
+ }
85
+ /** DSH's native/PTC catalog uses a smaller schema vocabulary than Zod emits.
86
+ * Length constraints remain enforced by the original Zod parser at execution.
87
+ * Unsupported future constructs fail registration instead of hiding fields as unknown.
88
+ */
89
+ export function toolParameters(schema) {
90
+ return project(z.toJSONSchema(schema, { io: 'input' }));
91
+ }
92
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/tool/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,SA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AC;QACtB,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,MAAM;QAAE,MAAM,CAAC,WAAW,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiB;IAC9C,OAAO,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolContext } from './context.js';
2
+ export declare function registerSendMessage(context: ToolContext): void;
3
+ //# sourceMappingURL=send-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-message.d.ts","sourceRoot":"","sources":["../../src/tool/send-message.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA4BhD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAqD9D"}
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { text, prompt } from './inputs.js';
3
+ import * as output from './outputs.js';
4
+ import { authorize, errorText } from './context.js';
5
+ import { delegationHandoff } from './guidance.js';
6
+ import { randomUUID } from 'node:crypto';
7
+ const sendArgs = z
8
+ .object({
9
+ sessionId: text.describe('Exact native Session id returned by clutch_span_worktree or clutch_list_sessions; not a Worktree id or path.'),
10
+ prompt,
11
+ mode: z
12
+ .enum(['queue', 'steer'])
13
+ .default('queue')
14
+ .describe('queue adds the message after the current turn; steer corrects work at the next step boundary. Omit for queue.'),
15
+ requestId: text
16
+ .max(200)
17
+ .optional()
18
+ .describe('Omit for a new message. Reuse a returned id only to retry the identical prompt after uncertain admission.'),
19
+ })
20
+ .strict();
21
+ export function registerSendMessage(context) {
22
+ const { add, options, check, scope } = context;
23
+ add('clutch_send_message', `Continue an existing Session in the calling Workspace. queue (default) runs after the current turn; steer corrects at a native step boundary. Returns admitted or prompt-failed, retaining requestId on failure. Each call gets a fresh requestId; provide the returned requestId only to retry that same message. ${delegationHandoff}`, sendArgs, output.object({
24
+ workspaceId: output.string,
25
+ sessionId: output.string,
26
+ requestId: output.string,
27
+ accepted: { const: true, type: 'boolean' },
28
+ status: { type: 'string', enum: ['admitted', 'prompt-failed'] },
29
+ error: output.string,
30
+ correction: output.string,
31
+ mode: { type: 'string', enum: ['queue', 'steer'] },
32
+ }, ['workspaceId', 'sessionId', 'requestId', 'status', 'mode']), async (args, exec) => {
33
+ const workspaceId = await scope();
34
+ await authorize(args.sessionId, workspaceId, options, true);
35
+ check(exec);
36
+ const requestId = args.requestId ?? `clutch-worktree:${randomUUID()}`;
37
+ const identity = { workspaceId, sessionId: args.sessionId, requestId, mode: args.mode };
38
+ if (!context.prepareMessage)
39
+ throw new Error('Delegation admission control is unavailable');
40
+ await context.prepareMessage(args.sessionId, requestId, args.prompt, args.mode, exec, args.requestId !== undefined);
41
+ check(exec);
42
+ try {
43
+ await options.sessions.prompt({
44
+ sessionId: args.sessionId,
45
+ requestId,
46
+ mode: args.mode,
47
+ content: [{ type: 'text', text: args.prompt }],
48
+ }, exec.signal);
49
+ return { ...identity, status: 'admitted', accepted: true };
50
+ }
51
+ catch (error) {
52
+ // Admission may already have committed. Keep its retry identity
53
+ // so native deduplication, not a new message, resolves uncertainty.
54
+ exec.signal.throwIfAborted();
55
+ return {
56
+ ...identity,
57
+ status: 'prompt-failed',
58
+ error: errorText(error).slice(0, 700),
59
+ correction: 'Admission may have succeeded. Retry the identical prompt using this sessionId and returned requestId; do not create another Session or use a fresh id.',
60
+ };
61
+ }
62
+ });
63
+ }
64
+ //# sourceMappingURL=send-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-message.js","sourceRoot":"","sources":["../../src/tool/send-message.ts"],"names":[],"mappings":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I,CAAC,MAAM,CACZ,CAAC;YACF,OAAO,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gEAAgE;YAChE,oEAAoE;YACpE,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC7B,OAAO;gBACL,GAAG,QAAQ;gBACX,MAAM,EAAE,eAAe;gBACvB,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;gBACrC,UAAU,EACR,wJAAwJ;aAC3J,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ToolContext } from './context.js';
2
+ export declare function registerSpanWorktree(context: ToolContext): void;
3
+ //# sourceMappingURL=span-worktree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span-worktree.d.ts","sourceRoot":"","sources":["../../src/tool/span-worktree.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA+BhD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAwG/D"}
@@ -0,0 +1,114 @@
1
+ import { z } from 'zod';
2
+ import { text, prompt, model } from './inputs.js';
3
+ import * as output from './outputs.js';
4
+ import { available, errorText } from './context.js';
5
+ import { delegationHandoff, delegationModel } from './guidance.js';
6
+ import { randomUUID } from 'node:crypto';
7
+ const common = {
8
+ prompt,
9
+ model: model.optional(),
10
+ title: text.max(200).optional().describe('Optional new Session title; max 200 characters.'),
11
+ };
12
+ const spanArgs = z.union([
13
+ z
14
+ .object({
15
+ ...common,
16
+ worktreeId: text.describe('Stable id returned by clutch_new_worktree or clutch_list_worktrees. Preferred target; do not also supply name.'),
17
+ })
18
+ .strict(),
19
+ z
20
+ .object({
21
+ ...common,
22
+ name: text.describe('Legacy alternative: exact branch name from clutch_list_worktrees. Do not also supply worktreeId.'),
23
+ })
24
+ .strict(),
25
+ ]);
26
+ export function registerSpanWorktree(context) {
27
+ const { add, agent, options, check, scope } = context;
28
+ add('clutch_span_worktree', `Delegate implementation and verification to a fresh ordinary DSH Session in a healthy managed Worktree. Use after clutch_new_worktree for requests to create a feature Worktree and implement/fix something; pass a self-contained prompt including requirements, acceptance criteria and checks. Prefer worktreeId; legacy exact branch name is accepted, but provide only one. ${delegationModel} Automatically enables only result reporting by default; other capabilities require /cluworktree or explicit Worktree automatic-injection preferences. Returns admission, not completion. ${delegationHandoff} Partial failures preserve the Session; repair it before retrying.`, spanArgs, output.object({
29
+ workspaceId: output.string,
30
+ worktreeId: output.string,
31
+ sessionId: output.string,
32
+ status: {
33
+ type: 'string',
34
+ enum: [
35
+ 'dispatched',
36
+ 'binding-failed',
37
+ 'model-failed',
38
+ 'title-failed',
39
+ 'prompt-failed',
40
+ 'reporting-failed',
41
+ ],
42
+ },
43
+ model: output.model,
44
+ requestId: output.string,
45
+ error: output.string,
46
+ correction: output.string,
47
+ }, ['workspaceId', 'worktreeId', 'sessionId', 'status', 'model', 'requestId']), async (args, exec) => {
48
+ context.delegation.assertDispatch(agent);
49
+ const workspaceId = await scope();
50
+ const worktreeId = 'worktreeId' in args ? args.worktreeId : undefined;
51
+ const name = 'name' in args ? args.name : undefined;
52
+ const matches = (await options.manager.listWorktrees({ workspaceId })).filter((record) => record.status === 'active' &&
53
+ (worktreeId === undefined ? record.branch === name : record.worktreeId === worktreeId));
54
+ if (matches.length !== 1 || !available(matches[0]))
55
+ throw new Error('Worktree must identify exactly one active, healthy managed Worktree');
56
+ const record = matches[0];
57
+ const selected = await options.sessions.validateModel(args.model ?? (await options.sessions.currentModel(agent.session.id, exec.signal)), exec.signal);
58
+ check(exec);
59
+ context.delegation.assertDispatch(agent);
60
+ const { sessionId } = await options.sessions.create({ cwd: record.absolutePath });
61
+ let status = 'binding-failed';
62
+ let error;
63
+ const requestId = `clutch-worktree:${sessionId}:${randomUUID()}`;
64
+ try {
65
+ check(exec);
66
+ await options.manager.bindSession({
67
+ workspaceId,
68
+ worktreeId: record.worktreeId,
69
+ sessionId,
70
+ });
71
+ status = 'model-failed';
72
+ check(exec);
73
+ await options.sessions.configureModel(sessionId, selected, exec.signal);
74
+ if (args.title) {
75
+ status = 'title-failed';
76
+ check(exec);
77
+ await options.sessions.rename({ sessionId, title: args.title });
78
+ }
79
+ status = 'reporting-failed';
80
+ if (!context.enableChild)
81
+ throw new Error('Delegated Session reporting setup is unavailable');
82
+ await context.enableChild(sessionId, requestId, args.prompt, 'queue', exec);
83
+ status = 'prompt-failed';
84
+ check(exec);
85
+ await options.sessions.prompt({
86
+ sessionId,
87
+ requestId,
88
+ mode: 'queue',
89
+ content: [{ type: 'text', text: args.prompt }],
90
+ }, exec.signal);
91
+ status = 'dispatched';
92
+ }
93
+ catch (cause) {
94
+ exec.signal.throwIfAborted();
95
+ error = errorText(cause).slice(0, 700);
96
+ }
97
+ options.changed(workspaceId, record.worktreeId);
98
+ return {
99
+ workspaceId,
100
+ worktreeId: record.worktreeId,
101
+ sessionId,
102
+ status,
103
+ model: selected,
104
+ requestId,
105
+ ...(error === undefined
106
+ ? {}
107
+ : {
108
+ error,
109
+ correction: `Session ${sessionId} already exists; ${status}. Repair that stage before continuing. Do not dispatch again. For prompt-failed, retry the identical prompt with clutch_send_message using this sessionId and requestId.`,
110
+ }),
111
+ };
112
+ });
113
+ }
114
+ //# sourceMappingURL=span-worktree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span-worktree.js","sourceRoot":"","sources":["../../src/tool/span-worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,E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IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5E,MAAM,GAAG,eAAe,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,CAAC;YACZ,MAAM,OAAO,CAAC,QAAQ,CAAC,MAAM,CAC3B;gBACE,SAAS;gBACT,SAAS;gBACT,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;aAC/C,EACD,IAAI,CAAC,MAAM,CACZ,CAAC;YACF,MAAM,GAAG,YAAY,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC7B,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;QAChD,OAAO;YACL,WAAW;YACX,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,SAAS;YACT,MAAM;YACN,KAAK,EAAE,QAAQ;YACf,SAAS;YACT,GAAG,CAAC,KAAK,KAAK,SAAS;gBACrB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE,KAAK;oBACL,UAAU,EAAE,WAAW,SAAS,oBAAoB,MAAM,0KAA0K;iBACrO,CAAC;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { z } from 'zod';
3
+ import type { WorktreeToolSessionPort } from './native-session.js';
4
+ import type { WorktreeManagerService } from '../manage/index.js';
5
+ import type { DshReadAdapter } from '../provider/types.js';
6
+ import type { WorktreeToolSelection, WorktreeToolSettingsScope } from '../contract/tool-settings.js';
7
+ import type { DelegationControl } from './delegation.js';
8
+ export type { WorktreeRecord } from '../contract/index.js';
9
+ export interface CallingAgent {
10
+ readonly session: {
11
+ readonly id: string;
12
+ };
13
+ readonly ctx: Context;
14
+ }
15
+ export interface Execution {
16
+ agent?: CallingAgent;
17
+ signal: AbortSignal;
18
+ }
19
+ export interface Options {
20
+ settings?: {
21
+ read(scope: WorktreeToolSettingsScope): Promise<WorktreeToolSelection>;
22
+ subscribe(listener: (scope: WorktreeToolSettingsScope, selection: WorktreeToolSelection) => void): () => void;
23
+ };
24
+ manager: Pick<WorktreeManagerService, 'listWorktrees' | 'listBindings' | 'listBranches' | 'createWorktree' | 'createWorktreeAtCommit' | 'resolveRuntimeCwd' | 'readSessionHead' | 'bindSession' | 'updateWorktreeInstructions'>;
25
+ dsh: Pick<DshReadAdapter, 'getSession' | 'getWorkspace' | 'listSessions' | 'listWorkspaces'>;
26
+ sessions: WorktreeToolSessionPort;
27
+ samePhysicalPath(left: string, right: string): Promise<boolean>;
28
+ changed(workspaceId: string, worktreeId: string): void;
29
+ isDisposed(): boolean;
30
+ }
31
+ export interface ToolDefinition {
32
+ name: string;
33
+ description: string;
34
+ parameters: unknown;
35
+ output: {
36
+ schema: unknown;
37
+ render(args: unknown, value: unknown): {
38
+ type: 'text';
39
+ text: string;
40
+ }[];
41
+ };
42
+ execute(args: unknown, exec: Execution): Promise<unknown>;
43
+ }
44
+ export interface ToolContext {
45
+ agent: CallingAgent;
46
+ options: Options;
47
+ delegation: DelegationControl;
48
+ enableChild?: (sessionId: string, requestId: string, prompt: string, mode: string, exec: Execution) => Promise<void>;
49
+ prepareMessage?: (sessionId: string, requestId: string, prompt: string, mode: string, exec: Execution, retry: boolean) => Promise<void>;
50
+ check(exec: Execution): void;
51
+ scope(requested?: string): Promise<string>;
52
+ add<Schema extends z.ZodType>(name: string, description: string, schema: Schema, outputSchema: unknown, execute: (args: z.output<Schema>, exec: Execution) => Promise<unknown>): () => void;
53
+ }
54
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1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