@1agh/maude 2.0.4 → 2.0.8

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 (272) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/closure.ts +156 -16
  3. package/apps/studio/access/filters.ts +39 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/actions/agents.ts +59 -0
  7. package/apps/studio/actions/ctx.ts +3 -0
  8. package/apps/studio/actions/defs/app.ts +12 -0
  9. package/apps/studio/actions/defs/sync.ts +13 -0
  10. package/apps/studio/actions/defs/view.ts +59 -3
  11. package/apps/studio/actions/keymap.gen.ts +35 -0
  12. package/apps/studio/actions/menu.ts +2 -0
  13. package/apps/studio/actions/types.ts +3 -1
  14. package/apps/studio/actions.manifest.json +148 -1
  15. package/apps/studio/actions.parity.json +31 -1
  16. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/ride.ts +2 -1
  20. package/apps/studio/annotations/ui/text-style.ts +1 -1
  21. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  22. package/apps/studio/annotations-layer.tsx +4 -15
  23. package/apps/studio/api.ts +425 -128
  24. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  25. package/apps/studio/artboard-ai-copies.tsx +4 -4
  26. package/apps/studio/artboard-freeze.ts +108 -0
  27. package/apps/studio/artboard-live-gate.tsx +636 -0
  28. package/apps/studio/artboard-live.ts +831 -0
  29. package/apps/studio/artboard-placeholder.ts +197 -0
  30. package/apps/studio/artboard-still-raster.ts +485 -0
  31. package/apps/studio/artboard-still-warmup.ts +221 -0
  32. package/apps/studio/artboard-still.ts +1188 -0
  33. package/apps/studio/artboard-webgl.ts +669 -0
  34. package/apps/studio/asset-placeholder.tsx +237 -132
  35. package/apps/studio/asset-upload-bars.tsx +4 -4
  36. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  37. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  38. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  39. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  40. package/apps/studio/bin/_ds-check.mjs +4 -1
  41. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  42. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  43. package/apps/studio/bin/_import-asset.mjs +2 -1
  44. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  45. package/apps/studio/bin/_perf-probe.mjs +2 -1
  46. package/apps/studio/bin/_perf-shared.mjs +12 -7
  47. package/apps/studio/bin/_pw-launch.mjs +26 -1
  48. package/apps/studio/bin/_studio-verb.mjs +24 -3
  49. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  50. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  51. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  52. package/apps/studio/bin/ds-check.sh +5 -1
  53. package/apps/studio/bin/perf.sh +30 -1
  54. package/apps/studio/bin/server-up.sh +7 -2
  55. package/apps/studio/bin/smoke.sh +19 -0
  56. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  57. package/apps/studio/canvas-build-sandbox.ts +69 -13
  58. package/apps/studio/canvas-camera.ts +90 -0
  59. package/apps/studio/canvas-comment-mount.tsx +9 -9
  60. package/apps/studio/canvas-lib.tsx +289 -44
  61. package/apps/studio/canvas-pages-view.tsx +465 -0
  62. package/apps/studio/canvas-pages.ts +305 -0
  63. package/apps/studio/canvas-rows.ts +62 -0
  64. package/apps/studio/canvas-shell.tsx +62 -16
  65. package/apps/studio/canvas-theme-icons.tsx +41 -0
  66. package/apps/studio/canvas-theme-pill.tsx +15 -6
  67. package/apps/studio/canvas-theme.ts +12 -11
  68. package/apps/studio/client/app.jsx +7 -0
  69. package/apps/studio/client/canvas-url.js +36 -1
  70. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  71. package/apps/studio/client/home/Shelves.jsx +4 -3
  72. package/apps/studio/client/home/home-accounts-model.js +121 -0
  73. package/apps/studio/client/home/home-api.js +6 -0
  74. package/apps/studio/client/home/home-app.jsx +141 -40
  75. package/apps/studio/client/home/home-model.js +172 -6
  76. package/apps/studio/client/home/home.css +169 -5
  77. package/apps/studio/client/home/shell-mode.js +8 -1
  78. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  79. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  80. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  81. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  82. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  83. package/apps/studio/client/hooks/use-project-data.jsx +13 -2
  84. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  85. package/apps/studio/client/index-loader.ts +41 -21
  86. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  87. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  88. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  89. package/apps/studio/client/panels/caps-cache.js +46 -0
  90. package/apps/studio/client/shell/viewport.jsx +66 -22
  91. package/apps/studio/client/tree/tree.jsx +17 -0
  92. package/apps/studio/client/v2/access/access-client.js +2 -0
  93. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  94. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  95. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  96. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  97. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  98. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  99. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  100. package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
  101. package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
  102. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  103. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  104. package/apps/studio/client/v2/code/code-bus.js +5 -0
  105. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  106. package/apps/studio/client/v2/code/code-consent.js +67 -0
  107. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  108. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  109. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  110. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  111. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  112. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  113. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  114. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  115. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  116. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  117. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  118. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  119. package/apps/studio/client/v2/history/git-model.js +3 -1
  120. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  121. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  122. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  123. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  124. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  125. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  126. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  127. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  128. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  129. package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
  130. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  131. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  132. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  133. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  134. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  135. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  136. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  137. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  138. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  139. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  140. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  141. package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
  142. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  143. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  144. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  145. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  146. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  147. package/apps/studio/client/v2/shell/use-account.js +8 -1
  148. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  149. package/apps/studio/collab/persistence.ts +9 -1
  150. package/apps/studio/collab/registry.ts +32 -0
  151. package/apps/studio/collab/room.ts +8 -0
  152. package/apps/studio/comments-overlay.tsx +12 -11
  153. package/apps/studio/config-reload-wire.ts +56 -0
  154. package/apps/studio/config.schema.json +6 -0
  155. package/apps/studio/context.ts +37 -1
  156. package/apps/studio/dist/client.bundle.js +1198 -1198
  157. package/apps/studio/dist/comment-mount.js +2 -2
  158. package/apps/studio/dist/styles.css +1 -1
  159. package/apps/studio/ds/board/board.css +6 -0
  160. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  161. package/apps/studio/ds/board/specimen.tsx +16 -2
  162. package/apps/studio/ds/board/template.ts +39 -19
  163. package/apps/studio/ds/canvas-cli.ts +58 -2
  164. package/apps/studio/ds/check.ts +26 -1
  165. package/apps/studio/ds/cli.ts +14 -4
  166. package/apps/studio/ds/component-list.ts +2 -1
  167. package/apps/studio/ds/convert.ts +34 -6
  168. package/apps/studio/ds/default.ts +6 -1
  169. package/apps/studio/ds/ds-resolver.ts +58 -8
  170. package/apps/studio/ds/ds-verb.ts +13 -0
  171. package/apps/studio/ds/engine.ts +3 -1
  172. package/apps/studio/ds/folder-systems.ts +199 -0
  173. package/apps/studio/ds/pairing-css.ts +2 -1
  174. package/apps/studio/ds/post-build.ts +38 -0
  175. package/apps/studio/ds/rename.ts +10 -3
  176. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  177. package/apps/studio/ds/upgrade-apply.ts +27 -5
  178. package/apps/studio/ds/upgrade-cli.ts +22 -2
  179. package/apps/studio/ds/upgrade-prove.ts +198 -15
  180. package/apps/studio/ds/upgrade-stage.ts +10 -3
  181. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  182. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  183. package/apps/studio/editing/align-bar.tsx +4 -4
  184. package/apps/studio/editing/anchor-report.ts +3 -2
  185. package/apps/studio/editing/artboard-handles.tsx +4 -4
  186. package/apps/studio/editing/corner-dots.tsx +4 -4
  187. package/apps/studio/editing/crop-mode.tsx +4 -4
  188. package/apps/studio/editing/drop-chip.tsx +4 -4
  189. package/apps/studio/editing/empty-report.ts +3 -2
  190. package/apps/studio/editing/focus-model.tsx +4 -4
  191. package/apps/studio/editing/gap-bands.tsx +3 -3
  192. package/apps/studio/editing/hold-rings.tsx +4 -4
  193. package/apps/studio/editing/lock-badge.tsx +3 -3
  194. package/apps/studio/editing/long-page.ts +23 -1
  195. package/apps/studio/editing/nudge.tsx +2 -2
  196. package/apps/studio/editing/page-activity.ts +4 -3
  197. package/apps/studio/editing/paste-bar.tsx +4 -4
  198. package/apps/studio/editing/pen/overlay.tsx +4 -3
  199. package/apps/studio/editing/place-freely.tsx +3 -3
  200. package/apps/studio/editing/reorder-slot.tsx +3 -3
  201. package/apps/studio/editing/selection.tsx +4 -4
  202. package/apps/studio/editing/size-ghost.tsx +4 -4
  203. package/apps/studio/editing/tab-order.tsx +4 -4
  204. package/apps/studio/editing/text-in-place.tsx +4 -4
  205. package/apps/studio/editing/undo-preview.tsx +3 -3
  206. package/apps/studio/equal-spacing-handles.tsx +3 -3
  207. package/apps/studio/frame-clock.ts +89 -0
  208. package/apps/studio/history/trash.ts +6 -0
  209. package/apps/studio/home/accounts.ts +87 -0
  210. package/apps/studio/home/index-reader.ts +24 -2
  211. package/apps/studio/home/routes.ts +19 -0
  212. package/apps/studio/http.ts +80 -34
  213. package/apps/studio/index/ds-usage.ts +4 -1
  214. package/apps/studio/index-cache.ts +272 -0
  215. package/apps/studio/inspect-overlay.tsx +4 -3
  216. package/apps/studio/inspect.ts +7 -2
  217. package/apps/studio/link-chip-overlay.tsx +4 -3
  218. package/apps/studio/measure-overlay.tsx +4 -3
  219. package/apps/studio/present/pointer-dot.tsx +3 -2
  220. package/apps/studio/present/present-media.ts +6 -2
  221. package/apps/studio/present/present-stage.tsx +3 -2
  222. package/apps/studio/preview/preview-camera.tsx +3 -2
  223. package/apps/studio/routes/ds-convert.ts +18 -0
  224. package/apps/studio/routes/sync.ts +176 -0
  225. package/apps/studio/routes/trash.ts +16 -1
  226. package/apps/studio/safe-zones-overlay.tsx +3 -2
  227. package/apps/studio/server.ts +8 -10
  228. package/apps/studio/skip-dirs.ts +103 -47
  229. package/apps/studio/studio-page-host.ts +70 -0
  230. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  231. package/apps/studio/sync/asset-push.ts +146 -23
  232. package/apps/studio/sync/asset-state.ts +3 -2
  233. package/apps/studio/sync/code-module-consent.ts +86 -0
  234. package/apps/studio/sync/file-ledger.ts +24 -0
  235. package/apps/studio/sync/file-membership.ts +28 -3
  236. package/apps/studio/sync/file-plane.ts +497 -61
  237. package/apps/studio/sync/file-pull.ts +304 -33
  238. package/apps/studio/sync/held-deletes.ts +230 -0
  239. package/apps/studio/sync/hub-link.ts +1 -2
  240. package/apps/studio/sync/hubs-config.ts +59 -2
  241. package/apps/studio/sync/index.ts +405 -163
  242. package/apps/studio/sync/journal-client.ts +94 -5
  243. package/apps/studio/sync/pending-deletes.ts +100 -0
  244. package/apps/studio/sync/projection.ts +77 -12
  245. package/apps/studio/sync/seed-progress.ts +104 -3
  246. package/apps/studio/sync/settings.ts +36 -1
  247. package/apps/studio/sync/status.ts +17 -1
  248. package/apps/studio/sync/writer-registry.ts +5 -0
  249. package/apps/studio/text-caret.ts +5 -3
  250. package/apps/studio/thumbs/service.ts +12 -2
  251. package/apps/studio/thumbs/validate.ts +7 -0
  252. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  253. package/apps/studio/ui-prefs-migrate.ts +4 -0
  254. package/apps/studio/use-annotation-resize.tsx +4 -3
  255. package/apps/studio/use-artboard-drag.tsx +3 -2
  256. package/apps/studio/use-element-resize.tsx +7 -6
  257. package/apps/studio/use-grid-track-handles.tsx +5 -4
  258. package/apps/studio/use-selection-set.tsx +64 -4
  259. package/apps/studio/use-spacing-handles.tsx +7 -6
  260. package/apps/studio/video-comp.tsx +75 -39
  261. package/apps/studio/video-play-overlay.tsx +4 -3
  262. package/apps/studio/whats-new.json +99 -0
  263. package/cli/commands/design.mjs +5 -2
  264. package/cli/commands/hub.mjs +10 -1
  265. package/cli/lib/bash-guard.mjs +27 -1
  266. package/cli/lib/design-help.gen.mjs +1 -1
  267. package/cli/lib/design-hook.mjs +20 -0
  268. package/cli/lib/design-link.mjs +42 -17
  269. package/cli/lib/hub-purge.mjs +183 -0
  270. package/cli/lib/studio-locate.mjs +35 -10
  271. package/package.json +8 -8
  272. package/plugins/design/templates/_shell.html +164 -1
