@1agh/maude 2.0.3 → 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 (242) hide show
  1. package/README.md +6 -5
  2. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  3. package/apps/studio/access/filters.ts +12 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/access/request.ts +0 -1
  7. package/apps/studio/acp/adapter-stderr.ts +43 -13
  8. package/apps/studio/acp/background-tasks.ts +155 -0
  9. package/apps/studio/acp/bridge.ts +44 -5
  10. package/apps/studio/acp/connected-fact.ts +15 -4
  11. package/apps/studio/acp/index.ts +14 -5
  12. package/apps/studio/actions/agents.ts +10 -0
  13. package/apps/studio/actions/defs/app.ts +12 -0
  14. package/apps/studio/actions/defs/view.ts +12 -0
  15. package/apps/studio/actions.manifest.json +25 -1
  16. package/apps/studio/actions.parity.json +13 -1
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/text-style.ts +1 -1
  20. package/apps/studio/annotations-layer.tsx +0 -12
  21. package/apps/studio/api.ts +73 -24
  22. package/apps/studio/artboard-live-gate.tsx +267 -0
  23. package/apps/studio/artboard-live.ts +336 -0
  24. package/apps/studio/artboard-webgl.ts +668 -0
  25. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  26. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  27. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  28. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  29. package/apps/studio/bin/_ds-check.mjs +4 -1
  30. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  31. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  32. package/apps/studio/bin/_import-asset.mjs +2 -1
  33. package/apps/studio/bin/_perf-probe.mjs +2 -1
  34. package/apps/studio/bin/_png-playwright.mjs +10 -1
  35. package/apps/studio/bin/_pw-launch.mjs +14 -0
  36. package/apps/studio/bin/_studio-verb.mjs +24 -3
  37. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  38. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  39. package/apps/studio/bin/_thumbs-playwright.mjs +93 -13
  40. package/apps/studio/bin/ds-check.sh +5 -1
  41. package/apps/studio/bin/perf.sh +11 -1
  42. package/apps/studio/bin/server-up.sh +7 -2
  43. package/apps/studio/bin/smoke.sh +19 -0
  44. package/apps/studio/boot-progress.ts +31 -0
  45. package/apps/studio/canvas-build-sandbox.ts +275 -42
  46. package/apps/studio/canvas-build-worker.ts +10 -0
  47. package/apps/studio/canvas-create.ts +24 -0
  48. package/apps/studio/canvas-lib.tsx +131 -12
  49. package/apps/studio/canvas-module-cache.ts +93 -0
  50. package/apps/studio/canvas-source/errors.ts +39 -0
  51. package/apps/studio/canvas-source/waiting.ts +290 -0
  52. package/apps/studio/client/actions/shell-key-handlers.js +5 -0
  53. package/apps/studio/client/app.jsx +19 -9
  54. package/apps/studio/client/canvas-url.js +13 -0
  55. package/apps/studio/client/github.js +23 -3
  56. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  57. package/apps/studio/client/home/Shelves.jsx +4 -3
  58. package/apps/studio/client/home/home-accounts-model.js +121 -0
  59. package/apps/studio/client/home/home-api.js +36 -19
  60. package/apps/studio/client/home/home-app.jsx +141 -40
  61. package/apps/studio/client/home/home-model.js +172 -6
  62. package/apps/studio/client/home/home.css +169 -5
  63. package/apps/studio/client/home/shell-mode.js +8 -1
  64. package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
  65. package/apps/studio/client/hooks/use-project-data.jsx +2 -0
  66. package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
  67. package/apps/studio/client/hooks/use-tabs.jsx +64 -35
  68. package/apps/studio/client/index-loader.ts +23 -3
  69. package/apps/studio/client/panels/ChatPanel.jsx +49 -57
  70. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  71. package/apps/studio/client/panels/DiffView.jsx +314 -248
  72. package/apps/studio/client/panels/TeamProjects.jsx +119 -69
  73. package/apps/studio/client/panels/acp-runtime.js +25 -0
  74. package/apps/studio/client/panels/caps-cache.js +46 -0
  75. package/apps/studio/client/panels/chat-finish.js +66 -0
  76. package/apps/studio/client/shell/frame-cap.js +53 -0
  77. package/apps/studio/client/shell/viewport.jsx +45 -8
  78. package/apps/studio/client/styles/_index.css +2 -0
  79. package/apps/studio/client/tree/tree.jsx +48 -21
  80. package/apps/studio/client/v2/access/access-client.js +2 -0
  81. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  82. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  83. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  84. package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
  85. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  86. package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
  87. package/apps/studio/client/v2/ai/ai-run.css +87 -3
  88. package/apps/studio/client/v2/ai/background-model.js +113 -0
  89. package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
  90. package/apps/studio/client/v2/ai/run-api.js +7 -3
  91. package/apps/studio/client/v2/ai/runs-store.js +2 -1
  92. package/apps/studio/client/v2/annotations/vote-store.js +11 -5
  93. package/apps/studio/client/v2/assets/asset-state-lane.js +6 -3
  94. package/apps/studio/client/v2/assets/assets-bus.js +10 -8
  95. package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
  96. package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
  97. package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
  98. package/apps/studio/client/v2/assets/spotlight.css +153 -0
  99. package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
  100. package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
  101. package/apps/studio/client/v2/assets/tile.jsx +3 -0
  102. package/apps/studio/client/v2/assets/use-assets.js +2 -1
  103. package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
  104. package/apps/studio/client/v2/canvases/covers.js +11 -5
  105. package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
  106. package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
  107. package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
  108. package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
  109. package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
  110. package/apps/studio/client/v2/canvases/use-pins.js +2 -1
  111. package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
  112. package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
  113. package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
  114. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
  115. package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
  116. package/apps/studio/client/v2/code/code-bus.js +5 -0
  117. package/apps/studio/client/v2/code/code.css +67 -0
  118. package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
  119. package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
  120. package/apps/studio/client/v2/create/name-dialog.css +10 -0
  121. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -23
  122. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  123. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  124. package/apps/studio/client/v2/ds/make-host.jsx +13 -12
  125. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -16
  126. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  127. package/apps/studio/client/v2/ds/truth-host.jsx +15 -14
  128. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  129. package/apps/studio/client/v2/empty/arriving.jsx +29 -12
  130. package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
  131. package/apps/studio/client/v2/empty/not-local.jsx +31 -1
  132. package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
  133. package/apps/studio/client/v2/export/last-finished.js +2 -1
  134. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  135. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  136. package/apps/studio/client/v2/history/git-model.js +21 -5
  137. package/apps/studio/client/v2/history/git-parts.jsx +76 -43
  138. package/apps/studio/client/v2/history/history.css +6 -0
  139. package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
  140. package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
  141. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
  142. package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
  143. package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
  144. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  145. package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
  146. package/apps/studio/client/v2/search/search-recent.js +3 -1
  147. package/apps/studio/client/v2/search/search-remote.js +6 -4
  148. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  149. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  150. package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
  151. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  152. package/apps/studio/client/v2/shell/menu-runner.js +12 -0
  153. package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
  154. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  155. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  156. package/apps/studio/client/v2/shell/recovery-store.js +2 -1
  157. package/apps/studio/client/v2/shell/served-routes.js +120 -0
  158. package/apps/studio/client/v2/shell/share-cluster-host.jsx +139 -11
  159. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  160. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  161. package/apps/studio/client/v2/shell/shell-activity.js +19 -0
  162. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  163. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  164. package/apps/studio/client/v2/shell/use-account.js +8 -1
  165. package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
  166. package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
  167. package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
  168. package/apps/studio/cloud/endpoints.ts +23 -1
  169. package/apps/studio/collab/persistence.ts +9 -1
  170. package/apps/studio/collab/registry.ts +32 -0
  171. package/apps/studio/collab/room.ts +8 -0
  172. package/apps/studio/config-reload-wire.ts +53 -0
  173. package/apps/studio/dist/client.bundle.js +1098 -1102
  174. package/apps/studio/dist/styles.css +1 -1
  175. package/apps/studio/ds/board/specimen.tsx +12 -1
  176. package/apps/studio/ds/canvas-cli.ts +58 -2
  177. package/apps/studio/ds/check.ts +26 -1
  178. package/apps/studio/ds/cli.ts +7 -3
  179. package/apps/studio/ds/convert.ts +34 -6
  180. package/apps/studio/ds/ds-verb.ts +13 -0
  181. package/apps/studio/ds/post-build.ts +38 -0
  182. package/apps/studio/ds/upgrade-apply.ts +27 -5
  183. package/apps/studio/ds/upgrade-cli.ts +22 -2
  184. package/apps/studio/ds/upgrade-prove.ts +198 -15
  185. package/apps/studio/ds/upgrade-stage.ts +4 -1
  186. package/apps/studio/editing/minimap-context.tsx +3 -3
  187. package/apps/studio/editing/page-activity.ts +251 -0
  188. package/apps/studio/editing/rotate-handle.tsx +9 -5
  189. package/apps/studio/editing/sticky-name.tsx +4 -4
  190. package/apps/studio/history/restore-artboard-action.ts +40 -0
  191. package/apps/studio/history/trash.ts +6 -0
  192. package/apps/studio/home/accounts.ts +87 -0
  193. package/apps/studio/home/hub.ts +77 -175
  194. package/apps/studio/home/index-reader.ts +24 -2
  195. package/apps/studio/home/routes.ts +66 -8
  196. package/apps/studio/http.ts +131 -68
  197. package/apps/studio/index-flight.ts +40 -0
  198. package/apps/studio/managed-projects.ts +52 -24
  199. package/apps/studio/migrate/hub.ts +7 -1
  200. package/apps/studio/routes/canvas-source.ts +44 -2
  201. package/apps/studio/routes/ds-convert.ts +18 -0
  202. package/apps/studio/routes/history.ts +28 -5
  203. package/apps/studio/routes/hub-signin.ts +115 -0
  204. package/apps/studio/routes/index.ts +4 -0
  205. package/apps/studio/routes/table.ts +7 -0
  206. package/apps/studio/routes/trash.ts +19 -1
  207. package/apps/studio/server.ts +19 -10
  208. package/apps/studio/sync/accepted-cold-start.ts +54 -16
  209. package/apps/studio/sync/accepted-link.ts +9 -4
  210. package/apps/studio/sync/asset-push.ts +146 -23
  211. package/apps/studio/sync/asset-state.ts +3 -2
  212. package/apps/studio/sync/code-module-consent.ts +74 -0
  213. package/apps/studio/sync/file-ledger.ts +35 -0
  214. package/apps/studio/sync/file-membership.ts +28 -3
  215. package/apps/studio/sync/file-plane.ts +483 -86
  216. package/apps/studio/sync/file-pull.ts +304 -33
  217. package/apps/studio/sync/hub-browser-signin.ts +377 -0
  218. package/apps/studio/sync/hub-link.ts +1 -2
  219. package/apps/studio/sync/hub-text-undo.ts +30 -10
  220. package/apps/studio/sync/index.ts +381 -161
  221. package/apps/studio/sync/journal-client.ts +94 -5
  222. package/apps/studio/sync/pending-deletes.ts +100 -0
  223. package/apps/studio/sync/projection.ts +121 -14
  224. package/apps/studio/sync/pull-pacer.ts +160 -0
  225. package/apps/studio/sync/pull-priority.ts +119 -0
  226. package/apps/studio/sync/seed-progress.ts +58 -3
  227. package/apps/studio/sync/status.ts +3 -1
  228. package/apps/studio/sync/transaction-client.ts +71 -6
  229. package/apps/studio/sync/workspace-signin.ts +6 -256
  230. package/apps/studio/sync/writer-registry.ts +5 -1
  231. package/apps/studio/thumbs/service.ts +12 -2
  232. package/apps/studio/thumbs/validate.ts +7 -0
  233. package/apps/studio/ui-prefs-migrate.ts +4 -0
  234. package/apps/studio/video-comp.tsx +23 -0
  235. package/apps/studio/video-links-overlay.tsx +3 -2
  236. package/apps/studio/whats-new.json +126 -0
  237. package/cli/lib/bash-guard.mjs +13 -1
  238. package/cli/lib/design-help.gen.mjs +1 -1
  239. package/cli/lib/design-hook.mjs +20 -0
  240. package/cli/lib/studio-locate.mjs +35 -10
  241. package/cli/lib/workspace-plan.mjs +14 -0
  242. package/package.json +8 -8
