@1agh/maude 2.0.4 → 2.0.6

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 (129) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/filters.ts +12 -5
  3. package/apps/studio/access/known-canvases.ts +24 -1
  4. package/apps/studio/access/refused-inputs.ts +89 -0
  5. package/apps/studio/actions/agents.ts +5 -0
  6. package/apps/studio/actions/defs/app.ts +12 -0
  7. package/apps/studio/actions.manifest.json +13 -1
  8. package/apps/studio/actions.parity.json +7 -1
  9. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  10. package/apps/studio/annotations/ui/lod.tsx +1 -1
  11. package/apps/studio/annotations/ui/text-style.ts +1 -1
  12. package/apps/studio/annotations-layer.tsx +0 -12
  13. package/apps/studio/api.ts +42 -0
  14. package/apps/studio/artboard-live-gate.tsx +267 -0
  15. package/apps/studio/artboard-live.ts +336 -0
  16. package/apps/studio/artboard-webgl.ts +668 -0
  17. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  18. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  19. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  20. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  21. package/apps/studio/bin/_ds-check.mjs +4 -1
  22. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  23. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  24. package/apps/studio/bin/_import-asset.mjs +2 -1
  25. package/apps/studio/bin/_perf-probe.mjs +2 -1
  26. package/apps/studio/bin/_studio-verb.mjs +24 -3
  27. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  28. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  29. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  30. package/apps/studio/bin/ds-check.sh +5 -1
  31. package/apps/studio/bin/perf.sh +11 -1
  32. package/apps/studio/bin/server-up.sh +7 -2
  33. package/apps/studio/bin/smoke.sh +19 -0
  34. package/apps/studio/canvas-lib.tsx +131 -12
  35. package/apps/studio/client/canvas-url.js +13 -0
  36. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  37. package/apps/studio/client/home/Shelves.jsx +4 -3
  38. package/apps/studio/client/home/home-accounts-model.js +121 -0
  39. package/apps/studio/client/home/home-api.js +6 -0
  40. package/apps/studio/client/home/home-app.jsx +141 -40
  41. package/apps/studio/client/home/home-model.js +172 -6
  42. package/apps/studio/client/home/home.css +169 -5
  43. package/apps/studio/client/home/shell-mode.js +8 -1
  44. package/apps/studio/client/hooks/use-project-data.jsx +2 -0
  45. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  46. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  47. package/apps/studio/client/panels/caps-cache.js +46 -0
  48. package/apps/studio/client/shell/viewport.jsx +36 -8
  49. package/apps/studio/client/v2/access/access-client.js +2 -0
  50. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  51. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  52. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  53. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  54. package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
  55. package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
  56. package/apps/studio/client/v2/code/code-bus.js +5 -0
  57. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  58. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  59. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  60. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  61. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  62. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  63. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  64. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  65. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  66. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  67. package/apps/studio/client/v2/history/git-model.js +3 -1
  68. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  69. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  70. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  71. package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
  72. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  73. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  74. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  75. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  76. package/apps/studio/client/v2/shell/share-cluster-host.jsx +137 -10
  77. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  78. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  79. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  80. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  81. package/apps/studio/client/v2/shell/use-account.js +8 -1
  82. package/apps/studio/collab/persistence.ts +9 -1
  83. package/apps/studio/collab/registry.ts +32 -0
  84. package/apps/studio/collab/room.ts +8 -0
  85. package/apps/studio/config-reload-wire.ts +53 -0
  86. package/apps/studio/dist/client.bundle.js +1232 -1232
  87. package/apps/studio/dist/styles.css +1 -1
  88. package/apps/studio/ds/board/specimen.tsx +12 -1
  89. package/apps/studio/ds/canvas-cli.ts +58 -2
  90. package/apps/studio/ds/check.ts +26 -1
  91. package/apps/studio/ds/cli.ts +7 -3
  92. package/apps/studio/ds/convert.ts +34 -6
  93. package/apps/studio/ds/ds-verb.ts +13 -0
  94. package/apps/studio/ds/post-build.ts +38 -0
  95. package/apps/studio/ds/upgrade-apply.ts +27 -5
  96. package/apps/studio/ds/upgrade-cli.ts +22 -2
  97. package/apps/studio/ds/upgrade-prove.ts +198 -15
  98. package/apps/studio/ds/upgrade-stage.ts +4 -1
  99. package/apps/studio/history/trash.ts +6 -0
  100. package/apps/studio/home/accounts.ts +87 -0
  101. package/apps/studio/home/index-reader.ts +24 -2
  102. package/apps/studio/home/routes.ts +19 -0
  103. package/apps/studio/http.ts +14 -2
  104. package/apps/studio/routes/ds-convert.ts +18 -0
  105. package/apps/studio/routes/trash.ts +16 -1
  106. package/apps/studio/server.ts +8 -10
  107. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  108. package/apps/studio/sync/asset-push.ts +146 -23
  109. package/apps/studio/sync/asset-state.ts +3 -2
  110. package/apps/studio/sync/file-membership.ts +28 -3
  111. package/apps/studio/sync/file-plane.ts +40 -9
  112. package/apps/studio/sync/file-pull.ts +304 -33
  113. package/apps/studio/sync/hub-link.ts +1 -2
  114. package/apps/studio/sync/index.ts +308 -150
  115. package/apps/studio/sync/journal-client.ts +94 -5
  116. package/apps/studio/sync/pending-deletes.ts +100 -0
  117. package/apps/studio/sync/projection.ts +77 -12
  118. package/apps/studio/sync/seed-progress.ts +12 -1
  119. package/apps/studio/sync/status.ts +3 -1
  120. package/apps/studio/thumbs/service.ts +12 -2
  121. package/apps/studio/thumbs/validate.ts +7 -0
  122. package/apps/studio/ui-prefs-migrate.ts +4 -0
  123. package/apps/studio/video-comp.tsx +23 -0
  124. package/apps/studio/whats-new.json +72 -0
  125. package/cli/lib/bash-guard.mjs +13 -1
  126. package/cli/lib/design-help.gen.mjs +1 -1
  127. package/cli/lib/design-hook.mjs +20 -0
  128. package/cli/lib/studio-locate.mjs +35 -10
  129. package/package.json +8 -8
