@1agh/maude 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/apps/studio/acp/agents/auth.ts +241 -0
  2. package/apps/studio/acp/agents/catalog.ts +308 -0
  3. package/apps/studio/acp/agents/chat-key.ts +64 -0
  4. package/apps/studio/acp/agents/conformance.ts +1853 -0
  5. package/apps/studio/acp/agents/consent.ts +92 -0
  6. package/apps/studio/acp/agents/descriptor.ts +188 -0
  7. package/apps/studio/acp/agents/discover.ts +491 -0
  8. package/apps/studio/acp/agents/e2e-model.ts +58 -0
  9. package/apps/studio/acp/agents/health.ts +46 -0
  10. package/apps/studio/acp/agents/link-scan.ts +230 -0
  11. package/apps/studio/acp/agents/spawn.ts +164 -0
  12. package/apps/studio/acp/agents/state.ts +132 -0
  13. package/apps/studio/acp/ask-queue.ts +13 -4
  14. package/apps/studio/acp/bootstrap-brief.ts +16 -3
  15. package/apps/studio/acp/bridge.ts +709 -99
  16. package/apps/studio/acp/env.ts +43 -1
  17. package/apps/studio/acp/index.ts +428 -43
  18. package/apps/studio/acp/may-scope.ts +244 -21
  19. package/apps/studio/acp/policy/agent-home.ts +202 -0
  20. package/apps/studio/acp/policy/bridge-gate.ts +68 -0
  21. package/apps/studio/acp/policy/codex-home.ts +228 -0
  22. package/apps/studio/acp/policy/enforce.ts +620 -0
  23. package/apps/studio/acp/policy/gate-types.ts +41 -0
  24. package/apps/studio/acp/policy/launch-codex.ts +351 -0
  25. package/apps/studio/acp/policy/launch-copilot.ts +119 -0
  26. package/apps/studio/acp/policy/launch-gemini.ts +120 -0
  27. package/apps/studio/acp/policy/launch-opencode.ts +131 -0
  28. package/apps/studio/acp/policy/opencode-user-config.ts +240 -0
  29. package/apps/studio/acp/probe.ts +78 -14
  30. package/apps/studio/acp/transcript.ts +14 -0
  31. package/apps/studio/acp/write-scope.ts +62 -2
  32. package/apps/studio/canvas-pages-view.tsx +3 -2
  33. package/apps/studio/canvas-theme-pill.tsx +125 -72
  34. package/apps/studio/client/panels/ChatPanel.jsx +19 -4
  35. package/apps/studio/client/panels/PermissionPrompt.jsx +11 -6
  36. package/apps/studio/client/panels/acp-runtime.js +95 -7
  37. package/apps/studio/client/v2/ai/Advanced.jsx +4 -3
  38. package/apps/studio/client/v2/ai/AgentNotice.jsx +138 -0
  39. package/apps/studio/client/v2/ai/AgentOffer.jsx +110 -0
  40. package/apps/studio/client/v2/ai/AgentPicker.jsx +121 -0
  41. package/apps/studio/client/v2/ai/Composer.jsx +4 -0
  42. package/apps/studio/client/v2/ai/ConnectSheet.jsx +13 -0
  43. package/apps/studio/client/v2/ai/Feed.jsx +8 -0
  44. package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +24 -1
  45. package/apps/studio/client/v2/ai/Suggest.jsx +5 -1
  46. package/apps/studio/client/v2/ai/advanced-model.js +17 -6
  47. package/apps/studio/client/v2/ai/agents-model.js +333 -0
  48. package/apps/studio/client/v2/ai/agents-store.js +223 -0
  49. package/apps/studio/client/v2/ai/ai.css +63 -0
  50. package/apps/studio/client/v2/ai/needs-you.js +1 -1
  51. package/apps/studio/client/v2/fold/fold-store.js +1 -0
  52. package/apps/studio/client/v2/left-panel/left-panel.css +8 -0
  53. package/apps/studio/client/v2/settings/agent-keys.js +88 -0
  54. package/apps/studio/client/v2/settings/agents-card.jsx +408 -0
  55. package/apps/studio/client/v2/settings/connections-model.js +1 -1
  56. package/apps/studio/client/v2/settings/connections-section.jsx +4 -0
  57. package/apps/studio/client/v2/settings/settings-cards.js +2 -1
  58. package/apps/studio/client/v2/settings/settings-model.js +1 -0
  59. package/apps/studio/client/v2/settings/settings.css +7 -0
  60. package/apps/studio/client/v2/shell/served-routes.js +1 -0
  61. package/apps/studio/cloud-build.ts +5 -0
  62. package/apps/studio/dist/client.bundle.js +604 -604
  63. package/apps/studio/dist/styles.css +1 -1
  64. package/apps/studio/ds/board/board.css +4 -78
  65. package/apps/studio/ds/board/ds-bar.tsx +15 -9
  66. package/apps/studio/generation/keys.ts +197 -11
  67. package/apps/studio/outbox/policy.ts +8 -2
  68. package/apps/studio/outbox/types.ts +5 -0
  69. package/apps/studio/routes/agents.ts +479 -0
  70. package/apps/studio/routes/index.ts +3 -0
  71. package/apps/studio/scripts/acp-conformance-local.ts +95 -0
  72. package/apps/studio/scripts/acp-e2e-local.ts +1026 -0
  73. package/apps/studio/server.ts +9 -0
  74. package/apps/studio/sync/writer-registry.ts +12 -0
  75. package/apps/studio/whats-new.json +19 -0
  76. package/apps/studio/ws.ts +3 -0
  77. package/cli/commands/codex.mjs +36 -2
  78. package/cli/lib/harness/codex-runtime.mjs +98 -11
  79. package/package.json +9 -8
