@1agh/maude 2.0.8 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (401) hide show
  1. package/README.md +2 -1
  2. package/apps/hub/src/project-transactions/kernel.mjs +13 -7
  3. package/apps/studio/access/closure.ts +86 -10
  4. package/apps/studio/access/filters.ts +18 -1
  5. package/apps/studio/access/request.ts +8 -0
  6. package/apps/studio/acp/design-write-verb.ts +12 -2
  7. package/apps/studio/acp/env.ts +7 -2
  8. package/apps/studio/acp/index.ts +15 -4
  9. package/apps/studio/acp/login-state.ts +22 -5
  10. package/apps/studio/acp/may-scope.ts +38 -1
  11. package/apps/studio/acp/plugin-bootstrap.ts +13 -1
  12. package/apps/studio/acp/probe.ts +11 -4
  13. package/apps/studio/actions/agents.ts +110 -28
  14. package/apps/studio/actions/canvas-keys.ts +4 -2
  15. package/apps/studio/actions/ctx.ts +3 -0
  16. package/apps/studio/actions/defs/annotation.ts +84 -2
  17. package/apps/studio/actions/defs/app.ts +28 -1
  18. package/apps/studio/actions/defs/edit.ts +13 -0
  19. package/apps/studio/actions/defs/export.ts +12 -0
  20. package/apps/studio/actions/defs/sync.ts +18 -0
  21. package/apps/studio/actions/defs/video.ts +9 -0
  22. package/apps/studio/actions/documents.ts +6 -1
  23. package/apps/studio/actions/keymap.gen.ts +147 -9
  24. package/apps/studio/actions/menu.ts +5 -1
  25. package/apps/studio/actions/types.ts +4 -2
  26. package/apps/studio/actions/verbs.ts +9 -0
  27. package/apps/studio/actions.manifest.json +300 -45
  28. package/apps/studio/actions.parity.json +19 -1
  29. package/apps/studio/ai/save-hold.ts +2 -1
  30. package/apps/studio/ai/write-claim-scope.ts +7 -1
  31. package/apps/studio/ai/write-claim.ts +154 -3
  32. package/apps/studio/annotations/ai-read.ts +42 -6
  33. package/apps/studio/annotations/ai-write.ts +145 -2
  34. package/apps/studio/annotations/board-ops.ts +34 -3
  35. package/apps/studio/annotations/checklist-ops.ts +374 -0
  36. package/apps/studio/annotations/elements/checkitem.model.ts +129 -0
  37. package/apps/studio/annotations/elements/sticky.model.ts +54 -2
  38. package/apps/studio/annotations/ops.ts +30 -0
  39. package/apps/studio/annotations/registry.ts +9 -1
  40. package/apps/studio/annotations/templates.ts +4 -2
  41. package/apps/studio/annotations/text-steps.ts +114 -10
  42. package/apps/studio/annotations/ui/checklist-wire.ts +129 -0
  43. package/apps/studio/annotations/ui/checklist.tsx +429 -0
  44. package/apps/studio/annotations/ui/element-node.tsx +48 -2
  45. package/apps/studio/annotations/ui/template-place.ts +11 -1
  46. package/apps/studio/annotations/v1-adapter.ts +22 -3
  47. package/apps/studio/annotations-context-toolbar.tsx +12 -0
  48. package/apps/studio/annotations-layer.tsx +442 -49
  49. package/apps/studio/annotations-model.ts +4 -2
  50. package/apps/studio/api.ts +148 -21
  51. package/apps/studio/artboard-live-gate.tsx +54 -17
  52. package/apps/studio/artboard-still-persist.ts +166 -0
  53. package/apps/studio/artboard-still-raster.ts +6 -2
  54. package/apps/studio/artboard-still.ts +390 -20
  55. package/apps/studio/asset-added.ts +154 -0
  56. package/apps/studio/asset-details.ts +46 -3
  57. package/apps/studio/asset-origins.ts +5 -3
  58. package/apps/studio/asset-trash.ts +6 -1
  59. package/apps/studio/bin/_agent-browser-safe.mjs +3 -4
  60. package/apps/studio/bin/_annotate-post.mjs +14 -5
  61. package/apps/studio/bin/_audio-search.mjs +8 -2
  62. package/apps/studio/bin/_curl-local.mjs +7 -4
  63. package/apps/studio/bin/_desktop-locate.sh +145 -0
  64. package/apps/studio/bin/_ds-check-live.mjs +2 -1
  65. package/apps/studio/bin/_exports.mjs +38 -2
  66. package/apps/studio/bin/_history.mjs +79 -8
  67. package/apps/studio/bin/_import-asset.mjs +14 -9
  68. package/apps/studio/bin/_import-figma.mjs +510 -98
  69. package/apps/studio/bin/_index-cli.mjs +10 -21
  70. package/apps/studio/bin/_ingest-footage.mjs +24 -6
  71. package/apps/studio/bin/_media-probe.mjs +232 -0
  72. package/apps/studio/bin/_perf-probe-open.mjs +6 -0
  73. package/apps/studio/bin/_perf-probe-safari.mjs +6 -0
  74. package/apps/studio/bin/_perf-probe-studio.mjs +6 -1
  75. package/apps/studio/bin/_perf-probe.mjs +8 -3
  76. package/apps/studio/bin/_perf-sweep-shared.mjs +789 -0
  77. package/apps/studio/bin/_perf-sweep.mjs +240 -0
  78. package/apps/studio/bin/_record-shot.sh +33 -8
  79. package/apps/studio/bin/_screenshot-playwright.mjs +45 -2
  80. package/apps/studio/bin/_studio-verb.mjs +8 -3
  81. package/apps/studio/bin/_thumb-route.mjs +21 -0
  82. package/apps/studio/bin/_thumbs-playwright.mjs +83 -1
  83. package/apps/studio/bin/_transcribe.mjs +22 -6
  84. package/apps/studio/bin/_unsynced-refs.mjs +22 -0
  85. package/apps/studio/bin/_url-guard.mjs +120 -5
  86. package/apps/studio/bin/_url-guard.sh +29 -7
  87. package/apps/studio/bin/_video-limits.mjs +104 -0
  88. package/apps/studio/bin/_video-playwright.mjs +119 -19
  89. package/apps/studio/bin/_video-proxy.mjs +130 -0
  90. package/apps/studio/bin/_write-claim.mjs +38 -16
  91. package/apps/studio/bin/annotate.mjs +12 -2
  92. package/apps/studio/bin/canvas-rects.sh +19 -4
  93. package/apps/studio/bin/chat-open.sh +7 -1
  94. package/apps/studio/bin/draw-proof.sh +6 -2
  95. package/apps/studio/bin/generate.sh +32 -10
  96. package/apps/studio/bin/handoff.sh +2 -2
  97. package/apps/studio/bin/perf.sh +96 -15
  98. package/apps/studio/bin/photo-adjust.sh +6 -3
  99. package/apps/studio/bin/photo-bg-remove.sh +2 -2
  100. package/apps/studio/bin/prep.sh +21 -4
  101. package/apps/studio/bin/read-annotations.mjs +3 -0
  102. package/apps/studio/bin/runtime-health.sh +27 -1
  103. package/apps/studio/bin/screenshot.sh +152 -12
  104. package/apps/studio/bin/server-up.sh +64 -6
  105. package/apps/studio/bin/smoke.sh +43 -8
  106. package/apps/studio/bin/to-lottie.sh +3 -2
  107. package/apps/studio/bin/video-proxy.sh +27 -0
  108. package/apps/studio/bin/visual-sanity.sh +3 -1
  109. package/apps/studio/bridge/dgn-protocol.ts +157 -1
  110. package/apps/studio/bridge/mode-shows.ts +8 -6
  111. package/apps/studio/bridge/still-webp.ts +233 -0
  112. package/apps/studio/build.ts +18 -0
  113. package/apps/studio/canvas-build.ts +93 -11
  114. package/apps/studio/canvas-comment-mount.tsx +53 -8
  115. package/apps/studio/canvas-edit.ts +34 -1
  116. package/apps/studio/canvas-lib-module.ts +210 -0
  117. package/apps/studio/canvas-lib.tsx +3 -12
  118. package/apps/studio/canvas-pipeline.ts +111 -5
  119. package/apps/studio/canvas-shell.tsx +8 -11
  120. package/apps/studio/canvas-theme-pill.tsx +5 -3
  121. package/apps/studio/check/index.ts +12 -5
  122. package/apps/studio/check/video.ts +18 -2
  123. package/apps/studio/client/app.jsx +65 -7
  124. package/apps/studio/client/clipboard-relay.ts +193 -16
  125. package/apps/studio/client/comments-overlay.css +18 -0
  126. package/apps/studio/client/export-center.jsx +30 -0
  127. package/apps/studio/client/generate-dialog.jsx +49 -4
  128. package/apps/studio/client/github.js +7 -0
  129. package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
  130. package/apps/studio/client/home/HomeConnection.jsx +111 -0
  131. package/apps/studio/client/home/home-accounts-model.js +110 -1
  132. package/apps/studio/client/home/home-api.js +9 -2
  133. package/apps/studio/client/home/home-app.jsx +126 -13
  134. package/apps/studio/client/home/home-model.js +69 -1
  135. package/apps/studio/client/home/home-where-model.js +105 -0
  136. package/apps/studio/client/home/home.css +239 -1
  137. package/apps/studio/client/hooks/use-canvas-bridge.jsx +173 -98
  138. package/apps/studio/client/hooks/use-palette-and-panels.jsx +5 -1
  139. package/apps/studio/client/hooks/use-tabs.jsx +11 -4
  140. package/apps/studio/client/panels/DiffView.jsx +7 -1
  141. package/apps/studio/client/panels/TeamProjects.jsx +137 -134
  142. package/apps/studio/client/panels/chat-context.js +2 -0
  143. package/apps/studio/client/panels/slash-commands.gen.js +13 -13
  144. package/apps/studio/client/selection-scope.js +16 -9
  145. package/apps/studio/client/share-link.js +12 -0
  146. package/apps/studio/client/shell/viewport.jsx +11 -1
  147. package/apps/studio/client/shell-events.js +8 -0
  148. package/apps/studio/client/styles/3-kit-maude-v2.css +16 -0
  149. package/apps/studio/client/styles/_index.css +4 -0
  150. package/apps/studio/client/v2/ai/Feed.jsx +1 -1
  151. package/apps/studio/client/v2/ai/OfferCard.jsx +34 -0
  152. package/apps/studio/client/v2/ai/activity-line.js +54 -1
  153. package/apps/studio/client/v2/ai/ai-offer.js +21 -1
  154. package/apps/studio/client/v2/ai/run-model.js +3 -1
  155. package/apps/studio/client/v2/annotations/vote-store.js +28 -4
  156. package/apps/studio/client/v2/assets/asset-drop-session.js +37 -2
  157. package/apps/studio/client/v2/assets/canvas-drop-catcher.jsx +7 -5
  158. package/apps/studio/client/v2/assets/details-model.js +1 -1
  159. package/apps/studio/client/v2/assets/details.jsx +5 -0
  160. package/apps/studio/client/v2/assets/tile-drag.js +11 -7
  161. package/apps/studio/client/v2/comments/comments-panel.jsx +22 -3
  162. package/apps/studio/client/v2/create/duplicate-done.js +6 -2
  163. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
  164. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
  165. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
  166. package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
  167. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +113 -3
  168. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +343 -6
  169. package/apps/studio/client/v2/diagnostics/sync-details/unsynced-refs.js +55 -0
  170. package/apps/studio/client/v2/ds/review.css +1 -1
  171. package/apps/studio/client/v2/export/exports-model.js +7 -0
  172. package/apps/studio/client/v2/export/exports-panel.jsx +1 -0
  173. package/apps/studio/client/v2/export/job-row.jsx +32 -2
  174. package/apps/studio/client/v2/handoff/ready-card.jsx +1 -1
  175. package/apps/studio/client/v2/history/compare-view.jsx +1 -0
  176. package/apps/studio/client/v2/inspector/css-write.js +6 -1
  177. package/apps/studio/client/v2/inspector/frame.jsx +28 -4
  178. package/apps/studio/client/v2/inspector/kinds/clip-model.js +51 -0
  179. package/apps/studio/client/v2/inspector/kinds/clip.jsx +75 -2
  180. package/apps/studio/client/v2/inspector/model.js +21 -0
  181. package/apps/studio/client/v2/inspector/sections/fill.jsx +12 -3
  182. package/apps/studio/client/v2/inspector/sections/recent-colours.js +8 -5
  183. package/apps/studio/client/v2/inspector/view-mode.jsx +11 -1
  184. package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
  185. package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
  186. package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
  187. package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
  188. package/apps/studio/client/v2/link-server/link-server.css +109 -0
  189. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
  190. package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
  191. package/apps/studio/client/v2/preview/link-follow.js +4 -2
  192. package/apps/studio/client/v2/preview/preview-chrome-host.jsx +16 -6
  193. package/apps/studio/client/v2/search/help-model.js +2 -0
  194. package/apps/studio/client/v2/search/search-keywords.js +3 -2
  195. package/apps/studio/client/v2/settings/account.jsx +4 -2
  196. package/apps/studio/client/v2/settings/advanced-section.jsx +344 -137
  197. package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
  198. package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
  199. package/apps/studio/client/v2/settings/general-section.jsx +155 -24
  200. package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
  201. package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
  202. package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
  203. package/apps/studio/client/v2/settings/settings-cards.js +220 -0
  204. package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
  205. package/apps/studio/client/v2/settings/settings-model.js +100 -31
  206. package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
  207. package/apps/studio/client/v2/settings/settings.css +374 -64
  208. package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
  209. package/apps/studio/client/v2/settings/this-project-model.js +172 -0
  210. package/apps/studio/client/v2/settings/use-connections.js +3 -2
  211. package/apps/studio/client/v2/settings/use-open-card.js +37 -0
  212. package/apps/studio/client/v2/share/share-sheet.jsx +28 -11
  213. package/apps/studio/client/v2/shell/api-session-boot.js +6 -0
  214. package/apps/studio/client/v2/shell/api-session.js +126 -0
  215. package/apps/studio/client/v2/shell/connection-state.js +197 -0
  216. package/apps/studio/client/v2/shell/floating-panels.css +31 -1
  217. package/apps/studio/client/v2/shell/image-pick.js +61 -8
  218. package/apps/studio/client/v2/shell/menu-aim.js +43 -0
  219. package/apps/studio/client/v2/shell/menu-runner.js +25 -7
  220. package/apps/studio/client/v2/shell/occlusion-insets.js +18 -1
  221. package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
  222. package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
  223. package/apps/studio/client/v2/shell/project-account-model.js +272 -149
  224. package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
  225. package/apps/studio/client/v2/shell/project-account.css +237 -0
  226. package/apps/studio/client/v2/shell/project-pill.jsx +52 -6
  227. package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
  228. package/apps/studio/client/v2/shell/shell-parity.js +3 -2
  229. package/apps/studio/client/v2/shell/shell-parity.json +71 -36
  230. package/apps/studio/client/v2/shell/still-bridge.js +194 -0
  231. package/apps/studio/client/v2/shell/still-store.js +319 -0
  232. package/apps/studio/client/v2/shell/use-account.js +2 -0
  233. package/apps/studio/client/v2/shell/use-tool-panels.js +2 -1
  234. package/apps/studio/client/v2/signin/use-signin.js +1 -1
  235. package/apps/studio/client/v2/timeline/Timeline.jsx +15 -0
  236. package/apps/studio/client/v2/timeline/frame-handle-model.js +142 -0
  237. package/apps/studio/client/v2/timeline/frame-handle.jsx +151 -0
  238. package/apps/studio/clip-ops.ts +126 -8
  239. package/apps/studio/cloud/endpoints.ts +29 -4
  240. package/apps/studio/collab/ai-activity.ts +10 -8
  241. package/apps/studio/collab/awareness-bridge.ts +34 -9
  242. package/apps/studio/collab/index.ts +3 -0
  243. package/apps/studio/collab/registry.ts +41 -10
  244. package/apps/studio/comment-reattach.ts +149 -0
  245. package/apps/studio/comments/mine-stamp.ts +15 -7
  246. package/apps/studio/comments/ops.ts +52 -8
  247. package/apps/studio/comments-overlay.tsx +146 -9
  248. package/apps/studio/dist/client.bundle.js +892 -885
  249. package/apps/studio/dist/comment-mount.js +2 -2
  250. package/apps/studio/dist/styles.css +1 -1
  251. package/apps/studio/dom-selection.ts +87 -18
  252. package/apps/studio/ds/board/directions.css +8 -0
  253. package/apps/studio/ds/board/outline.tsx +16 -0
  254. package/apps/studio/ds/canvas-check.ts +6 -0
  255. package/apps/studio/edit-ops/clip/reframe.ts +19 -3
  256. package/apps/studio/edit-ops/clip-carry.ts +602 -0
  257. package/apps/studio/edit-ops/clipboard.ts +318 -23
  258. package/apps/studio/edit-ops/dispatch.ts +20 -2
  259. package/apps/studio/edit-ops/scope-names.ts +249 -40
  260. package/apps/studio/edit-ops/slot-defaults.ts +3 -0
  261. package/apps/studio/edit-ops/types.ts +6 -0
  262. package/apps/studio/editing/align-bar.tsx +33 -9
  263. package/apps/studio/editing/artboard-actions.ts +5 -0
  264. package/apps/studio/editing/artboard-menu.tsx +6 -2
  265. package/apps/studio/editing/click-to-type.ts +1 -1
  266. package/apps/studio/editing/clip-words.ts +48 -0
  267. package/apps/studio/editing/clipboard.ts +21 -6
  268. package/apps/studio/editing/declared-background.ts +25 -0
  269. package/apps/studio/editing/index.tsx +3 -0
  270. package/apps/studio/editing/object-keys.ts +4 -4
  271. package/apps/studio/editing/object-menu.tsx +13 -3
  272. package/apps/studio/editing/pen/points.tsx +61 -0
  273. package/apps/studio/editing/text-in-place.tsx +11 -0
  274. package/apps/studio/editing/video-frame-handle.tsx +425 -0
  275. package/apps/studio/exporters/capture-prepass.ts +374 -0
  276. package/apps/studio/exporters/degraded.ts +148 -0
  277. package/apps/studio/exporters/hub-render-door.ts +28 -2
  278. package/apps/studio/exporters/index.ts +3 -1
  279. package/apps/studio/exporters/job-budget.ts +93 -0
  280. package/apps/studio/exporters/jobs.ts +215 -28
  281. package/apps/studio/exporters/parity-check.ts +254 -0
  282. package/apps/studio/exporters/remote.ts +209 -15
  283. package/apps/studio/exporters/svg-inline.ts +87 -0
  284. package/apps/studio/exporters/video-render-lib.ts +88 -26
  285. package/apps/studio/exporters/video.ts +29 -6
  286. package/apps/studio/figma/assets.ts +58 -43
  287. package/apps/studio/figma/codegen-fonts.ts +100 -0
  288. package/apps/studio/figma/fig-decode.ts +390 -25
  289. package/apps/studio/figma/fig-kiwi.ts +18 -4
  290. package/apps/studio/figma/fig-vector.ts +59 -3
  291. package/apps/studio/figma/sanitize.ts +2 -0
  292. package/apps/studio/figma/style-map.ts +293 -48
  293. package/apps/studio/figma/to-artboard.ts +455 -69
  294. package/apps/studio/figma/to-strokes.ts +44 -11
  295. package/apps/studio/figma/types.ts +13 -0
  296. package/apps/studio/footage/schema.ts +3 -3
  297. package/apps/studio/generation/adapters/elevenlabs.ts +7 -1
  298. package/apps/studio/generation/adapters/groq.ts +8 -1
  299. package/apps/studio/generation/spend.ts +312 -0
  300. package/apps/studio/generation/types.ts +12 -0
  301. package/apps/studio/handoff/run.ts +1 -1
  302. package/apps/studio/handoff/targets.ts +2 -2
  303. package/apps/studio/handoff/write-scopes.ts +1 -1
  304. package/apps/studio/history/describe-annotations.ts +4 -0
  305. package/apps/studio/home/accounts.ts +30 -11
  306. package/apps/studio/home/cloud.ts +6 -1
  307. package/apps/studio/home/create-local.ts +32 -3
  308. package/apps/studio/home/hub-health.ts +76 -0
  309. package/apps/studio/home/routes.ts +15 -4
  310. package/apps/studio/http.ts +438 -86
  311. package/apps/studio/imported-module-ids.ts +91 -0
  312. package/apps/studio/inspect.ts +2 -0
  313. package/apps/studio/migrate/hub.ts +8 -1
  314. package/apps/studio/notifications.tsx +47 -5
  315. package/apps/studio/paths.ts +10 -1
  316. package/apps/studio/port.ts +3 -2
  317. package/apps/studio/preview/preview-camera.tsx +15 -382
  318. package/apps/studio/readiness.ts +10 -1
  319. package/apps/studio/release-build.ts +51 -0
  320. package/apps/studio/routes/agent.ts +188 -9
  321. package/apps/studio/routes/ai.ts +43 -11
  322. package/apps/studio/routes/annotations.ts +27 -1
  323. package/apps/studio/routes/assets.ts +18 -1
  324. package/apps/studio/routes/canvas-origin.ts +12 -9
  325. package/apps/studio/routes/cloud-move.ts +15 -0
  326. package/apps/studio/routes/edit.ts +3 -0
  327. package/apps/studio/routes/export.ts +51 -0
  328. package/apps/studio/routes/generate.ts +42 -12
  329. package/apps/studio/routes/hub-link-folder.ts +334 -0
  330. package/apps/studio/routes/hub-signin.ts +78 -1
  331. package/apps/studio/routes/index.ts +9 -1
  332. package/apps/studio/routes/shell.ts +217 -5
  333. package/apps/studio/routes/sync.ts +136 -8
  334. package/apps/studio/routes/votes.ts +2 -1
  335. package/apps/studio/schema/annotations.v2.schema.json +143 -1
  336. package/apps/studio/schema/beats.v1.schema.json +1 -1
  337. package/apps/studio/schema/edl.v1.schema.json +1 -1
  338. package/apps/studio/schema/formats.ts +3 -3
  339. package/apps/studio/schema/transcript.v1.schema.json +1 -1
  340. package/apps/studio/server.ts +142 -43
  341. package/apps/studio/shell/api-key.ts +503 -0
  342. package/apps/studio/shell/attest.ts +59 -0
  343. package/apps/studio/shell/capture-url.ts +20 -0
  344. package/apps/studio/shell/cli-yield.ts +276 -0
  345. package/apps/studio/shell/clip-transfer.ts +302 -0
  346. package/apps/studio/shell/key-file.ts +108 -0
  347. package/apps/studio/shell/server-json.ts +75 -0
  348. package/apps/studio/shell/worktree.ts +19 -0
  349. package/apps/studio/spoof-chars.ts +9 -0
  350. package/apps/studio/studio-page-host.ts +1 -1
  351. package/apps/studio/sync/accepted-cold-start.ts +144 -8
  352. package/apps/studio/sync/accepted-link.ts +76 -29
  353. package/apps/studio/sync/action-stage.ts +575 -44
  354. package/apps/studio/sync/adopt-held.ts +85 -0
  355. package/apps/studio/sync/ctl-heal.ts +58 -0
  356. package/apps/studio/sync/file-ledger.ts +38 -4
  357. package/apps/studio/sync/file-membership.ts +16 -1
  358. package/apps/studio/sync/file-plane.ts +289 -22
  359. package/apps/studio/sync/held-deletes.ts +86 -5
  360. package/apps/studio/sync/hub-link.ts +8 -0
  361. package/apps/studio/sync/index.ts +196 -12
  362. package/apps/studio/sync/journal-client.ts +50 -4
  363. package/apps/studio/sync/link-consent.ts +22 -75
  364. package/apps/studio/sync/link-survey.ts +252 -0
  365. package/apps/studio/sync/local-kernel.ts +296 -8
  366. package/apps/studio/sync/projection.ts +22 -3
  367. package/apps/studio/sync/seed-progress.ts +12 -0
  368. package/apps/studio/sync/source-recovery.ts +59 -3
  369. package/apps/studio/sync/status.ts +19 -2
  370. package/apps/studio/sync/unsynced-refs.ts +397 -0
  371. package/apps/studio/sync/writer-registry.ts +20 -0
  372. package/apps/studio/thumbs/service.ts +4 -1
  373. package/apps/studio/tool-palette.tsx +23 -0
  374. package/apps/studio/ui-prefs.ts +40 -0
  375. package/apps/studio/use-agent-presence.tsx +2 -2
  376. package/apps/studio/use-canvas-keys.ts +6 -1
  377. package/apps/studio/video/format-ids.ts +2 -2
  378. package/apps/studio/video/inject.ts +31 -0
  379. package/apps/studio/video/media-risk.ts +58 -0
  380. package/apps/studio/video/object-fit.ts +137 -0
  381. package/apps/studio/video/provider-transcript.ts +141 -0
  382. package/apps/studio/whats-new.json +137 -0
  383. package/apps/studio/workspace-mode.ts +1 -0
  384. package/apps/studio/ws.ts +5 -0
  385. package/cli/commands/design.mjs +119 -8
  386. package/cli/lib/bash-guard.mjs +366 -6
  387. package/cli/lib/confine-read.mjs +1 -0
  388. package/cli/lib/design-help.gen.mjs +3 -2
  389. package/cli/lib/design-hook.mjs +387 -81
  390. package/cli/lib/design-link.mjs +16 -1
  391. package/cli/lib/design-open.mjs +49 -3
  392. package/cli/lib/desktop-locate.mjs +770 -0
  393. package/cli/lib/handoff.mjs +1 -1
  394. package/cli/lib/hook-state.mjs +291 -0
  395. package/cli/lib/pkg-root.mjs +65 -13
  396. package/cli/lib/studio-locate.mjs +59 -16
  397. package/package.json +15 -8
  398. package/plugins/design/templates/_shell.html +13 -0
  399. package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
  400. package/apps/studio/client/v2/shell/account-card-model.js +0 -114
  401. package/apps/studio/client/v2/shell/account-card.jsx +0 -189
