@agentage/components 0.21.1 → 0.22.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.
- package/README.md +4 -0
- package/dist/components/accordion.trigger.js +1 -1
- package/dist/components/approval-bar.d.ts +14 -0
- package/dist/components/approval-bar.d.ts.map +1 -0
- package/dist/components/approval-bar.js +40 -0
- package/dist/components/chat.icons.d.ts +6 -0
- package/dist/components/chat.icons.d.ts.map +1 -0
- package/dist/components/chat.icons.js +23 -0
- package/dist/components/check-list.js +1 -1
- package/dist/components/code-block.body.d.ts +7 -0
- package/dist/components/code-block.body.d.ts.map +1 -0
- package/dist/components/code-block.body.js +24 -0
- package/dist/components/code-block.d.ts +5 -1
- package/dist/components/code-block.d.ts.map +1 -1
- package/dist/components/code-block.js +39 -37
- package/dist/components/context-meter.d.ts +16 -0
- package/dist/components/context-meter.d.ts.map +1 -0
- package/dist/components/context-meter.js +58 -0
- package/dist/components/conversation.d.ts +13 -0
- package/dist/components/conversation.d.ts.map +1 -0
- package/dist/components/conversation.js +61 -0
- package/dist/components/data-table.variants.d.ts.map +1 -1
- package/dist/components/data-table.variants.js +2 -2
- package/dist/components/data-view.board-card.d.ts.map +1 -1
- package/dist/components/data-view.board-card.js +1 -1
- package/dist/components/description-list.property.js +1 -1
- package/dist/components/group-header.js +1 -1
- package/dist/components/index.d.ts +18 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +10 -1
- package/dist/components/log-view.row.d.ts.map +1 -1
- package/dist/components/log-view.row.js +26 -27
- package/dist/components/markdown.d.ts +11 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +21 -0
- package/dist/components/markdown.parts.d.ts +4 -0
- package/dist/components/markdown.parts.d.ts.map +1 -0
- package/dist/components/markdown.parts.js +91 -0
- package/dist/components/menu.variants.js +1 -1
- package/dist/components/message.d.ts +10 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +22 -0
- package/dist/components/prompt-input.d.ts +22 -0
- package/dist/components/prompt-input.d.ts.map +1 -0
- package/dist/components/prompt-input.js +59 -0
- package/dist/components/reasoning.d.ts +13 -0
- package/dist/components/reasoning.d.ts.map +1 -0
- package/dist/components/reasoning.js +43 -0
- package/dist/components/row.variants.d.ts.map +1 -1
- package/dist/components/row.variants.js +1 -1
- package/dist/components/table.js +1 -1
- package/dist/components/tool-call.d.ts +25 -0
- package/dist/components/tool-call.d.ts.map +1 -0
- package/dist/components/tool-call.js +52 -0
- package/dist/components/tool-call.parts.d.ts +29 -0
- package/dist/components/tool-call.parts.d.ts.map +1 -0
- package/dist/components/tool-call.parts.js +96 -0
- package/dist/components/tool-group.d.ts +20 -0
- package/dist/components/tool-group.d.ts.map +1 -0
- package/dist/components/tool-group.js +49 -0
- package/dist/index.js +10 -1
- package/dist/lib/highlight-code.d.ts +9 -0
- package/dist/lib/highlight-code.d.ts.map +1 -0
- package/dist/lib/highlight-code.js +67 -0
- package/dist/lib/utils.d.ts +4 -4
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/package.json +40 -4
- package/src/styles/syntax.css +92 -0
- package/src/styles/theme.css +3 -0
- package/src/styles/tokens.css +68 -0
package/dist/components/index.js
CHANGED
|
@@ -92,4 +92,13 @@ import { ActionBar as qt } from "./action-bar.js";
|
|
|
92
92
|
import { Alert as Jt } from "./alert.js";
|
|
93
93
|
import { DirtyBar as Yt } from "./dirty-bar.js";
|
|
94
94
|
import { ToastProvider as Xt, useToast as Zt } from "./toast.js";
|
|
95
|
-
|
|
95
|
+
import { ApprovalBar as Qt } from "./approval-bar.js";
|
|
96
|
+
import { ContextMeter as $t, meterTone as en } from "./context-meter.js";
|
|
97
|
+
import { Conversation as tn } from "./conversation.js";
|
|
98
|
+
import { Markdown as nn } from "./markdown.js";
|
|
99
|
+
import { Message as rn } from "./message.js";
|
|
100
|
+
import { PromptInput as an } from "./prompt-input.js";
|
|
101
|
+
import { Reasoning as on } from "./reasoning.js";
|
|
102
|
+
import { ToolCall as sn } from "./tool-call.js";
|
|
103
|
+
import { ToolGroup as cn } from "./tool-group.js";
|
|
104
|
+
export { Pe as Accordion, Fe as AccordionContent, Ie as AccordionItem, at as AccordionTrigger, qt as ActionBar, Je as ActiveFilters, Jt as Alert, Qt as ApprovalBar, e as Avatar, t as Badge, R as Breadcrumb, z as BreadcrumbItem, B as BreadcrumbLink, V as BreadcrumbList, H as BreadcrumbPage, U as BreadcrumbSeparator, r as Button, He as Card, Re as CardAction, Ue as CardContent, ze as CardDescription, We as CardFooter, Be as CardHeader, Le as CardMeta, Ve as CardTitle, Xe as CheckItem, Ze as CheckList, v as Checkbox, i as Chip, Qe as CodeBlock, tt as Collapsible, nt as CollapsibleContent, rt as CollapsibleTrigger, Dt as Command, jt as CommandEmpty, Mt as CommandGroup, Nt as CommandItem, Pt as CommandSeparator, it as ContentBlocks, $t as ContextMeter, tn as Conversation, a as CopyButton, ae as DataTree, oe as DataView, x as DatePicker, ot as DescriptionDetail, st as DescriptionGroup, ct as DescriptionList, lt as DescriptionTerm, Ot as Dialog, kt as DialogFooter, Yt as DirtyBar, ce as Disclosure, qe as DisplayMenu, At as DropdownMenu, he as DropdownMenuCheckboxItem, ge as DropdownMenuItem, _e as DropdownMenuLabel, ve as DropdownMenuRadioGroup, ye as DropdownMenuRadioItem, be as DropdownMenuSeparator, Ae as EMPTY_LIST_CONTROLS, _t as EmptyState, Ke as FilterMenu, S as FormField, ue as GroupHeader, o as IconButton, $e as InlineCode, C as InlineEdit, w as Input, s as Kbd, E as Label, le as List, et as ListRow, de as ListToolbar, fe as ListToolbarEnd, me as LogView, nn as Markdown, rn as Message, K as MetaItem, xt as MiniBars, W as NavRow, G as NavTree, c as PRIORITY_LABEL, q as PageHeader, J as Pagination, Ft as Popover, l as PriorityGlyph, vt as Progress, an as PromptInput, ut as Property, pt as PropertyDate, ht as PropertyMultiSelect, gt as PropertySelect, dt as PropertyText, ft as PropertyValue, u as Prose, D as RadioGroup, O as RadioGroupItem, on as Reasoning, yt as RelativeTime, Bt as ResizableHandle, Vt as ResizablePanel, It as ResizablePanelGroup, Ht as ResizableSplit, Wt as ResizableSplitPrepaint, k as SecretInput, A as Section, Y as SectionIndex, j as SectionLabel, M as Select, Gt as Sheet, X as Sidebar, Z as SidebarContent, Q as SidebarFooter, $ as SidebarGroup, ee as SidebarGroupLabel, te as SidebarHeader, d as Skeleton, St as Sparkline, f as Spinner, Ct as StatCard, wt as StatusBar, p as StatusGlyph, Tt as Step, Et as StepList, N as Switch, xe as Table, Se as TableBody, Ce as TableCaption, we as TableCell, Te as TableFooter, Ee as TableHead, De as TableHeader, Oe as TableRow, ne as Tabs, re as TabsContent, ie as TabsList, se as TabsTrigger, T as Textarea, Xt as ToastProvider, P as ToggleButton, F as ToggleGroup, sn as ToolCall, cn as ToolGroup, Ge as ToolbarSearch, pe as ToolbarToggle, Kt as Tooltip, I as TreeSelect, ke as Truncate, Ye as ViewSwitch, je as activeFilterCount, g as activeSection, m as announce, Me as applyListControls, n as buttonVariants, L as describeCron, mt as formatPropertyDate, bt as formatRelativeTime, en as meterTone, y as parseRelativeRange, Lt as resizableSplitCollapsedVar, Rt as resizableSplitPrepaint, zt as resizableSplitVar, b as resolveDateRange, h as useAnnounce, Ne as useListControls, Ut as useResizableSplit, _ as useScrollSpy, Zt as useToast };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-view.row.d.ts","sourceRoot":"","sources":["../../src/components/log-view.row.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAsB5F,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,UAAU,GAAG,UAAU,GAAG,KAAK,CAAC;IAC1C,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;
|
|
1
|
+
{"version":3,"file":"log-view.row.d.ts","sourceRoot":"","sources":["../../src/components/log-view.row.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AAsB5F,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,aAAa,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,UAAU,GAAG,UAAU,GAAG,KAAK,CAAC;IAC1C,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,oGAAoG;AACpG,eAAO,MAAM,MAAM,wGAC2D,WAAW,uBAgFxF,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,sGAAsG;AACtG,eAAO,MAAM,SAAS,GAAI,uCAAuC,cAAc,sBA+B9E,CAAC"}
|
|
@@ -23,60 +23,59 @@ var d = {
|
|
|
23
23
|
success: "success",
|
|
24
24
|
warning: "warning",
|
|
25
25
|
destructive: "destructive"
|
|
26
|
-
}, p =
|
|
27
|
-
let
|
|
26
|
+
}, p = c.memo(({ id: n, line: c, index: p, style: h, top: g, height: _, wrap: v, showTime: y, showSource: b, ...x }) => {
|
|
27
|
+
let S = 3 + +!!y + +!!b;
|
|
28
28
|
return /* @__PURE__ */ u("div", {
|
|
29
29
|
id: n,
|
|
30
30
|
role: "row",
|
|
31
|
-
"aria-rowindex":
|
|
32
|
-
"aria-selected":
|
|
31
|
+
"aria-rowindex": p + 1,
|
|
32
|
+
"aria-selected": x.active,
|
|
33
33
|
"data-level": c.level,
|
|
34
34
|
"data-line": c.id,
|
|
35
|
-
style:
|
|
35
|
+
style: g === void 0 ? void 0 : {
|
|
36
36
|
position: "absolute",
|
|
37
|
-
top:
|
|
37
|
+
top: g,
|
|
38
38
|
left: 0,
|
|
39
39
|
right: 0
|
|
40
40
|
},
|
|
41
41
|
className: "group/log",
|
|
42
42
|
children: [/* @__PURE__ */ u("div", {
|
|
43
|
-
onClick: () =>
|
|
44
|
-
style:
|
|
45
|
-
className: t("relative flex cursor-pointer items-start gap-2 px-2 font-mono text-xs leading-6 hover:bg-accent", e,
|
|
43
|
+
onClick: () => x.onPick(c.id),
|
|
44
|
+
style: v ? { minHeight: _ } : { height: _ },
|
|
45
|
+
className: t("relative flex cursor-pointer items-start gap-2 px-2 font-mono text-xs leading-6 hover:bg-accent", e, v && "[content-visibility:auto] [contain-intrinsic-size:auto_24px]", x.active && [
|
|
46
46
|
"bg-accent",
|
|
47
|
-
"
|
|
48
|
-
p,
|
|
47
|
+
"on-accent",
|
|
49
48
|
"before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-primary"
|
|
50
49
|
]),
|
|
51
50
|
children: [
|
|
52
51
|
/* @__PURE__ */ l("span", {
|
|
53
52
|
role: "gridcell",
|
|
54
|
-
"aria-expanded":
|
|
53
|
+
"aria-expanded": x.expanded,
|
|
55
54
|
className: "flex h-6 w-3.5 shrink-0 items-center",
|
|
56
55
|
children: /* @__PURE__ */ l(s, {
|
|
57
|
-
shape:
|
|
58
|
-
tone: f[
|
|
59
|
-
label:
|
|
56
|
+
shape: h.shape,
|
|
57
|
+
tone: f[h.tone],
|
|
58
|
+
label: h.label ?? c.level
|
|
60
59
|
})
|
|
61
60
|
}),
|
|
62
|
-
|
|
61
|
+
y && /* @__PURE__ */ l("span", {
|
|
63
62
|
role: "gridcell",
|
|
64
63
|
className: "shrink-0 text-muted-foreground",
|
|
65
64
|
children: c.time !== void 0 && /* @__PURE__ */ l(o, {
|
|
66
65
|
value: c.time,
|
|
67
|
-
format:
|
|
66
|
+
format: y,
|
|
68
67
|
className: "font-mono"
|
|
69
68
|
})
|
|
70
69
|
}),
|
|
71
|
-
|
|
70
|
+
b && /* @__PURE__ */ l("span", {
|
|
72
71
|
role: "gridcell",
|
|
73
72
|
className: "w-24 shrink-0 truncate text-muted-foreground",
|
|
74
73
|
children: c.source
|
|
75
74
|
}),
|
|
76
75
|
/* @__PURE__ */ l("span", {
|
|
77
76
|
role: "gridcell",
|
|
78
|
-
className: t("min-w-0 flex-1",
|
|
79
|
-
children: i(c.message,
|
|
77
|
+
className: t("min-w-0 flex-1", v ? "break-words whitespace-pre-wrap" : "truncate whitespace-pre", d[h.tone]),
|
|
78
|
+
children: i(c.message, x.highlight)
|
|
80
79
|
}),
|
|
81
80
|
/* @__PURE__ */ l("span", {
|
|
82
81
|
role: "gridcell",
|
|
@@ -87,17 +86,17 @@ var d = {
|
|
|
87
86
|
})
|
|
88
87
|
})
|
|
89
88
|
]
|
|
90
|
-
}),
|
|
89
|
+
}), x.expanded && /* @__PURE__ */ l(m, {
|
|
91
90
|
id: c.id,
|
|
92
91
|
fields: c.fields,
|
|
93
|
-
index:
|
|
94
|
-
cols:
|
|
95
|
-
onHeight:
|
|
92
|
+
index: p,
|
|
93
|
+
cols: S,
|
|
94
|
+
onHeight: x.onHeight
|
|
96
95
|
})]
|
|
97
96
|
});
|
|
98
97
|
});
|
|
99
|
-
|
|
100
|
-
var
|
|
98
|
+
p.displayName = "LogRow";
|
|
99
|
+
var m = ({ id: e, fields: t, index: r, cols: i, onHeight: a }) => {
|
|
101
100
|
let o = c.useRef(null);
|
|
102
101
|
return c.useLayoutEffect(() => {
|
|
103
102
|
let t = o.current;
|
|
@@ -124,4 +123,4 @@ var g = ({ id: e, fields: t, index: r, cols: i, onHeight: a }) => {
|
|
|
124
123
|
})
|
|
125
124
|
});
|
|
126
125
|
};
|
|
127
|
-
export {
|
|
126
|
+
export { m as LogDetail, p as LogRow };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface MarkdownProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
/** The markdown text. Raw HTML in it shows as text; it is never rendered. */
|
|
4
|
+
children: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A markdown answer: headings, lists, inline code, links, tables and fenced code highlighted by
|
|
8
|
+
* its language. Safe to re-render with a growing string while it streams.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Markdown: React.ForwardRefExoticComponent<MarkdownProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/components/markdown.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC3F,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,sFAgBpB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { MARKDOWN_COMPONENTS as t } from "./markdown.parts.js";
|
|
4
|
+
import * as n from "react";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import i from "react-markdown";
|
|
7
|
+
import a from "remark-gfm";
|
|
8
|
+
// src/components/markdown.tsx
|
|
9
|
+
var o = [a], s = n.forwardRef(({ children: n, className: a, ...s }, c) => /* @__PURE__ */ r("div", {
|
|
10
|
+
ref: c,
|
|
11
|
+
className: e("flex min-w-0 flex-col gap-2 text-ui leading-[1.55] text-foreground [overflow-wrap:anywhere]", a),
|
|
12
|
+
"data-slot": "markdown",
|
|
13
|
+
...s,
|
|
14
|
+
children: /* @__PURE__ */ r(i, {
|
|
15
|
+
remarkPlugins: o,
|
|
16
|
+
components: t,
|
|
17
|
+
children: n
|
|
18
|
+
})
|
|
19
|
+
}));
|
|
20
|
+
s.displayName = "Markdown";
|
|
21
|
+
export { s as Markdown };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.parts.d.ts","sourceRoot":"","sources":["../../src/components/markdown.parts.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,gBAAgB,CAAC;AAoC7D,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,EAAE,UA0DjC,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { CodeBlock as t, InlineCode as n } from "./code-block.js";
|
|
4
|
+
import { TableBody as r, TableCell as i, TableHead as a, TableHeader as o, TableRow as s } from "./table.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
7
|
+
// src/components/markdown.parts.tsx
|
|
8
|
+
var l = (e) => e.type === "text" ? e.value : "children" in e ? e.children.map(l).join("") : "", u = "m-0 mt-1 text-sm font-semibold leading-snug text-foreground", d = ({ node: e }) => {
|
|
9
|
+
let n = e?.children.find((e) => e.type === "element" && e.tagName === "code"), r = n?.type === "element" ? n.properties.className : void 0, i = Array.isArray(r) ? r.map(String).find((e) => e.startsWith("language-"))?.slice(9) : void 0, a = n ? l(n).replace(/\n$/, "") : "";
|
|
10
|
+
return /* @__PURE__ */ c(t, {
|
|
11
|
+
code: a,
|
|
12
|
+
language: i
|
|
13
|
+
});
|
|
14
|
+
}, f = (t, n) => ({ node: r, className: i, ...a }) => /* @__PURE__ */ c(t, {
|
|
15
|
+
className: e("h-7 px-2.5", n, i),
|
|
16
|
+
...a
|
|
17
|
+
}), p = {
|
|
18
|
+
h1: ({ node: e, children: t, ...n }) => /* @__PURE__ */ c("h2", {
|
|
19
|
+
className: u,
|
|
20
|
+
...n,
|
|
21
|
+
children: t
|
|
22
|
+
}),
|
|
23
|
+
h2: ({ node: e, children: t, ...n }) => /* @__PURE__ */ c("h3", {
|
|
24
|
+
className: u,
|
|
25
|
+
...n,
|
|
26
|
+
children: t
|
|
27
|
+
}),
|
|
28
|
+
h3: ({ node: e, children: t, ...n }) => /* @__PURE__ */ c("h4", {
|
|
29
|
+
className: u,
|
|
30
|
+
...n,
|
|
31
|
+
children: t
|
|
32
|
+
}),
|
|
33
|
+
h4: ({ node: e, children: t, ...n }) => /* @__PURE__ */ c("h5", {
|
|
34
|
+
className: u,
|
|
35
|
+
...n,
|
|
36
|
+
children: t
|
|
37
|
+
}),
|
|
38
|
+
p: ({ node: e, ...t }) => /* @__PURE__ */ c("p", {
|
|
39
|
+
className: "m-0",
|
|
40
|
+
...t
|
|
41
|
+
}),
|
|
42
|
+
ul: ({ node: e, ...t }) => /* @__PURE__ */ c("ul", {
|
|
43
|
+
className: "m-0 list-disc pl-[18px]",
|
|
44
|
+
...t
|
|
45
|
+
}),
|
|
46
|
+
ol: ({ node: e, ...t }) => /* @__PURE__ */ c("ol", {
|
|
47
|
+
className: "m-0 list-decimal pl-[18px]",
|
|
48
|
+
...t
|
|
49
|
+
}),
|
|
50
|
+
li: ({ node: e, ...t }) => /* @__PURE__ */ c("li", {
|
|
51
|
+
className: "my-0.5",
|
|
52
|
+
...t
|
|
53
|
+
}),
|
|
54
|
+
a: ({ node: e, children: t, ...n }) => /* @__PURE__ */ c("a", {
|
|
55
|
+
className: "rounded-sm text-primary-emphasis underline underline-offset-4 hover:text-foreground focus-ring",
|
|
56
|
+
rel: "noreferrer",
|
|
57
|
+
...n,
|
|
58
|
+
children: t
|
|
59
|
+
}),
|
|
60
|
+
strong: ({ node: e, ...t }) => /* @__PURE__ */ c("strong", {
|
|
61
|
+
className: "font-semibold",
|
|
62
|
+
...t
|
|
63
|
+
}),
|
|
64
|
+
blockquote: ({ node: e, ...t }) => /* @__PURE__ */ c("blockquote", {
|
|
65
|
+
className: "m-0 border-l-2 border-border pl-3 text-muted-foreground",
|
|
66
|
+
...t
|
|
67
|
+
}),
|
|
68
|
+
hr: () => /* @__PURE__ */ c("hr", { className: "my-1 border-0 border-t border-border" }),
|
|
69
|
+
code: ({ node: t, className: r, ...i }) => /* @__PURE__ */ c(n, {
|
|
70
|
+
className: e("bg-accent", r),
|
|
71
|
+
...i
|
|
72
|
+
}),
|
|
73
|
+
pre: d,
|
|
74
|
+
table: ({ node: e, ...t }) => /* @__PURE__ */ c("div", {
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
className: "min-w-0 overflow-x-auto rounded-lg border border-border focus-ring",
|
|
77
|
+
children: /* @__PURE__ */ c("table", {
|
|
78
|
+
className: "w-full border-collapse text-xs",
|
|
79
|
+
...t
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
thead: ({ node: e, ...t }) => /* @__PURE__ */ c(o, { ...t }),
|
|
83
|
+
tbody: ({ node: e, ...t }) => /* @__PURE__ */ c(r, { ...t }),
|
|
84
|
+
tr: ({ node: e, ...t }) => /* @__PURE__ */ c(s, {
|
|
85
|
+
className: "hover:bg-transparent",
|
|
86
|
+
...t
|
|
87
|
+
}),
|
|
88
|
+
th: f(a, "static bg-card font-semibold"),
|
|
89
|
+
td: f(i, "whitespace-nowrap")
|
|
90
|
+
};
|
|
91
|
+
export { p as MARKDOWN_COMPONENTS };
|
|
@@ -5,7 +5,7 @@ var n = t(["z-[var(--z-dropdown,100)] min-w-52.5 rounded-lg border border-border
|
|
|
5
5
|
"flex h-7 w-full items-center gap-2.5 rounded-md px-2.5 text-ui cursor-pointer transition-colors duration-fast",
|
|
6
6
|
"focus-ring focus:bg-accent focus:text-accent-foreground",
|
|
7
7
|
e,
|
|
8
|
-
"focus:
|
|
8
|
+
"focus:on-accent"
|
|
9
9
|
], {
|
|
10
10
|
variants: { variant: {
|
|
11
11
|
default: "text-popover-foreground hover:bg-accent hover:text-accent-foreground",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface MessageProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** `user`: a bubble on the right. `assistant` (default): flat text across the column. */
|
|
4
|
+
from?: 'user' | 'assistant';
|
|
5
|
+
/** A row of small icon buttons under the message, for example Copy and Retry. */
|
|
6
|
+
actions?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/** One turn in a conversation. The body is any content: text, Markdown, tool calls. */
|
|
9
|
+
export declare const Message: React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/components/message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACxE,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC5B,iFAAiF;IACjF,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,uFAAuF;AACvF,eAAO,MAAM,OAAO,qFA+BnB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cn as e } from "../lib/utils.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
// src/components/message.tsx
|
|
5
|
+
var i = t.forwardRef(({ from: t = "assistant", actions: i, className: a, children: o, ...s }, c) => /* @__PURE__ */ r("div", {
|
|
6
|
+
ref: c,
|
|
7
|
+
className: e("flex min-w-0 flex-col gap-1 text-ui leading-normal [overflow-wrap:anywhere]", t === "user" && "items-end", a),
|
|
8
|
+
"data-slot": "message",
|
|
9
|
+
"data-from": t,
|
|
10
|
+
...s,
|
|
11
|
+
children: [/* @__PURE__ */ n("div", {
|
|
12
|
+
className: e("flex min-w-0 flex-col gap-3", t === "user" ? "max-w-[85%] rounded-lg bg-accent px-2.5 py-2 text-accent-foreground" : "w-full text-foreground"),
|
|
13
|
+
"data-slot": "message-body",
|
|
14
|
+
children: o
|
|
15
|
+
}), i && /* @__PURE__ */ n("div", {
|
|
16
|
+
className: "-ml-1 flex items-center gap-0.5",
|
|
17
|
+
"data-slot": "message-actions",
|
|
18
|
+
children: i
|
|
19
|
+
})]
|
|
20
|
+
}));
|
|
21
|
+
i.displayName = "Message";
|
|
22
|
+
export { i as Message };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface PromptInputProps extends Omit<React.HTMLAttributes<HTMLFormElement>, 'onSubmit' | 'defaultValue' | 'children'> {
|
|
3
|
+
value?: string;
|
|
4
|
+
defaultValue?: string;
|
|
5
|
+
onValueChange?: (value: string) => void;
|
|
6
|
+
/** Send: the Send button, or Enter (Shift+Enter adds a line). Uncontrolled text then clears. */
|
|
7
|
+
onSubmit?: (value: string) => void;
|
|
8
|
+
/** `running`: Send turns into Stop, and Enter does not send. Default `ready`. */
|
|
9
|
+
status?: 'ready' | 'running';
|
|
10
|
+
/** Called by the Stop button while `status` is `running`. */
|
|
11
|
+
onStop?: () => void;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Accessible name of the text field. Default "Message". */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Left of the footer, for example an attach button. */
|
|
16
|
+
attach?: React.ReactNode;
|
|
17
|
+
/** The footer line after `attach`, for example "Not sent yet". */
|
|
18
|
+
footer?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/** The chat composer: a text field that grows to 8 rows, an attach slot, a footer and Send. */
|
|
21
|
+
export declare const PromptInput: React.ForwardRefExoticComponent<PromptInputProps & React.RefAttributes<HTMLFormElement>>;
|
|
22
|
+
//# sourceMappingURL=prompt-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-input.d.ts","sourceRoot":"","sources":["../../src/components/prompt-input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EACrC,UAAU,GAAG,cAAc,GAAG,UAAU,CACzC;IACC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,gGAAgG;IAChG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,iFAAiF;IACjF,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kEAAkE;IAClE,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAKD,+FAA+F;AAC/F,eAAO,MAAM,WAAW,0FAyFvB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { useControlled as t } from "../lib/use-controlled.js";
|
|
4
|
+
import { ArrowUpIcon as n, StopIcon as r } from "./chat.icons.js";
|
|
5
|
+
import * as i from "react";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
// src/components/prompt-input.tsx
|
|
8
|
+
var s = "grid size-7 flex-none place-items-center rounded-lg transition-colors duration-fast focus-ring", c = i.forwardRef(({ value: i, defaultValue: c = "", onValueChange: l, onSubmit: u, status: d = "ready", onStop: f, placeholder: p, label: m = "Message", attach: h, footer: g, className: _, ...v }, y) => {
|
|
9
|
+
let [b, x] = t(i, c, l), S = d === "running", C = !S && b.trim() !== "", w = () => {
|
|
10
|
+
C && (u?.(b), i === void 0 && x(""));
|
|
11
|
+
}, T = (e) => {
|
|
12
|
+
e.key !== "Enter" || e.shiftKey || e.nativeEvent.isComposing || e.keyCode === 229 || (e.preventDefault(), w());
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ o("form", {
|
|
15
|
+
ref: y,
|
|
16
|
+
className: e("flex flex-col rounded-lg border border-border bg-background focus-within:border-muted-foreground", _),
|
|
17
|
+
"data-slot": "prompt-input",
|
|
18
|
+
"data-status": d,
|
|
19
|
+
onSubmit: (e) => {
|
|
20
|
+
e.preventDefault(), w();
|
|
21
|
+
},
|
|
22
|
+
...v,
|
|
23
|
+
children: [/* @__PURE__ */ a("textarea", {
|
|
24
|
+
"aria-label": m,
|
|
25
|
+
placeholder: p,
|
|
26
|
+
value: b,
|
|
27
|
+
rows: 1,
|
|
28
|
+
onChange: (e) => x(e.target.value),
|
|
29
|
+
onKeyDown: T,
|
|
30
|
+
className: "block max-h-[calc(8lh+8px)] min-h-[calc(1lh+8px)] w-full resize-none overflow-auto border-0 bg-transparent px-2.5 pt-2 text-ui leading-normal text-foreground outline-none [field-sizing:content] placeholder:text-muted-foreground",
|
|
31
|
+
"data-slot": "prompt-input-textarea"
|
|
32
|
+
}), /* @__PURE__ */ o("div", {
|
|
33
|
+
className: "flex h-9 items-center gap-1.5 px-1",
|
|
34
|
+
"data-slot": "prompt-input-footer",
|
|
35
|
+
children: [
|
|
36
|
+
h,
|
|
37
|
+
/* @__PURE__ */ a("span", {
|
|
38
|
+
className: "min-w-0 flex-1 truncate text-xs text-muted-foreground",
|
|
39
|
+
children: g
|
|
40
|
+
}),
|
|
41
|
+
S ? /* @__PURE__ */ a("button", {
|
|
42
|
+
type: "button",
|
|
43
|
+
"aria-label": "Stop",
|
|
44
|
+
onClick: f,
|
|
45
|
+
className: e(s, "bg-accent text-foreground hover:bg-border"),
|
|
46
|
+
children: /* @__PURE__ */ a(r, {})
|
|
47
|
+
}) : /* @__PURE__ */ a("button", {
|
|
48
|
+
type: "submit",
|
|
49
|
+
"aria-label": "Send",
|
|
50
|
+
disabled: !C,
|
|
51
|
+
className: e(s, "bg-primary text-primary-foreground hover:bg-primary-hover disabled:cursor-default disabled:bg-accent disabled:text-muted-foreground"),
|
|
52
|
+
children: /* @__PURE__ */ a(n, {})
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
c.displayName = "PromptInput";
|
|
59
|
+
export { c as PromptInput };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ReasoningProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3
|
+
/** Seconds spent so far, or in total once done. */
|
|
4
|
+
seconds: number;
|
|
5
|
+
/** `running` reads "Thinking N s", `done` (default) "Thought for N s". */
|
|
6
|
+
status?: 'running' | 'done';
|
|
7
|
+
open?: boolean;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
/** One 28 px line for the model's thinking time; `children` is the optional thought text. */
|
|
12
|
+
export declare const Reasoning: React.ForwardRefExoticComponent<ReasoningProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
//# sourceMappingURL=reasoning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoning.d.ts","sourceRoot":"","sources":["../../src/components/reasoning.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzF,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED,6FAA6F;AAC7F,eAAO,MAAM,SAAS,uFAmDrB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { useControlled as t } from "../lib/use-controlled.js";
|
|
4
|
+
import { BulbIcon as n } from "./chat.icons.js";
|
|
5
|
+
import { Disclosure as r } from "./disclosure.js";
|
|
6
|
+
import { ToolRow as i } from "./tool-call.parts.js";
|
|
7
|
+
import * as a from "react";
|
|
8
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
+
// src/components/reasoning.tsx
|
|
10
|
+
var c = a.forwardRef(({ seconds: c, status: l = "done", open: u, defaultOpen: d = !1, onOpenChange: f, className: p, children: m, ...h }, g) => {
|
|
11
|
+
let [_, v] = t(u, d, f), y = a.useId(), b = m != null && m !== "", x = String(Math.round(c));
|
|
12
|
+
return /* @__PURE__ */ s("div", {
|
|
13
|
+
ref: g,
|
|
14
|
+
className: e("min-w-0", p),
|
|
15
|
+
"data-slot": "reasoning",
|
|
16
|
+
...h,
|
|
17
|
+
children: [/* @__PURE__ */ o(i, {
|
|
18
|
+
glyph: /* @__PURE__ */ o("span", {
|
|
19
|
+
className: "text-muted-foreground",
|
|
20
|
+
children: /* @__PURE__ */ o(n, {})
|
|
21
|
+
}),
|
|
22
|
+
nested: !0,
|
|
23
|
+
open: b ? _ : void 0,
|
|
24
|
+
"aria-controls": b ? y : void 0,
|
|
25
|
+
onClick: () => v(!_),
|
|
26
|
+
className: "pl-0.5",
|
|
27
|
+
children: /* @__PURE__ */ o("span", {
|
|
28
|
+
className: e("min-w-0 flex-1 truncate text-ui", l === "done" ? "text-muted-foreground" : "text-foreground"),
|
|
29
|
+
children: l === "running" ? `Thinking ${x} s` : `Thought for ${x} s`
|
|
30
|
+
})
|
|
31
|
+
}), b && /* @__PURE__ */ o(r, {
|
|
32
|
+
open: _,
|
|
33
|
+
id: y,
|
|
34
|
+
shrink: !0,
|
|
35
|
+
children: /* @__PURE__ */ o("div", {
|
|
36
|
+
className: "mb-0.5 ml-2 mt-0.5 border-l-2 border-border py-0.5 pl-3 text-ui leading-[1.55] text-muted-foreground",
|
|
37
|
+
children: m
|
|
38
|
+
})
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
c.displayName = "Reasoning";
|
|
43
|
+
export { c as Reasoning };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.variants.d.ts","sourceRoot":"","sources":["../../src/components/row.variants.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"row.variants.d.ts","sourceRoot":"","sources":["../../src/components/row.variants.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;8EA4BvB,CAAC"}
|
|
@@ -10,7 +10,7 @@ var n = t("relative flex w-full min-w-0 items-center text-left text-ui transitio
|
|
|
10
10
|
stacked: "h-[54px] flex-col items-stretch justify-center gap-0.5 px-2.5"
|
|
11
11
|
},
|
|
12
12
|
interactive: {
|
|
13
|
-
true: ["cursor-pointer hover:bg-accent", "hover:
|
|
13
|
+
true: ["cursor-pointer hover:bg-accent", "hover:on-accent"],
|
|
14
14
|
false: ""
|
|
15
15
|
},
|
|
16
16
|
selected: {
|
package/dist/components/table.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as t from "react";
|
|
|
3
3
|
import { cva as n } from "class-variance-authority";
|
|
4
4
|
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
// src/components/table.tsx
|
|
6
|
-
var i = "h-8 bg-background px-3 text-left align-middle text-xs font-normal text-muted-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0", a = "h-9 px-3 py-0 align-middle [&:has([role=checkbox])]:pr-0", o = e("border-b border-border transition-colors duration-fast hover:bg-accent data-[state=selected]:bg-accent", "hover:
|
|
6
|
+
var i = "h-8 bg-background px-3 text-left align-middle text-xs font-normal text-muted-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0", a = "h-9 px-3 py-0 align-middle [&:has([role=checkbox])]:pr-0", o = e("border-b border-border transition-colors duration-fast hover:bg-accent data-[state=selected]:bg-accent", "hover:on-accent", "data-[state=selected]:on-accent"), s = n("", {
|
|
7
7
|
variants: { sticky: {
|
|
8
8
|
true: "sticky top-0 z-10",
|
|
9
9
|
false: ""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolCallStatus } from './tool-call.parts.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type { ToolCallStatus } from './tool-call.parts.js';
|
|
4
|
+
export interface ToolCallProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
5
|
+
/** The tool, as `server.tool`; the server prefix is dimmed. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** One line after the name, for example the main argument or the error. */
|
|
8
|
+
summary?: React.ReactNode;
|
|
9
|
+
status: ToolCallStatus;
|
|
10
|
+
/** For example "1.7 s". */
|
|
11
|
+
duration?: React.ReactNode;
|
|
12
|
+
/** Arguments: an object is shown as highlighted JSON, a string as is. */
|
|
13
|
+
input?: unknown;
|
|
14
|
+
/** Result, or the error text when `status` is `failed`. */
|
|
15
|
+
output?: unknown;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One tool call: a 32 px row (status, name, summary, duration) that opens its input and output.
|
|
22
|
+
* `children` go between input and output, for example an ApprovalBar while `status` is `waiting`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ToolCall: React.ForwardRefExoticComponent<ToolCallProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
//# sourceMappingURL=tool-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-call.d.ts","sourceRoot":"","sources":["../../src/components/tool-call.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IACxF,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,cAAc,CAAC;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,yEAAyE;IACzE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,sFA0EpB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { useControlled as t } from "../lib/use-controlled.js";
|
|
4
|
+
import { Disclosure as n } from "./disclosure.js";
|
|
5
|
+
import { Payload as r, StatusMark as i, ToolGroupContext as a, ToolName as o, ToolRow as s } from "./tool-call.parts.js";
|
|
6
|
+
import * as c from "react";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
// src/components/tool-call.tsx
|
|
9
|
+
var d = c.forwardRef(({ name: d, summary: f, status: p, duration: m, input: h, output: g, open: _, defaultOpen: v = !1, onOpenChange: y, className: b, children: x, ...S }, C) => {
|
|
10
|
+
let w = c.useContext(a), [T, E] = t(_, v, y), D = c.useId(), O = h !== void 0 || g !== void 0 || x != null, k = p === "failed";
|
|
11
|
+
return /* @__PURE__ */ u("div", {
|
|
12
|
+
ref: C,
|
|
13
|
+
className: e("min-w-0", !w && "rounded-lg border border-border bg-background", !w && p === "waiting" && "border-primary/60", b),
|
|
14
|
+
"data-slot": "tool-call",
|
|
15
|
+
"data-status": p,
|
|
16
|
+
...S,
|
|
17
|
+
children: [/* @__PURE__ */ u(s, {
|
|
18
|
+
glyph: /* @__PURE__ */ l(i, { status: p }),
|
|
19
|
+
duration: m,
|
|
20
|
+
nested: w,
|
|
21
|
+
open: O ? T : void 0,
|
|
22
|
+
"aria-controls": O ? D : void 0,
|
|
23
|
+
onClick: () => E(!T),
|
|
24
|
+
children: [/* @__PURE__ */ l(o, { name: d }), /* @__PURE__ */ l("span", {
|
|
25
|
+
className: e("min-w-0 flex-1 truncate text-xs", k ? "text-destructive" : "text-muted-foreground"),
|
|
26
|
+
children: f
|
|
27
|
+
})]
|
|
28
|
+
}), O && /* @__PURE__ */ l(n, {
|
|
29
|
+
open: T,
|
|
30
|
+
id: D,
|
|
31
|
+
shrink: !0,
|
|
32
|
+
children: /* @__PURE__ */ u("div", {
|
|
33
|
+
className: e("flex flex-col gap-1.5 px-2.5 pb-2.5 pt-2", !w && "border-t border-border"),
|
|
34
|
+
"data-slot": "tool-call-body",
|
|
35
|
+
children: [
|
|
36
|
+
h !== void 0 && /* @__PURE__ */ l(r, {
|
|
37
|
+
label: "Input",
|
|
38
|
+
value: h
|
|
39
|
+
}),
|
|
40
|
+
x,
|
|
41
|
+
g !== void 0 && /* @__PURE__ */ l(r, {
|
|
42
|
+
label: k ? "Error" : "Output",
|
|
43
|
+
value: g,
|
|
44
|
+
error: k
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
d.displayName = "ToolCall";
|
|
52
|
+
export { d as ToolCall };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { StatusGlyphProps } from './status-glyph.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type ToolCallStatus = 'running' | 'succeeded' | 'failed' | 'waiting';
|
|
4
|
+
export declare const TOOL_GLYPH: Record<ToolCallStatus, Pick<StatusGlyphProps, 'shape' | 'tone' | 'pulse' | 'label'>>;
|
|
5
|
+
/** Set by ToolGroup: its calls render as flat 28 px rows inside the group body. */
|
|
6
|
+
export declare const ToolGroupContext: React.Context<boolean>;
|
|
7
|
+
/** `server.tool` with the server prefix dimmed. */
|
|
8
|
+
export declare const ToolName: ({ name }: {
|
|
9
|
+
name: string;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export interface ToolRowProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
|
+
glyph: React.ReactNode;
|
|
13
|
+
duration?: React.ReactNode;
|
|
14
|
+
/** Set when the row toggles a body: it is a button with a turning chevron. */
|
|
15
|
+
open?: boolean;
|
|
16
|
+
nested?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** The one header row of a tool call, group or reasoning line: glyph, text, duration, chevron. */
|
|
19
|
+
export declare const ToolRow: ({ glyph, duration, open, nested, className, children, ...props }: ToolRowProps) => React.JSX.Element;
|
|
20
|
+
export declare const StatusMark: ({ status }: {
|
|
21
|
+
status: ToolCallStatus;
|
|
22
|
+
}) => React.JSX.Element;
|
|
23
|
+
/** One labelled payload (Input, Output or Error): JSON highlighted, errors in the danger tone. */
|
|
24
|
+
export declare const Payload: ({ label, value, error, }: {
|
|
25
|
+
label: string;
|
|
26
|
+
value: unknown;
|
|
27
|
+
error?: boolean;
|
|
28
|
+
}) => React.JSX.Element;
|
|
29
|
+
//# sourceMappingURL=tool-call.parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-call.parts.d.ts","sourceRoot":"","sources":["../../src/components/tool-call.parts.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5E,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,cAAc,EACd,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC,CAM7D,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,wBAA6B,CAAC;AAE3D,mDAAmD;AACnD,eAAO,MAAM,QAAQ,GAAI,UAAU;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,sBAQlD,CAAC;AAEF,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACjF,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAID,kGAAkG;AAClG,eAAO,MAAM,OAAO,GAAI,kEAQrB,YAAY,sBAkCd,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,YAAY;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,sBAEhE,CAAC;AAoBF,kGAAkG;AAClG,eAAO,MAAM,OAAO,GAAI,0BAIrB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,sBA0BA,CAAC"}
|