@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
@@ -8,14 +8,18 @@
8
8
  // an ordinary one. Never throws: a failed claim never blocks the verb's write. Internal; not a verb.
9
9
 
10
10
  import { spawnSync } from 'node:child_process';
11
- import { readFileSync } from 'node:fs';
11
+ import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
12
+ import { tmpdir } from 'node:os';
12
13
  import { join } from 'node:path';
13
14
 
15
+ import { serverKeyForSync } from '../../../cli/lib/desktop-locate.mjs';
16
+
14
17
  import {
15
18
  DESIGN_REL,
16
19
  findProjectRoot,
17
20
  locateStudio,
18
21
  rootIdentity,
22
+ studioHeaders,
19
23
  } from '../../../cli/lib/studio-locate.mjs';
20
24
 
21
25
  const CHAT_ID = /^[A-Za-z0-9_-]{1,64}$/;
@@ -37,7 +41,7 @@ export async function claimWrites(from, writes, { env = process.env, timeoutMs =
37
41
  try {
38
42
  const res = await fetch(`${studio.base}/_api/agent/write/claim`, {
39
43
  method: 'POST',
40
- headers: { 'content-type': 'application/json' },
44
+ headers: studioHeaders(studio, { 'content-type': 'application/json' }),
41
45
  body: JSON.stringify({
42
46
  chat,
43
47
  writes: list.map((w) => {
@@ -100,20 +104,38 @@ export function claimWritesSync(from, writes, { env = process.env, timeoutSec =
100
104
  chat,
101
105
  writes: list.map((w) => ({ path: claimPath(w.rel), content: w.content })),
102
106
  });
103
- const r = curl(
104
- [
105
- '-o',
106
- '/dev/null',
107
- '-w',
108
- '%{http_code}',
109
- '-H',
110
- 'content-type: application/json',
111
- '--data-binary',
112
- '@-',
113
- `${base}/_api/agent/write/claim`,
114
- ],
115
- body
116
- );
107
+ // sec-loopback-bearer §7.6 — the key of the server on that port (the app's, attested here with a
108
+ // synchronous challenge; else a terminal server's key file). curl takes it through a config on
109
+ // stdin, never argv, so the body then goes through a 0600 file in a private temp dir.
110
+ const key = serverKeyForSync(root, port, {
111
+ env,
112
+ attest: (p, n) => {
113
+ const a = curl([`http://127.0.0.1:${p}/_api/shell/attest?n=${n}`]);
114
+ try {
115
+ return a.status === 0 ? JSON.parse(a.stdout)?.mac : null;
116
+ } catch {
117
+ return null;
118
+ }
119
+ },
120
+ });
121
+ const post = ['-o', '/dev/null', '-w', '%{http_code}', '-H', 'content-type: application/json'];
122
+ const url = `${base}/_api/agent/write/claim`;
123
+ let r;
124
+ if (key) {
125
+ const dir = mkdtempSync(join(tmpdir(), 'maude-claim-'));
126
+ try {
127
+ const file = join(dir, 'body.json');
128
+ writeFileSync(file, body, { mode: 0o600 });
129
+ r = curl(
130
+ ['--config', '-', ...post, '--data-binary', `@${file}`, url],
131
+ `header = "x-maude-api-key: ${key}"\n`
132
+ );
133
+ } finally {
134
+ rmSync(dir, { recursive: true, force: true });
135
+ }
136
+ } else {
137
+ r = curl([...post, '--data-binary', '@-', url], body);
138
+ }
117
139
  const code = Number(String(r.stdout).trim());
118
140
  return code === 200
119
141
  ? { claimed: true }
@@ -88,6 +88,13 @@ or "@refs" minted earlier in the batch.
88
88
  Needs the host's geometry (--rects / --canvas-state) or the end's x/y as its cached point.
89
89
  { "op": "create", "type": "sticky"|"text"|"image", …, "to": "ab:…"|"el:…" }
90
90
  the new note also gets a bound arrow to that host (pass "from" only on arrows).
91
+ { "op": "create", "type": "sticky", "text": "Launch", "items": ["Write the post", { "text": "Demo", "done": true }] }
92
+ a CHECKLIST: a sticky whose text is the title and whose items are tickable entries. "items" is a
93
+ shorthand for one checkitem per entry (never stored on the sticky); at most 200 per list.
94
+ { "op": "create", "type": "checkitem", "list": <sticky|@ref>, "text"?, "done"?: true } add one entry
95
+ { "op": "update", "id": <checkitem>, "done": true } tick it (as the AI); "done": false (or null) unticks.
96
+ A locked checklist still ticks; its entries are not added, reworded, removed or reordered.
97
+ Deleting the sticky deletes its entries.
91
98
  { "op": "sticker", "sticker": "<pack>/<id>", x?, y?, w?, h?, "to"?, … }
92
99
  a Stickers-gallery picture (an image, 160 × 160 by default), authored by AI.
93
100
  { "op": "resolve", "id": <sticky> | "ids": [<sticky>, …] } resolved by AI (a person's stays);
@@ -401,7 +408,8 @@ function createOp(batch, pl, op) {
401
408
  if (fields.fill === undefined) fields.fill = NODE_FILL;
402
409
  fields.width ??= 3;
403
410
  }
404
- if (type === 'arrow' || type === 'pen') return batch.create(type, fields);
411
+ // An arrow / pen has no box to place; a checkitem has no place at all (it belongs to a sticky).
412
+ if (type === 'arrow' || type === 'pen' || type === 'checkitem') return batch.create(type, fields);
405
413
  // `to` makes a note point at something; `from` only means something on an arrow. Neither is a
406
414
  // field of a box element — silently dropping one would hide a mistake.
407
415
  const { to, from, ...boxFields } = fields;
@@ -724,7 +732,9 @@ async function main() {
724
732
  // Whatever this call put at the top level (arrows keep their hosts and stay out).
725
733
  ids = batch.created.filter((id) => {
726
734
  const e = batch.state.get(id);
727
- return e && e.type !== 'arrow' && !batch.scene.effectiveParent(e);
735
+ return (
736
+ e && e.type !== 'arrow' && e.type !== 'checkitem' && !batch.scene.effectiveParent(e)
737
+ );
728
738
  });
729
739
  }
730
740
  sectionId = batch.wrapSection({ ids, text: args.title ?? undefined });
@@ -57,7 +57,18 @@ emit_static() {
57
57
  }
58
58
 
59
59
  # ---------- server detection ----------
60
- if [ -z "$PORT" ] && [ -f "$STATE" ]; then
60
+ # #206 T6.3d — the desktop app's attested server first. 11 (the app serves this project but did not answer the
61
+ # check) never falls back to _server.json: the static, browser-free manifest instead.
62
+ APP_UNVERIFIED=0
63
+ if [ -z "$PORT" ]; then
64
+ . "$SCRIPT_DIR/_desktop-locate.sh"
65
+ desktop_port "$REPO" --lease
66
+ case $? in
67
+ 0) PORT="$DESKTOP_PORT" ;;
68
+ 11) APP_UNVERIFIED=1 ;;
69
+ esac
70
+ fi
71
+ if [ -z "$PORT" ] && [ "$APP_UNVERIFIED" = 0 ] && [ -f "$STATE" ]; then
61
72
  if command -v jq >/dev/null 2>&1; then
62
73
  PORT=$(jq -r .port "$STATE" 2>/dev/null)
63
74
  else
@@ -83,7 +94,10 @@ fi
83
94
  # the canvas-origin sandbox is on (default since phase-9.1) — mirrors
84
95
  # screenshot.sh's URL construction.
85
96
  REL_ENC=$(printf '%s' "$DESIGN_REL/$REL" | sed 's/ /%20/g')
86
- URL="http://localhost:${PORT}/_canvas-shell.html?canvas=${REL_ENC}"
97
+ # sec-loopback-bearer §7.3 — a key-required server mints the capture's frame capability only for a caller
98
+ # that sent the key: studio_capture_url asks with it and prints the capture-origin URL.
99
+ . "$SCRIPT_DIR/_desktop-locate.sh"
100
+ URL="$(studio_capture_url "$REPO" "$PORT" "/_canvas-shell.html?canvas=${REL_ENC}")"
87
101
  . "$SCRIPT_DIR/_url-guard.sh" && maude_url_guard "$URL" || exit 2 # V2-8.9 B2 — http(s) to this Mac only
88
102
 
89
103
  # ---------- engine resolution (mirrors screenshot.sh) ----------
@@ -107,7 +121,7 @@ if [ "$ENGINE" = "auto" ]; then
107
121
  fi
108
122
  fi
109
123
  ab_headless_browser
110
- echo "→ canvas-rects engine: $ENGINE | url: $URL" >&2
124
+ echo "→ canvas-rects engine: $ENGINE | url: $(maude_redact "$URL")" >&2
111
125
 
112
126
  # ---------- agent-browser lane ----------
113
127
  if [ "$ENGINE" = "agent-browser" ]; then
@@ -117,7 +131,8 @@ if [ "$ENGINE" = "agent-browser" ]; then
117
131
  exit 0
118
132
  fi
119
133
  ab_park_arm
120
- "$AB" open "$URL" >&2
134
+ # its own output can echo the URL (a frame capability): never to stderr, which the AI chat reads
135
+ "$AB" open "$URL" >/dev/null 2>&1
121
136
 
122
137
  # Poll for the hook itself (more precise than screenshot.sh's generic
123
138
  # [data-dc-screen] mount check — this is exactly what we're about to call).
@@ -36,7 +36,13 @@ if [ -z "${PORT:-}" ]; then
36
36
  exit 1
37
37
  fi
38
38
 
39
- if curl -fsS -X POST "http://127.0.0.1:${PORT}/_api/acp/focus" >/dev/null 2>&1; then
39
+ # sec-loopback-bearer §7.6 — the studio's API key, through curl's stdin config (never argv)
40
+ . "$(dirname "$0")/_desktop-locate.sh"
41
+ if ! studio_key "$REPO" "$PORT"; then
42
+ echo "chat-open: Maude has this project open, but its server did not answer the check." >&2
43
+ exit 1
44
+ fi
45
+ if studio_curl "$REPO" "$PORT" -fsS -X POST "http://127.0.0.1:${PORT}/_api/acp/focus" >/dev/null 2>&1; then
40
46
  echo "→ opened the AI chat panel in Maude (port ${PORT})."
41
47
  else
42
48
  echo "chat-open: focus request to the dev server failed (port ${PORT})." >&2
@@ -156,8 +156,12 @@ OUT_DIR="$(cd "$OUT_DIR" && pwd)"
156
156
 
157
157
  # ---------- screenshot every artboard ----------
158
158
  REL="_draw/$SLUG.proof.tsx"
159
- URL="http://localhost:$PORT/_canvas-shell.html?canvas=$REL"
160
- echo "→ screenshotting proof ladder ($URL)" >&2
159
+ # sec-loopback-bearer §7.3 — a key-required server mints the capture's frame capability only for a caller
160
+ # that sent the key: studio_capture_url asks with it and prints the capture-origin URL.
161
+ . "$SCRIPT_DIR/_desktop-locate.sh"
162
+ . "$SCRIPT_DIR/_url-guard.sh" # maude_redact — a log line never carries the frame capability
163
+ URL="$(studio_capture_url "$REPO" "$PORT" "/_canvas-shell.html?canvas=$REL")"
164
+ echo "→ screenshotting proof ladder ($(maude_redact "$URL"))" >&2
161
165
 
162
166
  bash "$SCRIPT_DIR/screenshot.sh" \
163
167
  --all-screens \
@@ -16,7 +16,7 @@
16
16
  # generate.sh --prompt "<text>" [--provider gemini|elevenlabs] [--model <id>]
17
17
  # [--modality image|audio|video] [--aspect 16:9] [--source assets/<sha8>.<ext>]
18
18
  # [--kind music|sfx|tts] [--voice <voice_id>] [--duration <seconds>]
19
- # [--root <repo>] [--timeout <sec>]
19
+ # [--approval <id>] [--root <repo>] [--timeout <sec>]
20
20
  # generate.sh --take next|prev [--root <repo>]
21
21
  #
22
22
  # --take (S8.16) swaps the picture selected in the studio (_active.json) for its
@@ -39,7 +39,7 @@
39
39
  # --modality video (provider gemini / Veo 3.1): ASYNC — the clip takes ~1–10 min;
40
40
  # the poll timeout defaults to 600s for video (180s otherwise). Produces
41
41
  # assets/<sha8>.mp4 + a provenance assets/<sha8>.footage.json stub so the clip is
42
- # reel-ready (see /design:reel Step 1.5).
42
+ # reel-ready (see /design-video:reel Step 1.5).
43
43
  #
44
44
  # The key is NEVER passed here — it lives server-side. Add it in Settings
45
45
  # (⌘,) or drop it into ~/.config/maude/keys.json (mode 0600).
@@ -49,14 +49,20 @@
49
49
  #
50
50
  # Stdout (last line): the produced asset path `/assets/<sha8>.<ext>` (for $(...)).
51
51
  # Stderr: progress / diagnostics.
52
- # Exit: 0 ok / 1 server problem / 2 bad args / 3 generation failed.
52
+ # Exit: 0 ok / 1 server problem / 2 bad args / 3 generation failed /
53
+ # 4 needs the person's OK in the app / 5 stopped by a spend limit.
54
+ #
55
+ # Spend limits: a paid job is estimated first. Over the per-session or per-day limit (Settings ›
56
+ # Advanced › Generation spend) it is STOPPED (exit 5, nothing sent, nothing charged). A single job
57
+ # above the confirm amount waits for the person: exit 4 prints an approval id, the person approves it
58
+ # in the Maude window, then re-run the SAME command with --approval <id>. The verb cannot approve.
53
59
 
54
60
  set -euo pipefail
55
61
 
56
62
  PROMPT="" PROVIDER="gemini" MODEL="" MODALITY="image" ASPECT="" SOURCE="" REPO="" TIMEOUT="" TAKE=""
57
63
  # Audio params (Phase 2) — kind = music|sfx|tts; voice = an ElevenLabs voice_id
58
64
  # (required for tts); duration = seconds (music/sfx length).
59
- KIND="" VOICE="" DURATION=""
65
+ KIND="" VOICE="" DURATION="" APPROVAL=""
60
66
 
61
67
  while [ $# -gt 0 ]; do
62
68
  case "$1" in
@@ -72,7 +78,8 @@ while [ $# -gt 0 ]; do
72
78
  --root) REPO="$2"; shift 2 ;;
73
79
  --timeout) TIMEOUT="$2"; shift 2 ;;
74
80
  --take) TAKE="$2"; shift 2 ;;
75
- --help|-h) sed -n '2,49p' "$0" | sed 's/^# \?//'; exit 0 ;;
81
+ --approval) APPROVAL="$2"; shift 2 ;;
82
+ --help|-h) sed -n '2,57p' "$0" | sed 's/^# \?//'; exit 0 ;;
76
83
  *) echo "generate.sh: unknown arg '$1'" >&2; exit 2 ;;
77
84
  esac
78
85
  done
@@ -104,6 +111,9 @@ STATE="$DESIGN_ROOT/_server.json"
104
111
  [ -f "$STATE" ] || { echo "generate.sh: no _server.json (start the dev server first)" >&2; exit 1; }
105
112
  PORT=$(jq -r '.port // empty' "$STATE" 2>/dev/null)
106
113
  [ -n "$PORT" ] || { echo "generate.sh: could not read port from $STATE" >&2; exit 1; }
114
+ # sec-loopback-bearer §7.6 — every call carries the studio's API key (studio_curl: curl's stdin config)
115
+ . "$(dirname "$0")/_desktop-locate.sh"
116
+ studio_key "$REPO" "$PORT" || { echo "generate.sh: Maude has this project open, but its server did not answer the check" >&2; exit 1; }
107
117
 
108
118
  # ── --take: ← → between a generated picture's takes, on the studio's selection ──
109
119
  if [ -n "$TAKE" ]; then
@@ -118,7 +128,7 @@ if [ -n "$TAKE" ]; then
118
128
  elif .id and .artboardId then ({ artboard: .artboardId, element: .id } + (if (.index // 0) > 0 then { occurrence: .index } else {} end))
119
129
  else empty end')
120
130
  [ -n "$ASSET" ] && [ -n "$REF" ] || { echo "generate.sh: the selection is not a picture" >&2; exit 2; }
121
- OF=$(curl -s -G "http://127.0.0.1:$PORT/_api/generate-takes/of" --data-urlencode "asset=$ASSET" --data-urlencode "canvas=$CANVAS")
131
+ OF=$(studio_curl "$REPO" "$PORT" -s -G "http://127.0.0.1:$PORT/_api/generate-takes/of" --data-urlencode "asset=$ASSET" --data-urlencode "canvas=$CANVAS")
122
132
  NEXT=$(printf '%s' "$OF" | jq -r --arg a "$ASSET" --arg dir "$TAKE" '
123
133
  (.takes // []) as $t | ($t | index($a)) as $i
124
134
  | if $i == null or ($t | length) < 2 then empty
@@ -126,7 +136,7 @@ if [ -n "$TAKE" ]; then
126
136
  [ -n "$NEXT" ] || { echo "generate.sh: that picture has no other takes" >&2; exit 3; }
127
137
  BODY=$(jq -n --arg file "$CANVAS" --argjson ref "$REF" --arg asset "$NEXT" \
128
138
  '{ file: $file, op: "image.replace", targets: [$ref], params: { asset: $asset } }')
129
- RESP=$(curl -s -X POST -H 'Content-Type: application/json' -d "$BODY" "http://127.0.0.1:$PORT/_api/edit-op")
139
+ RESP=$(studio_curl "$REPO" "$PORT" -s -X POST -H 'Content-Type: application/json' -d "$BODY" "http://127.0.0.1:$PORT/_api/edit-op")
130
140
  if [ "$(printf '%s' "$RESP" | jq -r '.ok // false' 2>/dev/null)" != "true" ]; then
131
141
  echo "generate.sh: not changed: $RESP" >&2
132
142
  exit 3
@@ -152,19 +162,31 @@ PARAMS=$(jq -n --arg kind "$KIND" --arg voice "$VOICE" --arg dur "$DURATION" '
152
162
  # Build the request body — jq handles all prompt escaping. Omit empty optionals.
153
163
  BODY=$(jq -n \
154
164
  --arg modality "$MODALITY" --arg provider "$PROVIDER" --arg model "$MODEL" \
155
- --arg prompt "$PROMPT" --arg aspect "$ASPECT" --arg source "$SOURCE" \
165
+ --arg prompt "$PROMPT" --arg aspect "$ASPECT" --arg source "$SOURCE" --arg approval "$APPROVAL" \
156
166
  --argjson params "$PARAMS" '
157
167
  { modality: $modality, provider: $provider }
158
168
  + (if $prompt != "" then { prompt: $prompt } else {} end)
159
169
  + (if $model != "" then { model: $model } else {} end)
160
170
  + (if $aspect != "" then { aspectRatio: $aspect } else {} end)
161
171
  + (if $source != "" then { sourceAsset: $source } else {} end)
172
+ + (if $approval != "" then { approvalId: $approval } else {} end)
162
173
  + (if ($params|length) > 0 then { params: $params } else {} end)')
163
174
 
164
175
  echo "generate.sh: submitting to $PROVIDER ($MODALITY)…" >&2
165
- RESP=$(curl -s -X POST -H 'Content-Type: application/json' -d "$BODY" "$BASE")
176
+ RESP=$(studio_curl "$REPO" "$PORT" -s -X POST -H 'Content-Type: application/json' -d "$BODY" "$BASE")
166
177
  JOB_ID=$(printf '%s' "$RESP" | jq -r '.jobId // empty' 2>/dev/null || echo "")
167
178
  if [ -z "$JOB_ID" ]; then
179
+ REASON=$(printf '%s' "$RESP" | jq -r '.reason // empty' 2>/dev/null || echo "")
180
+ MSG=$(printf '%s' "$RESP" | jq -r '.message // empty' 2>/dev/null || echo "")
181
+ case "$REASON" in
182
+ needs-confirm)
183
+ echo "generate.sh: $MSG" >&2
184
+ echo "generate.sh: approval id $(printf '%s' "$RESP" | jq -r '.approvalId'); once approved, re-run with --approval <id>" >&2
185
+ exit 4 ;;
186
+ run-cap|day-cap)
187
+ echo "generate.sh: $MSG" >&2
188
+ exit 5 ;;
189
+ esac
168
190
  echo "generate.sh: enqueue rejected: $RESP" >&2
169
191
  exit 3
170
192
  fi
@@ -173,7 +195,7 @@ echo "generate.sh: job $JOB_ID queued — polling…" >&2
173
195
  # Poll the job list until this job is done/failed, or the timeout elapses.
174
196
  DEADLINE=$(( $(date +%s) + TIMEOUT ))
175
197
  while :; do
176
- JOBS=$(curl -s "$BASE" 2>/dev/null || echo '{}')
198
+ JOBS=$(studio_curl "$REPO" "$PORT" -s "$BASE" 2>/dev/null || echo '{}')
177
199
  JOB=$(printf '%s' "$JOBS" | jq -c --arg id "$JOB_ID" '.jobs[]? | select(.id == $id)' 2>/dev/null || echo "")
178
200
  STATUS=$(printf '%s' "$JOB" | jq -r '.status // empty' 2>/dev/null || echo "")
179
201
  case "$STATUS" in
@@ -16,7 +16,7 @@ if [ "${1:-}" = "--help" ] || [ "${1:-}" = "-h" ]; then
16
16
  echo "usage: maude design handoff <canvas-abs-path> [designRoot] [--target web|rn|lottie|tokens]"
17
17
  echo " Emit <Slug>.registry.json (a shadcn registry handoff) next to the canvas."
18
18
  echo " --target web (default) is this verb; rn, lottie and tokens are drafted by AI:"
19
- echo " Handoff to production (Shift-Cmd-H) in Maude, or /design:to-rn and /design:to-lottie."
19
+ echo " Handoff to production (Shift-Cmd-H) in Maude, or /design:to-rn and /design-video:to-lottie."
20
20
  exit 0
21
21
  fi
22
22
  # S8.10 — the target arg (any position). `web` is the shadcn registry item this verb emits; the others
@@ -34,7 +34,7 @@ set -- "${ARGS[@]+"${ARGS[@]}"}"
34
34
  case "$TARGET" in
35
35
  web) ;;
36
36
  rn) echo "handoff: a React Native component is drafted by AI — run /design:to-rn \"<canvas>\" --out <file>, or Handoff to production in Maude" >&2; exit 2 ;;
37
- lottie) echo "handoff: a Lottie animation is drafted by AI — run /design:to-lottie \"<canvas>\" --verify, or Handoff to production in Maude" >&2; exit 2 ;;
37
+ lottie) echo "handoff: a Lottie animation is drafted by AI — run /design-video:to-lottie \"<canvas>\" --verify, or Handoff to production in Maude" >&2; exit 2 ;;
38
38
  tokens) echo "handoff: design tokens are drafted by AI — use Handoff to production in Maude (Design system › Hand off tokens)" >&2; exit 2 ;;
39
39
  *) echo "handoff: unknown --target $TARGET (web, rn, lottie or tokens)" >&2; exit 2 ;;
40
40
  esac
@@ -20,6 +20,8 @@
20
20
  # [--window WxH] [--frame today|pinned|full|WxH] [--compare-frame <same>]
21
21
  # [--variant <tag>] [--inject-css <css>] [--query <k=v&…>]
22
22
  # [--history <path>] [--json]
23
+ # [--sweep [--repeat N] [--runs N] [--sweep-zoom Z] [--speed PXS] [--after-zoom-rows N]
24
+ # [--sweeps N] [--warmup N] [--dpr D] [--gpu] [--out file.json]]
23
25
  #
24
26
  # --engine safari measures WebKit through safaridriver (one-time
25
27
  # `safaridriver --enable`, needs admin auth). Use it for anything the Tauri
@@ -40,6 +42,17 @@
40
42
  # moment the first artboard is there, while it still loads (`_perf-probe-open.mjs`): open →
41
43
  # first artboard / first drawn / all on-screen drawn, long tasks and long frames, placeholders
42
44
  # left at the gesture's end, DOM size, JS heap. `--engine safari` runs it in Playwright WebKit.
45
+ # --sweep (T9.1) The FULL-CANVAS sweep (`_perf-sweep.mjs`), the lane that reads what a person feels on a big
46
+ # board: four phases — a serpentine pan over the whole world at the overview zoom (--sweep-zoom,
47
+ # default 0.1), the same at the zoom with the most artboards on screen (fit-all, nudged), three
48
+ # fit-all <-> overview zoom cycles, and a serpentine started the instant a zoom cycle ends.
49
+ # Reports per phase: artboards on screen / mounted / standing in as a still, p50 / p95 / p99, the
50
+ # fewest frames in any 1 s window, and frames that showed an artboard which already had content
51
+ # as blank. --repeat is the passes per run, --runs the fresh page loads; the table is the median
52
+ # and min..max over every pass. --engine chromium (Playwright, headless, --window default
53
+ # 1600x920, --dpr 2) or --engine safari (safaridriver, a real window of --window, e.g.
54
+ # 2560x1340; refused with exit 3 while the page is occluded). The bare canvas page, both engines.
55
+ # Default --query artboard-live=sleep (+ artboard-still=on on chromium, where stills are opt-in).
43
56
  # --studio (chromium: Playwright, dpr-2 page at --window, V2-8.8) (safari) Measure inside the real studio shell, not the bare canvas
44
57
  # page. Makes one real WebDriver click into the canvas frame first and
45
58
  # proves it lifted WebKit's ~30 fps throttle on an untouched
@@ -86,6 +99,17 @@ PROBE_ENGINE="chromium"
86
99
  FIT_ALL=0
87
100
  STUDIO=0
88
101
  OPEN_LOAD=0
102
+ SWEEP=0
103
+ RUNS=1
104
+ SWEEP_ZOOM=""
105
+ SPEED=""
106
+ SWEEPS=""
107
+ WARMUP=""
108
+ GPU=0
109
+ AFTER_ZOOM_ROWS=""
110
+ DPR=""
111
+ OUT=""
112
+ REPEAT_SET=0
89
113
  TIMEOUT=30
90
114
  HISTORY=""
91
115
  JSON=0
@@ -106,7 +130,17 @@ while [ $# -gt 0 ]; do
106
130
  --pan) PAN="$2"; shift 2 ;;
107
131
  --zoom) ZOOM="$2"; shift 2 ;;
108
132
  --timeout) TIMEOUT="$2"; shift 2 ;;
