@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
@@ -5,8 +5,13 @@
5
5
  // object.copy the selected objects' JSX (document order) — a READ: nothing is written
6
6
  // artboard.copy params.artboards' whole `<DCArtboard>` ranges — a READ
7
7
  // object.cut object.copy, then the objects leave the file — one write, one ⌘Z
8
+ // artboard.cut artboard.copy + artboard.trash's removal (#122) — one write, `kind: 'trash'`, one ⌘Z
8
9
  // canvas.paste params.clip = the handle a copy / cut answered — one write, one ⌘Z
9
10
  //
11
+ // #122 (122-A): a copy also keeps what it READS from around it — the imports and module-level declarations
12
+ // (edit-ops/clip-carry.ts) — and a paste on another canvas adds what the target lacks (re-pointed, reused or
13
+ // renamed; every added import passes the C4 import rule). Function-scope names still refuse (`needs`).
14
+ //
10
15
  // The BYTES never travel: a copy / cut keeps the copied text HERE (server memory, per project server)
11
16
  // and answers a handle `{ id, kind, count, from }` in `detail.clip`. The shell holds that handle (its
12
17
  // clipboard, client/clipboard-relay.ts) and is the only one that names it on a paste — it overwrites
@@ -40,9 +45,19 @@ import {
40
45
  walkIdElements,
41
46
  withIdAttr,
42
47
  } from '../element-ids.ts';
48
+ import { artboardTrash } from './artboard-trash.ts';
49
+ import {
50
+ type CarriedSummary,
51
+ type Carry,
52
+ type CarryPlan,
53
+ carryOf,
54
+ MAX_CARRIED,
55
+ planCarry,
56
+ renameRefs,
57
+ } from './clip-carry.ts';
43
58
  import { artboardLabels, copyId, copyName } from './duplicate-at-width.ts';
44
59
  import { isCoord } from './layout-patch.ts';
45
- import { needsOf, scopeAt } from './scope-names.ts';
60
+ import { scopeAt } from './scope-names.ts';
46
61
  import { lineIndent, reindent } from './siblings.ts';
47
62
  import type { ClipScope, EditOp, ElementRef, LayoutPatch, ResolvedEditOp } from './types.ts';
48
63
 
@@ -64,9 +79,15 @@ interface Clip extends ClipHandle {
64
79
  names: Array<{ id: string; label: string; width: number | null }>;
65
80
  /** objects: the artboard they came from (a paste with nowhere else to go lands there) */
66
81
  artboard: string | null;
67
- /** objects: the names the copied code reads from around it (a component's values, a helper) — a paste where
68
- * they are not visible is refused (P8 C7), never landed as an error card */
69
- needs?: string[];
82
+ /** the names the copied code reads that can not travel (a component's props / state, a `let`) — a paste where
83
+ * they are not visible is refused (P8 C7), never landed as an error card; #122: artboards too */
84
+ needs: string[];
85
+ /** #122 (122-A) — the imports and module-level declarations the copy reads; a paste on another canvas adds them */
86
+ carry: Carry;
87
+ /** #122 — set when the carry was too big to keep: a paste on another canvas is refused with these words */
88
+ carryRefused: string | null;
89
+ /** #122 (122-C) — set on a clip that came from ANOTHER project (the shell's clip-import): never "this canvas" */
90
+ project?: string;
70
91
  bytes: number;
71
92
  }
72
93
 
