@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
@@ -0,0 +1,374 @@
1
+ // capture-prepass.ts — issue #150 §2 + §3: two things @remotion/web-renderer gets
2
+ // wrong that the browser gets right, fixed in the capture page for the length of
3
+ // one render (same install / restore shape as svg-inline.ts, so the library stays
4
+ // unpatched — no per-workspace patchedDependencies entry, DDR-176 — and a
5
+ // renderer upgrade that fixes either one itself just makes the guard a no-op).
6
+ //
7
+ // §2 An `<img>` of an SVG that has no size of its own (`width="100%"`, or only a
8
+ // `viewBox` — what Affinity / Illustrator write) has no usable
9
+ // `naturalWidth`/`naturalHeight`. The renderer draws an image with
10
+ // `drawImage(img, 0, 0, naturalWidth, naturalHeight, …)`: with 0 that draws
11
+ // nothing (the report); with Chromium's 300 × 150 default-object-size
12
+ // stand-in (157 × 150 for a 684 × 652 viewBox) it draws the TOP-LEFT part of
13
+ // the picture, scaled up (measured live) — because a size-less SVG that is
14
+ // the source of `drawImage` is rasterized at the size of the CANVAS it is
15
+ // drawn into, not at its natural size nor at its layout size. The guard
16
+ // reports the layout size where the browser reports 0, and rescales the
17
+ // source rectangle from the natural size to the real draw space.
18
+ //
19
+ // §3 `transform` (and `scale`, `rotate`, `filter`) makes a NON-positioned element
20
+ // the containing block of its `position: absolute` children. The renderer
21
+ // resets those properties on an element while it measures the element's
22
+ // subtree, so the children resolve against the next positioned ancestor — the
23
+ // whole frame — and jump out of the element. While an element in that state
24
+ // is read, it is pinned as `position: relative` (offsets `auto`, so nothing
25
+ // moves): a containing block that does not depend on the property the
26
+ // renderer is about to reset.
27
+ //
28
+ // Browser-safe and React-free; imported by `video-render-lib.ts` (runs inside the
29
+ // capture Chromium) and unit-tested under happy-dom.
30
+
31
+ // ---------------------------------------------------------------------------
32
+ // §2 — size-less SVG <img>
33
+ // ---------------------------------------------------------------------------
34
+
35
+ /** `12`, `12.5px`, `3em` … — a length, as opposed to `100%`, `auto` or nothing. */
36
+ const ABSOLUTE_LENGTH = /^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[a-z]{1,4})?\s*$/i;
37
+
38
+ function rootTag(text: string): string | null {
39
+ const m = /<svg(?=[\s>/])[^>]*>/i.exec(text.replace(/<!--[\s\S]*?-->/g, ''));
40
+ return m ? m[0] : null;
41
+ }
42
+
43
+ function rootAttr(tag: string, name: string): string | null {
44
+ const m = new RegExp(`\\s${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, 'i').exec(tag);
45
+ return m ? (m[1] ?? m[2] ?? '') : null;
46
+ }
47
+
48
+ /**
49
+ * Does this SVG document have NO size of its own? Reads the root start tag only.
50
+ * An SVG has natural dimensions when both `width` and `height` are lengths, or
51
+ * when one is and a `viewBox` supplies the ratio; anything else (`100%`, `auto`,
52
+ * absent) is sized by whoever embeds it. Not an SVG at all → false.
53
+ */
54
+ export function svgRootIsSizeless(text: string): boolean {
55
+ const tag = rootTag(text);
56
+ if (!tag) return false;
57
+ const w = rootAttr(tag, 'width');
58
+ const h = rootAttr(tag, 'height');
59
+ const hasW = w !== null && ABSOLUTE_LENGTH.test(w);
60
+ const hasH = h !== null && ABSOLUTE_LENGTH.test(h);
61
+ if (hasW && hasH) return false;
62
+ if ((hasW || hasH) && rootAttr(tag, 'viewBox') !== null) return false;
63
+ return true;
64
+ }
65
+
66
+ /** width / height of the root's `viewBox`, or null when there is none (or it is degenerate). */
67
+ export function svgViewBoxRatio(text: string): number | null {
68
+ const tag = rootTag(text);
69
+ const vb = tag ? rootAttr(tag, 'viewBox') : null;
70
+ if (vb === null) return null;
71
+ const n = vb
72
+ .trim()
73
+ .split(/[\s,]+/)
74
+ .map(Number);
75
+ return n.length === 4 && n[2] > 0 && n[3] > 0 && n.every(Number.isFinite) ? n[2] / n[3] : null;
76
+ }
77
+
78
+ /**
79
+ * The size Chromium rasterizes a size-less SVG at when it is the SOURCE of
80
+ * `drawImage`: the canvas it is drawn into, contain-fitted to the viewBox ratio
81
+ * (the whole canvas without a viewBox). Measured live (canvas 400 × 400, viewBox
82
+ * 684 × 652 → 400 × 381; canvas 640 × 360 → 378 × 360) — and it does NOT depend
83
+ * on how large the `<img>` is laid out, which is why the renderer's
84
+ * natural-size-based source rectangle crops the picture.
85
+ */
86
+ export function sizelessSvgDrawSpace(
87
+ canvas: { width: number; height: number },
88
+ ratio: number | null
89
+ ): { w: number; h: number } {
90
+ if (!ratio) return { w: canvas.width, h: canvas.height };
91
+ const byWidth = { w: canvas.width, h: canvas.width / ratio };
92
+ return byWidth.h <= canvas.height ? byWidth : { w: canvas.height * ratio, h: canvas.height };
93
+ }
94
+
95
+ function decodeSvgDataUrl(url: string): string | null {
96
+ const comma = url.indexOf(',');
97
+ if (comma < 0) return null;
98
+ const head = url.slice(0, comma);
99
+ const body = url.slice(comma + 1);
100
+ try {
101
+ return /;base64/i.test(head) ? atob(body) : decodeURIComponent(body);
102
+ } catch {
103
+ return null;
104
+ }
105
+ }
106
+
107
+ /** The SVG's source text, or null when it cannot be read (then the image is left alone). */
108
+ function readSvgText(url: string): string | null {
109
+ if (/^data:image\/svg\+xml/i.test(url)) return decodeSvgDataUrl(url);
110
+ try {
111
+ // Synchronous on purpose: the renderer asks for `naturalWidth` in the middle of a draw call
112
+ // and cannot await. Same-origin / blob / loopback only (the capture CSP's connect-src), once
113
+ // per URL (`infoCache`).
114
+ const xhr = new XMLHttpRequest();
115
+ xhr.open('GET', url, false);
116
+ xhr.send();
117
+ return xhr.status === 200 || (xhr.status === 0 && xhr.responseText) ? xhr.responseText : null;
118
+ } catch {
119
+ return null;
120
+ }
121
+ }
122
+
123
+ const SVG_URL = /\.svg(?:[?#]|$)|^data:image\/svg\+xml/i;
124
+
125
+ function layoutSize(img: HTMLImageElement, which: 'width' | 'height'): number {
126
+ // The content box: what the browser rasterizes an SVG image at. `clientWidth` is
127
+ // transform-independent (the renderer resets the transform anyway) and excludes borders.
128
+ const client = which === 'width' ? img.clientWidth : img.clientHeight;
129
+ if (!client) return 0;
130
+ let pad = 0;
131
+ try {
132
+ const cs = getComputedStyle(img);
133
+ pad =
134
+ which === 'width'
135
+ ? (Number.parseFloat(cs.paddingLeft) || 0) + (Number.parseFloat(cs.paddingRight) || 0)
136
+ : (Number.parseFloat(cs.paddingTop) || 0) + (Number.parseFloat(cs.paddingBottom) || 0);
137
+ } catch {
138
+ /* no computed style: padding is rare on an image */
139
+ }
140
+ return Math.max(0, client - pad);
141
+ }
142
+
143
+ type DrawImageFn = (this: unknown, image: unknown, ...rest: number[]) => void;
144
+
145
+ /**
146
+ * Make a size-less SVG `<img>` draw the way the browser shows it, for as long as
147
+ * the guard is installed:
148
+ * • `naturalWidth` / `naturalHeight` that the browser reports as 0 report the
149
+ * layout size instead (with 0 the renderer draws nothing at all);
150
+ * • the 9-argument `drawImage` the renderer issues has its SOURCE rectangle
151
+ * rescaled from the natural size it was computed from to the size the picture
152
+ * is really rasterized at (`sizelessSvgDrawSpace`), so the whole picture lands
153
+ * in the destination instead of its top-left corner.
154
+ * Every other image — a PNG, an SVG with a real size, one not laid out — answers
155
+ * and draws exactly as before. Returns the restore function; call it in a `finally`.
156
+ */
157
+ export function installSizelessSvgImageGuard(): () => void {
158
+ const proto = HTMLImageElement.prototype;
159
+ const widthDesc = Object.getOwnPropertyDescriptor(proto, 'naturalWidth');
160
+ const heightDesc = Object.getOwnPropertyDescriptor(proto, 'naturalHeight');
161
+ if (!widthDesc?.get || !heightDesc?.get) return () => {};
162
+ const realWidth = widthDesc.get;
163
+ const realHeight = heightDesc.get;
164
+ const infoCache = new Map<string, { sizeless: boolean; ratio: number | null }>();
165
+
166
+ const infoFor = (img: HTMLImageElement): { sizeless: boolean; ratio: number | null } | null => {
167
+ const url = img.currentSrc || img.src;
168
+ if (!url || !img.complete) return null;
169
+ let info = infoCache.get(url);
170
+ if (!info) {
171
+ info = { sizeless: false, ratio: null };
172
+ // A raster image is never asked: only SVG-looking URLs, or an image the browser itself
173
+ // reports as having no size at all.
174
+ if (SVG_URL.test(url) || realWidth.call(img) === 0) {
175
+ const text = readSvgText(url);
176
+ if (text !== null && svgRootIsSizeless(text)) {
177
+ info = { sizeless: true, ratio: svgViewBoxRatio(text) };
178
+ }
179
+ }
180
+ infoCache.set(url, info);
181
+ }
182
+ return info.sizeless ? info : null;
183
+ };
184
+
185
+ const natural = (img: HTMLImageElement, which: 'width' | 'height'): number => {
186
+ const real = (which === 'width' ? realWidth : realHeight).call(img) as number;
187
+ if (real > 0 || !infoFor(img)) return real;
188
+ const laid = layoutSize(img, which);
189
+ return laid > 0 ? laid : real;
190
+ };
191
+
192
+ Object.defineProperty(proto, 'naturalWidth', {
193
+ ...widthDesc,
194
+ get(this: HTMLImageElement) {
195
+ return natural(this, 'width');
196
+ },
197
+ });
198
+ Object.defineProperty(proto, 'naturalHeight', {
199
+ ...heightDesc,
200
+ get(this: HTMLImageElement) {
201
+ return natural(this, 'height');
202
+ },
203
+ });
204
+
205
+ const restores: Array<() => void> = [];
206
+ for (const name of ['CanvasRenderingContext2D', 'OffscreenCanvasRenderingContext2D']) {
207
+ const ctor = (globalThis as unknown as Record<string, { prototype: Record<string, unknown> }>)[
208
+ name
209
+ ];
210
+ const original = ctor?.prototype?.drawImage as DrawImageFn | undefined;
211
+ if (!original) continue;
212
+ ctor.prototype.drawImage = function guardedDrawImage(
213
+ this: { canvas?: { width: number; height: number } },
214
+ image: unknown,
215
+ ...rest: number[]
216
+ ) {
217
+ if (rest.length === 8 && image instanceof HTMLImageElement && this.canvas) {
218
+ const info = infoFor(image);
219
+ const nw = info ? natural(image, 'width') : 0;
220
+ const nh = info ? natural(image, 'height') : 0;
221
+ if (info && nw > 0 && nh > 0) {
222
+ const space = sizelessSvgDrawSpace(this.canvas, info.ratio);
223
+ const kx = space.w / nw;
224
+ const ky = space.h / nh;
225
+ const [sx, sy, sw, sh, ...dest] = rest;
226
+ return original.call(this, image, sx * kx, sy * ky, sw * kx, sh * ky, ...dest);
227
+ }
228
+ }
229
+ return original.call(this, image, ...rest);
230
+ };
231
+ restores.push(() => {
232
+ ctor.prototype.drawImage = original;
233
+ });
234
+ }
235
+
236
+ return () => {
237
+ for (const restore of restores) restore();
238
+ Object.defineProperty(proto, 'naturalWidth', widthDesc);
239
+ Object.defineProperty(proto, 'naturalHeight', heightDesc);
240
+ };
241
+ }
242
+
243
+ // ---------------------------------------------------------------------------
244
+ // §3 — transformed static parents with absolute children
245
+ // ---------------------------------------------------------------------------
246
+
247
+ /** Longhands the renderer resets on an element while it measures the subtree. */
248
+ const INSET_PROPS = ['top', 'right', 'bottom', 'left'] as const;
249
+
250
+ interface Pin {
251
+ position: string;
252
+ positionPriority: string;
253
+ zIndex: string;
254
+ zIndexPriority: string;
255
+ insets: Array<[string, string, string]>;
256
+ /** What made the element a containing block — decides what "mid-reset" looks like. */
257
+ by: Array<'transform' | 'filter'>;
258
+ }
259
+
260
+ const NONE = new Set(['', 'none', 'initial']);
261
+ const set = (cs: CSSStyleDeclaration, prop: string): boolean =>
262
+ !NONE.has(cs.getPropertyValue(prop));
263
+
264
+ function causes(cs: CSSStyleDeclaration): Array<'transform' | 'filter'> {
265
+ const by: Array<'transform' | 'filter'> = [];
266
+ if (set(cs, 'transform') || set(cs, 'scale') || set(cs, 'rotate')) by.push('transform');
267
+ if (set(cs, 'filter')) by.push('filter');
268
+ return by;
269
+ }
270
+
271
+ /** The renderer's own reset leaves these inline values behind (see `makeTransformResetter`). */
272
+ function midReset(el: HTMLElement, by: Pin['by']): boolean {
273
+ const s = el.style;
274
+ return by.some((b) =>
275
+ b === 'transform'
276
+ ? s.transform === 'none' && s.scale === 'none' && s.rotate === 'none'
277
+ : s.filter === 'none'
278
+ );
279
+ }
280
+
281
+ /**
282
+ * While installed, an element that is `position: static` yet carries a `transform`
283
+ * / `scale` / `rotate` / `filter` is pinned as `position: relative` the moment it
284
+ * is read through `getComputedStyle` — which is how the renderer reads every node
285
+ * and ancestor, before it resets the property. The pin is dropped again when the
286
+ * author's own styling no longer makes the element a containing block (a frame
287
+ * where the transform is `none`), so a later frame still matches the browser.
288
+ * Returns the restore function — it also undoes every live pin.
289
+ */
290
+ export function installTransformPinGuard(): () => void {
291
+ const original = window.getComputedStyle;
292
+ const pins = new Map<HTMLElement, Pin>();
293
+
294
+ const unpin = (el: HTMLElement, pin: Pin): void => {
295
+ const s = el.style;
296
+ s.removeProperty('position');
297
+ if (pin.position) s.setProperty('position', pin.position, pin.positionPriority);
298
+ s.removeProperty('z-index');
299
+ if (pin.zIndex) s.setProperty('z-index', pin.zIndex, pin.zIndexPriority);
300
+ for (const [prop, value, priority] of pin.insets) {
301
+ s.removeProperty(prop);
302
+ if (value) s.setProperty(prop, value, priority);
303
+ }
304
+ pins.delete(el);
305
+ };
306
+
307
+ const sync = (el: HTMLElement, cs: CSSStyleDeclaration): void => {
308
+ const pin = pins.get(el);
309
+ const by = causes(cs);
310
+ if (pin) {
311
+ if (by.length === 0 && !midReset(el, pin.by)) unpin(el, pin);
312
+ return;
313
+ }
314
+ if (by.length === 0) return;
315
+ if (cs.position && cs.position !== 'static') return;
316
+ if (cs.display === 'inline' || cs.display === 'contents' || cs.display === 'none') return;
317
+ const s = el.style;
318
+ const record: Pin = {
319
+ position: s.getPropertyValue('position'),
320
+ positionPriority: s.getPropertyPriority('position'),
321
+ zIndex: s.getPropertyValue('z-index'),
322
+ zIndexPriority: s.getPropertyPriority('z-index'),
323
+ insets: [],
324
+ by,
325
+ };
326
+ // A static element ignores z-index and offsets; a relative one would not. Neutralize both so
327
+ // the pin changes the containing block and nothing else (a flex / grid item already honours
328
+ // z-index, so that one is left alone).
329
+ const parent = el.parentElement;
330
+ const parentDisplay = parent ? original.call(window, parent).display : '';
331
+ const itemOfFlexOrGrid = /flex|grid/.test(parentDisplay);
332
+ if (!itemOfFlexOrGrid && cs.zIndex && cs.zIndex !== 'auto') s.setProperty('z-index', 'auto');
333
+ for (const prop of INSET_PROPS) {
334
+ const value = cs.getPropertyValue(prop);
335
+ if (value && value !== 'auto') {
336
+ record.insets.push([prop, s.getPropertyValue(prop), s.getPropertyPriority(prop)]);
337
+ s.setProperty(prop, 'auto');
338
+ }
339
+ }
340
+ s.setProperty('position', 'relative');
341
+ pins.set(el, record);
342
+ };
343
+
344
+ window.getComputedStyle = function guardedGetComputedStyle(
345
+ this: Window,
346
+ el: Element,
347
+ pseudo?: string | null
348
+ ): CSSStyleDeclaration {
349
+ const cs = original.call(window, el, pseudo);
350
+ if (!pseudo && el instanceof HTMLElement) {
351
+ try {
352
+ sync(el, cs);
353
+ } catch {
354
+ /* a guard must never break the render it protects */
355
+ }
356
+ }
357
+ return cs;
358
+ } as typeof window.getComputedStyle;
359
+
360
+ return () => {
361
+ window.getComputedStyle = original;
362
+ for (const [el, pin] of [...pins]) unpin(el, pin);
363
+ };
364
+ }
365
+
366
+ /** Both pre-pass guards for one render. Returns the restore function. */
367
+ export function installCapturePrepass(): () => void {
368
+ const restoreImages = installSizelessSvgImageGuard();
369
+ const restorePins = installTransformPinGuard();
370
+ return () => {
371
+ restorePins();
372
+ restoreImages();
373
+ };
374
+ }
@@ -6,6 +6,8 @@
6
6
  //
7
7
  // RCA `issue-mp4-audio-export-html5audio-silent-degrade`.
8
8
 
9
+ import { PARITY_FEATURES, type ParityFeature } from './parity-check.ts';
10
+
9
11
  /**
10
12
  * The file is real and the job is `done` — but it is NOT clean, and saying so
11
13
  * is the whole point.
@@ -37,6 +39,17 @@ export interface ExportDegradation {
37
39
  * `AAAAAA+` subset prefixes; the count and the split live in `reason`.
38
40
  */
39
41
  fontsNotEmbedded?: string[];
42
+ /**
43
+ * Captioned clips (`assets/<sha8>.<ext>`) that have no `assets/<sha8>.transcript.json`, so the
44
+ * comp's <Captions> had no words to show (#128 §7). Names only; the sentence is in `reason`.
45
+ */
46
+ captionsMissing?: string[];
47
+ /**
48
+ * What the video exporter cannot draw the way the preview does (#150 §4, #128 §8): one entry per
49
+ * feature, naming the elements (`a background-image url() is not drawn — div.hero, div.camo`).
50
+ * A warning found BEFORE the render started; the file is otherwise complete.
51
+ */
52
+ unsupportedFeatures?: string[];
40
53
  /** Human-readable cause, already newline-collapsed by the shim (DDR-054). */
41
54
  reason: string;
42
55
  /** One-line remedy — present only when the cause is a fixable authoring mistake. */
@@ -104,5 +117,140 @@ export function remedyFor(reason: string): string | undefined {
104
117
  'carry audio through the export.'
105
118
  );
106
119
  }
120
+ // Issue #150 §1 — @remotion/web-renderer rejects with exactly this message when
121
+ // the image it makes of an inline <svg> fails to load. It used to look like a
122
+ // renderer bug; it is almost always the svg's own markup, and the file that
123
+ // comes out of the frame-by-frame fallback has no audio.
124
+ if (/Failed to convert SVG to image/i.test(reason)) {
125
+ return (
126
+ 'An inline <svg> in this comp could not be turned into an image, so the audio ' +
127
+ 'renderer stopped. Check that svg for invalid markup, or save it as a .svg file ' +
128
+ 'with a fixed width and height and draw it with <Img>.'
129
+ );
130
+ }
107
131
  return undefined;
108
132
  }
133
+
134
+ /** Two degradations of one job (the first run's and a retry's, or a render's and a parity note) as one: reasons joined, flags kept. */
135
+ export function mergeDegraded(
136
+ a: ExportDegradation | undefined,
137
+ b: ExportDegradation | undefined
138
+ ): ExportDegradation | undefined {
139
+ if (!a || !b) return a ?? b;
140
+ const union = (x?: string[], y?: string[]): string[] => [
141
+ ...new Set([...(x ?? []), ...(y ?? [])]),
142
+ ];
143
+ const fonts = union(a.fontsNotEmbedded, b.fontsNotEmbedded);
144
+ const captions = union(a.captionsMissing, b.captionsMissing);
145
+ const features = union(a.unsupportedFeatures, b.unsupportedFeatures);
146
+ return {
147
+ ...a,
148
+ ...b,
149
+ ...(a.audioDropped || b.audioDropped ? { audioDropped: true } : {}),
150
+ ...(fonts.length ? { fontsNotEmbedded: fonts } : {}),
151
+ ...(captions.length ? { captionsMissing: captions } : {}),
152
+ ...(features.length ? { unsupportedFeatures: features } : {}),
153
+ // a remedy is a fixable cause's one-liner: keep the first one anybody had
154
+ ...(a.remedy || b.remedy ? { remedy: a.remedy ?? b.remedy } : {}),
155
+ reason: [...new Set([a.reason, b.reason])].join(' '),
156
+ };
157
+ }
158
+
159
+ const PARITY_NAMED_FEATURES = 8;
160
+ const PARITY_NAMED_ELEMENTS = 5;
161
+
162
+ /** A name that came out of the canvas page (untrusted, DDR-054): one line, no control characters, short. */
163
+ const cleanName = (v: unknown, max: number): string | null => {
164
+ if (typeof v !== 'string') return null;
165
+ let plain = '';
166
+ for (const ch of v) {
167
+ const code = ch.charCodeAt(0);
168
+ plain += code < 32 || code === 127 ? ' ' : ch;
169
+ }
170
+ const line = plain.replace(/\s+/g, ' ').trim();
171
+ return line ? line.slice(0, max) : null;
172
+ };
173
+
174
+ /**
175
+ * The degradation for a comp that uses CSS the video exporter cannot draw (#150 §4, #128 §8), from the
176
+ * scan the capture page ran before the render. The page is the canvas author's code, so the report is
177
+ * untrusted: only features this module knows are accepted, and every name is cleaned and capped before
178
+ * it reaches a sentence. Never blocks — it rides the same channel as a muted file, as a warning.
179
+ * Returns undefined when there is nothing (usable) to say.
180
+ */
181
+ export function parityGap(raw: unknown): ExportDegradation | undefined {
182
+ if (!raw || typeof raw !== 'object') return undefined;
183
+ const scan = raw as { artboard?: unknown; findings?: unknown };
184
+ if (!Array.isArray(scan.findings)) return undefined;
185
+ const entries: string[] = [];
186
+ const hints: string[] = [];
187
+ for (const f of scan.findings.slice(0, PARITY_NAMED_FEATURES)) {
188
+ if (!f || typeof f !== 'object') continue;
189
+ const feature = (f as { feature?: unknown }).feature;
190
+ if (typeof feature !== 'string' || !Object.hasOwn(PARITY_FEATURES, feature)) continue;
191
+ const known = PARITY_FEATURES[feature as ParityFeature];
192
+ const names = Array.isArray((f as { elements?: unknown }).elements)
193
+ ? ((f as { elements: unknown[] }).elements
194
+ .slice(0, PARITY_NAMED_ELEMENTS)
195
+ .map((n) => cleanName(n, 48))
196
+ .filter((n) => n !== null) as string[])
197
+ : [];
198
+ const count = Number((f as { count?: unknown }).count);
199
+ const more =
200
+ Number.isFinite(count) && count > names.length
201
+ ? ` and ${Math.floor(count) - names.length} more`
202
+ : '';
203
+ entries.push(names.length ? `${known.label} — ${names.join(', ')}${more}` : known.label);
204
+ hints.push(known.hint);
205
+ }
206
+ if (!entries.length) return undefined;
207
+ const board = cleanName(scan.artboard, 60);
208
+ return {
209
+ unsupportedFeatures: entries,
210
+ reason: `${board ? `Artboard "${board}": the` : 'The'} video exporter cannot draw everything in this comp, so the file may differ from the preview: ${entries.join('; ')}.`,
211
+ remedy: `To match the preview, ${[...new Set(hints)].slice(0, 3).join('; ')}. Or check the exported frames before you send it.`,
212
+ };
213
+ }
214
+
215
+ /** At most this many assets are listed by name in the sentence (the array keeps them all). */
216
+ const CAPTION_GAP_NAMED = 5;
217
+
218
+ /**
219
+ * The degradation for a video whose <Captions> sit over clips with no transcript sidecar (#128 §7).
220
+ * The export is real and downloadable; its captions are silently empty, which is what this says —
221
+ * with the asset names, because "some clip" gives a person nothing to act on.
222
+ */
223
+ export function captionGap(assets: readonly string[]): ExportDegradation {
224
+ const named = assets.slice(0, CAPTION_GAP_NAMED).join(', ');
225
+ const more =
226
+ assets.length > CAPTION_GAP_NAMED ? ` and ${assets.length - CAPTION_GAP_NAMED} more` : '';
227
+ return {
228
+ captionsMissing: [...assets],
229
+ reason: `No captions for ${named}${more}: no transcript was saved for ${assets.length === 1 ? 'it' : 'them'}.`,
230
+ remedy: 'Make captions for the clip again (Transcript panel, or `maude design transcribe`).',
231
+ };
232
+ }
233
+
234
+ /** At most this many clips are listed by name in the sentence. */
235
+ const MEDIA_GAP_NAMED = 3;
236
+
237
+ /**
238
+ * The degradation for a video export that fell back to frame-by-frame capture (so: no sound) while the comp
239
+ * holds clips the audio renderer is known to choke on — HEVC, variable frame rate, a second audio track
240
+ * (#128 §1, root cause of #127). The renderer's own message only says "the video could not be decoded";
241
+ * this names the clip and the codec and says what to do about it.
242
+ */
243
+ export function undecodableMediaGap(
244
+ clips: readonly { asset: string; what: string }[]
245
+ ): ExportDegradation {
246
+ const named = clips
247
+ .slice(0, MEDIA_GAP_NAMED)
248
+ .map((c) => `${c.asset} (${c.what})`)
249
+ .join(', ');
250
+ const more = clips.length > MEDIA_GAP_NAMED ? ` and ${clips.length - MEDIA_GAP_NAMED} more` : '';
251
+ return {
252
+ audioDropped: true,
253
+ reason: `No sound in this file: the audio renderer could not use ${named}${more}, so it was captured frame by frame instead.`,
254
+ remedy: `Make an H.264 copy with \`maude design video-proxy ${clips[0]?.asset ?? 'assets/<clip>'}\`, then use that copy in the canvas.`,
255
+ };
256
+ }
@@ -20,6 +20,7 @@ import {
20
20
  CLOUD_FINGERPRINT_MAX,
21
21
  CLOUD_TOO_BIG_WORDS,
22
22
  CloudArtifactTooLargeError,
23
+ type CloudCancelAnswer,
23
24
  type CloudJobStatus,
24
25
  type CloudRenderDoor,
25
26
  cloudNotSyncedWords,
@@ -219,18 +220,43 @@ export function createHubRenderDoor(opts: HubRenderDoorOptions): CloudRenderDoor
219
220
  const body = await readJson(r);
220
221
  const job = (body?.job && typeof body.job === 'object' ? body.job : body) as Json | null;
221
222
  const state = job?.state ?? job?.status;
222
- if (state === 'done') return { state: 'done' };
223
+ if (state === 'done') {
224
+ const d = (
225
+ job?.degraded && typeof job.degraded === 'object' ? job.degraded : null
226
+ ) as Json | null;
227
+ const reason = cleanText(d?.reason, 300);
228
+ const remedy = cleanText(d?.remedy, 300);
229
+ return {
230
+ state: 'done',
231
+ ...(reason ? { degraded: { reason, ...(remedy ? { remedy } : {}) } } : {}),
232
+ };
233
+ }
223
234
  if (state === 'failed') {
224
235
  const error = cleanText(job?.error, 500);
225
236
  return { state: 'failed', ...(error ? { error } : {}) };
226
237
  }
227
238
  if (state === 'queued' || state === 'running') {
228
239
  const progress = clampProgress(job?.progress);
229
- return { state, ...(progress ? { progress } : {}) };
240
+ const waiting = cleanText(job?.waiting, 120);
241
+ return { state, ...(progress ? { progress } : {}), ...(waiting ? { waiting } : {}) };
230
242
  }
231
243
  return { state: 'unreachable' }; // a state we do not know: ask again, trust nothing
232
244
  },
