@actioneer/ads 0.3.1 → 0.4.0

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.
@@ -0,0 +1,87 @@
1
+ import { ReactNode } from 'react';
2
+ import { ToolState } from './tool';
3
+ /**
4
+ * AgentTrace — the ENTIRE agent reasoning trace as one component, so any
5
+ * consumer gets the complete, correct experience instead of hand-wiring it
6
+ * from ChainOfThought / Task / Tool primitives and getting a subset (a
7
+ * misaligned connector, no live line, no slow-call handoff).
8
+ *
9
+ * It is live-only and fully controlled: pass the current agent state, update
10
+ * it as the run progresses, and the component reflects it. There is no
11
+ * internal replay engine — the consuming app owns progression (and, if it
12
+ * wants a counting clock, ticks `elapsed`).
13
+ *
14
+ * What it renders, always:
15
+ * 1. Phases — steps grouped by `group`, each a `Task` disclosure; finished
16
+ * phases fold away while another is active.
17
+ * 2. Steps — a `ChainOfThought connector="tree"` per phase; settled steps
18
+ * hang off the phase on a measured tree connector.
19
+ * 3. Tools — each call is a `Tool` card hung off its step as a branch.
20
+ * Plus the reason-first live line (the `active` step is narrated by
21
+ * `ResearchActivity` and joins the tree only once it settles) and, when an
22
+ * active step outruns `slowSeconds`, the handoff `Alert`.
23
+ */
24
+ /** A single tool call within a step. */
25
+ export interface AgentTraceCall {
26
+ name: string;
27
+ state: ToolState;
28
+ input?: unknown;
29
+ /** Rendered when the call succeeds. */
30
+ output?: unknown;
31
+ /** Rendered when the call errors. */
32
+ error?: string;
33
+ }
34
+ /**
35
+ * `active` is the in-flight step (there should be at most one) — it is owned
36
+ * by the live line, not the tree. `pending` steps are not shown yet.
37
+ */
38
+ export type AgentTraceStepStatus = "complete" | "active" | "error" | "pending";
39
+ export interface AgentTraceStep {
40
+ /** Stable identity — used for the review handoff and React keys. */
41
+ id: string;
42
+ /** Phase / section this step belongs to, e.g. "Research". */
43
+ group: string;
44
+ /** Icon for the phase header (only the first step in a group needs it). */
45
+ groupIcon?: ReactNode;
46
+ /** The step's own leading icon. */
47
+ icon?: ReactNode;
48
+ label: string;
49
+ /** Attribution — shown only when it differs from `mainAgent`. */
50
+ agent?: string;
51
+ /** The agent's own narration for this step. */
52
+ detail?: ReactNode;
53
+ /** Cubes / tables / sources this step touched, as chips. */
54
+ sources?: string[];
55
+ status: AgentTraceStepStatus;
56
+ /** Preformatted elapsed (e.g. "0:06"); falls back to `seconds`. */
57
+ elapsed?: ReactNode;
58
+ /** Wall clock in seconds — powers the phase total and slow detection. */
59
+ seconds?: number;
60
+ calls?: AgentTraceCall[];
61
+ }
62
+ export interface AgentTraceProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
63
+ steps: AgentTraceStep[];
64
+ /** Attribution equal to this is suppressed (it's the orchestrator). */
65
+ mainAgent?: string;
66
+ /** An active step past this many seconds shows the handoff. Default 60. */
67
+ slowSeconds?: number;
68
+ /** Ids already handed off — their button reads "Sent" and is disabled. */
69
+ reviewedStepIds?: string[];
70
+ /** Fires when the reader hands a slow step off for review. */
71
+ onSendForReview?: (step: AgentTraceStep) => void;
72
+ /** Override the handoff copy for a given stuck step. */
73
+ slowMessage?: (step: AgentTraceStep) => {
74
+ title: ReactNode;
75
+ detail: ReactNode;
76
+ };
77
+ /**
78
+ * Render a tool call yourself instead of the built-in card — for consumers
79
+ * with richer tool rendering (SQL extraction, custom payloads). Falls back
80
+ * to the default `Tool` card.
81
+ */
82
+ renderCall?: (call: AgentTraceCall) => ReactNode;
83
+ }
84
+ export declare const AgentTrace: {
85
+ ({ steps, mainAgent, slowSeconds, reviewedStepIds, onSendForReview, slowMessage, renderCall, className, ...props }: AgentTraceProps): import("react").JSX.Element;
86
+ displayName: string;
87
+ };
@@ -0,0 +1,180 @@
1
+ "use client";
2
+ import { jsxs as a, jsx as t, Fragment as j } from "react/jsx-runtime";
3
+ import { memo as b, useState as D, useRef as _, useEffect as z } from "react";
4
+ import { cn as L } from "../../lib/cn.js";
5
+ import { Clock as F } from "../../lib/icons.js";
6
+ import { Alert as G, AlertTitle as H, AlertDescription as U } from "../alert.js";
7
+ import { Button as B } from "../button.js";
8
+ import { Text as K } from "../typography.js";
9
+ import { ChainOfThoughtStep as P, ChainOfThoughtTrigger as W, ChainOfThoughtContent as q, ChainOfThoughtItem as J, ChainOfThoughtSearchResults as Q, ChainOfThoughtSearchResult as V, ChainOfThought as X } from "./chain-of-thought.js";
10
+ import { ResearchActivity as Y } from "./research-activity.js";
11
+ import { Task as Z, TaskTrigger as ee, TaskContent as te } from "./task.js";
12
+ import { Tool as ne, ToolHeader as re, ToolContent as oe, ToolInput as se, ToolOutput as ie } from "./tool.js";
13
+ const ae = "Main Agent", le = 60;
14
+ function x(e) {
15
+ const o = Math.floor(e);
16
+ return `${Math.floor(o / 60)}:${String(o % 60).padStart(2, "0")}`;
17
+ }
18
+ function v(e) {
19
+ if (e.elapsed != null) return e.elapsed;
20
+ if (e.seconds != null) return x(e.seconds);
21
+ }
22
+ function y(e) {
23
+ const o = [];
24
+ for (const s of e) o.includes(s.group) || o.push(s.group);
25
+ return o;
26
+ }
27
+ function ce(e) {
28
+ const o = new Set(e.flatMap((i) => i.sources ?? [])).size, s = e.reduce((i, c) => i + (c.seconds ?? 0), 0), l = [];
29
+ return o && l.push(`${o} ${o === 1 ? "source" : "sources"}`), s && e.length > 1 && l.push(x(s)), l.join(" · ") || void 0;
30
+ }
31
+ function de(e) {
32
+ var i, c, h;
33
+ const o = (c = (i = e.calls) == null ? void 0 : i[0]) == null ? void 0 : c.name, s = (((h = e.calls) == null ? void 0 : h.length) ?? 0) - 1, l = s > 0 ? ` ${s} other call${s === 1 ? "" : "s"} in this step ${s === 1 ? "is" : "are"} waiting behind it.` : "";
34
+ return {
35
+ title: o ? `The ${o} call has not returned` : "This step has not finished",
36
+ detail: /* @__PURE__ */ a(j, { children: [
37
+ e.detail,
38
+ l,
39
+ " Send for review to the Actioneer team to help with future runs."
40
+ ] })
41
+ };
42
+ }
43
+ const A = b(({ call: e }) => /* @__PURE__ */ a(ne, { children: [
44
+ /* @__PURE__ */ t(re, { title: e.name, type: `tool-${e.name}`, state: e.state }),
45
+ /* @__PURE__ */ a(oe, { children: [
46
+ e.input !== void 0 && /* @__PURE__ */ t(se, { input: e.input }),
47
+ /* @__PURE__ */ t(
48
+ ie,
49
+ {
50
+ output: e.state === "output-available" ? e.output : void 0,
51
+ errorText: e.state === "output-error" ? e.error : void 0
52
+ }
53
+ )
54
+ ] })
55
+ ] }));
56
+ A.displayName = "AgentTrace.ToolCard";
57
+ const O = b(
58
+ ({
59
+ step: e,
60
+ mainAgent: o,
61
+ renderCall: s
62
+ }) => {
63
+ const l = v(e);
64
+ return /* @__PURE__ */ a(P, { status: e.status === "error" ? "error" : "complete", children: [
65
+ /* @__PURE__ */ a(W, { leftIcon: e.icon, endContent: l, children: [
66
+ /* @__PURE__ */ t("span", { children: e.label }),
67
+ e.agent && e.agent !== o && /* @__PURE__ */ t("span", { className: "ml-2 text-xs font-normal text-tertiary", children: e.agent })
68
+ ] }),
69
+ /* @__PURE__ */ t(q, { children: /* @__PURE__ */ a("div", { className: "-ml-5", style: { "--tree-rail-lead": "18px" }, children: [
70
+ e.detail != null && /* @__PURE__ */ t("div", { className: "ads-tree-rail pb-3", children: /* @__PURE__ */ t(J, { children: e.detail }) }),
71
+ e.sources && e.sources.length > 0 && /* @__PURE__ */ t("div", { className: "ads-tree-rail pb-3", children: /* @__PURE__ */ t(Q, { children: e.sources.map((i) => /* @__PURE__ */ t(V, { children: i }, i)) }) }),
72
+ (e.calls ?? []).map((i, c) => /* @__PURE__ */ t(
73
+ "div",
74
+ {
75
+ className: "ads-tree-branch pb-2 last:pb-0",
76
+ style: { "--tree-elbow": "23px" },
77
+ children: s ? s(i) : /* @__PURE__ */ t(A, { call: i })
78
+ },
79
+ c
80
+ ))
81
+ ] }) })
82
+ ] });
83
+ }
84
+ );
85
+ O.displayName = "AgentTrace.StepRow";
86
+ const ue = ({
87
+ steps: e,
88
+ mainAgent: o = ae,
89
+ slowSeconds: s = le,
90
+ reviewedStepIds: l,
91
+ onSendForReview: i,
92
+ slowMessage: c = de,
93
+ renderCall: h,
94
+ className: $,
95
+ ...k
96
+ }) => {
97
+ var S;
98
+ const n = e.find((r) => r.status === "active") ?? null, f = e.filter((r) => r.status === "complete" || r.status === "error"), p = new Set(l ?? []), [E, C] = D(/* @__PURE__ */ new Set()), w = _(null);
99
+ z(() => {
100
+ const r = (n == null ? void 0 : n.group) ?? null;
101
+ r == null || r === w.current || (w.current = r, C(new Set(y(e).filter((d) => d !== r))));
102
+ }, [n == null ? void 0 : n.group, e]);
103
+ const N = y(f).map((r) => {
104
+ var d;
105
+ return {
106
+ group: r,
107
+ icon: (d = f.find((u) => u.group === r)) == null ? void 0 : d.groupIcon,
108
+ steps: f.filter((u) => u.group === r)
109
+ };
110
+ }), M = (n == null ? void 0 : n.seconds) ?? 0, I = n != null && M >= s, g = n ? c(n) : null;
111
+ return /* @__PURE__ */ a("div", { "data-slot": "agent-trace", className: L("w-full", $), ...k, children: [
112
+ /* @__PURE__ */ t("div", { className: "flex flex-col gap-3", children: N.map(({ group: r, icon: d, steps: u }) => /* @__PURE__ */ a(
113
+ Z,
114
+ {
115
+ open: !E.has(r),
116
+ onOpenChange: (m) => C((R) => {
117
+ const T = new Set(R);
118
+ return m ? T.delete(r) : T.add(r), T;
119
+ }),
120
+ children: [
121
+ /* @__PURE__ */ t(ee, { title: r, icon: d, endContent: ce(u) }),
122
+ /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(X, { connector: "tree", children: u.map((m) => /* @__PURE__ */ t(
123
+ O,
124
+ {
125
+ step: m,
126
+ mainAgent: o,
127
+ renderCall: h
128
+ },
129
+ m.id
130
+ )) }) })
131
+ ]
132
+ },
133
+ r
134
+ )) }),
135
+ n && /* @__PURE__ */ a("div", { className: "mt-3", children: [
136
+ /* @__PURE__ */ t(
137
+ Y,
138
+ {
139
+ status: "active",
140
+ open: !0,
141
+ onOpenChange: () => {
142
+ },
143
+ elapsed: v(n) ?? "0:00",
144
+ sourceCount: ((S = n.sources) == null ? void 0 : S.length) ?? 0,
145
+ activity: n.label,
146
+ activityKey: n.id,
147
+ activityPlacement: "bottom",
148
+ collapsible: !1,
149
+ children: /* @__PURE__ */ t("span", {})
150
+ }
151
+ ),
152
+ I && g && /* @__PURE__ */ t(G, { variant: "warning", icon: /* @__PURE__ */ t(F, {}), className: "mt-3", children: /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
153
+ /* @__PURE__ */ a("div", { className: "min-w-0", children: [
154
+ /* @__PURE__ */ a(H, { children: [
155
+ g.title,
156
+ " —",
157
+ " ",
158
+ /* @__PURE__ */ t("span", { className: "tabular-nums text-tertiary", children: v(n) })
159
+ ] }),
160
+ /* @__PURE__ */ t(U, { children: g.detail })
161
+ ] }),
162
+ i && /* @__PURE__ */ t(
163
+ B,
164
+ {
165
+ size: "sm",
166
+ variant: p.has(n.id) ? "ghost" : "secondary",
167
+ disabled: p.has(n.id),
168
+ onClick: () => i(n),
169
+ children: p.has(n.id) ? "Sent" : "Skip and send"
170
+ }
171
+ )
172
+ ] }) })
173
+ ] }),
174
+ N.length === 0 && !n && /* @__PURE__ */ t(K, { size: "sm", className: "text-tertiary", children: "No steps yet." })
175
+ ] });
176
+ };
177
+ ue.displayName = "AgentTrace";
178
+ export {
179
+ ue as AgentTrace
180
+ };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as c, Fragment as R } from "react/jsx-runtime";
2
+ import { jsx as t, jsxs as c, Fragment as R } from "react/jsx-runtime";
3
3
  import { Badge as y } from "../badge.js";