@@ -249,33 +249,111 @@ export async function hubHealth(opts: {
249
249
  hubUrl: string;
250
250
  fetchImpl?: typeof fetch;
251
251
  signal?: AbortSignal;
252
- }): Promise<{ capabilities: string[] | null; formatVersion: number | null }> {
252
+ /** Override the 4 s ceiling (the lane probe asks with a longer one). */
253
+ timeoutMs?: number;
254
+ }): Promise<{
255
+ capabilities: string[] | null;
256
+ formatVersion: number | null;
257
+ /**
258
+ * Did the HUB answer (2.0.5)? False for a timeout, a network error, a 5xx, a
259
+ * 429 or an unreadable body — none of which says anything about what the hub
260
+ * can do. `capabilities: null` with `answered: true` is a real answer: a hub
261
+ * that predates capabilities.
262
+ */
263
+ answered: boolean;
264
+ }> {
253
265
  const fetchImpl = opts.fetchImpl ?? fetch;
254
266
  const base = opts.hubUrl.replace(/\/+$/, '');
255
267
  try {
256
- const timeout = AbortSignal.timeout(HEALTH_TIMEOUT_MS);
268
+ const timeout = AbortSignal.timeout(opts.timeoutMs ?? HEALTH_TIMEOUT_MS);
257
269
  const res = await fetchImpl(`${base}/health`, {
258
270
  // a hub answers its own /health: a redirect is never followed (gate-b-sec1 A5 — a bounce to an internal
259
271
  // http address from a cell). The other sync requests do not follow one either (`redirect: 'manual'`).
260
272
  redirect: 'error',
261
273
  signal: opts.signal ? AbortSignal.any([opts.signal, timeout]) : timeout,
262
274
  });
263
- if (!res.ok) return { capabilities: null, formatVersion: null };
275
+ if (!res.ok) {
276
+ // A hub without the route (404) has answered: it has no capabilities. A
277
+ // server error or a rate limit has not.
278
+ const answered = res.status < 500 && res.status !== 429 && res.status !== 408;
279
+ return { capabilities: null, formatVersion: null, answered };
280
+ }
264
281
  const body = (await res.json()) as { capabilities?: unknown; formatVersion?: unknown };
265
282
  const fv = body?.formatVersion;
266
283
  const formatVersion = typeof fv === 'number' && Number.isSafeInteger(fv) && fv >= 1 ? fv : null;
267
- if (!Array.isArray(body?.capabilities)) return { capabilities: null, formatVersion };
284
+ if (!Array.isArray(body?.capabilities))
285
+ return { capabilities: null, formatVersion, answered: true };
268
286
  return {
269
287
  capabilities: body.capabilities
270
288
  .filter((c): c is string => typeof c === 'string')
271
289
  .slice(0, 32),
272
290
  formatVersion,
291
+ answered: true,
273
292
  };
274
293
  } catch {
275
- return { capabilities: null, formatVersion: null };
294
+ return { capabilities: null, formatVersion: null, answered: false };
276
295
  }
277
296
  }
278
297
 
