@1agh/maude 1.9.1 → 2.0.0-rc.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 (1986) hide show
  1. package/README.md +4 -4
  2. package/apps/hub/src/project-transactions/baseline.mjs +276 -0
  3. package/apps/hub/src/project-transactions/kernel.mjs +1756 -0
  4. package/apps/hub/src/project-transactions/lanes.mjs +287 -0
  5. package/apps/hub/src/project-transactions/runs-core.mjs +639 -0
  6. package/apps/hub/src/project-transactions/store-core.mjs +831 -0
  7. package/apps/studio/access/closure.ts +1075 -0
  8. package/apps/studio/access/filters.ts +1193 -0
  9. package/apps/studio/access/frame.ts +365 -0
  10. package/apps/studio/access/known-canvases.ts +82 -0
  11. package/apps/studio/access/request.ts +637 -0
  12. package/apps/studio/access/roles.ts +187 -0
  13. package/apps/studio/access/scope.ts +407 -0
  14. package/apps/studio/access/share-map.ts +434 -0
  15. package/apps/studio/acp/adapter-stderr.ts +22 -0
  16. package/apps/studio/acp/agent-path.ts +39 -0
  17. package/apps/studio/acp/ask-queue.ts +238 -0
  18. package/apps/studio/acp/audience.ts +615 -0
  19. package/apps/studio/acp/bootstrap-brief.ts +32 -15
  20. package/apps/studio/acp/bridge.ts +890 -114
  21. package/apps/studio/acp/chat-search.ts +195 -0
  22. package/apps/studio/acp/connected-fact.ts +83 -0
  23. package/apps/studio/acp/design-write-verb.ts +71 -0
  24. package/apps/studio/acp/env.ts +86 -0
  25. package/apps/studio/acp/index.ts +775 -58
  26. package/apps/studio/acp/login-state.ts +15 -1
  27. package/apps/studio/acp/may-scope.ts +771 -0
  28. package/apps/studio/acp/plugin-bootstrap.ts +90 -5
  29. package/apps/studio/acp/probe.ts +18 -4
  30. package/apps/studio/acp/repo-private.ts +73 -0
  31. package/apps/studio/acp/running.ts +50 -5
  32. package/apps/studio/acp/transcript.ts +356 -21
  33. package/apps/studio/acp/write-scope.ts +141 -11
  34. package/apps/studio/actions/agents.ts +2068 -0
  35. package/apps/studio/actions/canvas-keys.ts +41 -0
  36. package/apps/studio/actions/ctx.ts +118 -0
  37. package/apps/studio/actions/defs/_v1.ts +55 -0
  38. package/apps/studio/actions/defs/ai-runs.ts +56 -0
  39. package/apps/studio/actions/defs/annotation.ts +164 -0
  40. package/apps/studio/actions/defs/app.ts +269 -0
  41. package/apps/studio/actions/defs/canvas.ts +281 -0
  42. package/apps/studio/actions/defs/chat.ts +158 -0
  43. package/apps/studio/actions/defs/diagnostics.ts +52 -0
  44. package/apps/studio/actions/defs/ds.ts +139 -0
  45. package/apps/studio/actions/defs/edit.ts +986 -0
  46. package/apps/studio/actions/defs/export.ts +221 -0
  47. package/apps/studio/actions/defs/history.ts +175 -0
  48. package/apps/studio/actions/defs/native.ts +264 -0
  49. package/apps/studio/actions/defs/presence.ts +53 -0
  50. package/apps/studio/actions/defs/search.ts +90 -0
  51. package/apps/studio/actions/defs/sync.ts +47 -0
  52. package/apps/studio/actions/defs/timeline.ts +254 -0
  53. package/apps/studio/actions/defs/tool.ts +152 -0
  54. package/apps/studio/actions/defs/ui.ts +38 -0
  55. package/apps/studio/actions/defs/video.ts +115 -0
  56. package/apps/studio/actions/defs/view.ts +556 -0
  57. package/apps/studio/actions/documents.ts +32 -0
  58. package/apps/studio/actions/forward.ts +48 -0
  59. package/apps/studio/actions/help.ts +115 -0
  60. package/apps/studio/actions/index.ts +51 -0
  61. package/apps/studio/actions/keymap.gen.ts +1170 -0
  62. package/apps/studio/actions/keys.ts +271 -0
  63. package/apps/studio/actions/legacy.ts +250 -0
  64. package/apps/studio/actions/manifest-version.ts +18 -0
  65. package/apps/studio/actions/menu.ts +203 -0
  66. package/apps/studio/actions/native-menu.ts +132 -0
  67. package/apps/studio/actions/resolve.ts +118 -0
  68. package/apps/studio/actions/types.ts +266 -0
  69. package/apps/studio/actions/uniqueness.ts +119 -0
  70. package/apps/studio/actions/verbs.ts +306 -0
  71. package/apps/studio/actions.manifest.json +7826 -0
  72. package/apps/studio/actions.parity.json +268 -0
  73. package/apps/studio/activity.ts +4 -31
  74. package/apps/studio/agent-runs.ts +676 -0
  75. package/apps/studio/ai/attach-grants.ts +497 -0
  76. package/apps/studio/ai/copy-meta.ts +204 -0
  77. package/apps/studio/ai/create-claim.ts +88 -0
  78. package/apps/studio/ai/lease-home.ts +202 -0
  79. package/apps/studio/ai/run-doing.ts +106 -0
  80. package/apps/studio/ai/run-lifecycle.ts +320 -0
  81. package/apps/studio/ai/run-progress.ts +154 -0
  82. package/apps/studio/ai/runs.ts +1180 -0
  83. package/apps/studio/ai/save-hold.ts +565 -0
  84. package/apps/studio/ai/watch-progress.ts +182 -0
  85. package/apps/studio/ai/write-claim-scope.ts +39 -0
  86. package/apps/studio/ai/write-claim.ts +193 -0
  87. package/apps/studio/ai-banner.tsx +8 -14
  88. package/apps/studio/annotations/ai-read.ts +289 -1
  89. package/apps/studio/annotations/ai-write.ts +281 -23
  90. package/apps/studio/annotations/artboard-members.ts +86 -0
  91. package/apps/studio/annotations/board-ops.ts +358 -0
  92. package/apps/studio/annotations/board-schema.ts +81 -0
  93. package/apps/studio/annotations/constants.ts +2 -0
  94. package/apps/studio/annotations/elements/_shared.ts +290 -1
  95. package/apps/studio/annotations/elements/arrow.model.ts +29 -2
  96. package/apps/studio/annotations/elements/ballot.model.ts +110 -0
  97. package/apps/studio/annotations/elements/media.model.ts +11 -1
  98. package/apps/studio/annotations/elements/section.model.ts +3 -1
  99. package/apps/studio/annotations/elements/stamp.model.ts +83 -0
  100. package/apps/studio/annotations/elements/sticky.model.ts +235 -0
  101. package/apps/studio/annotations/elements/vote.model.ts +71 -0
  102. package/apps/studio/annotations/fields.ts +51 -0
  103. package/apps/studio/annotations/figjam-into.ts +119 -0
  104. package/apps/studio/annotations/hosts.ts +231 -0
  105. package/apps/studio/annotations/migrate-v1.ts +21 -2
  106. package/apps/studio/annotations/ops.ts +23 -0
  107. package/apps/studio/annotations/registry.ts +154 -16
  108. package/apps/studio/annotations/route.ts +268 -0
  109. package/apps/studio/annotations/run-tag.ts +150 -0
  110. package/apps/studio/annotations/stamp-kinds.ts +66 -0
  111. package/apps/studio/annotations/templates.ts +154 -0
  112. package/apps/studio/annotations/text-steps.ts +253 -0
  113. package/apps/studio/annotations/time-marks.ts +140 -0
  114. package/apps/studio/annotations/types.ts +22 -0
  115. package/apps/studio/annotations/ui/ai-marks.tsx +64 -0
  116. package/apps/studio/annotations/ui/ai-seen.tsx +117 -0
  117. package/apps/studio/annotations/ui/arrow-bind.ts +347 -0
  118. package/apps/studio/annotations/ui/arrow-cards.tsx +396 -0
  119. package/apps/studio/annotations/ui/arrow-kinds.ts +90 -0
  120. package/apps/studio/annotations/ui/bar-place.ts +18 -0
  121. package/apps/studio/annotations/ui/element-node.tsx +300 -52
  122. package/apps/studio/annotations/ui/host-view.ts +99 -0
  123. package/apps/studio/annotations/ui/locked.tsx +83 -0
  124. package/apps/studio/annotations/ui/lod.tsx +246 -0
  125. package/apps/studio/annotations/ui/placement.tsx +270 -0
  126. package/apps/studio/annotations/ui/pointer-pipeline.ts +10 -0
  127. package/apps/studio/annotations/ui/posture.ts +124 -0
  128. package/apps/studio/annotations/ui/quiet-tip.ts +28 -0
  129. package/apps/studio/annotations/ui/render-model.ts +27 -2
  130. package/apps/studio/annotations/ui/rest-route.ts +152 -0
  131. package/apps/studio/annotations/ui/ride.ts +957 -0
  132. package/apps/studio/annotations/ui/scene.tsx +59 -11
  133. package/apps/studio/annotations/ui/section-fold.ts +95 -0
  134. package/apps/studio/annotations/ui/shell-asks.ts +62 -0
  135. package/apps/studio/annotations/ui/stamps.ts +221 -0
  136. package/apps/studio/annotations/ui/stamps.tsx +272 -0
  137. package/apps/studio/annotations/ui/sticker-drop.ts +147 -0
  138. package/apps/studio/annotations/ui/sticker-preview.ts +41 -0
  139. package/apps/studio/annotations/ui/sticky-resolve.ts +106 -0
  140. package/apps/studio/annotations/ui/template-place.ts +108 -0
  141. package/apps/studio/annotations/ui/text-editor.tsx +6 -4
  142. package/apps/studio/annotations/ui/text-session.ts +63 -1
  143. package/apps/studio/annotations/ui/text-style.ts +11 -3
  144. package/apps/studio/annotations/ui/time-pins.tsx +134 -0
  145. package/apps/studio/annotations/ui/tool-prefs.ts +242 -0
  146. package/apps/studio/annotations/ui/tool-state.ts +211 -0
  147. package/apps/studio/annotations/ui/visibility.ts +76 -0
  148. package/apps/studio/annotations/ui/vote-dots.tsx +283 -0
  149. package/apps/studio/annotations/v1-adapter.ts +88 -5
  150. package/apps/studio/annotations/validate-board.ts +257 -0
  151. package/apps/studio/annotations/vote-guard.ts +48 -0
  152. package/apps/studio/annotations/votes-local.ts +481 -0
  153. package/apps/studio/annotations-bindings.ts +54 -8
  154. package/apps/studio/annotations-context-toolbar.tsx +612 -150
  155. package/apps/studio/annotations-layer.tsx +1768 -674
  156. package/apps/studio/annotations-model.ts +80 -5
  157. package/apps/studio/api.ts +1522 -454
  158. package/apps/studio/artboard-activity-overlay.tsx +530 -3
  159. package/apps/studio/artboard-ai-copies.tsx +187 -0
  160. package/apps/studio/artboard-convert-marks.tsx +142 -0
  161. package/apps/studio/artboard-gap-mark.tsx +177 -0
  162. package/apps/studio/artboard-ghosts-overlay.tsx +106 -0
  163. package/apps/studio/artboard-growth-memory.ts +56 -0
  164. package/apps/studio/artboard-growth-tag.tsx +115 -0
  165. package/apps/studio/artboard-guides-overlay.tsx +86 -26
  166. package/apps/studio/artboard-marquee.tsx +21 -6
  167. package/apps/studio/artboard-new-section.tsx +188 -0
  168. package/apps/studio/artboard-warn-mark.tsx +330 -0
  169. package/apps/studio/asset-details.ts +339 -0
  170. package/apps/studio/asset-generated.ts +99 -0
  171. package/apps/studio/asset-origins.ts +147 -0
  172. package/apps/studio/asset-placeholder.tsx +481 -0
  173. package/apps/studio/asset-rename.ts +171 -0
  174. package/apps/studio/asset-trash.ts +176 -0
  175. package/apps/studio/asset-upload-bars.tsx +167 -0
  176. package/apps/studio/asset-upload.ts +145 -1
  177. package/apps/studio/attribute-artboards.ts +327 -0
  178. package/apps/studio/bin/_ab-headless.sh +35 -0
  179. package/apps/studio/bin/_ab-park.sh +83 -0
  180. package/apps/studio/bin/_agent-browser-safe.mjs +36 -3
  181. package/apps/studio/bin/_annotate-post.mjs +137 -0
  182. package/apps/studio/bin/_assets.mjs +213 -0
  183. package/apps/studio/bin/_brand-colours.mjs +189 -0
  184. package/apps/studio/bin/_brand-fonts.mjs +158 -0
  185. package/apps/studio/bin/_brand-site.mjs +309 -0
  186. package/apps/studio/bin/_canvas-errors.mjs +143 -0
  187. package/apps/studio/bin/_canvas-rects-playwright.mjs +6 -3
  188. package/apps/studio/bin/_canvas-rects-static.mjs +1 -1
  189. package/apps/studio/bin/_check.mjs +122 -0
  190. package/apps/studio/bin/_comments.mjs +274 -0
  191. package/apps/studio/bin/_curl-local.mjs +122 -3
  192. package/apps/studio/bin/_decode-webaudio.mjs +120 -0
  193. package/apps/studio/bin/_describe.mjs +220 -0
  194. package/apps/studio/bin/_ds-check.mjs +26 -0
  195. package/apps/studio/bin/_ds-prove-playwright.mjs +327 -0
  196. package/apps/studio/bin/_ds-upgrade.mjs +14 -0
  197. package/apps/studio/bin/_ds.mjs +82 -0
  198. package/apps/studio/bin/_enumerate-artboards-playwright.mjs +6 -3
  199. package/apps/studio/bin/_exports.mjs +244 -0
  200. package/apps/studio/bin/_fetch-asset.mjs +209 -15
  201. package/apps/studio/bin/_history.mjs +509 -0
  202. package/apps/studio/bin/_html-playwright.mjs +10 -3
  203. package/apps/studio/bin/_import-asset.mjs +446 -15
  204. package/apps/studio/bin/_import-brand.mjs +40 -156
  205. package/apps/studio/bin/_import-figma.mjs +878 -20
  206. package/apps/studio/bin/_import-tokens.mjs +8 -118
  207. package/apps/studio/bin/_index-cli.mjs +126 -0
  208. package/apps/studio/bin/_layout-check.mjs +35 -0
  209. package/apps/studio/bin/_logs.mjs +130 -0
  210. package/apps/studio/bin/_motion-sample-playwright.mjs +6 -3
  211. package/apps/studio/bin/_no-egress.sh +36 -0
  212. package/apps/studio/bin/_pdf-playwright.mjs +9 -3
  213. package/apps/studio/bin/_perf-probe-safari.mjs +327 -37
  214. package/apps/studio/bin/_perf-probe-studio.mjs +259 -0
  215. package/apps/studio/bin/_perf-probe.mjs +35 -1
  216. package/apps/studio/bin/_perf-shared.mjs +377 -12
  217. package/apps/studio/bin/_place.mjs +35 -0
  218. package/apps/studio/bin/_png-playwright.mjs +27 -7
  219. package/apps/studio/bin/_pptx-playwright.mjs +4 -3
  220. package/apps/studio/bin/_pw-launch.mjs +124 -2
  221. package/apps/studio/bin/_record-shot.sh +65 -0
  222. package/apps/studio/bin/_rects-input.mjs +69 -0
  223. package/apps/studio/bin/_reel-place.mjs +160 -0
  224. package/apps/studio/bin/_region.mjs +37 -1
  225. package/apps/studio/bin/_runs.mjs +178 -0
  226. package/apps/studio/bin/_screenshot-playwright.mjs +6 -3
  227. package/apps/studio/bin/_studio-verb.mjs +220 -0
  228. package/apps/studio/bin/_svg-playwright.mjs +4 -3
  229. package/apps/studio/bin/_sync.mjs +179 -0
  230. package/apps/studio/bin/_thumbs-playwright.mjs +704 -0
  231. package/apps/studio/bin/_tile-draw.mjs +74 -0
  232. package/apps/studio/bin/_transcribe-local.mjs +243 -0
  233. package/apps/studio/bin/_transcribe.mjs +48 -56
  234. package/apps/studio/bin/_trash.mjs +287 -0
  235. package/apps/studio/bin/_url-guard.mjs +88 -0
  236. package/apps/studio/bin/_url-guard.sh +16 -0
  237. package/apps/studio/bin/_video-playwright.mjs +9 -3
  238. package/apps/studio/bin/_video-verbs.mjs +403 -0
  239. package/apps/studio/bin/_write-claim.mjs +124 -0
  240. package/apps/studio/bin/annotate.mjs +348 -330
  241. package/apps/studio/bin/assets.sh +28 -0
  242. package/apps/studio/bin/beats.mjs +237 -0
  243. package/apps/studio/bin/beats.sh +24 -0
  244. package/apps/studio/bin/bootstrap-check.sh +2 -1
  245. package/apps/studio/bin/canvas-edit.sh +17 -9
  246. package/apps/studio/bin/canvas-errors.sh +18 -0
  247. package/apps/studio/bin/canvas-rects.sh +14 -0
  248. package/apps/studio/bin/canvas-source.sh +18 -0
  249. package/apps/studio/bin/captions.sh +13 -0
  250. package/apps/studio/bin/chat-open.sh +2 -2
  251. package/apps/studio/bin/check.sh +27 -0
  252. package/apps/studio/bin/comments.sh +20 -0
  253. package/apps/studio/bin/cut-to-beat.sh +13 -0
  254. package/apps/studio/bin/cut-words.sh +13 -0
  255. package/apps/studio/bin/describe.sh +28 -0
  256. package/apps/studio/bin/draw-proof.sh +41 -8
  257. package/apps/studio/bin/ds-check.sh +30 -0
  258. package/apps/studio/bin/ds-upgrade.sh +30 -0
  259. package/apps/studio/bin/ds.sh +29 -0
  260. package/apps/studio/bin/exports.sh +19 -0
  261. package/apps/studio/bin/generate.sh +45 -3
  262. package/apps/studio/bin/handoff.sh +60 -1
  263. package/apps/studio/bin/history.sh +24 -0
  264. package/apps/studio/bin/import-brand.sh +5 -3
  265. package/apps/studio/bin/index.sh +26 -0
  266. package/apps/studio/bin/layout-check.sh +20 -0
  267. package/apps/studio/bin/logs.sh +17 -0
  268. package/apps/studio/bin/perf.sh +93 -3
  269. package/apps/studio/bin/photo-bg-remove.sh +49 -7
  270. package/apps/studio/bin/place.sh +20 -0
  271. package/apps/studio/bin/read-annotations.mjs +52 -1
  272. package/apps/studio/bin/reel-place.sh +15 -0
  273. package/apps/studio/bin/runs.sh +19 -0
  274. package/apps/studio/bin/screenshot.sh +37 -21
  275. package/apps/studio/bin/server-up.sh +50 -13
  276. package/apps/studio/bin/smoke.sh +10 -0
  277. package/apps/studio/bin/sync.sh +18 -0
  278. package/apps/studio/bin/to-lottie.sh +1 -1
  279. package/apps/studio/bin/transcribe-local.sh +27 -0
  280. package/apps/studio/bin/trash.sh +23 -0
  281. package/apps/studio/bin/visual-sanity.sh +1 -0
  282. package/apps/studio/bridge/canvas-mode-store.ts +301 -0
  283. package/apps/studio/bridge/canvas-modes.ts +548 -0
  284. package/apps/studio/bridge/dgn-protocol.ts +2671 -0
  285. package/apps/studio/bridge/esc-ladder.ts +98 -0
  286. package/apps/studio/bridge/link-target.ts +157 -0
  287. package/apps/studio/bridge/mode-shows.ts +167 -0
  288. package/apps/studio/bridge/occlusion.ts +108 -0
  289. package/apps/studio/bridge/paste-data.ts +101 -0
  290. package/apps/studio/build.ts +12 -1
  291. package/apps/studio/bunfig.toml +4 -0
  292. package/apps/studio/canvas-build-sandbox.ts +34 -5
  293. package/apps/studio/canvas-build-worker.ts +23 -1
  294. package/apps/studio/canvas-build.ts +419 -15
  295. package/apps/studio/canvas-comment-mount.tsx +113 -25
  296. package/apps/studio/canvas-create.ts +285 -49
  297. package/apps/studio/canvas-cursors.ts +12 -0
  298. package/apps/studio/canvas-ds-icons.tsx +241 -0
  299. package/apps/studio/canvas-edit.ts +1188 -172
  300. package/apps/studio/canvas-hud-tokens.gen.ts +120 -0
  301. package/apps/studio/canvas-icons.tsx +47 -0
  302. package/apps/studio/canvas-lib-inline.ts +57 -3
  303. package/apps/studio/canvas-lib.tsx +1033 -263
  304. package/apps/studio/canvas-list-watch.ts +73 -2
  305. package/apps/studio/canvas-meta.schema.json +11 -0
  306. package/apps/studio/canvas-notifications.tsx +28 -3
  307. package/apps/studio/canvas-pipeline.ts +43 -8
  308. package/apps/studio/canvas-replay-keys.ts +65 -0
  309. package/apps/studio/canvas-rows.ts +116 -0
  310. package/apps/studio/canvas-shell.tsx +784 -698
  311. package/apps/studio/canvas-source/errors.ts +315 -0
  312. package/apps/studio/canvas-source/source-map.ts +69 -0
  313. package/apps/studio/canvas-theme-pill.tsx +164 -0
  314. package/apps/studio/canvas-theme.ts +133 -0
  315. package/apps/studio/canvas-top-level.ts +69 -0
  316. package/apps/studio/check/ids.ts +28 -0
  317. package/apps/studio/check/index.ts +586 -0
  318. package/apps/studio/check/link-resolver.ts +75 -0
  319. package/apps/studio/check/meta.ts +79 -0
  320. package/apps/studio/check/video.ts +352 -0
  321. package/apps/studio/client/actions/shell-key-handlers.js +450 -0
  322. package/apps/studio/client/app.jsx +2914 -1203
  323. package/apps/studio/client/canvas-url.js +241 -5
  324. package/apps/studio/client/clipboard-relay.ts +144 -0
  325. package/apps/studio/client/command-palette-match.js +4 -2
  326. package/apps/studio/client/comments-overlay.css +529 -144
  327. package/apps/studio/client/dialogs/asset-picker.jsx +77 -32
  328. package/apps/studio/client/dialogs/command-palette.jsx +453 -67
  329. package/apps/studio/client/dialogs/export-dialog.jsx +6 -781
  330. package/apps/studio/client/dialogs/help-modal.jsx +31 -2
  331. package/apps/studio/client/dialogs/shortcuts-overlay.jsx +201 -106
  332. package/apps/studio/client/edit-op-relay.ts +77 -0
  333. package/apps/studio/client/embed-view.jsx +25 -5
  334. package/apps/studio/client/export-bridge-scope.js +72 -0
  335. package/apps/studio/client/export-center.jsx +179 -369
  336. package/apps/studio/client/export-lane.js +117 -0
  337. package/apps/studio/client/export-region.ts +25 -0
  338. package/apps/studio/client/file-tree.jsx +4 -4
  339. package/apps/studio/client/frame-cap.js +132 -0
  340. package/apps/studio/client/generate-dialog.jsx +38 -36
  341. package/apps/studio/client/github.js +85 -26
  342. package/apps/studio/client/home/HomeAsk.jsx +220 -0
  343. package/apps/studio/client/home/InviteSheet.jsx +150 -0
  344. package/apps/studio/client/home/Shelves.jsx +216 -0
  345. package/apps/studio/client/home/Starters.jsx +42 -0
  346. package/apps/studio/client/home/TargetChip.jsx +152 -0
  347. package/apps/studio/client/home/home-api.js +275 -0
  348. package/apps/studio/client/home/home-app.jsx +1884 -0
  349. package/apps/studio/client/home/home-icons.jsx +143 -0
  350. package/apps/studio/client/home/home-menu.js +43 -0
  351. package/apps/studio/client/home/home-model.js +514 -0
  352. package/apps/studio/client/home/home-starters.js +136 -0
  353. package/apps/studio/client/home/home.css +1681 -0
  354. package/apps/studio/client/home/invite-flow.js +422 -0
  355. package/apps/studio/client/home/shell-mode.js +49 -0
  356. package/apps/studio/client/hooks/annotations-hidden-toast.js +21 -0
  357. package/apps/studio/client/hooks/canvas-origin-probe.js +26 -0
  358. package/apps/studio/client/hooks/edit-scope-query.js +16 -0
  359. package/apps/studio/client/hooks/use-action-keys.jsx +121 -0
  360. package/apps/studio/client/hooks/use-canvas-bridge.jsx +881 -247
  361. package/apps/studio/client/hooks/use-git-actions.jsx +33 -12
  362. package/apps/studio/client/hooks/use-palette-and-panels.jsx +722 -287
  363. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +268 -307
  364. package/apps/studio/client/hooks/use-project-data.jsx +23 -2
  365. package/apps/studio/client/hooks/use-shell-core.jsx +582 -126
  366. package/apps/studio/client/hooks/use-tabs.jsx +268 -126
  367. package/apps/studio/client/index-loader.ts +3 -1
  368. package/apps/studio/client/inspector/color-picker.jsx +29 -18
  369. package/apps/studio/client/inspector/css-knobs.jsx +765 -436
  370. package/apps/studio/client/inspector/css-vocab.jsx +37 -4
  371. package/apps/studio/client/inspector/ds-tokens.js +127 -15
  372. package/apps/studio/client/inspector/grid-tracks-editor.jsx +21 -15
  373. package/apps/studio/client/inspector/inspect-computed.jsx +17 -15
  374. package/apps/studio/client/inspector/inspector-panel.jsx +314 -207
  375. package/apps/studio/client/inspector/layers.jsx +90 -65
  376. package/apps/studio/client/inspector/selection.js +20 -0
  377. package/apps/studio/client/inspector/token-popover.jsx +42 -28
  378. package/apps/studio/client/inspector-controls.jsx +453 -106
  379. package/apps/studio/client/panels/BrandUploadPanel.jsx +8 -229
  380. package/apps/studio/client/panels/ChatPanel.jsx +391 -1674
  381. package/apps/studio/client/panels/CloudBar.jsx +548 -252
  382. package/apps/studio/client/panels/CollabModelInfographic.jsx +77 -20
  383. package/apps/studio/client/panels/CreateProject.jsx +224 -40
  384. package/apps/studio/client/panels/DiffView.jsx +27 -10
  385. package/apps/studio/client/panels/ElicitationPrompt.jsx +4 -3
  386. package/apps/studio/client/panels/FigmaImportPanel.jsx +12 -263
  387. package/apps/studio/client/panels/IdentityBar.jsx +262 -74
  388. package/apps/studio/client/panels/IntroVideoDialog.jsx +6 -1
  389. package/apps/studio/client/panels/PermissionPrompt.jsx +85 -9
  390. package/apps/studio/client/panels/ReadinessList.jsx +71 -46
  391. package/apps/studio/client/panels/RepoBranchSwitcher.jsx +124 -745
  392. package/apps/studio/client/panels/SettingsPanel.jsx +492 -608
  393. package/apps/studio/client/panels/SetupChecklist.jsx +10 -3
  394. package/apps/studio/client/panels/SourceConflictPanel.jsx +96 -20
  395. package/apps/studio/client/panels/SyncConsentDialog.jsx +14 -13
  396. package/apps/studio/client/panels/TeamProjects.jsx +365 -119
  397. package/apps/studio/client/panels/ToolGroup.jsx +6 -2
  398. package/apps/studio/client/panels/acp-runtime.js +127 -22
  399. package/apps/studio/client/panels/acp-usage.js +4 -1
  400. package/apps/studio/client/panels/chat-context.js +74 -5
  401. package/apps/studio/client/panels/chat-header.jsx +67 -0
  402. package/apps/studio/client/panels/chat-markdown.jsx +6 -2
  403. package/apps/studio/client/panels/file-deep-link-dialog.jsx +88 -17
  404. package/apps/studio/client/panels/file-preview.jsx +50 -24
  405. package/apps/studio/client/panels/git-grouping.js +9 -2
  406. package/apps/studio/client/panels/slash-commands.gen.js +171 -0
  407. package/apps/studio/client/panels/slash-commands.js +65 -25
  408. package/apps/studio/client/panels/timeline-media-cache.js +68 -2
  409. package/apps/studio/client/panels/timeline-parse.js +62 -22
  410. package/apps/studio/client/panels/timeline-snap.js +4 -1
  411. package/apps/studio/client/panels/transcript-view.js +9 -0
  412. package/apps/studio/client/photo-knobs.jsx +225 -46
  413. package/apps/studio/client/prefs-migrate.js +79 -0
  414. package/apps/studio/client/report-bug.jsx +59 -26
  415. package/apps/studio/client/selection-scope.js +215 -0
  416. package/apps/studio/client/share-link.js +104 -8
  417. package/apps/studio/client/shell/account-tone.js +28 -0
  418. package/apps/studio/client/shell/banners.jsx +21 -188
  419. package/apps/studio/client/shell/comments-panel.jsx +5 -176
  420. package/apps/studio/client/shell/constants.js +1 -0
  421. package/apps/studio/client/shell/dock.jsx +217 -31
  422. package/apps/studio/client/shell/drop-guard.js +52 -0
  423. package/apps/studio/client/shell/icons.jsx +165 -23
  424. package/apps/studio/client/shell/util.js +20 -33
  425. package/apps/studio/client/shell/viewport.jsx +249 -95
  426. package/apps/studio/client/shell-bus.js +82 -0
  427. package/apps/studio/client/shell-events.js +251 -0
  428. package/apps/studio/client/stamp-follow.js +62 -0
  429. package/apps/studio/client/stores/shell-store.jsx +15 -0
  430. package/apps/studio/client/styles/0-reset.css +79 -16
  431. package/apps/studio/client/styles/1-tokens-maude-v2.css +367 -0
  432. package/apps/studio/client/styles/1-tokens-shell.css +374 -0
  433. package/apps/studio/client/styles/2-layout.css +404 -24
  434. package/apps/studio/client/styles/3-kit-maude-v2.css +683 -0
  435. package/apps/studio/client/styles/_index.css +183 -18
  436. package/apps/studio/client/system/system-view.jsx +52 -6
  437. package/apps/studio/client/tour/collab-tour.js +43 -38
  438. package/apps/studio/client/tour/overlay.jsx +61 -19
  439. package/apps/studio/client/tour/quick-setup-tour.js +27 -20
  440. package/apps/studio/client/tour/tour-model.js +36 -0
  441. package/apps/studio/client/tour/usage-tour.js +43 -24
  442. package/apps/studio/client/tree/tree.jsx +661 -409
  443. package/apps/studio/client/tree-expansion.js +5 -2
  444. package/apps/studio/client/tree-row-menu.jsx +43 -29
  445. package/apps/studio/client/ui-open.js +104 -0
  446. package/apps/studio/client/use-tree-drag.js +2 -0
  447. package/apps/studio/client/v2/access/access-card.jsx +54 -0
  448. package/apps/studio/client/v2/access/access-client.js +525 -0
  449. package/apps/studio/client/v2/access/access-host.jsx +328 -0
  450. package/apps/studio/client/v2/access/access.css +163 -0
  451. package/apps/studio/client/v2/access/ask-to-edit.jsx +97 -0
  452. package/apps/studio/client/v2/access/disabled-reason.js +50 -0
  453. package/apps/studio/client/v2/access/link-off-card.jsx +37 -0
  454. package/apps/studio/client/v2/access/trashed-banner.jsx +123 -0
  455. package/apps/studio/client/v2/advanced/where-matrix.js +231 -0
  456. package/apps/studio/client/v2/ai/AChip.jsx +158 -0
  457. package/apps/studio/client/v2/ai/Advanced.jsx +640 -0
  458. package/apps/studio/client/v2/ai/AiChatIsland.jsx +108 -0
  459. package/apps/studio/client/v2/ai/AskSelectionHost.jsx +173 -0
  460. package/apps/studio/client/v2/ai/AttachMenu.jsx +190 -0
  461. package/apps/studio/client/v2/ai/BigChat.jsx +195 -0
  462. package/apps/studio/client/v2/ai/ChatList.jsx +614 -0
  463. package/apps/studio/client/v2/ai/ChatUndo.jsx +164 -0
  464. package/apps/studio/client/v2/ai/ChoiceCard.jsx +178 -0
  465. package/apps/studio/client/v2/ai/Composer.jsx +655 -0
  466. package/apps/studio/client/v2/ai/ConnectSheet.jsx +118 -0
  467. package/apps/studio/client/v2/ai/Consent.jsx +66 -0
  468. package/apps/studio/client/v2/ai/DropOverlay.jsx +113 -0
  469. package/apps/studio/client/v2/ai/Feed.jsx +589 -0
  470. package/apps/studio/client/v2/ai/FoldNeeds.jsx +23 -0
  471. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +250 -0
  472. package/apps/studio/client/v2/ai/NotReady.jsx +110 -0
  473. package/apps/studio/client/v2/ai/OfferCard.jsx +165 -0
  474. package/apps/studio/client/v2/ai/PermissionCard.jsx +168 -0
  475. package/apps/studio/client/v2/ai/PickedShots.jsx +33 -0
  476. package/apps/studio/client/v2/ai/ProblemCard.jsx +41 -0
  477. package/apps/studio/client/v2/ai/QuitDialog.jsx +127 -0
  478. package/apps/studio/client/v2/ai/RawLog.jsx +68 -0
  479. package/apps/studio/client/v2/ai/Result.jsx +144 -0
  480. package/apps/studio/client/v2/ai/RunList.jsx +352 -0
  481. package/apps/studio/client/v2/ai/RunSurface.jsx +248 -0
  482. package/apps/studio/client/v2/ai/ScopeChip.jsx +239 -0
  483. package/apps/studio/client/v2/ai/SentStrip.jsx +70 -0
  484. package/apps/studio/client/v2/ai/StoppedDivider.jsx +84 -0
  485. package/apps/studio/client/v2/ai/Suggest.jsx +153 -0
  486. package/apps/studio/client/v2/ai/TurnResult.jsx +95 -0
  487. package/apps/studio/client/v2/ai/WaitingCard.jsx +133 -0
  488. package/apps/studio/client/v2/ai/WillChange.jsx +40 -0
  489. package/apps/studio/client/v2/ai/Working.jsx +74 -0
  490. package/apps/studio/client/v2/ai/advanced-handlers.js +56 -0
  491. package/apps/studio/client/v2/ai/advanced-model.js +214 -0
  492. package/apps/studio/client/v2/ai/ai-list-advanced.css +625 -0
  493. package/apps/studio/client/v2/ai/ai-may.js +75 -0
  494. package/apps/studio/client/v2/ai/ai-offer.js +178 -0
  495. package/apps/studio/client/v2/ai/ai-run.css +281 -0
  496. package/apps/studio/client/v2/ai/ai-send.js +164 -0
  497. package/apps/studio/client/v2/ai/ai.css +261 -0
  498. package/apps/studio/client/v2/ai/answer-note.js +44 -0
  499. package/apps/studio/client/v2/ai/ask-frame.js +131 -0
  500. package/apps/studio/client/v2/ai/ask-selection-lane.js +100 -0
  501. package/apps/studio/client/v2/ai/ask-selection.css +142 -0
  502. package/apps/studio/client/v2/ai/ask-selection.js +84 -0
  503. package/apps/studio/client/v2/ai/attach.css +366 -0
  504. package/apps/studio/client/v2/ai/attach.js +186 -0
  505. package/apps/studio/client/v2/ai/chat-list-model.js +333 -0
  506. package/apps/studio/client/v2/ai/chat-store-api.js +93 -0
  507. package/apps/studio/client/{styles/6-acp-chat.css → v2/ai/chat.css} +1152 -797
  508. package/apps/studio/client/v2/ai/connect-flow.js +75 -0
  509. package/apps/studio/client/v2/ai/gate-lines.js +121 -0
  510. package/apps/studio/client/v2/ai/icons.jsx +66 -0
  511. package/apps/studio/client/v2/ai/jump-model.js +61 -0
  512. package/apps/studio/client/v2/ai/made-by-ai.js +179 -0
  513. package/apps/studio/client/v2/ai/needs-you-store.js +112 -0
  514. package/apps/studio/client/v2/ai/needs-you-toast.js +104 -0
  515. package/apps/studio/client/v2/ai/needs-you.css +554 -0
  516. package/apps/studio/client/v2/ai/needs-you.js +391 -0
  517. package/apps/studio/client/v2/ai/panel-focus.js +71 -0
  518. package/apps/studio/client/v2/ai/panel.css +88 -0
  519. package/apps/studio/client/v2/ai/paste-chips.jsx +108 -0
  520. package/apps/studio/client/v2/ai/picked-shots.js +48 -0
  521. package/apps/studio/client/v2/ai/quit.css +64 -0
  522. package/apps/studio/client/v2/ai/result-shown.js +50 -0
  523. package/apps/studio/client/v2/ai/ring-relay.js +143 -0
  524. package/apps/studio/client/v2/ai/row-slots-lane.js +67 -0
  525. package/apps/studio/client/v2/ai/run-api.js +137 -0
  526. package/apps/studio/client/v2/ai/run-cards.js +31 -0
  527. package/apps/studio/client/v2/ai/run-compare.js +60 -0
  528. package/apps/studio/client/v2/ai/run-icons.jsx +53 -0
  529. package/apps/studio/client/v2/ai/run-model.js +348 -0
  530. package/apps/studio/client/v2/ai/runs-model.js +568 -0
  531. package/apps/studio/client/v2/ai/runs-store.js +161 -0
  532. package/apps/studio/client/v2/ai/runs.css +226 -0
  533. package/apps/studio/client/v2/ai/scope.js +298 -0
  534. package/apps/studio/client/v2/ai/seen-relay.js +95 -0
  535. package/apps/studio/client/v2/ai/sent-attachments.js +77 -0
  536. package/apps/studio/client/v2/ai/stopped.js +69 -0
  537. package/apps/studio/client/v2/ai/suggest-why.js +200 -0
  538. package/apps/studio/client/v2/ai/use-ai-scope.js +198 -0
  539. package/apps/studio/client/v2/ai/use-ask-ai.js +63 -0
  540. package/apps/studio/client/v2/ai/use-ask-selection.js +41 -0
  541. package/apps/studio/client/v2/ai/use-attachments.js +239 -0
  542. package/apps/studio/client/v2/ai/use-chat-runs.js +32 -0
  543. package/apps/studio/client/v2/ai/use-run-versions.js +39 -0
  544. package/apps/studio/client/v2/ai/video/ClipsAttached.jsx +23 -0
  545. package/apps/studio/client/v2/ai/video/LeftOut.jsx +29 -0
  546. package/apps/studio/client/v2/ai/video/WatchProgress.jsx +65 -0
  547. package/apps/studio/client/v2/ai/video/card-model.js +107 -0
  548. package/apps/studio/client/v2/ai/video/cards.jsx +51 -0
  549. package/apps/studio/client/v2/ai/video/clip-pic.js +12 -0
  550. package/apps/studio/client/v2/ai/video/video-cards.css +168 -0
  551. package/apps/studio/client/v2/annotations/annotation-asks.js +171 -0
  552. package/apps/studio/client/v2/annotations/annotation-list-model.js +238 -0
  553. package/apps/studio/client/v2/annotations/annotation-list.css +277 -0
  554. package/apps/studio/client/v2/annotations/annotation-list.jsx +433 -0
  555. package/apps/studio/client/v2/annotations/recent-stickers.js +64 -0
  556. package/apps/studio/client/v2/annotations/stamp-row.jsx +66 -0
  557. package/apps/studio/client/v2/annotations/stamps-glyphs.jsx +35 -0
  558. package/apps/studio/client/v2/annotations/sticker-preload.js +44 -0
  559. package/apps/studio/client/v2/annotations/sticker-search.js +155 -0
  560. package/apps/studio/client/v2/annotations/stickers-gallery.css +295 -0
  561. package/apps/studio/client/v2/annotations/stickers-gallery.jsx +454 -0
  562. package/apps/studio/client/v2/annotations/templates-panel.css +344 -0
  563. package/apps/studio/client/v2/annotations/templates-panel.jsx +240 -0
  564. package/apps/studio/client/v2/annotations/v2-scope.js +20 -0
  565. package/apps/studio/client/v2/annotations/vote-bar.jsx +212 -0
  566. package/apps/studio/client/v2/annotations/vote-sheet.jsx +200 -0
  567. package/apps/studio/client/v2/annotations/vote-store.js +392 -0
  568. package/apps/studio/client/v2/annotations/vote.css +153 -0
  569. package/apps/studio/client/v2/assets/ask-once.js +65 -0
  570. package/apps/studio/client/v2/assets/asset-drop-session.js +238 -0
  571. package/apps/studio/client/v2/assets/asset-state-lane.js +267 -0
  572. package/apps/studio/client/v2/assets/assets-bus.js +109 -0
  573. package/apps/studio/client/v2/assets/browse-model.js +90 -0
  574. package/apps/studio/client/v2/assets/browse-view.jsx +202 -0
  575. package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +114 -0
  576. package/apps/studio/client/v2/assets/connect-key-sheet.jsx +69 -0
  577. package/apps/studio/client/v2/assets/copy-asset.js +37 -0
  578. package/apps/studio/client/v2/assets/describe-client.js +156 -0
  579. package/apps/studio/client/v2/assets/describe-consent.jsx +184 -0
  580. package/apps/studio/client/v2/assets/describe.css +72 -0
  581. package/apps/studio/client/v2/assets/details-advanced.jsx +76 -0
  582. package/apps/studio/client/v2/assets/details-model.js +233 -0
  583. package/apps/studio/client/v2/assets/details.jsx +292 -0
  584. package/apps/studio/client/v2/assets/generate-ask.jsx +506 -0
  585. package/apps/studio/client/v2/assets/generated.js +83 -0
  586. package/apps/studio/client/v2/assets/import-lines.js +228 -0
  587. package/apps/studio/client/v2/assets/import-offline.js +32 -0
  588. package/apps/studio/client/v2/assets/import-toast.js +56 -0
  589. package/apps/studio/client/v2/assets/just-added.js +32 -0
  590. package/apps/studio/client/v2/assets/kinds-chip.jsx +77 -0
  591. package/apps/studio/client/v2/assets/library-foot.js +42 -0
  592. package/apps/studio/client/v2/assets/missing-frame.css +60 -0
  593. package/apps/studio/client/v2/assets/missing-frame.jsx +218 -0
  594. package/apps/studio/client/v2/assets/multi-select.js +58 -0
  595. package/apps/studio/client/v2/assets/place-asset.js +128 -0
  596. package/apps/studio/client/v2/assets/relink.js +96 -0
  597. package/apps/studio/client/v2/assets/rename-asset.js +83 -0
  598. package/apps/studio/client/v2/assets/search-marks.jsx +75 -0
  599. package/apps/studio/client/v2/assets/takes-overlay.jsx +86 -0
  600. package/apps/studio/client/v2/assets/takes.css +177 -0
  601. package/apps/studio/client/v2/assets/takes.js +224 -0
  602. package/apps/studio/client/v2/assets/tidy.jsx +144 -0
  603. package/apps/studio/client/v2/assets/tile-drag.js +53 -0
  604. package/apps/studio/client/v2/assets/tile-menu.jsx +119 -0
  605. package/apps/studio/client/v2/assets/tile.jsx +131 -0
  606. package/apps/studio/client/v2/assets/trash-assets.js +98 -0
  607. package/apps/studio/client/v2/assets/use-asset-details.js +58 -0
  608. package/apps/studio/client/v2/assets/use-assets.js +121 -0
  609. package/apps/studio/client/v2/assets/use-takes-lane.js +150 -0
  610. package/apps/studio/client/v2/canvases/canvas-icons.jsx +107 -0
  611. package/apps/studio/client/v2/canvases/canvases-panel.jsx +1466 -0
  612. package/apps/studio/client/v2/canvases/canvases.css +699 -0
  613. package/apps/studio/client/v2/canvases/covers.js +32 -0
  614. package/apps/studio/client/v2/canvases/inline-rename.jsx +122 -0
  615. package/apps/studio/client/v2/canvases/jump-list.jsx +100 -0
  616. package/apps/studio/client/v2/canvases/jump-model.js +102 -0
  617. package/apps/studio/client/v2/canvases/kept-on-this-mac.jsx +192 -0
  618. package/apps/studio/client/v2/canvases/last-canvas.js +36 -0
  619. package/apps/studio/client/v2/canvases/move-model.js +45 -0
  620. package/apps/studio/client/v2/canvases/move-sheet.jsx +91 -0
  621. package/apps/studio/client/v2/canvases/open-link.js +154 -0
  622. package/apps/studio/client/v2/canvases/panel-search.js +156 -0
  623. package/apps/studio/client/v2/canvases/rename-model.js +134 -0
  624. package/apps/studio/client/v2/canvases/row-menu.jsx +145 -0
  625. package/apps/studio/client/v2/canvases/row-slots.js +224 -0
  626. package/apps/studio/client/v2/canvases/sort.js +132 -0
  627. package/apps/studio/client/v2/canvases/support-model.js +68 -0
  628. package/apps/studio/client/v2/canvases/trash-canvas.js +120 -0
  629. package/apps/studio/client/v2/canvases/tree-model.js +760 -0
  630. package/apps/studio/client/v2/canvases/use-canvas-index.js +50 -0
  631. package/apps/studio/client/v2/canvases/use-canvases-sort.js +59 -0
  632. package/apps/studio/client/v2/canvases/use-move.js +61 -0
  633. package/apps/studio/client/v2/canvases/use-pins.js +80 -0
  634. package/apps/studio/client/v2/cloud/browser-door.js +152 -0
  635. package/apps/studio/client/v2/cloud/cloud-name.js +38 -0
  636. package/apps/studio/client/v2/code/canvas-error-card.jsx +407 -0
  637. package/apps/studio/client/v2/code/canvas-imports-card.jsx +31 -0
  638. package/apps/studio/client/v2/code/code-bus.js +63 -0
  639. package/apps/studio/client/v2/code/code-view.jsx +277 -0
  640. package/apps/studio/client/v2/code/code.css +373 -0
  641. package/apps/studio/client/v2/code/highlight.js +163 -0
  642. package/apps/studio/client/v2/code/use-canvas-source.js +338 -0
  643. package/apps/studio/client/v2/comments/comment-bridge.js +154 -0
  644. package/apps/studio/client/v2/comments/comment-client.js +84 -0
  645. package/apps/studio/client/v2/comments/comment-tool.js +18 -0
  646. package/apps/studio/client/v2/comments/comments-model.js +213 -0
  647. package/apps/studio/client/v2/comments/comments-panel.jsx +400 -0
  648. package/apps/studio/client/v2/comments/comments.css +305 -0
  649. package/apps/studio/client/v2/comments/mention-callouts.jsx +90 -0
  650. package/apps/studio/client/v2/comments/mention-model.js +118 -0
  651. package/apps/studio/client/v2/comments/native-mention-notice.js +73 -0
  652. package/apps/studio/client/v2/comments/reply-focus.js +30 -0
  653. package/apps/studio/client/v2/comments/use-comments-shell.jsx +176 -0
  654. package/apps/studio/client/v2/create/NameDialog.jsx +95 -0
  655. package/apps/studio/client/v2/create/NameDialogHost.jsx +141 -0
  656. package/apps/studio/client/v2/create/create-project.css +260 -0
  657. package/apps/studio/client/v2/create/duplicate-done.js +45 -0
  658. package/apps/studio/client/v2/create/empty-project.css +113 -0
  659. package/apps/studio/client/v2/create/empty-project.jsx +162 -0
  660. package/apps/studio/client/v2/create/first-draft.js +30 -0
  661. package/apps/studio/client/v2/create/intent-host.jsx +40 -0
  662. package/apps/studio/client/v2/create/name-dialog-bus.js +41 -0
  663. package/apps/studio/client/v2/create/name-dialog.css +36 -0
  664. package/apps/studio/client/v2/create/new-canvas.js +64 -0
  665. package/apps/studio/client/v2/create/open-sizes.js +41 -0
  666. package/apps/studio/client/v2/create/render-error.css +29 -0
  667. package/apps/studio/client/v2/create/render-error.jsx +107 -0
  668. package/apps/studio/client/v2/create/repair-offer.js +36 -0
  669. package/apps/studio/client/v2/create/take-intent.js +154 -0
  670. package/apps/studio/client/v2/create/use-project-empty.js +85 -0
  671. package/apps/studio/client/v2/create/use-render-error.js +116 -0
  672. package/apps/studio/client/v2/diagnostics/diagnostics-bus.js +47 -0
  673. package/apps/studio/client/v2/diagnostics/diagnostics-handlers.js +108 -0
  674. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +196 -0
  675. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +253 -0
  676. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +557 -0
  677. package/apps/studio/client/v2/diagnostics/diagnostics.css +612 -0
  678. package/apps/studio/client/v2/diagnostics/resync-model.js +51 -0
  679. package/apps/studio/client/v2/diagnostics/resync-run.js +79 -0
  680. package/apps/studio/client/v2/diagnostics/sync-actions.js +38 -0
  681. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +241 -0
  682. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +392 -0
  683. package/apps/studio/client/v2/diagnostics/use-diagnostics-menu.js +58 -0
  684. package/apps/studio/client/v2/ds/advanced-bus.js +40 -0
  685. package/apps/studio/client/v2/ds/advanced-host.jsx +228 -0
  686. package/apps/studio/client/v2/ds/advanced-model.js +110 -0
  687. package/apps/studio/client/v2/ds/advanced-store.js +47 -0
  688. package/apps/studio/client/v2/ds/advanced.css +277 -0
  689. package/apps/studio/client/v2/ds/advanced.jsx +203 -0
  690. package/apps/studio/client/v2/ds/check-card.jsx +80 -0
  691. package/apps/studio/client/v2/ds/colour-picker.jsx +121 -0
  692. package/apps/studio/client/v2/ds/colour-words.js +48 -0
  693. package/apps/studio/client/v2/ds/conflict-pick.jsx +151 -0
  694. package/apps/studio/client/v2/ds/contrast-warning.jsx +80 -0
  695. package/apps/studio/client/v2/ds/contrast.js +137 -0
  696. package/apps/studio/client/v2/ds/convert-dialog.jsx +133 -0
  697. package/apps/studio/client/v2/ds/convert-host.jsx +143 -0
  698. package/apps/studio/client/v2/ds/convert-model.js +221 -0
  699. package/apps/studio/client/v2/ds/default-write.js +69 -0
  700. package/apps/studio/client/v2/ds/direction-bar.jsx +287 -0
  701. package/apps/studio/client/v2/ds/door-write.js +163 -0
  702. package/apps/studio/client/v2/ds/edge-model.js +151 -0
  703. package/apps/studio/client/v2/ds/edge-write.js +91 -0
  704. package/apps/studio/client/v2/ds/edges.css +152 -0
  705. package/apps/studio/client/v2/ds/follower-swap.js +88 -0
  706. package/apps/studio/client/v2/ds/go-to.js +71 -0
  707. package/apps/studio/client/v2/ds/kinds/master.jsx +214 -0
  708. package/apps/studio/client/v2/ds/kinds/token.jsx +546 -0
  709. package/apps/studio/client/v2/ds/library-bus.js +43 -0
  710. package/apps/studio/client/v2/ds/library-card.jsx +379 -0
  711. package/apps/studio/client/v2/ds/library-host.jsx +436 -0
  712. package/apps/studio/client/v2/ds/library-model.js +305 -0
  713. package/apps/studio/client/v2/ds/library-store.js +45 -0
  714. package/apps/studio/client/v2/ds/library.css +148 -0
  715. package/apps/studio/client/v2/ds/make-host.jsx +244 -0
  716. package/apps/studio/client/v2/ds/make-model.js +208 -0
  717. package/apps/studio/client/v2/ds/make-sheet.jsx +264 -0
  718. package/apps/studio/client/v2/ds/make-write.js +90 -0
  719. package/apps/studio/client/v2/ds/make.css +242 -0
  720. package/apps/studio/client/v2/ds/master-write.js +145 -0
  721. package/apps/studio/client/v2/ds/new-canvas-default.js +89 -0
  722. package/apps/studio/client/v2/ds/off-system-host.jsx +107 -0
  723. package/apps/studio/client/v2/ds/off-system.jsx +101 -0
  724. package/apps/studio/client/v2/ds/outside-banner.jsx +153 -0
  725. package/apps/studio/client/v2/ds/pinned-rows.js +138 -0
  726. package/apps/studio/client/v2/ds/pins.js +102 -0
  727. package/apps/studio/client/v2/ds/preview-bar.jsx +220 -0
  728. package/apps/studio/client/v2/ds/preview-doors.js +47 -0
  729. package/apps/studio/client/v2/ds/preview-mode.js +163 -0
  730. package/apps/studio/client/v2/ds/reach-data.js +68 -0
  731. package/apps/studio/client/v2/ds/reach-model.js +184 -0
  732. package/apps/studio/client/v2/ds/reach-view.jsx +577 -0
  733. package/apps/studio/client/v2/ds/reach.css +298 -0
  734. package/apps/studio/client/v2/ds/rename-write.js +88 -0
  735. package/apps/studio/client/v2/ds/review-bus.js +41 -0
  736. package/apps/studio/client/v2/ds/review-host.jsx +438 -0
  737. package/apps/studio/client/v2/ds/review-model.js +307 -0
  738. package/apps/studio/client/v2/ds/review-sheet.jsx +390 -0
  739. package/apps/studio/client/v2/ds/review.css +894 -0
  740. package/apps/studio/client/v2/ds/row-dots.js +41 -0
  741. package/apps/studio/client/v2/ds/switch-bus.js +56 -0
  742. package/apps/studio/client/v2/ds/switch-host.jsx +241 -0
  743. package/apps/studio/client/v2/ds/switch-model.js +254 -0
  744. package/apps/studio/client/v2/ds/switch-sheet.jsx +364 -0
  745. package/apps/studio/client/v2/ds/switch.css +263 -0
  746. package/apps/studio/client/v2/ds/system-menu.jsx +81 -0
  747. package/apps/studio/client/v2/ds/system-rename.jsx +102 -0
  748. package/apps/studio/client/v2/ds/token-write.js +241 -0
  749. package/apps/studio/client/v2/ds/token.css +185 -0
  750. package/apps/studio/client/v2/ds/trash-token-sheet.jsx +112 -0
  751. package/apps/studio/client/v2/ds/truth-card.jsx +85 -0
  752. package/apps/studio/client/v2/ds/truth-host.jsx +239 -0
  753. package/apps/studio/client/v2/ds/truth-model.js +315 -0
  754. package/apps/studio/client/v2/ds/truth-store.js +45 -0
  755. package/apps/studio/client/v2/ds/truth.css +143 -0
  756. package/apps/studio/client/v2/ds/update-available.jsx +261 -0
  757. package/apps/studio/client/v2/ds/update-dots.js +103 -0
  758. package/apps/studio/client/v2/ds/update-model.js +295 -0
  759. package/apps/studio/client/v2/ds/upgrade-bus.js +40 -0
  760. package/apps/studio/client/v2/ds/upgrade-host.jsx +185 -0
  761. package/apps/studio/client/v2/ds/upgrade-model.js +266 -0
  762. package/apps/studio/client/v2/ds/upgrade-offers.js +34 -0
  763. package/apps/studio/client/v2/ds/upgrade-sheet.jsx +277 -0
  764. package/apps/studio/client/v2/ds/upgrade.css +166 -0
  765. package/apps/studio/client/v2/ds/use-covers.js +27 -0
  766. package/apps/studio/client/v2/ds/use-ds-frames.js +165 -0
  767. package/apps/studio/client/v2/ds/use-ds-model.js +61 -0
  768. package/apps/studio/client/v2/ds/use-ds-search.js +61 -0
  769. package/apps/studio/client/v2/ds/use-ds-state.js +65 -0
  770. package/apps/studio/client/v2/ds/uses-link.jsx +58 -0
  771. package/apps/studio/client/v2/empty/all-trashed-model.js +321 -0
  772. package/apps/studio/client/v2/empty/all-trashed-relay.js +65 -0
  773. package/apps/studio/client/v2/empty/all-trashed.jsx +229 -0
  774. package/apps/studio/client/v2/empty/arriving.jsx +180 -0
  775. package/apps/studio/client/v2/empty/artboard-hint.jsx +47 -0
  776. package/apps/studio/client/v2/empty/ask-button.jsx +35 -0
  777. package/apps/studio/client/v2/empty/confetti.jsx +46 -0
  778. package/apps/studio/client/v2/empty/empty-canvas.jsx +96 -0
  779. package/apps/studio/client/v2/empty/empty-copy.js +265 -0
  780. package/apps/studio/client/v2/empty/empty-hint-store.js +31 -0
  781. package/apps/studio/client/v2/empty/empty-host.jsx +168 -0
  782. package/apps/studio/client/v2/empty/empty.css +440 -0
  783. package/apps/studio/client/v2/empty/empty.jsx +162 -0
  784. package/apps/studio/client/v2/empty/fill-ask.js +22 -0
  785. package/apps/studio/client/v2/empty/free-centre.js +11 -0
  786. package/apps/studio/client/v2/empty/index.js +40 -0
  787. package/apps/studio/client/v2/empty/layers-empty.jsx +22 -0
  788. package/apps/studio/client/v2/empty/not-local.jsx +111 -0
  789. package/apps/studio/client/v2/empty/select-new-artboard.js +32 -0
  790. package/apps/studio/client/v2/empty/skeleton.jsx +51 -0
  791. package/apps/studio/client/v2/empty/spot-art.jsx +923 -0
  792. package/apps/studio/client/v2/empty/spot.jsx +96 -0
  793. package/apps/studio/client/v2/empty/suggestions.jsx +18 -0
  794. package/apps/studio/client/v2/empty/use-empty-canvas.js +251 -0
  795. package/apps/studio/client/v2/export/access-line.jsx +48 -0
  796. package/apps/studio/client/v2/export/advanced/advanced-copy.js +77 -0
  797. package/apps/studio/client/v2/export/advanced/advanced.css +252 -0
  798. package/apps/studio/client/v2/export/advanced/advanced.jsx +148 -0
  799. package/apps/studio/client/v2/export/advanced/command.js +128 -0
  800. package/apps/studio/client/v2/export/advanced/command.jsx +50 -0
  801. package/apps/studio/client/v2/export/advanced/fields.jsx +132 -0
  802. package/apps/studio/client/v2/export/advanced/image.jsx +124 -0
  803. package/apps/studio/client/v2/export/advanced/model.js +199 -0
  804. package/apps/studio/client/v2/export/advanced/names.jsx +65 -0
  805. package/apps/studio/client/v2/export/advanced/print.jsx +99 -0
  806. package/apps/studio/client/v2/export/advanced/render.jsx +63 -0
  807. package/apps/studio/client/v2/export/advanced/video.jsx +76 -0
  808. package/apps/studio/client/v2/export/annotations-policy.js +28 -0
  809. package/apps/studio/client/v2/export/cloud-queue.js +69 -0
  810. package/apps/studio/client/v2/export/copy-command.js +72 -0
  811. package/apps/studio/client/v2/export/copy-png.js +144 -0
  812. package/apps/studio/client/v2/export/done-toast.jsx +89 -0
  813. package/apps/studio/client/v2/export/edges.css +74 -0
  814. package/apps/studio/client/v2/export/export-copy.js +352 -0
  815. package/apps/studio/client/v2/export/export-sheet.jsx +804 -0
  816. package/apps/studio/client/v2/export/export-sizes.js +217 -0
  817. package/apps/studio/client/v2/export/export.css +832 -0
  818. package/apps/studio/client/v2/export/exports-model.js +383 -0
  819. package/apps/studio/client/v2/export/exports-panel.css +192 -0
  820. package/apps/studio/client/v2/export/exports-panel.jsx +164 -0
  821. package/apps/studio/client/v2/export/file-rows.jsx +84 -0
  822. package/apps/studio/client/v2/export/inspector-export.jsx +335 -0
  823. package/apps/studio/client/v2/export/job-row.jsx +358 -0
  824. package/apps/studio/client/v2/export/last-finished.js +34 -0
  825. package/apps/studio/client/v2/export/native-save.js +160 -0
  826. package/apps/studio/client/v2/export/other-formats.jsx +199 -0
  827. package/apps/studio/client/v2/export/parts.jsx +117 -0
  828. package/apps/studio/client/v2/export/preflight/fonts.js +27 -0
  829. package/apps/studio/client/v2/export/preflight/paper.jsx +177 -0
  830. package/apps/studio/client/v2/export/preflight/safe-margin.js +24 -0
  831. package/apps/studio/client/v2/export/preflight/use-preflight.js +74 -0
  832. package/apps/studio/client/v2/export/preview.jsx +79 -0
  833. package/apps/studio/client/v2/export/print.css +219 -0
  834. package/apps/studio/client/v2/export/run-export.js +177 -0
  835. package/apps/studio/client/v2/export/scope-bar.jsx +70 -0
  836. package/apps/studio/client/v2/export/sections/batch-model.js +224 -0
  837. package/apps/studio/client/v2/export/sections/batch.jsx +235 -0
  838. package/apps/studio/client/v2/export/sections/image.jsx +93 -0
  839. package/apps/studio/client/v2/export/sections/print-copy.js +41 -0
  840. package/apps/studio/client/v2/export/sections/print.jsx +285 -0
  841. package/apps/studio/client/v2/export/sections/render-row.jsx +81 -0
  842. package/apps/studio/client/v2/export/sections/version.jsx +176 -0
  843. package/apps/studio/client/v2/export/sections/video-copy.js +92 -0
  844. package/apps/studio/client/v2/export/sections/video-model.js +127 -0
  845. package/apps/studio/client/v2/export/sections/video.jsx +397 -0
  846. package/apps/studio/client/v2/export/sections/web.jsx +151 -0
  847. package/apps/studio/client/v2/export/share-hint.jsx +51 -0
  848. package/apps/studio/client/v2/export/use-export-spec.js +546 -0
  849. package/apps/studio/client/v2/export/video-content.js +75 -0
  850. package/apps/studio/client/v2/export/video.css +221 -0
  851. package/apps/studio/client/v2/fold/advanced-fold.jsx +96 -0
  852. package/apps/studio/client/v2/fold/fold-store.js +151 -0
  853. package/apps/studio/client/v2/fold/fold.css +59 -0
  854. package/apps/studio/client/v2/fold/use-fold.js +36 -0
  855. package/apps/studio/client/v2/handoff/edges.jsx +74 -0
  856. package/apps/studio/client/v2/handoff/handoff-sheet.jsx +469 -0
  857. package/apps/studio/client/v2/handoff/handoff.css +181 -0
  858. package/apps/studio/client/v2/handoff/ready-card.jsx +84 -0
  859. package/apps/studio/client/v2/handoff/targets.js +111 -0
  860. package/apps/studio/client/v2/help/add-guides.js +43 -0
  861. package/apps/studio/client/v2/help/help.css +995 -0
  862. package/apps/studio/client/v2/history/blame.js +161 -0
  863. package/apps/studio/client/v2/history/branch-actions.js +214 -0
  864. package/apps/studio/client/v2/history/change-list.jsx +102 -0
  865. package/apps/studio/client/v2/history/clear-band.js +144 -0
  866. package/apps/studio/client/v2/history/compare-store.js +80 -0
  867. package/apps/studio/client/v2/history/compare-view.jsx +318 -0
  868. package/apps/studio/client/v2/history/compare-words.js +8 -0
  869. package/apps/studio/client/v2/history/git-advanced.jsx +580 -0
  870. package/apps/studio/client/v2/history/git-io.js +58 -0
  871. package/apps/studio/client/v2/history/git-model.js +526 -0
  872. package/apps/studio/client/v2/history/git-parts.jsx +662 -0
  873. package/apps/studio/client/v2/history/history-host.jsx +78 -0
  874. package/apps/studio/client/v2/history/history-panel.jsx +599 -0
  875. package/apps/studio/client/v2/history/history.css +1477 -0
  876. package/apps/studio/client/v2/history/name-dialog.jsx +109 -0
  877. package/apps/studio/client/v2/history/object-filter.js +143 -0
  878. package/apps/studio/client/v2/history/object-history-ask.js +62 -0
  879. package/apps/studio/client/v2/history/object-view.jsx +236 -0
  880. package/apps/studio/client/v2/history/rows.ts +445 -0
  881. package/apps/studio/client/v2/history/use-versions.js +391 -0
  882. package/apps/studio/client/v2/history/view-bar.jsx +80 -0
  883. package/apps/studio/client/v2/import/brand-model.js +145 -0
  884. package/apps/studio/client/v2/import/brand-result.jsx +197 -0
  885. package/apps/studio/client/v2/import/brand-sheet.jsx +434 -0
  886. package/apps/studio/client/v2/import/brand.css +378 -0
  887. package/apps/studio/client/v2/import/figma-artboard.jsx +121 -0
  888. package/apps/studio/client/v2/import/figma-model.js +237 -0
  889. package/apps/studio/client/v2/import/figma-prefill.js +23 -0
  890. package/apps/studio/client/v2/import/figma-sheet.jsx +525 -0
  891. package/apps/studio/client/v2/import/figma-summary.jsx +62 -0
  892. package/apps/studio/client/v2/import/figma.css +179 -0
  893. package/apps/studio/client/v2/import/frame-picker.jsx +57 -0
  894. package/apps/studio/client/v2/inspect/inspect-host.jsx +53 -0
  895. package/apps/studio/client/v2/inspect/inspect-model.js +132 -0
  896. package/apps/studio/client/v2/inspect/inspect-panel.jsx +214 -0
  897. package/apps/studio/client/v2/inspect/inspect.css +87 -0
  898. package/apps/studio/client/v2/inspector/advanced-rows-default.jsx +773 -0
  899. package/apps/studio/client/v2/inspector/advanced-rows.js +106 -0
  900. package/apps/studio/client/v2/inspector/advanced.jsx +286 -0
  901. package/apps/studio/client/v2/inspector/blocks.js +57 -0
  902. package/apps/studio/client/v2/inspector/colour-groups.js +129 -0
  903. package/apps/studio/client/v2/inspector/component-picker.css +133 -0
  904. package/apps/studio/client/v2/inspector/component-picker.jsx +367 -0
  905. package/apps/studio/client/v2/inspector/crumbs.jsx +89 -0
  906. package/apps/studio/client/v2/inspector/css-text.js +179 -0
  907. package/apps/studio/client/v2/inspector/css-write.js +204 -0
  908. package/apps/studio/client/v2/inspector/element-code.js +39 -0
  909. package/apps/studio/client/v2/inspector/element-id.js +70 -0
  910. package/apps/studio/client/v2/inspector/formats-ui.js +101 -0
  911. package/apps/studio/client/v2/inspector/formats-write.js +60 -0
  912. package/apps/studio/client/v2/inspector/frame.jsx +336 -0
  913. package/apps/studio/client/v2/inspector/inspector-actions.js +60 -0
  914. package/apps/studio/client/v2/inspector/inspector.css +2872 -0
  915. package/apps/studio/client/v2/inspector/jsx-slice.js +219 -0
  916. package/apps/studio/client/v2/inspector/kinds/add-width.js +55 -0
  917. package/apps/studio/client/v2/inspector/kinds/artboard-advanced-rows.jsx +89 -0
  918. package/apps/studio/client/v2/inspector/kinds/artboard-advanced.jsx +62 -0
  919. package/apps/studio/client/v2/inspector/kinds/artboard-fixed.jsx +111 -0
  920. package/apps/studio/client/v2/inspector/kinds/artboard-kinds-model.js +171 -0
  921. package/apps/studio/client/v2/inspector/kinds/artboard-model.js +155 -0
  922. package/apps/studio/client/v2/inspector/kinds/artboard-multi.jsx +142 -0
  923. package/apps/studio/client/v2/inspector/kinds/artboard-print-advanced.jsx +210 -0
  924. package/apps/studio/client/v2/inspector/kinds/artboard-print-model.js +112 -0
  925. package/apps/studio/client/v2/inspector/kinds/artboard-print.jsx +268 -0
  926. package/apps/studio/client/v2/inspector/kinds/artboard-rows.jsx +124 -0
  927. package/apps/studio/client/v2/inspector/kinds/artboard-video.jsx +144 -0
  928. package/apps/studio/client/v2/inspector/kinds/artboard-web.jsx +170 -0
  929. package/apps/studio/client/v2/inspector/kinds/artboard.jsx +168 -0
  930. package/apps/studio/client/v2/inspector/kinds/caption.jsx +203 -0
  931. package/apps/studio/client/v2/inspector/kinds/clip-model.js +190 -0
  932. package/apps/studio/client/v2/inspector/kinds/clip.css +157 -0
  933. package/apps/studio/client/v2/inspector/kinds/clip.jsx +447 -0
  934. package/apps/studio/client/v2/inspector/kinds/frame.jsx +118 -0
  935. package/apps/studio/client/v2/inspector/kinds/image.jsx +267 -0
  936. package/apps/studio/client/v2/inspector/kinds/index.js +180 -0
  937. package/apps/studio/client/v2/inspector/kinds/instance.jsx +377 -0
  938. package/apps/studio/client/v2/inspector/kinds/multi-artboard.jsx +129 -0
  939. package/apps/studio/client/v2/inspector/kinds/multi.jsx +220 -0
  940. package/apps/studio/client/v2/inspector/kinds/music.jsx +294 -0
  941. package/apps/studio/client/v2/inspector/kinds/path.jsx +174 -0
  942. package/apps/studio/client/v2/inspector/kinds/shape.jsx +59 -0
  943. package/apps/studio/client/v2/inspector/kinds/text.jsx +518 -0
  944. package/apps/studio/client/v2/inspector/kinds/title-rows.jsx +135 -0
  945. package/apps/studio/client/v2/inspector/kinds/video-facts.js +142 -0
  946. package/apps/studio/client/v2/inspector/layers-row-tools.jsx +93 -0
  947. package/apps/studio/client/v2/inspector/layers-slot.jsx +93 -0
  948. package/apps/studio/client/v2/inspector/link-write.js +52 -0
  949. package/apps/studio/client/v2/inspector/live-size.js +96 -0
  950. package/apps/studio/client/v2/inspector/model.js +228 -0
  951. package/apps/studio/client/v2/inspector/path-point.js +104 -0
  952. package/apps/studio/client/v2/inspector/print-write.js +85 -0
  953. package/apps/studio/client/v2/inspector/safe-zones-write.js +88 -0
  954. package/apps/studio/client/v2/inspector/sections/add-requests.js +35 -0
  955. package/apps/studio/client/v2/inspector/sections/border.jsx +141 -0
  956. package/apps/studio/client/v2/inspector/sections/color-control.jsx +246 -0
  957. package/apps/studio/client/v2/inspector/sections/colour-custom.jsx +826 -0
  958. package/apps/studio/client/v2/inspector/sections/colour-model.js +404 -0
  959. package/apps/studio/client/v2/inspector/sections/colour-popover.jsx +631 -0
  960. package/apps/studio/client/v2/inspector/sections/colour-words.js +131 -0
  961. package/apps/studio/client/v2/inspector/sections/corners.jsx +177 -0
  962. package/apps/studio/client/v2/inspector/sections/effects.jsx +67 -0
  963. package/apps/studio/client/v2/inspector/sections/export-slot.jsx +60 -0
  964. package/apps/studio/client/v2/inspector/sections/fill.jsx +187 -0
  965. package/apps/studio/client/v2/inspector/sections/formats.jsx +209 -0
  966. package/apps/studio/client/v2/inspector/sections/index.js +74 -0
  967. package/apps/studio/client/v2/inspector/sections/interaction.jsx +204 -0
  968. package/apps/studio/client/v2/inspector/sections/layout.jsx +314 -0
  969. package/apps/studio/client/v2/inspector/sections/opacity-row.jsx +37 -0
  970. package/apps/studio/client/v2/inspector/sections/point.jsx +102 -0
  971. package/apps/studio/client/v2/inspector/sections/position.jsx +259 -0
  972. package/apps/studio/client/v2/inspector/sections/recent-colours.js +106 -0
  973. package/apps/studio/client/v2/inspector/sections/row.jsx +91 -0
  974. package/apps/studio/client/v2/inspector/sections/safe-zones.jsx +174 -0
  975. package/apps/studio/client/v2/inspector/sections/sections.css +1474 -0
  976. package/apps/studio/client/v2/inspector/sections/size.jsx +104 -0
  977. package/apps/studio/client/v2/inspector/sections/type.jsx +168 -0
  978. package/apps/studio/client/v2/inspector/sections/warnings.css +44 -0
  979. package/apps/studio/client/v2/inspector/sections/warnings.jsx +137 -0
  980. package/apps/studio/client/v2/inspector/sections.js +226 -0
  981. package/apps/studio/client/v2/inspector/slots.js +110 -0
  982. package/apps/studio/client/v2/inspector/token-chip.jsx +315 -0
  983. package/apps/studio/client/v2/inspector/view-mode.jsx +193 -0
  984. package/apps/studio/client/v2/inspector/warning-fix.js +111 -0
  985. package/apps/studio/client/v2/kinds/ConvertDialog.jsx +183 -0
  986. package/apps/studio/client/v2/kinds/KindChips.jsx +60 -0
  987. package/apps/studio/client/v2/kinds/KindDimHost.jsx +35 -0
  988. package/apps/studio/client/v2/kinds/LayersKindFilter.jsx +108 -0
  989. package/apps/studio/client/v2/kinds/SizePicker.jsx +566 -0
  990. package/apps/studio/client/v2/kinds/SizePickerHost.jsx +104 -0
  991. package/apps/studio/client/v2/kinds/advanced-rows.js +40 -0
  992. package/apps/studio/client/v2/kinds/convert-api.js +116 -0
  993. package/apps/studio/client/v2/kinds/convert.css +87 -0
  994. package/apps/studio/client/v2/kinds/kind-dim-relay.js +93 -0
  995. package/apps/studio/client/v2/kinds/kind-filter-model.js +106 -0
  996. package/apps/studio/client/v2/kinds/kind-filter-store.js +71 -0
  997. package/apps/studio/client/v2/kinds/kind-filter.css +105 -0
  998. package/apps/studio/client/v2/kinds/layers-kind-model.js +99 -0
  999. package/apps/studio/client/v2/kinds/size-picker-model.js +189 -0
  1000. package/apps/studio/client/v2/kinds/size-picker.css +393 -0
  1001. package/apps/studio/client/v2/layers/artboard-layers.jsx +105 -0
  1002. package/apps/studio/client/v2/layers/layers.css +94 -0
  1003. package/apps/studio/client/v2/left-panel/advanced-model.js +98 -0
  1004. package/apps/studio/client/v2/left-panel/assets-panel.jsx +1203 -0
  1005. package/apps/studio/client/v2/left-panel/canvas-file-menu.js +115 -0
  1006. package/apps/studio/client/v2/left-panel/canvases-advanced.jsx +270 -0
  1007. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +274 -0
  1008. package/apps/studio/client/v2/left-panel/layers-advanced.jsx +179 -0
  1009. package/apps/studio/client/v2/left-panel/left-panel-bus.js +83 -0
  1010. package/apps/studio/client/v2/left-panel/left-panel-model.js +184 -0
  1011. package/apps/studio/client/v2/left-panel/left-panel.css +1846 -0
  1012. package/apps/studio/client/v2/left-panel/selector-scope.js +42 -0
  1013. package/apps/studio/client/v2/left-panel/trash-model.js +282 -0
  1014. package/apps/studio/client/v2/left-panel/trash-view.jsx +257 -0
  1015. package/apps/studio/client/v2/left-panel/use-trash.js +172 -0
  1016. package/apps/studio/client/v2/left-panel/view-prefs.js +84 -0
  1017. package/apps/studio/client/v2/onboarding/AdvSheet.jsx +114 -0
  1018. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +239 -0
  1019. package/apps/studio/client/v2/onboarding/CliSheet.jsx +101 -0
  1020. package/apps/studio/client/v2/onboarding/ConnectAiSheet.jsx +60 -0
  1021. package/apps/studio/client/v2/onboarding/FigmaSheet.jsx +96 -0
  1022. package/apps/studio/client/v2/onboarding/FolderGithubSheet.jsx +77 -0
  1023. package/apps/studio/client/v2/onboarding/GithubSegment.jsx +241 -0
  1024. package/apps/studio/client/v2/onboarding/HubSheet.jsx +244 -0
  1025. package/apps/studio/client/v2/onboarding/connect-ai-home.js +94 -0
  1026. package/apps/studio/client/v2/onboarding/github-home.js +84 -0
  1027. package/apps/studio/client/v2/onboarding/onboarding-model.js +106 -0
  1028. package/apps/studio/client/v2/onboarding/onboarding.css +546 -0
  1029. package/apps/studio/client/v2/photo/apply-every-use-sheet.jsx +196 -0
  1030. package/apps/studio/client/v2/photo/canvas-rel.js +20 -0
  1031. package/apps/studio/client/v2/photo/looks.js +129 -0
  1032. package/apps/studio/client/v2/photo/photo-section.jsx +625 -0
  1033. package/apps/studio/client/v2/photo/photo.css +218 -0
  1034. package/apps/studio/client/v2/portal-scope.jsx +14 -0
  1035. package/apps/studio/client/v2/presence/faces.jsx +356 -0
  1036. package/apps/studio/client/v2/presence/presence.css +187 -0
  1037. package/apps/studio/client/v2/presence/use-presence-host.js +83 -0
  1038. package/apps/studio/client/v2/present/audience-window.js +63 -0
  1039. package/apps/studio/client/v2/present/canvas-pill.jsx +55 -0
  1040. package/apps/studio/client/v2/present/copy-link.js +82 -0
  1041. package/apps/studio/client/v2/present/follow-location.js +82 -0
  1042. package/apps/studio/client/v2/present/follow-model.js +68 -0
  1043. package/apps/studio/client/v2/present/follow-view.jsx +354 -0
  1044. package/apps/studio/client/v2/present/follow.css +91 -0
  1045. package/apps/studio/client/v2/present/order-map.jsx +64 -0
  1046. package/apps/studio/client/v2/present/order-notes-artboards.js +88 -0
  1047. package/apps/studio/client/v2/present/order-notes-model.js +141 -0
  1048. package/apps/studio/client/v2/present/order-notes-mount.jsx +26 -0
  1049. package/apps/studio/client/v2/present/order-notes-sheet.jsx +293 -0
  1050. package/apps/studio/client/v2/present/order-notes.css +150 -0
  1051. package/apps/studio/client/v2/present/present-chrome-host.jsx +95 -0
  1052. package/apps/studio/client/v2/present/present-controls-model.js +114 -0
  1053. package/apps/studio/client/v2/present/present-controls.jsx +263 -0
  1054. package/apps/studio/client/v2/present/present-zoom-store.js +33 -0
  1055. package/apps/studio/client/v2/present/present.css +258 -0
  1056. package/apps/studio/client/v2/present/presenter-button.jsx +25 -0
  1057. package/apps/studio/client/v2/present/presenter-host.jsx +246 -0
  1058. package/apps/studio/client/v2/present/presenter-model.js +167 -0
  1059. package/apps/studio/client/v2/present/presenter-store.js +140 -0
  1060. package/apps/studio/client/v2/present/presenter-view.css +298 -0
  1061. package/apps/studio/client/v2/present/presenter-view.jsx +241 -0
  1062. package/apps/studio/client/v2/present/video-present-model.js +92 -0
  1063. package/apps/studio/client/v2/present/video-present.css +164 -0
  1064. package/apps/studio/client/v2/present/video-present.jsx +331 -0
  1065. package/apps/studio/client/v2/preview/external-link-confirm.jsx +245 -0
  1066. package/apps/studio/client/v2/preview/link-follow.js +109 -0
  1067. package/apps/studio/client/v2/preview/open-in-app.jsx +46 -0
  1068. package/apps/studio/client/v2/preview/preview-back.js +21 -0
  1069. package/apps/studio/client/v2/preview/preview-bar.jsx +86 -0
  1070. package/apps/studio/client/v2/preview/preview-chrome-host.jsx +234 -0
  1071. package/apps/studio/client/v2/preview/preview-history.js +61 -0
  1072. package/apps/studio/client/v2/preview/preview.css +262 -0
  1073. package/apps/studio/client/v2/preview/zoom-only.jsx +58 -0
  1074. package/apps/studio/client/v2/search/help-model.js +275 -0
  1075. package/apps/studio/client/v2/search/moved-keys.js +74 -0
  1076. package/apps/studio/client/v2/search/palette-icons.js +45 -0
  1077. package/apps/studio/client/v2/search/search-ds.js +142 -0
  1078. package/apps/studio/client/v2/search/search-env.js +110 -0
  1079. package/apps/studio/client/v2/search/search-keywords.js +162 -0
  1080. package/apps/studio/client/v2/search/search-model.js +623 -0
  1081. package/apps/studio/client/v2/search/search-projects.js +214 -0
  1082. package/apps/studio/client/v2/search/search-recent.js +94 -0
  1083. package/apps/studio/client/v2/search/search-remote.js +30 -0
  1084. package/apps/studio/client/v2/search/search.css +519 -0
  1085. package/apps/studio/client/v2/settings/account.jsx +164 -0
  1086. package/apps/studio/client/v2/settings/advanced-prefs.js +91 -0
  1087. package/apps/studio/client/v2/settings/advanced-section.jsx +308 -0
  1088. package/apps/studio/client/v2/settings/connection-row.jsx +79 -0
  1089. package/apps/studio/client/v2/settings/connections-model.js +138 -0
  1090. package/apps/studio/client/v2/settings/connections-section.jsx +663 -0
  1091. package/apps/studio/client/v2/settings/general-section.jsx +155 -0
  1092. package/apps/studio/client/v2/settings/parts.jsx +48 -0
  1093. package/apps/studio/client/v2/settings/prefs-migrate.js +141 -0
  1094. package/apps/studio/client/v2/settings/project-sync-settings.jsx +255 -0
  1095. package/apps/studio/client/v2/settings/reset-section.jsx +164 -0
  1096. package/apps/studio/client/v2/settings/settings-handlers.js +46 -0
  1097. package/apps/studio/client/v2/settings/settings-model.js +523 -0
  1098. package/apps/studio/client/v2/settings/settings-sheet.jsx +204 -0
  1099. package/apps/studio/client/v2/settings/settings.css +975 -0
  1100. package/apps/studio/client/v2/settings/theme-auto.js +75 -0
  1101. package/apps/studio/client/v2/settings/use-advanced-prefs.js +32 -0
  1102. package/apps/studio/client/v2/settings/use-connections.js +485 -0
  1103. package/apps/studio/client/v2/share/glyphs.jsx +92 -0
  1104. package/apps/studio/client/v2/share/invite-row.jsx +68 -0
  1105. package/apps/studio/client/v2/share/link-dialog.js +53 -0
  1106. package/apps/studio/client/v2/share/link-row.jsx +38 -0
  1107. package/apps/studio/client/v2/share/move-to-cloud.jsx +88 -0
  1108. package/apps/studio/client/v2/share/people-list.jsx +151 -0
  1109. package/apps/studio/client/v2/share/person.jsx +26 -0
  1110. package/apps/studio/client/v2/share/role-menu.jsx +145 -0
  1111. package/apps/studio/client/v2/share/share-advanced.jsx +411 -0
  1112. package/apps/studio/client/v2/share/share-model.js +469 -0
  1113. package/apps/studio/client/v2/share/share-sheet.jsx +602 -0
  1114. package/apps/studio/client/v2/share/share.css +828 -0
  1115. package/apps/studio/client/v2/shell/account-card-model.js +114 -0
  1116. package/apps/studio/client/v2/shell/account-card.jsx +177 -0
  1117. package/apps/studio/client/v2/shell/annotation-prefs-store.js +105 -0
  1118. package/apps/studio/client/v2/shell/ask-to-edit.js +33 -0
  1119. package/apps/studio/client/v2/shell/callouts-host.jsx +151 -0
  1120. package/apps/studio/client/v2/shell/callouts-model.js +358 -0
  1121. package/apps/studio/client/v2/shell/callouts.css +164 -0
  1122. package/apps/studio/client/v2/shell/callouts.jsx +162 -0
  1123. package/apps/studio/client/v2/shell/canvas-mode.js +393 -0
  1124. package/apps/studio/client/v2/shell/contrast.css +37 -0
  1125. package/apps/studio/client/v2/shell/corner-icons.jsx +153 -0
  1126. package/apps/studio/client/v2/shell/dock-rail-homes.js +106 -0
  1127. package/apps/studio/client/v2/shell/f6-cycle.js +124 -0
  1128. package/apps/studio/client/v2/shell/floating-panels.css +2858 -0
  1129. package/apps/studio/client/v2/shell/fold-ghost.js +70 -0
  1130. package/apps/studio/client/v2/shell/format-update.css +43 -0
  1131. package/apps/studio/client/v2/shell/format-update.js +487 -0
  1132. package/apps/studio/client/v2/shell/format-update.jsx +479 -0
  1133. package/apps/studio/client/v2/shell/held-conflict.js +51 -0
  1134. package/apps/studio/client/v2/shell/image-pick.js +140 -0
  1135. package/apps/studio/client/v2/shell/insets-now.js +35 -0
  1136. package/apps/studio/client/v2/shell/inspector-follow.js +113 -0
  1137. package/apps/studio/client/v2/shell/menu-runner.js +711 -0
  1138. package/apps/studio/client/v2/shell/modal-focus.js +259 -0
  1139. package/apps/studio/client/v2/shell/mode-switch.jsx +418 -0
  1140. package/apps/studio/client/v2/shell/native-doors.js +121 -0
  1141. package/apps/studio/client/v2/shell/occlusion-insets.js +116 -0
  1142. package/apps/studio/client/v2/shell/panel-availability.js +27 -0
  1143. package/apps/studio/client/v2/shell/panel-layout.js +144 -0
  1144. package/apps/studio/client/v2/shell/panel-sizes.js +150 -0
  1145. package/apps/studio/client/v2/shell/paste-forward.js +43 -0
  1146. package/apps/studio/client/v2/shell/present-from-label.js +19 -0
  1147. package/apps/studio/client/v2/shell/project-menu-model.js +216 -0
  1148. package/apps/studio/client/v2/shell/project-pill.css +214 -0
  1149. package/apps/studio/client/v2/shell/project-pill.jsx +456 -0
  1150. package/apps/studio/client/v2/shell/recovery-store.js +139 -0
  1151. package/apps/studio/client/v2/shell/role-denial.js +73 -0
  1152. package/apps/studio/client/v2/shell/role-gate.js +29 -0
  1153. package/apps/studio/client/v2/shell/save-hold-notice.js +69 -0
  1154. package/apps/studio/client/v2/shell/save-status.js +191 -0
  1155. package/apps/studio/client/v2/shell/scroll-lock.js +49 -0
  1156. package/apps/studio/client/v2/shell/share-cluster-host.jsx +389 -0
  1157. package/apps/studio/client/v2/shell/share-cluster.css +608 -0
  1158. package/apps/studio/client/v2/shell/share-cluster.jsx +255 -0
  1159. package/apps/studio/client/v2/shell/shell-error-boundary.jsx +81 -0
  1160. package/apps/studio/client/v2/shell/shell-panels-relay.js +95 -0
  1161. package/apps/studio/client/v2/shell/shell-parity.js +457 -0
  1162. package/apps/studio/client/v2/shell/shell-parity.json +2106 -0
  1163. package/apps/studio/client/v2/shell/single-keys-store.js +49 -0
  1164. package/apps/studio/client/v2/shell/tool-panels.css +39 -0
  1165. package/apps/studio/client/v2/shell/tool-panels.js +156 -0
  1166. package/apps/studio/client/v2/shell/use-account.js +59 -0
  1167. package/apps/studio/client/v2/shell/use-annotation-prefs.js +77 -0
  1168. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +388 -0
  1169. package/apps/studio/client/v2/shell/use-dismiss-outside.js +35 -0
  1170. package/apps/studio/client/v2/shell/use-fit-on-ai-pin.js +42 -0
  1171. package/apps/studio/client/v2/shell/use-fit-while-ai-drafts.js +37 -0
  1172. package/apps/studio/client/v2/shell/use-occluded-insets.js +107 -0
  1173. package/apps/studio/client/v2/shell/use-panel-layout.js +45 -0
  1174. package/apps/studio/client/v2/shell/use-single-keys.js +56 -0
  1175. package/apps/studio/client/v2/shell/use-tool-panels.js +205 -0
  1176. package/apps/studio/client/v2/signin/CreateLocalSheet.jsx +155 -0
  1177. package/apps/studio/client/v2/signin/SignInCard.jsx +284 -0
  1178. package/apps/studio/client/v2/signin/SignInToast.jsx +22 -0
  1179. package/apps/studio/client/v2/signin/WhatsNewLine.jsx +64 -0
  1180. package/apps/studio/client/v2/signin/advanced-rows.js +40 -0
  1181. package/apps/studio/client/v2/signin/signin-model.js +138 -0
  1182. package/apps/studio/client/v2/signin/signin.css +484 -0
  1183. package/apps/studio/client/v2/signin/use-signin.js +209 -0
  1184. package/apps/studio/client/v2/signin/use-whats-new-line.js +94 -0
  1185. package/apps/studio/client/v2/sync-states/back-online.jsx +61 -0
  1186. package/apps/studio/client/v2/sync-states/conflict-card.jsx +326 -0
  1187. package/apps/studio/client/v2/sync-states/offline-foot.jsx +79 -0
  1188. package/apps/studio/client/v2/sync-states/row-words.js +83 -0
  1189. package/apps/studio/client/v2/sync-states/sync-states-model.js +264 -0
  1190. package/apps/studio/client/v2/sync-states/sync-states.css +232 -0
  1191. package/apps/studio/client/v2/timeline/Timeline.jsx +3194 -0
  1192. package/apps/studio/client/v2/timeline/TimelineHost.jsx +360 -0
  1193. package/apps/studio/client/v2/timeline/advanced/actions.js +27 -0
  1194. package/apps/studio/client/v2/timeline/advanced/advanced-store.js +116 -0
  1195. package/apps/studio/client/v2/timeline/advanced/advanced.css +323 -0
  1196. package/apps/studio/client/v2/timeline/advanced/cut-as-code.jsx +127 -0
  1197. package/apps/studio/client/v2/timeline/advanced/easing-curve.jsx +200 -0
  1198. package/apps/studio/client/v2/timeline/advanced/foot.jsx +210 -0
  1199. package/apps/studio/client/v2/timeline/advanced/model.js +121 -0
  1200. package/apps/studio/client/v2/timeline/advanced/render-settings.jsx +62 -0
  1201. package/apps/studio/client/v2/timeline/advanced/video-cap.js +174 -0
  1202. package/apps/studio/client/v2/timeline/ai-edge-model.js +111 -0
  1203. package/apps/studio/client/v2/timeline/ai-edge.css +104 -0
  1204. package/apps/studio/client/v2/timeline/ai-edge.jsx +113 -0
  1205. package/apps/studio/client/v2/timeline/anchor-lane.js +80 -0
  1206. package/apps/studio/client/v2/timeline/anchor.js +80 -0
  1207. package/apps/studio/client/v2/timeline/assemble-video.js +64 -0
  1208. package/apps/studio/client/v2/timeline/clip-search.js +88 -0
  1209. package/apps/studio/client/v2/timeline/clip-verb.js +224 -0
  1210. package/apps/studio/client/v2/timeline/comment-strip-host.jsx +93 -0
  1211. package/apps/studio/client/v2/timeline/comment-strip-model.js +103 -0
  1212. package/apps/studio/client/v2/timeline/comment-strip.jsx +82 -0
  1213. package/apps/studio/client/v2/timeline/edit/clip-menu.js +118 -0
  1214. package/apps/studio/client/v2/timeline/edit/clip-menu.jsx +48 -0
  1215. package/apps/studio/client/v2/timeline/edit/drop.jsx +101 -0
  1216. package/apps/studio/client/v2/timeline/edit/move.jsx +43 -0
  1217. package/apps/studio/client/v2/timeline/edit/ripple.js +43 -0
  1218. package/apps/studio/client/v2/timeline/edit/trim.jsx +52 -0
  1219. package/apps/studio/client/v2/timeline/edit/words.js +65 -0
  1220. package/apps/studio/client/v2/timeline/fit-fill.jsx +172 -0
  1221. package/apps/studio/client/v2/timeline/fit-model.js +137 -0
  1222. package/apps/studio/client/v2/timeline/fold.js +128 -0
  1223. package/apps/studio/client/v2/timeline/footage-rows.jsx +46 -0
  1224. package/apps/studio/client/v2/timeline/footage-state.js +135 -0
  1225. package/apps/studio/client/v2/timeline/glyphs.jsx +118 -0
  1226. package/apps/studio/client/v2/timeline/island-context.js +29 -0
  1227. package/apps/studio/client/v2/timeline/island-controls.jsx +83 -0
  1228. package/apps/studio/client/v2/timeline/island.jsx +54 -0
  1229. package/apps/studio/client/v2/timeline/joins/join-model.js +133 -0
  1230. package/apps/studio/client/v2/timeline/joins/joins.css +277 -0
  1231. package/apps/studio/client/v2/timeline/joins/transition-picker.jsx +240 -0
  1232. package/apps/studio/client/v2/timeline/keys.js +74 -0
  1233. package/apps/studio/client/v2/timeline/lanes/caption-lane.jsx +149 -0
  1234. package/apps/studio/client/v2/timeline/lanes/music-lane.jsx +294 -0
  1235. package/apps/studio/client/v2/timeline/lanes/music-media.js +200 -0
  1236. package/apps/studio/client/v2/timeline/lanes/music-model.js +190 -0
  1237. package/apps/studio/client/v2/timeline/loop-handle.jsx +70 -0
  1238. package/apps/studio/client/v2/timeline/marker-store.js +117 -0
  1239. package/apps/studio/client/v2/timeline/markers.js +79 -0
  1240. package/apps/studio/client/v2/timeline/marks.jsx +152 -0
  1241. package/apps/studio/client/v2/timeline/music-hint.jsx +98 -0
  1242. package/apps/studio/client/v2/timeline/other-takes-model.js +103 -0
  1243. package/apps/studio/client/v2/timeline/other-takes-store.js +49 -0
  1244. package/apps/studio/client/v2/timeline/other-takes.css +98 -0
  1245. package/apps/studio/client/v2/timeline/other-takes.jsx +269 -0
  1246. package/apps/studio/client/v2/timeline/peers.jsx +246 -0
  1247. package/apps/studio/client/v2/timeline/playhead.js +97 -0
  1248. package/apps/studio/client/v2/timeline/poster.js +109 -0
  1249. package/apps/studio/client/v2/timeline/reframe-island.jsx +478 -0
  1250. package/apps/studio/client/v2/timeline/reframe-model.js +135 -0
  1251. package/apps/studio/client/v2/timeline/reframe.css +150 -0
  1252. package/apps/studio/client/v2/timeline/ruler.js +61 -0
  1253. package/apps/studio/client/v2/timeline/selection.js +110 -0
  1254. package/apps/studio/client/v2/timeline/timeline-empty.jsx +108 -0
  1255. package/apps/studio/client/v2/timeline/timeline-store.js +147 -0
  1256. package/apps/studio/client/v2/timeline/timeline.css +2879 -0
  1257. package/apps/studio/client/v2/timeline/together.css +85 -0
  1258. package/apps/studio/client/v2/timeline/track-toggle.js +56 -0
  1259. package/apps/studio/client/v2/timeline/tracks.js +68 -0
  1260. package/apps/studio/client/v2/timeline/transport.js +66 -0
  1261. package/apps/studio/client/v2/timeline/zoom.js +37 -0
  1262. package/apps/studio/client/v2/transcript/TranscriptHost.jsx +162 -0
  1263. package/apps/studio/client/v2/transcript/TranscriptPanel.jsx +358 -0
  1264. package/apps/studio/client/v2/transcript/captions-api.js +297 -0
  1265. package/apps/studio/client/v2/transcript/captions-file-flag.js +38 -0
  1266. package/apps/studio/client/v2/transcript/comp-media-store.js +89 -0
  1267. package/apps/studio/client/v2/transcript/transcript-model.js +240 -0
  1268. package/apps/studio/client/v2/transcript/transcript.css +262 -0
  1269. package/apps/studio/client/v2/undo/projection.js +291 -0
  1270. package/apps/studio/client/v2/undo/undo-history.jsx +286 -0
  1271. package/apps/studio/client/v2/undo/undo.css +81 -0
  1272. package/apps/studio/client/v2/undo/use-undo-mode-lane.js +96 -0
  1273. package/apps/studio/client/v2/undo/use-undo-projection.jsx +460 -0
  1274. package/apps/studio/client/v2/undo/zoom-undo.jsx +79 -0
  1275. package/apps/studio/client/whats-new-seen.js +40 -0
  1276. package/apps/studio/client/whats-new.jsx +65 -62
  1277. package/apps/studio/clip-ops.ts +38 -6
  1278. package/apps/studio/cloud/config-path.ts +42 -0
  1279. package/apps/studio/cloud/endpoints.ts +212 -50
  1280. package/apps/studio/cloud/renew.ts +29 -16
  1281. package/apps/studio/collab/ai-activity.ts +19 -0
  1282. package/apps/studio/collab/awareness-bridge.ts +131 -4
  1283. package/apps/studio/collab/git-lifecycle.ts +52 -20
  1284. package/apps/studio/collab/holds.ts +69 -0
  1285. package/apps/studio/collab/index.ts +25 -0
  1286. package/apps/studio/collab/protocol.ts +64 -0
  1287. package/apps/studio/collab/registry.ts +59 -6
  1288. package/apps/studio/collab/room.ts +374 -16
  1289. package/apps/studio/collab/timeline-awareness.ts +123 -0
  1290. package/apps/studio/collab/timeline-presence.tsx +219 -0
  1291. package/apps/studio/commands/move-artboards-command.ts +45 -4
  1292. package/apps/studio/comments/anchors.ts +147 -0
  1293. package/apps/studio/comments/author-face.ts +41 -0
  1294. package/apps/studio/comments/from-line.ts +43 -0
  1295. package/apps/studio/comments/imported-from.ts +113 -0
  1296. package/apps/studio/comments/local-author.ts +41 -0
  1297. package/apps/studio/comments/mentions.ts +115 -0
  1298. package/apps/studio/comments/mine-stamp.ts +78 -0
  1299. package/apps/studio/comments/ops.ts +293 -0
  1300. package/apps/studio/comments/people.ts +66 -0
  1301. package/apps/studio/comments/where.ts +136 -0
  1302. package/apps/studio/comments-overlay.tsx +1220 -253
  1303. package/apps/studio/config.schema.json +33 -0
  1304. package/apps/studio/context-menu.tsx +126 -42
  1305. package/apps/studio/context.ts +178 -13
  1306. package/apps/studio/cursors-overlay.tsx +28 -11
  1307. package/apps/studio/debug-bundle.ts +21 -5
  1308. package/apps/studio/describe/batch.ts +414 -0
  1309. package/apps/studio/describe/budget.ts +147 -0
  1310. package/apps/studio/describe/claude.ts +273 -0
  1311. package/apps/studio/describe/consent.ts +120 -0
  1312. package/apps/studio/describe/validate.ts +192 -0
  1313. package/apps/studio/design-setup-readiness.ts +2 -2
  1314. package/apps/studio/diagnostics/store.ts +220 -0
  1315. package/apps/studio/dist/client.bundle.js +2429 -2329
  1316. package/apps/studio/dist/comment-mount.js +12 -9
  1317. package/apps/studio/dist/styles.css +1 -1
  1318. package/apps/studio/dom-selection.ts +239 -23
  1319. package/apps/studio/drag-bus.ts +211 -0
  1320. package/apps/studio/draw/serialize-animate.ts +4 -4
  1321. package/apps/studio/ds/board/board-specimen.css +199 -0
  1322. package/apps/studio/ds/board/board.css +674 -0
  1323. package/apps/studio/ds/board/brand-notes.ts +92 -0
  1324. package/apps/studio/ds/board/build-model.ts +418 -0
  1325. package/apps/studio/ds/board/component-states.ts +111 -0
  1326. package/apps/studio/ds/board/directions-model.ts +145 -0
  1327. package/apps/studio/ds/board/directions.css +169 -0
  1328. package/apps/studio/ds/board/directions.tsx +100 -0
  1329. package/apps/studio/ds/board/ds-bar.tsx +107 -0
  1330. package/apps/studio/ds/board/index.tsx +71 -0
  1331. package/apps/studio/ds/board/logo-paint.ts +118 -0
  1332. package/apps/studio/ds/board/outline.tsx +127 -0
  1333. package/apps/studio/ds/board/parts.tsx +160 -0
  1334. package/apps/studio/ds/board/section-brand.tsx +148 -0
  1335. package/apps/studio/ds/board/section-colour.tsx +160 -0
  1336. package/apps/studio/ds/board/section-components.tsx +146 -0
  1337. package/apps/studio/ds/board/section-motion.tsx +106 -0
  1338. package/apps/studio/ds/board/section-patterns.tsx +89 -0
  1339. package/apps/studio/ds/board/section-space.tsx +109 -0
  1340. package/apps/studio/ds/board/section-type.tsx +129 -0
  1341. package/apps/studio/ds/board/specimen.tsx +61 -0
  1342. package/apps/studio/ds/board/state.ts +105 -0
  1343. package/apps/studio/ds/board/template.ts +152 -0
  1344. package/apps/studio/ds/board/types.ts +346 -0
  1345. package/apps/studio/ds/canvas-check.ts +914 -0
  1346. package/apps/studio/ds/canvas-cli.ts +346 -0
  1347. package/apps/studio/ds/check-system-verb.ts +88 -0
  1348. package/apps/studio/ds/check-system.ts +293 -0
  1349. package/apps/studio/ds/check.ts +541 -0
  1350. package/apps/studio/ds/cli.ts +348 -0
  1351. package/apps/studio/ds/component-list.ts +150 -0
  1352. package/apps/studio/ds/contrast.ts +438 -0
  1353. package/apps/studio/ds/convert-map.ts +126 -0
  1354. package/apps/studio/ds/convert.ts +603 -0
  1355. package/apps/studio/ds/css-scan.ts +292 -0
  1356. package/apps/studio/ds/default-components.tsx +377 -0
  1357. package/apps/studio/ds/default.ts +58 -0
  1358. package/apps/studio/ds/design-system.tsx.tpl +40 -0
  1359. package/apps/studio/ds/ds-resolver.ts +205 -0
  1360. package/apps/studio/ds/ds-verb.ts +563 -0
  1361. package/apps/studio/ds/edges.ts +412 -0
  1362. package/apps/studio/ds/emit.ts +217 -0
  1363. package/apps/studio/ds/engine.ts +1652 -0
  1364. package/apps/studio/ds/fallbacks.ts +116 -0
  1365. package/apps/studio/ds/generate.ts +746 -0
  1366. package/apps/studio/ds/head.ts +372 -0
  1367. package/apps/studio/ds/instance-info.ts +90 -0
  1368. package/apps/studio/ds/library.ts +1137 -0
  1369. package/apps/studio/ds/make.ts +726 -0
  1370. package/apps/studio/ds/migrate-emitter.ts +42 -0
  1371. package/apps/studio/ds/nearest.ts +163 -0
  1372. package/apps/studio/ds/outside.ts +343 -0
  1373. package/apps/studio/ds/override-map.ts +213 -0
  1374. package/apps/studio/ds/pairing-css.ts +145 -0
  1375. package/apps/studio/ds/pin-scope.ts +268 -0
  1376. package/apps/studio/ds/registry.ts +228 -0
  1377. package/apps/studio/ds/rename.ts +104 -0
  1378. package/apps/studio/ds/render-rev.ts +144 -0
  1379. package/apps/studio/ds/revision.ts +268 -0
  1380. package/apps/studio/ds/shell-fallbacks.ts +84 -0
  1381. package/apps/studio/ds/switch.ts +426 -0
  1382. package/apps/studio/ds/system-files.ts +251 -0
  1383. package/apps/studio/ds/system.ts +312 -0
  1384. package/apps/studio/ds/undo-hook.ts +46 -0
  1385. package/apps/studio/ds/upgrade-apply.ts +258 -0
  1386. package/apps/studio/ds/upgrade-cli.ts +216 -0
  1387. package/apps/studio/ds/upgrade-codemod.ts +116 -0
  1388. package/apps/studio/ds/upgrade-progress.ts +153 -0
  1389. package/apps/studio/ds/upgrade-prove.ts +429 -0
  1390. package/apps/studio/ds/upgrade-stage.ts +387 -0
  1391. package/apps/studio/ds/upgrade.ts +394 -0
  1392. package/apps/studio/ds/value-types.ts +190 -0
  1393. package/apps/studio/edit-ops/align.ts +43 -0
  1394. package/apps/studio/edit-ops/arrange.ts +93 -0
  1395. package/apps/studio/edit-ops/artboard-facts.ts +70 -0
  1396. package/apps/studio/edit-ops/artboard-resize.ts +50 -0
  1397. package/apps/studio/edit-ops/artboard-trash.ts +77 -0
  1398. package/apps/studio/edit-ops/clear-link.ts +16 -0
  1399. package/apps/studio/edit-ops/clip/captions.ts +154 -0
  1400. package/apps/studio/edit-ops/clip/comp.ts +124 -0
  1401. package/apps/studio/edit-ops/clip/cut-source-range.ts +100 -0
  1402. package/apps/studio/edit-ops/clip/cut-to-beat.ts +136 -0
  1403. package/apps/studio/edit-ops/clip/duck.ts +123 -0
  1404. package/apps/studio/edit-ops/clip/easing.ts +76 -0
  1405. package/apps/studio/edit-ops/clip/formats.ts +163 -0
  1406. package/apps/studio/edit-ops/clip/gestures.ts +161 -0
  1407. package/apps/studio/edit-ops/clip/index.ts +543 -0
  1408. package/apps/studio/edit-ops/clip/jsx.ts +251 -0
  1409. package/apps/studio/edit-ops/clip/place.ts +127 -0
  1410. package/apps/studio/edit-ops/clip/reframe.ts +194 -0
  1411. package/apps/studio/edit-ops/clip/take-swap.ts +53 -0
  1412. package/apps/studio/edit-ops/clip/title-motion.ts +103 -0
  1413. package/apps/studio/edit-ops/clip/title-style.ts +177 -0
  1414. package/apps/studio/edit-ops/clip/track.ts +102 -0
  1415. package/apps/studio/edit-ops/clipboard.ts +482 -0
  1416. package/apps/studio/edit-ops/combine.ts +264 -0
  1417. package/apps/studio/edit-ops/constraints.ts +148 -0
  1418. package/apps/studio/edit-ops/convert-kind.ts +203 -0
  1419. package/apps/studio/edit-ops/corner-radius.ts +86 -0
  1420. package/apps/studio/edit-ops/crop.ts +303 -0
  1421. package/apps/studio/edit-ops/czech-ties.ts +84 -0
  1422. package/apps/studio/edit-ops/detach-instance.ts +119 -0
  1423. package/apps/studio/edit-ops/dispatch.ts +552 -0
  1424. package/apps/studio/edit-ops/distribute.ts +31 -0
  1425. package/apps/studio/edit-ops/ds-instance-update.ts +46 -0
  1426. package/apps/studio/edit-ops/ds-use-nearest.ts +72 -0
  1427. package/apps/studio/edit-ops/duplicate-at-width.ts +241 -0
  1428. package/apps/studio/edit-ops/frame.ts +68 -0
  1429. package/apps/studio/edit-ops/guides.ts +67 -0
  1430. package/apps/studio/edit-ops/hide.ts +30 -0
  1431. package/apps/studio/edit-ops/hover-rules.ts +94 -0
  1432. package/apps/studio/edit-ops/image-fit.ts +571 -0
  1433. package/apps/studio/edit-ops/insert-component.ts +344 -0
  1434. package/apps/studio/edit-ops/insert-preset.ts +151 -0
  1435. package/apps/studio/edit-ops/insert-shape.ts +326 -0
  1436. package/apps/studio/edit-ops/instance-model.ts +286 -0
  1437. package/apps/studio/edit-ops/instance-tree.ts +215 -0
  1438. package/apps/studio/edit-ops/layout-patch.ts +81 -0
  1439. package/apps/studio/edit-ops/lock.ts +30 -0
  1440. package/apps/studio/edit-ops/op-label.ts +155 -0
  1441. package/apps/studio/edit-ops/path-model.ts +671 -0
  1442. package/apps/studio/edit-ops/path.ts +172 -0
  1443. package/apps/studio/edit-ops/photo-every-use.ts +64 -0
  1444. package/apps/studio/edit-ops/photo-use.ts +41 -0
  1445. package/apps/studio/edit-ops/place-freely.ts +47 -0
  1446. package/apps/studio/edit-ops/place-plan.ts +60 -0
  1447. package/apps/studio/edit-ops/print.ts +104 -0
  1448. package/apps/studio/edit-ops/references.ts +231 -0
  1449. package/apps/studio/edit-ops/relink.ts +49 -0
  1450. package/apps/studio/edit-ops/reorder.ts +104 -0
  1451. package/apps/studio/edit-ops/reset-overrides.ts +75 -0
  1452. package/apps/studio/edit-ops/revert.ts +63 -0
  1453. package/apps/studio/edit-ops/rotate.ts +58 -0
  1454. package/apps/studio/edit-ops/safe-zones.ts +38 -0
  1455. package/apps/studio/edit-ops/scope-names.ts +151 -0
  1456. package/apps/studio/edit-ops/select-matching.ts +48 -0
  1457. package/apps/studio/edit-ops/set-gap.ts +65 -0
  1458. package/apps/studio/edit-ops/set-id.ts +42 -0
  1459. package/apps/studio/edit-ops/set-link.ts +39 -0
  1460. package/apps/studio/edit-ops/siblings.ts +105 -0
  1461. package/apps/studio/edit-ops/slot-defaults.ts +48 -0
  1462. package/apps/studio/edit-ops/stamp.ts +27 -0
  1463. package/apps/studio/edit-ops/swap-variant.ts +163 -0
  1464. package/apps/studio/edit-ops/text-copy.ts +146 -0
  1465. package/apps/studio/edit-ops/text-detach.ts +62 -0
  1466. package/apps/studio/edit-ops/text-style-ops.ts +131 -0
  1467. package/apps/studio/edit-ops/text-style.ts +141 -0
  1468. package/apps/studio/edit-ops/tidy.ts +72 -0
  1469. package/apps/studio/edit-ops/types.ts +229 -0
  1470. package/apps/studio/edit-ops/unframe.ts +53 -0
  1471. package/apps/studio/edit-ops/words-css.ts +487 -0
  1472. package/apps/studio/edit-ops/words-paint.ts +521 -0
  1473. package/apps/studio/edit-ops/z-order.ts +81 -0
  1474. package/apps/studio/editing/ai-point-ring.tsx +158 -0
  1475. package/apps/studio/editing/ai-scope-outline.tsx +180 -0
  1476. package/apps/studio/editing/align-bar.tsx +510 -0
  1477. package/apps/studio/editing/anchor-report.ts +123 -0
  1478. package/apps/studio/editing/anchor-reporter.tsx +64 -0
  1479. package/apps/studio/editing/aria-live.tsx +162 -0
  1480. package/apps/studio/editing/arrange.ts +345 -0
  1481. package/apps/studio/editing/artboard-actions.ts +275 -0
  1482. package/apps/studio/editing/artboard-commands.tsx +232 -0
  1483. package/apps/studio/editing/artboard-guides.tsx +265 -0
  1484. package/apps/studio/editing/artboard-handles.tsx +524 -0
  1485. package/apps/studio/editing/artboard-menu.tsx +153 -0
  1486. package/apps/studio/editing/artboard-resize.ts +306 -0
  1487. package/apps/studio/editing/ask-bubble.tsx +161 -0
  1488. package/apps/studio/editing/asset-drag.ts +70 -0
  1489. package/apps/studio/editing/click-to-type.ts +207 -0
  1490. package/apps/studio/editing/clipboard-actions.ts +91 -0
  1491. package/apps/studio/editing/clipboard.ts +194 -0
  1492. package/apps/studio/editing/clipped-grab.ts +45 -0
  1493. package/apps/studio/editing/corner-dots.tsx +394 -0
  1494. package/apps/studio/editing/crop-geometry.ts +128 -0
  1495. package/apps/studio/editing/crop-mode.tsx +522 -0
  1496. package/apps/studio/editing/crumbs.ts +158 -0
  1497. package/apps/studio/editing/draw-geometry.ts +151 -0
  1498. package/apps/studio/editing/draw-tools.tsx +490 -0
  1499. package/apps/studio/editing/drop-chip.tsx +105 -0
  1500. package/apps/studio/editing/duplicate-rhythm.ts +166 -0
  1501. package/apps/studio/editing/edit-chrome-gate.tsx +58 -0
  1502. package/apps/studio/editing/edit-op.ts +90 -0
  1503. package/apps/studio/editing/empty-report.ts +182 -0
  1504. package/apps/studio/editing/empty-reporter.tsx +74 -0
  1505. package/apps/studio/editing/figma-paste.ts +71 -0
  1506. package/apps/studio/editing/finder-drop-model.ts +130 -0
  1507. package/apps/studio/editing/finder-drop.tsx +400 -0
  1508. package/apps/studio/editing/focus-model.tsx +429 -0
  1509. package/apps/studio/editing/gap-bands.tsx +257 -0
  1510. package/apps/studio/editing/hold-rings.tsx +461 -0
  1511. package/apps/studio/editing/image-drop.tsx +193 -0
  1512. package/apps/studio/editing/index.tsx +402 -0
  1513. package/apps/studio/editing/instance-actions.ts +152 -0
  1514. package/apps/studio/editing/kids-summary.ts +75 -0
  1515. package/apps/studio/editing/kind-dim.tsx +54 -0
  1516. package/apps/studio/editing/layout-actions.ts +159 -0
  1517. package/apps/studio/editing/lock-badge.tsx +178 -0
  1518. package/apps/studio/editing/long-page.ts +102 -0
  1519. package/apps/studio/editing/minimap-context.tsx +161 -0
  1520. package/apps/studio/editing/nudge.tsx +212 -0
  1521. package/apps/studio/editing/object-actions.ts +156 -0
  1522. package/apps/studio/editing/object-keys.ts +58 -0
  1523. package/apps/studio/editing/object-menu.tsx +216 -0
  1524. package/apps/studio/editing/object-ops.ts +114 -0
  1525. package/apps/studio/editing/paste-bar.tsx +388 -0
  1526. package/apps/studio/editing/pen/combine-run.ts +113 -0
  1527. package/apps/studio/editing/pen/draw.tsx +364 -0
  1528. package/apps/studio/editing/pen/index.tsx +48 -0
  1529. package/apps/studio/editing/pen/overlay.tsx +147 -0
  1530. package/apps/studio/editing/pen/pen-geometry.ts +234 -0
  1531. package/apps/studio/editing/pen/point-store.ts +64 -0
  1532. package/apps/studio/editing/pen/points.tsx +421 -0
  1533. package/apps/studio/editing/place-freely.tsx +389 -0
  1534. package/apps/studio/editing/place-ghost.tsx +418 -0
  1535. package/apps/studio/editing/place-image.tsx +219 -0
  1536. package/apps/studio/editing/preset-ruler.tsx +218 -0
  1537. package/apps/studio/editing/rename-order.ts +58 -0
  1538. package/apps/studio/editing/reorder-slot.tsx +567 -0
  1539. package/apps/studio/editing/rotate-handle.tsx +353 -0
  1540. package/apps/studio/editing/selection.tsx +319 -0
  1541. package/apps/studio/editing/set-gap.ts +55 -0
  1542. package/apps/studio/editing/size-ghost.tsx +343 -0
  1543. package/apps/studio/editing/space-tap.ts +56 -0
  1544. package/apps/studio/editing/sticky-name.tsx +112 -0
  1545. package/apps/studio/editing/tab-order.tsx +298 -0
  1546. package/apps/studio/editing/take-keys.ts +115 -0
  1547. package/apps/studio/editing/text-actions.ts +214 -0
  1548. package/apps/studio/editing/text-in-place.tsx +187 -0
  1549. package/apps/studio/editing/tidy-preview.tsx +83 -0
  1550. package/apps/studio/editing/token-ruler.tsx +231 -0
  1551. package/apps/studio/editing/type-role.ts +122 -0
  1552. package/apps/studio/editing/undo-preview.tsx +120 -0
  1553. package/apps/studio/editing/video-label.ts +66 -0
  1554. package/apps/studio/editing/video-play.ts +65 -0
  1555. package/apps/studio/editing/world-menu.ts +36 -0
  1556. package/apps/studio/element-ids.ts +1030 -0
  1557. package/apps/studio/equal-spacing-handles.tsx +1 -1
  1558. package/apps/studio/exporters/_runtime.ts +64 -24
  1559. package/apps/studio/exporters/audio.ts +136 -0
  1560. package/apps/studio/exporters/door-fingerprint.ts +202 -0
  1561. package/apps/studio/exporters/estimate.ts +314 -0
  1562. package/apps/studio/exporters/file-names.ts +197 -0
  1563. package/apps/studio/exporters/format-scopes.ts +7 -1
  1564. package/apps/studio/exporters/hub-render-door.ts +368 -0
  1565. package/apps/studio/exporters/index.ts +53 -7
  1566. package/apps/studio/exporters/jobs.ts +484 -80
  1567. package/apps/studio/exporters/jpg.ts +21 -0
  1568. package/apps/studio/exporters/pdf-fonts.ts +102 -0
  1569. package/apps/studio/exporters/pdf.ts +133 -14
  1570. package/apps/studio/exporters/png.ts +136 -9
  1571. package/apps/studio/exporters/print-back.ts +92 -0
  1572. package/apps/studio/exporters/print-preflight.ts +373 -0
  1573. package/apps/studio/exporters/rects-runner.ts +130 -0
  1574. package/apps/studio/exporters/remote.ts +726 -3
  1575. package/apps/studio/exporters/render-seconds.ts +57 -0
  1576. package/apps/studio/exporters/replay.ts +48 -0
  1577. package/apps/studio/exporters/scope.ts +560 -15
  1578. package/apps/studio/exporters/spec-run.ts +270 -0
  1579. package/apps/studio/exporters/spec-v2.ts +408 -0
  1580. package/apps/studio/exporters/video-cap.ts +280 -0
  1581. package/apps/studio/exporters/wait-ai.ts +192 -0
  1582. package/apps/studio/figma/client.ts +67 -0
  1583. package/apps/studio/figma/comments-to-pins.ts +249 -0
  1584. package/apps/studio/figma/comments-to-strokes.ts +6 -1
  1585. package/apps/studio/figma/into-board.ts +141 -0
  1586. package/apps/studio/figma/to-strokes.ts +54 -0
  1587. package/apps/studio/format.ts +172 -30
  1588. package/apps/studio/fs-watch.ts +28 -1
  1589. package/apps/studio/generation/adapters/gemini.ts +3 -0
  1590. package/apps/studio/generation/adapters/stub.ts +133 -0
  1591. package/apps/studio/generation/gen-sidecar.ts +108 -0
  1592. package/apps/studio/generation/registry.ts +16 -5
  1593. package/apps/studio/generation/takes.ts +398 -0
  1594. package/apps/studio/generation/types.ts +7 -0
  1595. package/apps/studio/git/service.ts +143 -14
  1596. package/apps/studio/github/endpoints.ts +1 -1
  1597. package/apps/studio/github/identity-cache.ts +53 -14
  1598. package/apps/studio/handoff/blockers.ts +120 -0
  1599. package/apps/studio/handoff/run.ts +233 -0
  1600. package/apps/studio/handoff/targets.ts +334 -0
  1601. package/apps/studio/handoff/write-scopes.ts +57 -0
  1602. package/apps/studio/handoff.ts +24 -5
  1603. package/apps/studio/history/changes.ts +199 -0
  1604. package/apps/studio/history/describe-annotations.ts +216 -0
  1605. package/apps/studio/history/describe-css.ts +592 -0
  1606. package/apps/studio/history/describe-match.ts +866 -0
  1607. package/apps/studio/history/describe-meta.ts +281 -0
  1608. package/apps/studio/history/describe-version.ts +89 -0
  1609. package/apps/studio/history/describe-words.ts +513 -0
  1610. package/apps/studio/history/describe.ts +1452 -0
  1611. package/apps/studio/history/last-good.ts +123 -0
  1612. package/apps/studio/history/links.ts +112 -0
  1613. package/apps/studio/history/object-history.ts +535 -0
  1614. package/apps/studio/history/render-ok-signal.ts +81 -0
  1615. package/apps/studio/history/restore-artboard-action.ts +183 -0
  1616. package/apps/studio/history/restore-artboard.ts +607 -0
  1617. package/apps/studio/history/restore-object.ts +168 -0
  1618. package/apps/studio/history/run-label.ts +18 -0
  1619. package/apps/studio/history/surface-requests.ts +115 -0
  1620. package/apps/studio/history/titles.ts +259 -0
  1621. package/apps/studio/history/trash.ts +314 -0
  1622. package/apps/studio/history/version-lanes.ts +115 -0
  1623. package/apps/studio/history/versions.ts +458 -0
  1624. package/apps/studio/hmr-broadcast.ts +55 -1
  1625. package/apps/studio/home/ai.ts +79 -0
  1626. package/apps/studio/home/cli.ts +221 -0
  1627. package/apps/studio/home/cloud.ts +297 -0
  1628. package/apps/studio/home/create-local.ts +164 -0
  1629. package/apps/studio/home/github.ts +99 -0
  1630. package/apps/studio/home/hub.ts +340 -0
  1631. package/apps/studio/home/index-gc.ts +288 -0
  1632. package/apps/studio/home/index-reader.ts +338 -0
  1633. package/apps/studio/home/invite.ts +204 -0
  1634. package/apps/studio/home/main.ts +159 -0
  1635. package/apps/studio/home/pid.ts +12 -0
  1636. package/apps/studio/home/routes.ts +591 -0
  1637. package/apps/studio/home/signin.ts +285 -0
  1638. package/apps/studio/home/user-state.ts +177 -0
  1639. package/apps/studio/home/whats-new.ts +42 -0
  1640. package/apps/studio/http.ts +2589 -947
  1641. package/apps/studio/index/assets-response.ts +34 -0
  1642. package/apps/studio/index/assets.ts +335 -0
  1643. package/apps/studio/index/ds-usage.ts +983 -0
  1644. package/apps/studio/index/extract.ts +348 -0
  1645. package/apps/studio/index/extractors/asset-usage.ts +349 -0
  1646. package/apps/studio/index/extractors/attribution-cache.ts +225 -0
  1647. package/apps/studio/index/history-refs.ts +301 -0
  1648. package/apps/studio/index/history-source.ts +39 -0
  1649. package/apps/studio/index/match.ts +307 -0
  1650. package/apps/studio/index/scan-kick.ts +47 -0
  1651. package/apps/studio/index/service.ts +367 -0
  1652. package/apps/studio/index/snapshot.ts +135 -0
  1653. package/apps/studio/index/types.ts +139 -0
  1654. package/apps/studio/index/version-feed.ts +71 -0
  1655. package/apps/studio/input-router.tsx +522 -55
  1656. package/apps/studio/inspect-canvas.ts +86 -0
  1657. package/apps/studio/inspect-overlay.tsx +192 -0
  1658. package/apps/studio/inspect.ts +96 -33
  1659. package/apps/studio/kinds/convert.ts +175 -0
  1660. package/apps/studio/kinds/export-defaults.ts +42 -0
  1661. package/apps/studio/kinds/meta.ts +237 -0
  1662. package/apps/studio/kinds/physical.ts +84 -0
  1663. package/apps/studio/kinds/presets.ts +452 -0
  1664. package/apps/studio/kinds/print-custom.ts +165 -0
  1665. package/apps/studio/kinds/print-edit.ts +130 -0
  1666. package/apps/studio/kinds/print-guides.ts +23 -0
  1667. package/apps/studio/kinds/safe-zones.ts +250 -0
  1668. package/apps/studio/kinds/warnings.ts +422 -0
  1669. package/apps/studio/layer-name.ts +148 -0
  1670. package/apps/studio/layout/free-space.ts +131 -0
  1671. package/apps/studio/link-chip-overlay.tsx +175 -0
  1672. package/apps/studio/link-import.ts +617 -0
  1673. package/apps/studio/loopback-listen.ts +105 -0
  1674. package/apps/studio/macro-guard.ts +67 -0
  1675. package/apps/studio/managed-projects.ts +63 -14
  1676. package/apps/studio/marquee-overlay.tsx +2 -2
  1677. package/apps/studio/measure-overlay.tsx +10 -4
  1678. package/apps/studio/migrate/cli.ts +164 -0
  1679. package/apps/studio/migrate/ds-registry.ts +42 -0
  1680. package/apps/studio/migrate/engine.ts +926 -0
  1681. package/apps/studio/migrate/hub.ts +219 -0
  1682. package/apps/studio/migrate/steps.ts +627 -0
  1683. package/apps/studio/notifications.tsx +197 -52
  1684. package/apps/studio/outbox/content.ts +139 -0
  1685. package/apps/studio/outbox/drain.ts +269 -0
  1686. package/apps/studio/outbox/hub-reachability.ts +58 -0
  1687. package/apps/studio/outbox/index.ts +57 -0
  1688. package/apps/studio/outbox/policy.ts +859 -0
  1689. package/apps/studio/outbox/senders/export-cloud.ts +116 -0
  1690. package/apps/studio/outbox/store.ts +336 -0
  1691. package/apps/studio/outbox/types.ts +160 -0
  1692. package/apps/studio/participants-chrome.tsx +178 -60
  1693. package/apps/studio/paths.ts +8 -0
  1694. package/apps/studio/photo-store.ts +230 -1
  1695. package/apps/studio/port.ts +93 -0
  1696. package/apps/studio/presence/canvas-presence.tsx +522 -0
  1697. package/apps/studio/presence/fields.ts +93 -0
  1698. package/apps/studio/presence/model.ts +296 -0
  1699. package/apps/studio/presence/tones.ts +39 -0
  1700. package/apps/studio/present/fit.ts +138 -0
  1701. package/apps/studio/present/follow.ts +142 -0
  1702. package/apps/studio/present/media-presence.ts +105 -0
  1703. package/apps/studio/present/meta-schema.ts +612 -0
  1704. package/apps/studio/present/order.ts +153 -0
  1705. package/apps/studio/present/pointer-dot.tsx +379 -0
  1706. package/apps/studio/present/pointer-point.ts +24 -0
  1707. package/apps/studio/present/present-media.ts +446 -0
  1708. package/apps/studio/present/present-stage.tsx +1018 -0
  1709. package/apps/studio/present/present-zoom.ts +63 -0
  1710. package/apps/studio/present/relay-strip.ts +136 -0
  1711. package/apps/studio/preview/preview-camera.tsx +442 -0
  1712. package/apps/studio/preview/wheel-scroll.ts +85 -0
  1713. package/apps/studio/print/units.ts +3 -0
  1714. package/apps/studio/print-overlay-content.tsx +127 -10
  1715. package/apps/studio/read-only-mode.ts +83 -0
  1716. package/apps/studio/readiness.ts +18 -3
  1717. package/apps/studio/ripple.ts +19 -1
  1718. package/apps/studio/routes/agent.ts +1025 -0
  1719. package/apps/studio/routes/ai.ts +422 -0
  1720. package/apps/studio/routes/annotations.ts +649 -0
  1721. package/apps/studio/routes/asset-details.ts +87 -0
  1722. package/apps/studio/routes/asset-rename.ts +60 -0
  1723. package/apps/studio/routes/asset-state.ts +137 -0
  1724. package/apps/studio/routes/asset-trash.ts +77 -0
  1725. package/apps/studio/routes/assets.ts +217 -0
  1726. package/apps/studio/routes/availability.ts +94 -0
  1727. package/apps/studio/routes/canvas-meta-rider.ts +304 -0
  1728. package/apps/studio/routes/canvas-origin.ts +88 -0
  1729. package/apps/studio/routes/canvas-source.ts +315 -0
  1730. package/apps/studio/routes/chat-attach.ts +335 -0
  1731. package/apps/studio/routes/chat.ts +137 -0
  1732. package/apps/studio/routes/cloud-move.ts +364 -0
  1733. package/apps/studio/routes/cloud-plan.ts +36 -0
  1734. package/apps/studio/routes/comments.ts +118 -0
  1735. package/apps/studio/routes/connections.ts +132 -0
  1736. package/apps/studio/routes/describe.ts +122 -0
  1737. package/apps/studio/routes/diagnostics.ts +118 -0
  1738. package/apps/studio/routes/ds-check.ts +124 -0
  1739. package/apps/studio/routes/ds-convert.ts +55 -0
  1740. package/apps/studio/routes/ds-edges.ts +136 -0
  1741. package/apps/studio/routes/ds-library.ts +194 -0
  1742. package/apps/studio/routes/ds-make.ts +91 -0
  1743. package/apps/studio/routes/ds-switch.ts +68 -0
  1744. package/apps/studio/routes/ds-upgrade.ts +139 -0
  1745. package/apps/studio/routes/ds.ts +808 -0
  1746. package/apps/studio/routes/edit.ts +658 -0
  1747. package/apps/studio/routes/element-links.ts +155 -0
  1748. package/apps/studio/routes/export.ts +486 -0
  1749. package/apps/studio/routes/figma.ts +200 -0
  1750. package/apps/studio/routes/generate.ts +443 -0
  1751. package/apps/studio/routes/handoff.ts +319 -0
  1752. package/apps/studio/routes/help-guides.ts +37 -0
  1753. package/apps/studio/routes/history.ts +739 -0
  1754. package/apps/studio/routes/import-link.ts +186 -0
  1755. package/apps/studio/routes/index.ts +293 -0
  1756. package/apps/studio/routes/kinds.ts +257 -0
  1757. package/apps/studio/routes/links.ts +72 -0
  1758. package/apps/studio/routes/outbox.ts +87 -0
  1759. package/apps/studio/routes/photo-every-use.ts +241 -0
  1760. package/apps/studio/routes/pins.ts +66 -0
  1761. package/apps/studio/routes/present.ts +187 -0
  1762. package/apps/studio/routes/project-format.ts +148 -0
  1763. package/apps/studio/routes/project-undo.ts +497 -0
  1764. package/apps/studio/routes/settings.ts +179 -0
  1765. package/apps/studio/routes/share.ts +463 -0
  1766. package/apps/studio/routes/shell.ts +137 -0
  1767. package/apps/studio/routes/sync-conflicts.ts +150 -0
  1768. package/apps/studio/routes/sync.ts +172 -0
  1769. package/apps/studio/routes/table.ts +224 -0
  1770. package/apps/studio/routes/trash.ts +393 -0
  1771. package/apps/studio/routes/video.ts +395 -0
  1772. package/apps/studio/routes/votes.ts +486 -0
  1773. package/apps/studio/safe-zones-overlay.tsx +269 -0
  1774. package/apps/studio/scaffold-design.ts +72 -124
  1775. package/apps/studio/schema/annotations.v2.schema.json +2303 -0
  1776. package/apps/studio/schema/beats.v1.schema.json +94 -0
  1777. package/apps/studio/schema/canvas-meta.v2.schema.json +264 -0
  1778. package/apps/studio/schema/canvas-tsx.md +357 -0
  1779. package/apps/studio/schema/comments.v2.schema.json +125 -0
  1780. package/apps/studio/schema/ds-components-v1.schema.json +96 -0
  1781. package/apps/studio/schema/ds-formats.md +146 -0
  1782. package/apps/studio/schema/ds-head-v1.schema.json +67 -0
  1783. package/apps/studio/schema/ds-revision-v1.schema.json +31 -0
  1784. package/apps/studio/schema/ds-schema-v1.fallbacks.css +118 -0
  1785. package/apps/studio/schema/ds-schema-v1.json +2029 -0
  1786. package/apps/studio/schema/ds-schema-v1.schema.json +663 -0
  1787. package/apps/studio/schema/ds-tokens-v1.schema.json +210 -0
  1788. package/apps/studio/schema/edl.v1.schema.json +124 -0
  1789. package/apps/studio/schema/formats.ts +175 -0
  1790. package/apps/studio/schema/gen.v1.schema.json +33 -0
  1791. package/apps/studio/schema/transcript.v1.schema.json +133 -0
  1792. package/apps/studio/server.ts +454 -166
  1793. package/apps/studio/shell/info-file.ts +54 -0
  1794. package/apps/studio/shell/parent-watch.ts +97 -0
  1795. package/apps/studio/shell/profile.ts +61 -0
  1796. package/apps/studio/shell-canvas-file.ts +36 -0
  1797. package/apps/studio/skip-dirs.ts +455 -0
  1798. package/apps/studio/spoof-chars.ts +17 -0
  1799. package/apps/studio/static-lane.ts +212 -0
  1800. package/apps/studio/sync/accepted-cold-start.ts +35 -13
  1801. package/apps/studio/sync/accepted-link.ts +524 -27
  1802. package/apps/studio/sync/access-notices.ts +143 -0
  1803. package/apps/studio/sync/action-feed.ts +145 -0
  1804. package/apps/studio/sync/action-stage.ts +831 -165
  1805. package/apps/studio/sync/asset-push.ts +24 -2
  1806. package/apps/studio/sync/asset-state.ts +391 -0
  1807. package/apps/studio/sync/atomic-write.ts +42 -1
  1808. package/apps/studio/sync/availability.ts +185 -0
  1809. package/apps/studio/sync/canvas-path.ts +70 -6
  1810. package/apps/studio/sync/cell-pairing.ts +5 -24
  1811. package/apps/studio/sync/comment-door.ts +104 -0
  1812. package/apps/studio/sync/conflict-record.ts +186 -0
  1813. package/apps/studio/sync/create-collision.ts +297 -0
  1814. package/apps/studio/sync/ctl-provider.ts +13 -1
  1815. package/apps/studio/sync/file-membership.ts +95 -10
  1816. package/apps/studio/sync/file-plane.ts +76 -7
  1817. package/apps/studio/sync/format-sync.ts +13 -7
  1818. package/apps/studio/sync/history-fields.ts +61 -0
  1819. package/apps/studio/sync/hub-link.ts +24 -4
  1820. package/apps/studio/sync/hub-text-undo.ts +178 -0
  1821. package/apps/studio/sync/hubs-config.ts +122 -20
  1822. package/apps/studio/sync/index.ts +1444 -127
  1823. package/apps/studio/sync/journal-client.ts +44 -0
  1824. package/apps/studio/sync/keep-both.ts +187 -0
  1825. package/apps/studio/sync/link-consent.ts +390 -0
  1826. package/apps/studio/sync/local-kernel.ts +2725 -0
  1827. package/apps/studio/sync/media-gate.ts +97 -0
  1828. package/apps/studio/sync/object-conflict.ts +199 -0
  1829. package/apps/studio/sync/poke.ts +20 -0
  1830. package/apps/studio/sync/presentation.ts +14 -1
  1831. package/apps/studio/sync/project-config-push.ts +5 -2
  1832. package/apps/studio/sync/projection.ts +201 -34
  1833. package/apps/studio/sync/resync-trace.ts +220 -0
  1834. package/apps/studio/sync/status.ts +8 -1
  1835. package/apps/studio/sync/supervisor.ts +20 -2
  1836. package/apps/studio/sync/transaction-client.ts +364 -34
  1837. package/apps/studio/sync/trash-clear-copies.ts +120 -0
  1838. package/apps/studio/sync/trash-watch.ts +157 -0
  1839. package/apps/studio/sync/trash.ts +50 -2
  1840. package/apps/studio/sync/undo-target.ts +110 -0
  1841. package/apps/studio/sync/workspace-signin.ts +14 -3
  1842. package/apps/studio/sync/write-hold.ts +238 -0
  1843. package/apps/studio/sync/writer-registry.ts +380 -5
  1844. package/apps/studio/sync-name-key.ts +59 -0
  1845. package/apps/studio/thumbs/keys.ts +147 -0
  1846. package/apps/studio/thumbs/routes.ts +68 -0
  1847. package/apps/studio/thumbs/service.ts +884 -0
  1848. package/apps/studio/thumbs/store.ts +114 -0
  1849. package/apps/studio/thumbs/validate.ts +62 -0
  1850. package/apps/studio/tool-palette.tsx +782 -563
  1851. package/apps/studio/toolbars/marker-tip.ts +22 -0
  1852. package/apps/studio/toolbars/shell-panels.ts +55 -0
  1853. package/apps/studio/toolbars/tool-panel.ts +89 -0
  1854. package/apps/studio/toolbars/toolbar-css.ts +283 -0
  1855. package/apps/studio/toolbars/toolbar-icons.tsx +135 -0
  1856. package/apps/studio/toolbars/toolbar-rect.ts +82 -0
  1857. package/apps/studio/ui-prefs-migrate.ts +467 -0
  1858. package/apps/studio/ui-prefs.ts +305 -3
  1859. package/apps/studio/undo-stack.ts +10 -0
  1860. package/apps/studio/use-annotation-resize.tsx +23 -17
  1861. package/apps/studio/use-artboard-drag.tsx +156 -15
  1862. package/apps/studio/use-canvas-keys.ts +58 -0
  1863. package/apps/studio/use-chrome-visibility.tsx +13 -0
  1864. package/apps/studio/use-collab.tsx +556 -56
  1865. package/apps/studio/use-element-resize.tsx +13 -9
  1866. package/apps/studio/use-governed-mode.ts +23 -0
  1867. package/apps/studio/use-keyboard-discipline.tsx +114 -49
  1868. package/apps/studio/use-selection-set.tsx +110 -9
  1869. package/apps/studio/use-snap-guides.tsx +74 -5
  1870. package/apps/studio/use-spacing-handles.tsx +90 -27
  1871. package/apps/studio/use-tool-mode.tsx +204 -10
  1872. package/apps/studio/use-undo-stack.tsx +19 -23
  1873. package/apps/studio/video/beats.ts +484 -0
  1874. package/apps/studio/video/decode-webaudio.ts +115 -0
  1875. package/apps/studio/video/decode.ts +288 -0
  1876. package/apps/studio/video/derive.ts +647 -0
  1877. package/apps/studio/video/format-ids.ts +158 -0
  1878. package/apps/studio/video/framing.ts +246 -0
  1879. package/apps/studio/video/inject.ts +324 -0
  1880. package/apps/studio/video/keyframes.ts +356 -0
  1881. package/apps/studio/video/link-groups.ts +40 -0
  1882. package/apps/studio/video/linked-formats.ts +142 -0
  1883. package/apps/studio/video/mask-comments.ts +36 -0
  1884. package/apps/studio/video/media-analysis.ts +169 -0
  1885. package/apps/studio/video/reel-place.ts +286 -0
  1886. package/apps/studio/video/reframe-read.ts +90 -0
  1887. package/apps/studio/video/schema.ts +422 -0
  1888. package/apps/studio/video/speech.ts +129 -0
  1889. package/apps/studio/video/title-motion.ts +85 -0
  1890. package/apps/studio/video/transcript-cut.ts +91 -0
  1891. package/apps/studio/video/whisper-parse.ts +123 -0
  1892. package/apps/studio/video/words-run.ts +210 -0
  1893. package/apps/studio/video/words-timing.ts +222 -0
  1894. package/apps/studio/video-comp.tsx +238 -9
  1895. package/apps/studio/video-links-overlay.tsx +272 -0
  1896. package/apps/studio/video-natural.ts +73 -0
  1897. package/apps/studio/video-play-chrome.tsx +229 -0
  1898. package/apps/studio/video-play-overlay.tsx +190 -0
  1899. package/apps/studio/video-vocab.tsx +460 -0
  1900. package/apps/studio/view-only-gesture.tsx +101 -0
  1901. package/apps/studio/viewport-fit.ts +28 -0
  1902. package/apps/studio/web-overlay-content.tsx +4 -2
  1903. package/apps/studio/whats-new.json +55 -20
  1904. package/apps/studio/whats-new.schema.json +10 -0
  1905. package/apps/studio/whats-new.ts +4 -0
  1906. package/apps/studio/workspace-mode.ts +10 -0
  1907. package/apps/studio/ws.ts +299 -8
  1908. package/cli/bin/maude.mjs +2 -0
  1909. package/cli/commands/design.mjs +401 -72
  1910. package/cli/commands/flow.mjs +73 -0
  1911. package/cli/commands/help.mjs +14 -1
  1912. package/cli/commands/init.mjs +1 -1
  1913. package/cli/commands/migrate.mjs +55 -0
  1914. package/cli/lib/bash-guard.mjs +1691 -0
  1915. package/cli/lib/cache.mjs +1 -1
  1916. package/cli/lib/confine-out.mjs +150 -0
  1917. package/cli/lib/confine-read.mjs +179 -0
  1918. package/cli/lib/confine-root.mjs +157 -0
  1919. package/cli/lib/ddr-to-kgai.mjs +2 -2
  1920. package/cli/lib/design-help.gen.mjs +119 -0
  1921. package/cli/lib/design-hook.mjs +1764 -0
  1922. package/cli/lib/design-link.mjs +68 -4
  1923. package/cli/lib/design-open.mjs +238 -0
  1924. package/cli/lib/export-spec.mjs +394 -0
  1925. package/cli/lib/finding-text.mjs +63 -0
  1926. package/cli/lib/flow-usage.mjs +133 -0
  1927. package/cli/lib/gitignore-block.mjs +1 -0
  1928. package/cli/lib/handoff.mjs +285 -0
  1929. package/cli/lib/handoff.schema.json +336 -0
  1930. package/cli/lib/hubs-config.mjs +10 -0
  1931. package/cli/lib/json-schema-lite.mjs +260 -0
  1932. package/cli/lib/project-links.mjs +88 -0
  1933. package/cli/lib/studio-locate.mjs +83 -0
  1934. package/cli/lib/sub-verbs.mjs +111 -0
  1935. package/cli/lib/workspace-plan.mjs +16 -3
  1936. package/package.json +30 -11
  1937. package/plugins/design/README.md +46 -0
  1938. package/plugins/design/templates/_shell.html +749 -69
  1939. package/plugins/design/templates/blank-canvas.tsx.template +26 -0
  1940. package/plugins/design/templates/brief-board.tsx.template +12 -11
  1941. package/plugins/design/templates/canvas.tsx.template +3 -3
  1942. package/plugins/design/templates/design-system-inspiration/core/README.philosophy.md.tpl +104 -0
  1943. package/plugins/design/templates/design-system-inspiration/core/colors_and_type.css.tpl +38 -3
  1944. package/plugins/design/templates/design-system-inspiration/core/components.json.tpl +127 -0
  1945. package/plugins/design/templates/design-system-inspiration/core/config.json.tpl +1 -0
  1946. package/plugins/design/templates/design-system-inspiration/core/preview/_components.css.tpl +111 -0
  1947. package/plugins/flow/.claude-plugin/config.schema.json +170 -9
  1948. package/plugins/flow/README.md +18 -17
  1949. package/plugins/flow/dependencies.json +25 -26
  1950. package/plugins/flow/templates/ai-skeleton/INDEX.md +3 -3
  1951. package/plugins/flow/templates/ai-skeleton/README.md +5 -5
  1952. package/plugins/flow/templates/ai-skeleton/context/README.md +1 -1
  1953. package/plugins/flow/templates/ai-skeleton/logs/README.md +1 -1
  1954. package/plugins/flow/templates/ai-skeleton/plans/README.md +1 -1
  1955. package/plugins/flow/templates/ai-skeleton/reviews/README.md +2 -2
  1956. package/plugins/flow/templates/ai-skeleton/scenario-guide.md +4 -4
  1957. package/plugins/flow/templates/ai-skeleton/scenarios/README.md +2 -2
  1958. package/plugins/flow/templates/ai-skeleton/templates/HANDOFF.md +1 -1
  1959. package/apps/studio/annotations/ui/edit-actions.ts +0 -551
  1960. package/apps/studio/canvas-header.ts +0 -165
  1961. package/apps/studio/client/hmr.mjs +0 -113
  1962. package/apps/studio/client/hooks/use-keyboard-shortcuts.jsx +0 -297
  1963. package/apps/studio/client/iframe-lazy.mjs +0 -121
  1964. package/apps/studio/client/inspector/artboard-knobs.jsx +0 -456
  1965. package/apps/studio/client/menus/menubar.jsx +0 -856
  1966. package/apps/studio/client/panels/CapabilityBar.jsx +0 -101
  1967. package/apps/studio/client/panels/ClipInspector.jsx +0 -409
  1968. package/apps/studio/client/panels/GitPanel.jsx +0 -1026
  1969. package/apps/studio/client/panels/OnboardingWizard.jsx +0 -642
  1970. package/apps/studio/client/panels/StickerPicker.jsx +0 -160
  1971. package/apps/studio/client/panels/SyncPanel.jsx +0 -1190
  1972. package/apps/studio/client/panels/TimelinePanel.jsx +0 -2259
  1973. package/apps/studio/client/share-dialog.jsx +0 -91
  1974. package/apps/studio/client/shell/collapsed-rail.jsx +0 -23
  1975. package/apps/studio/client/shell/status-bar.jsx +0 -215
  1976. package/apps/studio/client/styles/1-tokens-maude.css +0 -296
  1977. package/apps/studio/client/styles/1-tokens.css +0 -304
  1978. package/apps/studio/client/styles/3-shell-maude.css +0 -3158
  1979. package/apps/studio/client/styles/3-shell.css +0 -1036
  1980. package/apps/studio/client/styles/4-components-maude.css +0 -134
  1981. package/apps/studio/client/styles/4-components.css +0 -2204
  1982. package/apps/studio/client/styles/5-maude-overrides.css +0 -162
  1983. package/apps/studio/client/styles.css +0 -1264
  1984. package/apps/studio/contextual-toolbar.tsx +0 -512
  1985. package/apps/studio/export-dialog.tsx +0 -827
  1986. package/apps/studio/undo-hud.tsx +0 -16
