@1agh/maude 2.0.3 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/README.md +6 -5
  2. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  3. package/apps/studio/access/filters.ts +12 -5
  4. package/apps/studio/access/known-canvases.ts +24 -1
  5. package/apps/studio/access/refused-inputs.ts +89 -0
  6. package/apps/studio/access/request.ts +0 -1
  7. package/apps/studio/acp/adapter-stderr.ts +43 -13
  8. package/apps/studio/acp/background-tasks.ts +155 -0
  9. package/apps/studio/acp/bridge.ts +44 -5
  10. package/apps/studio/acp/connected-fact.ts +15 -4
  11. package/apps/studio/acp/index.ts +14 -5
  12. package/apps/studio/actions/agents.ts +10 -0
  13. package/apps/studio/actions/defs/app.ts +12 -0
  14. package/apps/studio/actions/defs/view.ts +12 -0
  15. package/apps/studio/actions.manifest.json +25 -1
  16. package/apps/studio/actions.parity.json +13 -1
  17. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  18. package/apps/studio/annotations/ui/lod.tsx +1 -1
  19. package/apps/studio/annotations/ui/text-style.ts +1 -1
  20. package/apps/studio/annotations-layer.tsx +0 -12
  21. package/apps/studio/api.ts +73 -24
  22. package/apps/studio/artboard-live-gate.tsx +267 -0
  23. package/apps/studio/artboard-live.ts +336 -0
  24. package/apps/studio/artboard-webgl.ts +668 -0
  25. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  26. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  27. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  28. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  29. package/apps/studio/bin/_ds-check.mjs +4 -1
  30. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  31. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  32. package/apps/studio/bin/_import-asset.mjs +2 -1
  33. package/apps/studio/bin/_perf-probe.mjs +2 -1
  34. package/apps/studio/bin/_png-playwright.mjs +10 -1
  35. package/apps/studio/bin/_pw-launch.mjs +14 -0
  36. package/apps/studio/bin/_studio-verb.mjs +24 -3
  37. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  38. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  39. package/apps/studio/bin/_thumbs-playwright.mjs +93 -13
  40. package/apps/studio/bin/ds-check.sh +5 -1
  41. package/apps/studio/bin/perf.sh +11 -1
  42. package/apps/studio/bin/server-up.sh +7 -2
  43. package/apps/studio/bin/smoke.sh +19 -0
  44. package/apps/studio/boot-progress.ts +31 -0
  45. package/apps/studio/canvas-build-sandbox.ts +275 -42
  46. package/apps/studio/canvas-build-worker.ts +10 -0
  47. package/apps/studio/canvas-create.ts +24 -0
  48. package/apps/studio/canvas-lib.tsx +131 -12
  49. package/apps/studio/canvas-module-cache.ts +93 -0
  50. package/apps/studio/canvas-source/errors.ts +39 -0
  51. package/apps/studio/canvas-source/waiting.ts +290 -0
  52. package/apps/studio/client/actions/shell-key-handlers.js +5 -0
  53. package/apps/studio/client/app.jsx +19 -9
  54. package/apps/studio/client/canvas-url.js +13 -0
  55. package/apps/studio/client/github.js +23 -3
  56. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  57. package/apps/studio/client/home/Shelves.jsx +4 -3
  58. package/apps/studio/client/home/home-accounts-model.js +121 -0
  59. package/apps/studio/client/home/home-api.js +36 -19
  60. package/apps/studio/client/home/home-app.jsx +141 -40
  61. package/apps/studio/client/home/home-model.js +172 -6
  62. package/apps/studio/client/home/home.css +169 -5
  63. package/apps/studio/client/home/shell-mode.js +8 -1
  64. package/apps/studio/client/hooks/use-git-actions.jsx +2 -1
  65. package/apps/studio/client/hooks/use-project-data.jsx +2 -0
  66. package/apps/studio/client/hooks/use-shell-core.jsx +3 -0
  67. package/apps/studio/client/hooks/use-tabs.jsx +64 -35
  68. package/apps/studio/client/index-loader.ts +23 -3
  69. package/apps/studio/client/panels/ChatPanel.jsx +49 -57
  70. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  71. package/apps/studio/client/panels/DiffView.jsx +314 -248
  72. package/apps/studio/client/panels/TeamProjects.jsx +119 -69
  73. package/apps/studio/client/panels/acp-runtime.js +25 -0
  74. package/apps/studio/client/panels/caps-cache.js +46 -0
  75. package/apps/studio/client/panels/chat-finish.js +66 -0
  76. package/apps/studio/client/shell/frame-cap.js +53 -0
  77. package/apps/studio/client/shell/viewport.jsx +45 -8
  78. package/apps/studio/client/styles/_index.css +2 -0
  79. package/apps/studio/client/tree/tree.jsx +48 -21
  80. package/apps/studio/client/v2/access/access-client.js +2 -0
  81. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  82. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  83. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  84. package/apps/studio/client/v2/ai/BackgroundStrip.jsx +120 -0
  85. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  86. package/apps/studio/client/v2/ai/StoppedDivider.jsx +2 -1
  87. package/apps/studio/client/v2/ai/ai-run.css +87 -3
  88. package/apps/studio/client/v2/ai/background-model.js +113 -0
  89. package/apps/studio/client/v2/ai/needs-you-store.js +2 -1
  90. package/apps/studio/client/v2/ai/run-api.js +7 -3
  91. package/apps/studio/client/v2/ai/runs-store.js +2 -1
  92. package/apps/studio/client/v2/annotations/vote-store.js +11 -5
  93. package/apps/studio/client/v2/assets/asset-state-lane.js +6 -3
  94. package/apps/studio/client/v2/assets/assets-bus.js +10 -8
  95. package/apps/studio/client/v2/assets/browse-view.jsx +2 -0
  96. package/apps/studio/client/v2/assets/ds-library-view.jsx +47 -0
  97. package/apps/studio/client/v2/assets/spotlight-model.js +75 -0
  98. package/apps/studio/client/v2/assets/spotlight.css +153 -0
  99. package/apps/studio/client/v2/assets/spotlight.jsx +199 -0
  100. package/apps/studio/client/v2/assets/tile-menu.jsx +3 -1
  101. package/apps/studio/client/v2/assets/tile.jsx +3 -0
  102. package/apps/studio/client/v2/assets/use-assets.js +2 -1
  103. package/apps/studio/client/v2/canvases/canvases-panel.jsx +13 -2
  104. package/apps/studio/client/v2/canvases/covers.js +11 -5
  105. package/apps/studio/client/v2/canvases/folder-ask.js +139 -0
  106. package/apps/studio/client/v2/canvases/folder-dialogs.jsx +150 -0
  107. package/apps/studio/client/v2/canvases/trash-canvas.js +10 -2
  108. package/apps/studio/client/v2/canvases/trash-queue.js +152 -0
  109. package/apps/studio/client/v2/canvases/use-canvas-index.js +42 -18
  110. package/apps/studio/client/v2/canvases/use-pins.js +2 -1
  111. package/apps/studio/client/v2/code/canvas-error-card.jsx +70 -5
  112. package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
  113. package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
  114. package/apps/studio/client/v2/code/canvas-waiting-card.jsx +128 -0
  115. package/apps/studio/client/v2/code/canvas-waiting.js +164 -0
  116. package/apps/studio/client/v2/code/code-bus.js +5 -0
  117. package/apps/studio/client/v2/code/code.css +67 -0
  118. package/apps/studio/client/v2/code/use-canvas-source.js +19 -4
  119. package/apps/studio/client/v2/create/NameDialog.jsx +4 -2
  120. package/apps/studio/client/v2/create/name-dialog.css +10 -0
  121. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -23
  122. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  123. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  124. package/apps/studio/client/v2/ds/make-host.jsx +13 -12
  125. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -16
  126. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  127. package/apps/studio/client/v2/ds/truth-host.jsx +15 -14
  128. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  129. package/apps/studio/client/v2/empty/arriving.jsx +29 -12
  130. package/apps/studio/client/v2/empty/empty-host.jsx +8 -2
  131. package/apps/studio/client/v2/empty/not-local.jsx +31 -1
  132. package/apps/studio/client/v2/empty/use-empty-canvas.js +10 -1
  133. package/apps/studio/client/v2/export/last-finished.js +2 -1
  134. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  135. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  136. package/apps/studio/client/v2/history/git-model.js +21 -5
  137. package/apps/studio/client/v2/history/git-parts.jsx +76 -43
  138. package/apps/studio/client/v2/history/history.css +6 -0
  139. package/apps/studio/client/v2/left-panel/assets-panel.jsx +87 -10
  140. package/apps/studio/client/v2/left-panel/use-trash.js +2 -1
  141. package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +100 -33
  142. package/apps/studio/client/v2/onboarding/HubSheet.jsx +51 -83
  143. package/apps/studio/client/v2/onboarding/onboarding-model.js +10 -6
  144. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  145. package/apps/studio/client/v2/present/order-notes-artboards.js +2 -1
  146. package/apps/studio/client/v2/search/search-recent.js +3 -1
  147. package/apps/studio/client/v2/search/search-remote.js +6 -4
  148. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  149. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  150. package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
  151. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  152. package/apps/studio/client/v2/shell/menu-runner.js +12 -0
  153. package/apps/studio/client/v2/shell/occlusion-insets.js +14 -2
  154. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  155. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  156. package/apps/studio/client/v2/shell/recovery-store.js +2 -1
  157. package/apps/studio/client/v2/shell/served-routes.js +120 -0
  158. package/apps/studio/client/v2/shell/share-cluster-host.jsx +139 -11
  159. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  160. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  161. package/apps/studio/client/v2/shell/shell-activity.js +19 -0
  162. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  163. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  164. package/apps/studio/client/v2/shell/use-account.js +8 -1
  165. package/apps/studio/client/v2/shell/use-occluded-insets.js +3 -0
  166. package/apps/studio/client/v2/sync-states/conflict-card.jsx +7 -2
  167. package/apps/studio/client/v2/undo/use-undo-projection.jsx +3 -1
  168. package/apps/studio/cloud/endpoints.ts +23 -1
  169. package/apps/studio/collab/persistence.ts +9 -1
  170. package/apps/studio/collab/registry.ts +32 -0
  171. package/apps/studio/collab/room.ts +8 -0
  172. package/apps/studio/config-reload-wire.ts +53 -0
  173. package/apps/studio/dist/client.bundle.js +1098 -1102
  174. package/apps/studio/dist/styles.css +1 -1
  175. package/apps/studio/ds/board/specimen.tsx +12 -1
  176. package/apps/studio/ds/canvas-cli.ts +58 -2
  177. package/apps/studio/ds/check.ts +26 -1
  178. package/apps/studio/ds/cli.ts +7 -3
  179. package/apps/studio/ds/convert.ts +34 -6
  180. package/apps/studio/ds/ds-verb.ts +13 -0
  181. package/apps/studio/ds/post-build.ts +38 -0
  182. package/apps/studio/ds/upgrade-apply.ts +27 -5
  183. package/apps/studio/ds/upgrade-cli.ts +22 -2
  184. package/apps/studio/ds/upgrade-prove.ts +198 -15
  185. package/apps/studio/ds/upgrade-stage.ts +4 -1
  186. package/apps/studio/editing/minimap-context.tsx +3 -3
  187. package/apps/studio/editing/page-activity.ts +251 -0
  188. package/apps/studio/editing/rotate-handle.tsx +9 -5
  189. package/apps/studio/editing/sticky-name.tsx +4 -4
  190. package/apps/studio/history/restore-artboard-action.ts +40 -0
  191. package/apps/studio/history/trash.ts +6 -0
  192. package/apps/studio/home/accounts.ts +87 -0
  193. package/apps/studio/home/hub.ts +77 -175
  194. package/apps/studio/home/index-reader.ts +24 -2
  195. package/apps/studio/home/routes.ts +66 -8
  196. package/apps/studio/http.ts +131 -68
  197. package/apps/studio/index-flight.ts +40 -0
  198. package/apps/studio/managed-projects.ts +52 -24
  199. package/apps/studio/migrate/hub.ts +7 -1
  200. package/apps/studio/routes/canvas-source.ts +44 -2
  201. package/apps/studio/routes/ds-convert.ts +18 -0
  202. package/apps/studio/routes/history.ts +28 -5
  203. package/apps/studio/routes/hub-signin.ts +115 -0
  204. package/apps/studio/routes/index.ts +4 -0
  205. package/apps/studio/routes/table.ts +7 -0
  206. package/apps/studio/routes/trash.ts +19 -1
  207. package/apps/studio/server.ts +19 -10
  208. package/apps/studio/sync/accepted-cold-start.ts +54 -16
  209. package/apps/studio/sync/accepted-link.ts +9 -4
  210. package/apps/studio/sync/asset-push.ts +146 -23
  211. package/apps/studio/sync/asset-state.ts +3 -2
  212. package/apps/studio/sync/code-module-consent.ts +74 -0
  213. package/apps/studio/sync/file-ledger.ts +35 -0
  214. package/apps/studio/sync/file-membership.ts +28 -3
  215. package/apps/studio/sync/file-plane.ts +483 -86
  216. package/apps/studio/sync/file-pull.ts +304 -33
  217. package/apps/studio/sync/hub-browser-signin.ts +377 -0
  218. package/apps/studio/sync/hub-link.ts +1 -2
  219. package/apps/studio/sync/hub-text-undo.ts +30 -10
  220. package/apps/studio/sync/index.ts +381 -161
  221. package/apps/studio/sync/journal-client.ts +94 -5
  222. package/apps/studio/sync/pending-deletes.ts +100 -0
  223. package/apps/studio/sync/projection.ts +121 -14
  224. package/apps/studio/sync/pull-pacer.ts +160 -0
  225. package/apps/studio/sync/pull-priority.ts +119 -0
  226. package/apps/studio/sync/seed-progress.ts +58 -3
  227. package/apps/studio/sync/status.ts +3 -1
  228. package/apps/studio/sync/transaction-client.ts +71 -6
  229. package/apps/studio/sync/workspace-signin.ts +6 -256
  230. package/apps/studio/sync/writer-registry.ts +5 -1
  231. package/apps/studio/thumbs/service.ts +12 -2
  232. package/apps/studio/thumbs/validate.ts +7 -0
  233. package/apps/studio/ui-prefs-migrate.ts +4 -0
  234. package/apps/studio/video-comp.tsx +23 -0
  235. package/apps/studio/video-links-overlay.tsx +3 -2
  236. package/apps/studio/whats-new.json +126 -0
  237. package/cli/lib/bash-guard.mjs +13 -1
  238. package/cli/lib/design-help.gen.mjs +1 -1
  239. package/cli/lib/design-hook.mjs +20 -0
  240. package/cli/lib/studio-locate.mjs +35 -10
  241. package/cli/lib/workspace-plan.mjs +14 -0
  242. package/package.json +8 -8
