@tangle-network/ui 11.9.0 → 11.11.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 (155) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +14 -0
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DixfCMCk.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -15
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-uhNnwdsD.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-CPLL0Fd9.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -30
  16. package/dist/code-block-B9miUPht.d.ts +23 -0
  17. package/dist/code-block-CngSn37j.js +165 -0
  18. package/dist/diff-preview-cySuqowW.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-Cz6oEF1o.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -33
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-CYlOo0mE.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -40
  28. package/dist/focus-Cw02pNSr.js +56 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -45
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-COgqsFAQ.d.ts +42 -0
  34. package/dist/index-CPDET_s1.d.ts +549 -0
  35. package/dist/index-CUhfHT_V.d.ts +204 -0
  36. package/dist/index-Cg6gYAqh.d.ts +73 -0
  37. package/dist/index-Cq-EJzqW.d.ts +16 -0
  38. package/dist/index-DhYmSaLF.d.ts +245 -0
  39. package/dist/index-DjKxO357.d.ts +128 -0
  40. package/dist/index-b56ew9aF.d.ts +107 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -460
  43. package/dist/markdown-BprL96Gl.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -14
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DT4xbvWt.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -12
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-DE-blUz-.js +1239 -0
  55. package/dist/primitives.d.ts +5 -523
  56. package/dist/primitives.js +9 -211
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-D1InSdQu.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -39
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -35
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-DHyqDPbU.js +146 -0
  70. package/dist/tabs-ujuqAdtb.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-C1W1N54c.js +109 -0
  74. package/dist/tool-call-step-Bi3_YJRV.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -22
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BjVBDbxK.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -51
  87. package/dist/utils.js +6 -32
  88. package/package.json +39 -41
  89. package/src/auth/auth.tsx +5 -1
  90. package/src/chat/agent-timeline.tsx +6 -1
  91. package/src/chat/chat-container.tsx +2 -1
  92. package/src/editor/document-editor-pane.test.tsx +3 -1
  93. package/src/editor/document-editor-pane.tsx +5 -1
  94. package/src/editor/markdown-document-editor.test.tsx +9 -4
  95. package/src/files/file-artifact-pane.tsx +3 -2
  96. package/src/files/file-preview.tsx +3 -1
  97. package/src/files/file-tabs.tsx +9 -2
  98. package/src/lib/focus.ts +63 -0
  99. package/src/markdown/code-block.tsx +5 -1
  100. package/src/primitives/badge.tsx +2 -1
  101. package/src/primitives/button.tsx +2 -1
  102. package/src/primitives/card.tsx +1 -2
  103. package/src/primitives/dialog.tsx +7 -1
  104. package/src/primitives/input.tsx +15 -14
  105. package/src/primitives/segmented-control.tsx +5 -3
  106. package/src/primitives/select.tsx +3 -1
  107. package/src/primitives/switch.tsx +3 -1
  108. package/src/primitives/tabs.tsx +6 -4
  109. package/src/primitives/terminal-display.tsx +6 -8
  110. package/src/primitives/toast.tsx +5 -1
  111. package/src/tool-previews/command-preview.tsx +5 -1
  112. package/src/tool-previews/web-search-preview.tsx +2 -1
  113. package/src/utils/index.ts +7 -0
  114. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  115. package/dist/button-CMQuQEW_.d.ts +0 -17
  116. package/dist/chunk-34A66VBG.js +0 -214
  117. package/dist/chunk-3OI2QKFD.js +0 -0
  118. package/dist/chunk-3TI5DEHV.js +0 -299
  119. package/dist/chunk-4CLN43XT.js +0 -45
  120. package/dist/chunk-565EATZZ.js +0 -156
  121. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  122. package/dist/chunk-6BGQA4BQ.js +0 -0
  123. package/dist/chunk-7YOCS6IF.js +0 -728
  124. package/dist/chunk-EOAX2ENE.js +0 -60
  125. package/dist/chunk-GYPQXTJU.js +0 -230
  126. package/dist/chunk-HFL6R6IF.js +0 -37
  127. package/dist/chunk-HGML45QH.js +0 -104
  128. package/dist/chunk-KNYSKNZX.js +0 -550
  129. package/dist/chunk-L57WRIND.js +0 -59
  130. package/dist/chunk-LDLOJKPC.js +0 -1585
  131. package/dist/chunk-LTEKI7YJ.js +0 -59
  132. package/dist/chunk-MKTSMWVD.js +0 -109
  133. package/dist/chunk-ND3ZFXQK.js +0 -179
  134. package/dist/chunk-NKDZ7GZE.js +0 -192
  135. package/dist/chunk-NWECTSOH.js +0 -589
  136. package/dist/chunk-OEX7NZE3.js +0 -321
  137. package/dist/chunk-Q56BYXQF.js +0 -61
  138. package/dist/chunk-REJESC5U.js +0 -117
  139. package/dist/chunk-RQGKSCEZ.js +0 -0
  140. package/dist/chunk-TN4FUEWY.js +0 -437
  141. package/dist/chunk-VPWY4I5O.js +0 -1048
  142. package/dist/chunk-WUQDUBJG.js +0 -168
  143. package/dist/chunk-XGKULLYE.js +0 -40
  144. package/dist/chunk-XU3HB5QL.js +0 -127
  145. package/dist/chunk-XYAIX4SU.js +0 -133
  146. package/dist/chunk-YJ6RE5WV.js +0 -875
  147. package/dist/chunk-YTO5V6QS.js +0 -19
  148. package/dist/chunk-ZKCEAIIZ.js +0 -1395
  149. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  150. package/dist/document-editor-pane-EX25CEYW.js +0 -12
  151. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  152. package/dist/message-BHWbxBtT.d.ts +0 -15
  153. package/dist/parts-dj7AcUg0.d.ts +0 -36
  154. package/dist/run-PfLmDAox.d.ts +0 -41
  155. package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
