@1agh/maude 2.0.4 → 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 (129) hide show
  1. package/apps/hub/src/project-transactions/kernel.mjs +10 -1
  2. package/apps/studio/access/filters.ts +12 -5
  3. package/apps/studio/access/known-canvases.ts +24 -1
  4. package/apps/studio/access/refused-inputs.ts +89 -0
  5. package/apps/studio/actions/agents.ts +5 -0
  6. package/apps/studio/actions/defs/app.ts +12 -0
  7. package/apps/studio/actions.manifest.json +13 -1
  8. package/apps/studio/actions.parity.json +7 -1
  9. package/apps/studio/annotations/ui/element-node.tsx +139 -54
  10. package/apps/studio/annotations/ui/lod.tsx +1 -1
  11. package/apps/studio/annotations/ui/text-style.ts +1 -1
  12. package/apps/studio/annotations-layer.tsx +0 -12
  13. package/apps/studio/api.ts +42 -0
  14. package/apps/studio/artboard-live-gate.tsx +267 -0
  15. package/apps/studio/artboard-live.ts +336 -0
  16. package/apps/studio/artboard-webgl.ts +668 -0
  17. package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
  18. package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
  19. package/apps/studio/bin/_canvas-reasons.mjs +34 -0
  20. package/apps/studio/bin/_ds-check-live.mjs +37 -0
  21. package/apps/studio/bin/_ds-check.mjs +4 -1
  22. package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
  23. package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
  24. package/apps/studio/bin/_import-asset.mjs +2 -1
  25. package/apps/studio/bin/_perf-probe.mjs +2 -1
  26. package/apps/studio/bin/_studio-verb.mjs +24 -3
  27. package/apps/studio/bin/_thumb-blank.mjs +70 -0
  28. package/apps/studio/bin/_thumb-cover.mjs +35 -0
  29. package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
  30. package/apps/studio/bin/ds-check.sh +5 -1
  31. package/apps/studio/bin/perf.sh +11 -1
  32. package/apps/studio/bin/server-up.sh +7 -2
  33. package/apps/studio/bin/smoke.sh +19 -0
  34. package/apps/studio/canvas-lib.tsx +131 -12
  35. package/apps/studio/client/canvas-url.js +13 -0
  36. package/apps/studio/client/home/HomeAccounts.jsx +262 -0
  37. package/apps/studio/client/home/Shelves.jsx +4 -3
  38. package/apps/studio/client/home/home-accounts-model.js +121 -0
  39. package/apps/studio/client/home/home-api.js +6 -0
  40. package/apps/studio/client/home/home-app.jsx +141 -40
  41. package/apps/studio/client/home/home-model.js +172 -6
  42. package/apps/studio/client/home/home.css +169 -5
  43. package/apps/studio/client/home/shell-mode.js +8 -1
  44. package/apps/studio/client/hooks/use-project-data.jsx +2 -0
  45. package/apps/studio/client/panels/ChatPanel.jsx +27 -20
  46. package/apps/studio/client/panels/CreateProject.jsx +19 -5
  47. package/apps/studio/client/panels/caps-cache.js +46 -0
  48. package/apps/studio/client/shell/viewport.jsx +36 -8
  49. package/apps/studio/client/v2/access/access-client.js +2 -0
  50. package/apps/studio/client/v2/access/access-host.jsx +12 -1
  51. package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
  52. package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
  53. package/apps/studio/client/v2/ai/Composer.jsx +27 -10
  54. package/apps/studio/client/v2/code/canvas-imports-card.jsx +15 -14
  55. package/apps/studio/client/v2/code/canvas-imports-words.js +44 -0
  56. package/apps/studio/client/v2/code/code-bus.js +5 -0
  57. package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
  58. package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
  59. package/apps/studio/client/v2/ds/library-host.jsx +45 -45
  60. package/apps/studio/client/v2/ds/make-host.jsx +13 -15
  61. package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
  62. package/apps/studio/client/v2/ds/review-host.jsx +7 -1
  63. package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
  64. package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
  65. package/apps/studio/client/v2/history/branch-actions.js +13 -9
  66. package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
  67. package/apps/studio/client/v2/history/git-model.js +3 -1
  68. package/apps/studio/client/v2/history/git-parts.jsx +16 -1
  69. package/apps/studio/client/v2/presence/faces.jsx +42 -14
  70. package/apps/studio/client/v2/shell/account-card.jsx +10 -4
  71. package/apps/studio/client/v2/shell/canvas-crash-guard.js +137 -0
  72. package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
  73. package/apps/studio/client/v2/shell/menu-runner.js +11 -0
  74. package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
  75. package/apps/studio/client/v2/shell/project-account-model.js +182 -0
  76. package/apps/studio/client/v2/shell/share-cluster-host.jsx +137 -10
  77. package/apps/studio/client/v2/shell/share-cluster.css +58 -0
  78. package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
  79. package/apps/studio/client/v2/shell/team-switch.js +94 -0
  80. package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
  81. package/apps/studio/client/v2/shell/use-account.js +8 -1
  82. package/apps/studio/collab/persistence.ts +9 -1
  83. package/apps/studio/collab/registry.ts +32 -0
  84. package/apps/studio/collab/room.ts +8 -0
  85. package/apps/studio/config-reload-wire.ts +53 -0
  86. package/apps/studio/dist/client.bundle.js +1232 -1232
  87. package/apps/studio/dist/styles.css +1 -1
  88. package/apps/studio/ds/board/specimen.tsx +12 -1
  89. package/apps/studio/ds/canvas-cli.ts +58 -2
  90. package/apps/studio/ds/check.ts +26 -1
  91. package/apps/studio/ds/cli.ts +7 -3
  92. package/apps/studio/ds/convert.ts +34 -6
  93. package/apps/studio/ds/ds-verb.ts +13 -0
  94. package/apps/studio/ds/post-build.ts +38 -0
  95. package/apps/studio/ds/upgrade-apply.ts +27 -5
  96. package/apps/studio/ds/upgrade-cli.ts +22 -2
  97. package/apps/studio/ds/upgrade-prove.ts +198 -15
  98. package/apps/studio/ds/upgrade-stage.ts +4 -1
  99. package/apps/studio/history/trash.ts +6 -0
  100. package/apps/studio/home/accounts.ts +87 -0
  101. package/apps/studio/home/index-reader.ts +24 -2
  102. package/apps/studio/home/routes.ts +19 -0
  103. package/apps/studio/http.ts +14 -2
  104. package/apps/studio/routes/ds-convert.ts +18 -0
  105. package/apps/studio/routes/trash.ts +16 -1
  106. package/apps/studio/server.ts +8 -10
  107. package/apps/studio/sync/accepted-cold-start.ts +28 -13
  108. package/apps/studio/sync/asset-push.ts +146 -23
  109. package/apps/studio/sync/asset-state.ts +3 -2
  110. package/apps/studio/sync/file-membership.ts +28 -3
  111. package/apps/studio/sync/file-plane.ts +40 -9
  112. package/apps/studio/sync/file-pull.ts +304 -33
  113. package/apps/studio/sync/hub-link.ts +1 -2
  114. package/apps/studio/sync/index.ts +308 -150
  115. package/apps/studio/sync/journal-client.ts +94 -5
  116. package/apps/studio/sync/pending-deletes.ts +100 -0
  117. package/apps/studio/sync/projection.ts +77 -12
  118. package/apps/studio/sync/seed-progress.ts +12 -1
  119. package/apps/studio/sync/status.ts +3 -1
  120. package/apps/studio/thumbs/service.ts +12 -2
  121. package/apps/studio/thumbs/validate.ts +7 -0
  122. package/apps/studio/ui-prefs-migrate.ts +4 -0
  123. package/apps/studio/video-comp.tsx +23 -0
  124. package/apps/studio/whats-new.json +72 -0
  125. package/cli/lib/bash-guard.mjs +13 -1
  126. package/cli/lib/design-help.gen.mjs +1 -1
  127. package/cli/lib/design-hook.mjs +20 -0
  128. package/cli/lib/studio-locate.mjs +35 -10
  129. package/package.json +8 -8