@@ -53,12 +53,66 @@ import { normalizeOpenPath } from '../../share-link.js';
53
53
  import { useAccount } from './use-account.js';
54
54
  import { useCanvasModeLane } from './use-canvas-mode-lane.js';
55
55
  import { usePanelLayout } from './use-panel-layout.js';
56
- import { isNativeApp } from '../../github.js';
56
+ import { invoke as shellInvoke, isNativeApp, openTeamServerSignIn } from '../../github.js';
57
57
  import {
58
58
  chosenDisplay,
59
59
  presenterAvailable,
60
60
  usePresenterDisplays,
61
61
  } from '../present/presenter-store.js';
62
+ import { servedFetch } from './served-routes.js';
63
+ import { CLOUD_CHANGED_EVENT } from '../../panels/CloudBar.jsx';
64
+ import { GitHubSignInSheet, useGitHubSignInHost } from './github-signin-host.jsx';
65
+ import { ProjectAccountCard, ProjectAccountPopover } from './project-account-card.jsx';
66
+ import { projectAccount } from './project-account-model.js';
67
+ import { runTeamSwitch } from './team-switch.js';
68
+
69
+ /** 2.0.5 W4 — the team server sign-in's recorded account (`GET /_api/connections/hub`, Settings' own read). */
70
+ function useHubAccount(enabled, url) {
71
+ const [account, setAccount] = useState(null);
72
+ // biome-ignore lint/correctness/useExhaustiveDependencies: `url` re-reads when the folder's link moves
73
+ useEffect(() => {
74
+ if (!enabled) {
75
+ setAccount(null);
76
+ return undefined;
77
+ }
78
+ let live = true;
79
+ fetch('/_api/connections/hub')
80
+ .then((r) => (r.ok ? r.json() : null))
81
+ .then((j) => {
82
+ if (live) setAccount(typeof j?.hub?.account === 'string' ? j.hub.account : null);
83
+ })
84
+ .catch(() => {});
85
+ return () => {
86
+ live = false;
87
+ };
88
+ }, [enabled, url]);
89
+ return account;
90
+ }
91
+
92
+ /** Settings' team-server "Sign out": POST /_api/cloud/detach — the link and its sign-in, this profile only. */
93
+ async function detachHub(host) {
94
+ try {
95
+ const r = await fetch('/_api/cloud/detach', { method: 'POST' });
96
+ const j = await r.json().catch(() => ({}));
97
+ if (!r.ok || !j?.ok) throw new Error(j?.error || String(r.status));
98
+ window.dispatchEvent(
99
+ new CustomEvent(CLOUD_CHANGED_EVENT, { detail: { from: 'account-card' } })
100
+ );
101
+ shellToast(`Signed out of ${host || 'the team server'}. Your work stays on this Mac.`, true);
102
+ } catch {
103
+ shellToast('Could not sign out. Nothing changed — try again.');
104
+ }
105
+ }
106
+
107
+ /** `{ ok, status, json }` of a same-origin JSON call (team-switch.js's `api`). */
108
+ async function jsonFetch(path, init) {
109
+ try {
110
+ const r = await fetch(path, init);
111
+ return { ok: r.ok, status: r.status, json: await r.json().catch(() => null) };
112
+ } catch {
113
+ return { ok: false, status: 0, json: null };
114
+ }
115
+ }
62
116
 
