@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
@@ -8,8 +8,11 @@
8
8
  // • Maude Cloud — sign in with the same device flow CloudBar uses, then the
9
9
  // projects your account belongs to. Viewers get the browser, not a dead
10
10
  // Open (the workspace would refuse their edits).
11
- // • Your team's server — its address plus the email and password the team
12
- // gave you (the self-hosted hub's own sign-in).
11
+ // • Your team's server — its address, then "Sign in", which opens the
12
+ // server's OWN sign-in page in the browser (a password, "Sign in with
13
+ // <provider>", whatever that server offers) and comes back with a one-time
14
+ // code (issue #204, decision maude/v2-michal-team-server-signin-via-hub-page).
15
+ // The app has no email or password field for a team server.
13
16
  //
14
17
  // Every path ends in `openTeamProject` / `managedProjectOpen`: the studio holds
15
18
  // the credential and describes the project, the shell creates or reuses the
@@ -27,6 +30,7 @@ import {
27
30
  managedProjectOpen,
28
31
  managedProjectsList,
29
32
  openTeamProject,
33
+ openTeamServerSignIn,
30
34
  } from '../github.js';
31
35
  import { reasonProps } from '../v2/access/disabled-reason.js';
32
36
  import { SIGNIN_WORDS } from '../v2/signin/signin-model.js';
@@ -145,8 +149,8 @@ function ErrorLine({ text }) {
145
149
  );
146
150
  }
147
151
 
148
- // `serverOnly` (V2-4.7a): Settings › Connections › “Add a team server…” opens just the address /
149
- // email / password form — the recents and the cloud list have their own homes. The same form,
152
+ // `serverOnly` (V2-4.7a): Settings › Connections › “Add a team server…” opens just the address +
153
+ // Sign in (issue #204: the server's own page signs you in) — the recents and the cloud list have their own homes. The same form,
150
154
  // the same handler, the same consent path (opening a project still goes through the switch).