@@ -265,6 +265,130 @@
265
265
  .home-top-acct .home-face {
266
266
  box-shadow: 0 0 0 2px var(--bg-1);
267
267
  }
268
+ /* 2.0.5 W4b — the face is a button that opens every account on this Mac */
269
+ .home-top-acct {
270
+ position: relative;
271
+ }
272
+ .home-top-acct-btn {
273
+ display: inline-flex;
274
+ padding: 0;
275
+ border: 0;
276
+ background: none;
277
+ border-radius: var(--radius-pill);
278
+ cursor: pointer;
279
+ }
280
+ .home-top-acct-btn:focus-visible {
281
+ outline: 2px solid var(--accent);
282
+ outline-offset: 2px;
283
+ }
284
+ .home-accts {
285
+ position: absolute;
286
+ top: calc(100% + var(--space-2));
287
+ right: 0;
288
+ z-index: 50;
289
+ width: 320px;
290
+ max-height: 70vh;
291
+ overflow: auto;
292
+ display: flex;
293
+ flex-direction: column;
294
+ gap: var(--space-2);
295
+ padding: var(--space-3);
296
+ background: var(--bg-1);
297
+ border: 1px solid var(--line-1, var(--bg-3));
298
+ border-radius: var(--radius-lg, 12px);
299
+ box-shadow: var(--shadow-3, 0 8px 24px rgb(0 0 0 / 0.18));
300
+ text-align: left;
301
+ }
302
+ .home-accts-h {
303
+ margin: 0;
304
+ font-size: var(--type-xs);
305
+ font-weight: var(--w-semibold);
306
+ color: var(--fg-2);
307
+ }
308
+ .home-accts-p {
309
+ display: flex;
310
+ flex-direction: column;
311
+ gap: var(--space-1);
312
+ }
313
+ .home-accts-ph {
314
+ display: flex;
315
+ align-items: center;
316
+ gap: var(--space-2);
317
+ margin: 0;
318
+ font-size: var(--type-sm);
319
+ font-weight: var(--w-semibold);
320
+ color: var(--fg-0);
321
+ }
322
+ .home-accts-list {
323
+ display: flex;
324
+ flex-direction: column;
325
+ gap: 2px;
326
+ margin: 0;
327
+ padding: 0;
328
+ list-style: none;
329
+ }
330
+ .home-accts-row {
331
+ display: flex;
332
+ align-items: center;
333
+ gap: var(--space-2);
334
+ padding-left: calc(16px + var(--space-2));
335
+ }
336
+ .home-accts-t {
337
+ flex: 1;
338
+ min-width: 0;
339
+ display: flex;
340
+ flex-direction: column;
341
+ font-size: var(--type-xs);
342
+ color: var(--fg-2);
343
+ }
344
+ .home-accts-t strong {
345
+ font-weight: var(--w-medium, 500);
346
+ color: var(--fg-1);
347
+ overflow: hidden;
348
+ text-overflow: ellipsis;
349
+ white-space: nowrap;
350
+ }
351
+ .home-accts-none,
352
+ .home-accts-note {
353
+ margin: 0;
354
+ padding-left: calc(16px + var(--space-2));
355
+ font-size: var(--type-xs);
356
+ color: var(--fg-2);
357
+ }
358
+ .home-accts-act {
359
+ align-self: flex-start;
360
+ padding: 2px 0 2px calc(16px + var(--space-2));
361
+ border: 0;
362
+ background: none;
363
+ font: inherit;
364
+ font-size: var(--type-xs);
365
+ color: var(--accent);
366
+ cursor: pointer;
367
+ }
368
+ .home-accts-foot {
369
+ display: flex;
370
+ flex-direction: column;
371
+ gap: 2px;
372
+ padding-top: var(--space-2);
373
+ border-top: 1px solid var(--line-1, var(--bg-3));
374
+ }
375
+ .home-accts-foot .home-accts-act {
376
+ padding-left: 0;
377
+ }
378
+ .home-accts-ask {
379
+ display: flex;
380
+ flex-direction: column;
381
+ gap: var(--space-1);
382
+ padding: var(--space-2);
383
+ border-radius: var(--radius-md, 8px);
384
+ background: var(--bg-2);
385
+ font-size: var(--type-xs);
386
+ }
387
+ .home-accts-btns {
388
+ display: flex;
389
+ justify-content: flex-end;
390
+ gap: var(--space-1);
391
+ }
268
392
 
