@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
@@ -650,10 +650,12 @@ export function stickyEditNext(
650
650
  text: string,
651
651
  fmt: EditorFmt | undefined,
652
652
  measuredH: number | undefined,
653
- baseText: string = existing.text
653
+ baseText: string = existing.text,
654
+ /** #113 — a checklist's entries: the card keeps room for them under its title. */
655
+ items?: ReadonlyArray<{ text?: unknown }>
654
656
  ): StickyStroke | null {
655
657
  if (baseText === text && existing.text === text && fmtEqual(existing, fmt)) return null;
656
- const fit = fitSticky({ w: existing.w, h: existing.h, fontSize: existing.fontSize }, text);
658
+ const fit = fitSticky({ w: existing.w, h: existing.h, fontSize: existing.fontSize }, text, items);
657
659
  const sized =
658
660
  fit.w !== Math.abs(existing.w) ||
659
661
  fit.h !== Math.abs(existing.h) ||
@@ -29,11 +29,13 @@ import {
29
29
  type Op as AnnotationOp,
30
30
  type ApplyResult,
31
31
  applyOps as applyAnnotationOpsPure,
32
+ cleanGestureLabel,
32
33
  diffToOps,
33
34
  } from './annotations/ops.ts';
34
35
  import './annotations/ops-merge.ts';
35
36
  import { runTagOf } from './annotations/run-tag.ts';
36
37
  import { parseBoard, serializeBoard } from './annotations/schema.ts';
38
+ import { mergedTextSlots } from './annotations/text-steps.ts';
37
39
  import type { AnnotationElement } from './annotations/types.ts';
38
40
  import { type BoardGuard, voteDoorOnly } from './annotations/vote-guard.ts';
39
41
  import { createAssetMirror, s3ConfigFromEnv } from './assets-s3.ts';
@@ -109,6 +111,7 @@ import {
109
111
  type EditScope,
110
112
  editArrayElementString,
111
113
  editAttribute,
114
+ ensureStamped,
112
115
  enumerateClips,
113
116
  type InsertKind,
114
117
  insertArtboard,
@@ -151,6 +154,7 @@ import {
151
154
  sanitizeReuseText,
152
155
  } from './generation/audio-library.ts';
153
156
  import { createHistory } from './history.ts';
157
+ import { moduleOwningId, moduleRefusal } from './imported-module-ids.ts';
154
158
  import { pidOf, projectDir } from './index/snapshot.ts';
155
159
  import {
156
160
  CANVAS_INDEX_SEED_DEBOUNCE_MS,
@@ -738,6 +742,12 @@ export interface Api {
738
742
  /** sec-a M1 — refuse the WHOLE batch when the guard names a change (HTTP writers pass
739
743
  * `voteDoorOnly`; the in-process vote door passes none). `refused` in the result. */
740
744
  guard?: BoardGuard;
745
+ /**
746
+ * T7.3b (#113) — the gesture in words the canvas said ("Ticked “Write the post”"): untrusted,
747
+ * cleaned here; the row (and the ⌘Z toast) reads it in place of "Edit annotations". A
748
+ * run-tagged batch never carries it — the run names its own action.
749
+ */
750
+ label?: unknown;
741
751
  }
742
752
  ): Promise<AnnotationOpsResult>;
743
753
  /** Materialize a document snapshot without publishing it as another user edit. */
@@ -1144,13 +1154,18 @@ export interface ApiHooks {
1144
1154
  * base for accepted revisions). `recordedWithLanes`: the caller sends this board to the op log in the
1145
1155
  * same action as another lane (`proposer.send(lanes)` — the artboard move rider, a conversion), so the
1146
1156
  * hook must not record it a second time as a stroke of its own; the room bridge still runs.
1157
+ * `contested` (T5.2, #165): ids whose text this write merged 3-way against a collaborator's change —
1158
+ * the disk path's half of the room's contest (annotations/text-steps.ts); the home refuses its ⌘Z.
1147
1159
  */
1148
1160
  onAnnotationsChanged?: (
1149
1161
  file: string,
1150
1162
  text: string,
1151
1163
  writeId?: string,
1152
1164
  base?: string,
1153
- recordedWithLanes?: boolean
1165
+ recordedWithLanes?: boolean,
1166
+ contested?: readonly string[],
1167
+ /** T7.3b (#113) — the person's op batch said what gesture it was ("Ticked …"; cleaned). */
1168
+ label?: string
1154
1169
  ) => void;
1155
1170
  /**
1156
1171
  * Apply an op batch to the canvas's LIVE collab room, when one holds the
@@ -1164,7 +1179,9 @@ export interface ApiHooks {
1164
1179
  ops: readonly AnnotationOp[],
1165
1180
  actionId?: string,
1166
1181
  /** sec-a M1 — checked against the ROOM's before/after; a hit writes nothing (`'refused'`). */
1167
- guard?: BoardGuard
1182
+ guard?: BoardGuard,
1183
+ /** T7.3b — the gesture in words, for the room's projection (`takeFlushLabel`). */
1184
+ label?: string
1168
1185
  ) => ApplyResult | 'too-large' | 'refused' | null;
1169
1186
  /**
1170
1187
  * Accepted-revisions mode (DDR-241): propose a folder operation as ONE
@@ -2972,7 +2989,11 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
2972
2989
  }
2973
2990
 
2974
2991
  async function writeBoardFile(file: string, text: string): Promise<void> {
2975
- await Bun.write(annotationsPath(file), text);
2992
+ const abs = annotationsPath(file);
2993
+ await Bun.write(abs, text);
2994
+ // #164 N3 — the person's bytes, noted as soon as they are on disk (as a layout save is): the end of
2995
+ // a call that wrote without naming files must not take them for the AI. Only a person's save is noted.
2996
+ saveHold().notePersonWrite(abs, text);
2976
2997
  // Annotations reach OTHER VIEWERS over the collab room, but the file is also
2977
2998
  // a versioned, file-plane sidecar (DDR-115), and the file plane learns about
2978
2999
  // a cell's own writes through exactly this event.
@@ -3043,10 +3064,12 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
3043
3064
  file: string,
3044
3065
  ops: readonly AnnotationOp[],
3045
3066
  actionId?: string,
3046
- opts?: { hooks?: boolean; guard?: BoardGuard }
3067
+ opts?: { hooks?: boolean; guard?: BoardGuard; label?: unknown }
3047
3068
  ): Promise<AnnotationOpsResult> {
3048
3069
  const withHooks = opts?.hooks !== false;
3049
3070
  const guard = opts?.guard;
3071
+ // T7.3b — a person's gesture in words; a run's batch is named by its run, never by the canvas.
3072
+ const label = runTagOf(actionId) === null ? cleanGestureLabel(opts?.label) : undefined;
3050
3073
  const refusedResult = (id: string): AnnotationOpsResult => ({
3051
3074
  ok: false,
3052
3075
  changed: false,
@@ -3068,7 +3091,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
3068
3091
  // stage, and ⌘Z / "Undo this chat" would miss it (contract S4-S5-ai-annotations §2; S4.20).
3069
3092
  const live =
3070
3093
  withHooks && runTagOf(actionId) === null
3071
- ? (hooks.applyAnnotationOpsLive?.(file, ops, actionId, guard) ?? null)
3094
+ ? (hooks.applyAnnotationOpsLive?.(file, ops, actionId, guard, label) ?? null)
3072
3095
  : null;
3073
3096
  if (live === 'refused') return refusedResult('?');
3074
3097
  if (live === 'too-large') {
@@ -3093,7 +3116,19 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
3093
3116
  return { ok: false, changed: false, rejected, error: 'board exceeds the size cap' };
3094
3117
  }
3095
3118
  await writeBoardFile(file, text);
3096
- if (withHooks) onAnnotationsChanged?.(file, text, actionId, beforeText);
3119
+ if (withHooks) {
3120
+ // T5.2 (#165) — the room records the same contest for a batch it takes (collab/registry.ts).
3121
+ const contested = mergedTextSlots(beforeMap, ops);
3122
+ onAnnotationsChanged?.(
3123
+ file,
3124
+ text,
3125
+ actionId,
3126
+ beforeText,
3127
+ undefined,
3128
+ contested.length ? contested : undefined,
3129
+ label
3130
+ );
3131
+ }
3097
3132
  return { ok: true, changed: true, rejected };
3098
3133
  });
3099
3134
  });
@@ -5720,6 +5755,16 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5720
5755
  return { ok: false, status: 500, error: err instanceof Error ? err.message : 'move failed' };
5721
5756
  }
5722
5757
 
5758
+ // The FOLDER moved: say so once, here, whether or not a canvas lives inside. The per-canvas
5759
+ // `moved` announcements below are no stand-in — an EMPTY folder has none, and the tree (served
5760
+ // from the index cache) reloads the moment this write answers, ahead of the file watcher. The
5761
+ // same shape as `mkdir` / `removed-folder`: no `rel`, so the canvas-list watchers ignore it.
5762
+ ctx.bus.emit('canvas-list-update', {
5763
+ action: 'moved-folder',
5764
+ dir: toRelDir,
5765
+ fromDir: relDir,
5766
+ });
5767
+
5723
5768
  const moved: string[] = [path.relative(paths.repoRoot, toDirFinalAbs)];
5724
5769
  const locatorAbs = path.join(paths.designRoot, '_locator.json');
5725
5770
  for (const fromRel of canvasRels) {
@@ -6052,7 +6097,11 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
6052
6097
  async function lockedTarget(
6053
6098
  abs: string,
6054
6099
  targets: ReadonlyArray<string | { id: string; occurrence?: number }>
6055
- ): Promise<{ ok: false; status: 409; error: string; code: 'locked' } | null> {
6100
+ ): Promise<
6101
+ | { ok: false; status: 409; error: string; code: 'locked' }
6102
+ | { ok: false; status: 422; error: string }
6103
+ | null
6104
+ > {
6056
6105
  let source: string;
6057
6106
  try {
6058
6107
  source = await Bun.file(abs).text();
@@ -6064,6 +6113,15 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
6064
6113
  const ids: string[] = [];
6065
6114
  for (const t of targets) {
6066
6115
  const { id, occurrence } = typeof t === 'string' ? { id: t, occurrence: undefined } : t;
6116
+ // #151 T2.3b — an id the canvas file does not hold may be an element of a module it imports:
6117
+ // selectable and commentable, edit-read-only. Say which file instead of "not found in <path>".
6118
+ try {
6119
+ ensureStamped(abs, source, id);
6120
+ } catch (e) {
6121
+ const module =
6122
+ e instanceof CanvasEditError ? moduleOwningId(abs, paths.designRoot, id) : null;
6123
+ if (module) return { ok: false, status: 422, error: moduleRefusal(module) };
6124
+ }
6067
6125
  ids.push(id);
6068
6126
  if (typeof occurrence === 'number') {
6069
6127
  const usage = usageIdOf(abs, source, id, occurrence);
@@ -6076,6 +6134,35 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
6076
6134
  : null;
6077
6135
  }
6078
6136
 
6137
+ /**
6138
+ * #170 — the same lock lookup for the LEGACY artboard and clip routes (resize / set-artboard-* / delete-artboard,
6139
+ * the *-sequence routes, toggle-hide): the 409 `locked` for a named artboard that carries the shared lock
6140
+ * (`data-cd-locked` on its `DCArtboard`), else null. The dispatcher already refuses artboard-wide ops there; these
6141
+ * routes never asked. An artboard that is not named (the legacy whole-file index path) is not asked, as in the
6142
+ * dispatcher.
6143
+ */
6144
+ async function lockedBoard(
6145
+ abs: string,
6146
+ artboardId: string | undefined
6147
+ ): Promise<{ ok: false; status: 409; error: string; code: 'locked' } | null> {
6148
+ if (!artboardId) return null;
6149
+ let source: string;
6150
+ try {
6151
+ source = await Bun.file(abs).text();
6152
+ } catch {
6153
+ return null;
6154
+ }
6155
+ const walk = walkIdElements(source, abs);
6156
+ if (!walk.ok) return null;
6157
+ const board = walk.elements.find((x) => x.tag === 'DCArtboard' && x.artboard === artboardId);
6158
+ if (!board?.locked) return null;
6159
+ // the artboard may carry no data-cd-id: ask the lookup under the artboard's own id
6160
+ const lock = lockedRefusal([{ ...board, id: artboardId }], [artboardId]);
6161
+ return lock && lock.code === 'locked'
6162
+ ? { ok: false, status: 409, error: lock.message, code: 'locked' }
6163
+ : null;
6164
+ }
6165
+
6079
6166
  async function editCss(input: {
6080
6167
  canvas?: unknown;
6081
6168
  id?: unknown;
@@ -6467,6 +6554,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
6467
6554
  if (patch.durationInFrames == null && patch.from == null) {
6468
6555
  return { ok: false, status: 400, error: 'nothing to retime' };
6469
6556
  }
6557
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
6558
+ if (lockedBoardAnswer) return lockedBoardAnswer;
6470
6559
  const rel = path.relative(paths.designRoot, r.abs);
6471
6560
  ctx.bus.emit('activity:suppress', rel);
6472
6561
  try {
@@ -6513,6 +6602,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
6513
6602
  if (!stableId) return { ok: false, status: 400, error: 'stableId required' };
6514
6603
  const artboardId = typeof input.artboardId === 'string' ? input.artboardId : undefined;
6515
6604
  const contentHash = typeof input.contentHash === 'string' ? input.contentHash : undefined;
6605
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
6606
+ if (lockedBoardAnswer) return lockedBoardAnswer;
6516
6607
  const rel = path.relative(paths.designRoot, r.abs);
6517
6608
  ctx.bus.emit('activity:suppress', rel);
6518
6609
  try {
@@ -6582,6 +6673,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
6582
6673
  ph && typeof ph === 'object' && typeof ph.prompt === 'string'
6583
6674
  ? { prompt: ph.prompt, kind: typeof ph.kind === 'string' ? ph.kind : 'veo' }
6584
6675
  : null;
6676
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
6677
+ if (lockedBoardAnswer) return lockedBoardAnswer;
6585
6678
  const rel = path.relative(paths.designRoot, r.abs);
6586
6679
  ctx.bus.emit('activity:suppress', rel);
6587
6680
  try {
@@ -7061,7 +7154,11 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7061
7154
  ctx.bus.emit('activity:unsuppress', rel);
7062
7155
  return { ok: false, status: 413, error: 'canvas source too large to grow' };
7063
7156
  }
7064
- const res = await insertArtboard(r.abs, { id, label, width, height });
7157
+ // #164 B4 — the op says its bytes like delete/insert-element: the person's edit, or (inside an AI
7158
+ // route's write claim) the run's, never an `outside` change the watcher had to guess
7159
+ const res = await sayingWrites(before, 'Added an artboard', () =>
7160
+ insertArtboard(r.abs, { id, label, width, height })
7161
+ );
7065
7162
  const after = await Bun.file(r.abs).text();
7066
7163
  if (after === before) {
7067
7164
  ctx.bus.emit('activity:unsuppress', rel);
@@ -7072,7 +7169,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7072
7169
  } catch {
7073
7170
  /* snapshot best-effort */
7074
7171
  }
7075
- return { ok: true, artboardId: res.artboardId, seq: logUndo(r.abs, before, after) };
7172
+ const seq = logUndo(r.abs, before, after);
7173
+ noteSourceWritten(rel, after, 'Added an artboard');
7174
+ return { ok: true, artboardId: res.artboardId, seq };
7076
7175
  } catch (err) {
7077
7176
  ctx.bus.emit('activity:unsuppress', rel);
7078
7177
  return {
@@ -7157,6 +7256,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7157
7256
  if (width == null && height == null) {
7158
7257
  return { ok: false, status: 400, error: 'width or height required' };
7159
7258
  }
7259
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7260
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7160
7261
  const rel = path.relative(paths.designRoot, r.abs);
7161
7262
  ctx.bus.emit('activity:suppress', rel);
7162
7263
  try {
@@ -7210,6 +7311,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7210
7311
  const freezeHeight = Number.isFinite(Number(input.freezeHeight))
7211
7312
  ? Math.max(64, Math.min(8192, Math.round(Number(input.freezeHeight))))
7212
7313
  : undefined;
7314
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7315
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7213
7316
  const rel = path.relative(paths.designRoot, r.abs);
7214
7317
  ctx.bus.emit('activity:suppress', rel);
7215
7318
  try {
@@ -7265,6 +7368,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7265
7368
  } else {
7266
7369
  return { ok: false, status: 400, error: 'invalid kind' };
7267
7370
  }
7371
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7372
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7268
7373
  const rel = path.relative(paths.designRoot, r.abs);
7269
7374
  ctx.bus.emit('activity:suppress', rel);
7270
7375
  try {
@@ -7309,12 +7414,17 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7309
7414
  return { ok: false, status: 400, error: 'name is required' };
7310
7415
  }
7311
7416
  const label = input.label;
7417
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7418
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7312
7419
  const rel = path.relative(paths.designRoot, r.abs);
7313
7420
  ctx.bus.emit('activity:suppress', rel);
7314
7421
  try {
7315
7422
  const before = await Bun.file(r.abs).text();
7316
7423
  announceOp(r.abs, rel, before, { kind: 'artboard', fn: 'label', artboardId, args: [label] });
7317
- await setArtboardLabel(r.abs, artboardId, label);
7424
+ // #164 B4 — says its bytes (see insertArtboardOp)
7425
+ await sayingWrites(before, 'Renamed an artboard', () =>
7426
+ setArtboardLabel(r.abs, artboardId, label)
7427
+ );
7318
7428
  const after = await Bun.file(r.abs).text();
7319
7429
  if (after === before) {
7320
7430
  ctx.bus.emit('activity:unsuppress', rel);
@@ -7325,7 +7435,9 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7325
7435
  } catch {
7326
7436
  /* snapshot best-effort */
7327
7437
  }
7328
- return { ok: true, seq: logUndo(r.abs, before, after) };
7438
+ const seq = logUndo(r.abs, before, after);
7439
+ noteSourceWritten(rel, after, 'Renamed an artboard');
7440
+ return { ok: true, seq };
7329
7441
  } catch (err) {
7330
7442
  ctx.bus.emit('activity:unsuppress', rel);
7331
7443
  return {
@@ -7365,6 +7477,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7365
7477
  } else {
7366
7478
  return { ok: false, status: 400, error: 'invalid guides' };
7367
7479
  }
7480
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7481
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7368
7482
  const rel = path.relative(paths.designRoot, r.abs);
7369
7483
  ctx.bus.emit('activity:suppress', rel);
7370
7484
  try {
@@ -7454,6 +7568,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7454
7568
  } else {
7455
7569
  return { ok: false, status: 400, error: 'invalid print' };
7456
7570
  }
7571
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7572
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7457
7573
  const rel = path.relative(paths.designRoot, r.abs);
7458
7574
  ctx.bus.emit('activity:suppress', rel);
7459
7575
  try {
@@ -7547,6 +7663,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7547
7663
  if (Object.keys(patch).length === 0) {
7548
7664
  return { ok: false, status: 400, error: 'no style props given' };
7549
7665
  }
7666
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7667
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7550
7668
  const rel = path.relative(paths.designRoot, r.abs);
7551
7669
  ctx.bus.emit('activity:suppress', rel);
7552
7670
  try {
@@ -7639,6 +7757,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7639
7757
  if (!/^[A-Za-z][\w-]{0,63}$/.test(artboardId)) {
7640
7758
  return { ok: false, status: 400, error: 'invalid artboard id' };
7641
7759
  }
7760
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7761
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7642
7762
  const rel = path.relative(paths.designRoot, r.abs);
7643
7763
  ctx.bus.emit('activity:suppress', rel);
7644
7764
  try {
@@ -7743,6 +7863,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7743
7863
  if (!stableId) return { ok: false, status: 400, error: 'stableId required' };
7744
7864
  const artboardId = typeof input.artboardId === 'string' ? input.artboardId : undefined;
7745
7865
  const contentHash = typeof input.contentHash === 'string' ? input.contentHash : undefined;
7866
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7867
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7746
7868
  const rel = path.relative(paths.designRoot, r.abs);
7747
7869
  ctx.bus.emit('activity:suppress', rel);
7748
7870
  try {
@@ -7789,13 +7911,18 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7789
7911
  ctx.bus.emit('activity:suppress', rel);
7790
7912
  try {
7791
7913
  const before = await Bun.file(r.abs).text();
7792
- await editArrayElementString(r.abs, arrayName, index, field, value);
7914
+ // #164 B4 — says its bytes (see insertArtboardOp)
7915
+ await sayingWrites(before, 'Replaced media', () =>
7916
+ editArrayElementString(r.abs, arrayName, index, field, value)
7917
+ );
7793
7918
  const after = await Bun.file(r.abs).text();
7794
7919
  if (after === before) {
7795
7920
  ctx.bus.emit('activity:unsuppress', rel);
7796
7921
  return { ok: true };
7797
7922
  }
7798
- return { ok: true, seq: logUndo(r.abs, before, after) };
7923
+ const seq = logUndo(r.abs, before, after);
7924
+ noteSourceWritten(rel, after, 'Replaced media');
7925
+ return { ok: true, seq };
7799
7926
  } catch (err) {
7800
7927
  ctx.bus.emit('activity:unsuppress', rel);
7801
7928
  return {
@@ -7833,6 +7960,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7833
7960
  const contentHash = typeof input.contentHash === 'string' ? input.contentHash : undefined;
7834
7961
  const refContentHash =
7835
7962
  typeof input.refContentHash === 'string' ? input.refContentHash : undefined;
7963
+ const lockedBoardAnswer = await lockedBoard(r.abs, artboardId || undefined);
7964
+ if (lockedBoardAnswer) return lockedBoardAnswer;
7836
7965
  const rel = path.relative(paths.designRoot, r.abs);
7837
7966
  ctx.bus.emit('activity:suppress', rel);
7838
7967
  try {
@@ -8334,14 +8463,12 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
8334
8463
  // These are non-HTML so they're listed but not openable in the iframe; the
8335
8464
  // sidebar can still display them as context (mirrors CV-08 mock).
8336
8465
  const projectFiles: string[] = [];
8337
- {
8338
- for (const e of rootEntries) {
8339
- if (!e.isFile()) continue;
8340
- if (e.name.startsWith('_')) continue;
8341
- if (e.name.startsWith('.')) continue;
8342
- if (!/\.(md|json|txt|yml|yaml|css)$/i.test(e.name)) continue;
8343
- projectFiles.push(path.posix.join(paths.designRel, e.name));
8344
- }
8466
+ for (const e of rootEntries) {
8467
+ if (!e.isFile()) continue;
8468
+ if (e.name.startsWith('_')) continue;
8469
+ if (e.name.startsWith('.')) continue;
8470
+ if (!/\.(md|json|txt|yml|yaml|css)$/i.test(e.name)) continue;
8471
+ projectFiles.push(path.posix.join(paths.designRel, e.name));
8345
8472
  }
8346
8473
  if (projectFiles.length) {
8347
8474
  head.push({
@@ -49,12 +49,30 @@ import {
49
49
  ARTBOARD_STILL_CSS,
50
50
  inOverviewCut,
51
51
  resolveStillMode,
52
+ STILL_ENCODED_MAX_BYTES,
53
+ type StillCache,
52
54
  StillController,
53
55
  } from './artboard-still.ts';
56
+ import { startStillPersist } from './artboard-still-persist.ts';
54
57
  import { rasterTimings, startStill } from './artboard-still-raster.ts';
55
58
  import { StillWarmup, WARM_ENABLED } from './artboard-still-warmup.ts';
56
59
  import { WebglBudget } from './artboard-webgl.ts';
57
60
  import { frameFreezeApi, frameFrozen, frameRaf, onFrameFreeze } from './frame-clock.ts';
61
+ import { IS_RELEASE_BUILD } from './release-build.ts';
62
+
63
+ /** The still runtime's window globals (tests and measurements read them). */
64
+ export const STILL_DIAGNOSTICS = Object.freeze([
65
+ '__maudeStillStats',
66
+ '__maudeStillCache',
67
+ '__maudeStillHistory',
68
+ '__maudeStillJobs',
69
+ '__maudeStillWarm',
70
+ ]);
71
+ /**
72
+ * #212 §5 — a release build puts none of them on the window: they hand the still cache to any code on the canvas
73
+ * origin, a sibling frame included. The canvas build learns it is a release one from `canvasDefines` (release-build.ts).
74
+ */
75
+ export const stillDiagnosticsOn = (release: boolean = IS_RELEASE_BUILD): boolean => !release;
58
76
 
59
77
  const ALL_LIVE: ArtboardLiveState = { live: true, seen: true, media: true };
60
78
  const LiveContext = createContext<ArtboardLiveState>(ALL_LIVE);
@@ -254,9 +272,17 @@ function getRuntime(): Runtime | null {
254
272
  // 2.0.7 — no mid-gesture wait for artboards under the cut (decision v2-207-drop-undercut-midgesture-wait): in Safari
255
273
  // the wait alone put the 10 % sweep's tail over base (p99 ~80 -> ~120 ms, worst second 52 -> 31 frames), since the
256
274
  // waiting artboards stayed on screen as placeholders through the pan; the ring's mid-gesture hold stays
275
+ // #169 T8.1b (decision A) — what waits is narrower: mid-ZOOM, an artboard that HAS a kept still (its placeholder
276
+ // shows it) mounts at the settle, so still → live never happens mid-zoom. No still, or a pan: it mounts as before.
277
+ registry.setMayWait((id) => st.holdsForSettle(id));
257
278
  stills = st;
258
- const w = window as unknown as Record<string, unknown>;
279
+ // #212 §5 — the stills persist across sessions, through the shell (it picks the key; the frame only offers)
280
+ startStillPersist(st);
281
+ // a release build keeps them off the window (stillDiagnosticsOn); tests and measurements run from source
282
+ const w = (stillDiagnosticsOn() ? window : {}) as unknown as Record<string, unknown>;
259
283
  w.__maudeStillStats = () => ({ ...st.stats(), raster: { ...rasterTimings } });
284
+ // the two-tier cache (#212): tests and measurements read its tiers
285
+ w.__maudeStillCache = () => st.cache;
260
286
  // the views each artboard went through (the flicker count of the overview level)
261
287
  w.__maudeStillHistory = (id?: string) => st.history(id);
262
288
  // the last drawings: slices, the longest one, when the walk / the decode / the drawing ended
@@ -324,9 +350,10 @@ function startWarmup(
324
350
  now() - registry.lastMountAt() >= WARM_RING_QUIET_MS,
325
351
  lastActivity: () => st.lastActivity(),
326
352
  cacheRoom: () => {
353
+ // the encoded tier is what keeps a still (the decoded one only evicts to it): warm while it has room
327
354
  const c = st.cache.stats();
328
- const each = c.n ? c.bytes / c.n : 0;
329
- return c.bytes + 2 * each <= st.cache.max;
355
+ const each = c.encoded ? c.encodedBytes / c.encoded : 0;
356
+ return c.encodedBytes + 2 * each <= STILL_ENCODED_MAX_BYTES;
330
357
  },
331
358
  });
332
359
  st.onStill((id, ok) => wu.stillDone(id, ok));
@@ -587,7 +614,7 @@ export function ArtboardLiveGate({
587
614
  backgroundColor: ph.bg || undefined,
588
615
  }}
589
616
  >
590
- {kept ? <StillCopy still={kept.el} /> : null}
617
+ {kept && stills ? <StillHold cache={stills.cache} id={id} /> : null}
591
618
  {pic?.blocks.map((b, i) => (
592
619
  <i
593
620
  // biome-ignore lint/suspicious/noArrayIndexKey: a still picture; its blocks never reorder
@@ -607,19 +634,29 @@ export function ArtboardLiveGate({
607
634
  );
608
635
  }
609
636
 
610
- /** A copy of a kept still (the cache's own canvas stays the cache's): drawn once, on mount. */
611
- function StillCopy({ still }: { still: HTMLElement }) {
637
+ /**
638
+ * A released artboard's placeholder holds the cache's OWN still element (#212 — it used to draw a second canvas,
639
+ * which doubled the memory and was outside the budget); the controller takes it back on a remount. When the decoded
640
+ * tier lets go of the bitmap it shows the encoded copy instead, so a known still is never replaced by the skeleton.
641
+ */
642
+ function StillHold({ cache, id }: { cache: StillCache; id: string }) {
643
+ const [, bump] = useState(0);
644
+ const anchor = useRef<HTMLSpanElement>(null);
645
+ const kept = cache.peek(id);
646
+ useEffect(() => cache.onEvict((k) => k === id && bump((n) => n + 1)), [cache, id]);
647
+ // every render: the element may have been taken (a remount) or may be new (a redraw)
648
+ useLayoutEffect(() => {
649
+ const el = kept?.el;
650
+ const a = anchor.current;
651
+ if (!el || !a || el.parentNode === a) return;
652
+ el.classList?.add('dc-artboard-still-copy');
653
+ a.appendChild(el);
654
+ });
655
+ const url = kept && !kept.el ? cache.blobUrl(id) : null;
612
656
  return (
613
- <canvas
614
- className="dc-artboard-still-copy"
615
- ref={(c) => {
616
- const src = still as HTMLCanvasElement;
617
- if (!c || !src.width || c.width === src.width) return;
618
- c.width = src.width;
619
- c.height = src.height;
620
- c.getContext('2d')?.drawImage(src, 0, 0);
621
- }}
622
- />
657
+ <span ref={anchor} style={{ display: 'contents' }}>
658
+ {url ? <img className="dc-artboard-still-copy" src={url} alt="" draggable={false} /> : null}
659
+ </span>
623
660
  );
624
661
  }
625
662
 
@@ -632,5 +669,5 @@ html[data-dc-crowded] .dc-canvas .dc-artboard { will-change: auto; }
632
669
  .dc-artboard-sleeping { width: 100%; position: relative; overflow: hidden; }
633
670
  .dc-artboard-sleeping > i { position: absolute; display: block; opacity: 0.45; border-radius: 2px; }
634
671
  .dc-artboard-sleeping > i[data-media] { background: color-mix(in srgb, currentColor 16%, transparent); }
635
- .dc-artboard-sleeping > .dc-artboard-still-copy { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
672
+ .dc-artboard-sleeping .dc-artboard-still-copy { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
636
673
  `;