@tangle-network/sandbox-ui 2.0.3 → 2.0.4
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/dist/{AgentGraph-Dd1EBlhu.js → AgentGraph-DA5lyE06.js} +2 -2
- package/dist/{AgentGraph-BqLPrigw.d.ts → AgentGraph-K7OCgKcC.d.ts} +4 -4
- package/dist/{AgentGraphCanvas-CIGQjYtw.js → AgentGraphCanvas-BQwSxnaH.js} +49 -114
- package/dist/{WorkflowGraph-Bj6VMnOz.js → WorkflowGraph-CQyy5SBb.js} +3 -3
- package/dist/{canvas-theme-DGd0fm1H.js → canvas-theme-aqWjGbfu.js} +2 -5
- package/dist/globals.css +126 -66
- package/dist/{index-CjGeAD3E.d.ts → index-DMX2q0_h.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{latest-events-D1i5Ny3N.js → latest-events-C_G-ekNg.js} +36 -56
- package/dist/{node-ui-DWv_oLvy.js → node-ui-DJo7yr4o.js} +1 -1
- package/dist/{run-B0HDqO5h.js → run-X00BQO6i.js} +2 -2
- package/dist/run.d.ts +1 -1
- package/dist/run.js +2 -2
- package/dist/styles.css +126 -66
- package/dist/tailwind.css +44 -31
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +2 -2
- package/package.json +3 -3
|
@@ -1258,7 +1258,7 @@ function retryImport(factory, retries = 2, delayMs = 350) {
|
|
|
1258
1258
|
});
|
|
1259
1259
|
}
|
|
1260
1260
|
function lazyWorkflowGraph() {
|
|
1261
|
-
return lazy(() => retryImport(() => import("./WorkflowGraph-
|
|
1261
|
+
return lazy(() => retryImport(() => import("./WorkflowGraph-CQyy5SBb.js").then((m) => ({ default: m.WorkflowGraph }))));
|
|
1262
1262
|
}
|
|
1263
1263
|
var GraphErrorBoundary = class extends Component {
|
|
1264
1264
|
state = { hasError: false };
|
|
@@ -1318,7 +1318,7 @@ function WorkflowGraph(props) {
|
|
|
1318
1318
|
* taking the pane down.
|
|
1319
1319
|
*/
|
|
1320
1320
|
function lazyCanvas() {
|
|
1321
|
-
return lazy(() => retryImport(() => import("./AgentGraphCanvas-
|
|
1321
|
+
return lazy(() => retryImport(() => import("./AgentGraphCanvas-BQwSxnaH.js").then((m) => ({ default: m.AgentGraphCanvas }))));
|
|
1322
1322
|
}
|
|
1323
1323
|
/** The agents as a list, for when the canvas cannot load. */
|
|
1324
1324
|
function AgentListFallback({ nodes, selectedId, onSelect, className, onRetry }) {
|
|
@@ -37,7 +37,7 @@ interface AgentGraphNode {
|
|
|
37
37
|
startedAt?: number | null;
|
|
38
38
|
/** Live cards: commits it shipped. */
|
|
39
39
|
commits?: number | null;
|
|
40
|
-
/** Live cards: a settled agent's result
|
|
40
|
+
/** Live cards: a settled agent's result in its compact row, e.g. "rc2 · 14 commits". */
|
|
41
41
|
result?: string | null;
|
|
42
42
|
}
|
|
43
43
|
type AgentGraphActivity = "thinking" | "reading" | "building" | "proving" | "writing" | "waiting" | "restarting";
|
|
@@ -113,9 +113,9 @@ interface AgentGraphProps {
|
|
|
113
113
|
/** Hub layout: the header title. Default "Agent graph". */
|
|
114
114
|
title?: ReactNode;
|
|
115
115
|
/**
|
|
116
|
-
* Tree layout:
|
|
117
|
-
*
|
|
118
|
-
*
|
|
116
|
+
* Tree layout: readable task summaries, the latest three events and model/accounting details. Desktop slots stay
|
|
117
|
+
* fixed through status updates; completed results compact while failures retain their evidence. Phones preserve
|
|
118
|
+
* their initial attention order. Only the running dot breathes; commands update without routine sliding.
|
|
119
119
|
*/
|
|
120
120
|
live?: boolean;
|
|
121
121
|
/** Host tool identity, such as charts' toolGlyph(event.label). Core graphs need no charts dependency. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as MOTION_CONTROL } from "./motion-Bn7ESHrj.js";
|
|
2
|
-
import { d as quietActivity, f as syncAmbient, g as useRunNow, h as useMotionAllowed, i as fmtCost, m as useAttention, o as fmtEventTime, p as tokenMilliseconds, s as fmtTokenTotal, u as ambientStyle } from "./AgentGraph-
|
|
3
|
-
import { t as LatestEvents } from "./latest-events-
|
|
4
|
-
import { P as shortModel, m as edgeColor, o as RESTING_BORDER, r as NodeMark, s as RESTING_SHADOW, t as KIND_ACCENT } from "./node-ui-
|
|
5
|
-
import { i as loadElk, r as useColorMode, t as SELECTION_OUTLINE } from "./canvas-theme-
|
|
2
|
+
import { d as quietActivity, f as syncAmbient, g as useRunNow, h as useMotionAllowed, i as fmtCost, m as useAttention, o as fmtEventTime, p as tokenMilliseconds, s as fmtTokenTotal, u as ambientStyle } from "./AgentGraph-DA5lyE06.js";
|
|
3
|
+
import { t as LatestEvents } from "./latest-events-C_G-ekNg.js";
|
|
4
|
+
import { P as shortModel, m as edgeColor, o as RESTING_BORDER, r as NodeMark, s as RESTING_SHADOW, t as KIND_ACCENT } from "./node-ui-DJo7yr4o.js";
|
|
5
|
+
import { i as loadElk, r as useColorMode, t as SELECTION_OUTLINE } from "./canvas-theme-aqWjGbfu.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { useCallback, useEffect,
|
|
8
|
-
import {
|
|
7
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
|
+
import { Wrench } from "lucide-react";
|
|
9
9
|
import { RunStatusIcon, statusMeta } from "@tangle-network/ui/run";
|
|
10
10
|
import { Background, BaseEdge, Controls, EdgeLabelRenderer, Handle, MarkerType, MiniMap, Position, ReactFlow, useInternalNode } from "@xyflow/react";
|
|
11
11
|
import "@xyflow/react/dist/style.css";
|
|
@@ -17,7 +17,7 @@ const AGENT_CARD = {
|
|
|
17
17
|
};
|
|
18
18
|
/** A live card: room for the header, a two-line thinking line and the last three events. Fixed for the same reason. */
|
|
19
19
|
const LIVE_AGENT_CARD = {
|
|
20
|
-
width:
|
|
20
|
+
width: 296,
|
|
21
21
|
height: 164
|
|
22
22
|
};
|
|
23
23
|
const GRID_GAP = 10;
|
|
@@ -76,13 +76,14 @@ function gridSize(members, columns, card) {
|
|
|
76
76
|
const rows = Math.ceil(members / cols);
|
|
77
77
|
return {
|
|
78
78
|
width: cols * card.width + (cols - 1) * GRID_GAP + 24,
|
|
79
|
-
height:
|
|
79
|
+
height: 80 + rows * card.height + (rows - 1) * GRID_GAP + FRAME_PAD
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
/** The boxes the layouter places: each ungrouped agent, and each grid as one block. */
|
|
83
83
|
function layoutUnits(topology, columns, card) {
|
|
84
84
|
const units = [];
|
|
85
|
-
|
|
85
|
+
const ownerGroup = new Map(topology.groups.map((group) => [group.parentId, group.id]));
|
|
86
|
+
for (const id of topology.agentIds) if (!topology.groupOf.has(id) && !ownerGroup.has(id)) units.push({
|
|
86
87
|
id,
|
|
87
88
|
width: card.width,
|
|
88
89
|
height: card.height
|
|
@@ -91,7 +92,7 @@ function layoutUnits(topology, columns, card) {
|
|
|
91
92
|
id: g.id,
|
|
92
93
|
...gridSize(g.memberIds.length, columns, card)
|
|
93
94
|
});
|
|
94
|
-
const unitOf = (id) => topology.groupOf.get(id) ?? id;
|
|
95
|
+
const unitOf = (id) => topology.groupOf.get(id) ?? ownerGroup.get(id) ?? id;
|
|
95
96
|
const seen = /* @__PURE__ */ new Set();
|
|
96
97
|
const links = [];
|
|
97
98
|
for (const s of topology.spawns) {
|
|
@@ -218,11 +219,15 @@ async function layoutAgents(topology, direction, columns, card = AGENT_CARD) {
|
|
|
218
219
|
...origin,
|
|
219
220
|
...size
|
|
220
221
|
});
|
|
222
|
+
positions.set(g.parentId, {
|
|
223
|
+
x: origin.x + FRAME_PAD,
|
|
224
|
+
y: origin.y + 8
|
|
225
|
+
});
|
|
221
226
|
const cols = Math.max(1, Math.min(columns, g.memberIds.length));
|
|
222
227
|
g.memberIds.forEach((id, i) => {
|
|
223
228
|
positions.set(id, {
|
|
224
229
|
x: origin.x + FRAME_PAD + i % cols * (card.width + GRID_GAP),
|
|
225
|
-
y: origin.y +
|
|
230
|
+
y: origin.y + 80 + Math.floor(i / cols) * (card.height + GRID_GAP)
|
|
226
231
|
});
|
|
227
232
|
});
|
|
228
233
|
}
|
|
@@ -364,7 +369,7 @@ function AgentCardView({ agent, selected, direction, now: fixed, onOpen, parentL
|
|
|
364
369
|
})
|
|
365
370
|
}),
|
|
366
371
|
/* @__PURE__ */ jsxs("span", {
|
|
367
|
-
className: "min-w-0 flex-1 truncate text-
|
|
372
|
+
className: "min-w-0 flex-1 truncate text-sm font-semibold leading-[18px]",
|
|
368
373
|
children: [parentLabel && /* @__PURE__ */ jsxs("span", {
|
|
369
374
|
className: "ag-parent-label",
|
|
370
375
|
children: [parentLabel, " / "]
|
|
@@ -410,62 +415,17 @@ function AgentCard({ data }) {
|
|
|
410
415
|
handles: true
|
|
411
416
|
});
|
|
412
417
|
}
|
|
413
|
-
/** The statuses a grid caption counts: the ones a reader looks for. */
|
|
414
|
-
const CAPTION_STATUSES = [
|
|
415
|
-
"needs-you",
|
|
416
|
-
"failed",
|
|
417
|
-
"quiet",
|
|
418
|
-
"waiting",
|
|
419
|
-
"running"
|
|
420
|
-
];
|
|
421
418
|
function AgentFrameBox({ data }) {
|
|
422
|
-
const { frame,
|
|
423
|
-
const counts = CAPTION_STATUSES.map((status) => ({
|
|
424
|
-
status,
|
|
425
|
-
n: status === "quiet" ? data.quietCount ?? 0 : statuses.filter((s) => s === status).length
|
|
426
|
-
})).filter((c) => c.n > 0);
|
|
427
|
-
const words = [`${frame.group.memberIds.length} agents`, ...counts.map((c) => `${c.n} ${c.status === "quiet" ? "quiet" : agentStatus(c.status).label.toLowerCase()}`)].join(", ");
|
|
419
|
+
const { frame, direction } = data;
|
|
428
420
|
return /* @__PURE__ */ jsxs("div", {
|
|
429
421
|
className: "relative h-full w-full rounded-2xl border",
|
|
430
422
|
style: {
|
|
431
423
|
background: "color-mix(in srgb, hsl(var(--muted-foreground)) 7%, transparent)",
|
|
432
424
|
borderColor: "hsl(var(--foreground) / 0.08)"
|
|
433
425
|
},
|
|
434
|
-
children: [/* @__PURE__ */ jsx(Handles, {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
438
|
-
className: "flex h-[26px] items-center gap-2.5 px-3 text-[11px] text-muted-foreground leading-4",
|
|
439
|
-
children: [
|
|
440
|
-
/* @__PURE__ */ jsx("span", {
|
|
441
|
-
className: "sr-only",
|
|
442
|
-
children: words
|
|
443
|
-
}),
|
|
444
|
-
/* @__PURE__ */ jsxs("span", {
|
|
445
|
-
"aria-hidden": true,
|
|
446
|
-
className: "flex items-center gap-1.5 font-medium",
|
|
447
|
-
children: [
|
|
448
|
-
/* @__PURE__ */ jsx(Users, {
|
|
449
|
-
size: 12,
|
|
450
|
-
strokeWidth: 2
|
|
451
|
-
}),
|
|
452
|
-
frame.group.memberIds.length,
|
|
453
|
-
" agents"
|
|
454
|
-
]
|
|
455
|
-
}),
|
|
456
|
-
counts.map((c) => /* @__PURE__ */ jsxs("span", {
|
|
457
|
-
"aria-hidden": true,
|
|
458
|
-
className: "flex items-center gap-1 tabular-nums",
|
|
459
|
-
children: [
|
|
460
|
-
c.status !== "quiet" && /* @__PURE__ */ jsx(StatusGlyph, {
|
|
461
|
-
status: c.status,
|
|
462
|
-
size: 11
|
|
463
|
-
}),
|
|
464
|
-
c.n,
|
|
465
|
-
c.status === "quiet" ? " quiet" : ""
|
|
466
|
-
]
|
|
467
|
-
}, c.status))
|
|
468
|
-
]
|
|
426
|
+
children: [/* @__PURE__ */ jsx(Handles, { direction }), /* @__PURE__ */ jsxs("span", {
|
|
427
|
+
className: "sr-only",
|
|
428
|
+
children: [frame.group.memberIds.length, " workers"]
|
|
469
429
|
})]
|
|
470
430
|
});
|
|
471
431
|
}
|
|
@@ -574,48 +534,13 @@ function LiveAgentCardView({ agent, selected, direction = "TB", now: fixed, hand
|
|
|
574
534
|
const quiet = quietActivity(agent, now);
|
|
575
535
|
const s = agentStatus(agent.status);
|
|
576
536
|
const meta = [agent.model ? shortModel(agent.model) : void 0, agent.effort].filter(Boolean).join(" · ");
|
|
577
|
-
const
|
|
537
|
+
const events = (agent.events ?? []).slice(-3);
|
|
578
538
|
const cost = Number.isFinite(agent.costUsd) ? fmtCost(agent.costUsd) : void 0;
|
|
579
539
|
const metrics = [
|
|
580
540
|
cost,
|
|
581
541
|
!failed && agent.startedAt != null ? `${fmtEventTime(agent.startedAt, now, false)} elapsed` : void 0,
|
|
582
542
|
Number.isFinite(agent.commits) ? `${agent.commits} ${agent.commits === 1 ? "commit" : "commits"}` : void 0
|
|
583
543
|
].filter(Boolean).join(" · ") || "—";
|
|
584
|
-
const tail = useRef(null);
|
|
585
|
-
const motion = useMotionAllowed();
|
|
586
|
-
const previous = useRef(events.at(-1)?.id);
|
|
587
|
-
const pending = useRef(void 0);
|
|
588
|
-
const latest = useRef(agent.events);
|
|
589
|
-
latest.current = agent.events;
|
|
590
|
-
useEffect(() => {
|
|
591
|
-
if (pending.current !== void 0) return;
|
|
592
|
-
pending.current = setTimeout(() => {
|
|
593
|
-
setEvents((latest.current ?? []).slice(-4));
|
|
594
|
-
pending.current = void 0;
|
|
595
|
-
}, tokenMilliseconds("--duration-ambient", ref.current) * .15);
|
|
596
|
-
}, [agent.events]);
|
|
597
|
-
useEffect(() => () => clearTimeout(pending.current), []);
|
|
598
|
-
const tailAnimation = useRef(null);
|
|
599
|
-
useEffect(() => () => tailAnimation.current?.cancel(), []);
|
|
600
|
-
useLayoutEffect(() => {
|
|
601
|
-
const last = events.at(-1)?.id;
|
|
602
|
-
const old = previous.current;
|
|
603
|
-
previous.current = last;
|
|
604
|
-
const element = tail.current;
|
|
605
|
-
if (!motion) {
|
|
606
|
-
tailAnimation.current?.cancel();
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
if (!element || !old || old === last) return;
|
|
610
|
-
const queued = events.findIndex((event) => event.id === old);
|
|
611
|
-
const offset = new DOMMatrix(getComputedStyle(element).transform).m42 + 16;
|
|
612
|
-
tailAnimation.current?.cancel();
|
|
613
|
-
const frames = queued < 0 ? [{ opacity: 0 }, { opacity: 1 }] : [{ transform: `translateY(${offset}px)` }, { transform: "translateY(-16px)" }];
|
|
614
|
-
tailAnimation.current = element.animate(frames, {
|
|
615
|
-
duration: tokenMilliseconds("--duration-stream", element),
|
|
616
|
-
easing: getComputedStyle(element).getPropertyValue("--ease-standard").trim()
|
|
617
|
-
});
|
|
618
|
-
}, [events, motion]);
|
|
619
544
|
return /* @__PURE__ */ jsxs("div", {
|
|
620
545
|
className: "ag-live-slot",
|
|
621
546
|
children: [handles && /* @__PURE__ */ jsx(Handles, { direction }), /* @__PURE__ */ jsxs("div", {
|
|
@@ -722,7 +647,6 @@ function LiveAgentCardView({ agent, selected, direction = "TB", now: fixed, hand
|
|
|
722
647
|
}), events.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
723
648
|
className: "ag-live-events-clip",
|
|
724
649
|
children: /* @__PURE__ */ jsx("ol", {
|
|
725
|
-
ref: tail,
|
|
726
650
|
className: "ag-live-events",
|
|
727
651
|
"aria-label": "Latest events",
|
|
728
652
|
children: events.map((event) => /* @__PURE__ */ jsxs("li", {
|
|
@@ -867,9 +791,7 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
867
791
|
draggable: false,
|
|
868
792
|
data: {
|
|
869
793
|
frame,
|
|
870
|
-
direction
|
|
871
|
-
quietCount: frame.group.memberIds.filter((id) => byId.get(id) && quietActivity(byId.get(id), clock)).length,
|
|
872
|
-
statuses: frame.group.memberIds.map((id) => byId.get(id)?.status ?? "unknown")
|
|
794
|
+
direction
|
|
873
795
|
}
|
|
874
796
|
}));
|
|
875
797
|
const cards = [];
|
|
@@ -878,14 +800,17 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
878
800
|
const position = layout.positions.get(id);
|
|
879
801
|
if (!agent || !position) continue;
|
|
880
802
|
const selected = selectedId === id;
|
|
803
|
+
const owned = layout.frames.find((frame) => frame.group.parentId === id);
|
|
804
|
+
const width = owned ? owned.width - 24 : card.width, height = owned ? 64 : card.height;
|
|
805
|
+
const measured = rfRef.current?.getInternalNode(id)?.measured;
|
|
881
806
|
cards.push({
|
|
882
807
|
id,
|
|
883
808
|
type: live ? "liveAgent" : "agent",
|
|
884
809
|
position,
|
|
885
|
-
width
|
|
886
|
-
height
|
|
887
|
-
measured:
|
|
888
|
-
className: AGENT_NODE_CLASS
|
|
810
|
+
width,
|
|
811
|
+
height,
|
|
812
|
+
measured: measured?.width === width && measured.height === height ? measured : void 0,
|
|
813
|
+
className: `${AGENT_NODE_CLASS}${owned ? " ag-frame-owner" : ""}`,
|
|
889
814
|
draggable: false,
|
|
890
815
|
ariaRole: "button",
|
|
891
816
|
ariaLabel: agentSummary(agent),
|
|
@@ -918,13 +843,14 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
918
843
|
const out = [];
|
|
919
844
|
const seen = /* @__PURE__ */ new Set();
|
|
920
845
|
for (const s of topology.spawns) {
|
|
921
|
-
const target = topology.groupOf.get(s.to) ?? s.to;
|
|
922
|
-
|
|
846
|
+
const source = topology.groups.find((group) => group.parentId === s.from)?.id ?? s.from, target = topology.groupOf.get(s.to) ?? s.to;
|
|
847
|
+
if (source === target) continue;
|
|
848
|
+
const id = `spawn:${source}:${target}`;
|
|
923
849
|
if (seen.has(id)) continue;
|
|
924
850
|
seen.add(id);
|
|
925
851
|
out.push({
|
|
926
852
|
id,
|
|
927
|
-
source
|
|
853
|
+
source,
|
|
928
854
|
target,
|
|
929
855
|
type: "smoothstep",
|
|
930
856
|
pathOptions: { borderRadius: 14 },
|
|
@@ -1003,6 +929,11 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
1003
929
|
readerMoved.current = preserveView;
|
|
1004
930
|
const frame = requestAnimationFrame(() => {
|
|
1005
931
|
if (preserveView) revealSelection(inst, wrapperRef.current, selection.current);
|
|
932
|
+
else if (live) inst.setViewport({
|
|
933
|
+
x: FIT_PADDING,
|
|
934
|
+
y: FIT_PADDING / 2,
|
|
935
|
+
zoom: 1
|
|
936
|
+
}, { duration: animate ? tokenMilliseconds("--duration-base", wrapperRef.current) : 0 });
|
|
1006
937
|
else inst.fitView({
|
|
1007
938
|
padding: `${FIT_PADDING}px`,
|
|
1008
939
|
maxZoom: 1,
|
|
@@ -1017,7 +948,8 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
1017
948
|
layoutIdentity,
|
|
1018
949
|
canvas,
|
|
1019
950
|
minZoom,
|
|
1020
|
-
animateMotion
|
|
951
|
+
animateMotion,
|
|
952
|
+
live
|
|
1021
953
|
]);
|
|
1022
954
|
const select = useCallback((id) => {
|
|
1023
955
|
if (byId.has(id)) {
|
|
@@ -1054,9 +986,9 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
1054
986
|
if (!target) return;
|
|
1055
987
|
event.preventDefault();
|
|
1056
988
|
event.stopPropagation();
|
|
1057
|
-
const position = layout?.positions.get(target);
|
|
989
|
+
const position = layout?.positions.get(target), size = rfRef.current?.getInternalNode(target)?.measured;
|
|
1058
990
|
wrapperRef.current?.querySelector(`.react-flow__node[data-id="${CSS.escape(target)}"]`)?.focus();
|
|
1059
|
-
if (position) rfRef.current?.setCenter(position.x + card.width / 2, position.y + card.height / 2, {
|
|
991
|
+
if (position) rfRef.current?.setCenter(position.x + (size?.width ?? card.width) / 2, position.y + (size?.height ?? card.height) / 2, {
|
|
1060
992
|
zoom: rfRef.current.getZoom(),
|
|
1061
993
|
duration: animateMotion ? tokenMilliseconds("--duration-base", wrapperRef.current) : 0
|
|
1062
994
|
});
|
|
@@ -1069,6 +1001,9 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
1069
1001
|
animateMotion
|
|
1070
1002
|
]);
|
|
1071
1003
|
const activityRank = (agent) => agent.status === "needs-you" ? 0 : agent.status === "failed" ? 1 : quietActivity(agent, clock) ? 2 : agent.status === "waiting" ? 3 : agent.status === "running" ? 4 : 5;
|
|
1004
|
+
const readingOrder = useRef([]);
|
|
1005
|
+
const known = new Set(readingOrder.current);
|
|
1006
|
+
readingOrder.current = [...readingOrder.current.filter((id) => byId.has(id)), ...nodes.filter((agent) => !known.has(agent.id)).sort((a, b) => activityRank(a) - activityRank(b)).map((agent) => agent.id)];
|
|
1072
1007
|
const parentOf = new Map(edges.filter((e) => e.kind === "spawn").map((e) => [e.to, e.from]));
|
|
1073
1008
|
const depthOf = (id) => {
|
|
1074
1009
|
const seen = /* @__PURE__ */ new Set([id]);
|
|
@@ -1106,8 +1041,8 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
1106
1041
|
const index = group.matches.findIndex((agent) => agent.id === selectedId);
|
|
1107
1042
|
const next = group.matches[(index + 1) % group.matches.length];
|
|
1108
1043
|
select(next.id);
|
|
1109
|
-
const p = layout?.positions.get(next.id);
|
|
1110
|
-
if (p) rfRef.current?.setCenter(p.x + card.width / 2, p.y + card.height / 2, {
|
|
1044
|
+
const p = layout?.positions.get(next.id), size = rfRef.current?.getInternalNode(next.id)?.measured;
|
|
1045
|
+
if (p) rfRef.current?.setCenter(p.x + (size?.width ?? card.width) / 2, p.y + (size?.height ?? card.height) / 2, {
|
|
1111
1046
|
zoom: 1,
|
|
1112
1047
|
duration: animateMotion ? tokenMilliseconds("--duration-base", wrapperRef.current) : 0
|
|
1113
1048
|
});
|
|
@@ -1154,7 +1089,7 @@ function AgentGraphCanvas({ nodes, edges, selectedId, onSelect, direction = "TB"
|
|
|
1154
1089
|
narrow ? /* @__PURE__ */ jsx("ul", {
|
|
1155
1090
|
className: "ag-graph-viewport ag-phone-list overflow-auto",
|
|
1156
1091
|
"aria-label": "Agents by attention",
|
|
1157
|
-
children:
|
|
1092
|
+
children: readingOrder.current.map((id) => byId.get(id)).map((agent) => /* @__PURE__ */ jsx("li", {
|
|
1158
1093
|
style: { ["--depth"]: depthOf(agent.id) },
|
|
1159
1094
|
children: /* @__PURE__ */ jsx("div", {
|
|
1160
1095
|
role: "button",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as fmtDuration, c as fmtTokens, i as fmtCost, r as clampPreview } from "./AgentGraph-
|
|
2
|
-
import { A as worstSeverity, E as isStructuralKind, O as triggerNodeIndex, P as shortModel, T as buildWorkflowGraph, _ as problemBorder, a as ProblemMessages, b as statusBorder, c as STATUS_COLOR, f as StatusFooter, g as kindAccent, h as emptySlotLabel, i as ProblemMarker, k as wfEdgeId, l as STATUS_LABEL, m as edgeColor, o as RESTING_BORDER, p as StatusPill, r as NodeMark, s as RESTING_SHADOW, v as problemSurface, x as COMPACT_NODE_SIZE, y as problemTitle } from "./node-ui-
|
|
1
|
+
import { a as fmtDuration, c as fmtTokens, i as fmtCost, r as clampPreview } from "./AgentGraph-DA5lyE06.js";
|
|
2
|
+
import { A as worstSeverity, E as isStructuralKind, O as triggerNodeIndex, P as shortModel, T as buildWorkflowGraph, _ as problemBorder, a as ProblemMessages, b as statusBorder, c as STATUS_COLOR, f as StatusFooter, g as kindAccent, h as emptySlotLabel, i as ProblemMarker, k as wfEdgeId, l as STATUS_LABEL, m as edgeColor, o as RESTING_BORDER, p as StatusPill, r as NodeMark, s as RESTING_SHADOW, v as problemSurface, x as COMPACT_NODE_SIZE, y as problemTitle } from "./node-ui-DJo7yr4o.js";
|
|
3
3
|
import { n as classifyOutput, t as NodeOutputBody } from "./node-output-DlySTwxr.js";
|
|
4
|
-
import { i as loadElk, n as motionAllowed, r as useColorMode, t as SELECTION_OUTLINE } from "./canvas-theme-
|
|
4
|
+
import { i as loadElk, n as motionAllowed, r as useColorMode, t as SELECTION_OUTLINE } from "./canvas-theme-aqWjGbfu.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { Expand, Maximize2, Minimize2, Plus, Shrink, X } from "lucide-react";
|
|
@@ -47,12 +47,9 @@ function useColorMode(wrapperRef, hasGraph) {
|
|
|
47
47
|
}, [wrapperRef, hasGraph]);
|
|
48
48
|
return mode;
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
* because both of those are already spoken for — the border carries tone and
|
|
52
|
-
* run status, the shadow carries the running/waiting glow — and an outline
|
|
53
|
-
* composes with both without disturbing the laid-out box. */
|
|
50
|
+
/** Selection preserves the status border and stays quieter than failure or a response request. */
|
|
54
51
|
const SELECTION_OUTLINE = {
|
|
55
|
-
outline: "
|
|
52
|
+
outline: "1px solid hsl(var(--foreground) / .45)",
|
|
56
53
|
outlineOffset: 2
|
|
57
54
|
};
|
|
58
55
|
export { loadElk as i, motionAllowed as n, useColorMode as r, SELECTION_OUTLINE as t };
|