arco-workbench 0.1.3 → 0.1.4

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 (296) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +5 -1
  3. package/client/dist/assets/{PhosphorBackdrop-CkVIGkeX.js → PhosphorBackdrop-CNumba2X.js} +1 -1
  4. package/client/dist/assets/{ThemedBackgroundShaderImpl-DHF7CnpE.js → ThemedBackgroundShaderImpl-DX5KyCt3.js} +1 -1
  5. package/client/dist/assets/{XtermView-SY0UcZUS.js → XtermView-DhS5g8Rt.js} +1 -1
  6. package/client/dist/assets/{galleryEditor-Ca4F8HiM.js → galleryEditor-fPb76Cjv.js} +1 -1
  7. package/client/dist/assets/index-CjkHb-_n.js +592 -0
  8. package/client/dist/assets/index-DIbh3ae5.css +1 -0
  9. package/client/dist/index.html +2 -2
  10. package/client/src/App.tsx +2 -0
  11. package/client/src/alerts/desktopAlerts.ts +13 -1
  12. package/client/src/brief/briefFacts.ts +22 -0
  13. package/client/src/brief/briefFromStore.ts +7 -2
  14. package/client/src/components/ArtifactMoveDialog.tsx +64 -0
  15. package/client/src/components/BriefControl.tsx +38 -47
  16. package/client/src/components/CatchMeUp.tsx +25 -25
  17. package/client/src/components/CheckpointActions.tsx +7 -4
  18. package/client/src/components/ClusterComposerButtons.tsx +6 -3
  19. package/client/src/components/ClusterPlanTab.tsx +15 -1
  20. package/client/src/components/ClusterRightPanel/AutoPickupControl.tsx +6 -2
  21. package/client/src/components/ClusterTab.tsx +33 -3
  22. package/client/src/components/ClusterTaskBoardTab.tsx +62 -8
  23. package/client/src/components/DialogShell.tsx +115 -0
  24. package/client/src/components/DocsUpdateDialog.tsx +16 -42
  25. package/client/src/components/ForwardMessages.tsx +28 -32
  26. package/client/src/components/GitDialog.tsx +52 -52
  27. package/client/src/components/GitOtherWork.tsx +4 -2
  28. package/client/src/components/HandoffDialog.tsx +19 -45
  29. package/client/src/components/Home/HomeView.tsx +36 -8
  30. package/client/src/components/Home/home.css +7 -0
  31. package/client/src/components/KeepButton.tsx +23 -0
  32. package/client/src/components/MdTuneupDialog.tsx +52 -51
  33. package/client/src/components/MemberCard.tsx +4 -1
  34. package/client/src/components/MemberPane.tsx +1 -1
  35. package/client/src/components/NotificationCenter.tsx +4 -3
  36. package/client/src/components/NotificationChannelsSettings.tsx +25 -7
  37. package/client/src/components/PlanCandidateBanner.tsx +111 -57
  38. package/client/src/components/PlanComposerDialog.tsx +55 -87
  39. package/client/src/components/ProjectStateNotice.tsx +60 -0
  40. package/client/src/components/PublicProjectBox.tsx +25 -0
  41. package/client/src/components/ResearchDialog.tsx +15 -24
  42. package/client/src/components/ReviewDialog.tsx +32 -57
  43. package/client/src/components/RightPanel/OutputsPanel.tsx +4 -0
  44. package/client/src/components/RightPanel/PlanTab.tsx +24 -2
  45. package/client/src/components/RightPanel/UsageTab.tsx +77 -1
  46. package/client/src/components/SkillEditorDialog.tsx +38 -73
  47. package/client/src/components/SpawnDialog.tsx +19 -41
  48. package/client/src/components/StorageWarnings.tsx +21 -0
  49. package/client/src/components/SystemHeader.tsx +2 -2
  50. package/client/src/components/TerminalInput.tsx +6 -2
  51. package/client/src/components/TidyComposer.tsx +24 -41
  52. package/client/src/components/TranscriptSendDialog.tsx +151 -202
  53. package/client/src/components/UtilityAgentPicker.tsx +4 -2
  54. package/client/src/components/WorkflowCreator/index.tsx +2 -0
  55. package/client/src/components/WorkflowView.tsx +4 -1
  56. package/client/src/components/clusterNeedsYou.ts +35 -3
  57. package/client/src/components/compare/CompareDialog.tsx +26 -2
  58. package/client/src/components/terminalInput/planDraft.ts +33 -4
  59. package/client/src/components/utilityResult.ts +5 -1
  60. package/client/src/explorer/ExplorerApp.tsx +5 -2
  61. package/client/src/explorer/PlansLens.tsx +60 -19
  62. package/client/src/explorer/StorageLens.tsx +275 -0
  63. package/client/src/explorer/launch.ts +3 -3
  64. package/client/src/explorer/plansGrouping.ts +15 -0
  65. package/client/src/help/content/cluster.tsx +42 -7
  66. package/client/src/help/content/composer.tsx +26 -6
  67. package/client/src/help/content/header.tsx +16 -14
  68. package/client/src/help/content/misc.tsx +141 -6
  69. package/client/src/help/content/rightPanel.tsx +16 -0
  70. package/client/src/help/content/settings.tsx +4 -4
  71. package/client/src/help/manualSections/actions.tsx +19 -4
  72. package/client/src/help/manualSections/clusters.tsx +29 -16
  73. package/client/src/help/manualSections/configuration.tsx +6 -4
  74. package/client/src/help/manualSections/maintenance.tsx +27 -5
  75. package/client/src/help/manualSections/plans.tsx +96 -2
  76. package/client/src/help/manualSections/powerFeatures.tsx +2 -2
  77. package/client/src/help/manualSections/reference.tsx +6 -0
  78. package/client/src/help/manualSections/workspace.tsx +9 -5
  79. package/client/src/stores/appStore.ts +10 -1
  80. package/client/src/stores/appStore.types.ts +2 -0
  81. package/client/src/stores/mdTuneupStore.ts +5 -4
  82. package/client/src/stores/memoryTrim.ts +18 -2
  83. package/client/src/stores/storageWarningStore.ts +18 -0
  84. package/client/src/utils/gitDialogMemory.ts +26 -0
  85. package/client/src/utils/historyEvents.ts +1 -0
  86. package/client/src/utils/homeModel.ts +19 -0
  87. package/client/src/utils/publicProject.ts +56 -0
  88. package/client/src/ws/handleServerMessage.ts +7 -2
  89. package/docs/ARCHITECTURE.md +1 -1
  90. package/docs/CHECKPOINTS.md +2 -0
  91. package/docs/CLIENT.md +29 -11
  92. package/docs/FEATURES.md +14 -11
  93. package/docs/GETTING_STARTED.md +7 -7
  94. package/docs/GLOSSARY.md +3 -3
  95. package/docs/GOTCHAS.md +3 -2
  96. package/docs/HTTP_API.md +31 -1
  97. package/docs/NOTIFICATIONS.md +13 -14
  98. package/docs/OPERATIONS.md +27 -1
  99. package/docs/OPERATOR_ACTIONS.md +1 -1
  100. package/docs/OUTPUTS.md +9 -0
  101. package/docs/PERSISTENCE.md +34 -4
  102. package/docs/PLAN_OR_BOARD.md +7 -0
  103. package/docs/PRIMITIVES.md +3 -3
  104. package/docs/PROTOCOL.md +14 -4
  105. package/docs/PROTOCOL_CLUSTER.md +3 -2
  106. package/docs/SERVICE_MODE.md +5 -1
  107. package/docs/SETTINGS.md +8 -6
  108. package/docs/STORAGE_PLAN.md +324 -0
  109. package/docs/TASK_LEDGER.md +5 -4
  110. package/native/linux-arm64/manifest.json +1 -1
  111. package/node_modules/@arco/shared/dist/index.d.ts +2 -0
  112. package/node_modules/@arco/shared/dist/index.js +2 -0
  113. package/node_modules/@arco/shared/dist/protocol/autoPickup.d.ts +1 -1
  114. package/node_modules/@arco/shared/dist/protocol/autoPickup.js +1 -1
  115. package/node_modules/@arco/shared/dist/protocol/checkpoints.d.ts +1 -0
  116. package/node_modules/@arco/shared/dist/protocol/clusters.d.ts +2 -1
  117. package/node_modules/@arco/shared/dist/protocol/index.d.ts +1 -0
  118. package/node_modules/@arco/shared/dist/protocol/index.js +1 -0
  119. package/node_modules/@arco/shared/dist/protocol/mdTuneup.d.ts +6 -0
  120. package/node_modules/@arco/shared/dist/protocol/notifications.d.ts +2 -1
  121. package/node_modules/@arco/shared/dist/protocol/notifications.js +3 -2
  122. package/node_modules/@arco/shared/dist/protocol/plans.d.ts +2 -0
  123. package/node_modules/@arco/shared/dist/protocol/serverMessages.d.ts +2 -1
  124. package/node_modules/@arco/shared/dist/protocol/storage.d.ts +21 -0
  125. package/node_modules/@arco/shared/dist/protocol/storage.js +3 -0
  126. package/node_modules/@arco/shared/dist/protocol/tasks.d.ts +3 -0
  127. package/node_modules/@arco/shared/dist/protocol/utilityAgent.d.ts +2 -2
  128. package/node_modules/@arco/shared/dist/protocol/utilityAgent.js +2 -2
  129. package/node_modules/@arco/shared/dist/publicGuardrails.d.ts +7 -0
  130. package/node_modules/@arco/shared/dist/publicGuardrails.js +47 -0
  131. package/node_modules/@arco/shared/dist/publicSafetyRules.d.ts +1 -0
  132. package/node_modules/@arco/shared/dist/publicSafetyRules.js +6 -0
  133. package/node_modules/@arco/shared/package.json +1 -1
  134. package/package.json +3 -2
  135. package/scripts/packaging/arco.mjs +17 -1
  136. package/scripts/packaging/services.mjs +35 -5
  137. package/scripts/packaging/storage.mjs +125 -0
  138. package/scripts/packaging/update.mjs +3 -3
  139. package/server/dist/artifactCopy.d.ts +26 -0
  140. package/server/dist/artifactCopy.js +398 -0
  141. package/server/dist/atomicFile.d.ts +1 -0
  142. package/server/dist/atomicFile.js +1 -1
  143. package/server/dist/attention.d.ts +1 -1
  144. package/server/dist/attention.js +10 -13
  145. package/server/dist/catchUp.d.ts +2 -0
  146. package/server/dist/catchUp.js +46 -23
  147. package/server/dist/clusterPeerOps.d.ts +2 -0
  148. package/server/dist/clusterPeerOps.js +2 -0
  149. package/server/dist/clusterSnapshots.js +22 -12
  150. package/server/dist/eventLog.d.ts +55 -0
  151. package/server/dist/eventLog.js +792 -0
  152. package/server/dist/explorerLaunch.d.ts +4 -1
  153. package/server/dist/explorerLaunch.js +3 -2
  154. package/server/dist/explorerPlans.d.ts +4 -0
  155. package/server/dist/explorerPlans.js +27 -2
  156. package/server/dist/http/clusterRoutes.js +2 -0
  157. package/server/dist/http/explorerRoutes.js +2 -1
  158. package/server/dist/http/publicProjectRoutes.d.ts +2 -0
  159. package/server/dist/http/publicProjectRoutes.js +68 -0
  160. package/server/dist/http/router.js +6 -0
  161. package/server/dist/http/storageRoutes.d.ts +2 -0
  162. package/server/dist/http/storageRoutes.js +254 -0
  163. package/server/dist/http/usageStatsRoutes.js +3 -12
  164. package/server/dist/index.js +4 -0
  165. package/server/dist/keepStore.d.ts +16 -0
  166. package/server/dist/keepStore.js +119 -0
  167. package/server/dist/management/clusterActivity.js +6 -20
  168. package/server/dist/management/initHubLink.js +10 -43
  169. package/server/dist/mcp/clusterMcpTools.js +8 -1
  170. package/server/dist/notifications.d.ts +3 -1
  171. package/server/dist/notifications.js +5 -4
  172. package/server/dist/outputStore.d.ts +1 -0
  173. package/server/dist/outputStore.js +1 -1
  174. package/server/dist/outputs.js +39 -8
  175. package/server/dist/planHistory.d.ts +3 -0
  176. package/server/dist/planHistory.js +60 -0
  177. package/server/dist/primitives/runMdTuneup.d.ts +5 -1
  178. package/server/dist/primitives/runMdTuneup.js +43 -2
  179. package/server/dist/project/taskLedger.d.ts +4 -0
  180. package/server/dist/project/taskLedger.js +19 -0
  181. package/server/dist/providers/claude-native/peerTools.js +4 -0
  182. package/server/dist/providers/claude-native/resumeSummary.js +30 -19
  183. package/server/dist/providers/index.js +8 -13
  184. package/server/dist/providers/localProviderQueue.d.ts +2 -0
  185. package/server/dist/providers/localProviderQueue.js +11 -0
  186. package/server/dist/publicProject.d.ts +54 -0
  187. package/server/dist/publicProject.js +135 -0
  188. package/server/dist/recall/index.js +22 -23
  189. package/server/dist/server/broadcast.d.ts +2 -1
  190. package/server/dist/server/broadcast.js +56 -1
  191. package/server/dist/smartPickupAdapters.d.ts +7 -0
  192. package/server/dist/smartPickupAdapters.js +172 -8
  193. package/server/dist/storageActions.d.ts +50 -0
  194. package/server/dist/storageActions.js +326 -0
  195. package/server/dist/storageArchive.d.ts +24 -0
  196. package/server/dist/storageArchive.js +358 -0
  197. package/server/dist/storageOverview.d.ts +47 -0
  198. package/server/dist/storageOverview.js +197 -0
  199. package/server/dist/storageReport.d.ts +48 -0
  200. package/server/dist/storageReport.js +185 -0
  201. package/server/dist/storageWarnings.d.ts +4 -0
  202. package/server/dist/storageWarnings.js +96 -0
  203. package/server/dist/workers/limits.js +4 -1
  204. package/server/dist/workflowStore.d.ts +2 -0
  205. package/server/dist/workflowStore.js +88 -72
  206. package/server/dist/workflows/purgeWorkflow.d.ts +1 -0
  207. package/server/dist/workflows/purgeWorkflow.js +15 -2
  208. package/server/dist/workflows/sessionDiscovery.js +5 -17
  209. package/server/dist/workflows/sessionIndex.js +22 -17
  210. package/server/dist/ws/taskLedgerHandlers.js +8 -3
  211. package/server/dist/ws/workflowHandlers.js +5 -4
  212. package/server/package.json +1 -1
  213. package/server/src/artifactCopy.ts +254 -0
  214. package/server/src/atomicFile.ts +1 -1
  215. package/server/src/attention.ts +9 -10
  216. package/server/src/catchUp.ts +37 -15
  217. package/server/src/clusterPeerOps.ts +5 -0
  218. package/server/src/clusterSnapshots.ts +20 -13
  219. package/server/src/eventLog.ts +571 -0
  220. package/server/src/explorerLaunch.ts +3 -2
  221. package/server/src/explorerPlans.ts +22 -2
  222. package/server/src/http/clusterRoutes.ts +4 -1
  223. package/server/src/http/explorerRoutes.ts +2 -1
  224. package/server/src/http/publicProjectRoutes.ts +54 -0
  225. package/server/src/http/router.ts +4 -0
  226. package/server/src/http/storageRoutes.ts +187 -0
  227. package/server/src/http/usageStatsRoutes.ts +3 -11
  228. package/server/src/index.ts +4 -0
  229. package/server/src/keepStore.ts +102 -0
  230. package/server/src/management/clusterActivity.ts +6 -16
  231. package/server/src/management/initHubLink.ts +10 -39
  232. package/server/src/mcp/clusterMcpTools.ts +8 -2
  233. package/server/src/notifications.ts +4 -3
  234. package/server/src/outputStore.ts +5 -2
  235. package/server/src/outputs.ts +30 -6
  236. package/server/src/planHistory.ts +48 -0
  237. package/server/src/primitives/runMdTuneup.ts +32 -2
  238. package/server/src/project/taskLedger.ts +20 -0
  239. package/server/src/providers/claude-native/peerTools.ts +4 -0
  240. package/server/src/providers/claude-native/resumeSummary.ts +32 -18
  241. package/server/src/providers/index.ts +2 -16
  242. package/server/src/providers/localProviderQueue.ts +13 -0
  243. package/server/src/publicProject.ts +142 -0
  244. package/server/src/recall/index.ts +4 -9
  245. package/server/src/server/broadcast.ts +53 -1
  246. package/server/src/smartPickupAdapters.ts +128 -5
  247. package/server/src/storageActions.ts +216 -0
  248. package/server/src/storageArchive.ts +277 -0
  249. package/server/src/storageOverview.ts +184 -0
  250. package/server/src/storageReport.ts +210 -0
  251. package/server/src/storageWarnings.ts +84 -0
  252. package/server/src/workers/limits.ts +4 -1
  253. package/server/src/workflowStore.ts +78 -61
  254. package/server/src/workflows/purgeWorkflow.ts +12 -3
  255. package/server/src/workflows/sessionDiscovery.ts +5 -13
  256. package/server/src/workflows/sessionIndex.ts +5 -9
  257. package/server/src/ws/taskLedgerHandlers.ts +8 -3
  258. package/server/src/ws/workflowHandlers.ts +5 -4
  259. package/shared/dist/index.d.ts +2 -0
  260. package/shared/dist/index.js +2 -0
  261. package/shared/dist/protocol/autoPickup.d.ts +1 -1
  262. package/shared/dist/protocol/autoPickup.js +1 -1
  263. package/shared/dist/protocol/checkpoints.d.ts +1 -0
  264. package/shared/dist/protocol/clusters.d.ts +2 -1
  265. package/shared/dist/protocol/index.d.ts +1 -0
  266. package/shared/dist/protocol/index.js +1 -0
  267. package/shared/dist/protocol/mdTuneup.d.ts +6 -0
  268. package/shared/dist/protocol/notifications.d.ts +2 -1
  269. package/shared/dist/protocol/notifications.js +3 -2
  270. package/shared/dist/protocol/plans.d.ts +2 -0
  271. package/shared/dist/protocol/serverMessages.d.ts +2 -1
  272. package/shared/dist/protocol/storage.d.ts +21 -0
  273. package/shared/dist/protocol/storage.js +3 -0
  274. package/shared/dist/protocol/tasks.d.ts +3 -0
  275. package/shared/dist/protocol/utilityAgent.d.ts +2 -2
  276. package/shared/dist/protocol/utilityAgent.js +2 -2
  277. package/shared/dist/publicGuardrails.d.ts +7 -0
  278. package/shared/dist/publicGuardrails.js +47 -0
  279. package/shared/dist/publicSafetyRules.d.ts +1 -0
  280. package/shared/dist/publicSafetyRules.js +6 -0
  281. package/shared/src/index.ts +3 -0
  282. package/shared/src/protocol/autoPickup.ts +1 -1
  283. package/shared/src/protocol/checkpoints.ts +4 -0
  284. package/shared/src/protocol/clusters.ts +6 -1
  285. package/shared/src/protocol/index.ts +1 -0
  286. package/shared/src/protocol/mdTuneup.ts +5 -0
  287. package/shared/src/protocol/notifications.ts +6 -2
  288. package/shared/src/protocol/plans.ts +2 -0
  289. package/shared/src/protocol/serverMessages.ts +2 -0
  290. package/shared/src/protocol/storage.ts +35 -0
  291. package/shared/src/protocol/tasks.ts +6 -0
  292. package/shared/src/protocol/utilityAgent.ts +2 -2
  293. package/shared/src/publicGuardrails.ts +50 -0
  294. package/shared/src/publicSafetyRules.ts +5 -0
  295. package/client/dist/assets/index-CcNtMA2y.js +0 -546
  296. package/client/dist/assets/index-Dl8tYsSp.css +0 -1