@@ -1,550 +0,0 @@
1
- import {
2
- getToolCategory,
3
- getToolDisplayMetadata,
4
- getToolErrorText
5
- } from "./chunk-ND3ZFXQK.js";
6
- import {
7
- CommandPreview,
8
- DiffPreview,
9
- GlobResultsPreview,
10
- GrepResultsPreview,
11
- QuestionPreview,
12
- WebSearchPreview,
13
- WriteFilePreview
14
- } from "./chunk-NWECTSOH.js";
15
- import {
16
- TextShimmer
17
- } from "./chunk-L57WRIND.js";
18
- import {
19
- formatDuration
20
- } from "./chunk-4CLN43XT.js";
21
- import {
22
- CodeBlock
23
- } from "./chunk-WUQDUBJG.js";
24
- import {
25
- cn
26
- } from "./chunk-RQHJBTEU.js";
27
-
28
- // src/run/expanded-tool-detail.tsx
29
- import { memo } from "react";
30
- import {
31
- ArrowRight,
32
- ArrowLeft,
33
- AlertCircle,
34
- Loader2,
35
- FileText
36
- } from "lucide-react";
37
-
38
- // src/run/expandable-content.tsx
39
- import { useEffect, useRef, useState } from "react";
40
- import { jsx, jsxs } from "react/jsx-runtime";
41
- function ExpandableContent({
42
- children,
43
- collapsedMaxPx = 180,
44
- fadeClassName = "from-muted",
45
- className
46
- }) {
47
- const [expanded, setExpanded] = useState(false);
48
- const [overflowing, setOverflowing] = useState(false);
49
- const contentRef = useRef(null);
50
- useEffect(() => {
51
- const el = contentRef.current;
52
- if (!el) return;
53
- const measure = () => setOverflowing(el.scrollHeight > collapsedMaxPx + 4);
54
- measure();
55
- if (typeof ResizeObserver === "undefined") return;
56
- const observer = new ResizeObserver(measure);
57
- observer.observe(el);
58
- return () => observer.disconnect();
59
- }, [collapsedMaxPx]);
60
- const clamped = overflowing && !expanded;
61
- return /* @__PURE__ */ jsxs("div", { className, children: [
62
- /* @__PURE__ */ jsxs(
63
- "div",
64
- {
65
- ref: contentRef,
66
- className: "relative overflow-hidden",
67
- style: clamped ? { maxHeight: collapsedMaxPx } : void 0,
68
- children: [
69
- children,
70
- clamped ? /* @__PURE__ */ jsx(
71
- "div",
72
- {
73
- className: cn(
74
- "pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t to-transparent",
75
- fadeClassName
76
- )
77
- }
78
- ) : null
79
- ]
80
- }
81
- ),
82
- overflowing ? /* @__PURE__ */ jsx(
83
- "button",
84
- {
85
- type: "button",
86
- onClick: () => setExpanded((value) => !value),
87
- className: "mt-1 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground",
88
- children: expanded ? "Show less" : "Show more"
89
- }
90
- ) : null
91
- ] });
92
- }
93
-
94
- // src/run/expanded-tool-detail.tsx
95
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
96
- var EXT_LANG = {
97
- ts: "typescript",
98
- tsx: "tsx",
99
- js: "javascript",
100
- jsx: "jsx",
101
- rs: "rust",
102
- py: "python",
103
- go: "go",
104
- rb: "ruby",
105
- json: "json",
106
- yaml: "yaml",
107
- yml: "yaml",
108
- toml: "toml",
109
- md: "markdown",
110
- css: "css",
111
- scss: "scss",
112
- html: "html",
113
- sh: "bash",
114
- bash: "bash",
115
- zsh: "bash",
116
- sql: "sql",
117
- sol: "solidity",
118
- proto: "protobuf"
119
- };
120
- function langFromPath(path) {
121
- if (!path) return void 0;
122
- const ext = path.split(".").pop()?.toLowerCase();
123
- return ext ? EXT_LANG[ext] : void 0;
124
- }
125
- function formatOutput(value) {
126
- if (value == null) return "";
127
- if (typeof value === "string") return value;
128
- try {
129
- return JSON.stringify(value, null, 2);
130
- } catch {
131
- return String(value);
132
- }
133
- }
134
- var ExpandedToolDetail = memo(({ part }) => {
135
- const meta = getToolDisplayMetadata(part);
136
- const { status, input, output, error } = part.state;
137
- if (meta.displayVariant === "command") {
138
- return /* @__PURE__ */ jsx2(CommandPreview, { part });
139
- }
140
- if (meta.displayVariant === "write-file") {
141
- return /* @__PURE__ */ jsx2(WriteFilePreview, { part });
142
- }
143
- if (meta.displayVariant === "grep") {
144
- return /* @__PURE__ */ jsx2(GrepResultsPreview, { part });
145
- }
146
- if (meta.displayVariant === "glob") {
147
- return /* @__PURE__ */ jsx2(GlobResultsPreview, { part });
148
- }
149
- if (meta.displayVariant === "web-search") {
150
- return /* @__PURE__ */ jsx2(WebSearchPreview, { part });
151
- }
152
- if (meta.displayVariant === "question") {
153
- return /* @__PURE__ */ jsx2(QuestionPreview, { part });
154
- }
155
- if (meta.displayVariant === "diff") {
156
- return /* @__PURE__ */ jsx2(DiffPreview, { part });
157
- }
158
- if (meta.displayVariant === "read-file") {
159
- return /* @__PURE__ */ jsxs2("div", { className: "overflow-hidden rounded-[var(--radius-lg)] border border-border bg-card shadow-[var(--shadow-card)]", children: [
160
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2.5 border-b border-border bg-card px-3 py-2", children: [
161
- /* @__PURE__ */ jsx2("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border border-[var(--border-accent)] bg-muted text-primary", children: /* @__PURE__ */ jsx2(FileText, { className: "h-3.5 w-3.5" }) }),
162
- /* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex items-center gap-2", children: [
163
- /* @__PURE__ */ jsx2("span", { className: "text-xs font-semibold text-foreground", children: "Read file" }),
164
- meta.targetPath ? /* @__PURE__ */ jsx2("span", { className: "truncate text-xs font-mono text-muted-foreground", children: meta.targetPath }) : null
165
- ] })
166
- ] }),
167
- /* @__PURE__ */ jsxs2("div", { className: "space-y-2 px-3 py-2.5", children: [
168
- typeof output === "string" ? /* @__PURE__ */ jsx2(CodeBlock, { code: output, language: langFromPath(meta.targetPath) ?? "text", className: "rounded-[var(--radius-md)]" }) : /* @__PURE__ */ jsx2("div", { className: "rounded-[var(--radius-md)] border border-dashed border-border bg-muted px-3 py-4 text-sm text-muted-foreground", children: "No readable file content was returned." }),
169
- error ? /* @__PURE__ */ jsx2("div", { className: "rounded-[var(--radius-md)] border border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] px-3 py-3 text-sm text-[var(--surface-danger-text)]", children: error }) : null
170
- ] })
171
- ] });
172
- }
173
- const inputStr = formatOutput(input);
174
- const outputStr = formatOutput(output);
175
- return /* @__PURE__ */ jsxs2("div", { className: "space-y-3", children: [
176
- inputStr && /* @__PURE__ */ jsxs2("div", { className: "overflow-hidden rounded-[var(--radius-lg)] border border-border bg-card", children: [
177
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 border-b border-border bg-background px-3 py-2", children: [
178
- /* @__PURE__ */ jsx2(ArrowRight, { className: "h-3 w-3 text-primary" }),
179
- /* @__PURE__ */ jsx2("span", { className: "text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Input" })
180
- ] }),
181
- /* @__PURE__ */ jsx2(CodeBlock, { code: inputStr, language: "json", className: "rounded-none border-0" })
182
- ] }),
183
- status === "completed" && outputStr && /* @__PURE__ */ jsxs2("div", { className: "overflow-hidden rounded-[var(--radius-lg)] border border-border bg-card", children: [
184
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 border-b border-border bg-background px-3 py-2", children: [
185
- /* @__PURE__ */ jsx2(ArrowLeft, { className: "h-3 w-3 text-primary" }),
186
- /* @__PURE__ */ jsx2("span", { className: "text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Output" })
187
- ] }),
188
- /* @__PURE__ */ jsx2(ExpandableContent, { fadeClassName: "from-card", children: /* @__PURE__ */ jsx2(
189
- CodeBlock,
190
- {
191
- code: outputStr.length > 2e3 ? outputStr.slice(0, 2e3) + "\n...(truncated)" : outputStr,
192
- language: "json",
193
- className: "rounded-none border-0"
194
- }
195
- ) })
196
- ] }),
197
- error && /* @__PURE__ */ jsxs2("div", { className: "overflow-hidden rounded-[var(--radius-lg)] border border-[var(--surface-danger-border)]", children: [
198
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 border-b border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)] px-3 py-2", children: [
199
- /* @__PURE__ */ jsx2(AlertCircle, { className: "h-3 w-3 text-[var(--surface-danger-text)]" }),
200
- /* @__PURE__ */ jsx2("span", { className: "text-xs font-medium uppercase tracking-[0.08em] text-[var(--surface-danger-text)]", children: "Error" })
201
- ] }),
202
- /* @__PURE__ */ jsx2(ExpandableContent, { fadeClassName: "from-[var(--surface-danger-bg)]", children: /* @__PURE__ */ jsx2("pre", { className: "bg-[var(--surface-danger-bg)] p-3 text-xs font-mono whitespace-pre-wrap break-all text-[var(--surface-danger-text)]", children: error }) })
203
- ] }),
204
- (status === "pending" || status === "running") && /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 rounded-[var(--radius-md)] border border-border bg-muted px-3 py-3 text-xs text-muted-foreground", children: [
205
- /* @__PURE__ */ jsx2(Loader2, { className: cn("h-3 w-3 animate-spin text-primary") }),
206
- "Running\u2026"
207
- ] })
208
- ] });
209
- });
210
- ExpandedToolDetail.displayName = "ExpandedToolDetail";
211
-
212
- // src/run/run-row-shell.tsx
213
- import { useState as useState2 } from "react";
214
- import * as Collapsible from "@radix-ui/react-collapsible";
215
- import { ChevronRight } from "lucide-react";
216
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
217
- function RunRowStatusDot({ status }) {
218
- if (status !== "error") return null;
219
- return /* @__PURE__ */ jsx3(
220
- "span",
221
- {
222
- "data-run-row-status": "error",
223
- className: "h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--surface-danger-text)]"
224
- }
225
- );
226
- }
227
- var SHAPE_CLASS = {
228
- single: "rounded-[var(--radius-lg)]",
229
- first: "rounded-t-[var(--radius-lg)] rounded-b-[var(--radius-sm)]",
230
- middle: "rounded-[var(--radius-sm)]",
231
- last: "rounded-t-[var(--radius-sm)] rounded-b-[var(--radius-lg)]"
232
- };
233
- var HEADER_INSET = "px-2 py-1";
234
- var ERROR_INDENT = "pl-[2.375rem]";
235
- function RunRowShell({
236
- icon,
237
- title,
238
- description,
239
- descriptionMono = false,
240
- status = "idle",
241
- durationMs,
242
- groupPosition = "single",
243
- collapsedError,
244
- actions,
245
- open: openProp,
246
- onOpenChange,
247
- defaultOpen = false,
248
- className,
249
- contentClassName,
250
- children
251
- }) {
252
- const [openState, setOpenState] = useState2(defaultOpen);
253
- const isControlled = openProp !== void 0;
254
- const open = isControlled ? openProp : openState;
255
- const setOpen = (next) => {
256
- if (!isControlled) setOpenState(next);
257
- onOpenChange?.(next);
258
- };
259
- const isRunning = status === "running";
260
- const expandable = children != null;
261
- return /* @__PURE__ */ jsx3(Collapsible.Root, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-2", children: [
262
- /* @__PURE__ */ jsxs3(
263
- "div",
264
- {
265
- "data-run-row": "",
266
- "data-state": open ? "open" : "closed",
267
- className: cn(
268
- "group min-w-0 flex-1 overflow-hidden border transition-colors",
269
- open ? "border-border bg-[var(--md3-surface-container)]" : "border-transparent bg-transparent",
270
- expandable && !open && "hover:bg-[var(--md3-surface-container)]",
271
- SHAPE_CLASS[groupPosition],
272
- className
273
- ),
274
- children: [
275
- /* @__PURE__ */ jsx3(Collapsible.Trigger, { asChild: true, disabled: !expandable, children: /* @__PURE__ */ jsxs3(
276
- "button",
277
- {
278
- type: "button",
279
- className: cn(
280
- "flex w-full items-center gap-2 text-left",
281
- HEADER_INSET,
282
- expandable ? "cursor-pointer" : "cursor-default"
283
- ),
284
- children: [
285
- /* @__PURE__ */ jsxs3(
286
- "span",
287
- {
288
- "aria-hidden": true,
289
- className: "flex h-[1.375rem] w-[1.375rem] shrink-0 items-center justify-center text-muted-foreground",
290
- children: [
291
- /* @__PURE__ */ jsx3(
292
- "span",
293
- {
294
- "data-run-row-glyph": "",
295
- className: cn(
296
- "flex items-center justify-center",
297
- expandable && "group-hover:hidden",
298
- open && "hidden"
299
- ),
300
- children: icon
301
- }
302
- ),
303
- expandable ? /* @__PURE__ */ jsx3(
304
- ChevronRight,
305
- {
306
- "data-run-row-chevron": "",
307
- className: cn(
308
- "hidden h-3.5 w-3.5 transition-transform group-hover:block",
309
- open && "block rotate-90"
310
- )
311
- }
312
- ) : null
313
- ]
314
- }
315
- ),
316
- /* @__PURE__ */ jsx3(
317
- "span",
318
- {
319
- className: cn(
320
- "shrink-0 whitespace-nowrap text-sm font-normal text-muted-foreground transition-colors group-hover:text-foreground",
321
- open && "text-foreground"
322
- ),
323
- children: title
324
- }
325
- ),
326
- description ? /* @__PURE__ */ jsx3(
327
- "span",
328
- {
329
- className: cn(
330
- "hidden min-w-0 flex-1 truncate text-sm text-muted-foreground transition-colors group-hover:text-foreground sm:inline",
331
- descriptionMono && "font-mono"
332
- ),
333
- children: description
334
- }
335
- ) : null,
336
- /* @__PURE__ */ jsxs3("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
337
- !isRunning && durationMs != null ? /* @__PURE__ */ jsx3(
338
- "span",
339
- {
340
- "data-run-row-duration": "",
341
- className: "font-mono text-[10px] tabular-nums text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
342
- children: formatDuration(durationMs)
343
- }
344
- ) : null,
345
- /* @__PURE__ */ jsx3(RunRowStatusDot, { status })
346
- ] })
347
- ]
348
- }
349
- ) }),
350
- collapsedError && !open ? /* @__PURE__ */ jsx3(
351
- "div",
352
- {
353
- className: cn(
354
- "pb-1.5 pr-2 text-xs leading-snug text-[var(--surface-danger-text)]",
355
- ERROR_INDENT
356
- ),
357
- children: collapsedError
358
- }
359
- ) : null,
360
- expandable ? /* @__PURE__ */ jsx3(Collapsible.Content, { className: "overflow-hidden data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp", children: /* @__PURE__ */ jsx3("div", { className: cn("border-t border-border", contentClassName), children }) }) : null
361
- ]
362
- }
363
- ),
364
- actions ? /* @__PURE__ */ jsx3(
365
- "div",
366
- {
367
- className: "flex shrink-0 flex-wrap items-center justify-end gap-1.5 pt-1",
368
- onClick: (event) => event.stopPropagation(),
369
- children: actions
370
- }
371
- ) : null
372
- ] }) });
373
- }
374
-
375
- // src/run/inline-tool-item.tsx
376
- import { memo as memo2 } from "react";
377
- import {
378
- Terminal,
379
- FileEdit,
380
- FileSearch,
381
- Search,
382
- PencilLine,
383
- Bot,
384
- Globe,
385
- ClipboardList,
386
- Settings
387
- } from "lucide-react";
388
- import { jsx as jsx4 } from "react/jsx-runtime";
389
- var TOOL_CATEGORY_ICON_MAP = {
390
- command: Terminal,
391
- write: FileEdit,
392
- read: FileSearch,
393
- search: Search,
394
- edit: PencilLine,
395
- task: Bot,
396
- web: Globe,
397
- todo: ClipboardList,
398
- other: Settings
399
- };
400
- function toRowStatus(status) {
401
- if (status === "pending" || status === "running") return "running";
402
- if (status === "error") return "error";
403
- return "success";
404
- }
405
- var InlineToolItem = memo2(
406
- ({
407
- part,
408
- renderToolDetail,
409
- groupPosition = "single",
410
- className,
411
- contentClassName,
412
- actions,
413
- title: titleOverride,
414
- description: descriptionOverride
415
- }) => {
416
- const meta = getToolDisplayMetadata(part);
417
- const title = titleOverride ?? meta.title;
418
- const description = descriptionOverride ?? meta.description;
419
- const errorText = getToolErrorText(part);
420
- const startTime = part.state.time?.start;
421
- const endTime = part.state.time?.end;
422
- const durationMs = startTime != null && endTime != null ? endTime - startTime : void 0;
423
- const category = getToolCategory(part.tool);
424
- const DefaultIcon = TOOL_CATEGORY_ICON_MAP[category] ?? Settings;
425
- const status = toRowStatus(part.state.status);
426
- return /* @__PURE__ */ jsx4(
427
- RunRowShell,
428
- {
429
- icon: /* @__PURE__ */ jsx4(DefaultIcon, { className: "h-3.5 w-3.5" }),
430
- title: status === "running" ? /* @__PURE__ */ jsx4(TextShimmer, { children: title }) : title,
431
- description,
432
- descriptionMono: true,
433
- status,
434
- durationMs,
435
- groupPosition,
436
- collapsedError: errorText ?? void 0,
437
- actions,
438
- className,
439
- contentClassName: cn("p-2", contentClassName),
440
- children: renderToolDetail?.(part) ?? /* @__PURE__ */ jsx4(ExpandedToolDetail, { part })
441
- }
442
- );
443
- }
444
- );
445
- InlineToolItem.displayName = "InlineToolItem";
446
-
447
- // src/run/tool-call-step.tsx
448
- import { jsx as jsx5 } from "react/jsx-runtime";
449
- var EXT_LANGUAGE = {
450
- ts: "typescript",
451
- tsx: "typescript",
452
- js: "javascript",
453
- jsx: "javascript",
454
- mjs: "javascript",
455
- cjs: "javascript",
456
- css: "css",
457
- scss: "scss",
458
- json: "json",
459
- jsonc: "json",
460
- md: "markdown",
461
- mdx: "markdown",
462
- py: "python",
463
- sh: "bash",
464
- bash: "bash",
465
- zsh: "bash",
466
- html: "html",
467
- htm: "html",
468
- yaml: "yaml",
469
- yml: "yaml",
470
- toml: "toml",
471
- rs: "rust",
472
- go: "go",
473
- sql: "sql",
474
- xml: "xml"
475
- };
476
- function inferLanguage(detail, language) {
477
- if (language) return language;
478
- if (!detail) return void 0;
479
- const ext = detail.split(".").pop()?.toLowerCase();
480
- return ext ? EXT_LANGUAGE[ext] : void 0;
481
- }
482
- var STATUS_MAP = {
483
- running: "running",
484
- success: "completed",
485
- error: "error"
486
- };
487
- function ToolCallStep({
488
- type,
489
- label,
490
- status,
491
- detail,
492
- output,
493
- language,
494
- duration,
495
- className,
496
- actions,
497
- part
498
- }) {
499
- const resolvedPart = part ?? {
500
- type: "tool",
501
- id: `${type}:${label}`,
502
- tool: type,
503
- state: {
504
- status: STATUS_MAP[status],
505
- input: detail ? { detail } : void 0,
506
- output,
507
- time: duration != null ? { start: 0, end: duration } : void 0
508
- }
509
- };
510
- const lang = inferLanguage(detail, language);
511
- return /* @__PURE__ */ jsx5(
512
- InlineToolItem,
513
- {
514
- part: resolvedPart,
515
- title: label,
516
- description: detail,
517
- className,
518
- actions,
519
- renderToolDetail: part ? void 0 : output ? () => /* @__PURE__ */ jsx5(
520
- CodeBlock,
521
- {
522
- code: output,
523
- language: lang,
524
- className: "max-h-72 overflow-auto text-xs"
525
- }
526
- ) : () => null
527
- }
528
- );
529
- }
530
- function ToolCallGroup({ title, children, className }) {
531
- return /* @__PURE__ */ jsx5(
532
- "div",
533
- {
534
- role: "group",
535
- "aria-label": title,
536
- className: cn("flex flex-col gap-1", className),
537
- children
538
- }
539
- );
540
- }
541
-
542
- export {
543
- ExpandableContent,
544
- ExpandedToolDetail,
545
- RunRowStatusDot,
546
- RunRowShell,
547
- InlineToolItem,
548
- ToolCallStep,
549
- ToolCallGroup
550
- };
@@ -1,59 +0,0 @@
1
- import {
2
- cn
3
- } from "./chunk-RQHJBTEU.js";
4
-
5
- // src/primitives/text-shimmer.tsx
6
- import { useEffect, useLayoutEffect } from "react";
7
- import { jsx } from "react/jsx-runtime";
8
- var CLASS_NAME = "tangle-text-shimmer";
9
- var STYLE_ID = "tangle-text-shimmer-styles";
10
- var SHIMMER_CSS = `
11
- @keyframes ${CLASS_NAME} {
12
- from { -webkit-mask-position: 150% center; mask-position: 150% center; }
13
- to { -webkit-mask-position: -50% center; mask-position: -50% center; }
14
- }
15
- .${CLASS_NAME} {
16
- -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0.72) 0%, #000 45%, rgba(0,0,0,0.72) 60%);
17
- mask-image: linear-gradient(90deg, rgba(0,0,0,0.72) 0%, #000 45%, rgba(0,0,0,0.72) 60%);
18
- -webkit-mask-size: 250% 100%;
19
- mask-size: 250% 100%;
20
- animation: ${CLASS_NAME} 1.4s linear infinite;
21
- }
22
- @media (prefers-reduced-motion: reduce) {
23
- .${CLASS_NAME} {
24
- animation: none;
25
- -webkit-mask-image: none;
26
- mask-image: none;
27
- text-decoration: underline dotted currentColor;
28
- text-underline-offset: 3px;
29
- }
30
- }
31
- `;
32
- function ensureShimmerStyles() {
33
- if (typeof document === "undefined") return;
34
- if (document.getElementById(STYLE_ID)) return;
35
- const style = document.createElement("style");
36
- style.id = STYLE_ID;
37
- style.textContent = SHIMMER_CSS;
38
- document.head.appendChild(style);
39
- }
40
- var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
41
- function TextShimmer({
42
- children,
43
- className,
44
- durationMs = 1400
45
- }) {
46
- useIsomorphicLayoutEffect(ensureShimmerStyles, []);
47
- return /* @__PURE__ */ jsx(
48
- "span",
49
- {
50
- className: cn(CLASS_NAME, "text-foreground", className),
51
- style: { animationDuration: `${durationMs}ms` },
52
- children
53
- }
54
- );
55
- }
56
-
57
- export {
58
- TextShimmer
59
- };