@tangle-network/ui 5.0.0 → 5.2.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/CHANGELOG.md +17 -0
- package/dist/chat.js +5 -6
- package/dist/{chunk-54SQQMMM.js → chunk-AZWDI2JG.js} +1 -1
- package/dist/chunk-EOGJX2TU.js +366 -0
- package/dist/chunk-LASW7CYH.js +473 -0
- package/dist/{chunk-5VPTNXX7.js → chunk-O6NUUCT2.js} +1 -1
- package/dist/{chunk-CMX2I43A.js → chunk-PN3S2MTV.js} +1 -1
- package/dist/{chunk-KT5RNO7N.js → chunk-SJ6IL4HI.js} +4 -4
- package/dist/{chunk-BX6AQMUS.js → chunk-ULDNFLIM.js} +44 -1
- package/dist/hooks.js +7 -5
- package/dist/index.js +13 -15
- package/dist/run.d.ts +5 -1
- package/dist/run.js +7 -8
- package/dist/sdk-hooks.js +7 -5
- package/dist/utils.js +4 -6
- package/package.json +1 -1
- package/src/run/inline-tool-item.tsx +14 -6
- package/src/run/run-group.tsx +52 -48
- package/src/run/tool-call-step.tsx +48 -150
- package/dist/chunk-4CLN43XT.js +0 -45
- package/dist/chunk-DGW77LD7.js +0 -186
- package/dist/chunk-JBPWIYTQ.js +0 -754
package/dist/chunk-DGW77LD7.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CodeBlock
|
|
3
|
-
} from "./chunk-WUQDUBJG.js";
|
|
4
|
-
import {
|
|
5
|
-
cn
|
|
6
|
-
} from "./chunk-RQHJBTEU.js";
|
|
7
|
-
|
|
8
|
-
// src/run/tool-call-step.tsx
|
|
9
|
-
import { useState } from "react";
|
|
10
|
-
import {
|
|
11
|
-
Terminal,
|
|
12
|
-
FileText,
|
|
13
|
-
FileCode,
|
|
14
|
-
Search,
|
|
15
|
-
CheckCircle,
|
|
16
|
-
ChevronRight,
|
|
17
|
-
Loader2,
|
|
18
|
-
FolderOpen,
|
|
19
|
-
Download,
|
|
20
|
-
Pencil,
|
|
21
|
-
Eye
|
|
22
|
-
} from "lucide-react";
|
|
23
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
var EXT_LANGUAGE = {
|
|
25
|
-
ts: "typescript",
|
|
26
|
-
tsx: "typescript",
|
|
27
|
-
js: "javascript",
|
|
28
|
-
jsx: "javascript",
|
|
29
|
-
mjs: "javascript",
|
|
30
|
-
cjs: "javascript",
|
|
31
|
-
css: "css",
|
|
32
|
-
scss: "scss",
|
|
33
|
-
json: "json",
|
|
34
|
-
jsonc: "json",
|
|
35
|
-
md: "markdown",
|
|
36
|
-
mdx: "markdown",
|
|
37
|
-
py: "python",
|
|
38
|
-
sh: "bash",
|
|
39
|
-
bash: "bash",
|
|
40
|
-
zsh: "bash",
|
|
41
|
-
html: "html",
|
|
42
|
-
htm: "html",
|
|
43
|
-
yaml: "yaml",
|
|
44
|
-
yml: "yaml",
|
|
45
|
-
toml: "toml",
|
|
46
|
-
rs: "rust",
|
|
47
|
-
go: "go",
|
|
48
|
-
sql: "sql",
|
|
49
|
-
xml: "xml"
|
|
50
|
-
};
|
|
51
|
-
function inferLanguage(detail, language) {
|
|
52
|
-
if (language) return language;
|
|
53
|
-
if (!detail) return void 0;
|
|
54
|
-
const ext = detail.split(".").pop()?.toLowerCase();
|
|
55
|
-
return ext ? EXT_LANGUAGE[ext] : void 0;
|
|
56
|
-
}
|
|
57
|
-
function isFilePath(detail) {
|
|
58
|
-
return /[/\\]/.test(detail) || /\.\w{1,6}$/.test(detail);
|
|
59
|
-
}
|
|
60
|
-
function FilePathChip({ path }) {
|
|
61
|
-
const parts = path.replace(/\\/g, "/").split("/");
|
|
62
|
-
const filename = parts.pop() ?? path;
|
|
63
|
-
const dir = parts.length > 0 ? parts.join("/") + "/" : "";
|
|
64
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 rounded-[var(--radius-sm)] border border-border bg-background px-2.5 py-1.5 font-mono text-xs min-w-0", children: [
|
|
65
|
-
/* @__PURE__ */ jsx(FileCode, { className: "h-3.5 w-3.5 shrink-0 text-primary" }),
|
|
66
|
-
dir && /* @__PURE__ */ jsx("span", { className: "truncate text-muted-foreground", children: dir }),
|
|
67
|
-
/* @__PURE__ */ jsx("span", { className: "shrink-0 font-semibold text-foreground", children: filename })
|
|
68
|
-
] });
|
|
69
|
-
}
|
|
70
|
-
var ICONS = {
|
|
71
|
-
bash: Terminal,
|
|
72
|
-
read: Eye,
|
|
73
|
-
write: FileText,
|
|
74
|
-
edit: Pencil,
|
|
75
|
-
glob: FolderOpen,
|
|
76
|
-
grep: Search,
|
|
77
|
-
list: FolderOpen,
|
|
78
|
-
download: Download,
|
|
79
|
-
inspect: Search,
|
|
80
|
-
audit: CheckCircle,
|
|
81
|
-
unknown: FileCode
|
|
82
|
-
};
|
|
83
|
-
var STATUS_COLORS = {
|
|
84
|
-
running: "text-primary",
|
|
85
|
-
success: "text-[var(--code-success)]",
|
|
86
|
-
error: "text-[var(--code-error)]"
|
|
87
|
-
};
|
|
88
|
-
function ToolCallStep({
|
|
89
|
-
type,
|
|
90
|
-
label,
|
|
91
|
-
status,
|
|
92
|
-
detail,
|
|
93
|
-
output,
|
|
94
|
-
language,
|
|
95
|
-
duration,
|
|
96
|
-
className
|
|
97
|
-
}) {
|
|
98
|
-
const [expanded, setExpanded] = useState(false);
|
|
99
|
-
const Icon = ICONS[type] || ICONS.unknown;
|
|
100
|
-
const hasExpandable = !!(detail || output);
|
|
101
|
-
const lang = inferLanguage(detail, language);
|
|
102
|
-
return /* @__PURE__ */ jsxs(
|
|
103
|
-
"div",
|
|
104
|
-
{
|
|
105
|
-
className: cn(
|
|
106
|
-
"group overflow-hidden rounded-[var(--radius-lg)] border bg-card transition-colors",
|
|
107
|
-
status === "running" && "border-border",
|
|
108
|
-
status === "success" && "border-border hover:border-primary/20",
|
|
109
|
-
status === "error" && "border-[var(--surface-danger-border)]",
|
|
110
|
-
className
|
|
111
|
-
),
|
|
112
|
-
children: [
|
|
113
|
-
/* @__PURE__ */ jsxs(
|
|
114
|
-
"button",
|
|
115
|
-
{
|
|
116
|
-
onClick: () => hasExpandable && setExpanded(!expanded),
|
|
117
|
-
disabled: !hasExpandable,
|
|
118
|
-
className: cn(
|
|
119
|
-
"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm",
|
|
120
|
-
hasExpandable && "cursor-pointer"
|
|
121
|
-
),
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
"div",
|
|
125
|
-
{
|
|
126
|
-
className: cn(
|
|
127
|
-
"flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border",
|
|
128
|
-
status === "running" && "border-[var(--border-accent)] bg-[var(--accent-surface-soft)] text-primary",
|
|
129
|
-
status === "success" && "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]",
|
|
130
|
-
status === "error" && "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]"
|
|
131
|
-
),
|
|
132
|
-
children: status === "running" ? /* @__PURE__ */ jsx(Loader2, { className: "h-3 w-3 animate-spin shrink-0" }) : /* @__PURE__ */ jsx(Icon, { className: cn("h-3 w-3 shrink-0", STATUS_COLORS[status]) })
|
|
133
|
-
}
|
|
134
|
-
),
|
|
135
|
-
/* @__PURE__ */ jsx("span", { className: "truncate flex-1 font-sans text-foreground", children: label }),
|
|
136
|
-
/* @__PURE__ */ jsx(
|
|
137
|
-
"span",
|
|
138
|
-
{
|
|
139
|
-
className: cn(
|
|
140
|
-
"rounded-full border px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.06em]",
|
|
141
|
-
status === "running" && "border-border bg-[var(--accent-surface-soft)] text-primary",
|
|
142
|
-
status === "success" && "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)] text-[var(--surface-success-text)]",
|
|
143
|
-
status === "error" && "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] text-[var(--surface-danger-text)]"
|
|
144
|
-
),
|
|
145
|
-
children: status
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
duration !== void 0 && status !== "running" && /* @__PURE__ */ jsx("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: duration < 1e3 ? `${duration}ms` : `${(duration / 1e3).toFixed(1)}s` }),
|
|
149
|
-
hasExpandable && /* @__PURE__ */ jsx(
|
|
150
|
-
ChevronRight,
|
|
151
|
-
{
|
|
152
|
-
className: cn(
|
|
153
|
-
"h-3 w-3 text-muted-foreground transition-transform shrink-0",
|
|
154
|
-
expanded && "rotate-90"
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
)
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
expanded && (detail || output) && /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t border-border bg-muted px-3 py-2.5", children: [
|
|
162
|
-
detail && (isFilePath(detail) ? /* @__PURE__ */ jsx(FilePathChip, { path: detail }) : /* @__PURE__ */ jsx("div", { className: "text-xs font-mono text-muted-foreground", children: detail })),
|
|
163
|
-
output && /* @__PURE__ */ jsx(
|
|
164
|
-
CodeBlock,
|
|
165
|
-
{
|
|
166
|
-
code: output,
|
|
167
|
-
language: lang,
|
|
168
|
-
className: "max-h-72 overflow-auto text-xs"
|
|
169
|
-
}
|
|
170
|
-
)
|
|
171
|
-
] })
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
function ToolCallGroup({ title, children, className }) {
|
|
177
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("my-2 space-y-2", className), children: [
|
|
178
|
-
title && /* @__PURE__ */ jsx("div", { className: "mb-1 px-1 text-xs font-medium uppercase tracking-wider text-muted-foreground", children: title }),
|
|
179
|
-
children
|
|
180
|
-
] });
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export {
|
|
184
|
-
ToolCallStep,
|
|
185
|
-
ToolCallGroup
|
|
186
|
-
};
|