@1agh/maude 2.0.6 → 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 (177) hide show
  1. package/apps/studio/access/closure.ts +156 -16
  2. package/apps/studio/access/filters.ts +27 -0
  3. package/apps/studio/actions/agents.ts +54 -0
  4. package/apps/studio/actions/ctx.ts +3 -0
  5. package/apps/studio/actions/defs/sync.ts +13 -0
  6. package/apps/studio/actions/defs/view.ts +59 -3
  7. package/apps/studio/actions/keymap.gen.ts +35 -0
  8. package/apps/studio/actions/menu.ts +2 -0
  9. package/apps/studio/actions/types.ts +3 -1
  10. package/apps/studio/actions.manifest.json +136 -1
  11. package/apps/studio/actions.parity.json +25 -1
  12. package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
  13. package/apps/studio/annotations/ui/ride.ts +2 -1
  14. package/apps/studio/annotations-context-toolbar.tsx +5 -4
  15. package/apps/studio/annotations-layer.tsx +4 -3
  16. package/apps/studio/api.ts +383 -128
  17. package/apps/studio/artboard-activity-overlay.tsx +4 -4
  18. package/apps/studio/artboard-ai-copies.tsx +4 -4
  19. package/apps/studio/artboard-freeze.ts +108 -0
  20. package/apps/studio/artboard-live-gate.tsx +414 -45
  21. package/apps/studio/artboard-live.ts +526 -31
  22. package/apps/studio/artboard-placeholder.ts +197 -0
  23. package/apps/studio/artboard-still-raster.ts +485 -0
  24. package/apps/studio/artboard-still-warmup.ts +221 -0
  25. package/apps/studio/artboard-still.ts +1188 -0
  26. package/apps/studio/artboard-webgl.ts +2 -1
  27. package/apps/studio/asset-placeholder.tsx +237 -132
  28. package/apps/studio/asset-upload-bars.tsx +4 -4
  29. package/apps/studio/bin/_perf-probe-open.mjs +364 -0
  30. package/apps/studio/bin/_perf-shared.mjs +12 -7
  31. package/apps/studio/bin/_pw-launch.mjs +26 -1
  32. package/apps/studio/bin/perf.sh +19 -0
  33. package/apps/studio/bridge/dgn-protocol.ts +35 -0
  34. package/apps/studio/canvas-build-sandbox.ts +69 -13
  35. package/apps/studio/canvas-camera.ts +90 -0
  36. package/apps/studio/canvas-comment-mount.tsx +9 -9
  37. package/apps/studio/canvas-lib.tsx +160 -34
  38. package/apps/studio/canvas-pages-view.tsx +465 -0
  39. package/apps/studio/canvas-pages.ts +305 -0
  40. package/apps/studio/canvas-rows.ts +62 -0
  41. package/apps/studio/canvas-shell.tsx +62 -16
  42. package/apps/studio/canvas-theme-icons.tsx +41 -0
  43. package/apps/studio/canvas-theme-pill.tsx +15 -6
  44. package/apps/studio/canvas-theme.ts +12 -11
  45. package/apps/studio/client/app.jsx +7 -0
  46. package/apps/studio/client/canvas-url.js +23 -1
  47. package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
  48. package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
  49. package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
  50. package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
  51. package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
  52. package/apps/studio/client/hooks/use-project-data.jsx +11 -2
  53. package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
  54. package/apps/studio/client/index-loader.ts +41 -21
  55. package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
  56. package/apps/studio/client/shell/viewport.jsx +32 -16
  57. package/apps/studio/client/tree/tree.jsx +17 -0
  58. package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
  59. package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
  60. package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
  61. package/apps/studio/client/v2/code/canvas-imports-card.jsx +7 -3
  62. package/apps/studio/client/v2/code/canvas-imports-words.js +16 -0
  63. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
  64. package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
  65. package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
  66. package/apps/studio/client/v2/code/code-consent.js +67 -0
  67. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
  68. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
  69. package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
  70. package/apps/studio/client/v2/layers/layers-request.js +49 -0
  71. package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
  72. package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
  73. package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
  74. package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
  75. package/apps/studio/client/v2/shell/canvas-crash-guard.js +40 -5
  76. package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
  77. package/apps/studio/client/v2/shell/floating-panels.css +37 -1
  78. package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
  79. package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
  80. package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
  81. package/apps/studio/client/v2/shell/pages-pick.js +49 -0
  82. package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
  83. package/apps/studio/client/v2/shell/share-cluster-host.jsx +3 -1
  84. package/apps/studio/client/v2/shell/shell-parity.json +8 -0
  85. package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
  86. package/apps/studio/comments-overlay.tsx +12 -11
  87. package/apps/studio/config-reload-wire.ts +4 -1
  88. package/apps/studio/config.schema.json +6 -0
  89. package/apps/studio/context.ts +37 -1
  90. package/apps/studio/dist/client.bundle.js +720 -720
  91. package/apps/studio/dist/comment-mount.js +2 -2
  92. package/apps/studio/dist/styles.css +1 -1
  93. package/apps/studio/ds/board/board.css +6 -0
  94. package/apps/studio/ds/board/ds-bar.tsx +21 -3
  95. package/apps/studio/ds/board/specimen.tsx +6 -3
  96. package/apps/studio/ds/board/template.ts +39 -19
  97. package/apps/studio/ds/cli.ts +7 -1
  98. package/apps/studio/ds/component-list.ts +2 -1
  99. package/apps/studio/ds/default.ts +6 -1
  100. package/apps/studio/ds/ds-resolver.ts +58 -8
  101. package/apps/studio/ds/engine.ts +3 -1
  102. package/apps/studio/ds/folder-systems.ts +199 -0
  103. package/apps/studio/ds/pairing-css.ts +2 -1
  104. package/apps/studio/ds/rename.ts +10 -3
  105. package/apps/studio/ds/shell-fallbacks.ts +2 -1
  106. package/apps/studio/ds/upgrade-stage.ts +6 -2
  107. package/apps/studio/editing/ai-point-ring.tsx +4 -4
  108. package/apps/studio/editing/ai-scope-outline.tsx +4 -4
  109. package/apps/studio/editing/align-bar.tsx +4 -4
  110. package/apps/studio/editing/anchor-report.ts +3 -2
  111. package/apps/studio/editing/artboard-handles.tsx +4 -4
  112. package/apps/studio/editing/corner-dots.tsx +4 -4
  113. package/apps/studio/editing/crop-mode.tsx +4 -4
  114. package/apps/studio/editing/drop-chip.tsx +4 -4
  115. package/apps/studio/editing/empty-report.ts +3 -2
  116. package/apps/studio/editing/focus-model.tsx +4 -4
  117. package/apps/studio/editing/gap-bands.tsx +3 -3
  118. package/apps/studio/editing/hold-rings.tsx +4 -4
  119. package/apps/studio/editing/lock-badge.tsx +3 -3
  120. package/apps/studio/editing/long-page.ts +23 -1
  121. package/apps/studio/editing/nudge.tsx +2 -2
  122. package/apps/studio/editing/page-activity.ts +4 -3
  123. package/apps/studio/editing/paste-bar.tsx +4 -4
  124. package/apps/studio/editing/pen/overlay.tsx +4 -3
  125. package/apps/studio/editing/place-freely.tsx +3 -3
  126. package/apps/studio/editing/reorder-slot.tsx +3 -3
  127. package/apps/studio/editing/selection.tsx +4 -4
  128. package/apps/studio/editing/size-ghost.tsx +4 -4
  129. package/apps/studio/editing/tab-order.tsx +4 -4
  130. package/apps/studio/editing/text-in-place.tsx +4 -4
  131. package/apps/studio/editing/undo-preview.tsx +3 -3
  132. package/apps/studio/equal-spacing-handles.tsx +3 -3
  133. package/apps/studio/frame-clock.ts +89 -0
  134. package/apps/studio/http.ts +66 -32
  135. package/apps/studio/index/ds-usage.ts +4 -1
  136. package/apps/studio/index-cache.ts +272 -0
  137. package/apps/studio/inspect-overlay.tsx +4 -3
  138. package/apps/studio/inspect.ts +7 -2
  139. package/apps/studio/link-chip-overlay.tsx +4 -3
  140. package/apps/studio/measure-overlay.tsx +4 -3
  141. package/apps/studio/present/pointer-dot.tsx +3 -2
  142. package/apps/studio/present/present-media.ts +6 -2
  143. package/apps/studio/present/present-stage.tsx +3 -2
  144. package/apps/studio/preview/preview-camera.tsx +3 -2
  145. package/apps/studio/routes/sync.ts +176 -0
  146. package/apps/studio/safe-zones-overlay.tsx +3 -2
  147. package/apps/studio/skip-dirs.ts +103 -47
  148. package/apps/studio/studio-page-host.ts +70 -0
  149. package/apps/studio/sync/code-module-consent.ts +86 -0
  150. package/apps/studio/sync/file-ledger.ts +24 -0
  151. package/apps/studio/sync/file-plane.ts +458 -53
  152. package/apps/studio/sync/held-deletes.ts +230 -0
  153. package/apps/studio/sync/hubs-config.ts +59 -2
  154. package/apps/studio/sync/index.ts +99 -15
  155. package/apps/studio/sync/seed-progress.ts +92 -2
  156. package/apps/studio/sync/settings.ts +36 -1
  157. package/apps/studio/sync/status.ts +15 -1
  158. package/apps/studio/sync/writer-registry.ts +5 -0
  159. package/apps/studio/text-caret.ts +5 -3
  160. package/apps/studio/toolbars/toolbar-rect.ts +3 -2
  161. package/apps/studio/use-annotation-resize.tsx +4 -3
  162. package/apps/studio/use-artboard-drag.tsx +3 -2
  163. package/apps/studio/use-element-resize.tsx +7 -6
  164. package/apps/studio/use-grid-track-handles.tsx +5 -4
  165. package/apps/studio/use-selection-set.tsx +64 -4
  166. package/apps/studio/use-spacing-handles.tsx +7 -6
  167. package/apps/studio/video-comp.tsx +55 -42
  168. package/apps/studio/video-play-overlay.tsx +4 -3
  169. package/apps/studio/whats-new.json +27 -0
  170. package/cli/commands/design.mjs +5 -2
  171. package/cli/commands/hub.mjs +10 -1
  172. package/cli/lib/bash-guard.mjs +14 -0
  173. package/cli/lib/design-help.gen.mjs +1 -1
  174. package/cli/lib/design-link.mjs +42 -17
  175. package/cli/lib/hub-purge.mjs +183 -0
  176. package/package.json +8 -8
  177. package/plugins/design/templates/_shell.html +164 -1