@@ -181,6 +181,13 @@ export interface WriteScopeVerdict {
181
181
  * runs only executable hooks there, and `Write` creates 0644.
182
182
  * • `.ai/workflows.config.json` (root only — a PREFIX rule below) — flow
183
183
  * `eval`s its `quality` gates on the next /flow:validate or commit gate.
184
+ * • Other agents' project config (security review 2026-11-12, defender M1 /
185
+ * attacker C2) — `.codex`, `.agents`, `.opencode`, `opencode.json(c)`,
186
+ * `.gemini`, `AGENTS.md`, `GEMINI.md` (and the already-listed `.claude`,
187
+ * `CLAUDE.md`, `.mcp.json`). The person's terminal Codex / opencode / Gemini
188
+ * loads them from the project on its next run: MCP servers and plugins start
189
+ * unsandboxed, and the instruction files steer that agent. This narrows the
190
+ * Claude chat too: those writes now reach the person's card.
184
191
  *
185
192
  * THE PREDICATE, recorded so this list is extended by RE-DERIVATION rather than
186
193
  * by pattern-matching the entries above: **an in-project path that reaches
@@ -203,6 +210,15 @@ export const PROTECTED_IN_PROJECT: readonly string[] = [
203
210
  '.claude',
204
211
  'CLAUDE.md',
205
212
  '.mcp.json',
213
+ // security review 2026-11-12 M1/C2 — other agents' project config (see the bullet above).
214
+ '.codex',
215
+ '.agents',
216
+ '.opencode',
217
+ 'opencode.json',
218
+ 'opencode.jsonc',
219
+ '.gemini',
220
+ 'AGENTS.md',
221
+ 'GEMINI.md',
206
222
  '.envrc',
207
223
  '.vscode',
208
224
  'node_modules',
@@ -544,6 +560,50 @@ export function resolveWriteTargets(
544
560
  }
545
561
 
546
562
  const resolved = [...new Set([...resolvedLocations, ...resolvedRawInput])];
563
+ return judgeResolvedWrites(resolved, odd, [scopeRoot], readOnlyRoots, onlyPaths, designRoots);
564
+ }
565
+
566
+ /**
567
+ * Universal ACP (B3/F5, contract rule 5) — the write gate keyed on a normalised request's paths
568
+ * instead of a Claude tool call: each path spelled from `cwd` through agent-path.ts and realpath'd,
569
+ * then the same rules as `resolveWriteTargets` (read-only grants, every target inside one of
570
+ * `writeRoots`, protected paths, runtime state, a run's own scope). No path, or one with a NUL →
571
+ * `no-target`. `writeRoots` are compared as they resolve on disk.
572
+ */
573
+ export function writeVerdictForPaths(
574
+ paths: readonly string[],
575
+ cwd: string,
576
+ writeRoots: readonly string[],
577
+ readOnlyRoots: readonly string[] = [],
578
+ onlyPaths: readonly string[] | null = null,
579
+ designRoots: readonly string[] = []
580
+ ): WriteScopeVerdict {
581
+ const roots = writeRoots.filter((r) => isAbsolute(r)).map((r) => resolveRealPath(r, r));
582
+ const spelled = paths.map((p) => agentPath(p, cwd));
583
+ if (!spelled.length || !roots.length || spelled.some((a) => a === null))
584
+ return { inside: false, reason: 'no-target', resolved: [] };
585
+ const odd = spelled.some((a) => a?.odd);
586
+ const resolved = [
587
+ ...new Set(spelled.map((a) => resolveRealPath((a as { abs: string }).abs, cwd))),
588
+ ];
589
+ return judgeResolvedWrites(resolved, odd, roots, readOnlyRoots, onlyPaths, designRoots);
590
+ }
591
+
592
+ /**
593
+ * The rules after resolution, shared by both entry points. `roots[0]` (the pinned scope root) is
594
+ * what relative grants and run paths resolve against; a target must lie inside ONE of `roots`, and
595
+ * the protected-path test runs against that root.
596
+ */
597
+ function judgeResolvedWrites(
598
+ resolved: string[],
599
+ odd: boolean,
600
+ roots: readonly string[],
601
+ readOnlyRoots: readonly string[],
602
+ onlyPaths: readonly string[] | null,
603
+ designRoots: readonly string[]
604
+ ): WriteScopeVerdict {
605
+ const scopeRoot = roots[0] as string;
606
+ const rootOf = (p: string) => roots.find((r) => isInsideRoot(p, r));
547
607
  // S5.10 — a folder the person allowed AI to READ stays read-only, inside the project or not.
548
608
  // Judged on the resolved target (symlinks followed by resolveRealPath) against each grant's real
549
609
  // path, and the root itself counts: a grant never turns into a write path.
@@ -559,12 +619,12 @@ export function resolveWriteTargets(
559
619
  return { inside: false, reason: 'read-only-grant', resolved };
560
620
  }
561
621
  // EVERY target must pass — a multi-location write with one escape is an escape.
562
- const inside = !odd && resolved.every((p) => isInsideRoot(p, scopeRoot));
622
+ const inside = !odd && resolved.every((p) => rootOf(p) !== undefined);
563
623
  if (!inside) return { inside: false, reason: 'outside', resolved };
564
624
  // Inside is NECESSARY but not SUFFICIENT. A write under `.git/` or `.claude/`
565
625
  // is in-project and still reaches execution, so it goes to the prompt like any
566
626
  // out-of-project write would. See PROTECTED_IN_PROJECT.
567
- if (resolved.some((p) => isProtectedInProject(p, scopeRoot))) {
627
+ if (resolved.some((p) => isProtectedInProject(p, rootOf(p) as string))) {
568
628
  return { inside: false, reason: 'in-project-denied', resolved };
569
629
  }
570
630
  // V2-8.9 B1 — the app's runtime state under the design root is not the agent's to write.
@@ -362,10 +362,11 @@ const SEG_TITLE = {
362
362
  pages: 'One artboard at a time',
363
363
  } as const;
364
364
 
365
- /** The two homes of the switch: the canvas pill (canvas-theme-pill.tsx) and the Design system bar (ds-bar.tsx). */
365
+ /** The two homes of the switch: the canvas pill (canvas-theme-pill.tsx) and the Design system bar (ds-bar.tsx) —
366
+ * one island since #225, so one set of classes. */
366
367
  const SEG_CLASS = {
367
368
  pill: { seg: 'dc-theme-pill-seg', b: 'dc-theme-pill-b' },
368
- ds: { seg: 'ds-bar-seg', b: 'ds-bar-b' },
369
+ ds: { seg: 'dc-theme-pill-seg', b: 'dc-theme-pill-b' },
369
370
  } as const;
370
371
 
371
372
  /**
@@ -15,6 +15,9 @@
15
15
  // (smaller, grey), centred in the free band the shell reports with its `occluded-insets` (`topBand`, the stretch
16
16
  // between the project pill and the Share cluster) and never wider than it. Short of room the path line goes first,
17
17
  // then the name truncates. An older shell sends no band: the pill centres on the frame, as before.
18
+ //
19
+ // #225 — the Design system canvas's bar is the same island (`CanvasTopIsland`, its own controls on the row): it kept a
20
+ // copy of this chrome in ds/board/board.css and missed #217, so on that screen the bar sat elsewhere.
18
21
 
19
22
  import {
20
23
  type ReactNode,
@@ -30,7 +33,7 @@ import { DsIcon } from './canvas-ds-icons.tsx';
30
33
  import { getCanvasThemeSystemName, setCanvasTheme, useCanvasTheme } from './canvas-theme.ts';
31
34
  import { THEME_WORD, ThemeIcon } from './canvas-theme-icons.tsx';
32
35
 
33
- /** The pill's chrome. Kept in step with the `.ds-bar` block of ds/board/board.css (same pill, other canvases). */
36
+ /** The island's chrome — the canvas pill's AND the Design system bar's (#225: one copy, `CanvasTopIsland`). */
34
37
  const PILL_CSS = `
35
38
  .dc-theme-pill{position:fixed;left:50%;top:16px;translate:-50% 0;z-index:2147483000;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0;min-height:44px;padding:4px 8px 5px;overflow:hidden;border-radius:var(--maude-hud-radius-lg,14px);background:var(--maude-hud-island-bg);color:var(--maude-chrome-fg-0);-webkit-backdrop-filter:saturate(1.4) blur(18px);backdrop-filter:saturate(1.4) blur(18px);box-shadow:var(--maude-hud-island-shadow),inset 0 0 0 .5px var(--maude-hud-island-edge);font:400 var(--maude-hud-type-sm,12px)/1 var(--maude-chrome-font-body);white-space:nowrap}
36
39
  .dc-theme-pill-row{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding-left:4px}
@@ -152,33 +155,26 @@ function canvasFilePath(): string | null {
152
155
  }
153
156
 
154
157
  /**
155
- * @param bothThemes does the canvas's design system define Light AND Dark? Asked on every render (the answer can
156
- * arrive after first paint, once the system's stylesheet has parsed — the pill re-asks on load).
158
+ * #225 — the one top-centre island every canvas draws: the canvas pill below, and the Design system canvas's bar
159
+ * (ds/board/ds-bar.tsx), which used to keep its own copy of the chrome — still centred on the frame in the old one-row
160
+ * form after #217, so on that screen the bar sat elsewhere. Placed in the shell's free top band (`pillPlacement`), a
161
+ * column with the canvas's path on its own line above `children` (the host's controls row). Maude's chrome, so tagged
162
+ * `data-dc-overlay` (an export never carries it) and stepping aside while a people pill holds the spot.
157
163
  */
158
- export function CanvasThemePill({
159
- bothThemes,
160
- onProbeStale,
161
- extra,
164
+ export function CanvasTopIsland({
165
+ testid,
166
+ ariaLabel,
167
+ rowTestid,
168
+ pathTestid,
169
+ children,
162
170
  }: {
163
- bothThemes: () => boolean;
164
- /** subscribe to "the answer may have changed" (a stylesheet or the first artboard wrapper arrived) */
165
- onProbeStale?: (f: () => void) => () => void;
166
- /** 2.0.7 B2 — drawn after Light | Dark: the canvas's Canvas | Pages (canvas-pages-view.tsx) */
167
- extra?: ReactNode;
171
+ testid: string;
172
+ ariaLabel: string;
173
+ rowTestid: string;
174
+ pathTestid: string;
175
+ /** the controls row, under the path line */
176
+ children: ReactNode;
168
177
  }) {
169
- const mode = useCanvasTheme();
170
- const [, tick] = useState(0);
171
- useEffect(() => {
172
- if (typeof window === 'undefined') return;
173
- const again = () => tick((n) => n + 1);
174
- if (document.readyState === 'complete') again();
175
- else window.addEventListener('load', again, { once: true });
176
- const off = onProbeStale?.(again);
177
- return () => {
178
- window.removeEventListener('load', again);
179
- off?.();
180
- };
181
- }, [onProbeStale]);
182
178
  // r5-8 — the canvas's path on the pill; a click copies it whole and the pill says so for a moment
183
179
  const [copied, setCopied] = useState<'no' | 'ok' | 'failed'>('no');
184
180
  useEffect(() => {
@@ -198,20 +194,16 @@ export function CanvasThemePill({
198
194
  setCopied('failed');
199
195
  }
200
196
  };
201
- const both = bothThemes();
202
- const name = getCanvasThemeSystemName();
203
197
  // #217 — placed in the shell's free top band; the path line goes first when the band is short
204
198
  const band = useTopBand();
205
199
  const vw = useViewportWidth();
206
200
  const place = pillPlacement(band, vw);
207
201
  const pillRef = useRef<HTMLDivElement>(null);
208
- const textRef = useRef<HTMLSpanElement>(null);
209
- const titleRef = useRef<HTMLElement>(null);
210
202
  const pathRef = useRef<HTMLButtonElement>(null);
211
203
  const [pathShown, setPathShown] = useState(true);
212
204
  // how many characters of the path fit: it loses its leading folders first, never its file name
213
205
  const [pathChars, setPathChars] = useState(PATH_MAX);
214
- // biome-ignore lint/correctness/useExhaustiveDependencies: name, file and copied change the lines' natural widths
206
+ // file and copied change the path line's natural width; the row's own changes reach `fit` through the ResizeObserver
215
207
  useLayoutEffect(() => {
216
208
  const pill = pillRef.current;
217
209
  if (!pill) return undefined;
@@ -241,7 +233,7 @@ export function CanvasThemePill({
241
233
  const ro = new ResizeObserver(fit); // Light | Dark and Canvas | Pages may change width after first paint
242
234
  ro.observe(pill);
243
235
  return () => ro.disconnect();
244
- }, [place.maxWidth, name, file, copied]);
236
+ }, [place.maxWidth, file, copied]);
245
237
  return (
246
238
  <>
247
239
  <style data-dc-theme-pill-css="">{PILL_CSS}</style>
@@ -249,19 +241,19 @@ export function CanvasThemePill({
249
241
  ref={pillRef}
250
242
  className="dc-theme-pill"
251
243
  data-dc-overlay=""
252
- data-testid="canvas-theme-pill"
244
+ data-testid={testid}
253
245
  data-band={place.banded ? 'band' : 'frame'}
254
246
  data-path={file ? (pathShown ? 'shown' : 'hidden') : undefined}
255
247
  style={{ left: `${place.left}px`, maxWidth: `${place.maxWidth}px` }}
256
248
  role="toolbar"
257
- aria-label="Canvas theme"
249
+ aria-label={ariaLabel}
258
250
  >
259
251
  {file ? (
260
252
  <button
261
253
  ref={pathRef}
262
254
  type="button"
263
255
  className="dc-theme-pill-path"
264
- data-testid="canvas-theme-path"
256
+ data-testid={pathTestid}
265
257
  title={`Copy relative path — ${file}`}
266
258
  aria-label={`Copy relative path ${file}`}
267
259
  aria-live="polite"
@@ -274,46 +266,107 @@ export function CanvasThemePill({
274
266
  : shortenCanvasPath(file, pathChars)}
275
267
  </button>
276
268
  ) : null}
277
- <div className="dc-theme-pill-row" data-testid="canvas-theme-row">
278
- {name ? (
279
- <span className="dc-theme-pill-ic" aria-hidden="true">
280
- <DsIcon name="system" size={14} />
281
- </span>
282
- ) : null}
283
- {name ? (
284
- <span ref={textRef} className="dc-theme-pill-text" data-testid="canvas-theme-text">
285
- <b ref={titleRef} className="dc-theme-pill-title" data-testid="canvas-theme-title">
286
- {name}
287
- </b>
288
- </span>
289
- ) : null}
290
- <fieldset className="dc-theme-pill-seg" aria-label="Show every artboard in">
291
- {(['light', 'dark'] as const).map((m) => (
292
- <button
293
- key={m}
294
- type="button"
295
- className="dc-theme-pill-b dc-theme-pill-b--ic"
296
- data-testid={`canvas-theme-mode-${m}`}
297
- aria-pressed={mode === m}
298
- aria-label={THEME_WORD[m]}
299
- disabled={!both && mode !== m}
300
- // 2.0.7 — icons only (Michal): the name is the tooltip; a theme the canvas lacks says so there
301
- title={!both && mode !== m ? `This canvas has no ${THEME_WORD[m]}` : THEME_WORD[m]}
302
- onClick={() => setCanvasTheme(m)}
303
- >
304
- <ThemeIcon mode={m} />
305
- </button>
306
- ))}
307
- </fieldset>
308
- {!both ? (
309
- // read by a screen reader only; the greyed button's tooltip says the same to everyone else
310
- <span className="dc-theme-pill-sr" data-testid="canvas-theme-note">
311
- {`This canvas has no ${mode === 'light' ? 'Dark' : 'Light'}`}
312
- </span>
313
- ) : null}
314
- {extra}
269
+ <div className="dc-theme-pill-row" data-testid={rowTestid}>
270
+ {children}
315
271
  </div>
316
272
  </div>
317
273
  </>
318
274
  );
319
275
  }
276
+
277
+ /** The design system's glyph tile and name, as both islands draw them (the name truncates first, never a control). */
278
+ export function TopIslandTitle({
279
+ name,
280
+ textTestid,
281
+ titleTestid,
282
+ }: {
283
+ name: string;
284
+ textTestid?: string;
285
+ titleTestid?: string;
286
+ }) {
287
+ return (
288
+ <>
289
+ <span className="dc-theme-pill-ic" aria-hidden="true">
290
+ <DsIcon name="system" size={14} />
291
+ </span>
292
+ <span className="dc-theme-pill-text" data-testid={textTestid}>
293
+ <b className="dc-theme-pill-title" data-testid={titleTestid}>
294
+ {name}
295
+ </b>
296
+ </span>
297
+ </>
298
+ );
299
+ }
300
+
301
+ /**
302
+ * @param bothThemes does the canvas's design system define Light AND Dark? Asked on every render (the answer can
303
+ * arrive after first paint, once the system's stylesheet has parsed — the pill re-asks on load).
304
+ */
305
+ export function CanvasThemePill({
306
+ bothThemes,
307
+ onProbeStale,
308
+ extra,
309
+ }: {
310
+ bothThemes: () => boolean;
311
+ /** subscribe to "the answer may have changed" (a stylesheet or the first artboard wrapper arrived) */
312
+ onProbeStale?: (f: () => void) => () => void;
313
+ /** 2.0.7 B2 — drawn after Light | Dark: the canvas's Canvas | Pages (canvas-pages-view.tsx) */
314
+ extra?: ReactNode;
315
+ }) {
316
+ const mode = useCanvasTheme();
317
+ const [, tick] = useState(0);
318
+ useEffect(() => {
319
+ if (typeof window === 'undefined') return;
320
+ const again = () => tick((n) => n + 1);
321
+ if (document.readyState === 'complete') again();
322
+ else window.addEventListener('load', again, { once: true });
323
+ const off = onProbeStale?.(again);
324
+ return () => {
325
+ window.removeEventListener('load', again);
326
+ off?.();
327
+ };
328
+ }, [onProbeStale]);
329
+ const both = bothThemes();
330
+ const name = getCanvasThemeSystemName();
331
+ return (
332
+ <CanvasTopIsland
333
+ testid="canvas-theme-pill"
334
+ ariaLabel="Canvas theme"
335
+ rowTestid="canvas-theme-row"
336
+ pathTestid="canvas-theme-path"
337
+ >
338
+ {name ? (
339
+ <TopIslandTitle
340
+ name={name}
341
+ textTestid="canvas-theme-text"
342
+ titleTestid="canvas-theme-title"
343
+ />
344
+ ) : null}
345
+ <fieldset className="dc-theme-pill-seg" aria-label="Show every artboard in">
346
+ {(['light', 'dark'] as const).map((m) => (
347
+ <button
348
+ key={m}
349
+ type="button"
350
+ className="dc-theme-pill-b dc-theme-pill-b--ic"
351
+ data-testid={`canvas-theme-mode-${m}`}
352
+ aria-pressed={mode === m}
353
+ aria-label={THEME_WORD[m]}
354
+ disabled={!both && mode !== m}
355
+ // 2.0.7 — icons only (Michal): the name is the tooltip; a theme the canvas lacks says so there
356
+ title={!both && mode !== m ? `This canvas has no ${THEME_WORD[m]}` : THEME_WORD[m]}
357
+ onClick={() => setCanvasTheme(m)}
358
+ >
359
+ <ThemeIcon mode={m} />
360
+ </button>
361
+ ))}
362
+ </fieldset>
363
+ {!both ? (
364
+ // read by a screen reader only; the greyed button's tooltip says the same to everyone else
365
+ <span className="dc-theme-pill-sr" data-testid="canvas-theme-note">
366
+ {`This canvas has no ${mode === 'light' ? 'Dark' : 'Light'}`}
367
+ </span>
368
+ ) : null}
369
+ {extra}
370
+ </CanvasTopIsland>
371
+ );
372
+ }
@@ -192,6 +192,8 @@ function ChatThread({
192
192
  suggestOn,
193
193
  onSetSuggestOn,
194
194
  unavailable = false,
195
+ claudeReady = false,
196
+ aiRunning = false,
195
197
  viewer = false,
196
198
  onConnected,
197
199
  projectName = '',
@@ -311,6 +313,9 @@ function ChatThread({
311
313
  // ThreadPrimitive.Messages' component registry, which doesn't pass custom
312
314
  // props through, so this context is the only way it reaches the filter.
313
315
  const [lightboxSrc, setLightboxSrc] = useState(null);
316
+ // Universal ACP B6 — the agent this chat runs on, as the server reports it (null: Claude, or not said yet)
317
+ const [chatAgent, setChatAgent] = useState(null);
318
+ useEffect(() => conn.onAgent?.(setChatAgent), [conn]);
314
319
  // P8 c10 (03 `ai-long`): the chat's runs, so an earlier reply can draw its own result card (v2/ai/TurnResult.jsx)
315
320
  const { runs: chatRunList } = useChatRuns(conn, chatId);
316
321
  const chatRuns = useMemo(() => ({ runs: chatRunList }), [chatRunList]);
@@ -321,8 +326,9 @@ function ChatThread({
321
326
  designRel,
322
327
  transcriptView,
323
328
  chatRuns,
329
+ agent: chatAgent, // B6: the vendor badge on a reply from an agent other than Claude
324
330
  }),
325
- [designRel, transcriptView, chatRuns]
331
+ [designRel, transcriptView, chatRuns, chatAgent]
326
332
  );
327
333
  const [activeTools, setActiveTools] = useState([]);
328
334
  useEffect(() => conn.onActivity(setActiveTools), [conn]);
@@ -451,7 +457,7 @@ function ChatThread({
451
457
  <DropOverlay attach={attach} />
452
458
  {/* DDR-184 #3 — said up front when the current mode can't edit (plan / dontAsk),
453
459
  so a user typing "change X" isn't silently ignored. Above the feed. */}
454
- <SuggestOnlyBanner modes={caps.modes} onSetMode={onSetMode} />
460
+ <SuggestOnlyBanner modes={caps.modes} onSetMode={onSetMode} agent={chatAgent} />
455
461
  <ThreadPrimitive.Root className="chat-thread">
456
462
  {/* gate-b-a11y: the feed scrolls, so it is a tab stop with a name (axe scrollable-region-focusable) */}
457
463
  <ThreadPrimitive.Viewport
@@ -461,7 +467,7 @@ function ChatThread({
461
467
  aria-label="Conversation"
462
468
  >
463
469
  <ThreadPrimitive.Empty>
464
- <ChatEmpty />
470
+ <ChatEmpty claudeConnected={claudeReady} running={aiRunning} />
465
471
  </ThreadPrimitive.Empty>
466
472
  <ThreadPrimitive.Messages components={{ UserMessage, AssistantMessage }} />
467
473
  {/* Background work that outlived the turn — streamed here so it's not
@@ -541,7 +547,12 @@ function ChatThread({
541
547
  chatId={chatId}
542
548
  chatTitle={chatTitle}
543
549
  active={!hidden && !panelHidden}
544
- caps={{ modes: caps.modes, parsedOptions }}
550
+ caps={{
551
+ modes: caps.modes,
552
+ parsedOptions,
553
+ agent: chatAgent ?? caps.agent ?? null,
554
+ allowedModes: caps.allowedModes,
555
+ }}
545
556
  onSetMode={onSetMode}
546
557
  onSetConfig={onSetConfig}
547
558
  transcriptView={transcriptView}
@@ -916,6 +927,8 @@ export default function ChatPanel({
916
927
  }, [chats, openChatIds, sessionTitles, runsView]);
917
928
 
918
929
  const connected = status.available !== false;
930
+ // B6: the offer line waits while any chat runs (Claude busy is not idle)
931
+ const aiRunning = Object.values(busyChats).some(Boolean);
919
932
 
920
933
  return (
921
934
  <AiChatIsland hidden={hidden} resizing={resizing} width={width}>
@@ -1031,6 +1044,8 @@ export default function ChatPanel({
1031
1044
  suggestOn={suggestOn}
1032
1045
  onSetSuggestOn={onSetSuggestOn}
1033
1046
  unavailable={status.available === false}
1047
+ claudeReady={status.available === true}
1048
+ aiRunning={aiRunning}
1034
1049
  viewer={readOnly}
1035
1050
  onConnected={recheck}
1036
1051
  />
@@ -95,16 +95,21 @@ export function sanitizePathForDisplay(p) {
95
95
  return String(p).replace(UNSAFE_DISPLAY, '�');
96
96
  }
97
97
 
98
- export function describeOutOfProject(scope) {
98
+ export function describeOutOfProject(scope, agent = null) {
99
99
  if (!scope || scope.outOfProjectWrite !== true) return null;
100
+ // Universal ACP (Design Decision 5) — the agent that asks; Claude when the frame names none
101
+ const who =
102
+ typeof agent?.label === 'string' && agent.label.trim()
103
+ ? sanitizePathForDisplay(agent.label.trim())
104
+ : 'Claude';
100
105
  const paths = Array.isArray(scope.resolvedPaths)
101
106
  ? scope.resolvedPaths.filter(Boolean).map(sanitizePathForDisplay)
102
107
  : [];
103
108
  const lead =
104
109
  scope.reason === 'no-target'
105
- ? 'Claude asked to write a file but did not say which one.'
110
+ ? `${who} asked to write a file but did not say which one.`
106
111
  : scope.reason === 'disagreement'
107
- ? 'Claude named two different files for one write.'
112
+ ? `${who} named two different files for one write.`
108
113
  : // `in-project-denied` is INSIDE the project — saying "outside" would be
109
114
  // a plain lie, and the reason it's being asked about is different in
110
115
  // kind: not "where is this going" but "this file runs".
@@ -126,8 +131,8 @@ export function describeOutOfProject(scope) {
126
131
  : scope.reason === 'audience-unknown'
127
132
  ? 'Maude couldn’t check who can see this canvas, and AI read other files in this chat.'
128
133
  : paths.length > 1
129
- ? 'Claude wants to write files outside this project.'
130
- : 'Claude wants to write a file outside this project.';
134
+ ? `${who} wants to write files outside this project.`
135
+ : `${who} wants to write a file outside this project.`;
131
136
  return {
132
137
  lead,
133
138
  paths,
@@ -193,7 +198,7 @@ export default function PermissionPrompt({ request, onRespond, queueLength = 1 }
193
198
  const cardRef = useRef(null);
194
199
  const { toolCall } = request;
195
200
  const target = toolTarget(toolCall);
196
- const outOfProject = describeOutOfProject(request.scope);
201
+ const outOfProject = describeOutOfProject(request.scope, request.agent);
197
202
  const options = visibleOptions(request.options, !!outOfProject);
198
203
  // See the header comment in the JSX below for why an out-of-project write
199
204
  // gets a substituted headline + target instead of the adapter's own.