@1agh/maude 2.0.8 → 2.1.1

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 (401) hide show
  1. package/README.md +2 -1
  2. package/apps/hub/src/project-transactions/kernel.mjs +13 -7
  3. package/apps/studio/access/closure.ts +86 -10
  4. package/apps/studio/access/filters.ts +18 -1
  5. package/apps/studio/access/request.ts +8 -0
  6. package/apps/studio/acp/design-write-verb.ts +12 -2
  7. package/apps/studio/acp/env.ts +7 -2
  8. package/apps/studio/acp/index.ts +15 -4
  9. package/apps/studio/acp/login-state.ts +22 -5
  10. package/apps/studio/acp/may-scope.ts +38 -1
  11. package/apps/studio/acp/plugin-bootstrap.ts +13 -1
  12. package/apps/studio/acp/probe.ts +11 -4
  13. package/apps/studio/actions/agents.ts +110 -28
  14. package/apps/studio/actions/canvas-keys.ts +4 -2
  15. package/apps/studio/actions/ctx.ts +3 -0
  16. package/apps/studio/actions/defs/annotation.ts +84 -2
  17. package/apps/studio/actions/defs/app.ts +28 -1
  18. package/apps/studio/actions/defs/edit.ts +13 -0
  19. package/apps/studio/actions/defs/export.ts +12 -0
  20. package/apps/studio/actions/defs/sync.ts +18 -0
  21. package/apps/studio/actions/defs/video.ts +9 -0
  22. package/apps/studio/actions/documents.ts +6 -1
  23. package/apps/studio/actions/keymap.gen.ts +147 -9
  24. package/apps/studio/actions/menu.ts +5 -1
  25. package/apps/studio/actions/types.ts +4 -2
  26. package/apps/studio/actions/verbs.ts +9 -0
  27. package/apps/studio/actions.manifest.json +300 -45
  28. package/apps/studio/actions.parity.json +19 -1
  29. package/apps/studio/ai/save-hold.ts +2 -1
  30. package/apps/studio/ai/write-claim-scope.ts +7 -1
  31. package/apps/studio/ai/write-claim.ts +154 -3
  32. package/apps/studio/annotations/ai-read.ts +42 -6
  33. package/apps/studio/annotations/ai-write.ts +145 -2
  34. package/apps/studio/annotations/board-ops.ts +34 -3
  35. package/apps/studio/annotations/checklist-ops.ts +374 -0
  36. package/apps/studio/annotations/elements/checkitem.model.ts +129 -0
  37. package/apps/studio/annotations/elements/sticky.model.ts +54 -2
  38. package/apps/studio/annotations/ops.ts +30 -0
  39. package/apps/studio/annotations/registry.ts +9 -1
  40. package/apps/studio/annotations/templates.ts +4 -2
  41. package/apps/studio/annotations/text-steps.ts +114 -10
  42. package/apps/studio/annotations/ui/checklist-wire.ts +129 -0
  43. package/apps/studio/annotations/ui/checklist.tsx +429 -0
  44. package/apps/studio/annotations/ui/element-node.tsx +48 -2
  45. package/apps/studio/annotations/ui/template-place.ts +11 -1
  46. package/apps/studio/annotations/v1-adapter.ts +22 -3
  47. package/apps/studio/annotations-context-toolbar.tsx +12 -0
  48. package/apps/studio/annotations-layer.tsx +442 -49
  49. package/apps/studio/annotations-model.ts +4 -2
  50. package/apps/studio/api.ts +148 -21
  51. package/apps/studio/artboard-live-gate.tsx +54 -17
  52. package/apps/studio/artboard-still-persist.ts +166 -0
  53. package/apps/studio/artboard-still-raster.ts +6 -2
  54. package/apps/studio/artboard-still.ts +390 -20
  55. package/apps/studio/asset-added.ts +154 -0
  56. package/apps/studio/asset-details.ts +46 -3
  57. package/apps/studio/asset-origins.ts +5 -3
  58. package/apps/studio/asset-trash.ts +6 -1
  59. package/apps/studio/bin/_agent-browser-safe.mjs +3 -4
  60. package/apps/studio/bin/_annotate-post.mjs +14 -5
  61. package/apps/studio/bin/_audio-search.mjs +8 -2
  62. package/apps/studio/bin/_curl-local.mjs +7 -4
  63. package/apps/studio/bin/_desktop-locate.sh +145 -0
  64. package/apps/studio/bin/_ds-check-live.mjs +2 -1
  65. package/apps/studio/bin/_exports.mjs +38 -2
  66. package/apps/studio/bin/_history.mjs +79 -8
  67. package/apps/studio/bin/_import-asset.mjs +14 -9
  68. package/apps/studio/bin/_import-figma.mjs +510 -98
  69. package/apps/studio/bin/_index-cli.mjs +10 -21
  70. package/apps/studio/bin/_ingest-footage.mjs +24 -6
  71. package/apps/studio/bin/_media-probe.mjs +232 -0
  72. package/apps/studio/bin/_perf-probe-open.mjs +6 -0
  73. package/apps/studio/bin/_perf-probe-safari.mjs +6 -0
  74. package/apps/studio/bin/_perf-probe-studio.mjs +6 -1
  75. package/apps/studio/bin/_perf-probe.mjs +8 -3
  76. package/apps/studio/bin/_perf-sweep-shared.mjs +789 -0
  77. package/apps/studio/bin/_perf-sweep.mjs +240 -0
  78. package/apps/studio/bin/_record-shot.sh +33 -8
  79. package/apps/studio/bin/_screenshot-playwright.mjs +45 -2
  80. package/apps/studio/bin/_studio-verb.mjs +8 -3
  81. package/apps/studio/bin/_thumb-route.mjs +21 -0
  82. package/apps/studio/bin/_thumbs-playwright.mjs +83 -1
  83. package/apps/studio/bin/_transcribe.mjs +22 -6
  84. package/apps/studio/bin/_unsynced-refs.mjs +22 -0
  85. package/apps/studio/bin/_url-guard.mjs +120 -5
  86. package/apps/studio/bin/_url-guard.sh +29 -7
  87. package/apps/studio/bin/_video-limits.mjs +104 -0
  88. package/apps/studio/bin/_video-playwright.mjs +119 -19
  89. package/apps/studio/bin/_video-proxy.mjs +130 -0
  90. package/apps/studio/bin/_write-claim.mjs +38 -16
  91. package/apps/studio/bin/annotate.mjs +12 -2
  92. package/apps/studio/bin/canvas-rects.sh +19 -4
  93. package/apps/studio/bin/chat-open.sh +7 -1
  94. package/apps/studio/bin/draw-proof.sh +6 -2
  95. package/apps/studio/bin/generate.sh +32 -10
  96. package/apps/studio/bin/handoff.sh +2 -2
  97. package/apps/studio/bin/perf.sh +96 -15
  98. package/apps/studio/bin/photo-adjust.sh +6 -3
  99. package/apps/studio/bin/photo-bg-remove.sh +2 -2
  100. package/apps/studio/bin/prep.sh +21 -4
  101. package/apps/studio/bin/read-annotations.mjs +3 -0
  102. package/apps/studio/bin/runtime-health.sh +27 -1
  103. package/apps/studio/bin/screenshot.sh +152 -12
  104. package/apps/studio/bin/server-up.sh +64 -6
  105. package/apps/studio/bin/smoke.sh +43 -8
  106. package/apps/studio/bin/to-lottie.sh +3 -2
  107. package/apps/studio/bin/video-proxy.sh +27 -0
  108. package/apps/studio/bin/visual-sanity.sh +3 -1
  109. package/apps/studio/bridge/dgn-protocol.ts +157 -1
  110. package/apps/studio/bridge/mode-shows.ts +8 -6
  111. package/apps/studio/bridge/still-webp.ts +233 -0
  112. package/apps/studio/build.ts +18 -0
  113. package/apps/studio/canvas-build.ts +93 -11
  114. package/apps/studio/canvas-comment-mount.tsx +53 -8
  115. package/apps/studio/canvas-edit.ts +34 -1
  116. package/apps/studio/canvas-lib-module.ts +210 -0
  117. package/apps/studio/canvas-lib.tsx +3 -12
  118. package/apps/studio/canvas-pipeline.ts +111 -5
  119. package/apps/studio/canvas-shell.tsx +8 -11
  120. package/apps/studio/canvas-theme-pill.tsx +5 -3
  121. package/apps/studio/check/index.ts +12 -5
  122. package/apps/studio/check/video.ts +18 -2
  123. package/apps/studio/client/app.jsx +65 -7
  124. package/apps/studio/client/clipboard-relay.ts +193 -16
  125. package/apps/studio/client/comments-overlay.css +18 -0
  126. package/apps/studio/client/export-center.jsx +30 -0
  127. package/apps/studio/client/generate-dialog.jsx +49 -4
  128. package/apps/studio/client/github.js +7 -0
  129. package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
  130. package/apps/studio/client/home/HomeConnection.jsx +111 -0
  131. package/apps/studio/client/home/home-accounts-model.js +110 -1
  132. package/apps/studio/client/home/home-api.js +9 -2
  133. package/apps/studio/client/home/home-app.jsx +126 -13
  134. package/apps/studio/client/home/home-model.js +69 -1
  135. package/apps/studio/client/home/home-where-model.js +105 -0
  136. package/apps/studio/client/home/home.css +239 -1
  137. package/apps/studio/client/hooks/use-canvas-bridge.jsx +173 -98
  138. package/apps/studio/client/hooks/use-palette-and-panels.jsx +5 -1
  139. package/apps/studio/client/hooks/use-tabs.jsx +11 -4
  140. package/apps/studio/client/panels/DiffView.jsx +7 -1
  141. package/apps/studio/client/panels/TeamProjects.jsx +137 -134
  142. package/apps/studio/client/panels/chat-context.js +2 -0
  143. package/apps/studio/client/panels/slash-commands.gen.js +13 -13
  144. package/apps/studio/client/selection-scope.js +16 -9
  145. package/apps/studio/client/share-link.js +12 -0
  146. package/apps/studio/client/shell/viewport.jsx +11 -1
  147. package/apps/studio/client/shell-events.js +8 -0
  148. package/apps/studio/client/styles/3-kit-maude-v2.css +16 -0
  149. package/apps/studio/client/styles/_index.css +4 -0
  150. package/apps/studio/client/v2/ai/Feed.jsx +1 -1
  151. package/apps/studio/client/v2/ai/OfferCard.jsx +34 -0
  152. package/apps/studio/client/v2/ai/activity-line.js +54 -1
  153. package/apps/studio/client/v2/ai/ai-offer.js +21 -1
  154. package/apps/studio/client/v2/ai/run-model.js +3 -1
  155. package/apps/studio/client/v2/annotations/vote-store.js +28 -4
  156. package/apps/studio/client/v2/assets/asset-drop-session.js +37 -2
  157. package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +7 -5
  158. package/apps/studio/client/v2/assets/details-model.js +1 -1
  159. package/apps/studio/client/v2/assets/details.jsx +5 -0
  160. package/apps/studio/client/v2/assets/tile-drag.js +11 -7
  161. package/apps/studio/client/v2/comments/comments-panel.jsx +22 -3
  162. package/apps/studio/client/v2/create/duplicate-done.js +6 -2
  163. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
  164. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
  165. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
  166. package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
  167. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +113 -3
  168. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +343 -6
  169. package/apps/studio/client/v2/diagnostics/sync-details/unsynced-refs.js +55 -0
  170. package/apps/studio/client/v2/ds/review.css +1 -1
  171. package/apps/studio/client/v2/export/exports-model.js +7 -0
  172. package/apps/studio/client/v2/export/exports-panel.jsx +1 -0
  173. package/apps/studio/client/v2/export/job-row.jsx +32 -2
  174. package/apps/studio/client/v2/handoff/ready-card.jsx +1 -1
  175. package/apps/studio/client/v2/history/compare-view.jsx +1 -0
  176. package/apps/studio/client/v2/inspector/css-write.js +6 -1
  177. package/apps/studio/client/v2/inspector/frame.jsx +28 -4
  178. package/apps/studio/client/v2/inspector/kinds/clip-model.js +51 -0
  179. package/apps/studio/client/v2/inspector/kinds/clip.jsx +75 -2
  180. package/apps/studio/client/v2/inspector/model.js +21 -0
  181. package/apps/studio/client/v2/inspector/sections/fill.jsx +12 -3
  182. package/apps/studio/client/v2/inspector/sections/recent-colours.js +8 -5
  183. package/apps/studio/client/v2/inspector/view-mode.jsx +11 -1
  184. package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
  185. package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
  186. package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
  187. package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
  188. package/apps/studio/client/v2/link-server/link-server.css +109 -0
  189. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
  190. package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
  191. package/apps/studio/client/v2/preview/link-follow.js +4 -2
  192. package/apps/studio/client/v2/preview/preview-chrome-host.jsx +16 -6
  193. package/apps/studio/client/v2/search/help-model.js +2 -0
  194. package/apps/studio/client/v2/search/search-keywords.js +3 -2
  195. package/apps/studio/client/v2/settings/account.jsx +4 -2
  196. package/apps/studio/client/v2/settings/advanced-section.jsx +344 -137
  197. package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
  198. package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
  199. package/apps/studio/client/v2/settings/general-section.jsx +155 -24
  200. package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
  201. package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
  202. package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
  203. package/apps/studio/client/v2/settings/settings-cards.js +220 -0
  204. package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
  205. package/apps/studio/client/v2/settings/settings-model.js +100 -31
  206. package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
  207. package/apps/studio/client/v2/settings/settings.css +374 -64
  208. package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
  209. package/apps/studio/client/v2/settings/this-project-model.js +172 -0
  210. package/apps/studio/client/v2/settings/use-connections.js +3 -2
  211. package/apps/studio/client/v2/settings/use-open-card.js +37 -0
  212. package/apps/studio/client/v2/share/share-sheet.jsx +28 -11
  213. package/apps/studio/client/v2/shell/api-session-boot.js +6 -0
  214. package/apps/studio/client/v2/shell/api-session.js +126 -0
  215. package/apps/studio/client/v2/shell/connection-state.js +197 -0
  216. package/apps/studio/client/v2/shell/floating-panels.css +31 -1
  217. package/apps/studio/client/v2/shell/image-pick.js +61 -8
  218. package/apps/studio/client/v2/shell/menu-aim.js +43 -0
  219. package/apps/studio/client/v2/shell/menu-runner.js +25 -7
  220. package/apps/studio/client/v2/shell/occlusion-insets.js +18 -1
  221. package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
  222. package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
  223. package/apps/studio/client/v2/shell/project-account-model.js +272 -149
  224. package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
  225. package/apps/studio/client/v2/shell/project-account.css +237 -0
  226. package/apps/studio/client/v2/shell/project-pill.jsx +52 -6
  227. package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
  228. package/apps/studio/client/v2/shell/shell-parity.js +3 -2
  229. package/apps/studio/client/v2/shell/shell-parity.json +71 -36
  230. package/apps/studio/client/v2/shell/still-bridge.js +194 -0
  231. package/apps/studio/client/v2/shell/still-store.js +319 -0
  232. package/apps/studio/client/v2/shell/use-account.js +2 -0
  233. package/apps/studio/client/v2/shell/use-tool-panels.js +2 -1
  234. package/apps/studio/client/v2/signin/use-signin.js +1 -1
  235. package/apps/studio/client/v2/timeline/Timeline.jsx +15 -0
  236. package/apps/studio/client/v2/timeline/frame-handle-model.js +142 -0
  237. package/apps/studio/client/v2/timeline/frame-handle.jsx +151 -0
  238. package/apps/studio/clip-ops.ts +126 -8
  239. package/apps/studio/cloud/endpoints.ts +29 -4
  240. package/apps/studio/collab/ai-activity.ts +10 -8
  241. package/apps/studio/collab/awareness-bridge.ts +34 -9
  242. package/apps/studio/collab/index.ts +3 -0
  243. package/apps/studio/collab/registry.ts +41 -10
  244. package/apps/studio/comment-reattach.ts +149 -0
  245. package/apps/studio/comments/mine-stamp.ts +15 -7
  246. package/apps/studio/comments/ops.ts +52 -8
  247. package/apps/studio/comments-overlay.tsx +146 -9
  248. package/apps/studio/dist/client.bundle.js +892 -885
  249. package/apps/studio/dist/comment-mount.js +2 -2
  250. package/apps/studio/dist/styles.css +1 -1
  251. package/apps/studio/dom-selection.ts +87 -18
  252. package/apps/studio/ds/board/directions.css +8 -0
  253. package/apps/studio/ds/board/outline.tsx +16 -0
  254. package/apps/studio/ds/canvas-check.ts +6 -0
  255. package/apps/studio/edit-ops/clip/reframe.ts +19 -3
  256. package/apps/studio/edit-ops/clip-carry.ts +602 -0
  257. package/apps/studio/edit-ops/clipboard.ts +318 -23
  258. package/apps/studio/edit-ops/dispatch.ts +20 -2
  259. package/apps/studio/edit-ops/scope-names.ts +249 -40
  260. package/apps/studio/edit-ops/slot-defaults.ts +3 -0
  261. package/apps/studio/edit-ops/types.ts +6 -0
  262. package/apps/studio/editing/align-bar.tsx +33 -9
  263. package/apps/studio/editing/artboard-actions.ts +5 -0
  264. package/apps/studio/editing/artboard-menu.tsx +6 -2
  265. package/apps/studio/editing/click-to-type.ts +1 -1
  266. package/apps/studio/editing/clip-words.ts +48 -0
  267. package/apps/studio/editing/clipboard.ts +21 -6
  268. package/apps/studio/editing/declared-background.ts +25 -0
  269. package/apps/studio/editing/index.tsx +3 -0
  270. package/apps/studio/editing/object-keys.ts +4 -4
  271. package/apps/studio/editing/object-menu.tsx +13 -3
  272. package/apps/studio/editing/pen/points.tsx +61 -0
  273. package/apps/studio/editing/text-in-place.tsx +11 -0
  274. package/apps/studio/editing/video-frame-handle.tsx +425 -0
  275. package/apps/studio/exporters/capture-prepass.ts +374 -0
  276. package/apps/studio/exporters/degraded.ts +148 -0
  277. package/apps/studio/exporters/hub-render-door.ts +28 -2
  278. package/apps/studio/exporters/index.ts +3 -1
  279. package/apps/studio/exporters/job-budget.ts +93 -0
  280. package/apps/studio/exporters/jobs.ts +215 -28
  281. package/apps/studio/exporters/parity-check.ts +254 -0
  282. package/apps/studio/exporters/remote.ts +209 -15
  283. package/apps/studio/exporters/svg-inline.ts +87 -0
  284. package/apps/studio/exporters/video-render-lib.ts +88 -26
  285. package/apps/studio/exporters/video.ts +29 -6
  286. package/apps/studio/figma/assets.ts +58 -43
  287. package/apps/studio/figma/codegen-fonts.ts +100 -0
  288. package/apps/studio/figma/fig-decode.ts +390 -25
  289. package/apps/studio/figma/fig-kiwi.ts +18 -4
  290. package/apps/studio/figma/fig-vector.ts +59 -3
  291. package/apps/studio/figma/sanitize.ts +2 -0
  292. package/apps/studio/figma/style-map.ts +293 -48
  293. package/apps/studio/figma/to-artboard.ts +455 -69
  294. package/apps/studio/figma/to-strokes.ts +44 -11
  295. package/apps/studio/figma/types.ts +13 -0
  296. package/apps/studio/footage/schema.ts +3 -3
  297. package/apps/studio/generation/adapters/elevenlabs.ts +7 -1
  298. package/apps/studio/generation/adapters/groq.ts +8 -1
  299. package/apps/studio/generation/spend.ts +312 -0
  300. package/apps/studio/generation/types.ts +12 -0
  301. package/apps/studio/handoff/run.ts +1 -1
  302. package/apps/studio/handoff/targets.ts +2 -2
  303. package/apps/studio/handoff/write-scopes.ts +1 -1
  304. package/apps/studio/history/describe-annotations.ts +4 -0
  305. package/apps/studio/home/accounts.ts +30 -11
  306. package/apps/studio/home/cloud.ts +6 -1
  307. package/apps/studio/home/create-local.ts +32 -3
  308. package/apps/studio/home/hub-health.ts +76 -0
  309. package/apps/studio/home/routes.ts +15 -4
  310. package/apps/studio/http.ts +438 -86
  311. package/apps/studio/imported-module-ids.ts +91 -0
  312. package/apps/studio/inspect.ts +2 -0
  313. package/apps/studio/migrate/hub.ts +8 -1
  314. package/apps/studio/notifications.tsx +47 -5
  315. package/apps/studio/paths.ts +10 -1
  316. package/apps/studio/port.ts +3 -2
  317. package/apps/studio/preview/preview-camera.tsx +15 -382
  318. package/apps/studio/readiness.ts +10 -1
  319. package/apps/studio/release-build.ts +51 -0
  320. package/apps/studio/routes/agent.ts +188 -9
  321. package/apps/studio/routes/ai.ts +43 -11
  322. package/apps/studio/routes/annotations.ts +27 -1
  323. package/apps/studio/routes/assets.ts +18 -1
  324. package/apps/studio/routes/canvas-origin.ts +12 -9
  325. package/apps/studio/routes/cloud-move.ts +15 -0
  326. package/apps/studio/routes/edit.ts +3 -0
  327. package/apps/studio/routes/export.ts +51 -0
  328. package/apps/studio/routes/generate.ts +42 -12
  329. package/apps/studio/routes/hub-link-folder.ts +334 -0
  330. package/apps/studio/routes/hub-signin.ts +78 -1
  331. package/apps/studio/routes/index.ts +9 -1
  332. package/apps/studio/routes/shell.ts +217 -5
  333. package/apps/studio/routes/sync.ts +136 -8
  334. package/apps/studio/routes/votes.ts +2 -1
  335. package/apps/studio/schema/annotations.v2.schema.json +143 -1
  336. package/apps/studio/schema/beats.v1.schema.json +1 -1
  337. package/apps/studio/schema/edl.v1.schema.json +1 -1
  338. package/apps/studio/schema/formats.ts +3 -3
  339. package/apps/studio/schema/transcript.v1.schema.json +1 -1
  340. package/apps/studio/server.ts +142 -43
  341. package/apps/studio/shell/api-key.ts +503 -0
  342. package/apps/studio/shell/attest.ts +59 -0
  343. package/apps/studio/shell/capture-url.ts +20 -0
  344. package/apps/studio/shell/cli-yield.ts +276 -0
  345. package/apps/studio/shell/clip-transfer.ts +302 -0
  346. package/apps/studio/shell/key-file.ts +108 -0
  347. package/apps/studio/shell/server-json.ts +75 -0
  348. package/apps/studio/shell/worktree.ts +19 -0
  349. package/apps/studio/spoof-chars.ts +9 -0
  350. package/apps/studio/studio-page-host.ts +1 -1
  351. package/apps/studio/sync/accepted-cold-start.ts +144 -8
  352. package/apps/studio/sync/accepted-link.ts +76 -29
  353. package/apps/studio/sync/action-stage.ts +575 -44
  354. package/apps/studio/sync/adopt-held.ts +85 -0
  355. package/apps/studio/sync/ctl-heal.ts +58 -0
  356. package/apps/studio/sync/file-ledger.ts +38 -4
  357. package/apps/studio/sync/file-membership.ts +16 -1
  358. package/apps/studio/sync/file-plane.ts +289 -22
  359. package/apps/studio/sync/held-deletes.ts +86 -5
  360. package/apps/studio/sync/hub-link.ts +8 -0
  361. package/apps/studio/sync/index.ts +196 -12
  362. package/apps/studio/sync/journal-client.ts +50 -4
  363. package/apps/studio/sync/link-consent.ts +22 -75
  364. package/apps/studio/sync/link-survey.ts +252 -0
  365. package/apps/studio/sync/local-kernel.ts +296 -8
  366. package/apps/studio/sync/projection.ts +22 -3
  367. package/apps/studio/sync/seed-progress.ts +12 -0
  368. package/apps/studio/sync/source-recovery.ts +59 -3
  369. package/apps/studio/sync/status.ts +19 -2
  370. package/apps/studio/sync/unsynced-refs.ts +397 -0
  371. package/apps/studio/sync/writer-registry.ts +20 -0
  372. package/apps/studio/thumbs/service.ts +4 -1
  373. package/apps/studio/tool-palette.tsx +23 -0
  374. package/apps/studio/ui-prefs.ts +40 -0
  375. package/apps/studio/use-agent-presence.tsx +2 -2
  376. package/apps/studio/use-canvas-keys.ts +6 -1
  377. package/apps/studio/video/format-ids.ts +2 -2
  378. package/apps/studio/video/inject.ts +31 -0
  379. package/apps/studio/video/media-risk.ts +58 -0
  380. package/apps/studio/video/object-fit.ts +137 -0
  381. package/apps/studio/video/provider-transcript.ts +141 -0
  382. package/apps/studio/whats-new.json +137 -0
  383. package/apps/studio/workspace-mode.ts +1 -0
  384. package/apps/studio/ws.ts +5 -0
  385. package/cli/commands/design.mjs +119 -8
  386. package/cli/lib/bash-guard.mjs +366 -6
  387. package/cli/lib/confine-read.mjs +1 -0
  388. package/cli/lib/design-help.gen.mjs +3 -2
  389. package/cli/lib/design-hook.mjs +387 -81
  390. package/cli/lib/design-link.mjs +16 -1
  391. package/cli/lib/design-open.mjs +49 -3
  392. package/cli/lib/desktop-locate.mjs +770 -0
  393. package/cli/lib/handoff.mjs +1 -1
  394. package/cli/lib/hook-state.mjs +291 -0
  395. package/cli/lib/pkg-root.mjs +65 -13
  396. package/cli/lib/studio-locate.mjs +59 -16
  397. package/package.json +15 -8
  398. package/plugins/design/templates/_shell.html +13 -0
  399. package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
  400. package/apps/studio/client/v2/shell/account-card-model.js +0 -114
  401. package/apps/studio/client/v2/shell/account-card.jsx +0 -189
