@1agh/maude 2.0.0-rc.1 → 2.0.0-rc.2

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 (36) hide show
  1. package/apps/studio/acp/index.ts +35 -2
  2. package/apps/studio/agent-runs.ts +3 -0
  3. package/apps/studio/ai/lease-home.ts +11 -1
  4. package/apps/studio/ai/run-lifecycle.ts +17 -0
  5. package/apps/studio/ai/runs.ts +64 -12
  6. package/apps/studio/api.ts +31 -5
  7. package/apps/studio/canvas-imports.ts +23 -4
  8. package/apps/studio/client/app.jsx +4 -0
  9. package/apps/studio/client/fonts/LICENSE-Inter-Tight.txt +93 -0
  10. package/apps/studio/client/fonts/LICENSE-Inter.txt +93 -0
  11. package/apps/studio/client/fonts/LICENSE-JetBrains-Mono.txt +93 -0
  12. package/apps/studio/client/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  13. package/apps/studio/client/fonts/inter-latin-wght-normal.woff2 +0 -0
  14. package/apps/studio/client/fonts/inter-tight-latin-ext-wght-normal.woff2 +0 -0
  15. package/apps/studio/client/fonts/inter-tight-latin-wght-normal.woff2 +0 -0
  16. package/apps/studio/client/fonts/jetbrains-mono-latin-ext-wght-normal.woff2 +0 -0
  17. package/apps/studio/client/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  18. package/apps/studio/client/index.html +0 -3
  19. package/apps/studio/client/styles/_index.css +2 -0
  20. package/apps/studio/client/styles/fonts.css +63 -0
  21. package/apps/studio/client/v2/ai/needs-you.js +10 -0
  22. package/apps/studio/dist/client.bundle.js +89 -89
  23. package/apps/studio/dist/styles.css +1 -1
  24. package/apps/studio/sync/ctl-provider.ts +4 -1
  25. package/apps/studio/sync/file-ledger.ts +12 -0
  26. package/apps/studio/sync/file-membership.ts +28 -0
  27. package/apps/studio/sync/file-plane.ts +119 -5
  28. package/apps/studio/sync/index.ts +55 -1
  29. package/apps/studio/sync/journal-client.ts +12 -0
  30. package/apps/studio/sync/poke.ts +30 -0
  31. package/apps/studio/sync/presentation.ts +6 -1
  32. package/apps/studio/sync/projection.ts +7 -0
  33. package/apps/studio/sync/retry-after.ts +27 -0
  34. package/apps/studio/sync/status.ts +9 -1
  35. package/apps/studio/whats-new.json +45 -0
  36. package/package.json +8 -8
@@ -38,7 +38,7 @@
38
38
  // retry-until-delivered machinery and no ordering guarantees: it is a doorbell,
39
39
  // not a delivery.
40
40
 
41
- import { isKeepalive, parsePoke, parseRunsPoke } from './poke.ts';
41
+ import { isKeepalive, isModeNotice, parsePoke, parseRunsPoke } from './poke.ts';
42
42
 
43
43
  /** The reserved control document. Must match the hub's `files-ctl.mjs`. */
44
44
  export const FILES_CTL_DOC = 'maude.files';