4
4
  import { Collapsible as N, CollapsibleTrigger as C, CollapsibleContent as T } from "../collapsible.js";
5
5
  import { ChevronRight as M, ChevronDown as w, WarningCircle as j, Database as _ } from "../../lib/icons.js";
@@ -13,8 +13,8 @@ const k = O(!1), E = O("rail"), B = l(
13
13
  role: o = "list",
14
14
  connector: r = "rail",
15
15
  children: a,
16
- ...t
17
- }) => /* @__PURE__ */ e(
16
+ ...e
17
+ }) => /* @__PURE__ */ t(
18
18
  "div",
19
19
  {
20
20
  "data-slot": "chain-of-thought",
@@ -27,8 +27,8 @@ const k = O(!1), E = O("rail"), B = l(
27
27
  ],
28
28
  i
29
29
  ),
30
- ...t,
31
- children: /* @__PURE__ */ e(E.Provider, { value: r, children: a })
30
+ ...e,
31
+ children: /* @__PURE__ */ t(E.Provider, { value: r, children: a })
32
32
  }
33
33
  )
34
34
  ), F = l(
@@ -37,54 +37,54 @@ const k = O(!1), E = O("rail"), B = l(
37
37
  defaultOpen: o,
38
38
  open: r,
39
39
  onOpenChange: a,
40
- status: t = "complete",
40
+ status: e = "complete",
41
41
  role: s = "listitem",
42
42
  "aria-busy": h,
43
43
  children: m,
44
44
  ...d
45
45
  }) => {
46
46
  const p = S(E), u = r !== void 0, [g, f] = D(
47
- o ?? t === "active"
48
- ), b = A(t), z = b.current !== "active" && t === "active", v = u ? r : z || g;
47
+ o ?? e === "active"
48
+ ), b = A(e), z = b.current !== "active" && e === "active", v = u ? r : z || g;
49
49
  return I(() => {
50
50
  const x = b.current;
51
- b.current = t, !(x === "active" || t !== "active") && (u || f(!0), a == null || a(!0));
52
- }, [u, a, t]), /* @__PURE__ */ e(
51
+ b.current = e, !(x === "active" || e !== "active") && (u || f(!0), a == null || a(!0));
52
+ }, [u, a, e]), /* @__PURE__ */ t(
53
53
  N,
54
54
  {
55
55
  "data-slot": "chain-of-thought-step",
56
- "data-status": t,
56
+ "data-status": e,
57
57
  open: v,
58
58
  onOpenChange: (x) => {
59
59
  u || f(x), a == null || a(x);
60
60
  },
61
61
  role: s,
62
- "aria-current": t === "active" ? "step" : void 0,
63
- "aria-busy": h ?? (t === "active" || void 0),
62
+ "aria-current": e === "active" ? "step" : void 0,
63
+ "aria-busy": h ?? (e === "active" || void 0),
64
64
  className: n(
65
65
  "group/cot-step relative pb-2",
66
66
  // Connector rail: a 16px segment centred in the 28px gap between a
67
67
  // collapsed step's icon and the next one (top-8 = 32px from the step
68
68
  // top, ending 4px past its box). It stretches with an open step.
69
- p === "rail" && "before:absolute before:top-8 before:-bottom-1 before:left-2 before:w-px before:bg-border before:content-['']",
69
+ p === "rail" && "before:absolute before:top-8 before:-bottom-1 before:left-2 before:w-px before:bg-border-strong before:content-['']",
70
70
  // Tree connector: a continuous rail down the group with an elbow
71
71
  // reaching EVERY step — the same branch language as Tree/TreeItem.
72
72
  // The last step drops the rail; its elbow draws the final segment.
73
73
  p === "tree" && [
74
74
  "ps-5",
75
- "before:absolute before:inset-y-0 before:left-0 before:border-l before:border-border before:content-['']",
75
+ "before:absolute before:inset-y-0 before:left-0 before:border-l before:border-border-strong before:content-['']",
76
76
  "last:before:hidden",
77
77
  // top-0.5 + h-4 lands the elbow at 18px — the step icon's centre.
78
- "after:absolute after:left-0 after:top-0.5 after:h-4 after:w-4 after:rounded-bl-[9px] after:border-b after:border-l after:border-border after:content-['']"
78
+ "after:absolute after:left-0 after:top-0.5 after:h-4 after:w-4 after:rounded-bl-[9px] after:border-b after:border-l after:border-border-strong after:content-['']"
79
79
  ],
80
- t === "complete" && "text-secondary",
81
- t === "active" && "text-primary",
82
- t === "pending" && "text-tertiary/60",
83
- t === "error" && "text-danger",
80
+ e === "complete" && "text-secondary",
81
+ e === "active" && "text-primary",
82
+ e === "pending" && "text-tertiary/60",
83
+ e === "error" && "text-danger",
84
84
  i
85
85
  ),
86
86
  ...d,
87
- children: /* @__PURE__ */ e(k.Provider, { value: v, children: m })
87
+ children: /* @__PURE__ */ t(k.Provider, { value: v, children: m })
88
88
  }
89
89
  );
