@1agh/maude 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/apps/studio/actions/agents.ts +18 -42
  2. package/apps/studio/actions/verbs.ts +49 -0
  3. package/apps/studio/actions.manifest.json +103 -19
  4. package/apps/studio/ai/create-claim.ts +1 -1
  5. package/apps/studio/bin/_asset-file.mjs +117 -0
  6. package/apps/studio/bin/_canvas-file.mjs +146 -0
  7. package/apps/studio/bin/_footage.mjs +123 -0
  8. package/apps/studio/bin/_pdf-playwright.mjs +14 -0
  9. package/apps/studio/bin/_png-playwright.mjs +15 -1
  10. package/apps/studio/bin/_pw-launch.mjs +98 -0
  11. package/apps/studio/bin/_retry-save.mjs +49 -0
  12. package/apps/studio/bin/_sync.mjs +145 -2
  13. package/apps/studio/bin/asset-rename.sh +12 -0
  14. package/apps/studio/bin/asset-trash.sh +12 -0
  15. package/apps/studio/bin/canvas-move.sh +12 -0
  16. package/apps/studio/bin/canvas-new.sh +12 -0
  17. package/apps/studio/bin/footage.sh +12 -0
  18. package/apps/studio/bin/generate.sh +7 -0
  19. package/apps/studio/bin/retry-save.sh +13 -0
  20. package/apps/studio/bridge/canvas-mode-store.ts +11 -2
  21. package/apps/studio/bridge/dgn-protocol.ts +8 -3
  22. package/apps/studio/bridge/occlusion.ts +45 -0
  23. package/apps/studio/canvas-theme-pill.tsx +169 -26
  24. package/apps/studio/client/export-center.jsx +32 -3
  25. package/apps/studio/client/home/HomeAccountBanner.jsx +61 -0
  26. package/apps/studio/client/home/HomeAccountsChip.jsx +404 -0
  27. package/apps/studio/client/home/HomeConnection.jsx +4 -3
  28. package/apps/studio/client/home/ProjectRows.jsx +514 -0
  29. package/apps/studio/client/home/home-accounts-model.js +148 -99
  30. package/apps/studio/client/home/home-api.js +4 -0
  31. package/apps/studio/client/home/home-app.jsx +127 -432
  32. package/apps/studio/client/home/home-icons.jsx +8 -0
  33. package/apps/studio/client/home/home-model.js +109 -0
  34. package/apps/studio/client/home/home.css +447 -111
  35. package/apps/studio/client/home/use-account-fix.js +123 -0
  36. package/apps/studio/client/v2/assets/generate-ask.jsx +3 -1
  37. package/apps/studio/client/v2/export/done-toast.jsx +2 -5
  38. package/apps/studio/client/v2/export/export-sheet.jsx +9 -2
  39. package/apps/studio/client/v2/export/export.css +9 -0
  40. package/apps/studio/client/v2/export/exports-model.js +16 -3
  41. package/apps/studio/client/v2/export/file-rows.jsx +81 -5
  42. package/apps/studio/client/v2/export/native-save.js +33 -0
  43. package/apps/studio/client/v2/export/sections/print-copy.js +3 -0
  44. package/apps/studio/client/v2/export/sections/print.jsx +37 -20
  45. package/apps/studio/client/v2/shell/occlusion-insets.js +37 -9
  46. package/apps/studio/client/v2/shell/use-occluded-insets.js +13 -3
  47. package/apps/studio/collab/room.ts +21 -7
  48. package/apps/studio/dist/client.bundle.js +692 -692
  49. package/apps/studio/dist/comment-mount.js +2 -2
  50. package/apps/studio/dist/styles.css +1 -1
  51. package/apps/studio/exporters/ghostscript.ts +78 -1
  52. package/apps/studio/exporters/pdf-fonts.ts +31 -4
  53. package/apps/studio/generation/jobs.ts +6 -0
  54. package/apps/studio/http.ts +6 -2
  55. package/apps/studio/routes/agent.ts +6 -2
  56. package/apps/studio/routes/project-undo.ts +10 -0
  57. package/apps/studio/server.ts +25 -0
  58. package/apps/studio/shell/cli-yield.ts +48 -11
  59. package/apps/studio/whats-new.json +18 -0
  60. package/cli/commands/design.mjs +74 -16
  61. package/cli/lib/bash-guard.mjs +4 -4
  62. package/cli/lib/confine-read.mjs +2 -0
  63. package/cli/lib/design-help.gen.mjs +15 -2
  64. package/cli/lib/design-hook.mjs +1 -1
  65. package/cli/lib/desktop-locate.mjs +36 -8
  66. package/cli/lib/studio-locate.mjs +8 -2
  67. package/cli/lib/sub-verbs.mjs +13 -1
  68. package/package.json +8 -8
  69. package/apps/studio/client/home/HomeAccounts.jsx +0 -262
  70. package/apps/studio/client/home/HomeAccountsRow.jsx +0 -221