@@ -1,7 +1,8 @@
1
1
  // client/v2/diagnostics/sync-details/sync-details.jsx — S11.12 (06 ad-syncd): Menu › Diagnostics ›
2
2
  // Sync, rebuilt. The controls carry the v1 hooks the e2e scenarios drive (S11.12b): sync-panel (root) ·
3
3
  // sync-ai-held · sync-ai-publish · sync-ai-discard · sync-assets-cancel · sync-signin-again ·
4
- // sync-delivery-attention. Replaces the v1 Sync panel's mount in the sheet (its routes stay; SyncPanel.jsx and
4
+ // sync-delivery-attention · sync-deletes-held (+ -delete / -keep / -confirm / -cancel / -said /
5
+ // -folders / -confirming) · sync-deletes-purging · sync-hub-only. Replaces the v1 Sync panel's mount in the sheet (its routes stay; SyncPanel.jsx and
5
6
  // SourceConflictPanel.jsx keep their files). What needs the person comes first, each with its own
6
7
  // choice; the transfer, the counts and the lists follow.
7
8
  //
@@ -14,6 +15,8 @@ import { useEffect, useRef, useState } from 'react';
14
15
  import { MEDIA_STAYS_LINE, MEDIA_STAYS_NEXT } from '../../../../sync/media-gate.ts';