269
393
  /* the Search palette (k-pal.pn-pal): a centred 620 card over a veil, field at --type-md with an esc key */
270
394
  .home-pal-veil {
@@ -861,6 +985,25 @@
861
985
  align-items: center;
862
986
  gap: var(--space-1);
863
987
  }
988
+ /* 2.0.5 W4b — how a project is connected, and the folders folded into its row */
989
+ .home-prow-conn {
990
+ display: inline-flex;
991
+ align-items: center;
992
+ gap: var(--space-1);
993
+ min-width: 0;
994
+ overflow: hidden;
995
+ text-overflow: ellipsis;
996
+ }
997
+ .home-prow-copies {
998
+ display: flex;
999
+ flex-wrap: wrap;
1000
+ gap: var(--space-1);
1001
+ /* under the name: past the 44px cover and the row's gap */
1002
+ padding: 0 var(--space-2) var(--space-1) calc(44px + var(--space-3) + var(--space-2));
1003
+ }
1004
+ .home-root .chip.home-prow-copy {
1005
+ font-size: var(--type-xs);
1006
+ }
864
1007
  /* live state on a project row (V2-3.3): AI working · Needs you · Resting (canvas 11 pn-bmore-st) */
865
1008
  .home-root .chip.home-prow-ai {
866
1009
  flex: none;
@@ -1569,15 +1712,36 @@
1569
1712
  .home-ghosts > i {
1570
1713
  display: block;
1571
1714
  height: 84px;
1715
+ min-width: 0;
1572
1716
  border-radius: var(--radius-md);
1573
- background: var(--bg-2);
1717
+ background: transparent;
1574
1718
  box-shadow: inset 0 0 0 1px var(--border-default);
1719
+ opacity: 0.6;
1720
+ }
1721
+ /* a shelf with nothing to draw: one quiet glyph beside the words, no ghost cards (the card stays as
1722
+ short as Recent canvases and Projects) */
1723
+ .home-shelf-row--lone {
1724
+ padding: var(--space-3) var(--space-4);
1725
+ overflow: hidden;
1726
+ }
1727
+ .home-shelf-row--lone .es-e {
1728
+ display: grid;
1729
+ grid-template-columns: auto minmax(0, 1fr);
1730
+ align-items: center;
1731
+ column-gap: var(--space-3);
1732
+ row-gap: 2px;
1575
1733
  }
1576
- .home-ghosts > i:nth-child(1) {
1577
- rotate: -2deg;
1734
+ .home-shelf-row--lone .es-e > .es-glyph {
1735
+ grid-row: 1 / span 2;
1578
1736
  }
1579
- .home-ghosts > i:nth-child(3) {
1580
- rotate: 2deg;
1737
+ .home-shelf-row--lone .es-e > :not(.es-glyph) {
1738
+ grid-column: 2;
1739
+ min-width: 0;
1740
+ }
1741
+ @media (max-width: 720px) {
1742
+ .home-two {
1743
+ grid-template-columns: minmax(0, 1fr);
1744
+ }
1581
1745
  }
1582
1746
  .island.home-shared {
1583
1747
  display: flex;
@@ -30,6 +30,10 @@ export function shellModeHint(win = typeof window !== 'undefined' ? window : und
30
30
  return null;
31
31
  }
32
32
 
33
+ /** The Home server's `/_config` answer the boot already read (null until then, or for a project). */
34
+ let bootConfig = null;
35
+ export const homeBootConfig = () => bootConfig;
36
+
33
37
  /**
34
38
  * Calls `render(mode, config)` once. Synchronously for a project the hint already names, so the
35
39
  * project shell's first paint is unchanged; after one `/_config` request otherwise.
@@ -41,7 +45,10 @@ export function bootShellMode(render, win) {
41
45
  return;
42
46
  }
43
47
  getConfig().then((r) => {
44
- if (r.ok && r.json?.mode === 'home') render('home', r.json);
48
+ if (r.ok && r.json?.mode === 'home') {
49
+ bootConfig = r.json;
50
+ render('home', r.json);
51
+ }
45
52
  // the Home window keeps Home even when its server is not answering yet: the page says so
46
53
  else if (hint === 'home') render('home', null);
47
54
  else render('project', null);
@@ -63,6 +63,8 @@ export function useProjectData({
63
63
  dsRevGaps: data.dsRevGaps ?? {},
64
64
  // gate-b-c4j — canvases that import another canvas do not render; the stage says why (viewport.jsx).
65
65
  canvasImportsCanvases: data.canvasImportsCanvases ?? {},
66
+ // 2.0.5 (#205) — canvases whose built module was refused for a file another canvas owns.
67
+ canvasRefusedInputs: data.canvasRefusedInputs ?? {},
66
68
  }));
67
69
  },
68
70
  onError: (error) => {
@@ -62,6 +62,7 @@ import { useAttachments } from '../v2/ai/use-attachments.js';
62
62
  import { notify } from '../../notifications.tsx';
63
63
  import { DEFAULT_TRANSCRIPT_VIEW, TRANSCRIPT_VIEWS } from './transcript-view.js';
64
64
  import { createFinishTracker } from './chat-finish.js';
65
+ import { capsKeyFor, isEmptyCaps, loadCachedCaps, saveCachedCaps } from './caps-cache.js';
65
66
 
66
67
  // DDR-185 — shared "did a genuinely new item arrive" check for the
67
68
  // permission/elicitation effects below: both need the identical shape (diff
@@ -193,32 +194,37 @@ function ChatThread({
193
194
  unavailable = false,
194
195
  viewer = false,
195
196
  onConnected,
197
+ projectName = '',
196
198
  }) {
197
199
  // Live session capabilities (feature-acp-panel-dynamic-claude-code-
198
200
  // capabilities) — `caps` is THIS chat's own connection's mode roster +
199
201
  // config-option set, sourced entirely from the ACP session. Never a
200
202
  // hardcoded list; re-renders on every `caps` frame (a model switch can
201
203
  // change which OTHER options — effort, fast — are even offered).
202
- const [caps, setCaps] = useState({ modes: null, configOptions: [] });
203
- useEffect(() => conn.onCaps(setCaps), [conn]);
204
+ //
205
+ // 2.0.5 - nothing starts Claude until the person engages, so a fresh load has no live roster. The last one this
206
+ // project saw is shown straight away (`caps-cache.js`) and the first live frame replaces it. A cached roster is
207
+ // only DRAWN: the one-time reconcile below waits for a live one, so it never sends anything on its own.
208
+ const capsKey = capsKeyFor(projectName || designRel);
209
+ const [caps, setCaps] = useState(
210
+ () => loadCachedCaps(capsKey) ?? { modes: null, configOptions: [] }
211
+ );
212
+ const [capsLive, setCapsLive] = useState(false);
213
+ useEffect(
214
+ () =>
215
+ conn.onCaps((next) => {
216
+ if (isEmptyCaps(next)) return; // the replay of "nothing yet" must not wipe the cached roster
217
+ setCaps(next);
218
+ setCapsLive(true);
219
+ saveCachedCaps(capsKey, next);
220
+ }),
221
+ [conn, capsKey]
222
+ );
204
223
  const parsedOptions = useMemo(() => parseConfigOptions(caps.configOptions), [caps.configOptions]);
205
224
 
206
- // Warm up as soon as this chat becomes the VISIBLE one — the capability bar
207
- // has nothing to show until a live session exists, and deferring the spawn
208
- // to "the user typed a slash command" (the original Composer-only trigger,
209
- // still below) left the model/effort/mode row completely EMPTY until then —
210
- // read as "I lost the picker" in dogfooding, a real regression. Fires once
211
- // per chat; a chat that's opened but never viewed still doesn't spawn
212
- // `claude`, so a background/hidden chat keeps some of DDR-123's "opening
213
- // the panel costs nothing" intent — only the chat actually on screen warms.
214
- const warmedOnVisibleRef = useRef(false);
215
- useEffect(() => {
216
- // S5.13: nothing to warm while Claude Code is not ready; the effect runs again when it is.
217
- if (hidden || unavailable || warmedOnVisibleRef.current) return;
218
- warmedOnVisibleRef.current = true;
219
- const p = picksRef.current;
220
- conn.warm(chatId, p.model, p.effort, p.mode);
221
- }, [hidden, unavailable, conn, chatId, picksRef]);
225
+ // No `warm` here (2.0.5). This effect used to spawn the claude adapter whenever a chat was on screen, so every
226
+ // webview reload started another process. The composer (v2/ai/Composer.jsx) warms it when the person focuses or
227
+ // types in it; a send spawns it itself.
222
228
 
223
229
  // One-time reconciliation: if the user's persisted pick (from a DIFFERENT
224
230
  // chat, or an earlier session) isn't what THIS freshly-established session
@@ -229,7 +235,7 @@ function ChatThread({
229
235
  // it can never loop.
230
236
  const reconciledRef = useRef(false);
231
237
  useEffect(() => {
232
- if (reconciledRef.current) return;
238
+ if (reconciledRef.current || !capsLive) return;
233
239
  const hasModes = (caps.modes?.availableModes?.length ?? 0) > 0;
234
240
  const hasOptions = caps.configOptions.length > 0;
235
241
  if (!hasModes && !hasOptions) return; // nothing to reconcile against yet
@@ -256,7 +262,7 @@ function ChatThread({
256
262
  if (resolved !== caps.modes.currentModeId) conn.setMode(chatId, resolved);
257
263
  }
258
264
  // eslint-disable-next-line react-hooks/exhaustive-deps
259
- }, [caps, parsedOptions]);
265
+ }, [caps, capsLive, parsedOptions]);
260
266
 
261
267
  const onSetMode = useCallback(
262
268
  (modeId) => {
@@ -1004,6 +1010,7 @@ export default function ChatPanel({
1004
1010
  chatId={id}
1005
1011
  initialMessages={hydratedRef.current.get(id) || []}
1006
1012
  hidden={id !== activeChatId}
1013
+ projectName={projectName}
1007
1014
  picksRef={picksRef}
1008
1015
  setPick={setPick}
1009
1016
  activeCanvas={activeCanvas}
@@ -23,6 +23,7 @@ import {
23
23
  pickDirectory,
24
24
  } from '../github.js';
25
25
  import { reasonProps } from '../v2/access/disabled-reason.js';
26
+ import { menuRunner } from '../v2/shell/menu-runner.js';
26
27
 
27
28
  function Icon({ name, size = 16 }) {
28
29
  const p = {
@@ -206,11 +207,24 @@ function NewView({ identity, signedIn, onClose }) {
206
207
  </button>
207
208
  </div>
208
209
  <span className="cp-field-help">
209
- {local
210
- ? 'A local git repo on your computer — no GitHub, no remote. You can publish it later.'
211
- : signedIn
212
- ? 'A repo on your GitHub account, cloned to your computer.'
213
- : 'Sign in with GitHub (bottom-left) to publish. For now you can create a local project.'}
210
+ {local ? (
211
+ 'A local git repo on your computer — no GitHub, no remote. You can publish it later.'
212
+ ) : signedIn ? (
213
+ 'A repo on your GitHub account, cloned to your computer.'
214
+ ) : (
215
+ <>
216
+ {/* 2.0.5 W4 — the line is a button (account.github-signin); the rail it pointed at is gone */}
217
+ <button
218
+ type="button"
219
+ className="btn btn--sm"
220
+ data-testid="cp-github-signin"
221
+ onClick={() => menuRunner.run('account.github-signin')}
222
+ >
223
+ Sign in with GitHub…
224
+ </button>{' '}
225
+ to publish. For now you can create a local project.
226
+ </>
227
+ )}
214
228
  </span>
215
229
  </div>
216
230
  <label className="cp-field">
@@ -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
+ }
@@ -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';
@@ -28,6 +28,8 @@ 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
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';
31
33
 