@@ -41,8 +41,13 @@ export interface SeedProgress {
41
41
  tracked: number;
42
42
  /** Rows in a terminal-good state. */
43
43
  delivered: number;
44
- /** `tracked - delivered - blocked - held`, floored at 0. */
44
+ /** `tracked - delivered - blocked - held - ignored`, floored at 0. */
45
45
  remaining: number;
46
+ /**
47
+ * Issue #207 — rows in a folder the project does not sync (`linkedHub.ignoreFolders`). A
48
+ * person's choice, not waiting and not a fault: their own count, outside `remaining`.
49
+ */
50
+ ignored?: number;
46
51
  /**
47
52
  * Issue #204 — rows this Mac REFUSES to take (a code module from a hub it has not vouched for).
48
53
  * Not waiting — nothing moves them but a person's consent — and not "blocked" on the hub's side
@@ -50,6 +55,16 @@ export interface SeedProgress {
50
55
  * `computeSeedProgress`; optional only so older snapshots still type.
51
56
  */
52
57
  held?: number;
58
+ /**
59
+ * fix/207 — `held` split by WHY. The status line used to say "N held: shared code not accepted"
60
+ * for both, and on Michal's desktop 6 555 render PNGs moved out of the project (held by the
61
+ * delete rule, `DELETED_HERE_HELD_REASON`) read as 6 942 files of shared code. Always set by
62
+ * `computeSeedProgress`; optional only so older snapshots still type.
63
+ */
64
+ heldCode?: number;
65
+ heldDeletedHere?: number;
66
+ /** Issue #207 (7b) — deleted on this Mac in a large batch, waiting for the person's answer. */
67
+ heldDeleteAsk?: number;
53
68
  /**
54
69
  * Outstanding rows whose last attempt FAILED and that wait out a backoff (`stuck`, `attempts`
55
70
  * ≥ 1) — counted inside `remaining` (they are not delivered), named here so a status line can say
@@ -111,6 +126,55 @@ export function isHeldByConsent(row: LedgerRow): boolean {
111
126
  );
112
127
  }
113
128
 
129
+ /**
130
+ * fix/207 — the paths THIS Mac holds because it has not allowed shared code from the hub: the rows
131
+ * behind Sync details' "Allow shared code…" (a `code-consent` held row). Sorted, so the panel's list
132
+ * is stable between passes.
133
+ */
134
+ export function codeConsentHeldPaths(rows: Readonly<Record<string, LedgerRow>>): string[] {
135
+ const out: string[] = [];
136
+ for (const [rel, row] of Object.entries(rows))
137
+ if (row.state === 'stuck' && row.reason === CODE_MODULE_HELD_REASON) out.push(rel);
138
+ return out.sort();
139
+ }
140
+
141
+ /**
142
+ * fix/207 — Sync details' sentence for that row (CONTRACT §4: what happened · what is safe · one
143
+ * verb). The verb is the row's button, Allow shared code… — the only place the answer changes in
144
+ * the app (the summary used to read "shared code not accepted on this Mac", a choice nobody could
145
+ * make there).
146
+ */
147
+ export function codeConsentHeldDetail(count: number): string {
148
+ const n = count.toLocaleString('en-US');
149
+ return count === 1
150
+ ? '1 file of shared code from this project is waiting: shared code reaches this Mac only once you allow it. Nothing is lost. Allow shared code and it arrives with the next sync.'
151
+ : `${n} files of shared code from this project are waiting: shared code reaches this Mac only once you allow it. Nothing is lost. Allow shared code and they arrive with the next sync.`;
152
+ }
153
+
154
+ /**
155
+ * fix/207 — the status line's words for what this Mac holds, one phrase per reason, so a deleted
156
+ * PNG is never "shared code" and no phrase names a choice the app does not offer.
157
+ */
158
+ export function heldWords(
159
+ p: Pick<SeedProgress, 'heldCode' | 'heldDeletedHere' | 'heldDeleteAsk'>
160
+ ): string[] {
161
+ const out: string[] = [];
162
+ const files = (n: number) => `${n.toLocaleString('en-US')} ${n === 1 ? 'file' : 'files'}`;
163
+ const code = p.heldCode ?? 0;
164
+ const deleted = p.heldDeletedHere ?? 0;
165
+ const ask = p.heldDeleteAsk ?? 0;
166
+ if (ask > 0)
167
+ out.push(
168
+ `${files(ask)} deleted on this Mac ${ask === 1 ? 'waits' : 'wait'} for your answer (Sync details)`
169
+ );
170
+ if (code > 0)
171
+ out.push(
172
+ `${files(code)} of shared code ${code === 1 ? 'waits' : 'wait'} for your yes (Sync details)`
173
+ );
174
+ if (deleted > 0) out.push(`${files(deleted)} deleted on this Mac stay deleted here`);
175
+ return out;
176
+ }
177
+
114
178
  /** States that will not move again without something changing. */
115
179
  const BLOCKED: ReadonlySet<DeliveryState> = new Set<DeliveryState>([
116
180
  'refused',
@@ -146,6 +210,10 @@ export function computeSeedProgress(input: SeedProgressInput): SeedProgress {
146
210
  let delivered = 0;
147
211
  let bytesRemaining = 0;
148
212
  let held = 0;
213
+ let heldCode = 0;
214
+ let heldDeletedHere = 0;
215
+ let heldDeleteAsk = 0;
216
+ let ignored = 0;
149
217
  let retrying = 0;
150
218
  let retryingFile: { rel: string; reason: string } | undefined;
151
219
  const blockedCounts = new Map<BlockedClass, number>();
@@ -157,8 +225,26 @@ export function computeSeedProgress(input: SeedProgressInput): SeedProgress {
157
225
  delivered += 1;
158
226
  continue;
159
227
  }
228
+ if (state === 'ignored') {
229
+ ignored += 1;
230
+ continue;
231
+ }
232
+ // Issue #207 (7b) — a delete waiting for the person's answer, and a file kept on the hub: held
233
+ // here by a choice (asked, or made), never "waiting" to move.
234
+ if (state === 'delete-held') {
235
+ held += 1;
236
+ heldDeleteAsk += 1;
237
+ continue;
238
+ }
239
+ if (state === 'hub-only') {
240
+ held += 1;
241
+ heldDeletedHere += 1;
242
+ continue;
243
+ }
160
244
  if (isHeldByConsent(row)) {
161
245
  held += 1;
246
+ if (row.reason === CODE_MODULE_HELD_REASON) heldCode += 1;
247
+ else heldDeletedHere += 1;
162
248
  continue;
163
249
  }
164
250
  if (state && BLOCKED.has(state)) {
@@ -182,7 +268,7 @@ export function computeSeedProgress(input: SeedProgressInput): SeedProgress {
182
268
  .map(([cls, count]) => ({ class: cls, count }))
183
269
  .sort((a, b) => b.count - a.count);
184
270
  const blockedTotal = blocked.reduce((n, b) => n + b.count, 0);
185
- const remaining = Math.max(0, tracked - delivered - blockedTotal - held);
271
+ const remaining = Math.max(0, tracked - delivered - blockedTotal - held - ignored);
186
272
 
187
273
  const paused =
188
274
  typeof input.pausedUntil === 'number' && Number.isFinite(input.pausedUntil)
@@ -205,6 +291,10 @@ export function computeSeedProgress(input: SeedProgressInput): SeedProgress {
205
291
  delivered,
206
292
  remaining,
207
293
  held,
294
+ heldCode,
295
+ heldDeletedHere,
296
+ ...(heldDeleteAsk > 0 ? { heldDeleteAsk } : {}),
297
+ ...(ignored > 0 ? { ignored } : {}),
208
298
  retrying,
209
299
  ...(retryingFile ? { retryingFile } : {}),
210
300
  bytesRemaining,
@@ -14,6 +14,8 @@
14
14
  import { existsSync, readFileSync } from 'node:fs';
15
15
  import { join } from 'node:path';
16
16
 
17
+ import { normalizeIgnoreFolders } from './file-plane.ts';
18
+
17
19
  export const FIRST_ANCHOR_MODES = ['ask', 'keep-local', 'keep-cloud'] as const;
18
20
  export type FirstAnchorMode = (typeof FIRST_ANCHOR_MODES)[number];
19
21
 
@@ -24,6 +26,14 @@ export interface SyncSettings {
24
26
  propagateDeletes: boolean;
25
27
  /** First-anchor resolution; 'ask' = the key is absent = hold and keep asking. */
26
28
  resolveFirstAnchor: FirstAnchorMode;
29
+ /** Issue #207 — folders this project does not sync (`linkedHub.ignoreFolders`); [] = every folder. */
30
+ ignoreFolders: string[];
31
+ }
32
+
33
+ /** Issue #207 — a change to the ignore list: one folder in or out (never a wholesale rewrite). */
34
+ export interface IgnoreFolderPatch {
35
+ addIgnoreFolder?: string;
36
+ removeIgnoreFolder?: string;
27
37
  }
28
38
 
29
39
  export function isFirstAnchorMode(v: unknown): v is FirstAnchorMode {
@@ -58,9 +68,19 @@ export function readSyncSettings(repoRoot: string): SyncSettings | null {
58
68
  syncFiles: hub.syncFiles !== false,
59
69
  propagateDeletes: hub.propagateDeletes !== false,
60
70
  resolveFirstAnchor: isFirstAnchorMode(hub.resolveFirstAnchor) ? hub.resolveFirstAnchor : 'ask',
71
+ ignoreFolders: normalizeIgnoreFolders(hub.ignoreFolders),
61
72
  };
62
73
  }
63
74
 
75
+ /**
76
+ * Issue #207 — whether deletions propagate, read NOW from the project config. The file plane calls
77
+ * this at the start of every pass, so a change in `config.json` (or in Sync settings) applies at the
78
+ * next pass. `fallback` answers when the config names no hub (a cell's pairing has no `linkedHub`).
79
+ */
80
+ export function livePropagateDeletes(repoRoot: string, fallback: boolean): boolean {
81
+ return readSyncSettings(repoRoot)?.propagateDeletes ?? fallback;
82
+ }
83
+
64
84
  /**
65
85
  * Patch ONLY the provided keys into `linkedHub`, preserving everything else.
66
86
  * Booleans are written explicitly when false and REMOVED when true (true is
@@ -71,7 +91,7 @@ export function readSyncSettings(repoRoot: string): SyncSettings | null {
71
91
  */
72
92
  export async function writeSyncSettings(
73
93
  repoRoot: string,
74
- patch: Partial<SyncSettings>
94
+ patch: Partial<Omit<SyncSettings, 'ignoreFolders'>> & IgnoreFolderPatch
75
95
  ): Promise<SyncSettings> {
76
96
  const p = configPath(repoRoot);
77
97
  if (existsSync(p)) {
@@ -103,6 +123,21 @@ export async function writeSyncSettings(
103
123
  next.resolveFirstAnchor = patch.resolveFirstAnchor;
104
124
  else throw new Error(`invalid resolveFirstAnchor: ${String(patch.resolveFirstAnchor)}`);
105
125
  }
126
+ if (patch.addIgnoreFolder !== undefined || patch.removeIgnoreFolder !== undefined) {
127
+ const list = normalizeIgnoreFolders(hub.ignoreFolders);
128
+ if (patch.addIgnoreFolder !== undefined) {
129
+ const [add] = normalizeIgnoreFolders([patch.addIgnoreFolder]);
130
+ if (!add) throw new Error(`not a folder inside the design root: ${patch.addIgnoreFolder}`);
131
+ if (!list.includes(add)) list.push(add);
132
+ }
133
+ const [drop] =
134
+ patch.removeIgnoreFolder !== undefined
135
+ ? normalizeIgnoreFolders([patch.removeIgnoreFolder])
136
+ : [];
137
+ const kept = drop ? list.filter((f) => f !== drop) : list;
138
+ // undefined, not delete: JSON.stringify drops it, so an empty list leaves no key behind.
139
+ next.ignoreFolders = kept.length > 0 ? kept : undefined;
140
+ }
106
141
  await Bun.write(p, `${JSON.stringify({ ...cfg, linkedHub: next }, null, 2)}\n`);
107
142
  const settings = readSyncSettings(repoRoot);
108
143
  if (!settings) throw new Error('settings write did not persist');
@@ -167,12 +167,18 @@ export interface FilePlaneStatus {
167
167
  | 'hub-older'
168
168
  | 'hub-refused'
169
169
  /** 2.0.5: files the legacy (v1) pull could not save here; retried later, less often. */
170
- | 'pull-failed';
170
+ | 'pull-failed'
171
+ /** fix/207: shared code this Mac holds until the person allows it (Allow shared code…). */
172
+ | 'code-consent';
171
173
  count: number;
172
174
  paths: string[];
175
+ /** Issue #207 (7b) — `delete-out`: the folders the held deletes sit in, largest first. */
176
+ folders?: { folder: string; count: number }[];
173
177
  /** One sentence, in the user's terms, about what is waiting and why. */
174
178
  detail: string;
175
179
  }[];
180
+ /** Issue #207 (7b) — the owner's purge of held deletes, while it runs (or the reason it stopped). */
181
+ deletePurge?: { total: number; done: number; running: boolean; error?: string };
176
182
  /**
177
183
  * Files this lane could NOT move on the last pass — issue #109.
178
184
  *
@@ -201,6 +207,14 @@ export interface FilePlaneStatus {
201
207
  unmeasured: number;
202
208
  byClass: Record<string, { files: number; bytes: number }>;
203
209
  };
210
+ /**
211
+ * Issue #207 — folders with a long run of pictures still going up (a render sequence). Not a
212
+ * fault: they sync like everything else. Sync details names them and offers "Don't sync this
213
+ * folder". Absent when there are none.
214
+ */
215
+ largeSequences?: { folder: string; files: number; bytes: number }[];
216
+ /** Issue #207 — the folders this project does not sync (`linkedHub.ignoreFolders`). */
217
+ ignoreFolders?: string[];
204
218
  /**
205
219
  * The hub asked us to slow down and the WHOLE LANE is paused until `until`.
206
220
  *
@@ -539,6 +539,11 @@ export const WRITER_REGISTRY: Record<string, WriterEntry> = {
539
539
  // gate-b-sec4 — Connect a committed link this Mac never made: a per-Mac record + a sync restart
540
540
  '/_api/sync/link': { class: 'read' },
541
541
  '/_api/sync/link/confirm': { class: 'local', rows: 'X16' },
542
+ // fix/207 — this Mac's shared-code consent: a per-Mac answer in the profile's hubs.json
543
+ '/_api/sync/code-consent': { class: 'read' },
544
+ '/_api/sync/code-consent/set': { class: 'local', rows: 'X16' },
545
+ // 2.0.7 #7b — the answer to held local deletes: this Mac's ledger (Keep) or the hub's own doors (Delete)
546
+ '/_api/sync/held-deletes': { class: 'local', rows: 'X16' },
542
547
  // S11.17 — Retry lands the canvas writes a full disk held; each then travels like any studio write
543
548
  '/_api/diagnostics/disk-retry': { class: 'local' },
544
549
  // p8-a1-save-hold — the closing page lands the saves held behind an AI call; each then travels like any studio write
@@ -25,6 +25,8 @@
25
25
  * while typing/moving).
26
26
  */
27
27
 
28
+ import { frameCafOn, frameRafOn } from './frame-clock.ts';
29
+
28
30
  /**
29
31
  * Place a collapsed caret inside a contentEditable at a viewport point —
30
32
  * `caretRangeFromPoint` (WebKit/Chromium), `caretPositionFromPoint`
@@ -264,13 +266,13 @@ export function mountCaret(editable: HTMLElement, win: Window): () => void {
264
266
  let raf = 0;
265
267
  const tick = (): void => {
266
268
  position();
267
- raf = win.requestAnimationFrame(tick);
269
+ raf = frameRafOn(win, tick);
268
270
  };
269
271
  position();
270
- raf = win.requestAnimationFrame(tick);
272
+ raf = frameRafOn(win, tick);
271
273
 
272
274
  return () => {
273
- win.cancelAnimationFrame(raf);
275
+ frameCafOn(win, raf);
274
276
  doc.removeEventListener('selectionchange', onUpdate);
275
277
  editable.removeEventListener('input', onUpdate);
276
278
  editable.removeEventListener('keyup', onUpdate);
@@ -8,6 +8,7 @@
8
8
  // Pure (the clock and the post are injected) so the throttle is a unit test, not a timing test.
9
9
 
10
10
  import type { CanvasModeV2 } from '../bridge/canvas-modes.ts';
11
+ import { frameCaf, frameRaf } from '../frame-clock.ts';
11
12
 
12
13
  export interface ToolbarRect {
13
14
  x: number;
@@ -53,12 +54,12 @@ export function createRectPoster(deps: RectPosterDeps): RectPoster {
53
54
  deps.raf ??
54
55
  ((fn: () => void) =>
55
56
  typeof requestAnimationFrame === 'function'
56
- ? requestAnimationFrame(fn)
57
+ ? frameRaf(fn)
57
58
  : (setTimeout(fn, 16) as unknown as number));
58
59
  const caf =
59
60
  deps.caf ??
60
61
  ((id: number) =>
61
- typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame(id) : clearTimeout(id));
62
+ typeof cancelAnimationFrame === 'function' ? frameCaf(id) : clearTimeout(id));
62
63
  let pending: number | null = null;
63
64
  let last = '';
64
65
  return {
@@ -44,6 +44,7 @@ import {
44
44
  strokeRotation,
45
45
  } from './annotations-layer.tsx';
46
46
  import { getLiveViewport, useViewportControllerContext } from './canvas-lib.tsx';
47
+ import { frameCaf, frameRaf } from './frame-clock.ts';
47
48
  import { useAnnotationSelection } from './use-annotation-selection.tsx';
48
49
 
49
50
  const RESIZE_CSS = `
@@ -691,11 +692,11 @@ export function AnnotationResizeOverlay({ store }: { store: StrokesStoreValue |
691
692
  handle.style.top = `${Math.round(sy - halfH)}px`;
692
693
  handle.dataset.corner = pos.corner;
693
694
  }
694
- rafRef.current = requestAnimationFrame(tick);
695
+ rafRef.current = frameRaf(tick);
695
696
  };
696
- rafRef.current = requestAnimationFrame(tick);
697
+ rafRef.current = frameRaf(tick);
697
698
  return () => {
698
- if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
699
+ if (rafRef.current != null) frameCaf(rafRef.current);
699
700
  };
700
701
  }, [selectedStroke, vp]);
701
702
 
@@ -35,6 +35,7 @@ import {
35
35
  useRef,
36
36
  useState,
37
37
  } from 'react';
38
+ import { frameCaf, frameRaf } from './frame-clock.ts';
38
39
 
39
40
  import { DRAG_THRESHOLD_PX as INPUT_DRAG_THRESHOLD_PX, isPageHit } from './input-router.tsx';
40
41
  import type { Selection } from './use-selection-set.tsx';
@@ -514,7 +515,7 @@ export function useArtboardDrag(opts: UseArtboardDragOptions): UseArtboardDragHa
514
515
  const frameLoop = useMemo(() => {
515
516
  const cancel = () => {
516
517
  if (rafRef.current !== null && typeof cancelAnimationFrame === 'function')
517
- cancelAnimationFrame(rafRef.current);
518
+ frameCaf(rafRef.current);
518
519
  rafRef.current = null;
519
520
  };
520
521
  const flush = () => {
@@ -527,7 +528,7 @@ export function useArtboardDrag(opts: UseArtboardDragOptions): UseArtboardDragHa
527
528
  const schedule = () => {
528
529
  if (rafRef.current !== null) return;
529
530
  if (typeof requestAnimationFrame !== 'function') flush();
530
- else rafRef.current = requestAnimationFrame(flush);
531
+ else rafRef.current = frameRaf(flush);
531
532
  };
532
533
  return { cancel, schedule };
533
534
  }, [emit]);
@@ -29,6 +29,7 @@
29
29
  import { type ReactNode, useCallback, useEffect, useRef } from 'react';
30
30
  import { globalCdOccurrence, resolveSelectionEl } from './dom-selection.ts';
31
31
  import { isElementDragActive } from './drag-state.ts';
32
+ import { frameCaf, frameRaf } from './frame-clock.ts';
32
33
  import { useSelectionSet } from './use-selection-set.tsx';
33
34
  import { useToolMode } from './use-tool-mode.tsx';
34
35
 
@@ -451,20 +452,20 @@ export function ElementResizeOverlay(): ReactNode {
451
452
  // doesn't compound the jank ("hrozně zavaší ten toolbar").
452
453
  if (isElementDragActive()) {
453
454
  hideAll();
454
- rafRef.current = requestAnimationFrame(tick);
455
+ rafRef.current = frameRaf(tick);
455
456
  return;
456
457
  }
457
458
  const el = resolveSelectionEl(document, one) as HTMLElement | null;
458
459
  // Skip inline text runs where width/height are meaningless (no explicit box).
459
460
  if (!el) {
460
461
  hideAll();
461
- rafRef.current = requestAnimationFrame(tick);
462
+ rafRef.current = frameRaf(tick);
462
463
  return;
463
464
  }
464
465
  const r = el.getBoundingClientRect();
465
466
  if (r.width <= 0 && r.height <= 0) {
466
467
  hideAll();
467
- rafRef.current = requestAnimationFrame(tick);
468
+ rafRef.current = frameRaf(tick);
468
469
  return;
469
470
  }
470
471
  // Stage D4 — an artboard gets growth-only handles (E/S/SE) and NO rotate
@@ -554,11 +555,11 @@ export function ElementResizeOverlay(): ReactNode {
554
555
  readout.style.opacity = '0';
555
556
  }
556
557
 
557
- rafRef.current = requestAnimationFrame(tick);
558
+ rafRef.current = frameRaf(tick);
558
559
  };
559
- rafRef.current = requestAnimationFrame(tick);
560
+ rafRef.current = frameRaf(tick);
560
561
  return () => {
561
- if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
562
+ if (rafRef.current != null) frameCaf(rafRef.current);
562
563
  };
563
564
  }, [active, one, artboardOnly]);
564
565
 
@@ -27,6 +27,7 @@
27
27
  import { type ReactNode, useCallback, useEffect, useRef } from 'react';
28
28
  import { globalCdOccurrence, resolveSelectionEl } from './dom-selection.ts';
29
29
  import { isElementDragActive } from './drag-state.ts';
30
+ import { frameCaf, frameRaf } from './frame-clock.ts';
30
31
  import {
31
32
  computeGutterLines,
32
33
  computeTrackDrag,
@@ -150,7 +151,7 @@ export function GridTrackHandlesOverlay(): ReactNode {
150
151
  const tick = () => {
151
152
  rafRef.current = null;
152
153
  const reschedule = () => {
153
- rafRef.current = requestAnimationFrame(tick);
154
+ rafRef.current = frameRaf(tick);
154
155
  };
155
156
  const bail = () => {
156
157
  hideAll();
@@ -226,11 +227,11 @@ export function GridTrackHandlesOverlay(): ReactNode {
226
227
  i++;
227
228
  }
228
229
  }
229
- rafRef.current = requestAnimationFrame(tick);
230
+ rafRef.current = frameRaf(tick);
230
231
  };
231
- rafRef.current = requestAnimationFrame(tick);
232
+ rafRef.current = frameRaf(tick);
232
233
  return () => {
233
- if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
234
+ if (rafRef.current != null) frameCaf(rafRef.current);
234
235
  };
235
236
  }, [active, one]);
236
237
 
@@ -137,6 +137,14 @@ interface SelectionSetValue {
137
137
  */
138
138
  replaceFromShell: (s: Selection | Selection[]) => boolean;
139
139
  addFromShell: (s: Selection | Selection[]) => boolean;
140
+ /** The selection as of the last change — `selected` lags a render (read it in a store listener). */
141
+ peek: () => Selection[];
142
+ /**
143
+ * 2.0.7 (decision `v2-207-pages-stale-selection`) — keep only what `keep` passes (Pages turned away from the
144
+ * artboard the rest was on). Not a pick: a pick from the shell right after still lands; only a replay of exactly
145
+ * what was dropped (a restore rung queued before the shell heard) yields, for RESTORE_YIELD_MS.
146
+ */
147
+ drop: (keep: (s: Selection) => boolean) => void;
140
148
  }
141
149
 
142
150
  const SelectionSetContext = createContext<SelectionSetValue | null>(null);
@@ -188,6 +196,21 @@ export function yieldsToLocalPick(
188
196
  return now - localAt < RESTORE_YIELD_MS && !sameKeys(next, current);
189
197
  }
190
198
 
199
+ /**
200
+ * 2.0.7 — a selection the shell sends that only brings back what a page turn just dropped (every item was among the
201
+ * dropped, `RESTORE_YIELD_MS` ago or less) is a restore rung queued before the shell heard → it yields. Anything
202
+ * else — a Layers pick of another layer, of the artboard itself — lands at once.
203
+ */
204
+ export function replaysDroppedSelection(
205
+ dropped: { at: number; sel: Selection[] },
206
+ incoming: Selection[],
207
+ now = Date.now()
208
+ ): boolean {
209
+ if (now - dropped.at >= RESTORE_YIELD_MS || incoming.length === 0) return false;
210
+ const gone = new Set(dropped.sel.map(selectionKey));
211
+ return incoming.every((s) => gone.has(selectionKey(s)));
212
+ }
213
+
191
214
  /**
192
215
  * S2.1 (S2-edit-ops.md §7) — `editing/selection.tsx` adds `refs` / `crumbs` / `kind` to every
193
216
  * `select-set` post. A registry (not an import) so this leaf provider never imports the editing
@@ -219,6 +242,11 @@ export function SelectionSetProvider({
219
242
  // the selection as of the last change (state lags a render) and when the canvas itself last changed it
220
243
  const currentRef = useRef<Selection[]>([]);
221
244
  const localAtRef = useRef(Number.NEGATIVE_INFINITY);
245
+ // what `drop` took away last, and when (a replay of it inside the yield window is a stale restore)
246
+ const droppedRef = useRef<{ at: number; sel: Selection[] }>({
247
+ at: Number.NEGATIVE_INFINITY,
248
+ sel: [],
249
+ });
222
250
  const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
223
251
  const pendingPostRef = useRef<(() => void) | null>(null);
224
252
 
@@ -275,23 +303,44 @@ export function SelectionSetProvider({
275
303
  [apply]
276
304
  );
277
305
 
306
+ const replaysDropped = useCallback(
307
+ (incoming: Selection[]) => replaysDroppedSelection(droppedRef.current, incoming),
308
+ []
309
+ );
310
+
278
311
  const replaceFromShell = useCallback(
279
312
  (s: Selection | Selection[]) => {
280
313
  const next = dedupe(Array.isArray(s) ? s : [s]);
281
314
  if (yieldsToLocalPick(localAtRef.current, currentRef.current, next)) return false;
315
+ if (replaysDropped(next)) return false;
282
316
  apply(next);
283
317
  return true;
284
318
  },
285
- [apply]
319
+ [apply, replaysDropped]
286
320
  );
287
321
 
288
322
  const addFromShell = useCallback(
289
323
  (s: Selection | Selection[]) => {
290
- const next = dedupe([...currentRef.current, ...(Array.isArray(s) ? s : [s])]);
324
+ const incoming = Array.isArray(s) ? s : [s];
325
+ const next = dedupe([...currentRef.current, ...incoming]);
291
326
  if (yieldsToLocalPick(localAtRef.current, currentRef.current, next)) return false;
327
+ if (replaysDropped(incoming)) return false;
292
328
  apply(next);
293
329
  return true;
294
330
  },
331
+ [apply, replaysDropped]
332
+ );
333
+
334
+ const peek = useCallback(() => currentRef.current, []);
335
+
336
+ const drop = useCallback(
337
+ (keep: (s: Selection) => boolean) => {
338
+ const cur = currentRef.current;
339
+ const next = cur.filter(keep);
340
+ if (next.length === cur.length) return;
341
+ droppedRef.current = { at: Date.now(), sel: cur.filter((s) => !keep(s)) };
342
+ apply(next);
343
+ },
295
344
  [apply]
296
345
  );
297
346
 
@@ -345,8 +394,19 @@ export function SelectionSetProvider({
345
394
  }, [apply]);
346
395
 
347
396
  const value = useMemo<SelectionSetValue>(
348
- () => ({ selected, replace, add, remove, toggle, clear, replaceFromShell, addFromShell }),
349
- [selected, replace, add, remove, toggle, clear, replaceFromShell, addFromShell]
397
+ () => ({
398
+ selected,
399
+ replace,
400
+ add,
401
+ remove,
402
+ toggle,
403
+ clear,
404
+ replaceFromShell,
405
+ addFromShell,
406
+ peek,
407
+ drop,
408
+ }),
409
+ [selected, replace, add, remove, toggle, clear, replaceFromShell, addFromShell, peek, drop]
350
410
  );
351
411
 
352
412
  return <SelectionSetContext.Provider value={value}>{children}</SelectionSetContext.Provider>;
@@ -28,6 +28,7 @@ import {
28
28
  spaceTokenFor,
29
29
  tokenRuler,
30
30
  } from './editing/token-ruler.tsx';
31
+ import { frameCaf, frameRaf } from './frame-clock.ts';
31
32
  import {
32
33
  computeGapDrag,
33
34
  computeGapMidpoints,
@@ -179,19 +180,19 @@ export function SpacingHandlesOverlay(): ReactNode {
179
180
  // irrelevant mid-drag anyway — the drag has its own live-preview chrome).
180
181
  if (isElementDragActive()) {
181
182
  hideAll();
182
- rafRef.current = requestAnimationFrame(tick);
183
+ rafRef.current = frameRaf(tick);
183
184
  return;
184
185
  }
185
186
  const el = resolveSelectionEl(document, one) as HTMLElement | null;
186
187
  if (!el) {
187
188
  hideAll();
188
- rafRef.current = requestAnimationFrame(tick);
189
+ rafRef.current = frameRaf(tick);
189
190
  return;
190
191
  }
191
192
  const r = el.getBoundingClientRect();
192
193
  if (r.width <= 0 && r.height <= 0) {
193
194
  hideAll();
194
- rafRef.current = requestAnimationFrame(tick);
195
+ rafRef.current = frameRaf(tick);
195
196
  return;
196
197
  }
197
198
  const cs = getComputedStyle(el);
@@ -249,11 +250,11 @@ export function SpacingHandlesOverlay(): ReactNode {
249
250
  h.style.top = `${Math.round(pt.y)}px`;
250
251
  i++;
251
252
  }
252
- rafRef.current = requestAnimationFrame(tick);
253
+ rafRef.current = frameRaf(tick);
253
254
  };
254
- rafRef.current = requestAnimationFrame(tick);
255
+ rafRef.current = frameRaf(tick);
255
256
  return () => {
256
- if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
257
+ if (rafRef.current != null) frameCaf(rafRef.current);
257
258
  };
258
259
  }, [active, one]);
259
260