298
+ /** The lane probe's patience: a longer ceiling than the 4 s boot probe. */
299
+ const LANE_PROBE_TIMEOUT_MS = 10_000;
300
+ /** Waits between attempts — a cold cell or a busy hub gets a moment. */
301
+ const LANE_PROBE_BACKOFF_MS = [2_000, 5_000] as const;
302
+
303
+ /**
304
+ * Which file lane this hub needs, decided only from an ANSWER (2.0.5).
305
+ *
306
+ * The boot used to ask `/health` once with a 4 s ceiling and read a timeout as
307
+ * "no journal here" — so a hub that was merely slow sent a 2.0 desktop down the
308
+ * legacy v1 lane on a ledger hub for the whole boot: no ledger, no held
309
+ * states, files the person had deleted pulled back, and (with the poll's
310
+ * overlapping passes) a core pinned at 2–4 GB. Now: up to `attempts` tries
311
+ * with a backoff and a longer ceiling; `legacy` only from a hub that answered
312
+ * without `ledger`; `unknown` when it never answered — the caller asks again
313
+ * later and runs no file lane meanwhile.
314
+ */
315
+ export async function probeFileLane(opts: {
316
+ hubUrl: string;
317
+ fetchImpl?: typeof fetch;
318
+ signal?: AbortSignal;
319
+ attempts?: number;
320
+ timeoutMs?: number;
321
+ backoffMs?: readonly number[];
322
+ sleep?: (ms: number) => Promise<void>;
323
+ }): Promise<{
324
+ lane: 'plane' | 'legacy' | 'unknown';
325
+ capabilities: string[] | null;
326
+ formatVersion: number | null;
327
+ }> {
328
+ const attempts = Math.max(1, opts.attempts ?? 3);
329
+ const backoff = opts.backoffMs ?? LANE_PROBE_BACKOFF_MS;
330
+ const sleep =
331
+ opts.sleep ??
332
+ ((ms: number) =>
333
+ new Promise<void>((r) => {
334
+ const t = setTimeout(r, ms);
335
+ (t as { unref?: () => void }).unref?.();
336
+ }));
337
+ for (let i = 0; i < attempts; i++) {
338
+ if (opts.signal?.aborted) break;
339
+ const h = await hubHealth({
340
+ hubUrl: opts.hubUrl,
341
+ ...(opts.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
342
+ ...(opts.signal ? { signal: opts.signal } : {}),
343
+ timeoutMs: opts.timeoutMs ?? LANE_PROBE_TIMEOUT_MS,
344
+ });
345
+ if (h.answered) {
346
+ return {
347
+ lane: hasLedger(h.capabilities) ? 'plane' : 'legacy',
348
+ capabilities: h.capabilities,
349
+ formatVersion: h.formatVersion,
350
+ };
351
+ }
352
+ if (i < attempts - 1) await sleep(backoff[Math.min(i, backoff.length - 1)] ?? 5_000);
353
+ }
354
+ return { lane: 'unknown', capabilities: null, formatVersion: null };
355
+ }
356
+
279
357
  /** Does this hub keep annotations as the v2 element model (DDR-242)? */
280
358
  export function hasAnnotationsV2(capabilities: string[] | null): boolean {
281
359
  return Array.isArray(capabilities) && capabilities.includes('annotations-v2');
@@ -297,3 +375,14 @@ export const FILE_CLASSES_V2_CAPABILITY = 'file-classes-v2';
297
375
  export function hasFileClassesV2(capabilities: string[] | null): boolean {
298
376
  return Array.isArray(capabilities) && capabilities.includes(FILE_CLASSES_V2_CAPABILITY);
299
377
  }
378
+
379
+ /** The capability a hub advertises when its doors take paths up to 32 segments deep (fix/205). */
380
+ export const FILE_DEPTH_V2_CAPABILITY = 'file-depth-v2';
381
+
382
+ /**
383
+ * Does this hub take paths deeper than 8 segments? Every hub before fix/205 answers them
384
+ * `400 invalid path`, so the desktop holds them for it with a reason (`olderDoorRefusesDepth`).
385
+ */
386
+ export function hasFileDepthV2(capabilities: string[] | null): boolean {
387
+ return Array.isArray(capabilities) && capabilities.includes(FILE_DEPTH_V2_CAPABILITY);
388
+ }
@@ -0,0 +1,100 @@
1
+ // sync/pending-deletes.ts — fix/ds-convert-hooks-cli #7: a deletion made while no studio runs.
2
+ //
3
+ // "This canvas is gone" travels only on the `canvas-deleted` bus event (sync/index.ts `noteToHub`):
4
+ // a file missing from disk is "this machine stopped carrying it", never a deletion. A verb that
5
+ // runs IN-PROCESS because no studio answers (`maude design ds convert <ds> --restore`,
6
+ // ds/ds-verb.ts) has no bus — so its deletion went nowhere, and the next boot's pull brought the
7
+ // hub's copy straight back (and with it, on the next convert, `ds-convert-exists`).
8
+ //
9
+ // So the in-process run writes the deletion down here, and the next sync boot (1) keeps the boot
10
+ // pull from fetching those canvases and (2) emits `canvas-deleted` for each one whose file is
11
+ // still absent — the same signal the routes send, so the hub hears it exactly as it would have.
12
+ // A canvas whose file is back by then (re-created offline) is not a deletion any more: dropped.
13
+ //
14
+ // `<designRoot>/_state/pending-deletes.json` — `_state/` is per-machine runtime state in every
15
+ // DDR-115 list, so this never syncs, never commits, and a clone never carries one.
16
+
17
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
18
+ import path from 'node:path';
19
+
20
+ const FILE = ['_state', 'pending-deletes.json'] as const;
21
+ const MAX = 256;
22
+ const SLUG_RE = /^[a-z0-9][a-z0-9._-]{0,199}$/;
23
+
24
+ export interface PendingDelete {
25
+ slug: string;
26
+ /** The canvas file, design-root-relative, POSIX — checked for absence at boot. */
27
+ rel: string;
28
+ at: number;
29
+ }
30
+
31
+ const fileOf = (designRoot: string) => path.join(designRoot, ...FILE);
32
+
33
+ function safeRel(rel: unknown): rel is string {
34
+ return (
35
+ typeof rel === 'string' &&
36
+ rel.length > 0 &&
37
+ rel.length <= 1024 &&
38
+ !rel.startsWith('/') &&
39
+ !rel.split('/').some((s) => s === '..' || s === '' || s.startsWith('_'))
40
+ );
41
+ }
42
+
43
+ /** The recorded deletions; `[]` for none, a missing file or anything malformed. */
44
+ export function readPendingDeletes(designRoot: string): PendingDelete[] {
45
+ let doc: unknown;
46
+ try {
47
+ doc = JSON.parse(readFileSync(fileOf(designRoot), 'utf8'));
48
+ } catch {
49
+ return [];
50
+ }
51
+ const list = (doc as { v?: unknown; deletes?: unknown })?.deletes;
52
+ if ((doc as { v?: unknown })?.v !== 1 || !Array.isArray(list)) return [];
53
+ return list
54
+ .filter(
55
+ (d): d is PendingDelete =>
56
+ !!d &&
57
+ typeof d.slug === 'string' &&
58
+ SLUG_RE.test(d.slug) &&
59
+ safeRel(d.rel) &&
60
+ typeof d.at === 'number'
61
+ )
62
+ .slice(0, MAX);
63
+ }
64
+
65
+ /** Write one deletion down (deduplicated by slug, newest kept). Best-effort, never throws. */
66
+ export function recordPendingDelete(
67
+ designRoot: string,
68
+ d: { slug: string; rel: string },
69
+ now = Date.now()
70
+ ): boolean {
71
+ if (!SLUG_RE.test(d.slug) || !safeRel(d.rel)) return false;
72
+ try {
73
+ const next = [
74
+ ...readPendingDeletes(designRoot).filter((x) => x.slug !== d.slug),
75
+ { slug: d.slug, rel: d.rel, at: now },
76
+ ].slice(-MAX);
77
+ const abs = fileOf(designRoot);
78
+ mkdirSync(path.dirname(abs), { recursive: true });
79
+ const tmp = `${abs}.${process.pid}.tmp`;
80
+ writeFileSync(tmp, `${JSON.stringify({ v: 1, deletes: next })}\n`, { mode: 0o600 });
81
+ renameSync(tmp, abs);
82
+ return true;
83
+ } catch {
84
+ return false;
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Boot: take the recorded deletions. Returns the ones still deletions (their file is absent) and
90
+ * clears the record — what it held is either told now or no longer true.
91
+ */
92
+ export function takePendingDeletes(designRoot: string): PendingDelete[] {
93
+ const all = readPendingDeletes(designRoot);
94
+ try {
95
+ rmSync(fileOf(designRoot), { force: true });
96
+ } catch {
97
+ /* a record we cannot clear is told again next boot — the hub's delete is idempotent */
98
+ }
99
+ return all.filter((d) => !existsSync(path.join(designRoot, ...d.rel.split('/'))));
100
+ }
@@ -281,6 +281,12 @@ export interface DocProjection {
281
281
  * while this replica still shows the value before it.
282
282
  */
283
283
  adoptOwnAccepted(value: string): void;
284
+ /**
285
+ * #14 (2.0.5) — the css twin's `adoptOwnAccepted`: `value` is this disk's own css proposal a
286
+ * previous run left unanswered, which the outbox drain just had accepted. It is the css base
287
+ * (persisted), and the replica's older css is never written over it while its publication comes.
288
+ */
289
+ adoptOwnAcceptedCss(value: string): void;
284
290
  /**
285
291
  * Accepted-revisions mode: propose one lane value that did not come through
286
292
  * the watcher (a comment/annotation API write). Resolves with the outcome;
@@ -345,6 +351,11 @@ export interface DocProjection {
345
351
  * recovery slots. Returns false when nothing is held.
346
352
  */
347
353
  takeAccepted(): boolean;
354
+ /**
355
+ * #14 (2.0.5) — the css twin's held conflict, when its lane holds one: this disk's css and the
356
+ * project's. Keep mine proposes `mine` on top of `theirs`; `takeAccepted` takes `theirs`.
357
+ */
358
+ heldCss(): { mine: string | null; theirs: string } | null;
348
359
  /** T28 — current sides plus the first candidate and proven base (null when unknown). */
349
360
  conflictSides(): {
350
361
  mine: string | null;
@@ -416,6 +427,9 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
416
427
  });
417
428
  return;
418
429
  }
430
+ // #14 — the canvas's conflict is also its css twin's: an accepted html save is no answer to
431
+ // a held css, so the notice (and its dedupe key) stays until that lane is resolved too.
432
+ if (held.has('css') || pending.has('css')) return;
419
433
  if (rejectedKey !== null) opts.onRecovered?.();
420
434
  rejectedKey = null;
421
435
  }
@@ -437,6 +451,21 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
437
451
  }
438
452
  }