@@ -15,8 +15,12 @@
15
15
  //
16
16
  // Which path to TRY comes from this Mac's stored role and its own record of deletes sent; the hub
17
17
  // decides the rest (a member's door 429, an owner check on the purge). Nothing here is a hub claim.
18
+ //
19
+ // 2.1.1 N4 — both answers name the batch the person was shown (`heldSetDigest` of the waiting set,
20
+ // carried in the pass status): a set that changed since (more local deletes joined it) answers
21
+ // `changed` and nothing is sent — the incoming answer's T8 rule.
18
22
 
19
- import { inHeldFolder } from './file-plane.ts';
23
+ import { heldSetDigest, inHeldFolder } from './file-plane.ts';
20
24
 
21
25
  /** The hub door's delete window — apps/hub/src/journal.mjs `DELETE_BUDGET_PER_WINDOW`. */
22
26
  export const DOOR_DELETES_MEMBER = 25;
@@ -32,6 +36,12 @@ export interface HeldDeletePlane {
32
36
  heldDeletes(): { count: number; paths: string[]; folders: { folder: string; count: number }[] };
33
37
  answerHeldDeletes(how: 'send' | 'purging' | 'keep', folder: string | null): string[];
34
38
  endPurge(rels: readonly string[]): void;
39
+ /** 2.1.1 T13 — the held INCOMING deletes (the project removed these; this Mac still has them). */
40
+ answerIncomingDeletes(
41
+ how: 'remove' | 'keep',
42
+ folder: string | null,
43
+ digest: string
44
+ ): string[] | null;
35
45
  }