@@ -26,6 +26,7 @@ import {
26
26
  renameSync,
27
27
  rmdirSync,
28
28
  rmSync,
29
+ statSync,
29
30
  writeFileSync,
30
31
  } from 'node:fs';
31
32
  import { readdir } from 'node:fs/promises';
@@ -33,19 +34,38 @@ import { hostname } from 'node:os';
33
34
  import path from 'node:path';
34
35
  import type { Awareness } from 'y-protocols/awareness';
35
36
  import * as Y from 'yjs';
37
+ import { resolveAccess } from '../access/scope.ts';
38
+ import { claimHashOf, currentWriteClaim, recordClaim } from '../ai/write-claim.ts';
36
39
  import { migrateAnnotationsV2 } from '../annotations/migrate-boot.ts';
37
40
  import { REPLICA_TYPE, replicaBoardText } from '../annotations/replica.ts';
41
+ import { attributeArtboards } from '../attribute-artboards.ts';
38
42
  import { renewHubCredential } from '../cloud/renew.ts';
39
43
  import { Y_TYPES } from '../collab/persistence.ts';
40
44
  import type { Context, LinkedHub } from '../context.ts';
41
45
  import { PROJECT_CONFIG_CACHE_REL, reloadConfig, sanitizeProjectConfig } from '../context.ts';