@@ -27,9 +27,12 @@ export const CLIP_COPY_OPS: ReadonlySet<string> = new Set([
27
27
  'object.copy',
28
28
  'object.cut',
29
29
  'artboard.copy',
30
+ 'artboard.cut',
30
31
  ]);
31
32
  export const CLIP_PASTE_OP = 'canvas.paste';
32
33
  export const NOTHING_TO_PASTE = 'Nothing to paste. Copy an object or an artboard first.';
34
+ /** #122 — a cloud tab's paste of a copy made elsewhere: the clip lives in a project on this Mac. */
35
+ export const CELL_NO_CROSS_PROJECT = 'Paste between projects works for projects on this Mac.';
33
36
 
34
37
  const CLIP_ID_RE = /^c_[0-9a-f]{16}$/;
35
38
 
@@ -52,7 +55,7 @@ const canvasKey = (f: string) => f.replace(/^\.design\//, '').replace(/^\/+/, ''
52
55
  export const canvasName = (f: string) =>
53
56
  (canvasKey(f).split('/').pop() ?? f).replace(/\.(tsx|jsx)$/, '');
54
57
 
55
- const what = (h: ClipHandle) =>
58
+ const what = (h: Pick<ClipHandle, 'kind' | 'count'>) =>
56
59
  h.kind === 'artboards'
57
60
  ? h.count === 1
58
61
  ? 'the artboard'
@@ -64,35 +67,63 @@ const what = (h: ClipHandle) =>
64
67
  export type ClipShape =
65
68
  | { kind: 'forward'; body: EditOpRequest }
66
69
  | { kind: 'reply'; result: EditOpResult }
67
- | { kind: 'confirm'; body: EditOpRequest; line: string; reply: EditOpResult };
70
+ | {
71
+ kind: 'confirm';
72
+ body: EditOpRequest;
73
+ line: string;
74
+ reply: EditOpResult;
75
+ /** #122 (122-C) — a copy from another project: Rust carries it after the click (clip_take) */
76
+ take?: () => Promise<ClipHandle>;
77
+ };
68
78
 
69
79
  // V2-8.9 attacker L2 — the ask below is trusted chrome, so it fires on the PERSON's schedule: only
70
80
  // within PASTE_INTENT_MS of a paste the shell itself saw — its own ⌘V / Edit › Paste / ⌘K row
71
81
  // (menu-runner), or a ⌘V the active frame relayed while it held the focus of a focused window (the
72
82
  // sec-a undo-key focus gate, use-canvas-bridge). One intent answers one ask. Planted canvas code that
73
83
  // sends `canvas.paste` on its own timing gets a refusal in the canvas's own words, never the shell's toast.
84
+ // A ⌘V the frame relayed is still the CANVAS's say (its code can send that message while it has focus): it
85
+ // may unlock a paste between two canvases of this project, never one from another project (`shapeClipPaste`).
74
86
  export const PASTE_INTENT_MS = 1000;
75
87
  let pasteIntentAt = Number.NEGATIVE_INFINITY;
88
+ let pasteIntentFromShell = false;
89
+
90
+ /** The clip ask's Paste button is inert this long after the toast appears: a lured click lands on nothing. */
91
+ export const CLIP_CONFIRM_ARM_MS = 600;
76
92
 
77
- /** A paste the shell saw (its own ⌘V / menu / ⌘K, or a focused frame's relayed ⌘V). */
93
+ /** A paste the shell itself saw: a keydown in its own document, its menu, its ⌘K row. */
78
94
  export function notePasteIntent(now: number = Date.now()): void {
79
95
  pasteIntentAt = now;
96
+ pasteIntentFromShell = true;
97
+ }
98
+
99
+ /** A ⌘V the active frame relayed while it held the focus of a focused window. */
100
+ export function noteFramePasteIntent(now: number = Date.now()): void {
101
+ pasteIntentAt = now;
102
+ pasteIntentFromShell = false;
80
103
  }
81
104
 
82
105
  /** Tests only. */
83
106
  export function _resetPasteIntent(): void {
84
107
  pasteIntentAt = Number.NEGATIVE_INFINITY;
108
+ pasteIntentFromShell = false;
85
109
  }
86
110
 
87
111
  /** What the relay does with one canvas edit-op request. */
88
112
  export function shapeClipRequest(
89
113
  body: EditOpRequest,
90
- { now = Date.now() }: { now?: number } = {}
114
+ { now = Date.now(), cloudTab = false }: { now?: number; cloudTab?: boolean } = {}
91
115
  ): ClipShape {
92
116
  if (body.op !== CLIP_PASTE_OP) return { kind: 'forward', body };
93
117
  const { clip: _theirs, ...params } = body.params ?? {};
94
118
  if (!held)
95
- return { kind: 'reply', result: { ok: false, code: 'invalid', message: NOTHING_TO_PASTE } };
119
+ return {
120
+ kind: 'reply',
121
+ result: {
122
+ ok: false,
123
+ code: 'invalid',
124
+ message: cloudTab ? CELL_NO_CROSS_PROJECT : NOTHING_TO_PASTE,
125
+ },
126
+ };
96
127
  const out: EditOpRequest = { ...body, params: { ...params, clip: held.id } };
97
128
  if (canvasKey(held.from) === canvasKey(body.file)) return { kind: 'forward', body: out };
98
129
  if (!(now - pasteIntentAt >= 0 && now - pasteIntentAt <= PASTE_INTENT_MS))
@@ -114,19 +145,31 @@ export function shapeClipRequest(
114
145
  };
115
146
  }
116
147
 
117
- /** After the server answered: a copy / cut's handle becomes the clipboard. */
118
- export function noteClipResult(body: EditOpRequest, result: EditOpResult): void {
148
+ const isHandle = (h: Partial<ClipHandle> | null | undefined): h is ClipHandle =>
149
+ !!h &&
150
+ typeof h.id === 'string' &&
151
+ CLIP_ID_RE.test(h.id) &&
152
+ (h.kind === 'objects' || h.kind === 'artboards') &&
153
+ typeof h.count === 'number' &&
154
+ typeof h.from === 'string';
155
+
156
+ /** After the server answered: a copy / cut's handle becomes the clipboard (and, on the desktop, the shell's). */
157
+ export function noteClipResult(
158
+ body: EditOpRequest,
159
+ result: EditOpResult,
160
+ bridge: ClipBridge | null = tauriClipBridge()
161
+ ): void {
119
162
  if (!result.ok || !CLIP_COPY_OPS.has(body.op)) return;
120
163
  const h = (result.detail as { clip?: Partial<ClipHandle> } | undefined)?.clip;
121
- if (
122
- !h ||
123
- typeof h.id !== 'string' ||
124
- !CLIP_ID_RE.test(h.id) ||
125
- (h.kind !== 'objects' && h.kind !== 'artboards') ||
126
- typeof h.count !== 'number' ||
127
- typeof h.from !== 'string'
128
- )
129
- return;
164
+ if (!isHandle(h)) return;
165
+ // #122 (122-C) — the desktop shell keeps the latest copy on this Mac, so another project's tab can paste it
166
+ try {
167
+ Promise.resolve(bridge?.note({ id: h.id, kind: h.kind, count: h.count, from: h.from })).catch(
168
+ () => {}
169
+ );
170
+ } catch {
171
+ /* an older app without the command — same-project paste is unaffected */
172
+ }
130
173
  held = { id: h.id, kind: h.kind, count: h.count, from: h.from };
131
174
  }
132
175
 
@@ -142,3 +185,137 @@ export function frameClipResult(body: EditOpRequest, result: EditOpResult): Edit
142
185
  if (!detail || !clip || typeof clip !== 'object') return result;
143
186
  return { ...result, detail: { ...detail, clip: { kind: clip.kind, count: clip.count } } };
144
187
  }
188
+
189
+ // ── #122 (122-C) — a paste between two projects on this Mac (contract §5.6) ──────────────────────────
190
+ //
191
+ // The desktop shell (Rust, clip_bridge.rs) keeps the latest copy made in ANY project tab — in memory, never on
192
+ // disk — and answers each tab only kind / count / where (`clip_latest`). A paste whose latest copy was made
193
+ // in another project's tab is asked in this shell's own words, on the person's schedule only (the same 1 s
194
+ // intent as a cross-canvas paste); after Paste, Rust reads the clip from that project's server and hands it
195
+ // to this one's over shell-token routes (`clip_take`), and the paste names the handle Rust brought. The tab
196
+ // that copied last wins, like the system clipboard. Cloud tabs and the browser have no bridge.
197
+
198
+ /** What Rust says about the latest copy on this Mac (never a handle of another tab). */
199
+ export interface ClipLatest {
200
+ seq: number;
201
+ /** the latest copy was made in this tab: paste with the shell's own handle */
202
+ mine: boolean;
203
+ kind: ClipHandle['kind'];
204
+ count: number;
205
+ from: string;
206
+ /** the project it was copied in */
207
+ project: string;
208
+ }
209
+
210
+ export interface ClipBridge {
211
+ note(h: ClipHandle): unknown;
212
+ latest(): Promise<ClipLatest | null>;
213
+ take(seq: number): Promise<ClipHandle>;
214
+ }
215
+
216
+ type TauriWin = { __TAURI__?: { core?: { invoke?: (cmd: string, args?: unknown) => unknown } } };
217
+
218
+ /** The desktop's three caller-checked commands; null outside the app (the browser, a test). */
219
+ export function tauriClipBridge(win: unknown = globalThis): ClipBridge | null {
220
+ const invoke = (win as TauriWin | null)?.__TAURI__?.core?.invoke;
221
+ if (typeof invoke !== 'function') return null;
222
+ return {
223
+ note: (h) => invoke('clip_note', { id: h.id, kind: h.kind, count: h.count, from: h.from }),
224
+ latest: async () => (await invoke('clip_latest')) as ClipLatest | null,
225
+ take: async (seq) => ((await invoke('clip_take', { seq })) as { handle: ClipHandle }).handle,
226
+ };
227
+ }
228
+
229
+ const isLatest = (l: unknown): l is ClipLatest => {
230
+ const v = l as Partial<ClipLatest> | null;
231
+ return (
232
+ !!v &&
233
+ typeof v.seq === 'number' &&
234
+ typeof v.mine === 'boolean' &&
235
+ (v.kind === 'objects' || v.kind === 'artboards') &&
236
+ typeof v.count === 'number' &&
237
+ typeof v.from === 'string' &&
238
+ typeof v.project === 'string'
239
+ );
240
+ };
241
+
242
+ /**
243
+ * `shapeClipRequest`, but on the desktop a paste first asks the shell which copy is the latest on this Mac.
244
+ * Synchronous for everything but a desktop paste (so no other edit-op changes its order).
245
+ */
246
+ export function shapeClipPaste(
247
+ body: EditOpRequest,
248
+ {
249
+ now = Date.now(),
250
+ cloudTab = false,
251
+ bridge = tauriClipBridge(),
252
+ synced = false,
253
+ here = '',
254
+ }: {
255
+ now?: number;
256
+ cloudTab?: boolean;
257
+ bridge?: ClipBridge | null;
258
+ /** this project syncs (a linked hub): the ask says the paste lands in a synced project */
259
+ synced?: boolean;
260
+ /** this project's name, for that line */
261
+ here?: string;
262
+ } = {}
263
+ ): ClipShape | Promise<ClipShape> {
264
+ if (body.op !== CLIP_PASTE_OP || cloudTab || !bridge)
265
+ return shapeClipRequest(body, { now, cloudTab });
266
+ return (async (): Promise<ClipShape> => {
267
+ let latest: unknown = null;
268
+ try {
269
+ latest = await bridge.latest();
270
+ } catch {
271
+ latest = null;
272
+ }
273
+ if (!isLatest(latest) || latest.mine) return shapeClipRequest(body, { now, cloudTab });
274
+ const named = `${what(latest)} copied in ${canvasName(latest.from)} · ${latest.project}`;
275
+ if (!(now - pasteIntentAt >= 0 && now - pasteIntentAt <= PASTE_INTENT_MS))
276
+ return {
277
+ kind: 'reply',
278
+ result: { ok: false, code: 'invalid', message: `To paste ${named}, press ⌘V.` },
279
+ };
280
+ // another project's copy: only a paste the shell itself saw, never a ⌘V the frame relayed
281
+ if (!pasteIntentFromShell)
282
+ return {
283
+ kind: 'reply',
284
+ result: { ok: false, code: 'invalid', message: `To paste ${named}, use Edit › Paste.` },
285
+ };
286
+ pasteIntentAt = Number.NEGATIVE_INFINITY;
287
+ const { clip: _theirs, ...params } = body.params ?? {};
288
+ const seq = latest.seq;
289
+ const into = synced
290
+ ? ` into ${here.trim() ? `the synced project ${here.trim().slice(0, 80)}` : 'this synced project'}`
291
+ : '';
292
+ return {
293
+ kind: 'confirm',
294
+ body: { ...body, params },
295
+ line: `Paste ${named}${into}?`,
296
+ reply: { ok: true, actionId: null, writeId: '', rev: '', refs: [], queued: true },
297
+ take: () => bridge.take(seq),
298
+ };
299
+ })();
300
+ }
301
+
302
+ const GONE_WORDS = 'That copy is gone; copy it again.';
303
+
304
+ /** After Paste on the shell's toast: the body to run — with the handle Rust brought, for another project's copy. */
305
+ export async function confirmedPasteBody(
306
+ shape: Extract<ClipShape, { kind: 'confirm' }>
307
+ ): Promise<{ ok: true; body: EditOpRequest } | { ok: false; message: string }> {
308
+ if (!shape.take) return { ok: true, body: shape.body };
309
+ let h: unknown;
310
+ try {
311
+ h = await shape.take();
312
+ } catch (e) {
313
+ const message = typeof e === 'string' ? e : e instanceof Error ? e.message : '';
314
+ return { ok: false, message: message || GONE_WORDS };
315
+ }
316
+ if (!isHandle(h as Partial<ClipHandle>)) return { ok: false, message: GONE_WORDS };
317
+ return {
318
+ ok: true,
319
+ body: { ...shape.body, params: { ...shape.body.params, clip: (h as ClipHandle).id } },
320
+ };
321
+ }
@@ -116,6 +116,12 @@
116
116
 
117
117
  /* P8 C5 (04 md-comment `md-th--new`, 10 `co-th`): one island — lg radius, the island shadow and its hairline edge,
118
118
  * 12 px in, 12 px between its parts, 330 wide for a new comment, 320 for a thread. */
119
+ /* #170: a card is placed by the anchor loop after it mounts; until then it is hidden, not drawn at (0, 0) */
120
+ .cm-composer:not([data-placed]),
121
+ .cm-thread:not([data-placed]) {
122
+ visibility: hidden;
123
+ }
124
+
119
125
  .cm-composer {
120
126
  position: absolute;
121
127
  width: 330px;
@@ -792,3 +798,15 @@ button.cm-chip--seek:focus-visible {
792
798
  .cm-glyph {
793
799
  flex: none;
794
800
  }
801
+
802
+ /* #170 R29: the card's and pin's hover transitions are hand-rolled (this frame has no shell motion tokens), so reduced
803
+ motion collapses them here */
804
+ @media (prefers-reduced-motion: reduce) {
805
+ .cm-pin,
806
+ .cm-composer,
807
+ .cm-composer *,
808
+ .cm-thread,
809
+ .cm-thread * {
810
+ transition-duration: 1ms !important;
811
+ }
812
+ }
@@ -328,6 +328,35 @@ export function useExportCenter({ enabled = true } = {}) {
328
328
  [fail]
329
329
  );
330
330
 
331
+ // #128 T3.7b — Cancel a running cloud export (POST /_api/export-jobs/cancel, registry `export.cancel`).
332
+ // The row ends in "Cancelled." over the socket; a refusal says why instead.
333
+ const cancel = useCallback(
334
+ async (job) => {
335
+ try {
336
+ const r = await fetch('/_api/export-jobs/cancel', {
337
+ method: 'POST',
338
+ headers: { 'content-type': 'application/json' },
339
+ body: JSON.stringify({ id: job.id }),
340
+ });
341
+ if (!r.ok)
342
+ fail(
343
+ job,
344
+ "Couldn't cancel",
345
+ r.status === 409
346
+ ? 'It has already finished.'
347
+ : r.status === 502
348
+ ? "The cloud didn't answer. Try again."
349
+ : r.status === 404
350
+ ? 'That export is no longer here.'
351
+ : (await r.text()) || `Refused (${r.status})`
352
+ );
353
+ } catch (err) {
354
+ fail(job, "Couldn't cancel", err?.message || String(err));
355
+ }
356
+ },
357
+ [fail]
358
+ );
359
+
331
360
  // A spec that names where to save (Downloads, or the remembered folder) saves itself on this Mac the
332
361
  // moment it is done — no dialog. Any other waits for Show in Finder, which asks once.
333
362
  useEffect(() => {
@@ -364,6 +393,7 @@ export function useExportCenter({ enabled = true } = {}) {
364
393
  reveal,
365
394
  again,
366
395
  retry,
396
+ cancel,
367
397
  renderHere,
368
398
  removeFromList,
369
399
  savedPaths,
@@ -59,6 +59,8 @@ export default function GenerateDialog({ onClose, onInsert }) {
59
59
  const [prompt, setPrompt] = useState('');
60
60
  const [busy, setBusy] = useState(false);
61
61
  const [status, setStatus] = useState(null); // { ok, msg }
62
+ // A job over the person's confirm amount waits for their OK (generation/spend.ts): { id, estimate } | null.
63
+ const [needsOk, setNeedsOk] = useState(null);
62
64
  const [resultAsset, setResultAsset] = useState(null);
63
65
  // feature-ai-media-generation Phase 1 (Task 1.1) — auto-insert the finished
64
66
  // image onto the canvas by default (generation is never a dead-end modal). The
@@ -164,10 +166,11 @@ export default function GenerateDialog({ onClose, onInsert }) {
164
166
  }, 180000);
165
167
  }, []);
166
168
 
167
- async function generate() {
169
+ async function generate(approved) {
168
170
  if (!prompt.trim() || !provider) return;
169
171
  setBusy(true);
170
172
  setStatus(null);
173
+ setNeedsOk(null);
171
174
  setResultAsset(null);
172
175
  setPlaced(null);
173
176
  autoInsertedRef.current = null;
@@ -182,7 +185,7 @@ export default function GenerateDialog({ onClose, onInsert }) {
182
185
  const res = await fetch('/_api/generate-jobs', {
183
186
  method: 'POST',
184
187
  headers: { 'content-type': 'text/plain' },
185
- body: JSON.stringify(body),
188
+ body: JSON.stringify(approved ? { ...body, approvalId: approved } : body),
186
189
  });
187
190
  if (res.status === 202) {
188
191
  const { jobId } = await res.json();
@@ -190,7 +193,19 @@ export default function GenerateDialog({ onClose, onInsert }) {
190
193
  poll(jobId);
191
194
  } else {
192
195
  setBusy(false);
193
- setStatus({ ok: false, msg: await res.text() });
196
+ const text = await res.text();
197
+ let why = null;
198
+ try {
199
+ why = JSON.parse(text);
200
+ } catch {}
201
+ // A spend limit (402) or a job that waits for the person (409): say what was kept safe.
202
+ if (why && typeof why.message === 'string') {
203
+ setStatus({ ok: false, msg: why.message });
204
+ if (why.reason === 'needs-confirm' && why.approvalId)
205
+ setNeedsOk({ id: why.approvalId, estimate: why.estimate });
206
+ } else {
207
+ setStatus({ ok: false, msg: text });
208
+ }
194
209
  }
195
210
  } catch (err) {
196
211
  setBusy(false);
@@ -198,6 +213,25 @@ export default function GenerateDialog({ onClose, onInsert }) {
198
213
  }
199
214
  }
200
215
 
216
+ // The person's yes, from this window: the server only takes it from a browser page (it sends Origin).
217
+ async function approveAndGenerate() {
218
+ const ask = needsOk;
219
+ if (!ask) return;
220
+ try {
221
+ const r = await fetch('/_api/generate-jobs', {
222
+ method: 'POST',
223
+ headers: { 'content-type': 'application/json' },
224
+ body: JSON.stringify({ approve: ask.id }),
225
+ });
226
+ if (!r.ok) throw new Error('approval expired');
227
+ } catch {
228
+ setNeedsOk(null);
229
+ setStatus({ ok: false, msg: 'That approval expired. Press Generate to ask again.' });
230
+ return;
231
+ }
232
+ generate(ask.id);
233
+ }
234
+
201
235
  return (
202
236
  <div
203
237
  className="sh-scrim"
@@ -338,11 +372,22 @@ export default function GenerateDialog({ onClose, onInsert }) {
338
372
  </div>
339
373
  )}
340
374
  <div className="sh-dialog-row" style={{ justifyContent: 'flex-end', marginTop: 12 }}>
375
+ {needsOk && (
376
+ <button
377
+ type="button"
378
+ className="sh-btn"
379
+ disabled={busy}
380
+ onClick={approveAndGenerate}
381
+ data-testid="generate-approve"
382
+ >
383
+ Generate for about ${Number(needsOk.estimate).toFixed(2)}
384
+ </button>
385
+ )}
341
386
  <button
342
387
  type="button"
343
388
  className="sh-btn ai-gen-go"
344
389
  disabled={busy || !prompt.trim() || !provider}
345
- onClick={generate}
390
+ onClick={() => generate()}
346
391
  >
347
392
  <Icon name="sparkle" size={14} /> {busy ? 'Generating…' : 'Generate'}
348
393
  </button>
@@ -301,3 +301,10 @@ export const setCrashReporting = (enabled) => invoke('prefs_set_crash_reporting'
301
301
  export const getClaudeAutoSetup = () => invoke('prefs_get_claude_auto_setup');
302
302
  /** Set the opt-in state. Takes effect on the next sidecar spawn (app launch / project switch). */
303
303
  export const setClaudeAutoSetup = (enabled) => invoke('prefs_set_claude_auto_setup', { enabled });
304
+
305
+ // ── Tauri shell: the terminal may open projects in Maude (#206, DDR-250) ─────────
306
+ // Local-file-only, DEFAULT ON. Off: a terminal design run never opens a folder in Maude.
307
+ /** Current state (boolean). */
308
+ export const getTerminalOpens = () => invoke('prefs_get_terminal_opens');
309
+ /** Set it. Takes effect on the terminal's next request. */
310
+ export const setTerminalOpens = (enabled) => invoke('prefs_set_terminal_opens', { enabled });
@@ -0,0 +1,221 @@
1
+ // client/home/HomeAccountsRow.jsx — 2.1.1 B4 (artboard 14): "Accounts on this Mac", the row on top of
2
+ // Home. One card per account (a Maude Cloud account by its e-mail, your server by its host) with where
3
+ // the person is signed in and whether that sign-in works; a sign-in that stopped working (or is
4
+ // missing) is fixed from its own card — Maude Cloud through Home's own sign-in, your server through the
5
+ // team-server sign-in with the address already filled in. Cards come from `homeAccountCards`
6
+ // (home-accounts-model.js); a server that does not answer has no button (nothing for the person to fix).
7
+
8
+ import { useEffect, useRef, useState } from 'react';
9
+
10
+ import { AcctFace, StateWord } from './HomeConnection.jsx';
11
+ import {
12
+ hubSignInCancel,
13
+ hubSignInPoll,
14
+ hubSignInStart,
15
+ openTeamServerSignIn,
16
+ } from './home-api.js';
17
+ import { slugOf } from './home-accounts-model.js';
18
+ import { CONN_TONE } from './home-where-model.js';
19
+
20
+ const POLL_MS = 1200;
21
+ const SIGNIN_WORDS = {
22
+ unreachable: 'Couldn’t reach that server. Check the address, or whether it’s online.',
23
+ noBrowser: 'The browser didn’t open. Nothing changed — try again.',
24
+ refused: 'That sign-in page can’t be opened from here. Nothing changed.',
25
+ };
26
+
27
+ /**
28
+ * @param {{ cards: object[], native: boolean, onCloudSignIn: (card: object) => unknown,
29
+ * onAddCloud: () => void, onAddTeam: () => void, onChanged?: () => unknown,
30
+ * pollMs?: number }} props
31
+ */
32
+ export function HomeAccountsRow({
33
+ cards,
34
+ native,
35
+ onCloudSignIn,
36
+ onAddCloud,
37
+ onAddTeam,
38
+ onChanged,
39
+ pollMs = POLL_MS,
40
+ }) {
41
+ const [adding, setAdding] = useState(false);
42
+ const [busy, setBusy] = useState(null); // the card key whose sign-in waits on the browser
43
+ const [error, setError] = useState(null);
44
+ const attempt = useRef(null); // { id, stop }
45
+ const wrap = useRef(null);
46
+
47
+ // leaving Home (or a new attempt) ends the one that waits
48
+ useEffect(
49
+ () => () => {
50
+ const a = attempt.current;
51
+ attempt.current = null;
52
+ if (a) {
53
+ a.stop();
54
+ void hubSignInCancel(a.id);
55
+ }
56
+ },
57
+ []
58
+ );
59
+ useEffect(() => {
60
+ if (!adding) return undefined;
61
+ const onKey = (e) => e.key === 'Escape' && setAdding(false);
62
+ const onDown = (e) => wrap.current && !wrap.current.contains(e.target) && setAdding(false);
63
+ window.addEventListener('keydown', onKey);
64
+ window.addEventListener('pointerdown', onDown);
65
+ return () => {
66
+ window.removeEventListener('keydown', onKey);
67
+ window.removeEventListener('pointerdown', onDown);
68
+ };
69
+ }, [adding]);
70
+
71
+ if (!cards.length && !native) return null;
72
+
73
+ const waitForBrowser = (id) =>
74
+ new Promise((resolve) => {
75
+ let timer = null;
76
+ const stop = () => {
77
+ clearTimeout(timer);
78
+ resolve({ ok: false, cancelled: true });
79
+ };
80
+ attempt.current = { id, stop };
81
+ const tick = async () => {
82
+ const p = await hubSignInPoll(id);
83
+ if (attempt.current?.id !== id) return;
84
+ if (p.json?.pending) {
85
+ timer = setTimeout(tick, pollMs);
86
+ return;
87
+ }
88
+ attempt.current = null;
89
+ resolve(
90
+ p.ok && p.json?.ok
91
+ ? { ok: true }
92
+ : { ok: false, error: p.json?.error || SIGNIN_WORDS.unreachable }
93
+ );
94
+ };
95
+ timer = setTimeout(tick, 0);
96
+ });
97
+
98
+ const fixServer = async (card) => {
99
+ setError(null);
100
+ setBusy(card.key);
101
+ const s = await hubSignInStart(card.fix.profile, card.fix.url);
102
+ if (!s.ok || !s.json?.ok) {
103
+ setBusy(null);
104
+ setError(s.json?.error || SIGNIN_WORDS.unreachable);
105
+ return;
106
+ }
107
+ const id = s.json.id;
108
+ const opened = await openTeamServerSignIn(s.json.signInUrl);
109
+ if (opened !== 'ok') {
110
+ void hubSignInCancel(id);
111
+ setBusy(null);
112
+ setError(opened === 'refused' ? SIGNIN_WORDS.refused : SIGNIN_WORDS.noBrowser);
113
+ return;
114
+ }
115
+ const done = await waitForBrowser(id);
116
+ setBusy(null);
117
+ if (done.cancelled) return;
118
+ if (!done.ok) {
119
+ setError(done.error);
120
+ return;
121
+ }
122
+ await onChanged?.();
123
+ };
124
+
125
+ const fix = (card) => (card.fix.path === 'cloud-signin' ? onCloudSignIn(card) : fixServer(card));
126
+
127
+ return (
128
+ <section
129
+ className="home-sec home-acr"
130
+ aria-labelledby="home-h-accounts"
131
+ data-testid="home-accounts-row"
132
+ >
133
+ <h2 className="home-h" id="home-h-accounts">
134
+ Accounts on this Mac
135
+ {native ? (
136
+ <span className="home-h-right home-acr-add" ref={wrap}>
137
+ <button
138
+ type="button"
139
+ className="btn btn--ghost btn--sm"
140
+ data-testid="home-accounts-row-add"
141
+ aria-haspopup="menu"
142
+ aria-expanded={adding}
143
+ onClick={() => setAdding((o) => !o)}
144
+ >
145
+ Add an account…
146
+ </button>
147
+ {adding ? (
148
+ <span className="island home-acr-menu" role="menu">
149
+ <button
150
+ type="button"
151
+ role="menuitem"
152
+ className="row-item"
153
+ data-testid="home-accounts-row-add-cloud"
154
+ onClick={() => {
155
+ setAdding(false);
156
+ onAddCloud?.();
157
+ }}
158
+ >
159
+ Add a Maude Cloud account…
160
+ </button>
161
+ <button
162
+ type="button"
163
+ role="menuitem"
164
+ className="row-item"
165
+ data-testid="home-accounts-row-add-team"
166
+ onClick={() => {
167
+ setAdding(false);
168
+ onAddTeam?.();
169
+ }}
170
+ >
171
+ Connect to a team server…
172
+ </button>
173
+ </span>
174
+ ) : null}
175
+ </span>
176
+ ) : null}
177
+ </h2>
178
+ <div className="home-acr-cards">
179
+ {cards.map((c) => {
180
+ const id = slugOf(c);
181
+ const bad = c.state === 'rejected' || c.state === 'missing';
182
+ return (
183
+ <span
184
+ key={c.key}
185
+ className={`home-acc${bad ? ' home-acc--bad' : ''}`}
186
+ data-kind={c.kind}
187
+ data-state={c.state}
188
+ data-testid={`home-account-card-${id}`}
189
+ >
190
+ <AcctFace face={c.face} state={c.state} size="lg" />
191
+ <span className="home-acc-t">
192
+ <strong>{c.title}</strong>
193
+ <span>{c.sub}</span>
194
+ <StateWord tone={CONN_TONE[c.state]} testid={`home-account-state-${id}`}>
195
+ {c.word}
196
+ </StateWord>
197
+ </span>
198
+ {c.fix ? (
199
+ <button
200
+ type="button"
201
+ className="btn btn--primary btn--sm"
202
+ data-testid={`home-account-signin-${id}`}
203
+ disabled={!native || busy === c.key}
204
+ title={native ? undefined : 'Sign in from the Maude app on your Mac.'}
205
+ onClick={() => fix(c)}
206
+ >
207
+ {busy === c.key ? 'Waiting for the browser…' : c.fix.label}
208
+ </button>
209
+ ) : null}
210
+ </span>
211
+ );
212
+ })}
213
+ </div>
214
+ {error ? (
215
+ <p className="home-acct-note" role="alert" data-testid="home-accounts-row-error">
216
+ {error}
217
+ </p>
218
+ ) : null}
219
+ </section>
220
+ );
221
+ }