@1agh/maude 2.0.2 → 2.0.4

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 (154) hide show
  1. package/README.md +6 -5
  2. package/apps/studio/access/request.ts +0 -1
  3. package/apps/studio/acp/adapter-stderr.ts +43 -13
  4. package/apps/studio/acp/background-tasks.ts +155 -0
  5. package/apps/studio/acp/bridge.ts +44 -5
  6. package/apps/studio/acp/connected-fact.ts +15 -4
  7. package/apps/studio/acp/index.ts +14 -5
  8. package/apps/studio/actions/agents.ts +5 -0
  9. package/apps/studio/actions/defs/view.ts +12 -0
  10. package/apps/studio/actions.manifest.json +13 -1
  11. package/apps/studio/actions.parity.json +7 -1
  12. package/apps/studio/api.ts +31 -24
  13. package/apps/studio/asset-placeholder.tsx +157 -62
  14. package/apps/studio/bin/_png-playwright.mjs +10 -1
  15. package/apps/studio/bin/_pw-launch.mjs +14 -0
  16. package/apps/studio/bin/_thumbs-playwright.mjs +4 -1
  17. package/apps/studio/boot-progress.ts +31 -0
  18. package/apps/studio/bridge/dgn-protocol.ts +34 -4
  19. package/apps/studio/canvas-build-sandbox.ts +275 -42
  20. package/apps/studio/canvas-build-worker.ts +10 -0
  21. package/apps/studio/canvas-create.ts +24 -0
  22. package/apps/studio/canvas-module-cache.ts +93 -0
  23. package/apps/studio/canvas-source/errors.ts +39 -0
  24. package/apps/studio/canvas-source/waiting.ts +290 -0
  25. package/apps/studio/client/actions/shell-key-handlers.js +5 -0
  26. package/apps/studio/client/app.jsx +22 -9
  27. package/apps/studio/client/github.js +23 -3
  28. package/apps/studio/client/home/home-api.js +30 -19
  29. package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
  30. package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
  31. package/apps/studio/client/hooks/use-tabs.jsx +64 -35
  32. package/apps/studio/client/index-loader.ts +23 -3
  33. package/apps/studio/client/panels/ChatPanel.jsx +22 -37
  34. package/apps/studio/client/panels/DiffView.jsx +314 -248
  35. package/apps/studio/client/panels/TeamProjects.jsx +119 -69
  36. package/apps/studio/client/panels/acp-runtime.js +25 -0
  37. package/apps/studio/client/panels/chat-finish.js +66 -0
  38. package/apps/studio/client/shell/frame-cap.js +53 -0
  39. package/apps/studio/client/shell/viewport.jsx +9 -0
  40. package/apps/studio/client/styles/_index.css +2 -0
  41. package/apps/studio/client/tree/tree.jsx +48 -21
  42. package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
  43. package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
  44. package/apps/studio/client/v2/ai/ai-run.css +87 -3
  45. package/apps/studio/client/v2/ai/background-model.js +113 -0
  46. package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
  47. package/apps/studio/client/v2/ai/run-api.js +7 -3
  48. package/apps/studio/client/v2/ai/runs-store.js +2 -1
  49. package/apps/studio/client/v2/annotations/vote-store.js +11 -5
  50. package/apps/studio/client/v2/assets/asset-state-lane.js +176 -8
  51. package/apps/studio/client/v2/assets/assets-bus.js +10 -8
  52. package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
  53. package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
  54. package/apps/studio/client/v2/assets/missing-frame.jsx +8 -4
  55. package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
  56. package/apps/studio/client/v2/assets/spotlight.css +153 -0
  57. package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
  58. package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
  59. package/apps/studio/client/v2/assets/tile.jsx +3 -0
  60. package/apps/studio/client/v2/assets/use-assets.js +2 -1
  61. package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
  62. package/apps/studio/client/v2/canvases/covers.js +11 -5
  63. package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
  64. package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
  65. package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
  66. package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
  67. package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
  68. package/apps/studio/client/v2/canvases/use-pins.js +2 -1
  69. package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
  70. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
  71. package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
  72. package/apps/studio/client/v2/code/code.css +67 -0
  73. package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
  74. package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
  75. package/apps/studio/client/v2/create/name-dialog.css +10 -0
  76. package/apps/studio/client/v2/ds/advanced-host.jsx +5 -2
  77. package/apps/studio/client/v2/ds/make-host.jsx +5 -2
  78. package/apps/studio/client/v2/ds/off-system-host.jsx +5 -2
  79. package/apps/studio/client/v2/ds/truth-host.jsx +5 -2
  80. package/apps/studio/client/v2/empty/arriving.jsx +29 -12
  81. package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
  82. package/apps/studio/client/v2/empty/not-local.jsx +31 -1
  83. package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
  84. package/apps/studio/client/v2/export/last-finished.js +2 -1
  85. package/apps/studio/client/v2/export/native-save.js +44 -0
  86. package/apps/studio/client/v2/history/git-model.js +18 -4
  87. package/apps/studio/client/v2/history/git-parts.jsx +60 -42
  88. package/apps/studio/client/v2/history/history.css +6 -0
  89. package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
  90. package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
  91. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
  92. package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
  93. package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
  94. package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
  95. package/apps/studio/client/v2/search/search-recent.js +3 -1
  96. package/apps/studio/client/v2/search/search-remote.js +6 -4
  97. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  98. package/apps/studio/client/v2/shell/menu-runner.js +1 -0
  99. package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
  100. package/apps/studio/client/v2/shell/recovery-store.js +2 -1
  101. package/apps/studio/client/v2/shell/served-routes.js +120 -0
  102. package/apps/studio/client/v2/shell/share-cluster-host.jsx +2 -1
  103. package/apps/studio/client/v2/shell/shell-activity.js +19 -0
  104. package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
  105. package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
  106. package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
  107. package/apps/studio/cloud/endpoints.ts +23 -1
  108. package/apps/studio/dist/client.bundle.js +798 -801
  109. package/apps/studio/dist/comment-mount.js +2 -2
  110. package/apps/studio/dist/styles.css +1 -1
  111. package/apps/studio/ds-assets.ts +138 -48
  112. package/apps/studio/editing/minimap-context.tsx +3 -3
  113. package/apps/studio/editing/page-activity.ts +251 -0
  114. package/apps/studio/editing/rotate-handle.tsx +9 -5
  115. package/apps/studio/editing/sticky-name.tsx +4 -4
  116. package/apps/studio/history/restore-artboard-action.ts +40 -0
  117. package/apps/studio/home/hub.ts +77 -175
  118. package/apps/studio/home/routes.ts +47 -8
  119. package/apps/studio/http.ts +117 -66
  120. package/apps/studio/index-flight.ts +40 -0
  121. package/apps/studio/managed-projects.ts +52 -24
  122. package/apps/studio/migrate/hub.ts +7 -1
  123. package/apps/studio/routes/asset-state.ts +12 -0
  124. package/apps/studio/routes/canvas-source.ts +44 -2
  125. package/apps/studio/routes/ds-assets.ts +8 -0
  126. package/apps/studio/routes/history.ts +28 -5
  127. package/apps/studio/routes/hub-signin.ts +115 -0
  128. package/apps/studio/routes/index.ts +4 -0
  129. package/apps/studio/routes/table.ts +7 -0
  130. package/apps/studio/routes/trash.ts +3 -0
  131. package/apps/studio/server.ts +11 -0
  132. package/apps/studio/sync/accepted-cold-start.ts +26 -3
  133. package/apps/studio/sync/accepted-link.ts +9 -4
  134. package/apps/studio/sync/asset-push.ts +8 -1
  135. package/apps/studio/sync/asset-state.ts +27 -2
  136. package/apps/studio/sync/code-module-consent.ts +74 -0
  137. package/apps/studio/sync/file-ledger.ts +35 -0
  138. package/apps/studio/sync/file-plane.ts +479 -84
  139. package/apps/studio/sync/hub-browser-signin.ts +377 -0
  140. package/apps/studio/sync/hub-text-undo.ts +30 -10
  141. package/apps/studio/sync/index.ts +73 -11
  142. package/apps/studio/sync/lfs-pointer.ts +137 -0
  143. package/apps/studio/sync/projection.ts +44 -2
  144. package/apps/studio/sync/pull-pacer.ts +160 -0
  145. package/apps/studio/sync/pull-priority.ts +119 -0
  146. package/apps/studio/sync/seed-progress.ts +47 -3
  147. package/apps/studio/sync/transaction-client.ts +71 -6
  148. package/apps/studio/sync/workspace-signin.ts +6 -256
  149. package/apps/studio/sync/writer-registry.ts +5 -1
  150. package/apps/studio/video-links-overlay.tsx +3 -2
  151. package/apps/studio/whats-new.json +63 -0
  152. package/cli/lib/design-help.gen.mjs +1 -1
  153. package/cli/lib/workspace-plan.mjs +14 -0
  154. package/package.json +8 -8