15
16
  import { safeDetail, syncPresentation } from '../../../../sync/presentation.ts';
16
17
  import { lineDiff } from '../../../panels/SourceConflictPanel.jsx';
18
+ import { readCodeConsent } from '../../code/code-consent.js';
19
+ import { CodeConsentSheet } from '../../code/code-consent-sheet.jsx';
17
20
  import { DELIVERY_WORD, cleanName, resolvedWords, syncDetailsModel } from './sync-details-model.js';
18
21
 
19
22
  /** Registry id → the `choice` the conflict route takes. */
@@ -155,6 +158,174 @@ function ConflictCard({ slug, canvasName, fetchImpl, onResolved, focusSeq = 0 })
155
158
  );
156
159
  }
157
160
 
161
+ /**
162
+ * fix/207 — shared code from the project's hub: the held row's "Allow shared code…" and, once it is
163
+ * allowed on this Mac, "Stop allowing shared code…". Both open the confirm sheet; the server writes
164
+ * the answer (POST /_api/sync/code-consent/set) and the next pass brings what was held.
165
+ */
166
+ export function useCodeConsent(fetchImpl, seq = 0) {
167
+ const [consent, setConsent] = useState(null);
168
+ // biome-ignore lint/correctness/useExhaustiveDependencies: re-read when the held rows change
169
+ useEffect(() => {
170
+ let live = true;
171
+ readCodeConsent(fetchImpl).then((c) => {
172
+ if (live) setConsent(c);
173
+ });
174
+ return () => {
175
+ live = false;
176
+ };
177
+ }, [seq]);
178
+ return [consent, setConsent];
179
+ }
180
+
181
+ function CodeConsentButton({ mode, host, fetchImpl, onDone }) {
182
+ const [open, setOpen] = useState(false);
183
+ const stop = mode === 'stop';
184
+ return (
185
+ <>
186
+ <button
187
+ type="button"
188
+ className="sd-link"
189
+ data-action={stop ? 'sync.stop-code' : 'sync.allow-code'}
190
+ data-testid={stop ? 'diag-sync-stop-code' : 'diag-sync-allow-code'}
191
+ onClick={() => setOpen(true)}
192
+ >
193
+ {stop ? 'Stop allowing shared code…' : 'Allow shared code…'}
194
+ </button>
195
+ {open ? (
196
+ <CodeConsentSheet
197
+ mode={mode}
198
+ host={host}
199
+ fetchImpl={fetchImpl}
200
+ onClose={() => setOpen(false)}
201
+ onDone={(c) => {
202
+ setOpen(false);
203
+ onDone?.(c);
204
+ }}
205
+ />
206
+ ) : null}
207
+ </>
208
+ );
209
+ }
210
+
211
+ const filesWord = (n) => `${n.toLocaleString('en-US')} ${n === 1 ? 'file' : 'files'}`;
212
+
213
+ /** Issue #207 (7b) — the words after an answer to held deletes (CONTRACT §3–§4: plain, no "we"). */
214
+ export function heldDeletesWords(answer) {
215
+ if (!answer?.ok) return safeDetail(answer?.detail, 'That didn’t work. Nothing was deleted.');
216
+ if (answer.how === 'keep')
217
+ return `Kept on the hub. ${filesWord(answer.count)} stay there and aren’t downloaded again.`;
218
+ if (answer.how === 'purge')
219
+ return `Deleting ${filesWord(answer.count)} on the hub. A batch this big takes a few minutes.`;
220
+ return `Deleting ${filesWord(answer.count)} on the hub.`;
221
+ }
222
+
223
+ /**
224
+ * Issue #207 (7b) — Deleted on this Mac, held: a batch of local deletes larger than sync sends unasked.
225
+ * Delete on the hub too… asks once more (the batch reaches every teammate), then sends it as one
226
+ * confirmed batch; Keep on the hub leaves the files there and never downloads them again. Both
227
+ * `POST /_api/sync/held-deletes`; the server picks the hub's door or the owner's confirmed purge.
228
+ */
229
+ function HeldDeletesCard({ need, fetchImpl }) {
230
+ const [confirming, setConfirming] = useState(false);
231
+ const [busy, setBusy] = useState(false);
232
+ const [said, setSaid] = useState('');
233
+ const [done, setDone] = useState(false);
234
+ async function answer(kind) {
235
+ setBusy(true);
236
+ setSaid('');
237
+ const r = await postJson(fetchImpl, '/_api/sync/held-deletes', { answer: kind, folder: null });
238
+ setBusy(false);
239
+ setConfirming(false);
240
+ setSaid(heldDeletesWords(r));
241
+ if (r?.ok) setDone(true);
242
+ }
243
+ const n = need.count;
244
+ return (
245
+ <div className="sd-card" data-testid="sync-deletes-held">
246
+ <strong className="sd-ct">Deleted on this Mac · {filesWord(n)}</strong>
247
+ <span className="sd-cd">{need.detail}</span>
248
+ {need.folders.length ? (
249
+ <ul className="sd-failed" data-testid="sync-deletes-held-folders">
250
+ {need.folders.map((f) => (
251
+ <li key={f.folder}>
252
+ <span className="dg-mono">{cleanName(f.folder, 'the project folder')}</span>{' '}
253
+ {filesWord(f.count)}
254
+ </li>
255
+ ))}
256
+ </ul>
257
+ ) : null}
258
+ {done ? null : confirming ? (
259
+ <div className="sd-acts" data-testid="sync-deletes-held-confirming">
260
+ <span className="sd-cd">
261
+ Move {filesWord(n)} to the hub’s trash? Each teammate confirms on their own Mac.
262
+ </span>
263
+ <button
264
+ type="button"
265
+ className="dg-btn dg-btn--primary"
266
+ data-testid="sync-deletes-held-confirm"
267
+ disabled={busy}
268
+ onClick={() => answer('delete')}
269
+ >
270
+ Move to the hub’s trash
271
+ </button>
272
+ <button
273
+ type="button"
274
+ className="dg-btn"
275
+ data-testid="sync-deletes-held-cancel"
276
+ disabled={busy}
277
+ onClick={() => setConfirming(false)}
278
+ >
279
+ Cancel
280
+ </button>
281
+ </div>
282
+ ) : (
283
+ <div className="sd-acts">
284
+ <button
285
+ type="button"
286
+ className="dg-btn"
287
+ data-action="sync.delete-held-on-hub"
288
+ data-testid="sync-deletes-held-delete"
289
+ disabled={busy}
290
+ onClick={() => setConfirming(true)}
291
+ >
292
+ Move to the hub’s trash too…
293
+ </button>
294
+ <button
295
+ type="button"
296
+ className="dg-btn"
297
+ data-action="sync.keep-held-on-hub"
298
+ data-testid="sync-deletes-held-keep"
299
+ disabled={busy}
300
+ onClick={() => answer('keep')}
301
+ >
302
+ Keep on the hub
303
+ </button>
304
+ </div>
305
+ )}
306
+ {said ? (
307
+ <p className="dg-hint" role="status" data-testid="sync-deletes-held-said">
308
+ {said}
309
+ </p>
310
+ ) : null}
311
+ </div>
312
+ );
313
+ }
314
+
315
+ /** Issue #207 (7b) — the owner's purge of held deletes: how far it is, or why it stopped. */
316
+ function DeletesPurgingCard({ need }) {
317
+ return (
318
+ <div className="sd-card" data-testid="sync-deletes-purging">
319
+ <strong className="sd-ct">
320
+ {need.error
321
+ ? 'Deleting on the hub stopped.'
322
+ : `Deleting on the hub · ${need.done.toLocaleString('en-US')} of ${filesWord(need.total)}`}
323
+ </strong>
324
+ {need.error ? <span className="sd-cd">{need.error}</span> : null}
325
+ </div>
326
+ );
327
+ }
328
+
158
329
  // The team server holds no media checkout (sync/media-gate.ts words): said once, with the next step.
