@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
@@ -37,7 +37,7 @@ import {
37
37
  V2_ONLY_FORMATS,
38
38
  } from '../lib/export-spec.mjs';
39
39
  import { writeGitignoreBlock } from '../lib/gitignore-block.mjs';
40
- import { isCompiledBinary } from '../lib/pkg-root.mjs';
40
+ import { isCompiledBinary, resolveAppSidecar } from '../lib/pkg-root.mjs';
41
41
  import { subVerbArgs } from '../lib/sub-verbs.mjs';
42
42
 
43
43
  const SUBCOMMANDS = new Set([
@@ -128,6 +128,10 @@ const BIN_VERBS = new Set([
128
128
  // reads the clip as a file:// resource).
129
129
  'ingest-footage',
130
130
  'probe-footage',
131
+ // #128 §1. `video-proxy` writes an H.264 / constant-frame-rate / single-AAC copy of ONE
132
+ // asset next to it, for a clip that is HEVC, variable frame rate or has a second audio
133
+ // track (the ones the export's audio renderer cannot decode). Explicit, never automatic.
134
+ 'video-proxy',
131
135
  // feature-scene-aware-keyframes. `smart-frames` is the scene-AWARE sibling of
132
136
  // `probe-footage`: it selects keyframes at scene cuts + semantic action beats +
133
137
  // endpoints (three tiers, auto-detected — gemma scout / ffmpeg scene-detect /
@@ -289,7 +293,11 @@ export async function run({ args, pkgRoot }) {
289
293
  if (sub === 'link') return runLink({ args });
290
294
  if (sub === 'unlink') return runUnlink({ args });
291
295
  if (sub === 'detach') return runDetach({ args });
292
- if (sub === 'status') return runStatus({ args });
296
+ if (sub === 'status')
297
+ return runStatus({
298
+ args,
299
+ unsynced: (designRoot) => unsyncedViaHelper({ pkgRoot, designRoot }),
300
+ });
293
301
  if (sub === 'adopt') return runAdopt({ args });
294
302
  if (sub === 'bulk-deletes') return runBulkDeletes({ args });
295
303
  if (sub === 'open') {
@@ -401,6 +409,37 @@ export function isVirtualNapiPath(p) {
401
409
  return typeof p === 'string' && /^(\/\$bunfs\/|[A-Za-z]:[\\/]~BUN[\\/])/.test(p);
402
410
  }
403
411
 
412
+ /**
413
+ * #158 — the files a linked canvas uses that will not reach the workspace, for `maude design status`.
414
+ * The diagnostic is TypeScript over the sync classifier, so it runs in the bundled helper under bun
415
+ * (the same `bun` resolution every bin helper gets — RCA G3). Read-only; returns the report (with its
416
+ * terminal `lines`), or null when the helper cannot run — status then simply says nothing about it.
417
+ */
418
+ export function unsyncedViaHelper({ pkgRoot, designRoot }) {
419
+ const script = join(pkgRoot, 'apps', 'studio', 'bin', '_unsynced-refs.mjs');
420
+ if (!existsSync(script)) return null;
421
+ const { env, shimDir } = ensureBunOnPath({ ...process.env }, pkgRoot);
422
+ try {
423
+ const r = spawnSync('bun', [script, '--design-root', designRoot, '--json'], {
424
+ env,
425
+ encoding: 'utf8',
426
+ timeout: 30_000,
427
+ });
428
+ if (r.error || r.status !== 0) return null;
429
+ return JSON.parse(r.stdout.trim().split('\n').pop() ?? 'null');
430
+ } catch {
431
+ return null;
432
+ } finally {
433
+ if (shimDir) {
434
+ try {
435
+ rmSync(shimDir, { recursive: true, force: true });
436
+ } catch {
437
+ /* best-effort cleanup */
438
+ }
439
+ }
440
+ }
441
+ }
442
+
404
443
  function runBinDispatch(verb, { args, pkgRoot }) {
405
444
  if (!BIN_VERBS.has(verb)) {
406
445
  process.stderr.write(`maude design: "${verb}" is not a dev-tooling verb.\n${usage()}`);
@@ -456,9 +495,15 @@ function runBinDispatch(verb, { args, pkgRoot }) {
456
495
  // server.ts crashes at boot on `yjs`. server-up.sh prefers MAUDE_DEV_SERVER_BIN
457
496
  // when set; absent ⇒ dev tree ⇒ it falls back to `bun server.ts`. Helpers that
458
497
  // shell into server-up.sh (visual-sanity, smoke) inherit it. DDR-084.
498
+ // T1.10 (#206) — from the packaged app with no desktop parent (a terminal), the compiled server
499
+ // beside this CLI, with the env the desktop gives it (appSidecarEnv).
459
500
  if (BOOT_VERBS.has(verb) && !process.env.MAUDE_DEV_SERVER_BIN) {
460
- const bin = resolveServerBinary({ pkgRoot });
461
- if (bin) childEnv.MAUDE_DEV_SERVER_BIN = bin;
501
+ const app = appSidecar(pkgRoot);
502
+ if (app) Object.assign(childEnv, appSidecarEnv(app, process.env));
503
+ else {
504
+ const bin = resolveServerBinary({ pkgRoot });
505
+ if (bin) childEnv.MAUDE_DEV_SERVER_BIN = bin;
506
+ }
462
507
  }
463
508
  // RCA G3 — make `bun` resolvable to the helper from the bundled compiled binary
464
509
  // when no standalone `bun` is installed (desktop / npm). No-op in dev. The shim
@@ -531,7 +576,7 @@ Dev-tooling (dispatch to the dev-server bash helpers — DDR-062):
531
576
  screenshot · server-up · prep · slug · bootstrap-check · runtime-health
532
577
  smoke · canvas-edit · handoff · asset-sweep · visual-sanity · fetch-asset
533
578
  draw-build · draw-proof · svg-optimize · to-lottie · read-annotations · annotate
534
- canvas-rects · canvas-errors · canvas-source · ingest-footage · probe-footage · smart-frames
579
+ canvas-rects · canvas-errors · canvas-source · ingest-footage · probe-footage · video-proxy · smart-frames
535
580
  generate · transcribe · transcribe-local · audio-search
536
581
  Invoke the bundled helper of the same name. maude resolves it from its
537
582
  own package root and sets CLAUDE_PLUGIN_ROOT for the child; stdout,
@@ -629,8 +674,44 @@ Dev-tooling (dispatch to the dev-server bash helpers — DDR-062):
629
674
  `;
630
675
  }
631
676
 
677
+ /**
678
+ * #206 T6.3d (contract 206-cli-reuses-desktop.md §2): `serve` when the desktop app already serves
679
+ * the project → a pointer and exit 0, no second server; `--force` keeps the old behaviour. The
680
+ * server it does start runs as role `cli` (MAUDE_SERVER_ROLE=cli), so it steps down by itself once
681
+ * the app serves the project (shell/cli-yield.ts). The root is the server's own order: --root,
682
+ * $CLAUDE_PROJECT_DIR, the cwd (context.ts resolveRepoRoot).
683
+ */
684
+ export async function serveDesktopGuard(
685
+ forwarded,
686
+ { env = process.env, cwd = process.cwd() } = {}
687
+ ) {
688
+ const force = forwarded.includes('--force');
689
+ const rest = forwarded.filter((a) => a !== '--force');
690
+ const i = rest.indexOf('--root');
691
+ const root =
692
+ i !== -1 && rest[i + 1]
693
+ ? resolve(rest[i + 1])
694
+ : env.CLAUDE_PROJECT_DIR
695
+ ? resolve(env.CLAUDE_PROJECT_DIR)
696
+ : cwd;
697
+ if (force) return { forwarded: rest, served: null };
698
+ const { locateDesktop } = await import('../lib/desktop-locate.mjs');
699
+ const served = await locateDesktop(root, { env });
700
+ return { forwarded: rest, served };
701
+ }
702
+
632
703
  async function runServe({ args, pkgRoot }) {
633
- const forwarded = args.slice(args.indexOf('serve') + 1);
704
+ const guard = await serveDesktopGuard(args.slice(args.indexOf('serve') + 1));
705
+ if (guard.served) {
706
+ process.stdout.write(
707
+ 'Maude is already serving this project — it is open in the Maude app.\n' +
708
+ ' `maude design open <canvas>` shows a canvas there. To start a separate server anyway: maude design serve --force\n'
709
+ );
710
+ process.exit(0);
711
+ }
712
+ const forwarded = guard.forwarded;
713
+ // the server reads it once and drops it from its own env (server.ts); a shell spawn never has it
714
+ process.env.MAUDE_SERVER_ROLE = 'cli';
634
715
  const fs = await import('node:fs');
635
716
 
636
717
  // Resolution order:
@@ -641,11 +722,20 @@ async function runServe({ args, pkgRoot }) {
641
722
  // 4. Hard-fail with actionable hint.
642
723
  // Maintainers hacking on the dev-server source can force #3 with
643
724
  // MAUDE_FORCE_SOURCE=1.
725
+ // 0. The packaged app: the compiled server beside this CLI (T1.10) — the staged source in
726
+ // Contents/Resources has no node_modules, so nothing below can boot it there.
644
727
  const forceSource = process.env.MAUDE_FORCE_SOURCE === '1';
645
728
  const sideChannel = resolve(pkgRoot, 'cli', '.platform-binary-path');
646
729
  let binPath = null;
730
+ let binEnv = process.env;
731
+
732
+ const app = appSidecar(pkgRoot);
733
+ if (app) {
734
+ binPath = app.bin;
735
+ binEnv = { ...process.env, ...appSidecarEnv(app, process.env) };
736
+ }
647
737
 
648
- if (!forceSource) {
738
+ if (!forceSource && !binPath) {
649
739
  try {
650
740
  if (fs.existsSync(sideChannel)) {
651
741
  const candidate = fs.readFileSync(sideChannel, 'utf8').trim();
@@ -670,7 +760,7 @@ async function runServe({ args, pkgRoot }) {
670
760
  }
671
761
 
672
762
  if (binPath) {
673
- const child = spawn(binPath, forwarded, { stdio: 'inherit', env: process.env });
763
+ const child = spawn(binPath, forwarded, { stdio: 'inherit', env: binEnv });
674
764
  child.on('exit', (code) => process.exit(code ?? 0));
675
765
  child.on('error', (err) => {
676
766
  process.stderr.write(`maude design serve (binary ${binPath}): ${err.message}\n`);
@@ -791,8 +881,29 @@ export function isPlausiblePlatformBinary(p) {
791
881
  return /^maude-[a-z0-9-]+$/.test(basename(dirname(p)));
792
882
  }
793
883
 
884
+ /** The packaged app's compiled server beside this CLI (T1.10), or null; MAUDE_FORCE_SOURCE=1 wins. */
885
+ function appSidecar(pkgRoot) {
886
+ if (process.env.MAUDE_FORCE_SOURCE === '1') return null;
887
+ return resolveAppSidecar({ pkgRoot, execPath: process.execPath });
888
+ }
889
+
890
+ /**
891
+ * The env the desktop starts the same server with (sidecar.rs): MAUDE_DEV_SERVER_BIN for the helper,
892
+ * and MAUDE_DEV_SERVER_ROOT / MAUDE_PKG_ROOT so the compiled server, alone in Contents/MacOS, finds
893
+ * the staged studio. A value the caller already has is kept.
894
+ */
895
+ export function appSidecarEnv(app, env) {
896
+ return {
897
+ MAUDE_DEV_SERVER_BIN: app.bin,
898
+ MAUDE_DEV_SERVER_ROOT: env.MAUDE_DEV_SERVER_ROOT || app.devServerRoot,
899
+ MAUDE_PKG_ROOT: env.MAUDE_PKG_ROOT || app.pkgRoot,
900
+ };
901
+ }
902
+
794
903
  export function resolveServerBinary({ pkgRoot }) {
795
904
  if (process.env.MAUDE_FORCE_SOURCE === '1') return null;
905
+ const app = appSidecar(pkgRoot);
906
+ if (app) return app.bin;
796
907
  // In the local source checkout, return null so server-up.sh boots
797
908
  // `bun server.ts` from source — the maintainer is editing the dev-server and
798
909
  // needs their working copy live, not a stale compiled binary that happens to
@@ -37,7 +37,7 @@
37
37
  import { createHash } from 'node:crypto';
38
38
  import { readdirSync, readFileSync, statSync } from 'node:fs';
39
39
  import { homedir, tmpdir } from 'node:os';
40
- import { basename, isAbsolute, join, relative, resolve, sep } from 'node:path';
40
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
41
41
 
42
42
  import { realpathDeep } from './confine-out.mjs';
43
43
  import { DESIGN_ROOT_FLAGS, ROOT_FLAGS, SESSION_ENV_KEYS } from './confine-root.mjs';
@@ -597,6 +597,25 @@ const HUMAN_ONLY_ROUTES = [
597
597
  what: 'Move to cloud',
598
598
  why: 'it uploads the project to their billed cloud account',
599
599
  },
600
+ // 2.1.1 — Link your server: THIS folder joins the person's team server; the studio answers a
601
+ // write without the window's own fetch 403 window-only (routes/hub-link-folder.ts).
602
+ {
603
+ re: /\/_api\/hub\/link-folder(?![\w-])/i,
604
+ what: 'Link your server',
605
+ why: "it uploads the project to their team server with this Mac's sign-in",
606
+ },
607
+ // 2.1.1 T8 — a team-server sign-in and saving a team-server credential are the person's acts; the
608
+ // studio answers them 403 person-only to a key holder (shell/api-key.ts PERSON_ONLY).
609
+ {
610
+ re: /\/_api\/hub-signin\/(?:start|check)(?![\w-])/i,
611
+ what: 'Sign in to your server',
612
+ why: 'it signs this Mac in to a team server and stores that sign-in',
613
+ },
614
+ {
615
+ re: /\/_api\/hub\/link(?![\w-])/i,
616
+ what: 'Save a server sign-in',
617
+ why: "it stores a team server's credential on this Mac",
618
+ },
600
619
  // V2-8.9 defender M1 (decision maude/v2-8.9-sync-link-confirm-needs-fetch-metadata).
601
620
  {
602
621
  re: /\/_api\/sync\/link\/confirm(?![\w-])/i,
@@ -816,7 +835,7 @@ export function designVerbOf(cmd, verbs) {
816
835
  * a flag denylist over tools that add flags per release is the class Claude Code's own read-only
817
836
  * check lost to (CVE-2025-64755, CVE-2025-66032); leaving them out costs only a claim window.
818
837
  */
819
- const READERS = new Set([
838
+ export const READERS = new Set([
820
839
  'ls',
821
840
  'cat',
822
841
  'head',
@@ -966,25 +985,52 @@ function headNames(words) {
966
985
  * `sh -c` script that does, or an interpreter script whose visible text forks or detaches. An
967
986
  * unparseable command (or a `sh -c` script it can't read) may: that is `unparsed`, true by default
968
987
  * (fail closed — the ACP claim window). The caller keeps the call's claim window open until the
969
- * turn ends instead of the call's return + settle. A script FILE (`python3 w.py`) is not read —
970
- * the named residual (binding by what changed, not by time, is follow-up F3).
988
+ * turn ends instead of the call's return + settle.
989
+ * #168 E4: given the call's `cwd` and project `root`, a script FILE the call runs (`python3 w.py`,
990
+ * `bash run.sh`, `. env.sh`, `./run.sh`) is read like an inline script — only a regular file inside
991
+ * the root (realpath'd), at most `scriptMaxBytes`; a bigger one is unknown (`unparsed`). Without a
992
+ * root nothing is read.
971
993
  * p8-secfix-hook-2 N3: the design hook passes `unparsed: false` — a background mark binds every
972
994
  * later change to the AI until the turn ends, so it is kept for a call that visibly backgrounds.
973
995
  *
974
996
  * @param {unknown} command
975
- * @param {{ unparsed?: boolean, depth?: number }} [opts]
997
+ * @param {{ unparsed?: boolean, depth?: number, cwd?: string | null, root?: string | null, scriptMaxBytes?: number }} [opts]
976
998
  * @returns {boolean}
977
999
  */
978
- export function bashBackgrounds(command, { unparsed = true, depth = 0 } = {}) {
1000
+ export function bashBackgrounds(
1001
+ command,
1002
+ { unparsed = true, depth = 0, cwd = null, root = null, scriptMaxBytes = 262_144 } = {}
1003
+ ) {
979
1004
  if (typeof command !== 'string' || !command.trim()) return false;
980
1005
  const cmds = parseBash(command);
981
1006
  if (!cmds) return unparsed;
1007
+ let here = cwd ? resolve(cwd) : null;
1008
+ const deeper = (text) =>
1009
+ depth < 4 &&
1010
+ bashBackgrounds(text, { unparsed, depth: depth + 1, cwd: here, root, scriptMaxBytes });
1011
+ /** E4 — a script file's verdict: true / false, or null when there is no readable file. */
1012
+ const fileDetaches = (word, asShell) => {
1013
+ const t = scriptFileText(word, here, root, scriptMaxBytes);
1014
+ if (t === null) return null;
1015
+ if (t === undefined) return unparsed;
1016
+ return asShell ? deeper(t) : SCRIPT_DETACHES.test(t);
1017
+ };
982
1018
  for (const cmd of cmds) {
983
1019
  if (cmd.bg) return true;
984
1020
  const names = headNames(cmd.words);
985
1021
  if (names.some((n) => BG_HEADS.has(n))) return true;
986
1022
  const e = effective(cmd.words);
987
1023
  if (!e) continue;
1024
+ // a literal `cd` moves where a relative script path resolves (as callCoverage tracks it)
1025
+ if (e.raw === 'cd' || e.raw === 'pushd') {
1026
+ if (here && e.args[0]?.literal && !isOpt(e.args[0])) here = resolve(here, e.args[0].text);
1027
+ continue;
1028
+ }
1029
+ // `. env.sh` / `source env.sh` run the file in this shell
1030
+ if (root && (e.raw === '.' || e.raw === 'source')) {
1031
+ if (fileDetaches(e.args[0], true)) return true;
1032
+ continue;
1033
+ }
988
1034
  if (SHELLS.has(e.name)) {
989
1035
  const k = e.args.findIndex((a) => a.literal && /^-[A-Za-z]*c[A-Za-z]*$/.test(a.text));
990
1036
  const script = k === -1 ? null : e.args[k + 1];
@@ -998,17 +1044,62 @@ export function bashBackgrounds(command, { unparsed = true, depth = 0 } = {}) {
998
1044
  const doc = k === -1 ? cmd.redirs.find((r) => r.op === '<<' || r.op === '<<-') : null;
999
1045
  if (doc?.body && depth < 4 && bashBackgrounds(doc.body, { unparsed, depth: depth + 1 }))
1000
1046
  return true;
1047
+ // `bash run.sh`: the script is a file (E4)
1048
+ if (root && k === -1 && !doc && fileDetaches(operands(e.args)[0], true)) return true;
1001
1049
  continue;
1002
1050
  }
1003
1051
  const lang = Object.hasOwn(INTERPRETERS, e.name) ? e.name : null;
1004
1052
  if (lang) {
1005
1053
  const text = scriptText(cmd, e.args, INTERPRETERS[lang], lang);
1006
1054
  if (text && SCRIPT_DETACHES.test(text)) return true;
1055
+ // `python3 w.py`: no inline program, the first operand is the script file (E4)
1056
+ if (!text && root && fileDetaches(operands(e.args)[0], false)) return true;
1057
+ continue;
1058
+ }
1059
+ // `./run.sh`, `tools/go`: the program word itself is a script file (E4) — its shebang says how
1060
+ // it runs; a file with none runs as a shell script, a binary (NUL bytes) is not read
1061
+ if (root && e.raw.includes('/')) {
1062
+ const t = scriptFileText(
1063
+ cmd.words[cmd.words.length - e.args.length - 1],
1064
+ here,
1065
+ root,
1066
+ scriptMaxBytes
1067
+ );
1068
+ if (t === undefined && unparsed) return true;
1069
+ if (typeof t === 'string' && !t.includes('\0')) {
1070
+ const bang = /^#!\s*(\S+)(?:\s+(\S+))?/.exec(t);
1071
+ const runner = bang
1072
+ ? nameOf(
1073
+ bang[1] === '/usr/bin/env' || nameOf(bang[1]) === 'env' ? (bang[2] ?? '') : bang[1]
1074
+ )
1075
+ : 'sh';
1076
+ if (SHELLS.has(runner) ? deeper(t) : SCRIPT_DETACHES.test(t)) return true;
1077
+ }
1007
1078
  }
1008
1079
  }
1009
1080
  return false;
1010
1081
  }
1011
1082
 
1083
+ /**
1084
+ * #168 E4 — the text of a script file `word` names: a literal path resolved against `cwd`, realpath'd
1085
+ * inside `root`, a regular file of at most `max` bytes. `null` = no such file (missing, outside the
1086
+ * root, not a file, unreadable); `undefined` = a file too big to read.
1087
+ */
1088
+ function scriptFileText(word, cwd, root, max) {
1089
+ if (!root || !word?.literal || !word.text || word.text.includes('\0')) return null;
1090
+ if (!isAbsolute(word.text) && !cwd) return null;
1091
+ const real = realpathDeep(isAbsolute(word.text) ? word.text : resolve(cwd, word.text));
1092
+ if (!within(real, realpathDeep(resolve(root)))) return null;
1093
+ try {
1094
+ const st = statSync(real);
1095
+ if (!st.isFile()) return null;
1096
+ if (st.size > max) return undefined;
1097
+ return readFileSync(real, 'utf8');
1098
+ } catch {
1099
+ return null;
1100
+ }
1101
+ }
1102
+
1012
1103
  /**
1013
1104
  * The pre-bash decision for `command` run in `cwd`: { code, reason } or null (no decision).
1014
1105
  * Every path is realpath'd before it is judged (`designPath`): the design-root rules see the file
@@ -1714,4 +1805,273 @@ export function changedDesignFiles(designRoot, hashes, since, opts = {}) {
1714
1805
  return out;
1715
1806
  }
1716
1807
 
1808
+ /**
1809
+ * #164 B1 — the frozen READERS list `bash-guard-readers.test.mjs` compares `READERS` against. A tool
1810
+ * joins `READERS` only if none of its flags writes a file (no `-o FILE`, no `w` command, no `-i`, no
1811
+ * `--output`, no `--pre CMD`): a reader that does costs a wrong "provably a read", so a call that runs
1812
+ * it skips the window and its write lands as outside. Adding one means changing this pin in the same
1813
+ * commit, with the "cannot write" check the test names.
1814
+ */
1815
+ export const READERS_PIN = Object.freeze([
1816
+ '[',
1817
+ 'basename',
1818
+ 'cat',
1819
+ 'cd',
1820
+ 'cmp',
1821
+ 'column',
1822
+ 'cut',
1823
+ 'date',
1824
+ 'df',
1825
+ 'diff',
1826
+ 'dirname',
1827
+ 'du',
1828
+ 'echo',
1829
+ 'egrep',
1830
+ 'false',
1831
+ 'fgrep',
1832
+ 'find',
1833
+ 'grep',
1834
+ 'head',
1835
+ 'jq',
1836
+ 'ls',
1837
+ 'md5',
1838
+ 'nl',
1839
+ 'popd',
1840
+ 'printf',
1841
+ 'pushd',
1842
+ 'pwd',
1843
+ 'readlink',
1844
+ 'realpath',
1845
+ 'sha256sum',
1846
+ 'shasum',
1847
+ 'sleep',
1848
+ 'stat',
1849
+ 'tail',
1850
+ 'test',
1851
+ 'tr',
1852
+ 'true',
1853
+ 'type',
1854
+ 'wc',
1855
+ 'which',
1856
+ ]);
1857
+
1858
+ // ── #164 B1: the lane snapshot, its diff, and what a call can plausibly write ────────────────
1859
+
1860
+ /** @typedef {{ v: 1, complete: boolean, files: Record<string, [string, string, number, string, string | null]> }} LaneManifest */
1861
+
1862
+ const laneSha = (bytes) => createHash('sha256').update(bytes).digest('hex');
1863
+ const sameKey = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
1864
+ const filesOf = (m) =>
1865
+ m && typeof m === 'object' && m.files && typeof m.files === 'object' ? m.files : null;
1866
+
1867
+ /**
1868
+ * A manifest of every canvas-lane file of `designRoot`: `rel → [mtimeNs, ctimeNs, size, ino, sha]`.
1869
+ * The stat key includes `ctime` (a `touch -r` restore moves it) and the inode (a rename-over). The sha
1870
+ * (sha256, hex) is taken only on a cache miss, within `budgetMs`: a file whose key matches `prev` or
1871
+ * `cache` reuses that sha, so a stat-only pass hashes nothing. Past a bound (`budgetMs`, `maxEntries`,
1872
+ * `maxFiles`) the rest has `sha: null` or is left out, and `complete` is false. The hash cache is
1873
+ * non-authoritative: a stale entry can only mis-list a touch, never claim bytes (the studio re-reads).
1874
+ *
1875
+ * @returns {LaneManifest}
1876
+ */
1877
+ export function laneSnapshot(
1878
+ designRoot,
1879
+ { prev = null, cache = null, budgetMs = 800, maxEntries = 50_000, maxFiles = 20_000 } = {}
1880
+ ) {
1881
+ const t0 = performance.now();
1882
+ const pf = filesOf(prev);
1883
+ const cf = filesOf(cache);
1884
+ /** @type {LaneManifest['files']} */
1885
+ const files = {};
1886
+ let complete = true;
1887
+ let entries = 0;
1888
+ let count = 0;
1889
+ let stop = false;
1890
+ const walk = (dir, relDir) => {
1891
+ let names;
1892
+ try {
1893
+ names = readdirSync(dir, { withFileTypes: true });
1894
+ } catch {
1895
+ return;
1896
+ }
1897
+ for (const d of names) {
1898
+ if (stop) return;
1899
+ if (++entries > maxEntries) {
1900
+ complete = false;
1901
+ stop = true;
1902
+ return;
1903
+ }
1904
+ if (d.name.startsWith('_') || d.name.startsWith('.') || d.name === 'node_modules') continue;
1905
+ const abs = join(dir, d.name);
1906
+ const rel = relDir ? `${relDir}/${d.name}` : d.name;
1907
+ if (d.isDirectory()) {
1908
+ walk(abs, rel);
1909
+ } else if (d.isFile() && LANE_FILE_RE.test(d.name)) {
1910
+ if (count >= maxFiles) {
1911
+ complete = false;
1912
+ stop = true;
1913
+ return;
1914
+ }
1915
+ let st;
1916
+ try {
1917
+ st = statSync(abs, { bigint: true });
1918
+ } catch {
1919
+ continue; // gone
1920
+ }
1921
+ const key = [String(st.mtimeNs), String(st.ctimeNs), Number(st.size), String(st.ino)];
1922
+ let sha = null;
1923
+ for (const src of [pf, cf]) {
1924
+ const e = src && Object.hasOwn(src, rel) ? src[rel] : null;
1925
+ if (Array.isArray(e) && e.length >= 5 && sameKey(e, key) && typeof e[4] === 'string') {
1926
+ sha = e[4];
1927
+ break;
1928
+ }
1929
+ }
1930
+ if (sha === null) {
1931
+ if (performance.now() - t0 >= budgetMs) complete = false;
1932
+ else {
1933
+ try {
1934
+ sha = laneSha(readFileSync(abs));
1935
+ } catch {
1936
+ continue; // gone
1937
+ }
1938
+ }
1939
+ }
1940
+ files[rel] = [...key, sha];
1941
+ count++;
1942
+ }
1943
+ }
1944
+ };
1945
+ walk(designRoot, '');
1946
+ return { v: 1, complete, files };
1947
+ }
1948
+
1949
+ /**
1950
+ * The lane files that differ between two manifests, sorted by path:
1951
+ * `{ path, sha, created, deleted }` with `sha` the post-call bytes' sha256, or null when it cannot be
1952
+ * stated (the file was past the budget, so no pre-hash exists, or no post-hash): null never claims.
1953
+ * A rewrite to the same bytes (a `sed -i` with no match) is not listed. An incomplete manifest proves
1954
+ * neither a create (pre) nor a delete (post), so those are not reported as such.
1955
+ */
1956
+ export function laneDiff(pre, post) {
1957
+ const a = filesOf(pre);
1958
+ const b = filesOf(post);
1959
+ if (!a || !b) return [];
1960
+ const out = [];
1961
+ for (const [path, q] of Object.entries(b)) {
1962
+ const p = Object.hasOwn(a, path) ? a[path] : null;
1963
+ if (!p) {
1964
+ const proven = pre.complete === true;
1965
+ out.push({ path, sha: proven ? (q[4] ?? null) : null, created: proven, deleted: false });
1966
+ } else if (!sameKey(p, q)) {
1967
+ // a rewrite to the same bytes (`sed -i` with no match) is not a change
1968
+ if (p[4] === null) out.push({ path, sha: null, created: false, deleted: false });
1969
+ else if (q[4] === null || q[4] !== p[4])
1970
+ out.push({ path, sha: q[4] ?? null, created: false, deleted: false });
1971
+ }
1972
+ }
1973
+ if (post.complete === true)
1974
+ for (const path of Object.keys(a))
1975
+ if (!Object.hasOwn(b, path)) out.push({ path, sha: null, created: false, deleted: true });
1976
+ return out.sort((x, y) => (x.path < y.path ? -1 : x.path > y.path ? 1 : 0));
1977
+ }
1978
+
1979
+ const SCRIPT_EXT_RE = /\.(?:py|mjs|cjs|js|ts|mts|cts|sh|bash|zsh|rb|pl|php|lua)$/i;
1980
+ const LANE_EXT = '(?:tsx|jsx|meta\\.json|annotations\\.json)';
1981
+ const QUOTED_LANE_RE = new RegExp(`(["'\`])([^"'\`\\n]{1,300}?\\.${LANE_EXT})\\1`, 'gi');
1982
+ const BARE_LANE_RE = new RegExp(
1983
+ `(?:^|[\\s=(,\\[:])([^\\s"'\`<>|;&()=,\\[\\]]+\\.${LANE_EXT})(?![A-Za-z0-9_.-])`,
1984
+ 'gi'
1985
+ );
1986
+ const reEscape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1987
+ const posix = (p) => p.split(sep).join('/');
1988
+
1989
+ /**
1990
+ * What a call that may write can plausibly write, judged from its command text (and the text of a
1991
+ * script file it runs: a literal operand with a script extension, or the program word itself, an existing
1992
+ * file inside the project, at most `scriptMaxBytes`):
1993
+ * `named` — canvas-lane files the text names, plus lane paths it names that do not exist yet (a
1994
+ * create), resolved against the effective cwd (a literal `cd` moves it);
1995
+ * `all` — names none, but the text references the design root (its absolute path or its `.design`
1996
+ * segment), or the cwd is inside it, or it names more files than one window carries;
1997
+ * `none` — anything else (`pnpm test`, `git pull`): no snapshot, no window; a canvas such a call
1998
+ * writes lands as outside.
1999
+ *
2000
+ * @param {string} designRoot
2001
+ * @param {string} cwd
2002
+ * @param {unknown} command
2003
+ * @returns {{ mode: 'named' | 'all' | 'none', files: string[] }}
2004
+ */
2005
+ export function callCoverage(designRoot, cwd, command, { scriptMaxBytes = 262_144 } = {}) {
2006
+ if (typeof command !== 'string' || !command.trim()) return { mode: 'none', files: [] };
2007
+ const root = resolve(designRoot);
2008
+ const project = dirname(root);
2009
+ const inProject = (abs) => abs === project || abs.startsWith(project + sep);
2010
+ const inDesign = (abs) => abs === root || abs.startsWith(root + sep);
2011
+ const base = basename(root);
2012
+ const cmds = parseBash(command);
2013
+ // the effective cwd, and the files a script word names
2014
+ let cur = resolve(cwd || '.');
2015
+ let cdInside = inDesign(cur);
2016
+ const texts = [command];
2017
+ const cwds = [cur];
2018
+ const scripts = new Set();
2019
+ for (const cmd of cmds ?? []) {
2020
+ const e = effective(cmd.words);
2021
+ if (e && e.name === 'cd' && e.args[0]?.literal && !isOpt(e.args[0])) {
2022
+ cur = resolve(cur, e.args[0].text);
2023
+ cwds.push(cur);
2024
+ if (inDesign(cur)) cdInside = true;
2025
+ continue;
2026
+ }
2027
+ cmd.words.forEach((w, i) => {
2028
+ if (!w.literal || !w.text || w.text.startsWith('-')) return;
2029
+ if (SCRIPT_EXT_RE.test(w.text) || (i === 0 && /[/.]/.test(w.text))) {
2030
+ const abs = resolve(cur, w.text);
2031
+ if (inProject(abs)) scripts.add(abs);
2032
+ }
2033
+ });
2034
+ }
2035
+ for (const abs of scripts) {
2036
+ try {
2037
+ const st = statSync(abs);
2038
+ if (!st.isFile() || st.size > scriptMaxBytes) continue;
2039
+ texts.push(readFileSync(abs, 'utf8'));
2040
+ } catch {
2041
+ /* not a readable file */
2042
+ }
2043
+ }
2044
+ const text = texts.join('\n');
2045
+ const found = new Set(namedDesignFiles(designRoot, text, { max: 33 }));
2046
+ // lane paths that do not exist yet (a create), resolved against the effective cwd
2047
+ const cands = new Set();
2048
+ for (const m of text.matchAll(QUOTED_LANE_RE)) cands.add(m[2]);
2049
+ // a bare scan over what the quoted scan left (else `'A B Cut.tsx'` also yields `Cut.tsx`)
2050
+ for (const m of text.replace(QUOTED_LANE_RE, ' ').matchAll(BARE_LANE_RE)) cands.add(m[1]);
2051
+ for (const c of cands) {
2052
+ if (/[*?{}$`~]/.test(c)) continue; // computed or globbed, not a name
2053
+ const tries = isAbsolute(c)
2054
+ ? [c]
2055
+ : [
2056
+ ...cwds.map((d) => resolve(d, c)),
2057
+ ...(c.startsWith(`${base}/`) || c.startsWith(`./${base}/`) ? [resolve(project, c)] : []),
2058
+ ];
2059
+ for (const abs of tries) {
2060
+ if (!inDesign(abs) || abs === root) continue;
2061
+ const rel = posix(relative(root, abs));
2062
+ if (
2063
+ rel.split('/').some((s) => s.startsWith('_') || s.startsWith('.') || s === 'node_modules')
2064
+ )
2065
+ continue;
2066
+ if (LANE_FILE_RE.test(rel)) found.add(rel);
2067
+ }
2068
+ }
2069
+ if (found.size > 32) return { mode: 'all', files: [] };
2070
+ if (found.size) return { mode: 'named', files: [...found].sort() };
2071
+ const refsRoot =
2072
+ text.includes(root) ||
2073
+ new RegExp(`(?:^|[^A-Za-z0-9_.-])${reEscape(base)}(?=[/\\\\'"\`\\s)]|$)`).test(text);
2074
+ return refsRoot || cdInside ? { mode: 'all', files: [] } : { mode: 'none', files: [] };
2075
+ }
2076
+
1717
2077
  export { CANVAS_RE };
@@ -44,6 +44,7 @@ export const SOURCE_VERBS = new Set([
44
44
  'smart-frames',
45
45
  'transcribe-local',
46
46
  'probe-footage',
47
+ 'video-proxy',
47
48
  'photo-adjust',
48
49
  ]);
49
50
 
@@ -1,9 +1,9 @@
1
1
  // GENERATED by scripts/gen-actions.mjs from apps/studio/actions/verbs.ts — DO NOT EDIT BY HAND.
2
2
  // What `maude design help` prints under the static usage (contract V2-1.11 §5.7 rule 6).
3
- // manifest fb02f78da791
3
+ // manifest cc9b94549577
4
4
 
5
5
  export const DESIGN_VERB_TIERS_HELP =
6
- "Verbs by permission tier (generated from actions.manifest.json, contract V2-1.11 §5.3):\n auto No prompt in the Maude chat (effect none/project):\n prep · bootstrap-check · slug · server-up · runtime-health · screenshot · smoke\n visual-sanity · perf · canvas-rects · canvas-errors · canvas-source\n read-annotations · svg-optimize · asset-sweep · draw-proof · probe-footage\n smart-frames · agent-browser-safe · chat-open · serve · status · index · assets\n help · check · place · layout-check · open · history list · history show\n history diff · history object · trash list · comments list · exports list\n exports again · runs list · runs stop · logs · sync status · annotate · canvas-edit\n handoff · import-asset · import-tokens · ingest-footage · photo-adjust\n transcribe-local · beats · captions list · captions add · captions export · captions\n cut-words · cut-to-beat · reel-place · ds-check · ds-upgrade analyse\n ds-upgrade plan · ds-upgrade validate · ds-upgrade status · ds-upgrade stage\n ds-upgrade prove · ds-upgrade discard · ds-upgrade cancel · trash move\n trash restore · ds status · ds usage · ds check-system · ds revisions\n prompt Shows the permission card:\n hook · export · curl-local · draw-build · to-lottie · generate · audio-search\n fetch-asset · ensure-browser · transcribe · import-figma · import-brand\n photo-bg-remove · describe · init · ds-upgrade · bulk-deletes · history restore\n trash · history undo · history name · exports · sync resync · sync · runs · ds\n comments reply · comments resolve · comments reopen · comments add · comments\n history\n human For people in a terminal. Never in the AI allow list:\n trash clear · link · adopt · unlink · detach\n Every studio capability's file or verb: the design plugin's studio-actions skill.\n";
6
+ "Verbs by permission tier (generated from actions.manifest.json, contract V2-1.11 §5.3):\n auto No prompt in the Maude chat (effect none/project):\n prep · bootstrap-check · slug · server-up · runtime-health · screenshot · smoke\n visual-sanity · perf · canvas-rects · canvas-errors · canvas-source\n read-annotations · svg-optimize · asset-sweep · draw-proof · probe-footage\n smart-frames · agent-browser-safe · chat-open · serve · status · index · assets\n help · check · place · layout-check · open · history list · history show\n history diff · history object · trash list · comments list · exports list\n exports again · runs list · runs stop · logs · sync status · annotate · canvas-edit\n handoff · import-asset · import-tokens · ingest-footage · photo-adjust\n transcribe-local · beats · captions list · captions add · captions export · captions\n cut-words · cut-to-beat · reel-place · ds-check · ds-upgrade analyse\n ds-upgrade plan · ds-upgrade validate · ds-upgrade status · ds-upgrade stage\n ds-upgrade prove · ds-upgrade discard · ds-upgrade cancel · trash move\n trash restore · ds status · ds usage · ds check-system · ds revisions\n prompt Shows the permission card:\n hook · video-proxy · export · curl-local · draw-build · to-lottie · generate\n audio-search · fetch-asset · ensure-browser · transcribe · import-figma\n import-brand · photo-bg-remove · describe · init · ds-upgrade · bulk-deletes\n history restore · trash · history undo · history name · exports · sync resync · sync\n runs · ds · comments reply · comments resolve · comments reopen · comments add\n comments · history\n human For people in a terminal. Never in the AI allow list:\n trash clear · link · adopt · unlink · detach\n Every studio capability's file or verb: the design plugin's studio-actions skill.\n";
7
7
 
8
8
  /** The `maude design` verbs the manifest knows, by tier. */
9
9
  export const DESIGN_VERBS_BY_TIER = {
@@ -83,6 +83,7 @@ export const DESIGN_VERBS_BY_TIER = {
83
83
  ],
84
84
  prompt: [
85
85
  'hook',
86
+ 'video-proxy',
86
87
  'export',
87
88
  'curl-local',
88
89
  'draw-build',