151
155
  export default function TeamProjects({ variant = 'door', initialServer = '', serverOnly = false }) {
152
156
  const [recents, setRecents] = useState(null);
@@ -158,7 +162,10 @@ export default function TeamProjects({ variant = 'door', initialServer = '', ser
158
162
  const [projects, setProjects] = useState(null);
159
163
  const [device, setDevice] = useState(null);
160
164
  const [copied, setCopied] = useState(false);
161
- const [hub, setHub] = useState({ url: initialServer, email: '', password: '' });
165
+ const [hub, setHub] = useState({ url: initialServer });
166
+ // Issue #204: a team-server sign-in waiting on the browser — `{ id, url }`.
167
+ const [hubWait, setHubWait] = useState(null);
168
+ const hubPollRef = useRef(null);
162
169
  const [busy, setBusy] = useState(''); // the key of whatever is opening
163
170
  const [opening, setOpening] = useState(''); // display name once the switch started
164
171
  const [err, setErr] = useState('');
@@ -180,6 +187,7 @@ export default function TeamProjects({ variant = 'door', initialServer = '', ser
180
187
  return () => {
181
188
  alive = false;
182
189
  clearInterval(pollRef.current);
190
+ clearInterval(hubPollRef.current);
183
191
  };
184
192
  // eslint-disable-next-line react-hooks/exhaustive-deps
185
193
  }, []);
@@ -276,17 +284,70 @@ export default function TeamProjects({ variant = 'door', initialServer = '', ser
276
284
  const openCloud = (p) =>
277
285
  run(`cloud:${p.id}`, p.name || p.id, () => openTeamProject({ kind: 'cloud', projectId: p.id }));
278
286
 
279
- const openHub = () =>
280
- run('hub', serverLabel(hub.url), () =>
281
- openTeamProject({
282
- kind: 'hub',
283
- url: hub.url.trim(),
284
- email: hub.email.trim(),
285
- password: hub.password,
286
- })
287
- );
287
+ // Issue #204 — "Sign in" opens the team server's own page; this tab's server waits for the
288
+ // browser to come back with a one-time code, stores the sign-in, and then the project opens
289
+ // the way a known server's does (no credential ever passes through this page).
290
+ async function startHubSignIn() {
291
+ if (busy || hubWait) return;
292
+ setErr('');
293
+ const url = hub.url.trim();
294
+ const r = await api('/_api/hub-signin/start', {
295
+ method: 'POST',
296
+ headers: { 'content-type': 'application/json' },
297
+ body: JSON.stringify({ url }),
298
+ });
299
+ if (!r.ok || !r.json?.ok) {
300
+ setErr(r.json?.error || 'The sign-in could not start. Try again.');
301
+ return;
302
+ }
303
+ const id = r.json.id;
304
+ const opened = await openTeamServerSignIn(r.json.signInUrl);
305
+ if (opened !== 'ok') {
306
+ void api('/_api/hub-signin/cancel', {
307
+ method: 'POST',
308
+ headers: { 'content-type': 'application/json' },
309
+ body: JSON.stringify({ id }),
310
+ });
311
+ setErr(
312
+ opened === 'refused'
313
+ ? 'Maude won’t open that address. Check the server address.'
314
+ : 'Maude couldn’t open your browser. Try again.'
315
+ );
316
+ return;
317
+ }
318
+ setHubWait({ id, url });
319
+ clearInterval(hubPollRef.current);
320
+ hubPollRef.current = setInterval(async () => {
321
+ const p = await api('/_api/hub-signin/poll', {
322
+ method: 'POST',
323
+ headers: { 'content-type': 'application/json' },
324
+ body: JSON.stringify({ id }),
325
+ });
326
+ if (p.json?.pending) return;
327
+ clearInterval(hubPollRef.current);
328
+ setHubWait(null);
329
+ if (p.ok && p.json?.ok && p.json.url) {
330
+ const signedIn = p.json.url;
331
+ run('hub', serverLabel(signedIn), () =>
332
+ openTeamProject({ kind: 'known-hub', url: signedIn })
333
+ );
334
+ } else setErr(p.json?.error || 'The sign-in did not finish. Try again.');
335
+ }, 1500);
336
+ }
288
337
 
289
- const canHub = hub.url.trim() && hub.email.trim() && hub.password;
338
+ function cancelHubSignIn() {
339
+ clearInterval(hubPollRef.current);
340
+ const id = hubWait?.id;
341
+ setHubWait(null);
342
+ if (id)
343
+ void api('/_api/hub-signin/cancel', {
344
+ method: 'POST',
345
+ headers: { 'content-type': 'application/json' },
346
+ body: JSON.stringify({ id }),
347
+ });
348
+ }
349
+
350
+ const canHub = !!hub.url.trim();
290
351
 
291
352
  return (
292
353
  <div className={`tp tp--${variant}`} data-testid="team-projects">
@@ -487,7 +548,7 @@ export default function TeamProjects({ variant = 'door', initialServer = '', ser
487
548
  className="ob-form"
488
549
  onSubmit={(e) => {
489
550
  e.preventDefault();
490
- if (canHub && !busy) openHub();
551
+ if (canHub && !busy && !hubWait) void startHubSignIn();
491
552
  }}
492
553
  >
493
554
  <label className="ob-field">
@@ -503,63 +564,52 @@ export default function TeamProjects({ variant = 'door', initialServer = '', ser
503
564
  placeholder="https://design.yourteam.com"
504
565
  aria-label="Server address"
505
566
  data-testid="team-hub-url"
567
+ disabled={!!hubWait}
506
568
  onChange={(e) => setHub((h) => ({ ...h, url: e.target.value }))}
507
569
  />
508
570
  </span>
509
571
  </label>
510
- <label className="ob-field">
511
- <span className="ob-field-label">Email</span>
512
- <span className="ob-field-wrap">
513
- <Icon name="user" size={14} className="ob-field-pre" />
514
- <input
515
- className="input ob-input"
516
- type="email"
517
- autoComplete="username"
518
- value={hub.email}
519
- placeholder="you@yourteam.com"
520
- aria-label="Email"
521
- data-testid="team-hub-email"
522
- onChange={(e) => setHub((h) => ({ ...h, email: e.target.value }))}
523
- />
524
- </span>
525
- </label>
526
- <label className="ob-field">
527
- <span className="ob-field-label">Password</span>
528
- <span className="ob-field-wrap">
529
- <Icon name="key" size={14} className="ob-field-pre" />
530
- <input
531
- className="input ob-input"
532
- type="password"
533
- autoComplete="current-password"
534
- value={hub.password}
535
- aria-label="Password"
536
- data-testid="team-hub-password"
537
- onChange={(e) => setHub((h) => ({ ...h, password: e.target.value }))}
538
- />
539
- </span>
540
- </label>
541
- <div className="ob-form-actions">
542
- <button
543
- type="submit"
544
- className="btn btn--primary"
545
- disabled={!canHub || !!busy}
546
- {...reasonProps(
547
- !canHub || !!busy,
548
- busy ? 'Opening…' : 'Fill in the address, email and password first.'
549
- )}
550
- data-testid="team-hub-open"
551
- >
552
- {busy === 'hub' ? (
553
- <>
554
- <Icon name="spinner" size={15} className="ob-spin" /> Signing in…
555
- </>
556
- ) : (
557
- <>
558
- <Icon name="arrow-right" size={15} /> Sign in and open
559
- </>
560
- )}
561
- </button>
562
- </div>
572
+ {hubWait ? (
573
+ <div className="ob-form-actions" data-testid="team-hub-waiting">
574
+ <span className="gi-dc-status" aria-live="polite">
575
+ <span className="gi-pulse" aria-hidden="true" /> Finish signing in in your browser…
576
+ </span>
577
+ <button
578
+ type="button"
579
+ className="btn btn--ghost"
580
+ onClick={cancelHubSignIn}
581
+ data-testid="team-hub-cancel"
582
+ >
583
+ Cancel
584
+ </button>
585
+ </div>
586
+ ) : (
587
+ <div className="ob-form-actions">
588
+ <button
589
+ type="submit"
590
+ className="btn btn--primary"
591
+ disabled={!canHub || !!busy}
592
+ {...reasonProps(
593
+ !canHub || !!busy,
594
+ busy ? 'Opening…' : 'Fill in the server address first.'
595
+ )}
596
+ data-testid="team-hub-open"
597
+ >
598
+ {busy === 'hub' ? (
599
+ <>
600
+ <Icon name="spinner" size={15} className="ob-spin" /> Opening…
601
+ </>
602
+ ) : (
603
+ <>
604
+ <Icon name="external" size={15} /> Sign in
605
+ </>
606
+ )}
607
+ </button>
608
+ </div>
609
+ )}
610
+ <p className="ob-foot-note">
611
+ Opens your team server’s sign-in page in your browser, then brings you back.
612
+ </p>
563
613
  </form>
564
614
  </section>
565
615
 
@@ -10,6 +10,7 @@ import { recordSent, sentFromChips } from '../v2/ai/sent-attachments.js';
10
10
  import { readMay } from '../v2/ai/ai-may.js';
11
11
  import { mayField, mergeOutbox, newAskId, promptFrame, reduceQueued } from '../v2/ai/ask-frame.js';
12
12
  import { noteAskedAnnotations } from '../v2/ai/ai-offer.js';
13
+ import { cleanTasks } from '../v2/ai/background-model.js';
13
14
 
14
15
  const WS_PATH = '/_ws/acp';
15
16
 
@@ -252,6 +253,17 @@ export function createAcpConnection() {
252
253
  emitBackground();
253
254
  }
254
255
 
256
+ // Issue #177 — the chat's live background tasks (subagents, background commands): the server's
257
+ // `{t:'background', tasks}` snapshot, replaced whole on every change and replayed on attach. Chrome,
258
+ // not turn content — it outlives the turn by design.
259
+ const bgTaskListeners = new Set();
260
+ let bgTasks = [];
261
+ function setBgTasks(next) {
262
+ if (next === bgTasks || (!next.length && !bgTasks.length)) return;
263
+ bgTasks = next;
264
+ for (const fn of bgTaskListeners) fn(bgTasks);
265
+ }
266
+
255
267
  // Connection-problem error card (Task C3) — the bridge `error` frame (a
256
268
  // socket/adapter failure mid-turn) is ALSO thrown from prompt()'s generator
257
269
  // (so assistant-ui's own turn-failed bookkeeping still runs), but a thrown
@@ -307,6 +319,10 @@ export function createAcpConnection() {
307
319
  if (frame.running) setBusy(true);
308
320
  return;
309
321
  }
322
+ if (frame.t === 'background') {
323
+ setBgTasks(cleanTasks(frame.tasks));
324
+ return;
325
+ }
310
326
  if (frame.t === 'ready') {
311
327
  status.ready = true;
312
328
  status.available = frame.available;
@@ -456,6 +472,8 @@ export function createAcpConnection() {
456
472
  ws = null;
457
473
  status.ready = false;
458
474
  emitStatus();
475
+ // The bridge is unreachable: what it ran is unknown until the next attach replays it.
476
+ setBgTasks([]);
459
477
  };
460
478
  sock.onmessage = (e) => {
461
479
  try {
@@ -487,6 +505,13 @@ export function createAcpConnection() {
487
505
  return () => turnFrameListeners.delete(fn);
488
506
  },
489
507
 
508
+ /** Issue #177 — the live background tasks; `fn(list)` now and on every change. */
509
+ onBackgroundTasks(fn) {
510
+ bgTaskListeners.add(fn);
511
+ fn(bgTasks);
512
+ return () => bgTaskListeners.delete(fn);
513
+ },
514
+
490
515
  /** Subscribe to the post-turn-end continuation parts; replays the current tail. */
491
516
  onBackground(fn) {
492
517
  backgroundListeners.add(fn);
@@ -0,0 +1,46 @@
1
+ // 2.0.5 - the last capability set (`{modes, configOptions}`: model, effort, permissions...) the AI answered with,
2
+ // kept per project so the Advanced fold can draw its rows on a fresh load WITHOUT starting Claude (a panel that
3
+ // only opened must not spawn the adapter - ChatPanel sends no `warm` on mount). The first live `caps` frame
4
+ // replaces it and refreshes the cache; a cached set is only ever shown, never acted on (no reconcile, no send).
5
+
6
+ const PREFIX = 'maude-acp-caps';
7
+
8
+ /** @param {string} scope the project's name (or its design folder when the name is not known yet) */
9
+ export function capsKeyFor(scope) {
10
+ return `${PREFIX}:${scope || ''}`;
11
+ }
12
+
13
+ /** @param {{modes?: any, configOptions?: any[]}|null|undefined} caps */
14
+ export function isEmptyCaps(caps) {
15
+ const modes = caps?.modes?.availableModes;
16
+ const opts = caps?.configOptions;
17
+ return !(Array.isArray(modes) && modes.length) && !(Array.isArray(opts) && opts.length);
18
+ }
19
+
20
+ /** @returns {{modes: any, configOptions: any[]}|null} the cached set, or null (none, corrupt, or empty) */
21
+ export function loadCachedCaps(key, storage = globalThis.localStorage) {
22
+ try {
23
+ const raw = storage?.getItem(key);
24
+ if (!raw) return null;
25
+ const parsed = JSON.parse(raw);
26
+ const caps = {
27
+ modes: parsed?.modes && typeof parsed.modes === 'object' ? parsed.modes : null,
28
+ configOptions: Array.isArray(parsed?.configOptions) ? parsed.configOptions : [],
29
+ };
30
+ return isEmptyCaps(caps) ? null : caps;
31
+ } catch {
32
+ return null;
33
+ }
34
+ }
35
+
36
+ export function saveCachedCaps(key, caps, storage = globalThis.localStorage) {
37
+ if (isEmptyCaps(caps)) return;
38
+ try {
39
+ storage?.setItem(
40
+ key,
41
+ JSON.stringify({ modes: caps.modes ?? null, configOptions: caps.configOptions })
42
+ );
43
+ } catch {
44
+ /* private mode / unavailable - non-fatal */
45
+ }
46
+ }
@@ -0,0 +1,66 @@
1
+ // When a chat counts as "finished" — the ping behind the AI-finished notification, the Dock badge
2
+ // and the dot in the chat list. Pure state, so it is testable without a socket.
3
+ //
4
+ // A connection replays its CURRENT busy state the moment anyone subscribes (`onBusy` calls the
5
+ // listener with `busy` straight away), so "not busy" alone is not the end of a turn: on every
6
+ // project load that replay used to ping "AI finished" with no AI run at all. A turn ends only on a
7
+ // busy → not-busy change. Background work (a subagent, a task the AI left running) can outlive the
8
+ // turn (claude-agent-acp #773, issue #177): then the ping waits until it drains.
9
+ //
10
+ // Hooks (all optional): dot(on) — the chat's busy dot; aggregate(busy) — this chat's share of the
11
+ // app-wide busy state; finished() — the ping; refresh() — reload the chat list.
12
+ export function createFinishTracker(hooks = {}) {
13
+ const call = (name, ...args) => hooks[name]?.(...args);
14
+ let toolsActive = false; // a tool (e.g. a subagent) is still running
15
+ let tasksActive = false; // a background task is still running
16
+ let bgActive = false; // either of the two
17
+ let busyNow = false; // the prompt turn itself is in flight
18
+ let deferredFinish = false; // a turn (or background work) ended while something still ran
19
+
20
+ const background = () => {
21
+ bgActive = toolsActive || tasksActive;
22
+ call('aggregate', busyNow || bgActive);
23
+ if (deferredFinish && !bgActive && !busyNow) {
24
+ deferredFinish = false;
25
+ call('dot', false);
26
+ call('finished');
27
+ call('refresh');
28
+ }
29
+ };
30
+
31
+ return {
32
+ activity(activeTools) {
33
+ toolsActive = activeTools.length > 0;
34
+ background();
35
+ },
36
+ tasks(list) {
37
+ tasksActive = list.length > 0;
38
+ if (tasksActive && !busyNow) {
39
+ // work started outside a turn (a follow-up the AI began on its own): lit until it ends
40
+ deferredFinish = true;
41
+ call('dot', true);
42
+ }
43
+ background();
44
+ },
45
+ busy(busy) {
46
+ const wasBusy = busyNow;
47
+ busyNow = busy;
48
+ call('aggregate', busyNow || bgActive);
49
+ if (busy) {
50
+ deferredFinish = false; // a new turn supersedes any pending drain ping
51
+ call('dot', true);
52
+ return;
53
+ }
54
+ if (!wasBusy) return; // the subscribe-time replay of an idle chat, not the end of a turn
55
+ // Turn ended. If background work is still draining, keep the dot lit and hold the ping.
56
+ if (bgActive) {
57
+ deferredFinish = true;
58
+ call('refresh');
59
+ } else {
60
+ call('dot', false);
61
+ call('finished');
62
+ call('refresh');
63
+ }
64
+ },
65
+ };
66
+ }
@@ -0,0 +1,53 @@
1
+ // shell/frame-cap.js — Maude 2.0.4 (task O): how many canvas frames the viewport keeps mounted.
2
+ //
3
+ // Every mounted canvas frame is a whole page: its own React, its own canvas runtime and the canvas bundle (~2 MB
4
+ // of script per canvas), plus every picture on it decoded. The viewport mounts one frame per entry in `tabs`, and
5
+ // some roads append to `tabs` without dropping the frame before (a comment jump into another canvas), so a session
6
+ // could keep any number of canvases alive. The cap: the active canvas + the one shown just before it. A frame past
7
+ // the cap unmounts; opening its canvas again loads it afresh — its camera comes back from `_canvas-state` like any
8
+ // open.
9
+
10
+ /** Frames kept mounted at most: the active canvas + 1 most recent. */
11
+ export const FRAME_CAP = 2;
12
+
13
+ /** How many recent canvases are remembered (only the first FRAME_CAP - 1 others are ever mounted). */
14
+ const RECENT_KEEP = 8;
15
+
16
+ /**
17
+ * The recency list with `path` moved to the front (most recent first). Returns the SAME array when `path` is
18
+ * already at the front, so a render that changes nothing allocates nothing.
19
+ * @param {string[]} recent
20
+ * @param {string | null | undefined} path
21
+ * @returns {string[]}
22
+ */
23
+ export function noteShown(recent, path) {
24
+ if (!path || recent[0] === path) return recent;
25
+ return [path, ...recent.filter((p) => p !== path)].slice(0, RECENT_KEEP);
26
+ }
27
+
28
+ /**
29
+ * Which tabs get a mounted frame: the active path, then the most recently shown other open tabs, up to `cap`.
30
+ * Paths in `skip` (views that are not canvas frames, like the Design system tab) are never counted.
31
+ * @param {{ path: string }[]} tabs
32
+ * @param {string | null | undefined} activePath
33
+ * @param {string[]} recent most recent first
34
+ * @param {{ cap?: number, skip?: (path: string) => boolean }} [opts]
35
+ * @returns {Set<string>}
36
+ */
37
+ export function framesToMount(tabs, activePath, recent, opts = {}) {
38
+ const cap = opts.cap ?? FRAME_CAP;
39
+ const skip = opts.skip ?? (() => false);
40
+ const open = new Set(tabs.map((t) => t.path).filter((p) => !skip(p)));
41
+ const keep = new Set();
42
+ if (activePath && open.has(activePath)) keep.add(activePath);
43
+ for (const p of recent) {
44
+ if (keep.size >= cap) break;
45
+ if (open.has(p)) keep.add(p);
46
+ }
47
+ // an open tab never shown yet (none in practice — every tab is opened by showing it) takes a free slot
48
+ for (const p of open) {
49
+ if (keep.size >= cap) break;
50
+ keep.add(p);
51
+ }
52
+ return keep;
53
+ }
@@ -1,7 +1,7 @@
1
1
  // shell/viewport.jsx — moved verbatim out of client/app.jsx (Maude v2 plan V2-0.2, move-only split).
2
2
 
3
3
  import { useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
4
- import { canvasFrameCfg, canvasImportsOf, canvasUrl } from '../canvas-url.js';
4
+ import { canvasFrameCfg, canvasImportsOf, canvasRefusedOf, canvasUrl } from '../canvas-url.js';
5
5
  import { CompareHost } from '../v2/history/compare-view.jsx';
6
6
  import { useDsPreviewTarget, withDsPreview } from '../v2/ds/preview-mode.js';
7
7
  import { useViewing } from '../v2/history/history-host.jsx';
@@ -27,6 +27,9 @@ import { insetsNow } from '../v2/shell/insets-now.js';
27
27
  import { normalizeOpenPath } from '../share-link.js';
28
28
  import { framesIsolated, sessionRole } from '../v2/access/access-client.js';
29
29
  import { CanvasDropCatcher, catcherReadOnly } from '../v2/assets/canvas-drop-catcher.jsx';
30
+ import { framesToMount, noteShown } from './frame-cap.js';
31
+ import { crashGuard, subscribeCrashGuard } from '../v2/shell/canvas-crash-guard.js';
32
+ import { TooHeavyCanvas } from '../v2/shell/too-heavy-card.jsx';
30
33
 
31
34
  export function Viewport({
32
35
  tabs,
@@ -112,9 +115,14 @@ export function Viewport({
112
115
  // S6.12 (C5) — what the open canvases say about drawing: one listener for every frame. The card is below.
113
116
  const wsSend = useContext(ShellStoreContext)?.local?.wsSend;
114
117
  const renderSignal = useRenderSignal({ cfg, wsSend, viewingPath: viewing?.path ?? null });
118
+ // 2.0.5 — a canvas that crashed the page twice is not reopened in a loop (canvas-crash-guard.js).
119
+ const guard = useMemo(() => crashGuard(), []);
120
+ const [, bumpGuard] = useState(0);
121
+ useEffect(() => subscribeCrashGuard(() => bumpGuard((n) => n + 1)), []);
115
122
  const stableSrc = (path) => {
116
123
  const held = viewing?.path === path ? { viewing: viewing.at } : undefined;
117
- const opts = withDsPreview(held, dsPreview);
124
+ const base = withDsPreview(held, dsPreview);
125
+ const opts = guard.isLight(path) ? { ...(base || {}), light: true } : base;
118
126
  // A frame that changes between now and a past version is a new frame: the entry it comes back to is
119
127
  // built afresh, so it carries the capability that is live THEN, not the one of the first open.
120
128
  // The same holds for a frame entering or leaving a design-system preview, or stepping to another system.
@@ -143,6 +151,11 @@ export function Viewport({
143
151
  const canvasTab = activePath && activePath !== SYSTEM_TAB ? activePath : null;
144
152
  const availability = useCanvasAvailability(canvasTab, { stamp: canvasReloadNonce });
145
153
  const notLocal = !!canvasTab && availability === 'not-local';
154
+ const tooHeavy = !!canvasTab && guard.tooHeavy(canvasTab);
155
+ // The mark the next boot reads: this canvas is framed now (none while its card stands in).
156
+ useEffect(() => {
157
+ guard.noteOpen(tooHeavy ? null : canvasTab);
158
+ }, [guard, canvasTab, tooHeavy]);
146
159
  // Still coming down (Q13 fallback): the "<name> is on its way." card, same stand-in for the frame.
147
160
  const arriving = !!canvasTab && availability === 'arriving';
148
161
  const canvasState =
@@ -154,6 +167,13 @@ export function Viewport({
154
167
  ? 'loading'
155
168
  : 'idle';
156
169
  const soloFrame = framesIsolated(cfg);
170
+ // 2.0.4 (task O) — at most the active canvas frame + the one shown before it stay mounted (frame-cap.js): each
171
+ // frame is a whole page with its own runtime, so an unbounded `tabs` list was an unbounded memory bill.
172
+ const recentRef = useRef([]);
173
+ recentRef.current = noteShown(recentRef.current, activePath);
174
+ const mounted = framesToMount(tabs, activePath, recentRef.current, {
175
+ skip: (p) => p === SYSTEM_TAB,
176
+ });
157
177
  return (
158
178
  // V2-8.7 — the stage IS the page's main landmark (axe landmark-one-main: with no canvas open the shell had none)
159
179
  <main className="viewport sh-stage" data-tour="viewport" data-canvas-state={canvasState}>
@@ -217,6 +237,20 @@ export function Viewport({
217
237
  <NotLocalCanvas name={basename(t.path).replace(/\.(tsx|html)$/i, '')} />
218
238
  </div>
219
239
  );
240
+ if (tooHeavy && t.path === activePath)
241
+ return (
242
+ <div
243
+ key={`${t.path}#too-heavy`}
244
+ className="sh-not-local active"
245
+ style={{ '--es-cx': freeCx }}
246
+ >
247
+ <TooHeavyCanvas
248
+ name={basename(t.path).replace(/\.(tsx|html)$/i, '')}
249
+ onLight={() => guard.chooseLight(t.path)}
250
+ onAll={() => guard.forgive(t.path)}
251
+ />
252
+ </div>
253
+ );
220
254
  if (arriving && t.path === activePath)
221
255
  return (
222
256
  <div
@@ -230,6 +264,7 @@ export function Viewport({
230
264
  // p8-secfix-f F1 — sibling frames on the one canvas origin can read each other; a canvas-only
231
265
  // session's frames carry different grants, so only its active canvas is framed (no keep-alive).
232
266
  if (soloFrame && t.path !== activePath) return null;
267
+ if (!mounted.has(t.path)) return null;
233
268
  return (
234
269
  <iframe
235
270
  // The nonce is part of the key ONLY so the #115 Retry can force a
@@ -258,7 +293,7 @@ export function Viewport({
258
293
  />
259
294
  );
260
295
  })}
261
- {canvasTab && !notLocal && !arriving && (
296
+ {canvasTab && !notLocal && !arriving && !tooHeavy && (
262
297
  // r3 — an Assets tile dragged over the canvas: the shell takes the drop (WebKit gives the canvas origin no
263
298
  // event of a drag the shell started) and places the picture on what the canvas says lies under it
264
299
  <CanvasDropCatcher
@@ -285,7 +320,7 @@ export function Viewport({
285
320
  onClose={() => setCodeReq(null)}
286
321
  />
287
322
  )}
288
- {loadingPath && loadingPath === activePath && !notLocal && !arriving && (
323
+ {loadingPath && loadingPath === activePath && !notLocal && !arriving && !tooHeavy && (
289
324
  // DS skeletons recipe — calm .skel pulse while the canvas-shell compiles
290
325
  // the TSX. Cleared by the iframe's dgn:'loaded' message (or the onLoad
291
326
  // fallback timer for legacy .html canvases that never post it).
@@ -296,7 +331,7 @@ export function Viewport({
296
331
  // a fresh card on every re-render while opening, so the card never left (fix-opening-hang).
297
332
  <CanvasLoading key={`${loadingPath}#loading`} path={loadingPath} cloud={!!cfg?.cloud} />
298
333
  )}
299
- {canvasError && canvasError.path === activePath && !notLocal && !arriving && (
334
+ {canvasError && canvasError.path === activePath && !notLocal && !arriving && !tooHeavy && (
300
335
  // issue #115 — what the blank pane used to be. Names which of the two
301
336
  // failures happened and offers the recovery that used to require
302
337
  // quitting the app (or knowing that switching projects and back
@@ -322,12 +357,14 @@ export function Viewport({
322
357
  Reload canvas
323
358
  </button>
324
359
  </div>
325
- ) : canvasImportsOf(cfg, canvasError.path) ? (
360
+ ) : canvasImportsOf(cfg, canvasError.path) || canvasRefusedOf(cfg, canvasError.path) ? (
326
361
  // gate-b-c4j — it imports another canvas, so its frame refused the module: say that, not "can't
327
- // be drawn" (v2/code/canvas-imports-card.jsx).
362
+ // be drawn" (v2/code/canvas-imports-card.jsx). 2.0.5 (#205): or its built module inlined a file
363
+ // another canvas owns — the card names that file too.
328
364
  <CanvasImportsCard
329
365
  key={`${canvasError.path}#imports`}
330
366
  imports={canvasImportsOf(cfg, canvasError.path)}
367
+ refused={canvasRefusedOf(cfg, canvasError.path)}
331
368
  componentDir={cfg?.newComponentDir}
332
369
  />
333
370
  ) : (
@@ -347,7 +384,7 @@ export function Viewport({
347
384
  )}
348
385
  </div>
349
386
  )}
350
- {canvasTab && !notLocal && !arriving && (
387
+ {canvasTab && !notLocal && !arriving && !tooHeavy && (
351
388
  // S6.12 — the code compiles and then throws while drawing: S11.7's card over the dimmed last good
352
389
  // render, with Go back to 14:05. Silent while this Mac's own AI run draws on it.
353
390
  <RenderErrorHost
@@ -174,6 +174,8 @@
174
174
  @import url("../v2/assets/describe.css");
175
175
  /* 2.0.2 - the Assets tab Library switch and a design system own library (client/v2/assets/ds-library-view.jsx). */
176
176
  @import url("../v2/assets/ds-library.css");
177
+ /* 2.0.4 - an Assets tile, large: double-click opens it in a window (client/v2/assets/spotlight.jsx). */
178
+ @import url("../v2/assets/spotlight.css");
177
179
  /* Phase 4 gate — the a11y contrast floor (WCAG 1.4.3), utilities layer: wins over shell + components. */
178
180
  @import url("../v2/shell/contrast.css");
179
181
  /* V2-3.3 — the Home page, scoped under `.maude-v2.home-root` (maude-v2 tokens only). */