@@ -0,0 +1,115 @@
1
+ import { useEffect, useRef, type CSSProperties, type ReactNode } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+
4
+ // One layout for operator dialogs opened from the composer and the top bar:
5
+ // rendered into document.body (so no ancestor transform, filter or stacking
6
+ // context can clip or cover it), an opaque dialog surface, a header with the
7
+ // title and a close button, a scrolling body, and actions at the bottom right.
8
+ // The header and footer never scroll away, so the result line and the actions
9
+ // stay visible at small window heights.
10
+
11
+ export const dialogTitleStyle: CSSProperties = {
12
+ fontSize: '12px', letterSpacing: '3px', color: 'var(--color-accent-primary)', margin: 0, fontWeight: 'normal',
13
+ };
14
+ export const dialogBodyStyle: CSSProperties = { fontSize: '12px', lineHeight: 1.5 };
15
+
16
+ // Portals composer dialogs out of the composer. Static server rendering (unit
17
+ // tests) has no document, so children render in place there.
18
+ export function DialogPortal({ children }: { children: ReactNode }) {
19
+ if (typeof document === 'undefined') return <>{children}</>;
20
+ return createPortal(children, document.body);
21
+ }
22
+
23
+ interface Props {
24
+ title: string;
25
+ onClose: () => void;
26
+ children: ReactNode;
27
+ // Buttons for the bottom-right action row.
28
+ actions?: ReactNode;
29
+ // Result or error line kept between the scrolling body and the actions.
30
+ status?: ReactNode;
31
+ width?: number;
32
+ ariaLabel?: string;
33
+ testId?: string;
34
+ dataHelp?: string;
35
+ zIndex?: number;
36
+ // Backdrop clicks close only when the dialog holds no work to lose.
37
+ closeOnBackdrop?: boolean;
38
+ closeLabel?: string;
39
+ closeTestId?: string;
40
+ onKeyDown?: (e: React.KeyboardEvent) => void;
41
+ // Optional handle on the scrolling body (for dialogs that remember scroll).
42
+ bodyRef?: React.Ref<HTMLDivElement>;
43
+ onBodyScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
44
+ }
45
+
46
+ const FOCUSABLE = 'button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), summary, a[href]';
47
+
48
+ export function DialogShell({ title, onClose, children, actions, status, width = 680, ariaLabel, testId, dataHelp, zIndex = 2000, closeOnBackdrop = false, closeLabel = 'Close', closeTestId, onKeyDown, bodyRef, onBodyScroll }: Props) {
49
+ const box = useRef<HTMLDivElement>(null);
50
+ const closeRef = useRef(onClose);
51
+ closeRef.current = onClose;
52
+ useEffect(() => {
53
+ const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
54
+ box.current?.focus();
55
+ const onKey = (event: KeyboardEvent) => {
56
+ if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); closeRef.current(); return; }
57
+ if (event.key !== 'Tab' || !box.current) return;
58
+ const controls = [...box.current.querySelectorAll<HTMLElement>(FOCUSABLE)];
59
+ if (!controls.length) { event.preventDefault(); box.current.focus(); return; }
60
+ const index = controls.indexOf(document.activeElement as HTMLElement);
61
+ if (event.shiftKey && index <= 0) { event.preventDefault(); controls[controls.length - 1]?.focus(); }
62
+ else if (!event.shiftKey && (index < 0 || index === controls.length - 1)) { event.preventDefault(); controls[0]?.focus(); }
63
+ };
64
+ document.addEventListener('keydown', onKey, true);
65
+ return () => { document.removeEventListener('keydown', onKey, true); previous?.focus(); };
66
+ }, []);
67
+ return (
68
+ <DialogPortal>
69
+ <div
70
+ role="dialog"
71
+ aria-modal="true"
72
+ aria-label={ariaLabel ?? title}
73
+ data-testid={testId}
74
+ data-help={dataHelp}
75
+ data-dialog-shell=""
76
+ onClick={(e) => { e.stopPropagation(); if (closeOnBackdrop && e.target === e.currentTarget) onClose(); }}
77
+ onKeyDown={(e) => { if (e.key !== 'Escape') e.stopPropagation(); onKeyDown?.(e); }}
78
+ style={{ position: 'fixed', inset: 0, zIndex, background: 'rgba(0,0,0,.65)', display: 'grid', placeItems: 'center', padding: '12px' }}
79
+ >
80
+ <div
81
+ ref={box}
82
+ tabIndex={-1}
83
+ style={{
84
+ width: `min(${width}px, 100%)`, maxHeight: 'calc(85vh / var(--ui-scale, 1))', minHeight: 0,
85
+ display: 'flex', flexDirection: 'column', overflow: 'hidden',
86
+ background: 'var(--color-bg-dialog)', border: '1px solid var(--color-border-hairline)', borderRadius: '6px',
87
+ boxShadow: '0 8px 32px rgba(0,0,0,0.4)', fontFamily: 'var(--font-body)', outline: 'none',
88
+ }}
89
+ >
90
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', padding: '10px 14px', borderBottom: '1px solid var(--color-border-hairline)', flexShrink: 0 }}>
91
+ <h2 className="display-font" style={dialogTitleStyle}>{title.toUpperCase()}</h2>
92
+ <button
93
+ type="button"
94
+ aria-label={closeLabel}
95
+ data-testid={closeTestId}
96
+ title={closeLabel}
97
+ onClick={onClose}
98
+ className="display-font"
99
+ style={{ marginLeft: 'auto', background: 'transparent', border: '1px solid var(--color-border-hairline)', color: 'var(--color-fg-muted)', padding: '2px 8px', cursor: 'pointer', fontSize: '12px', lineHeight: 1.2 }}
100
+ >{'\u00D7'}</button>
101
+ </div>
102
+ <div ref={bodyRef} onScroll={onBodyScroll} style={{ ...dialogBodyStyle, flex: '1 1 auto', minHeight: 0, overflow: 'auto', overflowWrap: 'anywhere', padding: '12px 14px', display: 'grid', gap: '10px', alignContent: 'start' }}>
103
+ {children}
104
+ </div>
105
+ {status && <div style={{ ...dialogBodyStyle, padding: '8px 14px', borderTop: '1px solid var(--color-border-hairline)', flexShrink: 0, overflowWrap: 'anywhere', maxHeight: '30%', overflow: 'auto' }}>{status}</div>}
106
+ {actions && (
107
+ <div style={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'flex-end', gap: '8px', padding: '10px 14px', borderTop: '1px solid var(--color-border-hairline)', flexShrink: 0 }}>
108
+ {actions}
109
+ </div>
110
+ )}
111
+ </div>
112
+ </div>
113
+ </DialogPortal>
114
+ );
115
+ }
@@ -1,5 +1,6 @@
1
1
  import { useMemo, useState } from 'react';