233
245
 
246
+ async cancel(jobId): Promise<CloudCancelAnswer> {
247
+ // a job id that is not ours is nothing to stop — and never leaves this Mac
248
+ if (!JOB_ID_RE.test(jobId)) return { ok: true };
249
+ const r = await reach('POST', `${jobsPath}/${jobId}/cancel`);
250
+ if (r === 'signed-out' || r === 'network') return { ok: false, code: 'unreachable' };
251
+ await r.body?.cancel().catch(() => {});
252
+ lastHeard = now();
253
+ // 404 / 410: the cloud no longer has it, so there is nothing left to stop
254
+ if (r.status === 200 || r.status === 404 || r.status === 410) return { ok: true };
255
+ if (r.status === 409) return { ok: false, code: 'not-running' };
256
+ if (r.status === 403) return { ok: false, code: 'forbidden' };
257
+ return { ok: false, code: 'unreachable' };
258
+ },
259
+
234
260
  async artifact(jobId) {
235
261
  if (!JOB_ID_RE.test(jobId)) return null;
236
262
  const r = await reach('GET', `${jobsPath}/${jobId}/file`, undefined, {
@@ -7,6 +7,7 @@
7
7
  // replace them with real renderers.
8
8
 
9
9
  import path from 'node:path';
10
+ import { localCaptureUrl } from '../shell/capture-url.ts';
10
11
  // DDR-148 — temporal formats (capture-spine encode). Named exports mp4/webm/gif.
11
12
  import { audio } from './audio.ts';
12
13
  import * as canva from './canva.ts';
@@ -238,5 +239,6 @@ export function canvasShellUrl(
238
239
  const at = pastVersionOf({ atSha: opts.at });
239
240
  if (at) params.set('sha', at);
240
241
  }
241
- return `${ctx.serverOrigin}/_canvas-shell.html?${params.toString()}`;
242
+ // sec-loopback-bearer §7.3 — on a key-required server, already the capture origin + capability
243
+ return localCaptureUrl(`${ctx.serverOrigin}/_canvas-shell.html?${params.toString()}`);
242
244
  }