@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
@@ -1367,6 +1367,13 @@ async function preBash(ctx, input) {
1367
1367
  // the guard can't read every language, so post-bash binds what changed during the call. No
1368
1368
  // snapshot for those (no named file): the studio maps the change to every artboard it touched.
1369
1369
  if (!writers.length && !(toolUseId && bashMayWrite(command, manifestVerbs(ctx)))) return null;
1370
+ // fix/ds-convert-hooks-cli #11 — a call whose only writers are `maude design` verbs (nothing else in
1371
+ // it can write: no interpreter, no redirect into the design root). What such a verb writes besides
1372
+ // the canvases the command names (a `ds convert`'s revisions + head.json, the imports `ds switch`
1373
+ // rewrites, a board sync lands meanwhile) is Maude's write, not the AI's: post-bash binds only the
1374
+ // named canvases it snapshotted below.
1375
+ const claiming = claimingVerbs(ctx);
1376
+ const verbOnly = writers.length > 0 && claiming !== null && !bashMayWrite(command, claiming);
1370
1377
  const snaps = {};
1371
1378
  for (const w of writers) {
1372
1379
  for (const word of w.cmd.words) {
@@ -1408,6 +1415,7 @@ async function preBash(ctx, input) {
1408
1415
  JSON.stringify({
1409
1416
  at,
1410
1417
  snaps,
1418
+ ...(verbOnly ? { verbOnly: true } : {}),
1411
1419
  ...bg,
1412
1420
  ...(interp ? { interp: true, files, hashes, ...(all ? { all: true } : {}) } : {}),
1413
1421
  })
@@ -1529,6 +1537,7 @@ async function bindBashWrites(ctx, toolUseId, mark, by, since) {
1529
1537
  const files = designWritesSince(ctx.designRoot, since);
1530
1538
  if (!files.length) return;
1531
1539
  for (const rel of files) {
1540
+ if (!aiMayHaveWritten(mark, rel)) continue;
1532
1541
  let at;
1533
1542
  try {
1534
1543
  at = statSync(join(ctx.designRoot, rel)).mtimeMs;
@@ -1557,6 +1566,16 @@ async function bindBashWrites(ctx, toolUseId, mark, by, since) {
1557
1566
  );
1558
1567
  }
1559
1568
 
1569
+ /**
1570
+ * fix/ds-convert-hooks-cli #11 — may the AI's own call have written `rel`? A call of `maude design`
1571
+ * verbs only (`verbOnly`) wrote, as the AI's, just the canvases its command named (`snaps`); the rest
1572
+ * a verb or sync wrote during it is Maude's: it is not bound, and no shell mark keeps a later edit
1573
+ * from taking it as the run's base, so Stop never holds the AI to it.
1574
+ */
1575
+ const aiMayHaveWritten = (mark, rel) =>
1576
+ mark?.verbOnly !== true ||
1577
+ (!!mark.snaps && typeof mark.snaps === 'object' && Object.hasOwn(mark.snaps, rel));
1578
+
1560
1579
  /**
1561
1580
  * p8-sec2-attrib A1 — what a call that cannot claim may have written: the canvases it named, plus every
1562
1581
  * canvas lane whose bytes changed against the hashes pre-bash took (none taken: by mtime alone).
@@ -1610,6 +1629,7 @@ async function drainBackground(ctx, studio) {
1610
1629
  }
1611
1630
  // the write is the newest call's whose window it falls in
1612
1631
  const owner = marks.find((x) => at === undefined || sinceOf(x) <= at) ?? marks[0];
1632
+ if (!aiMayHaveWritten(owner.m, rel)) continue;
1613
1633
  const by = typeof owner.m.by === 'string' ? owner.m.by : 'main';
1614
1634
  recordTouch(ctx, rel, { by, via: 'bash', artboards: null, at });
1615
1635
  markShellWrite(ctx, rel); // F4 — no base taken after this write
@@ -39,26 +39,51 @@ export function rootIdentity(root) {
39
39
 
40
40
  /** `{ port, base }` of the studio serving `root`, or null. Never throws. */
41
41
  export async function locateStudio(root, { timeoutMs = 300 } = {}) {
42
+ return (await probeStudio(root, { timeoutMs })).studio ?? null;
43
+ }
44
+
45
+ /**
46
+ * fix/ds-convert-hooks-cli #13 — `locateStudio` that tells "not running" from "busy": a live
47
+ * server whose `/_health` did not answer within `timeoutMs` is retried (`attempts` in all, with
48
+ * `retryDelayMs` between) and, still silent, reported `{ state: 'busy' }` — a studio under load
49
+ * (an export, a big sync) is not "no studio". `{ studio }`, `{ state: 'none' }` or
50
+ * `{ state: 'busy' }`. Never throws.
51
+ */
52
+ export async function probeStudio(
53
+ root,
54
+ { timeoutMs = 300, attempts = 1, retryDelayMs = 250 } = {}
55
+ ) {
56
+ let port;
42
57
  try {
43
58
  const info = JSON.parse(readFileSync(join(root, DESIGN_REL, '_server.json'), 'utf8'));
44
- const port = Number(info?.port);
45
- if (!Number.isInteger(port) || port < 1 || port > 65535) return null;
59
+ port = Number(info?.port);
60
+ if (!Number.isInteger(port) || port < 1 || port > 65535) return { state: 'none' };
46
61
  if (Number.isInteger(info?.pid)) {
47
62
  try {
48
63
  process.kill(info.pid, 0);
49
64
  } catch (e) {
50
- if (e?.code !== 'EPERM') return null; // a dead server's file
65
+ if (e?.code !== 'EPERM') return { state: 'none' }; // a dead server's file
51
66
  }
52
67
  }
53
- const base = `http://127.0.0.1:${port}`;
54
- const res = await fetch(`${base}/_health`, { signal: AbortSignal.timeout(timeoutMs) });
55
- if (!res.ok) return null;
56
- const health = await res.json();
57
- if (health?.app !== 'design' || health.rootId !== rootIdentity(root)) return null;
58
- return { port, base, health };
59
68
  } catch {
60
- return null;
69
+ return { state: 'none' };
70
+ }
71
+ const base = `http://127.0.0.1:${port}`;
72
+ for (let i = 0; i < Math.max(1, attempts); i++) {
73
+ if (i > 0) await new Promise((r) => setTimeout(r, retryDelayMs));
74
+ try {
75
+ const res = await fetch(`${base}/_health`, { signal: AbortSignal.timeout(timeoutMs) });
76
+ if (!res.ok) return { state: 'none' };
77
+ const health = await res.json();
78
+ if (health?.app !== 'design' || health.rootId !== rootIdentity(root))
79
+ return { state: 'none' };
80
+ return { studio: { port, base, health } };
81
+ } catch (e) {
82
+ // only a timeout is "busy": a refused connection is no server on that port
83
+ if (e?.name !== 'TimeoutError' && e?.name !== 'AbortError') return { state: 'none' };
84
+ }
61
85
  }
86
+ return { state: 'busy' };
62
87
  }
63
88
 
64
89
  /** POST JSON to a located studio. `{ status, body }`, or null on any transport failure. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agh/maude",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
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.4",
69
- "@1agh/maude-darwin-x64": "2.0.4",
70
- "@1agh/maude-linux-arm64": "2.0.4",
71
- "@1agh/maude-linux-arm64-musl": "2.0.4",
72
- "@1agh/maude-linux-x64": "2.0.4",
73
- "@1agh/maude-linux-x64-musl": "2.0.4",
74
- "@1agh/maude-win32-x64": "2.0.4"
68
+ "@1agh/maude-darwin-arm64": "2.0.6",
69
+ "@1agh/maude-darwin-x64": "2.0.6",
70
+ "@1agh/maude-linux-arm64": "2.0.6",
71
+ "@1agh/maude-linux-arm64-musl": "2.0.6",
72
+ "@1agh/maude-linux-x64": "2.0.6",
73
+ "@1agh/maude-linux-x64-musl": "2.0.6",
74
+ "@1agh/maude-win32-x64": "2.0.6"
75
75
  },
76
76
  "files": [
77
77
  "cli",