@@ -38,6 +38,7 @@ import { type BoardGuard, voteDoorOnly } from './annotations/vote-guard.ts';
38
38
  import { createAssetMirror, s3ConfigFromEnv } from './assets-s3.ts';
39
39
  import { canvasArtifacts, locatorKeyFor, relocatedName } from './canvas-artifacts.ts';
40
40
  import {
41
+ FOLDER_WORDS,
41
42
  foldToAllowedName,
42
43
  nameFromPrompt,
43
44
  nextFreeCanvasName,
@@ -146,6 +147,7 @@ import {
146
147
  sanitizeReuseText,
147
148
  } from './generation/audio-library.ts';
148
149
  import { createHistory } from './history.ts';
150
+ import { createSingleFlight } from './index-flight.ts';
149
151
  import { clearLocatorSlug, readLocator, writeLocator } from './locator.ts';
150
152
  import { listMaterializable } from './materialize-client.ts';
151
153
  import { resolveUrlPathUnder } from './path-containment.ts';
@@ -5388,14 +5390,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5388
5390
  return abs === gAbs || abs.startsWith(`${gAbs}${path.sep}`);
5389
5391
  });
5390
5392
  if (!withinAGroup(resolvedDir)) {
5391
- return {
5392
- ok: false,
5393
- status: 400,
5394
- error: 'only folders under a managed canvas group can be moved',
5395
- };
5393
+ return { ok: false, status: 400, error: FOLDER_WORDS.notHere };
5396
5394
  }