46
+ import { persistableFormat, projectFormat, SUPPORTED_FORMAT } from '../format.ts';
47
+ import type { TrashListing, TrashOutcome } from '../history/trash.ts';
42
48
  import { createHistory } from '../history.ts';
43
49
  import { SYNTHETIC_FS_DELAY_MS } from '../hmr-broadcast.ts';
44
- import { acceptedColdStart } from './accepted-cold-start.ts';
45
- import { type AcceptedLink, createAcceptedLink } from './accepted-link.ts';
50
+ import { rekeyUserState } from '../home/user-state.ts';
51
+ import { acceptedColdStart, localCreateLanes } from './accepted-cold-start.ts';
52
+ import { type AcceptedLink, createAcceptedLink, type StructuralOutcome } from './accepted-link.ts';
53
+ import { createAccessRelay } from './access-notices.ts';
54
+ import type { RunFence } from './action-stage.ts';
46
55
  import { type CanvasSyncAgent, createCanvasSyncAgent } from './agent.ts';
47
56
  import { isPushableAssetRel, pushAssets } from './asset-push.ts';
57
+ import {
58
+ askHubPresence,
59
+ createHeldReporter,
60
+ reportHeld,
61
+ uploadingFromRows,
62
+ } from './asset-state.ts';
48
63
  import { atomicWrite } from './atomic-write.ts';
