@1agh/maude 2.2.1 → 2.3.2
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.
- package/apps/studio/acp/agents/auth.ts +241 -0
- package/apps/studio/acp/agents/catalog.ts +308 -0
- package/apps/studio/acp/agents/chat-key.ts +64 -0
- package/apps/studio/acp/agents/conformance.ts +1853 -0
- package/apps/studio/acp/agents/consent.ts +92 -0
- package/apps/studio/acp/agents/descriptor.ts +188 -0
- package/apps/studio/acp/agents/discover.ts +491 -0
- package/apps/studio/acp/agents/e2e-model.ts +58 -0
- package/apps/studio/acp/agents/health.ts +46 -0
- package/apps/studio/acp/agents/link-scan.ts +230 -0
- package/apps/studio/acp/agents/spawn.ts +164 -0
- package/apps/studio/acp/agents/state.ts +132 -0
- package/apps/studio/acp/ask-queue.ts +13 -4
- package/apps/studio/acp/bootstrap-brief.ts +16 -3
- package/apps/studio/acp/bridge.ts +709 -99
- package/apps/studio/acp/env.ts +43 -1
- package/apps/studio/acp/index.ts +428 -43
- package/apps/studio/acp/may-scope.ts +244 -21
- package/apps/studio/acp/policy/agent-home.ts +202 -0
- package/apps/studio/acp/policy/bridge-gate.ts +68 -0
- package/apps/studio/acp/policy/codex-home.ts +228 -0
- package/apps/studio/acp/policy/enforce.ts +620 -0
- package/apps/studio/acp/policy/gate-types.ts +41 -0
- package/apps/studio/acp/policy/launch-codex.ts +351 -0
- package/apps/studio/acp/policy/launch-copilot.ts +119 -0
- package/apps/studio/acp/policy/launch-gemini.ts +120 -0
- package/apps/studio/acp/policy/launch-opencode.ts +131 -0
- package/apps/studio/acp/policy/opencode-user-config.ts +240 -0
- package/apps/studio/acp/probe.ts +78 -14
- package/apps/studio/acp/transcript.ts +14 -0
- package/apps/studio/acp/write-scope.ts +62 -2
- package/apps/studio/annotations-layer.tsx +8 -0
- package/apps/studio/bin/_capture-init.js +5 -0
- package/apps/studio/bin/screenshot.sh +7 -1
- package/apps/studio/bridge/dgn-protocol.ts +3 -2
- package/apps/studio/canvas-shell.tsx +54 -0
- package/apps/studio/client/panels/ChatPanel.jsx +19 -4
- package/apps/studio/client/panels/PermissionPrompt.jsx +11 -6
- package/apps/studio/client/panels/SyncConsentDialog.jsx +4 -1
- package/apps/studio/client/panels/acp-runtime.js +95 -7
- package/apps/studio/client/v2/ai/Advanced.jsx +4 -3
- package/apps/studio/client/v2/ai/AgentNotice.jsx +138 -0
- package/apps/studio/client/v2/ai/AgentOffer.jsx +110 -0
- package/apps/studio/client/v2/ai/AgentPicker.jsx +121 -0
- package/apps/studio/client/v2/ai/Composer.jsx +4 -0
- package/apps/studio/client/v2/ai/ConnectSheet.jsx +13 -0
- package/apps/studio/client/v2/ai/Feed.jsx +8 -0
- package/apps/studio/client/v2/ai/NeedsYouSlot.jsx +24 -1
- package/apps/studio/client/v2/ai/Suggest.jsx +5 -1
- package/apps/studio/client/v2/ai/advanced-model.js +17 -6
- package/apps/studio/client/v2/ai/agents-model.js +333 -0
- package/apps/studio/client/v2/ai/agents-store.js +223 -0
- package/apps/studio/client/v2/ai/ai.css +63 -0
- package/apps/studio/client/v2/ai/needs-you.js +1 -1
- package/apps/studio/client/v2/empty/empty-host.jsx +11 -2
- package/apps/studio/client/v2/empty/use-empty-canvas.js +22 -7
- package/apps/studio/client/v2/fold/fold-store.js +1 -0
- package/apps/studio/client/v2/preview/preview-chrome-host.jsx +1 -0
- package/apps/studio/client/v2/settings/agent-keys.js +88 -0
- package/apps/studio/client/v2/settings/agents-card.jsx +408 -0
- package/apps/studio/client/v2/settings/connections-model.js +1 -1
- package/apps/studio/client/v2/settings/connections-section.jsx +4 -0
- package/apps/studio/client/v2/settings/settings-cards.js +2 -1
- package/apps/studio/client/v2/settings/settings-model.js +1 -0
- package/apps/studio/client/v2/settings/settings.css +7 -0
- package/apps/studio/client/v2/shell/served-routes.js +1 -0
- package/apps/studio/client/v2/undo/zoom-undo.jsx +19 -2
- package/apps/studio/cloud-build.ts +5 -0
- package/apps/studio/comments/reveal.ts +13 -0
- package/apps/studio/comments-overlay.tsx +36 -0
- package/apps/studio/dist/client.bundle.js +535 -535
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/editing/annotation-count.ts +25 -0
- package/apps/studio/editing/empty-report.ts +8 -3
- package/apps/studio/editing/empty-reporter.tsx +10 -1
- package/apps/studio/generation/keys.ts +197 -11
- package/apps/studio/outbox/policy.ts +8 -2
- package/apps/studio/outbox/types.ts +5 -0
- package/apps/studio/routes/agents.ts +479 -0
- package/apps/studio/routes/index.ts +3 -0
- package/apps/studio/scripts/acp-conformance-local.ts +95 -0
- package/apps/studio/scripts/acp-e2e-local.ts +1026 -0
- package/apps/studio/server.ts +9 -0
- package/apps/studio/sync/index.ts +9 -1
- package/apps/studio/sync/writer-registry.ts +12 -0
- package/apps/studio/whats-new.json +19 -0
- package/apps/studio/ws.ts +3 -0
- package/cli/commands/codex.mjs +36 -2
- package/cli/lib/harness/codex-runtime.mjs +98 -11
- 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) =>
|
|
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,
|
|
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.
|
|
@@ -147,6 +147,7 @@ import { VoteDots } from './annotations/ui/vote-dots.tsx';
|
|
|
147
147
|
import { projectStrokes, type StrokeCache } from './annotations/ui/world.ts';
|
|
148
148
|
import { elementsToStrokes, strokesToElementMap } from './annotations/v1-adapter.ts';
|
|
149
149
|
import { reasonProps } from './client/v2/access/disabled-reason.js';
|
|
150
|
+
import { setAnnotationCount } from './editing/annotation-count.ts';
|
|
150
151
|
import { frameCaf, frameRaf } from './frame-clock.ts';
|
|
151
152
|
import { setStickerSelected } from './toolbars/shell-panels.ts';
|
|
152
153
|
/**
|
|
@@ -1270,6 +1271,13 @@ export function AnnotationsLayer() {
|
|
|
1270
1271
|
() => preview ?? (uploading.length ? [...boardStrokes, ...uploading] : boardStrokes),
|
|
1271
1272
|
[preview, uploading, boardStrokes]
|
|
1272
1273
|
);
|
|
1274
|
+
// #227 — the empty canvas ("Your canvas is ready.") must not sit over a canvas that has been drawn on:
|
|
1275
|
+
// the reporter sends this with the artboard count. The board's own count — hidden or far-zoom still counts.
|
|
1276
|
+
const annotationTotal = boardStrokes.length + uploading.length;
|
|
1277
|
+
useEffect(() => {
|
|
1278
|
+
setAnnotationCount(annotationTotal);
|
|
1279
|
+
}, [annotationTotal]);
|
|
1280
|
+
useEffect(() => () => setAnnotationCount(0), []);
|
|
1273
1281
|
const [drawing, setDrawing] = useState<Stroke | null>(null);
|
|
1274
1282
|
// S4.8 — colour, ink, thickness, Marker tip and the Highlighter's hue / nib are the tool state
|
|
1275
1283
|
// (annotations/ui/tool-state.ts): the toolbar's popovers set them, and they are the person's own,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// bin/_capture-init.js — loaded into the capture helper's own browser before the studio's code (#228).
|
|
2
|
+
// A capture opens the studio in a browser with no history, so the questions the studio asks a person once
|
|
3
|
+
// (the sync consent sheet) would be asked again and would cover the very window the capture is of.
|
|
4
|
+
// Nothing here answers a question: the studio only holds it back while this window is a capture.
|
|
5
|
+
window.__MAUDE_CAPTURE__ = true;
|
|
@@ -479,7 +479,13 @@ navigate_once() {
|
|
|
479
479
|
# screenshot" — which for the Report-a-Bug shell shot means a blank image
|
|
480
480
|
# labelled "Maude window" lands in someone's bug report.
|
|
481
481
|
# its own output can echo the URL (an opening link, a frame capability): never to stderr
|
|
482
|
-
|
|
482
|
+
# #228 — a shell capture says so to the studio (bin/_capture-init.js), which then holds back the
|
|
483
|
+
# ask-once sheets a browser with no history would raise over the window being captured.
|
|
484
|
+
local open_extra=()
|
|
485
|
+
if [ "$MODE" = "shell" ] && [ -f "$(dirname "$0")/_capture-init.js" ]; then
|
|
486
|
+
open_extra=(--init-script "$(dirname "$0")/_capture-init.js")
|
|
487
|
+
fi
|
|
488
|
+
if ! "$AB" open "$URL" ${open_extra[@]+"${open_extra[@]}"} >/dev/null 2>&1; then
|
|
483
489
|
echo "✗ navigation failed: $(shown_url "$URL")" >&2
|
|
484
490
|
return 1
|
|
485
491
|
fi
|
|
@@ -315,7 +315,8 @@ export interface CanvasToShell {
|
|
|
315
315
|
// legacy, no in-tree sender (accepted today; removal needs a characterization proof)
|
|
316
316
|
select: { selection: Selection };
|
|
317
317
|
'clear-select': Empty;
|
|
318
|
-
|
|
318
|
+
/** `annotations` (#227): how many annotations the canvas's board holds; absent from an older canvas. */
|
|
319
|
+
artboards: { count: number; annotations?: number };
|
|
319
320
|
/** S11.2 — the ONE selected artboard has nothing on it (the shell draws the hint at `rect`, iframe viewport px);
|
|
320
321
|
* `rect: null` = it is not empty now / something else is selected. `label` / `from` are untrusted text. */
|
|
321
322
|
'artboard-empty': {
|
|
@@ -1853,7 +1854,7 @@ const c2s: C2S = {
|
|
|
1853
1854
|
gate: 'active',
|
|
1854
1855
|
status: 'live',
|
|
1855
1856
|
owner: 'v2/empty (S11.2); the shell bridge keeps the Layers count',
|
|
1856
|
-
parse: p({ count: num }),
|
|
1857
|
+
parse: p({ count: num, annotations: opt(num) }),
|
|
1857
1858
|
},
|
|
1858
1859
|
// S11.2 — the shell draws the empty-artboard hint (Q5 of S11-slices): the copy lives in one table.
|
|
1859
1860
|
'artboard-empty': {
|
|
@@ -51,12 +51,14 @@ import { HUD_TOKENS_CSS } from './canvas-hud-tokens.gen.ts';
|
|
|
51
51
|
import {
|
|
52
52
|
type ArtboardRect,
|
|
53
53
|
fitRectIntoHost,
|
|
54
|
+
getLiveViewport,
|
|
54
55
|
PhotoPreviewBridge,
|
|
55
56
|
SnapGuideOverlay,
|
|
56
57
|
useArtboardsContext,
|
|
57
58
|
useDragStateContext,
|
|
58
59
|
useViewportControllerContext,
|
|
59
60
|
type ViewportControllerHandle,
|
|
61
|
+
type ViewportState,
|
|
60
62
|
} from './canvas-lib.tsx';
|
|
61
63
|
import {
|
|
62
64
|
CanvasPagesSwitch,
|
|
@@ -78,6 +80,7 @@ import {
|
|
|
78
80
|
} from './commands/edit-source-command.ts';
|
|
79
81
|
import { type AlignMode, alignLabel, equalSpacingLabel } from './commands/equal-spacing-command.ts';
|
|
80
82
|
import { buildReorderRecord, type ReorderRevertFn } from './commands/reorder-command.ts';
|
|
83
|
+
import { COMMENT_REVEAL_EVENT, type CommentRevealDetail } from './comments/reveal.ts';
|
|
81
84
|
import {
|
|
82
85
|
ContextMenuProvider,
|
|
83
86
|
type ContextRegistry,
|
|
@@ -2534,6 +2537,33 @@ export function revealElementViaCamera(
|
|
|
2534
2537
|
if (dx !== 0 || dy !== 0) controller.panBy(dx, dy);
|
|
2535
2538
|
}
|
|
2536
2539
|
|
|
2540
|
+
/** Room (screen px) a comment's thread card needs beside its pin — it opens to the pin's right or left. */
|
|
2541
|
+
export const COMMENT_REVEAL_ROOM_PX = 120;
|
|
2542
|
+
|
|
2543
|
+
/**
|
|
2544
|
+
* #229 — where the camera goes so a comment's place (`pos`, client px) is in view: null when it already is
|
|
2545
|
+
* (the pin and room for its thread card inside the view box), else the camera that puts it in the middle
|
|
2546
|
+
* of the view box. A jump from the Comments panel is a "take me there", so it centres rather than nudging.
|
|
2547
|
+
*/
|
|
2548
|
+
export function commentRevealTarget(
|
|
2549
|
+
view: { left: number; top: number; right: number; bottom: number },
|
|
2550
|
+
pos: { x: number; y: number; w: number; h: number },
|
|
2551
|
+
vp: ViewportState,
|
|
2552
|
+
room = COMMENT_REVEAL_ROOM_PX
|
|
2553
|
+
): ViewportState | null {
|
|
2554
|
+
const cx = pos.x + pos.w / 2;
|
|
2555
|
+
const cy = pos.y + pos.h / 2;
|
|
2556
|
+
const mx = Math.min(room, Math.max(0, (view.right - view.left) / 2 - 1));
|
|
2557
|
+
const my = Math.min(room, Math.max(0, (view.bottom - view.top) / 2 - 1));
|
|
2558
|
+
const inside =
|
|
2559
|
+
cx >= view.left + mx && cx <= view.right - mx && cy >= view.top + my && cy <= view.bottom - my;
|
|
2560
|
+
if (inside) return null;
|
|
2561
|
+
const dx = (view.left + view.right) / 2 - cx;
|
|
2562
|
+
const dy = (view.top + view.bottom) / 2 - cy;
|
|
2563
|
+
if (!Number.isFinite(dx) || !Number.isFinite(dy)) return null;
|
|
2564
|
+
return { x: vp.x + dx, y: vp.y + dy, zoom: vp.zoom };
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2537
2567
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
2538
2568
|
// feature-4 T7b — locked-layer enforcement. The shell owns the padlock UI +
|
|
2539
2569
|
// view.json persistence; the canvas only needs the LIVE set to refuse
|
|
@@ -2742,6 +2772,30 @@ function CanvasRouter({
|
|
|
2742
2772
|
|
|
2743
2773
|
// Shell View-menu zoom bridge (dgn:'zoom') — same controller the zoom pill uses.
|
|
2744
2774
|
const zoomController = useViewportControllerContext();
|
|
2775
|
+
// #229 — a thread opened from the Comments panel: the overlay (which knows the comment) asks for its place
|
|
2776
|
+
// to be brought into view. A comment on another page turns to that page first; the place is measured after.
|
|
2777
|
+
useEffect(() => {
|
|
2778
|
+
if (typeof document === 'undefined' || !zoomController) return;
|
|
2779
|
+
const onReveal = (e: Event) => {
|
|
2780
|
+
const d = (e as CustomEvent<CommentRevealDetail>).detail;
|
|
2781
|
+
if (typeof d?.locate !== 'function') return;
|
|
2782
|
+
const go = () => {
|
|
2783
|
+
const host = hostRef.current;
|
|
2784
|
+
const pos = d.locate();
|
|
2785
|
+
if (!host || !pos) return;
|
|
2786
|
+
const next = commentRevealTarget(
|
|
2787
|
+
revealViewBox(host.getBoundingClientRect(), canvasInsets()),
|
|
2788
|
+
pos,
|
|
2789
|
+
getLiveViewport() ?? zoomController.viewport
|
|
2790
|
+
);
|
|
2791
|
+
if (next) zoomController.animateTo(next, 220);
|
|
2792
|
+
};
|
|
2793
|
+
if (d.artboard && turnToPage(d.artboard)) frameRaf(() => frameRaf(go));
|
|
2794
|
+
else go();
|
|
2795
|
+
};
|
|
2796
|
+
document.addEventListener(COMMENT_REVEAL_EVENT, onReveal);
|
|
2797
|
+
return () => document.removeEventListener(COMMENT_REVEAL_EVENT, onReveal);
|
|
2798
|
+
}, [zoomController, hostRef]);
|
|
2745
2799
|
// Shell View-menu chrome-visibility bridge (dgn:'view-chrome') — minimap /
|
|
2746
2800
|
// zoom-controls toggles + Presentation Mode. Drives the shared chrome store
|
|
2747
2801
|
// the floating chrome (DCMiniMap, DCZoomToolbar, ToolPalette, AnnotationsLayer)
|
|
@@ -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={{
|
|
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
|
-
?
|
|
110
|
+
? `${who} asked to write a file but did not say which one.`
|
|
106
111
|
: scope.reason === 'disagreement'
|
|
107
|
-
?
|
|
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
|
-
?
|
|
130
|
-
:
|
|
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.
|
|
@@ -62,7 +62,10 @@ export default function SyncConsentDialog({ status, cloud }) {
|
|
|
62
62
|
|
|
63
63
|
// Never on a cell (a member browsing someone's hosted project is not the
|
|
64
64
|
// machine whose files sync), never for loopback, never before sync speaks.
|
|
65
|
-
|
|
65
|
+
// #228 — never in a capture helper's own browser (bin/_capture-init.js): it has no history, so the sheet
|
|
66
|
+
// would rise over every "Maude window" shot a bug report attaches. Nothing is answered for the person.
|
|
67
|
+
const capture = typeof window !== 'undefined' && window.__MAUDE_CAPTURE__ === true;
|
|
68
|
+
const due = !capture && !cloud && url && !isLoopback(url) && !answered && !readConsent(url);
|
|
66
69
|
|
|
67
70
|
// The dialog steals the screen, so say so to assistive tech the same way
|
|
68
71
|
// the other modals do — but only while actually shown.
|
|
@@ -11,6 +11,7 @@ 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
13
|
import { cleanTasks } from '../v2/ai/background-model.js';
|
|
14
|
+
import { frameAgent, refusedNotice } from '../v2/ai/agents-model.js';
|
|
14
15
|
|
|
15
16
|
const WS_PATH = '/_ws/acp';
|
|
16
17
|
|
|
@@ -271,15 +272,50 @@ export function createAcpConnection() {
|
|
|
271
272
|
// it as its own channel too so the panel can render a proper retry card
|
|
272
273
|
// instead — same "chrome, not turn content" treatment as commands/caps.
|
|
273
274
|
const errorListeners = new Set();
|
|
274
|
-
|
|
275
|
+
// { message, code?, agent? } | null — `code` is the server's (S5.6: read-only | not-queued; B6:
|
|
276
|
+
// agent-needs-consent | agent-policy-violated), `agent` the `{ id, label, vendor }` that said it (B6).
|
|
277
|
+
let lastError = null;
|
|
275
278
|
function emitError() {
|
|
276
279
|
for (const fn of errorListeners) fn(lastError);
|
|
277
280
|
}
|
|
278
|
-
function setError(message, code) {
|
|
279
|
-
|
|
281
|
+
function setError(message, code, agent) {
|
|
282
|
+
const who = frameAgent(agent);
|
|
283
|
+
lastError = message
|
|
284
|
+
? { message, ...(code ? { code } : {}), ...(who ? { agent: who } : {}) }
|
|
285
|
+
: null;
|
|
280
286
|
emitError();
|
|
281
287
|
}
|
|
282
288
|
|
|
289
|
+
// Universal ACP B6 — the agent this chat runs on (`agent` on the `ready` / `caps` frames: `{ id, label,
|
|
290
|
+
// vendor }`; null until the server says, and from an older server that never does), the agent a NEW chat
|
|
291
|
+
// asks for on `attach`, and a refused turn's one quiet line (`turn-end` `reason: 'refused'`).
|
|
292
|
+
let chatAgent = null;
|
|
293
|
+
const agentListeners = new Set();
|
|
294
|
+
function setChatAgent(v) {
|
|
295
|
+
const next = frameAgent(v);
|
|
296
|
+
if (!next || (chatAgent && chatAgent.id === next.id && chatAgent.label === next.label)) return;
|
|
297
|
+
chatAgent = next;
|
|
298
|
+
for (const fn of agentListeners) fn(chatAgent);
|
|
299
|
+
}
|
|
300
|
+
let attachAgent; // the id the `attach` frame carries (undefined = the server's default, Claude)
|
|
301
|
+
let attachConsent = false;
|
|
302
|
+
let notice = null;
|
|
303
|
+
const noticeListeners = new Set();
|
|
304
|
+
function setNotice(v) {
|
|
305
|
+
if (notice === v) return;
|
|
306
|
+
notice = v;
|
|
307
|
+
for (const fn of noticeListeners) fn(notice);
|
|
308
|
+
}
|
|
309
|
+
function attachFrame() {
|
|
310
|
+
return {
|
|
311
|
+
t: 'attach',
|
|
312
|
+
chat: attachedChatId,
|
|
313
|
+
seq: hydratedSeq,
|
|
314
|
+
...(attachAgent ? { agent: attachAgent } : {}),
|
|
315
|
+
...(attachAgent && attachConsent ? { consent: true } : {}),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
283
319
|
// S5.13 — the chat's waiting prompts (`{t:'queued'}`, S5.6) and the runs it has (`{t:'run'}`). Neither is
|
|
284
320
|
// turn content: a queued prompt did not start a turn, a run frame is bookkeeping. Chrome, like caps.
|
|
285
321
|
const queuedListeners = new Set();
|
|
@@ -327,6 +363,7 @@ export function createAcpConnection() {
|
|
|
327
363
|
status.ready = true;
|
|
328
364
|
status.available = frame.available;
|
|
329
365
|
status.reason = frame.reason;
|
|
366
|
+
if (frame.agent) setChatAgent(frame.agent);
|
|
330
367
|
emitStatus();
|
|
331
368
|
return;
|
|
332
369
|
}
|
|
@@ -340,7 +377,14 @@ export function createAcpConnection() {
|
|
|
340
377
|
// Same treatment for the capability channel — chrome, not turn content,
|
|
341
378
|
// arrives on establish + on every live mode/config-option change.
|
|
342
379
|
if (frame.t === 'caps') {
|
|
343
|
-
|
|
380
|
+
if (frame.agent) setChatAgent(frame.agent);
|
|
381
|
+
caps = {
|
|
382
|
+
modes: frame.modes ?? null,
|
|
383
|
+
configOptions: frame.configOptions ?? [],
|
|
384
|
+
// B6: the modes the server lets this agent use (the bridge refuses the rest); absent = all offered
|
|
385
|
+
...(Array.isArray(frame.allowedModes) ? { allowedModes: frame.allowedModes } : {}),
|
|
386
|
+
...(frameAgent(frame.agent) ? { agent: frameAgent(frame.agent) } : {}),
|
|
387
|
+
};
|
|
344
388
|
for (const fn of capsListeners) fn(caps);
|
|
345
389
|
return;
|
|
346
390
|
}
|
|
@@ -375,9 +419,14 @@ export function createAcpConnection() {
|
|
|
375
419
|
// A refusal with a code (S5.6: `read-only`, `not-queued`) can arrive with no turn in flight (a
|
|
376
420
|
// continuation, or a role that dropped mid-socket). It is a card, not a thrown turn.
|
|
377
421
|
if (frame.t === 'error' && frame.code && !turnHandler) {
|
|
378
|
-
setError(frame.message || 'AI could not do that.', frame.code);
|
|
422
|
+
setError(frame.message || 'AI could not do that.', frame.code, frame.agent);
|
|
379
423
|
return;
|
|
380
424
|
}
|
|
425
|
+
// B6: a refused turn says so in one quiet line (the turn itself ends below, as any turn-end does)
|
|
426
|
+
if (frame.t === 'turn-end') {
|
|
427
|
+
const said = refusedNotice(frame);
|
|
428
|
+
if (said) setNotice(said);
|
|
429
|
+
}
|
|
381
430
|
if (frame.t === 'permission-request') {
|
|
382
431
|
pendingPermissions = [
|
|
383
432
|
...pendingPermissions,
|
|
@@ -391,6 +440,8 @@ export function createAcpConnection() {
|
|
|
391
440
|
// permission request, so PermissionPrompt's "outside the project"
|
|
392
441
|
// copy can't fire on one.
|
|
393
442
|
scope: frame.scope ?? null,
|
|
443
|
+
// Universal ACP (Design Decision 5) — the agent that asks (absent: Claude)
|
|
444
|
+
agent: frame.agent ?? null,
|
|
394
445
|
},
|
|
395
446
|
];
|
|
396
447
|
emitPermissions();
|
|
@@ -460,7 +511,7 @@ export function createAcpConnection() {
|
|
|
460
511
|
// prompt.
|
|
461
512
|
if (attachedChatId) {
|
|
462
513
|
try {
|
|
463
|
-
sock.send(JSON.stringify(
|
|
514
|
+
sock.send(JSON.stringify(attachFrame()));
|
|
464
515
|
} catch {
|
|
465
516
|
/* the frame handlers below surface a dead socket */
|
|
466
517
|
}
|
|
@@ -616,6 +667,42 @@ export function createAcpConnection() {
|
|
|
616
667
|
hydratedSeq = Number.isFinite(seq) && seq > 0 ? Math.floor(seq) : 0;
|
|
617
668
|
},
|
|
618
669
|
|
|
670
|
+
/**
|
|
671
|
+
* B6 — the agent this chat asks for on `attach` (`agent: <id>`; Claude or none = the server's default, so
|
|
672
|
+
* a Claude chat's frame is unchanged). `consent` answers `agent-needs-consent` for an unrestricted agent.
|
|
673
|
+
* With the socket already open the attach is sent again at once; otherwise it rides the next open.
|
|
674
|
+
*/
|
|
675
|
+
setAgent(agentId, { consent = false } = {}) {
|
|
676
|
+
const next = agentId && agentId !== 'claude' ? agentId : undefined;
|
|
677
|
+
const changed = next !== attachAgent || (consent && !attachConsent);
|
|
678
|
+
attachAgent = next;
|
|
679
|
+
attachConsent = !!(next && consent);
|
|
680
|
+
if (!changed || !attachedChatId || ws?.readyState !== WebSocket.OPEN) return;
|
|
681
|
+
try {
|
|
682
|
+
ws.send(JSON.stringify(attachFrame()));
|
|
683
|
+
} catch {
|
|
684
|
+
/* the next open sends it */
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
/** The id the next `attach` carries (undefined = Claude, the server's default). */
|
|
688
|
+
get attachAgent() {
|
|
689
|
+
return attachAgent;
|
|
690
|
+
},
|
|
691
|
+
|
|
692
|
+
/** Subscribe to the agent this chat runs on (`{ id, label, vendor }` or null); replays the current one. */
|
|
693
|
+
onAgent(fn) {
|
|
694
|
+
agentListeners.add(fn);
|
|
695
|
+
fn(chatAgent);
|
|
696
|
+
return () => agentListeners.delete(fn);
|
|
697
|
+
},
|
|
698
|
+
|
|
699
|
+
/** Subscribe to the refused turn's quiet line (string or null); replays the current one. */
|
|
700
|
+
onNotice(fn) {
|
|
701
|
+
noticeListeners.add(fn);
|
|
702
|
+
fn(notice);
|
|
703
|
+
return () => noticeListeners.delete(fn);
|
|
704
|
+
},
|
|
705
|
+
|
|
619
706
|
/** Subscribe to `{ chat, running }` — fires once per successful attach.
|
|
620
707
|
* `running: true` means this socket re-joined a LIVE turn. */
|
|
621
708
|
onAttached(fn) {
|
|
@@ -733,7 +820,7 @@ export function createAcpConnection() {
|
|
|
733
820
|
if (!sawTurn) ended = true;
|
|
734
821
|
} else if (frame.t === 'error') {
|
|
735
822
|
failure = frame.message || 'The Claude bridge errored.';
|
|
736
|
-
setError(failure, frame.code); // Task C3: the styled retry card's source
|
|
823
|
+
setError(failure, frame.code, frame.agent); // Task C3: the styled retry card's source
|
|
737
824
|
} else {
|
|
738
825
|
sawTurn = true;
|
|
739
826
|
queue.push(frame); // update / connected / permission
|
|
@@ -760,6 +847,7 @@ export function createAcpConnection() {
|
|
|
760
847
|
// busy before these empty emits.
|
|
761
848
|
resetBackground();
|
|
762
849
|
setError(null); // a fresh turn clears any stale card from a prior failure
|
|
850
|
+
setNotice(null); // …and a refused turn's line (B6)
|
|
763
851
|
if (activeTools.size) {
|
|
764
852
|
activeTools.clear();
|
|
765
853
|
emitActivity();
|
|
@@ -175,8 +175,8 @@ function MaySwitch({ row, label, on, onChange }) {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
/** The one-line "AI is set to suggest only. The canvas won't change. [Allow changes]" above the thread. */
|
|
178
|
-
export function SuggestOnlyBanner({ modes, onSetMode }) {
|
|
179
|
-
const b = modeBanner(modes);
|
|
178
|
+
export function SuggestOnlyBanner({ modes, onSetMode, agent = null }) {
|
|
179
|
+
const b = modeBanner(modes, agent);
|
|
180
180
|
if (!b) return null;
|
|
181
181
|
return (
|
|
182
182
|
<div className="ai-modebar" role="alert" data-testid="chat-mode-banner">
|
|
@@ -261,7 +261,8 @@ export function ChatAdvanced({
|
|
|
261
261
|
|
|
262
262
|
const parsed = caps?.parsedOptions ?? { model: null, effort: null, fast: null, others: [] };
|
|
263
263
|
const modes = caps?.modes ?? null;
|
|
264
|
-
|
|
264
|
+
// B6: the chat's agent's own modes; Claude's ids keep their plain words, the server's allowed list wins
|
|
265
|
+
const modeList = modeOptions(modes, { agent: caps?.agent, allowed: caps?.allowedModes });
|
|
265
266
|
const currentMode = modeList.find((m) => m.id === modes?.currentModeId);
|
|
266
267
|
// "Change canvases" is the ask-before mode seen as a switch: the "AI changes nothing" modes are off.
|
|
267
268
|
const changesNothing = modeList.find((m) => m.id === modes?.currentModeId)?.group === 'nochange';
|