36
46
 
37
47
  export interface HeldDeletesDeps {
@@ -57,16 +67,32 @@ export interface HeldDeletesView {
57
67
  }
58
68
 
59
69
  export type HeldDeleteAnswer =
60
- | { ok: true; how: 'door' | 'purge' | 'keep'; count: number }
70
+ | { ok: true; how: 'door' | 'purge' | 'keep' | 'removed' | 'kept-here'; count: number }
61
71
  | {
62
72
  ok: false;
63
- reason: 'nothing-held' | 'not-owner' | 'busy' | 'not-linked';
73
+ reason: 'nothing-held' | 'not-owner' | 'busy' | 'not-linked' | 'changed';
64
74
  detail: string;
65
75
  };
66
76
 
67
77
  export interface HeldDeletesControl {
68
78
  view(): HeldDeletesView;
69
- answer(answer: 'delete' | 'keep', folder: string | null): Promise<HeldDeleteAnswer>;
79
+ /** 2.1.1 N4 — `digest` names the set the person was shown; a stale or missing one answers `changed`. */
80
+ answer(
81
+ answer: 'delete' | 'keep',
82
+ folder: string | null,
83
+ digest: string
84
+ ): Promise<HeldDeleteAnswer>;
85
+ /**
86
+ * 2.1.1 T13 — the answer to a batch the PROJECT deleted, held here. `remove`: filed into `_trash/` on
87
+ * the next pass, all at once (recoverable). `keep`: stays on this Mac, never sent back. Local to
88
+ * this Mac either way, so no role or hub decides it. 2.1.1 T8 — `digest` names the set the person
89
+ * was shown; a set that changed since answers `changed` and nothing is applied.
90
+ */
91
+ answerIncoming(
92
+ answer: 'remove' | 'keep',
93
+ folder: string | null,
94
+ digest: string
95
+ ): Promise<HeldDeleteAnswer>;
70
96
  /** Test seam: the running purge, if any. */
71
97
  idle(): Promise<void>;
72
98
  }
@@ -169,7 +195,7 @@ export function createHeldDeletes(deps: HeldDeletesDeps): HeldDeletesControl {
169
195
  purge: purge ? { ...purge } : null,
170
196
  };
171
197
  },