64
+ import {
65
+ declaredCanvasGroups,
66
+ isUndeclaredGroupName,
67
+ resolveCanvasBodyRel,
68
+ } from './canvas-path.ts';
49
69
  import { type CellPairing, resolveCellPairing, sanitizeForLog } from './cell-pairing.ts';
50
70
  import {
51
71
  canvasPathFromDoc,
@@ -55,12 +75,14 @@ import {
55
75
  stampCanvasPath,
56
76
  stampMovedTo,
57
77
  } from './codec.ts';
78
+ import { type CommentDoor, createCommentDoor } from './comment-door.ts';
58
79
  import { commentLedgerFor } from './comment-ledger.ts';
59
80
  import {
60
81
  type ConnectionMonitor,
61
82
  createConnectionMonitor,
62
83
  type ProviderStatus,
63
84
  } from './connection-state.ts';
85
+ import { createCollisionRenamer, createRenamedText } from './create-collision.ts';
64
86
  import { createCtlProvider } from './ctl-provider.ts';
65
87
  import { createRescanScheduler, diffCanvasSet, type RescanScheduler } from './discovery.ts';
66
88
  import { createDocNameResolver } from './doc-name.ts';
@@ -79,11 +101,15 @@ import {
79
101
  withFormatParam,
80
102
  } from './format-sync.ts';
81
103
  import { createFsReader, type FsReader } from './fs-mirror.ts';
104
+ import { canvasLanes, namedField, type RowNamed } from './history-fields.ts';
82
105
  import { type HubDocRow, hubHolds, indexHubDocs } from './hub-listing.ts';
83
- import { getHubRecord } from './hubs-config.ts';
106
+ import { hubTextUndoConflict } from './hub-text-undo.ts';
107
+ import { accessFor, getHubRecord } from './hubs-config.ts';
84
108
  import { loadJournal, type SyncJournal } from './journal.ts';
85
109
  import { hasAnnotationsV2, hasLedger, hubHealth } from './journal-client.ts';
110
+ import type { RestoreOptions } from './local-kernel.ts';
86
111
  import { isLoopbackHost } from './loopback.ts';
112
+ import { createMediaGate, MEDIA_STAYS_LINE, readServerSignature } from './media-gate.ts';
87
113
  import { migrateFlatFallback } from './migrate-flat-fallback.ts';
88
114
  import { migrateSeed } from './migrate-seed.ts';
89
115
  import { ORIGINS } from './origins.ts';
@@ -116,9 +142,18 @@ import {
116
142
  } from './remote-docs.ts';
117
143
  import { createRevisionBarrier } from './revision-barrier.ts';
118
144
  import { computeSeedProgress } from './seed-progress.ts';
145
+ import { mergeSource } from './source-merge.ts';
119
146
  import { replaySourceOp, type SourceOp } from './source-ops.ts';
120
- import { createSyncStatusStore, type SyncStatusStore } from './status.ts';
147
+ import { createSyncStatusStore, type FilePlaneStatus, type SyncStatusStore } from './status.ts';
121
148
  import { quarantineCanvas } from './tombstone-apply.ts';
149
+ import { createTrashWatch } from './trash-watch.ts';
150
+ import {
151
+ asTarget,
152
+ chatActionIds,
153
+ originFields,
154
+ type UndoTarget,
155
+ undoLabel,
156
+ } from './undo-target.ts';
122
157
  import { writeUntrustedMarkers } from './untrusted.ts';
123
158
 
124
159
  /** A minimum-surface stand-in for the HocuspocusProvider's runtime API. */
@@ -535,6 +570,18 @@ export interface SyncRuntime {
535
570
  agentFor(slug: string): CanvasSyncAgent | undefined;
536
571
  /** Current offline/sync status payload (Task 8), or null when unlinked. */
537
572
  status(): import('./status.ts').SyncStatusPayload | null;
573
+ /** S11.4 — what the availability read model folds (listed ∖ on disk); a read, never a fetch. */
574
+ availability?(): import('./availability.ts').AvailabilitySource;
575
+ /**
576
+ * S8.19 — ask the linked hub "who holds these" (contract S8-S9-asset-presence §5.4). Null in a
577
+ * cell (a cell IS the hub: there is no peer hub to ask) and once stopped.
578
+ */
579
+ assetPresenceAsker?(): import('./asset-state.ts').AssetPresenceAsker | null;
580
+ /**
581
+ * S8.19 — this Mac's own pending pushes (the file plane's `local-only` / `pushing` rows, or the
582
+ * legacy sweep's file on the wire): what reads as `uploading`. Null when nothing is known.
583
+ */
584
+ assetUploading?(): ReadonlyMap<string, { progress?: number }> | null;
538
585
  /**
539
586
  * Stop the asset sweep child, if one is running. `false` means there was
540
587
  * nothing to cancel — the caller reports that, rather than pretending.
@@ -559,12 +606,53 @@ export interface SyncRuntime {
559
606
  * `null` when the project is not in that mode or this runtime does not carry
560
607
  * the canvas — the caller then writes the shared document as before.
561
608
  */
609
+ /**
610
+ * P8 G1a — a comment op from a session that may not edit the canvas, sent to the hub's
611
+ * comment door (`sync/comment-door.ts`). `null` for an editor, or a canvas this runtime
612
+ * does not carry — the caller then writes the comment as before.
613
+ */
614
+ commentDoor?: CommentDoor;
562
615
  proposeLane?(
563
616
  slug: string,
564
617
  lane: 'comments' | 'annotations' | 'meta',
565
618
  text: string,
566
- opts?: { baseText?: string; writeId?: string }
619
+ /** T-S4.5b — `stageable`: a run-tagged annotation batch joins its run's stage (claimed by hash). */
620
+ opts?: { baseText?: string; writeId?: string; stageable?: boolean }
567
621
  ): Promise<{ status: 'accepted' | 'rejected'; code?: string }> | null;
622
+ /**
623
+ * S4.7 — several lanes of one synced canvas as ONE proposal (a sticky ↔
624
+ * comment conversion). `null` when the project is not in accepted mode or
625
+ * this runtime does not carry the canvas.
626
+ */
627
+ proposeLanes?(
628
+ slug: string,
629
+ lanes: Array<{
630
+ /** S2.10b — `html`: an edit-op's source with its layout lane (one action) */
631
+ lane: 'comments' | 'annotations' | 'meta' | 'html';
632
+ text: string;
633
+ baseText: string;
634
+ }>,
635
+ opts: {
636
+ kind: string;
637
+ label: string;
638
+ writeId?: string;
639
+ /** S2.10b — an artboard-trash action's `origin.trashed` (S1-trash.md §2) */
640
+ origin?: { trashed?: Array<{ artboard: string; label?: string }> };
641
+ }
642
+ ): Promise<{ status: 'accepted' | 'rejected'; code?: string; actionId?: string }> | null;
643
+ /**
644
+ * S10.3b — the linked-hub twin of the local kernel's `proposeFiles` (S10.2): several canvas
645
+ * files (design-root-relative `rel`: a body, its `.meta.json` or its board) as ONE action.
646
+ * Each file's lane value is proposed against what this Mac and the accepted replica agreed on;
647
+ * a file already holding the value adds nothing (none left → accepted, no action). Nothing is
648
+ * written here: on acceptance the hub publishes and the projections write the files, which
649
+ * this waits for, so the answer means "on disk". `null` when the project is not in accepted
650
+ * mode — the DS engine then refuses `ds-kernel-unavailable`.
651
+ */
652
+ proposeFiles?(
653
+ files: { rel: string; text: string }[],
654
+ action: { kind: string; label: string | null }
655
+ ): Promise<{ status: 'accepted' | 'rejected'; code?: string; actionId?: string } | null>;
568
656
  /**
569
657
  * Accepted-revisions mode: a folder operation as ONE project action. `null`
570
658
  * when the project is not in that mode; otherwise the (possibly queued)
@@ -582,6 +670,8 @@ export interface SyncRuntime {
582
670
  ): Promise<{ status: 'accepted' | 'rejected'; code?: string; queued?: boolean }> | null;
583
671
  /** True while the linked project is in accepted-revisions mode. */
584
672
  acceptedMode?(): boolean;
673
+ /** p8-fix-a F19 — false until the hub (or a remembered answer for this hub) has said how the project saves. */
674
+ acceptedModeKnown?(): boolean;
585
675
  /**
586
676
  * Issue #133 — may the comment ledger record `slug`'s current comments as
587
677
  * synced? Only when the hub is known to hold them: accepted mode (the doc IS
@@ -597,35 +687,160 @@ export interface SyncRuntime {
597
687
  limit?: number;
598
688
  before?: number | null;
599
689
  path?: string | null;
690
+ /** S5.5 — additive filters (store-core `history`, S5.1a). */
691
+ chat?: string | null;
692
+ kind?: string | null;
693
+ /** Only this person's actions. */
694
+ mine?: boolean;
600
695
  }): Promise<AcceptedHistoryRow[] | null>;