@@ -176,6 +176,9 @@ export function createCtlProvider(opts: CtlProviderOptions): CtlProvider {
176
176
  // provider's silence check quiet on a healthy socket). Not a poke, and
177
177
  // not malformed either.
178
178
  if (isKeepalive(data?.payload)) return;
179
+ // The hub's mode/format notice goes to every open connection, this one
180
+ // included. The canvas providers act on it; here it is simply not ours.
181
+ if (isModeNotice(data?.payload)) return;
179
182
  // A runs poke is not a files poke and not malformed either: a runs-v1 hub sends both.
180
183
  const runsSeq = parseRunsPoke(data?.payload);
181
184
  if (runsSeq !== null) {
@@ -193,6 +193,14 @@ export interface LedgerRow {
193
193
  * Remembering which remote we parked makes the second pass a no-op.
194
194
  */
195
195
  parkedRemote?: string;
196
+ /**
197
+ * The local hash the hub's door REFUSED for good (a 400/404/413/422 on its
198
+ * PUT — issue #175). Set with `state: 'refused'` + `blockedClass: 'refused'`.
199
+ * While the file still hashes to this, the plane does not ask again: the
200
+ * door's answer about these bytes is final, and retrying it with backoff
201
+ * forever was the bug. A real change gives a new hash, which is tried once.
202
+ */
203
+ refusedHash?: string;
196
204
  pushedAt?: number;
197
205
  pulledAt?: number;
198
206
  healedAt?: number;
@@ -424,6 +432,8 @@ export function createFileLedger(opts: FileLedgerOptions): FileLedger {
424
432
  ? { attempts: Math.min(Math.trunc(r.attempts as number), 1_000) }
425
433
  : {}),
426
434
  ...(Number.isFinite(r.nextAttemptAt) ? { nextAttemptAt: r.nextAttemptAt } : {}),
435
+ // Same allowlist rule: dropped here, a final refusal would be asked again after every restart.
436
+ ...(typeof r.refusedHash === 'string' ? { refusedHash: r.refusedHash } : {}),
427
437
  };
428
438
  }
429
439
  return out;
@@ -638,6 +648,8 @@ export function createFileLedger(opts: FileLedgerOptions): FileLedger {
638
648
  // prune. A hub re-offering H a week later got a `noop` with no
639
649
  // recoverable copy anywhere, while the row still claimed one was made.
640
650
  r.parkedRemote = undefined;
651
+ // The door took these bytes (or the hub already holds them): no refusal stands.
652
+ r.refusedHash = undefined;
641
653
  schedule();
642
654
  return true;
643
655
  },
@@ -345,6 +345,34 @@ export function isProjectFileShape(rel: string): boolean {
345
345
  return relShape(rel) !== null;
346
346
  }
347
347
 
348
+ /**
349
+ * The `.json` sidecars a hub WITHOUT the `file-classes-v2` capability (every
350
+ * 1.x hub, v1.10.0 included) already took. Its door classifies any other
351
+ * `.json` as `never` and answers `400 invalid path`.
352
+ */
353
+ const OLDER_DOOR_JSON_SUFFIXES = [
354
+ '.photo.json',
355
+ '.audio.json',
356
+ '.footage.json',
357
+ '.registry.json',
358
+ '.edl.json',
359
+ ];
360
+
361
+ /**
362
+ * Would a hub without `file-classes-v2` refuse this FILE-PLANE path? (issue #175)
363
+ *
364
+ * 2.0 added `.transcript.json`, `.beats.json`, `.gen.json` and the design-system
365
+ * manifests (`<group>/<ds>/tokens.json`, `components.json`, `revisions/*.json`)
366
+ * to the plane; the deployed 1.x hubs refuse every one of them. Asked only about
367
+ * a path this side already classifies into the plane, where the only `.json`
368
+ * files are exactly those plus the five older sidecars — so the test is the
369
+ * suffix, not a second copy of the classifier. Studio-only: a hub never asks it.
370
+ */
371
+ export function olderDoorRefuses(rel: string): boolean {
372
+ const lower = (rel.split('/').pop() ?? '').toLowerCase();
373
+ return lower.endsWith('.json') && !OLDER_DOOR_JSON_SUFFIXES.some((s) => lower.endsWith(s));
374
+ }
375
+
348
376
  /** The segment shape rules alone — split parts, or null on refusal. */
349
377
 
350
378
  /**
@@ -71,6 +71,7 @@ import {
71
71
  classifyProjectFile,
72
72
  type FileClass,
73
73
  isFilePlaneClass,
74
+ olderDoorRefuses,
74
75
  } from './file-membership.ts';
75
76
  import {
76
77
  fetchJournal,
@@ -79,7 +80,7 @@ import {
79
80
  type JournalPage,
80
81
  } from './journal-client.ts';
81
82
  import { createPullBudget } from './pull-budget.ts';
82
- import { failureReason, isBackpressure, retryAfterMs } from './retry-after.ts';
83
+ import { failureReason, isBackpressure, refusalWords, retryAfterMs } from './retry-after.ts';
83
84
  import { classifyTransportError } from './transport-error.ts';
84
85
 
85
86
  /** How long to wait for one file's bytes. Generous — these run to videos. */
@@ -426,8 +427,25 @@ export interface FilePlaneResult {
426
427
  * read carries it; absent otherwise. A count of 0 means nothing is held.
427
428
  */
428
429
  codeHeld?: { count: number; paths: { path: string; reason: HeldReason }[] };
430
+ /**
431
+ * Issue #175 — files the hub's door will not take, from the LEDGER (so a pass
432
+ * that skipped them still reports them). `older` = held before asking, because
433
+ * the hub lacks `file-classes-v2`; otherwise the door answered a permanent 4xx
434
+ * and `reason` carries its words. Bounded; absent when there are none.
435
+ */
436
+ hubRefused?: { rel: string; reason: string; older?: true }[];
429
437
  }
430
438
 
439
+ /** Statuses that are a door's FINAL word on a file push (issue #175). 408/429 are not: they retry. */
440
+ const PERMANENT_PUSH_REFUSALS = new Set([400, 404, 413, 422]);
441
+
442
+ /** How many `hubRefused` rows one result carries. */
443
+ export const MAX_HUB_REFUSED_ROWS = 200;
444
+
445
+ /** The ledger reason for a file held back from a hub without `file-classes-v2`. */
446
+ export const OLDER_HUB_REASON =
447
+ 'The project’s server runs an older Maude that is too old to take this kind of file';
448
+
431
449
  export interface FilePlaneOptions {
432
450
  designRoot: string;
433
451
  hubUrl: string;
@@ -517,6 +535,12 @@ export interface FilePlaneOptions {
517
535
  * throw is swallowed.
518
536
  */
519
537
  onDelivered?: (rel: string) => void;
538
+ /**
539
+ * Issue #175 — the hub advertises `file-classes-v2` (`hasFileClassesV2`). False ⇒ the paths a
540
+ * 1.x door refuses (`olderDoorRefuses`) are held here with a reason and never offered. Absent ⇒
541
+ * true (every caller before this option, and every test hub, takes them).
542
+ */
543
+ hubTakesV2Files?: boolean;
520
544
  }
521
545
 
522
546
  interface SyncableLocalFile {
@@ -885,12 +909,17 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
885
909
  * Every non-ok response on this lane comes through here, so there is one
886
910
  * answer to "was that a fault or a wall" rather than one per call site.
887
911
  */
888
- async function refusal(res: Response): Promise<{
912
+ async function refusal(
913
+ res: Response,
914
+ /** The request NAMES THE FILE (a push or a session create): a 4xx about it is final (#175). */
915
+ { final = false }: { final?: boolean } = {}
916
+ ): Promise<{
889
917
  ok: false;
890
918
  reason: string;
891
919
  rateLimited?: true;
892
920
  quotaExhausted?: true;
893
921
  quotaResetsAt?: number;
922
+ permanent?: true;
894
923
  }> {
895
924
  // 507 — the per-token hourly WRITE QUOTA is spent (file-door.mjs
896
925
  // `QUOTA_BYTES_PER_WINDOW`, 2 GiB). Not a fault and not a rate limit: the
@@ -931,6 +960,12 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
931
960
  formatRefused = { formatVersion: fv };
932
961
  return { ok: false, reason: 'This project now uses Maude 2. Update Maude to edit it.' };
933
962
  }
963
+ // A FINAL ANSWER ABOUT THESE BYTES (issue #175). The 1.10.0 hub answered
964
+ // `400 {"error":"invalid path"}` to 2.0-only files and the plane retried
965
+ // each one with backoff forever. The caller holds the file instead.
966
+ if (final && PERMANENT_PUSH_REFUSALS.has(res.status)) {
967
+ return { ok: false, reason: await refusalWords(res), permanent: true };
968
+ }
934
969
  const reason = await failureReason(res);
935
970
  // BACKPRESSURE, not just 429 — a cell that is starting answers 503 with a
936
971
  // Retry-After, and firing this pass's remaining request budget into that
@@ -1274,6 +1309,7 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1274
1309
  tooLarge?: true;
1275
1310
  quotaExhausted?: true;
1276
1311
  quotaResetsAt?: number;
1312
+ permanent?: true;
1277
1313
  }
1278
1314
  > {
1279
1315
  // PRE-FLIGHT AGAINST THE DOOR'S OWN CEILING, before a byte is read.
@@ -1348,7 +1384,7 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1348
1384
  current: typeof body?.current === 'string' ? body.current : null,
1349
1385
  };
1350
1386
  }
1351
- if (!res.ok) return await refusal(res);
1387
+ if (!res.ok) return await refusal(res, { final: true });
1352
1388
  const body = (await res.json().catch(() => ({}))) as { seq?: unknown };
1353
1389
  return { ok: true, seq: typeof body?.seq === 'number' ? body.seq : null };
1354
1390
  } catch (err) {
@@ -1384,7 +1420,7 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1384
1420
  }),