2
2
  import type { WorkflowConfig, ProviderName, ModelName, EffortLevel } from '@arco/shared';
3
+ import { DialogShell } from './DialogShell';
3
4
  import { RunAsPicker, spawnConfigFromRunAs, type RunAsSelection } from './RunAsPicker';
4
5
 
5
6
  // Composer-button sibling for REVIEW / HANDOFF / SPAWN / PLAN. One-click
@@ -58,52 +59,30 @@ export function DocsUpdateDialog({ parentConfig, onConfirm, onSpawn, onCancel }:
58
59
  }
59
60
  };
60
61
  return (
61
- <div
62
- style={{
63
- position: 'fixed',
64
- inset: 0,
65
- background: 'rgba(0,0,0,0.6)',
66
- zIndex: 50,
67
- display: 'flex',
68
- alignItems: 'center',
69
- justifyContent: 'center',
70
- }}
71
- onClick={onCancel}
62
+ <DialogShell
63
+ title="Update repo docs"
64
+ dataHelp="composer.docs"
65
+ onClose={onCancel}
66
+ closeOnBackdrop
67
+ width={520}
68
+ zIndex={50}
69
+ actions={(
70
+ <>
71
+ <Btn onClick={onCancel}>CANCEL</Btn>
72
+ <Btn primary onClick={send}>{isCurrentPrimary ? 'SEND TO AGENT' : 'SEND (NEW TAB)'}</Btn>
73
+ </>
74
+ )}
72
75
  >
73
- <div
74
- data-help="composer.docs"
75
- onClick={(e) => e.stopPropagation()}
76
- style={{
77
- background: 'var(--color-bg-dialog)',
78
- border: '1px solid var(--color-accent-primary-dim)',
79
- borderRadius: '6px',
80
- padding: '18px 22px',
81
- width: 'min(520px, calc(94vw / var(--ui-scale, 1)))',
82
- fontFamily: 'var(--font-body)',
83
- }}
84
- >
85
- <div
86
- className="display-font"
87
- style={{
88
- fontSize: '12px',
89
- letterSpacing: '3px',
90
- color: 'var(--color-accent-primary)',
91
- marginBottom: '6px',
92
- }}
93
- >
94
- UPDATE REPO DOCS
95
- </div>
96
76
  <div
97
77
  style={{
98
78
  fontSize: '11px',
99
79
  color: 'var(--color-fg-muted)',
100
80
  lineHeight: 1.5,
101
- marginBottom: '12px',
102
81
  }}
103
82
  >
104
83
  Sends the current agent a structured prompt to update README, DEVLOG, CLAUDE.md, and other markdown docs based on recent git activity. <strong style={{ color: 'var(--color-warning)' }}>Plan files under <code>.arco/plans/</code> are explicitly excluded.</strong>
105
84
  </div>
106
- <div style={{ marginBottom: '12px' }}>
85
+ <div>
107
86
  <RunAsPicker current={currentPrimary} selection={runAs} onChange={setRunAs} />
108
87
  </div>
109
88
 
@@ -128,12 +107,7 @@ export function DocsUpdateDialog({ parentConfig, onConfirm, onSpawn, onCancel }:
128
107
  resize: 'vertical',
129
108
  }}