601
- /** A canvas source (repo-relative path) as it stood at a revision. */
602
- acceptedVersion?(repoRel: string, revision: number): Promise<string | null>;
603
- /** Restore a canvas to a revision as a NEW action. */
696
+ /**
697
+ * A canvas lane (repo-relative TSX path) as it stood at a revision — its source (`html`, the
698
+ * default), its same-name CSS or its meta (S1.11, V2-1.9 §5.6). null = no such lane then.
699
+ */
700
+ acceptedVersion?(
701
+ repoRel: string,
702
+ revision: number,
703
+ lane?: 'html' | 'css' | 'meta' | 'annotations',
704
+ /** S1.13 — the body a `history.aside` at exactly `revision` kept for that lane. */
705
+ o?: { aside?: boolean }
706
+ ): Promise<string | null>;
707
+ /** S1.18 — the manifest rows a stable link resolves over (history/links.ts). Null when legacy. */
708
+ acceptedLinkDocs?(): Promise<{ entry: string; path: string | null; retired: boolean }[] | null>;
709
+ /**
710
+ * S1.12b — name a version of a canvas (`history.name`, V2-1.9 §5.4): the kernel snaps
711
+ * `revision` to the newest one at or before it that changed the canvas; `null` clears.
712
+ */
713
+ acceptedName?(
714
+ repoRel: string,
715
+ revision: number,
716
+ name: string | null
717
+ ): Promise<{
718
+ status: 'accepted' | 'rejected';
719
+ code?: string;
720
+ queued?: boolean;
721
+ actionId?: string;
722
+ } | null>;
723
+ /** S1.12b — keep a version nobody kept (`history.aside`, no head moves). */
724
+ acceptedAside?(
725
+ repoRel: string,
726
+ lane: 'html' | 'css' | 'meta' | 'annotations',
727
+ content: string,
728
+ label?: string
729
+ ): Promise<{
730
+ status: 'accepted' | 'rejected';
731
+ code?: string;
732
+ queued?: boolean;
733
+ actionId?: string;
734
+ } | null>;
735
+ /** S1.18 — the manifest rows a stable link resolves over (history/links.ts). Null when legacy. */
736
+ acceptedLinkDocs?(): Promise<{ entry: string; path: string | null; retired: boolean }[] | null>;
737
+ /**
738
+ * Restore a canvas to a revision as a NEW action. S1.13: `o.lanes` — one artboard / object /
739
+ * kept-aside version, the studio's lanes as ONE `restore` action (local-kernel.ts RestoreOptions).
740
+ */
604
741
  acceptedRestore?(
605
742
  repoRel: string,
606
- revision: number
607
- ): Promise<{ status: 'accepted' | 'rejected'; code?: string; queued?: boolean } | null>;
608
- /** Personal undo/redo of one of this actor's accepted actions (T28). */
743
+ revision: number,
744
+ o?: RestoreOptions
745
+ ): Promise<{
746
+ status: 'accepted' | 'rejected';
747
+ code?: string;
748
+ queued?: boolean;
749
+ actionId?: string;
750
+ } | null>;
751
+ /**
752
+ * S5.15 (U22) — does the home undo several actions as ONE? The hub's bootstrap says so with
753
+ * `capabilities.undoTargets` (S5.1a); an older hub lacks it. null = no bootstrap read yet.
754
+ */
755
+ chatUndoReady?(): boolean | null;
756
+ /**
757
+ * Personal undo/redo of this actor's accepted actions (T28). S5.5: one id,
758
+ * several (`actionIds` — "as if they never happened", ONE action), or a
759
+ * whole chat (`chatId` → this person's actions of that chat).
760
+ */
609
761
  acceptedUndo?(
610
- actionId: string,
611
- redo?: boolean
762
+ target: string | UndoTarget,
763
+ redo?: boolean,
764
+ o?: { via?: 'keys' | 'panel' }
612
765
  ): Promise<{
613
766
  status: 'accepted' | 'rejected';
614
767
  code?: string;
615
768
  queued?: boolean;
616
769
  actionId?: string;
770
+ undoes?: string | string[];
771
+ skipped?: Array<{ doc?: string; lane?: string; reason: string; conflictWith?: string }>;
617
772
  } | null>;
618
773
  /**
619
- * T16 — an AI action begins: file changes tools make until it ends are
774
+ * p8-hub-undo-collision — would ⌘Z of this text step collide with a collaborator's text (the
775
+ * 3-way merge of the undo onto the hub head overlaps)? True → the route answers `undo-conflict`
776
+ * before the kernel. Redo is never checked (as on the local home).
777
+ */
778
+ textUndoConflict?(target: string | UndoTarget, redo?: boolean): Promise<boolean>;
779
+ /**
780
+ * S1.7b — the shared Trash of a linked project (history/trash.ts
781
+ * `TrashRuntime`). Null while the project is legacy or its hub does not
782
+ * advertise `trash.restore` / `trash.clear`: the view then falls back to
783
+ * this Mac's own list.
784
+ */
785
+ acceptedTrash?(): Promise<TrashListing | null>;
786
+ acceptedTrashRestore?(entry: string): Promise<TrashOutcome | null>;
787
+ acceptedTrashClear?(items?: string[]): Promise<TrashOutcome | null>;
788
+ /**
789
+ * T16 — an AI run begins: file changes its tools make until it ends are
620
790
  * published together as one action (see action-stage.ts). `key` names the
621
- * participant (an agent turn, a /design:edit run).
791
+ * participant (an agent turn, a /design:edit run); `meta.runId` the
792
+ * registry's run when there is one. Each run is its own stage (V2-1.5 §5.5).
622
793
  */
623
- beginAiAction?(key: string, label: string): void;
624
- /** T16 — `done` publishes (when the last participant ends); `failed` holds. */
794
+ beginAiAction?(
795
+ key: string,
796
+ label: string,
797
+ meta?: {
798
+ runId?: string;
799
+ chatId?: string;
800
+ actor?: string;
801
+ /** V2-8.9 round B A1 — a shell verb call's window (sync/action-stage.ts `claimOnly`). */
802
+ shell?: { call: string; open: boolean; files?: string[]; all?: boolean };
803
+ /** p8-a1-claims — begun by a claim: takes only claimed writes (sync/action-stage.ts). */
804
+ claimOnly?: boolean;
805
+ }
806
+ ): void;
807
+ /** `done` publishes; `stopped` publishes partial; `failed` holds. */
625
808
  endAiAction?(
626
809
  key: string,
627
- outcome: 'done' | 'failed'
628
- ): Promise<{ status: 'accepted' | 'rejected'; code?: string } | null>;
810
+ outcome: 'done' | 'failed' | 'stopped',
811
+ o?: { fence?: RunFence }
812
+ ): Promise<{
813
+ status: 'accepted' | 'rejected';
814
+ code?: string;
815
+ actionId?: string;
816
+ /** S5.5b — the run's touched artboards (canvas → ids), for `project:action`. */
817
+ touched?: Record<string, string[]>;
818
+ } | null>;
819
+ /** S5.5 — a tool reported writing `hash` (sha256) to canvas `repoRel` for run `key`. */
820
+ claimAiWrite?(key: string, repoRel: string, hash?: string | null): void;
821
+ /** p8-a1-claims (F17) — run `key` is about to delete canvas `repoRel`: the delete joins the run. */
822
+ claimAiDelete?(key: string, repoRel: string): void;
823
+ unclaimAiDelete?(key: string, repoRel: string): void;
824
+ /** S5.11b — a canvas's accepted source under the staged runs; null = the disk is accepted. */
825
+ acceptedCanvas?(repoRel: string): string | null;
826
+ /**
827
+ * S2.20c (V2-1.5 §5.4) — this person's edits to canvas `repoRel` waiting behind an AI run, oldest
828
+ * first (an inverse ⌘Z queued names the edit it `undoes`). Null when no hub answers.
829
+ */
830
+ pendingEdits?(repoRel: string): Array<{
831
+ transactionId: string;
832
+ label: string;
833
+ madeAt: number;
834
+ undoes?: string;
835
+ }> | null;
836
+ /**
837
+ * S2.20c — ⌘Z on a waiting edit: the disk loses it now, and its inverse waits behind the same
838
+ * run, landing as that edit's undo right after it. Never touches the run's staged writes.
839
+ */
840
+ undoPendingEdit?(
841
+ repoRel: string,
842
+ transactionId: string
843
+ ): Promise<{ status: 'accepted' | 'rejected'; code?: string; transactionId?: string } | null>;
629
844
  /**
630
845
  * T19 — make the whole project available offline now: file-plane passes
631
846
  * back to back (no pacing floor) until nothing is left to pull, or a pass
@@ -647,16 +862,30 @@ export interface SyncRuntime {
647
862
  */
648
863
  resolveConflict?(
649
864
  repoRel: string,
650
- choice: 'mine' | 'theirs'
865
+ choice: 'mine' | 'theirs',
866
+ /**
867
+ * S11.12 (Keep both) — take theirs only while this Mac's version is still exactly `ifMine`
868
+ * (what the copy holds). Checked and taken in one synchronous step, so an edit that lands
869
+ * meanwhile is never written over: the answer is `rejected` / `changed` and nothing moves.
870
+ */
871
+ o?: { ifMine?: string }
651
872
  ): Promise<{ status: 'accepted' | 'rejected' | 'taken'; code?: string } | null>;
652
- /** T16 — the person's decision on a held (unfinished) AI action. */
653
- resolveAiAction?(choice: 'publish' | 'discard'): Promise<{
873
+ /** T16 — the person's decision on a held (unfinished) AI run (no id: every held run). */
874
+ resolveAiAction?(
875
+ choice: 'publish' | 'discard',
876
+ runId?: string
877
+ ): Promise<{
654
878
  status: 'accepted' | 'rejected' | 'discarded';
655
879
  code?: string;
656
880
  canvases?: number;
881
+ actionId?: string;
882
+ touched?: Record<string, string[]>;
657
883
  } | null>;
658
884
  }
659
885
 