109
- --repeat) REPEAT="$2"; shift 2 ;;
133
+ --repeat) REPEAT="$2"; REPEAT_SET=1; shift 2 ;;
134
+ --sweep) SWEEP=1; shift ;;
135
+ --runs) RUNS="$2"; shift 2 ;;
136
+ --sweep-zoom) SWEEP_ZOOM="$2"; shift 2 ;;
137
+ --speed) SPEED="$2"; shift 2 ;;
138
+ --sweeps) SWEEPS="$2"; shift 2 ;;
139
+ --warmup) WARMUP="$2"; shift 2 ;;
140
+ --gpu) GPU=1; shift ;;
141
+ --after-zoom-rows) AFTER_ZOOM_ROWS="$2"; shift 2 ;;
142
+ --dpr) DPR="$2"; shift 2 ;;
143
+ --out) OUT="$2"; shift 2 ;;
110
144
  --engine) PROBE_ENGINE="$2"; shift 2 ;;
111
145
  --fit-all) FIT_ALL=1; shift ;;
112
146
  --studio) STUDIO=1; shift ;;
@@ -140,8 +174,8 @@ if [ "$PROBE_ENGINE" != "safari" ] && { [ -n "$FRAME" ] || [ -n "$COMPARE_FRAME"
140
174
  echo "perf.sh: --frame / --compare-frame need --engine safari" >&2
141
175
  exit 2
142
176
  fi
143
- if [ "$PROBE_ENGINE" != "safari" ] && [ "$STUDIO" != "1" ] && [ -n "$WINDOW" ]; then
144
- echo "perf.sh: --window needs --engine safari or --studio" >&2
177
+ if [ "$PROBE_ENGINE" != "safari" ] && [ "$STUDIO" != "1" ] && [ "$SWEEP" != "1" ] && [ -n "$WINDOW" ]; then
178
+ echo "perf.sh: --window needs --engine safari, --studio or --sweep" >&2
145
179
  exit 2
146
180
  fi
147
181
  if { [ -n "$FRAME" ] || [ -n "$COMPARE_FRAME" ]; } && [ "$STUDIO" != "1" ]; then
@@ -149,6 +183,11 @@ if { [ -n "$FRAME" ] || [ -n "$COMPARE_FRAME" ]; } && [ "$STUDIO" != "1" ]; then
149
183
  exit 2
150
184
  fi
151
185
 
186
+ if [ "$SWEEP" = "1" ] && { [ "$STUDIO" = "1" ] || [ "$OPEN_LOAD" = "1" ]; }; then
187
+ echo "perf.sh: --sweep measures the bare canvas page; it does not combine with --studio / --open-load" >&2
188
+ exit 2
189
+ fi
190
+
152
191
  # JS runtime. The packaged desktop app ships no user `node` (DDR-177) but always
153
192
  # has a `bun` on PATH (real, or the compiled-sidecar shim `maude` stages), so
154
193
  # prefer bun and keep node as the developer-machine fallback.
@@ -162,12 +201,24 @@ DESIGN_ROOT="$REPO/.design"
162
201
  [ -d "$DESIGN_ROOT" ] || { echo "perf.sh: no .design/ under $REPO" >&2; exit 1; }
163
202
 
164
203
  STATE="$DESIGN_ROOT/_server.json"
165
- [ -f "$STATE" ] || { echo "perf.sh: $STATE missing — run 'maude design server-up' first" >&2; exit 1; }
166
-
167
- if command -v jq >/dev/null 2>&1; then
168
- PORT=$(jq -r .port "$STATE" 2>/dev/null)
169
- else
170
- PORT=$(sed -nE 's/.*"port"[[:space:]]*:[[:space:]]*([0-9]+).*/\1/p' "$STATE" | head -n1)
204
+ # #206 T6.3d — the desktop app's attested server first; _server.json only when the app does not serve it.
205
+ . "$(dirname "$0")/_desktop-locate.sh"
206
+ # sec-loopback-bearer §7.4–7.5 (re-check A) — a one-time opening link reaches a probe on an inherited
207
+ # pipe (`--launch-fd 3 3< <(studio_launch_url …)`): never its argv (`ps` shows argv to every process of
208
+ # this user) and never a file ($TMPDIR is the AI chat's own scratch folder, which the agent reads).
209
+ PORT=""
210
+ desktop_port "$REPO" --lease
211
+ case $? in
212
+ 0) PORT="$DESKTOP_PORT" ;;
213
+ 11) exit 1 ;;
214
+ esac
215
+ if [ -z "$PORT" ]; then
216
+ [ -f "$STATE" ] || { echo "perf.sh: $STATE missing — run 'maude design server-up' first" >&2; exit 1; }
217
+ if command -v jq >/dev/null 2>&1; then
218
+ PORT=$(jq -r .port "$STATE" 2>/dev/null)
219
+ else
220
+ PORT=$(sed -nE 's/.*"port"[[:space:]]*:[[:space:]]*([0-9]+).*/\1/p' "$STATE" | head -n1)
221
+ fi
171
222
  fi