172
- async answer(answer, folder) {
198
+ async answer(answer, folder, digest) {
173
199
  const plane = deps.plane();
174
200
  if (!plane) {
175
201
  return {
@@ -178,6 +204,9 @@ export function createHeldDeletes(deps: HeldDeletesDeps): HeldDeletesControl {
178
204
  detail: 'This project isn’t syncing with a hub right now.',
179
205
  };
180
206
  }
207
+ // 2.1.1 N4 — the answer covers exactly the waiting set that was on screen, or nothing
208
+ if (digest !== heldSetDigest(plane.heldDeletes().paths))
209
+ return listChanged(LIST_CHANGED_OUT_DETAIL);
181
210
  if (answer === 'keep') {
182
211
  const kept = plane.answerHeldDeletes('keep', folder);
183
212
  if (kept.length === 0) return nothingHeld();
@@ -207,12 +236,52 @@ export function createHeldDeletes(deps: HeldDeletesDeps): HeldDeletesControl {
207
236
  });
208
237
  return { ok: true, how: 'purge', count: rels.length };
209
238
  },
239
+ async answerIncoming(answer, folder, digest) {
240
+ const plane = deps.plane();
241
+ if (!plane) {
242
+ return {
243
+ ok: false,
244
+ reason: 'not-linked',
245
+ detail: 'This project isn’t syncing with a hub right now.',
246
+ };
247
+ }
248
+ const rels = plane.answerIncomingDeletes(answer, folder, digest);
249
+ if (rels === null) return listChanged();
250
+ if (rels.length === 0) {
251
+ return {
252
+ ok: false,
253
+ reason: 'nothing-held',
254
+ detail: 'Nothing here is waiting to be removed.',
255
+ };
256
+ }
257
+ // The removal applies on the very next pass — start it now rather than at the next tick.
258
+ void Promise.resolve(deps.runPass()).catch(() => {});
259
+ return { ok: true, how: answer === 'remove' ? 'removed' : 'kept-here', count: rels.length };
260
+ },
210
261
  async idle() {
211
262
  await job;
212
263
  },
213
264
  };
214
265
  }
