@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,93 @@
1
+ // The wall-clock budget of one export job (#128 T3.7b).
2
+ //
3
+ // A job's render timeout bounds RENDER time. A cloud video can sit in the render service's queue
4
+ // behind another video (one video renders at a time), and that wait is not the job's work: it
5
+ // must not spend the job's own budget, or a long video that waited its turn is aborted before it
6
+ // has run for as long as it was promised. So the budget has a pause: while the service says
7
+ // "waiting" the budget stands still, but the waiting is itself bounded — `maxPauseMs` in total —
8
+ // so a queue that never moves still ends the job.
9
+ //
10
+ // `onExpire` is told which limit ran out: `budget` (it rendered for too long) or `queue` (it
11
+ // waited for too long).
12
+
13
+ export type BudgetExpiry = 'budget' | 'queue';
14
+
15
+ export interface JobBudget {
16
+ /** Arm the budget: the render started. */
17
+ start(): void;
18
+ /** The job is waiting in a queue: the budget stands still, the queue ceiling runs. */
19
+ pause(): void;
20
+ /** It runs again: the rest of the budget runs. */
21
+ resume(): void;
22
+ /** Disarm everything (the job ended). */
23
+ stop(): void;
24
+ }
25
+
26
+ export function createJobBudget(o: {
27
+ /** how long the job may RUN */
28
+ budgetMs: number;
29
+ /** how long, in total, it may WAIT in a queue */
30
+ maxPauseMs: number;
31
+ onExpire: (why: BudgetExpiry) => void;
32
+ now?: () => number;
33
+ setTimer?: (fn: () => void, ms: number) => ReturnType<typeof setTimeout>;
34
+ clearTimer?: (h: ReturnType<typeof setTimeout>) => void;
35
+ }): JobBudget {
36
+ const now = o.now ?? Date.now;
37
+ const setT = o.setTimer ?? ((fn, ms) => setTimeout(fn, ms));
38
+ const clearT = o.clearTimer ?? ((h) => clearTimeout(h));
39
+
40
+ let spent = 0; // running time so far
41
+ let waited = 0; // queue time so far
42
+ let since = 0; // when the current stretch (running or paused) began
43
+ let state: 'idle' | 'running' | 'paused' | 'stopped' = 'idle';
44
+ let timer: ReturnType<typeof setTimeout> | undefined;
45
+
46
+ const disarm = () => {
47
+ if (timer !== undefined) clearT(timer);
48
+ timer = undefined;
49
+ };
50
+ const fire = (why: BudgetExpiry) => {
51
+ timer = undefined;
52
+ if (state === 'stopped') return;
53
+ state = 'stopped';
54
+ o.onExpire(why);
55
+ };
56
+ const arm = () => {
57
+ disarm();
58
+ if (state === 'running') timer = setT(() => fire('budget'), Math.max(0, o.budgetMs - spent));
59
+ else if (state === 'paused')
60
+ timer = setT(() => fire('queue'), Math.max(0, o.maxPauseMs - waited));
61
+ };
62
+ const settle = () => {
63
+ const t = now();
64
+ if (state === 'running') spent += t - since;
65
+ else if (state === 'paused') waited += t - since;
66
+ since = t;
67
+ };
68
+
69
+ return {
70
+ start() {
71
+ if (state !== 'idle') return;
72
+ state = 'running';
73
+ since = now();
74
+ arm();
75
+ },
76
+ pause() {
77
+ if (state !== 'running') return;
78
+ settle();
79
+ state = 'paused';
80
+ arm();
81
+ },
82
+ resume() {
83
+ if (state !== 'paused') return;
84
+ settle();
85
+ state = 'running';
86
+ arm();
87
+ },
88
+ stop() {
89
+ state = 'stopped';
90
+ disarm();
91
+ },
92
+ };
93
+ }
@@ -32,7 +32,10 @@ import { readAllArtboardPrintProps } from '../canvas-edit.ts';
32
32
 
33
33
  import type { Bus } from '../context.ts';
34
34
  import { currentSession, normalizeSessionKey } from '../session-scope.ts';