172
223
  [ -n "$PORT" ] || { echo "perf.sh: no port in $STATE" >&2; exit 1; }
173
224
 
@@ -241,8 +292,10 @@ if [ -n "${QUERY:-}" ]; then
241
292
  *[!A-Za-z0-9=\&_-]*) echo "perf.sh: --query takes letters, digits and = & _ - only" >&2; exit 2 ;;
242
293
  esac
243
294
  [ "$STUDIO" = "1" ] && { echo "perf.sh: --query applies to the bare canvas page, not --studio" >&2; exit 2; }
244
- URL="${URL}&${QUERY}"
295
+ [ "$SWEEP" = "1" ] || URL="${URL}&${QUERY}"
245
296
  fi
297
+ # sec-loopback-bearer §7.3 — the bare canvas page: asked with the key, so it gets its frame capability
298
+ [ "$STUDIO" = "1" ] || URL="$(studio_capture_url "$REPO" "$PORT" "${URL#http://localhost:${PORT}}")"
246
299
  . "$SCRIPT_DIR/_url-guard.sh" && maude_url_guard "$URL" || exit 2 # V2-8.9 B2 — http(s) to this Mac only
247
300
 
248
301
  # ---------- history path ----------
@@ -272,17 +325,42 @@ if [ -z "$ENGINE_TAG" ]; then
272
325
  if [ -n "$MAUDE_DESKTOP" ]; then ENGINE_TAG="webkit-desktop"; else ENGINE_TAG="blink-headless"; fi
273
326
  fi
274
327
 
328
+ if [ "$SWEEP" = "1" ]; then
329
+ # T9.1 — the full-canvas sweep. The page is the bare canvas page (the capture URL resolved above); the
330
+ # driver adds the query itself, so one call is the same page on both engines.
331
+ SQ="${QUERY:-artboard-live=sleep}"
332
+ if [ -z "${QUERY:-}" ] && [ "$PROBE_ENGINE" = "chromium" ]; then SQ="artboard-live=sleep&artboard-still=on"; fi
333
+ SWEEP_TIMEOUT=900
334
+ [ "$TIMEOUT" -gt 30 ] && SWEEP_TIMEOUT="$TIMEOUT"
335
+ echo "→ perf --sweep: $REL_FULL | port: $PORT | engine: $PROBE_ENGINE" >&2
336
+ ARGS=(--url "$URL" --engine "$PROBE_ENGINE" --label "$REL_FULL" --runs "$RUNS" --query "$SQ" --timeout "$SWEEP_TIMEOUT")
337
+ [ "$REPEAT_SET" = "1" ] && ARGS+=(--passes "$REPEAT")
338
+ [ -n "$SWEEP_ZOOM" ] && ARGS+=(--zoom "$SWEEP_ZOOM")
339
+ [ -n "$SPEED" ] && ARGS+=(--speed "$SPEED")
340
+ [ -n "$SWEEPS" ] && ARGS+=(--sweeps "$SWEEPS")
341
+ [ -n "$WARMUP" ] && ARGS+=(--warmup "$WARMUP")
342
+ [ "$GPU" = "1" ] && ARGS+=(--gpu)
343
+ [ -n "$AFTER_ZOOM_ROWS" ] && ARGS+=(--after-zoom-rows "$AFTER_ZOOM_ROWS")
344
+ [ -n "$WINDOW" ] && ARGS+=(--window "$WINDOW")
345
+ [ -n "$DPR" ] && ARGS+=(--dpr "$DPR")
346
+ [ -n "$OUT" ] && ARGS+=(--out "$OUT")
347
+ [ "$JSON" = "1" ] && ARGS+=(--json)
348
+ # node, like the other Playwright lanes: Playwright's driver pipe is a Node contract
349
+ exec node "$SCRIPT_DIR/_perf-sweep.mjs" "${ARGS[@]}"
350
+ fi
351
+
275
352
  if [ "$OPEN_LOAD" = "1" ]; then
276
353
  # 2.0.7 — the OPEN lane: open the canvas in the studio and pan/zoom while it loads (first paint, all visible,
277
354
  # long tasks/frames, placeholders left, DOM size). Playwright Chromium or Playwright WebKit (`--engine safari`).
278
355
  OPEN_ENGINE="chromium"
279
356
  [ "$PROBE_ENGINE" = "safari" ] && OPEN_ENGINE="webkit"
280
357
  echo "→ perf --open-load: $REL_FULL | port: $PORT | engine: $OPEN_ENGINE" >&2
281
- ARGS=(--url "http://localhost:${PORT}/" --open "${REL_FULL#"$DESIGN_REL"/}" --engine "$OPEN_ENGINE" --timeout "$TIMEOUT")
358
+ # sec-loopback-bearer §7.4 — the studio page needs a session: the probe opens a one-time link first
359
+ ARGS=(--url "http://localhost:${PORT}/" --launch-fd 3 --open "${REL_FULL#"$DESIGN_REL"/}" --engine "$OPEN_ENGINE" --timeout "$TIMEOUT")
282
360
  [ -n "$WINDOW" ] && ARGS+=(--window "$WINDOW")
283
361
  [ -n "$INJECT_CSS" ] && ARGS+=(--inject-css "$INJECT_CSS")
284
362
  [ "$JSON" = "1" ] && ARGS+=(--json)
285
- exec node "$SCRIPT_DIR/_perf-probe-open.mjs" "${ARGS[@]}"
363
+ exec node "$SCRIPT_DIR/_perf-probe-open.mjs" "${ARGS[@]}" 3< <(studio_launch_url "$REPO" "$PORT" --helper)
286
364
  fi
287
365
 
288
366
  if [ "$PROBE_ENGINE" = "safari" ]; then
@@ -309,7 +387,7 @@ if [ "$PROBE_ENGINE" = "safari" ]; then
309
387
  echo "→ perf: $REL_FULL | port: $PORT | engine: webkit-safari${STUDIO:+ | studio}" >&2
310
388
  ARGS=(--url "$PROBE_URL" --label "$REL_FULL$([ "$STUDIO" = "1" ] && echo " (studio)")" --history "$HISTORY"
311
389
  --timeout "$TIMEOUT" --pan "$PAN" --zoom "$ZOOM" --repeat "$REPEAT")
312
- [ "$STUDIO" = "1" ] && ARGS+=(--studio "$SLUG")
390
+ [ "$STUDIO" = "1" ] && ARGS+=(--studio "$SLUG" --launch-fd 3)
313
391
  [ "$FIT_ALL" = "1" ] && ARGS+=(--fit-all)
314
392
  [ "$JSON" = "1" ] && ARGS+=(--json)
315
393
  [ -n "$WINDOW" ] && ARGS+=(--window "$WINDOW")
@@ -318,6 +396,9 @@ if [ "$PROBE_ENGINE" = "safari" ]; then
318
396
  [ -n "$VARIANT" ] && ARGS+=(--variant "$VARIANT")
319
397
  [ -n "$INJECT_CSS" ] && ARGS+=(--inject-css "$INJECT_CSS")
320
398
  [ "$STUDIO" = "1" ] && ARGS+=(--open "${REL_FULL#"$DESIGN_REL"/}")
399
+ if [ "$STUDIO" = "1" ]; then
400
+ exec "$JS_RUNTIME" "$SCRIPT_DIR/_perf-probe-safari.mjs" "${ARGS[@]}" 3< <(studio_launch_url "$REPO" "$PORT" --helper)
401
+ fi
321
402
  exec "$JS_RUNTIME" "$SCRIPT_DIR/_perf-probe-safari.mjs" "${ARGS[@]}"
322
403
  fi
323
404
 
@@ -329,7 +410,7 @@ if [ "$PROBE_ENGINE" = "chromium" ] && [ "$STUDIO" = "1" ]; then
329
410
  | sed -E 's/[^a-z0-9]+/-/g; s/^-+|-+$//g')