1385
1421
  signal: AbortSignal.timeout(GET_TIMEOUT_MS),
1386
1422
  });
1387
- if (!created.ok) return await refusal(created);
1423
+ if (!created.ok) return await refusal(created, { final: true });
1388
1424
  const s = await json(created);
1389
1425
  const id = typeof s.id === 'string' ? s.id : '';
1390
1426
  const partBytes = Number(s.partBytes);
@@ -1610,7 +1646,29 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1610
1646
  return out;
1611
1647
  }
1612
1648
 
1649
+ /** Issue #175 — every file a door will not take, from the ledger, bounded. */
1650
+ function hubRefusedRows(): NonNullable<FilePlaneResult['hubRefused']> {
1651
+ const rows: NonNullable<FilePlaneResult['hubRefused']> = [];
1652
+ for (const [rel, r] of Object.entries(ledger.rows())) {
1653
+ if (r.state !== 'refused' || r.blockedClass !== 'refused') continue;
1654
+ rows.push({
1655
+ rel,
1656
+ reason: r.reason ?? 'The project’s server did not take this file',
1657
+ ...(r.refusedHash === undefined ? { older: true as const } : {}),
1658
+ });
1659
+ }
1660
+ rows.sort((a, b) => a.rel.localeCompare(b.rel));
1661
+ return rows.slice(0, MAX_HUB_REFUSED_ROWS);
1662
+ }
1663
+
1613
1664
  async function reconcile(): Promise<FilePlaneResult> {
1665
+ const out = await reconcilePass();
1666
+ const refused = hubRefusedRows();
1667
+ if (refused.length > 0) out.hubRefused = refused;
1668
+ return out;
1669
+ }
1670
+
1671
+ async function reconcilePass(): Promise<FilePlaneResult> {
1614
1672
  const out: FilePlaneResult = {
1615
1673
  pulled: [],
1616
1674
  pushed: [],
@@ -1832,7 +1890,7 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1832
1890
  if (
1833
1891
  !here &&
1834
1892
  kept?.state === 'refused' &&
1835
- kept.blockedClass === 'too-large' &&
1893
+ (kept.blockedClass === 'too-large' || kept.blockedClass === 'refused') &&
1836
1894
  !kept.syncedHash &&
1837
1895
  !(row && !row.deleted) &&
1838
1896
  !ledger.remoteOf(rel)
@@ -1968,6 +2026,40 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1968
2026
  }
1969
2027
  }
1970
2028
 
2029
+ // A HUB THAT CANNOT TAKE IT IS NOT OFFERED IT (issue #175). A 1.x door
2030
+ // answers `400 invalid path` to every 2.0-only file; asking costs a
2031
+ // request and tells nobody anything. Held with a reason instead — and
2032
+ // offered again the pass this hub advertises `file-classes-v2`.
2033
+ if (
2034
+ here &&
2035
+ remoteHash === null &&
2036
+ opts.hubTakesV2Files === false &&
2037
+ olderDoorRefuses(rel) &&
2038
+ isFilePlaneClass(
2039
+ classifyProjectFile(rel, {
2040
+ canvasGroups: opts.canvasGroups,
2041
+ hasFile: (r) => local.has(r) || existsSync(path.join(designRoot, r)),
2042
+ })
2043
+ )
2044
+ ) {
2045
+ if (
2046
+ !(
2047
+ kept?.state === 'refused' &&
2048
+ kept.blockedClass === 'refused' &&
2049
+ kept.reason === OLDER_HUB_REASON &&
2050
+ kept.refusedHash === undefined
2051
+ )
2052
+ ) {
2053
+ ledger.setState(rel, 'refused', {
2054
+ reason: OLDER_HUB_REASON,
2055
+ blockedClass: 'refused',
2056
+ refusedHash: undefined,
2057
+ });
2058
+ }
2059
+ out.dropped.push({ rel, reason: OLDER_HUB_REASON });
2060
+ continue;
2061
+ }
2062
+
1971
2063
  const state: FileState = {
1972
2064
  path: rel,
1973
2065
  local: here?.hash ?? null,
@@ -1979,6 +2071,17 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
1979
2071
  ...(opts.propagateDeletes ? { propagateDeletes: true } : {}),
1980
2072
  };
1981
2073
  const decision = decideFile(state);
2074
+ // REFUSED FOR GOOD, AND UNCHANGED (issue #175): the door already said no
2075
+ // to exactly these bytes. Not work, not a failure, not a backoff — held.
2076
+ if (
2077
+ (decision.action === 'push' || decision.action === 'revive') &&
2078
+ here &&
2079
+ kept?.state === 'refused' &&
2080
+ kept.blockedClass === 'refused' &&
2081
+ kept.refusedHash === here.hash
2082
+ ) {
2083
+ continue;
2084
+ }
1982
2085
  if (decision.action === 'noop' && !decision.parkRemote) {
1983
2086
  if (decision.adoptAncestor && here) {
1984
2087
  // Record agreement so the next pass is a stat and nothing more.
@@ -2431,6 +2534,17 @@ export function createFilePlane(opts: FilePlaneOptions): FilePlane {
2431
2534
  }
2432
2535
  return true;
2433
2536
  }
2537
+ if (res.permanent) {
2538
+ // THE DOOR'S FINAL WORD on these bytes (issue #175): held, with its
2539
+ // words, and not asked again until the file changes (`refusedHash`).
2540
+ ledger.setState(rel, 'refused', {
2541
+ reason: res.reason,
2542
+ blockedClass: 'refused',
2543
+ refusedHash: here.hash,
2544
+ });
2545
+ out.dropped.push({ rel, reason: res.reason });
2546
+ return true;
2547
+ }
2434
2548
  out.failed.push({ rel, reason: res.reason });
2435
2549
  ledger.setState(rel, 'stuck', { reason: res.reason });
2436
2550
  return false;
@@ -106,7 +106,7 @@ import { type HubDocRow, hubHolds, indexHubDocs } from './hub-listing.ts';
106
106
  import { hubTextUndoConflict } from './hub-text-undo.ts';
107
107
  import { accessFor, getHubRecord } from './hubs-config.ts';
108
108
  import { loadJournal, type SyncJournal } from './journal.ts';
109
- import { hasAnnotationsV2, hasLedger, hubHealth } from './journal-client.ts';
109
+ import { hasAnnotationsV2, hasFileClassesV2, hasLedger, hubHealth } from './journal-client.ts';
110
110
  import type { RestoreOptions } from './local-kernel.ts';
111
111
  import { isLoopbackHost } from './loopback.ts';
112
112
  import { createMediaGate, MEDIA_STAYS_LINE, readServerSignature } from './media-gate.ts';
@@ -5778,6 +5778,9 @@ export function createSyncRuntime(
5778
5778
  canvasGroups: ctx.cfg.canvasGroups,
5779
5779
  allowCodeModules,
5780
5780
  canUploadCodeModules: cellPairing !== null || isProjectOwner,
5781
+ // Issue #175 — a 1.x hub's door refuses the 2.0-only files with a 400; it is not
5782
+ // offered them (they are held, with a reason, in Sync details).
5783
+ hubTakesV2Files: hasFileClassesV2(caps),
5781
5784
  unlimitedOutboundDeletes: unlimitedDeletes,
5782
5785
  // Increment 6, DEFAULT ON: a hub-owned mirror that ignores
5783
5786
  // deletes contradicts the model it is selling — you delete a
@@ -6731,6 +6734,27 @@ export function filePlaneHeld(
6731
6734
  detail: codeHeldDetail(result.codeHeld.count),
6732
6735
  });
6733
6736
  }
6737
+ // Issue #175 — files the project's server will not take. Counted already under
6738
+ // `progress.blocked` (class `refused`), so these rows are the per-file WHY, not a second count.
6739
+ const refused = result.hubRefused ?? [];
6740
+ const older = refused.filter((r) => r.older).map((r) => r.rel);
6741
+ if (older.length > 0) {
6742
+ held.push({
6743
+ kind: 'hub-older',
6744
+ count: older.length,
6745
+ paths: older,
6746
+ detail: hubOlderDetail(older.length),
6747
+ });
6748
+ }
6749
+ const final = refused.filter((r) => !r.older);
6750
+ if (final.length > 0) {
6751
+ held.push({
6752
+ kind: 'hub-refused',
6753
+ count: final.length,
6754
+ paths: final.map((r) => r.rel),
6755
+ detail: hubRefusedDetail(final.map((r) => r.reason)),
6756
+ });
6757
+ }
6734
6758
  if (result.reanchorHeld) {
6735
6759
  held.push({
6736
6760
  kind: 'reanchor',
@@ -6743,6 +6767,36 @@ export function filePlaneHeld(
6743
6767
  return held;
6744
6768
  }
6745
6769
 
6770
+ /**
6771
+ * Issue #175 — the Sync details sentence for files held back from a server too old to take them
6772
+ * (CONTRACT §4: what happened · what is safe · one verb).
6773
+ */
6774
+ export function hubOlderDetail(count: number): string {
6775
+ return count === 1
6776
+ ? '1 file is a kind the project’s server is too old to take, so it doesn’t sync. It stays on this Mac. Update the server to Maude 2 to sync it.'
6777
+ : `${count} files are a kind the project’s server is too old to take, so they don’t sync. They stay on this Mac. Update the server to Maude 2 to sync them.`;
6778
+ }
6779
+
6780
+ /**
6781
+ * Issue #175 — the Sync details sentence for files the server refused for good. Each reason is one
6782
+ * sentence carrying the server's own words in quotes (`refusalWords`); the row quotes the first
6783
+ * answer and says how many other answers there were.
6784
+ */
6785
+ export function hubRefusedDetail(reasons: readonly string[]): string {
6786
+ const count = reasons.length;
6787
+ const answers = [
6788
+ ...new Set(reasons.map((r) => /“([^”]*)”/.exec(r)?.[1] ?? '').filter((a) => a !== '')),
6789
+ ];
6790
+ const others = answers.length - 1;
6791
+ const answered =
6792
+ answers.length === 0
6793
+ ? ''
6794
+ : ` — it answered “${answers[0]}”${others > 0 ? ` (and ${others} other answer${others === 1 ? '' : 's'})` : ''}`;
6795
+ return count === 1
6796
+ ? `1 file wasn’t taken by the project’s server${answered}. It stays on this Mac, and sync tries again when it changes.`
6797
+ : `${count} files weren’t taken by the project’s server${answered}. They stay on this Mac, and sync tries again when one changes.`;
6798
+ }
6799
+
6746
6800
  /**
6747
6801
  * p8-held-surface — the Sync details sentence for files the hub holds back from the code lane
6748
6802
  * (CONTRACT §4: what happened · what is safe · one verb). Only the owner reads it, and only the
@@ -285,3 +285,15 @@ export function hasAnnotationsV2(capabilities: string[] | null): boolean {
285
285
  export function hasLedger(capabilities: string[] | null): boolean {
286
286
  return Array.isArray(capabilities) && capabilities.includes('ledger');
287
287
  }
288
+
289
+ /** The capability a hub advertises when its file door takes the 2.0 file classes (issue #175). */
290
+ export const FILE_CLASSES_V2_CAPABILITY = 'file-classes-v2';
291
+
292
+ /**
293
+ * Does this hub's file door take the 2.0 file classes (`.transcript.json`, `.beats.json`,
294
+ * `.gen.json`, the design-system manifests)? Every 1.x hub answers those with `400 invalid path`,
295
+ * and it is deployed, so the desktop must not offer them (`olderDoorRefuses`, file-membership.ts).
296
+ */
297
+ export function hasFileClassesV2(capabilities: string[] | null): boolean {
298
+ return Array.isArray(capabilities) && capabilities.includes(FILE_CLASSES_V2_CAPABILITY);
299
+ }
@@ -82,3 +82,33 @@ export const CTL_KEEPALIVE_FRAME = '{"t":"ka"}';
82
82
  export function isKeepalive(payload: unknown): boolean {
83
83
  return payload === CTL_KEEPALIVE_FRAME;
84
84
  }
85
+
86
+ /**
87
+ * The hub's mode/format notice (`hub-integration.mjs`, v1.x and 2.x alike):
88
+ * `{type:'maude.mode', mode, epoch, writable, formatVersion}` is sent to EVERY
89
+ * open connection — the control socket included — when the project's mode flips
90
+ * or its format is raised (a 2.0 studio attaching to a format-1 project raises
91
+ * it, so this arrives right after attach). The canvas providers act on it; the
92
+ * control channel has no use for it and must neither act on it nor call it
93
+ * garbage. Strict on purpose: bounded size, a known mode, a boolean `writable`,
94
+ * a sane epoch. Anything else stays malformed.
95
+ */
96
+ export function isModeNotice(payload: unknown): boolean {
97
+ if (typeof payload !== 'string' || payload.length > MAX_POKE_BYTES) return false;
98
+ let parsed: unknown;
99
+ try {
100
+ parsed = JSON.parse(payload);
101
+ } catch {
102
+ return false;
103
+ }
104
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return false;
105
+ const frame = parsed as { type?: unknown; mode?: unknown; epoch?: unknown; writable?: unknown };
106
+ return (
107
+ frame.type === 'maude.mode' &&
108
+ (frame.mode === 'legacy' || frame.mode === 'transactions') &&
109
+ typeof frame.writable === 'boolean' &&
110
+ typeof frame.epoch === 'number' &&
111
+ Number.isSafeInteger(frame.epoch) &&
112
+ frame.epoch >= 0
113
+ );
114
+ }
@@ -224,7 +224,12 @@ function readLanes(status: SyncStatusLike): LaneFacts {
224
224
  }
225
225
  if (isCount(files.failed)) facts.failedFiles = files.failed;
226
226
  if (Array.isArray(files.held)) {
227
- for (const h of files.held) facts.held += isRecord(h) && isCount(h.count) ? h.count : 1;
227
+ for (const h of files.held) {
228
+ // Issue #175 — files the server will not take are counted under `progress.blocked`
229
+ // ("N files are blocked"); their held row is the per-file why, not a decision to make.
230
+ if (isRecord(h) && (h.kind === 'hub-older' || h.kind === 'hub-refused')) continue;
231
+ facts.held += isRecord(h) && isCount(h.count) ? h.count : 1;
232
+ }
228
233
  }
229
234
  // The hub asked the lane to wait with changes still on this Mac: that is syncing (paused), never
230
235
  // "synced" — the Share cluster must not say Saved over a callout that says changes are waiting.
@@ -1150,6 +1150,13 @@ export function createDocProjection(opts: DocProjectionOptions): DocProjection {
1150
1150
 
1151
1151
  function applyFromFs(evt: { path: string; bytes: Uint8Array; hash: string }): boolean {
1152
1152
  if (stopped) return false;
1153
+ // NOT OURS, SO NOT TOUCHED (#175). The runtime offers every file event to
1154
+ // every canvas's projection in turn; decoding the bytes before asking whose
1155
+ // path it is cost a 300-canvas project 300 decodes of each write — the
1156
+ // file plane's ~2.6 MB ledger, once a second, through a first sync — and
1157
+ // took the server to GBs of RSS. It also let a foreign projection consume
1158
+ // the owner's echo token from the shared guard below.
1159
+ if (laneOfPath(evt.path) === null) return false;
1153
1160
  // Write-inert both ways — a local edit to a stale pre-move file must not
1154
1161
  // revive the retired document (see codec stampMovedTo).
1155
1162
  if (movedToFromDoc(doc) !== null) return false;
@@ -122,6 +122,33 @@ export async function failureReason(res: Response): Promise<string> {
122
122
  return snippet ? `HTTP ${res.status} — ${snippet}` : `HTTP ${res.status}`;
123
123
  }
124
124
 
125
+ /**
126
+ * A door's own words for a FINAL refusal, as one sentence for a person (issue #175): the hub's
127
+ * JSON `error` when it sent one (`{"error":"invalid path"}` → “invalid path”), else the bounded
128
+ * body. Hub-supplied ⇒ untrusted (DDR-054): the same stripping and cap as `failureReason`, and it
129
+ * only ever renders as text.
130
+ */
131
+ export async function refusalWords(res: Response): Promise<string> {
132
+ const raw = await readBounded(res);
133
+ let said = raw;
134
+ try {
135
+ const body = JSON.parse(raw) as { error?: unknown } | null;
136
+ if (typeof body?.error === 'string') said = body.error;
137
+ } catch {
138
+ /* not JSON — the body itself is what it said */
139
+ }
140
+ const clean = said
141
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: stripping them is the point.
142
+ .replace(/[\u0000-\u001f\u007f]/g, ' ')
143
+ .replace(/[“”"]/g, "'")
144
+ .replace(/\s+/g, ' ')
145
+ .trim()
146
+ .slice(0, ERROR_SNIPPET_CHARS);
147
+ return clean
148
+ ? `The project’s server didn’t take this file — it answered “${clean}”.`
149
+ : 'The project’s server didn’t take this file.';
150
+ }
151
+
125
152
  /** A refusal that names a WALL rather than a fault: the hub is willing, just
126
153
  * not now. Every lane that can hit one reports it in this shape. */
127
154
  export interface RateLimited {
@@ -157,7 +157,15 @@ export interface FilePlaneStatus {
157
157
  */
158
158
  held?: {
159
159
  /** `code-held` (p8-held-surface): files the hub holds back from the code lane — the owner only. */
160
- kind: 'delete-out' | 'delete-in' | 'first-anchor' | 'reanchor' | 'code-held';
160
+ /** `hub-older` / `hub-refused` (issue #175): files the project's server cannot / will not take. */
161
+ kind:
162
+ | 'delete-out'
163
+ | 'delete-in'
164
+ | 'first-anchor'
165
+ | 'reanchor'
166
+ | 'code-held'
167
+ | 'hub-older'
168
+ | 'hub-refused';
161
169
  count: number;
162
170
  paths: string[];
163
171
  /** One sentence, in the user's terms, about what is waiting and why. */
@@ -10,6 +10,51 @@
10
10
  "summary": "The canvas now fills the window, and everything else floats around it: one project menu, Home to start from, a tab per project, Share, and an AI chat panel that works on what you select. Preview adds whiteboard tools, Present shows a canvas to an audience, video artboards get a timeline, and a design system is a canvas of its own. Menu › Help › Take the tour walks through it.",
11
11
  "surface": "design-ui"
12
12
  },
13
+ {
14
+ "id": "ai-big-canvas-ask",
15
+ "version": null,
16
+ "date": null,
17
+ "kind": "fix",
18
+ "title": "AI works on canvases with hundreds of artboards",
19
+ "summary": "Asking the AI about a whole canvas with more than 200 artboards no longer leaves the chat on “AI is working” forever: it starts right away and takes each artboard as it changes it. If an ask cannot start, the chat now says why.",
20
+ "surface": "design-ui"
21
+ },
22
+ {
23
+ "id": "home-opens-dark",
24
+ "version": null,
25
+ "date": null,
26
+ "kind": "fix",
27
+ "title": "Maude opens dark, never on a white window",
28
+ "summary": "The first window no longer sits white while it waits on the network: Home and every project tab draw on the dark background from the first moment, even offline.",
29
+ "surface": "design-ui"
30
+ },
31
+ {
32
+ "id": "sync-refused-files-held",
33
+ "version": null,
34
+ "date": null,
35
+ "kind": "fix",
36
+ "title": "Sync stops retrying files the server refuses",
37
+ "summary": "A file the project’s server turns down is no longer sent again and again: it stays on this Mac and Sync details shows it with the server’s reason, and it is tried once more when you change it. A first sync of a big project also uses much less memory.",
38
+ "surface": "design-ui"
39
+ },
40
+ {
41
+ "id": "fonts-ship-with-maude",
42
+ "version": null,
43
+ "date": null,
44
+ "kind": "improvement",
45
+ "title": "Maude’s fonts ship with the app",
46
+ "summary": "Inter, Inter Tight and JetBrains Mono now come with Maude, so the app makes no request to Google Fonts and looks the same offline.",
47
+ "surface": "design-ui"
48
+ },
49
+ {
50
+ "id": "rename-keeps-css-import",
51
+ "version": null,
52
+ "date": null,
53
+ "kind": "fix",
54
+ "title": "Renaming a canvas keeps its styles",
55
+ "summary": "Renaming or moving a canvas carries its own stylesheet along and points the canvas at it, so the canvas renders right away instead of showing a “could not resolve” error.",
56
+ "surface": "design-ui"
57
+ },
13
58
  {
14
59
  "id": "fixed-artboard-full-height",
15
60
  "version": null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0-rc.2",
4
4
  "description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -65,13 +65,13 @@
65
65
  "test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
66
66
  },
67
67
  "optionalDependencies": {
68
- "@1agh/maude-darwin-arm64": "2.0.0-rc.1",
69
- "@1agh/maude-darwin-x64": "2.0.0-rc.1",
70
- "@1agh/maude-linux-arm64": "2.0.0-rc.1",
71
- "@1agh/maude-linux-arm64-musl": "2.0.0-rc.1",
72
- "@1agh/maude-linux-x64": "2.0.0-rc.1",
73
- "@1agh/maude-linux-x64-musl": "2.0.0-rc.1",
74
- "@1agh/maude-win32-x64": "2.0.0-rc.1"
68
+ "@1agh/maude-darwin-arm64": "2.0.0-rc.2",
69
+ "@1agh/maude-darwin-x64": "2.0.0-rc.2",
70
+ "@1agh/maude-linux-arm64": "2.0.0-rc.2",
71
+ "@1agh/maude-linux-arm64-musl": "2.0.0-rc.2",
72
+ "@1agh/maude-linux-x64": "2.0.0-rc.2",
73
+ "@1agh/maude-linux-x64-musl": "2.0.0-rc.2",
74
+ "@1agh/maude-win32-x64": "2.0.0-rc.2"
75
75
  },
76
76
  "files": [
77
77
  "cli",