@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
@@ -0,0 +1,1764 @@
1
+ // design-hook.mjs — `maude design hook <event>`, the design plugin's hooks (contract V2-1.11 §5.4;
2
+ // lifted from apps/studio/test/agent-evals/harness/hook.mjs, the prototype V2-1.18 measured).
3
+ //
4
+ // prompt UserPromptSubmit POST /_api/agent/run/begin; names the run folder once per session
5
+ // → additionalContext or nothing
6
+ // pre-edit PreToolUse snapshot · whole-file-rewrite · POST edit/check → deny or nothing
7
+ // (a sub-agent: its hand-off `owns`, outside .design/ too; S12.7)
8
+ // post-edit PostToolUse check (studio, else local) · rollback · touched · `ds` warnings
9
+ // (ds-check --hook, S12.4/D9) → block, or additionalContext, or nothing
10
+ // pre-bash PreToolUse Bash use-trash · use-verb · not-a-writer · human-only · out-of-project (bash-guard)
11
+ // · an untrusted-content reader has no shell (S12.7)
12
+ // → deny or nothing
13
+ // post-bash PostToolUse Bash what a write verb / any not-provably-read call wrote → touched → nothing
14
+ // stop Stop stop-tier check of the run's files · run/end → block or nothing
15
+ // SubagentStop (same command) hand-off result + the files it owns → block or nothing
16
+ // subagent-start SubagentStart records agent_id → {type, at, handoffs} → nothing
17
+ // session-start SessionStart exports MAUDE_HOOK_SESSION to Bash (CLAUDE_ENV_FILE); §5.6
18
+ // handshake: warns when the plugin's manifest is older than
19
+ // the app's; names the active canvas → additionalContext or nothing
20
+ //
21
+ // DENY-ONLY and FAIL-OPEN: never `ask`, never `allow`; bad stdin, no project, a path outside
22
+ // designRoot, any internal error → exit 0 with no output. Without a studio (no `_server.json`,
23
+ // refused, timeout, non-2xx) the studio parts are skipped; snapshot, check and rollback still run.
24
+ //
25
+ // State per Claude Code session in <designRoot>/_runs/<session>/ (runtime, DDR-115):
26
+ // snap/<tool_use_id> bytes before that edit (`.new` marker: the file did not exist)
27
+ // base/<sha(path)> bytes before the run first touched the file (stop-tier `against`);
28
+ // `.bash`: an AI shell call wrote it first — no base, Stop checks it whole
29
+ // Only the hooks write base/, snap/, bash/, touched.json and stop-last* — main agent included (D1).
30
+ // touched.json files this run changed ({at, by, via, artboards}: artboards the
31
+ // studio mapped the edits to; null = unknown → any capture of the canvas)
32
+ // shots.jsonl captures `maude design screenshot` made under this session (Stop's
33
+ // screenshot gate; <designRoot>/_runs/shots.jsonl when no session is known)
34
+ // bash/<tool_use_id>.json a write verb's start ({at, snaps}) — post-bash binds what changed since;
35
+ // a call that leaves a process running ({bg, by, seen}) keeps it until
36
+ // the run ends, and every Stop binds what changed since `seen`
37
+ // stop-last.json the last Stop block (so a re-stop with the same list lets it end)
38
+ // agents.json sub-agent starts: agent_id → {type, at, handoffs: [{rel, sha}]}
39
+ // (SubagentStart records each hand-off with its content hash; the
40
+ // agent is held to THAT copy — gone or changed → its writes are denied)
41
+ // handoff/*.in.json maude.agent-handoff/1 role "in", written by the main agent before a
42
+ // spawn: a sub-agent of that type writes ONLY its `owns` (V2-1.18)
43
+ // A sub-agent never writes the run folder's control files (agents.json, *.in.json, the hooks'
44
+ // snapshots): under _runs/ it writes only its hand-off `output` and what it `owns`. Nobody — the
45
+ // main agent included — writes the local harnesses (_draw/*.proof.tsx, _photo/*.bgremove.tsx):
46
+ // their verbs generate them from their own process.
47
+ // and <designRoot>/_runs/sessions/<session>.json marks a session whose run folder was named.
48
+ //
49
+ // Leaf module: node built-ins + studio-locate.mjs + bash-guard.mjs + finding-text.mjs.
50
+
51
+ import { spawnSync } from 'node:child_process';
52
+ import { createHash } from 'node:crypto';
53
+ import {
54
+ appendFileSync,
55
+ existsSync,
56
+ mkdirSync,
57
+ readdirSync,
58
+ readFileSync,
59
+ renameSync,
60
+ rmSync,
61
+ statSync,
62
+ unlinkSync,
63
+ writeFileSync,
64
+ } from 'node:fs';
65
+ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
66
+
67
+ import {
68
+ bashBackgrounds,
69
+ bashMayWrite,
70
+ changedDesignFiles,
71
+ classifyBash,
72
+ designLaneHashes,
73
+ designVerbOf,
74
+ designWritesSince,
75
+ maudeWords,
76
+ namedDesignFiles,
77
+ parseBash,
78
+ } from './bash-guard.mjs';
79
+ import { realpathDeep } from './confine-out.mjs';
80
+ import { sessionRoot } from './confine-root.mjs';
81
+ import { cleanFinding, cleanText, fileText, findingLine } from './finding-text.mjs';
82
+ import { DESIGN_REL, findProjectRoot, locateStudio, postStudio } from './studio-locate.mjs';
83
+
84
+ export const HOOK_EVENTS = [
85
+ 'prompt',
86
+ 'pre-edit',
87
+ 'post-edit',
88
+ 'pre-bash',
89
+ 'post-bash',
90
+ 'stop',
91
+ 'subagent-start',
92
+ 'session-start',
93
+ ];
94
+ const KEY_RE = /^[A-Za-z0-9_-]{1,128}$/;
95
+ const EDIT_TOOLS = new Set(['Edit', 'Write', 'MultiEdit', 'NotebookEdit']);
96
+ const CANVAS_RE = /\.(?:tsx|jsx)$/;
97
+ const BOARD_RE = /\.annotations\.json$/;
98
+ /** V2-1.11 §9 Q5: a Write over an existing canvas longer than this is a lazy rewrite. */
99
+ export const LAZY_WRITE_LINES = 40;
100
+ const LOCATE_MS = 300;
101
+ /**
102
+ * p8-secfix-hook-2 N1 — the longest a shell mark counts, from the call's start: the studio's own
103
+ * bound on a bash window (`BASH_WINDOW_MS`, routes/agent.ts), so neither side binds an older write.
104
+ */
105
+ export const BG_MARK_MS = 15 * 60_000;
106
+ /** p8-secfix-hook-2 N2 — background marks one Stop drains (the newest; older ones are dropped). */
107
+ export const BG_MARKS_MAX = 16;
108
+ /** A bash snapshot is skipped above this (no exact artboard map for it — fail-open). */
109
+ const SNAP_MAX_BYTES = 4 * 1024 * 1024;
110
+
111
+ const sha = (s) => createHash('sha256').update(s, 'utf8').digest('hex');
112
+ /** Claude Code's ids are safe segments; anything else is hashed into one. */
113
+ export const hookKey = (raw) =>
114
+ typeof raw === 'string' && KEY_RE.test(raw) ? raw : raw ? sha(String(raw)).slice(0, 32) : null;
115
+
116
+ function readOr(abs) {
117
+ try {
118
+ return readFileSync(abs, 'utf8');
119
+ } catch {
120
+ return null;
121
+ }
122
+ }
123
+ function writeAt(abs, text) {
124
+ mkdirSync(dirname(abs), { recursive: true });
125
+ writeFileSync(abs, text);
126
+ }
127
+ const readJson = (abs, dflt) => {
128
+ try {
129
+ return JSON.parse(readFileSync(abs, 'utf8'));
130
+ } catch {
131
+ return dflt;
132
+ }
133
+ };
134
+ const deny = (reason) => ({
135
+ hookSpecificOutput: {
136
+ hookEventName: 'PreToolUse',
137
+ permissionDecision: 'deny',
138
+ permissionDecisionReason: reason,
139
+ },
140
+ });
141
+
142
+ /** What the tool writes, replayed on `cur`. null = can't tell (MultiEdit misses, NotebookEdit). */
143
+ export function replayEdit(tool, ti, cur) {
144
+ if (tool === 'Write') return typeof ti.content === 'string' ? ti.content : null;
145
+ const one = (s, e) => {
146
+ if (s === null || typeof e?.old_string !== 'string' || !e.old_string) return null;
147
+ if (!s.includes(e.old_string)) return null;
148
+ const next = e.new_string ?? '';
149
+ return e.replace_all ? s.split(e.old_string).join(next) : s.replace(e.old_string, () => next);
150
+ };
151
+ if (tool === 'Edit') return one(cur, ti);
152
+ if (tool === 'MultiEdit' && Array.isArray(ti.edits)) {
153
+ let s = cur;
154
+ for (const e of ti.edits) s = one(s, e);
155
+ return s;
156
+ }
157
+ return null;
158
+ }
159
+
160
+ // ── hand-offs (maude.agent-handoff/1, V2-1.18 §5.2) ──────────────────────────────────────────
161
+ // A structural check of the shape until cli/lib/handoff.mjs (p2-ai-paths-4b, the JSON Schema)
162
+ // lands; validateHandoff / ownsPath keep that module's signatures so the swap is an import.
163
+
164
+ export const HANDOFF_CONTRACT = 'maude.agent-handoff/1';
165
+ const REL_PATH_RE = /^(?!\/)(?!.*(?:^|\/)\.\.(?:\/|$))[^\0\\]{1,512}$/;
166
+ const OUT_STATUS = ['done', 'partial', 'blocked', 'refused'];
167
+ const CHANGE_KINDS = ['new-file', 'edit', 'proposal', 'draft', 'brief', 'report'];
168
+ const SEVERITIES = ['blocker', 'warning', 'info'];
169
+ const IN_KEYS = [
170
+ 'contract',
171
+ 'role',
172
+ 'runId',
173
+ 'agent',
174
+ 'n',
175
+ 'task',
176
+ 'scope',
177
+ 'owns',
178
+ 'reads',
179
+ 'context',
180
+ 'checks',
181
+ 'budget',
182
+ 'output',
183
+ ];
184
+ const OUT_KEYS = [
185
+ 'contract',
186
+ 'role',
187
+ 'runId',
188
+ 'agent',
189
+ 'n',
190
+ 'status',
191
+ 'summary',
192
+ 'changed',
193
+ 'evidence',
194
+ 'decisions',
195
+ 'findings',
196
+ 'open_questions',
197
+ 'result',
198
+ 'next',
199
+ ];
200
+ const bareAgent = (a) => String(a ?? '').replace(/^.*:/, '');
201
+
202
+ /** `{ ok, role, errors: [{where, what, fix}] }` — never throws, ≤ 20 errors. */
203
+ export function validateHandoff(doc, { role } = {}) {
204
+ const errors = [];
205
+ const err = (where, what, fix) => errors.length < 20 && errors.push({ where, what, fix });
206
+ if (!doc || typeof doc !== 'object' || Array.isArray(doc)) {
207
+ err('$', 'is not a JSON object', `Write a ${HANDOFF_CONTRACT} object.`);
208
+ return { ok: false, role: null, errors };
209
+ }
210
+ const r = doc.role === 'in' || doc.role === 'out' ? doc.role : null;
211
+ if (doc.contract !== HANDOFF_CONTRACT)
212
+ err('contract', `is not "${HANDOFF_CONTRACT}"`, `Set "contract": "${HANDOFF_CONTRACT}".`);
213
+ if (!r) err('role', 'is not "in" or "out"', 'Set "role".');
214
+ if (role && r && r !== role)
215
+ err('role', `is "${r}", this file must be "${role}"`, `Set "role": "${role}".`);
216
+ const str = (k, max, req = true) => {
217
+ if (doc[k] === undefined) return req && err(k, 'is missing', `Add "${k}".`);
218
+ if (typeof doc[k] !== 'string' || !doc[k] || doc[k].length > max)
219
+ err(k, `is not a string of 1–${max} chars`, `Fix "${k}".`);
220
+ };
221
+ const arr = (k, req = true) => {
222
+ if (doc[k] === undefined) return req && err(k, 'is missing', `Add "${k}" (an array).`);
223
+ if (!Array.isArray(doc[k])) err(k, 'is not an array', `Make "${k}" an array.`);
224
+ };
225
+ str('agent', 200);
226
+ if (
227
+ (r === 'in' || doc.runId !== undefined) &&
228
+ (typeof doc.runId !== 'string' || !/^r_[A-Za-z0-9_-]{4,64}$/.test(doc.runId))
229
+ )
230
+ err('runId', 'is not r_<4–64 id chars>', 'Use the run id from the run folder line.');
231
+ if (r === 'in') {
232
+ str('task', 4000);
233
+ if (
234
+ !Array.isArray(doc.owns) ||
235
+ !doc.owns.length ||
236
+ !doc.owns.every((g) => typeof g === 'string' && REL_PATH_RE.test(g))
237
+ )
238
+ err(
239
+ 'owns',
240
+ 'is not a non-empty array of repo-relative paths',
241
+ 'List the paths this agent may write.'
242
+ );
243
+ else if (!doc.owns.every(globFits))
244
+ err(
245
+ 'owns',
246
+ `has a glob over ${GLOB_MAX_CHARS} chars or with more than ${GLOB_MAX_WILDCARDS} wildcards`,
247
+ 'Name the paths more plainly.'
248
+ );
249
+ if (typeof doc.output !== 'string' || !REL_PATH_RE.test(doc.output))
250
+ err('output', 'is not a repo-relative path', 'Name where the agent writes its result.');
251
+ }
252
+ if (r === 'out') {
253
+ if (!OUT_STATUS.includes(doc.status))
254
+ err('status', `is not one of ${OUT_STATUS.join(' | ')}`, 'Set "status".');
255
+ str('summary', 2000);
256
+ arr('changed');
257
+ if (Array.isArray(doc.changed))
258
+ doc.changed.forEach((c, i) => {
259
+ if (
260
+ !c ||
261
+ typeof c.file !== 'string' ||
262
+ !REL_PATH_RE.test(c.file) ||
263
+ !CHANGE_KINDS.includes(c.kind)
264
+ )
265
+ err(
266
+ `changed[${i}]`,
267
+ `needs a repo-relative "file" and "kind" ${CHANGE_KINDS.join(' | ')}`,
268
+ 'Fix the entry.'
269
+ );
270
+ });
271
+ arr('decisions');
272
+ arr('findings');
273
+ if (Array.isArray(doc.findings))
274
+ doc.findings.forEach((f, i) => {
275
+ if (!f || !SEVERITIES.includes(f.severity) || typeof f.what !== 'string')
276
+ err(
277
+ `findings[${i}]`,
278
+ `needs "severity" (${SEVERITIES.join(' | ')}) and "what"`,
279
+ 'Fix the entry.'
280
+ );
281
+ });
282
+ arr('open_questions');
283
+ if (Array.isArray(doc.open_questions) && doc.open_questions.length > 20)
284
+ err('open_questions', 'has more than 20 entries', 'Keep the 20 that matter.');
285
+ if (doc.result !== undefined && JSON.stringify(doc.result).length > 64 * 1024)
286
+ err('result', 'is over 64 KB', 'Put the bulk in a file and name it.');
287
+ }
288
+ if (r) {
289
+ const known = r === 'in' ? IN_KEYS : OUT_KEYS;
290
+ for (const k of Object.keys(doc))
291
+ if (!known.includes(k)) err(k, 'is not a field of this role', `Remove "${k}".`);
292
+ }
293
+ return { ok: errors.length === 0, role: r, errors };
294
+ }
295
+
296
+ /** An `owns` glob the hook will match: short, few wildcards (the main agent writes them). */
297
+ const GLOB_MAX_CHARS = 256;
298
+ const GLOB_MAX_WILDCARDS = 8;
299
+ const GLOB_TOKEN = /(\*\*\/|\*\*|\*|\?)/;
300
+ const globFits = (g) =>
301
+ typeof g === 'string' &&
302
+ g.length <= GLOB_MAX_CHARS &&
303
+ (g.match(/\*\*\/|\*\*|\*|\?/g) ?? []).length <= GLOB_MAX_WILDCARDS;
304
+
305
+ /**
306
+ * `path` against `glob` (`*` one segment, `**` across, `**` + `/` zero or more segments, `?` one
307
+ * char) as a set-of-states walk: O(path × glob), never a backtracking RegExp over agent text.
308
+ */
309
+ export function globMatch(glob, path) {
310
+ const S = 1;
311
+ const DS = 2;
312
+ const DSS = 3;
313
+ const Q = 4;
314
+ const toks = [];
315
+ for (const part of glob.split(GLOB_TOKEN))
316
+ if (part === '**/') toks.push(DSS);
317
+ else if (part === '**') toks.push(DS);
318
+ else if (part === '*') toks.push(S);
319
+ else if (part === '?') toks.push(Q);
320
+ else for (const ch of part) toks.push(ch);
321
+ const T = toks.length; // the accept state; T + 1 + i = "inside the `**` + `/` at i"
322
+ const close = (set, i) => {
323
+ if (i >= T) {
324
+ set.add(T);
325
+ return;
326
+ }
327
+ if (set.has(i)) return;
328
+ set.add(i);
329
+ if (toks[i] === S || toks[i] === DS) close(set, i + 1);
330
+ else if (toks[i] === DSS) {
331
+ set.add(T + 1 + i);
332
+ close(set, i + 1);
333
+ }
334
+ };
335
+ let cur = new Set();
336
+ close(cur, 0);
337
+ for (const c of path) {
338
+ const next = new Set();
339
+ for (const st of cur) {
340
+ if (st === T) continue;
341
+ if (st > T) {
342
+ next.add(st);
343
+ if (c === '/') close(next, st - T);
344
+ continue;
345
+ }
346
+ const k = toks[st];
347
+ if (k === S) {
348
+ if (c !== '/') close(next, st);
349
+ } else if (k === DS) close(next, st);
350
+ else if (k === Q) {
351
+ if (c !== '/') close(next, st + 1);
352
+ } else if (k === c) close(next, st + 1);
353
+ }
354
+ if (!next.size) return false;
355
+ cur = next;
356
+ }
357
+ return cur.has(T);
358
+ }
359
+ /** Does the hand-off's `owns` cover `repoRel` (POSIX, repo-relative)? `*` one segment, `**` across. */
360
+ export function ownsPath(doc, repoRel) {
361
+ return (
362
+ Array.isArray(doc?.owns) && doc.owns.some((g) => globFits(g) && globMatch(g, String(repoRel)))
363
+ );
364
+ }
365
+
366
+ /**
367
+ * The run's role-"in" hand-offs for a sub-agent of `agentType` (bare names compared): `{ hs,
368
+ * invalid }`. A file that names this agent but is not a valid hand-off is `invalid` (its rel) --
369
+ * the fence fails closed on it (gate-b-sec2 finding 3b) instead of skipping it, which left the
370
+ * agent with no fence at all.
371
+ */
372
+ function handoffScan(ctx, agentType) {
373
+ const dir = join(ctx.run, 'handoff');
374
+ let names = [];
375
+ try {
376
+ names = readdirSync(dir).filter((f) => f.endsWith('.in.json'));
377
+ } catch {
378
+ return { hs: [], invalid: [] };
379
+ }
380
+ const want = bareAgent(agentType);
381
+ const hs = [];
382
+ const invalid = [];
383
+ for (const f of names.sort()) {
384
+ const rel = `_runs/${ctx.session}/handoff/${f}`;
385
+ const text = readOr(join(dir, f));
386
+ const doc = parseOr(text);
387
+ // a file named for this agent (`<agent>-<n>.in.json`) or one whose `agent` is this agent
388
+ const named = f.replace(/-[^-]*\.in\.json$/, '') === want;
389
+ if (doc?.role !== 'in' || bareAgent(doc.agent) !== want) {
390
+ if (named) invalid.push(rel);
391
+ continue;
392
+ }
393
+ if (!validateHandoff(doc, { role: 'in' }).ok) {
394
+ invalid.push(rel);
395
+ continue;
396
+ }
397
+ hs.push({ rel, doc, text });
398
+ }
399
+ return { hs, invalid };
400
+ }
401
+
402
+ /**
403
+ * gate-b-sec2 finding 3 (decision v2-gate-b-sec2-bounded-writer-verbs). The bounded writers are
404
+ * spawned on a hand-off (V2-1.18 §5.5): without a valid one they write nothing. Each one — and the
405
+ * S8.10 Handoff to production run — runs only the `maude` verbs its own body names; any other maude
406
+ * verb (and every non-`design` maude command) is denied. An entry is a verb (`check`: any sub-verb)
407
+ * or a verb + sub-verb (`ds convert`). Derived from each agent's body (`plugins/design/agents/*`);
408
+ * hooks.test.mjs holds every `maude design ...` an agent body names to its list.
409
+ */
410
+ export const HANDOFF_REQUIRED = new Set([
411
+ 'ds-migrator',
412
+ 'draw-agent',
413
+ 'footage-director',
414
+ 'reconstruct-agent',
415
+ ]);
416
+ export const AGENT_VERBS = {
417
+ 'ds-migrator': ['ds convert', 'ds status', 'ds check-system', 'check', 'screenshot'],
418
+ 'draw-agent': ['check', 'draw-build', 'draw-proof', 'svg-optimize', 'server-up'],
419
+ 'footage-director': ['check'],
420
+ // no shell at all (frontmatter, and UNTRUSTED_READERS for the readers): no maude verb either
421
+ 'reconstruct-agent': [],
422
+ 'asset-describer': [],
423
+ 'media-generation-director': [],
424
+ };
425
+ /** S8.10 — a Handoff to production run (MAUDE_CHAT_ID `handoff-<id>`, handoff/write-scopes.ts). */
426
+ export const HANDOFF_CHAT_RE = /^handoff-[a-z0-9]{6,40}$/;
427
+ /** Mirrors apps/studio/handoff/write-scopes.ts HANDOFF_RUN_VERBS (a studio test pins the two). */
428
+ export const HANDOFF_RUN_VERBS = ['handoff', 'to-lottie', 'bootstrap-check', 'check'];
429
+
430
+ const parseOr = (text) => {
431
+ try {
432
+ return text === null ? null : JSON.parse(text);
433
+ } catch {
434
+ return null;
435
+ }
436
+ };
437
+ const isSubagent = (input) => Boolean(input.agent_id || input.agent_type);
438
+
439
+ /**
440
+ * S12.7 — the agents that read untrusted content (a source image, a clip's frames, an asset;
441
+ * DDR-174 Decision 1, DDR-183 F2). Their frontmatter already has no Bash/Web*; the hooks hold
442
+ * them to it at run time as well (an override, a widened copy): no Bash at all, and no write
443
+ * outside the design root — the DDR-174 Addendum gap (`.claude/settings.json`, a CLAUDE.md, a
444
+ * shell rc) that a tool list alone cannot close. `plugin-name-namespace.test.mjs` keeps this set
445
+ * equal to the agents it selects as readers.
446
+ */
447
+ export const UNTRUSTED_READERS = new Set([
448
+ 'footage-analyst',
449
+ 'reconstruct-agent',
450
+ 'reconstruct-critic',
451
+ 'asset-describer',
452
+ ]);
453
+ const isUntrustedReader = (input) =>
454
+ isSubagent(input) && UNTRUSTED_READERS.has(bareAgent(input.agent_type));
455
+
456
+ /**
457
+ * A sub-agent's write OUTSIDE the design root (`d` = null): an untrusted-content reader never
458
+ * makes one; an agent held to a hand-off makes one only into a path its `owns` names (repo-
459
+ * relative, so nothing outside the project ever qualifies). Anything else is not ours to judge.
460
+ */
461
+ function outsideGuard(ctx, input, fenceOf) {
462
+ if (!isSubagent(input)) return null;
463
+ const p = input.tool_input?.file_path ?? input.tool_input?.notebook_path;
464
+ if (typeof p !== 'string' || !p || p.includes('\0')) return null;
465
+ const abs = realpathDeep(isAbsolute(p) ? p : `${ctx.cwd}${sep}${p}`);
466
+ const rel = relative(realpathDeep(ctx.root), abs);
467
+ const inRepo = rel && rel !== '..' && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
468
+ const repoRel = inRepo ? rel.split(sep).join('/') : null;
469
+ const shown = repoRel ? shownPath(repoRel) : fileText(abs, 200);
470
+ if (isUntrustedReader(input))
471
+ return `out-of-scope: ${input.agent_type} reads untrusted content (DDR-174/DDR-183) — it writes nothing outside ${DESIGN_REL}/, and ${shown} is outside it. Write only the files your inputs name.`;
472
+ const f = fenceOf();
473
+ if (f.error) return fenceReason(input, f.error);
474
+ if (!f.hs.length || (repoRel && f.hs.some((h) => ownsPath(h.doc, repoRel)))) return null;
475
+ return `out-of-scope: ${input.agent_type ?? 'this agent'} writes only what its hand-off owns — ${shown} is not in it. Put the change in your hand-off result and let the main agent apply it.`;
476
+ }
477
+
478
+ /**
479
+ * The fence a sub-agent is held to: `{ hs: [{rel, doc}], error }`. The hand-offs SubagentStart
480
+ * recorded (path + content hash), re-read and re-hashed — one gone or changed is an `error` and
481
+ * every write the agent makes is denied (fail closed). No record (SubagentStart did not run: an
482
+ * older plugin, a lost write race) → the directory as it is now, the pre-record behaviour.
483
+ */
484
+ function agentFence(ctx, input) {
485
+ const f = agentFenceOf(ctx, input);
486
+ if (f.error) return f;
487
+ // gate-b-sec2 3b: a bounded writer with no valid hand-off writes nothing (fail closed)
488
+ if (!f.hs.length && HANDOFF_REQUIRED.has(bareAgent(input.agent_type)))
489
+ return { hs: [], error: 'it was spawned without a valid hand-off' };
490
+ return f;
491
+ }
492
+ function agentFenceOf(ctx, input) {
493
+ const id = hookKey(input.agent_id);
494
+ const rec = id ? readJson(join(ctx.run, 'agents.json'), {})?.[id] : null;
495
+ const invalidError = (rels) =>
496
+ `${DESIGN_REL}/${rels[0]}, a hand-off for it, is not a valid hand-off`;
497
+ if (!rec || typeof rec !== 'object') {
498
+ const { hs, invalid } = handoffScan(ctx, input.agent_type);
499
+ return invalid.length ? { hs: [], error: invalidError(invalid) } : { hs, error: null };
500
+ }
501
+ if (!Array.isArray(rec.handoffs)) return { hs: [], error: 'its spawn record lists no hand-offs' };
502
+ if (Array.isArray(rec.invalid) && rec.invalid.length)
503
+ return { hs: [], error: invalidError(rec.invalid.map(String)) };
504
+ const hs = [];
505
+ for (const h of rec.handoffs) {
506
+ const rel = typeof h?.rel === 'string' ? h.rel : '';
507
+ const m = /^_runs\/([^/]+)\/handoff\/[^/]+\.in\.json$/.exec(rel);
508
+ if (!m || m[1] !== ctx.session || typeof h.sha !== 'string')
509
+ return { hs: [], error: 'its spawn record is not one the hooks wrote' };
510
+ const text = readOr(join(ctx.designRoot, rel));
511
+ if (text === null)
512
+ return { hs: [], error: `${DESIGN_REL}/${rel}, the hand-off it was spawned with, is gone` };
513
+ if (sha(text) !== h.sha)
514
+ return { hs: [], error: `${DESIGN_REL}/${rel} changed after it was spawned` };
515
+ const doc = parseOr(text);
516
+ if (!validateHandoff(doc, { role: 'in' }).ok)
517
+ return { hs: [], error: `${DESIGN_REL}/${rel} is no longer a valid hand-off` };
518
+ hs.push({ rel, doc });
519
+ }
520
+ return { hs, error: null };
521
+ }
522
+
523
+ const fenceReason = (input, error) =>
524
+ `out-of-scope: ${input.agent_type ?? 'this agent'} can't write — ${error}. Stop here and report it in your hand-off result; the main agent re-spawns you with a new hand-off.`;
525
+
526
+ /** The local harnesses Maude's own verbs generate (V2-2.8 isLocalHarness): never an AI write. */
527
+ const HARNESS_RE = /^_(?:draw\/[^/]+\.proof|photo\/[^/]+\.bgremove)\.tsx$/;
528
+ /** Run-folder files (and the dirs that hold them) only the hooks and the main agent write. */
529
+ const RUN_CONTROL_RE =
530
+ /^_runs(?:\/[^/]+)?(?:\/handoff)?\/?$|^_runs\/(?:[^/]+\/)*(?:agents\.json[^/]*|handoff\/[^/]+\.in\.json)$/;
531
+ /** The hooks' own state under a run folder — nobody else writes it (D1). */
532
+ const HOOK_STATE_RE =
533
+ /^_runs(?:\/[^/]+)?\/?$|^_runs\/[^/]+\/(?:(?:base|snap|bash)(?:\/.*)?|touched\.json|turn\.json|stop-last[^/]*)$/;
534
+
535
+ /**
536
+ * The guard for a runtime (`_*`) design path a tool would write: `{ code, reason }` or null.
537
+ * `fenceOf` is a thunk (agents.json is read only for a sub-agent writing under _runs/).
538
+ */
539
+ function runtimeGuard(input, rel, fenceOf) {
540
+ // Names compared case-insensitively (F2): on a case-insensitive file system `_RUNS/AGENTS.JSON`
541
+ // IS `_runs/agents.json`, and a name not on disk yet keeps the case it was typed in. An allow
542
+ // (`output`, `owns`) stays exact — only the refusals widen.
543
+ const lc = rel.toLowerCase();
544
+ if (HARNESS_RE.test(lc)) {
545
+ const verb = lc.startsWith('_draw/') ? 'draw-proof' : 'photo-bg-remove';
546
+ return {
547
+ code: 'not-a-writer',
548
+ reason: `not-a-writer: ${shownRel(rel)} is a local harness \`maude design ${verb}\` generates — it is never written by hand or by Bash. Run \`maude design ${verb}\` instead.`,
549
+ };
550
+ }
551
+ // p8-secfix-hook D1 — the hooks' own run state (the run base Stop checks against, the snapshots,
552
+ // the bash marks, touched.json, the last Stop block) and the folders that hold it are written by
553
+ // the hooks alone, main agent included: a planted base equal to the bad file made every error
554
+ // "pre-existing" at Stop; an emptied touched.json leaves nothing for Stop to check.
555
+ if (HOOK_STATE_RE.test(lc))
556
+ return {
557
+ code: 'not-a-writer',
558
+ reason: `not-a-writer: ${shownRel(rel)} is the design hooks' own run state (the run base, snapshots, touched files) — only the hooks write it. Edit the design file itself.`,
559
+ };
560
+ if (!isSubagent(input) || !(lc === '_runs' || lc.startsWith('_runs/'))) return null;
561
+ const f = fenceOf();
562
+ if (f.error) return { code: 'out-of-scope', reason: fenceReason(input, f.error) };
563
+ const repoRel = `${DESIGN_REL}/${rel}`;
564
+ if (f.hs.some((h) => h.doc.output === repoRel)) return null;
565
+ if (!RUN_CONTROL_RE.test(lc) && f.hs.some((h) => ownsPath(h.doc, repoRel))) return null;
566
+ const outs = f.hs.map((h) => h.doc.output);
567
+ return {
568
+ code: 'out-of-scope',
569
+ reason: `out-of-scope: ${input.agent_type ?? 'a sub-agent'} never writes ${shownRel(rel)} — the run folder's hand-offs, agents.json and snapshots belong to the main agent and the hooks.${outs.length ? ` Write your result to ${outs.slice(0, 3).map(shownPath).join(' or ')}.` : ''}`,
570
+ };
571
+ }
572
+
573
+ /**
574
+ * S10.3b — a design system's `revisions/*` (content-addressed, immutable) and `revisions/head.json`
575
+ * (the pointer the ⌘Z hook moves) are written only by the DS engine (V2-1.6 §5.15; S10.2's
576
+ * `ds/head.ts` is the sole head.json writer). A hand edit would fork the history the review and
577
+ * every peer read, so the hook refuses it BEFORE the write — anyone, main agent included. The
578
+ * systems are the config's `designSystems[].path` plus the `system/<ds>/` convention
579
+ * (check/index.ts `kindOf` 'ds-managed', which still blocks a write that got past this).
580
+ */
581
+ function dsManagedGuard(ctx, rel) {
582
+ const lc = rel.toLowerCase();
583
+ const segs = lc.split('/');
584
+ let hit =
585
+ segs[0] === 'system' &&
586
+ segs.length >= 3 &&
587
+ (segs[2] === 'revisions' || segs[segs.length - 1] === 'head.json');
588
+ if (!hit) {
589
+ const cfg = readJson(join(ctx.designRoot, 'config.json'), {});
590
+ const systems = Array.isArray(cfg?.designSystems) ? cfg.designSystems : [];
591
+ hit = systems.some((s) => {
592
+ if (typeof s?.path !== 'string') return false;
593
+ const root = s.path
594
+ .replace(/\\/g, '/')
595
+ .replace(/^\/+|\/+$/g, '')
596
+ .toLowerCase();
597
+ return !!root && (lc.startsWith(`${root}/revisions/`) || lc === `${root}/head.json`);
598
+ });
599
+ }
600
+ if (!hit) return null;
601
+ return `ds-managed: ${shownRel(rel)} is design-system history Maude keeps — revisions and head.json are never written by hand. Change the system with \`maude design ds\` (pending --set, publish, keep, undo, pick); \`maude design ds status --json\` shows where it stands.`;
602
+ }
603
+
604
+ /** The run id the hand-offs carry: stable per session, no studio needed (V2-1.18 §5.1 shape). */
605
+ const runIdOf = (ctx) => `r_${sha(ctx.session).slice(0, 16)}`;
606
+ /** A design path as a reason names it: plain when it is plain, else cleaned + quoted (F3). */
607
+ const PLAIN_REL_RE = /^[A-Za-z0-9 _./()*-]{1,240}$/;
608
+ const shownPath = (r) => (PLAIN_REL_RE.test(r) ? r : fileText(r, 200));
609
+ const shownRel = (rel) => shownPath(`${DESIGN_REL}/${rel}`);
610
+ /** An artboard id as a reason names it (the studio's AGENT_ID_RE, else cleaned + quoted). */
611
+ const shownId = (id) =>
612
+ typeof id === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(id) ? id : fileText(id);
613
+ /** The studio's pre-edit deny reason as it is forwarded: one line, capped (F3 second net). */
614
+ export const STUDIO_REASON_MAX = 800;
615
+ export const studioReason = (reason) => cleanText(reason, STUDIO_REASON_MAX);
616
+
617
+ /** semver `a` < `b` (x.y.z, a prerelease before its release). Unparseable → false. */
618
+ export function versionOlder(a, b) {
619
+ const parse = (v) => {
620
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/.exec(String(v ?? '').trim());
621
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3]), m[4] ?? null] : null;
622
+ };
623
+ const x = parse(a);
624
+ const y = parse(b);
625
+ if (!x || !y) return false;
626
+ for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] < y[i];
627
+ if (x[3] === y[3] || x[3] === null) return false;
628
+ if (y[3] === null) return true;
629
+ return x[3].localeCompare(y[3], 'en', { numeric: true }) < 0;
630
+ }
631
+
632
+ const SAFE_CANVAS_RE = /^[A-Za-z0-9 _./()-]{1,240}\.(?:tsx|jsx)$/;
633
+
634
+ /**
635
+ * SessionStart: export the hook session to this session's Bash commands (Claude Code's
636
+ * CLAUDE_ENV_FILE), so `maude design screenshot` files its captures under this run. Then the
637
+ * §5.6 handshake: the plugin's bundled actions.manifest.json against the app's — /_health
638
+ * `manifestVersion` when the studio is up, else this CLI's own manifest — and one line when the
639
+ * plugin is the older side. Never blocks.
640
+ */
641
+ async function sessionStart(ctx) {
642
+ const envFile = process.env.CLAUDE_ENV_FILE;
643
+ if (envFile && isAbsolute(envFile) && ctx.session !== 'no-session') {
644
+ try {
645
+ // gate-b-sec2: and the project this session is held to (cli/lib/confine-root.mjs)
646
+ const q = `'${ctx.root.replaceAll("'", `'\\''`)}'`;
647
+ appendFileSync(
648
+ envFile,
649
+ `export MAUDE_HOOK_SESSION=${ctx.session}\nexport MAUDE_SESSION_ROOT=${q}\n`
650
+ );
651
+ } catch {
652
+ /* no env file: captures go to _runs/shots.jsonl */
653
+ }
654
+ }
655
+ const lines = [];
656
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
657
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
658
+ if (pluginRoot && isAbsolute(pluginRoot)) {
659
+ const plugin = {
660
+ mv: readJson(join(pluginRoot, 'actions.manifest.json'), null)?.manifestVersion,
661
+ version: readJson(join(pluginRoot, '.claude-plugin', 'plugin.json'), null)?.version,
662
+ };
663
+ const cli = ctx.pkgRoot
664
+ ? {
665
+ mv: readJson(join(ctx.pkgRoot, 'apps', 'studio', 'actions.manifest.json'), null)
666
+ ?.manifestVersion,
667
+ version: readJson(join(ctx.pkgRoot, 'package.json'), null)?.version,
668
+ }
669
+ : {};
670
+ const h = studio?.health;
671
+ const app =
672
+ typeof h?.manifestVersion === 'string'
673
+ ? {
674
+ mv: h.manifestVersion,
675
+ version: typeof h.version === 'string' ? h.version : cli.version,
676
+ }
677
+ : cli;
678
+ if (
679
+ typeof plugin.mv === 'string' &&
680
+ typeof app.mv === 'string' &&
681
+ plugin.mv !== app.mv &&
682
+ versionOlder(plugin.version, app.version)
683
+ )
684
+ lines.push(
685
+ `The Maude design plugin (${plugin.version}) is older than Maude (${app.version}), so its skills may not know every action. Tell the person to update the plugin: /plugin marketplace update maude, then /reload-plugins.`
686
+ );
687
+ }
688
+ if (studio) {
689
+ const active = readJson(join(ctx.designRoot, '_active.json'), null)?.active;
690
+ const rel = typeof active === 'string' ? active.replace(/^\.design\//, '') : null;
691
+ if (rel && SAFE_CANVAS_RE.test(rel) && !rel.split('/').includes('..'))
692
+ lines.push(`Maude is showing ${rel} (the active canvas).`);
693
+ // V2-8.16 S1 — a terminal session rarely loads the design skill for "put it back", and re-typed
694
+ // the old text by hand (a new change: no restore version, no one-step undo). Told once, here.
695
+ lines.push(
696
+ 'Put a canvas back to an earlier version with `maude design history restore <canvas> <ref>` (refs: `history list`), never by re-typing it.'
697
+ );
698
+ }
699
+ if (!lines.length) return null;
700
+ return {
701
+ hookSpecificOutput: {
702
+ hookEventName: 'SessionStart',
703
+ additionalContext: lines.join(' ').slice(0, 400),
704
+ },
705
+ };
706
+ }
707
+
708
+ function subagentStart(ctx, input) {
709
+ const id = hookKey(input.agent_id);
710
+ if (!id) return null;
711
+ const p = join(ctx.run, 'agents.json');
712
+ const agents = readJson(p, {});
713
+ agents[id] = {
714
+ type: typeof input.agent_type === 'string' ? input.agent_type : null,
715
+ at: Date.now(),
716
+ ...(() => {
717
+ const { hs, invalid } = handoffScan(ctx, input.agent_type);
718
+ return { handoffs: hs.map((h) => ({ rel: h.rel, sha: sha(h.text) })), invalid };
719
+ })(),
720
+ };
721
+ // tmp + rename: a torn agents.json would read as "no record" for every agent
722
+ const tmp = `${p}.${process.pid}.tmp`;
723
+ writeAt(tmp, JSON.stringify(agents));
724
+ renameSync(tmp, p);
725
+ return null;
726
+ }
727
+
728
+ function context(input, pkgRoot) {
729
+ const cwd = typeof input.cwd === 'string' ? input.cwd : process.cwd();
730
+ const root = findProjectRoot(cwd);
731
+ if (!root) return null;
732
+ const designRoot = join(root, DESIGN_REL);
733
+ const session = hookKey(input.session_id) ?? 'no-session';
734
+ return { root, designRoot, session, cwd, pkgRoot, run: join(designRoot, '_runs', session) };
735
+ }
736
+
737
+ /** The generated manifest's verb table (`{verb, effect}` rows), or null when it can't be read. */
738
+ function manifestVerbs(ctx) {
739
+ if (!ctx.pkgRoot) return null;
740
+ const m = readJson(join(ctx.pkgRoot, 'apps', 'studio', 'actions.manifest.json'), null);
741
+ return Array.isArray(m?.verbs) ? m.verbs : null;
742
+ }
743
+
744
+ /**
745
+ * p8-a1-claims — the same table with every `design` verb read as writing nothing unclaimed: each one
746
+ * claims its own canvas writes before they land (apps/studio/ai/write-claim.ts). What is left writing
747
+ * is the part of a call that cannot claim (the S7 interpreter fallback: python, node -e, sed -i …).
748
+ */
749
+ function claimingVerbs(ctx) {
750
+ const verbs = manifestVerbs(ctx);
751
+ return verbs
752
+ ? verbs.map((v) =>
753
+ typeof v?.verb === 'string' && v.verb.startsWith('design ') ? { ...v, effect: 'none' } : v
754
+ )
755
+ : null;
756
+ }
757
+
758
+ /**
759
+ * The `maude design` verbs in `command` that write (effect other than `none`). An unknown table
760
+ * counts every design verb as a writer: binding finds nothing when nothing changed.
761
+ */
762
+ function writeVerbs(ctx, command) {
763
+ if (typeof command !== 'string' || !command.includes('maude')) return [];
764
+ const cmds = parseBash(command);
765
+ if (!cmds) return [];
766
+ const verbs = manifestVerbs(ctx);
767
+ const out = [];
768
+ for (const c of cmds) {
769
+ const v = designVerbOf(c, verbs);
770
+ if (v && v.verb !== 'hook' && v.effect !== 'none') out.push({ ...v, cmd: c });
771
+ }
772
+ return out;
773
+ }
774
+
775
+ /** The design root as the kernel names it (symlinks followed, on-disk case), once per ctx. */
776
+ const designReal = (ctx) => {
777
+ ctx.designReal ??= realpathDeep(ctx.designRoot);
778
+ return ctx.designReal;
779
+ };
780
+
781
+ /**
782
+ * The designRoot-relative POSIX path of the tool's target, runtime ones included; null outside.
783
+ * Classified by the file the kernel opens, not by the text (F2): every existing segment
784
+ * realpath'd — symlinks followed, `..` popped after them, the on-disk case on a case-insensitive
785
+ * file system — the missing tail kept as written, relative to the realpath'd design root.
786
+ */
787
+ function designTarget(ctx, input) {
788
+ const ti = input.tool_input ?? {};
789
+ const p = ti.file_path ?? ti.notebook_path;
790
+ if (typeof p !== 'string' || !p || p.includes('\0')) return null;
791
+ const cwd = typeof input.cwd === 'string' ? input.cwd : process.cwd();
792
+ const abs = realpathDeep(isAbsolute(p) ? p : `${cwd}${sep}${p}`);
793
+ const rel = relative(designReal(ctx), abs);
794
+ if (!rel || rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel)) return null;
795
+ const posix = rel.split(sep).join('/');
796
+ const runtime = posix.startsWith('_') || posix.split('/').some((s) => s.startsWith('.'));
797
+ return { abs, rel: posix, runtime };
798
+ }
799
+ /** The designRoot-relative POSIX path of the tool's target, or null (outside / runtime). */
800
+ function targetOf(ctx, input) {
801
+ const t = designTarget(ctx, input);
802
+ return t && !t.runtime ? { abs: t.abs, rel: t.rel } : null;
803
+ }
804
+
805
+ const snapRel = (ctx, toolUseId) => `_runs/${ctx.session}/snap/${toolUseId}`;
806
+ const baseRel = (ctx, rel) => `_runs/${ctx.session}/base/${sha(rel).slice(0, 16)}`;
807
+
808
+ /** Save `cur` (or the "did not exist" marker) at `rel` under designRoot. */
809
+ function saveSnapshot(ctx, rel, cur) {
810
+ const abs = join(ctx.designRoot, rel);
811
+ if (cur === null) writeAt(`${abs}.new`, '');
812
+ else writeAt(abs, cur);
813
+ }
814
+ /**
815
+ * p8-secfix-hook F4 — the run base is the file as it was before the run first wrote it. A shell
816
+ * call the hook can't read (a python heredoc, `nohup … &`) writes without a snapshot, so the next
817
+ * edit's first sight of the file would be AFTER that write and every finding the shell call planted
818
+ * would read as "pre-existing". Such a file gets a `.bash` marker instead of a base: no base is
819
+ * ever saved for it in this run, and Stop checks it with none (every finding counts as the run's).
820
+ */
821
+ const shellMarkAbs = (ctx, rel) => join(ctx.designRoot, `${baseRel(ctx, rel)}.bash`);
822
+ const shellWrote = (ctx, rel) => existsSync(shellMarkAbs(ctx, rel));
823
+
824
+ /**
825
+ * p8-secfix-hook-2 N1 — when this turn began (`turn.json`, written by the prompt hook), or null
826
+ * (no prompt seen: an older hook build, `no-session`). A value in the future is not a turn start.
827
+ */
828
+ function turnStart(ctx, now = Date.now()) {
829
+ const at = readJson(join(ctx.run, 'turn.json'), null)?.at;
830
+ return typeof at === 'number' && Number.isFinite(at) && at <= now ? at : null;
831
+ }
832
+ /**
833
+ * Does shell mark `m` still count? It began in THIS turn (a mark left by a turn that ended without
834
+ * a passing Stop — the person interrupted it — is not this turn's) and at most BG_MARK_MS ago.
835
+ */
836
+ function liveMark(m, now, turn) {
837
+ if (typeof m?.at !== 'number' || !Number.isFinite(m.at) || m.at > now) return false;
838
+ if (now - m.at > BG_MARK_MS) return false;
839
+ return turn === null || m.at >= turn;
840
+ }
841
+
842
+ /** Did an AI shell call still in flight (or left running) possibly write `rel` since it began? */
843
+ function shellMayHaveWritten(ctx, rel) {
844
+ let mtime;
845
+ try {
846
+ mtime = statSync(join(ctx.designRoot, rel)).mtimeMs;
847
+ } catch {
848
+ return false;
849
+ }
850
+ let names = [];
851
+ try {
852
+ names = readdirSync(join(ctx.run, 'bash'));
853
+ } catch {
854
+ return false;
855
+ }
856
+ const now = Date.now();
857
+ const turn = turnStart(ctx, now);
858
+ return names.some((n) => {
859
+ const m = readJson(join(ctx.run, 'bash', n), null);
860
+ return liveMark(m, now, turn) && mtime >= m.at;
861
+ });
862
+ }
863
+
864
+ /** Save the run's base of `rel` (= `cur`) unless it has one, or a shell call wrote it first. */
865
+ function ensureBase(ctx, rel, cur) {
866
+ const base = baseRel(ctx, rel);
867
+ if (loadSnapshot(ctx, base) || shellWrote(ctx, rel)) return;
868
+ if (shellMayHaveWritten(ctx, rel)) writeAt(shellMarkAbs(ctx, rel), '');
869
+ else saveSnapshot(ctx, base, cur);
870
+ }
871
+
872
+ /** A shell call wrote `rel` before the run had a base of it: mark it (see ensureBase). */
873
+ function markShellWrite(ctx, rel) {
874
+ if (!loadSnapshot(ctx, baseRel(ctx, rel)) && !shellWrote(ctx, rel))
875
+ writeAt(shellMarkAbs(ctx, rel), '');
876
+ }
877
+
878
+ /** { existed, content } of a saved snapshot, or null when there is none. */
879
+ function loadSnapshot(ctx, rel) {
880
+ const abs = join(ctx.designRoot, rel);
881
+ const content = readOr(abs);
882
+ if (content !== null) return { existed: true, content, rel };
883
+ if (existsSync(`${abs}.new`)) return { existed: false, content: null, rel };
884
+ return null;
885
+ }
886
+
887
+ /**
888
+ * `maude design check` of one designRoot file → { ok, errors, existing } or null (could not run:
889
+ * fail open). The studio's warm validator when it is up, else a local run of the verb. Michal
890
+ * 2026-10-29 (kg maude/v2-michal-gate-blocks-only-introduced-findings): `errors` are only the
891
+ * findings this write INTRODUCED against `snapshot` (none = a new file: all of them), `existing`
892
+ * the ones the file already had — those never block. A studio too old to split answers without
893
+ * `existing`: every error then blocks, as before.
894
+ */
895
+ async function check(ctx, studio, rel, tier, snapshot, self) {
896
+ if (studio) {
897
+ const r = await postStudio(
898
+ studio,
899
+ '/_api/agent/check',
900
+ {
901
+ path: rel,
902
+ tier,
903
+ strict: true,
904
+ introduced: true,
905
+ ...(snapshot?.existed ? { snapshot: snapshot.rel } : {}),
906
+ },
907
+ { timeoutMs: 900 }
908
+ );
909
+ if (r?.status === 200 && r.body && typeof r.body.ok === 'boolean')
910
+ return {
911
+ ok: r.body.ok,
912
+ errors: Array.isArray(r.body.errors) ? r.body.errors : [],
913
+ existing: Array.isArray(r.body.existing) ? r.body.existing : [],
914
+ };
915
+ }
916
+ if (!self) return null;
917
+ const args = [
918
+ join(ctx.designRoot, rel),
919
+ '--strict',
920
+ '--tier',
921
+ tier,
922
+ '--json',
923
+ '--introduced',
924
+ '--root',
925
+ ctx.root,
926
+ ];
927
+ if (snapshot?.existed) args.push('--against', join(ctx.designRoot, snapshot.rel));
928
+ const p = spawnSync(self[0], [...self.slice(1), 'design', 'check', ...args], {
929
+ encoding: 'utf8',
930
+ timeout: tier === 'stop' ? 20000 : 1200,
931
+ env: { ...process.env, MAUDE_NO_UPDATE_CHECK: '1' },
932
+ });
933
+ try {
934
+ const results = JSON.parse(p.stdout);
935
+ const errors = results.flatMap((x) => x.errors ?? []);
936
+ const existing = results.flatMap((x) => (Array.isArray(x.existing) ? x.existing : []));
937
+ return { ok: errors.length === 0, errors, existing };
938
+ } catch {
939
+ return null;
940
+ }
941
+ }
942
+
943
+ /**
944
+ * Who is driving this session: the Maude chat's ACP bridge marks the adapter it spawns with
945
+ * MAUDE_AGENT_ACTOR=maude-chat (the adapter hands its env to `claude`, and `claude` to every hook);
946
+ * anything else is a terminal Claude Code. Attribution only, never a permission.
947
+ */
948
+ export const hookActor = (env = process.env) =>
949
+ env.MAUDE_AGENT_ACTOR === 'maude-chat' ? 'maude-chat' : 'claude-code';
950
+
951
+ /**
952
+ * V2-1.15 §5.4 "Binding the hook run key": the ACP bridge spawns each chat's `claude` with
953
+ * MAUDE_CHAT_ID=<chatId> (acp/env.ts `chatSpawnEnv`); every `/_api/agent/*` call sends it as
954
+ * `chat`, so the hook's run IS that chat's `starting` run — one turn is never two runs. A value
955
+ * that is not a chat id is ignored (the call binds by session alone). Attribution and run
956
+ * binding only, never a permission: the studio's checks are the same either way.
957
+ */
958
+ export const hookChat = (env = process.env) => {
959
+ const v = env.MAUDE_CHAT_ID;
960
+ return typeof v === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(v) ? v : null;
961
+ };
962
+ /** The hook key the studio resolves a run by: the session, plus the chat when there is one. */
963
+ const runKey = (ctx) => {
964
+ const chat = hookChat();
965
+ return chat ? { session: ctx.session, chat } : { session: ctx.session };
966
+ };
967
+
968
+ /**
969
+ * p8-secfix-hook-2 N1 — a prompt starts a turn: its start goes to `turn.json`, and every background
970
+ * mark left behind is dropped unread. Each belongs to a turn that is over (a passing Stop removes
971
+ * the run folder, so these are from a turn the person interrupted); draining them now would bind
972
+ * the person's own saves since then to the AI. Foreground marks stay for their post-bash; they no
973
+ * longer count once their turn is over (`liveMark`).
974
+ */
975
+ function startTurn(ctx) {
976
+ const dir = join(ctx.run, 'bash');
977
+ let names = [];
978
+ try {
979
+ names = readdirSync(dir);
980
+ } catch {
981
+ /* no marks */
982
+ }
983
+ for (const n of names)
984
+ if (readJson(join(dir, n), null)?.bg) rmSync(join(dir, n), { force: true });
985
+ writeAt(join(ctx.run, 'turn.json'), JSON.stringify({ at: Date.now() }));
986
+ }
987
+
988
+ async function prompt(ctx, input) {
989
+ // V2-1.18 §5.4: the main agent needs its run folder to write hand-offs — named once a session
990
+ const marker = join(ctx.designRoot, '_runs', 'sessions', `${ctx.session}.json`);
991
+ let out = null;
992
+ if (ctx.session !== 'no-session') startTurn(ctx);
993
+ if (ctx.session !== 'no-session' && !existsSync(marker)) {
994
+ writeAt(marker, JSON.stringify({ at: Date.now() }));
995
+ out = {
996
+ hookSpecificOutput: {
997
+ hookEventName: 'UserPromptSubmit',
998
+ additionalContext: `Maude run folder for this conversation: ${DESIGN_REL}/_runs/${ctx.session}/ (run id ${runIdOf(ctx)}; sub-agent hand-offs go in its handoff/).`,
999
+ },
1000
+ };
1001
+ }
1002
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
1003
+ if (!studio) return out;
1004
+ const promptId = hookKey(input.prompt_id);
1005
+ // No label: the prompt text stays on this machine (a run label is shown to collaborators).
1006
+ await postStudio(
1007
+ studio,
1008
+ '/_api/agent/run/begin',
1009
+ { ...runKey(ctx), ...(promptId ? { promptId } : {}), actor: hookActor() },
1010
+ { timeoutMs: 600 }
1011
+ );
1012
+ return out;
1013
+ }
1014
+
1015
+ /**
1016
+ * S12.16 — a new canvas is made by the app's own create (`POST /_api/canvas`), never written by
1017
+ * hand: a hand-made one differs from the app's in its name, its `.meta.json` and its scaffold, and
1018
+ * its first version is not the AI's. Not canvases: a design system's files (its folder, the
1019
+ * `system/` tree), a component (a `newComponentDir`, top level or per system), a `_`-prefixed
1020
+ * helper module. Returns the deny reason, or null.
1021
+ */
1022
+ export function handMadeCanvasReason(designRoot, rel) {
1023
+ if (!/\.tsx$/i.test(rel)) return null;
1024
+ const segs = rel.split('/');
1025
+ if (segs[segs.length - 1].startsWith('_') || segs[0] === 'system') return null;
1026
+ const cfg = readJson(join(designRoot, 'config.json'), {});
1027
+ const dirs = [
1028
+ typeof cfg?.newComponentDir === 'string' ? cfg.newComponentDir : 'ui/project/components',
1029
+ ];
1030
+ for (const s of Array.isArray(cfg?.designSystems) ? cfg.designSystems : []) {
1031
+ if (typeof s?.path === 'string') dirs.push(s.path);
1032
+ if (typeof s?.newComponentDir === 'string') dirs.push(s.newComponentDir);
1033
+ }
1034
+ const under = (d) => {
1035
+ const dir = String(d).replace(/^\.?\/+|\/+$/g, '');
1036
+ return dir !== '' && (rel === dir || rel.startsWith(`${dir}/`));
1037
+ };
1038
+ if (dirs.some(under)) return null;
1039
+ return `new-canvas: ${rel} does not exist yet, and a canvas is never written by hand. Make it with the app's own create — \`maude design curl-local "http://127.0.0.1:<port>/_api/canvas" --method POST --header "Content-Type: application/json" --data '{"kind":"blank","name":"<name>"}'\` (the port is in ${DESIGN_REL}/_server.json; the answer's \`rel\` is the file) — then Edit the file it made. A component goes in the newComponentDir instead.`;
1040
+ }
1041
+
1042
+ async function preEdit(ctx, input) {
1043
+ if (!EDIT_TOOLS.has(input.tool_name)) return null;
1044
+ const d = designTarget(ctx, input);
1045
+ let fence = null;
1046
+ const fenceOf = () => {
1047
+ fence ??= agentFence(ctx, input);
1048
+ return fence;
1049
+ };
1050
+ if (!d) {
1051
+ const outside = outsideGuard(ctx, input, fenceOf);
1052
+ return outside ? deny(outside) : null;
1053
+ }
1054
+ // S10.3b: a design system's managed files (revisions, the review's own state) are written by the
1055
+ // DS verbs, never by an editing tool.
1056
+ if (!d.runtime) {
1057
+ const managed = dsManagedGuard(ctx, d.rel);
1058
+ if (managed) return deny(managed);
1059
+ }
1060
+ if (isSubagent(input) && fenceOf().error) return deny(fenceReason(input, fence.error));
1061
+ if (d.runtime) {
1062
+ const g = runtimeGuard(input, d.rel, fenceOf);
1063
+ return g ? deny(g.reason) : null;
1064
+ }
1065
+ const t = { abs: d.abs, rel: d.rel };
1066
+ // 0. a sub-agent spawned with a hand-off writes only what it `owns` (V2-1.18 §5.4 (a))
1067
+ if (isSubagent(input)) {
1068
+ const hs = fenceOf().hs;
1069
+ const repoRel = `${DESIGN_REL}/${t.rel}`;
1070
+ if (hs.length && !hs.some((h) => ownsPath(h.doc, repoRel))) {
1071
+ const owns = [...new Set(hs.flatMap((h) => h.doc.owns))]
1072
+ .slice(0, 6)
1073
+ .map(shownPath)
1074
+ .join(', ');
1075
+ return deny(
1076
+ `out-of-scope: ${input.agent_type ?? 'this agent'} writes only what its hand-off owns (${owns}) — ${shownRel(t.rel)} is not in it. Put the change in your hand-off result and let the main agent apply it.`
1077
+ );
1078
+ }
1079
+ }
1080
+ // 0b. a new canvas is made by the create (S12.16) — a sub-agent held to a hand-off that owns
1081
+ // the path (checked above) makes the file it was handed
1082
+ if (
1083
+ input.tool_name === 'Write' &&
1084
+ !existsSync(t.abs) &&
1085
+ !(isSubagent(input) && fenceOf().hs.length)
1086
+ ) {
1087
+ const made = handMadeCanvasReason(ctx.designRoot, t.rel);
1088
+ if (made) return deny(made);
1089
+ }
1090
+ const ti = input.tool_input ?? {};
1091
+ const cur = readOr(t.abs);
1092
+ const toolUseId = hookKey(input.tool_use_id);
1093
+ // 1. snapshots (no studio needed): this edit's, and the run's first sight of the file — never
1094
+ // after an AI shell write it could not snapshot (F4, ensureBase)
1095
+ if (toolUseId) saveSnapshot(ctx, snapRel(ctx, toolUseId), cur);
1096
+ ensureBase(ctx, t.rel, cur);
1097
+ // 2. the lazy whole-file rewrite
1098
+ if (input.tool_name === 'Write' && cur !== null && CANVAS_RE.test(t.rel)) {
1099
+ const lines = cur.split('\n').length;
1100
+ if (lines > LAZY_WRITE_LINES)
1101
+ return deny(
1102
+ `whole-file-rewrite: ${t.rel} already exists (${lines} lines). Use Edit on existing canvases — it keeps element ids and locked elements.`
1103
+ );
1104
+ }
1105
+ // 3. the studio's view: busy artboards (A4), read-only sessions
1106
+ if (!toolUseId) return null;
1107
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
1108
+ if (!studio) return null;
1109
+ // p8-a1-claims — a MultiEdit is replayed here (the studio replays Edit itself): the exact bytes
1110
+ const multi = input.tool_name === 'MultiEdit' ? replayEdit('MultiEdit', ti, cur) : null;
1111
+ const edit =
1112
+ input.tool_name === 'Write'
1113
+ ? { content: String(ti.content ?? '') }
1114
+ : typeof multi === 'string'
1115
+ ? { content: multi }
1116
+ : input.tool_name === 'Edit' && typeof ti.old_string === 'string'
1117
+ ? {
1118
+ old: ti.old_string,
1119
+ new: String(ti.new_string ?? ''),
1120
+ replaceAll: ti.replace_all === true,
1121
+ }
1122
+ : undefined;
1123
+ const r = await postStudio(
1124
+ studio,
1125
+ '/_api/agent/edit/check',
1126
+ {
1127
+ ...runKey(ctx),
1128
+ toolUseId,
1129
+ tool: input.tool_name,
1130
+ path: t.rel,
1131
+ ...(edit ? { edit } : {}),
1132
+ },
1133
+ { timeoutMs: 600 }
1134
+ );
1135
+ if (r?.status === 200 && r.body?.decision === 'deny' && typeof r.body.reason === 'string')
1136
+ return deny(studioReason(r.body.reason));
1137
+ return null;
1138
+ }
1139
+
1140
+ /** touched.json: the latest touch of `rel`, its artboards unioned (null = unknown, sticky). */
1141
+ function recordTouch(ctx, rel, { by, via, artboards, at = Date.now() }) {
1142
+ const p = join(ctx.run, 'touched.json');
1143
+ const touched = readJson(p, {});
1144
+ const prev = touched[rel];
1145
+ const known = prev && prev.artboards === null ? null : artboards;
1146
+ touched[rel] = {
1147
+ at: Math.max(at, prev?.at ?? 0),
1148
+ by,
1149
+ via,
1150
+ artboards: known === null ? null : [...new Set([...(prev?.artboards ?? []), ...(known ?? [])])],
1151
+ };
1152
+ writeAt(p, JSON.stringify(touched));
1153
+ }
1154
+
1155
+ /** Captures of `rel` at or after `since`: this session's shots, plus session-less ones. */
1156
+ function shotsOf(ctx, rel, since) {
1157
+ const out = [];
1158
+ for (const p of [join(ctx.run, 'shots.jsonl'), join(ctx.designRoot, '_runs', 'shots.jsonl')]) {
1159
+ const text = readOr(p);
1160
+ if (!text) continue;
1161
+ for (const line of text.split('\n')) {
1162
+ try {
1163
+ const s = JSON.parse(line);
1164
+ if (s?.canvas === rel && typeof s.at === 'number' && s.at >= since) out.push(s);
1165
+ } catch {
1166
+ /* a torn line */
1167
+ }
1168
+ }
1169
+ }
1170
+ return out;
1171
+ }
1172
+
1173
+ const ARTBOARD_ID_RE = /<DCArtboard\b[^>]*?\bid=["']([^"']+)["']/g;
1174
+
1175
+ /**
1176
+ * §5.4 stop step 2 — touched artboards without a capture newer than their last edit, as
1177
+ * `canvas › artboard` (or `canvas` when its artboards are unknown). A removed artboard needs none.
1178
+ */
1179
+ function missingShots(ctx, touched) {
1180
+ const missing = [];
1181
+ for (const [rel, t] of Object.entries(touched)) {
1182
+ if (!CANVAS_RE.test(rel)) continue;
1183
+ const src = readOr(join(ctx.designRoot, rel));
1184
+ if (src === null) continue;
1185
+ const shots = shotsOf(ctx, rel, t.at ?? 0);
1186
+ if (shots.some((s) => s.all === true)) continue;
1187
+ if (!Array.isArray(t.artboards)) {
1188
+ if (!shots.length) missing.push(shownPath(rel));
1189
+ continue;
1190
+ }
1191
+ const exist = new Set([...src.matchAll(ARTBOARD_ID_RE)].map((m) => m[1]));
1192
+ for (const id of t.artboards)
1193
+ if (exist.has(id) && !shots.some((s) => s.artboard === id))
1194
+ missing.push(`${shownPath(rel)} › ${shownId(id)}`);
1195
+ }
1196
+ return missing;
1197
+ }
1198
+
1199
+ async function postEdit(ctx, input, self) {
1200
+ const t0 = performance.now();
1201
+ if (!EDIT_TOOLS.has(input.tool_name)) return null;
1202
+ const t = targetOf(ctx, input);
1203
+ if (!t) return null;
1204
+ const toolUseId = hookKey(input.tool_use_id);
1205
+ const snap = toolUseId ? loadSnapshot(ctx, snapRel(ctx, toolUseId)) : null;
1206
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
1207
+ const res = await check(ctx, studio, t.rel, 'fast', snap, self);
1208
+ const had = alreadyThere(res?.existing, { shell: shellWrote(ctx, t.rel) });
1209
+ if (res && !res.ok) {
1210
+ // roll back ONLY if the file still holds exactly what the tool wrote
1211
+ let restored = false;
1212
+ if (snap) {
1213
+ const wrote = replayEdit(input.tool_name, input.tool_input ?? {}, snap.content);
1214
+ if (wrote !== null && readOr(t.abs) === wrote) {
1215
+ try {
1216
+ if (snap.existed) writeFileSync(t.abs, snap.content);
1217
+ else unlinkSync(t.abs);
1218
+ restored = true;
1219
+ } catch {
1220
+ /* leave it */
1221
+ }
1222
+ }
1223
+ }
1224
+ return {
1225
+ decision: 'block',
1226
+ reason: `${res.errors.map((f) => findingLine(f)).join('\n')}\n${
1227
+ restored
1228
+ ? 'The file was restored to before this edit — make the change again without these problems.'
1229
+ : 'The file was left as it is (it changed after this edit) — fix these problems.'
1230
+ }${had ? `\n${had.brief}` : ''}`,
1231
+ };
1232
+ }
1233
+ let artboards = null; // unknown without the studio's map
1234
+ if (studio && toolUseId) {
1235
+ const r = await postStudio(
1236
+ studio,
1237
+ '/_api/agent/edit/touched',
1238
+ { ...runKey(ctx), toolUseId, path: t.rel, via: 'tool' },
1239
+ { timeoutMs: 900 }
1240
+ );
1241
+ if (r?.status === 200 && Array.isArray(r.body?.artboards)) artboards = r.body.artboards;
1242
+ }
1243
+ recordTouch(ctx, t.rel, { by: input.agent_type ?? 'main', via: 'tool', artboards });
1244
+ const notes = [
1245
+ had?.full,
1246
+ syncedBoardHint(ctx, t.rel),
1247
+ dsWarnings(ctx, t.rel, input, self, t0),
1248
+ ].filter(Boolean);
1249
+ return notes.length
1250
+ ? { hookSpecificOutput: { hookEventName: 'PostToolUse', additionalContext: notes.join('\n') } }
1251
+ : null;
1252
+ }
1253
+
1254
+ const EXISTING_SHOWN = 5;
1255
+ /**
1256
+ * The errors a file already had before this write, for the agent: `full` (pre-existing only — the
1257
+ * edit is kept; additionalContext) and `brief` (beside a block, one line). Null when there are none.
1258
+ */
1259
+ function alreadyThere(existing, { shell = false } = {}) {
1260
+ if (!Array.isArray(existing) || !existing.length) return null;
1261
+ const n = existing.length;
1262
+ if (shell) {
1263
+ // F4 — this run wrote the file through the shell before any copy of it was kept: what was
1264
+ // there before THIS edit may be the run's own, so it is never called pre-existing
1265
+ const lines = existing.slice(0, EXISTING_SHOWN).map((f) => findingLine(f, 'error'));
1266
+ if (n > EXISTING_SHOWN) lines.push(`… and ${n - EXISTING_SHOWN} more`);
1267
+ const what = n === 1 ? 'This finding is' : `These ${n} findings are`;
1268
+ return {
1269
+ full: `${what} in the file, which this run changed through the shell. This edit did not add ${n === 1 ? 'it' : 'them'}, so it is kept, but ${n === 1 ? 'it counts' : 'they count'} as this run's: fix ${n === 1 ? 'it' : 'them'} before you finish (Stop checks the file):\n${lines.join('\n')}`,
1270
+ brief: `${n === 1 ? 'One more finding is' : `${n} more findings are`} in the file this run changed through the shell; fix ${n === 1 ? 'it' : 'them'} before you finish (${[...new Set(existing.map((f) => cleanFinding(f).code))].join(', ')}).`,
1271
+ };
1272
+ }
1273
+ const lines = existing.slice(0, EXISTING_SHOWN).map((f) => findingLine(f, 'pre-existing'));
1274
+ if (n > EXISTING_SHOWN) lines.push(`… and ${n - EXISTING_SHOWN} more`);
1275
+ return {
1276
+ full: `${n === 1 ? 'This finding was' : `These ${n} findings were`} already in the file before this edit, so they do not block it (fix them only if the task asks for it):\n${lines.join('\n')}`,
1277
+ brief: `${n === 1 ? 'One more finding was' : `${n} more findings were`} already in the file before this edit and do not block (${[...new Set(existing.map((f) => cleanFinding(f).code))].join(', ')}).`,
1278
+ };
1279
+ }
1280
+
1281
+ /** The files the `ds` checker reads S-rules / system structure from (the old hook's filter). */
1282
+ const DS_FILE_RE = /(?:\.tsx|\.css|(?:^|\/)components\.json)$/;
1283
+ /** V2-1.18 §5.3: the `ds` checker's share of the fast tier, and post-edit's whole budget. */
1284
+ export const DS_CHECK_MS = 400;
1285
+ export const POST_EDIT_BUDGET_MS = 1500;
1286
+ const DS_LINES = 16;
1287
+ const DS_LINE_MAX = 240;
1288
+
1289
+ /**
1290
+ * S12.4 (D9) — `maude design ds-check --hook` on the file just written: its S-rule / system
1291
+ * findings as warnings (additionalContext text), never a decision. Fail-open: no `self`, a crash,
1292
+ * a timeout, garbage or a forged decision → only the child's `additionalContext` string is ever
1293
+ * read, cleaned per line and capped; anything else → nothing. Bounded by what is left of the
1294
+ * post-edit budget (≤ DS_CHECK_MS); skipped when too little is left.
1295
+ */
1296
+ function dsWarnings(ctx, rel, input, self, t0) {
1297
+ if (!self || !DS_FILE_RE.test(rel)) return null;
1298
+ const left = Math.min(DS_CHECK_MS, POST_EDIT_BUDGET_MS - 150 - (performance.now() - t0));
1299
+ if (left < 100) return null;
1300
+ try {
1301
+ const p = spawnSync(
1302
+ self[0],
1303
+ [...self.slice(1), 'design', 'ds-check', '--hook', '--root', ctx.root],
1304
+ {
1305
+ input: JSON.stringify(input),
1306
+ encoding: 'utf8',
1307
+ timeout: Math.round(left),
1308
+ killSignal: 'SIGKILL',
1309
+ maxBuffer: 256 * 1024,
1310
+ env: { ...process.env, MAUDE_NO_UPDATE_CHECK: '1' },
1311
+ }
1312
+ );
1313
+ if (p.error || p.status !== 0 || !p.stdout) return null;
1314
+ const text = JSON.parse(p.stdout)?.hookSpecificOutput?.additionalContext;
1315
+ if (typeof text !== 'string' || !text.trim()) return null;
1316
+ const lines = text
1317
+ .split('\n')
1318
+ .map((l) => cleanText(l, DS_LINE_MAX))
1319
+ .filter((l) => l.trim());
1320
+ return lines.slice(0, DS_LINES).join('\n') || null;
1321
+ } catch {
1322
+ return null;
1323
+ }
1324
+ }
1325
+
1326
+ /** §5.4 post-edit 4: a synced board edited directly gets one hint a run (no studio needed) — its text. */
1327
+ function syncedBoardHint(ctx, rel) {
1328
+ if (!BOARD_RE.test(rel)) return null;
1329
+ const cfg = readJson(join(ctx.designRoot, 'config.json'), {});
1330
+ if (!cfg?.linkedHub && !existsSync(join(ctx.designRoot, '_sync.json'))) return null;
1331
+ const marker = join(ctx.run, 'board-hint');
1332
+ if (existsSync(marker)) return null;
1333
+ writeAt(marker, '');
1334
+ return `${rel} is a board this project syncs with collaborators. For board changes prefer \`maude design annotate <canvas> --ops <ops.json>\`: it applies them as element ops that merge with other people's edits.`;
1335
+ }
1336
+
1337
+ async function preBash(ctx, input) {
1338
+ if (input.tool_name !== 'Bash') return null;
1339
+ if (isUntrustedReader(input))
1340
+ return deny(
1341
+ `out-of-scope: ${input.agent_type} reads untrusted content (DDR-174/DDR-183) — it has no shell. Do the work with Read (and Write for the files your inputs name); the orchestrator runs every command.`
1342
+ );
1343
+ const command = input.tool_input?.command;
1344
+ let fence = null;
1345
+ const fenceOf = () => {
1346
+ fence ??= agentFence(ctx, input);
1347
+ return fence;
1348
+ };
1349
+ const verbs = verbFence(ctx, input, command, fenceOf);
1350
+ if (verbs) return deny(verbs);
1351
+ const subVerb = commentsSubVerbHint(command);
1352
+ if (subVerb) return deny(subVerb);
1353
+ const verdict = classifyBash(command, {
1354
+ cwd: ctx.cwd,
1355
+ designRoot: ctx.designRoot,
1356
+ root: ctx.root,
1357
+ // gate-b-sec2: a maude verb's --root / cwd is held to the session's project, not the cwd's
1358
+ sessionRoot: sessionRoot(process.env, ctx.root) ?? ctx.root,
1359
+ guard: (rel) => runtimeGuard(input, rel, fenceOf),
1360
+ });
1361
+ if (verdict) return deny(verdict.reason);
1362
+ // a `maude design` write verb: remember when it started, and snapshot the design files it names
1363
+ // (post-bash and edit/touched {via:'bash'} bind what changed in this tool call's window)
1364
+ const toolUseId = hookKey(input.tool_use_id);
1365
+ const writers = toolUseId ? writeVerbs(ctx, command) : [];
1366
+ // V2-8.16 S7 — and any other call that is not provably a read (a python heredoc, node -e, awk …):
1367
+ // the guard can't read every language, so post-bash binds what changed during the call. No
1368
+ // snapshot for those (no named file): the studio maps the change to every artboard it touched.
1369
+ if (!writers.length && !(toolUseId && bashMayWrite(command, manifestVerbs(ctx)))) return null;
1370
+ const snaps = {};
1371
+ for (const w of writers) {
1372
+ for (const word of w.cmd.words) {
1373
+ if (Object.keys(snaps).length >= 8) break;
1374
+ const t = word.literal
1375
+ ? targetOf(ctx, { cwd: ctx.cwd, tool_input: { file_path: word.text } })
1376
+ : null;
1377
+ const rel = t ? t.rel : designRel(ctx, word);
1378
+ if (!rel || snaps[rel] || !CANVAS_RE.test(rel)) continue;
1379
+ const cur = readOr(join(ctx.designRoot, rel));
1380
+ if (cur === null || cur.length > SNAP_MAX_BYTES) continue;
1381
+ const name = `${toolUseId}.${sha(rel).slice(0, 16)}`;
1382
+ saveSnapshot(ctx, `_runs/${ctx.session}/snap/${name}`, cur);
1383
+ ensureBase(ctx, rel, cur);
1384
+ snaps[rel] = name;
1385
+ }
1386
+ }
1387
+ // p8-secfix-hook F2 — a call that leaves a process running (`nohup … &`, `run_in_background`)
1388
+ // keeps its mark until the turn ends: Stop binds what that process wrote after the call returned
1389
+ const bg =
1390
+ input.tool_input?.run_in_background === true || bashBackgrounds(command, { unparsed: false })
1391
+ ? { bg: true, by: input.agent_type ?? 'main' }
1392
+ : {};
1393
+ // p8-a1-claims — `interp`: something in the call writes without claiming (no table: assume so).
1394
+ // A terminal-lane verb cannot claim either (no MAUDE_CHAT_ID names a chat).
1395
+ const interp = !claimingVerbs(ctx) || bashMayWrite(command, claimingVerbs(ctx)) || !hookChat();
1396
+ // Such a call gets a time window for the canvases its command NAMES only (bash-guard
1397
+ // `namedDesignFiles`): a person's save to any other canvas during it stays theirs.
1398
+ const files = interp ? namedDesignFiles(ctx.designRoot, command) : [];
1399
+ // p8-sec2-attrib A1 — a path it only computes (`sed -i … *.tsx`, `find -exec`, `'Ho'+'me.tsx'`) is
1400
+ // not named, yet the call may write it: hash every canvas lane now, so its end binds exactly the
1401
+ // files whose bytes changed (the studio drops what a person's save landed). A call that names
1402
+ // nothing opens an all-canvas window for the run stage instead (it takes outside writes; no hold).
1403
+ const at = Date.now();
1404
+ const hashes = interp ? designLaneHashes(ctx.designRoot) : null;
1405
+ const all = interp && !files.length;
1406
+ writeAt(
1407
+ join(ctx.run, 'bash', `${toolUseId}.json`),
1408
+ JSON.stringify({
1409
+ at,
1410
+ snaps,
1411
+ ...bg,
1412
+ ...(interp ? { interp: true, files, hashes, ...(all ? { all: true } : {}) } : {}),
1413
+ })
1414
+ );
1415
+ if (files.length || all) await bashWindow(ctx, toolUseId, true, files, all);
1416
+ return null;
1417
+ }
1418
+
1419
+ /** p8-a1-claims — open / close a no-claim call's window in the studio (fail-open). */
1420
+ async function bashWindow(ctx, toolUseId, open, files, all = false) {
1421
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
1422
+ if (!studio) return;
1423
+ await postStudio(
1424
+ studio,
1425
+ '/_api/agent/bash/window',
1426
+ { ...runKey(ctx), toolUseId, open, files, ...(all ? { all: true } : {}) },
1427
+ { timeoutMs: 600 }
1428
+ );
1429
+ }
1430
+
1431
+ /**
1432
+ * p8-journey-grader (S11): `maude design comments <path>` with no sub-verb. The CLI rejects it (exit 2, unknown
1433
+ * sub-verb) and the auto tier allows only `comments list:*`, so an agent that wrote the bare form got a permission
1434
+ * denial with no hint and gave up. Say what to type. Deny-only and narrow: it refuses just the form the CLI would
1435
+ * refuse itself (a literal first word that is neither a sub-verb nor a flag), never widens a tier, and a command the
1436
+ * reader can't follow is left alone (fail-open).
1437
+ */
1438
+ const COMMENTS_SUBS = new Set(['list', 'reply', 'resolve', 'reopen', 'add']);
1439
+ function commentsSubVerbHint(command) {
1440
+ if (typeof command !== 'string' || !command.includes('comments')) return null;
1441
+ const cmds = parseBash(command);
1442
+ if (!cmds) return null;
1443
+ for (const c of cmds) {
1444
+ const w = maudeWords(c);
1445
+ if (w?.[0]?.text !== 'design' || w[1]?.text !== 'comments') continue;
1446
+ const first = w[2];
1447
+ if (!first?.literal || first.text.startsWith('-') || COMMENTS_SUBS.has(first.text)) continue;
1448
+ return `use-sub-verb: \`maude design comments\` takes a sub-verb (list | reply | resolve | reopen | add). To read a canvas's comments run \`maude design comments list ${first.text}\` (add --open for the unresolved ones, --json for data).`;
1449
+ }
1450
+ return null;
1451
+ }
1452
+
1453
+ /** Does `words` (after `maude`) run one of `allowed` (`check`, or `ds convert`)? */
1454
+ function verbAllowed(words, allowed) {
1455
+ if (!words[0]?.literal || words[0].text !== 'design' || !words[1]?.literal) return false;
1456
+ const verb = words[1].text;
1457
+ const sub = words[2]?.literal ? words[2].text : null;
1458
+ return allowed.some((a) => {
1459
+ const [v, s] = a.split(' ');
1460
+ return v === verb && (!s || s === sub);
1461
+ });
1462
+ }
1463
+
1464
+ /**
1465
+ * gate-b-sec2 finding 3: the maude verbs a bounded writer (AGENT_VERBS) or the S8.10 Handoff to
1466
+ * production run (HANDOFF_RUN_VERBS) may run — any other maude command is denied, read-only ones
1467
+ * included (a fenced agent reads peer-written content). A sub-agent whose fence failed (no valid
1468
+ * hand-off, or one that changed) runs no write-tier verb at all. A command the reader can't
1469
+ * follow is denied for them when it names maude: their fence is not fail-open.
1470
+ */
1471
+ function verbFence(ctx, input, command, fenceOf) {
1472
+ if (typeof command !== 'string' || !command.includes('maude')) return null;
1473
+ const agent = isSubagent(input) ? bareAgent(input.agent_type) : null;
1474
+ const allowed =
1475
+ agent && Object.hasOwn(AGENT_VERBS, agent)
1476
+ ? AGENT_VERBS[agent]
1477
+ : HANDOFF_CHAT_RE.test(hookChat() ?? '')
1478
+ ? HANDOFF_RUN_VERBS
1479
+ : null;
1480
+ const who = agent ? `${input.agent_type}` : 'this Handoff to production run';
1481
+ const cmds = parseBash(command);
1482
+ if (allowed) {
1483
+ const list = allowed.length
1484
+ ? `only ${allowed.map((a) => `\`maude design ${a}\``).join(', ')}`
1485
+ : 'no maude verb';
1486
+ const refuse = `out-of-scope: ${who} runs ${list}. Put what else you need in your hand-off result and let the main agent run it.`;
1487
+ if (!cmds) return refuse;
1488
+ for (const c of cmds) {
1489
+ const w = maudeWords(c);
1490
+ if (w && !verbAllowed(w, allowed)) return refuse;
1491
+ }
1492
+ }
1493
+ if (!agent) return null;
1494
+ const f = fenceOf();
1495
+ if (!f.error) return null;
1496
+ if (!cmds) return fenceReason(input, f.error);
1497
+ return writeVerbs(ctx, command).length ? fenceReason(input, f.error) : null;
1498
+ }
1499
+
1500
+ /** A verb argument written designRoot-relative (`ui/C.tsx`, as the verbs take it) → that rel. */
1501
+ function designRel(ctx, word) {
1502
+ if (!word.literal || !word.text || word.text.startsWith('-')) return null;
1503
+ const t = targetOf(ctx, { cwd: ctx.designRoot, tool_input: { file_path: word.text } });
1504
+ return t && existsSync(t.abs) ? t.rel : null;
1505
+ }
1506
+
1507
+ async function postBash(ctx, input) {
1508
+ if (input.tool_name !== 'Bash') return null;
1509
+ const toolUseId = hookKey(input.tool_use_id);
1510
+ if (!toolUseId) return null;
1511
+ const markP = join(ctx.run, 'bash', `${toolUseId}.json`);
1512
+ const mark = readJson(markP, null);
1513
+ if (!mark || typeof mark.at !== 'number') return null; // not a write verb
1514
+ // p8-a1-claims — the call returned: its window shuts (the studio keeps it SHELL_SETTLE_MS more)
1515
+ const files = Array.isArray(mark.files) ? mark.files.filter((f) => typeof f === 'string') : [];
1516
+ if ((files.length || mark.all) && !mark.bg)
1517
+ await bashWindow(ctx, toolUseId, false, files, mark.all === true);
1518
+ await bindBashWrites(ctx, toolUseId, mark, input.agent_type ?? 'main', mark.at);
1519
+ if (mark.bg) writeAt(markP, JSON.stringify({ ...mark, seen: Date.now() }));
1520
+ else rmSync(markP, { force: true });
1521
+ return null;
1522
+ }
1523
+
1524
+ /**
1525
+ * Bind the design files changed since `since` to the run: touched.json (`via: 'bash'`) and the
1526
+ * studio's `edit/touched` for the call's window (from `mark.at`).
1527
+ */
1528
+ async function bindBashWrites(ctx, toolUseId, mark, by, since) {
1529
+ const files = designWritesSince(ctx.designRoot, since);
1530
+ if (!files.length) return;
1531
+ for (const rel of files) {
1532
+ let at;
1533
+ try {
1534
+ at = statSync(join(ctx.designRoot, rel)).mtimeMs;
1535
+ } catch {
1536
+ /* gone again */
1537
+ }
1538
+ recordTouch(ctx, rel, { by, via: 'bash', artboards: null, at });
1539
+ markShellWrite(ctx, rel); // F4 — no base taken after this write
1540
+ }
1541
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
1542
+ if (studio)
1543
+ await postStudio(
1544
+ studio,
1545
+ '/_api/agent/edit/touched',
1546
+ {
1547
+ ...runKey(ctx),
1548
+ toolUseId,
1549
+ via: 'bash',
1550
+ since: mark.at,
1551
+ // p8-a1-claims — only claiming verbs wrote: the studio binds what they claimed, nothing else;
1552
+ // a call that cannot claim binds the canvases its command named and (p8-sec2-attrib A1) every
1553
+ // file whose bytes it changed — the studio skips what a person's save landed
1554
+ ...(mark.interp ? { files: interpFiles(ctx, mark) } : { claimedOnly: true }),
1555
+ },
1556
+ { timeoutMs: 900 }
1557
+ );
1558
+ }
1559
+
1560
+ /**
1561
+ * p8-sec2-attrib A1 — what a call that cannot claim may have written: the canvases it named, plus every
1562
+ * canvas lane whose bytes changed against the hashes pre-bash took (none taken: by mtime alone).
1563
+ */
1564
+ function interpFiles(ctx, mark) {
1565
+ const named = Array.isArray(mark.files) ? mark.files.filter((f) => typeof f === 'string') : [];
1566
+ const hashes = mark.hashes && typeof mark.hashes === 'object' ? mark.hashes : {};
1567
+ return [...new Set([...named, ...changedDesignFiles(ctx.designRoot, hashes, mark.at)])].sort();
1568
+ }
1569
+
1570
+ /**
1571
+ * p8-secfix-hook F2 — at the turn's end (Stop / SubagentStop), what every still-running background
1572
+ * call (`bg` mark) wrote since it was last looked at. A blocked Stop looks again at the next one;
1573
+ * the marks go with the run folder (a passing Stop) or at the next prompt (startTurn).
1574
+ * p8-secfix-hook-2 N2 — bounded, whatever the number of marks: a mark that no longer counts
1575
+ * (`liveMark`) is dropped, at most BG_MARKS_MAX of the newest are kept (older ones dropped), and
1576
+ * their union is bound with ONE walk (since the earliest unseen start) and ONE studio POST, on the
1577
+ * studio the caller located once for the whole Stop.
1578
+ */
1579
+ async function drainBackground(ctx, studio) {
1580
+ const dir = join(ctx.run, 'bash');
1581
+ let names = [];
1582
+ try {
1583
+ names = readdirSync(dir);
1584
+ } catch {
1585
+ return;
1586
+ }
1587
+ const now = Date.now();
1588
+ const turn = turnStart(ctx, now);
1589
+ const marks = [];
1590
+ for (const n of names) {
1591
+ const toolUseId = n.endsWith('.json') ? hookKey(n.slice(0, -5)) : null;
1592
+ if (!toolUseId) continue;
1593
+ const m = readJson(join(dir, n), null);
1594
+ if (!m?.bg) continue;
1595
+ if (!liveMark(m, now, turn)) rmSync(join(dir, n), { force: true });
1596
+ else marks.push({ n, toolUseId, m });
1597
+ }
1598
+ marks.sort((a, b) => b.m.at - a.m.at); // newest first
1599
+ for (const x of marks.splice(BG_MARKS_MAX)) rmSync(join(dir, x.n), { force: true });
1600
+ if (!marks.length) return;
1601
+ const sinceOf = (x) =>
1602
+ typeof x.m.seen === 'number' && x.m.seen >= x.m.at && x.m.seen <= now ? x.m.seen : x.m.at;
1603
+ const files = designWritesSince(ctx.designRoot, Math.min(...marks.map(sinceOf)));
1604
+ for (const rel of files) {
1605
+ let at;
1606
+ try {
1607
+ at = statSync(join(ctx.designRoot, rel)).mtimeMs;
1608
+ } catch {
1609
+ /* gone again */
1610
+ }
1611
+ // the write is the newest call's whose window it falls in
1612
+ const owner = marks.find((x) => at === undefined || sinceOf(x) <= at) ?? marks[0];
1613
+ const by = typeof owner.m.by === 'string' ? owner.m.by : 'main';
1614
+ recordTouch(ctx, rel, { by, via: 'bash', artboards: null, at });
1615
+ markShellWrite(ctx, rel); // F4 — no base taken after this write
1616
+ }
1617
+ if (files.length && studio) {
1618
+ const oldest = marks[marks.length - 1];
1619
+ await postStudio(
1620
+ studio,
1621
+ '/_api/agent/edit/touched',
1622
+ {
1623
+ ...runKey(ctx),
1624
+ toolUseId: oldest.toolUseId,
1625
+ via: 'bash',
1626
+ since: oldest.m.at,
1627
+ ...(marks.every((x) => !x.m.interp) ? { claimedOnly: true } : {}),
1628
+ },
1629
+ { timeoutMs: 900 }
1630
+ );
1631
+ }
1632
+ const seen = Date.now();
1633
+ for (const x of marks) writeAt(join(dir, x.n), JSON.stringify({ ...x.m, seen }));
1634
+ }
1635
+
1636
+ /** SubagentStop: the hand-off result, then the stop-tier check of the run's files it owns. */
1637
+ async function subagentStop(ctx, input, self, studio) {
1638
+ const fence = agentFence(ctx, input);
1639
+ const hs = fence.hs;
1640
+ const id = hookKey(input.agent_id);
1641
+ const problems = [];
1642
+ if (fence.error) problems.push(`handoff-changed: ${fence.error} — say so in your result.`);
1643
+ else if (!hs.length) return null; // spawned without a hand-off: nothing to hold it to
1644
+ const started = (id && readJson(join(ctx.run, 'agents.json'), {})[id]?.at) || 0;
1645
+ // its result: one of its hand-offs' `output` files, written after it started, valid as "out"
1646
+ const outs = hs
1647
+ .map((h) => ({ rel: h.doc.output, abs: resolve(ctx.root, h.doc.output) }))
1648
+ .filter((o) => !relative(ctx.root, o.abs).startsWith('..'));
1649
+ const fresh = outs.filter((o) => {
1650
+ try {
1651
+ return statSync(o.abs).mtimeMs >= started - 1000;
1652
+ } catch {
1653
+ return false;
1654
+ }
1655
+ });
1656
+ if (!fresh.length && !fence.error)
1657
+ problems.push(
1658
+ `handoff-missing: write your result (${HANDOFF_CONTRACT}, role "out") to ${outs.map((o) => o.rel).join(' or ')} before you finish.`
1659
+ );
1660
+ for (const o of fresh) {
1661
+ const v = validateHandoff(readJson(o.abs, null), { role: 'out' });
1662
+ for (const e of v.errors)
1663
+ problems.push(
1664
+ `handoff-invalid ${cleanText(o.rel, 200)} · ${cleanText(e.where, 80)} ${cleanText(e.what, 200)} · ${cleanText(e.fix, 200)}`
1665
+ );
1666
+ }
1667
+ const touched = readJson(join(ctx.run, 'touched.json'), {});
1668
+ for (const rel of Object.keys(touched)) {
1669
+ if (!hs.some((h) => ownsPath(h.doc, `${DESIGN_REL}/${rel}`))) continue;
1670
+ if (!existsSync(join(ctx.designRoot, rel))) continue;
1671
+ const res = await check(ctx, studio, rel, 'stop', loadSnapshot(ctx, baseRel(ctx, rel)), self);
1672
+ if (res && !res.ok) problems.push(...res.errors.map((f) => findingLine(f)));
1673
+ }
1674
+ if (!problems.length) return null;
1675
+ const sig = sha(problems.join('\n'));
1676
+ const lastP = join(ctx.run, `stop-last.${id ?? 'agent'}.json`);
1677
+ if (input.stop_hook_active === true && readJson(lastP, null)?.sig === sig) return null; // let it end
1678
+ writeAt(lastP, JSON.stringify({ sig, at: Date.now() }));
1679
+ return { decision: 'block', reason: `Before you finish:\n${problems.join('\n')}` };
1680
+ }
1681
+
1682
+ async function stop(ctx, input, self) {
1683
+ // N2 — the studio is located once per Stop: the drain and the gate share it
1684
+ const studio = await locateStudio(ctx.root, { timeoutMs: LOCATE_MS });
1685
+ await drainBackground(ctx, studio);
1686
+ if (input.hook_event_name === 'SubagentStop') return subagentStop(ctx, input, self, studio);
1687
+ const touched = readJson(join(ctx.run, 'touched.json'), {});
1688
+ const problems = [];
1689
+ for (const rel of Object.keys(touched)) {
1690
+ if (!existsSync(join(ctx.designRoot, rel))) continue;
1691
+ const res = await check(ctx, studio, rel, 'stop', loadSnapshot(ctx, baseRel(ctx, rel)), self);
1692
+ if (res && !res.ok) problems.push(...res.errors.map((f) => findingLine(f)));
1693
+ }
1694
+ // 2. the screenshot gate — only with a studio: `maude design screenshot` needs one to render
1695
+ const missing = studio ? missingShots(ctx, touched) : [];
1696
+ if (problems.length || missing.length) {
1697
+ const sig = sha(JSON.stringify({ problems, missing }));
1698
+ const lastP = join(ctx.run, 'stop-last.json');
1699
+ if (!(input.stop_hook_active === true && readJson(lastP, null)?.sig === sig)) {
1700
+ writeAt(lastP, JSON.stringify({ sig, at: Date.now() }));
1701
+ const parts = [];
1702
+ if (problems.length) parts.push(`These files don't pass the check:\n${problems.join('\n')}`);
1703
+ if (missing.length)
1704
+ parts.push(
1705
+ `Screenshot each artboard you changed and look at it before you finish (\`maude design screenshot --canvas "<path>" --screen <artboard id> --out <png>\`, or --full for every artboard). Missing: ${missing.slice(0, 20).join(', ')}${missing.length > 20 ? ` (+${missing.length - 20})` : ''}`
1706
+ );
1707
+ return { decision: 'block', reason: parts.join('\n\n') };
1708
+ }
1709
+ }
1710
+ // the run ends (with warnings when the same problems are still there)
1711
+ if (studio)
1712
+ await postStudio(
1713
+ studio,
1714
+ '/_api/agent/run/end',
1715
+ {
1716
+ ...runKey(ctx),
1717
+ outcome: problems.length || missing.length ? 'warnings' : 'done',
1718
+ },
1719
+ { timeoutMs: 600 }
1720
+ );
1721
+ rmSync(ctx.run, { recursive: true, force: true });
1722
+ return null;
1723
+ }
1724
+
1725
+ /**
1726
+ * Run one hook event. `self` = argv prefix that runs this `maude` (for the local check), or null.
1727
+ * Returns the stdout text ('' = no decision). Never throws.
1728
+ */
1729
+ export async function runHook({ event, stdinText, self = null, pkgRoot = null }) {
1730
+ try {
1731
+ if (!HOOK_EVENTS.includes(event)) return '';
1732
+ const input = JSON.parse(stdinText || '{}');
1733
+ if (!input || typeof input !== 'object') return '';
1734
+ const ctx = context(input, pkgRoot);
1735
+ if (!ctx) return '';
1736
+ const fn = {
1737
+ prompt,
1738
+ 'pre-edit': preEdit,
1739
+ 'post-edit': postEdit,
1740
+ 'pre-bash': preBash,
1741
+ 'post-bash': postBash,
1742
+ stop,
1743
+ 'subagent-start': subagentStart,
1744
+ 'session-start': sessionStart,
1745
+ }[event];
1746
+ const out = await fn(ctx, input, self);
1747
+ return out ? JSON.stringify(out) : '';
1748
+ } catch {
1749
+ return '';
1750
+ }
1751
+ }
1752
+
1753
+ /** The CLI entry: stdin → runHook → stdout. Always exit 0 (fail-open). */
1754
+ export async function runHookCli({ words, self, pkgRoot = null }) {
1755
+ let stdinText = '';
1756
+ try {
1757
+ if (!process.stdin.isTTY) stdinText = readFileSync(0, 'utf8');
1758
+ } catch {
1759
+ /* no stdin */
1760
+ }
1761
+ const out = await runHook({ event: words[0], stdinText, self, pkgRoot });
1762
+ if (out) process.stdout.write(out);
1763
+ return 0;
1764
+ }