130
109
  />
131
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px', marginTop: '14px' }}>
132
- <Btn onClick={onCancel}>CANCEL</Btn>
133
- <Btn primary onClick={send}>{isCurrentPrimary ? 'SEND TO AGENT' : 'SEND (NEW TAB)'}</Btn>
134
- </div>
135
- </div>
136
- </div>
110
+ </DialogShell>
137
111
  );
138
112
  }
139
113
 
@@ -1,4 +1,5 @@
1
1
  import { useMemo, useState } from 'react';
2
+ import { DialogShell } from './DialogShell';
2
3
  import type { ChatMessage, ClusterStatePayload } from '@arco/shared';
3
4
  import { useMessageSelectionStore, EMPTY_SELECTION } from '../stores/messageSelectionStore';
4
5
  import { formatRow } from '../utils/transcriptFormat';
@@ -55,37 +56,32 @@ export function ForwardDialog({ cluster, fromWorkflowId, messages, onConfirm, on
55
56
  const over = bytes > MAX_BYTES;
56
57
  const canSend = to.length > 0 && content.length > 0 && !over;
57
58
  return (
58
- <div role="dialog" aria-modal="true" aria-label="Forward messages" onClick={onCancel}
59
- style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.6)', zIndex: 50, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
60
- <div onClick={(e) => e.stopPropagation()} data-help="chat.forward"
61
- style={{ background: 'var(--color-bg-dialog, var(--color-bg-panel))', border: '1px solid var(--color-border-hairline)', width: 'min(640px, calc(92vw / var(--ui-scale, 1)))', maxHeight: 'calc(85vh / var(--ui-scale, 1))', display: 'flex', flexDirection: 'column', padding: '12px 14px', gap: '10px', overflowY: 'auto' }}>
62
- <span className="display-font" style={{ letterSpacing: '1px', fontSize: '11px' }}>FORWARD {ids.length} MESSAGE{ids.length === 1 ? '' : 'S'} · FROM {senderName.toUpperCase()}</span>
63
- {peers.length === 0 ? <div style={{ color: 'var(--color-warning)', fontSize: '11px' }}>No other members in this cluster.</div> : (
64
- <>
65
- <div>
66
- <div className="display-font" style={{ color: 'var(--color-fg-muted)', fontSize: '9px', letterSpacing: '1px', marginBottom: '4px' }}>RECIPIENTS</div>
67
- {peers.map((p) => (
68
- <label key={p.workflowId} style={{ display: 'flex', gap: '8px', alignItems: 'center', fontSize: '11px', padding: '2px 0' }}>
69
- <input type="checkbox" aria-label={`Forward to ${p.displayName}`} checked={to.includes(p.workflowId)}
70
- onChange={(e) => setTo((cur) => (e.target.checked ? [...cur, p.workflowId] : cur.filter((id) => id !== p.workflowId)))} />
71
- {p.displayName}
72
- </label>
73
- ))}
74
- </div>
75
- <textarea aria-label="Covering note" rows={2} value={note} onChange={(e) => setNote(e.target.value)} placeholder="Optional note placed above the forwarded messages"
76
- style={{ width: '100%', boxSizing: 'border-box', background: 'var(--color-bg)', color: 'var(--color-fg)', border: '1px solid var(--color-border-hairline)', padding: '6px 8px', fontSize: '11px', fontFamily: 'inherit', resize: 'vertical' }} />
77
- <div className="display-font" style={{ color: over ? 'var(--color-warning)' : 'var(--color-fg-muted)', fontSize: '9px', letterSpacing: '1px' }}>
78
- PREVIEW · {bytes.toLocaleString()} / {MAX_BYTES.toLocaleString()} bytes{over ? ' - too long, select fewer messages' : ''}
79
- </div>
80
- <pre data-testid="forward-preview" style={{ margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word', fontSize: '11px', maxHeight: '220px', overflowY: 'auto', background: 'var(--color-bg)', padding: '8px 10px', border: '1px solid var(--color-border-hairline)' }}>{content || '(nothing to forward in the selection)'}</pre>
81
- </>
82
- )}
83
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px' }}>
84
- <button type="button" className="display-font" style={button} onClick={onCancel}>CANCEL</button>
85
- <button type="button" className="display-font" disabled={!canSend} style={{ ...button, opacity: canSend ? 1 : 0.4, cursor: canSend ? 'pointer' : 'not-allowed' }}
86
- onClick={() => { if (canSend) onConfirm(to, content); }}>{to.length > 1 ? `SEND TO ${to.length}` : 'SEND'}</button>
87
- </div>
88
- </div>
89
- </div>
59
+ <DialogShell title={`Forward ${ids.length} message${ids.length === 1 ? '' : 's'} - from ${senderName}`} ariaLabel="Forward messages" dataHelp="chat.forward" onClose={onCancel} closeOnBackdrop width={640} zIndex={50}
60
+ actions={<>
61
+ <button type="button" className="display-font" style={button} onClick={onCancel}>CANCEL</button>
62
+ <button type="button" className="display-font" disabled={!canSend} style={{ ...button, opacity: canSend ? 1 : 0.4, cursor: canSend ? 'pointer' : 'not-allowed' }}
63
+ onClick={() => { if (canSend) onConfirm(to, content); }}>{to.length > 1 ? `SEND TO ${to.length}` : 'SEND'}</button>
64
+ </>}>
65
+ {peers.length === 0 ? <div style={{ color: 'var(--color-warning)', fontSize: '11px' }}>No other members in this cluster.</div> : (
66
+ <>
67
+ <div>
68
+ <div className="display-font" style={{ color: 'var(--color-fg-muted)', fontSize: '9px', letterSpacing: '1px', marginBottom: '4px' }}>RECIPIENTS</div>
69
+ {peers.map((p) => (
70
+ <label key={p.workflowId} style={{ display: 'flex', gap: '8px', alignItems: 'center', fontSize: '11px', padding: '2px 0' }}>
71
+ <input type="checkbox" aria-label={`Forward to ${p.displayName}`} checked={to.includes(p.workflowId)}
72
+ onChange={(e) => setTo((cur) => (e.target.checked ? [...cur, p.workflowId] : cur.filter((id) => id !== p.workflowId)))} />
73
+ {p.displayName}
74
+ </label>
75
+ ))}
76
+ </div>
77
+ <textarea aria-label="Covering note" rows={2} value={note} onChange={(e) => setNote(e.target.value)} placeholder="Optional note placed above the forwarded messages"
78
+ style={{ width: '100%', boxSizing: 'border-box', background: 'var(--color-bg)', color: 'var(--color-fg)', border: '1px solid var(--color-border-hairline)', padding: '6px 8px', fontSize: '11px', fontFamily: 'inherit', resize: 'vertical' }} />
79
+ <div className="display-font" style={{ color: over ? 'var(--color-warning)' : 'var(--color-fg-muted)', fontSize: '9px', letterSpacing: '1px' }}>
80
+ PREVIEW · {bytes.toLocaleString()} / {MAX_BYTES.toLocaleString()} bytes{over ? ' - too long, select fewer messages' : ''}
81
+ </div>
82
+ <pre data-testid="forward-preview" style={{ margin: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-word', fontSize: '11px', maxHeight: '220px', overflowY: 'auto', background: 'var(--color-bg)', padding: '8px 10px', border: '1px solid var(--color-border-hairline)' }}>{content || '(nothing to forward in the selection)'}</pre>
83
+ </>
84
+ )}
85
+ </DialogShell>
90
86
  );
91
87
  }
@@ -1,4 +1,5 @@
1
- import { useEffect, useMemo, useState } from 'react';
1
+ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
2
+ import { forgetGitDialog, recallGitDialog, rememberGitDialog } from '../utils/gitDialogMemory';
2
3
  import { upstreamForFinalBranch } from '../utils/gitPushTarget';
3
4
  import { GitOtherWork } from './GitOtherWork';
4
5
  import type { WorkflowConfig, ProviderName, ModelName, EffortLevel } from '@arco/shared';
@@ -7,6 +8,7 @@ import type { WorkflowConfig, ProviderName, ModelName, EffortLevel } from '@arco
7
8
  import { PROTECTED_BRANCH_RE } from '@arco/shared';
8
9
  import { RunAsPicker, spawnConfigFromRunAs, type RunAsSelection } from './RunAsPicker';
9
10
  import { ChangesPanel } from './diff/ChangesPanel';
11
+ import { DialogShell } from './DialogShell';
10
12
 
11
13
  // Composer-button sibling for COMMIT / PUSH / PR / branch switching.
12
14
  // Fetches live git status on open so the popup shows reality (current
@@ -106,29 +108,33 @@ function inferDefaultAction(status: GitStatus): Action {
106
108
  export function GitDialog({ cwd, wfid, parentConfig, onConfirm, onSpawn, onCancel }: Props) {
107
109
  const [status, setStatus] = useState<GitStatus | null>(null);
108
110
  const [loadError, setLoadError] = useState<string | null>(null);
109
- const [action, setAction] = useState<Action>('commit-push');
111
+ // A dialog closed without sending (for example through VIEW CHANGES) reopens as it was.
112
+ const memo = useRef(recallGitDialog(wfid)).current;
113
+ const [action, setAction] = useState<Action>((memo?.action as Action | undefined) ?? 'commit-push');
110
114
  const currentPrimary: RunAsSelection = useMemo(() => ({
111
115
  provider: (parentConfig.primaryProvider ?? 'claude') as ProviderName,
112
116
  model: parentConfig.primaryModel as ModelName,
113
117
  effort: parentConfig.primaryEffort as EffortLevel,
114
118
  providerAccountRef: parentConfig.providerAccountRef,
115
119
  }), [parentConfig.primaryProvider, parentConfig.primaryModel, parentConfig.primaryEffort, parentConfig.providerAccountRef]);
116
- const [runAs, setRunAs] = useState<RunAsSelection>(currentPrimary);
120
+ const [runAs, setRunAs] = useState<RunAsSelection>((memo?.runAs as RunAsSelection | undefined) ?? currentPrimary);
117
121
  const isCurrentPrimary = runAs.provider === currentPrimary.provider && runAs.model === currentPrimary.model && runAs.effort === currentPrimary.effort && runAs.providerAccountRef === currentPrimary.providerAccountRef;
118
- const [saveAsDefault, setSaveAsDefault] = useState(false);
119
- const [commitSubject, setCommitSubject] = useState('');
120
- const [scopeNotes, setScopeNotes] = useState('');
122
+ const [saveAsDefault, setSaveAsDefault] = useState(memo?.saveAsDefault ?? false);
123
+ const [commitSubject, setCommitSubject] = useState(memo?.commitSubject ?? '');
124
+ const [scopeNotes, setScopeNotes] = useState(memo?.scopeNotes ?? '');
121
125
  // Branch dropdown / new-branch state.
122
- const [pickedBranch, setPickedBranch] = useState<string>('');
123
- const [creatingNew, setCreatingNew] = useState(false);
124
- const [newBranchName, setNewBranchName] = useState('');
125
- const [newBranchBase, setNewBranchBase] = useState<string>('');
126
+ const [pickedBranch, setPickedBranch] = useState<string>(memo?.pickedBranch ?? '');
127
+ const [creatingNew, setCreatingNew] = useState(memo?.creatingNew ?? false);
128
+ const [newBranchName, setNewBranchName] = useState(memo?.newBranchName ?? '');
129
+ const [newBranchBase, setNewBranchBase] = useState<string>(memo?.newBranchBase ?? '');
126
130
  const [switchPending, setSwitchPending] = useState(false);
127
131
  const [switchError, setSwitchError] = useState<string | null>(null);
128
132
  // Pre-commit working-tree diff preview. Collapsed by default so the dialog
129
133
  // opens compact; the operator expands to confirm exactly what's about to be
130
134
  // committed before dispatching the prompt.
131
- const [showDiff, setShowDiff] = useState(false);
135
+ const [showDiff, setShowDiff] = useState(memo?.showDiff ?? false);
136
+ const [otherOpen, setOtherOpen] = useState(memo?.otherOpen ?? false);
137
+ const scroller = useRef<HTMLDivElement>(null);
132
138
 
133
139
  // Initial load — fetch status, prime defaults from saved prefs + smart inference.
134
140
  useEffect(() => {
@@ -141,9 +147,11 @@ export function GitDialog({ cwd, wfid, parentConfig, onConfirm, onSpawn, onCance
141
147
  if (cancelled) return;
142
148
  setStatus(s);
143
149
  const saved = loadPrefs(cwd);
144
- setAction(saved?.action ?? inferDefaultAction(s));
145
- setPickedBranch(s.currentBranch ?? '');
146
- setNewBranchBase(s.defaultBranch ?? s.currentBranch ?? '');
150
+ if (!memo) {
151
+ setAction(saved?.action ?? inferDefaultAction(s));
152
+ setPickedBranch(s.currentBranch ?? '');
153
+ setNewBranchBase(s.defaultBranch ?? s.currentBranch ?? '');
154
+ }
147
155
  } catch (err) {
148
156
  if (cancelled) return;
149
157
  setLoadError(err instanceof Error ? err.message : String(err));
@@ -152,6 +160,14 @@ export function GitDialog({ cwd, wfid, parentConfig, onConfirm, onSpawn, onCance
152
160
  return () => { cancelled = true; };
153
161
  }, [cwd]);
154
162
 
163
+ useEffect(() => {
164
+ rememberGitDialog(wfid, { action, runAs, saveAsDefault, commitSubject, scopeNotes, pickedBranch, creatingNew, newBranchName, newBranchBase, showDiff, otherOpen });
165
+ }, [wfid, action, runAs, saveAsDefault, commitSubject, scopeNotes, pickedBranch, creatingNew, newBranchName, newBranchBase, showDiff, otherOpen]);
166
+ // Restore the scroll position once the status has laid the dialog out.
167
+ useLayoutEffect(() => {
168
+ if (status && memo?.scrollTop && scroller.current) scroller.current.scrollTop = memo.scrollTop;
169
+ }, [status]);
170
+
155
171
  const isProtectedTarget = useMemo(() => {
156
172
  const target = creatingNew ? newBranchName : pickedBranch;
157
173
  return target ? PROTECTED_BRANCH_RE.test(target) : false;
@@ -218,45 +234,37 @@ export function GitDialog({ cwd, wfid, parentConfig, onConfirm, onSpawn, onCance
218
234
  });
219
235
  if (isCurrentPrimary) {
220
236
  // Same-tab dispatch — drops into the existing chat as a regular turn.
237
+ forgetGitDialog(wfid);
221
238
  onConfirm(prompt);
222
239
  } else {
223
240
  // RUN AS override — spawn a new tab so the picked model handles
224
241
  // the git work without permanently switching this tab's primary.
225
242
  const newConfig = spawnConfigFromRunAs(parentConfig, runAs, 'git');
243
+ forgetGitDialog(wfid);
226
244
  onSpawn(newConfig, prompt, false);
227
245
  }
228
246
  };
229
247
 
248
+ const canSubmit = Boolean(status && status.isRepo);
230
249
  return (
231
- <div
232
- style={{
233
- position: 'fixed',
234
- inset: 0,
235
- background: 'rgba(0,0,0,0.6)',
236
- zIndex: 50,
237
- display: 'flex',
238
- alignItems: 'center',
239
- justifyContent: 'center',
240
- }}
241
- onClick={onCancel}
250
+ <DialogShell
251
+ title="Git"
252
+ dataHelp="composer.git"
253
+ onClose={onCancel}
254
+ closeOnBackdrop
255
+ width={760}
256
+ zIndex={50}
257
+ bodyRef={scroller}
258
+ onBodyScroll={(e) => rememberGitDialog(wfid, { scrollTop: e.currentTarget.scrollTop })}
259
+ actions={canSubmit ? (
260
+ <>
261
+ <Btn onClick={onCancel}>CANCEL</Btn>
262
+ <Btn primary onClick={submit} disabled={switchPending || (creatingNew && !newBranchName.trim())}>
263
+ {switchPending ? 'SWITCHING\u2026' : isCurrentPrimary ? 'CONTINUE' : 'CONTINUE (NEW TAB)'}
264
+ </Btn>
265
+ </>
266
+ ) : undefined}
242
267
  >
243
- <div
244
- data-help="composer.git"
245
- onClick={(e) => e.stopPropagation()}
246
- style={{
247
- background: 'var(--color-bg-dialog)',
248
- border: '1px solid var(--color-accent-primary-dim)',
249
- borderRadius: '6px',
250
- padding: '18px 22px',
251
- width: 'min(760px, calc(94vw / var(--ui-scale, 1)))',
252
- maxHeight: 'calc(90vh / var(--ui-scale, 1))',
253
- overflowY: 'auto',
254
- fontFamily: 'var(--font-body)',
255
- }}
256
- >
257
- <div className="display-font" style={{ fontSize: '12px', letterSpacing: '3px', color: 'var(--color-accent-primary)', marginBottom: '12px' }}>
258
- GIT
259
- </div>
260
268
 
261
269
  <div style={{ marginBottom: '12px' }}>
262
270
  <RunAsPicker current={currentPrimary} selection={runAs} onChange={setRunAs} />
@@ -281,7 +289,7 @@ export function GitDialog({ cwd, wfid, parentConfig, onConfirm, onSpawn, onCance
281
289
  <>
282
290
  <RepoLine status={status} />
283
291
  <GitStateSummary status={status} />
284
- <GitOtherWork cwd={cwd} wfid={wfid} onViewed={onCancel} />
292
+ <GitOtherWork cwd={cwd} wfid={wfid} onViewed={onCancel} open={otherOpen} onOpenChange={setOtherOpen} />
285
293
 
286
294
  <button
287
295
  type="button"
@@ -414,17 +422,9 @@ export function GitDialog({ cwd, wfid, parentConfig, onConfirm, onSpawn, onCance
414
422
  rows={2}
415
423
  style={{ ...inputStyle, resize: 'vertical', fontFamily: 'var(--font-body)' }}
416
424
  />
417
-
418
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px', marginTop: '14px' }}>
419
- <Btn onClick={onCancel}>CANCEL</Btn>
420
- <Btn primary onClick={submit} disabled={switchPending || (creatingNew && !newBranchName.trim())}>
421
- {switchPending ? 'SWITCHING…' : isCurrentPrimary ? 'CONTINUE' : 'CONTINUE (NEW TAB)'}
422
- </Btn>
423
- </div>
424
425
  </>
425
426
  )}
426
- </div>
427
- </div>
427
+ </DialogShell>
428
428
  );
429
429
  }
430
430
 
@@ -24,8 +24,10 @@ export function tabsAt(path: string, jobs: Record<string, { config: { name: stri
24
24
  return [...names];
25
25
  }
26
26
 
27
- export function GitOtherWork({ cwd, wfid, onViewed }: { cwd: string; wfid: string; onViewed: () => void }) {
28
- const [open, setOpen] = useState(false);
27
+ export function GitOtherWork({ cwd, wfid, onViewed, open: openProp, onOpenChange }: { cwd: string; wfid: string; onViewed: () => void; open?: boolean; onOpenChange?: (open: boolean) => void }) {
28
+ const [openLocal, setOpenLocal] = useState(false);
29
+ const open = openProp ?? openLocal;
30
+ const setOpen = (next: boolean | ((o: boolean) => boolean)) => { const value = typeof next === 'function' ? next(open) : next; setOpenLocal(value); onOpenChange?.(value); };
29
31
  const [data, setData] = useState<OtherWorkResponse | null>(null);
30
32
  const [failed, setFailed] = useState(false);
31
33
  const jobs = useAppStore((s) => s.jobs);
@@ -4,6 +4,7 @@ import { useAppStore } from '../stores/appStore';
4
4
  import { effortsForModel, clampEffortForProvider } from '../utils/format';
5
5
  import { claudeModelLabel, defaultModelForProvider, modelsForProvider, useModelCatalogs } from '../utils/modelCatalog';
6
6
  import { CursorModelSelect } from './CursorModelSelect';
7
+ import { DialogShell } from './DialogShell';
7
8
 
8
9
  // Shared look for the Cursor family/effort dropdowns — matches the dialog's
9
10
  // text inputs (sunken bg, hairline border, accent text).
@@ -125,42 +126,24 @@ export function HandoffDialog({ currentConfig, onConfirm, onCancel }: Props) {
125
126
  };
126
127
 
127
128
  return (
128
- <div
129
- style={{
130
- position: 'fixed',
131
- inset: 0,
132
- background: 'rgba(0,0,0,0.6)',
133
- zIndex: 50,
134
- display: 'flex',
135
- alignItems: 'center',
136
- justifyContent: 'center',
137
- }}
138
- onClick={onCancel}
129
+ <DialogShell
130
+ title="Rotate session"
131
+ dataHelp="actions.handoff"
132
+ onClose={onCancel}
133
+ closeOnBackdrop
134
+ width={520}
135
+ zIndex={50}
136
+ actions={(
137
+ <>
138
+ <span data-help="handoff.cancel" style={{ display: 'inline-flex' }}>
139
+ <Btn onClick={onCancel}>CANCEL</Btn>
140
+ </span>
141
+ <span data-help="handoff.confirm" style={{ display: 'inline-flex' }}>
142
+ <Btn primary onClick={confirm}>{primaryChanged ? 'ROTATE & SWAP' : 'ROTATE'}</Btn>
143
+ </span>
144
+ </>
145
+ )}
139
146
  >
140
- <div
141
- onClick={(e) => e.stopPropagation()}
142
- style={{
143
- background: 'var(--color-bg-dialog)',
144
- border: '1px solid var(--color-accent-primary-dim)',
145
- borderRadius: '6px',
146
- padding: '18px 22px',
147
- width: 'min(520px, calc(94vw / var(--ui-scale, 1)))',
148
- maxHeight: 'calc(88vh / var(--ui-scale, 1))',
149
- overflowY: 'auto',
150
- fontFamily: 'var(--font-body)',
151
- }}
152
- >
153
- <div
154
- className="display-font"
155
- style={{
156
- fontSize: '12px',
157
- letterSpacing: '3px',
158
- color: 'var(--color-accent-primary)',
159
- marginBottom: '6px',
160
- }}
161
- >
162
- ROTATE SESSION
163
- </div>
164
147
  <div
165
148
  className="display-font"
166
149
  style={{ fontSize: '10px', color: 'var(--color-fg-muted)', marginBottom: '14px', letterSpacing: '0.5px', lineHeight: 1.5 }}
@@ -389,16 +372,7 @@ export function HandoffDialog({ currentConfig, onConfirm, onCancel }: Props) {
389
372
  );
390
373
  })()}
391
374
 
392
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px', marginTop: '10px' }}>
393
- <span data-help="handoff.cancel" style={{ display: 'inline-flex' }}>
394
- <Btn onClick={onCancel}>CANCEL</Btn>
395
- </span>
396
- <span data-help="handoff.confirm" style={{ display: 'inline-flex' }}>
397
- <Btn primary onClick={confirm}>{primaryChanged ? 'ROTATE & SWAP' : 'ROTATE'}</Btn>
398
- </span>
399
- </div>
400
- </div>
401
- </div>
375
+ </DialogShell>
402
376
  );
403
377
  }
404
378