@1agh/maude 2.1.0 → 2.1.1

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 (100) hide show
  1. package/apps/studio/access/request.ts +1 -0
  2. package/apps/studio/actions/agents.ts +27 -0
  3. package/apps/studio/actions/defs/app.ts +28 -1
  4. package/apps/studio/actions/defs/sync.ts +4 -0
  5. package/apps/studio/actions.manifest.json +60 -2
  6. package/apps/studio/actions.parity.json +13 -1
  7. package/apps/studio/bin/_curl-local.mjs +7 -4
  8. package/apps/studio/client/app.jsx +16 -4
  9. package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
  10. package/apps/studio/client/home/HomeConnection.jsx +111 -0
  11. package/apps/studio/client/home/home-accounts-model.js +110 -1
  12. package/apps/studio/client/home/home-api.js +6 -2
  13. package/apps/studio/client/home/home-app.jsx +74 -12
  14. package/apps/studio/client/home/home-model.js +40 -1
  15. package/apps/studio/client/home/home-where-model.js +105 -0
  16. package/apps/studio/client/home/home.css +233 -1
  17. package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
  18. package/apps/studio/client/hooks/use-tabs.jsx +11 -4
  19. package/apps/studio/client/panels/TeamProjects.jsx +137 -134
  20. package/apps/studio/client/share-link.js +12 -0
  21. package/apps/studio/client/styles/_index.css +4 -0
  22. package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
  23. package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
  24. package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
  25. package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
  26. package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
  27. package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
  28. package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
  29. package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
  30. package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
  31. package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
  32. package/apps/studio/client/v2/link-server/link-server.css +109 -0
  33. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
  34. package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
  35. package/apps/studio/client/v2/search/search-keywords.js +3 -2
  36. package/apps/studio/client/v2/settings/account.jsx +4 -2
  37. package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
  38. package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
  39. package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
  40. package/apps/studio/client/v2/settings/general-section.jsx +138 -43
  41. package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
  42. package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
  43. package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
  44. package/apps/studio/client/v2/settings/settings-cards.js +220 -0
  45. package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
  46. package/apps/studio/client/v2/settings/settings-model.js +91 -31
  47. package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
  48. package/apps/studio/client/v2/settings/settings.css +374 -64
  49. package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
  50. package/apps/studio/client/v2/settings/this-project-model.js +172 -0
  51. package/apps/studio/client/v2/settings/use-connections.js +3 -2
  52. package/apps/studio/client/v2/settings/use-open-card.js +37 -0
  53. package/apps/studio/client/v2/shell/connection-state.js +197 -0
  54. package/apps/studio/client/v2/shell/menu-runner.js +7 -2
  55. package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
  56. package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
  57. package/apps/studio/client/v2/shell/project-account-model.js +272 -149
  58. package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
  59. package/apps/studio/client/v2/shell/project-account.css +237 -0
  60. package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
  61. package/apps/studio/client/v2/shell/shell-parity.js +3 -2
  62. package/apps/studio/client/v2/shell/shell-parity.json +40 -26
  63. package/apps/studio/client/v2/shell/use-account.js +2 -0
  64. package/apps/studio/client/v2/signin/use-signin.js +1 -1
  65. package/apps/studio/cloud/endpoints.ts +29 -4
  66. package/apps/studio/dist/client.bundle.js +834 -834
  67. package/apps/studio/dist/styles.css +1 -1
  68. package/apps/studio/home/accounts.ts +30 -11
  69. package/apps/studio/home/cloud.ts +6 -1
  70. package/apps/studio/home/hub-health.ts +76 -0
  71. package/apps/studio/home/routes.ts +9 -3
  72. package/apps/studio/http.ts +8 -0
  73. package/apps/studio/migrate/hub.ts +8 -1
  74. package/apps/studio/routes/hub-link-folder.ts +334 -0
  75. package/apps/studio/routes/hub-signin.ts +78 -1
  76. package/apps/studio/routes/index.ts +4 -0
  77. package/apps/studio/routes/sync.ts +22 -4
  78. package/apps/studio/shell/api-key.ts +11 -0
  79. package/apps/studio/sync/accepted-cold-start.ts +144 -8
  80. package/apps/studio/sync/action-stage.ts +18 -1
  81. package/apps/studio/sync/ctl-heal.ts +58 -0
  82. package/apps/studio/sync/file-ledger.ts +38 -4
  83. package/apps/studio/sync/file-plane.ts +226 -19
  84. package/apps/studio/sync/held-deletes.ts +86 -5
  85. package/apps/studio/sync/hub-link.ts +8 -0
  86. package/apps/studio/sync/index.ts +68 -4
  87. package/apps/studio/sync/link-consent.ts +22 -75
  88. package/apps/studio/sync/link-survey.ts +252 -0
  89. package/apps/studio/sync/local-kernel.ts +16 -1
  90. package/apps/studio/sync/seed-progress.ts +12 -0
  91. package/apps/studio/sync/source-recovery.ts +18 -2
  92. package/apps/studio/sync/status.ts +11 -1
  93. package/apps/studio/sync/writer-registry.ts +5 -0
  94. package/apps/studio/whats-new.json +18 -0
  95. package/cli/lib/bash-guard.mjs +19 -0
  96. package/cli/lib/design-help.gen.mjs +1 -1
  97. package/package.json +9 -8
  98. package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
  99. package/apps/studio/client/v2/shell/account-card-model.js +0 -114
  100. package/apps/studio/client/v2/shell/account-card.jsx +0 -189