@@ -112,7 +133,11 @@ function shelfOf(subject: string): Map<string, Clip> {
112
133
  function keep(clip: Omit<Clip, 'id' | 'bytes' | 'count'>, scope: ClipScope): ClipHandle {
113
134
  const clips = shelfOf(scope.subject);
114
135
  const id = `c_${randomBytes(8).toString('hex')}`;
115
- const bytes = clip.items.reduce((n, t) => n + t.length * 2, 0);
136
+ // #122: the carried text counts toward the shelf's bytes like the items
137
+ const carried =
138
+ clip.carry.decls.reduce((n, d) => n + d.text.length + d.name.length, 0) +
139
+ clip.carry.imports.reduce((n, i) => n + i.spec.length + i.local.length + i.imported.length, 0);
140
+ const bytes = clip.items.reduce((n, t) => n + t.length * 2, 0) + carried * 2;
116
141
  clips.set(id, { ...clip, id, bytes, count: clip.items.length });
117
142
  let total = 0;
118
143
  for (const c of clips.values()) total += c.bytes;
@@ -201,13 +226,33 @@ const widthOf = (attrs: string): number | null => {
201
226
  return m ? Number(m[1]) : null;
202
227
  };
203
228
 
229
+ /** #122 — what the copied ranges read from around them: carried, or (function scope, `let`) needed. */
230
+ function readsOf(
231
+ source: string,
232
+ req: ResolvedEditOp,
233
+ els: IdElement[],
234
+ items: string[]
235
+ ): Pick<Clip, 'needs' | 'carry' | 'carryRefused'> {
236
+ const read = carryOf(
237
+ source,
238
+ els.map((el) => [el.start, el.end] as const),
239
+ req.file,
240
+ items,
241
+ req.readFile ? { text: req.readFile } : undefined
242
+ );
243
+ if (!read) return fail(req.file, 'This canvas does not parse; fix it before editing.');
244
+ return { needs: read.needs, carry: read.carry, carryRefused: read.refused };
245
+ }
246
+
204
247
  function readArtboards(source: string, req: ResolvedEditOp): Omit<Clip, 'id' | 'bytes' | 'count'> {
205
248
  const { els, all } = artboardsOf(source, req);
206
249
  const labels = artboardLabels(source);
250
+ const items = els.map((el) => itemOf(source, all, el));
207
251
  return {
208
252
  kind: 'artboards',
209
253
  from: req.file,
210
- items: els.map((el) => itemOf(source, all, el)),
254
+ items,
255
+ ...readsOf(source, req, els, items),
211
256
  names: els.map((el) => {
212
257
  const id = el.artboard as string;
213
258
  const open = source.slice(el.start, source.indexOf('>', el.nameEnd) + 1);
@@ -219,15 +264,16 @@ function readArtboards(source: string, req: ResolvedEditOp): Omit<Clip, 'id' | '
219
264
 
220
265
  function readObjects(source: string, req: ResolvedEditOp) {
221
266
  const { els, all } = objectsOf(source, req);
267
+ const items = els.map((el) => itemOf(source, all, el));
222
268
  return {
223
269
  els,
224
270
  clip: {
225
271
  kind: 'objects' as const,
226
272
  from: req.file,
227
- items: els.map((el) => itemOf(source, all, el)),
273
+ items,
228
274
  names: [],
229
275
  artboard: req.targets[0]?.artboard ?? null,
230
- needs: [...new Set(els.flatMap((el) => needsOf(source, el.start, el.end) ?? []))].sort(),
276
+ ...readsOf(source, req, els, items),
231
277
  },
232
278
  };
233
279
  }
@@ -276,6 +322,36 @@ export const objectCut: EditOp = {
276
322
  },
277
323
  };
278
324
 
325
+ /**
326
+ * #122 (122-A, contract §5.3) — `artboard.copy` + `artboard.trash`'s removal (the JSX spans and the
327
+ * `layout.remove`) in ONE write, `kind: 'trash'` with `origin.trashed`: a cut artboard that is never pasted is
328
+ * in the Trash, not only in this server's forgettable clip. The canvas keeps at least one artboard (trash's rule,
329
+ * its words); a refused cut keeps no clip.
330
+ */
331
+ export const artboardCut: EditOp = {
332
+ id: 'artboard.cut',
333
+ artboards: (req) => artboardTrash.artboards?.(req) ?? [],
334
+ apply(source, req) {
335
+ const trash = artboardTrash.apply(source, req);
336
+ const clip = readArtboards(source, req);
337
+ const trashed = trash.action?.trashed ?? [];
338
+ const handle = keep(clip, req.clipScope ?? DESKTOP_SCOPE);
339
+ return {
340
+ source: trash.source,
341
+ ...(trash.layout ? { layout: trash.layout } : {}),
342
+ detail: { clip: handle },
343
+ action: {
344
+ kind: 'trash',
345
+ label:
346
+ trashed.length === 1
347
+ ? `Cut “${trashed[0]?.label ?? ''}”`
348
+ : `Cut ${trashed.length} artboards`,
349
+ trashed,
350
+ },
351
+ };
352
+ },
353
+ };
354
+
279
355
  // ── the paste ─────────────────────────────────────────────────────────────────────────────────
280
356
 
281
357
  const WRAP_HEAD = 'const __maudeClip = (\n';
@@ -316,6 +392,41 @@ function clipOf(req: ResolvedEditOp): Clip {
316
392
  return clip;
317
393
  }
318
394
 
395
+ /**
396
+ * What the paste at `at` needs from around it, and (#122, another canvas only) what it carries. The clip's
397
+ * `needs` the spot cannot see refuse it in today's words; on its own canvas nothing is carried (the names
398
+ * are already there). Null = nothing to carry.
399
+ */
400
+ function readsAt(
401
+ source: string,
402
+ at: number,
403
+ req: ResolvedEditOp,
404
+ clip: Clip,
405
+ what: 'object' | 'artboard'
406
+ ): CarryPlan | null {
407
+ if (clip.needs.length) {
408
+ const seen = scopeAt(source, at);
409
+ const missing = seen ? clip.needs.filter((n) => !seen.has(n)) : [];
410
+ if (missing.length)
411
+ return fail(
412
+ req.file,
413
+ `That ${what} reads ${missing.slice(0, 3).join(', ')} from where it was copied; it can’t be pasted here. Copy the whole component instead.`
414
+ );
415
+ }
416
+ if (clip.from === req.file && !clip.project) return null;
417
+ if (clip.carryRefused) return fail(req.file, clip.carryRefused);
418
+ return planCarry(
419
+ source,
420
+ at,
421
+ clip.carry,
422
+ clip.from,
423
+ req.file,
424
+ what,
425
+ req.readFile ? { text: req.readFile } : undefined,
426
+ (message) => fail(req.file, message)
427
+ );
428
+ }
429
+
319
430
  /** Where objects land inside an artboard: its page root when it has exactly one element child. */
320
431
  function containerOf(source: string, all: IdElement[], board: IdElement): IdElement {
321
432
  const kids = board.kids.map((i) => all[i]).filter((e): e is IdElement => !!e);
@@ -347,7 +458,7 @@ function pasteObjects(source: string, req: ResolvedEditOp, clip: Clip) {
347
458
  const boards = all.filter((e) => e.tag === 'DCArtboard' && e.artboard);
348
459
  const want =
349
460
  (typeof req.params.artboard === 'string' && req.params.artboard) ||
350
- (clip.from === req.file ? clip.artboard : null);
461
+ (clip.from === req.file && !clip.project ? clip.artboard : null);
351
462
  const board =
352
463
  (want ? boards.find((b) => b.artboard === want) : undefined) ??
353
464
  (typeof req.params.artboard === 'string' ? undefined : boards[0]);
@@ -364,22 +475,14 @@ function pasteObjects(source: string, req: ResolvedEditOp, clip: Clip) {
364
475
  artboard = board.artboard as string;
365
476
  }
366
477
 
367
- if (clip.needs?.length) {
368
- const seen = scopeAt(source, at);
369
- const missing = seen ? clip.needs.filter((n) => !seen.has(n)) : [];
370
- if (missing.length)
371
- return fail(
372
- req.file,
373
- `That object reads ${missing.slice(0, 3).join(', ')} from where it was copied; it can’t be pasted here. Copy the whole component instead.`
374
- );
375
- }
478
+ const plan = readsAt(source, at, req, clip, 'object');
376
479
  const created: ElementRef[] = [];
377
480
  let block = '';
378
481
  for (const raw of clip.items) {
379
482
  const item = checkItem(raw, req.file);
380
483
  if (!item || ['DCArtboard', 'DCSection', 'DesignCanvas'].includes(item.root.tag))
381
484
  return fail(req.file, 'That copy can not be pasted here.');
382
- let text = item.text;
485
+ let text = plan ? renameRefs(item.text, plan.renames, true) : item.text;
383
486
  if (/^[a-z]/.test(item.root.tag)) {
384
487
  const id = generateElementId(seedOf(item.root), used);
385
488
  text = withIdAttr(text, id);
@@ -388,8 +491,9 @@ function pasteObjects(source: string, req: ResolvedEditOp, clip: Clip) {
388
491
  block += `\n${indent}${reindent(text, '', indent)}`;
389
492
  }
390
493
  const s = new MagicString(source);
494
+ plan?.apply(s);
391
495
  s.appendLeft(at, block);
392
- return { source: s.toString(), created };
496
+ return { source: s.toString(), created, carried: plan?.carried };
393
497
  }
394
498
 
395
499
  function pasteArtboards(source: string, req: ResolvedEditOp, clip: Clip) {
@@ -407,6 +511,8 @@ function pasteArtboards(source: string, req: ResolvedEditOp, clip: Clip) {
407
511
  const place = isRec(req.params.at) && isCoord(req.params.at.x) && isCoord(req.params.at.y);
408
512
  let x = place ? Math.round((req.params.at as { x: number }).x) : 0;
409
513
  const y = place ? Math.round((req.params.at as { y: number }).y) : 0;
514
+ // #122: an artboard gets the same needs / carry treatment as an object (it got none before)
515
+ const plan = readsAt(source, after.end, req, clip, 'artboard');
410
516
  let block = '';
411
517
  clip.items.forEach((raw, i) => {
412
518
  const item = checkItem(raw, req.file);
@@ -417,7 +523,8 @@ function pasteArtboards(source: string, req: ResolvedEditOp, clip: Clip) {
417
523
  ids.add(id);
418
524
  const label = copyName(name.label, labels);
419
525
  labels.add(label);
420
- block += `\n${indent}${reindent(renameBoard(item.text, id, label, req.file), '', indent)}`;
526
+ const text = renameBoard(item.text, id, label, req.file);
527
+ block += `\n${indent}${reindent(plan ? renameRefs(text, plan.renames, true) : text, '', indent)}`;
421
528
  created.push({ artboard: id, element: id });
422
529
  if (place) {
423
530
  set.push({ id, x, y });
@@ -425,8 +532,14 @@ function pasteArtboards(source: string, req: ResolvedEditOp, clip: Clip) {
425
532
  }
426
533
  });
427
534
  const s = new MagicString(source);
535
+ plan?.apply(s);
428
536
  s.appendLeft(after.end, block);
429
- return { source: s.toString(), created, layout: set.length ? { set } : undefined };
537
+ return {
538
+ source: s.toString(),
539
+ created,
540
+ layout: set.length ? { set } : undefined,
541
+ carried: plan?.carried,
542
+ };
430
543
  }
431
544
 
432
545
  /** `<DCArtboard id="…" label="…">` of a checked item with a new id and label (the opening tag only). */
@@ -470,13 +583,195 @@ export const canvasPaste: EditOp = {
470
583
  clip.kind === 'artboards'
471
584
  ? countWords(clip.items.length, 'artboard', 'artboards')
472
585
  : countWords(clip.items.length, 'object', 'objects');
586
+ // #122: on another canvas, what the paste added (the canvas's toast says it — counts only, never a handle)
587
+ const carried: CarriedSummary | undefined = done.carried;
473
588
  return {
474
589
  source: done.source,
475
590
  created: done.created,
476
591
  ...('layout' in done && done.layout ? { layout: done.layout } : {}),
592
+ ...(carried ? { detail: { carried } } : {}),
477
593
  action: { kind: 'edit', label: `Paste ${what}` },
478
594
  };
479
595
  },
480
596
  };
481
597
 
482
- export const CLIPBOARD_OPS: readonly EditOp[] = [objectCopy, artboardCopy, objectCut, canvasPaste];
598
+ export const CLIPBOARD_OPS: readonly EditOp[] = [
599
+ objectCopy,
600
+ artboardCopy,
601
+ objectCut,
602
+ artboardCut,
603
+ canvasPaste,
604
+ ];
605
+
606
+ // ── #122 (122-C) — a clip between two projects on this Mac ────────────────────────────────────
607
+ //
608
+ // The desktop shell (Rust, clip_bridge.rs) carries a clip from the server it was copied on to the server of
609
+ // the tab it is pasted in, over the shell-token routes (routes/shell.ts, shell/clip-transfer.ts). Only a
610
+ // clip this server read from its OWN disk is exported (never one that came in from elsewhere), and an
611
+ // imported clip is checked item by item with the paste's own `checkItem` before it is kept — on the
612
+ // desktop shelf, marked with the project it came from so no paste treats it as "this canvas".
613
+
614
+ /** What crosses between two project servers: the text, never another shelf's handle. */
615
+ export interface ClipTransfer {
616
+ kind: ClipKind;
617
+ /** designRoot-relative canvas in the SOURCE project */
618
+ from: string;
619
+ items: string[];
620
+ names: Array<{ id: string; label: string; width: number | null }>;
621
+ artboard: string | null;
622
+ needs: string[];
623
+ carry: Carry;
624
+ carryRefused: string | null;
625
+ }
626
+
627
+ /** A desktop-shelf clip this server read itself, as it crosses; null = no such clip (gone, foreign, a cell's). */
628
+ export function exportClip(id: string): ClipTransfer | null {
629
+ if (typeof id !== 'string' || !CLIP_ID_RE.test(id)) return null;
630
+ const clip = shelves.get(DESKTOP_SCOPE.subject)?.get(id);
631
+ if (!clip || clip.project !== undefined) return null;
632
+ return {
633
+ kind: clip.kind,
634
+ from: clip.from,
635
+ items: [...clip.items],
636
+ names: clip.names.map((n) => ({ ...n })),
637
+ artboard: clip.artboard,
638
+ needs: [...clip.needs],
639
+ carry: {
640
+ imports: clip.carry.imports.map((i) => ({ ...i })),
641
+ decls: clip.carry.decls.map((d) => ({ ...d })),
642
+ assets: [...clip.carry.assets],
643
+ },
644
+ carryRefused: clip.carryRefused,
645
+ };
646
+ }
647
+
648
+ const IDENT = /^[A-Za-z_$][\w$]*$/;
649
+ const NAME_MAX = 200;
650
+ const PATH_MAX = 512;
651
+ const DECL_KINDS = new Set(['const', 'function', 'class', 'type']);
652
+ const DECL_NODES = new Set([
653
+ 'VariableDeclaration',
654
+ 'FunctionDeclaration',
655
+ 'ClassDeclaration',
656
+ 'TSTypeAliasDeclaration',
657
+ 'TSInterfaceDeclaration',
658
+ ]);
659
+ const str = (v: unknown, max: number): v is string =>
660
+ typeof v === 'string' && v.length <= max && !v.includes('\0');
661
+ /** A designRoot-relative path: no root, no `..`, no backslash, no empty segment. */
662
+ export const isDesignRel = (v: unknown): v is string =>
663
+ str(v, PATH_MAX) &&
664
+ v.length > 0 &&
665
+ !v.startsWith('/') &&
666
+ !v.includes('\\') &&
667
+ !v.split('/').some((seg) => seg === '..' || seg === '' || seg === '.');
668
+
669
+ /** One carried declaration's text: exactly one top-level declaration statement. */
670
+ function declParses(text: string): boolean {
671
+ try {
672
+ const parsed = parseSync('decl.tsx', text, { sourceType: 'module' }) as {
673
+ program?: { body?: Array<{ type?: string }> };
674
+ errors?: unknown[];
675
+ };
676
+ const body = parsed.program?.body ?? [];
677
+ return !parsed.errors?.length && body.length === 1 && DECL_NODES.has(body[0]?.type ?? '');
678
+ } catch {
679
+ return false;
680
+ }
681
+ }
682
+
683
+ /**
684
+ * A clip that came from another project, checked as strictly as a paste checks its own (every item re-parsed
685
+ * as one element of the right kind, the carry's shapes and bounds). Null = refused; nothing is kept.
686
+ */
687
+ export function checkTransfer(v: unknown): ClipTransfer | null {
688
+ if (!isRec(v)) return null;
689
+ const { kind, from, items, names, artboard, needs, carry, carryRefused } = v;
690
+ if (kind !== 'objects' && kind !== 'artboards') return null;
691
+ if (!isDesignRel(from) || !/\.(tsx|jsx)$/.test(from)) return null;
692
+ if (!Array.isArray(items) || items.length === 0 || items.length > MAX_CLIP_ITEMS) return null;
693
+ let chars = 0;
694
+ for (const item of items) {
695
+ if (typeof item !== 'string') return null;
696
+ chars += item.length;
697
+ const checked = checkItem(item, from);
698
+ if (!checked) return null;
699
+ const tag = checked.root.tag;
700
+ if (
701
+ kind === 'artboards'
702
+ ? tag !== 'DCArtboard'
703
+ : /^(DCArtboard|DCSection|DesignCanvas)$/.test(tag)
704
+ )
705
+ return null;
706
+ }
707
+ if (!Array.isArray(names) || names.length !== (kind === 'artboards' ? items.length : 0))
708
+ return null;
709
+ for (const n of names)
710
+ if (
711
+ !isRec(n) ||
712
+ !str(n.id, NAME_MAX) ||
713
+ !str(n.label, NAME_MAX) ||
714
+ !(n.width === null || (typeof n.width === 'number' && Number.isFinite(n.width)))
715
+ )
716
+ return null;
717
+ if (!(artboard === null || str(artboard, NAME_MAX))) return null;
718
+ if (
719
+ !Array.isArray(needs) ||
720
+ needs.length > 256 ||
721
+ !needs.every((n) => str(n, NAME_MAX) && IDENT.test(n))
722
+ )
723
+ return null;
724
+ if (!(carryRefused === null || str(carryRefused, 400))) return null;
725
+ if (!isRec(carry) || !Array.isArray(carry.imports) || !Array.isArray(carry.decls)) return null;
726
+ if (!Array.isArray(carry.assets) || carry.assets.length > 512) return null;
727
+ if (carry.imports.length + carry.decls.length > MAX_CARRIED) return null;
728
+ for (const i of carry.imports as unknown[]) {
729
+ if (!isRec(i) || !str(i.local, NAME_MAX) || !IDENT.test(i.local)) return null;
730
+ if (!str(i.imported, NAME_MAX) || !str(i.spec, PATH_MAX) || i.spec.length === 0) return null;
731
+ if (!(i.module === null || isDesignRel(i.module))) return null;
732
+ if (!(i.typeOnly === undefined || typeof i.typeOnly === 'boolean')) return null;
733
+ chars += i.spec.length + i.local.length + i.imported.length;
734
+ }
735
+ for (const d of carry.decls as unknown[]) {
736
+ if (!isRec(d) || !str(d.name, NAME_MAX) || !IDENT.test(d.name)) return null;
737
+ if (typeof d.text !== 'string' || !DECL_KINDS.has(d.kind as string)) return null;
738
+ if (!declParses(d.text)) return null;
739
+ chars += d.text.length + d.name.length;
740
+ }
741
+ for (const a of carry.assets as unknown[])
742
+ if (!isDesignRel(a) || !a.startsWith('assets/')) return null;
743
+ if (chars * 2 > MAX_CLIP_BYTES) return null;
744
+ return {
745
+ kind,
746
+ from,
747
+ items: items as string[],
748
+ names: (names as ClipTransfer['names']).map((n) => ({
749
+ id: n.id,
750
+ label: n.label,
751
+ width: n.width,
752
+ })),
753
+ artboard: artboard as string | null,
754
+ needs: needs as string[],
755
+ carry: {
756
+ imports: (carry.imports as Carry['imports']).map((i) => ({
757
+ local: i.local,
758
+ imported: i.imported,
759
+ spec: i.spec,
760
+ module: i.module,
761
+ ...(i.typeOnly ? { typeOnly: true } : {}),
762
+ })),
763
+ decls: (carry.decls as Carry['decls']).map((d) => ({
764
+ name: d.name,
765
+ text: d.text,
766
+ kind: d.kind,
767
+ })),
768
+ assets: [...(carry.assets as string[])],
769
+ },
770
+ carryRefused: carryRefused as string | null,
771
+ };
772
+ }
773
+
774
+ /** Keep a checked transfer on the desktop shelf; its handle is what the shell pastes with. */
775
+ export function keepTransfer(t: ClipTransfer, project: string): ClipHandle {
776
+ return keep({ ...t, project: project.slice(0, NAME_MAX) }, DESKTOP_SCOPE);
777
+ }
@@ -12,6 +12,7 @@ import { createHash } from 'node:crypto';
12
12
 
13
13
  import { CanvasEditError, ensureStamped } from '../canvas-edit.ts';
14
14
  import { type IdElement, walkIdElements } from '../element-ids.ts';
15
+ import { moduleRefusal } from '../imported-module-ids.ts';
15
16
  import { alignOps } from './align.ts';
16
17
  import { artboardResize } from './artboard-resize.ts';
17
18
  import { artboardTrash } from './artboard-trash.ts';
@@ -200,6 +201,12 @@ export interface DispatchDeps {
200
201
  ctx?(rel: string): EditCtx;
201
202
  /** V2-8.9 L1 — this request's clipboard owner + sight (routes/edit.ts); ops read it as `req.clipScope` */
202
203
  clipScope?: ClipScope;
204
+ /**
205
+ * #151 T2.3b — the imported module (design-root-relative path) an element id lives in, asked only once
206
+ * the id is not in the canvas file: such an element is selectable but edit-read-only, and the refusal
207
+ * names the file. Absent = the plain "not on this canvas".
208
+ */
209
+ moduleOf?(rel: string, id: string): string | null;
203
210
  }
204
211
 
205
212
  /** What `land` is asked to make one action of. */
@@ -301,15 +308,22 @@ export async function dispatchEditOp(raw: unknown, deps: DispatchDeps): Promise<
301
308
  // Stamp every target in this write (V2-1.4 rule 3): an op never sees a computed id.
302
309
  let source = current;
303
310
  const refs: ElementRef[] = [];
311
+ let asked = '';
304
312
  try {
305
313
  for (const t of req.targets) {
314
+ asked = t.element;
306
315
  const st = ensureStamped(rel, source, t.element, t.occurrence);
307
316
  source = st.source;
308
317
  refs.push(t.occurrence ? { ...t, element: st.id } : { artboard: t.artboard, element: st.id });
309
318
  }
310
319
  } catch (e) {
311
- if (e instanceof CanvasEditError)
312
- return refuse('invalid', 'One of the objects is not on this canvas.');
320
+ if (e instanceof CanvasEditError) {
321
+ const module = deps.moduleOf?.(rel, asked) ?? null;
322
+ return refuse(
323
+ 'invalid',
324
+ module ? moduleRefusal(module) : 'One of the objects is not on this canvas.'
325
+ );
326
+ }
313
327
  throw e;
314
328
  }
315
329
  const walk = walkIdElements(source, rel);
@@ -331,6 +345,8 @@ export async function dispatchEditOp(raw: unknown, deps: DispatchDeps): Promise<
331
345
  params: req.params ?? {},
332
346
  // V2-8.9 L1: a copy keeps its text on the requester's own shelf
333
347
  ...(deps.clipScope ? { clipScope: deps.clipScope } : {}),
348
+ // #122: a copy resolves the imports it carries
349
+ readFile: deps.read,
334
350
  });
335
351
  } catch (e) {
336
352
  if (e instanceof CanvasEditError) return refuse('invalid', e.message);
@@ -410,6 +426,8 @@ export async function dispatchEditOp(raw: unknown, deps: DispatchDeps): Promise<
410
426
  ...(deps.exists ? { exists: deps.exists } : {}),
411
427
  ...(deps.ctx ? { ctx: deps.ctx(rel) } : {}),
412
428
  ...(deps.clipScope ? { clipScope: deps.clipScope } : {}),
429
+ // #122: a cross-canvas paste checks every import it adds against the C4 import rule
430
+ readFile: deps.read,
413
431
  });
414
432
  } catch (e) {
415
433
  if (e instanceof CanvasEditError) return refuse('invalid', e.message);