@@ -8,6 +8,7 @@
8
8
  // no index (an older server, a cloud tab that does not serve it) the panel is simply without badges.
9
9
 
10
10
  import { useEffect, useRef, useState } from 'react';
11
+ import { fetchIfServed } from '../shell/served-routes.js';
11
12
 
12
13
  /** The shell's relay of the socket's `index-changed { seq, rels }` (client/app.jsx). */
13
14
  export const INDEX_CHANGED_EVENT = 'maude:index-changed';
@@ -23,27 +24,50 @@ export function useCanvasIndex({ stamp, fetchImpl } = {}) {
23
24
  const fetchRef = useRef(fetchImpl || ((...a) => fetch(...a)));
24
25
  fetchRef.current = fetchImpl || fetchRef.current;
25
26
  const seq = useRef(0);
26
-
27
- // biome-ignore lint/correctness/useExhaustiveDependencies: `stamp` and `moved` are the "something changed" signals
27
+ // #204 R — ONE read at a time. A change that lands while a read is out asks once more after it (with
28
+ // `?since=`), instead of dropping that answer and asking the whole index again: on boot the tree stamp
29
+ // moves several times inside the first read, and each move used to discard it and ask anew (7 full reads
30
+ // per load against a cell, where the route is withheld anyway — `fetchIfServed` no longer asks it there).
31
+ const flight = useRef({ busy: false, again: false, alive: true });
28
32
  useEffect(() => {
29
- let cancelled = false;
30
- const t = setTimeout(async () => {
31
- try {
32
- const url = seq.current ? `/_api/index?since=${seq.current}` : '/_api/index';
33
- const r = await fetchRef.current(url, { cache: 'no-store' });
34
- if (!r.ok || cancelled) return;
35
- const data = await r.json();
36
- if (cancelled || data?.unchanged || !Array.isArray(data?.canvases)) return;
37
- seq.current = data.writer?.seq || 0;
38
- setSnapshot(data);
39
- } catch {
40
- /* no index: no badges */
41
- }
42
- }, 200);
33
+ const f = flight.current;
34
+ f.alive = true;
43
35
  return () => {
44
- cancelled = true;
45
- clearTimeout(t);
36
+ f.alive = false;
46
37
  };
38
+ }, []);
39
+ const read = useRef(null);
40
+ read.current ??= async () => {
41
+ const f = flight.current;
42
+ if (f.busy) {
43
+ f.again = true;
44
+ return;
45
+ }
46
+ f.busy = true;
47
+ try {
48
+ do {
49
+ f.again = false;
50
+ const url = seq.current ? `/_api/index?since=${seq.current}` : '/_api/index';
51
+ const r = await fetchIfServed(url, { cache: 'no-store' }, fetchRef.current);
52
+ if (!r.ok || !f.alive) break; // not here (or refused): asking again cannot help
53
+ const data = await r.json();
54
+ if (!f.alive) break;
55
+ if (!data?.unchanged && Array.isArray(data?.canvases)) {
56
+ seq.current = data.writer?.seq || 0;
57
+ setSnapshot(data);
58
+ }
59
+ } while (f.again);
60
+ } catch {
61
+ /* no index: no badges */
62
+ } finally {
63
+ f.busy = false;
64
+ }
65
+ };
66
+
67
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `stamp` and `moved` are the "something changed" signals
68
+ useEffect(() => {
69
+ const t = setTimeout(() => read.current(), 200);
70
+ return () => clearTimeout(t);
47
71
  }, [stamp, moved]);
48
72
 
49
73
  return snapshot;
@@ -7,6 +7,7 @@
7
7
  // "Recently opened" sort uses it when it is there and falls back to when a canvas last changed.
8
8
 
9
9
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
10
+ import { fetchIfServed } from '../shell/served-routes.js';
10
11
 
11
12
  /** The list with `rel` pinned or unpinned — a new array, pin order kept (oldest first). */
12
13
  export function withPin(pins, rel, pinned, at = Date.now()) {
@@ -34,7 +35,7 @@ export function usePins({ stamp, fetchImpl } = {}) {
34
35
 
35
36
  const load = useCallback(async () => {
36
37
  try {
37
- const r = await fetchRef.current('/_api/pins', { cache: 'no-store' });
38
+ const r = await fetchIfServed('/_api/pins', { cache: 'no-store' }, fetchRef.current);
38
39
  if (!r.ok) return;
39
40
  setState({ ...normalisePins(await r.json()), loaded: true });
40
41
  } catch {
@@ -21,7 +21,10 @@ import { useEffect, useRef, useState } from 'react';
21
21
  import { StIcon } from '../../shell/icons.jsx';
22
22
  import { AdvancedFold } from '../fold/advanced-fold.jsx';
23
23
  import { Check, Copy, Spark } from '../ai/icons.jsx';
24
+ import { INDEX_CHANGED_EVENT } from '../canvases/use-canvas-index.js';
24
25
  import { projectRel } from '../shell/native-doors.js';
26
+ import { BUILD_FAILURE_BODY, buildFailureReason } from './canvas-waiting.js';
27
+ import { CanvasBuildingCard, CanvasWaitingCard } from './canvas-waiting-card.jsx';
25
28
  import { registerErrorCard } from './code-bus.js';
26
29
  import {
27
30
  askAiText,
@@ -36,6 +39,8 @@ import {
36
39
  } from './use-canvas-source.js';
37
40
 
38
41
  const pad2 = (n) => String(n).padStart(2, '0');
42
+ /** 2.0.4 — the waiting card re-asks this often (a landed file re-asks at once, via the index). */
43
+ export const WAITING_WATCH_MS = 4000;
39
44
  const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
40
45
 
41
46
  /** "14:05" (24 hour, local). */
@@ -53,7 +58,7 @@ export function whenLabel(at) {
53
58
  }
54
59
 
55
60
  /** The card's sentence under the title. */
56
- export function cardBody({ kind, error, lastGood }) {
61
+ export function cardBody({ kind, error, lastGood, buildFailure = null }) {
57
62
  const tail = 'Other canvases are fine; the last good version is in Version history.';
58
63
  if (kind === 'render') {
59
64
  const when = lastGood ? whenLabel(lastGood.at) : '';
@@ -62,6 +67,8 @@ export function cardBody({ kind, error, lastGood }) {
62
67
  : "The last change has a mistake the canvas can't show. Nothing is lost; every version stays in Version history.";
63
68
  }
64
69
  // 01 cf-render-error: the body is one plain sentence; the error and the line live under Show details
70
+ // #189 — the build stopped on the app's side (engine, time, memory, refused imports): not the code
71
+ if (!error && buildFailure) return BUILD_FAILURE_BODY;
65
72
  // the load gave up and the server knows of no mistake in the code: say that, not a guess about it
66
73
  if (!error)
67
74
  return "It didn't finish loading. Nothing is lost. Reload the canvas, or ask AI to look.";
@@ -143,10 +150,14 @@ export function CanvasErrorCard({
143
150
  onReload,
144
151
  onCopy,
145
152
  askAiAvailable = true,
153
+ /** #189 — the build stopped outside the code (`{ class, count? }`): no Ask AI, the reason under the fold. */
154
+ buildFailure = null,
146
155
  /** The fold starts open (a test / a caller that wants the details up front). */
147
156
  detailsOpen = false,
148
157
  }) {
149
158
  const [open, setOpen] = useState(detailsOpen);
159
+ // AI can't fix the app's own build: Ask AI is offered only when the cause may be the code
160
+ const offerAi = askAiAvailable && !(buildFailure && !error);
150
161
  const name = canvasTitle(canvas);
151
162
  const where = whereLabel(error);
152
163
  const excerpt = excerptOf(error, lines);
@@ -155,7 +166,16 @@ export function CanvasErrorCard({
155
166
  // The registry's three card actions (canvas.copy-error · canvas.ask-ai-fix · canvas.last-good) reach the
156
167
  // card that is showing through the bus; a ref keeps the newest props without re-registering.
157
168
  const live = useRef({});
158
- live.current = { canvas, kind, error, lastGood, onAskAi, onGoBack, onCopy, askAiAvailable };
169
+ live.current = {
170
+ canvas,
171
+ kind,
172
+ error,
173
+ lastGood,
174
+ onAskAi,
175
+ onGoBack,
176
+ onCopy,
177
+ askAiAvailable: offerAi,
178
+ };
159
179
  useEffect(
160
180
  () =>
161
181
  registerErrorCard({
@@ -191,7 +211,7 @@ export function CanvasErrorCard({
191
211
  </h2>
192
212
  </header>
193
213
  <p className="v2-err-d" data-testid="canvas-error-body">
194
- {cardBody({ kind, error, lastGood })}
214
+ {cardBody({ kind, error, lastGood, buildFailure })}
195
215
  </p>
196
216
  {lastGood ? (
197
217
  <p className="v2-err-lg" data-testid="canvas-error-last-good-line">
@@ -209,7 +229,7 @@ export function CanvasErrorCard({
209
229
  {clock ? `Go back to ${clock}` : 'Go back'}
210
230
  </button>
211
231
  ) : null}
212
- {askAiAvailable && onAskAi ? (
232
+ {offerAi && onAskAi ? (
213
233
  <button
214
234
  type="button"
215
235
  className="btn btn--sm btn--spark"
@@ -247,6 +267,13 @@ export function CanvasErrorCard({
247
267
  ) : null}
248
268
  <ErrorExcerpt excerpt={excerpt} />
249
269
  </>
270
+ ) : buildFailure ? (
271
+ <div className="v2-err-row">
272
+ <span className="v2-err-k">Reason</span>
273
+ <span className="v2-err-v" data-testid="canvas-error-build-reason">
274
+ {buildFailureReason(buildFailure)}
275
+ </span>
276
+ </div>
250
277
  ) : (
251
278
  <p className="v2-err-none" data-testid="canvas-error-none">
252
279
  No details were reported. Reload the canvas, or ask AI to look.
@@ -359,10 +386,44 @@ export function CanvasLoadFailure({
359
386
  onNotify,
360
387
  onCopy,
361
388
  fetchImpl,
389
+ /** How often the waiting card re-asks (a file landing also re-asks at once). */
390
+ watchMs = WAITING_WATCH_MS,
362
391
  }) {
363
- const err = useCanvasError({ canvas, fetchImpl });
392
+ const [stamp, setStamp] = useState(0);
393
+ const err = useCanvasError({ canvas, stamp, quiet: true, fetchImpl });
364
394
  const ghosts = useGhostBoxes({ canvas, fetchImpl });
365
395
  const error = err.status === 'ok' ? err.error : null;
396
+ const waiting = err.status === 'ok' ? err.waiting : null;
397
+ const buildFailure = err.status === 'ok' ? err.buildFailure : null;
398
+ // 2.0.4 task P — its build is still running on the server (no file is missing, nothing failed)
399
+ const building = err.status === 'ok' && !error && !waiting && err.building === true;
400
+ // 2.0.4 — while it waits for files (or, task P, for its build), watch: re-ask when the project index
401
+ // moves (a file landed) and on a modest timer, and load the canvas by itself the moment nothing is
402
+ // missing any more. This is not a retry of a failure (CONTRACT C20): the cause it named went away.
403
+ const waitingNow = !!waiting || building;
404
+ useEffect(() => {
405
+ if (!waitingNow) return undefined;
406
+ const again = () => setStamp((n) => n + 1);
407
+ const timer = setInterval(again, watchMs);
408
+ globalThis.addEventListener?.(INDEX_CHANGED_EVENT, again);
409
+ return () => {
410
+ clearInterval(timer);
411
+ globalThis.removeEventListener?.(INDEX_CHANGED_EVENT, again);
412
+ };
413
+ }, [waitingNow, watchMs]);
414
+ const wasWaiting = useRef(false);
415
+ const reloadRef = useRef(onReload);
416
+ reloadRef.current = onReload;
417
+ useEffect(() => {
418
+ if (err.status !== 'ok') return;
419
+ if (err.waiting || (err.building && !err.error)) wasWaiting.current = true;
420
+ else if (wasWaiting.current) {
421
+ wasWaiting.current = false;
422
+ // a build that stopped (past its ceiling, out of memory …) stays on the card that says why: a
423
+ // reload would only start the same build again
424
+ if (!err.buildFailure && !err.error) reloadRef.current?.();
425
+ }
426
+ }, [err]);
366
427
  // Context lines come from the source — for people who may read it (Can view gets the one quoted line).
367
428
  const src = useCanvasSource({ canvas, enabled: !!error?.line, fetchImpl });
368
429
  const lines = src.status === 'ok' ? src.lines : null;
@@ -387,6 +448,9 @@ export function CanvasLoadFailure({
387
448
  </p>
388
449
  );
389
450
  }
451
+ // files it imports haven't reached this Mac, or are held back: not a mistake in its code
452
+ if (waiting) return <CanvasWaitingCard canvas={canvas} waiting={waiting} />;
453
+ if (building) return <CanvasBuildingCard canvas={canvas} />;
390
454
  return (
391
455
  <>
392
456
  <LastGoodGhosts boxes={ghosts} />
@@ -401,6 +465,7 @@ export function CanvasLoadFailure({
401
465
  onGoBack={canEdit ? goBack : undefined}
402
466
  onReload={onReload}
403
467
  onCopy={onCopy}
468
+ buildFailure={buildFailure}
404
469
  />
405
470
  </>
406
471
  );
@@ -6,25 +6,26 @@
6
6
  // (`/_index-data` `canvasImportsCanvases`, canvas-url.js `canvasImportsOf`) and says so on the stage
7
7
  // (shell/viewport.jsx), in place of the generic "can't be drawn" card. What happened · what to do; no
8
8
  // action — the fix is in the code (move the shared part into a component file).
9
+ //
10
+ // 2.0.5 (#205): a walk the closure did not block can still be refused AFTER the build, when the module inlined
11
+ // a design-root file the frame does not admit (http.ts `canvasInputsGate`). The server keeps those files per
12
+ // canvas and the index reports them (`canvasRefusedInputs`, canvas-url.js `canvasRefusedOf`): the card names
13
+ // them too — "This canvas uses <file>, which belongs to another canvas."
9
14
 
10
- /** The card's two lines. `imports`: designRoot-relative names the viewer may see (may be empty). */
11
- export function canvasImportsText(imports, componentDir) {
12
- const names = Array.isArray(imports) ? imports.filter((x) => typeof x === 'string' && x) : [];
13
- const dir =
14
- String(componentDir || 'ui/components').replace(/^\.?\/+|\/+$/g, '') || 'ui/components';
15
- return {
16
- title: names.length
17
- ? `This canvas imports another canvas (${names.join(', ')}).`
18
- : 'This canvas imports another canvas.',
19
- body: `Move the shared part into a component file (e.g. ${dir}/…) to render it here.`,
20
- };
21
- }
15
+ import { canvasImportsText } from './canvas-imports-words.js';
16
+
17
+ export { canvasImportsText };
22
18
 
23
- export function CanvasImportsCard({ imports, componentDir }) {
24
- const { title, body } = canvasImportsText(imports, componentDir);
19
+ export function CanvasImportsCard({ imports, refused, componentDir }) {
20
+ const { title, also, body } = canvasImportsText(imports, componentDir, refused);
25
21
  return (
26
22
  <div className="sh-canvas-error-card" data-testid="canvas-imports-card">
27
23
  <div className="sh-canvas-error-title">{title}</div>
24
+ {also.map((line) => (
25
+ <div key={line} className="sh-canvas-error-body">
26
+ {line}
27
+ </div>
28
+ ))}
28
29
  <div className="sh-canvas-error-body">{body}</div>
29
30
  </div>
30
31
  );
@@ -0,0 +1,44 @@
1
+ // client/v2/code/canvas-imports-words.js — the words for a canvas whose frame refuses its module because it
2
+ // reaches another canvas's code (gate-b-c4j) or, 2.0.5 (#205), because its built module inlined a file another
3
+ // canvas owns. Pure: the shell's card (canvas-imports-card.jsx), `maude design ds-check` (ds/canvas-cli.ts) and
4
+ // `/design:smoke` (bin/_canvas-reasons.mjs) say the same thing.
5
+
6
+ /** "a.tsx", "a.tsx and b.tsx", "a.tsx, b.tsx and c.tsx" */
7
+ function listWords(names) {
8
+ if (names.length < 2) return names[0] ?? '';
9
+ return `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
10
+ }
11
+
12
+ const namesOf = (list) =>
13
+ Array.isArray(list) ? list.filter((x) => typeof x === 'string' && x) : [];
14
+
15
+ /**
16
+ * The card's lines. `imports`: designRoot-relative canvases it imports that the viewer may see (may be empty);
17
+ * `refused` (2.0.5, #205): the design-root files its built module was refused for — a file another canvas owns.
18
+ * `title` is the first reason, `also` the other one (when both are on record), `body` what to do.
19
+ */
20
+ export function canvasImportsText(imports, componentDir, refused = []) {
21
+ const names = namesOf(imports);
22
+ const uses = namesOf(refused);
23
+ const dir =
24
+ String(componentDir || 'ui/components').replace(/^\.?\/+|\/+$/g, '') || 'ui/components';
25
+ const importsLine = names.length
26
+ ? `This canvas imports another canvas (${names.join(', ')}).`
27
+ : 'This canvas imports another canvas.';
28
+ const usesLine = uses.length
29
+ ? `This canvas uses ${listWords(uses)}, which ${uses.length > 1 ? 'belong' : 'belongs'} to another canvas.`
30
+ : null;
31
+ const lines = names.length || !usesLine ? [importsLine, usesLine] : [usesLine];
32
+ const [title, ...also] = lines.filter(Boolean);
33
+ return {
34
+ title,
35
+ also,
36
+ body: `Move the shared part into a component file (e.g. ${dir}/…) to render it here.`,
37
+ };
38
+ }
39
+
40
+ /** The card's words as plain lines (title, the other reason, what to do) — for a terminal or a report. */
41
+ export function canvasImportsLines(imports, componentDir, refused = []) {
42
+ const { title, also, body } = canvasImportsText(imports, componentDir, refused);
43
+ return [title, ...also, body];
44
+ }
@@ -0,0 +1,128 @@
1
+ // client/v2/code/canvas-waiting-card.jsx — 2.0.4 task B: the card for a canvas that can't load YET,
2
+ // because files it imports haven't reached this Mac (first sync) or are held back (a refusal).
3
+ //
4
+ // waiting "Uniformy-2027 is still downloading." · a bar of the files this canvas needs (3 of 5
5
+ // files) · the project's sync (Project sync: 5,029 of 5,041 files) · the names it waits
6
+ // for (five, then "and N more"). No button: the canvas opens by itself when they land
7
+ // (CanvasLoadFailure watches and reloads it).
8
+ // refused "Uniformy-2027 can't open on this Mac yet." · why, in plain words; for the code consent,
9
+ // linking the folder again (the link asks — Settings has no per-hub consent row, and a
10
+ // Maude Cloud project opened from Home accepts by itself). No "Ask AI to fix it": AI can't change a
11
+ // sync consent, and nothing in the code is wrong.
12
+ //
13
+ // Same card frame as the broken-canvas card (`.v2-err`); the words are canvas-waiting.js's.
14
+
15
+ import { StIcon } from '../../shell/icons.jsx';
16
+ import {
17
+ BUILDING_BODY,
18
+ baseName,
19
+ buildingTitle,
20
+ fileNote,
21
+ moreCount,
22
+ needLabel,
23
+ projectLabel,
24
+ refusedFile,
25
+ SHOWN_FILES,
26
+ waitingBody,
27
+ waitingTitle,
28
+ } from './canvas-waiting.js';
29
+ import { canvasTitle } from './use-canvas-source.js';
30
+
31
+ export function CanvasWaitingCard({ canvas, waiting }) {
32
+ const name = canvasTitle(canvas);
33
+ const held = !!refusedFile(waiting);
34
+ const { need, progress } = waiting;
35
+ const shown = waiting.files.slice(0, SHOWN_FILES);
36
+ const more = moreCount(waiting);
37
+ const pct = need ? Math.round((need.here / need.total) * 100) : 0;
38
+ return (
39
+ <section
40
+ className="v2-err v2-err--waiting"
41
+ aria-labelledby="v2-err-title"
42
+ data-testid="canvas-waiting-card"
43
+ data-kind={held ? 'refused' : 'waiting'}
44
+ aria-live="polite"
45
+ >
46
+ <header className="v2-err-hd">
47
+ <span className={`v2-err-ic${held ? '' : ' v2-err-ic--calm'}`} aria-hidden="true">
48
+ <StIcon name={held ? 'lock' : 'sync'} size={20} />
49
+ </span>
50
+ <h2 className="v2-err-t" id="v2-err-title" data-testid="canvas-waiting-title">
51
+ {waitingTitle(name, waiting)}
52
+ </h2>
53
+ </header>
54
+ <p className="v2-err-d" data-testid="canvas-waiting-body">
55
+ {waitingBody(waiting)}
56
+ </p>
57
+ {need && !held ? (
58
+ <div className="v2-err-prog" data-testid="canvas-waiting-progress">
59
+ <span
60
+ className="v2-err-bar"
61
+ role="progressbar"
62
+ aria-label={`Files ${name} needs`}
63
+ aria-valuemin={0}
64
+ aria-valuemax={need.total}
65
+ aria-valuenow={need.here}
66
+ aria-valuetext={needLabel(need)}
67
+ >
68
+ <i style={{ width: `${pct}%` }} />
69
+ </span>
70
+ <span className="v2-err-prog-l">{needLabel(need)}</span>
71
+ </div>
72
+ ) : null}
73
+ {progress && !held ? (
74
+ <p className="v2-err-lg" data-testid="canvas-waiting-project">
75
+ {projectLabel(progress)}
76
+ </p>
77
+ ) : null}
78
+ {shown.length > (held ? 1 : 0) ? (
79
+ <div className="v2-err-files">
80
+ <span className="v2-err-files-h">Waiting for</span>
81
+ <ul className="v2-err-files-l" data-testid="canvas-waiting-files">
82
+ {shown.map((f) => (
83
+ <li key={f.rel} className="v2-err-file" title={f.rel}>
84
+ <span className="v2-err-file-n">{baseName(f.rel)}</span>
85
+ {fileNote(f) ? <span className="v2-err-file-s">{fileNote(f)}</span> : null}
86
+ </li>
87
+ ))}
88
+ {more > 0 ? (
89
+ <li className="v2-err-file v2-err-file--more" data-testid="canvas-waiting-more">
90
+ and {more} more
91
+ </li>
92
+ ) : null}
93
+ </ul>
94
+ </div>
95
+ ) : null}
96
+ </section>
97
+ );
98
+ }
99
+
100
+ /**
101
+ * 2.0.4 task P — its build is still running (it outlived the request that started it; a big canvas
102
+ * on a busy server). Not a failure: no Ask AI, no Reload. CanvasLoadFailure watches and loads the
103
+ * canvas by itself when the build is done; a build that died past its ceiling turns into the
104
+ * ordinary "can't be drawn" card with "The build timed out" under Show details.
105
+ */
106
+ export function CanvasBuildingCard({ canvas }) {
107
+ return (
108
+ <section
109
+ className="v2-err v2-err--waiting"
110
+ aria-labelledby="v2-err-title"
111
+ data-testid="canvas-waiting-card"
112
+ data-kind="building"
113
+ aria-live="polite"
114
+ >
115
+ <header className="v2-err-hd">
116
+ <span className="v2-err-ic v2-err-ic--calm" aria-hidden="true">
117
+ <StIcon name="sync" size={20} />
118
+ </span>
119
+ <h2 className="v2-err-t" id="v2-err-title" data-testid="canvas-waiting-title">
120
+ {buildingTitle(canvas, canvasTitle(canvas))}
121
+ </h2>
122
+ </header>
123
+ <p className="v2-err-d" data-testid="canvas-waiting-body">
124
+ {BUILDING_BODY}
125
+ </p>
126
+ </section>
127
+ );
128
+ }
@@ -0,0 +1,164 @@
1
+ // client/v2/code/canvas-waiting.js — 2.0.4 task B + #189: the words for a canvas that can't load for a
2
+ // reason that is NOT a mistake in its code. The data half; canvas-waiting-card.jsx and
3
+ // canvas-error-card.jsx only draw it.
4
+ //
5
+ // waiting files it imports haven't reached this Mac yet (first sync) — "<Canvas> is still downloading."
6
+ // refused a file it imports is held back (code from a hub this Mac hasn't accepted, too big, …)
7
+ // buildFailure the build stopped on the app's side (engine unavailable, timed out, imports refused)
8
+ // building the build is still running on the server (2.0.4 task P) — not a failure
9
+ //
10
+ // The server answers with its own state and reason WORDS (`canvas-source/waiting.ts`,
11
+ // `canvas-source/errors.ts` `BuildFailure`); anything else is dropped here, so no hub text and no
12
+ // build text is ever drawn. File names are drawn as text nodes only.
13
+
14
+ const STATES = new Set(['downloading', 'waiting', 'refused']);
15
+ const REASONS = new Set([
16
+ 'code-consent',
17
+ 'too-large',
18
+ 'quota',
19
+ 'refused',
20
+ 'retrying',
21
+ 'not-shared',
22
+ ]);
23
+ const FAILURES = new Set(['engine', 'timed-out', 'memory', 'imports-refused']);
24
+
25
+ /** Names the card lists before "and N more". */
26
+ export const SHOWN_FILES = 5;
27
+
28
+ const count = (v) => (Number.isFinite(v) && v > 0 ? Math.floor(v) : 0);
29
+
30
+ /** The server's `waiting` → the card's shape, or null (nothing it waits for). */
31
+ export function normalizeWaiting(w) {
32
+ if (!w || typeof w !== 'object' || !Array.isArray(w.files)) return null;
33
+ const files = w.files
34
+ .filter((f) => f && typeof f.rel === 'string' && f.rel && STATES.has(f.state))
35
+ .map((f) => ({
36
+ rel: f.rel.slice(0, 512),
37
+ state: f.state,
38
+ ...(REASONS.has(f.reason) ? { reason: f.reason } : {}),
39
+ }));
40
+ if (!files.length) return null;
41
+ const need =
42
+ w.need && count(w.need.total) > 0
43
+ ? { here: Math.min(count(w.need.here), count(w.need.total)), total: count(w.need.total) }
44
+ : null;
45
+ const progress =
46
+ w.progress && count(w.progress.total) > 0
47
+ ? {
48
+ delivered: Math.min(count(w.progress.delivered), count(w.progress.total)),
49
+ total: count(w.progress.total),
50
+ }
51
+ : null;
52
+ return { files, more: count(w.more), need, progress };
53
+ }
54
+
55
+ /** The server's `buildFailure` → `{ class, count? }`, or null. */
56
+ export function normalizeBuildFailure(b) {
57
+ if (!b || typeof b !== 'object' || !FAILURES.has(b.class)) return null;
58
+ return b.class === 'imports-refused'
59
+ ? { class: b.class, count: count(b.count) }
60
+ : { class: b.class };
61
+ }
62
+
63
+ /** `ui/_uniform-template.ts` → `_uniform-template.ts`. */
64
+ export const baseName = (rel) =>
65
+ String(rel ?? '')
66
+ .split('/')
67
+ .pop() || String(rel ?? '');
68
+
69
+ /** "5,041" — counts read the same on every Mac. */
70
+ export const num = (n) => count(n).toLocaleString('en-US');
71
+
72
+ /** Refused outranks waiting: the first held file decides the card, or null when nothing is held. */
73
+ export function refusedFile(waiting) {
74
+ return waiting?.files.find((f) => f.state === 'refused') ?? null;
75
+ }
76
+
77
+ /** The card's title. */
78
+ export function waitingTitle(name, waiting) {
79
+ return refusedFile(waiting)
80
+ ? `${name} can't open on this Mac yet.`
81
+ : `${name} is still downloading.`;
82
+ }
83
+
84
+ /** The card's sentence under the title: what happened · what is safe · what comes next. */
85
+ export function waitingBody(waiting) {
86
+ const held = refusedFile(waiting);
87
+ if (!held)
88
+ return "Some of its files haven't reached this Mac yet. Nothing is lost. The canvas opens by itself when they arrive.";
89
+ const file = baseName(held.rel);
90
+ switch (held.reason) {
91
+ case 'code-consent':
92
+ return `This Mac hasn't accepted shared code from this project (${file}). Nothing is lost. To allow it, link this folder to the project again and accept shared code when asked.`;
93
+ case 'too-large':
94
+ return `${file} is too big to sync, so it can't reach this Mac. Nothing is lost.`;
95
+ case 'quota':
96
+ return `This project's upload allowance is used up for now, so ${file} hasn't reached this Mac. Nothing is lost; it arrives once the allowance resets.`;
97
+ default:
98
+ return `The project's server refused ${file}, so it can't reach this Mac. Nothing is lost.`;
99
+ }
100
+ }
101
+
102
+ /** The quiet note beside one listed file (none for a plain download). */
103
+ export function fileNote(f) {
104
+ if (f.state === 'refused') return 'held back';
105
+ if (f.reason === 'retrying') return 'retrying';
106
+ if (f.reason === 'not-shared') return 'not shared yet';
107
+ if (f.state === 'waiting') return 'waiting';
108
+ return '';
109
+ }
110
+
111
+ /** "3 of 5 files" for the canvas's bar. */
112
+ export function needLabel(need) {
113
+ return need
114
+ ? `${num(need.here)} of ${num(need.total)} ${need.total === 1 ? 'file' : 'files'}`
115
+ : '';
116
+ }
117
+
118
+ /** "Project sync: 5,029 of 5,041 files". */
119
+ export function projectLabel(progress) {
120
+ return progress
121
+ ? `Project sync: ${num(progress.delivered)} of ${num(progress.total)} ${progress.total === 1 ? 'file' : 'files'}`
122
+ : '';
123
+ }
124
+
125
+ /** How many names past the first five ("and 3 more"). */
126
+ export function moreCount(waiting) {
127
+ return Math.max(0, (waiting?.files.length ?? 0) - SHOWN_FILES) + (waiting?.more ?? 0);
128
+ }
129
+
130
+ // ── 2.0.4 task P: a build that is still running ──────────────────────────────────────────────────
131
+
132
+ /** The Design system canvas: `system/<ds>/design-system.tsx` (designRoot- or repo-relative). */
133
+ const DS_BOARD_RE = /(?:^|\/)system\/[^/]+\/design-system\.tsx$/;
134
+
135
+ /** The building card's title: the design system by its role, any other canvas by its name. */
136
+ export function buildingTitle(canvas, name) {
137
+ return DS_BOARD_RE.test(String(canvas ?? ''))
138
+ ? 'Building the design system…'
139
+ : `Building ${name}…`;
140
+ }
141
+
142
+ export const BUILDING_BODY =
143
+ "This can take a minute on a big project. Nothing is lost. The canvas opens by itself when it's ready.";
144
+
145
+ // ── #189: a build that stopped on the app's side ─────────────────────────────────────────────────
146
+
147
+ export const BUILD_FAILURE_BODY =
148
+ "It couldn't be built, and the cause is on the app's side, not in its code. Nothing is lost.";
149
+
150
+ /** The reason class under Show details, in words. */
151
+ export function buildFailureReason(b) {
152
+ switch (b?.class) {
153
+ case 'engine':
154
+ return 'The build engine is unavailable';
155
+ case 'timed-out':
156
+ return 'The build timed out';
157
+ case 'memory':
158
+ return 'The build ran out of memory';
159
+ case 'imports-refused':
160
+ return `${num(b.count)} ${b.count === 1 ? 'import' : 'imports'} refused`;
161
+ default:
162
+ return '';
163
+ }
164
+ }
@@ -47,6 +47,11 @@ export function registerErrorCard(handlers) {
47
47
  return () => cards.delete(key);
48
48
  }
49
49
 
50
+ /** Whether a broken-canvas card is showing (2.0.5: the design-system slow read waits while one is). */
51
+ export function errorCardShown() {
52
+ return cards.size > 0;
53
+ }
54
+
50
55
  /** Run `op` ('copy' | 'ask-ai' | 'last-good') on the newest mounted card. @returns whether one answered */
51
56
  export function runErrorOp(op) {
52
57
  const handlers = [...cards.values()].at(-1);