@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
@@ -33,7 +33,7 @@ const FIX = 'match maude.agent-handoff/1 (cli/lib/handoff.schema.json)';
33
33
  /** V2-1.18 §5.5: writers of NEW files, spawned with a hand-off naming that file in `owns`. */
34
34
  const BOUNDED_WRITERS = new Set([
35
35
  'design:draw-agent',
36
- 'design:footage-director',
36
+ 'design-video:footage-director',
37
37
  'design:reconstruct-agent',
38
38
  'design:ds-migrator',
39
39
  'ds-migrator',
@@ -0,0 +1,291 @@
1
+ // hook-state.mjs — where the design hooks keep state that must NOT live in the project (#164 B1,
2
+ // contract apps/studio/client/v2/contracts/164-hash-diff-attribution.md §5).
3
+ //
4
+ // The pre/post-bash lane manifest (a stat key + sha256 per canvas-lane file) and the hash cache used
5
+ // to sit under `<designRoot>/_runs`, which is project state: a synced or cloned project would carry
6
+ // them, and an AI that can write the project could rewrite them. They live under
7
+ //
8
+ // $MAUDE_HOOK_STATE_HOME || ~/.claude/maude-hook /<rootIdentity(root)>/
9
+ // lanes.json the root's hash cache (non-authoritative)
10
+ // shots.jsonl captures made with no hook session (#168 E3)
11
+ // <session>/bash/<toolUseId>.json one call's {v, at, mode, files, bg?, verbOnly?, snaps, manifest}
12
+ // <session>/snaps/{snap,base}/<name>.json the sha256 of each run snapshot / base (#168 E1)
13
+ // <session>/shots.jsonl `maude design screenshot` captures under the session (#168 E3,
14
+ // written by apps/studio/bin/_record-shot.sh, read by Stop)
15
+ //
16
+ // Directories 0700, files 0600, written tmp + rename (a torn file reads as "no state"). The precedent
17
+ // is `~/.claude/flow-runs`. A test MUST set MAUDE_HOOK_STATE_HOME to a temp dir.
18
+ //
19
+ // Leaf module: node built-ins + studio-locate.mjs.
20
+
21
+ import {
22
+ chmodSync,
23
+ lstatSync,
24
+ mkdirSync,
25
+ readdirSync,
26
+ readFileSync,
27
+ renameSync,
28
+ rmdirSync,
29
+ rmSync,
30
+ statSync,
31
+ writeFileSync,
32
+ } from 'node:fs';
33
+ import { homedir } from 'node:os';
34
+ import { dirname, join, sep } from 'node:path';
35
+
36
+ import { rootIdentity } from './studio-locate.mjs';
37
+
38
+ const SEG_RE = /^[A-Za-z0-9_-]{1,128}$/;
39
+
40
+ /** The folder every root's hook state sits in. */
41
+ export function hookStateHome(env = process.env) {
42
+ const o = env.MAUDE_HOOK_STATE_HOME;
43
+ return typeof o === 'string' && o ? o : join(homedir(), '.claude', 'maude-hook');
44
+ }
45
+
46
+ /** This project's hook state folder. */
47
+ export function hookStateDir(root, env = process.env) {
48
+ return join(hookStateHome(env), rootIdentity(root));
49
+ }
50
+
51
+ /** The state file of one call, or null when `session` / `toolUseId` is not a safe segment. */
52
+ export function bashStatePath(root, session, toolUseId, env = process.env) {
53
+ if (!SEG_RE.test(session ?? '') || !SEG_RE.test(toolUseId ?? '')) return null;
54
+ return join(hookStateDir(root, env), session, 'bash', `${toolUseId}.json`);
55
+ }
56
+
57
+ /** The root's non-authoritative hash cache. */
58
+ export const lanesCachePath = (root, env = process.env) =>
59
+ join(hookStateDir(root, env), 'lanes.json');
60
+
61
+ /** A snapshot name: a hook key, optionally with dotted parts (`<toolUseId>.<sha16>`, `<sha16>.bash`). */
62
+ const NAME_RE = /^[A-Za-z0-9_-][A-Za-z0-9_.-]{0,159}$/;
63
+
64
+ /**
65
+ * #168 E1 — the record of one run snapshot: `{v:1, existed:true, sha}` (the sha256 of the bytes the
66
+ * hook saved under `<designRoot>/_runs/<session>/<kind>/<name>`), `{v:1, existed:false}` (the file did
67
+ * not exist) or, for a base, `{v:1, shell:true}` (an AI shell call wrote the file first: no base).
68
+ * The bytes stay in the design root, where the studio reads them; they count only while they hash to
69
+ * this record. Null for an unsafe segment.
70
+ *
71
+ * <hookStateDir>/<session>/snaps/{snap|base}/<name>.json
72
+ */
73
+ export function snapshotRecordPath(root, session, kind, name, env = process.env) {
74
+ if (!SEG_RE.test(session ?? '') || (kind !== 'snap' && kind !== 'base')) return null;
75
+ if (!NAME_RE.test(name ?? '') || name.includes('..')) return null;
76
+ return join(hookStateDir(root, env), session, 'snaps', kind, `${name}.json`);
77
+ }
78
+
79
+ /**
80
+ * #168 E3 — the screenshot record (`_record-shot.sh` appends, the Stop gate reads): one session's, or
81
+ * the root's for a capture made with no hook session. Null for an unsafe session.
82
+ */
83
+ export function shotsPath(root, session, env = process.env) {
84
+ if (session === null) return join(hookStateDir(root, env), 'shots.jsonl');
85
+ return SEG_RE.test(session ?? '') ? join(hookStateDir(root, env), session, 'shots.jsonl') : null;
86
+ }
87
+
88
+ /**
89
+ * #168 E1 — a private copy of `text` (bytes the hook verified) for one local check to read: 0600,
90
+ * created exclusively under the session's state folder. The path, or null when it cannot be written.
91
+ * The caller removes it.
92
+ */
93
+ export function writePrivateCopy(root, session, text, env = process.env) {
94
+ if (!SEG_RE.test(session ?? '')) return null;
95
+ const abs = join(
96
+ hookStateDir(root, env),
97
+ session,
98
+ `against.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.txt`
99
+ );
100
+ try {
101
+ mkdirSync(dirname(abs), { recursive: true, mode: 0o700 });
102
+ tighten(abs, env);
103
+ writeFileSync(abs, text, { mode: 0o600, flag: 'wx' });
104
+ return abs;
105
+ } catch {
106
+ return null;
107
+ }
108
+ }
109
+
110
+ /** A passing Stop ends the run: its snapshot records and its screenshot record go with it. */
111
+ export function dropRunState(root, session, env = process.env) {
112
+ if (!SEG_RE.test(session ?? '')) return;
113
+ const dir = join(hookStateDir(root, env), session);
114
+ rmSync(join(dir, 'snaps'), { recursive: true, force: true });
115
+ rmSync(join(dir, 'shots.jsonl'), { force: true });
116
+ }
117
+
118
+ /**
119
+ * Tighten the folders the state lives in to 0700 on every open: `mkdir -p`'s mode only applies to a
120
+ * folder it creates, so one an older build or a looser umask made would stay readable (#164 D7).
121
+ */
122
+ function tighten(abs, env) {
123
+ const home = hookStateHome(env);
124
+ if (!abs.startsWith(home + sep)) return;
125
+ const rootDir = join(home, abs.slice(home.length + 1).split(sep)[0]);
126
+ for (const d of [home, rootDir]) {
127
+ try {
128
+ chmodSync(d, 0o700);
129
+ } catch {
130
+ /* not ours to change: the write still fails closed if it cannot happen */
131
+ }
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Write JSON atomically: dirs 0700, file 0600. Throws on failure (the caller fails closed). The temp
137
+ * file is created exclusively (`wx`), so a link planted at its name is replaced, never followed, and a
138
+ * target that is itself a symlink is refused (#164 F8).
139
+ */
140
+ export function writeState(abs, value, env = process.env) {
141
+ mkdirSync(dirname(abs), { recursive: true, mode: 0o700 });
142
+ tighten(abs, env);
143
+ let target = null;
144
+ try {
145
+ target = lstatSync(abs);
146
+ } catch (e) {
147
+ if (e?.code !== 'ENOENT') throw e;
148
+ }
149
+ if (target?.isSymbolicLink()) throw new Error('hook state: refusing a symlinked state file');
150
+ const tmp = `${abs}.${process.pid}.tmp`;
151
+ const body = JSON.stringify(value);
152
+ try {
153
+ writeFileSync(tmp, body, { mode: 0o600, flag: 'wx' });
154
+ } catch (e) {
155
+ if (e?.code !== 'EEXIST') throw e;
156
+ rmSync(tmp, { force: true }); // unlinks a leftover (or a planted link) without following it
157
+ writeFileSync(tmp, body, { mode: 0o600, flag: 'wx' });
158
+ }
159
+ renameSync(tmp, abs);
160
+ }
161
+
162
+ /** Read JSON, or `dflt` for a missing / unreadable / torn file. */
163
+ export function readState(abs, dflt = null) {
164
+ try {
165
+ return JSON.parse(readFileSync(abs, 'utf8'));
166
+ } catch {
167
+ return dflt;
168
+ }
169
+ }
170
+
171
+ export function removeState(abs) {
172
+ rmSync(abs, { force: true });
173
+ }
174
+
175
+ /** An empty folder is only removed once it has been idle this long (a writer may be about to fill it). */
176
+ const EMPTY_DIR_GRACE_MS = 60_000;
177
+
178
+ /**
179
+ * Drop call states nobody settled (a killed call sends no PostToolUse) once they are older than
180
+ * `maxAgeMs`, so a manifest never outlives its turn by long; then the session folders that are left
181
+ * empty and a lane cache nobody has refreshed in as long (#164 D7). Best effort, never throws.
182
+ */
183
+ export function pruneStates(root, maxAgeMs = 24 * 3_600_000, env = process.env) {
184
+ try {
185
+ const base = hookStateDir(root, env);
186
+ const now = Date.now();
187
+ // how long a folder has been idle, read before this pass touches it
188
+ const idle = (d) => {
189
+ try {
190
+ return now - statSync(d).mtimeMs > EMPTY_DIR_GRACE_MS;
191
+ } catch {
192
+ return false;
193
+ }
194
+ };
195
+ for (const s of readdirSync(base, { withFileTypes: true })) {
196
+ if (!s.isDirectory()) continue;
197
+ const sessionDir = join(base, s.name);
198
+ const dir = join(sessionDir, 'bash');
199
+ const dirIdle = idle(dir);
200
+ const sessionIdle = idle(sessionDir);
201
+ let names = [];
202
+ try {
203
+ names = readdirSync(dir);
204
+ } catch {
205
+ /* no bash folder */
206
+ }
207
+ let left = names.length;
208
+ for (const n of names) {
209
+ try {
210
+ if (now - statSync(join(dir, n)).mtimeMs > maxAgeMs) {
211
+ rmSync(join(dir, n), { force: true });
212
+ left--;
213
+ }
214
+ } catch {
215
+ left--; // gone
216
+ }
217
+ }
218
+ // rmdir only succeeds on an empty folder, so a refill in between is safe
219
+ if (left === 0 && dirIdle) {
220
+ try {
221
+ rmdirSync(dir);
222
+ } catch {
223
+ /* refilled, or gone */
224
+ }
225
+ }
226
+ // #168 E1/E3 — an edit's snapshot record is needed until its post-edit (pruned like a call
227
+ // state); a run base and the screenshot record last as long as a run may (a week of idling)
228
+ const runAge = maxAgeMs * 7;
229
+ const snaps = join(sessionDir, 'snaps');
230
+ for (const [d, age] of [
231
+ [join(snaps, 'snap'), maxAgeMs],
232
+ [join(snaps, 'base'), runAge],
233
+ ]) {
234
+ let files = [];
235
+ try {
236
+ files = readdirSync(d);
237
+ } catch {
238
+ continue;
239
+ }
240
+ for (const n of files) {
241
+ try {
242
+ if (now - statSync(join(d, n)).mtimeMs > age) rmSync(join(d, n), { force: true });
243
+ } catch {
244
+ /* gone */
245
+ }
246
+ }
247
+ if (idle(d)) {
248
+ try {
249
+ rmdirSync(d);
250
+ } catch {
251
+ /* not empty */
252
+ }
253
+ }
254
+ }
255
+ if (idle(snaps)) {
256
+ try {
257
+ rmdirSync(snaps);
258
+ } catch {
259
+ /* not empty */
260
+ }
261
+ }
262
+ try {
263
+ const shots = join(sessionDir, 'shots.jsonl');
264
+ if (now - statSync(shots).mtimeMs > runAge) rmSync(shots, { force: true });
265
+ } catch {
266
+ /* no record */
267
+ }
268
+ if (sessionIdle) {
269
+ try {
270
+ rmdirSync(sessionDir);
271
+ } catch {
272
+ /* not empty */
273
+ }
274
+ }
275
+ }
276
+ try {
277
+ const lanes = lanesCachePath(root, env);
278
+ if (now - statSync(lanes).mtimeMs > maxAgeMs) rmSync(lanes, { force: true });
279
+ } catch {
280
+ /* no cache */
281
+ }
282
+ try {
283
+ const shots = shotsPath(root, null, env);
284
+ if (now - statSync(shots).mtimeMs > maxAgeMs * 7) rmSync(shots, { force: true });
285
+ } catch {
286
+ /* no session-less record */
287
+ }
288
+ } catch {
289
+ /* nothing to prune */
290
+ }
291
+ }
@@ -12,8 +12,8 @@
12
12
  // — not by importing paths.ts directly, to keep the CLI's compiled binary
13
13
  // decoupled from the dev-server's module graph.
14
14
 
15
- import { existsSync, realpathSync } from 'node:fs';
16
- import { dirname, join } from 'node:path';
15
+ import { existsSync, realpathSync, statSync } from 'node:fs';
16
+ import { basename, dirname, join } from 'node:path';
17
17
  import { fileURLToPath } from 'node:url';
18
18
 
19
19
  function isVirtualBunfsPath(p) {
@@ -94,6 +94,67 @@ export function resolveTauriResourcePkgRoot(execDir) {
94
94
  return null;
95
95
  }
96
96
 
97
+ function realOrNull(p) {
98
+ try {
99
+ return realpathSync(p);
100
+ } catch {
101
+ return null;
102
+ }
103
+ }
104
+
105
+ /**
106
+ * The packaged app's compiled studio server, when THIS CLI runs from the app bundle (T1.10, #206).
107
+ *
108
+ * From the `.app`, `maude design server-up` / `serve` used to run `bun server.ts` against the staged
109
+ * studio source in `Contents/Resources/apps/studio`, which has no node_modules ("dev-server runtime
110
+ * deps not installed: yjs y-protocols lib0"), while the compiled `maude-server` the desktop runs sat
111
+ * right next to the CLI in `Contents/MacOS`. The desktop hands its children MAUDE_DEV_SERVER_BIN;
112
+ * a terminal has no desktop parent, so the CLI finds the server itself, the same way it finds its
113
+ * package root: from the running executable's REAL directory (a PATH symlink into the app is
114
+ * dereferenced), and only when the package root in use IS that bundle's resource tree.
115
+ *
116
+ * Returns `{ bin, devServerRoot, pkgRoot }` — the env the desktop gives the same server is
117
+ * MAUDE_DEV_SERVER_ROOT = devServerRoot and MAUDE_PKG_ROOT = pkgRoot (sidecar.rs) — or null for a
118
+ * repo checkout or an npm install (nothing beside node / the platform binary).
119
+ */
120
+ export function resolveAppSidecar({ pkgRoot, execPath }) {
121
+ const real = realOrNull(execPath);
122
+ if (!real || !pkgRoot) return null;
123
+ const execDir = dirname(real);
124
+ const bin = join(execDir, process.platform === 'win32' ? 'maude-server.exe' : 'maude-server');
125
+ try {
126
+ if (!statSync(bin).isFile()) return null;
127
+ } catch {
128
+ return null;
129
+ }
130
+ const sibling = resolveTauriResourcePkgRoot(execDir);
131
+ if (!sibling || realOrNull(sibling) !== realOrNull(pkgRoot)) return null;
132
+ return { bin, devServerRoot: join(sibling, 'apps', 'studio'), pkgRoot: sibling };
133
+ }
134
+
135
+ /**
136
+ * The package root for a running executable in `execDir`. Inside `<X>.app/Contents/MacOS` the
137
+ * bundle's own `Contents/Resources` wins: a debug build sits under `target/debug/`, which also
138
+ * holds staged `apps/` + `cli/` + `package.json`, and the walk-up used to reach that tree first (so
139
+ * `server-up` ran the staged source with no node_modules). Otherwise walk up (up to 10 levels),
140
+ * then fall back to the Tauri sibling probe. Null when nothing matches.
141
+ */
142
+ export function pkgRootFromExecDir(execDir) {
143
+ if (basename(execDir) === 'MacOS' && basename(dirname(execDir)) === 'Contents') {
144
+ const res = join(execDir, '..', 'Resources');
145
+ if (isPkgRoot(res)) return res;
146
+ }
147
+ let cur = execDir;
148
+ for (let i = 0; i < 10; i++) {
149
+ if (isPkgRoot(cur)) return cur;
150
+ const parent = dirname(cur);
151
+ if (parent === cur) break;
152
+ cur = parent;
153
+ }
154
+ // Tauri `.app` sibling probe — the packaged layout the walk-up can't reach.
155
+ return resolveTauriResourcePkgRoot(execDir);
156
+ }
157
+
97
158
  export function resolvePkgRoot() {
98
159
  const override = process.env.MAUDE_PKG_ROOT;
99
160
  if (override && !isVirtualBunfsPath(override) && isPkgRoot(override)) return override;
@@ -117,17 +178,8 @@ export function resolvePkgRoot() {
117
178
  } catch {
118
179
  execDir = dirname(process.execPath);
119
180
  }
120
- let cur = execDir;
121
- for (let i = 0; i < 10; i++) {
122
- if (isPkgRoot(cur)) return cur;
123
- const parent = dirname(cur);
124
- if (parent === cur) break;
125
- cur = parent;
126
- }
127
-
128
- // (3) Tauri `.app` sibling probe — the packaged layout the walk-up can't reach.
129
- const sibling = resolveTauriResourcePkgRoot(execDir);
130
- if (sibling) return sibling;
181
+ const found = pkgRootFromExecDir(execDir);
182
+ if (found) return found;
131
183
 
132
184
  // Final fallback for unanchored test contexts — callers should expect
133
185
  // existsSync-based lookups to fail and surface a clear error, same
@@ -7,12 +7,25 @@
7
7
  // sha256(realpath(root))[:12], http.ts rootIdentity) — a reused port may be another project's.
8
8
  // Any failure → null: callers fail open.
9
9
  //
10
- // Leaf module: node built-ins only.
10
+ // #206 T6.3d — the desktop app first (desktop-locate.mjs): while the app runs and its registry names
11
+ // this root as running, ITS attested server is the studio and `_server.json` is never read; a server
12
+ // there that does not attest means no studio (fail closed), not a fallback to the project file.
13
+ //
14
+ // sec-loopback-bearer §7 — an app server requires its per-spawn API key from every caller: the attested
15
+ // app studio carries `apiKey` (from the app's registry, never from a project file), and every request a
16
+ // verb or hook sends goes through `studioHeaders`. A terminal-started studio (§7.5) carries the key it
17
+ // wrote to its per-user key file (desktop-locate.mjs `terminalKeyFor`), read only after `/_health`
18
+ // named this root.
19
+ //
20
+ // Node built-ins + desktop-locate.mjs (itself a leaf).
11
21
 
12
- import { createHash } from 'node:crypto';
13
- import { existsSync, readFileSync, realpathSync } from 'node:fs';
22
+ import { existsSync, readFileSync } from 'node:fs';
14
23
  import { dirname, join, resolve } from 'node:path';
15
24
 
25
+ import { probeDesktop, rootIdentity, serverKeyFor, terminalKeyFor } from './desktop-locate.mjs';
26
+
27
+ export { rootIdentity };
28
+
16
29
  export const DESIGN_REL = '.design';
17
30
 
18
31
  /** The nearest directory at or above `start` holding `.design/config.json`, or null. */
@@ -26,17 +39,6 @@ export function findProjectRoot(start) {
26
39
  }
27
40
  }
28
41
 
29
- /** http.ts rootIdentity, verbatim. */
30
- export function rootIdentity(root) {
31
- let resolved = root;
32
- try {
33
- resolved = realpathSync(root);
34
- } catch {
35
- /* hash what we were told */
36
- }
37
- return createHash('sha256').update(resolved, 'utf8').digest('hex').slice(0, 12);
38
- }
39
-
40
42
  /** `{ port, base }` of the studio serving `root`, or null. Never throws. */
41
43
  export async function locateStudio(root, { timeoutMs = 300 } = {}) {
42
44
  return (await probeStudio(root, { timeoutMs })).studio ?? null;
@@ -53,6 +55,28 @@ export async function probeStudio(
53
55
  root,
54
56
  { timeoutMs = 300, attempts = 1, retryDelayMs = 250 } = {}
55
57
  ) {
58
+ const app = await probeDesktop(root, { timeoutMs: Math.max(timeoutMs, 300) });
59
+ if (app.state === 'unverified') return { state: 'none' };
60
+ if (app.state === 'running') {
61
+ const base = `http://127.0.0.1:${app.port}`;
62
+ let health = null;
63
+ try {
64
+ const res = await fetch(`${base}/_health`, { signal: AbortSignal.timeout(timeoutMs) });
65
+ if (res.ok) health = await res.json();
66
+ } catch {
67
+ /* attested already; /_health is only informative here */
68
+ }
69
+ return {
70
+ studio: {
71
+ port: app.port,
72
+ base,
73
+ health,
74
+ owner: 'app',
75
+ label: app.label,
76
+ ...(app.apiKey ? { apiKey: app.apiKey } : {}),
77
+ },
78
+ };
79
+ }
56
80
  let port;
57
81
  try {
58
82
  const info = JSON.parse(readFileSync(join(root, DESIGN_REL, '_server.json'), 'utf8'));
@@ -77,7 +101,9 @@ export async function probeStudio(
77
101
  const health = await res.json();
78
102
  if (health?.app !== 'design' || health.rootId !== rootIdentity(root))
79
103
  return { state: 'none' };
80
- return { studio: { port, base, health } };
104
+ // §7.5 — a terminal-started server's own key, from its per-user key file (never the project)
105
+ const apiKey = terminalKeyFor(root, port);
106
+ return { studio: { port, base, health, ...(apiKey ? { apiKey } : {}) } };
81
107
  } catch (e) {
82
108
  // only a timeout is "busy": a refused connection is no server on that port
83
109
  if (e?.name !== 'TimeoutError' && e?.name !== 'AbortError') return { state: 'none' };
@@ -86,12 +112,29 @@ export async function probeStudio(
86
112
  return { state: 'busy' };
87
113
  }
88
114
 
115
+ export const API_KEY_HEADER = 'x-maude-api-key';
116
+
117
+ /** The headers every request to `studio` carries (the app server's API key), merged over `extra`. */
118
+ export function studioHeaders(studio, extra = {}) {
119
+ return studio?.apiKey ? { ...extra, [API_KEY_HEADER]: studio.apiKey } : { ...extra };
120
+ }
121
+
122
+ /**
123
+ * The same headers for a helper that holds only a PORT (read from `_server.json` by a bash caller):
124
+ * the key of the server serving `root` there — the app's attested one, else a terminal-started one
125
+ * whose `/_health` names `root`. A port that is neither gets no key. Never throws.
126
+ */
127
+ export async function studioHeadersFor(root, port, extra = {}) {
128
+ const r = await serverKeyFor(root, Number(port));
129
+ return r.key ? { ...extra, [API_KEY_HEADER]: r.key } : { ...extra };
130
+ }
131
+
89
132
  /** POST JSON to a located studio. `{ status, body }`, or null on any transport failure. */
90
133
  export async function postStudio(studio, route, payload, { timeoutMs = 1500 } = {}) {
91
134
  try {
92
135
  const res = await fetch(`${studio.base}${route}`, {
93
136
  method: 'POST',
94
- headers: { 'content-type': 'application/json' },
137
+ headers: studioHeaders(studio, { 'content-type': 'application/json' }),
95
138
  body: JSON.stringify(payload),
96
139
  signal: AbortSignal.timeout(timeoutMs),
97
140
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "2.0.8",
3
+ "version": "2.1.1",
4
4
  "description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -49,7 +49,9 @@
49
49
  "test:e2e:desktop:lifecycle": "pnpm --filter @maude/desktop-e2e e2e:lifecycle",
50
50
  "test:e2e:desktop:switchrepos": "pnpm --filter @maude/desktop-e2e e2e:switchrepos",
51
51
  "test:e2e:desktop:tabs": "pnpm --filter @maude/desktop-e2e e2e:tabs",
52
+ "test:e2e:desktop:clip": "pnpm --filter @maude/desktop-e2e e2e:clip",
52
53
  "test:e2e:desktop:tabs-identity": "pnpm --filter @maude/desktop-e2e e2e:tabs-identity",
54
+ "test:e2e:desktop:cli-reuse": "pnpm --filter @maude/desktop-e2e e2e:cli-reuse",
53
55
  "test:e2e:desktop:relaunch": "pnpm --filter @maude/desktop-e2e e2e:relaunch",
54
56
  "test:e2e:desktop:home": "pnpm --filter @maude/desktop-e2e e2e:home",
55
57
  "test:e2e:desktop:onboarding": "pnpm --filter @maude/desktop-e2e e2e:onboarding",
@@ -57,21 +59,26 @@
57
59
  "test:e2e:desktop:acp-fake": "pnpm --filter @maude/desktop-e2e e2e:acp-fake",
58
60
  "test:e2e:desktop:parity": "pnpm --filter @maude/desktop-e2e e2e:parity",
59
61
  "test:e2e:desktop:sidecar-respawn": "pnpm --filter @maude/desktop-e2e e2e:sidecar-respawn",
62
+ "test:e2e:desktop:exports": "pnpm --filter @maude/desktop-e2e e2e:exports",
63
+ "test:e2e:desktop:accounts": "pnpm --filter @maude/desktop-e2e e2e:accounts",
60
64
  "test:e2e:desktop:team-project": "pnpm --filter @maude/desktop-e2e e2e:team-project",
61
65
  "test:e2e:desktop:ai-runs": "pnpm --filter @maude/desktop-e2e e2e:ai-runs",
62
66
  "test:e2e:desktop:team-cell": "pnpm --filter @maude/desktop-e2e e2e:team-cell",
63
67
  "test:e2e:desktop:team-cell-missing": "pnpm --filter @maude/desktop-e2e e2e:team-cell-missing",
68
+ "test:e2e:desktop:an-vote": "pnpm --filter @maude/desktop-e2e e2e:an-vote",
69
+ "test:e2e:desktop:co-mention-notify": "pnpm --filter @maude/desktop-e2e e2e:co-mention-notify",
70
+ "test:e2e:desktop:ve-footage": "pnpm --filter @maude/desktop-e2e e2e:ve-footage",
64
71
  "test:e2e:desktop:s20": "pnpm --filter @maude/desktop-e2e e2e:s20",
65
72
  "test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
66
73
  },
67
74
  "optionalDependencies": {
68
- "@1agh/maude-darwin-arm64": "2.0.8",
69
- "@1agh/maude-darwin-x64": "2.0.8",
70
- "@1agh/maude-linux-arm64": "2.0.8",
71
- "@1agh/maude-linux-arm64-musl": "2.0.8",
72
- "@1agh/maude-linux-x64": "2.0.8",
73
- "@1agh/maude-linux-x64-musl": "2.0.8",
74
- "@1agh/maude-win32-x64": "2.0.8"
75
+ "@1agh/maude-darwin-arm64": "2.1.1",
76
+ "@1agh/maude-darwin-x64": "2.1.1",
77
+ "@1agh/maude-linux-arm64": "2.1.1",
78
+ "@1agh/maude-linux-arm64-musl": "2.1.1",
79
+ "@1agh/maude-linux-x64": "2.1.1",
80
+ "@1agh/maude-linux-x64-musl": "2.1.1",
81
+ "@1agh/maude-win32-x64": "2.1.1"
75
82
  },
76
83
  "files": [
77
84
  "cli",
@@ -365,6 +365,19 @@
365
365
  }
366
366
  }
367
367
  </script>
368
+ <!-- #169 item 1 — the runtime modules every canvas loads (comment-mount.js's static import
369
+ graph): fetched while the canvas module builds instead of one level after another. The
370
+ server adds the shared canvas-lib and its imports here (canvas-lib-module.ts). Kept equal
371
+ to comment-mount's graph by test/shell-modulepreload.test.ts. -->
372
+ <link rel="modulepreload" href="./_canvas-runtime/react.js" />
373
+ <link rel="modulepreload" href="./_canvas-runtime/react-dom.js" />
374
+ <link rel="modulepreload" href="./_canvas-runtime/react-dom_client.js" />
375
+ <link rel="modulepreload" href="./_canvas-runtime/react_jsx-runtime.js" />
376
+ <link rel="modulepreload" href="./_canvas-runtime/yjs.js" />
377
+ <link rel="modulepreload" href="./_canvas-runtime/y-protocols_sync.js" />
378
+ <link rel="modulepreload" href="./_canvas-runtime/y-protocols_awareness.js" />
379
+ <link rel="modulepreload" href="./_canvas-runtime/lib0_decoding.js" />
380
+ <link rel="modulepreload" href="./_canvas-runtime/lib0_encoding.js" />
368
381
  </head>
369
382
  <body>
370
383
  <div id="canvas-root"></div>