330
411
  ENGINE_TAG="${MAUDE_PERF_ENGINE_TAG:-blink-studio}"
331
412
  echo "→ perf: $REL_FULL | port: $PORT | engine: $ENGINE_TAG" >&2
332
- ARGS=(--url "http://localhost:${PORT}/" --studio "$SLUG" --label "$REL_FULL" --history "$HISTORY"
413
+ ARGS=(--url "http://localhost:${PORT}/" --launch-fd 3 --studio "$SLUG" --label "$REL_FULL" --history "$HISTORY"
333
414
  --engine-tag "$ENGINE_TAG" --timeout "$TIMEOUT" --pan "$PAN" --zoom "$ZOOM" --repeat "$REPEAT")
334
415
  [ "$FIT_ALL" = "1" ] && ARGS+=(--fit-all)
335
416
  [ "$JSON" = "1" ] && ARGS+=(--json)
@@ -338,7 +419,7 @@ if [ "$PROBE_ENGINE" = "chromium" ] && [ "$STUDIO" = "1" ]; then
338
419
  [ -n "$INJECT_CSS" ] && ARGS+=(--inject-css "$INJECT_CSS")
339
420
  # a canvas the Canvases panel does not list (the Design system canvas under system/) opens by its path
340
421
  ARGS+=(--open "${REL_FULL#"$DESIGN_REL"/}")
341
- exec node "$SCRIPT_DIR/_perf-probe-studio.mjs" "${ARGS[@]}"
422
+ exec node "$SCRIPT_DIR/_perf-probe-studio.mjs" "${ARGS[@]}" 3< <(studio_launch_url "$REPO" "$PORT" --helper)
342
423
  fi
343
424
 
344
425
  AB="${MAUDE_AGENT_BROWSER:-agent-browser}"
@@ -78,6 +78,9 @@ STATE="$DESIGN_ROOT/_server.json"
78
78
  [ -f "$STATE" ] || { echo "photo-adjust.sh: no _server.json (start the dev server first)" >&2; exit 1; }
79
79
  PORT=$(jq -r '.port // empty' "$STATE" 2>/dev/null)
80
80
  [ -n "$PORT" ] || { echo "photo-adjust.sh: could not read port from $STATE" >&2; exit 1; }
81
+ # sec-loopback-bearer §7.6 — every call carries the studio's API key (studio_curl: curl's stdin config)
82
+ . "$(dirname "$0")/_desktop-locate.sh"
83
+ studio_key "$REPO" "$PORT" || { echo "photo-adjust.sh: Maude has this project open, but its server did not answer the check" >&2; exit 1; }
81
84
 
82
85
  BASE_URL="http://127.0.0.1:$PORT/_api/photo-edit"
83
86
  # URL-encode the asset param minimally (slashes are safe as a query value here).
@@ -86,7 +89,7 @@ URL="$BASE_URL?asset=$ENC_ASSET"
86
89
 
87
90
  # --reset short-circuits: write a neutral sidecar.
88
91
  if [ "$RESET" -eq 1 ]; then
89
- RESP=$(curl -s -X PUT -H 'Content-Type: application/json' -d '{}' "$URL")
92
+ RESP=$(studio_curl "$REPO" "$PORT" -s -X PUT -H 'Content-Type: application/json' -d '{}' "$URL")
90
93
  OK=$(printf '%s' "$RESP" | jq -r '.ok // false' 2>/dev/null || echo false)
91
94
  [ "$OK" = "true" ] || { echo "photo-adjust.sh: reset rejected: $RESP" >&2; exit 3; }
92
95
  printf '%s\n' "$(printf '%s' "$RESP" | jq -r '.path')"
@@ -149,12 +152,12 @@ if [ "$REPLACE" -eq 1 ]; then
149
152
  else
150
153
  # Merge onto the current sidecar (deep object merge via jq's `*`), dropping the
151
154
  # server-stamped `version` (it's re-stamped on write).
152
- BASE=$(curl -s "$URL" 2>/dev/null || echo '{}')
155
+ BASE=$(studio_curl "$REPO" "$PORT" -s "$URL" 2>/dev/null || echo '{}')
153
156
  printf '%s' "$BASE" | jq -e . >/dev/null 2>&1 || BASE='{}'
154
157
  BODY=$(jq -n --argjson base "$BASE" --argjson patch "$PATCH" '($base | del(.version)) * $patch')
155
158
  fi
156
159
 
157
- RESP=$(curl -s -X PUT -H 'Content-Type: application/json' -d "$BODY" "$URL")
160
+ RESP=$(studio_curl "$REPO" "$PORT" -s -X PUT -H 'Content-Type: application/json' -d "$BODY" "$URL")
158
161
  OK=$(printf '%s' "$RESP" | jq -r '.ok // false' 2>/dev/null || echo false)
159
162
  if [ "$OK" != "true" ]; then
160
163
  echo "photo-adjust.sh: server rejected the edit: $RESP" >&2
@@ -250,8 +250,8 @@ URL="http://localhost:$PORT/_canvas-shell.html?canvas=$REL&nonce=$NONCE"
250
250
  . "$SCRIPT_DIR/_url-guard.sh" && maude_url_guard "$URL" || exit 2 # V2-8.9 B2 — http(s) to this Mac only
251
251
  SEL="[data-photo-bgremove-status]"
252
252
 
253
- echo "→ driving $URL (session $SESSION)" >&2
254
- if ! "$AB" --session "$SESSION" open "$URL" >&2; then
253
+ echo "→ driving $(maude_redact "$URL") (session $SESSION)" >&2
254
+ if ! "$AB" --session "$SESSION" open "$URL" >/dev/null 2>&1; then
255
255
  echo "photo-bg-remove.sh: agent-browser failed to open the harness canvas" >&2
256
256
  exit 3
257
257
  fi