159
330
  function AssetsStayCard() {
160
331
  return (
@@ -232,6 +403,97 @@ function AiCard({ need, fetchImpl }) {
232
403
  );
233
404
  }
234
405
 
406
+ /** 1 234 567 890 → "1.1 GB"; below a gigabyte, whole megabytes. */
407
+ function sizeWord(bytes) {
408
+ const mb = bytes / (1024 * 1024);
409
+ return mb >= 1024 ? `${(mb / 1024).toFixed(1)} GB` : `${Math.max(1, Math.round(mb))} MB`;
410
+ }
411
+
412
+ /**
413
+ * Issue #207 — a long run of pictures going up (a render sequence), and the folders this project
414
+ * leaves out. Never a warning: the pictures sync like every other file; leaving the folder out is
415
+ * an option, and "Sync it again" undoes it. Both write `linkedHub.ignoreFolders` through
416
+ * `/_api/sync/settings`; the next pass applies it.
417
+ */
418
+ function FoldersSection({ sequences, ignored, fetchImpl }) {
419
+ const [left, setLeft] = useState(() => new Set());
420
+ const [back, setBack] = useState(() => new Set());
421
+ const [said, setSaid] = useState('');
422
+ const change = async (body, done) => {
423
+ setSaid('');
424
+ const res = await postJson(fetchImpl, '/_api/sync/settings', body);
425
+ if (res?.ok) done();
426
+ else setSaid('That didn’t save. Nothing changed — try again.');
427
+ };
428
+ const shown = sequences.filter((s) => !ignored.includes(s.folder));
429
+ const still = ignored.filter((f) => !back.has(f));
430
+ if (!shown.length && !still.length) return null;
431
+ return (
432
+ <section aria-label="Large folders" data-testid="sync-folders">
433
+ {shown.map((s, i) => (
434
+ <div className="sd-card" key={s.folder} data-testid={`sync-large-seq-${i}`}>
435
+ <strong className="sd-ct">
436
+ {cleanName(s.folder)} · {s.files.toLocaleString()} pictures · {sizeWord(s.bytes)}
437
+ </strong>
438
+ {left.has(s.folder) ? (
439
+ <span className="sd-cd" role="status" data-testid={`sync-large-seq-left-${i}`}>
440
+ Left out from the next sync. What’s already in the project stays there.
441
+ </span>
442
+ ) : (
443
+ <>
444
+ <span className="sd-cd">
445
+ They go up like every other file, and a run this long takes a while. You can keep
446
+ this folder on this Mac only.
447
+ </span>
448
+ <div className="sd-acts">
449
+ <button
450
+ type="button"
451
+ className="dg-btn"
452
+ data-action="sync.ignore-folder"
453
+ data-testid={`sync-large-seq-ignore-${i}`}
454
+ onClick={() =>
455
+ change({ addIgnoreFolder: s.folder }, () =>
456
+ setLeft((prev) => new Set(prev).add(s.folder))
457
+ )
458
+ }
459
+ >
460
+ Don’t sync this folder
461
+ </button>
462
+ </div>
463
+ </>
464
+ )}
465
+ </div>
466
+ ))}
467
+ {still.length ? (
468
+ <div data-testid="sync-ignored-folders">
469
+ <p className="sd-sub">Not synced · {still.length}</p>
470
+ {still.map((f, i) => (
471
+ <div className="dg-row" key={f} data-testid={`sync-ignored-folder-${i}`}>
472
+ <span className="dg-k dg-mono">{cleanName(f)}</span>
473
+ <button
474
+ type="button"
475
+ className="dg-btn"
476
+ data-action="sync.sync-folder-again"
477
+ data-testid={`sync-ignored-folder-resume-${i}`}
478
+ onClick={() =>
479
+ change({ removeIgnoreFolder: f }, () => setBack((prev) => new Set(prev).add(f)))
480
+ }
481
+ >
482
+ Sync it again
483
+ </button>
484
+ </div>
485
+ ))}
486
+ </div>
487
+ ) : null}
488
+ {said ? (
489
+ <p className="dg-hint" role="alert">
490
+ {said}
491
+ </p>
492
+ ) : null}
493
+ </section>
494
+ );
495
+ }
496
+
235
497
  export default function SyncDetails({
236
498
  status,
237
499
  project,
@@ -247,6 +509,9 @@ export default function SyncDetails({
247
509
  const p = syncPresentation(status, { project });
248
510
  const m = syncDetailsModel(status, { project, cloud, native, refused: p?.phase === 'refused' });
249
511
  const [cancelled, setCancelled] = useState(false);
512
+ const codeHeld = m.lists.held.find((h) => h.kind === 'code-consent');
513
+ const [consent, setConsent] = useCodeConsent(fetchImpl, codeHeld ? codeHeld.paths.length + 1 : 0);
514
+ const canChange = consent?.changeable === true;
250
515
  return (
251
516
  <div className="sd" data-testid="sync-panel">
252
517
  <div className="dg-hd">
@@ -274,6 +539,10 @@ export default function SyncDetails({
274
539
  <AssetsFailedCard key="assets-failed" need={need} />
275
540
  ) : need.kind === 'assets-stay' ? (
276
541
  <AssetsStayCard key="assets-stay" />
542
+ ) : need.kind === 'deletes-held' ? (
543
+ <HeldDeletesCard key="deletes-held" need={need} fetchImpl={fetchImpl} />
544
+ ) : need.kind === 'deletes-purging' ? (
545
+ <DeletesPurgingCard key="deletes-purging" need={need} />
277
546
  ) : (
278
547
  <AiCard key="ai" need={need} fetchImpl={fetchImpl} />
279
548
  )
@@ -316,6 +585,12 @@ export default function SyncDetails({
316
585
  </section>
317
586
  ) : null}
318
587
 
588
+ <FoldersSection
589
+ sequences={m.lists.sequences}
590
+ ignored={m.lists.ignoredFolders}
591
+ fetchImpl={fetchImpl}
592
+ />
593
+
319
594
  {m.counts.length ? (
320
595
  <section aria-label="Counts" data-testid="diag-sync-counts">
321
596
  <p className="sd-sub">Counts</p>
@@ -334,15 +609,49 @@ export default function SyncDetails({
334
609
  </p>
335
610
  ) : null}
336
611
  {m.lists.held.map((h) => (
337
- <details className="sd-held" key={h.kind} data-testid={`diag-sync-held-${h.kind}`}>
338
- <summary>{h.detail}</summary>
612
+ <div key={h.kind}>
613
+ <details className="sd-held" data-testid={`diag-sync-held-${h.kind}`}>
614
+ <summary>{h.detail}</summary>
615
+ <ul>
616
+ {h.paths.map((rel) => (
617
+ <li key={rel}>{cleanName(rel)}</li>
618
+ ))}
619
+ </ul>
620
+ </details>
621
+ {h.kind === 'code-consent' && canChange && !consent.allowed ? (
622
+ <CodeConsentButton
623
+ mode="allow"
624
+ host={consent.host}
625
+ fetchImpl={fetchImpl}
626
+ onDone={setConsent}
627
+ />
628
+ ) : null}
629
+ </div>
630
+ ))}
631
+ {canChange && consent.allowed && consent.how !== 'cell' ? (
632
+ <p className="dg-hint" data-testid="diag-sync-code-allowed">
633
+ Shared code from {consent.host} is allowed on this Mac.{' '}
634
+ <CodeConsentButton
635
+ mode="stop"
636
+ host={consent.host}
637
+ fetchImpl={fetchImpl}
638
+ onDone={setConsent}
639
+ />
640
+ </p>
641
+ ) : null}
642
+ {m.lists.hubOnly.count ? (
643
+ <details className="sd-held" data-testid="sync-hub-only">
644
+ <summary>
645
+ On the hub only · {filesWord(m.lists.hubOnly.count)} — deleted on this Mac and kept
646
+ on the hub. They aren’t downloaded again.
647
+ </summary>
339
648
  <ul>
340
- {h.paths.map((rel) => (
649
+ {m.lists.hubOnly.paths.map((rel) => (
341
650
  <li key={rel}>{cleanName(rel)}</li>
342
651
  ))}
343
652
  </ul>
344
653
  </details>
345
- ))}
654
+ ) : null}
346
655
  {m.lists.failed > 0 || m.lists.attention.length ? (
347
656
  <div data-testid="diag-sync-failed">
348
657
  {m.lists.attention.length ? (
@@ -18,18 +18,16 @@
18
18
  // The system comes from the canvas the person has open, never from a message.
19
19
 
20
20
  import { useEffect, useRef } from 'react';
21
- import { pacedInterval } from '../../../editing/page-activity.ts';
22
- import { shellActivity } from '../shell/shell-activity.js';
23
21
  import { dispatchCanvasOp } from '../left-panel/left-panel-bus.js';
24
22
  import { menuRunner } from '../shell/menu-runner.js';
25
23
  import { nativeDoors } from '../shell/native-doors.js';
26
24
  import { onDsAdvancedRequest } from './advanced-bus.js';
27
25
  import { ADVANCED_WORDS, askAiText, checkToast, revealRel } from './advanced-model.js';
28
26
  import { setAdvanced, setAdvancedActions } from './advanced-store.js';
27
+ import { dsRefresh } from './ds-refresh.js';
29
28
  import { fetchBoard } from './token-write.js';
30
29
  import { ownSystemOf } from './truth-model.js';
31
30
 
32
- export const ADVANCED_POLL_MS = 8000;
33
31
  const JSON_HEADERS = { 'content-type': 'application/json' };
34
32
  const NO_FINDER = 'Open this project in the Mac app to work with its files.';
35
33
 
@@ -109,16 +107,9 @@ export async function revealSystem(cfg, ds, doors = nativeDoors()) {
109
107
 
110
108
  /**
111
109
  * @param {{ cfg: any, activePath: string | null, toast?: (m: string) => void,
112
- * fetchImpl?: typeof fetch, pollMs?: number }} props
110
+ * fetchImpl?: typeof fetch }} props
113
111
  */
114
- export function DsAdvancedHost({
115
- cfg,
116
- activePath,
117
- toast,
118
- project = '',
119
- fetchImpl,
120
- pollMs = ADVANCED_POLL_MS,
121
- }) {
112
+ export function DsAdvancedHost({ cfg, activePath, toast, project = '', fetchImpl }) {
122
113
  const ds = ownSystemOf(activePath, cfg);
123
114
  const live = useRef({ cfg, activePath, toast, fetchImpl, project });
124
115
  live.current = { cfg, activePath, toast, fetchImpl, project };
@@ -147,7 +138,7 @@ export function DsAdvancedHost({
147
138
  [ds]
148
139
  );
149
140
 
150
- // biome-ignore lint/correctness/useExhaustiveDependencies: `ds` and the poll rate are the triggers; the rest rides on `live`
141
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `ds` is the trigger; the rest rides on `live`
151
142
  useEffect(() => {
152
143
  if (!ds) {
153
144
  setAdvanced(null);
@@ -159,10 +150,10 @@ export function DsAdvancedHost({
159
150
  let seq = 0;
160
151
  const native = nativeDoors().available;
161
152
 
162
- const refresh = async ({ withBoard = false } = {}) => {
163
- if (typeof document !== 'undefined' && document.visibilityState === 'hidden') return;
153
+ // the board's facts are read with the files: a write or a redraw can change its name, canvases or modes
154
+ const refresh = async (fetchImpl) => {
164
155
  const n = ++seq;
165
- const got = await loadAdvanced(ds, f(), withBoard ? null : board.current);
156
+ const got = await loadAdvanced(ds, fetchImpl, null);
166
157
  if (dead || n !== seq) return;
167
158
  if (!got) {
168
159
  setAdvanced(null);
@@ -211,21 +202,15 @@ export function DsAdvancedHost({
211
202
  },
212
203
  });
213
204
 
214
- refresh({ withBoard: true });
215
- // 2.0.4: at pace while the window is used, slower while it is only looked at, not at all while hidden
216
- const stopPoll = pacedInterval(() => refresh(), pollMs, shellActivity());
217
- const onVisible = () => {
218
- if (document.visibilityState === 'visible') refresh({ withBoard: true });
219
- };
220
- document.addEventListener('visibilitychange', onVisible);
205
+ // 2.0.5: once, then on a write or a return to the window — never on a clock
206
+ const reads = dsRefresh(refresh, { fetchImpl: f });
221
207
  return () => {
222
208
  dead = true;
223
- stopPoll();
224
- document.removeEventListener('visibilitychange', onVisible);
209
+ reads.stop();
225
210
  setAdvancedActions(null);
226
211
  setAdvanced(null);
227
212
  };
228
- }, [ds, pollMs]);
213
+ }, [ds]);
229
214
 
230
215
  return null;
231
216
  }
@@ -0,0 +1,161 @@
1
+ // client/v2/ds/ds-refresh.js — 2.0.5 (#205): when the shell's design-system hosts read the server.
2
+ //
3
+ // Before, each host (make · truth · advanced · off-system) re-read on its own timer every 2.5–8 s while the
4
+ // window was looked at. On a cell that was ~50 requests a minute per open DS board, each one a closure walk
5
+ // and a system read, and the hub's studio child sat at 1.5 GB / 138 % CPU. Nothing those reads show changes
6
+ // on its own clock: it changes when someone writes, and every write the shell makes says so
7
+ // (DS_STATE_CHANGED, door-write.js), and a write the canvas sees redraws it (`dgn:'loaded'`).
8
+ //
9
+ // So a host reads:
10
+ // - once when it starts (per system),
11
+ // - when the window is looked at again (`visibilitychange` → visible),
12
+ // - when the shell wrote the system (DS_STATE_CHANGED),
13
+ // - when the open canvas has drawn again (`dgn:'loaded'` from its own frame, only with `frameFor`),
14
+ // - when one of `events` (window events the host names — e.g. `maude:ai-runs`, the AI run registry moved) fires,
15
+ // - after a failed read, again after 5 s, 10 s, 20 s … at most 5 min (one success resets it),
16
+ // - and, only with `slowMs`, on ONE slow clock — visible window only, held while the canvas is loading or
17
+ // broken. Only the "changed outside" card needs it (truth-host): a file edited outside Maude has no event; and
18
+ // the upgrade sheet while a check is running (a proof's progress has no push).
19
+ //
20
+ // `load(fetchImpl)` reads through the fetch it is given; a read that throws, or any answer that is not ok, is a
21
+ // failure. The host keeps its own sequence guard; this only decides WHEN.
22
+
23
+ import { errorCardShown } from '../code/code-bus.js';
24
+ import { DS_STATE_CHANGED } from './door-write.js';
25
+
26
+ export const DS_BACKOFF_FIRST_MS = 5_000;
27
+ export const DS_BACKOFF_CAP_MS = 5 * 60_000;
28
+ /** The one slow clock (truth-host's "changed outside" card). */
29
+ export const DS_SLOW_POLL_MS = 60_000;
30
+
31
+ /** The canvas pane is still opening, or shows a broken-canvas card: the slow clock waits. */
32
+ export function canvasPaused(doc = globalThis.document) {
33
+ if (errorCardShown()) return true;
34
+ const state = doc
35
+ ?.querySelector?.('main.viewport[data-canvas-state]')
36
+ ?.getAttribute?.('data-canvas-state');
37
+ return state === 'loading' || state === 'error';
38
+ }
39
+
40
+ /** The delay before the retry after `failures` failed reads in a row (1 → first). */
41
+ export function backoffMs(failures, first = DS_BACKOFF_FIRST_MS, cap = DS_BACKOFF_CAP_MS) {
42
+ if (failures <= 0) return 0;
43
+ return Math.min(cap, first * 2 ** (failures - 1));
44
+ }
45
+
46
+ /**
47
+ * @param {(fetchImpl: typeof fetch) => Promise<unknown>} load
48
+ * @param {{
49
+ * fetchImpl?: () => typeof fetch,
50
+ * slowMs?: number,
51
+ * events?: string[],
52
+ * skipFirst?: boolean,
53
+ * failed?: (res: Response) => boolean,
54
+ * paused?: () => boolean,
55
+ * frameFor?: () => ({ contentWindow?: unknown } | null),
56
+ * firstMs?: number,
57
+ * backoffFirstMs?: number,
58
+ * backoffCapMs?: number,
59
+ * win?: Window,
60
+ * doc?: Document,
61
+ * timers?: { set: typeof setTimeout, clear: typeof clearTimeout },
62
+ * }} [opts]
63
+ * @returns {{ now(): Promise<void>, stop(): void }}
64
+ */
65
+ export function dsRefresh(load, opts = {}) {
66
+ const win = opts.win ?? globalThis.window;
67
+ const doc = opts.doc ?? globalThis.document;
68
+ const set = opts.timers?.set ?? ((fn, ms) => setTimeout(fn, ms));
69
+ const clear = opts.timers?.clear ?? ((t) => clearTimeout(t));
70
+ const paused = opts.paused ?? (() => canvasPaused(doc));
71
+ const getFetch = opts.fetchImpl ?? (() => globalThis.fetch);
72
+ const slowMs = opts.slowMs ?? 0;
73
+ const failedRes = opts.failed ?? ((res) => !res?.ok);
74
+ const hidden = () => doc?.visibilityState === 'hidden';
75
+
76
+ let dead = false;
77
+ let failures = 0;
78
+ let timer = null;
79
+
80
+ const schedule = (ms, fn) => {
81
+ if (timer !== null) clear(timer);
82
+ timer = ms > 0 ? set(fn, ms) : null;
83
+ };
84
+ const next = () => {
85
+ if (dead) return;
86
+ if (failures > 0)
87
+ return schedule(backoffMs(failures, opts.backoffFirstMs, opts.backoffCapMs), retry);
88
+ if (slowMs > 0) return schedule(slowMs, tick);
89
+ schedule(0);
90
+ };
91
+
92
+ const now = async () => {
93
+ if (dead || hidden()) return;
94
+ let failed = false;
95
+ const base = getFetch();
96
+ const tracked = async (...args) => {
97
+ try {
98
+ const res = await base(...args);
99
+ if (failedRes(res)) failed = true;
100
+ return res;
101
+ } catch (err) {
102
+ failed = true;
103
+ throw err;
104
+ }
105
+ };
106
+ try {
107
+ await load(tracked);
108
+ } catch {
109
+ failed = true;
110
+ }
111
+ if (dead) return;
112
+ failures = failed ? failures + 1 : 0;
113
+ next();
114
+ };
115
+
116
+ // a retry waits for a looked-at window: `visibilitychange` reads at once when it is looked at again
117
+ function retry() {
118
+ timer = null;
119
+ if (!hidden()) void now();
120
+ }
121
+ function tick() {
122
+ timer = null;
123
+ if (hidden() || paused()) return next();
124
+ void now();
125
+ }
126
+
127
+ const onVisible = () => {
128
+ if (doc?.visibilityState === 'visible') void now();
129
+ };
130
+ const onChanged = () => void now();
131
+ const onMessage = (e) => {
132
+ const frame = opts.frameFor?.() ?? null;
133
+ if (!frame || e?.source !== frame.contentWindow) return;
134
+ if (e.data && typeof e.data === 'object' && e.data.dgn === 'loaded') void now();
135
+ };
136
+
137
+ doc?.addEventListener?.('visibilitychange', onVisible);
138
+ win?.addEventListener?.(DS_STATE_CHANGED, onChanged);
139
+ if (opts.frameFor) win?.addEventListener?.('message', onMessage);
140
+ for (const name of opts.events ?? []) win?.addEventListener?.(name, onChanged);
141
+
142
+ let first = null;
143
+ if (opts.skipFirst)
144
+ next(); // the host just read: wait for an event (or the slow clock)
145
+ else if (opts.firstMs && opts.firstMs > 0) first = set(() => void now(), opts.firstMs);
146
+ else void now();
147
+
148
+ return {
149
+ now,
150
+ stop() {
151
+ dead = true;
152
+ if (first !== null) clear(first);
153
+ if (timer !== null) clear(timer);
154
+ timer = null;
155
+ doc?.removeEventListener?.('visibilitychange', onVisible);
156
+ win?.removeEventListener?.(DS_STATE_CHANGED, onChanged);
157
+ if (opts.frameFor) win?.removeEventListener?.('message', onMessage);
158
+ for (const name of opts.events ?? []) win?.removeEventListener?.(name, onChanged);
159
+ },
160
+ };
161
+ }