@@ -67,6 +67,14 @@ const GLYPHS = {
67
67
  <path d="M5.5 8.25l1.75 1.75 3.25-3.75" />
68
68
  </>
69
69
  ),
70
+ // 2.1.2 HB1 — the accounts chip and an account line's "…"
71
+ people: (
72
+ <>
73
+ <circle cx="6" cy="5.5" r="2.25" />
74
+ <path d="M2 13c0-2.2 1.8-3.75 4-3.75s4 1.55 4 3.75M10.5 3.6a2.25 2.25 0 010 4.1M12 9.6c1.2.5 2 1.7 2 3.4" />
75
+ </>
76
+ ),
77
+ more: <path d="M3.5 8h.01M8 8h.01M12.5 8h.01" />,
70
78
  };
71
79
 
72
80
  export function HIcon({ name, size = 16 }) {
@@ -289,6 +289,11 @@ export function buildHomeModel({
289
289
  copies: [],
290
290
  folder: (p.root || '').split('/').filter(Boolean).pop() ?? '',
291
291
  cover: firstCover(ix),
292
+ // 2.1.2 — the row's quiet time: the registry's last open, else the newest canvas opened
293
+ lastOpenedAt:
294
+ typeof p.lastOpenedAt === 'number' && p.lastOpenedAt > 0
295
+ ? p.lastOpenedAt
296
+ : newestOpened(ix),
292
297
  };
293
298
  });