32
34
  export function Viewport({
33
35
  tabs,
@@ -113,9 +115,14 @@ export function Viewport({
113
115
  // S6.12 (C5) — what the open canvases say about drawing: one listener for every frame. The card is below.
114
116
  const wsSend = useContext(ShellStoreContext)?.local?.wsSend;
115
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)), []);
116
122
  const stableSrc = (path) => {
117
123
  const held = viewing?.path === path ? { viewing: viewing.at } : undefined;
118
- const opts = withDsPreview(held, dsPreview);
124
+ const base = withDsPreview(held, dsPreview);
125
+ const opts = guard.isLight(path) ? { ...(base || {}), light: true } : base;
119
126
  // A frame that changes between now and a past version is a new frame: the entry it comes back to is
120
127
  // built afresh, so it carries the capability that is live THEN, not the one of the first open.
121
128
  // The same holds for a frame entering or leaving a design-system preview, or stepping to another system.
@@ -144,6 +151,11 @@ export function Viewport({
144
151
  const canvasTab = activePath && activePath !== SYSTEM_TAB ? activePath : null;
145
152
  const availability = useCanvasAvailability(canvasTab, { stamp: canvasReloadNonce });
146
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]);
147
159
  // Still coming down (Q13 fallback): the "<name> is on its way." card, same stand-in for the frame.
148
160
  const arriving = !!canvasTab && availability === 'arriving';
149
161
  const canvasState =
@@ -225,6 +237,20 @@ export function Viewport({
225
237
  <NotLocalCanvas name={basename(t.path).replace(/\.(tsx|html)$/i, '')} />
226
238
  </div>
227
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
+ );
228
254
  if (arriving && t.path === activePath)
229
255
  return (
230
256
  <div
@@ -267,7 +293,7 @@ export function Viewport({
267
293
  />
268
294
  );
269
295
  })}
270
- {canvasTab && !notLocal && !arriving && (
296
+ {canvasTab && !notLocal && !arriving && !tooHeavy && (
271
297
  // r3 — an Assets tile dragged over the canvas: the shell takes the drop (WebKit gives the canvas origin no
272
298
  // event of a drag the shell started) and places the picture on what the canvas says lies under it
273
299
  <CanvasDropCatcher
@@ -294,7 +320,7 @@ export function Viewport({
294
320
  onClose={() => setCodeReq(null)}
295
321
  />
296
322
  )}
297
- {loadingPath && loadingPath === activePath && !notLocal && !arriving && (
323
+ {loadingPath && loadingPath === activePath && !notLocal && !arriving && !tooHeavy && (
298
324
  // DS skeletons recipe — calm .skel pulse while the canvas-shell compiles
299
325
  // the TSX. Cleared by the iframe's dgn:'loaded' message (or the onLoad
300
326
  // fallback timer for legacy .html canvases that never post it).
@@ -305,7 +331,7 @@ export function Viewport({
305
331
  // a fresh card on every re-render while opening, so the card never left (fix-opening-hang).
306
332
  <CanvasLoading key={`${loadingPath}#loading`} path={loadingPath} cloud={!!cfg?.cloud} />
307
333
  )}
308
- {canvasError && canvasError.path === activePath && !notLocal && !arriving && (
334
+ {canvasError && canvasError.path === activePath && !notLocal && !arriving && !tooHeavy && (
309
335
  // issue #115 — what the blank pane used to be. Names which of the two
310
336
  // failures happened and offers the recovery that used to require
311
337
  // quitting the app (or knowing that switching projects and back
@@ -331,12 +357,14 @@ export function Viewport({
331
357
  Reload canvas
332
358
  </button>
333
359
  </div>
334
- ) : canvasImportsOf(cfg, canvasError.path) ? (
360
+ ) : canvasImportsOf(cfg, canvasError.path) || canvasRefusedOf(cfg, canvasError.path) ? (
335
361
  // gate-b-c4j — it imports another canvas, so its frame refused the module: say that, not "can't
336
- // 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.
337
364
  <CanvasImportsCard
338
365
  key={`${canvasError.path}#imports`}
339
366
  imports={canvasImportsOf(cfg, canvasError.path)}
367
+ refused={canvasRefusedOf(cfg, canvasError.path)}
340
368
  componentDir={cfg?.newComponentDir}
341
369
  />
342
370
  ) : (
@@ -356,7 +384,7 @@ export function Viewport({
356
384
  )}
357
385
  </div>
358
386
  )}
359
- {canvasTab && !notLocal && !arriving && (
387
+ {canvasTab && !notLocal && !arriving && !tooHeavy && (
360
388
  // S6.12 — the code compiles and then throws while drawing: S11.7's card over the dimmed last good
361
389
  // render, with Go back to 14:05. Silent while this Mac's own AI run draws on it.
362
390
  <RenderErrorHost
@@ -182,6 +182,8 @@ export const WORDS = Object.freeze({
182
182
  // decision v2-lead-trashed-while-open-stops-writes: writes stop; what was not sent yet is parked with it
183
183
  trashedLine: 'You can keep looking. Your unsent changes stay with it.',
184
184
  restore: 'Restore',
185
+ // the restore never writes over a canvas made at the old place meanwhile: it comes back beside it
186
+ restoredAs: (canvas) => `Restored as ${canvas}. A canvas with the old name already exists.`,
185
187
  sharedWithYou: (role) => `Shared with you · ${accessWord(role)}`,
186
188
  onlyOne: (canvas) => `Only ${canvas} was shared with you.`,
187
189
  onlyMany: (n) => `Only these ${n} canvases were shared with you.`,
@@ -306,7 +306,18 @@ export function AccessHost({
306
306
  const open = (tabs || []).map((t) => canvasRel(t?.path, designRel)).filter(Boolean);
307
307
  useTrashGhosts(items, open, onOpenTab, rel);
308
308
 
309
- const onRestored = useCallback(() => void reload(), [reload]);
309
+ const onRestored = useCallback(
310
+ (path, o) => {
311
+ void reload();
312
+ // A canvas was made at that place meanwhile: the restore never overwrites it, it comes back beside it.
313
+ if (o?.renamed)
314
+ toast?.({
315
+ title: WORDS.restoredAs(canvasName(path)),
316
+ kind: 'info',
317
+ });
318
+ },
319
+ [reload, toast]
320
+ );
310
321
  const onError = useCallback((m) => toast?.({ title: m, kind: 'error' }), [toast]);
311
322
 
312
323
  return (
@@ -16,10 +16,13 @@ import { commentTime } from '../comments/comments-model.js';
16
16
  import { restoreItem } from '../left-panel/use-trash.js';
17
17
  import { canvasName, WORDS } from './access-client.js';
18
18
 
19
- /** The shared Trash's canvas item for the open canvas (designRoot-relative `rel`), or null. */
19
+ /**
20
+ * The shared Trash's canvas item for the open canvas (designRoot-relative `rel`), or null. An item a live
21
+ * canvas holds the path of (`liveAtPath`, GET /_api/trash) is an OLDER copy: the open canvas was not trashed.
22
+ */
20
23
  export function trashedWhileOpen(items, rel) {
21
24
  if (!rel || !Array.isArray(items)) return null;
22
- return items.find((i) => i?.kind === 'canvas' && i.path === rel) ?? null;
25
+ return items.find((i) => i?.kind === 'canvas' && i.path === rel && i.liveAtPath !== true) ?? null;
23
26
  }
24
27
 
25
28
  /** Every open tab whose canvas is in the trash → the panel's ghost rows. `open` = designRoot-relative paths. */
@@ -73,7 +76,7 @@ export function TrashedBanner({ item, canRestore = true, now, fetchImpl, onResto
73
76
  try {
74
77
  const r = await restoreItem(item.id, fetchImpl);
75
78
  if (r.status >= 200 && r.status < 300 && r.body?.ok !== false)
76
- onRestored?.(r.body?.path ?? item.path);
79
+ onRestored?.(r.body?.path ?? item.path, { renamed: r.body?.renamed === true });
77
80
  else
78
81
  onError?.(
79
82
  typeof r.body?.error === 'string' ? r.body.error : 'Could not restore it. Try again.'
@@ -401,6 +401,18 @@ export function ChatAdvanced({
401
401
  Connecting…
402
402
  </p>
403
403
  ) : null}
404
+ {/* 2.0.5 - AI starts when you do, so a first run has no roster yet: the rows sit in their resting
405
+ state (same labels) instead of leaving the fold empty; they fill in once AI answers. */}
406
+ {noCaps && !connecting ? (
407
+ <div data-testid="chat-caps-placeholder">
408
+ {['Model', 'Effort', 'Permissions'].map((label) => (
409
+ <div className="ai-adv-row" key={label} data-adv-row={`placeholder-${label}`}>
410
+ <span className="ai-adv-k">{label}</span>
411
+ <span className="ai-adv-hint">Set when AI starts</span>
412
+ </div>
413
+ ))}
414
+ </div>
415
+ ) : null}
404
416
  {parsed.model ? (
405
417
  <OptionSelect row="model" label="Model" opt={parsed.model} onChange={onSetConfig} />
406
418
  ) : null}
@@ -308,7 +308,15 @@ export function CommandPopover({ items, activeIndex, onPick, onHover }) {
308
308
  // but ONLY when that token is a command that exists (the badge gate). The mirror
309
309
  // MUST match the textarea's box model exactly (see .chat-input / .chat-input-mirror
310
310
  // in v2/ai/chat.css) or the pill drifts off the text.
311
- function HighlightedInput({ existsSet, attachmentsRef, onAttachChange, attach, multi, onMulti }) {
311
+ function HighlightedInput({
312
+ existsSet,
313
+ attachmentsRef,
314
+ onAttachChange,
315
+ attach,
316
+ multi,
317
+ onMulti,
318
+ onEngage,
319
+ }) {
312
320
  const text = useComposer((c) => c.text);
313
321
  const mirrorRef = useRef(null);
314
322
  const wrapRef = useRef(null);
@@ -420,6 +428,9 @@ function HighlightedInput({ existsSet, attachmentsRef, onAttachChange, attach, m
420
428
  placeholder="Ask AI…"
421
429
  aria-label="Message to AI"
422
430
  onPaste={onPaste}
431
+ // 2.0.5 - the person is here: the first focus or keystroke wakes the adapter (once, in Composer)
432
+ onFocus={onEngage}
433
+ onInput={onEngage}
423
434
  onScroll={(e) => {
424
435
  if (mirrorRef.current) mirrorRef.current.scrollTop = e.currentTarget.scrollTop;
425
436
  }}
@@ -498,19 +509,24 @@ export function Composer({
498
509
  setMoreOpen(false);
499
510
  }, [match?.token]);
500
511
 
501
- // Warm the adapter the first time the user starts a slash command, so the live
502
- // catalogue arrives without a full prompt. Guarded to fire once per mount.
512
+ // Warm the adapter the first time the person ENGAGES: focuses the field, starts typing (a slash command included),
513
+ // or sends (a prompt spawns it itself). Never on mount or reload - a panel that only re-opened used to send `warm`
514
+ // from ChatPanel, and every webview reload started another `claude` (2.0.5). Focus is early enough that the
515
+ // capability row and the slash catalogue are usually there before the first word. Once per mount; not while Claude
516
+ // Code is not ready (S5.13) or for a viewer (the field is read-only).
503
517
  // model/effort/mode are the user's PERSISTED picks (read live off the ref so
504
- // this effect doesn't need to re-run when they change) — applied once, live,
518
+ // this callback doesn't need to change when they change) - applied once, live,
505
519
  // by the bridge right after the session establishes.
506
520
  const warmedRef = useRef(false);
521
+ const warmOnce = useCallback(() => {
522
+ if (warmedRef.current || unavailable || viewer) return;
523
+ warmedRef.current = true;
524
+ const p = picksRef.current;
525
+ conn.warm(chatId, p.model, p.effort, p.mode);
526
+ }, [conn, chatId, picksRef, unavailable, viewer]);
507
527
  useEffect(() => {
508
- if (menuOpen && !warmedRef.current) {
509
- warmedRef.current = true;
510
- const p = picksRef.current;
511
- conn.warm(chatId, p.model, p.effort, p.mode);
512
- }
513
- }, [menuOpen, conn, chatId, picksRef]);
528
+ if (menuOpen) warmOnce();
529
+ }, [menuOpen, warmOnce]);
514
530
 
515
531
  // V2-4.6 — ⌘K "Ask AI": the query lands in the composer; the person still sends it. S10.16c: the DS hosts'
516
532
  // `askAI(text, { send: true, origin: 'ds-…' })` is the one ask that also sends (use-ask-ai.js; this file never does).
@@ -612,6 +628,7 @@ export function Composer({
612
628
  attach={attach}
613
629
  multi={multi}
614
630
  onMulti={setMulti}
631
+ onEngage={warmOnce}
615
632
  />
616
633
  {/* S5.12 — the model / effort / mode pickers and the info button moved to the panel's
617
634
  Advanced fold (Advanced.jsx); the field keeps only what 03 draws: the text and send