215
266
 
267
+ /** 2.1.1 T8 — the held set is not the one the person answered about. */
268
+ export const LIST_CHANGED_DETAIL = 'The list changed. Nothing was removed — look at it again.';
269
+ /** 2.1.1 N4 — the outbound twin: nothing was deleted on the hub. */
270
+ export const LIST_CHANGED_OUT_DETAIL = 'The list changed. Nothing was deleted — look at it again.';
271
+ function listChanged(detail = LIST_CHANGED_DETAIL): HeldDeleteAnswer {
272
+ return { ok: false, reason: 'changed', detail };
273
+ }
274
+
275
+ /** A folder name from the project for a sentence: no control or formatting characters (a bidi
276
+ * override would reorder the words around it), one line, capped — the folder list's own cleanup. */
277
+ export function cleanFolderName(raw: string): string {
278
+ const s = String(raw ?? '')
279
+ .replace(/[\p{Cc}\p{Cf}]/gu, '')
280
+ .replace(/\s+/g, ' ')
281
+ .trim();
282
+ return s.length > 120 ? `${s.slice(0, 120)}…` : s;
283
+ }
284
+
216
285
  function nothingHeld(): HeldDeleteAnswer {
217
286
  return { ok: false, reason: 'nothing-held', detail: 'Nothing here is waiting to be deleted.' };
218
287
  }
@@ -228,3 +297,15 @@ export function heldDeleteDetail(count: number, folders: { folder: string; count
228
297
  const files = count === 1 ? '1 file' : `${thousands(count)} files`;
229
298
  return `${files} deleted on this Mac${where} — more than sync deletes on the hub without asking. They are still on the hub. Delete them on the hub too, or keep them there.`;
230
299
  }
300
+
301
+ /** Sync details' sentence for the held INCOMING row (CONTRACT §4: what happened · what is safe · the verbs). */
302
+ export function heldIncomingDetail(count: number, folders: { folder: string; count: number }[]) {
303
+ const where =
304
+ folders.length === 1
305
+ ? ` in ${cleanFolderName(folders[0]?.folder ?? '') || 'the project folder'}`
306
+ : folders.length > 1
307
+ ? ` in ${thousands(folders.length)} folders`
308
+ : '';
309
+ const files = count === 1 ? '1 file' : `${thousands(count)} files`;
310
+ return `${files} deleted by the project${where} — more than sync removes here without asking. They are still on this Mac. Remove them here too and they go to the trash, or keep them here.`;
311
+ }
@@ -77,6 +77,11 @@ export async function linkHub(body: unknown): Promise<HubLinkResult> {
77
77
  }
78
78
  if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
79
79
  return bad('The hub address must start with http:// or https://.');
80
+ // 2.1.1 T8 — the same grammar as every other door (home/hub.ts `hubAddress`): a credential is never
81
+ // stored for cleartext http to a remote host; http stays for a loopback dev server.
82
+ if (parsed.protocol === 'http:' && !isLoopbackHostname(parsed.hostname))
83
+ return bad('The hub address must start with https://.');
84
+ if (parsed.username || parsed.password) return bad("That doesn't look like a valid hub address.");
80
85
 
81
86
  const token = b.token.trim();
82
87
 
@@ -97,6 +102,9 @@ export async function linkHub(body: unknown): Promise<HubLinkResult> {
97
102
  };
98
103
  }
99
104
 
105
+ const isLoopbackHostname = (h: string) =>
106
+ h === 'localhost' || h === '[::1]' || /^127(?:\.\d{1,3}){3}$/.test(h);
107
+
100
108
  function bad(error: string): HubLinkResult {
101
109
  return { status: 400, json: { ok: false, error } };
102
110
  }
@@ -48,10 +48,11 @@ import type { TrashListing, TrashOutcome } from '../history/trash.ts';
48
48
  import { createHistory } from '../history.ts';
49
49
  import { SYNTHETIC_FS_DELAY_MS } from '../hmr-broadcast.ts';
50
50
  import { rekeyUserState } from '../home/user-state.ts';
51
- import { acceptedColdStart, localCreateLanes } from './accepted-cold-start.ts';
51
+ import { acceptedColdStart, localCreateLanes, setAsideNotice } from './accepted-cold-start.ts';
52
52
  import { type AcceptedLink, createAcceptedLink, type StructuralOutcome } from './accepted-link.ts';
53
53
  import { createAccessRelay } from './access-notices.ts';
54
- import type { RunFence } from './action-stage.ts';
54
+ import { type RunFence, shellClaimLane } from './action-stage.ts';
55
+ import { type AdoptHeldControl, createAdoptHeld } from './adopt-held.ts';
55
56
  import { type CanvasSyncAgent, createCanvasSyncAgent } from './agent.ts';
56
57
  import { isPushableAssetRel, pushAssets } from './asset-push.ts';
