@actioneer/ads 0.3.0 → 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.
Files changed (35) hide show
  1. package/components/ai-elements/agent-trace.d.ts +87 -0
  2. package/components/ai-elements/agent-trace.js +180 -0
  3. package/components/ai-elements/chain-of-thought.d.ts +25 -5
  4. package/components/ai-elements/chain-of-thought.js +227 -183
  5. package/components/ai-elements/index.d.ts +1 -0
  6. package/components/ai-elements/research-activity.d.ts +17 -0
  7. package/components/ai-elements/research-activity.js +125 -107
  8. package/components/ai-elements/task.d.ts +7 -3
  9. package/components/ai-elements/task.js +84 -52
  10. package/components/ai-elements/tool.js +19 -19
  11. package/components/ai-elements/voice.d.ts +28 -12
  12. package/components/ai-elements/voice.js +270 -649
  13. package/components/alert.js +28 -16
  14. package/components/assistant-ui/composer-harness.js +5 -4
  15. package/components/code-block.d.ts +11 -5
  16. package/components/code-block.js +161 -62
  17. package/components/index.js +259 -257
  18. package/components/scroll-area.js +10 -10
  19. package/components/sidebar.js +1 -1
  20. package/components/stepper.d.ts +17 -9
  21. package/components/stepper.js +85 -96
  22. package/lib/icons.js +2 -2
  23. package/lib/motion.d.ts +2 -0
  24. package/lib/motion.js +21 -20
  25. package/llms.txt +7 -1
  26. package/manifest.json +69 -6
  27. package/package.json +1 -1
  28. package/styles.css +110 -4
  29. package/theme.css +12 -4
  30. package/components/agents-ui/agent-audio-visualizer-aura.d.ts +0 -11
  31. package/components/agents-ui/agent-audio-visualizer-aura.js +0 -277
  32. package/components/agents-ui/agent-audio-visualizer-wave.d.ts +0 -12
  33. package/components/agents-ui/agent-audio-visualizer-wave.js +0 -203
  34. package/components/agents-ui/react-shader-toy.d.ts +0 -87
  35. package/components/agents-ui/react-shader-toy.js +0 -531
@@ -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,13 +1,23 @@
1
1
  import { Badge } from '../badge';
2
2
  import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../collapsible';
3
3
  import { ComponentProps, ReactNode } from 'react';
4
+ /**
5
+ * How steps connect to one another.
6
+ * - `rail` — a short vertical segment between icons (the default).
7
+ * - `tree` — the Tree connector: a continuous rail with an elbow reaching
8
+ * EVERY step, so a nested trace reads as branches of its parent.
9
+ * - `none` — no connector; an outer structure carries the hierarchy.
10
+ */
11
+ export type ChainOfThoughtConnector = "rail" | "tree" | "none";
4
12
  /**
5
13
  * A step-first reasoning trace. The root is intentionally only a list: each
6
14
  * step owns its own disclosure so the trace does not need a redundant global
7
15
  * "Chain of Thought" trigger above it.
8
16
  */
9
- export type ChainOfThoughtProps = ComponentProps<"div">;
10
- export declare const ChainOfThought: import('react').MemoExoticComponent<({ className, role, ...props }: ChainOfThoughtProps) => import("react").JSX.Element>;
17
+ export type ChainOfThoughtProps = ComponentProps<"div"> & {
18
+ connector?: ChainOfThoughtConnector;
19
+ };
20
+ export declare const ChainOfThought: import('react').MemoExoticComponent<({ className, role, connector, children, ...props }: ChainOfThoughtProps) => import("react").JSX.Element>;
11
21
  /**
12
22
  * Step lifecycle mirrors the production work-trace statuses: steps stream in
13
23
  * as `active`, settle to `complete`, and surface failures as `error` — an
@@ -17,17 +27,27 @@ export type ChainOfThoughtStatus = "complete" | "active" | "pending" | "error";
17
27
  export type ChainOfThoughtStepProps = ComponentProps<typeof Collapsible> & {
18
28
  status?: ChainOfThoughtStatus;
19
29
  };
20
- export declare const ChainOfThoughtStep: import('react').MemoExoticComponent<({ className, defaultOpen, open: controlledOpen, onOpenChange, status, role, "aria-busy": ariaBusy, ...props }: ChainOfThoughtStepProps) => import("react").JSX.Element>;
30
+ export declare const ChainOfThoughtStep: import('react').MemoExoticComponent<({ className, defaultOpen, open: controlledOpen, onOpenChange, status, role, "aria-busy": ariaBusy, children, ...props }: ChainOfThoughtStepProps) => import("react").JSX.Element>;
21
31
  export type ChainOfThoughtTriggerProps = Omit<ComponentProps<typeof CollapsibleTrigger>, "asChild" | "children"> & {
22
32
  children: ReactNode;
23
33
  /** Semantic icon rendered on the reasoning rail. */
24
34
  leftIcon?: ReactNode;
25
35
  /** Optional trailing metadata such as elapsed time. */
26
36
  endContent?: ReactNode;
27
- /** Swap the semantic icon for a disclosure affordance on hover. */
37
+ /**
38
+ * Show the disclosure caret at the row's trailing edge, next to
39
+ * `endContent` — the same anatomy as `TaskTrigger`, so a nested trace reads
40
+ * consistently at both levels. With the caret on, the leading icon keeps its
41
+ * meaning instead of being swapped for an affordance.
42
+ */
43
+ caret?: boolean;
44
+ /**
45
+ * Swap the semantic icon for a disclosure affordance on hover. Ignored when
46
+ * `caret` is set — one affordance per row.
47
+ */
28
48
  swapIconOnHover?: boolean;
29
49
  };
30
- export declare const ChainOfThoughtTrigger: import('react').MemoExoticComponent<({ className, children, leftIcon, endContent, swapIconOnHover, ...props }: ChainOfThoughtTriggerProps) => import("react").JSX.Element>;
50
+ export declare const ChainOfThoughtTrigger: import('react').MemoExoticComponent<({ className, children, leftIcon, endContent, caret, swapIconOnHover, ...props }: ChainOfThoughtTriggerProps) => import("react").JSX.Element>;
31
51
  export type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;
32
52
  export declare const ChainOfThoughtContent: import('react').MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtContentProps) => import("react").JSX.Element>;
33
53
  export type ChainOfThoughtItemProps = ComponentProps<"div">;