90
90
  }
@@ -94,10 +94,10 @@ const k = O(!1), E = O("rail"), B = l(
94
94
  children: o,
95
95
  leftIcon: r,
96
96
  endContent: a,
97
- caret: t = !0,
97
+ caret: e = !0,
98
98
  swapIconOnHover: s = !0,
99
99
  ...h
100
- }) => /* @__PURE__ */ e(C, { asChild: !0, ...h, children: /* @__PURE__ */ c(
100
+ }) => /* @__PURE__ */ t(C, { asChild: !0, ...h, children: /* @__PURE__ */ c(
101
101
  "button",
102
102
  {
103
103
  type: "button",
@@ -111,23 +111,23 @@ const k = O(!1), E = O("rail"), B = l(
111
111
  i
112
112
  ),
113
113
  children: [
114
- /* @__PURE__ */ e(
114
+ /* @__PURE__ */ t(
115
115
  "span",
116
116
  {
117
117
  "aria-hidden": !0,
118
118
  className: "relative z-10 block size-4 shrink-0",
119
119
  children: r ? /* @__PURE__ */ c(R, { children: [
120
- /* @__PURE__ */ e(
120
+ /* @__PURE__ */ t(
121
121
  "span",
122
122
  {
123
123
  className: n(
124
124
  "absolute inset-0 flex items-center justify-center transition-opacity duration-(--duration-fast) ease-out [&>svg]:size-4 motion-reduce:transition-none",
125
- !t && s && "group-hover/cot-trigger:opacity-0 group-data-[state=open]/cot-trigger:opacity-0"
125
+ !e && s && "group-hover/cot-trigger:opacity-0 group-data-[state=open]/cot-trigger:opacity-0"
126
126
  ),
127
127
  children: r
128
128
  }
129
129
  ),
130
- !t && s && /* @__PURE__ */ e(
130
+ !e && s && /* @__PURE__ */ t(
131
131
  M,
132
132
  {
133
133
  className: n(
@@ -137,13 +137,13 @@ const k = O(!1), E = O("rail"), B = l(
137
137
  )
138
138
  }
139
139
  )
140
- ] }) : /* @__PURE__ */ e("span", { className: "absolute top-1/2 left-1/2 size-1.5 -translate-x-1/2 -translate-y-1/2 rounded-dot bg-current" })
140
+ ] }) : /* @__PURE__ */ t("span", { className: "absolute top-1/2 left-1/2 size-1.5 -translate-x-1/2 -translate-y-1/2 rounded-dot bg-current" })
141
141
  }
142
142
  ),
143
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1", children: o }),
143
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1", children: o }),
144
144
  /* @__PURE__ */ c("span", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
145
- a != null && /* @__PURE__ */ e("span", { className: "text-xs text-tertiary tabular-nums", children: a }),
146
- t && /* @__PURE__ */ e(
145
+ a != null && /* @__PURE__ */ t("span", { className: "text-xs text-tertiary tabular-nums", children: a }),
146
+ e && /* @__PURE__ */ t(
147
147
  w,
148
148
  {
149
149
  className: "size-4 shrink-0 text-tertiary transition-transform duration-(--duration-fast) ease-out group-data-[state=open]/cot-trigger:rotate-180 motion-reduce:transition-none",
@@ -157,7 +157,7 @@ const k = O(!1), E = O("rail"), B = l(
157
157
  ), W = l(
158
158
  ({ className: i, children: o, ...r }) => {
159
159
  const a = S(k);
160
- return /* @__PURE__ */ e(T, { forceMount: !0, asChild: !0, ...r, children: /* @__PURE__ */ e(
160
+ return /* @__PURE__ */ t(T, { forceMount: !0, asChild: !0, ...r, children: /* @__PURE__ */ t(
161
161
  L.div,
162
162
  {
163
163
  "data-slot": "chain-of-thought-content",
@@ -173,12 +173,12 @@ const k = O(!1), E = O("rail"), B = l(
173
173
  "data-[state=closed]:pointer-events-none",
174
174
  i
175
175
  ),
176
- children: /* @__PURE__ */ e("div", { className: "pt-2 pb-1 pl-7", children: o })
176
+ children: /* @__PURE__ */ t("div", { className: "pt-2 pb-1 pl-7", children: o })
177
177
  }
178
178
  ) });
179
179
  }
180
180
  ), X = l(
181
- ({ className: i, ...o }) => /* @__PURE__ */ e(
181
+ ({ className: i, ...o }) => /* @__PURE__ */ t(
182
182
  "div",
183
183
  {
184
184
  "data-slot": "chain-of-thought-item",
@@ -191,7 +191,7 @@ const k = O(!1), E = O("rail"), B = l(
191
191
  }
192
192
  )
193
193
  ), q = l(
194
- ({ className: i, ...o }) => /* @__PURE__ */ e(
194
+ ({ className: i, ...o }) => /* @__PURE__ */ t(
195
195
  "div",
196
196
  {
197
197
  className: n("flex flex-wrap items-center gap-2", i),
@@ -199,7 +199,7 @@ const k = O(!1), E = O("rail"), B = l(
199
199
  }
200
200
  )
201
201
  ), G = l(
202
- ({ className: i, children: o, ...r }) => /* @__PURE__ */ e(
202
+ ({ className: i, children: o, ...r }) => /* @__PURE__ */ t(
203
203
  y,
204
204
  {
205
205
  className: n("gap-1 font-normal", i),
@@ -215,7 +215,7 @@ const k = O(!1), E = O("rail"), B = l(
215
215
  title: o,
216
216
  tag: r,
217
217
  meta: a,
218
- source: t,
218
+ source: e,
219
219
  error: s,
220
220
  icon: h,
221
221
  defaultOpen: m = !1,
@@ -230,7 +230,7 @@ const k = O(!1), E = O("rail"), B = l(
230
230
  className: n("w-full", i),
231
231
  ...p,
232
232
  children: [
233
- /* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ c(
233
+ /* @__PURE__ */ t(C, { asChild: !0, children: /* @__PURE__ */ c(
234
234
  "button",
235
235
  {
236
236
  type: "button",
@@ -241,7 +241,7 @@ const k = O(!1), E = O("rail"), B = l(
241
241
  "focus-visible:ring-3 focus-visible:ring-ring motion-reduce:transition-none"
242
242
  ),
243
243
  children: [
244
- /* @__PURE__ */ e(
244
+ /* @__PURE__ */ t(
245
245
  "span",
246
246
  {
247
247
  "aria-hidden": !0,
@@ -249,11 +249,11 @@ const k = O(!1), E = O("rail"), B = l(
249
249
  "shrink-0 [&>svg]:size-3.5",
250
250
  s != null ? "text-danger" : "text-tertiary"
251
251
  ),
252
- children: h ?? (s != null ? /* @__PURE__ */ e(j, {}) : /* @__PURE__ */ e(_, {}))
252
+ children: h ?? (s != null ? /* @__PURE__ */ t(j, {}) : /* @__PURE__ */ t(_, {}))
253
253
  }
254
254
  ),
255
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-sm font-medium text-secondary", children: o }),
256
- r != null && /* @__PURE__ */ e(
255
+ /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-sm font-medium text-secondary", children: o }),
256
+ r != null && /* @__PURE__ */ t(
257
257
  y,
258
258
  {
259
259
  color: "default",
@@ -262,8 +262,8 @@ const k = O(!1), E = O("rail"), B = l(
262
262
  children: r
263
263
  }
264
264
  ),
265
- a != null && /* @__PURE__ */ e("span", { className: "shrink-0 text-xs text-tertiary tabular-nums", children: a }),
266
- /* @__PURE__ */ e(
265
+ a != null && /* @__PURE__ */ t("span", { className: "shrink-0 text-xs text-tertiary tabular-nums", children: a }),
266
+ /* @__PURE__ */ t(
267
267
  w,
268
268
  {
269
269
  "aria-hidden": !0,
@@ -276,7 +276,7 @@ const k = O(!1), E = O("rail"), B = l(
276
276
  ]
277
277
  }
278
278
  ) }),
279
- /* @__PURE__ */ e(
279
+ /* @__PURE__ */ t(
280
280
  T,
281
281
  {
282
282
  "data-slot": "chain-of-thought-evidence-content",
@@ -285,9 +285,9 @@ const k = O(!1), E = O("rail"), B = l(
285
285
  "data-[state=closed]:pointer-events-none data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:animate-out data-[state=open]:animate-in motion-reduce:animate-none"
286
286
  ),
287
287
  children: /* @__PURE__ */ c("div", { className: "flex flex-col gap-1.5 pt-1.5", children: [
288
- s != null && /* @__PURE__ */ e("p", { className: "text-xs text-danger", children: s }),
288
+ s != null && /* @__PURE__ */ t("p", { className: "text-xs text-danger", children: s }),
289
289
  d,
290
- t != null && /* @__PURE__ */ e("p", { className: "text-xs text-tertiary", children: t })
290
+ e != null && /* @__PURE__ */ t("p", { className: "text-xs text-tertiary", children: e })
291
291
  ] })
292
292
  }
293
293
  )
@@ -300,10 +300,10 @@ const k = O(!1), E = O("rail"), B = l(
300
300
  columns: o,
301
301
  rows: r,
302
302
  totalRows: a,
303
- flag: t,
303
+ flag: e,
304
304
  ...s
305
305
  }) => {
306
- const h = a != null && a > r.length, m = (t == null ? void 0 : t.color) ?? "default";
306
+ const h = a != null && a > r.length, m = (e == null ? void 0 : e.color) ?? "default";
307
307
  return /* @__PURE__ */ c(
308
308
  "div",
309
309
  {
@@ -311,8 +311,8 @@ const k = O(!1), E = O("rail"), B = l(
311
311
  className: n("overflow-hidden rounded-lg bg-surface", i),
312
312
  ...s,
313
313
  children: [
314
- /* @__PURE__ */ e("div", { className: "max-h-56 overflow-auto", children: /* @__PURE__ */ c("table", { className: "w-full border-collapse text-xs tabular-nums", children: [
315
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "text-tertiary", children: o.map((d) => /* @__PURE__ */ e(
314
+ /* @__PURE__ */ t("div", { className: "max-h-56 overflow-auto", children: /* @__PURE__ */ c("table", { className: "w-full border-collapse text-xs tabular-nums", children: [
315
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "text-tertiary", children: o.map((d) => /* @__PURE__ */ t(
316
316
  "th",
317
317
  {
318
318
  className: n(
@@ -323,9 +323,9 @@ const k = O(!1), E = O("rail"), B = l(
323
323
  },
324
324
  d.key
325
325
  )) }) }),
326
- /* @__PURE__ */ e("tbody", { children: r.map((d, p) => {
327
- const u = t != null && String(d[t.key]) === String(t.value);
328
- return /* @__PURE__ */ e("tr", { className: n(u && "bg-muted"), children: o.map((g, f) => /* @__PURE__ */ e(
326
+ /* @__PURE__ */ t("tbody", { children: r.map((d, p) => {
327
+ const u = e != null && String(d[e.key]) === String(e.value);
328
+ return /* @__PURE__ */ t("tr", { className: n(u && "bg-muted"), children: o.map((g, f) => /* @__PURE__ */ t(
329
329
  "td",
330
330
  {
331
331
  className: n(
@@ -353,7 +353,7 @@ const k = O(!1), E = O("rail"), B = l(
353
353
  );
354
354
  }
355
355
  ), Q = l(
356
- ({ className: i, role: o = "list", ...r }) => /* @__PURE__ */ e(
356
+ ({ className: i, role: o = "list", ...r }) => /* @__PURE__ */ t(
357
357
  "div",
358
358
  {
359
359
  "data-slot": "chain-of-thought-metrics",
@@ -374,37 +374,37 @@ const k = O(!1), E = O("rail"), B = l(
374
374
  label: o,
375
375
  value: r,
376
376
  sub: a,
377
- color: t = "default",
377
+ color: e = "default",
378
378
  role: s = "listitem",
379
379
  ...h
380
380
  }) => /* @__PURE__ */ c(
381
381
  "div",
382
382
  {
383
383
  "data-slot": "chain-of-thought-metric",
384
- "data-color": t,
384
+ "data-color": e,
385
385
  role: s,
386
386
  className: n("min-w-0", i),
387
387
  ...h,
388
388
  children: [
389
- /* @__PURE__ */ e("div", { className: "text-xs text-tertiary", children: o }),
390
- /* @__PURE__ */ e(
389
+ /* @__PURE__ */ t("div", { className: "text-xs text-tertiary", children: o }),
390
+ /* @__PURE__ */ t(
391
391
  "div",
392
392
  {
393
393
  className: n(
394
394
  "text-base font-semibold tabular-nums",
395
- V[t]
395
+ V[e]
396
396
  ),
397
397
  children: r
398
398
  }
399
399
  ),
400
- a != null && /* @__PURE__ */ e("div", { className: "text-xs text-tertiary", children: a })
400
+ a != null && /* @__PURE__ */ t("div", { className: "text-xs text-tertiary", children: a })
401
401
  ]
402
402
  }
403
403
  )
404
404
  ), Z = l(
405
405
  ({ className: i, children: o, caption: r, ...a }) => /* @__PURE__ */ c("div", { className: n("space-y-2", i), ...a, children: [
406
- /* @__PURE__ */ e("div", { className: "relative flex max-h-88 items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children: o }),
407
- r && /* @__PURE__ */ e("p", { className: "text-xs text-tertiary", children: r })
406
+ /* @__PURE__ */ t("div", { className: "relative flex max-h-88 items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children: o }),
407
+ r && /* @__PURE__ */ t("p", { className: "text-xs text-tertiary", children: r })
408
408
  ] })
409
409
  );
410
410
  B.displayName = "ChainOfThought";
@@ -1,3 +1,4 @@
1
+ export * from './agent-trace';
1
2
  export * from './chain-of-thought';
2
3
  export * from './chart';
3
4
  export * from './inline-citation';
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as o, jsxs as l } from "react/jsx-runtime";
3
3
  import { isValidElement as c } from "react";
4
- import { Collapsible as u, CollapsibleContent as m, CollapsibleTrigger as p } from "../collapsible.js";
4
+ import { Collapsible as u, CollapsibleTrigger as m, CollapsibleContent as p } from "../collapsible.js";
5
5
  import { Badge as f } from "../badge.js";
6
6
  import { Wrench as g, ChevronDown as h, CloseCircle as x, CheckCircle as b, Clock as N, CircleDashed as v } from "../../lib/icons.js";
7
7
  import { cn as n } from "../../lib/cn.js";
@@ -47,7 +47,7 @@ const S = ({
47
47
  state: a,
48
48
  ...i
49
49
  }) => /* @__PURE__ */ l(
50
- p,
50
+ m,
51
51
  {
52
52
  className: n(
53
53
  "group/tool-header flex w-full items-center justify-between gap-4 py-3 text-left transition-colors hover:text-primary motion-reduce:transition-none",
@@ -73,7 +73,7 @@ const S = ({
73
73
  );
74
74
  S.displayName = "ToolHeader";
75
75
  const j = ({ className: e, ...t }) => /* @__PURE__ */ o(
76
- m,
76
+ p,
77
77
  {
78
78
  className: n(
79
79
  "overflow-hidden text-foreground outline-none",