@@ -165,6 +165,7 @@ const CANVAS_ONLY_REFUSED = new Set([
165
165
  '/_api/diagnostics/report',
166
166
  '/_api/debug-bundle',
167
167
  '/_api/cloud/move',
168
+ '/_api/hub/link-folder',
168
169
  '/_api/cloud/projects',
169
170
  '/_api/github/repos',
170
171
  // #122 (122-C) — the desktop shell's clip carriage (shell-token routes, `project` class): they move a
@@ -216,6 +216,23 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
216
216
  server: { route: '/_api/sync/held-deletes', method: 'POST' },
217
217
  agent: human('hub-link', 'which deleted files stay on the hub is the person’s choice'),
218
218
  },
219
+ // 2.1.1 T13 — the answer to a batch the PROJECT deleted, held on this Mac by the inbound breaker.
220
+ // Removing files from this Mac's project folder (into the trash) or keeping them is the person's call.
221
+ 'sync.remove-held-here': {
222
+ effect: 'project',
223
+ minRole: 'edit',
224
+ server: { route: '/_api/sync/held-deletes', method: 'POST' },
225
+ agent: human(
226
+ 'hub-link',
227
+ 'removing a batch of the project’s files from this Mac is the person’s choice'
228
+ ),
229
+ },
230
+ 'sync.keep-held-here': {
231
+ effect: 'none',
232
+ minRole: 'edit',
233
+ server: { route: '/_api/sync/held-deletes', method: 'POST' },
234
+ agent: human('hub-link', 'which deleted files stay on this Mac is the person’s choice'),
235
+ },
219
236
  // #167 T5.3 — a file the hub holds back from the code lane: adopting teammate bytes as the owner's code
220
237
  // is the owner's own call (implicit adoption was rejected on purpose), never the AI's.
221
238
  'sync.adopt-as-code': {
@@ -1809,6 +1826,16 @@ export const AGENT_PATHS: Readonly<Record<ActionId, ActionDefAI>> = {
1809
1826
  effect: 'none',
1810
1827
  agent: human('native-window', 'the desktop app’s profiles; an agent never picks an account'),
1811
1828
  },
1829
+ // 2.1.1 B1: a new Maude Cloud account signs in in the person's own browser.
1830
+ 'account.add-cloud': {
1831
+ effect: 'none',
1832
+ agent: human('native-window', 'Maude Cloud’s sign-in page; an agent never signs anyone in'),
1833
+ },
1834
+ // 2.1.1 B2: linking a server is a sign-in on that server's page, in the person's own browser.
1835
+ 'account.link-server': {
1836
+ effect: 'none',
1837
+ agent: human('native-window', 'the server’s sign-in page; an agent never signs anyone in'),
1838
+ },
1812
1839
  // 2.0.5 W4: GitHub's device flow — a person types the code in their own browser.
1813
1840
  'account.github-signin': {
1814
1841
  effect: 'none',
@@ -109,11 +109,38 @@ export const APP_ACTIONS: ActionDef[] = [
109
109
  // from the Share panel as usual. V2-4.8a: a CLOUD tab has it too — there it ends the browser session
110
110
  // (the v1 menubar's account chip + "Sign out", Cloud Phase 27 C4: who you are, and how to stop
111
111
  // being them) and the hub asks for a sign-in again; the row shows the account's email.
112
+ // 2.1.1 T4 (canvas 17 · ac-switch): on the desktop it opens the avatar menu's Switch account list —
113
+ // the accounts already on this Mac and "No account — this Mac only" (`project_use_account`, a
114
+ // confirm sheet first). It never moves a project to a fresh, empty account any more.
112
115
  id: 'account.switch',
113
- label: 'Sign in as another account…',
116
+ label: 'Switch account…',
114
117
  kind: 'command',
115
118
  exec: 'shell',
116
119
  visible: { shell: ['desktop', 'cloud'] },
120
+ search: { keywords: ['account', 'sign in', 'profile', 'no account', 'this mac only'] },
121
+ },
122
+ {
123
+ // 2.1.1 T4 — the Switch account list's foot: a Maude Cloud account this Mac does not hold yet. The
124
+ // V2-3.8 path: `cloud_sign_in_prepare` (a profile already signed in to Maude Cloud is never
125
+ // re-signed — the project moves to a fresh profile of its own, and the page reloads), then the cloud
126
+ // sign-in in Settings › Connections.
127
+ id: 'account.add-cloud',
128
+ label: 'Add a Maude Cloud account…',
129
+ kind: 'command',
130
+ exec: 'shell',
131
+ visible: { shell: ['desktop'] },
132
+ search: { keywords: ['cloud', 'sign in', 'account', 'login'] },
133
+ },
134
+ {
135
+ // 2.1.1 T3/T4/T5 — "Link your server…" / "Sign in with custom server…": the one team-server dialog
136
+ // (B2 wires it: it hears the `maude:link-server` event and prevents its default). Until it is there
137
+ // the row opens Settings › Connections, where today's team-server dialog lives.
138
+ id: 'account.link-server',
139
+ label: 'Link your server…',
140
+ kind: 'command',
141
+ exec: 'shell',
142
+ visible: { shell: ['desktop', 'browser'] },
143
+ search: { keywords: ['team server', 'hub', 'self-hosted', 'custom server', 'sign in', 'link'] },
117
144
  },
118
145
  {
119
146
  // 2.0.5 W4: GitHub sign-in from anywhere — the avatar's card, ⌘K and every "Sign in with GitHub to
@@ -54,6 +54,10 @@ export const SYNC_ACTIONS: ActionDef[] = [
54
54
  // one confirmed batch, or keep the files on the hub (`POST /_api/sync/held-deletes { answer }`).
55
55
  pick('sync.delete-held-on-hub', 'Move to the hub’s trash too…'),
56
56
  pick('sync.keep-held-on-hub', 'Keep on the hub'),
57
+ // 2.1.1 T13 — Sync details › Deleted by the project, held here: file the batch into the trash on this
58
+ // Mac, or keep this Mac's copies (`POST /_api/sync/held-deletes { answer: remove-here | keep-here }`).
59
+ pick('sync.remove-held-here', 'Remove here too'),
60
+ pick('sync.keep-held-here', 'Keep them here'),
57
61
  // #167 T5.3 — Sync details › a file the hub holds back from the code lane (the owner's held list):
58
62
  // keep it as code (`POST /_api/sync/adopt-held { path }` → the hub's owner-only adopt door), or open
59
63
  // the canvas folders (config.json `canvasGroups`) to keep it as a canvas. The second is the Mac
@@ -2,7 +2,7 @@
2
2
  "generated": "scripts/gen-actions.mjs — do not edit by hand",
3
3
  "format": "maude.actions-manifest",
4
4
  "v": 1,
5
- "manifestVersion": "e05dcafced81",
5
+ "manifestVersion": "cc9b94549577",
6
6
  "actions": [
7
7
  {
8
8
  "id": "search.open",
@@ -4457,7 +4457,7 @@
4457
4457
  },
4458
4458
  {
4459
4459
  "id": "account.switch",
4460
- "label": "Sign in as another account…",
4460
+ "label": "Switch account…",
4461
4461
  "kind": "command",
4462
4462
  "exec": "shell",
4463
4463
  "effect": "none",
@@ -4467,6 +4467,30 @@
4467
4467
  "note": "the desktop app’s profiles; an agent never picks an account"
4468
4468
  }
4469
4469
  },
4470
+ {
4471
+ "id": "account.add-cloud",
4472
+ "label": "Add a Maude Cloud account…",
4473
+ "kind": "command",
4474
+ "exec": "shell",
4475
+ "effect": "none",
4476
+ "agent": {
4477
+ "path": "human",
4478
+ "because": "native-window",
4479
+ "note": "Maude Cloud’s sign-in page; an agent never signs anyone in"
4480
+ }
4481
+ },
4482
+ {
4483
+ "id": "account.link-server",
4484
+ "label": "Link your server…",
4485
+ "kind": "command",
4486
+ "exec": "shell",
4487
+ "effect": "none",
4488
+ "agent": {
4489
+ "path": "human",
4490
+ "because": "native-window",
4491
+ "note": "the server’s sign-in page; an agent never signs anyone in"
4492
+ }
4493
+ },
4470
4494
  {
4471
4495
  "id": "account.github-signin",
4472
4496
  "label": "Sign in with GitHub…",
@@ -6548,6 +6572,40 @@
6548
6572
  "note": "which deleted files stay on the hub is the person’s choice"
6549
6573
  }
6550
6574
  },
6575
+ {
6576
+ "id": "sync.remove-held-here",
6577
+ "label": "Remove here too",
6578
+ "kind": "command",
6579
+ "exec": "shell",
6580
+ "effect": "project",
6581
+ "minRole": "edit",
6582
+ "server": {
6583
+ "route": "/_api/sync/held-deletes",
6584
+ "method": "POST"
6585
+ },
6586
+ "agent": {
6587
+ "path": "human",
6588
+ "because": "hub-link",
6589
+ "note": "removing a batch of the project’s files from this Mac is the person’s choice"
6590
+ }
6591
+ },
6592
+ {
6593
+ "id": "sync.keep-held-here",
6594
+ "label": "Keep them here",
6595
+ "kind": "command",
6596
+ "exec": "shell",
6597
+ "effect": "none",
6598
+ "minRole": "edit",
6599
+ "server": {
6600
+ "route": "/_api/sync/held-deletes",
6601
+ "method": "POST"
6602
+ },
6603
+ "agent": {
6604
+ "path": "human",
6605
+ "because": "hub-link",
6606
+ "note": "which deleted files stay on this Mac is the person’s choice"
6607
+ }
6608
+ },
6551
6609
  {
6552
6610
  "id": "sync.adopt-as-code",
6553
6611
  "label": "Adopt as code",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$comment": "Lead-owned (contract V2-1.11 §5.7). humanMax/pendingMax may only be lowered; raising either, or adding a humanDecisions reason, is a lead change citing a decision id.",
3
- "humanMax": 188,
3
+ "humanMax": 192,
4
4
  "pendingMax": 0,
5
5
  "pending": [],
6
6
  "humanDecisions": {
@@ -304,6 +304,18 @@
304
304
  "from": 186,
305
305
  "by": "decision:maude/v2-T5.3-held-row-actions-human",
306
306
  "why": "#167 T5.3 registers sync.adopt-as-code and sync.open-canvas-folders (Sync details › a file the hub holds back from the code lane). Human 'hub-link' for Adopt as code: adopting teammate bytes as the owner's code is the owner's call (implicit adoption was rejected, v2-p8-holds-fix-no-implicit-owner-adoption). Human 'native-window' for Open canvas folders: it opens the person's editor on config.json, like canvas.open-in-editor. Two human rows."
307
+ },
308
+ {
309
+ "to": 190,
310
+ "from": 188,
311
+ "by": "decision:maude/v2-2.1.1-t13-incoming-held-delete-answers",
312
+ "why": "2.1.1 T13 registers sync.remove-held-here and sync.keep-held-here (Sync details › Deleted by the project, held: Remove here too / Keep them here). Human 'hub-link': removing a batch of the project's files from this Mac, and which deleted files stay on it, is the person's choice. Two human rows."
313
+ },
314
+ {
315
+ "to": 192,
316
+ "from": 190,
317
+ "by": "decision:maude/v2-211-t4-switch-account-existing-profile",
318
+ "why": "2.1.1 B1/B2 register account.add-cloud (a new Maude Cloud account signs in in the person's browser) and account.link-server (a server sign-in on that server's page). Human 'native-window': an agent never signs anyone in. Two human rows."
307
319
  }
308
320
  ],
309
321
  "humanMaxRaisedNote": "V2-5 A1 integration: the three slice raises stack on 86 (84 -> 86 by decision:maude/v2-4-gate-github-doors, human 'accounts'). S4.1/S4.3/S4.4 and S2.2-S2.4 add no human row. 86 + 4 + 6 + 4 = 100 human actions in the merged registry. V2-5 A2 integration: S5.4 builds `maude design runs list|stop`, so ai.runs.list and ai.stop turn cli (decision:maude/v2-S5.3-run-actions-human-until-s5.4 resolved by decision:maude/v2-S5.4-runs-fallback-prompts) and the cap lowers 100 -> 98; S3.1, S4.2, S4.5, S9.4, S2.5 and S1.4 add no human row. V2-5 A4 integration: measured 107 human actions in the merged registry (98 on feat + tool.pointer from S3.2b + 7 chat.advanced.* from S5.12 + object.select-matching from S2.6); every other A4 slice adds no human row. V2-5 A5 integration: measured 113 human actions in the merged registry (107 on feat + trash.clear from S1.7b + four ai.attach-* from S5.10 + present.presenter-view from S3.6b); every other A5 slice adds no human row. V2-5 A6a integration: measured 118 human actions in the merged registry (113 on feat + artboard.ask-ai S2.10 + element.set-id S2.2b/lead + edit.undo-history S2.20 + history.filter S1.12b − view.trash S1.17 (cli) + tab.overview + tab.rename S1.22b); every other A6a slice adds no human row."
@@ -467,9 +467,12 @@ async function main() {
467
467
  }
468
468
 
469
469
  // Run only when invoked directly (not when imported by the test). This shim
470
- // runs under real `node` on a real on-disk path (never embedded in
471
- // `bun --compile`), so the classic argv[1] guard is correct here — see the
472
- // v0.38.0 self-heal memory.
473
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
470
+ // runs under real `node` on a real on-disk path; since 2.1.1 the server also imports its loopback
471
+ // refusals (the address check), so the module is reachable inside `bun --compile` too. There the
472
+ // argv[1] compare is unreliable — `import.meta.main` is the entry flag under bun, and the compare
473
+ // stays only for plain `node` (Node <24 leaves it undefined).
474
+ const runDirectly =
475
+ import.meta.main ?? (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href);
476
+ if (runDirectly) {
474
477
  main();
475
478
  }
@@ -238,7 +238,9 @@ import { CornerIcons } from './v2/shell/corner-icons.jsx';
238
238
  import ShellErrorBoundary from './v2/shell/shell-error-boundary.jsx';
239
239
  import { expectServedFrom, setServedFrom } from './v2/shell/served-routes.js';
240
240
  import { cutCopyPaste, createMenuHandlers, menuRunner } from './v2/shell/menu-runner.js';
241
+ import { openAccountMenu } from './v2/shell/project-account-bus.js';
241
242
  import DiagnosticsHost from './v2/diagnostics/diagnostics-host.jsx';
243
+ import LinkServerHost from './v2/link-server/LinkServerHost.jsx';
242
244
  import { useDiagnosticsMenu } from './v2/diagnostics/use-diagnostics-menu.js';
243
245
  import { menuCtx, moveDestinations } from './v2/shell/project-menu-model.js';
244
246
  import { usePagesView } from './v2/shell/use-canvas-mode-lane.js';
@@ -1773,7 +1775,7 @@ function ShellProjectPill() {
1773
1775
  onQuickSetup: () => setQuickSetupOpen(true),
1774
1776
  onIntro: () => setIntroOpen(true),
1775
1777
  onWhatsNew: whatsNew.openPanel,
1776
- onShare: () => showShare(),
1778
+ onShare: (opts) => showShare(undefined, opts),
1777
1779
  onReload: reloadActive,
1778
1780
  onCloseCanvas: () => activePath && closeTab(activePath),
1779
1781
  onAssembleVideo: assembleVideo,
@@ -1830,11 +1832,19 @@ function ShellProjectPill() {
1830
1832
  form.submit();
1831
1833
  return;
1832
1834
  }
1835
+ // 2.1.1 T4 — the desktop: the avatar menu's Switch account list (accounts already on this Mac,
1836
+ // "No account — this Mac only"). It never moves the project to a fresh, empty account.
1837
+ openAccountMenu('switch');
1838
+ },
1839
+ // 2.1.1 T4 — "Add a Maude Cloud account…": V2-3.8's prepare (a profile already signed in to Maude
1840
+ // Cloud is never re-signed: the project moves to a profile of its own and reloads), then the cloud
1841
+ // sign-in where it lives, Settings › Connections.
1842
+ onAddCloudAccount: () => {
1833
1843
  cloudSignInPrepare().then(
1834
1844
  (moved) => {
1835
- if (!moved) shellToast('Sign in from the Share panel to use another account.');
1845
+ if (!moved) setSettingsOpen('connections');
1836
1846
  },
1837
- (e) => shellToast(String(e?.message || e || 'Could not switch accounts.'))
1847
+ (e) => shellToast(String(e?.message || e || 'Could not add an account.'))
1838
1848
  );
1839
1849
  },
1840
1850
  onCutPaste: (kind) => cutCopyPaste(kind, openerRef.current, { postToActiveCanvas }),
@@ -1906,7 +1916,7 @@ function ShellProjectPill() {
1906
1916
  window.removeEventListener(OPEN_ASSETS_EVENT, onAttachAssets);
1907
1917
  };
1908
1918
  }, [openRightPanel, openTab, cfg?.designRel]);
1909
- // S1.22c: the native tab menu's "Sign in as another account…" arrives as `menu://action
1919
+ // S1.22c: the native tab menu's "Switch account…" arrives as `menu://action
1910
1920
  // {id:'account.switch'}` (tabs.rs TabMenuItem::SwitchAccount); it is not a palette row, so the
1911
1921
  // palette's menu://action listener never runs it — the menu handler does.
1912
1922
  useEffect(() => {
@@ -3217,6 +3227,8 @@ function ShellTree() {
3217
3227
  <ShellProjectPill />
3218
3228
  {/* V2-4.7b — Menu › Diagnostics: Logs · Server · AI setup · Sync (today's Sync panel, whole). */}
3219
3229
  <DiagnosticsHost toast={shellToast} />
3230
+ {/* 2.1.1 T5 — `account.link-server`: the one "Link your server" dialog (avatar, Settings, Sync). */}
3231
+ <LinkServerHost />
3220
3232
  {/* V2-4.3a — the Share cluster, top-right: faces, status word, comments, Exports, Hide panels, Share. */}
3221
3233
  <ShellShareCluster />
3222
3234
  {/* S2.20 — Menu › Edit › Undo history… (the ⌘Z projection's popover). */}
@@ -0,0 +1,221 @@
1
+ // client/home/HomeAccountsRow.jsx — 2.1.1 B4 (artboard 14): "Accounts on this Mac", the row on top of
2
+ // Home. One card per account (a Maude Cloud account by its e-mail, your server by its host) with where
3
+ // the person is signed in and whether that sign-in works; a sign-in that stopped working (or is
4
+ // missing) is fixed from its own card — Maude Cloud through Home's own sign-in, your server through the
5
+ // team-server sign-in with the address already filled in. Cards come from `homeAccountCards`
6
+ // (home-accounts-model.js); a server that does not answer has no button (nothing for the person to fix).
7
+
8
+ import { useEffect, useRef, useState } from 'react';
9
+
10
+ import { AcctFace, StateWord } from './HomeConnection.jsx';
11
+ import {
12
+ hubSignInCancel,
13
+ hubSignInPoll,
14
+ hubSignInStart,
15
+ openTeamServerSignIn,
16
+ } from './home-api.js';
17
+ import { slugOf } from './home-accounts-model.js';
18
+ import { CONN_TONE } from './home-where-model.js';
19
+
20
+ const POLL_MS = 1200;
21
+ const SIGNIN_WORDS = {
22
+ unreachable: 'Couldn’t reach that server. Check the address, or whether it’s online.',
23
+ noBrowser: 'The browser didn’t open. Nothing changed — try again.',
24
+ refused: 'That sign-in page can’t be opened from here. Nothing changed.',
25
+ };
26
+
27
+ /**
28
+ * @param {{ cards: object[], native: boolean, onCloudSignIn: (card: object) => unknown,
29
+ * onAddCloud: () => void, onAddTeam: () => void, onChanged?: () => unknown,
30
+ * pollMs?: number }} props
31
+ */
32
+ export function HomeAccountsRow({
33
+ cards,
34
+ native,
35
+ onCloudSignIn,
36
+ onAddCloud,
37
+ onAddTeam,
38
+ onChanged,
39
+ pollMs = POLL_MS,
40
+ }) {
41
+ const [adding, setAdding] = useState(false);
42
+ const [busy, setBusy] = useState(null); // the card key whose sign-in waits on the browser
43
+ const [error, setError] = useState(null);
44
+ const attempt = useRef(null); // { id, stop }
45
+ const wrap = useRef(null);
46
+
47
+ // leaving Home (or a new attempt) ends the one that waits
48
+ useEffect(
49
+ () => () => {
50
+ const a = attempt.current;
51
+ attempt.current = null;
52
+ if (a) {
53
+ a.stop();
54
+ void hubSignInCancel(a.id);
55
+ }
56
+ },
57
+ []
58
+ );
59
+ useEffect(() => {
60
+ if (!adding) return undefined;
61
+ const onKey = (e) => e.key === 'Escape' && setAdding(false);
62
+ const onDown = (e) => wrap.current && !wrap.current.contains(e.target) && setAdding(false);
63
+ window.addEventListener('keydown', onKey);
64
+ window.addEventListener('pointerdown', onDown);
65
+ return () => {
66
+ window.removeEventListener('keydown', onKey);
67
+ window.removeEventListener('pointerdown', onDown);
68
+ };
69
+ }, [adding]);
70
+
71
+ if (!cards.length && !native) return null;
72
+
73
+ const waitForBrowser = (id) =>
74
+ new Promise((resolve) => {
75
+ let timer = null;
76
+ const stop = () => {
77
+ clearTimeout(timer);
78
+ resolve({ ok: false, cancelled: true });
79
+ };
80
+ attempt.current = { id, stop };
81
+ const tick = async () => {
82
+ const p = await hubSignInPoll(id);
83
+ if (attempt.current?.id !== id) return;
84
+ if (p.json?.pending) {
85
+ timer = setTimeout(tick, pollMs);
86
+ return;
87
+ }
88
+ attempt.current = null;
89
+ resolve(
90
+ p.ok && p.json?.ok
91
+ ? { ok: true }
92
+ : { ok: false, error: p.json?.error || SIGNIN_WORDS.unreachable }
93
+ );
94
+ };
95
+ timer = setTimeout(tick, 0);
96
+ });
97
+
98
+ const fixServer = async (card) => {
99
+ setError(null);
100
+ setBusy(card.key);
101
+ const s = await hubSignInStart(card.fix.profile, card.fix.url);
102
+ if (!s.ok || !s.json?.ok) {
103
+ setBusy(null);
104
+ setError(s.json?.error || SIGNIN_WORDS.unreachable);
105
+ return;
106
+ }
107
+ const id = s.json.id;
108
+ const opened = await openTeamServerSignIn(s.json.signInUrl);
109
+ if (opened !== 'ok') {
110
+ void hubSignInCancel(id);
111
+ setBusy(null);
112
+ setError(opened === 'refused' ? SIGNIN_WORDS.refused : SIGNIN_WORDS.noBrowser);
113
+ return;
114
+ }
115
+ const done = await waitForBrowser(id);
116
+ setBusy(null);
117
+ if (done.cancelled) return;
118
+ if (!done.ok) {
119
+ setError(done.error);
120
+ return;
121
+ }
122
+ await onChanged?.();
123
+ };
124
+
125
+ const fix = (card) => (card.fix.path === 'cloud-signin' ? onCloudSignIn(card) : fixServer(card));
126
+
127
+ return (
128
+ <section
129
+ className="home-sec home-acr"
130
+ aria-labelledby="home-h-accounts"
131
+ data-testid="home-accounts-row"
132
+ >
133
+ <h2 className="home-h" id="home-h-accounts">
134
+ Accounts on this Mac
135
+ {native ? (
136
+ <span className="home-h-right home-acr-add" ref={wrap}>
137
+ <button
138
+ type="button"
139
+ className="btn btn--ghost btn--sm"
140
+ data-testid="home-accounts-row-add"
141
+ aria-haspopup="menu"
142
+ aria-expanded={adding}
143
+ onClick={() => setAdding((o) => !o)}
144
+ >
145
+ Add an account…
146
+ </button>
147
+ {adding ? (
148
+ <span className="island home-acr-menu" role="menu">
149
+ <button
150
+ type="button"
151
+ role="menuitem"
152
+ className="row-item"
153
+ data-testid="home-accounts-row-add-cloud"
154
+ onClick={() => {
155
+ setAdding(false);
156
+ onAddCloud?.();
157
+ }}
158
+ >
159
+ Add a Maude Cloud account…
160
+ </button>
161
+ <button
162
+ type="button"
163
+ role="menuitem"
164
+ className="row-item"
165
+ data-testid="home-accounts-row-add-team"
166
+ onClick={() => {
167
+ setAdding(false);
168
+ onAddTeam?.();
169
+ }}
170
+ >
171
+ Connect to a team server…
172
+ </button>
173
+ </span>
174
+ ) : null}
175
+ </span>
176
+ ) : null}
177
+ </h2>
178
+ <div className="home-acr-cards">
179
+ {cards.map((c) => {
180
+ const id = slugOf(c);
181
+ const bad = c.state === 'rejected' || c.state === 'missing';
182
+ return (
183
+ <span
184
+ key={c.key}
185
+ className={`home-acc${bad ? ' home-acc--bad' : ''}`}
186
+ data-kind={c.kind}
187
+ data-state={c.state}
188
+ data-testid={`home-account-card-${id}`}
189
+ >
190
+ <AcctFace face={c.face} state={c.state} size="lg" />
191
+ <span className="home-acc-t">
192
+ <strong>{c.title}</strong>
193
+ <span>{c.sub}</span>
194
+ <StateWord tone={CONN_TONE[c.state]} testid={`home-account-state-${id}`}>
195
+ {c.word}
196
+ </StateWord>
197
+ </span>
198
+ {c.fix ? (
199
+ <button
200
+ type="button"
201
+ className="btn btn--primary btn--sm"
202
+ data-testid={`home-account-signin-${id}`}
203
+ disabled={!native || busy === c.key}
204
+ title={native ? undefined : 'Sign in from the Maude app on your Mac.'}
205
+ onClick={() => fix(c)}
206
+ >
207
+ {busy === c.key ? 'Waiting for the browser…' : c.fix.label}
208
+ </button>
209
+ ) : null}
210
+ </span>
211
+ );
212
+ })}
213
+ </div>
214
+ {error ? (
215
+ <p className="home-acct-note" role="alert" data-testid="home-accounts-row-error">
216
+ {error}
217
+ </p>
218
+ ) : null}
219
+ </section>
220
+ );
221
+ }
@@ -0,0 +1,111 @@
1
+ // client/home/HomeConnection.jsx — 2.1.1 B4 (artboard 14): the pieces Home's accounts row and its project
2
+ // rows share — an account's face with the connection badge on it, the "Where" chip, and the state word.
3
+ // Models: home-where-model.js (words, tones) · home-accounts-model.js (cards). Nothing here decides a
4
+ // state; it draws what the model says.
5
+
6
+ import { HIcon } from './home-icons.jsx';
7
+
8
+ /** The broken-link glyph on a sign-in that stopped working (the project window's badge). */
9
+ function BrokenLink({ size = 10 }) {
10
+ return (
11
+ <svg
12
+ width={size}
13
+ height={size}
14
+ viewBox="0 0 16 16"
15
+ fill="none"
16
+ stroke="currentColor"
17
+ strokeWidth="1.6"
18
+ strokeLinecap="round"
19
+ aria-hidden="true"
20
+ >
21
+ <path d="M6.6 9.4 5.1 10.9a2.1 2.1 0 0 1-3-3l1.5-1.5" />
22
+ <path d="M9.4 6.6 10.9 5.1a2.1 2.1 0 0 1 3 3l-1.5 1.5" />
23
+ <path d="M5.2 1.8v1.6M1.8 5.2h1.6M10.8 14.2v-1.6M14.2 10.8h-1.6" />
24
+ </svg>
25
+ );
26
+ }
27
+
28
+ /** "Kept by Maude" — the mark, single colour. */
29
+ function KeptGlyph({ size = 12 }) {
30
+ return (
31
+ <svg width={size} height={size} viewBox="0 0 16 16" aria-hidden="true">
32
+ <rect x="1.5" y="1.5" width="13" height="13" rx="3.5" fill="currentColor" />
33
+ <path d="M8 4.2v7.6M4.2 8h7.6" stroke="var(--bg-1)" strokeWidth="1.6" strokeLinecap="round" />
34
+ </svg>
35
+ );
36
+ }
37
+
38
+ /**
39
+ * An account's face — a circle with a letter for a Maude Cloud account, a tile with the server glyph for
40
+ * your server, a laptop tile for this Mac — with the connection state as ONE badge on it (a thin ring
41
+ * turning while it syncs, a grey face offline, a broken link when a sign-in needs the person, a warning
42
+ * when the server does not answer).
43
+ * @param {{ face: { kind: string, initial?: string, tone?: string }, state?: string|null,
44
+ * size?: 'sm'|'md'|'lg' }} props
45
+ */
46
+ export function AcctFace({ face, state = null, size = 'md' }) {
47
+ const glyph = size === 'lg' ? 16 : size === 'md' ? 13 : 10;
48
+ return (
49
+ <span
50
+ className={`home-acf home-acf--${size}`}
51
+ data-conn={state ?? undefined}
52
+ aria-hidden="true"
53
+ >
54
+ {face.kind === 'cloud' ? (
55
+ <span className={`home-face home-face--${size} home-face--${face.tone}`}>
56
+ {face.initial}
57
+ </span>
58
+ ) : (
59
+ <span className={`home-acf-tile home-acf-tile--${face.kind} home-acf-tile--${size}`}>
60
+ <HIcon name={face.kind === 'server' ? 'server' : 'laptop'} size={glyph} />
61
+ </span>
62
+ )}
63
+ {state === 'syncing' ? <span className="home-acf-ring" /> : null}
64
+ {state === 'missing' || state === 'rejected' ? (
65
+ <span className="home-acf-badge home-acf-badge--bad">
66
+ <BrokenLink size={size === 'lg' ? 12 : size === 'md' ? 10 : 8} />
67
+ </span>
68
+ ) : null}
69
+ {state === 'unreachable' ? (
70
+ <span className="home-acf-badge home-acf-badge--warn">!</span>
71
+ ) : null}
72
+ </span>
73
+ );
74
+ }
75
+
76
+ /** The state as a word with its dot (green · red · amber · grey). */
77
+ export function StateWord({ tone, children, testid }) {
78
+ return (
79
+ <span className="home-sw" data-tone={tone} data-testid={testid}>
80
+ <i aria-hidden="true" />
81
+ {children}
82
+ </span>
83
+ );
84
+ }
85
+
86
+ const WHERE_ICON = { cloud: 'cloud', server: 'server', folder: 'folder' };
87
+
88
+ /**
89
+ * The "Where" chip: the account for a synced project (Maude Cloud by e-mail, your server by host), or the
90
+ * place for a project only on this Mac (Your folder · Kept by Maude), with the folder's path beside it.
91
+ * @param {{ where: { kind: string, label: string, path: string|null }, testid?: string }} props
92
+ */
93
+ export function WhereChip({ where, testid }) {
94
+ return (
95
+ <span className="home-where" data-kind={where.kind} data-testid={testid}>
96
+ <span className="home-place">
97
+ {where.kind === 'kept' ? (
98
+ <KeptGlyph size={12} />
99
+ ) : (
100
+ <HIcon name={WHERE_ICON[where.kind] ?? 'folder'} size={12} />
101
+ )}
102
+ <span>{where.label}</span>
103
+ </span>
104
+ {where.path ? (
105
+ <span className="home-where-path" title={where.path}>
106
+ {where.path}
107
+ </span>
108
+ ) : null}
109
+ </span>
110
+ );
111
+ }