886
+ /** S5.5 — what `POST /_api/project/undo` names (V2-1.5 §5.3). */
887
+ export type { UndoTarget } from './undo-target.ts';
888
+
660
889
  export interface AcceptedHistoryRow {
661
890
  revision: number;
662
891
  actionId: string;
@@ -665,16 +894,32 @@ export interface AcceptedHistoryRow {
665
894
  kind: string;
666
895
  label: string | null;
667
896
  committedAt: number;
668
- undoes: string | null;
897
+ /** A single-target undo names one id; a multi-target one (S5.1a) an array. */
898
+ undoes: string | string[] | null;
669
899
  /** Design-root-relative canvas paths the action touched. */
670
900
  canvases: string[];
901
+ /** S1.12b — per canvas, the lanes the action touched there (additive). */
902
+ lanes?: Record<string, string[]>;
903
+ /** S1.12b — a `name` action's target revision and name (`origin.named`; null clears). */
904
+ named?: RowNamed;
905
+ /** V2-1.5 §5.1 — the AI run / chat that made it, the person's clock, a stopped run. */
906
+ runId?: string;
907
+ chatId?: string;
908
+ madeAt?: number;
909
+ partial?: true;
910
+ /** S2.20c — the proposal's transaction id: a pending ⌘Z entry finds the action it became. */
911
+ transactionId?: string;
671
912
  }
672
913
 
914
+ export { originFields } from './undo-target.ts';
915
+
673
916
  export interface CreateSyncRuntimeOptions {
674
917
  /** Transaction transport override (tests) — defaults to global fetch. */
675
918
  transactionFetch?: typeof fetch;
676
919
  /** Base backoff between re-sends of an unanswered proposal (tests). */
677
920
  transactionRetryMs?: number;
921
+ /** S6.13b crash test — called at named points inside an offline-create rename. */
922
+ createRenameFault?: (point: string) => void;
678
923
  /** Override the HocuspocusProvider factory (test injection). */
679
924
  providerFactory?: ProviderFactory;
680
925
  /** Force-enable/disable adopt mode (overrides cfg.linkedHub.adopt). */
@@ -834,6 +1079,13 @@ export function createSyncRuntime(
834
1079
  : ctx.cfg.linkedHub;
835
1080
  if (!linked) return null;
836
1081
  const linkedHub = linked;
1082
+ // p8-hub-folder-boundary — a hub's own studio, while the owner has declared no
1083
+ // canvas folders, takes and scans every folder the hub's kernel takes. Read per
1084
+ // call: the owner may declare groups mid-session (the project-config door), and
1085
+ // from then on the declared groups rule here exactly as on the hub.
1086
+ const hubBoundary = (): boolean =>
1087
+ hubFolderBoundary(ctx.paths.designRoot, { cellPairing: cellPairing !== null });
1088
+ const scanOpts = (): ScanOptions => ({ undeclaredFolders: hubBoundary() });
837
1089
  if (cellPairing) {
838
1090
  console.log(
839
1091
  `[sync] cell pairing ON — loopback shared-doc provider to ${sanitizeForLog(linkedHub.url)}; autocommit disabled (the hub is the sole committer). DDR-209 threaded, not reversed.`
@@ -910,7 +1162,13 @@ export function createSyncRuntime(
910
1162
  }
911
1163
  if (changed) {
912
1164
  console.log(
913
- `[sync] the project format is ${formatVersion}${outboundPaused() ? ' — newer than this build writes; open to look at, nothing goes up until Maude is updated' : ''}`
1165
+ `[sync] the project format is ${formatVersion}${
1166
+ !outboundPaused()
1167
+ ? ''
1168
+ : formatVersion > SUPPORTED_FORMAT
1169
+ ? ' — newer than this build writes; open to look at, nothing goes up until Maude is updated'
1170
+ : ' — older than this build edits; open to look at, nothing goes up until the owner runs Update project'
1171
+ }`
914
1172
  );
915
1173
  ctx.bus.emit('config-updated');
916
1174
  }
@@ -1079,6 +1337,28 @@ export function createSyncRuntime(
1079
1337
  // two-doc agent path has no proposal lane and stays legacy.
1080
1338
  /** Resolves once a previous run's outbox is drained: doc → own accepted html. */
1081
1339
  let outboxDrained: Promise<Map<string, string>> = Promise.resolve(new Map());
1340
+ /** S6.13 — documents whose `doc.create` that drain had accepted: made BY
1341
+ * THIS MAC in a previous run, so they join as a create, not a reconcile. */
1342
+ const drainedCreates = new Set<string>();
1343
+ // S6.13b — a create the project refused because a peer took the name while
1344
+ // this Mac was away: this Mac's canvas moves to the next free name.
1345
+ /** Documents this Mac's canvas moved away from: an answer to their create is not ours. */
1346
+ const renamedAway = new Set<string>();
1347
+ /** The renamed creates: new document → the source the project holds once accepted. */
1348
+ const renamedCreates = new Map<string, Promise<string | null>>();
1349
+ /** Slugs whose file moved away; kept attached until the peer's canvas lands there. */
1350
+ const vacated = new Set<string>();
1351
+ let collisionRenamer: ReturnType<typeof createCollisionRenamer> | null = null;
1352
+ const noticesBeforeStore: Array<{ id: string; severity: 'info' | 'warn'; text: string }> = [];
1353
+ // C5 — two local canvases on one wire document: say so in the Sync panel.
1354
+ const reportCollisions = (collisions: DocCollision[]): void => {
1355
+ for (const c of collisions) {
1356
+ const notice = docCollisionNotice(c, ctx.paths.designRoot);
1357
+ if (statusStore) statusStore.notice?.(notice);
1358
+ else noticesBeforeStore.push(notice);
1359
+ }
1360
+ };
1361
+ let saveModeAnnounced = false;
1082
1362
  const acceptedLink: AcceptedLink | null = useSharedDoc
1083
1363
  ? createAcceptedLink({
1084
1364
  hubUrl: linkedHub.url,
@@ -1091,6 +1371,16 @@ export function createSyncRuntime(
1091
1371
  retryMs: opts.transactionRetryMs,
1092
1372
  onStats: (stats) => statusStore?.updateAccepted?.(stats),
1093
1373
  onStage: (summary) => statusStore?.updateAiAction?.(summary),
1374
+ onCreateConflict: (ops, result, tx) =>
1375
+ collisionRenamer?.onCreateConflict(ops, result, tx) ?? Promise.resolve(null),
1376
+ ...(opts.createRenameFault ? { fault: opts.createRenameFault } : {}),
1377
+ // S5.5 — a run's `touched` artboards, by AST reference closure (V2-1.5 §5.7)
1378
+ attribute: (slug, before, after) => {
1379
+ const html = descriptors.get(slug)?.html;
1380
+ if (!html || !/\.tsx$/i.test(html)) return null;
1381
+ const canvas = path.relative(ctx.paths.designRoot, html).split(path.sep).join('/');
1382
+ return { canvas, artboards: attributeArtboards(canvas, before, after).artboards };
1383
+ },
1094
1384
  onBootstrap: (b) => {
1095
1385
  noteHubFormatSeen(
1096
1386
  formatFromHub(b),
@@ -1099,6 +1389,12 @@ export function createSyncRuntime(
1099
1389
  : undefined
1100
1390
  );
1101
1391
  noteProjectConfig(b.projectConfig);
1392
+ // p8-fix-a F19 — `/_config.saveMode` was `pending` until this first answer: tell the shells
1393
+ // to read it again (once; later mode changes already reach them through the migrator).
1394
+ if (!saveModeAnnounced) {
1395
+ saveModeAnnounced = true;
1396
+ ctx.bus.emit('config-updated');
1397
+ }
1102
1398
  if (!outboundPaused()) void projectConfigPusher?.push();
1103
1399
  // F3 S17 — a save made as the socket died is held (the connection
1104
1400
  // was not writable). After the reconnect the handshake re-admits the
@@ -1110,6 +1406,73 @@ export function createSyncRuntime(
1110
1406
  },
1111
1407
  })
1112
1408
  : null;
1409
+ /** S6.13b — an answer to a create of a document this Mac's canvas moved away from is not ours. */
1410
+ const notOursIfRenamed =
1411
+ (docName: string) =>
1412
+ (o: StructuralOutcome): StructuralOutcome =>
1413
+ renamedAway.has(docName) ? { status: 'rejected', code: 'renamed' } : o;
1414
+ collisionRenamer = acceptedLink
1415
+ ? createCollisionRenamer({
1416
+ paths: ctx.paths,
1417
+ docNameFor: (slug) => docNameFor(slug),
1418
+ liveDocs: async () => {
1419
+ await acceptedLink.refresh();
1420
+ const docs = acceptedLink.manifest?.docs;
1421
+ return docs ? docs.filter((d) => !d.retired) : null;
1422
+ },
1423
+ onRenaming: (c) => {
1424
+ renamedAway.add(c.fromDoc);
1425
+ // The old canvas stays attached: the peer's canvas lands at its path.
1426
+ if (projections.has(c.fromSlug) || providers.has(c.fromSlug)) vacated.add(c.fromSlug);
1427
+ projections.get(c.fromSlug)?.vacate();
1428
+ let settle: (html: string | null) => void = () => {};
1429
+ renamedCreates.set(
1430
+ c.toDoc,
1431
+ new Promise<string | null>((r) => {
1432
+ settle = r;
1433
+ })
1434
+ );
1435
+ return (result) => settle(result.status === 'accepted' ? c.html : null);
1436
+ },
1437
+ onRenamed: (c, tell) => {
1438
+ try {
1439
+ rekeyUserState(ctx.paths.designRoot, [[c.fromRel, c.toRel]]);
1440
+ } catch {
1441
+ /* a lost pin is not worth failing the rename */
1442
+ }
1443
+ // Open tabs and the selection follow it (server.ts retargets every
1444
+ // member's state on a move); the rescan adopts the new file.
1445
+ ctx.bus.emit('canvas-list-update', {
1446
+ action: 'moved',
1447
+ rel: c.toRel,
1448
+ slug: c.toSlug,
1449
+ fromRel: c.fromRel,
1450
+ fromSlug: c.fromSlug,
1451
+ });
1452
+ if (tell) {
1453
+ const name = (rel: string) => path.posix.basename(rel).replace(/\.tsx$/i, '');
1454
+ const notice = {
1455
+ id: `canvas-renamed-${c.toSlug}`,
1456
+ severity: 'info' as const,
1457
+ text: createRenamedText(name(c.fromRel), name(c.toRel)),
1458
+ };
1459
+ // A boot replay can land before the status store exists: kept until it does.
1460
+ if (statusStore) statusStore.notice?.(notice);
1461
+ else noticesBeforeStore.push(notice);
1462
+ }
1463
+ },
1464
+ ...(opts.createRenameFault ? { fault: opts.createRenameFault } : {}),
1465
+ })
1466
+ : null;
1467
+ const trashWatch = acceptedLink
1468
+ ? createTrashWatch({
1469
+ link: acceptedLink,
1470
+ designRoot: ctx.paths.designRoot,
1471
+ designRel: ctx.paths.designRel,
1472
+ emit: (e, p) => ctx.bus.emit(e, p),
1473
+ log: (line) => console.log(line),
1474
+ })
1475
+ : null;
1113
1476
  /**
1114
1477
  * The project's own group labels and design systems, kept for this copy's
1115
1478
  * config to fill in what it lacks (context.ts `withProjectConfig`) — so a
@@ -1215,10 +1578,24 @@ export function createSyncRuntime(
1215
1578
  let legacyLane: boolean | null = null;
1216
1579
  /** A pass was owed before the lane was decided — run it on the verdict. */
1217
1580
  let legacyBootPush: string | null = null;
1581
+ /**
1582
+ * p8-ia-edges — a hub without a media checkout answers every upload 405. The first refusal ends the pass and closes
1583
+ * this gate (one human message in the Sync panel, via the progress' `refused`); no file change, boot or poll tick
1584
+ * sends another PUT until the server's `/health` signature changes (`tick`, on the 20 s remote poll).
1585
+ */
1586
+ let mediaHubUrl: string | null = null;
1587
+ const mediaGate = createMediaGate({
1588
+ probe: () => (mediaHubUrl ? readServerSignature(mediaHubUrl, hubFetch) : Promise.resolve(null)),
1589
+ onNotice: (n) => {
1590
+ if (n) console.warn(`[sync/assets] ${MEDIA_STAYS_LINE}`);
1591
+ },
1592
+ });
1218
1593
 
1219
1594
  /** Run the legacy push now — single-flight with a trailing re-run. */
1220
1595
  function runLegacyPush(hubUrl: string): void {
1221
1596
  if (stopped || cellPairing || legacyLane !== true) return; // the cell never pushes
1597
+ if (!mediaGate.allowed()) return; // the hub has no media checkout; asks again when the server changes
1598
+ mediaHubUrl = hubUrl;
1222
1599
  if (legacyPushRunning) {
1223
1600
  legacyPushAgain = true;
1224
1601
  return;
@@ -1241,6 +1618,7 @@ export function createSyncRuntime(
1241
1618
  if (!stopped) statusStore?.updateAssets?.(p);
1242
1619
  },
1243
1620
  })
1621
+ .then((res) => mediaGate.noteResult(res))
1244
1622
  .catch(() => {
1245
1623
  /* pushAssets never throws; this is a belt for the promise chain */
1246
1624
  })
@@ -1272,6 +1650,7 @@ export function createSyncRuntime(
1272
1650
  return;
1273
1651
  }
1274
1652
  if (legacyLane === false) return; // the plane owns pushes on this hub
1653
+ if (!mediaGate.allowed()) return; // no media checkout on this hub — see `mediaGate`
1275
1654
  if (legacyPushRunning) {
1276
1655
  legacyPushAgain = true;
1277
1656
  return;
@@ -1508,6 +1887,12 @@ export function createSyncRuntime(
1508
1887
  */
1509
1888
  let filePlane: import('./file-plane.ts').FilePlane | null = null;
1510
1889
  let fileLedger: import('./file-ledger.ts').FileLedger | null = null;
1890
+ /**
1891
+ * S8.19 — tells the hub "this Mac holds these" after a plane pass: the journal file plane never
1892
+ * probes, so without it no hub would ever learn a holder (decision v2-S8.19-plane-feeds-presence).
1893
+ * Built with the plane; never in a cell (a cell IS the hub).
1894
+ */
1895
+ let heldReporter: ReturnType<typeof createHeldReporter> | null = null;
1511
1896
  /** Cumulative files sent up this boot — the doručenka's push half. */
1512
1897
  let filePushed = 0;
1513
1898
  /** Debounce for a plane pass triggered by a local write. */
@@ -1599,6 +1984,9 @@ export function createSyncRuntime(
1599
1984
  const r = await lane.reconcile();
1600
1985
  lastPlaneResult = r;
1601
1986
  planeResultSink?.(r);
1987
+ // S8.19 — the held set rides AFTER the pass (the plane now has a picture of the disk);
1988
+ // single-flight, floored, never throws, and never awaited by the pass's waiters.
1989
+ if (!cellPairing) void heldReporter?.afterPass();
1602
1990
  } catch (err) {
1603
1991
  console.error('[sync/files] pass failed:', err);
1604
1992
  } finally {
@@ -1804,6 +2192,8 @@ export function createSyncRuntime(
1804
2192
  * on every peer. Consulted by the adopt guard in `migrateSeed`.
1805
2193
  */
1806
2194
  let hubDocIndex: ReadonlyMap<string, number> = new Map<string, number>();
2195
+ /** S11.4 — the last listing of this boot, null until the hub has answered once. */
2196
+ let lastListingDocs: readonly HubDocRow[] | null = null;
1807
2197
 
1808
2198
  /**
1809
2199
  * Slugs whose refusal has already asked for a rescan. Once per slug per
@@ -1877,6 +2267,9 @@ export function createSyncRuntime(
1877
2267
  const noteHubListing = (docs: readonly HubDocRow[] | null): void => {
1878
2268
  if (docs === null) return;
1879
2269
  hubDocIndex = indexHubDocs(docs);
2270
+ // S11.4 — the same listing, kept for the availability read model (sync/availability.ts).
2271
+ // Same rule as the index above: a failed listing never clears it.
2272
+ lastListingDocs = docs.filter((d) => typeof d?.name === 'string' && d.name);
1880
2273
  };
1881
2274
 
1882
2275
  /**
@@ -2428,10 +2821,15 @@ export function createSyncRuntime(
2428
2821
  migrateAnnotationsV2({ designRoot: ctx.paths.designRoot });
2429
2822
  }
2430
2823
 
2431
- const scan = opts.canvases ? { canvases: opts.canvases, tsxCount: 0 } : await scanCanvases(ctx);
2824
+ const scan = opts.canvases
2825
+ ? { canvases: opts.canvases, tsxCount: 0 }
2826
+ : await scanCanvases(ctx, scanOpts());
2432
2827
  // DDR-064 pre-cutover A4 + A6 — two files must never share a document, and
2433
2828
  // the pinned set must be bounded. See `admitCanvases`.
2434
- const localCanvases = admitCanvases(scan.canvases, useSharedDoc);
2829
+ const localCanvases = admitCanvases(scan.canvases, useSharedDoc, {
2830
+ docNameOf: docNameFor,
2831
+ onCollisions: reportCollisions,
2832
+ });
2435
2833
 
2436
2834
  // PULL THE REST OF THE PROJECT DOWN.
2437
2835
  //
@@ -2462,9 +2860,14 @@ export function createSyncRuntime(
2462
2860
  // What each canvas's disk was last saved as, when that save was one of
2463
2861
  // these: the base its cold start judges the disk against.
2464
2862
  const own = new Map<string, string>();
2863
+ const drainFrom = Date.now();
2465
2864
  outboxDrained = acceptedLink.client
2466
2865
  .drainOutbox((result, operations) => {
2467
2866
  for (const o of operations) {
2867
+ if (o.op === 'doc.create' && typeof o.doc === 'string') {
2868
+ if (result.status === 'accepted') drainedCreates.add(o.doc);
2869
+ else drainedCreates.delete(o.doc);
2870
+ }
2468
2871
  const html =
2469
2872
  o.op === 'lane.replace' && o.lane === 'html'
2470
2873
  ? o.content
@@ -2479,6 +2882,8 @@ export function createSyncRuntime(
2479
2882
  .then((results) => {
2480
2883
  if (results.length)
2481
2884
  console.log(`[sync/tx] resent ${results.length} unanswered change(s).`);
2885
+ // S6.13b — every rename a previous run left has replayed by now.
2886
+ collisionRenamer?.sweep(drainFrom);
2482
2887
  return own;
2483
2888
  })
2484
2889
  .catch(() => own);
@@ -2525,36 +2930,62 @@ export function createSyncRuntime(
2525
2930
  // sandbox is off, or its canvases sit in a group it never declared — and
2526
2931
  // treating that as "a bare folder somebody just pointed at a project" would
2527
2932
  // let a hub author a `config.json` into a project that had work in it.
2528
- let freshLink =
2529
- localCanvases.length === 0 && !existsSync(designConfigPath(ctx)) && designRootIsBare(ctx);
2933
+ //
2934
+ // A HUB'S OWN STUDIO IS DIFFERENT (p8-hub-folder-boundary, decision
2935
+ // maude/v2-michal-hub-is-the-folder-boundary-before-config). Until the owner
2936
+ // declares canvas folders, the hub's kernel takes ANY folder, so its paired
2937
+ // studio does too — on every boot and for every later pull, not one extra
2938
+ // folder once. `undeclaredGate` holds both answers.
2939
+ const undeclaredGate = createUndeclaredGroupGate(
2940
+ localCanvases.length === 0 && !existsSync(designConfigPath(ctx)) && designRootIsBare(ctx),
2941
+ hubBoundary
2942
+ );
2530
2943
  const learnedGroups = new Set<string>();
2531
2944
  // True once THIS boot wrote the config. Until then an existing file is
2532
2945
  // somebody's own declaration and is never touched; afterwards it is ours to
2533
2946
  // extend as further groups arrive.
2534
2947
  let ownsSeededConfig = false;
2535
2948
  const noteLearnedGroup = (group: string): void => {
2536
- if (!freshLink || learnedGroups.has(group)) return;
2949
+ // Never a runtime folder (`_trash`, `_state`, …) or `node_modules` — the
2950
+ // classifier's folder rule (p8-boundary-harden, attacker L3).
2951
+ if (!isUndeclaredGroupName(group)) return;
2952
+ if (!undeclaredGate.freshLink || learnedGroups.has(group)) return;
2537
2953
  learnedGroups.add(group);
2538
2954
  if (existsSync(designConfigPath(ctx)) && !ownsSeededConfig) return;
2539
- if (seedProjectConfig(ctx, learnedGroups, ownsSeededConfig)) ownsSeededConfig = true;
2955
+ if (
2956
+ seedProjectConfig(
2957
+ ctx,
2958
+ learnedGroups,
2959
+ ownsSeededConfig,
2960
+ // The hub's format as this link knows it (the mirror its /health,
2961
+ // bootstrap or notice wrote) — the pulled project keeps it.
2962
+ projectFormat(formatCtx).value,
2963
+ // a hub's own studio never authors its checkout's config (see seedProjectConfig)
2964
+ { cellPairing: cellPairing !== null }
2965
+ )
2966
+ )
2967
+ ownsSeededConfig = true;
2540
2968
  // ONE GROUP, ONCE. `freshLink` was a `const`, so after the first config
2541
2969
  // was written every FURTHER undeclared group was accepted and appended —
2542
2970
  // the relaxation perpetuating itself instead of closing, and a hub free to
2543
2971
  // plant an unbounded set of directories in a single session. The project
2544
2972
  // has now declared itself; everything after this is checked against that
2545
- // declaration like any other boot.
2546
- freshLink = false;
2547
- pathOpts.allowUndeclaredGroup = false;
2973
+ // declaration like any other boot. (A hub's own studio keeps taking
2974
+ // every folder through `undeclaredGate` — it seeds nothing to close on.)
2975
+ undeclaredGate.closeFreshLink();
2548
2976
  };
2549
2977
  const pathOpts: {
2550
2978
  designRel: string;
2551
2979
  canvasGroups: Context['cfg']['canvasGroups'];
2552
- allowUndeclaredGroup: boolean;
2980
+ readonly allowUndeclaredGroup: boolean;
2553
2981
  onRefused: (slug: string, reason: string) => void;
2554
2982
  } = {
2555
2983
  designRel: ctx.paths.designRel,
2556
2984
  canvasGroups: ctx.cfg.canvasGroups,
2557
- allowUndeclaredGroup: freshLink,
2985
+ // Read at call time — `relocatePulled` reads `pathOpts` when a document arrives.
2986
+ get allowUndeclaredGroup() {
2987
+ return undeclaredGate.accepts();
2988
+ },
2558
2989
  onRefused: (slug: string, reason: string) =>
2559
2990
  console.warn(`[sync/${slug}] ignoring the path this document carries — ${reason}`),
2560
2991
  };
@@ -2709,19 +3140,70 @@ export function createSyncRuntime(
2709
3140
  // state to preserve, and one is exactly what a first canvas needs. The
2710
3141
  // supervisor owns cycling (it holds the serialization), so this asks
2711
3142
  // rather than acts — see `server.ts`.
3143
+ // One ask per runtime: the supervisor's cycle replaces this runtime, and a
3144
+ // second ask while it does would only queue a second, pointless cycle.
3145
+ let askedForCycle = false;
3146
+ const askForCycle = (why: string): void => {
3147
+ if (askedForCycle || stopped) return;
3148
+ askedForCycle = true;
3149
+ console.log(`[sync] ${why} — starting sync.`);
3150
+ ctx.bus.emit('sync:needs-restart');
3151
+ };
2712
3152
  const watchForFirst = createRescanScheduler({
2713
3153
  debounceMs: DISCOVERY_DEBOUNCE_MS,
2714
3154
  onError: (err) => console.error('[sync] first-canvas watch failed:', err),
2715
3155
  run: async () => {
2716
3156
  if (stopped || opts.canvases) return;
2717
- const again = await scanCanvases(ctx);
2718
- if (admitCanvases(again.canvases, useSharedDoc).length === 0) return;
2719
- console.log('[sync] the project has its first syncable canvas — starting sync.');
2720
- ctx.bus.emit('sync:needs-restart');
3157
+ const again = await scanCanvases(ctx, scanOpts());
3158
+ if (admitCanvases(again.canvases, useSharedDoc, { docNameOf: docNameFor }).length === 0)
3159
+ return;
3160
+ askForCycle('the project has its first syncable canvas');
2721
3161
  },
2722
3162
  });
2723
3163
  discoveryRescan = watchForFirst;
2724
3164
  discoveryUnsub = ctx.bus.on('canvas-list-update', () => watchForFirst.schedule());
3165
+ // THE OTHER HALF: A TEAMMATE'S FIRST CANVAS (p8-fix-c2 #1). The watch above
3166
+ // reads this disk only, so a copy that booted onto a project with no canvas
3167
+ // anywhere never asked the hub again — a teammate's first canvas (or the
3168
+ // cloud's, or a desktop's for a cell that booted empty) reached it only on a
3169
+ // restart. So the hub is asked on the same 20 s poll (and on the control
3170
+ // channel's documents-changed doorbell) a running copy uses, and a document
3171
+ // it did not list at boot asks for the same cycle.
3172
+ //
3173
+ // ONLY A NEW NAME. What the hub listed at boot was offered to this boot's
3174
+ // pull and refused (the sandbox gate, an opt-out, a bad path) — it is still
3175
+ // refused after a cycle, and cycling on it again would restart the runtime
3176
+ // every poll. A deleted canvas (tombstoned) is not a canvas either.
3177
+ if (!opts.canvases) {
3178
+ const offeredAtBoot = new Set((remoteListing?.documents ?? []).map((d) => d.name));
3179
+ const pollForFirst = async (): Promise<void> => {
3180
+ if (stopped || askedForCycle) return;
3181
+ const raw = await fetchRemoteListing(linkedHub.url, token);
3182
+ if (acceptedLink) await acceptedLink.refresh().catch(() => null);
3183
+ const listing = withAcceptedDocs(raw);
3184
+ if (stopped || listing === null) return;
3185
+ const gone = new Set(
3186
+ (listing.tombstones ?? []).map((t) => t.name).concat([...tombstoned].map(docNameFor))
3187
+ );
3188
+ const fresh = diffRemoteDocs([], listing.documents).hubOnly.filter(
3189
+ (d) => !offeredAtBoot.has(d.name) && !gone.has(d.name)
3190
+ );
3191
+ if (fresh.length === 0) return;
3192
+ askForCycle(`the project's first canvas arrived from the hub (${fresh[0]?.name})`);
3193
+ };
3194
+ remotePull = pollForFirst;
3195
+ documentDiscoveryUnsub = ctx.bus.on('sync:documents-changed', () => {
3196
+ void pollForFirst().catch((err) =>
3197
+ console.error('[sync] first-canvas poll failed:', err)
3198
+ );
3199
+ });
3200
+ remotePollTimer = setInterval(() => {
3201
+ void pollForFirst().catch((err) =>
3202
+ console.error('[sync] first-canvas poll failed:', err)
3203
+ );
3204
+ }, REMOTE_POLL_MS);
3205
+ remotePollTimer.unref?.();
3206
+ }
2725
3207
  return;
2726
3208
  }
2727
3209
 
@@ -2741,6 +3223,7 @@ export function createSyncRuntime(
2741
3223
  },
2742
3224
  broadcast: (payload) => ctx.bus.emit('sync:status', payload),
2743
3225
  });
3226
+ for (const n of noticesBeforeStore.splice(0)) statusStore.notice?.(n);
2744
3227
  const store = statusStore;
2745
3228
  // An unfinished AI action restored from the last session (T16).
2746
3229
  const restoredStage = acceptedLink?.stage.summary();
@@ -2812,6 +3295,9 @@ export function createSyncRuntime(
2812
3295
  return undefined;
2813
3296
  };
2814
3297
  const unsubSuppress = ctx.bus.on('activity:suppress', (rel: unknown) => {
3298
+ // p8-a1-claims — a route an AI verb called (X-Maude-Chat) is not the person's UI edit: the write
3299
+ // stays stageable, and `source-written` below claims its bytes for the run
3300
+ if (currentWriteClaim()) return;
2815
3301
  if (acceptedOn()) projectionForRel(rel)?.noteLocalWrite();
2816
3302
  });
2817
3303
  // T24 — the UI operation behind that write (sync/source-ops).
@@ -2828,6 +3314,22 @@ export function createSyncRuntime(
2828
3314
  if (!acceptedOn() || typeof p?.content !== 'string') return;
2829
3315
  const proj = projectionForRel(p.rel);
2830
3316
  if (!proj) return;
3317
+ // p8-a1-claims — claimed for the AI run BEFORE the projection proposes these bytes
3318
+ const run = currentWriteClaim();
3319
+ if (run && typeof p.rel === 'string') {
3320
+ const posix = p.rel.replace(/\\/g, '/').replace(/^\/+/, '');
3321
+ const repoRel = `${ctx.paths.designRel}/${posix}`;
3322
+ const slug = slugForRepoRel(repoRel);
3323
+ if (slug && acceptedLink) {
3324
+ acceptedLink.stage.begin(`run:${run.runId}`, run.label, {
3325
+ runId: run.runId,
3326
+ chatId: run.chatId,
3327
+ claimOnly: true,
3328
+ });
3329
+ acceptedLink.stage.claim(run.runId, slug, claimHashOf(repoRel, p.content));
3330
+ }
3331
+ recordClaim(run.chatId, posix);
3332
+ }
2831
3333
  proj.applyFromFs({
2832
3334
  path: path.join(ctx.paths.designRoot, p.rel as string),
2833
3335
  bytes: new TextEncoder().encode(p.content),
@@ -3091,6 +3593,17 @@ export function createSyncRuntime(
3091
3593
  return renewInFlight;
3092
3594
  };
3093
3595
 
3596
+ /**
3597
+ * S9.21b (V2-1.7 §5.6) — the hub's access notices, heard on every canvas doc socket: passed
3598
+ * to the shell ONCE (each socket carries its own copy), rebuilt key by key (sync/access-notices.ts),
3599
+ * on `access:notice` (ws.ts → the shell's inspector socket only, never the canvas iframe). A
3600
+ * `raised` re-exchanges the credential first, so the shell's re-read sees the new role.
3601
+ */
3602
+ const hearAccess = createAccessRelay({
3603
+ onFrame: (frame) => ctx.bus.emit('access:notice', frame),
3604
+ onRaised: () => renewCredentialNow(),
3605
+ });
3606
+
3094
3607
  /**
3095
3608
  * Arm the pre-expiry renewal at ~80 % of the credential's REMAINING life
3096
3609
  * (never sooner than a minute out). No stored expiry — a self-hosted hub,
@@ -3246,6 +3759,50 @@ export function createSyncRuntime(
3246
3759
  }
3247
3760
  };
3248
3761
 
3762
+ /**
3763
+ * S6.13 — a canvas made here that the project does not list yet is
3764
+ * proposed AT ONCE, before its document's handshake: offline that
3765
+ * handshake waits for the network, and ⌘N must still be a content-lane
3766
+ * write (V2-1.14 §8 "S6") — durable, ordered, and the watermark a prompt
3767
+ * queued behind it waits for. Its cold start then reuses this answer
3768
+ * instead of creating the canvas a second time.
3769
+ */
3770
+ const earlyCreates = new Map<string, { html: string; answer: Promise<StructuralOutcome> }>();
3771
+ const proposeEarlyCreate = (canvas: CanvasDescriptor): void => {
3772
+ if (!acceptedOn() || !acceptedLink || pulledSlugs.has(canvas.slug) || !canvas.html) return;
3773
+ if (earlyCreates.has(canvas.slug)) return;
3774
+ const docName = docNameFor(canvas.slug);
3775
+ if (acceptedLink.manifest?.docs.some((d) => d.doc === docName && !d.retired)) return;
3776
+ if (renamedCreates.has(docName)) return;
3777
+ let html: string;
3778
+ try {
3779
+ html = readFileSync(canvas.html, 'utf8');
3780
+ } catch {
3781
+ return;
3782
+ }
3783
+ const rel = path.relative(ctx.paths.designRoot, canvas.html).split(path.sep).join('/');
3784
+ const lanes = localCreateLanes(
3785
+ {
3786
+ html: canvas.html,
3787
+ comments: canvas.comments,
3788
+ annotations: canvas.annotations,
3789
+ meta: canvas.meta,
3790
+ css: canvas.css,
3791
+ },
3792
+ html
3793
+ );
3794
+ const answer = acceptedLink
3795
+ .createDoc(canvas.slug, rel, lanes)
3796
+ .then(notOursIfRenamed(docName))
3797
+ .catch(
3798
+ (err): StructuralOutcome => ({
3799
+ status: 'rejected',
3800
+ code: (err as { code?: string })?.code ?? 'failed',
3801
+ })
3802
+ );
3803
+ earlyCreates.set(canvas.slug, { html, answer });
3804
+ };
3805
+
3249
3806
  /** Post-handshake reconcile — shared by first connect and re-probe. */
3250
3807
  const handleSynced = async (
3251
3808
  canvas: CanvasDescriptor,
@@ -3316,18 +3873,45 @@ export function createSyncRuntime(
3316
3873
  const agent = agents.get(canvas.slug);
3317
3874
  if (projection && acceptedOn() && acceptedLink) {
3318
3875
  const docName = docNameFor(canvas.slug);
3319
- let inProject = acceptedLink.manifest?.docs.some((d) => d.doc === docName && !d.retired);
3320
- if (!inProject) {
3876
+ // S6.13 — the create this run already proposed (offline ⌘N) is THE
3877
+ // create: wait for its answer.
3878
+ const early = earlyCreates.get(canvas.slug);
3879
+ earlyCreates.delete(canvas.slug);
3880
+ const earlyAnswer = early ? await early.answer : null;
3881
+ // A save a previous run left unanswered is answered first: a disk
3882
+ // edited after it was edited ON it (F3 S14 on the cloud cell — judged
3883
+ // against the older base, the save conflicted with itself). Awaited
3884
+ // BEFORE asking whether the canvas is in the project: a create that
3885
+ // previous run left (S6.13) has made it a member by now.
3886
+ const drained = await outboxDrained;
3887
+ const ownAccepted = drained.get(docName) ?? null;
3888
+ // S6.13b — a canvas this Mac renamed because its name was taken joins
3889
+ // as that renamed create did.
3890
+ const renamed = renamedCreates.get(docName);
3891
+ const renamedHtml = renamed ? await renamed : null;
3892
+ renamedCreates.delete(docName);
3893
+ // A canvas THIS MAC created (now, or in the run the drain finished)
3894
+ // joins exactly as its own create did — never reconciled against a
3895
+ // replica that may not hold that publication yet, and never created
3896
+ // a second time. What the project holds is what the create carried
3897
+ // (or the newest save of it the drain had accepted).
3898
+ const createdHere =
3899
+ early && earlyAnswer?.status === 'accepted'
3900
+ ? early.html
3901
+ : drainedCreates.has(docName)
3902
+ ? ownAccepted
3903
+ : renamedHtml;
3904
+ drainedCreates.delete(docName);
3905
+ let inProject =
3906
+ createdHere === null &&
3907
+ acceptedLink.manifest?.docs.some((d) => d.doc === docName && !d.retired);
3908
+ if (createdHere === null && !inProject) {
3321
3909
  // A canvas adopted after boot: ask again before creating anything.
3322
3910
  await acceptedLink.refresh();
3323
3911
  inProject = acceptedLink.manifest?.docs.some((d) => d.doc === docName && !d.retired);
3324
3912
  }
3325
3913
  const rel = path.relative(ctx.paths.designRoot, canvas.html).split(path.sep).join('/');
3326
- // A save a previous run left unanswered is answered first: a disk
3327
- // edited after it was edited ON it (F3 S14 on the cloud cell — judged
3328
- // against the older base, the save conflicted with itself).
3329
- const ownAccepted = (await outboxDrained).get(docName) ?? null;
3330
- await acceptedColdStart({
3914
+ const coldStart: Parameters<typeof acceptedColdStart>[0] = {
3331
3915
  slug: canvas.slug,
3332
3916
  doc: provider.document,
3333
3917
  paths: canvasPaths,
@@ -3339,8 +3923,19 @@ export function createSyncRuntime(
3339
3923
  commentLedger: commentLedgerFor(ctx.paths.designRoot),
3340
3924
  ownAccepted,
3341
3925
  wasAccepted: (content) => acceptedLink.client.holdsValue(content),
3342
- createDoc: (lanes) => acceptedLink.createDoc(canvas.slug, rel, lanes),
3343
- });
3926
+ createDoc:
3927
+ createdHere !== null
3928
+ ? async () => ({ status: 'accepted' as const, html: createdHere })
3929
+ : (lanes) =>
3930
+ acceptedLink.createDoc(canvas.slug, rel, lanes).then(notOursIfRenamed(docName)),
3931
+ };
3932
+ let joined = await acceptedColdStart(coldStart);
3933
+ if (joined.kind === 'create-refused' && joined.code === 'renamed') {
3934
+ // S6.13b — this Mac's canvas moved to a free name while its create
3935
+ // waited; what stays at this path is the peer's canvas.
3936
+ joined = await acceptedColdStart({ ...coldStart, inProject: true });
3937
+ }
3938
+ renamedAway.delete(docName);
3344
3939
  projection.reconcile();
3345
3940
  } else if (projection) {
3346
3941
  // Phase E (DDR-064 Task 9) — one-time authoritative seed BEFORE
@@ -3632,7 +4227,7 @@ export function createSyncRuntime(
3632
4227
  realpath: realpathOfDeepestExisting,
3633
4228
  // The fresh-link relaxation is boot-only, per canvas — see
3634
4229
  // `strictPullSlugs` for why reading `pathOpts` alone is not enough.
3635
- allowUndeclaredGroup: pathOpts.allowUndeclaredGroup && !strictPullSlugs.has(canvas.slug),
4230
+ allowUndeclaredGroup: undeclaredGate.accepts({ strict: strictPullSlugs.has(canvas.slug) }),
3636
4231
  onRefused: (reason) => pathOpts.onRefused(canvas.slug, reason),
3637
4232
  });
3638
4233
  // A DOCUMENT WHOSE PATH WAS REFUSED IS NOT A DOCUMENT TO WRITE SOMEWHERE
@@ -4027,6 +4622,10 @@ export function createSyncRuntime(
4027
4622
  } catch {
4028
4623
  return;
4029
4624
  }
4625
+ if (msg?.type === 'maude.access' || msg?.type === 'maude.access-request') {
4626
+ hearAccess(payload);
4627
+ return;
4628
+ }
4030
4629
  if (msg?.type !== 'maude.mode') return;
4031
4630
  const fv = formatFromHub(msg);
4032
4631
  if (fv !== null)
@@ -4235,8 +4834,11 @@ export function createSyncRuntime(
4235
4834
  // An explicit canvas list (test injection) means the caller owns
4236
4835
  // membership; rescanning would silently overrule them.
4237
4836
  if (opts.canvases) return;
4238
- const fresh = await scanCanvases(ctx);
4239
- const admitted = admitCanvases(fresh.canvases, useSharedDoc);
4837
+ const fresh = await scanCanvases(ctx, scanOpts());
4838
+ const admitted = admitCanvases(fresh.canvases, useSharedDoc, {
4839
+ docNameOf: docNameFor,
4840
+ onCollisions: reportCollisions,
4841
+ });
4240
4842
  const bySlug = new Map(admitted.map((c) => [c.slug, c]));
4241
4843
  // THE PULL PIN IS A RACE GUARD, NOT A PERMANENT EXEMPTION.
4242
4844
  //
@@ -4258,10 +4860,16 @@ export function createSyncRuntime(
4258
4860
  // the canvas ("source sync blocked (local-edit)" on a fresh copy).
4259
4861
  if (body && existsSync(body) && bySlug.has(slug)) pulledSlugs.delete(slug);
4260
4862
  }
4863
+ // S6.13b — the same race guard for a path this Mac's canvas just moved
4864
+ // away from: the peer's canvas is written there after its cold start.
4865
+ for (const slug of [...vacated]) {
4866
+ const body = descriptors.get(slug)?.html;
4867
+ if (body && existsSync(body) && bySlug.has(slug)) vacated.delete(slug);
4868
+ }
4261
4869
  const { added, removed } = diffCanvasSet(
4262
4870
  [...agents.keys(), ...projections.keys()],
4263
4871
  bySlug.keys(),
4264
- pulledSlugs
4872
+ [...pulledSlugs, ...vacated]
4265
4873
  );
4266
4874
  if (added.length === 0 && removed.length === 0) return;
4267
4875
  if (removed.length > 0) {
@@ -4274,9 +4882,20 @@ export function createSyncRuntime(
4274
4882
  markUntrusted();
4275
4883
  }
4276
4884
  const incoming = added.map((slug) => bySlug.get(slug)).filter((c) => !!c);
4885
+ // S6.13 — only a project that does not answer gets its creates now;
4886
+ // one that answers creates them on the handshake, as it always has.
4887
+ const offline =
4888
+ incoming.length > 0 && acceptedOn() && acceptedLink
4889
+ ? (await Promise.race([
4890
+ acceptedLink.refresh(),
4891
+ new Promise<undefined>((r) => setTimeout(r, EARLY_CREATE_PROBE_MS)),
4892
+ ])) == null
4893
+ : false;
4277
4894
  for (const canvas of incoming) {
4278
4895
  if (agents.has(canvas.slug) || projections.has(canvas.slug)) continue;
4279
4896
  if (providers.has(canvas.slug)) continue;
4897
+ // Before the attach: offline, its handshake waits for the network.
4898
+ if (offline) proposeEarlyCreate(canvas);
4280
4899
  await attachCanvas(canvas, false);
4281
4900
  }
4282
4901
  if (incoming.length > 0) {
@@ -4430,6 +5049,10 @@ export function createSyncRuntime(
4430
5049
  if (acceptedLink) {
4431
5050
  await acceptedLink.refresh();
4432
5051
  if (acceptedOn()) applyProjectDirs(acceptedLink.manifest?.dirs ?? []);
5052
+ // S1.7b — someone else's delete / restore / clear-out reaches this
5053
+ // Mac's Trash view, and a clear-out removes this Mac's copies.
5054
+ if (acceptedOn() && acceptedLink.manifest)
5055
+ void trashWatch?.noteRevision(acceptedLink.manifest.revision);
4433
5056
  }
4434
5057
  const listing = withAcceptedDocs(rawListing);
4435
5058
  // null = unreachable, refused, or a hub without the route. Not an error
@@ -4441,6 +5064,17 @@ export function createSyncRuntime(
4441
5064
  // immediately pulled back — the resurrection this lane exists to end,
4442
5065
  // reintroduced inside one tick.
4443
5066
  await applyTombstones(listing.tombstones);
5067
+ // S1.7b — a canvas restored from the Trash (or a ⌘Z of its delete) is
5068
+ // live in the accepted manifest again and its tombstone is gone: this
5069
+ // run's memory of the delete must not keep it from coming back.
5070
+ if (acceptedOn() && acceptedLink?.manifest && tombstoned.size) {
5071
+ const stoned = new Set(listing.tombstones.map((t) => t.name));
5072
+ for (const d of acceptedLink.manifest.docs) {
5073
+ if (d.retired || stoned.has(d.doc)) continue;
5074
+ const slug = slugFromDocName(d.doc);
5075
+ if (slug) tombstoned.delete(slug);
5076
+ }
5077
+ }
4444
5078
  noteHubListing(listing.documents);
4445
5079
  const diff = diffRemoteDocs(
4446
5080
  [...descriptors.keys()].map((slug) => docNameFor(slug)),
@@ -4456,7 +5090,8 @@ export function createSyncRuntime(
4456
5090
  {
4457
5091
  ...pathOpts,
4458
5092
  // NEVER the fresh-link relaxation after boot. See `strictPullSlugs`.
4459
- allowUndeclaredGroup: false,
5093
+ // (A hub's own studio still takes every folder its kernel takes.)
5094
+ allowUndeclaredGroup: undeclaredGate.accepts({ strict: true }),
4460
5095
  realpath: realpathOfDeepestExisting,
4461
5096
  pathFor: manifestPathFor,
4462
5097
  }
@@ -4608,7 +5243,11 @@ export function createSyncRuntime(
4608
5243
  fileTotals.synced = result.skipped + result.pulled.length;
4609
5244
  fileTotals.pulled += result.pulled.length;
4610
5245
  fileTotals.conflicts += result.conflicts.length;
4611
- statusStore?.updateFiles?.({ ...fileTotals });
5246
+ // A journal-less hub's pass is the whole comparison there: say so, once the lane is decided.
5247
+ statusStore?.updateFiles?.({
5248
+ ...fileTotals,
5249
+ ...(legacyLane === true ? { lane: 'v1' as const } : {}),
5250
+ });
4612
5251
  };
4613
5252
  /**
4614
5253
  * The v2 pass's counts, PLUS the doručenka.
@@ -4628,35 +5267,7 @@ export function createSyncRuntime(
4628
5267
  // `console.warn` in a process log, and DDR-177's premise is that the
4629
5268
  // target user never opens a terminal — so a control whose only output
4630
5269
  // is a log line is a control nobody can act on.
4631
- const held: NonNullable<import('./status.ts').FilePlaneStatus['held']> = [];
4632
- if (result.deleteHeld) {
4633
- held.push({
4634
- kind: result.deleteHeld.direction === 'out' ? 'delete-out' : 'delete-in',
4635
- count: result.deleteHeld.count,
4636
- paths: result.deleteHeld.paths,
4637
- detail:
4638
- result.deleteHeld.direction === 'out'
4639
- ? `${result.deleteHeld.count} files are gone from this machine — more than sync will remove from the project without you saying so. Nothing was deleted anywhere else. Set linkedHub.propagateDeletes: false to stop asking, or delete them again once you have confirmed this was deliberate.`
4640
- : `The project wants to remove ${result.deleteHeld.count} files here — more than sync will delete without you saying so. Nothing was removed. They stay until you accept or the project puts them back.`,
4641
- });
4642
- }
4643
- if (result.firstAnchorHeld) {
4644
- held.push({
4645
- kind: 'first-anchor',
4646
- count: result.firstAnchorHeld.count,
4647
- paths: result.firstAnchorHeld.paths,
4648
- detail: `${result.firstAnchorHeld.count} files differ between this machine and the project, and neither copy has been reconciled here yet. Set linkedHub.resolveFirstAnchor to "keep-local" or "keep-cloud" to settle the whole set at once.`,
4649
- });
4650
- }
4651
- if (result.reanchorHeld) {
4652
- held.push({
4653
- kind: 'reanchor',
4654
- count: 0,
4655
- paths: [],
4656
- detail:
4657
- 'The project has asked to start over repeatedly, which is what a broken or hostile hub looks like. Nothing was overwritten. Sync retries by itself; if this persists, the hub needs looking at.',
4658
- });
4659
- }
5270
+ const held = filePlaneHeld(result);
4660
5271
  // THE DENOMINATOR, from the LEDGER — not from this pass.
4661
5272
  //
4662
5273
  // `fileTotals` below is derived from per-pass results, and a pass that
@@ -4783,6 +5394,13 @@ export function createSyncRuntime(
4783
5394
  documentDiscoveryUnsub = ctx.bus.on('sync:documents-changed', () => discovery.schedule());
4784
5395
  const pollRemote = (): void => {
4785
5396
  if (parkedNow) return;
5397
+ // p8-ia-edges — a hub that could not store media gets one look per tick; a changed server reopens the lane.
5398
+ void mediaGate
5399
+ .tick()
5400
+ .then((reopened) => {
5401
+ if (reopened && mediaHubUrl && !stopped) scheduleLegacyPush(mediaHubUrl);
5402
+ })
5403
+ .catch(() => {});
4786
5404
  void discovery
4787
5405
  .flush()
4788
5406
  .then(() => pullFilesOnce())
@@ -5154,6 +5772,8 @@ export function createSyncRuntime(
5154
5772
  renewalsSinceProgress = 0;
5155
5773
  lastFileProgressAt = Date.now();
5156
5774
  },
5775
+ // S10.3b — a delivered file is a PEER's change (the DS outside watcher's `peer`).
5776
+ onDelivered: (rel) => ctx.bus.emit('file-plane:delivered', { rel }),
5157
5777
  ledger: fileLedger,
5158
5778
  canvasGroups: ctx.cfg.canvasGroups,
5159
5779
  allowCodeModules,
@@ -5176,6 +5796,13 @@ export function createSyncRuntime(
5176
5796
  // resolves.
5177
5797
  label: hostname().slice(0, 32),
5178
5798
  });
5799
+ // S8.19 — the plane's held report (`/_asset-probe` held + sweep.final). This block
5800
+ // is already `!cellPairing`; the token is read per send (silent renewal).
5801
+ heldReporter = createHeldReporter({
5802
+ designRoot: ctx.paths.designRoot,
5803
+ canvasGroups: ctx.cfg.canvasGroups,
5804
+ send: (rels) => reportHeld({ fetchImpl: hubFetch, base: linkedHub.url, token, rels }),
5805
+ });
5179
5806
  console.log(
5180
5807
  '[sync/files] journal file plane active — one lane, both directions, per-file delivery state in the Sync panel.'
5181
5808
  );
@@ -5191,6 +5818,8 @@ export function createSyncRuntime(
5191
5818
  url: linkedHub.url,
5192
5819
  token,
5193
5820
  onDocuments: () => documentDiscovery?.schedule(),
5821
+ // S5.3 — server.ts forwards it to the AI run registry (`registry.poke`).
5822
+ onRuns: (seq) => ctx.bus.emit('hub:runs', { seq }),
5194
5823
  onPoke: () => {
5195
5824
  // Reuses `pollRemoteSoon` rather than calling the file lanes
5196
5825
  // directly, for two reasons: it already coalesces a burst into
@@ -5246,6 +5875,7 @@ export function createSyncRuntime(
5246
5875
  fileLedger?.stop();
5247
5876
  fileLedger = null;
5248
5877
  filePlane = null;
5878
+ heldReporter = null;
5249
5879
  // The control channel is a doorbell into this runtime; it goes with it.
5250
5880
  // Reported on the way out so the poke-miss question is answerable from a
5251
5881
  // session's log rather than from a hunch (DDR-226 §10).
@@ -5396,6 +6026,17 @@ export function createSyncRuntime(
5396
6026
  return next;
5397
6027
  }
5398
6028
 
6029
+ /**
6030
+ * S1.12b — does the linked hub take this op? It lists its ops in
6031
+ * `bootstrap.capabilities.operations` (S1-trash.md §3); an older hub's list
6032
+ * lacks the S1.6 ones. No list at all: unknown, so the kernel decides.
6033
+ */
6034
+ function hubOffers(op: string): boolean {
6035
+ const ops = (acceptedLink?.manifest as { capabilities?: { operations?: unknown } } | null)
6036
+ ?.capabilities?.operations;
6037
+ return !Array.isArray(ops) || ops.includes(op);
6038
+ }
6039
+
5399
6040
  return {
5400
6041
  start,
5401
6042
  stop,
@@ -5426,12 +6067,56 @@ export function createSyncRuntime(
5426
6067
  size: () => agents.size + projections.size,
5427
6068
  agentFor: (slug) => agents.get(slug),
5428
6069
  status: () => statusStore?.get() ?? null,
6070
+ // S11.4 — a READ of state the pull lane already holds; never fetches, never schedules a pull.
6071
+ availability: () => ({
6072
+ listing: lastListingDocs,
6073
+ gone: new Set([...tombstoned, ...retiredDocs, ...refusedPulls.keys()]),
6074
+ docNameFor: (slug: string) => docNameFor(slug),
6075
+ relFor: (docName: string, slug: string) =>
6076
+ resolveCanvasBodyRel({
6077
+ path: manifestPathFor(docName, slug),
6078
+ slug,
6079
+ designRel: ctx.paths.designRel,
6080
+ canvasGroups: ctx.cfg.canvasGroups,
6081
+ }),
6082
+ state: statusStore?.get()?.state ?? null,
6083
+ }),
6084
+ // S8.19 — presence (§5.4) through the same transport every hub call uses; a cell has no peer
6085
+ // hub, and a stopped runtime asks nothing (the service then reads "Not here yet").
6086
+ assetPresenceAsker: () => {
6087
+ if (cellPairing || stopped) return null;
6088
+ return {
6089
+ ask: (rels) => askHubPresence({ fetchImpl: hubFetch, base: linkedHub.url, token, rels }),
6090
+ };
6091
+ },
6092
+ assetUploading: () => {
6093
+ if (cellPairing) return null;
6094
+ const out = fileLedger ? uploadingFromRows(fileLedger.rows()) : new Map();
6095
+ // The legacy sweep (a journal-less hub): the one file on the wire right now.
6096
+ const active = legacyPushRunning ? statusStore?.get()?.assets?.active : null;
6097
+ if (active) out.set(active, {});
6098
+ return out;
6099
+ },
5429
6100
  cancelAssetSweep: () => {
5430
6101
  if (!legacyPushRunning) return false;
5431
6102
  legacyPushCancel = true;
5432
6103
  return true;
5433
6104
  },
5434
6105
  retireForMove: (fromSlug, toRel) => serializeMembership(() => retireForMove(fromSlug, toRel)),
6106
+ commentDoor: cellPairing
6107
+ ? () => null
6108
+ : createCommentDoor({
6109
+ hubUrl: linkedHub.url,
6110
+ token: () => token,
6111
+ docNameFor: (slug) => docNameFor(slug),
6112
+ // the stored claim (re-read: a role change rewrites hubs.json) and the project's own
6113
+ // word at its last bootstrap — either one saying "no edit" sends the comment to the door
6114
+ canEdit: (canvas) =>
6115
+ acceptedLink?.manifest?.you?.readOnly !== true &&
6116
+ resolveAccess(accessFor(linkedHub.url)).can('edit', canvas),
6117
+ carries: (slug) => providers.has(slug),
6118
+ fetchImpl: hubFetch,
6119
+ }),
5435
6120
  proposeLane: (slug, lane, text, o) => {
5436
6121
  if (!acceptedOn()) return null;
5437
6122
  const projection = projections.get(slug);
@@ -5442,10 +6127,105 @@ export function createSyncRuntime(
5442
6127
  return projection.proposeLane(lane, value, {
5443
6128
  ...(base !== undefined && base !== null ? { baseContent: base } : {}),
5444
6129
  ...(o?.writeId ? { writeId: o.writeId } : {}),
6130
+ ...(o?.stageable === true ? { stageable: true } : {}),
5445
6131
  });
5446
6132
  },
6133
+ proposeLanes: (slug, lanes, o) => {
6134
+ if (!acceptedOn() || !acceptedLink) return null;
6135
+ if (!projections.has(slug)) return null;
6136
+ const out: Array<{
6137
+ lane: 'comments' | 'annotations' | 'meta' | 'html';
6138
+ content: string;
6139
+ baseContent: string;
6140
+ }> = [];
6141
+ for (const l of lanes) {
6142
+ const content = laneValueFromFile(l.lane, l.text);
6143
+ const baseContent = laneValueFromFile(l.lane, l.baseText);
6144
+ if (content === null || baseContent === null) return null;
6145
+ out.push({ lane: l.lane, content, baseContent });
6146
+ }
6147
+ // p8-fix-c2 #2 — THE SOURCE LANE BELONGS TO ITS PROJECTION, even inside a larger action.
6148
+ // Sent straight to the link, the projection knew nothing of it: the route's own write of
6149
+ // those bytes (`source-written`) was proposed AGAIN as a file edit, and when the hub refused
6150
+ // an action the route had long answered "queued" (an offline trash, somebody else's edit
6151
+ // first) nobody heard — the held conflict appeared only because the duplicate was refused
6152
+ // too. Through `proposeVia` the action goes out ONCE, under the projection's transaction id;
6153
+ // its file write is an echo of a pending value; and its answer settles there like any of
6154
+ // the projection's own: refused → held, both versions kept, whenever that answer comes.
6155
+ const html = out.find((l) => l.lane === 'html');
6156
+ const projection = html ? projections.get(slug) : undefined;
6157
+ const link = acceptedLink;
6158
+ const send = (tx?: { transactionId: string; dependsOn?: string[] }) =>
6159
+ link.lanesEdit(slug, out, {
6160
+ ...o,
6161
+ ...(tx?.transactionId ? { transactionId: tx.transactionId } : {}),
6162
+ // A dependency an AI run still holds is not on the hub yet; the action never waited
6163
+ // behind a run before, and does not start here.
6164
+ ...(tx?.dependsOn?.length && !link.stage.holdsDependency(tx.dependsOn)
6165
+ ? { dependsOn: tx.dependsOn }
6166
+ : {}),
6167
+ });
6168
+ const answer =
6169
+ (html && projection?.proposeVia('html', html.content, html.baseContent, send)) || send();
6170
+ return answer.then((r) => ({
6171
+ status: r.status,
6172
+ ...(r.code ? { code: r.code } : {}),
6173
+ ...(r.actionId ? { actionId: r.actionId } : {}),
6174
+ }));
6175
+ },
6176
+ proposeFiles: async (files, action) => {
6177
+ if (!acceptedOn() || !acceptedLink) return null;
6178
+ const link = acceptedLink;
6179
+ const edits: Array<{
6180
+ slug: string;
6181
+ lane: 'html' | 'meta' | 'annotations';
6182
+ content: string;
6183
+ baseContent: string;
6184
+ }> = [];
6185
+ const seen = new Set<string>();
6186
+ for (const f of files) {
6187
+ const clean = String(f?.rel ?? '')
6188
+ .replace(/\\/g, '/')
6189
+ .replace(/^\/+/, '');
6190
+ if (!clean || clean.split('/').some((s) => s === '..') || typeof f.text !== 'string')
6191
+ return { status: 'rejected', code: 'invalid' };
6192
+ const abs = path.join(ctx.paths.designRoot, clean);
6193
+ let hit: { slug: string; lane: 'html' | 'meta' | 'annotations' } | null = null;
6194
+ for (const [slug, d] of descriptors) {
6195
+ if (d.html === abs) hit = { slug, lane: 'html' };
6196
+ else if (d.meta === abs) hit = { slug, lane: 'meta' };
6197
+ else if (d.annotations === abs) hit = { slug, lane: 'annotations' };
6198
+ if (hit) break;
6199
+ }
6200
+ const projection = hit ? projections.get(hit.slug) : undefined;
6201
+ if (!hit || !projection) return { status: 'rejected', code: 'unknown-canvas' };
6202
+ const key = `${hit.slug}\0${hit.lane}`;
6203
+ if (seen.has(key)) return { status: 'rejected', code: 'invalid' };
6204
+ seen.add(key);
6205
+ const content = laneValueFromFile(hit.lane, f.text);
6206
+ if (content === null) return { status: 'rejected', code: 'invalid' };
6207
+ const baseContent = projection.agreedLane(hit.lane);
6208
+ if (content === baseContent) continue;
6209
+ edits.push({ ...hit, content, baseContent });
6210
+ }
6211
+ if (!edits.length) return { status: 'accepted' };
6212
+ const r = await link.docsEdit(edits, {
6213
+ kind: action.kind,
6214
+ label: action.label ?? 'Edit canvases',
6215
+ });
6216
+ if (r.status === 'accepted')
6217
+ await Promise.all(
6218
+ edits.map((e) => projections.get(e.slug)?.settleLane(e.lane, e.content) ?? true)
6219
+ );
6220
+ return {
6221
+ status: r.status,
6222
+ ...(r.code ? { code: r.code } : {}),
6223
+ ...(r.actionId ? { actionId: r.actionId } : {}),
6224
+ };
6225
+ },
5447
6226
  proposeFolder,
5448
6227
  acceptedMode: acceptedOn,
6228
+ acceptedModeKnown: () => (acceptedLink ? acceptedLink.mode !== 'unknown' : true),
5449
6229
  commentsConfirmedOnHub: (slug) => {
5450
6230
  // The canvas must be live on the hub right now: a provider that has
5451
6231
  // synced. In accepted mode its doc is the accepted replica (local writes
@@ -5474,18 +6254,24 @@ export function createSyncRuntime(
5474
6254
  entry = manifest.docs.find((d) => d.doc === doc)?.entry ?? null;
5475
6255
  if (!entry) return [];
5476
6256
  }
6257
+ const you = manifest.you?.actor ?? null;
5477
6258
  const { history } = await acceptedLink.history({
5478
6259
  limit: Math.min(Math.max(q.limit ?? 50, 1), 200),
5479
6260
  before: q.before ?? null,
5480
6261
  entry,
6262
+ // S5.5 — "this person's actions of chat X", "Made by AI" (V2-1.5 §5.3)
6263
+ ...(q.chat ? { chat: q.chat } : {}),
6264
+ ...(q.kind ? { kind: q.kind } : {}),
6265
+ ...(q.mine && you ? { actor: you } : {}),
5481
6266
  });
5482
- const you = manifest.you?.actor ?? null;
5483
6267
  return history.map((a) => {
5484
- const canvases = new Set<string>();
5485
- for (const e of a.effects) {
5486
- const p = e.afterPath ?? (e.doc ? pathOf.get(e.doc) : null) ?? e.beforePath;
5487
- if (p && /\.(tsx|html)$/i.test(p)) canvases.add(p);
5488
- }
6268
+ // S1.12b — per-canvas lanes (comments-only actions are not versions) + `origin.named`.
6269
+ const { canvases, lanes } = canvasLanes(
6270
+ a.effects,
6271
+ (d) => pathOf.get(d),
6272
+ (p) => /\.(tsx|html)$/i.test(p)
6273
+ );
6274
+ const named = namedField(a.kind, a.origin);
5489
6275
  return {
5490
6276
  revision: a.revision,
5491
6277
  actionId: a.actionId,
@@ -5495,27 +6281,174 @@ export function createSyncRuntime(
5495
6281
  label: a.label,
5496
6282
  committedAt: a.committedAt,
5497
6283
  undoes: a.undoes,
5498
- canvases: [...canvases].sort(),
6284
+ canvases,
6285
+ lanes,
6286
+ ...(named ? { named } : {}),
6287
+ ...originFields(a.origin),
6288
+ ...(typeof a.tx === 'string' ? { transactionId: a.tx } : {}),
5499
6289
  };
5500
6290
  });
5501
6291
  },
5502
- acceptedVersion: async (repoRel, revision) => {
6292
+ acceptedName: async (repoRel, revision, name) => {
6293
+ if (!acceptedOn() || !acceptedLink) return null;
6294
+ const slug = slugForRepoRel(repoRel);
6295
+ if (!slug) return { status: 'rejected', code: 'unknown-canvas' };
6296
+ if (!hubOffers('history.name')) return { status: 'rejected', code: 'hub-too-old' };
6297
+ return acceptedLink.name(slug, revision, name);
6298
+ },
6299
+ acceptedAside: async (repoRel, lane, content, label) => {
6300
+ if (!acceptedOn() || !acceptedLink) return null;
6301
+ const slug = slugForRepoRel(repoRel);
6302
+ if (!slug) return { status: 'rejected', code: 'unknown-canvas' };
6303
+ if (!hubOffers('history.aside')) return { status: 'rejected', code: 'hub-too-old' };
6304
+ return acceptedLink.aside(slug, lane, content, label);
6305
+ },
6306
+ // S1.18 — a stable link's entry → path, over a FRESH manifest (a canvas moved since the last
6307
+ // bootstrap must resolve to where it is now). No cleared set here: history/links.ts reads a
6308
+ // retired entry with no live document as trashed.
6309
+ acceptedLinkDocs: async () => {
6310
+ if (!acceptedOn() || !acceptedLink) return null;
6311
+ const manifest = (await acceptedLink.refresh().catch(() => null)) ?? acceptedLink.manifest;
6312
+ if (!manifest) return null;
6313
+ return manifest.docs.map((d) => ({ entry: d.entry, path: d.path, retired: !!d.retired }));
6314
+ },
6315
+ acceptedVersion: async (repoRel, revision, lane = 'html', o) => {
5503
6316
  if (!acceptedOn() || !acceptedLink) return null;
5504
6317
  const slug = slugForRepoRel(repoRel);
5505
6318
  if (!slug) return null;
5506
- const r = await acceptedLink.laneAt(slug, 'html', revision);
6319
+ if (o?.aside) return acceptedLink.asideAt(slug, lane, revision);
6320
+ const r = await acceptedLink.laneAt(slug, lane, revision);
5507
6321
  return r.body || null;
5508
6322
  },
5509
- acceptedRestore: async (repoRel, revision) => {
6323
+ acceptedRestore: async (repoRel, revision, o) => {
5510
6324
  if (!acceptedOn() || !acceptedLink) return null;
5511
6325
  const slug = slugForRepoRel(repoRel);
5512
6326
  if (!slug) return { status: 'rejected', code: 'unknown-canvas' };
5513
6327
  const name = path.basename(repoRel).replace(/\.(tsx|html)$/i, '');
5514
- return acceptedLink.restore([slug], revision, `Restore ${name} to version ${revision}`);
6328
+ if (o?.lanes) {
6329
+ if (!o.lanes.length) return { status: 'rejected', code: 'invalid' };
6330
+ return acceptedLink.restoreLanes(slug, o.lanes, o.label ?? `Restore ${name}`);
6331
+ }
6332
+ return acceptedLink.restore(
6333
+ [slug],
6334
+ revision,
6335
+ o?.label ?? `Restore ${name} to version ${revision}`
6336
+ );
6337
+ },
6338
+ chatUndoReady: () => {
6339
+ if (!acceptedOn() || !acceptedLink?.manifest) return null;
6340
+ const n = (acceptedLink.manifest as { capabilities?: { undoTargets?: unknown } })
6341
+ ?.capabilities?.undoTargets;
6342
+ return typeof n === 'number' && n > 1;
5515
6343
  },
5516
- acceptedUndo: async (actionId, redo = false) => {
6344
+ acceptedUndo: async (raw, redo = false, o) => {
5517
6345
  if (!acceptedOn() || !acceptedLink) return null;
5518
- return acceptedLink.undo(actionId, redo);
6346
+ const target = asTarget(raw);
6347
+ const label = undoLabel(target, redo, o?.via);
6348
+ if ('chatId' in target) {
6349
+ const manifest = acceptedLink.manifest ?? (await acceptedLink.refresh().catch(() => null));
6350
+ const you = manifest?.you?.actor ?? null;
6351
+ if (!you) return { status: 'rejected', code: 'unreachable' };
6352
+ const { history } = await acceptedLink.history({
6353
+ limit: 200,
6354
+ chat: target.chatId,
6355
+ actor: you,
6356
+ kind: 'ai',
6357
+ });
6358
+ const ids = chatActionIds(
6359
+ history.map((a) => ({
6360
+ actionId: a.actionId,
6361
+ kind: a.kind,
6362
+ mine: a.actor === you,
6363
+ ...originFields(a.origin),
6364
+ })),
6365
+ target.chatId
6366
+ );
6367
+ if (!ids.ok) return { status: 'rejected', code: ids.code };
6368
+ return acceptedLink.undo({ actionIds: ids.actionIds }, false, label);
6369
+ }
6370
+ return acceptedLink.undo(target, redo, label);
6371
+ },
6372
+ textUndoConflict: async (raw, redo = false) => {
6373
+ if (redo || !acceptedOn() || !acceptedLink) return false;
6374
+ const link = acceptedLink;
6375
+ const you = link.manifest?.you?.actor ?? null;
6376
+ // the targets are this person's newest actions (the stack reads ≤ 200 rows): read once
6377
+ type Row = Awaited<ReturnType<typeof link.history>>['history'][number];
6378
+ let mine: Promise<Row[]> | null = null;
6379
+ const chatRows = new Map<string, Row>();
6380
+ return hubTextUndoConflict(asTarget(raw), {
6381
+ action: async (actionId) => {
6382
+ const hit = chatRows.get(actionId);
6383
+ if (hit) return hit;
6384
+ mine ??= link
6385
+ .history({ limit: 200, ...(you ? { actor: you } : {}) })
6386
+ .then((r) => r.history);
6387
+ return (await mine).find((a) => a.actionId === actionId) ?? null;
6388
+ },
6389
+ // p8-fix-d F12 — "Undo this chat" is judged on the very runs acceptedUndo will undo
6390
+ chat: async (chatId) => {
6391
+ if (!you) return null;
6392
+ const { history } = await link.history({
6393
+ limit: 200,
6394
+ chat: chatId,
6395
+ actor: you,
6396
+ kind: 'ai',
6397
+ });
6398
+ for (const a of history) chatRows.set(a.actionId, a);
6399
+ const ids = chatActionIds(
6400
+ history.map((a) => ({
6401
+ actionId: a.actionId,
6402
+ kind: a.kind,
6403
+ mine: a.actor === you,
6404
+ ...originFields(a.origin),
6405
+ })),
6406
+ chatId
6407
+ );
6408
+ return ids.ok ? ids.actionIds : null;
6409
+ },
6410
+ blob: (hash) => link.blob(hash),
6411
+ head: (doc) => link.laneHead(doc, 'annotations'),
6412
+ });
6413
+ },
6414
+ acceptedTrash: async () => {
6415
+ if (!acceptedOn() || !acceptedLink) return null;
6416
+ if (!acceptedLink.manifest) await acceptedLink.refresh().catch(() => null);
6417
+ if (!acceptedLink.trashOps()) return null;
6418
+ const listing = await acceptedLink.trash();
6419
+ return { ...listing, you: acceptedLink.manifest?.you?.actor ?? null };
6420
+ },
6421
+ acceptedTrashRestore: async (entry) => {
6422
+ if (!acceptedOn() || !acceptedLink) return null;
6423
+ if (!acceptedLink.manifest) await acceptedLink.refresh().catch(() => null);
6424
+ if (!acceptedLink.trashOps()) return null;
6425
+ const before = (await acceptedLink.trash().catch(() => null))?.canvases.find(
6426
+ (c) => c.entry === entry
6427
+ );
6428
+ const name = before ? path.posix.basename(before.path).replace(/\.(tsx|html)$/i, '') : null;
6429
+ const r = await acceptedLink.trashRestore(
6430
+ entry,
6431
+ name ? `Restored “${name}” from the trash` : 'Restored from the trash'
6432
+ );
6433
+ if (r.status !== 'accepted' || r.queued) return r;
6434
+ // S9.21b (V2-1.14 G1) — what an open tab had not sent when the canvas went to the trash was
6435
+ // parked with it; Restore brings those edits back into the chain too.
6436
+ if (before?.doc)
6437
+ void acceptedLink.client.requeueParked?.([before.doc]).catch((err: unknown) => {
6438
+ console.warn(`[sync] could not put back the edits kept with ${name ?? entry}: ${err}`);
6439
+ });
6440
+ // Where it came back: in place, or at `<name> 2` when the path was taken.
6441
+ const manifest = await acceptedLink.refresh().catch(() => null);
6442
+ const doc = manifest?.docs.find((d) => d.entry === entry && !d.retired);
6443
+ return doc?.path ? { ...r, path: doc.path } : r;
6444
+ },
6445
+ acceptedTrashClear: async (items) => {
6446
+ if (!acceptedOn() || !acceptedLink) return null;
6447
+ if (!acceptedLink.manifest) await acceptedLink.refresh().catch(() => null);
6448
+ if (!acceptedLink.trashOps()) return null;
6449
+ const r = await acceptedLink.trashClear(items, 'Cleared out the trash');
6450
+ if (r.status === 'accepted' && !r.queued) await trashWatch?.cleanup();
6451
+ return r;
5519
6452
  },
5520
6453
  prepareOffline: async () => {
5521
6454
  if (!filePlane) return null;
@@ -5545,13 +6478,16 @@ export function createSyncRuntime(
5545
6478
  const sides = slug ? projections.get(slug)?.conflictSides() : null;
5546
6479
  return slug && sides ? { slug, ...sides } : null;
5547
6480
  },
5548
- resolveConflict: async (repoRel, choice) => {
6481
+ resolveConflict: async (repoRel, choice, o) => {
5549
6482
  const slug = projections.has(repoRel) ? repoRel : slugForRepoRel(repoRel);
5550
6483
  const projection = slug ? projections.get(slug) : undefined;
5551
6484
  if (!slug || !projection) return null;
5552
6485
  const sides = projection.conflictSides();
5553
6486
  if (!sides) return null;
5554
6487
  if (choice === 'theirs') {
6488
+ // No await between the read of `mine` (the disk, read now) and the take.
6489
+ if (o?.ifMine !== undefined && sides.mine !== o.ifMine)
6490
+ return { status: 'rejected', code: 'changed' };
5555
6491
  projection.takeAccepted();
5556
6492
  return { status: 'taken' };
5557
6493
  }
@@ -5562,27 +6498,126 @@ export function createSyncRuntime(
5562
6498
  if (r.status === 'accepted') statusStore?.clearSourceConflict?.(slug);
5563
6499
  return { status: r.status, ...(r.code ? { code: r.code } : {}) };
5564
6500
  },
5565
- beginAiAction: (key, label) => {
6501
+ beginAiAction: (key, label, meta) => {
5566
6502
  if (!acceptedOn() || !acceptedLink) return;
5567
- acceptedLink.stage.begin(key, label);
6503
+ const { shell, ...rest } = meta ?? {};
6504
+ // p8-a1-claims — a window names its canvases repo-relative; a sidecar names its canvas
6505
+ const slugs = (shell?.files ?? [])
6506
+ .map((f) => slugForRepoRel(String(f).replace(/\.(?:meta|annotations)\.json$/i, '.tsx')))
6507
+ .filter((c): c is string => !!c);
6508
+ acceptedLink.stage.begin(key, label, {
6509
+ ...rest,
6510
+ ...(shell
6511
+ ? {
6512
+ shell: {
6513
+ call: shell.call,
6514
+ open: shell.open,
6515
+ slugs,
6516
+ ...(shell.all ? { all: true } : {}),
6517
+ },
6518
+ }
6519
+ : {}),
6520
+ });
5568
6521
  },
5569
- endAiAction: async (key, outcome) => {
6522
+ endAiAction: async (key, outcome, o) => {
5570
6523
  if (!acceptedLink) return null;
5571
6524
  // The watcher delivers the last tool write a beat after the tool
5572
6525
  // returns; let it land in the stage before the stage closes.
5573
6526
  await new Promise((r) => setTimeout(r, AI_ACTION_SETTLE_MS));
5574
6527
  await (discoveryRescan?.flush() ?? Promise.resolve()).catch(() => {});
5575
- const r = await acceptedLink.stage.end(key, outcome);
5576
- return r ? { status: r.status, ...(r.code ? { code: r.code } : {}) } : null;
6528
+ const touched = acceptedLink.stage.summaryOf(key)?.touched;
6529
+ const r = await acceptedLink.stage.end(key, outcome, o);
6530
+ return r
6531
+ ? {
6532
+ status: r.status,
6533
+ ...(r.code ? { code: r.code } : {}),
6534
+ ...(typeof r.actionId === 'string' ? { actionId: r.actionId } : {}),
6535
+ ...(touched && Object.keys(touched).length ? { touched } : {}),
6536
+ }
6537
+ : null;
6538
+ },
6539
+ claimAiWrite: (key, repoRel, hash) => {
6540
+ const slug = slugForRepoRel(repoRel);
6541
+ if (slug && acceptedLink) acceptedLink.stage.claim(key, slug, hash ?? null);
6542
+ },
6543
+ claimAiDelete: (key, repoRel) => {
6544
+ const slug = slugForRepoRel(repoRel);
6545
+ if (slug && acceptedLink) acceptedLink.stage.claimDelete(key, slug);
6546
+ },
6547
+ unclaimAiDelete: (key, repoRel) => {
6548
+ const slug = slugForRepoRel(repoRel);
6549
+ if (slug && acceptedLink) acceptedLink.stage.unclaimDelete(key, slug);
6550
+ },
6551
+ // S5.11b — Run on a copy builds the copy from this, never from a busy run's staged bytes
6552
+ acceptedCanvas: (repoRel) => {
6553
+ const slug = slugForRepoRel(repoRel);
6554
+ return slug && acceptedLink ? acceptedLink.stage.accepted(slug, 'html') : null;
6555
+ },
6556
+ pendingEdits: (repoRel) => {
6557
+ if (!acceptedOn() || !acceptedLink) return null;
6558
+ const slug = slugForRepoRel(repoRel);
6559
+ if (!slug) return [];
6560
+ return acceptedLink.stage.waiting(slug).map((e) => ({
6561
+ transactionId: e.transactionId,
6562
+ label: e.label,
6563
+ madeAt: e.madeAt,
6564
+ ...(e.undoes ? { undoes: e.undoes } : {}),
6565
+ }));
6566
+ },
6567
+ undoPendingEdit: async (repoRel, transactionId) => {
6568
+ if (!acceptedOn() || !acceptedLink) return null;
6569
+ const stage = acceptedLink.stage;
6570
+ const slug = slugForRepoRel(repoRel);
6571
+ const edit = stage.waitingEdit(transactionId);
6572
+ // Gone out already (the run ended meanwhile): the caller undoes the action it became.
6573
+ if (!slug || !edit || edit.slug !== slug || edit.undoes)
6574
+ return { status: 'rejected', code: 'not-pending' };
6575
+ if (stage.waiting(slug).some((w) => w.undoes === transactionId))
6576
+ return { status: 'rejected', code: 'already-undone' };
6577
+ // A layout move / board stroke waiting behind a run has no inverse here yet (html only).
6578
+ if (edit.lane !== 'html') return { status: 'rejected', code: 'unsupported' };
6579
+ const projection = projections.get(slug);
6580
+ const html = descriptors.get(slug)?.html;
6581
+ if (!projection || !html) return { status: 'rejected', code: 'not-pending' };
6582
+ let disk: string;
6583
+ try {
6584
+ disk = readFileSync(html, 'utf8');
6585
+ } catch {
6586
+ return { status: 'rejected', code: 'not-pending' };
6587
+ }
6588
+ // The disk without THIS edit: the run's later writes and the person's later edits stay.
6589
+ const inverse = mergeSource(edit.content, edit.baseContent, disk);
6590
+ if (!inverse.ok) return { status: 'rejected', code: 'undo-conflict' };
6591
+ const answer = projection.proposeInverse(inverse.merged, transactionId);
6592
+ if (!answer) return null;
6593
+ const queued = stage.waiting(slug).find((w) => w.undoes === transactionId);
6594
+ if (!queued) {
6595
+ const o = await answer;
6596
+ return { status: o.status, ...(o.code ? { code: o.code } : {}) };
6597
+ }
6598
+ return { status: 'accepted', transactionId: queued.transactionId };
5577
6599
  },
5578
- resolveAiAction: async (choice) => {
6600
+ resolveAiAction: async (choice, runId) => {
5579
6601
  if (!acceptedLink || acceptedLink.stage.state !== 'held') return null;
5580
6602
  if (choice === 'discard') {
5581
- const canvases = acceptedLink.stage.discard();
6603
+ const canvases = acceptedLink.stage.discard(runId);
5582
6604
  return { status: 'discarded', canvases };
5583
6605
  }
5584
- const r = await acceptedLink.stage.publish();
5585
- return r ? { status: r.status, ...(r.code ? { code: r.code } : {}) } : null;
6606
+ // S5.5b — the touched artboards of what Keep publishes, for `project:action`.
6607
+ const touched: Record<string, string[]> = {};
6608
+ for (const run of acceptedLink.stage.runs())
6609
+ if (run.state === 'held' && (!runId || run.runId === runId))
6610
+ for (const [c, ids] of Object.entries(run.touched))
6611
+ touched[c] = [...new Set([...(touched[c] ?? []), ...ids])].sort();
6612
+ const r = await acceptedLink.stage.publish(runId);
6613
+ return r
6614
+ ? {
6615
+ status: r.status,
6616
+ ...(r.code ? { code: r.code } : {}),
6617
+ ...(typeof r.actionId === 'string' ? { actionId: r.actionId } : {}),
6618
+ ...(Object.keys(touched).length ? { touched } : {}),
6619
+ }
6620
+ : null;
5586
6621
  },
5587
6622
  };
5588
6623
  }
@@ -5605,6 +6640,9 @@ export function createSyncRuntime(
5605
6640
  */
5606
6641
  /** Coalesce a burst of asset writes (dragging six images on) into one sweep. */
5607
6642
  const ASSET_SWEEP_DEBOUNCE_MS = 1500;
6643
+ /** S6.13 — how long a new canvas waits for the project to answer before its
6644
+ * create is proposed straight into the outbox (offline ⌘N). */
6645
+ const EARLY_CREATE_PROBE_MS = 1500;
5608
6646
 
5609
6647
  export const DEFAULT_MAX_PINNED_ROOMS = 500;
5610
6648
 
@@ -5616,13 +6654,25 @@ function maxPinnedRooms(): number {
5616
6654
  /**
5617
6655
  * Filter the discovered set down to what may safely be synced.
5618
6656
  *
5619
- * **A4 — slug collisions.** `slugFor` flattens `/` to `-`, so `ui/a/b.tsx` and
5620
- * `ui/a-b.tsx` produce the same slug. Two files on one document is not a
5621
- * degraded experience, it is silent cross-contamination: each would receive the
5622
- * other's body as a remote change and write it over itself, forever. Neither
5623
- * file is more correct than the other, so BOTH are excluded rather than one
5624
- * being picked — refusing to sync two canvases is recoverable by renaming a
5625
- * file; overwriting one with the other is not.
6657
+ * **A4 — document collisions.** Two canvases collide when they reach the SAME
6658
+ * wire document, not merely the same slug. `slugFor` flattens `/` to `-`, so
6659
+ * `ui/a/b.tsx` and `ui/a-b.tsx` share a slug; in a namespaced project
6660
+ * `sanitizeComponent` collapses further (an em dash and a hyphen, `a.b` runs,
6661
+ * 64-character truncation), so `ui/a—b.tsx` and `ui/a-b.tsx` share a document
6662
+ * though their slugs differ. The create/rename doors refuse such a name
6663
+ * (S1.23b, `sync-name-key.ts`), but a file written outside them — the AI's
6664
+ * Write, a `git pull`, Syncthing — never meets that guard, so this is the one
6665
+ * that holds. Grouping is by `docNameOf(slug)`, the FINAL wire name; the
6666
+ * doc-name algorithm itself is untouched, so v1 peers keep their ids.
6667
+ *
6668
+ * Two files on one document is not a degraded experience, it is silent
6669
+ * cross-contamination: each would receive the other's body as a remote change
6670
+ * and write it over itself, forever, on every peer. Neither file is more
6671
+ * correct than the other, so BOTH are excluded rather than one being picked —
6672
+ * refusing to sync two canvases is recoverable by renaming a file; overwriting
6673
+ * one with the other is not. Both files stay on disk untouched; `onCollisions`
6674
+ * lets the caller say so in the Sync panel (a console line never reaches a
6675
+ * terminal-free desktop user).
5626
6676
  *
5627
6677
  * **A6 — pinned-room ceiling.** Under shared-doc, admit at most
5628
6678
  * `maxPinnedRooms()`. Named loudly, because the ones past the ceiling stop
@@ -5630,32 +6680,144 @@ function maxPinnedRooms(): number {
5630
6680
  *
5631
6681
  * Exported for the pre-cutover tests.
5632
6682
  */
6683
+ export interface DocCollision {
6684
+ /** The wire document both files would share. */
6685
+ docName: string;
6686
+ /** The colliding canvas bodies (absolute paths, scan order). */
6687
+ files: string[];
6688
+ }
6689
+
6690
+ export interface AdmitCanvasesOptions {
6691
+ /** slug → wire document name (`docNameFor`). Default: the flat slug. */
6692
+ docNameOf?: (slug: string) => string;
6693
+ /** Called once per call with every collision found (never with an empty list). */
6694
+ onCollisions?: (collisions: DocCollision[]) => void;
6695
+ }
6696
+
6697
+ /**
6698
+ * Every hold a file-plane pass reports, as Sync details rows (`FilePlaneStatus.held`). A pure
6699
+ * function of the pass result so the panel's words are pinned by a test (p8-held-surface).
6700
+ */
6701
+ export function filePlaneHeld(
6702
+ result: import('./file-plane.ts').FilePlaneResult
6703
+ ): NonNullable<FilePlaneStatus['held']> {
6704
+ const held: NonNullable<FilePlaneStatus['held']> = [];
6705
+ if (result.deleteHeld) {
6706
+ held.push({
6707
+ kind: result.deleteHeld.direction === 'out' ? 'delete-out' : 'delete-in',
6708
+ count: result.deleteHeld.count,
6709
+ paths: result.deleteHeld.paths,
6710
+ detail:
6711
+ result.deleteHeld.direction === 'out'
6712
+ ? `${result.deleteHeld.count} files are gone from this machine — more than sync will remove from the project without you saying so. Nothing was deleted anywhere else. Set linkedHub.propagateDeletes: false to stop asking, or delete them again once you have confirmed this was deliberate.`
6713
+ : `The project wants to remove ${result.deleteHeld.count} files here — more than sync will delete without you saying so. Nothing was removed. They stay until you accept or the project puts them back.`,
6714
+ });
6715
+ }
6716
+ if (result.firstAnchorHeld) {
6717
+ held.push({
6718
+ kind: 'first-anchor',
6719
+ count: result.firstAnchorHeld.count,
6720
+ paths: result.firstAnchorHeld.paths,
6721
+ detail: `${result.firstAnchorHeld.count} files differ between this machine and the project, and neither copy has been reconciled here yet. Set linkedHub.resolveFirstAnchor to "keep-local" or "keep-cloud" to settle the whole set at once.`,
6722
+ });
6723
+ }
6724
+ // p8-held-surface — what the HUB holds back from the code lane (owner reads only). Without
6725
+ // this row a held file was not synced, not committed, and nobody was told.
6726
+ if (result.codeHeld && result.codeHeld.count > 0) {
6727
+ held.push({
6728
+ kind: 'code-held',
6729
+ count: result.codeHeld.count,
6730
+ paths: result.codeHeld.paths.map((h) => h.path),
6731
+ detail: codeHeldDetail(result.codeHeld.count),
6732
+ });
6733
+ }
6734
+ if (result.reanchorHeld) {
6735
+ held.push({
6736
+ kind: 'reanchor',
6737
+ count: 0,
6738
+ paths: [],
6739
+ detail:
6740
+ 'The project has asked to start over repeatedly, which is what a broken or hostile hub looks like. Nothing was overwritten. Sync retries by itself; if this persists, the hub needs looking at.',
6741
+ });
6742
+ }
6743
+ return held;
6744
+ }
6745
+
6746
+ /**
6747
+ * p8-held-surface — the Sync details sentence for files the hub holds back from the code lane
6748
+ * (CONTRACT §4: what happened · what is safe · one verb). Only the owner reads it, and only the
6749
+ * owner sets the canvas folders, so the verb is theirs to take.
6750
+ */
6751
+ export function codeHeldDetail(count: number): string {
6752
+ return count === 1
6753
+ ? '1 file was made or changed as a canvas before the canvas folders were set, and is outside them now, so it doesn’t sync. Nothing was removed. Add its folder to the canvas folders to keep it as a canvas.'
6754
+ : `${count} files were made or changed as canvases before the canvas folders were set, and are outside them now, so they don’t sync. Nothing was removed. Add their folders to the canvas folders to keep them as canvases.`;
6755
+ }
6756
+
6757
+ /** The Sync-panel notice for one collision (CONTRACT §4: what happened · what is safe · one verb). */
6758
+ export function docCollisionNotice(
6759
+ c: DocCollision,
6760
+ designRoot: string
6761
+ ): { id: string; severity: 'warn'; text: string } {
6762
+ const names = c.files.map(
6763
+ (f) =>
6764
+ `“${path
6765
+ .relative(designRoot, f)
6766
+ .split(path.sep)
6767
+ .join('/')
6768
+ .replace(/\.(tsx|html)$/i, '')}”`
6769
+ );
6770
+ const list =
6771
+ names.length <= 2
6772
+ ? names.join(' and ')
6773
+ : `${names.slice(0, -1).join(', ')} and ${names[names.length - 1]}`;
6774
+ const lead = names.length <= 2 ? 'neither is syncing' : 'none of them is syncing';
6775
+ const safe = names.length <= 2 ? 'Both files are' : 'All the files are';
6776
+ return {
6777
+ id: `doc-collision-${c.docName}`,
6778
+ severity: 'warn',
6779
+ text: `${list} would share one sync document, so ${lead}. ${safe} safe on this machine. Rename one.`,
6780
+ };
6781
+ }
6782
+
5633
6783
  export function admitCanvases(
5634
6784
  canvases: readonly CanvasDescriptor[],
5635
- sharedDoc: boolean
6785
+ sharedDoc: boolean,
6786
+ opts: AdmitCanvasesOptions = {}
5636
6787
  ): CanvasDescriptor[] {
5637
- const bySlug = new Map<string, CanvasDescriptor[]>();
6788
+ const docNameOf = opts.docNameOf ?? ((slug: string) => slug);
6789
+ const byDoc = new Map<string, CanvasDescriptor[]>();
5638
6790
  for (const c of canvases) {
5639
- const group = bySlug.get(c.slug);
6791
+ // `buildDocName` throws on a slug with nothing left after sanitising; such
6792
+ // a canvas cannot reach the wire under that name, so it keys by its slug
6793
+ // (and collides only with an identical slug, as before).
6794
+ let key: string;
6795
+ try {
6796
+ key = docNameOf(c.slug);
6797
+ } catch {
6798
+ key = `\0slug:${c.slug}`;
6799
+ }
6800
+ const group = byDoc.get(key);
5640
6801
  if (group) group.push(c);
5641
- else bySlug.set(c.slug, [c]);
6802
+ else byDoc.set(key, [c]);
5642
6803
  }
5643
6804
 
5644
6805
  const admitted: CanvasDescriptor[] = [];
5645
- const collisions: string[] = [];
5646
- for (const [slug, group] of bySlug) {
6806
+ const collisions: DocCollision[] = [];
6807
+ for (const [docName, group] of byDoc) {
5647
6808
  if (group.length > 1) {
5648
- collisions.push(`${slug} ← ${group.map((c) => c.html).join(' , ')}`);
6809
+ collisions.push({ docName, files: group.map((c) => c.html) });
5649
6810
  continue;
5650
6811
  }
5651
6812
  admitted.push(group[0] as CanvasDescriptor);
5652
6813
  }
5653
6814
  if (collisions.length > 0) {
5654
6815
  console.error(
5655
- `[sync] ${collisions.length} slug collision(s) — these canvases are NOT syncing, because two files sharing one document would overwrite each other (DDR-064 A4). Rename one of each pair:\n${collisions
5656
- .map((c) => ` ${c}`)
6816
+ `[sync] ${collisions.length} document collision(s) — these canvases are NOT syncing, because two files sharing one document would overwrite each other (DDR-064 A4). Rename one of each pair:\n${collisions
6817
+ .map((c) => ` ${c.docName} ← ${c.files.join(' , ')}`)
5657
6818
  .join('\n')}`
5658
6819
  );
6820
+ opts.onCollisions?.(collisions);
5659
6821
  }
5660
6822
 
5661
6823
  if (!sharedDoc) return admitted;
@@ -5721,7 +6883,82 @@ export interface CanvasScan {
5721
6883
  tsxCount: number;
5722
6884
  }
5723
6885
 
5724
- export async function scanCanvases(ctx: Context): Promise<CanvasScan> {
6886
+ export interface ScanOptions {
6887
+ /**
6888
+ * p8-hub-folder-boundary — walk every top folder the hub's kernel would take
6889
+ * as a canvas group, not only the declared ones. Only a hub's own studio
6890
+ * passes it, and only while the checkout declares no groups (`hubBoundary`).
6891
+ */
6892
+ undeclaredFolders?: boolean;
6893
+ }
6894
+
6895
+ /** The group folders one scan walks: the declared set, plus — under the hub
6896
+ * boundary — every top folder in the kernel's group charset (no `_` runtime
6897
+ * dir, no dotted or hidden name, no `node_modules`). A folder already inside
6898
+ * another listed folder is dropped so no canvas is walked twice. */
6899
+ function scanGroupPaths(ctx: Context, opts: ScanOptions): string[] {
6900
+ // Everyone else walks exactly the declared groups, as before.
6901
+ if (!opts.undeclaredFolders) return ctx.cfg.canvasGroups.map((g) => g.path);
6902
+ let entries: import('node:fs').Dirent[] = [];
6903
+ try {
6904
+ entries = readdirSync(ctx.paths.designRoot, { withFileTypes: true });
6905
+ } catch {
6906
+ entries = [];
6907
+ }
6908
+ return scanFolderPaths(
6909
+ ctx.cfg.canvasGroups.map((g) => String(g.path)),
6910
+ entries,
6911
+ (rel) => {
6912
+ try {
6913
+ const st = statSync(path.join(ctx.paths.designRoot, rel));
6914
+ return st.isDirectory() ? `${st.dev}:${st.ino}` : null;
6915
+ } catch {
6916
+ return null;
6917
+ }
6918
+ }
6919
+ );
6920
+ }
6921
+
6922
+ /**
6923
+ * The folder half of {@link scanGroupPaths}, pure (exported for
6924
+ * test/p8-boundary-harden.test.ts): the declared groups, then every listed top
6925
+ * folder the kernel would take as a group.
6926
+ *
6927
+ * TWO NAMES ARE ONE FOLDER ONLY WHEN THEY ARE ONE DIRECTORY (`idOf` = device +
6928
+ * inode, null when absent). Cells run on Linux, where `Brand/` and `BRAND/` are
6929
+ * different folders; de-duplicating names ignoring case dropped whichever listed
6930
+ * second, so an editor's `BRAND/zz.tsx` could knock the owner's `Brand/` out of
6931
+ * the scan and stop its canvases syncing on the cell (final-3 attacker L2). On a
6932
+ * case-insensitive Mac a declared `ui` and the listed `UI` share an inode and are
6933
+ * walked once, as before.
6934
+ */
6935
+ export function scanFolderPaths(
6936
+ declared: readonly string[],
6937
+ entries: readonly { name: string; isDirectory(): boolean }[],
6938
+ idOf: (rel: string) => string | null
6939
+ ): string[] {
6940
+ const paths: string[] = [];
6941
+ const seen = new Set<string>();
6942
+ const add = (rel: string, mustExist: boolean): void => {
6943
+ if (!rel || paths.includes(rel)) return;
6944
+ const id = idOf(rel);
6945
+ if (id !== null) {
6946
+ if (seen.has(id)) return;
6947
+ seen.add(id);
6948
+ } else if (mustExist) return;
6949
+ paths.push(rel);
6950
+ };
6951
+ for (const g of declared) add(g.replace(/^\/+|\/+$/g, ''), false);
6952
+ for (const e of entries) {
6953
+ if (e.isDirectory() && isUndeclaredGroupName(e.name)) add(e.name, true);
6954
+ }
6955
+ const lower = paths.map((p) => p.toLowerCase());
6956
+ return paths.filter(
6957
+ (p, i) => p && !lower.some((q, j) => j !== i && p.toLowerCase().startsWith(`${q}/`))
6958
+ );
6959
+ }
6960
+
6961
+ export async function scanCanvases(ctx: Context, opts: ScanOptions = {}): Promise<CanvasScan> {
5725
6962
  const out: CanvasDescriptor[] = [];
5726
6963
  const counter = { tsx: 0 };
5727
6964
  // T3 (9.1-B) — LOAD-BEARING coupling (the plan's "two locks flip together"
@@ -5741,8 +6978,8 @@ export async function scanCanvases(ctx: Context): Promise<CanvasScan> {
5741
6978
  // (`splitActive`) is UNTOUCHED — a `.tsx` still syncs ONLY when the cross-origin
5742
6979
  // containment is active; decoupling them would re-open the F1 RCE (DDR-060).
5743
6980
  const projectSyncTsx = ctx.cfg.linkedHub?.syncTsx !== false;
5744
- for (const group of ctx.cfg.canvasGroups) {
5745
- const groupAbs = path.join(ctx.paths.designRoot, group.path);
6981
+ for (const groupPath of scanGroupPaths(ctx, opts)) {
6982
+ const groupAbs = path.join(ctx.paths.designRoot, groupPath);
5746
6983
  if (!existsSync(groupAbs)) continue;
5747
6984
  await walk(
5748
6985
  groupAbs,
@@ -5997,6 +7234,63 @@ function designConfigPath(ctx: Context): string {
5997
7234
  return path.join(ctx.paths.designRoot, 'config.json');
5998
7235
  }
5999
7236
 
7237
+ /**
7238
+ * Is this copy a hub's own studio whose hub is still the folder boundary?
7239
+ * (p8-hub-folder-boundary, decision maude/v2-michal-hub-is-the-folder-boundary-before-config.)
7240
+ *
7241
+ * True only under cell pairing — the design root IS the hub's checkout — and only
7242
+ * while that checkout's `config.json` names no canvas group: absent or
7243
+ * unreadable, no `canvasGroups` array, or no entry with a path. That is the
7244
+ * kernel's own rule (hub `acceptedCanvasGroups` → `allowUndeclaredGroup`), so the
7245
+ * studio and its hub agree on which folders a canvas may live in. A desktop copy
7246
+ * is never the boundary: its one-shot fresh-link relaxation is unchanged.
7247
+ */
7248
+ export function hubFolderBoundary(
7249
+ designRoot: string,
7250
+ { cellPairing }: { cellPairing: boolean }
7251
+ ): boolean {
7252
+ if (!cellPairing) return false;
7253
+ try {
7254
+ const cfg = JSON.parse(readFileSync(path.join(designRoot, 'config.json'), 'utf8'));
7255
+ // The one "declared" predicate the hub kernel, classifier and workspace
7256
+ // agent use too (canvas-path `declaredCanvasGroups`, final-3 attacker I2).
7257
+ return declaredCanvasGroups(cfg?.canvasGroups) === null;
7258
+ } catch {
7259
+ return true;
7260
+ }
7261
+ }
7262
+
7263
+ export interface UndeclaredGroupGate {
7264
+ /** The fresh-link moment: a bare folder's first boot, until one group is learned. */
7265
+ readonly freshLink: boolean;
7266
+ closeFreshLink(): void;
7267
+ /**
7268
+ * May a canvas path sit outside every declared group? `strict` = a pull after
7269
+ * boot, which never gets the fresh-link relaxation — but does get the hub
7270
+ * boundary, because the kernel takes that path whenever it arrives.
7271
+ */
7272
+ accepts(opts?: { strict?: boolean }): boolean;
7273
+ }
7274
+
7275
+ /** The two answers to "outside every declared group" a sync runtime gives. */
7276
+ export function createUndeclaredGroupGate(
7277
+ freshLink: boolean,
7278
+ hubBoundary: () => boolean
7279
+ ): UndeclaredGroupGate {
7280
+ let fresh = freshLink;
7281
+ return {
7282
+ get freshLink() {
7283
+ return fresh;
7284
+ },
7285
+ closeFreshLink() {
7286
+ fresh = false;
7287
+ },
7288
+ accepts({ strict = false } = {}) {
7289
+ return hubBoundary() || (fresh && !strict);
7290
+ },
7291
+ };
7292
+ }
7293
+
6000
7294
  /**
6001
7295
  * Give a freshly-linked, previously-empty folder a config of its own.
6002
7296
  *
@@ -6006,17 +7300,39 @@ function designConfigPath(ctx: Context): string {
6006
7300
  * writes what the pull actually brought down, so the next boot needs no
6007
7301
  * relaxation and the tree lists the project it just received.
6008
7302
  *
7303
+ * A hub at format 2 or higher stamps `formatVersion` (decision 2A): the
7304
+ * pulled project is a format-N project, and without the stamp a later detach
7305
+ * or relink would read it back as format 1 (view only). A 1.x hub stamps
7306
+ * nothing — absent already means 1. The stamp is capped at SUPPORTED_FORMAT
7307
+ * (`persistableFormat`); exported for test/p8-secfix-format-clamp.test.ts.
7308
+ *
6009
7309
  * ADDITIVE AND ONE-SHOT. It refuses outright if a config already exists — a
6010
7310
  * user's own declaration is never edited by the sync runtime, and the caller's
6011
7311
  * `freshLink` gate means this cannot run on a project that had canvases.
6012
7312
  * Best-effort: a read-only design root costs the project its tidiness, never
6013
7313
  * its sync.
7314
+ *
7315
+ * NEVER IN A HUB'S OWN STUDIO (`cellPairing`, p8-docker-desktop-legs). A
7316
+ * paired studio's design root IS the hub's checkout, and the hub reads that
7317
+ * file's `canvasGroups` as the project's classification boundary (what a
7318
+ * writer may put where — the kernel's path check, the bootstrap every copy is
7319
+ * declared from). Seeded there, the studio's DEFAULT groups (`system`, `ui`)
7320
+ * fenced every other group out: a teammate's `screens/home.tsx` was refused
7321
+ * and every desktop copy drew an empty `system` folder. That boundary is the
7322
+ * project owner's to set (the owner-only project-config door), so a paired
7323
+ * studio pulls under the fresh-link relaxation and writes nothing.
6014
7324
  */
6015
- function seedProjectConfig(
7325
+ export function seedProjectConfig(
6016
7326
  ctx: Context,
6017
7327
  learnedGroups: ReadonlySet<string>,
6018
- owned: boolean
7328
+ owned: boolean,
7329
+ hubFormat = 1,
7330
+ { cellPairing = false }: { cellPairing?: boolean } = {}
6019
7331
  ): boolean {
7332
+ if (cellPairing) return false;
7333
+ // The hub's format reached us over an unauthenticated /health; the versioned
7334
+ // config never records more than this build edits (p8-secfix-studio F5/D4).
7335
+ const keep = persistableFormat(hubFormat);
6020
7336
  const file = designConfigPath(ctx);
6021
7337
  if (existsSync(file) && !owned) return false;
6022
7338
  const declared = (ctx.cfg.canvasGroups ?? []).map((g) => g.path);
@@ -6029,6 +7345,7 @@ function seedProjectConfig(
6029
7345
  name: ctx.cfg.name,
6030
7346
  designRoot: ctx.paths.designRel,
6031
7347
  canvasGroups: groups.map((p) => ({ label: p, path: p })),
7348
+ ...(keep >= 2 ? { formatVersion: keep } : {}),
6032
7349
  },
6033
7350
  null,
6034
7351
  2