5397
5395
  if (deletable.some((g) => path.resolve(path.join(paths.designRoot, g.path)) === resolvedDir)) {
5398
- return { ok: false, status: 400, error: 'cannot move a canvas group root' };
5396
+ return { ok: false, status: 400, error: FOLDER_WORDS.groupRoot };
5399
5397
  }
5400
5398
  if (!(await assertRealpathContained(resolvedDir))) {
5401
5399
  return { ok: false, status: 400, error: 'source path escapes the design root via a symlink' };
@@ -5421,7 +5419,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5421
5419
  return { ok: false, status: 400, error: 'destination resolves outside the design root' };
5422
5420
  }
5423
5421
  if (!withinAGroup(resolvedToDir)) {
5424
- return { ok: false, status: 400, error: 'destination must be inside a managed canvas group' };
5422
+ return { ok: false, status: 400, error: FOLDER_WORDS.notHere };
5425
5423
  }
5426
5424
  if (!(await assertRealpathContained(resolvedToDir))) {
5427
5425
  return {
@@ -5432,7 +5430,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5432
5430
  }
5433
5431
  // Refuse a move into itself or a descendant of itself.
5434
5432
  if (resolvedToDir === resolvedDir || resolvedToDir.startsWith(`${resolvedDir}${path.sep}`)) {
5435
- return { ok: false, status: 400, error: 'cannot move a folder into itself' };
5433
+ return { ok: false, status: 400, error: FOLDER_WORDS.intoItself };
5436
5434
  }
5437
5435
 
5438
5436
  // A RENAME is a move to a new name in the same (or another) parent — one
@@ -5456,7 +5454,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5456
5454
  if (closeFolder) return closeFolder;
5457
5455
  try {
5458
5456
  await statp(toDirFinalAbs);
5459
- return { ok: false, status: 409, error: `"${base}" already exists in ${toDir || '.'}` };
5457
+ return { ok: false, status: 409, error: FOLDER_WORDS.taken(base) };
5460
5458
  } catch {
5461
5459
  /* good — doesn't exist yet */
5462
5460
  }
@@ -5472,7 +5470,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5472
5470
  return {
5473
5471
  ok: false,
5474
5472
  status: 400,
5475
- error: `folder has ${found.length} canvases — the batch move cap is ${MAX_BATCH}; move a smaller subset`,
5473
+ error: FOLDER_WORDS.tooMany(path.basename(relDir), found.length, MAX_BATCH),
5476
5474
  };
5477
5475
  }
5478
5476
  const canvasRels = found.map((p) =>
@@ -5519,11 +5517,8 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5519
5517
  to: toRelDir,
5520
5518
  });
5521
5519
  if (folderMove?.status === 'rejected') {
5522
- return {
5523
- ok: false,
5524
- status: 409,
5525
- error: `the project did not accept this move (${folderMove.code ?? 'rejected'})`,
5526
- };
5520
+ console.warn(`[fs-move] the project refused dir.move (${folderMove.code ?? 'rejected'})`);
5521
+ return { ok: false, status: 409, error: FOLDER_WORDS.refused };
5527
5522
  }
5528
5523
 
5529
5524
  // Collab guard for every canvas found, BEFORE any disk mutation. Same
@@ -5538,7 +5533,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5538
5533
  return {
5539
5534
  ok: false,
5540
5535
  status: 409,
5541
- error: `"${path.basename(r)}" has a live shared session — cannot move the folder while it's pinned to the hub`,
5536
+ error: FOLDER_WORDS.live(path.basename(r).replace(/\.tsx$/i, '')),
5542
5537
  };
5543
5538
  }
5544
5539
  }
@@ -5706,7 +5701,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5706
5701
  return resolvedParent === gAbs || resolvedParent.startsWith(`${gAbs}${path.sep}`);
5707
5702
  });
5708
5703
  if (!withinAGroup) {
5709
- return { ok: false, status: 400, error: 'parent must be inside a managed canvas group' };
5704
+ return { ok: false, status: 400, error: FOLDER_WORDS.notHere };
5710
5705
  }
5711
5706
  if (!(await assertRealpathContained(resolvedParent))) {
5712
5707
  return {
@@ -5730,7 +5725,7 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5730
5725
  if (closeFolder) return closeFolder;
5731
5726
  try {
5732
5727
  await statp(dirAbs); // throws if absent (works for files AND dirs)
5733
- return { ok: false, status: 409, error: `"${v.name}" already exists` };
5728
+ return { ok: false, status: 409, error: FOLDER_WORDS.taken(v.name) };
5734
5729
  } catch {
5735
5730
  /* good — doesn't exist yet */
5736
5731
  }
@@ -5740,11 +5735,10 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
5740
5735
  path: path.posix.join(parent, v.name),
5741
5736
  });