63
117
  const subscribeOnline = (fn) => {
64
118
  window.addEventListener('online', fn);
@@ -83,7 +137,7 @@ function useOutboxPending(enabled, nudge) {
83
137
  let live = true;
84
138
  const read = () => {
85
139
  if (document.visibilityState === 'hidden') return;
86
- fetch('/_api/outbox')
140
+ servedFetch('/_api/outbox')
87
141
  .then((r) => (r.ok ? r.json() : null))
88
142
  .then((v) => {
89
143
  if (live) setPending(outboxPending(v));
@@ -248,7 +302,8 @@ export function ShellShareCluster() {
248
302
  // S1.22a — the account chip (desktop): which Mac account this project tab is bound to. A cloud tab's
249
303
  // account is the hub's, a browser tab has none: both get no chip.
250
304
  const native = isNativeApp();
251
- const acct = useAccount(native && !cfg?.cloud);
305
+ // 2.0.5 W4 — every non-cloud tab reads its account (a browser tab on this Mac shows the facts too)
306
+ const acct = useAccount(!cfg?.cloud);
252
307
  const projectName = cfg?.cloud?.projectName || project;
253
308
  const chip = useMemo(
254
309
  () =>
@@ -274,6 +329,61 @@ export function ShellShareCluster() {
274
329
  : null,
275
330
  [chip, projectName, cfg?.profile, acct.email, acct.accounts]
276
331
  );
332
+ // 2.0.5 W4 — the avatar (your face, or the chip) opens THIS project's account: kind, profile, hub or
333
+ // cloud project, the login; Sign out on the kind's existing path, Switch through bind-on-sign-in.
334
+ const gh = useGitHubSignInHost();
335
+ const [acctOpen, setAcctOpen] = useState(false);
336
+ const closeAcct = useCallback(() => setAcctOpen(false), []);
337
+ // the account's own read once it answered (it follows a sign-out), the shell's link until then
338
+ const linkHub = acct.linkedHub !== undefined ? acct.linkedHub : (cloudLinkedHub ?? null);
339
+ const hubAccount = useHubAccount(!cfg?.cloud && !!linkHub?.credentialed, linkHub?.url);
340
+ const projectAcct = useMemo(
341
+ () =>
342
+ projectAccount({
343
+ native,
344
+ cloudTab: cfg?.cloud ?? null,
345
+ profile: cfg?.profile,
346
+ project: projectName,
347
+ linkedHub: linkHub,
348
+ hubAccount,
349
+ cloudUrl: acct.cloudUrl,
350
+ cloudConnected: acct.connected,
351
+ cloudEmail: acct.email,
352
+ github: { state: gh.state, login: gh.login },
353
+ }),
354
+ [native, cfg?.cloud, cfg?.profile, projectName, linkHub, hubAccount, acct, gh.state, gh.login]
355
+ );
356
+ const signOutPath = useCallback(
357
+ async (path) => {
358
+ if (path === 'cloud-signout') return acct.signOut();
359
+ if (path === 'github-signout') return gh.signOut();
360
+ if (path === 'hub-detach') return detachHub(projectAcct.where);
361
+ },
362
+ [acct, gh, projectAcct.where]
363
+ );
364
+ // 2.0.5 W4b — Switch / Sign in for a team server: `team_sign_in_prepare` first (bind-on-sign-in for
365
+ // a hub), then the server's own page. Words come back as one toast.
366
+ const switchPath = useCallback(
367
+ async (spec) => {
368
+ if (spec?.path !== 'hub-switch') return;
369
+ const r = await runTeamSwitch({
370
+ url: spec.url,
371
+ native,
372
+ invoke: shellInvoke,
373
+ api: jsonFetch,
374
+ openPage: openTeamServerSignIn,
375
+ wait: (ms) => new Promise((res) => setTimeout(res, ms)),
376
+ });
377
+ if (r.cancelled) return;
378
+ if (r.message) shellToast(r.message, true);
379
+ else if (r.error) shellToast(r.error);
380
+ if (r.ok && !r.moved)
381
+ window.dispatchEvent(
382
+ new CustomEvent(CLOUD_CHANGED_EVENT, { detail: { from: 'account-card' } })
383
+ );
384
+ },
385
+ [native]
386
+ );
277
387
  // S9.23 — the faces' menu and people list: where people are, Follow / Go to / Bring everyone here.
278
388
  const presence = usePresenceHost({
279
389
  lane,
@@ -309,15 +419,32 @@ export function ShellShareCluster() {
309
419
  <ShareCluster
310
420
  cloud={!!cfg?.cloud}
311
421
  accountSlot={
312
- chip ? (
313
- <AccountChip
314
- chip={chip}
315
- card={card}
316
- onSwitch={() => menuRunner.run('account.switch')}
317
- onSignOut={acct.signOut}
318
- />
319
- ) : null
422
+ <>
423
+ <span className="sh-pa-anchor">
424
+ <ProjectAccountPopover open={acctOpen} onClose={closeAcct}>
425
+ <ProjectAccountCard
426
+ account={projectAcct}
427
+ run={(id) => menuRunner.run(id)}
428
+ onSignOut={signOutPath}
429
+ onSwitch={switchPath}
430
+ onClose={closeAcct}
431
+ />
432
+ </ProjectAccountPopover>
433
+ </span>
434
+ {chip ? (
435
+ <AccountChip
436
+ chip={chip}
437
+ card={card}
438
+ onSwitch={() => menuRunner.run('account.switch')}
439
+ onSignOut={acct.signOut}
440
+ onOpen={() => setAcctOpen((o) => !o)}
441
+ opened={acctOpen}
442
+ />
443
+ ) : null}
444
+ </>
320
445
  }
446
+ onAccount={() => setAcctOpen((o) => !o)}
447
+ accountOpen={acctOpen}
321
448
  faces={faces}
322
449
  onFollow={lane.follow}
323
450
  presence={presence}
@@ -386,6 +513,7 @@ export function ShellShareCluster() {
386
513
  run={(id) => menuRunner.run(id)}
387
514
  onOpenTab={openTrashed}
388
515
  />
516
+ <GitHubSignInSheet gh={gh} />
389
517
  </>
390
518
  );
391
519
  }
@@ -98,6 +98,21 @@
98
98
  overflow: hidden;
99
99
  text-overflow: ellipsis;
100
100
  }
101
+ /* 2.0.5 W4 — the word is a button (Diagnostics › Sync): no chrome until hover/focus */
102
+ .sh-saved--btn {
103
+ appearance: none;
104
+ border: 0;
105
+ background: transparent;
106
+ font: inherit;
107
+ font-size: var(--type-xs, 12px);
108
+ border-radius: var(--radius-md, 8px);
109
+ cursor: pointer;
110
+ }
111
+ .sh-saved--btn:hover,
112
+ .sh-saved--btn:focus-visible {
113
+ background: var(--accent-muted, var(--bg-3));
114
+ outline: none;
115
+ }
101
116
  .sh-saved--warn {
102
117
  color: var(--status-warn-text, var(--status-warn));
103
118
  }
@@ -438,6 +453,49 @@
438
453
  height: 32px;
439
454
  font-size: var(--type-sm, 13px);
440
455
  }
456
+ /* 2.0.5 W4 — this project's account (project-account-card.jsx), anchored at the cluster's start */
457
+ .sh-pa-anchor {
458
+ position: relative;
459
+ flex: none;
460
+ width: 0;
461
+ align-self: stretch;
462
+ }
463
+ .sh-pa {
464
+ display: flex;
465
+ flex-direction: column;
466
+ gap: 2px;
467
+ }
468
+ .sh-pa-h {
469
+ margin: 0;
470
+ padding: var(--space-1, 4px) var(--space-2, 8px);
471
+ font-size: var(--type-xs, 12px);
472
+ font-weight: var(--w-semibold, 600);
473
+ color: var(--fg-2);
474
+ }
475
+ .sh-pa-line {
476
+ display: flex;
477
+ justify-content: space-between;
478
+ gap: var(--space-3, 12px);
479
+ padding: 2px var(--space-2, 8px);
480
+ font-size: var(--type-xs, 12px);
481
+ }
482
+ .sh-pa-k {
483
+ color: var(--fg-2);
484
+ flex: none;
485
+ }
486
+ .sh-pa-v {
487
+ color: var(--fg-0);
488
+ min-width: 0;
489
+ overflow: hidden;
490
+ text-overflow: ellipsis;
491
+ white-space: nowrap;
492
+ }
493
+ .sh-pa-note {
494
+ margin: 0;
495
+ padding: 2px var(--space-2, 8px);
496
+ font-size: var(--type-xs, 12px);
497
+ color: var(--fg-2);
498
+ }
441
499
  .sh-acct-card {
442
500
  position: absolute;
443
501
  top: calc(100% + var(--space-2, 8px));
@@ -69,6 +69,8 @@ const withKey = (label, def, ctx) => {
69
69
  * @param present the Present spec while presenting (Artboards · Canvas are two columns of the table)
70
70
  * @param accountSlot the account chip + card (S1.22a, account-card.jsx) — first, desktop only
71
71
  * @param cloud this shell is a cloud tab: no sentence names a Mac (rc3-i)
72
+ * @param onAccount 2.0.5 W4 — your own face opens this project's account card (null: the face is a face)
73
+ * @param accountOpen the account card is showing (the face's aria-expanded)
72
74
  */
73
75
  export function ShareCluster({
74
76
  faces,
@@ -93,6 +95,8 @@ export function ShareCluster({
93
95
  mode = null,
94
96
  present = null,
95
97
  accountSlot = null,
98
+ onAccount = null,
99
+ accountOpen = false,
96
100
  cloud,
97
101
  }) {
98
102
  const cluster = mode ? modeCell('share-cluster', mode, present) : 'full';
@@ -133,7 +137,13 @@ export function ShareCluster({
133
137
  data-zen={panelsHidden ? 'true' : undefined}
134
138
  >
135
139
  {accountSlot}
136
- <PresenceFaces faces={faces} onFollow={onFollow} presence={presence} />
140
+ <PresenceFaces
141
+ faces={faces}
142
+ onFollow={onFollow}
143
+ presence={presence}
144
+ onYou={onAccount}
145
+ youOpen={accountOpen}
146
+ />
137
147
  {access ? (
138
148
  <span
139
149
  className="sh-saved"
@@ -145,21 +155,30 @@ export function ShareCluster({
145
155
  </span>
146
156
  ) : status ? (
147
157
  <>
148
- <span
149
- className={`sh-saved${status.tone ? ` sh-saved--${status.tone}` : ''}`}
158
+ {/* 2.0.5 W4 — the word is a button in every sync state: Diagnostics › Sync (`diag.sync`, the
159
+ registry row the menu and ⌘K run), or — while a held conflict waits — that conflict's
160
+ Compare. The live region is the word inside, so a state change is still announced. */}
161
+ <button
162
+ type="button"
163
+ className={`sh-saved sh-saved--btn${status.tone ? ` sh-saved--${status.tone}` : ''}`}
150
164
  data-testid="share-cluster-status"
151
165
  data-status={status.kind}
152
166
  // The old status-bar chip's detail (its tooltip and its short label — "3 to review",
153
167
  // "1 refused", "12/40") rides on the word: hover for the sentence; `data-sync-label` is
154
168
  // the short form for scenarios and scripts (V2-4.8b).
155
169
  data-sync-label={status.syncLabel || undefined}
156
- role="status"
157
- aria-live="polite"
158
170
  title={status.detail || status.title || undefined}
171
+ aria-label={`${status.word} — ${status.conflict ? 'Compare' : 'Sync details'}`}
172
+ onClick={() => {
173
+ if (status.conflict) onStatusAction?.('compare');
174
+ else run('diag.sync');
175
+ }}
159
176
  >
160
177
  <StIcon name={status.icon} size={16} />
161
- <span className="sh-saved-w">{status.word}</span>
162
- </span>
178
+ <span className="sh-saved-w" role="status" aria-live="polite">
179
+ {status.word}
180
+ </span>
181
+ </button>
163
182
  {status.actions.map((a) => (
164
183
  <button
165
184
  key={a.id}
@@ -0,0 +1,19 @@
1
+ // client/v2/shell/shell-activity.js — 2.0.4 (task O): the shell window's one activity clock, for its server polls.
2
+ //
3
+ // The canvas's clock (editing/page-activity.ts) turns idle after 3 s and counts node changes as use; the shell
4
+ // re-renders on its own (relative times, live rows), so here only input, messages from the canvas, resize, focus
5
+ // and visibility count, and "unused" starts after a minute. `pacedInterval(fn, ms, shellActivity())` keeps the pace
6
+ // while the window is used, slows while it is only looked at, and stops while it is hidden.
7
+
8
+ import { createPageActivity, domActivityEnv } from '../../../editing/page-activity.ts';
9
+
10
+ export const SHELL_IDLE_AFTER_MS = 60_000;
11
+
12
+ let one = null;
13
+
14
+ /** The shell's activity clock (made on first use; null outside a browser). */
15
+ export function shellActivity() {
16
+ if (one || typeof window === 'undefined' || typeof document === 'undefined') return one;
17
+ one = createPageActivity(domActivityEnv(window, { nodes: false }), SHELL_IDLE_AFTER_MS);
18
+ return one;
19
+ }
@@ -0,0 +1,94 @@
1
+ // client/v2/shell/team-switch.js — 2.0.5 W4b: Switch / Sign in for a team-server project.
2
+ //
3
+ // Option A of the W4 open point: a team server's credential lands in the project's PROFILE
4
+ // (`hubs.json`), so signing in as someone else on a profile other projects share would re-sign them
5
+ // too — V2-3.8 forbids it. So, in the app:
6
+ // 1. `team_sign_in_prepare` (Rust, project tabs only; the caller's label + origin are checked
7
+ // there). `true` = this project shared its profile: it is now bound to a fresh profile of its
8
+ // own and its server restarts onto it — the page reloads signed out, and the person signs in
9
+ // there (the card then offers "Sign in to <host>…"). Stop here.
10
+ // 2. `false` = this project is alone on its profile: run the team server's own sign-in page
11
+ // (`/_api/hub-signin/start` → `open_team_server_signin` → poll). The server's route restarts
12
+ // sync for this project's own server once the new sign-in is stored.
13
+ // No credential crosses this page; it only passes the server address and an attempt id.
14
+ //
15
+ // Pure over its effects (`invoke`, `api`, `openPage`, `wait`) so the test drives it with stubs.
16
+
17
+ const POLL_MS = 1500;
18
+ const POLL_CAP = 400; // 10 min at 1.5 s — the attempt's own lifetime
19
+
20
+ export const TEAM_SWITCH_WORDS = Object.freeze({
21
+ moved:
22
+ 'This project now has an account of its own on this Mac. Sign in to the team server again once it reloads.',
23
+ refused: 'Maude won’t open that address. Check the server address in Settings › Connections.',
24
+ failed: 'Maude couldn’t open your browser. Try again.',
25
+ start: 'The sign-in could not start. Try again.',
26
+ unfinished: 'The sign-in did not finish. Try again.',
27
+ needsApp: 'Switching a team-server account needs the Maude desktop app.',
28
+ });
29
+
30
+ const hostOf = (url) => {
31
+ try {
32
+ return new URL(String(url)).host;
33
+ } catch {
34
+ return String(url || '');
35
+ }
36
+ };
37
+
38
+ /**
39
+ * @returns {Promise<{ ok: boolean, moved?: boolean, url?: string, user?: string|null, error?: string }>}
40
+ */
41
+ export async function runTeamSwitch({ url, native, invoke, api, openPage, wait, cancelled }) {
42
+ if (!native || typeof invoke !== 'function')
43
+ return { ok: false, error: TEAM_SWITCH_WORDS.needsApp };
44
+ if (!url) return { ok: false, error: TEAM_SWITCH_WORDS.start };
45
+ let moved;
46
+ try {
47
+ moved = await invoke('team_sign_in_prepare');
48
+ } catch (e) {
49
+ return { ok: false, error: String(e?.message || e || TEAM_SWITCH_WORDS.start) };
50
+ }
51
+ if (moved === true) return { ok: true, moved: true, message: TEAM_SWITCH_WORDS.moved };
52
+
53
+ const post = (path, body) =>
54
+ api(path, {
55
+ method: 'POST',
56
+ headers: { 'content-type': 'application/json' },
57
+ body: JSON.stringify(body),
58
+ });
59
+ const r = await post('/_api/hub-signin/start', { url });
60
+ if (!r?.ok || !r.json?.ok || !r.json.id)
61
+ return { ok: false, error: r?.json?.error || TEAM_SWITCH_WORDS.start };
62
+ const id = r.json.id;
63
+ const opened = await openPage(r.json.signInUrl);
64
+ if (opened !== 'ok') {
65
+ void post('/_api/hub-signin/cancel', { id });
66
+ return {
67
+ ok: false,
68
+ error: opened === 'refused' ? TEAM_SWITCH_WORDS.refused : TEAM_SWITCH_WORDS.failed,
69
+ };
70
+ }
71
+ for (let i = 0; i < POLL_CAP; i++) {
72
+ await wait(POLL_MS);
73
+ if (cancelled?.()) {
74
+ void post('/_api/hub-signin/cancel', { id });
75
+ return { ok: false, cancelled: true };
76
+ }
77
+ const p = await post('/_api/hub-signin/poll', { id });
78
+ if (p?.json?.pending) continue;
79
+ if (p?.ok && p.json?.ok && p.json.url) {
80
+ const user = typeof p.json.user?.email === 'string' ? p.json.user.email : null;
81
+ return {
82
+ ok: true,
83
+ url: p.json.url,
84
+ user,
85
+ message: user
86
+ ? `Signed in to ${hostOf(p.json.url)} as ${user}.`
87
+ : `Signed in to ${hostOf(p.json.url)}.`,
88
+ };
89
+ }
90
+ return { ok: false, error: p?.json?.error || TEAM_SWITCH_WORDS.unfinished };
91
+ }
92
+ void post('/_api/hub-signin/cancel', { id });
93
+ return { ok: false, error: TEAM_SWITCH_WORDS.unfinished };
94
+ }
@@ -0,0 +1,38 @@
1
+ // client/v2/shell/too-heavy-card.jsx — 2.0.5: the card a tab shows instead of a canvas that keeps crashing
2
+ // the page (canvas-crash-guard.js). The viewport mounts it INSTEAD of the frame, like the not-local card:
3
+ // no frame, so nothing heavy runs until the person picks a way in.
4
+
5
+ import { Empty } from '../empty/empty.jsx';
6
+
7
+ /** @param {{ name: string, onLight: () => void, onAll: () => void }} props */
8
+ export function TooHeavyCanvas({ name, onLight, onAll }) {
9
+ return (
10
+ <Empty
11
+ size="canvas"
12
+ glyph="offline"
13
+ title="This canvas is too heavy to show all at once."
14
+ next={`Maude had to reload twice while ${name} was drawing. Show the artboards near where you look; the rest draw as you move to them.`}
15
+ testid="canvas-too-heavy"
16
+ actions={
17
+ <>
18
+ <button
19
+ type="button"
20
+ className="btn btn--sm btn--primary"
21
+ data-testid="canvas-too-heavy-light"
22
+ onClick={onLight}
23
+ >
24
+ Show visible artboards only
25
+ </button>
26
+ <button
27
+ type="button"
28
+ className="btn btn--sm"
29
+ data-testid="canvas-too-heavy-all"
30
+ onClick={onAll}
31
+ >
32
+ Show everything
33
+ </button>
34
+ </>
35
+ }
36
+ />
37
+ );
38
+ }
@@ -24,7 +24,14 @@ export function useAccount(enabled) {
24
24
  .then((r) => r.json().catch(() => ({})))
25
25
  .then((j) => {
26
26
  if (!gone)
27
- setState((s) => ({ ...s, connected: !!j?.connected, email: j?.email ?? null }));
27
+ setState((s) => ({
28
+ ...s,
29
+ connected: !!j?.connected,
30
+ email: j?.email ?? null,
31
+ // 2.0.5 W4 — the project account card's kind: the cloud address and this folder's link
32
+ cloudUrl: typeof j?.url === 'string' ? j.url : '',
33
+ linkedHub: j?.linkedHub ?? null,
34
+ }));
28
35
  })
29
36
  .catch(() => {
30
37
  if (!gone) setState((s) => ({ ...s, connected: false, email: null }));
@@ -82,8 +82,11 @@ export function useOccludedInsets({ bodyRef, iframesRef, presenting, layoutKey }
82
82
  pump.seed(win);
83
83
  return;
84
84
  }
85
+ // 2.0.4: a finished ladder leaves the set — its cancel holds `win`, and a kept one kept every canvas
86
+ // ever opened in memory (the webview's per-switch leak, occlusion-insets.js)
85
87
  const cancel = seedOnLadder(pump, win, {
86
88
  alive: () => frames().some((f) => f.contentWindow === win),
89
+ onDone: () => cancels.delete(cancel),
87
90
  });
88
91
  cancels.add(cancel);
89
92
  };
@@ -26,6 +26,7 @@ import { useOfflineFoot } from './offline-foot.jsx';
26
26
  import { useOutboxWords } from './row-words.js';
27
27
  import { conflictCard, conflictsFor, whenWords } from './sync-states-model.js';
28
28
  import { reasonProps } from '../access/disabled-reason.js';
29
+ import { servedFetch } from '../shell/served-routes.js';
29
30
 
30
31
  /** The shell opens the card from anywhere (the toast's Show, the mark, ⌘K-less row actions). */
31
32
  export const OPEN_EVENT = 'maude:sync-conflicts-open';
@@ -42,7 +43,11 @@ export const PICK = Object.freeze({
42
43
 
43
44
  export async function readConflicts(fetchImpl = fetch) {
44
45
  try {
45
- const r = await fetchImpl('/_api/sync/conflicts', { headers: { accept: 'application/json' } });
46
+ const r = await servedFetch(
47
+ '/_api/sync/conflicts',
48
+ { headers: { accept: 'application/json' } },
49
+ fetchImpl
50
+ );
46
51
  if (!r.ok) return null;
47
52
  const j = await r.json();
48
53
  return Array.isArray(j?.conflicts) ? j.conflicts : null;
@@ -258,7 +263,7 @@ export function SyncStatesHost() {
258
263
  let live = true;
259
264
  const read = () => {
260
265
  if (document.visibilityState === 'hidden') return;
261
- fetch('/_api/outbox')
266
+ servedFetch('/_api/outbox')
262
267
  .then((r) => (r.ok ? r.json() : null))
263
268
  .then((v) => live && setOutboxView(v))
264
269
  .catch(() => {});
@@ -26,6 +26,7 @@ import { notifyUndo } from '../../../notifications.tsx';
26
26
  import { getRunsStore } from '../ai/runs-store.js';
27
27
  import { actorName, ownRunWorkingOn } from '../ai/runs-model.js';
28
28
  import { historyRows, nextRedo, nextUndo } from './projection.js';
29
+ import { fetchIfServed } from '../shell/served-routes.js';
29
30
 
30
31
  export const UNDO_STACK_ROUTE = '/_api/project/undo-stack';
31
32
  export const UNDO_ROUTE = '/_api/project/undo';
@@ -50,7 +51,8 @@ const isObj = (v) => !!v && typeof v === 'object';
50
51
  const str = (v) => (typeof v === 'string' ? v : null);
51
52
 
52
53
  async function defaultRequest(method, url, body) {
53
- const r = await fetch(url, {
54
+ // #204 R — a workspace cell has no personal undo: its stack is not asked
55
+ const r = await fetchIfServed(url, {
54
56
  method,
55
57
  ...(body !== undefined
56
58
  ? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }
@@ -247,7 +247,7 @@ export function createCloudEndpoints(ctx: Ctx) {
247
247
  );
248
248
  /** The last plan read, for THIS token only (a new sign-in never sees the old account's plan). */
249
249
  let planRead: { token: string; at: number; plan: CloudPlan | null } | null = null;
250
- return {
250
+ const api = {
251
251
  /**
252
252
  * Signed in? Who? And WHICH folder is asking? Cheap — reads two files,
253
253
  * never the network.
@@ -730,6 +730,28 @@ export function createCloudEndpoints(ctx: Ctx) {
730
730
  },
731
731
  };
732
732
 
733
+ // #166 (2.0.4) — the attach lane is single-flight. Two calls that arrive together (a Connect
734
+ // pressed twice before the first answer, a Move to cloud racing a Connect) each ran their own
735
+ // /projects/open + the cell's /auth/login ~5 ms apart and minted two hub sessions for one
736
+ // person. A concurrent repeat now shares the call already running and gets its answer; a call
737
+ // after it settled runs again (a retry after a refusal must still reach the cell).
738
+ const inFlight = new Map<string, Promise<CloudEndpointResult>>();
739
+ const once = (key: string, run: () => Promise<CloudEndpointResult>) => {
740
+ const held = inFlight.get(key);
741
+ if (held) return held;
742
+ const p = run().finally(() => {
743
+ if (inFlight.get(key) === p) inFlight.delete(key);
744
+ });
745
+ inFlight.set(key, p);
746
+ return p;
747
+ };
748
+ const { attach, openManaged, attachStored } = api;
749
+ api.attach = (projectId: string) => once(`attach:${String(projectId)}`, () => attach(projectId));
750
+ api.openManaged = (projectId: string) =>
751
+ once(`open:${String(projectId)}`, () => openManaged(projectId));
752
+ api.attachStored = (hubUrl: string) => once(`link:${String(hubUrl)}`, () => attachStored(hubUrl));
753
+ return api;
754
+
733
755
  /**
734
756
  * The workspace this folder already answers to, if any. Address only.
735
757
  *
@@ -2,6 +2,7 @@
2
2
  // snapshots (Phase 6 _comments/<slug>.json) + the annotations board (DDR-242) + the
3
3
  // new `.ydoc.bin` cache under _state/<slug>.ydoc.bin.
4
4
 
5
+ import { rmSync } from 'node:fs';
5
6
  import path from 'node:path';
6
7
 
7
8
  import * as Y from 'yjs';
@@ -378,5 +379,12 @@ export function createPersistence(deps: PersistenceDeps): RoomCallbacks {
378
379
  await Bun.write(ydocBinPath(slug), state);
379
380
  }
380
381
 
381
- return { seed, persistJson, persistBinary };
382
+ // fix/205 — a cache, never content (DDR-051: JSON is canonical): the canvas
383
+ // it cached was deleted, and a room seeded from it would carry the deleted
384
+ // lineage into a canvas re-created at the same slug.
385
+ async function forget(slug: string): Promise<void> {
386
+ rmSync(ydocBinPath(slug), { force: true });
387
+ }
388
+
389
+ return { seed, persistJson, persistBinary, forget };
382
390
  }