35
+ import { missingTranscriptsFor } from '../video/inject.ts';
36
+ import { type RiskyMedia, riskyMediaIn } from '../video/media-risk.ts';
35
37
  import { resolveRenderLane } from '../workspace-mode.ts';
38
+ import { captionGap, mergeDegraded, undecodableMediaGap } from './degraded.ts';
36
39
  import {
37
40
  type ExportContext,
38
41
  type ExportDegradation,
@@ -42,11 +45,15 @@ import {
42
45
  runExport,
43
46
  type Scope,
44
47
  } from './index.ts';
48
+ import { createJobBudget, type JobBudget } from './job-budget.ts';
45
49
  import {
50
+ CLOUD_CANCELLED_WORDS,
46
51
  formatNeedsBrowser,
47
52
  NoRenderServiceError,
48
53
  REMOTE_UNSUPPORTED_FORMATS,
49
54
  REMOTE_UNSUPPORTED_MESSAGE,
55
+ RENDER_BUSY_WORDS,
56
+ RENDER_WAITING_WORDS,
50
57
  type RemoteCanvasAccess,
51
58
  renderRemotely,
52
59
  resolveRenderService,
@@ -110,6 +117,11 @@ export interface ExportJob {
110
117
  options: ExportOptions;
111
118
  status: ExportJobStatus;
112
119
  progress?: { current: number; total: number };
120
+ /**
121
+ * #128 T3.7 — a running job the render service holds behind another video (one video at a
122
+ * time): the row's words for it. Cleared once the render runs or settles.
123
+ */
124
+ waiting?: string;
113
125
  createdAt: string;
114
126
  startedAt?: string;
115
127
  finishedAt?: string;
@@ -215,6 +227,9 @@ export type RetryResult =
215
227
  reason: 'missing' | 'not-retryable' | 'nothing-to-retry' | 'busy' | 'not-allowed';
216
228
  };
217
229
 
230
+ /** #128 T3.7b — why a cancel did not stop anything. */
231
+ export type CancelResult = { ok: true } | { ok: false; reason: 'missing' | 'not-running' };
232
+
218
233
  export interface ExportJobQueue {
219
234
  /**
220
235
  * `already: true` — a replay of a `clientId` this owner already holds (S8.5b-1): nothing new is
@@ -228,6 +243,12 @@ export interface ExportJobQueue {
228
243
  * scoped like every read: another member's id answers false, exactly like a missing one.
229
244
  */
230
245
  refreshRenderToken(id: string, token: string, session?: string): boolean;
246
+ /**
247
+ * #128 T3.7b — stop one of this session's unfinished jobs. The job's abort signal fires, which
248
+ * also cancels it on the render service. Another member's job answers `missing`, like an id that
249
+ * never existed (V2-1.16 U1); a finished one `not-running`.
250
+ */
251
+ cancel(id: string, session?: string): CancelResult;
231
252
  /**
232
253
  * S8.4 — run again ONLY the failed (or waiting) items of a group job, named by `items` when
233
254
  * given. Returns once the re-run is started; the job goes back to `running` and its items
@@ -262,6 +283,37 @@ const HISTORY_DEPTH = 20;
262
283
  const MAX_JOB_AGE_MS = 24 * 60 * 60 * 1000;
263
284
  const DEFAULT_JOB_TIMEOUT_MS = 5 * 60 * 1000;
264
285
 
286
+ /** What a job a person cancelled says on its row (CONTRACT voice: short, no blame). */
287
+ export const EXPORT_CANCELLED_WORDS = CLOUD_CANCELLED_WORDS;
288
+
289
+ /**
290
+ * #128 T3.7b — the most a video may wait in the render service's queue, in total, before the job
291
+ * ends. The wait does not spend the job's render budget (it is not render time), so a stuck queue
292
+ * needs its own ceiling: one video ahead of it renders for at most the 60 min video ceiling, plus
293
+ * slack for the hand-over.
294
+ */
295
+ export const QUEUE_WAIT_CEIL_MS = 75 * 60 * 1000;
296
+
297
+ /** The scale the cloud renders a video at (mirrors apps/render/service.ts `CLOUD_VIDEO_SCALE`). */
298
+ const CLOUD_VIDEO_SCALE = 1;
299
+ /** The start of the notice a cloud video gets when it was asked for more than 1× (#128 T3.7b). */
300
+ export const CLOUD_SCALE_WORDS = 'Rendered at 1× in the cloud';
301
+
302
+ /**
303
+ * A cloud video asked for a larger scale is rendered at {@link CLOUD_VIDEO_SCALE} (the render
304
+ * instance cannot finish a long frame-by-frame video at 2×); the file is complete, so this rides the
305
+ * degradation channel as a notice, with the way to get the larger size.
306
+ */
307
+ function cloudScaleGap(format: string, options: ExportOptions): ExportDegradation | undefined {
308
+ if (format !== 'mp4' && format !== 'webm' && format !== 'gif') return undefined;
309
+ const asked = Math.floor(Number(options.scale));
310
+ if (!Number.isFinite(asked) || asked <= CLOUD_VIDEO_SCALE) return undefined;
311
+ return {
312
+ reason: `${CLOUD_SCALE_WORDS}. You asked for ${asked}×.`,
313
+ remedy: `For ${asked}×, export it on this Mac.`,
314
+ };
315
+ }
316
+
265
317
  // Video/animation exports run a per-frame capture loop, so they legitimately
266
318
  // take far longer than the 5-min default that's fine for image exports. The
267
319
  // fast one-pass renderMediaOnWeb path is quick, but a comp that can't use it —
@@ -396,6 +448,39 @@ function readUnsupportedMediaFor(
396
448
  return abs ? scanUnsupportedMedia(abs) : [];
397
449
  }
398
450
 
451
+ /** The captioned clips of the first element target's canvas that have no transcript sidecar. */
452
+ function readMissingTranscriptsFor(
453
+ targets: Target[],
454
+ repoRoot: string | undefined,
455
+ designRoot: string | undefined
456
+ ): string[] {
457
+ const t = targets.find((x) => x.kind === 'element');
458
+ if (!t || t.kind !== 'element' || !designRoot) return [];
459
+ const abs = safeCanvasAbs(repoRoot, designRoot, t.file);
460
+ if (!abs || !abs.endsWith('.tsx')) return [];
461
+ return missingTranscriptsFor(readFileSync(abs, 'utf8'), abs, designRoot);
462
+ }
463
+
464
+ /**
465
+ * The clips of the first element target's canvas that are HEVC, variable-rate or carry a second audio
466
+ * track (#128 §1) — the ones the audio renderer may not decode. Empty without ffprobe; never throws.
467
+ */
468
+ function readRiskyMediaFor(
469
+ targets: Target[],
470
+ repoRoot: string | undefined,
471
+ designRoot: string | undefined
472
+ ): RiskyMedia[] {
473
+ try {
474
+ const t = targets.find((x) => x.kind === 'element');
475
+ if (!t || t.kind !== 'element' || !designRoot) return [];
476
+ const abs = safeCanvasAbs(repoRoot, designRoot, t.file);
477
+ if (!abs || !abs.endsWith('.tsx')) return [];
478
+ return riskyMediaIn(readFileSync(abs, 'utf8'), designRoot);
479
+ } catch {
480
+ return [];
481
+ }
482
+ }
483
+
399
484
  /**
400
485
  * `{ [repoRelativeCanvasFile]: { [artboardId]: print } }` for every canvas an
401
486
  * element target names — what exporters/pdf.ts reads as `options.printProps`
@@ -422,22 +507,6 @@ function readPrintPropsFor(
422
507
  return out;
423
508
  }
424
509
 
425
- /** Two degradations of one job (the first run's and a retry's) as one: reasons joined, flags kept. */
426
- function mergeDegraded(
427
- a: ExportDegradation | undefined,
428
- b: ExportDegradation | undefined
429
- ): ExportDegradation | undefined {
430
- if (!a || !b) return a ?? b;
431
- const fonts = [...new Set([...(a.fontsNotEmbedded ?? []), ...(b.fontsNotEmbedded ?? [])])];
432
- return {
433
- ...a,
434
- ...b,
435
- ...(a.audioDropped || b.audioDropped ? { audioDropped: true } : {}),
436
- ...(fonts.length ? { fontsNotEmbedded: fonts } : {}),
437
- reason: [...new Set([a.reason, b.reason])].join(' '),
438
- };
439
- }
440
-
441
510
  /** Seams a test replaces (the engine call); production passes nothing. */
442
511
  export interface ExportJobQueueDeps {
443
512
  runExport?: typeof runExport;
@@ -445,6 +514,10 @@ export interface ExportJobQueueDeps {
445
514
  runs?: () => AiRunReader | null;
446
515
  /** A clock for the render-seconds meter (ms); tests move it by hand. */
447
516
  now?: () => number;
517
+ /** #128 T3.7 — how often a remote render is asked for its status (ms); tests shorten it. */
518
+ remotePollMs?: number;
519
+ /** #128 T3.7b — the most a video may wait in the render queue in total (ms); tests shorten it. */
520
+ queueWaitMs?: number;
448
521
  }
449
522
 
450
523
  export function createExportJobQueue(
@@ -479,6 +552,35 @@ export function createExportJobQueue(
479
552
  // S8.5b-1 — the args of every job not yet finished (the render reads `remoteCanvas` off them at
480
553
  // dispatch, so a swapped token reaches the render) and its result (what a replay hands back).
481
554
  const live = new Map<string, { args: EnqueueArgs; result: Promise<ExportResult> }>();
555
+ // #128 T3.7b — what stops a running job and why it stopped: a person's Cancel, or the queue ceiling.
556
+ const controls = new Map<
557
+ string,
558
+ { controller: AbortController; cancelled: boolean; queueExpired: boolean }
559
+ >();
560
+ // The job's budget, so the render's "waiting" report can pause it (makeRenderOne).
561
+ const budgets = new WeakMap<ExportJob, JobBudget>();
562
+ /** A job's budget: running time spends it, queue time does not (up to the ceiling). */
563
+ function armBudget(args: EnqueueArgs, controller: AbortController, job: ExportJob): JobBudget {
564
+ const ctl = controls.get(job.id);
565
+ const budget = createJobBudget({
566
+ budgetMs: jobTimeoutMs(args),
567
+ maxPauseMs: deps.queueWaitMs ?? QUEUE_WAIT_CEIL_MS,
568
+ onExpire: (why) => {
569
+ if (why === 'queue' && ctl) ctl.queueExpired = true;
570
+ controller.abort();
571
+ },
572
+ });
573
+ budgets.set(job, budget);
574
+ budget.start();
575
+ return budget;
576
+ }
577
+ /** What a failed job says: a person's Cancel and the queue ceiling have their own words. */
578
+ const failureWords = (id: string, err: unknown): string => {
579
+ const ctl = controls.get(id);
580
+ if (ctl?.cancelled) return EXPORT_CANCELLED_WORDS;
581
+ if (ctl?.queueExpired) return RENDER_BUSY_WORDS;
582
+ return err instanceof Error ? err.message : String(err);
583
+ };
482
584
 
483
585
  // Seed the ledger from disk ONCE — the only read of the history file. Every
484
586
  // later persist derives fresh from `jobs` and overwrites; there is no
@@ -646,7 +748,30 @@ export function createExportJobQueue(
646
748
  args.resolve.designRoot
647
749
  )
648
750
  : [];
649
- const res = dispatchRemote
751
+ // #128 §1 — say it BEFORE the render starts: a clip the audio renderer cannot decode makes the
752
+ // exporter fall back to frame-by-frame capture, which has no sound. Named here (the log) and, if
753
+ // that fallback does happen, in the job's notice below.
754
+ let risky: RiskyMedia[] = [];
755
+ if ((u.format === 'mp4' || u.format === 'webm') && u.options.audio !== false) {
756
+ try {
757
+ risky = readRiskyMediaFor(
758
+ dispatchRemote
759
+ ? remoteTargets
760
+ : await resolveScope({ scope: args.scope, ...args.resolve, options: args.options }),
761
+ args.resolve.repoRoot,
762
+ args.resolve.designRoot
763
+ );
764
+ } catch {
765
+ risky = [];
766
+ }
767
+ for (const r of risky) {
768
+ console.error(
769
+ `⚠ ${r.asset} is ${r.what}: the audio renderer may not be able to decode it, and the ` +
770
+ `export would then have no sound (fix: maude design video-proxy ${r.asset})`
771
+ );
772
+ }
773
+ }
774
+ const rendered = dispatchRemote
650
775
  ? await renderRemotely({
651
776
  format: args.format,
652
777
  targets: remoteTargets,
@@ -691,6 +816,21 @@ export function createExportJobQueue(
691
816
  // construction (the lane IS the presence of MAUDE_RENDER_URL).
692
817
  service: resolveRenderService()!,
693
818
  signal: controller.signal,
819
+ // #128 T3.7 — the service's frame progress and its "waiting for another video" line
820
+ // reach the row the same way the local lane's progress does.
821
+ pollMs: deps.remotePollMs,
822
+ onProgress: (update) => {
823
+ job.progress = update;
824
+ emit(job);
825
+ },
826
+ onWaiting: (waiting) => {
827
+ if (waiting) job.waiting = RENDER_WAITING_WORDS;
828
+ else delete job.waiting;
829
+ // #128 T3.7b — the wait is the queue's, not the render's: the job's budget stands still
830
+ if (waiting) budgets.get(job)?.pause();
831
+ else budgets.get(job)?.resume();
832
+ emit(job);
833
+ },
694
834
  })
695
835
  : await engine({
696
836
  format: args.format,
@@ -706,7 +846,36 @@ export function createExportJobQueue(
706
846
  },
707
847
  },
708
848
  });
709
- return res;
849
+ // #128 T3.7b — the cloud renders a video at 1×: say so when a larger scale was asked for.
850
+ const scaleGap = dispatchRemote ? cloudScaleGap(u.format, u.options) : undefined;
851
+ const res: ExportResult = scaleGap
852
+ ? { ...rendered, degraded: mergeDegraded(rendered.degraded, scaleGap) }
853
+ : rendered;
854
+ // #128 §7 — captions over a clip with no transcript sidecar export silently empty. Checked
855
+ // here, around the render, so the local lane and the render-worker lane (which holds no
856
+ // tenant files) say the same thing. A failed check never fails an export.
857
+ if (u.format !== 'mp4' && u.format !== 'webm') return res;
858
+ try {
859
+ const targets = dispatchRemote
860
+ ? remoteTargets
861
+ : await resolveScope({ scope: args.scope, ...args.resolve, options: args.options });
862
+ const missing = readMissingTranscriptsFor(
863
+ targets,
864
+ args.resolve.repoRoot,
865
+ args.resolve.designRoot
866
+ );
867
+ let out: ExportResult = missing.length
868
+ ? { ...res, degraded: mergeDegraded(res.degraded, captionGap(missing)) }
869
+ : res;
870
+ // #128 §1 — the render fell back to frame-by-frame capture (no sound) and a clip in the comp is
871
+ // one the audio renderer is known to choke on: name it and its codec.
872
+ if (risky.length && out.degraded?.audioDropped) {
873
+ out = { ...out, degraded: mergeDegraded(out.degraded, undecodableMediaGap(risky)) };
874
+ }
875
+ return out;
876
+ } catch {
877
+ return res;
878
+ }
710
879
  };
711
880
  }
712
881
 
@@ -773,10 +942,11 @@ export function createExportJobQueue(
773
942
  emit(job);
774
943
 
775
944
  const controller = new AbortController();
945
+ controls.set(id, { controller, cancelled: false, queueExpired: false });
776
946
  const done = (async () => {
777
947
  const release = await semaphore.acquire();
778
948
  const ranFrom = clock();
779
- const timer = setTimeout(() => controller.abort(), jobTimeoutMs(held.args));
949
+ const budget = armBudget(held.args, controller, job);
780
950
  try {
781
951
  const renderOne = makeRenderOne(held.args, held.lane, controller, job);
782
952
  const before = await heldFiles(job, rest);
@@ -807,9 +977,10 @@ export function createExportJobQueue(
807
977
  if (res.degraded) job.degraded = res.degraded;
808
978
  } catch (err) {
809
979
  job.status = 'failed';
810
- job.error = err instanceof Error ? err.message : String(err);
980
+ job.error = failureWords(id, err);
811
981
  } finally {
812
- clearTimeout(timer);
982
+ budget.stop();
983
+ controls.delete(id);
813
984
  meterRender(held.lane, ranFrom);
814
985
  job.finishedAt = new Date().toISOString();
815
986
  settleRetryable(job);
@@ -896,6 +1067,7 @@ export function createExportJobQueue(
896
1067
  emit(job);
897
1068
 
898
1069
  const controller = new AbortController();
1070
+ controls.set(id, { controller, cancelled: false, queueExpired: false });
899
1071
 
900
1072
  const dispatchRemote = lane !== 'local' && formatNeedsBrowser(args.format);
901
1073
  if (args.group) groups.set(id, { args, lane });
@@ -945,8 +1117,9 @@ export function createExportJobQueue(
945
1117
  // render budget; arming the timer before the semaphore resolves would
946
1118
  // abort it before it ever ran (code-review finding, /flow:done).
947
1119
  const ranFrom = clock();
948
- const timer = setTimeout(() => controller.abort(), jobTimeoutMs(args));
1120
+ const budget = armBudget(args, controller, job);
949
1121
  try {
1122
+ if (controls.get(id)?.cancelled) throw new Error(EXPORT_CANCELLED_WORDS);
950
1123
  job.status = 'running';
951
1124
  job.startedAt = new Date().toISOString();
952
1125
  emit(job);
@@ -988,30 +1161,44 @@ export function createExportJobQueue(
988
1161
  } catch (err) {
989
1162
  job.status = 'failed';
990
1163
  job.finishedAt = new Date().toISOString();
991
- job.error = err instanceof Error ? err.message : String(err);
1164
+ job.error = failureWords(id, err);
992
1165
  settleRetryable(job);
993
1166
  emit(job);
994
1167
  await persistAndEvict();
995
1168
  throw err;
996
1169
  } finally {
997
- clearTimeout(timer);
1170
+ budget.stop();
998
1171
  meterRender(lane, ranFrom);
999
1172
  release();
1000
1173
  }
1001
1174
  })();
1002
1175
  live.set(id, { args, result });
1003
1176
  // Every settle path (lane refusal, AI hold, render) ends here: the job is finished.
1004
- result.then(
1005
- () => live.delete(id),
1006
- () => live.delete(id)
1007
- );
1177
+ const settled = () => {
1178
+ live.delete(id);
1179
+ controls.delete(id);
1180
+ };
1181
+ result.then(settled, settled);
1008
1182
 
1009
1183
  return { id, result };
1010
1184
  }
1011
1185
 
1186
+ /** #128 T3.7b — see `ExportJobQueue.cancel`. */
1187
+ function cancel(id: string, session: string = currentSession()): CancelResult {
1188
+ const job = jobs.get(id);
1189
+ if (!job || ownerOf(id) !== normalizeSessionKey(session))
1190
+ return { ok: false, reason: 'missing' };
1191
+ const ctl = controls.get(id);
1192
+ if (!ctl || isFinished(job)) return { ok: false, reason: 'not-running' };
1193
+ ctl.cancelled = true;
1194
+ ctl.controller.abort();
1195
+ return { ok: true };
1196
+ }
1197
+
1012
1198
  return {
1013
1199
  enqueue,
1014
1200
  retry,
1201
+ cancel,
1015
1202
  refreshRenderToken(id, token, session = currentSession()) {
1016
1203
  if (typeof token !== 'string' || token.length === 0 || token.length > 4096) return false;
1017
1204
  const held = live.get(id);