294
299
  allLocal.sort((a, b) => {
@@ -391,15 +396,80 @@ export function buildHomeModel({
391
396
  .sort((a, b) => (a.r === b.r ? a.i - b.i : a.r - b.r))
392
397
  .map((x) => x.g);
393
398
 
399
+ // 2.1.2 (artboards 15/16/19) — the page's one list: live rows by last use, then the Maude Cloud
400
+ // projects not on this Mac, then the folders that moved. A row says where it lives in one word and
401
+ // a state only when it isn't fine; an account's face only when this Mac has two Maude Cloud accounts.
402
+ const cloudAccounts = new Set(
403
+ (clouds ?? [])
404
+ .filter((c) => c?.signedIn && typeof c.profile === 'string')
405
+ .map((c) => c.account?.email || c.profile)
406
+ );
407
+ const faces = cloudAccounts.size >= 2;
408
+ const slim = (r) => ({ ...r, lives: livesOf(r, faces), flag: flagOf(r) });
409
+ const projects = [
410
+ ...localRows.filter((r) => r.status !== 'gone').map(slim),
411
+ ...cloudRows.map(slim),
412
+ ...localRows.filter((r) => r.status === 'gone').map((r) => ({ ...r, lives: null, flag: null })),
413
+ ];
414
+
415
+ // 2.1.2 — Pinned joined Recent canvases: the pinned cards first (newest pin), then the opened ones
416
+ const inFilter = (r) => !filterPid || r.pid === filterPid;
417
+ const cards = [
418
+ ...pinned.filter(inFilter),
419
+ ...opened.filter((r) => r.pinnedAt == null && inFilter(r)),
420
+ ];
421
+
394
422
  return {
395
423
  pinned,
396
424
  recent,
425
+ cards,
397
426
  recentProjects,
398
427
  groups: ranked,
428
+ projects,
399
429
  projectCount: localRows.length + cloudRows.length,
400
430
  };
401
431
  }
402
432
 
433
+ /** The newest `openedAt` among a project's canvases (the index), or null. */
434
+ function newestOpened(ix) {
435
+ let at = null;
436
+ for (const c of ix?.canvases ?? [])
437
+ if (typeof c?.openedAt === 'number' && (at == null || c.openedAt > at)) at = c.openedAt;
438
+ return at;
439
+ }
440
+
441
+ /**
442
+ * 2.1.2 — where a row lives, in one word: "Maude Cloud" (CONTRACT: the name, never the address),
443
+ * your server's host, "Your folder" or "Kept by Maude". `face` = the Maude Cloud account's face, only
444
+ * when `faces` (this Mac has two Maude Cloud accounts).
445
+ */
446
+ export function livesOf(row, faces = false) {
447
+ const w = row.where;
448
+ if (!w) return null;
449
+ if (w.kind === 'cloud') {
450
+ const email = row.connection?.account || (w.label !== 'Maude Cloud' ? w.label : null);
451
+ return {
452
+ kind: 'cloud',
453
+ word: 'Maude Cloud',
454
+ face: faces ? accountFace({ id: row.profile, label: email || '', email: email || '' }) : null,
455
+ };
456
+ }
457
+ return { kind: w.kind, word: w.label, face: null };
458
+ }
459
+
460
+ /**
461
+ * 2.1.2 — a row's state, only when it isn't fine: Needs you · a broken sign-in · AI working · (a
462
+ * Maude Cloud project) Not on this Mac yet. Resting, Offline and an unreachable server say nothing on
463
+ * a row (the top of the page raises what needs action).
464
+ */
465
+ export function flagOf(row) {
466
+ if (row.kind === 'cloud') return { kind: 'away', word: 'Not on this Mac yet' };
467
+ if (row.ai?.awaiting > 0) return { kind: 'needs', word: 'Needs you' };
468
+ if (row.conn?.tone === 'bad') return { kind: 'signin', word: row.conn.word };
469
+ if (row.ai?.running > 0) return { kind: 'ai', word: 'AI working' };
470
+ return null;
471
+ }
472
+
403
473
  /**
404
474
  * #206 T6.3g (contract 206 §5 "Home and Recent") — the worktree folders this Mac opened as tabs
405
475
  * (`shell_state.worktrees`, newest first) go under their main project's row as `worktrees`, never as
@@ -484,6 +554,45 @@ function collapseDuplicates(rows, cloudUrl) {
484
554
  if (!primary) byReal.set(key, r);
485
555
  else fold(primary, r, 'folder', r.folder || r.name);
486
556
  }
557
+
558
+ // (c) 2.1.2 (H1 #3) — a managed copy whose folder is gone is not a row of its own while its project
559
+ // is still here: a live copy of the same project (profile + hub + project id) hides it; else the ONE
560
+ // live folder of that profile linking the hub does, when every copy on that hub is of one project
561
+ // (a folder's linkedHub names no project id, so a hub with copies of two projects cannot be told).
562
+ // Hidden only — the registry keeps it (Remove from list is the person's click, never ours).
563
+ for (const c of out) {
564
+ if (!c.copyOf || live(c) || drop.has(c.pid)) continue;
565
+ const mine = (x) => x.profile === c.profile && x.boundHub === c.boundHub;
566
+ const twin = out.find(
567
+ (x) => x !== c && live(x) && !drop.has(x.pid) && mine(x) && x.copyOf === c.copyOf
568
+ );
569
+ if (twin) {
570
+ drop.add(c.pid);
571
+ continue;
572
+ }
573
+ const ids = new Set(out.filter((x) => x.copyOf && mine(x)).map((x) => x.copyOf));
574
+ if (ids.size !== 1) continue;
575
+ const folders = out.filter(
576
+ (x) =>
577
+ !x.copyOf && live(x) && !drop.has(x.pid) && x.profile === c.profile && x.hub === c.boundHub
578
+ );
579
+ if (folders.length === 1) drop.add(c.pid);
580
+ }
581
+
582
+ // (d) one orphan row per project: gone copies of one project id show once, carrying every pid
583
+ const orphans = new Map();
584
+ for (const r of out) {
585
+ if (live(r) || drop.has(r.pid)) continue;
586
+ r.pids = [r.pid];
587
+ if (!r.copyOf) continue;
588
+ const key = `${r.profile} ${r.boundHub} ${r.copyOf}`;
589
+ const first = orphans.get(key);
590
+ if (!first) orphans.set(key, r);
591
+ else {
592
+ first.pids.push(r.pid);
593
+ drop.add(r.pid);
594
+ }
595
+ }
487
596
  return out.filter((r) => !drop.has(r.pid));
488
597
  }
489
598