57
58
  import {
@@ -112,7 +113,12 @@ import {
112
113
  withFormatParam,
113
114
  } from './format-sync.ts';
114
115
  import { createFsReader, type FsReader } from './fs-mirror.ts';
115
- import { createHeldDeletes, type HeldDeletesControl, heldDeleteDetail } from './held-deletes.ts';
116
+ import {
117
+ createHeldDeletes,
118
+ type HeldDeletesControl,
119
+ heldDeleteDetail,
120
+ heldIncomingDetail,
121
+ } from './held-deletes.ts';
116
122
  import { canvasLanes, namedField, type RowNamed } from './history-fields.ts';
117
123
  import { type HubDocRow, hubHolds, indexHubDocs } from './hub-listing.ts';
118
124
  import { HUB_UNDO_READ_MAX_BYTES, hubTextUndoConflict } from './hub-text-undo.ts';
@@ -120,9 +126,11 @@ import { accessFor, getHubRecord, watchHubsConfig } from './hubs-config.ts';
120
126
  import { loadJournal, type SyncJournal } from './journal.ts';
121
127
  import {
122
128
  hasAnnotationsV2,
129
+ hasAssetAddedV1,
123
130
  hasFileClassesV2,
124
131
  hasFileDepthV2,
125
132
  hasLedger,
133
+ hasPresenceRoleV1,
126
134
  probeFileLane,
127
135
  } from './journal-client.ts';
128
136
  import type { RestoreOptions } from './local-kernel.ts';
@@ -519,7 +527,12 @@ const AUTH_CLASS_HINT: Record<AuthFailureClass, string> = {
519
527
  * module cycle — the real `Registry` satisfies it.
520
528
  */
521
529
  export interface AwarenessRegistry {
522
- attachHubAwareness(slug: string, awareness: Awareness): () => void;
530
+ /** T5.2 — `rolesVouched`: does the hub stamp presence roles (collab/awareness-bridge.ts). */
531
+ attachHubAwareness(
532
+ slug: string,
533
+ awareness: Awareness,
534
+ opts?: { rolesVouched?: () => boolean }
535
+ ): () => void;
523
536
  /** Phase 9.1 — relay a hub-pushed comment/annotation snapshot into a live
524
537
  * room (wholesale, in-process) so the peer's canvas reflects it immediately
525
538
  * and the room's own debounced persist can't clobber the synced state back.
@@ -602,6 +615,8 @@ export interface SyncRuntime {
602
615
  codeConsent?(): CodeConsentControl | null;
603
616
  /** Issue #207 (7b) — the held local deletes and the person's answer (Sync details). */
604
617
  heldDeletes?(): HeldDeletesControl | null;
618
+ /** #167 T5.3 — Adopt as code for one file the hub holds back (Sync details, the owner). */
619
+ adoptHeld?(): AdoptHeldControl | null;
605
620
  /** Number of active per-canvas agents. */
606
621
  size(): number;
607
622
  /** Test inspection — get the agent for a slug if one was created. */
@@ -654,8 +669,19 @@ export interface SyncRuntime {
654
669
  slug: string,
655
670
  lane: 'comments' | 'annotations' | 'meta',
656
671
  text: string,
657
- /** T-S4.5b — `stageable`: a run-tagged annotation batch joins its run's stage (claimed by hash). */
658
- opts?: { baseText?: string; writeId?: string; stageable?: boolean }
672
+ /**
673
+ * T-S4.5b — `stageable`: a run-tagged annotation batch joins its run's stage (claimed by hash).
674
+ * `contested` (T5.2): texts a collaborator changed during this stroke — read by the local home
675
+ * only; a hub-linked runtime judges a ⌘Z from the hub's history instead.
676
+ */
677
+ opts?: {
678
+ baseText?: string;
679
+ writeId?: string;
680
+ stageable?: boolean;
681
+ contested?: readonly string[];
682
+ /** T7.3b (#113) — the person's gesture in words (untrusted; the receiver cleans it). Annotations only. */
683
+ label?: string;
684
+ }
659
685
  ): Promise<{ status: 'accepted' | 'rejected'; code?: string }> | null;
660
686
  /**
661
687
  * S4.7 — several lanes of one synced canvas as ONE proposal (a sticky ↔
@@ -862,6 +888,17 @@ export interface SyncRuntime {
862
888
  } | null>;
863
889
  /** S5.5 — a tool reported writing `hash` (sha256) to canvas `repoRel` for run `key`. */
864
890
  claimAiWrite?(key: string, repoRel: string, hash?: string | null): void;
891
+ /**
892
+ * #164 — run `key`'s call `call` settles: its window closes; what it parked joins that run when its
893
+ * bytes are claimed (`claimed`: the repo-relative files the settle claimed), the rest lands as
894
+ * outside. F5 — false when that run has no window for the call.
895
+ */
896
+ settleShellCall?(key: string, call: string, claimed?: readonly string[]): boolean;
897
+ /** F5/F6 — run `key`'s window for call `call` (local-kernel.ts `shellCall`), or null. */
898
+ shellCall?(
899
+ key: string,
900
+ call: string
901
+ ): { all: boolean; covers(repoRel: string): boolean; left(repoRel: string): boolean } | null;
865
902
  /** p8-a1-claims (F17) — run `key` is about to delete canvas `repoRel`: the delete joins the run. */
866
903
  claimAiDelete?(key: string, repoRel: string): void;
867
904
  unclaimAiDelete?(key: string, repoRel: string): void;
@@ -1123,6 +1160,11 @@ export function createSyncRuntime(
1123
1160
  : ctx.cfg.linkedHub;
1124
1161
  if (!linked) return null;
1125
1162
  const linkedHub = linked;
1163
+ /**
1164
+ * T5.2 (#165) — the hub's /health `capabilities` from the file-lane probe (null until it answers).
1165
+ * The awareness bridge keeps a hub-relayed presence role only while it says `presence-role-v1`.
1166
+ */
1167
+ let hubHealthCaps: string[] | null = null;
1126
1168
  /**
1127
1169
  * Issue #207 — folders this project does not sync, read from the project config per pass (a
1128
1170
  * choice made mid-upload applies at the next pass; cleaned, so a committed `..` entry is dropped).
@@ -1965,6 +2007,8 @@ export function createSyncRuntime(
1965
2007
  let heldReporter: ReturnType<typeof createHeldReporter> | null = null;
1966
2008
  /** Issue #207 (7b) — Delete on the hub too / Keep on the hub, for the held local deletes. */
1967
2009
  let heldDeletesControl: HeldDeletesControl | null = null;
2010
+ /** #167 T5.3 — Adopt as code: the owner's answer to a file the hub holds back. */
2011
+ let adoptHeldControl: AdoptHeldControl | null = null;
1968
2012
  /** Cumulative files sent up this boot — the doručenka's push half. */
1969
2013
  let filePushed = 0;
1970
2014
  /** Debounce for a plane pass triggered by a local write. */
@@ -2263,6 +2307,30 @@ export function createSyncRuntime(
2263
2307
  */
2264
2308
  const retiredDocs = new Set<string>();
2265
2309
 
2310
+ /**
2311
+ * The stale local copies a retirement left in place, keyed slug → the body's
2312
+ * size and mtime when it was let go.
2313
+ *
2314
+ * When a retired document's new path never appears, the old file stays on
2315
+ * disk (a recoverable ghost beats a lost canvas). The discovery rescan then
2316
+ * found a canvas on disk with no provider and adopted it again — whose
2317
+ * handshake read the same retirement, released it, and waited out the same
2318
+ * missing path, on every rescan for as long as the process ran: a full
2319
+ * document transfer each time, for a file nobody touched. The rescan skips a
2320
+ * copy whose body is unchanged since it was let go; an edit to it, or a new
2321
+ * file at the path, changes the stamp and is adopted as usual.
2322
+ */
2323
+ const retiredCopies = new Map<string, string>();
2324
+ const bodyStamp = (abs: string | undefined): string | null => {
2325
+ if (!abs) return null;
2326
+ try {
2327
+ const st = statSync(abs);
2328
+ return `${st.size}:${st.mtimeMs}`;
2329
+ } catch {
2330
+ return null;
2331
+ }
2332
+ };
2333
+
2266
2334
  /**
2267
2335
  * What the hub's last listing said each document HOLDS, in bytes.
2268
2336
  *
@@ -2382,6 +2450,12 @@ export function createSyncRuntime(
2382
2450
  const newAbs = path.resolve(ctx.paths.designRoot, norm);
2383
2451
  const contained =
2384
2452
  newAbs === ctx.paths.designRoot || newAbs.startsWith(ctx.paths.designRoot + path.sep);
2453
+ // The old body stays on disk from here on unless it is parked below:
2454
+ // remember it, so the next rescan does not adopt it straight back.
2455
+ if (!(desc.html && path.resolve(desc.html) === newAbs)) {
2456
+ const stamp = bodyStamp(desc.html);
2457
+ if (stamp !== null && retiredCopies.size < NUDGE_MEMO_CAP) retiredCopies.set(slug, stamp);
2458
+ }
2385
2459
  if (!contained) return; // hostile path — never act on it
2386
2460
  // A DOCUMENT THAT MOVED TO WHERE IT ALREADY IS DID NOT MOVE.
2387
2461
  //
@@ -4047,6 +4121,8 @@ export function createSyncRuntime(
4047
4121
  ownAccepted,
4048
4122
  ownAcceptedCss,
4049
4123
  wasAccepted: (content) => acceptedLink.client.holdsValue(content),
4124
+ // T11 — a hub's own checkout is the project's cache: never a held conflict there.
4125
+ checkoutIsCache: cellPairing !== null,
4050
4126
  createDoc:
4051
4127
  createdHere !== null
4052
4128
  ? async () => ({ status: 'accepted' as const, html: createdHere })
@@ -4064,6 +4140,16 @@ export function createSyncRuntime(
4064
4140
  // (the same file, or a module that keeps its name), so it joins it.
4065
4141
  joined = await acceptedColdStart({ ...coldStart, inProject: true });
4066
4142
  }
4143
+ // S1 (2.1.1) — what the project's version replaced of this Mac's (a first link) is in
4144
+ // its recovery slot; say so instead of only logging it.
4145
+ if (joined.kind === 'reconciled' && joined.setAside?.length) {
4146
+ store.notice({
4147
+ id: `set-aside-${canvas.slug}`,
4148
+ severity: 'warn',
4149
+ text: setAsideNotice(rel, canvas.slug, joined.setAside),
4150
+ lanes: [...joined.setAside],
4151
+ });
4152
+ }
4067
4153
  renamedAway.delete(docName);
4068
4154
  projection.reconcile();
4069
4155
  } else if (projection) {
@@ -4534,7 +4620,11 @@ export function createSyncRuntime(
4534
4620
  noteDetach(
4535
4621
  awarenessDetaches,
4536
4622
  canvas.slug,
4537
- opts.registry.attachHubAwareness(canvas.slug, provider.awareness)
4623
+ // T5.2 (#165) — a hub-relayed presence role is kept only from a hub that stamps roles: a
4624
+ // cell pairing dials its own hub (the same image), anything else must say so in /health.
4625
+ opts.registry.attachHubAwareness(canvas.slug, provider.awareness, {
4626
+ rolesVouched: () => cellPairing !== null || hasPresenceRoleV1(hubHealthCaps),
4627
+ })
4538
4628
  );
4539
4629
  }
4540
4630
  // Cold-start reconcile fires once the provider has hub state.
@@ -5019,7 +5109,18 @@ export function createSyncRuntime(
5019
5109
  // agent reads.
5020
5110
  markUntrusted();
5021
5111
  }
5022
- const incoming = added.map((slug) => bySlug.get(slug)).filter((c) => !!c);
5112
+ const incoming = added
5113
+ .map((slug) => bySlug.get(slug))
5114
+ .filter((c): c is CanvasDescriptor => {
5115
+ if (!c) return false;
5116
+ const was = retiredCopies.get(c.slug);
5117
+ if (was === undefined) return true;
5118
+ // Unchanged since its retirement released it: adopting it again
5119
+ // can only end in the same release.
5120
+ if (bodyStamp(c.html) === was) return false;
5121
+ retiredCopies.delete(c.slug);
5122
+ return true;
5123
+ });
5023
5124
  // S6.13 — only a project that does not answer gets its creates now;
5024
5125
  // one that answers creates them on the handshake, as it always has.
5025
5126
  const offline =
@@ -5504,6 +5605,7 @@ export function createSyncRuntime(
5504
5605
  // Read once: calling it inside the spread evaluated it twice and made
5505
5606
  // its `null` case the object's type.
5506
5607
  const blockedMedia = filePlane?.blocked() ?? null;
5608
+ const conflictCopiesNow = filePlane?.conflictCopies() ?? {};
5507
5609
  const ignoreFoldersNow = planeIgnoreFolders();
5508
5610
  const purgeNow = heldDeletesControl?.view().purge ?? null;
5509
5611
  statusStore?.updateFiles?.({
@@ -5513,6 +5615,9 @@ export function createSyncRuntime(
5513
5615
  ...(filePlane
5514
5616
  ? {
5515
5617
  delivery: filePlane.doruceka(),
5618
+ ...(Object.keys(conflictCopiesNow).length > 0
5619
+ ? { conflictCopies: conflictCopiesNow }
5620
+ : {}),
5516
5621
  ...(filePlane.dorucekaTotal() > MAX_DORUCEKA_ROWS
5517
5622
  ? { deliveryTruncated: filePlane.dorucekaTotal() - MAX_DORUCEKA_ROWS }
5518
5623
  : {}),
@@ -5962,6 +6067,7 @@ export function createSyncRuntime(
5962
6067
  void probeFileLane({ hubUrl: linkedHub.url, signal: fileEventsProbe.signal })
5963
6068
  .then(({ lane, capabilities: caps, formatVersion: hubFormat }) => {
5964
6069
  if (stopped) return;
6070
+ if (caps) hubHealthCaps = caps;
5965
6071
  if (lane === 'unknown') {
5966
6072
  if (!laneUnansweredSaid) {
5967
6073
  laneUnansweredSaid = true;
@@ -6040,6 +6146,8 @@ export function createSyncRuntime(
6040
6146
  hubTakesV2Files: hasFileClassesV2(caps),
6041
6147
  // fix/205 — an older hub refuses paths deeper than 8 segments; held, with a reason.
6042
6148
  hubTakesDeepPaths: hasFileDepthV2(caps),
6149
+ // #172 — a hub before `asset-added-v1` refuses the who-added sidecar; held, with a reason.
6150
+ hubTakesAddedFiles: hasAssetAddedV1(caps),
6043
6151
  unlimitedOutboundDeletes: unlimitedDeletes,
6044
6152
  // Increment 6, DEFAULT ON: a hub-owned mirror that ignores
6045
6153
  // deletes contradicts the model it is selling — you delete a
@@ -6086,6 +6194,13 @@ export function createSyncRuntime(
6086
6194
  runPass: () => schedulePlanePass(),
6087
6195
  });
6088
6196
  }
6197
+ // #167 T5.3 — Adopt as code: the hub's own owner gate decides; this only carries it.
6198
+ adoptHeldControl = createAdoptHeld({
6199
+ hubUrl: linkedHub.url,
6200
+ token: () => token,
6201
+ fetchImpl: hubFetch,
6202
+ runPass: () => schedulePlanePass(),
6203
+ });
6089
6204
  console.log(
6090
6205
  '[sync/files] journal file plane active — one lane, both directions, per-file delivery state in the Sync panel.'
6091
6206
  );
@@ -6165,6 +6280,7 @@ export function createSyncRuntime(
6165
6280
  filePlane = null;
6166
6281
  heldReporter = null;
6167
6282
  heldDeletesControl = null;
6283
+ adoptHeldControl = null;
6168
6284
  // The control channel is a doorbell into this runtime; it goes with it.
6169
6285
  // Reported on the way out so the poke-miss question is answerable from a
6170
6286
  // session's log rather than from a hunch (DDR-226 §10).
@@ -6355,6 +6471,7 @@ export function createSyncRuntime(
6355
6471
  pullRemoteNow: () => remotePull?.() ?? Promise.resolve(),
6356
6472
  codeConsent: () => codeConsent,
6357
6473
  heldDeletes: () => heldDeletesControl,
6474
+ adoptHeld: () => adoptHeldControl,
6358
6475
  // Under sharedDoc the per-canvas handler is a projection, not an agent;
6359
6476
  // count both so size() reflects the synced-canvas count in either mode.
6360
6477
  size: () => agents.size + projections.size,
@@ -6421,6 +6538,7 @@ export function createSyncRuntime(
6421
6538
  ...(base !== undefined && base !== null ? { baseContent: base } : {}),
6422
6539
  ...(o?.writeId ? { writeId: o.writeId } : {}),
6423
6540
  ...(o?.stageable === true ? { stageable: true } : {}),
6541
+ ...(lane === 'annotations' && o?.label ? { label: o.label } : {}),
6424
6542
  });
6425
6543
  },
6426
6544
  proposeLanes: (slug, lanes, o) => {
@@ -6853,6 +6971,32 @@ export function createSyncRuntime(
6853
6971
  const slug = slugForRepoRel(repoRel);
6854
6972
  if (slug && acceptedLink) acceptedLink.stage.claim(key, slug, hash ?? null);
6855
6973
  },
6974
+ settleShellCall: (key, call, claimed) => {
6975
+ if (!acceptedLink) return false;
6976
+ // N2 — each claimed file names its own lane of the canvas, never the whole canvas
6977
+ const lanes = (claimed ?? []).flatMap((f) => {
6978
+ const slug = slugForRepoRel(String(f).replace(/\.(?:meta|annotations)\.json$/i, '.tsx'));
6979
+ return slug ? [{ slug, lane: shellClaimLane(String(f)) }] : [];
6980
+ });
6981
+ return acceptedLink.stage.settleShellCall(key, call, lanes);
6982
+ },
6983
+ shellCall: (key, call) => {
6984
+ const w = acceptedLink?.stage.shellCall(key, call);
6985
+ if (!w) return null;
6986
+ const slugOf = (f: string) =>
6987
+ slugForRepoRel(String(f).replace(/\.(?:meta|annotations)\.json$/i, '.tsx'));
6988
+ return {
6989
+ all: w.all,
6990
+ covers: (repoRel) => {
6991
+ const s = slugOf(repoRel);
6992
+ return !!s && w.covers(s);
6993
+ },
6994
+ left: (repoRel) => {
6995
+ const s = slugOf(repoRel);
6996
+ return !!s && w.left(s);
6997
+ },
6998
+ };
6999
+ },
6856
7000
  claimAiDelete: (key, repoRel) => {
6857
7001
  const slug = slugForRepoRel(repoRel);
6858
7002
  if (slug && acceptedLink) acceptedLink.stage.claimDelete(key, slug);
@@ -7021,11 +7165,13 @@ export function filePlaneHeld(
7021
7165
  count: result.deleteHeld.count,
7022
7166
  paths: result.deleteHeld.paths,
7023
7167
  ...(result.deleteHeld.folders ? { folders: result.deleteHeld.folders } : {}),
7168
+ ...(result.deleteHeld.digest ? { digest: result.deleteHeld.digest } : {}),
7024
7169
  detail:
7025
7170
  result.deleteHeld.direction === 'out'
7026
7171
  ? // Issue #207 (7b) — the row's two buttons are the answer (Delete on the hub too · Keep on the hub).
7027
7172
  heldDeleteDetail(result.deleteHeld.count, result.deleteHeld.folders ?? [])
7028
- : `The project wants to remove ${result.deleteHeld.count} files here — more than sync will delete without you saying so. Nothing was removed. They stay until you accept or the project puts them back.`,
7173
+ : // 2.1.1 T13 — the row's two buttons are the answer (Remove here too · Keep them here).
7174
+ heldIncomingDetail(result.deleteHeld.count, result.deleteHeld.folders ?? []),
7029
7175
  });
7030
7176
  }
7031
7177
  if (result.firstAnchorHeld) {
@@ -7038,12 +7184,32 @@ export function filePlaneHeld(
7038
7184
  }
7039
7185
  // p8-held-surface — what the HUB holds back from the code lane (owner reads only). Without
7040
7186
  // this row a held file was not synced, not committed, and nobody was told.
7041
- if (result.codeHeld && result.codeHeld.count > 0) {
7187
+ // #167 T5.3 — an overflowed hold list is a row even when it names nothing: files are held unlisted.
7188
+ if (result.codeHeld && (result.codeHeld.count > 0 || result.codeHeld.overflow === true)) {
7189
+ const overflow = result.codeHeld.overflow === true;
7190
+ // Burndown F4 — the version of each file the hub holds, so the row shows it and adopts that one.
7191
+ const files = result.codeHeld.paths.flatMap((h) =>
7192
+ h.sha256 && typeof h.size === 'number'
7193
+ ? [{ path: h.path, sha256: h.sha256, size: h.size }]
7194
+ : []
7195
+ );
7042
7196
  held.push({
7043
7197
  kind: 'code-held',
7044
7198
  count: result.codeHeld.count,
7045
7199
  paths: result.codeHeld.paths.map((h) => h.path),
7046
- detail: codeHeldDetail(result.codeHeld.count),
7200
+ ...(files.length > 0 ? { files } : {}),
7201
+ ...(overflow ? { overflow: true as const } : {}),
7202
+ detail: codeHeldDetail(result.codeHeld.count, { overflow }),
7203
+ });
7204
+ }
7205
+ // #167 T5.3 item 6 — this Mac's canvases outside its canvas folders, held while none are declared.
7206
+ const outside = result.canvasOutsideFolders ?? [];
7207
+ if (outside.length > 0) {
7208
+ held.push({
7209
+ kind: 'canvas-outside-folders',
7210
+ count: outside.length,
7211
+ paths: outside,
7212
+ detail: canvasOutsideFoldersDetail(outside.length),
7047
7213
  });
7048
7214
  }
7049
7215
  // Issue #175 — files the project's server will not take. Counted already under
@@ -7109,12 +7275,30 @@ export function hubRefusedDetail(reasons: readonly string[]): string {
7109
7275
  : `${count} files weren’t taken by the project’s server${answered}. They stay on this Mac, and sync tries again when one changes.`;
7110
7276
  }
7111
7277
 
7278
+ /**
7279
+ * #167 T5.3 item 6 — the Sync details sentence for canvases outside the canvas folders, held on this
7280
+ * Mac while the project declares none (CONTRACT §4: what happened · what is safe · one verb).
7281
+ */
7282
+ export function canvasOutsideFoldersDetail(count: number): string {
7283
+ return count === 1
7284
+ ? '1 file is a canvas outside your canvas folders, so it doesn’t sync. Nothing was removed. Open canvas folders and add its folder to sync it as a canvas.'
7285
+ : `${count} files are canvases outside your canvas folders, so they don’t sync. Nothing was removed. Open canvas folders and add their folders to sync them as canvases.`;
7286
+ }
7287
+
7112
7288
  /**
7113
7289
  * p8-held-surface — the Sync details sentence for files the hub holds back from the code lane
7114
7290
  * (CONTRACT §4: what happened · what is safe · one verb). Only the owner reads it, and only the
7115
7291
  * owner sets the canvas folders, so the verb is theirs to take.
7116
7292
  */
7117
- export function codeHeldDetail(count: number): string {
7293
+ export function codeHeldDetail(count: number, { overflow = false } = {}): string {
7294
+ // #167 T5.3 — the hub's hold list overflowed (its cap or a cut walk): files it could not name are
7295
+ // held back from the code lane too, so the row says so — even when it lists none.
7296
+ if (overflow && count === 0) {
7297
+ return 'Files made as canvases before the canvas folders were set may be held back: the project’s server couldn’t keep track of every one, so those outside the canvas folders don’t sync. Nothing was removed. Add their folders to the canvas folders to keep them as canvases.';
7298
+ }
7299
+ if (overflow) {
7300
+ return `${codeHeldDetail(count)} The project’s server couldn’t keep track of every one, so more may be held than are listed.`;
7301
+ }
7118
7302
  return count === 1
7119
7303
  ? '1 file was made or changed as a canvas before the canvas folders were set, and is outside them now, so it doesn’t sync. Nothing was removed. Add its folder to the canvas folders to keep it as a canvas.'
7120
7304
  : `${count} files were made or changed as canvases before the canvas folders were set, and are outside them now, so they don’t sync. Nothing was removed. Add their folders to the canvas folders to keep them as canvases.`;