@actioneer/ads 0.2.2 → 0.2.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/bin/ads-init.mjs +176 -28
- package/components/ai-elements/chain-of-thought.d.ts +26 -19
- package/components/ai-elements/chain-of-thought.js +140 -150
- package/components/ai-elements/index.d.ts +0 -1
- package/components/ai-elements/message.d.ts +9 -4
- package/components/ai-elements/message.js +102 -88
- package/components/ai-elements/task-progress.js +69 -66
- package/components/answer.d.ts +3 -0
- package/components/answer.js +251 -212
- package/components/assistant-ui/composer-harness.js +24 -25
- package/components/assistant-ui/message.js +49 -36
- package/components/assistant-ui/primitives.d.ts +1 -1
- package/components/assistant-ui/thread-context.d.ts +2 -0
- package/components/assistant-ui/thread.js +33 -31
- package/components/chart.d.ts +64 -2
- package/components/chart.js +717 -456
- package/components/command-palette.d.ts +43 -0
- package/components/command-palette.js +146 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +383 -382
- package/components/sidebar.d.ts +4 -1
- package/components/sidebar.js +57 -55
- package/hooks/agents-ui/voice-visualizer-types.js +1 -0
- package/lib/icons.d.ts +12 -0
- package/lib/icons.js +97 -110
- package/lib/motion.js +47 -22
- package/lib/router.js +19 -0
- package/lib/utils.js +5 -0
- package/llms.txt +44 -34
- package/manifest.json +485 -186
- package/package.json +1 -1
- package/styles.css +10 -10
- package/theme.css +9 -9
- package/components/ai-elements/reasoning.d.ts +0 -26
- package/components/ai-elements/reasoning.js +0 -131
package/components/answer.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as i, jsx as
|
|
3
|
-
import * as
|
|
2
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import * as x from "react";
|
|
4
4
|
import { cva as E } from "class-variance-authority";
|
|
5
5
|
import { z as t } from "zod/v4";
|
|
6
|
-
import { Alert as
|
|
7
|
-
import { Badge as
|
|
8
|
-
import { Button as
|
|
9
|
-
import { FollowUpSuggestion as
|
|
10
|
-
import { AreaChart as
|
|
6
|
+
import { Alert as L, AlertTitle as B, AlertDescription as $ } from "./alert.js";
|
|
7
|
+
import { Badge as b } from "./badge.js";
|
|
8
|
+
import { Button as O } from "./button.js";
|
|
9
|
+
import { FollowUpSuggestion as V } from "./assistant-ui/follow-up-suggestions.js";
|
|
10
|
+
import { AreaChart as _, BarChart as z, LineChart as M } from "./chart.js";
|
|
11
11
|
import { Progress as P } from "./progress.js";
|
|
12
12
|
import { cn as c } from "../lib/cn.js";
|
|
13
|
-
const I = "render_answer", K = "Render the final answer with one curated ADS template. Choose the semantic kind that best matches the answer and provide only validated data; the application owns the layout.",
|
|
13
|
+
const I = "render_answer", K = "Render the final answer with one curated ADS template. Choose the semantic kind that best matches the answer and provide only validated data; the application owns the layout.", u = t.enum([
|
|
14
14
|
"default",
|
|
15
15
|
"primary",
|
|
16
16
|
"success",
|
|
17
17
|
"warning",
|
|
18
18
|
"danger",
|
|
19
19
|
"info"
|
|
20
|
-
]),
|
|
20
|
+
]), W = t.object({
|
|
21
21
|
id: t.string().min(1),
|
|
22
22
|
label: t.string().min(1),
|
|
23
23
|
prompt: t.string().min(1).optional()
|
|
24
|
-
}),
|
|
24
|
+
}), F = t.object({
|
|
25
25
|
id: t.string().min(1),
|
|
26
26
|
label: t.string().min(1),
|
|
27
27
|
description: t.string().optional()
|
|
28
|
-
}),
|
|
28
|
+
}), p = t.object({
|
|
29
29
|
label: t.string().optional(),
|
|
30
30
|
text: t.string().min(1),
|
|
31
|
-
tone:
|
|
32
|
-
}),
|
|
31
|
+
tone: u.optional()
|
|
32
|
+
}), f = {
|
|
33
33
|
eyebrow: t.string().optional(),
|
|
34
34
|
headline: t.string().min(1),
|
|
35
35
|
summary: t.string().optional(),
|
|
36
|
-
followUps: t.array(
|
|
37
|
-
sources: t.array(
|
|
36
|
+
followUps: t.array(W).max(3).optional(),
|
|
37
|
+
sources: t.array(F).max(8).optional()
|
|
38
38
|
}, A = t.object({
|
|
39
39
|
value: t.string().min(1),
|
|
40
40
|
detail: t.string().optional(),
|
|
41
|
-
tone:
|
|
42
|
-
}),
|
|
43
|
-
...
|
|
41
|
+
tone: u.optional()
|
|
42
|
+
}), H = t.object({
|
|
43
|
+
...f,
|
|
44
44
|
kind: t.literal("comparison"),
|
|
45
45
|
subjects: t.tuple([
|
|
46
46
|
t.object({ label: t.string().min(1), description: t.string().optional() }),
|
|
@@ -49,27 +49,28 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
49
49
|
rows: t.array(
|
|
50
50
|
t.object({
|
|
51
51
|
label: t.string().min(1),
|
|
52
|
+
description: t.string().min(1).optional().describe("Methodology, grain, or scope shown beneath the measure"),
|
|
52
53
|
values: t.tuple([A, A]),
|
|
53
54
|
delta: t.object({
|
|
54
55
|
value: t.string().min(1),
|
|
55
|
-
tone:
|
|
56
|
+
tone: u.optional()
|
|
56
57
|
}).optional()
|
|
57
58
|
})
|
|
58
59
|
).min(1).max(8),
|
|
59
|
-
takeaway:
|
|
60
|
-
}),
|
|
60
|
+
takeaway: p.optional()
|
|
61
|
+
}), k = t.enum([
|
|
61
62
|
"primary",
|
|
62
63
|
"success",
|
|
63
64
|
"warning",
|
|
64
65
|
"danger",
|
|
65
66
|
"info"
|
|
66
|
-
]),
|
|
67
|
+
]), q = t.discriminatedUnion("kind", [
|
|
67
68
|
t.object({
|
|
68
69
|
kind: t.literal("line"),
|
|
69
70
|
value: t.union([t.number(), t.string()]),
|
|
70
71
|
axis: t.enum(["x", "y"]).optional(),
|
|
71
72
|
label: t.string().optional(),
|
|
72
|
-
color:
|
|
73
|
+
color: k.optional()
|
|
73
74
|
}),
|
|
74
75
|
t.object({
|
|
75
76
|
kind: t.literal("band"),
|
|
@@ -77,7 +78,7 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
77
78
|
to: t.union([t.number(), t.string()]),
|
|
78
79
|
axis: t.enum(["x", "y"]).optional(),
|
|
79
80
|
label: t.string().optional(),
|
|
80
|
-
color:
|
|
81
|
+
color: k.optional()
|
|
81
82
|
}),
|
|
82
83
|
t.object({
|
|
83
84
|
kind: t.literal("point"),
|
|
@@ -85,38 +86,38 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
85
86
|
y: t.number(),
|
|
86
87
|
label: t.string().min(1),
|
|
87
88
|
description: t.string().optional(),
|
|
88
|
-
color:
|
|
89
|
+
color: k.optional()
|
|
89
90
|
})
|
|
90
|
-
]),
|
|
91
|
+
]), G = t.record(
|
|
91
92
|
t.string(),
|
|
92
93
|
t.union([t.string(), t.number(), t.null()])
|
|
93
|
-
),
|
|
94
|
-
...
|
|
94
|
+
), J = t.object({
|
|
95
|
+
...f,
|
|
95
96
|
kind: t.literal("trend"),
|
|
96
97
|
metric: t.object({
|
|
97
98
|
label: t.string().min(1),
|
|
98
99
|
value: t.string().min(1),
|
|
99
100
|
change: t.string().optional(),
|
|
100
|
-
tone:
|
|
101
|
+
tone: u.optional()
|
|
101
102
|
}).optional(),
|
|
102
103
|
chart: t.object({
|
|
103
104
|
type: t.enum(["line", "area", "bar"]),
|
|
104
|
-
data: t.array(
|
|
105
|
+
data: t.array(G).min(1).max(100),
|
|
105
106
|
categoryKey: t.string().min(1),
|
|
106
107
|
series: t.array(t.string().min(1)).min(1).max(4),
|
|
107
108
|
seriesLabels: t.record(t.string(), t.string()).optional(),
|
|
108
109
|
highlight: t.string().optional(),
|
|
109
110
|
unit: t.string().optional(),
|
|
110
|
-
annotations: t.array(
|
|
111
|
+
annotations: t.array(q).max(8).optional()
|
|
111
112
|
}),
|
|
112
|
-
insight:
|
|
113
|
-
}),
|
|
114
|
-
...
|
|
113
|
+
insight: p.optional()
|
|
114
|
+
}), Q = t.object({
|
|
115
|
+
...f,
|
|
115
116
|
kind: t.literal("status"),
|
|
116
117
|
overall: t.object({
|
|
117
118
|
label: t.string().min(1),
|
|
118
119
|
value: t.string().min(1),
|
|
119
|
-
tone:
|
|
120
|
+
tone: u.optional()
|
|
120
121
|
}).optional(),
|
|
121
122
|
items: t.array(
|
|
122
123
|
t.object({
|
|
@@ -124,12 +125,12 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
124
125
|
status: t.string().min(1),
|
|
125
126
|
detail: t.string().optional(),
|
|
126
127
|
meta: t.string().optional(),
|
|
127
|
-
tone:
|
|
128
|
+
tone: u.optional()
|
|
128
129
|
})
|
|
129
130
|
).min(1).max(12),
|
|
130
|
-
recommendation:
|
|
131
|
-
}),
|
|
132
|
-
...
|
|
131
|
+
recommendation: p.optional()
|
|
132
|
+
}), X = t.object({
|
|
133
|
+
...f,
|
|
133
134
|
kind: t.literal("breakdown"),
|
|
134
135
|
total: t.object({ label: t.string().min(1), value: t.string().min(1) }).optional(),
|
|
135
136
|
items: t.array(
|
|
@@ -138,12 +139,12 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
138
139
|
value: t.string().min(1),
|
|
139
140
|
share: t.number().min(0).max(100),
|
|
140
141
|
detail: t.string().optional(),
|
|
141
|
-
tone:
|
|
142
|
+
tone: u.optional()
|
|
142
143
|
})
|
|
143
144
|
).min(1).max(12),
|
|
144
|
-
insight:
|
|
145
|
-
}),
|
|
146
|
-
...
|
|
145
|
+
insight: p.optional()
|
|
146
|
+
}), Y = t.object({
|
|
147
|
+
...f,
|
|
147
148
|
kind: t.literal("explanation"),
|
|
148
149
|
sections: t.array(
|
|
149
150
|
t.object({
|
|
@@ -152,18 +153,18 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
152
153
|
bullets: t.array(t.string().min(1)).max(5).optional()
|
|
153
154
|
})
|
|
154
155
|
).min(1).max(6),
|
|
155
|
-
takeaway:
|
|
156
|
-
}),
|
|
157
|
-
|
|
158
|
-
G,
|
|
156
|
+
takeaway: p.optional()
|
|
157
|
+
}), Z = t.discriminatedUnion("kind", [
|
|
158
|
+
H,
|
|
159
159
|
J,
|
|
160
160
|
Q,
|
|
161
|
-
X
|
|
162
|
-
|
|
161
|
+
X,
|
|
162
|
+
Y
|
|
163
|
+
]), xt = {
|
|
163
164
|
name: I,
|
|
164
165
|
description: K,
|
|
165
|
-
inputSchema:
|
|
166
|
-
},
|
|
166
|
+
inputSchema: Z
|
|
167
|
+
}, v = E("font-semibold tabular-nums text-foreground", {
|
|
167
168
|
variants: {
|
|
168
169
|
tone: {
|
|
169
170
|
default: "text-foreground",
|
|
@@ -175,32 +176,32 @@ const I = "render_answer", K = "Render the final answer with one curated ADS tem
|
|
|
175
176
|
}
|
|
176
177
|
},
|
|
177
178
|
defaultVariants: { tone: "default" }
|
|
178
|
-
}),
|
|
179
|
+
}), U = new Intl.NumberFormat("en-US", {
|
|
179
180
|
notation: "compact",
|
|
180
181
|
maximumFractionDigits: 1
|
|
181
|
-
}),
|
|
182
|
-
function
|
|
182
|
+
}), tt = (e) => e === "success" || e === "warning" || e === "danger" || e === "info" ? e : "default", et = (e) => e === "success" || e === "warning" || e === "danger" || e === "info" ? e : "primary";
|
|
183
|
+
function y({ spec: e }) {
|
|
183
184
|
return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
184
|
-
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
|
|
185
|
+
e.eyebrow && /* @__PURE__ */ a("p", { className: "text-xs font-semibold uppercase tracking-wider text-tertiary", children: e.eyebrow }),
|
|
186
|
+
/* @__PURE__ */ a("h2", { className: "max-w-2xl text-xl font-bold leading-tight tracking-tight text-foreground", children: e.headline }),
|
|
187
|
+
e.summary && /* @__PURE__ */ a("p", { className: "max-w-2xl text-sm leading-6 text-secondary", children: e.summary })
|
|
187
188
|
] });
|
|
188
189
|
}
|
|
189
|
-
function
|
|
190
|
-
return /* @__PURE__ */ i(
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
190
|
+
function w({ signal: e }) {
|
|
191
|
+
return /* @__PURE__ */ i(L, { variant: tt(e.tone), children: [
|
|
192
|
+
/* @__PURE__ */ a(B, { children: e.label ?? "Takeaway" }),
|
|
193
|
+
/* @__PURE__ */ a($, { children: e.text })
|
|
193
194
|
] });
|
|
194
195
|
}
|
|
195
|
-
function
|
|
196
|
-
followUps:
|
|
196
|
+
function N({
|
|
197
|
+
followUps: e,
|
|
197
198
|
sources: r,
|
|
198
199
|
onFollowUp: s,
|
|
199
200
|
onSourceSelect: o
|
|
200
201
|
}) {
|
|
201
|
-
return !(
|
|
202
|
-
!!(
|
|
203
|
-
|
|
202
|
+
return !(e != null && e.length) && !(r != null && r.length) ? null : /* @__PURE__ */ i("div", { className: "space-y-3 pt-1", children: [
|
|
203
|
+
!!(e != null && e.length) && /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: e.map((l) => /* @__PURE__ */ a(
|
|
204
|
+
V,
|
|
204
205
|
{
|
|
205
206
|
type: "button",
|
|
206
207
|
disabled: !s,
|
|
@@ -210,10 +211,10 @@ function w({
|
|
|
210
211
|
l.id
|
|
211
212
|
)) }),
|
|
212
213
|
!!(r != null && r.length) && /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ a("span", { className: "mr-1 text-xs font-medium text-tertiary", children: "Sources" }),
|
|
214
215
|
r.map(
|
|
215
|
-
(l) => o ? /* @__PURE__ */
|
|
216
|
-
|
|
216
|
+
(l) => o ? /* @__PURE__ */ a(
|
|
217
|
+
O,
|
|
217
218
|
{
|
|
218
219
|
type: "button",
|
|
219
220
|
size: "xs",
|
|
@@ -224,64 +225,102 @@ function w({
|
|
|
224
225
|
children: l.label
|
|
225
226
|
},
|
|
226
227
|
l.id
|
|
227
|
-
) : /* @__PURE__ */
|
|
228
|
+
) : /* @__PURE__ */ a(b, { variant: "soft", title: l.description, children: l.label }, l.id)
|
|
228
229
|
)
|
|
229
230
|
] })
|
|
230
231
|
] });
|
|
231
232
|
}
|
|
232
|
-
const j =
|
|
233
|
+
const j = x.forwardRef(({ spec: e, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
|
|
233
234
|
"div",
|
|
234
235
|
{
|
|
235
|
-
ref:
|
|
236
|
-
"data-answer-kind":
|
|
236
|
+
ref: m,
|
|
237
|
+
"data-answer-kind": e.kind,
|
|
237
238
|
className: c("w-full max-w-2xl space-y-5", o),
|
|
238
239
|
...l,
|
|
239
240
|
children: [
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
241
|
+
/* @__PURE__ */ a(y, { spec: e }),
|
|
242
|
+
/* @__PURE__ */ a("div", { className: "overflow-x-auto rounded-2xl bg-surface p-2", children: /* @__PURE__ */ i("table", { className: "w-full min-w-[32rem] border-separate border-spacing-y-1 text-left", children: [
|
|
243
|
+
/* @__PURE__ */ a("caption", { className: "sr-only", children: e.headline }),
|
|
244
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ i("tr", { children: [
|
|
245
|
+
/* @__PURE__ */ a(
|
|
246
|
+
"th",
|
|
247
|
+
{
|
|
248
|
+
scope: "col",
|
|
249
|
+
className: "w-1/3 px-3 py-2 text-xs font-medium text-tertiary",
|
|
250
|
+
children: "Measure"
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
e.subjects.map((n) => /* @__PURE__ */ i(
|
|
254
|
+
"th",
|
|
255
|
+
{
|
|
256
|
+
scope: "col",
|
|
257
|
+
className: "px-3 py-2 align-bottom",
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ a("span", { className: "block text-sm font-semibold text-foreground", children: n.label }),
|
|
260
|
+
n.description && /* @__PURE__ */ a("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: n.description })
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
n.label
|
|
264
|
+
)),
|
|
265
|
+
/* @__PURE__ */ i("th", { scope: "col", className: "px-3 py-2 align-bottom", children: [
|
|
266
|
+
/* @__PURE__ */ a("span", { className: "block text-sm font-semibold text-foreground", children: "Difference" }),
|
|
267
|
+
/* @__PURE__ */ i("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: [
|
|
268
|
+
e.subjects[1].label,
|
|
269
|
+
" − ",
|
|
270
|
+
e.subjects[0].label
|
|
271
|
+
] })
|
|
272
|
+
] })
|
|
248
273
|
] }) }),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
274
|
+
/* @__PURE__ */ a("tbody", { children: e.rows.map((n) => {
|
|
275
|
+
const d = n.values[0].detail === n.values[1].detail ? n.values[0].detail : void 0, h = n.description ?? d;
|
|
276
|
+
return /* @__PURE__ */ i("tr", { className: "[&>*]:bg-muted/60", children: [
|
|
277
|
+
/* @__PURE__ */ i(
|
|
278
|
+
"th",
|
|
279
|
+
{
|
|
280
|
+
scope: "row",
|
|
281
|
+
className: "rounded-l-xl px-3 py-3 align-top text-left",
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ a("span", { className: "block text-sm font-medium text-secondary", children: n.label }),
|
|
284
|
+
h && /* @__PURE__ */ a("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: h })
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
n.values.map((g, D) => /* @__PURE__ */ a(
|
|
289
|
+
"td",
|
|
290
|
+
{
|
|
291
|
+
className: "px-3 py-3 align-top",
|
|
292
|
+
children: /* @__PURE__ */ a(
|
|
293
|
+
"span",
|
|
294
|
+
{
|
|
295
|
+
className: c(
|
|
296
|
+
v({ tone: g.tone }),
|
|
297
|
+
"block text-sm"
|
|
298
|
+
),
|
|
299
|
+
children: g.value
|
|
300
|
+
}
|
|
301
|
+
)
|
|
302
|
+
},
|
|
303
|
+
`${n.label}-${e.subjects[D].label}`
|
|
304
|
+
)),
|
|
305
|
+
/* @__PURE__ */ a("td", { className: "rounded-r-xl px-3 py-3 align-top", children: n.delta ? /* @__PURE__ */ a(
|
|
253
306
|
"span",
|
|
254
307
|
{
|
|
255
308
|
className: c(
|
|
256
|
-
|
|
257
|
-
"
|
|
309
|
+
v({ tone: n.delta.tone }),
|
|
310
|
+
"block text-sm"
|
|
258
311
|
),
|
|
259
312
|
children: n.delta.value
|
|
260
313
|
}
|
|
261
|
-
)
|
|
262
|
-
] })
|
|
263
|
-
|
|
264
|
-
"td",
|
|
265
|
-
{
|
|
266
|
-
className: c(
|
|
267
|
-
"px-3 py-3 align-top last:rounded-r-xl",
|
|
268
|
-
N({ tone: m.tone })
|
|
269
|
-
),
|
|
270
|
-
children: [
|
|
271
|
-
/* @__PURE__ */ e("span", { className: "block text-sm", children: m.value }),
|
|
272
|
-
m.detail && /* @__PURE__ */ e("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: m.detail })
|
|
273
|
-
]
|
|
274
|
-
},
|
|
275
|
-
`${n.label}-${a.subjects[u].label}`
|
|
276
|
-
))
|
|
277
|
-
] }, n.label)) })
|
|
314
|
+
) : /* @__PURE__ */ a("span", { "aria-label": "Not provided", className: "text-sm text-tertiary", children: "—" }) })
|
|
315
|
+
] }, n.label);
|
|
316
|
+
}) })
|
|
278
317
|
] }) }),
|
|
279
|
-
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
|
|
318
|
+
e.takeaway && /* @__PURE__ */ a(w, { signal: e.takeaway }),
|
|
319
|
+
/* @__PURE__ */ a(
|
|
320
|
+
N,
|
|
282
321
|
{
|
|
283
|
-
followUps:
|
|
284
|
-
sources:
|
|
322
|
+
followUps: e.followUps,
|
|
323
|
+
sources: e.sources,
|
|
285
324
|
onFollowUp: r,
|
|
286
325
|
onSourceSelect: s
|
|
287
326
|
}
|
|
@@ -290,53 +329,53 @@ const j = h.forwardRef(({ spec: a, onFollowUp: r, onSourceSelect: s, className:
|
|
|
290
329
|
}
|
|
291
330
|
));
|
|
292
331
|
j.displayName = "ComparisonAnswer";
|
|
293
|
-
const S =
|
|
294
|
-
({ spec:
|
|
295
|
-
const n =
|
|
296
|
-
() =>
|
|
297
|
-
[
|
|
298
|
-
),
|
|
299
|
-
data:
|
|
300
|
-
categoryKey:
|
|
301
|
-
series:
|
|
302
|
-
seriesLabels:
|
|
303
|
-
highlight:
|
|
304
|
-
annotations:
|
|
332
|
+
const S = x.forwardRef(
|
|
333
|
+
({ spec: e, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => {
|
|
334
|
+
const n = x.useMemo(
|
|
335
|
+
() => e.chart.unit ? (h) => `${U.format(h)}${e.chart.unit}` : void 0,
|
|
336
|
+
[e.chart.unit]
|
|
337
|
+
), d = {
|
|
338
|
+
data: e.chart.data,
|
|
339
|
+
categoryKey: e.chart.categoryKey,
|
|
340
|
+
series: e.chart.series,
|
|
341
|
+
seriesLabels: e.chart.seriesLabels,
|
|
342
|
+
highlight: e.chart.highlight,
|
|
343
|
+
annotations: e.chart.annotations,
|
|
305
344
|
formatValue: n,
|
|
306
345
|
height: 224
|
|
307
346
|
};
|
|
308
347
|
return /* @__PURE__ */ i(
|
|
309
348
|
"div",
|
|
310
349
|
{
|
|
311
|
-
ref:
|
|
312
|
-
"data-answer-kind":
|
|
350
|
+
ref: m,
|
|
351
|
+
"data-answer-kind": e.kind,
|
|
313
352
|
className: c("w-full max-w-2xl space-y-5", o),
|
|
314
353
|
...l,
|
|
315
354
|
children: [
|
|
316
355
|
/* @__PURE__ */ i("div", { className: "flex flex-col justify-between gap-4 sm:flex-row sm:items-end", children: [
|
|
317
|
-
/* @__PURE__ */
|
|
318
|
-
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
356
|
+
/* @__PURE__ */ a(y, { spec: e }),
|
|
357
|
+
e.metric && /* @__PURE__ */ i("div", { className: "shrink-0 rounded-xl bg-muted px-4 py-3 sm:text-right", children: [
|
|
358
|
+
/* @__PURE__ */ a("p", { className: "text-xs font-medium text-tertiary", children: e.metric.label }),
|
|
359
|
+
/* @__PURE__ */ a(
|
|
321
360
|
"p",
|
|
322
361
|
{
|
|
323
362
|
className: c(
|
|
324
|
-
|
|
363
|
+
v({ tone: e.metric.tone }),
|
|
325
364
|
"mt-1 text-2xl tracking-tight"
|
|
326
365
|
),
|
|
327
|
-
children:
|
|
366
|
+
children: e.metric.value
|
|
328
367
|
}
|
|
329
368
|
),
|
|
330
|
-
|
|
369
|
+
e.metric.change && /* @__PURE__ */ a("p", { className: "mt-0.5 text-xs text-secondary", children: e.metric.change })
|
|
331
370
|
] })
|
|
332
371
|
] }),
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
|
|
372
|
+
/* @__PURE__ */ a("div", { className: "rounded-2xl bg-surface px-3 pb-2 pt-4 sm:px-4", children: e.chart.type === "area" ? /* @__PURE__ */ a(_, { ...d }) : e.chart.type === "bar" ? /* @__PURE__ */ a(z, { ...d }) : /* @__PURE__ */ a(M, { ...d }) }),
|
|
373
|
+
e.insight && /* @__PURE__ */ a(w, { signal: e.insight }),
|
|
374
|
+
/* @__PURE__ */ a(
|
|
375
|
+
N,
|
|
337
376
|
{
|
|
338
|
-
followUps:
|
|
339
|
-
sources:
|
|
377
|
+
followUps: e.followUps,
|
|
378
|
+
sources: e.sources,
|
|
340
379
|
onFollowUp: r,
|
|
341
380
|
onSourceSelect: s
|
|
342
381
|
}
|
|
@@ -347,54 +386,54 @@ const S = h.forwardRef(
|
|
|
347
386
|
}
|
|
348
387
|
);
|
|
349
388
|
S.displayName = "TrendAnswer";
|
|
350
|
-
const C =
|
|
351
|
-
({ spec:
|
|
389
|
+
const C = x.forwardRef(
|
|
390
|
+
({ spec: e, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
|
|
352
391
|
"div",
|
|
353
392
|
{
|
|
354
|
-
ref:
|
|
355
|
-
"data-answer-kind":
|
|
393
|
+
ref: m,
|
|
394
|
+
"data-answer-kind": e.kind,
|
|
356
395
|
className: c("w-full max-w-2xl space-y-5", o),
|
|
357
396
|
...l,
|
|
358
397
|
children: [
|
|
359
398
|
/* @__PURE__ */ i("div", { className: "flex flex-col justify-between gap-3 sm:flex-row sm:items-start", children: [
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
|
|
362
|
-
|
|
399
|
+
/* @__PURE__ */ a(y, { spec: e }),
|
|
400
|
+
e.overall && /* @__PURE__ */ i(
|
|
401
|
+
b,
|
|
363
402
|
{
|
|
364
403
|
variant: "soft",
|
|
365
|
-
color:
|
|
404
|
+
color: e.overall.tone ?? "default",
|
|
366
405
|
className: "self-start",
|
|
367
406
|
children: [
|
|
368
|
-
|
|
407
|
+
e.overall.label,
|
|
369
408
|
" · ",
|
|
370
|
-
|
|
409
|
+
e.overall.value
|
|
371
410
|
]
|
|
372
411
|
}
|
|
373
412
|
)
|
|
374
413
|
] }),
|
|
375
|
-
/* @__PURE__ */
|
|
414
|
+
/* @__PURE__ */ a("ul", { className: "space-y-2", children: e.items.map((n) => /* @__PURE__ */ i(
|
|
376
415
|
"li",
|
|
377
416
|
{
|
|
378
417
|
className: "flex items-start justify-between gap-4 rounded-xl bg-surface px-4 py-3",
|
|
379
418
|
children: [
|
|
380
419
|
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
381
|
-
/* @__PURE__ */
|
|
382
|
-
n.detail && /* @__PURE__ */
|
|
420
|
+
/* @__PURE__ */ a("p", { className: "text-sm font-medium text-foreground", children: n.label }),
|
|
421
|
+
n.detail && /* @__PURE__ */ a("p", { className: "mt-1 text-xs leading-5 text-secondary", children: n.detail })
|
|
383
422
|
] }),
|
|
384
423
|
/* @__PURE__ */ i("div", { className: "shrink-0 text-right", children: [
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
n.meta && /* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ a(b, { variant: "dot", color: n.tone ?? "default", children: n.status }),
|
|
425
|
+
n.meta && /* @__PURE__ */ a("p", { className: "mt-1 text-xs tabular-nums text-tertiary", children: n.meta })
|
|
387
426
|
] })
|
|
388
427
|
]
|
|
389
428
|
},
|
|
390
429
|
n.label
|
|
391
430
|
)) }),
|
|
392
|
-
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
|
|
431
|
+
e.recommendation && /* @__PURE__ */ a(w, { signal: e.recommendation }),
|
|
432
|
+
/* @__PURE__ */ a(
|
|
433
|
+
N,
|
|
395
434
|
{
|
|
396
|
-
followUps:
|
|
397
|
-
sources:
|
|
435
|
+
followUps: e.followUps,
|
|
436
|
+
sources: e.sources,
|
|
398
437
|
onFollowUp: r,
|
|
399
438
|
onSourceSelect: s
|
|
400
439
|
}
|
|
@@ -404,54 +443,54 @@ const C = h.forwardRef(
|
|
|
404
443
|
)
|
|
405
444
|
);
|
|
406
445
|
C.displayName = "StatusAnswer";
|
|
407
|
-
const R =
|
|
446
|
+
const R = x.forwardRef(({ spec: e, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
|
|
408
447
|
"div",
|
|
409
448
|
{
|
|
410
|
-
ref:
|
|
411
|
-
"data-answer-kind":
|
|
449
|
+
ref: m,
|
|
450
|
+
"data-answer-kind": e.kind,
|
|
412
451
|
className: c("w-full max-w-2xl space-y-5", o),
|
|
413
452
|
...l,
|
|
414
453
|
children: [
|
|
415
454
|
/* @__PURE__ */ i("div", { className: "flex flex-col justify-between gap-3 sm:flex-row sm:items-end", children: [
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
455
|
+
/* @__PURE__ */ a(y, { spec: e }),
|
|
456
|
+
e.total && /* @__PURE__ */ i("div", { className: "shrink-0 sm:text-right", children: [
|
|
457
|
+
/* @__PURE__ */ a("p", { className: "text-xs font-medium text-tertiary", children: e.total.label }),
|
|
458
|
+
/* @__PURE__ */ a("p", { className: "mt-1 text-2xl font-semibold tabular-nums tracking-tight text-foreground", children: e.total.value })
|
|
420
459
|
] })
|
|
421
460
|
] }),
|
|
422
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ a("ol", { className: "space-y-2", children: e.items.map((n, d) => /* @__PURE__ */ i("li", { className: "rounded-xl bg-surface px-4 py-3", children: [
|
|
423
462
|
/* @__PURE__ */ i("div", { className: "mb-2 flex items-start justify-between gap-4", children: [
|
|
424
463
|
/* @__PURE__ */ i("div", { className: "flex min-w-0 items-start gap-2.5", children: [
|
|
425
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ a(b, { variant: "soft", className: "mt-0.5 tabular-nums", children: d + 1 }),
|
|
426
465
|
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
n.detail && /* @__PURE__ */
|
|
466
|
+
/* @__PURE__ */ a("p", { className: "text-sm font-medium text-foreground", children: n.label }),
|
|
467
|
+
n.detail && /* @__PURE__ */ a("p", { className: "mt-0.5 text-xs text-tertiary", children: n.detail })
|
|
429
468
|
] })
|
|
430
469
|
] }),
|
|
431
470
|
/* @__PURE__ */ i("div", { className: "shrink-0 text-right", children: [
|
|
432
|
-
/* @__PURE__ */
|
|
471
|
+
/* @__PURE__ */ a("p", { className: c(v({ tone: n.tone }), "text-sm"), children: n.value }),
|
|
433
472
|
/* @__PURE__ */ i("p", { className: "mt-0.5 text-xs tabular-nums text-tertiary", children: [
|
|
434
473
|
n.share,
|
|
435
474
|
"%"
|
|
436
475
|
] })
|
|
437
476
|
] })
|
|
438
477
|
] }),
|
|
439
|
-
/* @__PURE__ */
|
|
478
|
+
/* @__PURE__ */ a(
|
|
440
479
|
P,
|
|
441
480
|
{
|
|
442
481
|
value: n.share,
|
|
443
482
|
size: "sm",
|
|
444
|
-
color:
|
|
483
|
+
color: et(n.tone),
|
|
445
484
|
label: `${n.label}: ${n.share}%`
|
|
446
485
|
}
|
|
447
486
|
)
|
|
448
487
|
] }, n.label)) }),
|
|
449
|
-
|
|
450
|
-
/* @__PURE__ */
|
|
451
|
-
|
|
488
|
+
e.insight && /* @__PURE__ */ a(w, { signal: e.insight }),
|
|
489
|
+
/* @__PURE__ */ a(
|
|
490
|
+
N,
|
|
452
491
|
{
|
|
453
|
-
followUps:
|
|
454
|
-
sources:
|
|
492
|
+
followUps: e.followUps,
|
|
493
|
+
sources: e.sources,
|
|
455
494
|
onFollowUp: r,
|
|
456
495
|
onSourceSelect: s
|
|
457
496
|
}
|
|
@@ -460,41 +499,41 @@ const R = h.forwardRef(({ spec: a, onFollowUp: r, onSourceSelect: s, className:
|
|
|
460
499
|
}
|
|
461
500
|
));
|
|
462
501
|
R.displayName = "BreakdownAnswer";
|
|
463
|
-
const T =
|
|
502
|
+
const T = x.forwardRef(({ spec: e, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
|
|
464
503
|
"div",
|
|
465
504
|
{
|
|
466
|
-
ref:
|
|
467
|
-
"data-answer-kind":
|
|
505
|
+
ref: m,
|
|
506
|
+
"data-answer-kind": e.kind,
|
|
468
507
|
className: c("w-full max-w-2xl space-y-5", o),
|
|
469
508
|
...l,
|
|
470
509
|
children: [
|
|
471
|
-
/* @__PURE__ */
|
|
472
|
-
/* @__PURE__ */
|
|
473
|
-
var
|
|
510
|
+
/* @__PURE__ */ a(y, { spec: e }),
|
|
511
|
+
/* @__PURE__ */ a("ol", { className: "space-y-2", children: e.sections.map((n, d) => {
|
|
512
|
+
var h;
|
|
474
513
|
return /* @__PURE__ */ i("li", { className: "flex gap-3 rounded-xl bg-surface px-4 py-3.5", children: [
|
|
475
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ a(b, { variant: "soft", className: "mt-0.5 h-fit tabular-nums", children: d + 1 }),
|
|
476
515
|
/* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
477
|
-
/* @__PURE__ */
|
|
478
|
-
n.body && /* @__PURE__ */
|
|
479
|
-
!!((
|
|
480
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ a("h3", { className: "text-sm font-semibold text-foreground", children: n.title }),
|
|
517
|
+
n.body && /* @__PURE__ */ a("p", { className: "mt-1 text-sm leading-6 text-secondary", children: n.body }),
|
|
518
|
+
!!((h = n.bullets) != null && h.length) && /* @__PURE__ */ a("ul", { className: "mt-2 space-y-1.5", children: n.bullets.map((g) => /* @__PURE__ */ i("li", { className: "flex items-start gap-2 text-xs leading-5 text-secondary", children: [
|
|
519
|
+
/* @__PURE__ */ a(
|
|
481
520
|
"span",
|
|
482
521
|
{
|
|
483
522
|
"aria-hidden": !0,
|
|
484
523
|
className: "mt-2 size-1 shrink-0 rounded-dot bg-muted-foreground"
|
|
485
524
|
}
|
|
486
525
|
),
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
-
] },
|
|
526
|
+
/* @__PURE__ */ a("span", { children: g })
|
|
527
|
+
] }, g)) })
|
|
489
528
|
] })
|
|
490
529
|
] }, n.title);
|
|
491
530
|
}) }),
|
|
492
|
-
|
|
493
|
-
/* @__PURE__ */
|
|
494
|
-
|
|
531
|
+
e.takeaway && /* @__PURE__ */ a(w, { signal: e.takeaway }),
|
|
532
|
+
/* @__PURE__ */ a(
|
|
533
|
+
N,
|
|
495
534
|
{
|
|
496
|
-
followUps:
|
|
497
|
-
sources:
|
|
535
|
+
followUps: e.followUps,
|
|
536
|
+
sources: e.sources,
|
|
498
537
|
onFollowUp: r,
|
|
499
538
|
onSourceSelect: s
|
|
500
539
|
}
|
|
@@ -503,19 +542,19 @@ const T = h.forwardRef(({ spec: a, onFollowUp: r, onSourceSelect: s, className:
|
|
|
503
542
|
}
|
|
504
543
|
));
|
|
505
544
|
T.displayName = "ExplanationAnswer";
|
|
506
|
-
const at =
|
|
507
|
-
({ spec:
|
|
508
|
-
switch (
|
|
545
|
+
const at = x.forwardRef(
|
|
546
|
+
({ spec: e, ...r }, s) => {
|
|
547
|
+
switch (e.kind) {
|
|
509
548
|
case "comparison":
|
|
510
|
-
return /* @__PURE__ */
|
|
549
|
+
return /* @__PURE__ */ a(j, { ref: s, spec: e, ...r });
|
|
511
550
|
case "trend":
|
|
512
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ a(S, { ref: s, spec: e, ...r });
|
|
513
552
|
case "status":
|
|
514
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ a(C, { ref: s, spec: e, ...r });
|
|
515
554
|
case "breakdown":
|
|
516
|
-
return /* @__PURE__ */
|
|
555
|
+
return /* @__PURE__ */ a(R, { ref: s, spec: e, ...r });
|
|
517
556
|
case "explanation":
|
|
518
|
-
return /* @__PURE__ */
|
|
557
|
+
return /* @__PURE__ */ a(T, { ref: s, spec: e, ...r });
|
|
519
558
|
}
|
|
520
559
|
}
|
|
521
560
|
);
|
|
@@ -523,21 +562,21 @@ at.displayName = "AnswerRenderer";
|
|
|
523
562
|
export {
|
|
524
563
|
K as ANSWER_TOOL_DESCRIPTION,
|
|
525
564
|
I as ANSWER_TOOL_NAME,
|
|
526
|
-
|
|
565
|
+
W as AnswerFollowUpSchema,
|
|
527
566
|
at as AnswerRenderer,
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
567
|
+
p as AnswerSignalSchema,
|
|
568
|
+
F as AnswerSourceSchema,
|
|
569
|
+
Z as AnswerSpecSchema,
|
|
570
|
+
u as AnswerToneSchema,
|
|
532
571
|
R as BreakdownAnswer,
|
|
533
|
-
|
|
572
|
+
X as BreakdownAnswerSchema,
|
|
534
573
|
j as ComparisonAnswer,
|
|
535
|
-
|
|
574
|
+
H as ComparisonAnswerSchema,
|
|
536
575
|
T as ExplanationAnswer,
|
|
537
|
-
|
|
576
|
+
Y as ExplanationAnswerSchema,
|
|
538
577
|
C as StatusAnswer,
|
|
539
|
-
|
|
578
|
+
Q as StatusAnswerSchema,
|
|
540
579
|
S as TrendAnswer,
|
|
541
|
-
|
|
542
|
-
|
|
580
|
+
J as TrendAnswerSchema,
|
|
581
|
+
xt as answerTool
|
|
543
582
|
};
|