439
453
 
454
+ /**
455
+ * #14 — the css twin's agreed value, persisted like the body's (journal hash + recovery slot): a
456
+ * cold start judges a css edited while the studio was closed against it. Only ever a value the
457
+ * project accepted or wrote here — never a hold's base.
458
+ */
459
+ function rememberCssBase(css: string): void {
460
+ opts.journal?.record(slug, { cssHash: hashBytes(css) }); // DDR-102 checkpoint
461
+ if (!opts.historyDir || !paths.css) return;
462
+ try {
463
+ saveRecoveryBody(opts.historyDir, paths.css, 'base', css);
464
+ } catch {
465
+ /* the journal hash still covers the common case */
466
+ }
467
+ }
468
+
440
469
  function preserveLocal(body: string | null): void {
441
470
  if (opts.historyDir && body?.trim()) {
442
471
  // An invalid local draft can still contain authored work. Keep its raw
@@ -669,20 +698,19 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
669
698
  next = repeated.unit;
670
699
  }
671
700
  }
701
+ if (acceptedOwnCss !== null) {
702
+ // #14 — our own accepted css whose publication has not reached this replica: the replica's
703
+ // older css is never written over it. Once the replica moves (to it, or past it), it is over.
704
+ if (next === lastCss) return;
705
+ acceptedOwnCss = null;
706
+ }
672
707
  if (next === lastCss) return;
673
708
  lastCss = next;
674
709
  if (next === null) return; // doc carries no css yet — nothing to write
675
710
  if (!withinCap(paths.css, next, MAX_CSS_BYTES)) return;
