asta-ui 0.9.4 → 0.9.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.
- package/css/asta.css +2 -2
- package/css/asta.js +1461 -1
- package/css/components.css +1900 -138
- package/css/runtime/agent.css +136 -0
- package/css/runtime/agent.js +173 -0
- package/css/runtime/assist.css +79 -0
- package/css/runtime/assist.js +799 -0
- package/css/runtime/controls.css +48 -0
- package/css/runtime/controls.js +482 -0
- package/css/src/agent.css +484 -0
- package/css/src/assist.css +598 -0
- package/css/src/controls.css +424 -0
- package/css/tokens.css +16 -0
- package/dist/agent-plan.d.ts +2 -0
- package/dist/agent-plan.js +11 -0
- package/dist/agent-team.d.ts +2 -0
- package/dist/agent-team.js +7 -0
- package/dist/api-keys.d.ts +2 -0
- package/dist/api-keys.js +10 -0
- package/dist/autonomy-dial.d.ts +2 -0
- package/dist/autonomy-dial.js +7 -0
- package/dist/base/agent-plan.d.ts +2 -0
- package/dist/base/agent-plan.js +11 -0
- package/dist/base/agent-team.d.ts +2 -0
- package/dist/base/agent-team.js +7 -0
- package/dist/base/api-keys.d.ts +2 -0
- package/dist/base/api-keys.js +10 -0
- package/dist/base/autonomy-dial.d.ts +2 -0
- package/dist/base/autonomy-dial.js +7 -0
- package/dist/base/change-ledger.d.ts +2 -0
- package/dist/base/change-ledger.js +7 -0
- package/dist/base/citations.d.ts +2 -0
- package/dist/base/citations.js +9 -0
- package/dist/base/context-meter.d.ts +2 -0
- package/dist/base/context-meter.js +14 -0
- package/dist/base/fallback-chain.d.ts +2 -0
- package/dist/base/fallback-chain.js +7 -0
- package/dist/base/model-picker.d.ts +2 -0
- package/dist/base/model-picker.js +9 -0
- package/dist/base/prompt-composer.d.ts +2 -0
- package/dist/base/prompt-composer.js +9 -0
- package/dist/base/scrub-input.d.ts +2 -0
- package/dist/base/scrub-input.js +13 -0
- package/dist/base/thinking.d.ts +2 -0
- package/dist/base/thinking.js +11 -0
- package/dist/base/tool-approval.d.ts +2 -0
- package/dist/base/tool-approval.js +9 -0
- package/dist/base/trace-waterfall.d.ts +2 -0
- package/dist/base/trace-waterfall.js +9 -0
- package/dist/base.js +202 -134
- package/dist/change-ledger.d.ts +2 -0
- package/dist/change-ledger.js +7 -0
- package/dist/chunk-24O5V2PQ.js +253 -0
- package/dist/chunk-44DNL43W.js +490 -0
- package/dist/chunk-45IXJ7W7.js +245 -0
- package/dist/chunk-ANL6VX4X.js +326 -0
- package/dist/chunk-DNROUJ62.js +432 -0
- package/dist/chunk-F4CWSZXK.js +226 -0
- package/dist/chunk-GBOJUMMY.js +163 -0
- package/dist/chunk-H4NFBYKY.js +275 -0
- package/dist/chunk-KFPGQ5RT.js +321 -0
- package/dist/chunk-OIIMYSVT.js +342 -0
- package/dist/chunk-TL32C2SQ.js +221 -0
- package/dist/chunk-UBTYMAKF.js +240 -0
- package/dist/chunk-W6YVDJHX.js +235 -0
- package/dist/chunk-XYQI4ZYV.js +314 -0
- package/dist/citations.d.ts +2 -0
- package/dist/citations.js +9 -0
- package/dist/context-meter.d.ts +2 -0
- package/dist/context-meter.js +14 -0
- package/dist/fallback-chain.d.ts +2 -0
- package/dist/fallback-chain.js +7 -0
- package/dist/index.js +202 -134
- package/dist/model-picker.d.ts +2 -0
- package/dist/model-picker.js +9 -0
- package/dist/prompt-composer.d.ts +2 -0
- package/dist/prompt-composer.js +9 -0
- package/dist/scrub-input.d.ts +2 -0
- package/dist/scrub-input.js +13 -0
- package/dist/thinking.d.ts +2 -0
- package/dist/thinking.js +11 -0
- package/dist/tool-approval.d.ts +2 -0
- package/dist/tool-approval.js +9 -0
- package/dist/trace-waterfall.d.ts +2 -0
- package/dist/trace-waterfall.js +9 -0
- package/dist/types/components/kit/agent-plan.d.ts +34 -0
- package/dist/types/components/kit/api-keys.d.ts +62 -0
- package/dist/types/components/kit/citations.d.ts +34 -0
- package/dist/types/components/kit/context-meter.d.ts +38 -0
- package/dist/types/components/kit/model-picker.d.ts +46 -0
- package/dist/types/components/kit/prompt-composer.d.ts +61 -0
- package/dist/types/components/kit/scrub-input.d.ts +44 -0
- package/dist/types/components/kit/thinking.d.ts +28 -0
- package/dist/types/components/kit/tool-approval.d.ts +43 -0
- package/dist/types/components/kit/trace-waterfall.d.ts +44 -0
- package/dist/types/components/lab/blocks/AgentTeam.d.ts +2 -0
- package/dist/types/components/lab/blocks/AutonomyDial.d.ts +2 -0
- package/dist/types/components/lab/blocks/ChangeLedger.d.ts +2 -0
- package/dist/types/components/lab/blocks/FallbackChain.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/agent-plan.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/agent-team.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/api-keys.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/autonomy-dial.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/agent-plan.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/agent-team.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/api-keys.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/autonomy-dial.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/change-ledger.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/citations.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/context-meter.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/fallback-chain.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/model-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/prompt-composer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/scrub-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/thinking.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/tool-approval.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base/trace-waterfall.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/base.d.ts +25 -1
- package/dist/types/packages/asta-ui/src/change-ledger.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/citations.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/context-meter.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/fallback-chain.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/index.d.ts +25 -1
- package/dist/types/packages/asta-ui/src/model-picker.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/prompt-composer.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/scrub-input.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/thinking.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/tool-approval.d.ts +2 -0
- package/dist/types/packages/asta-ui/src/trace-waterfall.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/kit/trace-waterfall.tsx
|
|
4
|
+
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var cx = (...c) => c.filter(Boolean).join(" ");
|
|
7
|
+
var KEYFRAMES = `@keyframes asta-tw-grow { from { transform: translateX(var(--x)) scaleX(0) } }
|
|
8
|
+
@keyframes asta-tw-run { 50% { opacity: .45 } }
|
|
9
|
+
@keyframes asta-tw-in { from { opacity: 0; transform: translateY(6px) } }
|
|
10
|
+
@media (prefers-reduced-motion: reduce) { .asta-tw, .asta-tw * { animation: none !important; transition-duration: 0s !important } }`;
|
|
11
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
12
|
+
var KINDS = {
|
|
13
|
+
agent: { label: "Agent", fill: "bg-[color-mix(in_srgb,var(--ink)_22%,var(--paper))]", path: "M8 2.5v3M8 10.5v3M3.5 8h-1M13.5 8h-1M5 5l-.8-.8M11.8 11.8 11 11M11 5l.8-.8M4.2 11.8 5 11M8 5.5a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Z" },
|
|
14
|
+
llm: { label: "LLM call", fill: "bg-brand", path: "M8 2c.4 2.9 1.6 4.1 4.5 4.5-2.9.4-4.1 1.6-4.5 4.5-.4-2.9-1.6-4.1-4.5-4.5C6.4 6.1 7.6 4.9 8 2Z" },
|
|
15
|
+
tool: { label: "Tool call", fill: "bg-ink", path: "M10.2 2.8a3 3 0 0 0-3.6 3.9L2.8 10.5a1.3 1.3 0 0 0 1.8 1.8l3.8-3.8a3 3 0 0 0 3.9-3.6l-1.8 1.8-1.6-.4-.4-1.6Z" },
|
|
16
|
+
retrieval: { label: "Retrieval", fill: "bg-[color-mix(in_srgb,var(--brand)_42%,var(--paper))]", path: "M3 4.5c0-1.1 2.2-2 5-2s5 .9 5 2-2.2 2-5 2-5-.9-5-2ZM3 4.5v7c0 1.1 2.2 2 5 2s5-.9 5-2v-7M3 8c0 1.1 2.2 2 5 2s5-.9 5-2" }
|
|
17
|
+
};
|
|
18
|
+
var STEPS = [10, 20, 50, 100, 200, 250, 500, 1e3, 2e3, 2500, 5e3, 1e4, 2e4, 3e4, 6e4];
|
|
19
|
+
var GRID = "grid grid-cols-[minmax(200px,1.3fr)_minmax(240px,2fr)_56px_68px_76px] sm:grid-cols-[minmax(232px,1.3fr)_minmax(240px,2fr)_56px_68px_76px] items-center gap-x-3";
|
|
20
|
+
var ms = (n) => n < 1e3 ? `${Math.round(n)} ms` : `${(n / 1e3).toFixed(n < 1e4 ? 2 : 1)} s`;
|
|
21
|
+
var tick = (n) => n === 0 ? "0" : n < 1e3 ? `${n}ms` : `${+(n / 1e3).toFixed(1)}s`;
|
|
22
|
+
var usd = (n) => `$${n < 0.01 ? n.toFixed(4) : n.toFixed(3)}`;
|
|
23
|
+
var num = (n) => n.toLocaleString("en-US");
|
|
24
|
+
function Glyph({ d, className }) {
|
|
25
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: cx("h-3.5 w-3.5 shrink-0", className), fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d }) });
|
|
26
|
+
}
|
|
27
|
+
var WARN = "M8 2.5 14 13H2zM8 6.5v3M8 11.2h.01";
|
|
28
|
+
function Stat({ label, children }) {
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("dt", { className: "text-[11.5px] text-mute", children: label }),
|
|
31
|
+
/* @__PURE__ */ jsx("dd", { className: "mt-0.5 truncate text-[13px] tabular-nums text-ink", children })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function TraceWaterfall({ spans, title = "Agent run", live = false, startedAt, selected, defaultSelected = null, onSelect, loading, className }) {
|
|
35
|
+
const [innerSel, setInnerSel] = useState(defaultSelected);
|
|
36
|
+
const sel = selected !== void 0 ? selected : innerSel;
|
|
37
|
+
const [folded, setFolded] = useState(() => /* @__PURE__ */ new Set());
|
|
38
|
+
const [focusId, setFocusId] = useState(null);
|
|
39
|
+
const [now, setNow] = useState(0);
|
|
40
|
+
const [onScreen, setOnScreen] = useState(true);
|
|
41
|
+
const root = useRef(null);
|
|
42
|
+
const scroller = useRef(null);
|
|
43
|
+
const pinned = useRef(true);
|
|
44
|
+
const uid = useId();
|
|
45
|
+
const running = live && spans.some((s) => s.duration === void 0);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const el = root.current;
|
|
48
|
+
if (!el) return;
|
|
49
|
+
const io = new IntersectionObserver(([e]) => setOnScreen(e.isIntersecting));
|
|
50
|
+
io.observe(el);
|
|
51
|
+
return () => io.disconnect();
|
|
52
|
+
}, []);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!running || !onScreen || startedAt === void 0) return;
|
|
55
|
+
let id;
|
|
56
|
+
const start = () => {
|
|
57
|
+
clearInterval(id);
|
|
58
|
+
if (!document.hidden) id = setInterval(() => setNow(Date.now() - startedAt), 200);
|
|
59
|
+
};
|
|
60
|
+
start();
|
|
61
|
+
document.addEventListener("visibilitychange", start);
|
|
62
|
+
return () => {
|
|
63
|
+
clearInterval(id);
|
|
64
|
+
document.removeEventListener("visibilitychange", start);
|
|
65
|
+
};
|
|
66
|
+
}, [running, onScreen, startedAt]);
|
|
67
|
+
const kids = useMemo(() => {
|
|
68
|
+
const m = /* @__PURE__ */ new Map();
|
|
69
|
+
const ids = new Set(spans.map((s) => s.id));
|
|
70
|
+
for (const s of spans) {
|
|
71
|
+
const p = s.parentId && ids.has(s.parentId) ? s.parentId : "";
|
|
72
|
+
m.set(p, [...m.get(p) ?? [], s]);
|
|
73
|
+
}
|
|
74
|
+
m.forEach((list) => list.sort((a, b) => a.start - b.start));
|
|
75
|
+
return m;
|
|
76
|
+
}, [spans]);
|
|
77
|
+
const rows = useMemo(() => {
|
|
78
|
+
const out = [];
|
|
79
|
+
const walk = (pid, depth) => {
|
|
80
|
+
for (const s of kids.get(pid) ?? []) {
|
|
81
|
+
const hasKids = (kids.get(s.id)?.length ?? 0) > 0;
|
|
82
|
+
out.push({ s, depth, parent: pid || null, hasKids });
|
|
83
|
+
if (hasKids && !folded.has(s.id)) walk(s.id, depth + 1);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
walk("", 0);
|
|
87
|
+
return out;
|
|
88
|
+
}, [kids, folded]);
|
|
89
|
+
const end = (s) => s.start + (s.duration ?? Math.max(now - s.start, 0));
|
|
90
|
+
const total = Math.max(1, ...spans.map(end));
|
|
91
|
+
const step = STEPS.find((st) => total / st <= 5) ?? 6e4;
|
|
92
|
+
const axis = Math.ceil(total / step) * step;
|
|
93
|
+
const ticks = Array.from({ length: Math.round(axis / step) + 1 }, (_, i) => i * step);
|
|
94
|
+
const tokens = spans.reduce((a, s) => a + (s.tokensIn ?? 0) + (s.tokensOut ?? 0), 0);
|
|
95
|
+
const cost = spans.reduce((a, s) => a + (s.cost ?? 0), 0);
|
|
96
|
+
const errors = spans.filter((s) => s.status === "error").length;
|
|
97
|
+
const current = spans.find((s) => s.id === sel) ?? null;
|
|
98
|
+
useLayoutEffect(() => {
|
|
99
|
+
const el = scroller.current;
|
|
100
|
+
if (live && el && pinned.current) el.scrollTop = el.scrollHeight;
|
|
101
|
+
}, [live, spans.length]);
|
|
102
|
+
const choose = (id) => {
|
|
103
|
+
if (selected === void 0) setInnerSel(id);
|
|
104
|
+
onSelect?.(id);
|
|
105
|
+
};
|
|
106
|
+
const fold = (id, to) => setFolded((f) => {
|
|
107
|
+
const n = new Set(f);
|
|
108
|
+
if (to ?? !n.has(id)) n.add(id);
|
|
109
|
+
else n.delete(id);
|
|
110
|
+
return n;
|
|
111
|
+
});
|
|
112
|
+
const focusRow = (id) => {
|
|
113
|
+
if (!id) return;
|
|
114
|
+
setFocusId(id);
|
|
115
|
+
root.current?.querySelector(`[data-span="${CSS.escape(id)}"]`)?.focus();
|
|
116
|
+
};
|
|
117
|
+
const onKey = (e, k) => {
|
|
118
|
+
const r = rows[k];
|
|
119
|
+
if (e.key === "ArrowDown") focusRow(rows[k + 1]?.s.id);
|
|
120
|
+
else if (e.key === "ArrowUp") focusRow(rows[k - 1]?.s.id);
|
|
121
|
+
else if (e.key === "Home") focusRow(rows[0]?.s.id);
|
|
122
|
+
else if (e.key === "End") focusRow(rows[rows.length - 1]?.s.id);
|
|
123
|
+
else if (e.key === "ArrowRight") {
|
|
124
|
+
if (r.hasKids && folded.has(r.s.id)) fold(r.s.id, false);
|
|
125
|
+
else if (r.hasKids) focusRow(rows[k + 1]?.s.id);
|
|
126
|
+
} else if (e.key === "ArrowLeft") {
|
|
127
|
+
if (r.hasKids && !folded.has(r.s.id)) fold(r.s.id, true);
|
|
128
|
+
else focusRow(r.parent ?? void 0);
|
|
129
|
+
} else if (e.key === "Enter" || e.key === " ") choose(sel === r.s.id ? null : r.s.id);
|
|
130
|
+
else if (e.key === "Escape" && sel) choose(null);
|
|
131
|
+
else return;
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
};
|
|
134
|
+
const tabbable = focusId && rows.some((r) => r.s.id === focusId) ? focusId : rows[0]?.s.id;
|
|
135
|
+
const head = "sticky top-0 z-20 bg-paper font-mono text-[10.5px] uppercase tracking-wider text-mute";
|
|
136
|
+
return /* @__PURE__ */ jsxs("div", { ref: root, className: cx("asta-tw flex w-full flex-col overflow-hidden rounded-[14px] bg-paper shadow-[0_0_0_1px_color-mix(in_srgb,var(--ink)_9%,transparent),0_1px_2px_rgb(0_0_0/0.04)]", className), children: [
|
|
137
|
+
/* @__PURE__ */ jsx("style", { href: "asta-trace-waterfall", precedence: "asta", children: KEYFRAMES }),
|
|
138
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-wrap items-center gap-x-4 gap-y-2 px-4 pt-4 pb-3 sm:px-5", children: [
|
|
139
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
140
|
+
/* @__PURE__ */ jsx("h3", { className: "truncate text-[14px] font-medium tracking-[-0.01em] text-ink", children: title }),
|
|
141
|
+
running && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 rounded-[5px] bg-[color-mix(in_srgb,var(--brand)_10%,transparent)] px-1.5 py-0.5 text-[11.5px] font-medium text-brand", children: [
|
|
142
|
+
/* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-brand", style: { animation: `asta-tw-run 1.2s ${EASE} infinite ${onScreen ? "running" : "paused"}` } }),
|
|
143
|
+
"Live"
|
|
144
|
+
] })
|
|
145
|
+
] }),
|
|
146
|
+
/* @__PURE__ */ jsxs("dl", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-[12.5px] tabular-nums text-mute", children: [
|
|
147
|
+
[
|
|
148
|
+
["Duration", ms(total)],
|
|
149
|
+
["Tokens", num(tokens)],
|
|
150
|
+
["Cost", usd(cost)]
|
|
151
|
+
].map(([k, v]) => /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5", children: [
|
|
152
|
+
/* @__PURE__ */ jsx("dt", { children: k }),
|
|
153
|
+
/* @__PURE__ */ jsx("dd", { className: "font-medium text-ink", children: v })
|
|
154
|
+
] }, k)),
|
|
155
|
+
errors > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 font-medium text-ink", children: [
|
|
156
|
+
/* @__PURE__ */ jsx(Glyph, { d: WARN }),
|
|
157
|
+
/* @__PURE__ */ jsx("dt", { className: "sr-only", children: "Errors" }),
|
|
158
|
+
/* @__PURE__ */ jsxs("dd", { children: [
|
|
159
|
+
errors,
|
|
160
|
+
" ",
|
|
161
|
+
errors === 1 ? "error" : "errors"
|
|
162
|
+
] })
|
|
163
|
+
] })
|
|
164
|
+
] }),
|
|
165
|
+
/* @__PURE__ */ jsx("ul", { className: "flex flex-wrap items-center gap-3 text-[11.5px] text-mute sm:ml-auto", "aria-label": "Legend", children: ["llm", "tool", "retrieval"].map((k) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-1.5", children: [
|
|
166
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cx("h-2 w-2 rounded-[2px]", KINDS[k].fill) }),
|
|
167
|
+
KINDS[k].label
|
|
168
|
+
] }, k)) })
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ jsx(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
ref: scroller,
|
|
174
|
+
onScroll: (e) => {
|
|
175
|
+
const el = e.currentTarget;
|
|
176
|
+
pinned.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
|
|
177
|
+
},
|
|
178
|
+
className: "max-h-[440px] overflow-auto overscroll-contain [scrollbar-width:thin]",
|
|
179
|
+
children: /* @__PURE__ */ jsxs("div", { role: "treegrid", "aria-label": `${title} spans`, "aria-busy": loading || running || void 0, "aria-rowcount": rows.length + 1, className: "min-w-[700px] pb-2 sm:min-w-[740px]", children: [
|
|
180
|
+
/* @__PURE__ */ jsxs("div", { role: "row", className: cx(GRID, head, "h-8"), children: [
|
|
181
|
+
/* @__PURE__ */ jsx("span", { role: "columnheader", className: "left-0 z-10 bg-paper pl-4 sm:sticky sm:pl-5", children: "Span" }),
|
|
182
|
+
/* @__PURE__ */ jsxs("span", { role: "columnheader", className: "relative h-full", children: [
|
|
183
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
184
|
+
"Timeline, 0 to ",
|
|
185
|
+
ms(axis)
|
|
186
|
+
] }),
|
|
187
|
+
ticks.map((t) => /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cx("absolute top-1/2 -translate-y-1/2 normal-case tracking-normal", t === 0 ? "" : t === axis ? "-translate-x-full" : "-translate-x-1/2"), style: { left: `${t / axis * 100}%` }, children: tick(t) }, t))
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ jsx("span", { role: "columnheader", className: "text-right", children: "Tokens" }),
|
|
190
|
+
/* @__PURE__ */ jsx("span", { role: "columnheader", className: "text-right", children: "Cost" }),
|
|
191
|
+
/* @__PURE__ */ jsx("span", { role: "columnheader", className: "pr-4 text-right sm:pr-5", children: "Latency" })
|
|
192
|
+
] }),
|
|
193
|
+
loading ? Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs("div", { role: "row", className: cx(GRID, "h-10"), children: [
|
|
194
|
+
/* @__PURE__ */ jsx("span", { className: "pl-4 sm:pl-5", children: /* @__PURE__ */ jsx("span", { className: "block h-2.5 rounded-full bg-paper-2", style: { width: `${70 - i * 6}%`, marginLeft: i ? 16 : 0, animation: `asta-tw-run 1.4s ${EASE} ${i * 100}ms infinite` } }) }),
|
|
195
|
+
/* @__PURE__ */ jsx("span", { className: "relative h-2", children: /* @__PURE__ */ jsx("span", { className: "absolute inset-y-0 rounded-[2px] bg-paper-2", style: { left: `${i * 12}%`, width: `${30 - i * 3}%`, animation: `asta-tw-run 1.4s ${EASE} ${i * 100}ms infinite` } }) }),
|
|
196
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
197
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
198
|
+
/* @__PURE__ */ jsx("span", {})
|
|
199
|
+
] }, i)) : rows.map((r, k) => {
|
|
200
|
+
const s = r.s;
|
|
201
|
+
const kind = KINDS[s.kind];
|
|
202
|
+
const run = s.duration === void 0;
|
|
203
|
+
const dur = run ? Math.max(now - s.start, 0) : s.duration;
|
|
204
|
+
const x = s.start / axis;
|
|
205
|
+
const w = Math.max(dur / axis, 4e-3);
|
|
206
|
+
const on = sel === s.id;
|
|
207
|
+
const err = s.status === "error";
|
|
208
|
+
const bg = on ? "bg-[color-mix(in_srgb,var(--brand)_7%,var(--paper))]" : "bg-paper group-hover/row:bg-paper-2";
|
|
209
|
+
return /* @__PURE__ */ jsxs(
|
|
210
|
+
"div",
|
|
211
|
+
{
|
|
212
|
+
role: "row",
|
|
213
|
+
"data-span": s.id,
|
|
214
|
+
"aria-level": r.depth + 1,
|
|
215
|
+
"aria-expanded": r.hasKids ? !folded.has(s.id) : void 0,
|
|
216
|
+
"aria-selected": on,
|
|
217
|
+
tabIndex: tabbable === s.id ? 0 : -1,
|
|
218
|
+
onFocus: () => setFocusId(s.id),
|
|
219
|
+
onClick: () => choose(on ? null : s.id),
|
|
220
|
+
onKeyDown: (e) => onKey(e, k),
|
|
221
|
+
className: cx(GRID, "group/row h-10 cursor-pointer text-[13px] outline-none transition-colors duration-150 focus-visible:shadow-[inset_0_0_0_2px_color-mix(in_srgb,var(--brand)_55%,transparent)]", bg),
|
|
222
|
+
style: { animation: `asta-tw-in .35s ${EASE} both` },
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsxs("span", { role: "gridcell", className: cx("left-0 z-10 flex h-full min-w-0 sm:sticky items-center gap-1.5 pr-3 transition-colors duration-150", bg), style: { paddingLeft: 16 + r.depth * 18 }, children: [
|
|
225
|
+
r.hasKids ? /* @__PURE__ */ jsx(
|
|
226
|
+
"button",
|
|
227
|
+
{
|
|
228
|
+
type: "button",
|
|
229
|
+
tabIndex: -1,
|
|
230
|
+
"aria-label": folded.has(s.id) ? `Expand ${s.name}` : `Collapse ${s.name}`,
|
|
231
|
+
onClick: (e) => {
|
|
232
|
+
e.stopPropagation();
|
|
233
|
+
fold(s.id);
|
|
234
|
+
},
|
|
235
|
+
className: "-ml-1 grid h-5 w-5 shrink-0 place-items-center rounded text-mute hover:bg-[color-mix(in_srgb,var(--ink)_8%,transparent)] hover:text-ink",
|
|
236
|
+
children: /* @__PURE__ */ jsx(Glyph, { d: "m6 4 4 4-4 4", className: cx("h-3 w-3 transition-transform duration-200 ease-[cubic-bezier(.16,1,.3,1)]", !folded.has(s.id) && "rotate-90") })
|
|
237
|
+
}
|
|
238
|
+
) : /* @__PURE__ */ jsx("span", { className: "w-4 shrink-0" }),
|
|
239
|
+
/* @__PURE__ */ jsx("span", { className: cx("grid h-5 w-5 shrink-0 place-items-center rounded-[5px]", s.kind === "llm" ? "bg-[color-mix(in_srgb,var(--brand)_12%,transparent)] text-brand" : "bg-paper-2 text-ink-2"), title: kind.label, children: /* @__PURE__ */ jsx(Glyph, { d: kind.path, className: "h-3 w-3" }) }),
|
|
240
|
+
/* @__PURE__ */ jsx("span", { className: cx("min-w-0 truncate", s.kind === "agent" ? "font-medium text-ink" : "text-ink-2"), children: s.name }),
|
|
241
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
242
|
+
", ",
|
|
243
|
+
kind.label
|
|
244
|
+
] }),
|
|
245
|
+
err && /* @__PURE__ */ jsxs("span", { title: "Error", className: "grid h-5 w-5 shrink-0 place-items-center rounded-[5px] bg-ink text-paper", children: [
|
|
246
|
+
/* @__PURE__ */ jsx(Glyph, { d: WARN, className: "h-3 w-3" }),
|
|
247
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: ", Error" })
|
|
248
|
+
] })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ jsxs("span", { role: "gridcell", className: "relative h-full", children: [
|
|
251
|
+
ticks.slice(1, -1).map((t) => /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "absolute inset-y-0 w-px bg-[color-mix(in_srgb,var(--ink)_6%,transparent)]", style: { left: `${t / axis * 100}%` } }, t)),
|
|
252
|
+
/* @__PURE__ */ jsx("span", { className: "absolute inset-x-0 top-1/2 -mt-[5px] h-2.5", children: /* @__PURE__ */ jsx(
|
|
253
|
+
"span",
|
|
254
|
+
{
|
|
255
|
+
className: cx("absolute inset-0 origin-left rounded-[2px]", kind.fill, err && "opacity-60"),
|
|
256
|
+
style: {
|
|
257
|
+
"--x": `${x * 100}%`,
|
|
258
|
+
transform: `translateX(var(--x)) scaleX(${w})`,
|
|
259
|
+
transition: `transform .45s ${EASE}`,
|
|
260
|
+
animation: run ? `asta-tw-grow .6s ${EASE} both, asta-tw-run 1.2s ${EASE} .6s infinite ${onScreen ? "running" : "paused"}` : `asta-tw-grow .7s ${EASE} ${Math.round(x * 500)}ms both`
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
) }),
|
|
264
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
265
|
+
"Starts at ",
|
|
266
|
+
ms(s.start),
|
|
267
|
+
", ",
|
|
268
|
+
run ? "running" : `takes ${ms(dur)}`
|
|
269
|
+
] })
|
|
270
|
+
] }),
|
|
271
|
+
/* @__PURE__ */ jsx("span", { role: "gridcell", className: "text-right text-[12.5px] tabular-nums text-ink-2", title: s.tokensIn !== void 0 ? `${num(s.tokensIn)} in \xB7 ${num(s.tokensOut ?? 0)} out` : void 0, children: s.tokensIn !== void 0 || s.tokensOut !== void 0 ? num((s.tokensIn ?? 0) + (s.tokensOut ?? 0)) : /* @__PURE__ */ jsx("span", { className: "text-mute", children: "\u2013" }) }),
|
|
272
|
+
/* @__PURE__ */ jsx("span", { role: "gridcell", className: "text-right text-[12.5px] tabular-nums text-ink-2", children: s.cost !== void 0 ? usd(s.cost) : /* @__PURE__ */ jsx("span", { className: "text-mute", children: "\u2013" }) }),
|
|
273
|
+
/* @__PURE__ */ jsx("span", { role: "gridcell", className: "pr-4 text-right text-[12.5px] tabular-nums text-ink sm:pr-5", children: run ? /* @__PURE__ */ jsx("span", { className: "font-medium text-brand", children: "Running" }) : ms(dur) })
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
s.id
|
|
277
|
+
);
|
|
278
|
+
}),
|
|
279
|
+
!loading && rows.length === 0 && /* @__PURE__ */ jsxs("div", { role: "row", className: "flex flex-col items-center gap-1 px-4 py-12 text-center", children: [
|
|
280
|
+
/* @__PURE__ */ jsx("span", { role: "gridcell", className: "text-[13px] font-medium text-ink-2", children: "No spans yet" }),
|
|
281
|
+
/* @__PURE__ */ jsx("span", { className: "text-[12.5px] text-mute", children: "Start a run and its steps show up here as they happen." })
|
|
282
|
+
] })
|
|
283
|
+
] })
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
current && /* @__PURE__ */ jsxs("section", { "aria-labelledby": `${uid}-d`, className: "flex flex-col gap-4 bg-paper-2 px-4 py-4 sm:px-5", style: { animation: `asta-tw-in .3s ${EASE}` }, children: [
|
|
287
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2.5", children: [
|
|
288
|
+
/* @__PURE__ */ jsx("span", { className: cx("grid h-7 w-7 shrink-0 place-items-center rounded-md", current.kind === "llm" ? "bg-[color-mix(in_srgb,var(--brand)_12%,transparent)] text-brand" : "bg-paper text-ink-2"), children: /* @__PURE__ */ jsx(Glyph, { d: KINDS[current.kind].path }) }),
|
|
289
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
290
|
+
/* @__PURE__ */ jsx("h4", { id: `${uid}-d`, className: "truncate text-[14px] font-medium text-ink", children: current.name }),
|
|
291
|
+
/* @__PURE__ */ jsxs("p", { className: "text-[12px] text-mute", children: [
|
|
292
|
+
KINDS[current.kind].label,
|
|
293
|
+
current.model && ` \xB7 ${current.model}`
|
|
294
|
+
] })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ jsx(
|
|
297
|
+
"button",
|
|
298
|
+
{
|
|
299
|
+
type: "button",
|
|
300
|
+
"aria-label": "Close span details",
|
|
301
|
+
onClick: () => {
|
|
302
|
+
choose(null);
|
|
303
|
+
focusRow(current.id);
|
|
304
|
+
},
|
|
305
|
+
className: "grid h-7 w-7 shrink-0 place-items-center rounded-md text-mute outline-none transition-colors hover:bg-paper hover:text-ink focus-visible:ring-2 focus-visible:ring-brand/50",
|
|
306
|
+
children: /* @__PURE__ */ jsx(Glyph, { d: "m4.5 4.5 7 7M11.5 4.5l-7 7" })
|
|
307
|
+
}
|
|
308
|
+
)
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ jsxs("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-3 sm:grid-cols-5", children: [
|
|
311
|
+
/* @__PURE__ */ jsxs(Stat, { label: "Starts at", children: [
|
|
312
|
+
"+",
|
|
313
|
+
ms(current.start)
|
|
314
|
+
] }),
|
|
315
|
+
/* @__PURE__ */ jsx(Stat, { label: "Latency", children: current.duration === void 0 ? "Running" : ms(current.duration) }),
|
|
316
|
+
/* @__PURE__ */ jsx(Stat, { label: "Tokens in / out", children: current.tokensIn !== void 0 ? `${num(current.tokensIn)} / ${num(current.tokensOut ?? 0)}` : "\u2013" }),
|
|
317
|
+
/* @__PURE__ */ jsx(Stat, { label: "Cost", children: current.cost !== void 0 ? usd(current.cost) : "\u2013" }),
|
|
318
|
+
/* @__PURE__ */ jsx(Stat, { label: "Status", children: current.status === "error" ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 font-medium", children: [
|
|
319
|
+
/* @__PURE__ */ jsx(Glyph, { d: WARN, className: "h-3 w-3" }),
|
|
320
|
+
"Error"
|
|
321
|
+
] }) : current.duration === void 0 ? "Running" : "Done" })
|
|
322
|
+
] }),
|
|
323
|
+
current.error && /* @__PURE__ */ jsxs("p", { className: "flex gap-2 rounded-lg bg-paper px-3 py-2.5 text-[12.5px] leading-relaxed text-ink shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_14%,transparent)]", children: [
|
|
324
|
+
/* @__PURE__ */ jsx(Glyph, { d: WARN, className: "mt-0.5" }),
|
|
325
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
326
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Error: " }),
|
|
327
|
+
current.error
|
|
328
|
+
] })
|
|
329
|
+
] }),
|
|
330
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-3 md:grid-cols-2", children: ["input", "output"].map((f) => /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
331
|
+
/* @__PURE__ */ jsx("p", { className: "mb-1.5 font-mono text-[10.5px] uppercase tracking-wider text-mute", children: f }),
|
|
332
|
+
/* @__PURE__ */ jsx("pre", { className: "max-h-40 overflow-auto overscroll-contain whitespace-pre-wrap break-words rounded-lg bg-paper p-3 font-mono text-[12px] leading-relaxed text-ink-2 [scrollbar-width:thin]", children: current[f] || (f === "output" && current.duration === void 0 ? "Waiting for output\u2026" : "Nothing recorded.") })
|
|
333
|
+
] }, f)) })
|
|
334
|
+
] }, current.id)
|
|
335
|
+
] });
|
|
336
|
+
}
|
|
337
|
+
var trace_waterfall_default = TraceWaterfall;
|
|
338
|
+
|
|
339
|
+
export {
|
|
340
|
+
TraceWaterfall,
|
|
341
|
+
trace_waterfall_default
|
|
342
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// components/lab/blocks/AgentTeam.tsx
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var EASE = "cubic-bezier(.16,1,.3,1)";
|
|
7
|
+
var RING = "shadow-[inset_0_0_0_1px_color-mix(in_srgb,var(--ink)_10%,transparent)]";
|
|
8
|
+
var LINE = "bg-[color-mix(in_srgb,var(--ink)_16%,transparent)]";
|
|
9
|
+
var GOAL = "Draft the Q3 launch brief";
|
|
10
|
+
var AGENTS = [
|
|
11
|
+
{ role: "Research", task: "Compare pricing on 6 rival sites", unit: "sources", total: 6, end: 3300, found: "Rivals charge 12\u201318% more for teams" },
|
|
12
|
+
{ role: "Data", task: "Pull trial-to-paid for Q3", unit: "queries", total: 4, end: 2300, found: "Trial-to-paid reached 9.4% in October" },
|
|
13
|
+
{ role: "Writing", task: "Draft the headline and key messages", unit: "drafts", total: 3, end: 4300, found: "Headline plus 3 key messages drafted" }
|
|
14
|
+
];
|
|
15
|
+
var INIT = { phase: "plan", prog: AGENTS.map(() => 0), done: [] };
|
|
16
|
+
var STEPS = (() => {
|
|
17
|
+
const events = [{ at: 1e3, f: (s) => ({ ...s, phase: "split" }) }];
|
|
18
|
+
const WORK = 1500;
|
|
19
|
+
AGENTS.forEach((a, i) => {
|
|
20
|
+
for (let k = 1; k <= a.total; k++)
|
|
21
|
+
events.push({ at: WORK + a.end * k / a.total, f: (s) => ({ ...s, prog: s.prog.map((p, j) => j === i ? k : p) }) });
|
|
22
|
+
events.push({ at: WORK + a.end + 450, f: (s) => ({ ...s, done: [...s.done, i] }) });
|
|
23
|
+
});
|
|
24
|
+
const last = Math.max(...events.map((e) => e.at));
|
|
25
|
+
events.push({ at: last + 900, f: (s) => ({ ...s, phase: "merge" }) });
|
|
26
|
+
events.sort((a, b) => a.at - b.at);
|
|
27
|
+
return events.map((e, i) => [e.at - (i ? events[i - 1].at : 0), e.f]);
|
|
28
|
+
})();
|
|
29
|
+
var Check = ({ className = "" }) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className, fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-7" }) });
|
|
30
|
+
function AgentTeam() {
|
|
31
|
+
const [s, setS] = useState(INIT);
|
|
32
|
+
const [fade, setFade] = useState(false);
|
|
33
|
+
const [hover, setHover] = useState(false);
|
|
34
|
+
const [focusIn, setFocusIn] = useState(false);
|
|
35
|
+
const [visible, setVisible] = useState(true);
|
|
36
|
+
const [run, setRun] = useState(0);
|
|
37
|
+
const root = useRef(null);
|
|
38
|
+
const k = useRef(0);
|
|
39
|
+
const paused = hover || focusIn || !visible;
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const el = root.current;
|
|
42
|
+
if (!el) return;
|
|
43
|
+
let seen = true;
|
|
44
|
+
const sync = () => setVisible(seen && !document.hidden);
|
|
45
|
+
const io = new IntersectionObserver(([e]) => {
|
|
46
|
+
seen = e.isIntersecting;
|
|
47
|
+
sync();
|
|
48
|
+
});
|
|
49
|
+
io.observe(el);
|
|
50
|
+
document.addEventListener("visibilitychange", sync);
|
|
51
|
+
return () => {
|
|
52
|
+
io.disconnect();
|
|
53
|
+
document.removeEventListener("visibilitychange", sync);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (paused) return;
|
|
58
|
+
const t = [];
|
|
59
|
+
let alive = true;
|
|
60
|
+
const later = (ms, f) => t.push(setTimeout(() => alive && f(), ms));
|
|
61
|
+
const step = () => {
|
|
62
|
+
if (k.current >= STEPS.length) {
|
|
63
|
+
later(4200, () => setFade(true));
|
|
64
|
+
later(4700, () => {
|
|
65
|
+
k.current = 0;
|
|
66
|
+
setS(INIT);
|
|
67
|
+
});
|
|
68
|
+
later(4800, () => setFade(false));
|
|
69
|
+
later(5e3, step);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const [wait, f] = STEPS[k.current];
|
|
73
|
+
later(wait, () => {
|
|
74
|
+
k.current++;
|
|
75
|
+
setS(f);
|
|
76
|
+
step();
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
step();
|
|
80
|
+
return () => {
|
|
81
|
+
alive = false;
|
|
82
|
+
t.forEach(clearTimeout);
|
|
83
|
+
};
|
|
84
|
+
}, [paused, run]);
|
|
85
|
+
const restart = () => {
|
|
86
|
+
k.current = 0;
|
|
87
|
+
setS(INIT);
|
|
88
|
+
setHover(false);
|
|
89
|
+
setFocusIn(false);
|
|
90
|
+
root.current?.focus();
|
|
91
|
+
setRun((r) => r + 1);
|
|
92
|
+
};
|
|
93
|
+
const toggle = () => setHover((h) => !h);
|
|
94
|
+
const out = s.phase !== "plan";
|
|
95
|
+
const merged = s.phase === "merge";
|
|
96
|
+
const running = AGENTS.length - s.done.length;
|
|
97
|
+
const status = s.phase === "plan" ? "Planning" : merged ? "Done \xB7 41 s" : s.done.length ? `${s.done.length} of 3 reported` : "3 running";
|
|
98
|
+
return /* @__PURE__ */ jsxs(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
ref: root,
|
|
102
|
+
role: "group",
|
|
103
|
+
tabIndex: 0,
|
|
104
|
+
"aria-label": `Agent team. Goal: ${GOAL}. ${status}. ${hover ? "Paused" : "Live"}. Press space to ${hover ? "resume" : "pause"}`,
|
|
105
|
+
onPointerEnter: (e) => e.pointerType === "mouse" && setHover(true),
|
|
106
|
+
onPointerLeave: (e) => e.pointerType === "mouse" && setHover(false),
|
|
107
|
+
onPointerUp: (e) => e.pointerType !== "mouse" && !e.target.closest("button") && toggle(),
|
|
108
|
+
onFocus: (e) => setFocusIn(e.target !== e.currentTarget),
|
|
109
|
+
onBlur: (e) => !e.currentTarget.contains(e.relatedTarget) && setFocusIn(false),
|
|
110
|
+
onKeyDown: (e) => {
|
|
111
|
+
if (e.target === e.currentTarget && (e.key === " " || e.key === "Enter")) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
toggle();
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
className: "flex h-full w-full items-center justify-center px-5 pb-5 pt-11 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-brand/50",
|
|
117
|
+
style: { containerType: "size" },
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ jsx("style", { href: "asta-agentteam", precedence: "asta", children: `
|
|
120
|
+
@keyframes lab-at-dot { 0%, 100% { opacity: .25 } 40% { opacity: 1 } }
|
|
121
|
+
@keyframes lab-at-pop { from { transform: scale(.9); opacity: 0 } to { transform: none; opacity: 1 } }
|
|
122
|
+
@keyframes lab-at-in { from { transform: translateY(6px); opacity: 0 } to { transform: none; opacity: 1 } }
|
|
123
|
+
.lab-at-dot { animation: lab-at-dot 1.1s ${EASE} infinite }
|
|
124
|
+
.lab-at-pop { animation: lab-at-pop .45s ${EASE} both }
|
|
125
|
+
.lab-at-in { animation: lab-at-in .5s ${EASE} both }
|
|
126
|
+
@media (prefers-reduced-motion: reduce) { .lab-at-dot, .lab-at-pop, .lab-at-in { animation: none } .lab-at-move { transition: none !important } }
|
|
127
|
+
` }),
|
|
128
|
+
/* @__PURE__ */ jsxs(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
className: `flex w-full max-w-[520px] flex-col rounded-[14px] bg-paper p-[clamp(10px,3.4cqmin,16px)] ${RING} shadow-[0_18px_40px_-28px_rgb(0_0_0/0.35)]`,
|
|
132
|
+
style: { opacity: fade ? 0 : 1, transition: `opacity .45s ${EASE}` },
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsxs("div", { className: "relative z-10 flex items-center gap-2.5 rounded-[11px] bg-paper-2 p-[clamp(8px,2.6cqmin,11px)]", children: [
|
|
135
|
+
/* @__PURE__ */ jsx("span", { className: "grid h-8 w-8 shrink-0 place-items-center rounded-[8px] bg-brand text-paper", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", className: "h-4 w-4", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M8 1.5c.4 3.2 1.4 4.6 4.8 5.2v.6C9.4 7.9 8.4 9.3 8 12.5h-.1c-.4-3.2-1.4-4.6-4.8-5.2v-.6C6.5 6.1 7.5 4.7 7.9 1.5zM12.6 10.5c.2 1.4.7 2 2 2.3-1.3.3-1.8.9-2 2.3-.2-1.4-.7-2-2-2.3 1.3-.3 1.8-.9 2-2.3z" }) }) }),
|
|
136
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1 leading-tight", children: [
|
|
137
|
+
/* @__PURE__ */ jsx("span", { className: "block text-[11px] text-mute", children: "Lead agent" }),
|
|
138
|
+
/* @__PURE__ */ jsx("span", { className: "block truncate text-[13.5px] font-medium tracking-[-0.01em] text-ink", children: GOAL })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ jsxs(
|
|
141
|
+
"span",
|
|
142
|
+
{
|
|
143
|
+
className: `lab-at-pop flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-[11px] tabular-nums ${merged ? "bg-brand text-paper" : "bg-paper text-ink-2"}`,
|
|
144
|
+
"aria-live": "polite",
|
|
145
|
+
children: [
|
|
146
|
+
s.phase === "plan" && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "flex gap-[3px]", children: [0, 1, 2].map((d) => /* @__PURE__ */ jsx("span", { className: "lab-at-dot h-1 w-1 rounded-full bg-current", style: { animationDelay: `${d * 160}ms` } }, d)) }),
|
|
147
|
+
merged && /* @__PURE__ */ jsx(Check, { className: "h-3 w-3" }),
|
|
148
|
+
status
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
status
|
|
152
|
+
)
|
|
153
|
+
] }),
|
|
154
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-[clamp(12px,4.5cqh,22px)]", "aria-hidden": true, children: [
|
|
155
|
+
/* @__PURE__ */ jsx("span", { className: `lab-at-move absolute left-1/2 top-0 h-1/2 w-px origin-top ${LINE}`, style: { transform: `scaleY(${out && !merged ? 1 : 0})`, transition: `transform .35s ${EASE}` } }),
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: `lab-at-move absolute left-[16.67%] right-[16.67%] top-1/2 h-px ${LINE}`, style: { transform: `scaleX(${out && !merged ? 1 : 0})`, transition: `transform .45s ${EASE} ${out && !merged ? ".12s" : "0s"}` } }),
|
|
157
|
+
AGENTS.map((a, i) => /* @__PURE__ */ jsxs("span", { className: "absolute top-1/2 h-1/2 w-px", style: { left: `${16.67 + i * 33.33}%` }, children: [
|
|
158
|
+
/* @__PURE__ */ jsx("span", { className: `lab-at-move absolute inset-0 origin-top ${LINE}`, style: { transform: `scaleY(${out && !merged ? 1 : 0})`, transition: `transform .3s ${EASE} ${out && !merged ? ".3s" : "0s"}` } }),
|
|
159
|
+
/* @__PURE__ */ jsx("span", { className: "lab-at-move absolute inset-0 origin-bottom bg-brand", style: { transform: `scaleY(${s.done.includes(i) && !merged ? 1 : 0})`, transition: `transform .4s ${EASE}` } })
|
|
160
|
+
] }, a.role))
|
|
161
|
+
] }),
|
|
162
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
163
|
+
/* @__PURE__ */ jsx("ol", { className: "grid min-h-[100px] grid-cols-3 gap-[clamp(6px,2cqw,10px)]", "aria-label": "Subagents", children: AGENTS.map((a, i) => {
|
|
164
|
+
const done = s.done.includes(i);
|
|
165
|
+
const p = s.prog[i] / a.total;
|
|
166
|
+
const shown = out && !merged;
|
|
167
|
+
return /* @__PURE__ */ jsxs(
|
|
168
|
+
"li",
|
|
169
|
+
{
|
|
170
|
+
className: `lab-at-move flex min-w-0 flex-col gap-[max(4px,1.4cqh)] rounded-[11px] bg-paper p-[clamp(7px,2.4cqmin,11px)] ${RING}`,
|
|
171
|
+
style: {
|
|
172
|
+
transform: shown ? "none" : `translate(${(1 - i) * 100}%, ${merged ? "-40%" : "-55%"}) scale(.9)`,
|
|
173
|
+
opacity: shown ? 1 : 0,
|
|
174
|
+
transition: `transform .6s ${EASE} ${shown ? `${i * 70}ms` : "0ms"}, opacity .45s ${EASE} ${shown ? `${i * 70}ms` : "0ms"}`
|
|
175
|
+
},
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-1", children: [
|
|
178
|
+
/* @__PURE__ */ jsx("span", { className: "truncate font-mono text-[10px] uppercase tracking-wider text-ink-2", children: a.role }),
|
|
179
|
+
/* @__PURE__ */ jsx("span", { className: `grid h-3.5 w-3.5 shrink-0 place-items-center rounded-full ${done ? "bg-brand text-paper" : RING}`, style: { transition: `background-color .3s ${EASE}` }, children: done && /* @__PURE__ */ jsx(Check, { className: "lab-at-pop h-2 w-2" }) })
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ jsx("span", { className: "line-clamp-2 text-[12px] leading-snug text-ink", children: a.task }),
|
|
182
|
+
/* @__PURE__ */ jsxs("span", { className: "mt-auto flex flex-col gap-1", children: [
|
|
183
|
+
/* @__PURE__ */ jsx("span", { className: "h-1 overflow-hidden rounded-full bg-paper-2", children: /* @__PURE__ */ jsx("span", { className: "lab-at-move block h-full origin-left rounded-full bg-brand", style: { transform: `scaleX(${p})`, transition: `transform .5s ${EASE}` } }) }),
|
|
184
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[10.5px] tabular-nums text-mute", children: done ? "Reported" : `${s.prog[i]}/${a.total} ${a.unit}` })
|
|
185
|
+
] })
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
a.role
|
|
189
|
+
);
|
|
190
|
+
}) }),
|
|
191
|
+
merged && /* @__PURE__ */ jsxs("div", { className: "lab-at-pop absolute inset-0 flex flex-col gap-[max(4px,1.2cqh)] rounded-[11px] bg-paper p-[clamp(8px,2.6cqmin,12px)] shadow-[inset_0_0_0_1.5px_var(--brand),0_14px_30px_-20px_rgb(0_0_0/0.5)]", children: [
|
|
192
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
193
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-[13px] font-medium tracking-[-0.01em] text-ink", children: "Launch brief ready" }),
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
"button",
|
|
196
|
+
{
|
|
197
|
+
type: "button",
|
|
198
|
+
onClick: restart,
|
|
199
|
+
className: "shrink-0 rounded-[7px] bg-paper-2 px-2 py-1 text-[11px] font-medium text-ink outline-none hover:bg-[color-mix(in_srgb,var(--ink)_10%,var(--paper-2))] focus-visible:ring-2 focus-visible:ring-brand/60",
|
|
200
|
+
children: "Run it again"
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] }),
|
|
204
|
+
/* @__PURE__ */ jsx("ul", { className: "flex min-h-0 flex-col gap-[max(2px,0.8cqh)]", children: s.done.map((i, n) => /* @__PURE__ */ jsxs("li", { className: "lab-at-in flex min-w-0 items-baseline gap-2 text-[11.5px] leading-snug", style: { animationDelay: `${120 + n * 90}ms` }, children: [
|
|
205
|
+
/* @__PURE__ */ jsx("span", { className: "w-[54px] shrink-0 font-mono text-[9.5px] uppercase tracking-wider text-mute", children: AGENTS[i].role }),
|
|
206
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-ink", children: AGENTS[i].found })
|
|
207
|
+
] }, i)) })
|
|
208
|
+
] })
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: merged ? "All three reports merged into the summary" : running < 3 ? `${s.done.length} of 3 subagents reported` : "" })
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export {
|
|
220
|
+
AgentTeam
|
|
221
|
+
};
|