@1agh/maude 2.0.3 → 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 (143) 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/bin/_png-playwright.mjs +10 -1
  14. package/apps/studio/bin/_pw-launch.mjs +14 -0
  15. package/apps/studio/bin/_thumbs-playwright.mjs +4 -1
  16. package/apps/studio/boot-progress.ts +31 -0
  17. package/apps/studio/canvas-build-sandbox.ts +275 -42
  18. package/apps/studio/canvas-build-worker.ts +10 -0
  19. package/apps/studio/canvas-create.ts +24 -0
  20. package/apps/studio/canvas-module-cache.ts +93 -0
  21. package/apps/studio/canvas-source/errors.ts +39 -0
  22. package/apps/studio/canvas-source/waiting.ts +290 -0
  23. package/apps/studio/client/actions/shell-key-handlers.js +5 -0
  24. package/apps/studio/client/app.jsx +19 -9
  25. package/apps/studio/client/github.js +23 -3
  26. package/apps/studio/client/home/home-api.js +30 -19
  27. package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
  28. package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
  29. package/apps/studio/client/hooks/use-tabs.jsx +64 -35
  30. package/apps/studio/client/index-loader.ts +23 -3
  31. package/apps/studio/client/panels/ChatPanel.jsx +22 -37
  32. package/apps/studio/client/panels/DiffView.jsx +314 -248
  33. package/apps/studio/client/panels/TeamProjects.jsx +119 -69
  34. package/apps/studio/client/panels/acp-runtime.js +25 -0
  35. package/apps/studio/client/panels/chat-finish.js +66 -0
  36. package/apps/studio/client/shell/frame-cap.js +53 -0
  37. package/apps/studio/client/shell/viewport.jsx +9 -0
  38. package/apps/studio/client/styles/_index.css +2 -0
  39. package/apps/studio/client/tree/tree.jsx +48 -21
  40. package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
  41. package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
  42. package/apps/studio/client/v2/ai/ai-run.css +87 -3
  43. package/apps/studio/client/v2/ai/background-model.js +113 -0
  44. package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
  45. package/apps/studio/client/v2/ai/run-api.js +7 -3
  46. package/apps/studio/client/v2/ai/runs-store.js +2 -1
  47. package/apps/studio/client/v2/annotations/vote-store.js +11 -5
  48. package/apps/studio/client/v2/assets/asset-state-lane.js +6 -3
  49. package/apps/studio/client/v2/assets/assets-bus.js +10 -8
  50. package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
  51. package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
  52. package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
  53. package/apps/studio/client/v2/assets/spotlight.css +153 -0
  54. package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
  55. package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
  56. package/apps/studio/client/v2/assets/tile.jsx +3 -0
  57. package/apps/studio/client/v2/assets/use-assets.js +2 -1
  58. package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
  59. package/apps/studio/client/v2/canvases/covers.js +11 -5
  60. package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
  61. package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
  62. package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
  63. package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
  64. package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
  65. package/apps/studio/client/v2/canvases/use-pins.js +2 -1
  66. package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
  67. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
  68. package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
  69. package/apps/studio/client/v2/code/code.css +67 -0
  70. package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
  71. package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
  72. package/apps/studio/client/v2/create/name-dialog.css +10 -0
  73. package/apps/studio/client/v2/ds/advanced-host.jsx +5 -2
  74. package/apps/studio/client/v2/ds/make-host.jsx +5 -2
  75. package/apps/studio/client/v2/ds/off-system-host.jsx +5 -2
  76. package/apps/studio/client/v2/ds/truth-host.jsx +5 -2
  77. package/apps/studio/client/v2/empty/arriving.jsx +29 -12
  78. package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
  79. package/apps/studio/client/v2/empty/not-local.jsx +31 -1
  80. package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
  81. package/apps/studio/client/v2/export/last-finished.js +2 -1
  82. package/apps/studio/client/v2/history/git-model.js +18 -4
  83. package/apps/studio/client/v2/history/git-parts.jsx +60 -42
  84. package/apps/studio/client/v2/history/history.css +6 -0
  85. package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
  86. package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
  87. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
  88. package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
  89. package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
  90. package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
  91. package/apps/studio/client/v2/search/search-recent.js +3 -1
  92. package/apps/studio/client/v2/search/search-remote.js +6 -4
  93. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  94. package/apps/studio/client/v2/shell/menu-runner.js +1 -0
  95. package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
  96. package/apps/studio/client/v2/shell/recovery-store.js +2 -1
  97. package/apps/studio/client/v2/shell/served-routes.js +120 -0
  98. package/apps/studio/client/v2/shell/share-cluster-host.jsx +2 -1
  99. package/apps/studio/client/v2/shell/shell-activity.js +19 -0
  100. package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
  101. package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
  102. package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
  103. package/apps/studio/cloud/endpoints.ts +23 -1
  104. package/apps/studio/dist/client.bundle.js +977 -981
  105. package/apps/studio/dist/styles.css +1 -1
  106. package/apps/studio/editing/minimap-context.tsx +3 -3
  107. package/apps/studio/editing/page-activity.ts +251 -0
  108. package/apps/studio/editing/rotate-handle.tsx +9 -5
  109. package/apps/studio/editing/sticky-name.tsx +4 -4
  110. package/apps/studio/history/restore-artboard-action.ts +40 -0
  111. package/apps/studio/home/hub.ts +77 -175
  112. package/apps/studio/home/routes.ts +47 -8
  113. package/apps/studio/http.ts +117 -66
  114. package/apps/studio/index-flight.ts +40 -0
  115. package/apps/studio/managed-projects.ts +52 -24
  116. package/apps/studio/migrate/hub.ts +7 -1
  117. package/apps/studio/routes/canvas-source.ts +44 -2
  118. package/apps/studio/routes/history.ts +28 -5
  119. package/apps/studio/routes/hub-signin.ts +115 -0
  120. package/apps/studio/routes/index.ts +4 -0
  121. package/apps/studio/routes/table.ts +7 -0
  122. package/apps/studio/routes/trash.ts +3 -0
  123. package/apps/studio/server.ts +11 -0
  124. package/apps/studio/sync/accepted-cold-start.ts +26 -3
  125. package/apps/studio/sync/accepted-link.ts +9 -4
  126. package/apps/studio/sync/code-module-consent.ts +74 -0
  127. package/apps/studio/sync/file-ledger.ts +35 -0
  128. package/apps/studio/sync/file-plane.ts +443 -77
  129. package/apps/studio/sync/hub-browser-signin.ts +377 -0
  130. package/apps/studio/sync/hub-text-undo.ts +30 -10
  131. package/apps/studio/sync/index.ts +73 -11
  132. package/apps/studio/sync/projection.ts +44 -2
  133. package/apps/studio/sync/pull-pacer.ts +160 -0
  134. package/apps/studio/sync/pull-priority.ts +119 -0
  135. package/apps/studio/sync/seed-progress.ts +47 -3
  136. package/apps/studio/sync/transaction-client.ts +71 -6
  137. package/apps/studio/sync/workspace-signin.ts +6 -256
  138. package/apps/studio/sync/writer-registry.ts +5 -1
  139. package/apps/studio/video-links-overlay.tsx +3 -2
  140. package/apps/studio/whats-new.json +54 -0
  141. package/cli/lib/design-help.gen.mjs +1 -1
  142. package/cli/lib/workspace-plan.mjs +14 -0
  143. 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
@@ -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');