5742
5737
  if (folderCreate?.status === 'rejected') {
5743
- return {
5744
- ok: false,
5745
- status: 409,
5746
- error: `the project did not accept this folder (${folderCreate.code ?? 'rejected'})`,
5747
- };
5738
+ console.warn(
5739
+ `[fs-mkdir] the project refused dir.create (${folderCreate.code ?? 'rejected'})`
5740
+ );
5741
+ return { ok: false, status: 409, error: FOLDER_WORDS.refused };
5748
5742
  }
5749
5743
 
5750
5744
  await mkdir(dirAbs, { recursive: true });
@@ -7855,7 +7849,20 @@ export function createApi(ctx: Context, hooks: ApiHooks): Api {
7855
7849
 
7856
7850
  // ---------- Index data + System data ----------
7857
7851
 
7858
- async function buildIndexData(viewer?: { role?: string | null }) {
7852
+ // #204 — one index build at a time per reader: a client that timed out and asked again joins the
7853
+ // build still running instead of starting another next to it (index-flight.ts). File events bump
7854
+ // it, so a build that started before a change is never handed to a later caller.
7855
+ const indexFlight = createSingleFlight<unknown>();
7856
+ ctx.bus.on('fs:any', () => indexFlight.bump());
7857
+ function buildIndexData(viewer?: { role?: string | null }) {
7858
+ // A canvas-only session's answer is filtered by its own grants: never shared.
7859
+ if (!projectVisibility(ctx).current().full) return buildIndexDataNow(viewer);
7860
+ return indexFlight.run(`${viewer?.role ?? ''}|${currentSession()}`, () =>
7861
+ buildIndexDataNow(viewer)
7862
+ );
7863
+ }
7864
+
7865
+ async function buildIndexDataNow(viewer?: { role?: string | null }) {
7859
7866
  const groups = [];
7860
7867
 
7861
7868
  // DDR-093 — per-canvas design-system map (repo-relative canvas path → DS
@@ -12,6 +12,12 @@
12
12
  //
13
13
  // Anything uncertain is "Not here yet", never Missing. Outside a shell (an export capture, a
14
14
  // headless screenshot) nothing is ever sent, so nothing is ever drawn — exports carry no frames.
15
+ //
16
+ // 2.0.3 — a Git LFS placeholder (`lfs-pointer`: the file here is a pointer, not the picture) says so
17
+ // in plain words. Where the shell can repair it (`lfsActions`, the desktop app's AI chat) the frame
18
+ // adds "Fix with AI" and "Copy prompt"; both only NAME the rel (`asset-lfs-fix-request`,
19
+ // `asset-lfs-copy-request`) — the shell builds the prompt from its own answer and does the clipboard
20
+ // write (this iframe has no clipboard rights), then answers `asset-lfs-copied` for the "Copied" word.
15
21
 
16
22
  import { useEffect, useMemo, useRef, useState } from 'react';
17
23
  import { createPortal } from 'react-dom';
@@ -21,11 +27,16 @@ import { type AssetStateItem, acceptFromShell } from './bridge/dgn-protocol.ts';
21
27
 
22
28
  /** What a frame says. `null` = draw nothing (the picture is here, or still uploading from here). */
23
29
  export interface FrameWords {
24
- state: 'waiting' | 'missing';
30
+ state: 'waiting' | 'missing' | 'lfs-pointer';
25
31
  line: string;
26
32
  relink: boolean;
27
33
  }
28
34
 
35
+ /** 2.0.3 — the line a Git LFS placeholder wears. */
36
+ export const LFS_LINE = 'Not downloaded — Git LFS placeholder';
37
+ /** How long "Copy prompt" reads "Copied" after the shell said it copied. */
38
+ export const LFS_COPIED_MS = 1500;
39
+
29
40
  const KIND_WORD = { mac: 'Mac', pc: 'PC', linux: 'computer' } as const;
30
41
 
31
42
  /**
@@ -43,6 +54,7 @@ function possessive(name: string): string {
43
54
  /** The §5.5 words. A name only, never an address: "Jonas's device" when the kind is unknown. */
44
55
  export function frameWords(item: AssetStateItem | undefined): FrameWords | null {
45
56
  if (!item || item.state === 'here' || item.state === 'uploading') return null;
57
+ if (item.state === 'lfs-pointer') return { state: 'lfs-pointer', line: LFS_LINE, relink: false };
46
58
  if (item.state === 'missing') {
47
59
  return { state: 'missing', line: 'Missing — no device has it', relink: RELINK_LIVE };
48
60
  }
@@ -209,6 +221,10 @@ const CSS = `
209
221
  .dc-absent-btn { pointer-events: auto; margin-top: 2px; padding: 3px 10px; border: 0; border-radius: 6px; cursor: pointer;
210
222
  font: inherit; font-weight: 600; background: var(--dc-absent-accent); color: var(--dc-absent-accent-fg); }
211
223
  .dc-absent-btn:focus-visible { outline: 2px solid var(--dc-absent-accent); outline-offset: 2px; }
224
+ .dc-absent[data-state="lfs-pointer"] { background-image: repeating-linear-gradient(135deg, var(--dc-absent-stripe) 0 2px, transparent 2px 9px);
225
+ box-shadow: inset 0 0 0 1px var(--dc-absent-edge); }
226
+ .dc-absent-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
227
+ .dc-absent-btn--quiet { background: transparent; color: var(--dc-absent-ink); box-shadow: inset 0 0 0 1px var(--dc-absent-edge); }
212
228
  `;
213
229
 
214
230
  function ensureStyles(): void {
@@ -246,21 +262,48 @@ export function AssetPlaceholderLayer({
246
262
  const [items, setItems] = useState<ReadonlyMap<string, AssetStateItem>>(new Map());
247
263
  const [frames, setFrames] = useState<Frame[]>([]);
248
264
  const nodes = useRef(new Map<string, HTMLDivElement>());
265
+ // 2.0.3: the shell can repair an LFS placeholder (its AI chat exists); rel → what Copy prompt says now.
266
+ const [lfsActions, setLfsActions] = useState(false);
267
+ const [copied, setCopied] = useState<ReadonlyMap<string, 'copied' | 'failed'>>(new Map());
268
+ const copiedTimers = useRef(new Map<string, ReturnType<typeof setTimeout>>());
249
269
 
250
270
  useEffect(() => {
251
271
  if (typeof window === 'undefined') return;
272
+ const timers = copiedTimers.current;
252
273
  const onMessage = (e: MessageEvent) => {
253
274
  // Only the shell may say it (DDR-054); the table parses it (≤ 256 items, no e-mail names).
254
275
  if (e.source !== window.parent) return;
255
- if ((e.data as { dgn?: string } | null)?.dgn !== 'asset-state') return;
276
+ const dgn = (e.data as { dgn?: string } | null)?.dgn;
277
+ if (dgn !== 'asset-state' && dgn !== 'asset-lfs-copied') return;
256
278
  const m = acceptFromShell(e, window);
257
279
  if (m && m.dgn === 'asset-state') {
258
280
  ensureStyles();
259
281
  setItems(new Map(m.items.map((it) => [it.rel, it])));
282
+ setLfsActions(m.lfsActions === true);
283
+ } else if (m && m.dgn === 'asset-lfs-copied') {
284
+ const rel = m.rel;
285
+ setCopied((prev) => new Map(prev).set(rel, m.ok ? 'copied' : 'failed'));
286
+ const old = timers.get(rel);
287
+ if (old) clearTimeout(old);
288
+ timers.set(
289
+ rel,
290
+ setTimeout(() => {
291
+ timers.delete(rel);
292
+ setCopied((prev) => {
293
+ const next = new Map(prev);
294
+ next.delete(rel);
295
+ return next;
296
+ });
297
+ }, LFS_COPIED_MS)
298
+ );
260
299
  }
261
300
  };
262
301
  window.addEventListener('message', onMessage);
263
- return () => window.removeEventListener('message', onMessage);
302
+ return () => {
303
+ window.removeEventListener('message', onMessage);
304
+ for (const t of timers.values()) clearTimeout(t);
305
+ timers.clear();
306
+ };
264
307
  }, []);
265
308
 
266
309
  // Which elements need a frame: rescanned on news, and on every media load / error (capture
@@ -413,66 +456,118 @@ export function AssetPlaceholderLayer({
413
456
  {bars}
414
457
  {createPortal(
415
458
  <div className="dc-absent-layer" data-testid="asset-frames">
416
- {frames.map((f) => (
417
- // biome-ignore lint/a11y/useAriaPropsSupportedByRole: role is `group` or `img` (both take a name)
418
- <div
419
- key={f.key}
420
- ref={(el) => {
421
- if (el) nodes.current.set(f.key, el);
422
- else nodes.current.delete(f.key);
423
- }}
424
- className="dc-absent"
425
- data-testid="asset-frame"
426
- data-rel={f.rel}
427
- data-state={f.words.state}
428
- data-lost={f.lost ? '1' : undefined}
429
- // gate-b-a11y: `img` cannot hold the Relink… button (axe nested-interactive) — a labelled group can
430
- role={f.words.relink ? 'group' : 'img'}
431
- aria-label={
432
- f.lost && f.words.line === LOST_VIDEO_LINE
433
- ? `${f.words.line} · ${f.rel}`
434
- : `${f.lost ? f.rel : baseName(f.rel)} · ${f.words.line}`
435
- }
436
- >
437
- <span className="dc-absent-in">
438
- <svg
439
- className="dc-absent-ic"
440
- width="16"
441
- height="16"
442
- viewBox="0 0 16 16"
443
- fill="none"
444
- stroke="currentColor"
445
- strokeWidth="1.4"
446
- strokeLinecap="round"
447
- strokeLinejoin="round"
448
- aria-hidden="true"
449
- >
450
- <path d="M8 2.2 14.2 13H1.8z" />
451
- <path d="M8 6.4v3.2" />
452
- <circle cx="8" cy="11.3" r="0.4" fill="currentColor" />
453
- </svg>
454
- <span className="dc-absent-n">{f.lost ? f.rel : baseName(f.rel)}</span>
455
- <span className="dc-absent-d">{f.words.line}</span>
456
- {f.words.relink ? (
457
- <button
458
- type="button"
459
- className="dc-absent-btn"
460
- data-testid="asset-frame-relink"
461
- onClick={() => {
462
- // A literal `{ dgn }` so the bridge inventory sees this send site.
463
- try {
464
- window.parent.postMessage({ dgn: 'asset-relink-request', rel: f.rel }, '*');
465
- } catch {
466
- /* detached */
467
- }
468
- }}
459
+ {frames.map((f) => {
460
+ const lfs = f.words.state === 'lfs-pointer' && lfsActions && !f.lost;
461
+ const copyWord = copied.get(f.rel);
462
+ return (
463
+ // biome-ignore lint/a11y/useAriaPropsSupportedByRole: role is `group` or `img` (both take a name)
464
+ <div
465
+ key={f.key}
466
+ ref={(el) => {
467
+ if (el) nodes.current.set(f.key, el);
468
+ else nodes.current.delete(f.key);
469
+ }}
470
+ className="dc-absent"
471
+ data-testid="asset-frame"
472
+ data-rel={f.rel}
473
+ data-state={f.words.state}
474
+ data-lost={f.lost ? '1' : undefined}
475
+ // gate-b-a11y: `img` cannot hold the Relink… button (axe nested-interactive) — a labelled group can
476
+ role={f.words.relink || lfs ? 'group' : 'img'}
477
+ aria-label={
478
+ f.lost && f.words.line === LOST_VIDEO_LINE
479
+ ? `${f.words.line} · ${f.rel}`
480
+ : `${f.lost ? f.rel : baseName(f.rel)} · ${f.words.line}`
481
+ }
482
+ >
483
+ <span className="dc-absent-in">
484
+ <svg
485
+ className="dc-absent-ic"
486
+ width="16"
487
+ height="16"
488
+ viewBox="0 0 16 16"
489
+ fill="none"
490
+ stroke="currentColor"
491
+ strokeWidth="1.4"
492
+ strokeLinecap="round"
493
+ strokeLinejoin="round"
494
+ aria-hidden="true"
469
495
  >
470
- Relink…
471
- </button>
472
- ) : null}
473
- </span>
474
- </div>
475
- ))}
496
+ <path d="M8 2.2 14.2 13H1.8z" />
497
+ <path d="M8 6.4v3.2" />
498
+ <circle cx="8" cy="11.3" r="0.4" fill="currentColor" />
499
+ </svg>
500
+ <span className="dc-absent-n">{f.lost ? f.rel : baseName(f.rel)}</span>
501
+ <span className="dc-absent-d">{f.words.line}</span>
502
+ {f.words.relink ? (
503
+ <button
504
+ type="button"
505
+ className="dc-absent-btn"
506
+ data-testid="asset-frame-relink"
507
+ onClick={() => {
508
+ // A literal `{ dgn }` so the bridge inventory sees this send site.
509
+ try {
510
+ window.parent.postMessage(
511
+ { dgn: 'asset-relink-request', rel: f.rel },
512
+ '*'
513
+ );
514
+ } catch {
515
+ /* detached */
516
+ }
517
+ }}
518
+ >
519
+ Relink…
520
+ </button>
521
+ ) : null}
522
+ {lfs ? (
523
+ <span className="dc-absent-row">
524
+ <button
525
+ type="button"
526
+ className="dc-absent-btn"
527
+ data-testid="asset-frame-lfs-fix"
528
+ onClick={() => {
529
+ // A literal `{ dgn }` so the bridge inventory sees this send site.
530
+ try {
531
+ window.parent.postMessage(
532
+ { dgn: 'asset-lfs-fix-request', rel: f.rel },
533
+ '*'
534
+ );
535
+ } catch {
536
+ /* detached */
537
+ }
538
+ }}
539
+ >
540
+ Fix with AI
541
+ </button>
542
+ <button
543
+ type="button"
544
+ className="dc-absent-btn dc-absent-btn--quiet"
545
+ data-testid="asset-frame-lfs-copy"
546
+ aria-live="polite"
547
+ onClick={() => {
548
+ // A literal `{ dgn }` so the bridge inventory sees this send site.
549
+ try {
550
+ window.parent.postMessage(
551
+ { dgn: 'asset-lfs-copy-request', rel: f.rel },
552
+ '*'
553
+ );
554
+ } catch {
555
+ /* detached */
556
+ }
557
+ }}
558
+ >
559
+ {copyWord === 'copied'
560
+ ? 'Copied'
561
+ : copyWord === 'failed'
562
+ ? 'Couldn’t copy'
563
+ : 'Copy prompt'}
564
+ </button>
565
+ </span>
566
+ ) : null}
567
+ </span>
568
+ </div>
569
+ );
570
+ })}
476
571
  </div>,
477
572
  document.body
478
573
  )}
@@ -7,7 +7,12 @@
7
7
 
8
8
  import { mkdirSync } from 'node:fs';
9
9
  import { dirname, join } from 'node:path';
10
- import { launchChromium, newShellContext, safeArtboardFilename } from './_pw-launch.mjs';
10
+ import {
11
+ afterPaint,
12
+ launchChromium,
13
+ newShellContext,
14
+ safeArtboardFilename,
15
+ } from './_pw-launch.mjs';
11
16
  import { layoutRegion, parseRegionArg } from './_region.mjs';
12
17
 
13
18
  const args = Object.fromEntries(
@@ -201,6 +206,8 @@ try {
201
206
  const vp = page.viewportSize();
202
207
  const clipX = Math.min(Math.max(0, Math.floor(finalRect.x)), Math.max(0, vp.width - 1));
203
208
  const clipY = Math.min(Math.max(0, Math.floor(finalRect.y)), Math.max(0, vp.height - 1));
209
+ // Shoot a frame painted at this size and position, never the previous surface (afterPaint).
210
+ await afterPaint(page);
204
211
  await page.screenshot({
205
212
  ...shotOpts,
206
213
  path: target,
@@ -232,6 +239,8 @@ try {
232
239
  const box = await layoutRegion(page, region);
233
240
  assertOutputSizeOk(box.width, box.height);
234
241
  await page.setViewportSize({ width: Math.max(1, box.width), height: Math.max(1, box.height) });
242
+ // Shoot a frame painted at this size and position, never the previous surface (afterPaint).
243
+ await afterPaint(page);
235
244
  await page.screenshot({
236
245
  ...shotOpts,
237
246
  path: out,
@@ -153,6 +153,20 @@ export function safeArtboardFilename(id, index, ext) {
153
153
  return `${safe}.${ext}`;
154
154
  }
155
155
 
156
+ // fix/204-capture-parity — wait until the page has produced a frame AFTER its last layout change
157
+ // (a viewport resize, the world plane moved to the origin) before a raster shot. Taken at once,
158
+ // headless Chromium can hand `page.screenshot` the compositor's previous surface: stale raster
159
+ // tiles of the 1440×900 page repeated across the small viewport. Nothing on an idle canvas page
160
+ // requests a frame by itself, so the shot must. The first callback runs before the frame that
161
+ // carries the change, the second after it was produced. `_ds-prove-playwright.mjs` and
162
+ // `_tile-draw.mjs` already wait the same way.
163
+ export async function afterPaint(page) {
164
+ await page.evaluate(
165
+ () =>
166
+ new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(() => resolve())))
167
+ );
168
+ }
169
+
156
170
  // Shared by every raster-capture export shim (_png/_pdf-playwright.mjs) that
157
171
  // scales its render surface by `deviceScaleFactor` (feature-2-print-artboards
158
172
  // T4's DPI support). The requested pixel output is only knowable once the
@@ -31,7 +31,7 @@
31
31
 
32
32
  import { createInterface } from 'node:readline';
33
33
 
34
- import { launchChromium } from './_pw-launch.mjs';
34
+ import { afterPaint, launchChromium } from './_pw-launch.mjs';
35
35
  import { drawTile } from './_tile-draw.mjs';
36
36
 
37
37
  const MAX_PAGES = 4;
@@ -369,6 +369,9 @@ async function shoot(page, job, index, target, runtime, left) {
369
369
  if (seek !== true) partial = true;
370
370
  }
371
371
  assertOrigin(page, job);
372
+ // 2.0.4: the viewport was just resized — wait for a painted frame, or headless Chromium can hand back
373
+ // the previous one (the PNG shim's parity flake, decision v2-204-capture-waits-painted-frame).
374
+ await afterPaint(page);
372
375
  const jpeg = await page.screenshot({
373
376
  type: 'jpeg',
374
377
  quality: 80,
@@ -0,0 +1,31 @@
1
+ // apps/studio/boot-progress.ts — #204: the boot tells its supervisor it is still moving.
2
+ //
3
+ // A cell's hub supervises this process (apps/hub/src/studio-child.mjs) and used to SIGKILL it when
4
+ // `/_health` had not answered within a fixed 60 s. A large workspace on a small cell boots slower
5
+ // than that, so the child was killed mid-boot and started over — twice — before it came up. The
6
+ // supervisor now kills only a child that has gone QUIET: each `[boot] <step>` line here moves its
7
+ // deadline (BOOT_PROGRESS_RE there), and a hard ceiling still ends one that never gets there.
8
+ //
9
+ // Printed only where something reads it: a workspace cell, or an explicit MAUDE_BOOT_PROGRESS=1.
10
+ // One line per boot step (a handful), none after the server listens.
11
+
12
+ const enabled = (env: NodeJS.ProcessEnv = process.env): boolean =>
13
+ env.MAUDE_WORKSPACE_MODE === '1' || env.MAUDE_BOOT_PROGRESS === '1';
14
+
15
+ let finished = false;
16
+
17
+ /** One boot step done. `label` is a fixed word from server.ts — never a path or tenant text. */
18
+ export function bootStep(label: string, out: (line: string) => void = console.log): void {
19
+ if (finished || !enabled()) return;
20
+ out(`[boot] ${label} +${Math.round(performance.now())}ms`);
21
+ }
22
+
23
+ /** The server listens: from here `/_health` is the signal, and nothing more is printed. */
24
+ export function bootFinished(out: (line: string) => void = console.log): void {
25
+ bootStep('listening', out);
26
+ finished = true;
27
+ }
28
+
29
+ // The first line, printed as this module is evaluated — the import graph has loaded by now, which
30
+ // on a cold cell is the longest single step of the boot.
31
+ bootStep('modules');
@@ -439,12 +439,18 @@ export interface CanvasToShell {
439
439
  // S8.19 — the placeholder frame's Relink… (a Missing picture): the shell opens its relink sheet for
440
440
  // that rel. The canvas asks; the shell decides (the write is the shell's `asset.relink` edit op).
441
441
  'asset-relink-request': { rel: string };
442
+ // 2.0.3 — a Git LFS placeholder frame's two buttons (desktop only). The canvas only NAMES a rel; the
443
+ // shell checks it against its own asset-state answer (`lfs-pointer`) and builds the prompt itself.
444
+ 'asset-lfs-fix-request': { rel: string };
445
+ 'asset-lfs-copy-request': { rel: string };
442
446
  }
443
447
 
444
448
  /** S8.19 — one picture's state, as the shell tells the canvas (contract S8-S9-asset-presence §5.5). */
445
449
  export interface AssetStateItem {
446
450
  rel: string;
447
- state: 'here' | 'uploading' | 'waiting' | 'missing';
451
+ state: 'here' | 'uploading' | 'waiting' | 'missing' | 'lfs-pointer';
452
+ /** 2.0.3, `lfs-pointer` only: the real bytes are already in this repo's `.git/lfs/objects`. */
453
+ localObject?: boolean;
448
454
  /** A display name only — never an e-mail, never a device id. */
449
455
  who?: { name: string | null; kind: 'mac' | 'pc' | 'linux' | null; self: boolean };
450
456
  /** The hub already has the bytes; this Mac has not pulled them yet ("Syncing…"). */
@@ -747,7 +753,12 @@ export interface ShellToCanvas {
747
753
  // S8.19 — "Waiting for Jonas's Mac" vs Missing for the open canvas's media. State, not an event: the
748
754
  // shell sends the whole list on open, every 60 s while something waits, at reconnect and after a
749
755
  // sweep ends. ≤ 256 items; a name with an `@` is refused whole (the canvas never sees an e-mail).
750
- 'asset-state': { items: AssetStateItem[] };
756
+ // 2.0.3: `lfsActions` — this shell can repair a Git LFS placeholder (the desktop's AI chat), so its
757
+ // frame offers "Fix with AI" and "Copy prompt". Absent / false: the words only.
758
+ 'asset-state': { items: AssetStateItem[]; lfsActions?: boolean };
759
+ // 2.0.3 — the shell's answer to `asset-lfs-copy-request`: it wrote the prompt to the clipboard (`ok`)
760
+ // or could not. The frame's button reads "Copied" for a moment.
761
+ 'asset-lfs-copied': { rel: string; ok: boolean };
751
762
  // S8.16 — the pictures of the open canvas that have other takes (`assets/<sha8>.<ext>`): with one of them
752
763
  // selected, ← → are `take-step`, not a nudge. State, not an event: the whole set each time. ≤ 256 items,
753
764
  // each an asset path; a planted or oversized list is refused whole.
@@ -1188,7 +1199,8 @@ const assetWho = shape({
1188
1199
  });
1189
1200
  const assetStateItem = shape({
1190
1201
  rel: shortStr(512),
1191
- state: lit('here', 'uploading', 'waiting', 'missing'),
1202
+ state: lit('here', 'uploading', 'waiting', 'missing', 'lfs-pointer'),
1203
+ localObject: opt(bool),
1192
1204
  who: opt(assetWho),
1193
1205
  syncing: opt(bool),
1194
1206
  progress: opt(unit),
@@ -1939,6 +1951,18 @@ const c2s: C2S = {
1939
1951
  owner: 'client/v2/assets/asset-state-lane (S8.19)',
1940
1952
  parse: p({ rel: shortStr(512) }),
1941
1953
  },
1954
+ 'asset-lfs-fix-request': {
1955
+ gate: 'active',
1956
+ status: 'live',
1957
+ owner: 'client/v2/assets/asset-state-lane (2.0.3 LFS placeholder)',
1958
+ parse: p({ rel: shortStr(512) }),
1959
+ },
1960
+ 'asset-lfs-copy-request': {
1961
+ gate: 'active',
1962
+ status: 'live',
1963
+ owner: 'client/v2/assets/asset-state-lane (2.0.3 LFS placeholder)',
1964
+ parse: p({ rel: shortStr(512) }),
1965
+ },
1942
1966
  };
1943
1967
 
1944
1968
  const s2c: S2C = {
@@ -2565,7 +2589,13 @@ const s2c: S2C = {
2565
2589
  gate: 'parent',
2566
2590
  status: 'live',
2567
2591
  owner: 'canvas-lib asset placeholder frame (S8.19, L1)',
2568
- parse: p({ items: assetStateList }),
2592
+ parse: p({ items: assetStateList, lfsActions: opt(bool) }),
2593
+ },
2594
+ 'asset-lfs-copied': {
2595
+ gate: 'parent',
2596
+ status: 'live',
2597
+ owner: 'canvas-lib asset placeholder frame (2.0.3 LFS placeholder)',
2598
+ parse: p({ rel: shortStr(512), ok: bool }),
2569
2599
  },
2570
2600
  'gen-takes': {
2571
2601
  gate: 'parent',