@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
@@ -14,9 +14,10 @@
14
14
 
15
15
  import { readFileSync, statSync } from 'node:fs';
16
16
  import path from 'node:path';
17
-
17
+ import { readAssetAdded } from './asset-added.ts';
18
18
  import { homeShort, readAssetOrigin } from './asset-origins.ts';
19
19
  import { sidecarsOf } from './asset-trash.ts';
20
+ import { describeMedia, probeMedia } from './bin/_media-probe.mjs';
20
21
  import { walkIdElements } from './element-ids.ts';
21
22
  import { readGen } from './generation/gen-sidecar.ts';
22
23
  import { assetKindOf } from './index/extractors/asset-usage.ts';
@@ -72,7 +73,15 @@ export interface AssetDetails {
72
73
  mtimeMs: number;
73
74
  madeByAi: MadeByAi | null;
74
75
  footage: FootageFacts | null;
75
- /** "Added by <name>" — the display name this Mac's origin record keeps, only to a session that may hear the Original */
76
+ /**
77
+ * A clip that plays but cannot be exported with sound — HEVC, variable frame rate, a second audio track
78
+ * (#128 §1): the sentence names the asset and the codec and the fix. Only present for such a clip.
79
+ */
80
+ mediaWarnings?: string[];
81
+ /**
82
+ * "Added by <name>" — from the synced `assets/<stem>.added.json` (#172), told to every session that may see the asset;
83
+ * else the display name this Mac's origin record keeps, only to a session that may hear the Original. Never an e-mail.
84
+ */
76
85
  addedBy?: string;
77
86
  uses: UseOfAsset[];
78
87
  advanced: {
@@ -266,6 +275,33 @@ export interface AssetDetailsOptions {
266
275
  /** Tell this session the Original path? Only this Mac's own project session may hear it. */
267
276
  includeOriginal: boolean;
268
277
  home?: string;
278
+ /** Reads a clip with ffprobe (a seam for the tests); the studio passes none. */
279
+ probe?: typeof probeMedia;
280
+ }
281
+
282
+ /** One probe per file version: the sheet is opened often, ffprobe is a process spawn. */
283
+ const probeCache = new Map<string, string | null>();
284
+ const PROBE_CACHE_MAX = 200;
285
+
286
+ function mediaWarningOf(
287
+ rel: string,
288
+ abs: string,
289
+ st: { size: number; mtimeMs: number },
290
+ probe: typeof probeMedia
291
+ ): string | null {
292
+ const key = `${abs}|${st.size}|${Math.round(st.mtimeMs)}`;
293
+ if (probe === probeMedia && probeCache.has(key)) return probeCache.get(key) ?? null;
294
+ let warning: string | null = null;
295
+ try {
296
+ warning = describeMedia(rel, probe(abs));
297
+ } catch {
298
+ warning = null;
299
+ }
300
+ if (probe === probeMedia) {
301
+ if (probeCache.size >= PROBE_CACHE_MAX) probeCache.clear();
302
+ probeCache.set(key, warning);
303
+ }
304
+ return warning;
269
305
  }
270
306
 
271
307
  /** Everything the details sheet draws, or null when `rel` is not an asset this project keeps. */
@@ -310,6 +346,12 @@ export function assetDetails(rel: string, o: AssetDetailsOptions): AssetDetails
310
346
  }
311
347
 
312
348
  const origin = o.includeOriginal ? readAssetOrigin(o.designRoot, rel) : null;
349
+ // #172 — the synced record is what every peer says; this Mac's own note is only the fallback for an older import
350
+ const addedBy = readAssetAdded(o.designRoot, rel)?.by ?? origin?.by;
351
+ const mediaWarning =
352
+ kind === 'video'
353
+ ? mediaWarningOf(rel, path.join(o.designRoot, ...rel.split('/')), st, o.probe ?? probeMedia)
354
+ : null;
313
355
  const advanced: AssetDetails['advanced'] = {
314
356
  storedAs: rel,
315
357
  edits,
@@ -332,7 +374,8 @@ export function assetDetails(rel: string, o: AssetDetailsOptions): AssetDetails
332
374
  mtimeMs: Math.round(st.mtimeMs),
333
375
  madeByAi: madeByAiOf(o.designRoot, rel),
334
376
  footage: kind === 'video' ? footageOf(o.designRoot, rel) : null,
335
- ...(origin?.by ? { addedBy: origin.by } : {}),
377
+ ...(mediaWarning ? { mediaWarnings: [mediaWarning] } : {}),
378
+ ...(addedBy ? { addedBy } : {}),
336
379
  uses,
337
380
  advanced,
338
381
  };
@@ -13,10 +13,11 @@
13
13
  // shell caller that holds one (`recordAssetOrigin`). Keyed by the picture's sha8, so the same bytes imported again
14
14
  // (same name) keep ONE record: the latest path wins (the person's newest copy is the one they can still find).
15
15
  //
16
- // Leaf module (node:fs / node:path only; erasable TypeScript) — the CLI imports it under bun, the route under bun.
16
+ // Leaf module (node:fs / node:path + the leaf spoof-chars.ts; erasable TypeScript) — the CLI imports it under bun, the route under bun.
17
17
 
18
18
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
19
19
  import path from 'node:path';
20
+ import { stripNameSpoofChars } from './spoof-chars.ts';
20
21
 
21
22
  export const ORIGINS_REL = '_canvas-state/asset-origins.json';
22
23
  /** Oldest entries are dropped past this. */
@@ -52,10 +53,11 @@ export function originKey(assetRel: unknown): string | null {
52
53
  /** Longest name kept for "Added by". */
53
54
  export const MAX_ORIGIN_BY = 80;
54
55
 
55
- /** A display name, or null: no control character, no `@` (an e-mail is not a name), a sane length. */
56
+ /** A display name, or null: no control character, no `@` (an e-mail is not a name), a sane length. Bidi, zero-width
57
+ * and Unicode tag characters are stripped first (burndown L4) — a peer-synced name must not reorder or hide text. */
56
58
  export function cleanOriginBy(v: unknown): string | null {
57
59
  if (typeof v !== 'string') return null;
58
- const t = v.trim();
60
+ const t = stripNameSpoofChars(v).trim();
59
61
  if (!t || t.length > MAX_ORIGIN_BY || CONTROL.test(t) || t.includes('@')) return null;
60
62
  return t;
61
63
  }
@@ -27,6 +27,7 @@ const SIDECAR_SUFFIXES = [
27
27
  '.transcript.json',
28
28
  '.beats.json',
29
29
  '.gen.json',
30
+ '.added.json',
30
31
  '.srt',
31
32
  '.vtt',
32
33
  '.json',
@@ -87,7 +88,11 @@ export function sidecarsOf(designRoot: string, rel: string): string[] {
87
88
  for (const n of names) {
88
89
  if (n === name) continue;
89
90
  const perUse = PER_USE.exec(n);
90
- const own = (perUse && perUse[1] === stem) || SIDECAR_SUFFIXES.some((s) => n === `${base}${s}`);
91
+ const own =
92
+ (perUse && perUse[1] === stem) ||
93
+ SIDECAR_SUFFIXES.some((s) => n === `${base}${s}`) ||
94
+ // the who-added record keyed by the FULL name (burndown F6, asset-added.ts addedRelOf)
95
+ n === `${name}.added.json`;
91
96
  // another PICTURE with the same stem is not a sidecar — only the known companion shapes ride along
92
97
  if (own && !assetKindOf(n)) out.push(`assets/${n}`);
93
98
  }
@@ -200,10 +200,9 @@ export function validateArgv(argv) {
200
200
  // V2-8.9 B2 — `--allowed-domains` names hosts, so it never stopped `file://` (no host at all):
201
201
  // `open file:///…/.ssh/id_ed25519` + `get text body` read any file. Only http(s) to this Mac.
202
202
  // (`screenshot <path>` is confined to the project / temp dir by the dispatcher, cli design.mjs.)
203
- if (sub === 'open') {
204
- const why = urlRefusal(rest[0]);
205
- if (why) return why;
206
- }
203
+ // sec-loopback-bearer §7.5 — urlRefusal also refuses a one-time opening link in any encoding
204
+ // (_url-guard.mjs `launchRefusal`): the AI's browser never holds a studio session.
205
+ if (sub === 'open') return urlRefusal(rest[0]);
207
206
  return null;
208
207
  }
209
208
 
@@ -8,7 +8,9 @@
8
8
  // the exit code); returns `null` when the caller should write the board file itself.
9
9
 
10
10
  import { existsSync, readFileSync } from 'node:fs';
11
- import { join } from 'node:path';
11
+ import { dirname, join } from 'node:path';
12
+
13
+ import { findProjectRoot, studioHeadersFor } from '../../../cli/lib/studio-locate.mjs';
12
14
 
13
15
  export class PostOpsError extends Error {
14
16
  constructor(message, code = 1) {
@@ -63,12 +65,15 @@ export function runIdForChat(view, chatId) {
63
65
  * Claude, an outside write). Any failure to read the runs is "not inside a run" — the studio's
64
66
  * gate decides what a tag may do, this only names it.
65
67
  */
66
- export async function defaultActionId(base, env = process.env) {
68
+ export async function defaultActionId(base, env = process.env, headers = {}) {
67
69
  const fallback = `ai-annotate-${Math.random().toString(36).slice(2, 12)}`;
68
70
  const chatId = env.MAUDE_CHAT_ID;
69
71
  if (typeof chatId !== 'string' || !CHAT_ID.test(chatId)) return fallback;
70
72
  try {
71
- const res = await fetch(`${base}/_api/ai/runs`, { signal: AbortSignal.timeout(3_000) });
73
+ const res = await fetch(`${base}/_api/ai/runs`, {
74
+ headers,
75
+ signal: AbortSignal.timeout(3_000),
76
+ });
72
77
  if (!res.ok) return fallback;
73
78
  const runId = runIdForChat(await res.json(), chatId);
74
79
  return runId ? `run:${runId}` : fallback;
@@ -96,12 +101,16 @@ export async function postOps(designRoot, file, ops, actionId) {
96
101
  // `url` can't turn the verb into an exfiltration primitive. Anything else
97
102
  // silently falls back to the file write (the local intent still succeeds).
98
103
  if (!base || !isLoopbackHttpUrl(base)) return null;
99
- const id = actionId ?? (await defaultActionId(base));
104
+ // sec-loopback-bearer §7.6 — the key of the server serving this project on that port (the app's
105
+ // attested one, or a terminal one whose /_health names the root); none for any other port
106
+ const root = findProjectRoot(designRoot) ?? dirname(designRoot);
107
+ const keyed = await studioHeadersFor(root, new URL(base).port || 80);
108
+ const id = actionId ?? (await defaultActionId(base, process.env, keyed));
100
109
  let res;
101
110
  try {
102
111
  res = await fetch(`${base}/_api/annotations/ops`, {
103
112
  method: 'POST',
104
- headers: { 'Content-Type': 'application/json' },
113
+ headers: { ...keyed, 'Content-Type': 'application/json' },
105
114
  body: JSON.stringify({
106
115
  file,
107
116
  actionId: id,
@@ -23,6 +23,8 @@
23
23
  import { existsSync, readFileSync } from 'node:fs';
24
24
  import { join } from 'node:path';
25
25
 
26
+ import { studioHeadersFor } from '../../../cli/lib/studio-locate.mjs';
27
+
26
28
  function parseArgs(argv) {
27
29
  const out = {};
28
30
  for (let i = 0; i < argv.length; i++) {
@@ -68,12 +70,14 @@ async function main() {
68
70
  const repo = args.root || process.env.CLAUDE_PROJECT_DIR || process.cwd();
69
71
  const port = resolvePort(repo);
70
72
  const base = `http://127.0.0.1:${port}/_api/generate`;
73
+ // sec-loopback-bearer §7.6 — the studio's API key (the app's attested server, or a terminal one's)
74
+ const keyed = await studioHeadersFor(repo, port);
71
75
 
72
76
  if (args.reuse) {
73
77
  try {
74
78
  const res = await fetch(`${base}/audio-reuse`, {
75
79
  method: 'POST',
76
- headers: { 'content-type': 'application/json' },
80
+ headers: { ...keyed, 'content-type': 'application/json' },
77
81
  body: JSON.stringify({ id: args.reuse }),
78
82
  });
79
83
  const json = await res.json().catch(() => ({}));
@@ -94,7 +98,9 @@ async function main() {
94
98
 
95
99
  let data;
96
100
  try {
97
- const res = await fetch(`${base}/audio-search?q=${encodeURIComponent(args.query)}`);
101
+ const res = await fetch(`${base}/audio-search?q=${encodeURIComponent(args.query)}`, {
102
+ headers: keyed,
103
+ });
98
104
  data = await res.json();
99
105
  if (!res.ok) {
100
106
  process.stderr.write(`audio-search: ${data?.error ?? res.status}\n`);
@@ -467,9 +467,12 @@ async function main() {
467
467
  }
468
468
 
469
469
  // Run only when invoked directly (not when imported by the test). This shim
470
- // runs under real `node` on a real on-disk path (never embedded in
471
- // `bun --compile`), so the classic argv[1] guard is correct here — see the
472
- // v0.38.0 self-heal memory.
473
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
470
+ // runs under real `node` on a real on-disk path; since 2.1.1 the server also imports its loopback
471
+ // refusals (the address check), so the module is reachable inside `bun --compile` too. There the
472
+ // argv[1] compare is unreliable — `import.meta.main` is the entry flag under bun, and the compare
473
+ // stays only for plain `node` (Node <24 leaves it undefined).
474
+ const runDirectly =
475
+ import.meta.main ?? (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href);
476
+ if (runDirectly) {
474
477
  main();
475
478
  }
@@ -0,0 +1,145 @@
1
+ # _desktop-locate.sh — SOURCED (never run) by the helpers that need a project's studio port: server-up.sh,
2
+ # screenshot.sh, smoke.sh, canvas-rects.sh, perf.sh, runtime-health.sh. #206 T6.3d (DDR-250).
3
+ #
4
+ # While the Maude desktop app runs it owns a checkout's server. `desktop_port` asks the app's registry first
5
+ # (cli/lib/desktop-locate.mjs: the port is used only after the server there answers a fresh attest challenge)
6
+ # and sets DESKTOP_PORT. Return codes (the helper's own):
7
+ # 0 DESKTOP_PORT is the app's attested server for this project — use it, never `_server.json`
8
+ # 10 not the app's (no app, or it has no running server here) — keep the project's own `_server.json` path
9
+ # 11 the app serves this project but its server did not answer the check — fail closed: do NOT fall back
10
+ # to `_server.json` (a planted copy must never win while the app runs); the reason is on stderr
11
+ # 4 the app refused for a reason the person must see (stderr) — server-up only
12
+ #
13
+ # desktop_port <repo> [--ensure capture|show] [--lease]
14
+ # desktop_locate <mode> … the raw call (restart, app-pid)
15
+ #
16
+ # <pkgRoot>/cli/lib/desktop-locate.mjs is three levels above this file in every layout (dev tree, npm install,
17
+ # the .app's Contents/Resources). No JS runtime, or no module → 10 (today's behaviour).
18
+
19
+ _DL_JS="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." 2>/dev/null && pwd)/cli/lib/desktop-locate.mjs"
20
+
21
+ # Fast path: no registry file → no app, without starting a JS runtime. Only a precheck — the module decides
22
+ # everything else (ownership, mode, the test-runner guard). The same default as registryPath() there.
23
+ _dl_registry_file() {
24
+ case "${MAUDE_APP_REGISTRY_FILE:-}" in
25
+ /*) printf '%s' "$MAUDE_APP_REGISTRY_FILE"; return ;;
26
+ esac
27
+ case "$(uname -s 2>/dev/null)" in
28
+ Darwin) printf '%s' "$HOME/Library/Application Support/com.maude.app/servers.json" ;;
29
+ *)
30
+ local data="${XDG_DATA_HOME:-}"
31
+ case "$data" in /*) : ;; *) data="$HOME/.local/share" ;; esac
32
+ printf '%s' "$data/com.maude.app/servers.json"
33
+ ;;
34
+ esac
35
+ }
36
+
37
+ desktop_locate() {
38
+ [ -f "$_DL_JS" ] || return 10
39
+ [ -f "$(_dl_registry_file)" ] || return 10
40
+ if command -v node >/dev/null 2>&1; then
41
+ node "$_DL_JS" "$@"
42
+ elif command -v bun >/dev/null 2>&1; then
43
+ bun "$_DL_JS" "$@"
44
+ else
45
+ return 10
46
+ fi
47
+ }
48
+
49
+ desktop_port() {
50
+ local repo="$1" out rc
51
+ shift
52
+ DESKTOP_PORT=""
53
+ out=$(desktop_locate port --root "$repo" "$@")
54
+ rc=$?
55
+ if [ "$rc" = 0 ]; then
56
+ if [[ "$out" =~ ^[0-9]{1,5}$ ]]; then
57
+ DESKTOP_PORT="$out"
58
+ elif [ -n "$out" ]; then
59
+ return 10 # not a port: ignore it
60
+ fi
61
+ fi
62
+ return "$rc"
63
+ }
64
+
65
+ # ---------------------------------------------------------------------------------------------------------
66
+ # sec-loopback-bearer §7.5–7.6 — a studio started by the app or from a terminal requires its API key from
67
+ # every caller on its main origin. These are the ONLY way a helper talks to that origin (a static test,
68
+ # cli/lib/helper-studio-key.test.mjs, fails on a bare `curl http://…:$PORT/_…` or `fetch` elsewhere).
69
+ #
70
+ # studio_key <repo> <port> sets STUDIO_KEY (empty: the server needs no key it told us about);
71
+ # returns 11 when the app serves the project but did not attest
72
+ # studio_curl <repo> <port> <curl args…> curl with the key as a header, handed to curl through a
73
+ # config on stdin — never argv or the environment (`ps` shows both)
74
+ # studio_launch_url <repo> <port> [--helper] prints a one-time opening URL (`/?maude-launch=…`) for
75
+ # a browser; --helper for a capture helper's own browser (its session
76
+ # sits in the helpers' budget and never evicts the person's)
77
+ #
78
+ # The key is cached per (repo, port) in an UNEXPORTED shell variable, so a polling loop asks once and no
79
+ # child process inherits it. A request whose body is on stdin cannot use studio_curl.
80
+
81
+ _STUDIO_KEY_FOR=""
82
+ STUDIO_KEY=""
83
+
84
+ _dl_node() {
85
+ [ -f "$_DL_JS" ] || return 10
86
+ if command -v node >/dev/null 2>&1; then
87
+ node "$_DL_JS" "$@"
88
+ elif command -v bun >/dev/null 2>&1; then
89
+ bun "$_DL_JS" "$@"
90
+ else
91
+ return 10
92
+ fi
93
+ }
94
+
95
+ studio_key() {
96
+ local repo="$1" port="$2" out rc
97
+ if [ "$_STUDIO_KEY_FOR" = "$repo|$port" ]; then return 0; fi
98
+ STUDIO_KEY=""
99
+ out=$(_dl_node key --root "$repo" --port "$port" 2>/dev/null)
100
+ rc=$?
101
+ if [ "$rc" = 11 ]; then return 11; fi
102
+ if [ "$rc" = 0 ] && [[ "$out" =~ ^[0-9a-fA-F]{64}$ ]]; then STUDIO_KEY="$out"; fi
103
+ _STUDIO_KEY_FOR="$repo|$port"
104
+ return 0
105
+ }
106
+
107
+ studio_curl() {
108
+ local repo="$1" port="$2"
109
+ shift 2
110
+ # a subshell (`$(studio_curl …)`) cannot fill the caller's cache: call `studio_key` once first
111
+ studio_key "$repo" "$port" || return 7
112
+ if [ -n "$STUDIO_KEY" ]; then
113
+ printf 'header = "x-maude-api-key: %s"\n' "$STUDIO_KEY" | curl --config - "$@"
114
+ else
115
+ curl "$@"
116
+ fi
117
+ }
118
+
119
+ # studio_capture_url <repo> <port> <path?query> prints the URL a headless browser opens to capture a
120
+ # canvas (`/_canvas-shell.html?canvas=…`). A key-required server mints the frame capability on that
121
+ # path's 307 only for a caller that sent the key (sec-loopback-bearer §7.3): this asks with the key
122
+ # and prints the capture-origin URL the redirect names. No redirect (the split off), no key, or an
123
+ # unexpected answer: the main-origin URL, as before. Never prints the key or a launch token.
124
+ studio_capture_url() {
125
+ local repo="$1" port="$2" rel="$3" loc
126
+ loc=$(studio_curl "$repo" "$port" -s -o /dev/null --max-time 5 -w '%{redirect_url}' \
127
+ "http://localhost:${port}${rel}" 2>/dev/null)
128
+ if [[ "$loc" =~ ^http://(localhost|127\.0\.0\.1|\[::1\]):[0-9]{1,5}/_canvas-shell\.html(\?|$) ]]; then
129
+ printf '%s\n' "$loc"
130
+ else
131
+ printf 'http://localhost:%s%s\n' "$port" "$rel"
132
+ fi
133
+ }
134
+
135
+ studio_launch_url() {
136
+ local repo="$1" port="$2" out
137
+ local kind=()
138
+ [ "${3:-}" = "--helper" ] && kind=(--helper)
139
+ out=$(_dl_node launch-url --root "$repo" --port "$port" "${kind[@]}" 2>/dev/null)
140
+ if [[ "$out" =~ ^http://localhost:[0-9]{1,5}/ ]]; then
141
+ printf '%s\n' "$out"
142
+ else
143
+ printf 'http://localhost:%s/\n' "$port"
144
+ fi
145
+ }
@@ -6,7 +6,7 @@
6
6
  // `_server.json` cannot point ds-check at another host or project. Any failure → "no studio": ds-check then
7
7
  // says so and prints the static reasons only.
8
8
  import { resolve } from 'node:path';
9
- import { locateStudio } from '../../../cli/lib/studio-locate.mjs';
9
+ import { locateStudio, studioHeaders } from '../../../cli/lib/studio-locate.mjs';
10
10
  import { NO_STUDIO, refusedFromIndex } from '../ds/post-build.ts';
11
11
 
12
12
  /** The project root ds-check will use (`--root`, else $CLAUDE_PROJECT_DIR, else the cwd). */
@@ -27,6 +27,7 @@ export async function liveRefusals(root, { locate = locateStudio, timeoutMs = 15
27
27
  const studio = await locate(root, { timeoutMs });
28
28
  if (!studio) return NO_STUDIO;
29
29
  const res = await fetch(`${studio.base}/_index-data`, {
30
+ headers: studioHeaders(studio),
30
31
  signal: AbortSignal.timeout(timeoutMs),
31
32
  });
32
33
  if (!res.ok) return NO_STUDIO;
@@ -4,6 +4,8 @@
4
4
  // list GET /_api/export-history — this session's recent exports (effect none)
5
5
  // retry <id|i> S8.4 — run only the items of one group job that did not make it, again
6
6
  // (POST /_api/export-jobs/retry — the Exports panel's "Retry <name>"); effect project
7
+ // cancel <id> #128 T3.7b — stop one of your unfinished exports (POST /_api/export-jobs/cancel —
8
+ // the Exports panel's "Cancel" on a running cloud row); effect project
7
9
  // again <id|i> re-submit one entry through the SAME jobs path the Export sheet's
8
10
  // "Export again" row uses: POST /_api/export-jobs with replayExportJob(entry)
9
11
  // (exporters/replay.ts — the sheet's scope fallback), wait for the job, write
@@ -14,6 +16,7 @@
14
16
  import { existsSync, mkdirSync, statSync, writeFileSync } from 'node:fs';
15
17
  import { basename, dirname, join, resolve } from 'node:path';
16
18
  import { outputViolation, violationMessage } from '../../../cli/lib/confine-out.mjs';
19
+ import { studioHeaders } from '../../../cli/lib/studio-locate.mjs';
17
20
  import { replayExportBody } from '../exporters/replay.ts';
18
21
  import {
19
22
  call,
@@ -30,11 +33,14 @@ import {
30
33
  export const USAGE = `usage: maude design exports list [--json] [--root <project>]
31
34
  maude design exports again <id | index> [--out <file|folder/>] [--no-wait] [--json] [--root <project>]
32
35
  maude design exports retry <id | index> [--item <id[,id…]>] [--no-wait] [--json] [--root <project>]
36
+ maude design exports cancel <id> [--json] [--root <project>]
33
37
  list recent exports, newest first (index 0 is the newest)
34
38
  again export that entry again, exactly as the Export sheet's "Export again" does; waits for the
35
39
  job and writes the file to --out (default: the current folder). --no-wait only queues it.
36
40
  retry run again ONLY the items of that export that did not make it (all of them, or --item); the
37
41
  ones that made it are left alone. Waits for the job and says how many made it.
42
+ cancel stop one of YOUR unfinished exports (the id the panel row shows); a running cloud video is
43
+ also stopped on the render service. Another person's export is not found.
38
44
  Exit 0 ok · 1 not found / the export failed · 2 usage · 3 no studio running.
39
45
  `;
40
46
 
@@ -164,7 +170,8 @@ async function fetchBytes(studio, jobId) {
164
170
  try {
165
171
  const res = await fetch(
166
172
  `${studio.base}/_api/export-jobs/download?${new URLSearchParams({ id: jobId })}`,
167
- { signal: AbortSignal.timeout(60_000) }
173
+ // sec-loopback-bearer §7.6 — the studio's API key, like every `call`
174
+ { headers: studioHeaders(studio), signal: AbortSignal.timeout(60_000) }
168
175
  );
169
176
  return res.ok ? new Uint8Array(await res.arrayBuffer()) : null;
170
177
  } catch {
@@ -232,7 +239,36 @@ async function retry(words) {
232
239
  return failed.length || done.status === 'failed' ? 1 : 0;
233
240
  }
234
241
 
235
- const SUBS = { list, again, retry };
242
+ async function cancel(words) {
243
+ const { flags, pos } = parseWords(words, { bool: ['--json'], value: ['--root'] });
244
+ if (pos.length !== 1) throw new UsageError('cancel takes one <id>');
245
+ const c = await connect('exports', flags['--root']);
246
+ if (c.exit) return c.exit;
247
+ const id = pos[0];
248
+ const posted = await call(c.studio, '/_api/export-jobs/cancel', { method: 'POST', json: { id } });
249
+ if (posted?.status !== 200) {
250
+ const why =
251
+ posted?.status === 404
252
+ ? 'that export is not here any more'
253
+ : posted?.status === 409
254
+ ? 'it has already finished'
255
+ : posted?.status === 502
256
+ ? 'the cloud did not answer'
257
+ : posted
258
+ ? clean(posted.text).slice(0, 200) || posted.status
259
+ : 'no answer';
260
+ process.stderr.write(`maude design exports cancel: not cancelled (${why})\n`);
261
+ return 1;
262
+ }
263
+ process.stdout.write(
264
+ flags['--json']
265
+ ? `${JSON.stringify(untrustedJson({ jobId: id, cancelled: true }))}\n`
266
+ : `→ cancelled ${clean(id)}\n`
267
+ );
268
+ return 0;
269
+ }
270
+
271
+ const SUBS = { list, again, retry, cancel };
236
272
 
237
273
  if (import.meta.main) {
238
274
  runVerb('exports', USAGE, async (words) => {
@@ -27,7 +27,7 @@ import {
27
27
 
28
28
  export const USAGE = `usage: maude design history list [<canvas>] [--limit N] [--json] [--root <project>]
29
29
  maude design history show <ref> [<canvas>] [--json] [--root <project>]
30
- maude design history diff [<canvas>] [--from <ref>] [--to <ref>|now] [--json] [--root <project>]
30
+ maude design history diff [<canvas>] [--from <ref> | --run <id>|@mine] [--to <ref>|now] [--json] [--root <project>]
31
31
  maude design history object <canvas> <artboard>/<id> | <annotation-id> [--json] [--root <project>]
32
32
  maude design history restore <canvas> <ref> [--artboard <id> | --element <artboard>/<id>] [--json] [--root <project>]
33
33
  maude design history undo --action <id> | --chat <id> [--redo] [--json] [--root <project>]
@@ -37,8 +37,9 @@ export const USAGE = `usage: maude design history list [<canvas>] [--limit N] [-
37
37
  list the versions, newest first
38
38
  show one version: who, when, what it was, the canvases it touched
39
39
  diff what changed since <ref>: a synced project names the canvas and says it in words, from
40
- the version before its newest (or --from) to now (or --to); a git project diffs since
41
- <ref> (default: the last commit)
40
+ the version before the newest AI run's first version on that canvas (or --from, or
41
+ --run <id>: that run's; --run @mine: this chat's newest run) to now (or --to); a git
42
+ project diffs since <ref> (default: the last commit)
42
43
  object one object's versions, newest first (a canvas element by <artboard>/<id>, or a sticky /
43
44
  arrow / sticker by its annotation id); rows followed back by matching say so — synced
44
45
  restore the whole canvas back to <ref>, as a NEW version (Now stays in the history) — synced;
@@ -80,10 +81,23 @@ const canvasesOf = (row) => (row.canvases ?? []).map((c) => field(c).replace(/^\
80
81
  // p8-fix-d F20 — the person by name (the studio's lookup, `actorName`), an AI run as "· AI"
81
82
  // (CONTRACT §3), and a prompt-less run's placeholder label ("Claude Code") is not printed as if it
82
83
  // were the prompt.
84
+ /**
85
+ * #164 B3 — which agent made an AI version, from what the row carries: a Maude chat's run names its
86
+ * chat; a run with no chat is a terminal session's. A row with neither (older rows) names no agent —
87
+ * the placeholder label is never read as one.
88
+ */
89
+ export function agentOf(row) {
90
+ if (row?.kind !== 'ai') return undefined;
91
+ if (row.chatId) return 'Maude chat';
92
+ if (row.runId) return 'Claude Code';
93
+ return undefined;
94
+ }
95
+
83
96
  function syncedLine(row) {
84
97
  const ai = row.kind === 'ai';
85
98
  const person = row.actorName ?? row.actor ?? '?';
86
- const who = `${field(person)}${row.mine ? ' (you)' : ''}${ai ? ' · AI' : ''}`;
99
+ const agent = agentOf(row);
100
+ const who = `${field(person)}${row.mine ? ' (you)' : ''}${ai ? ` · AI${agent ? ` (${agent})` : ''}` : ''}`;
87
101
  const label = ai ? (promptOfRun(row.label) ?? '') : (row.label ?? '');
88
102
  const where = canvasesOf(row).join(', ');
89
103
  return `r${field(row.revision)} ${when(row.committedAt)} ${who} ${field(row.kind ?? '')}${label ? ` ${field(label)}` : ''}${where ? ` · ${where}` : ''}`;
@@ -109,7 +123,15 @@ async function list(words) {
109
123
  const repoRel = canvasArg(c.root, pos[0]);
110
124
  const v = await versions(c.studio, { repoRel, limit });
111
125
  if (v.kind === 'synced') {
112
- if (flags['--json']) out({ kind: 'synced', canvas: repoRel, versions: v.rows });
126
+ if (flags['--json'])
127
+ out({
128
+ kind: 'synced',
129
+ canvas: repoRel,
130
+ versions: v.rows.map((row) => {
131
+ const agent = agentOf(row);
132
+ return agent ? { ...row, agent } : row;
133
+ }),
134
+ });
113
135
  else if (v.rows.length === 0) process.stdout.write('no versions yet\n');
114
136
  else writeUntrusted(v.rows.map((row) => `${syncedLine(row)}\n`).join(''));
115
137
  return 0;
@@ -157,14 +179,23 @@ async function show(words) {
157
179
  async function diff(words) {
158
180
  const { flags, pos } = parseWords(words, {
159
181
  bool: ['--json'],
160
- value: ['--from', '--to', '--root'],
182
+ value: ['--from', '--to', '--run', '--root'],
161
183
  });
162
184
  if (pos.length > 1) throw new UsageError('diff takes at most one canvas');
185
+ const run = flags['--run'];
186
+ if (run !== undefined) {
187
+ if (flags['--from'] !== undefined) throw new UsageError('--run and --from name the same thing');
188
+ if (run !== '@mine' && !CHAT_ID.test(run))
189
+ throw new UsageError('--run takes a run id ([A-Za-z0-9_-], ≤ 64) or @mine');
190
+ if (run === '@mine' && !CHAT_ID.test(process.env.MAUDE_CHAT_ID ?? ''))
191
+ throw new UsageError('--run @mine needs a Maude chat (MAUDE_CHAT_ID is not set)');
192
+ }
163
193
  const c = await connect('history', flags['--root']);
164
194
  if (c.exit) return c.exit;
165
195
  const repoRel = canvasArg(c.root, pos[0]);
166
- const v = await versions(c.studio, { repoRel, limit: 2 });
196
+ const v = await versions(c.studio, { repoRel, limit: 200 });
167
197
  if (v.kind === 'synced') return syncedDiff(c, repoRel, v.rows, flags);
198
+ if (run !== undefined) throw new UsageError('--run needs a synced project');
168
199
  if (flags['--to'] !== undefined) throw new UsageError('--to needs a synced project');
169
200
  const from = flags['--from'] ?? 'HEAD';
170
201
  if (from !== 'HEAD' && !SHA.test(from)) throw new UsageError('--from is a commit sha');
@@ -210,14 +241,53 @@ async function diff(words) {
210
241
  * the canvas's newest (what its latest version changed) or `--from`, to now or `--to`.
211
242
  */
212
243
  const REF = /^(r\d{1,12}|git:[0-9a-f]{7,40})$/i;
244
+
245
+ /**
246
+ * The newest AI run in `rows` (newest first), of `chatId` when given. Only this Mac's own runs
247
+ * (`row.mine`) are a target: the default diff must never point at a teammate's run (#164 F3).
248
+ */
249
+ export function newestRun(rows, chatId) {
250
+ const r = rows.find(
251
+ (x) => x.kind === 'ai' && x.runId && x.mine && (!chatId || x.chatId === chatId)
252
+ );
253
+ return r?.runId;
254
+ }
255
+
256
+ /**
257
+ * Index of the OLDEST row of `runId`'s group in `rows` (newest first), or -1. A run's rows are not
258
+ * contiguous — a person's save, or another run, can land between its actions — so the version before
259
+ * the run is the row below this one, never the row below the run's newest (#164 §8).
260
+ */
261
+ export function oldestOfRun(rows, runId) {
262
+ let at = -1;
263
+ rows.forEach((x, i) => {
264
+ if (x.kind === 'ai' && x.runId === runId) at = i;
265
+ });
266
+ return at;
267
+ }
268
+
213
269
  async function syncedDiff(c, repoRel, rows, flags) {
214
270
  if (!repoRel) throw new UsageError('diff on a synced project takes a <canvas>');
215
271
  const to = flags['--to'] ?? 'now';
216
272
  if (to !== 'now' && !REF.test(to)) throw new UsageError('--to is r<n>, git:<sha> or now');
217
273
  let from = flags['--from'];
218
274
  if (from !== undefined && !REF.test(from)) throw new UsageError('--from is r<n> or git:<sha>');
275
+ const asked = flags['--run'];
276
+ const where = repoRel.replace(/^\.design\//, '');
277
+ let runId = asked;
278
+ if (asked === '@mine') runId = newestRun(rows, process.env.MAUDE_CHAT_ID);
279
+ else if (asked === undefined && from === undefined) runId = newestRun(rows);
219
280
  if (from === undefined) {
220
- const before = rows[1];
281
+ // by run when the rows say which run made them; the row just below the canvas's newest otherwise
282
+ let at = 0;
283
+ if (runId !== undefined) at = oldestOfRun(rows, runId);
284
+ if (asked !== undefined && (runId === undefined || at < 0)) {
285
+ process.stderr.write(
286
+ `maude design history: no version by run ${clean(asked)} in ${where} — \`maude design history list --json\` shows each version's runId\n`
287
+ );
288
+ return 1;
289
+ }
290
+ const before = rows[at + 1];
221
291
  if (!before) {
222
292
  process.stdout.write(`${field(repoRel)} has no earlier version to compare with\n`);
223
293
  return 0;
@@ -248,6 +318,7 @@ async function syncedDiff(c, repoRel, rows, flags) {
248
318
  const where = (Array.isArray(ch.artboards) ? ch.artboards : []).map((a) => field(a)).join(', ');
249
319
  return `${where || 'canvas'} ${field(ch.words ?? '')}\n`;
250
320
  };
321
+ process.stdout.write(`from ${from} to ${to}\n`);
251
322
  writeUntrusted(changes.map(line).join(''));
252
323
  return 0;
253
324
  }