676
711
  recordEcho(paths.css, next);
677
712
  writeAndAnnounce(paths.css, next);
678
- opts.journal?.record(slug, { cssHash: hashBytes(next) }); // DDR-102 checkpoint
679
- if (opts.historyDir) {
680
- try {
681
- saveRecoveryBody(opts.historyDir, paths.css, 'base', next);
682
- } catch {
683
- /* the journal hash still covers the common case */
684
- }
685
- }
713
+ rememberCssBase(next);
686
714
  }
687
715
 
688
716
  function writeMetaIfChanged(): void {
@@ -840,11 +868,13 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
840
868
  * overlaps an incoming change").
841
869
  */
842
870
  let acceptedOwn: string | null = null;
871
+ /** #14 — the css twin's `acceptedOwn`. */
872
+ let acceptedOwnCss: string | null = null;
843
873
 
844
874
  /** The value disk and the accepted replica last agreed on for `lane`. */
845
875
  function agreedValue(lane: ProposalLane): string {
846
876
  if (lane === 'html') return acceptedOwn ?? lastHtml ?? htmlFromDoc(doc);
847
- if (lane === 'css') return lastCss ?? cssFromDoc(doc) ?? '';
877
+ if (lane === 'css') return acceptedOwnCss ?? lastCss ?? cssFromDoc(doc) ?? '';
848
878
  return readLaneFromDoc(doc, lane);
849
879
  }
850
880
 
@@ -958,7 +988,16 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
958
988
  rememberBase(value);
959
989
  } else acceptedOwn = value;
960
990
  }
961
- if (lane === 'html') recovered();
991
+ if (lane === 'css' && !pending.has(lane)) {
992
+ // #14 — the css twin's accepted value is its base too, persisted at the ANSWER: a studio
993
+ // that closes before the publication comes back (or whose html writer is busy then)
994
+ // restarted with the base before this save, and its next closed-studio edit of the css
995
+ // was refused against its own accepted save — "changed here and in the cloud".
996
+ rememberCssBase(value);
997
+ if ((cssFromDoc(doc) ?? '') === value) lastCss = value;
998
+ else acceptedOwnCss = value;
999
+ }
1000
+ if (lane === 'html' || lane === 'css') recovered();
962
1001
  if (outcome.actionId) {
963
1002
  try {
964
1003
  opts.onAccepted?.({ lane, value, actionId: outcome.actionId });
@@ -1341,6 +1380,12 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
1341
1380
  // on disk now: the rest of its revision may show.
1342
1381
  const stamped = acceptedOn() ? stampedCohort() : null;
1343
1382
  if (stamped && !seenStamp) observeStamp(stamped);
1383
+ // fix/205-s515 — a publication that arrived before the cold start decided (the creator's own
1384
+ // `doc.create`, published over the socket before its HTTP answer) was refused by `flush`
1385
+ // (not ready) and is first seen HERE. It is on disk now: say it is applied, exactly as
1386
+ // `flush` would — or nothing else changes on this document and the replica's applied
1387
+ // revision stays one behind the head.
1388
+ if (stamped && !held.has('html') && !pending.has('html')) opts.onRevisionApplied?.(stamped[0]);
1344
1389
  }
1345
1390
 
1346
1391
  return {
@@ -1372,6 +1417,7 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
1372
1417
  observedBody = null;
1373
1418
  lastHtml = null;
1374
1419
  lastCss = null;
1420
+ acceptedOwnCss = null;
1375
1421
  lastMeta = null;
1376
1422
  deferredBeforeReady.clear();
1377
1423
  },
@@ -1386,6 +1432,15 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
1386
1432
  }
1387
1433
  rememberBase(value);
1388
1434
  },
1435
+ adoptOwnAcceptedCss(value: string) {
1436
+ const replica = cssFromDoc(doc) ?? '';
1437
+ if (replica === value) lastCss = value;
1438
+ else {
1439
+ lastCss = cssFromDoc(doc);
1440
+ acceptedOwnCss = value;
1441
+ }
1442
+ rememberCssBase(value);
1443
+ },
1389
1444
  hold(lane, base, local) {
1390
1445
  held.add(lane);
1391
1446
  if (lane === 'html') {
@@ -1397,8 +1452,14 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
1397
1452
  reject('local-edit', local, readLaneFromDoc(doc, lane), pathOfLane(lane));
1398
1453
  },
1399
1454
  takeAccepted() {
1400
- if (!held.has('html') && rejectedKey === null) return false;
1455
+ if (!held.has('html') && !held.has('css') && rejectedKey === null) return false;
1401
1456
  held.delete('html');
1457
+ // #14 — the css twin's conflict is taken with it: the project's css returns to disk (the
1458
+ // local css is in its recovery slot since the refusal).
1459
+ if (held.delete('css')) {
1460
+ lastCss = null;
1461
+ acceptedOwnCss = null;
1462
+ }
1402
1463
  // The local-edit guard compares disk with `observedBody`; declaring the
1403
1464
  // current disk bytes observed lets the writer replace them.
1404
1465
  observedBody = readLocal(paths.html);
@@ -1407,8 +1468,12 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
1407
1468
  void flush();
1408
1469
  return true;
1409
1470
  },
1471
+ heldCss() {
1472
+ if (!paths.css || !held.has('css') || pending.has('css')) return null;
1473
+ return { mine: readLocal(paths.css), theirs: cssFromDoc(doc) ?? '' };
1474
+ },
1410
1475
  conflictSides() {
1411
- if (!held.has('html') && rejectedKey === null) return null;
1476
+ if (!held.has('html') && !held.has('css') && rejectedKey === null) return null;
1412
1477
  const candidate = opts.historyDir ? readRecoveryCandidate(opts.historyDir, paths.html) : null;
1413
1478
  return {
1414
1479
  mine: readLocal(paths.html),
@@ -95,9 +95,20 @@ const DELIVERED: ReadonlySet<DeliveryState> = new Set<DeliveryState>([
95
95
  export const CODE_MODULE_HELD_REASON =
96
96
  'code modules replicate only from an owner-vouched or loopback hub';
97
97
 
98
+ /**
99
+ * 2.0.5 — the ledger reason for a file this person deleted here while the project keeps deletes
100
+ * to itself (`linkedHub.propagateDeletes: false`). Neither side will move it, so it is held — and
101
+ * no longer counted as delivered, which the field ledger did for 1 814 files that were not here.
102
+ */
103
+ export const DELETED_HERE_HELD_REASON =
104
+ 'deleted on this Mac — this project does not sync deletions, so the project keeps it and it is not put back here';
105
+
98
106
  /** A row the receiver itself refuses, by consent: held, not waiting. */
99
107
  export function isHeldByConsent(row: LedgerRow): boolean {
100
- return row.state === 'stuck' && row.reason === CODE_MODULE_HELD_REASON;
108
+ return (
109
+ row.state === 'stuck' &&
110
+ (row.reason === CODE_MODULE_HELD_REASON || row.reason === DELETED_HERE_HELD_REASON)
111
+ );
101
112
  }
102
113
 
103
114
  /** States that will not move again without something changing. */
@@ -165,7 +165,9 @@ export interface FilePlaneStatus {
165
165
  | 'reanchor'
166
166
  | 'code-held'
167
167
  | 'hub-older'
168
- | 'hub-refused';
168
+ | 'hub-refused'
169
+ /** 2.0.5: files the legacy (v1) pull could not save here; retried later, less often. */
170
+ | 'pull-failed';
169
171
  count: number;
170
172
  paths: string[];
171
173
  /** One sentence, in the user's terms, about what is waiting and why. */
@@ -44,7 +44,7 @@ import {
44
44
  versionLaneHashes,
45
45
  } from './keys.ts';
46
46
  import { hasThumb, pruneThumbs, readThumb, writeThumb } from './store.ts';
47
- import { checkJpeg, jpegSize } from './validate.ts';
47
+ import { checkJpeg, coverWorthy, jpegSize } from './validate.ts';
48
48
 
49
49
  export type ThumbAt = 'now' | { rev: number } | { sha: string };
50
50
  export interface ThumbRequest {
@@ -517,11 +517,18 @@ export function createThumbService(o: ThumbServiceOptions): ThumbService {
517
517
  }
518
518
  }
519
519
 
520
+ /** A canvas's whole-canvas picture (its Home cover) — what W5's blank / sliver checks are for. */
521
+ const isCover = (job: Job, t: Target): boolean => job.kind === 'canvas' && t.artboard === null;
522
+
520
523
  function store(job: Job, t: Target, b64: unknown): boolean {
521
524
  if (typeof b64 !== 'string' || b64.length > 2 * 1024 * 1024) return false;
522
525
  const bytes = Uint8Array.from(Buffer.from(b64, 'base64'));
523
526
  const check = checkJpeg(bytes, t.px);
524
527
  if (!check.ok) return false;
528
+ // W5: a cover is shown at ~16:10 on Home — a sliver (a header strip, a 3320 x 200 artboard) or a
529
+ // thumbnail under the floor is not a cover. Not stored; Home keeps its placeholder. A canvas COVER
530
+ // only: an asset tile (also artboard-less) is the picture itself, whatever its shape.
531
+ if (isCover(job, t) && !coverWorthy(check.w, check.h)) return false;
525
532
  writeThumb(o.pid, t.key, bytes);
526
533
  dims.set(t.key, { w: check.w, h: check.h });
527
534
  reference(t.key);
@@ -626,7 +633,10 @@ export function createThumbService(o: ThumbServiceOptions): ThumbService {
626
633
  noArtboard.add(t.key);
627
634
  continue;
628
635
  }
629
- if (!shot || !store(job, t, shot.jpeg)) fail(t.key);
636
+ // W5: a flat-colour cover (the renderer looked at its pixels) is a miss like any other failure —
637
+ // a canvas cover only; a tile of a flat picture is that picture
638
+ if (!shot || (isCover(job, t) && shot.blank === true) || !store(job, t, shot.jpeg))
639
+ fail(t.key);
630
640
  else if (shot.partial === true) partial = true;
631
641
  }
632
642
  if (partial && !job.retryOfPartial)
@@ -60,3 +60,10 @@ export function checkJpeg(b: Uint8Array | null | undefined, px: number): JpegChe
60
60
  if (size.w > px + 1 || size.h > px + 1) return { ok: false, reason: 'too-big' };
61
61
  return { ok: true, ...size };
62
62
  }
63
+
64
+ /** The smallest side and the longest aspect a stored COVER may have (W5): below 48 px or more than 10 : 1
65
+ * it is a strip of a header, not a picture of the canvas. Applies to cover targets only. */
66
+ export const MIN_COVER_PX = 48;
67
+ export const MAX_COVER_ASPECT = 10;
68
+ export const coverWorthy = (w: number, h: number): boolean =>
69
+ Math.min(w, h) >= MIN_COVER_PX && Math.max(w, h) / Math.min(w, h) <= MAX_COVER_ASPECT;
@@ -186,6 +186,10 @@ export const KEY_CLASS: Readonly<Record<string, KeyRule>> = {
186
186
  class: 'v2-new',
187
187
  note: 'v2 (S8.5b): Advanced › Where it renders › Video, per Mac; new in v2, nothing to migrate.',
188
188
  },
189
+ 'maude-acp-caps': {
190
+ class: 'v2-new',
191
+ note: '2.0.5 (client/panels/caps-cache.js, `maude-acp-caps:<project>`): the last AI capability set, a per-Mac UI cache so the Advanced fold draws without starting Claude; never synced, new in v2, nothing to migrate.',
192
+ },
189
193
  'maude-ds-upgrade-': {
190
194
  class: 'v2-new',
191
195
  note: 'Not a storage key: ds/upgrade-stage.ts STAGE_PREFIX names the staged-copy temp dirs; the scanner reads any *_PREFIX const.',
@@ -29,6 +29,7 @@ import {
29
29
  useState,
30
30
  useSyncExternalStore,
31
31
  } from 'react';
32
+ import { useArtboardActive } from './artboard-live-gate.tsx';
32
33
  import { canvasModeStore } from './bridge/canvas-mode-store.ts';
33
34
  import { videoLabelTail } from './editing/video-label.ts';
34
35
  import { resolvedPoster } from './kinds/meta.ts';
@@ -581,6 +582,28 @@ export function VideoComp({
581
582
  ? 0
582
583
  : clamp(liveTimelineFrame.get(compId) ?? posterFrame, 0, maxFrame);
583
584
 
585
+ // 2.0.5 — a comp in a sleeping artboard (offscreen, or the canvas zoomed out to its overview) stops
586
+ // decoding: pause it, and play it again on wake only if WE paused it. Never in a capture (always live).
587
+ const live = useArtboardActive();
588
+ const pausedAsleep = useRef(false);
589
+ useEffect(() => {
590
+ const p = ref.current;
591
+ if (!p) return;
592
+ try {
593
+ if (!live) {
594
+ if (p.isPlaying()) {
595
+ p.pause();
596
+ pausedAsleep.current = true;
597
+ }
598
+ } else if (pausedAsleep.current) {
599
+ pausedAsleep.current = false;
600
+ p.play();
601
+ }
602
+ } catch {
603
+ /* Player transitional — the next change settles it */
604
+ }
605
+ }, [live]);
606
+
584
607
  // Register with the seek bridge for the lifetime of this mount.
585
608
  useEffect(() => {
586
609
  installMaudeSeekBridge();
@@ -1,6 +1,78 @@
1
1
  {
2
2
  "$schema": "./whats-new.schema.json",
3
3
  "entries": [
4
+ {
5
+ "id": "heavy-canvases-stay-up",
6
+ "version": "2.0.5",
7
+ "date": "2026-11-05",
8
+ "kind": "fix",
9
+ "title": "Heavy canvases no longer crash the window",
10
+ "summary": "Only the artboards near where you look run live. Offscreen artboards, and every artboard when you zoom far out, pause their 3D scenes, videos and animations and keep their last picture, so a canvas with dozens of scenes pans smoothly. The design system canvas draws each page when you reach it. A canvas that still crashes twice opens with Show visible artboards only instead of crashing again. Exports still draw everything.",
11
+ "surface": "design-ui"
12
+ },
13
+ {
14
+ "id": "home-accounts",
15
+ "version": "2.0.5",
16
+ "date": "2026-11-05",
17
+ "kind": "feature",
18
+ "title": "All your accounts on Home",
19
+ "summary": "Click your face on Home to see every account on this Mac: Maude Cloud, your team servers and GitHub. Sign out of one, or add another. Each project now says how it is connected and as whom, and a project you have in two places shows once.",
20
+ "surface": "design-ui"
21
+ },
22
+ {
23
+ "id": "project-account-card",
24
+ "version": "2.0.5",
25
+ "date": "2026-11-05",
26
+ "kind": "feature",
27
+ "title": "See which account a project uses",
28
+ "summary": "Click your face at the top right to see how this project is signed in: a team server, Maude Cloud or GitHub, which account, and which profile on this Mac. Sign out or switch accounts from there, a team server too, and sign in with GitHub. Click the sync word, such as Syncing… or Offline, to open its details.",
29
+ "surface": "design-ui"
30
+ },
31
+ {
32
+ "id": "home-covers-and-shared-empty",
33
+ "version": "2.0.5",
34
+ "date": "2026-11-05",
35
+ "kind": "fix",
36
+ "title": "Better covers and a calmer empty Shared card on Home",
37
+ "summary": "A canvas whose first artboard is a thin header now gets a cover of its real content, whiteboards show their board, and blank pictures no longer stick as covers. The empty Shared with you card is a single quiet line instead of tilted placeholders.",
38
+ "surface": "design-ui"
39
+ },
40
+ {
41
+ "id": "board-zoom-stays-smooth",
42
+ "version": "2.0.5",
43
+ "date": "2026-11-05",
44
+ "kind": "fix",
45
+ "title": "Zooming a busy board stays smooth",
46
+ "summary": "A board with hundreds of notes no longer stutters when you zoom in the desktop app. The notes keep the same soft shadow.",
47
+ "surface": "design-ui"
48
+ },
49
+ {
50
+ "id": "ai-starts-when-you-do",
51
+ "version": "2.0.5",
52
+ "date": "2026-11-05",
53
+ "kind": "improvement",
54
+ "title": "AI starts when you start typing",
55
+ "summary": "Reopening or reloading Maude no longer starts Claude in the background. It starts the moment you click into the message box.",
56
+ "surface": "design-ui"
57
+ },
58
+ {
59
+ "id": "faster-steadier-uploads",
60
+ "version": "2.0.5",
61
+ "date": "2026-11-05",
62
+ "kind": "fix",
63
+ "title": "Faster, steadier uploads",
64
+ "summary": "A big project's pictures and media now go up to your team server a few at a time, so one slow file no longer holds up the rest, and a file that timed out gets a second try. Sync details counts only the files that still have to move, and files in deeply nested folders, like a 3D asset pack, now sync too. A server too old to take them lists each one with the reason.",
65
+ "surface": "design-ui"
66
+ },
67
+ {
68
+ "id": "first-download-stops-repeating",
69
+ "version": "2.0.5",
70
+ "date": "2026-11-05",
71
+ "kind": "fix",
72
+ "title": "A first download from an older team server finishes",
73
+ "summary": "Getting a project from a team server that runs an older Maude no longer asks for the same files over and over. A file that can't be fetched waits with a reason instead of being asked for on every pass, and a server that doesn't answer is asked again a minute later.",
74
+ "surface": "design-ui"
75
+ },
4
76
  {
5
77
  "id": "team-server-browser-signin",
6
78
  "version": "2.0.4",
@@ -1245,7 +1245,19 @@ export function classifyBash(command, { cwd, designRoot, root, sessionRoot = nul
1245
1245
  // a .design path the script names, runtime (`.design/_…`) ones excepted unless guarded
1246
1246
  // `.design` in any case (a case alias on APFS); a symlink to the root the script reaches
1247
1247
  // by another name is not seen here — residual, the script is text, not a path
1248
- const all = [...text.matchAll(/\.design(?:\/([^\s'"`),;]*))?/gi)].map((m) => m[1] ?? '');
1248
+ // fix/ds-convert-hooks-cli #12 — only a `.design` path segment (never `ctx.designRoot`), and
1249
+ // only one that can be THIS project's: an absolute (or `~`) path that resolves outside its
1250
+ // design root — a throwaway copy under /private/tmp/…/before/.design/ — is another tree.
1251
+ // A relative or computed prefix still counts (the script may chdir anywhere).
1252
+ const all = [...text.matchAll(/([^\s'"`(),;=]*?)\.design(?![\w-])(?:\/([^\s'"`),;]*))?/gi)]
1253
+ .filter((m) => {
1254
+ const pre = m[1] ?? '';
1255
+ if (!/^(?:\/|~\/)/.test(pre) || /[$*?[{]/.test(pre)) return true;
1256
+ const abs = pre.startsWith('~/') ? join(homedir(), pre.slice(2)) : pre;
1257
+ const rel = relative(realRoot(), realpathDeep(`${abs}.design${m[2] ? `/${m[2]}` : ''}`));
1258
+ return !(rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel));
1259
+ })
1260
+ .map((m) => m[2] ?? '');
1249
1261
  const runtime = (after) => {
1250
1262
  const first = after.split('/')[0] ?? '';
1251
1263
  return first.startsWith('_') || first.startsWith('.');
@@ -1,6 +1,6 @@
1
1
  // GENERATED by scripts/gen-actions.mjs from apps/studio/actions/verbs.ts — DO NOT EDIT BY HAND.
2
2
  // What `maude design help` prints under the static usage (contract V2-1.11 §5.7 rule 6).
3
- // manifest 4ae7b6bdb900
3
+ // manifest 3b10dc94b530
4
4
 
5
5
  export const DESIGN_VERB_TIERS_HELP =
6
6
  "Verbs by permission tier (generated from actions.manifest.json, contract V2-1.11 §5.3):\n auto No prompt in the Maude chat (effect none/project):\n prep · bootstrap-check · slug · server-up · runtime-health · screenshot · smoke\n visual-sanity · perf · canvas-rects · canvas-errors · canvas-source\n read-annotations · svg-optimize · asset-sweep · draw-proof · probe-footage\n smart-frames · agent-browser-safe · chat-open · serve · status · index · assets\n help · check · place · layout-check · open · history list · history show\n history diff · history object · trash list · comments list · exports list\n exports again · runs list · runs stop · logs · sync status · annotate · canvas-edit\n handoff · import-asset · import-tokens · ingest-footage · photo-adjust\n transcribe-local · beats · captions list · captions add · captions export · captions\n cut-words · cut-to-beat · reel-place · ds-check · ds-upgrade analyse\n ds-upgrade plan · ds-upgrade validate · ds-upgrade status · ds-upgrade stage\n ds-upgrade prove · ds-upgrade discard · ds-upgrade cancel · trash move\n trash restore · ds status · ds usage · ds check-system · ds revisions\n prompt Shows the permission card:\n hook · export · curl-local · draw-build · to-lottie · generate · audio-search\n fetch-asset · ensure-browser · transcribe · import-figma · import-brand\n photo-bg-remove · describe · init · ds-upgrade · bulk-deletes · history restore\n trash · history undo · history name · exports · sync resync · sync · runs · ds\n comments reply · comments resolve · comments reopen · comments add · comments\n history\n human For people in a terminal. Never in the AI allow list:\n trash clear · link · adopt · unlink · detach\n Every studio capability's file or verb: the design plugin's studio-actions skill.\n";