@tangle-network/ui 11.12.0 → 11.13.1
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 +24 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/auth/auth.d.ts +53 -0
- package/dist/{auth-DOETfnd9.js → auth/auth.js} +7 -37
- package/dist/auth/login-layout.d.ts +20 -0
- package/dist/auth/login-layout.js +36 -0
- package/dist/auth.d.ts +2 -1
- package/dist/auth.js +2 -1
- package/dist/chat/agent-timeline.d.ts +83 -0
- package/dist/chat/agent-timeline.js +236 -0
- package/dist/chat/chat-container.d.ts +51 -0
- package/dist/chat/chat-container.js +309 -0
- package/dist/chat/chat-message.d.ts +22 -0
- package/dist/chat/chat-message.js +38 -0
- package/dist/chat/message-list.d.ts +32 -0
- package/dist/chat/message-list.js +37 -0
- package/dist/chat/thinking-indicator.d.ts +6 -0
- package/dist/chat/thinking-indicator.js +38 -0
- package/dist/chat/user-message.d.ts +21 -0
- package/dist/chat/user-message.js +42 -0
- package/dist/chat.d.ts +6 -1
- package/dist/chat.js +6 -1
- package/dist/editor/document-editor-pane.d.ts +37 -0
- package/dist/editor/document-editor-pane.js +199 -0
- package/dist/editor/editor-lazy.js +37 -0
- package/dist/editor/editor-loading.js +21 -0
- package/dist/editor/editor-peers.d.ts +6 -0
- package/dist/editor/editor-peers.js +155 -0
- package/dist/editor/editor-provider.d.ts +97 -0
- package/dist/editor/editor-provider.js +253 -0
- package/dist/editor/editor-toolbar.d.ts +11 -0
- package/dist/editor/editor-toolbar.js +106 -0
- package/dist/editor/markdown-conversion.js +23 -0
- package/dist/editor/markdown-document-editor.js +103 -0
- package/dist/editor/tiptap-editor.d.ts +45 -0
- package/dist/editor/tiptap-editor.js +271 -0
- package/dist/editor/use-editor.d.ts +67 -0
- package/dist/editor/use-editor.js +158 -0
- package/dist/editor.d.ts +6 -119
- package/dist/editor.js +5 -1
- package/dist/files/file-artifact-pane.d.ts +47 -0
- package/dist/files/file-artifact-pane.js +114 -0
- package/dist/files/file-format.d.ts +51 -0
- package/dist/{file-format-BgXbr-Ib.js → files/file-format.js} +1 -1
- package/dist/files/file-preview.d.ts +27 -0
- package/dist/files/file-preview.js +359 -0
- package/dist/files/file-tabs.d.ts +19 -0
- package/dist/files/file-tabs.js +48 -0
- package/dist/files/file-tree.d.ts +31 -0
- package/dist/files/file-tree.js +135 -0
- package/dist/files/rich-file-tree.d.ts +62 -0
- package/dist/files/rich-file-tree.js +122 -0
- package/dist/files.d.ts +6 -1
- package/dist/files.js +6 -2
- package/dist/hooks/use-auth.d.ts +40 -0
- package/dist/hooks/use-auth.js +91 -0
- package/dist/hooks/use-auto-scroll.d.ts +11 -0
- package/dist/hooks/use-auto-scroll.js +48 -0
- package/dist/hooks/use-dropdown-menu.d.ts +12 -0
- package/dist/hooks/use-dropdown-menu.js +31 -0
- package/dist/hooks/use-live-time.d.ts +7 -0
- package/dist/hooks/use-live-time.js +22 -0
- package/dist/hooks/use-realtime-session.d.ts +32 -0
- package/dist/hooks/use-realtime-session.js +235 -0
- package/dist/hooks/use-run-collapse-state.d.ts +13 -0
- package/dist/hooks/use-run-collapse-state.js +24 -0
- package/dist/hooks/use-run-groups.d.ts +11 -0
- package/dist/hooks/use-run-groups.js +85 -0
- package/dist/hooks/use-sdk-session.d.ts +59 -0
- package/dist/hooks/use-sdk-session.js +322 -0
- package/dist/hooks/use-sse-stream.d.ts +124 -0
- package/dist/hooks/use-sse-stream.js +229 -0
- package/dist/hooks/use-tool-call-stream.d.ts +23 -0
- package/dist/hooks/use-tool-call-stream.js +75 -0
- package/dist/hooks.d.ts +11 -49
- package/dist/hooks.js +10 -110
- package/dist/index.d.ts +99 -25
- package/dist/index.js +86 -36
- package/dist/lib/focus.d.ts +55 -0
- package/dist/{focus-BcE_SHqz.js → lib/focus.js} +1 -1
- package/dist/lib/utils.d.ts +4 -0
- package/dist/{utils-C_uf36nf.js → lib/utils.js} +1 -1
- package/dist/{code-block-B9miUPht.d.ts → markdown/code-block.d.ts} +5 -6
- package/dist/{code-block-B36KVUSN.js → markdown/code-block.js} +60 -55
- package/dist/{markdown-C0atSabr.d.ts → markdown/markdown.d.ts} +4 -5
- package/dist/{markdown-Db08KAYF.js → markdown/markdown.js} +3 -3
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +2 -2
- package/dist/{openui-artifact-renderer-fkBQaoLO.d.ts → openui/openui-artifact-renderer.d.ts} +20 -21
- package/dist/{openui-artifact-renderer-DG_i2lOR.js → openui/openui-artifact-renderer.js} +9 -7
- package/dist/{schema-BpW9rSSG.js → openui/schema-compiled.js} +2 -354
- package/dist/{schema-DAstk-J4.d.ts → openui/schema-data.d.ts} +3 -24
- package/dist/openui/schema-data.js +206 -0
- package/dist/openui-schema.d.ts +22 -3
- package/dist/openui-schema.js +138 -1
- package/dist/openui.d.ts +3 -2
- package/dist/openui.js +3 -2
- package/dist/{artifact-pane-BL_DFWNl.d.ts → primitives/artifact-pane.d.ts} +3 -4
- package/dist/{artifact-pane-DMXT9a8U.js → primitives/artifact-pane.js} +2 -2
- package/dist/primitives/avatar.d.ts +8 -0
- package/dist/primitives/avatar.js +25 -0
- package/dist/primitives/badge.d.ts +22 -0
- package/dist/primitives/badge.js +47 -0
- package/dist/{button-yoIv77e2.d.ts → primitives/button.d.ts} +2 -2
- package/dist/primitives/button.js +113 -0
- package/dist/primitives/card.d.ts +18 -0
- package/dist/primitives/card.js +52 -0
- package/dist/primitives/code-block.d.ts +6 -0
- package/dist/primitives/code-block.js +13 -0
- package/dist/primitives/dialog.d.ts +23 -0
- package/dist/primitives/dialog.js +59 -0
- package/dist/primitives/drop-zone.d.ts +23 -0
- package/dist/primitives/drop-zone.js +104 -0
- package/dist/primitives/dropdown-menu.d.ts +29 -0
- package/dist/{dropdown-menu-BpcLa5vF.js → primitives/dropdown-menu.js} +2 -23
- package/dist/primitives/empty-state.d.ts +11 -0
- package/dist/primitives/empty-state.js +32 -0
- package/dist/primitives/heading.d.ts +23 -0
- package/dist/primitives/heading.js +38 -0
- package/dist/primitives/input.d.ts +23 -0
- package/dist/primitives/input.js +110 -0
- package/dist/primitives/label.d.ts +6 -0
- package/dist/primitives/label.js +16 -0
- package/dist/primitives/metric-strip.d.ts +48 -0
- package/dist/primitives/metric-strip.js +52 -0
- package/dist/primitives/page-header.d.ts +25 -0
- package/dist/primitives/page-header.js +47 -0
- package/dist/primitives/page-shell.d.ts +14 -0
- package/dist/primitives/page-shell.js +17 -0
- package/dist/primitives/progress.d.ts +9 -0
- package/dist/primitives/progress.js +29 -0
- package/dist/primitives/segmented-control.d.ts +40 -0
- package/dist/primitives/segmented-control.js +57 -0
- package/dist/primitives/select.d.ts +15 -0
- package/dist/primitives/select.js +74 -0
- package/dist/primitives/sidebar-drop-zone.d.ts +21 -0
- package/dist/primitives/sidebar-drop-zone.js +88 -0
- package/dist/primitives/skeleton.d.ts +10 -0
- package/dist/primitives/skeleton.js +50 -0
- package/dist/primitives/stat-card.d.ts +16 -0
- package/dist/primitives/stat-card.js +60 -0
- package/dist/primitives/status-pill.d.ts +44 -0
- package/dist/primitives/status-pill.js +119 -0
- package/dist/primitives/switch.d.ts +6 -0
- package/dist/primitives/switch.js +16 -0
- package/dist/primitives/table.d.ts +22 -0
- package/dist/primitives/table.js +63 -0
- package/dist/primitives/tabs.d.ts +13 -0
- package/dist/{tabs-BVHR6NkO.js → primitives/tabs.js} +3 -3
- package/dist/primitives/terminal-display.d.ts +25 -0
- package/dist/primitives/terminal-display.js +109 -0
- package/dist/primitives/text-shimmer.d.ts +16 -0
- package/dist/{text-shimmer-BUUo6I-g.js → primitives/text-shimmer.js} +2 -2
- package/dist/primitives/theme-toggle.d.ts +11 -0
- package/dist/primitives/theme-toggle.js +154 -0
- package/dist/primitives/toast.d.ts +29 -0
- package/dist/primitives/toast.js +142 -0
- package/dist/primitives/toolbar.d.ts +55 -0
- package/dist/primitives/toolbar.js +37 -0
- package/dist/primitives/upload-progress.d.ts +23 -0
- package/dist/primitives/upload-progress.js +72 -0
- package/dist/primitives.d.ts +35 -5
- package/dist/primitives.js +35 -9
- package/dist/{index-COgqsFAQ.d.ts → redaction/redacted-document.d.ts} +6 -7
- package/dist/{redaction-CGGB2ENG.js → redaction/redacted-document.js} +2 -2
- package/dist/redaction.d.ts +1 -1
- package/dist/redaction.js +1 -1
- package/dist/run/expandable-content.js +41 -0
- package/dist/run/expanded-tool-detail.d.ts +12 -0
- package/dist/run/expanded-tool-detail.js +163 -0
- package/dist/run/inline-thinking-item.d.ts +11 -0
- package/dist/run/inline-thinking-item.js +60 -0
- package/dist/run/inline-tool-item.d.ts +25 -0
- package/dist/run/inline-tool-item.js +63 -0
- package/dist/run/run-group.d.ts +26 -0
- package/dist/{run-group-BWGeesgs.js → run/run-group.js} +9 -60
- package/dist/run/run-item-primitives.d.ts +5 -0
- package/dist/{run-ZsIKPA6J.js → run/run-item-primitives.js} +2 -2
- package/dist/run/run-row-shell.d.ts +53 -0
- package/dist/run/run-row-shell.js +114 -0
- package/dist/{tool-call-feed-BeB1_4pX.d.ts → run/tool-call-feed.d.ts} +7 -12
- package/dist/{tool-call-feed-BpmMLpPX.js → run/tool-call-feed.js} +4 -4
- package/dist/run/tool-call-step.d.ts +5 -0
- package/dist/run/tool-call-step.js +82 -0
- package/dist/run.d.ts +8 -2
- package/dist/run.js +7 -4
- package/dist/sdk-hooks.d.ts +8 -1
- package/dist/sdk-hooks.js +8 -2
- package/dist/stores/active-sessions-store.d.ts +83 -0
- package/dist/{active-sessions-store-Gt1R0rFG.js → stores/active-sessions-store.js} +1 -1
- package/dist/stores/chat-store.d.ts +14 -0
- package/dist/stores/chat-store.js +33 -0
- package/dist/stores.d.ts +3 -16
- package/dist/stores.js +2 -33
- package/dist/tool-previews/command-preview.d.ts +11 -0
- package/dist/tool-previews/command-preview.js +91 -0
- package/dist/tool-previews/diff-preview.d.ts +7 -0
- package/dist/tool-previews/diff-preview.js +76 -0
- package/dist/tool-previews/glob-results-preview.d.ts +7 -0
- package/dist/tool-previews/glob-results-preview.js +53 -0
- package/dist/tool-previews/grep-results-preview.d.ts +7 -0
- package/dist/tool-previews/grep-results-preview.js +99 -0
- package/dist/tool-previews/preview-primitives.js +58 -0
- package/dist/tool-previews/question-preview.d.ts +7 -0
- package/dist/tool-previews/question-preview.js +63 -0
- package/dist/tool-previews/web-search-preview.d.ts +7 -0
- package/dist/tool-previews/web-search-preview.js +78 -0
- package/dist/tool-previews/write-file-preview.d.ts +11 -0
- package/dist/tool-previews/write-file-preview.js +52 -0
- package/dist/tool-previews.d.ts +7 -1
- package/dist/tool-previews.js +7 -1
- package/dist/{branding-26d5ARIr.d.ts → types/branding.d.ts} +2 -3
- package/dist/{message-vhUI0c5G.d.ts → types/message.d.ts} +2 -3
- package/dist/{parts-5mhy9yJ3.d.ts → types/parts.d.ts} +8 -9
- package/dist/{run-OyWmIDqu.d.ts → types/run.d.ts} +9 -10
- package/dist/{tool-display-DgmL5rIU.d.ts → types/tool-display.d.ts} +5 -6
- package/dist/types.d.ts +5 -5
- package/dist/utils/copy-text.d.ts +7 -0
- package/dist/{utils-Bl_CZ0Qp.js → utils/copy-text.js} +1 -11
- package/dist/utils/format.d.ts +22 -0
- package/dist/{format-DfcLWqMa.js → utils/format.js} +1 -1
- package/dist/utils/time-ago.d.ts +3 -0
- package/dist/utils/time-ago.js +11 -0
- package/dist/utils/tool-display.d.ts +16 -0
- package/dist/{tool-display-BAuAVa43.js → utils/tool-display.js} +1 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +6 -5
- package/package.json +2 -2
- package/src/files/rich-file-tree.stories.tsx +1 -1
- package/src/files/rich-file-tree.tsx +12 -9
- package/src/markdown/code-block.test.tsx +80 -2
- package/src/markdown/code-block.tsx +76 -80
- package/src/primitives/button.stories.tsx +37 -1
- package/src/primitives/button.test.tsx +230 -0
- package/src/primitives/button.tsx +62 -14
- package/src/primitives/card-anatomy.stories.tsx +51 -0
- package/src/primitives/card.test.tsx +71 -0
- package/src/primitives/card.tsx +25 -13
- package/src/primitives/heading.stories.tsx +35 -0
- package/src/primitives/heading.test.tsx +56 -0
- package/src/primitives/heading.tsx +76 -0
- package/src/primitives/index.ts +8 -0
- package/src/primitives/input.stories.tsx +28 -0
- package/src/primitives/input.test.tsx +161 -0
- package/src/primitives/input.tsx +34 -28
- package/src/primitives/page-header.stories.tsx +51 -0
- package/src/primitives/page-header.test.tsx +48 -0
- package/src/primitives/page-header.tsx +35 -35
- package/src/primitives/page-shell.stories.tsx +89 -0
- package/src/primitives/page-shell.test.tsx +24 -0
- package/src/primitives/page-shell.tsx +26 -0
- package/src/primitives/table-wrapper.stories.tsx +54 -0
- package/src/primitives/table.test.tsx +72 -0
- package/src/primitives/table.tsx +33 -12
- package/src/primitives/theme-toggle.test.tsx +167 -0
- package/src/primitives/theme-toggle.tsx +111 -39
- package/dist/active-sessions-store-nl70ZnMC.d.ts +0 -84
- package/dist/button-C87nEe2R.js +0 -78
- package/dist/chat-DDvF2oGQ.js +0 -672
- package/dist/diff-preview-BcK3nRXb.js +0 -533
- package/dist/document-editor-pane-BilJfiCo.d.ts +0 -136
- package/dist/document-editor-pane-POsq5Q0o.js +0 -1279
- package/dist/files-hywocVZz.js +0 -753
- package/dist/index-2UntyjBb.d.ts +0 -52
- package/dist/index-BgUHilZm.d.ts +0 -108
- package/dist/index-CJ8wRfiC.d.ts +0 -236
- package/dist/index-CPDET_s1.d.ts +0 -549
- package/dist/index-Cg6gYAqh.d.ts +0 -73
- package/dist/index-Cs7j8V7l.d.ts +0 -203
- package/dist/index-DjKxO357.d.ts +0 -128
- package/dist/primitives-Bx59fT-U.js +0 -1239
- package/dist/table-Bss73DhB.js +0 -146
- package/dist/tool-call-step-DNebqhmX.js +0 -434
- package/dist/use-auto-scroll-C5Pjeqon.js +0 -153
- package/dist/use-sse-stream-DjqRuDft.js +0 -884
- package/dist/use-sse-stream-Dm6R5YWz.d.ts +0 -282
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TextShimmer } from "../primitives/text-shimmer.js";
|
|
2
|
+
import { truncateText } from "../utils/format.js";
|
|
3
|
+
import { ExpandableContent } from "./expandable-content.js";
|
|
4
|
+
import { RunRowShell } from "./run-row-shell.js";
|
|
5
|
+
import { Markdown } from "../markdown/markdown.js";
|
|
6
|
+
import { memo, useEffect, useRef, useState } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Brain } from "lucide-react";
|
|
9
|
+
//#region src/run/inline-thinking-item.tsx
|
|
10
|
+
const InlineThinkingItem = memo(({ part, defaultOpen = false, autoCollapse = true, className, contentClassName }) => {
|
|
11
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
12
|
+
const autoCollapsedRef = useRef(false);
|
|
13
|
+
const startTime = part.time?.start;
|
|
14
|
+
const endTime = part.time?.end;
|
|
15
|
+
const durationMs = startTime != null && endTime != null ? endTime - startTime : void 0;
|
|
16
|
+
const isActive = startTime != null && endTime == null;
|
|
17
|
+
const preview = part.text ? truncateText(part.text, 120) : void 0;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (isActive) {
|
|
20
|
+
autoCollapsedRef.current = false;
|
|
21
|
+
setOpen(true);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (autoCollapse && !autoCollapsedRef.current && durationMs != null) {
|
|
25
|
+
const timer = window.setTimeout(() => {
|
|
26
|
+
setOpen(false);
|
|
27
|
+
autoCollapsedRef.current = true;
|
|
28
|
+
}, 900);
|
|
29
|
+
return () => window.clearTimeout(timer);
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
autoCollapse,
|
|
33
|
+
durationMs,
|
|
34
|
+
isActive
|
|
35
|
+
]);
|
|
36
|
+
return /* @__PURE__ */ jsx(RunRowShell, {
|
|
37
|
+
icon: /* @__PURE__ */ jsx(Brain, { className: "h-3.5 w-3.5" }),
|
|
38
|
+
title: isActive ? /* @__PURE__ */ jsx(TextShimmer, { children: "Thinking…" }) : "Reasoning",
|
|
39
|
+
description: preview,
|
|
40
|
+
status: isActive ? "running" : "idle",
|
|
41
|
+
durationMs,
|
|
42
|
+
open,
|
|
43
|
+
onOpenChange: setOpen,
|
|
44
|
+
className,
|
|
45
|
+
children: part.text ? /* @__PURE__ */ jsx(ExpandableContent, {
|
|
46
|
+
fadeClassName: "from-[var(--md3-surface-container)]",
|
|
47
|
+
className: contentClassName ? `px-3 py-3 ${contentClassName}` : "px-3 py-3",
|
|
48
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: "text-sm leading-relaxed text-foreground",
|
|
50
|
+
children: /* @__PURE__ */ jsx(Markdown, { children: part.text })
|
|
51
|
+
})
|
|
52
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
53
|
+
className: "px-3 py-2.5 text-xs text-muted-foreground",
|
|
54
|
+
children: "No reasoning text provided."
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
InlineThinkingItem.displayName = "InlineThinkingItem";
|
|
59
|
+
//#endregion
|
|
60
|
+
export { InlineThinkingItem };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ToolPart } from "../types/parts.js";
|
|
2
|
+
import { CustomToolRenderer } from "../types/tool-display.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/run/inline-tool-item.d.ts
|
|
5
|
+
export interface InlineToolItemProps {
|
|
6
|
+
part: ToolPart;
|
|
7
|
+
renderToolDetail?: CustomToolRenderer;
|
|
8
|
+
groupPosition?: "single" | "first" | "middle" | "last";
|
|
9
|
+
className?: string;
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
actions?: ReactNode;
|
|
12
|
+
/** Override the derived title (default: from `getToolDisplayMetadata`). */
|
|
13
|
+
title?: string;
|
|
14
|
+
/** Override the derived inline description. */
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Compact single-line tool call display: a category glyph, the tool verb, and
|
|
19
|
+
* the path or command it acted on. While the call runs the verb shimmers;
|
|
20
|
+
* once it completes the row goes quiet (duration on hover, a red dot only on
|
|
21
|
+
* error). Expands on click to show ExpandedToolDetail. Rendered through the
|
|
22
|
+
* shared RunRowShell so it stays consistent with the reasoning row.
|
|
23
|
+
*/
|
|
24
|
+
export declare const InlineToolItem: import("react").MemoExoticComponent<({ part, renderToolDetail, groupPosition, className, contentClassName, actions, title: titleOverride, description: descriptionOverride }: InlineToolItemProps) => import("react").JSX.Element>;
|
|
25
|
+
//#endregion
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { TextShimmer } from "../primitives/text-shimmer.js";
|
|
3
|
+
import { getToolCategory, getToolDisplayMetadata, getToolErrorText } from "../utils/tool-display.js";
|
|
4
|
+
import { ExpandedToolDetail } from "./expanded-tool-detail.js";
|
|
5
|
+
import { RunRowShell } from "./run-row-shell.js";
|
|
6
|
+
import { memo } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { Bot, ClipboardList, FileEdit, FileSearch, Globe, PencilLine, Search, Settings, Terminal } from "lucide-react";
|
|
9
|
+
//#region src/run/inline-tool-item.tsx
|
|
10
|
+
/** Map tool category to a lucide-react icon component. */
|
|
11
|
+
const TOOL_CATEGORY_ICON_MAP = {
|
|
12
|
+
command: Terminal,
|
|
13
|
+
write: FileEdit,
|
|
14
|
+
read: FileSearch,
|
|
15
|
+
search: Search,
|
|
16
|
+
edit: PencilLine,
|
|
17
|
+
task: Bot,
|
|
18
|
+
web: Globe,
|
|
19
|
+
todo: ClipboardList,
|
|
20
|
+
other: Settings
|
|
21
|
+
};
|
|
22
|
+
/** Map the tool part status onto the shared row status vocabulary. */
|
|
23
|
+
function toRowStatus(status) {
|
|
24
|
+
if (status === "pending" || status === "running") return "running";
|
|
25
|
+
if (status === "error") return "error";
|
|
26
|
+
return "success";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Compact single-line tool call display: a category glyph, the tool verb, and
|
|
30
|
+
* the path or command it acted on. While the call runs the verb shimmers;
|
|
31
|
+
* once it completes the row goes quiet (duration on hover, a red dot only on
|
|
32
|
+
* error). Expands on click to show ExpandedToolDetail. Rendered through the
|
|
33
|
+
* shared RunRowShell so it stays consistent with the reasoning row.
|
|
34
|
+
*/
|
|
35
|
+
const InlineToolItem = memo(({ part, renderToolDetail, groupPosition = "single", className, contentClassName, actions, title: titleOverride, description: descriptionOverride }) => {
|
|
36
|
+
const meta = getToolDisplayMetadata(part);
|
|
37
|
+
const title = titleOverride ?? meta.title;
|
|
38
|
+
const description = descriptionOverride ?? meta.description;
|
|
39
|
+
const errorText = getToolErrorText(part);
|
|
40
|
+
const startTime = part.state.time?.start;
|
|
41
|
+
const endTime = part.state.time?.end;
|
|
42
|
+
const durationMs = startTime != null && endTime != null ? endTime - startTime : void 0;
|
|
43
|
+
const category = getToolCategory(part.tool);
|
|
44
|
+
const DefaultIcon = TOOL_CATEGORY_ICON_MAP[category] ?? Settings;
|
|
45
|
+
const status = toRowStatus(part.state.status);
|
|
46
|
+
return /* @__PURE__ */ jsx(RunRowShell, {
|
|
47
|
+
icon: /* @__PURE__ */ jsx(DefaultIcon, { className: "h-3.5 w-3.5" }),
|
|
48
|
+
title: status === "running" ? /* @__PURE__ */ jsx(TextShimmer, { children: title }) : title,
|
|
49
|
+
description,
|
|
50
|
+
descriptionMono: true,
|
|
51
|
+
status,
|
|
52
|
+
durationMs,
|
|
53
|
+
groupPosition,
|
|
54
|
+
collapsedError: errorText ?? void 0,
|
|
55
|
+
actions,
|
|
56
|
+
className,
|
|
57
|
+
contentClassName: cn("p-2", contentClassName),
|
|
58
|
+
children: renderToolDetail?.(part) ?? /* @__PURE__ */ jsx(ExpandedToolDetail, { part })
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
InlineToolItem.displayName = "InlineToolItem";
|
|
62
|
+
//#endregion
|
|
63
|
+
export { InlineToolItem };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SessionPart, ToolPart } from "../types/parts.js";
|
|
2
|
+
import { AgentBranding } from "../types/branding.js";
|
|
3
|
+
import { CustomToolRenderer } from "../types/tool-display.js";
|
|
4
|
+
import { Run } from "../types/run.js";
|
|
5
|
+
import { ReactNode } from "react";
|
|
6
|
+
//#region src/run/run-group.d.ts
|
|
7
|
+
export interface RunGroupProps {
|
|
8
|
+
run: Run;
|
|
9
|
+
partMap: Record<string, SessionPart[]>;
|
|
10
|
+
collapsed: boolean;
|
|
11
|
+
onToggle: () => void;
|
|
12
|
+
branding?: AgentBranding;
|
|
13
|
+
renderToolDetail?: CustomToolRenderer;
|
|
14
|
+
headerActions?: ReactNode;
|
|
15
|
+
renderToolActions?: (part: ToolPart, options: {
|
|
16
|
+
run: Run;
|
|
17
|
+
messageId: string;
|
|
18
|
+
partIndex: number;
|
|
19
|
+
}) => ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Collapsible container for a consecutive group of assistant messages (a "run").
|
|
23
|
+
* Shows a summary header with stats and renders tool/thinking/text parts.
|
|
24
|
+
*/
|
|
25
|
+
export declare const RunGroup: import("react").MemoExoticComponent<({ run, partMap, collapsed, onToggle, branding, renderToolDetail, headerActions, renderToolActions }: RunGroupProps) => import("react").JSX.Element | null>;
|
|
26
|
+
//#endregion
|
|
@@ -1,64 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { memo,
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { formatDuration } from "../utils/format.js";
|
|
3
|
+
import { InlineToolItem } from "./inline-tool-item.js";
|
|
4
|
+
import { Markdown } from "../markdown/markdown.js";
|
|
5
|
+
import { InlineThinkingItem } from "./inline-thinking-item.js";
|
|
6
|
+
import { OpenUIArtifactRenderer } from "../openui/openui-artifact-renderer.js";
|
|
7
|
+
import { memo, useMemo } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { Bot,
|
|
9
|
+
import { Bot, ChevronDown, ChevronRight, ClipboardList, FileEdit, FileSearch, Globe, Loader2, PencilLine, Search, Settings, Sparkles, Terminal } from "lucide-react";
|
|
10
10
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
11
|
-
//#region src/run/inline-thinking-item.tsx
|
|
12
|
-
const InlineThinkingItem = memo(({ part, defaultOpen = false, autoCollapse = true, className, contentClassName }) => {
|
|
13
|
-
const [open, setOpen] = useState(defaultOpen);
|
|
14
|
-
const autoCollapsedRef = useRef(false);
|
|
15
|
-
const startTime = part.time?.start;
|
|
16
|
-
const endTime = part.time?.end;
|
|
17
|
-
const durationMs = startTime != null && endTime != null ? endTime - startTime : void 0;
|
|
18
|
-
const isActive = startTime != null && endTime == null;
|
|
19
|
-
const preview = part.text ? truncateText(part.text, 120) : void 0;
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (isActive) {
|
|
22
|
-
autoCollapsedRef.current = false;
|
|
23
|
-
setOpen(true);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (autoCollapse && !autoCollapsedRef.current && durationMs != null) {
|
|
27
|
-
const timer = window.setTimeout(() => {
|
|
28
|
-
setOpen(false);
|
|
29
|
-
autoCollapsedRef.current = true;
|
|
30
|
-
}, 900);
|
|
31
|
-
return () => window.clearTimeout(timer);
|
|
32
|
-
}
|
|
33
|
-
}, [
|
|
34
|
-
autoCollapse,
|
|
35
|
-
durationMs,
|
|
36
|
-
isActive
|
|
37
|
-
]);
|
|
38
|
-
return /* @__PURE__ */ jsx(RunRowShell, {
|
|
39
|
-
icon: /* @__PURE__ */ jsx(Brain, { className: "h-3.5 w-3.5" }),
|
|
40
|
-
title: isActive ? /* @__PURE__ */ jsx(TextShimmer, { children: "Thinking…" }) : "Reasoning",
|
|
41
|
-
description: preview,
|
|
42
|
-
status: isActive ? "running" : "idle",
|
|
43
|
-
durationMs,
|
|
44
|
-
open,
|
|
45
|
-
onOpenChange: setOpen,
|
|
46
|
-
className,
|
|
47
|
-
children: part.text ? /* @__PURE__ */ jsx(ExpandableContent, {
|
|
48
|
-
fadeClassName: "from-[var(--md3-surface-container)]",
|
|
49
|
-
className: contentClassName ? `px-3 py-3 ${contentClassName}` : "px-3 py-3",
|
|
50
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
51
|
-
className: "text-sm leading-relaxed text-foreground",
|
|
52
|
-
children: /* @__PURE__ */ jsx(Markdown, { children: part.text })
|
|
53
|
-
})
|
|
54
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
55
|
-
className: "px-3 py-2.5 text-xs text-muted-foreground",
|
|
56
|
-
children: "No reasoning text provided."
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
InlineThinkingItem.displayName = "InlineThinkingItem";
|
|
61
|
-
//#endregion
|
|
62
11
|
//#region src/run/run-group.tsx
|
|
63
12
|
/**
|
|
64
13
|
* One row on the run's timeline spine: a connector line + accent dot in a
|
|
@@ -407,4 +356,4 @@ const RunGroup = memo(({ run, partMap, collapsed, onToggle, branding = DEFAULT_B
|
|
|
407
356
|
});
|
|
408
357
|
RunGroup.displayName = "RunGroup";
|
|
409
358
|
//#endregion
|
|
410
|
-
export {
|
|
359
|
+
export { RunGroup };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatDuration } from "../utils/format.js";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/run/run-item-primitives.tsx
|
|
@@ -14,4 +14,4 @@ function LiveDuration({ startTime }) {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
|
-
export { LiveDuration
|
|
17
|
+
export { LiveDuration };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/run/run-row-shell.d.ts
|
|
3
|
+
export type RunRowStatus = "running" | "success" | "error" | "idle";
|
|
4
|
+
/**
|
|
5
|
+
* Trailing status indicator shared by every run row. Only `error` draws a
|
|
6
|
+
* mark (a red dot). Success is silence, and a running row carries its state in
|
|
7
|
+
* the title — a `TextShimmer` sweep — so neither renders anything here.
|
|
8
|
+
*/
|
|
9
|
+
export declare function RunRowStatusDot({ status }: {
|
|
10
|
+
status: RunRowStatus;
|
|
11
|
+
}): import("react").JSX.Element | null;
|
|
12
|
+
export interface RunRowShellProps {
|
|
13
|
+
/** Semantic lead glyph (14px). At rest it is the row's only ornament; on
|
|
14
|
+
* hover and while open the expand chevron takes its slot. */
|
|
15
|
+
icon: ReactNode;
|
|
16
|
+
/** Row title. A string in the common case; a node when the title carries its
|
|
17
|
+
* own treatment — a running row passes `<TextShimmer>` here, which is the
|
|
18
|
+
* whole in-flight signal (the shell draws no spinner). */
|
|
19
|
+
title: ReactNode;
|
|
20
|
+
/** Secondary inline text (tool path/command, or a reasoning preview). */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Render the description in mono (tools) vs prose (reasoning). */
|
|
23
|
+
descriptionMono?: boolean;
|
|
24
|
+
status?: RunRowStatus;
|
|
25
|
+
/** @deprecated The shell no longer ticks a live duration while running; the
|
|
26
|
+
* running state lives in the title (`TextShimmer`). Accepted and ignored so
|
|
27
|
+
* existing callers keep compiling. */
|
|
28
|
+
startTime?: number;
|
|
29
|
+
/** Static duration, revealed on hover once the row is no longer running. */
|
|
30
|
+
durationMs?: number;
|
|
31
|
+
/** Radius shaping when rows are stacked into a group. */
|
|
32
|
+
groupPosition?: "single" | "first" | "middle" | "last";
|
|
33
|
+
/** Message shown below the header while collapsed (tool errors). */
|
|
34
|
+
collapsedError?: string;
|
|
35
|
+
actions?: ReactNode;
|
|
36
|
+
/** Controlled open state. Omit for internal (uncontrolled) state. */
|
|
37
|
+
open?: boolean;
|
|
38
|
+
onOpenChange?: (open: boolean) => void;
|
|
39
|
+
defaultOpen?: boolean;
|
|
40
|
+
className?: string;
|
|
41
|
+
contentClassName?: string;
|
|
42
|
+
/** Expanded body. When absent the row is not expandable. */
|
|
43
|
+
children?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Shared shell for the agent activity rows (reasoning + tool). A quiet
|
|
47
|
+
* one-liner at rest — bare glyph, muted title and description, no fill, no
|
|
48
|
+
* border — that becomes a bordered card only while open. The border is always
|
|
49
|
+
* present (transparent at rest) so hover and expand never shift layout.
|
|
50
|
+
* Both row kinds render through it so they read as one family.
|
|
51
|
+
*/
|
|
52
|
+
export declare function RunRowShell({ icon, title, description, descriptionMono, status, durationMs, groupPosition, collapsedError, actions, open: openProp, onOpenChange, defaultOpen, className, contentClassName, children }: RunRowShellProps): import("react").JSX.Element;
|
|
53
|
+
//#endregion
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { formatDuration } from "../utils/format.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
7
|
+
//#region src/run/run-row-shell.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Trailing status indicator shared by every run row. Only `error` draws a
|
|
10
|
+
* mark (a red dot). Success is silence, and a running row carries its state in
|
|
11
|
+
* the title — a `TextShimmer` sweep — so neither renders anything here.
|
|
12
|
+
*/
|
|
13
|
+
function RunRowStatusDot({ status }) {
|
|
14
|
+
if (status !== "error") return null;
|
|
15
|
+
return /* @__PURE__ */ jsx("span", {
|
|
16
|
+
"data-run-row-status": "error",
|
|
17
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-[var(--surface-danger-text)]"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
const SHAPE_CLASS = {
|
|
21
|
+
single: "rounded-[var(--radius-lg)]",
|
|
22
|
+
first: "rounded-t-[var(--radius-lg)] rounded-b-[var(--radius-sm)]",
|
|
23
|
+
middle: "rounded-[var(--radius-sm)]",
|
|
24
|
+
last: "rounded-t-[var(--radius-sm)] rounded-b-[var(--radius-lg)]"
|
|
25
|
+
};
|
|
26
|
+
const HEADER_INSET = "px-2 py-1";
|
|
27
|
+
const ERROR_INDENT = "pl-[2.375rem]";
|
|
28
|
+
/**
|
|
29
|
+
* Shared shell for the agent activity rows (reasoning + tool). A quiet
|
|
30
|
+
* one-liner at rest — bare glyph, muted title and description, no fill, no
|
|
31
|
+
* border — that becomes a bordered card only while open. The border is always
|
|
32
|
+
* present (transparent at rest) so hover and expand never shift layout.
|
|
33
|
+
* Both row kinds render through it so they read as one family.
|
|
34
|
+
*/
|
|
35
|
+
function RunRowShell({ icon, title, description, descriptionMono = false, status = "idle", durationMs, groupPosition = "single", collapsedError, actions, open: openProp, onOpenChange, defaultOpen = false, className, contentClassName, children }) {
|
|
36
|
+
const [openState, setOpenState] = useState(defaultOpen);
|
|
37
|
+
const isControlled = openProp !== void 0;
|
|
38
|
+
const open = isControlled ? openProp : openState;
|
|
39
|
+
const setOpen = (next) => {
|
|
40
|
+
if (!isControlled) setOpenState(next);
|
|
41
|
+
onOpenChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
const isRunning = status === "running";
|
|
44
|
+
const expandable = children != null;
|
|
45
|
+
return /* @__PURE__ */ jsx(Collapsible.Root, {
|
|
46
|
+
open,
|
|
47
|
+
onOpenChange: setOpen,
|
|
48
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
49
|
+
className: "flex items-start gap-2",
|
|
50
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
51
|
+
"data-run-row": "",
|
|
52
|
+
"data-state": open ? "open" : "closed",
|
|
53
|
+
className: cn("group min-w-0 flex-1 overflow-hidden border transition-colors", open ? "border-border bg-[var(--md3-surface-container)]" : "border-transparent bg-transparent", expandable && !open && "hover:bg-[var(--md3-surface-container)]", SHAPE_CLASS[groupPosition], className),
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
56
|
+
asChild: true,
|
|
57
|
+
disabled: !expandable,
|
|
58
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
59
|
+
type: "button",
|
|
60
|
+
className: cn("flex w-full items-center gap-2 text-left", HEADER_INSET, expandable ? "cursor-pointer" : "cursor-default"),
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("span", {
|
|
63
|
+
"aria-hidden": true,
|
|
64
|
+
className: "flex h-[1.375rem] w-[1.375rem] shrink-0 items-center justify-center text-muted-foreground",
|
|
65
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
66
|
+
"data-run-row-glyph": "",
|
|
67
|
+
className: cn("flex items-center justify-center", expandable && "group-hover:hidden", open && "hidden"),
|
|
68
|
+
children: icon
|
|
69
|
+
}), expandable ? /* @__PURE__ */ jsx(ChevronRight, {
|
|
70
|
+
"data-run-row-chevron": "",
|
|
71
|
+
className: cn("hidden h-3.5 w-3.5 transition-transform group-hover:block", open && "block rotate-90")
|
|
72
|
+
}) : null]
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ jsx("span", {
|
|
75
|
+
className: cn("shrink-0 whitespace-nowrap text-sm font-normal text-muted-foreground transition-colors group-hover:text-foreground", open && "text-foreground"),
|
|
76
|
+
children: title
|
|
77
|
+
}),
|
|
78
|
+
description ? /* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: cn("hidden min-w-0 flex-1 truncate text-sm text-muted-foreground transition-colors group-hover:text-foreground sm:inline", descriptionMono && "font-mono"),
|
|
80
|
+
children: description
|
|
81
|
+
}) : null,
|
|
82
|
+
/* @__PURE__ */ jsxs("span", {
|
|
83
|
+
className: "ml-auto flex shrink-0 items-center gap-1.5",
|
|
84
|
+
children: [!isRunning && durationMs != null ? /* @__PURE__ */ jsx("span", {
|
|
85
|
+
"data-run-row-duration": "",
|
|
86
|
+
className: "font-mono text-[10px] tabular-nums text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",
|
|
87
|
+
children: formatDuration(durationMs)
|
|
88
|
+
}) : null, /* @__PURE__ */ jsx(RunRowStatusDot, { status })]
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
}),
|
|
93
|
+
collapsedError && !open ? /* @__PURE__ */ jsx("div", {
|
|
94
|
+
className: cn("pb-1.5 pr-2 text-xs leading-snug text-[var(--surface-danger-text)]", ERROR_INDENT),
|
|
95
|
+
children: collapsedError
|
|
96
|
+
}) : null,
|
|
97
|
+
expandable ? /* @__PURE__ */ jsx(Collapsible.Content, {
|
|
98
|
+
className: "overflow-hidden data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp",
|
|
99
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
100
|
+
className: cn("border-t border-border", contentClassName),
|
|
101
|
+
children
|
|
102
|
+
})
|
|
103
|
+
}) : null
|
|
104
|
+
]
|
|
105
|
+
}), actions ? /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "flex shrink-0 flex-wrap items-center justify-end gap-1.5 pt-1",
|
|
107
|
+
onClick: (event) => event.stopPropagation(),
|
|
108
|
+
children: actions
|
|
109
|
+
}) : null]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { RunRowShell, RunRowStatusDot };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//#region src/run/tool-call-step.d.ts
|
|
3
|
-
type ToolCallType = "bash" | "read" | "write" | "edit" | "glob" | "grep" | "list" | "download" | "inspect" | "audit" | "unknown";
|
|
4
|
-
type ToolCallStatus = "running" | "success" | "error";
|
|
5
|
-
//#endregion
|
|
1
|
+
import { ToolCallStatus, ToolCallType } from "./tool-call-step.js";
|
|
6
2
|
//#region src/run/tool-call-feed.d.ts
|
|
7
|
-
interface ToolCallData {
|
|
3
|
+
export interface ToolCallData {
|
|
8
4
|
id: string;
|
|
9
5
|
type: ToolCallType;
|
|
10
6
|
label: string;
|
|
@@ -13,7 +9,7 @@ interface ToolCallData {
|
|
|
13
9
|
output?: string;
|
|
14
10
|
duration?: number;
|
|
15
11
|
}
|
|
16
|
-
type FeedSegment = {
|
|
12
|
+
export type FeedSegment = {
|
|
17
13
|
kind: "text";
|
|
18
14
|
content: string;
|
|
19
15
|
} | {
|
|
@@ -24,14 +20,14 @@ type FeedSegment = {
|
|
|
24
20
|
title?: string;
|
|
25
21
|
calls: ToolCallData[];
|
|
26
22
|
};
|
|
27
|
-
interface ToolCallFeedProps {
|
|
23
|
+
export interface ToolCallFeedProps {
|
|
28
24
|
segments: FeedSegment[];
|
|
29
25
|
className?: string;
|
|
30
26
|
}
|
|
31
27
|
/**
|
|
32
28
|
* Renders a feed of interleaved text and tool calls.
|
|
33
29
|
*/
|
|
34
|
-
declare function ToolCallFeed({ segments, className }: ToolCallFeedProps): import("react").JSX.Element | null;
|
|
30
|
+
export declare function ToolCallFeed({ segments, className }: ToolCallFeedProps): import("react").JSX.Element | null;
|
|
35
31
|
/**
|
|
36
32
|
* Parse raw SSE tool events into FeedSegments.
|
|
37
33
|
*
|
|
@@ -39,9 +35,8 @@ declare function ToolCallFeed({ segments, className }: ToolCallFeedProps): impor
|
|
|
39
35
|
* and the ToolCallFeed component. Consumers call this in their
|
|
40
36
|
* useToolCallStream hook.
|
|
41
37
|
*/
|
|
42
|
-
declare function parseToolEvent(event: {
|
|
38
|
+
export declare function parseToolEvent(event: {
|
|
43
39
|
type: string;
|
|
44
40
|
data: Record<string, unknown>;
|
|
45
41
|
}): ToolCallData | null;
|
|
46
|
-
//#endregion
|
|
47
|
-
export { parseToolEvent as a, ToolCallFeedProps as i, ToolCallData as n, ToolCallStatus as o, ToolCallFeed as r, ToolCallType as s, FeedSegment as t };
|
|
42
|
+
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { Markdown } from "../markdown/markdown.js";
|
|
3
|
+
import { ToolCallGroup, ToolCallStep } from "./tool-call-step.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/run/tool-call-feed.tsx
|
|
6
6
|
/**
|
|
@@ -106,4 +106,4 @@ function truncate(text, max) {
|
|
|
106
106
|
return text.length > max ? text.slice(0, max - 3) + "..." : text;
|
|
107
107
|
}
|
|
108
108
|
//#endregion
|
|
109
|
-
export {
|
|
109
|
+
export { ToolCallFeed, parseToolEvent };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/run/tool-call-step.d.ts
|
|
3
|
+
export type ToolCallType = "bash" | "read" | "write" | "edit" | "glob" | "grep" | "list" | "download" | "inspect" | "audit" | "unknown";
|
|
4
|
+
export type ToolCallStatus = "running" | "success" | "error";
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { CodeBlock } from "../markdown/code-block.js";
|
|
3
|
+
import { InlineToolItem } from "./inline-tool-item.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/run/tool-call-step.tsx
|
|
6
|
+
const EXT_LANGUAGE = {
|
|
7
|
+
ts: "typescript",
|
|
8
|
+
tsx: "typescript",
|
|
9
|
+
js: "javascript",
|
|
10
|
+
jsx: "javascript",
|
|
11
|
+
mjs: "javascript",
|
|
12
|
+
cjs: "javascript",
|
|
13
|
+
css: "css",
|
|
14
|
+
scss: "scss",
|
|
15
|
+
json: "json",
|
|
16
|
+
jsonc: "json",
|
|
17
|
+
md: "markdown",
|
|
18
|
+
mdx: "markdown",
|
|
19
|
+
py: "python",
|
|
20
|
+
sh: "bash",
|
|
21
|
+
bash: "bash",
|
|
22
|
+
zsh: "bash",
|
|
23
|
+
html: "html",
|
|
24
|
+
htm: "html",
|
|
25
|
+
yaml: "yaml",
|
|
26
|
+
yml: "yaml",
|
|
27
|
+
toml: "toml",
|
|
28
|
+
rs: "rust",
|
|
29
|
+
go: "go",
|
|
30
|
+
sql: "sql",
|
|
31
|
+
xml: "xml"
|
|
32
|
+
};
|
|
33
|
+
function inferLanguage(detail, language) {
|
|
34
|
+
if (language) return language;
|
|
35
|
+
if (!detail) return void 0;
|
|
36
|
+
const ext = detail.split(".").pop()?.toLowerCase();
|
|
37
|
+
return ext ? EXT_LANGUAGE[ext] : void 0;
|
|
38
|
+
}
|
|
39
|
+
const STATUS_MAP = {
|
|
40
|
+
running: "running",
|
|
41
|
+
success: "completed",
|
|
42
|
+
error: "error"
|
|
43
|
+
};
|
|
44
|
+
function ToolCallStep({ type, label, status, detail, output, language, duration, className, actions, part }) {
|
|
45
|
+
const resolvedPart = part ?? {
|
|
46
|
+
type: "tool",
|
|
47
|
+
id: `${type}:${label}`,
|
|
48
|
+
tool: type,
|
|
49
|
+
state: {
|
|
50
|
+
status: STATUS_MAP[status],
|
|
51
|
+
input: detail ? { detail } : void 0,
|
|
52
|
+
output,
|
|
53
|
+
time: duration != null ? {
|
|
54
|
+
start: 0,
|
|
55
|
+
end: duration
|
|
56
|
+
} : void 0
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const lang = inferLanguage(detail, language);
|
|
60
|
+
return /* @__PURE__ */ jsx(InlineToolItem, {
|
|
61
|
+
part: resolvedPart,
|
|
62
|
+
title: label,
|
|
63
|
+
description: detail,
|
|
64
|
+
className,
|
|
65
|
+
actions,
|
|
66
|
+
renderToolDetail: part ? void 0 : output ? () => /* @__PURE__ */ jsx(CodeBlock, {
|
|
67
|
+
code: output,
|
|
68
|
+
language: lang,
|
|
69
|
+
className: "max-h-72 overflow-auto text-xs"
|
|
70
|
+
}) : () => null
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function ToolCallGroup({ title, children, className }) {
|
|
74
|
+
return /* @__PURE__ */ jsx("div", {
|
|
75
|
+
role: "group",
|
|
76
|
+
"aria-label": title,
|
|
77
|
+
className: cn("flex flex-col gap-1", className),
|
|
78
|
+
children
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { ToolCallGroup, ToolCallStep };
|
package/dist/run.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ToolCallStatus, ToolCallType } from "./run/tool-call-step.js";
|
|
2
|
+
import { FeedSegment, ToolCallData, ToolCallFeed, ToolCallFeedProps, parseToolEvent } from "./run/tool-call-feed.js";
|
|
3
|
+
import { RunGroup, RunGroupProps } from "./run/run-group.js";
|
|
4
|
+
import { RunRowShell, RunRowShellProps, RunRowStatus, RunRowStatusDot } from "./run/run-row-shell.js";
|
|
5
|
+
import { InlineToolItem, InlineToolItemProps } from "./run/inline-tool-item.js";
|
|
6
|
+
import { InlineThinkingItem, InlineThinkingItemProps } from "./run/inline-thinking-item.js";
|
|
7
|
+
import { ExpandedToolDetail, ExpandedToolDetailProps } from "./run/expanded-tool-detail.js";
|
|
8
|
+
import { LiveDuration } from "./run/run-item-primitives.js";
|
|
3
9
|
export { ExpandedToolDetail, type ExpandedToolDetailProps, type FeedSegment, InlineThinkingItem, type InlineThinkingItemProps, InlineToolItem, type InlineToolItemProps, LiveDuration, RunGroup, type RunGroupProps, RunRowShell, type RunRowShellProps, type RunRowStatus, RunRowStatusDot, type ToolCallData, ToolCallFeed, type ToolCallFeedProps, type ToolCallStatus, type ToolCallType, parseToolEvent };
|
package/dist/run.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ExpandedToolDetail } from "./run/expanded-tool-detail.js";
|
|
2
|
+
import { RunRowShell, RunRowStatusDot } from "./run/run-row-shell.js";
|
|
3
|
+
import { InlineToolItem } from "./run/inline-tool-item.js";
|
|
4
|
+
import { InlineThinkingItem } from "./run/inline-thinking-item.js";
|
|
5
|
+
import { RunGroup } from "./run/run-group.js";
|
|
6
|
+
import { LiveDuration } from "./run/run-item-primitives.js";
|
|
7
|
+
import { ToolCallFeed, parseToolEvent } from "./run/tool-call-feed.js";
|
|
5
8
|
export { ExpandedToolDetail, InlineThinkingItem, InlineToolItem, LiveDuration, RunGroup, RunRowShell, RunRowStatusDot, ToolCallFeed, parseToolEvent };
|
package/dist/sdk-hooks.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useAutoScroll } from "./hooks/use-auto-scroll.js";
|
|
2
|
+
import { useDropdownMenu } from "./hooks/use-dropdown-menu.js";
|
|
3
|
+
import { useRunCollapseState } from "./hooks/use-run-collapse-state.js";
|
|
4
|
+
import { UseRunGroupsOptions, useRunGroups } from "./hooks/use-run-groups.js";
|
|
5
|
+
import { UseToolCallStreamReturn, useToolCallStream } from "./hooks/use-tool-call-stream.js";
|
|
6
|
+
import { AppendUserMessageOptions, ApplySdkEventOptions, BeginAssistantMessageOptions, CompleteAssistantMessageOptions, SdkSessionAttachment, SdkSessionEvent, SdkSessionSeed, UseSdkSessionOptions, UseSdkSessionReturn, useSdkSession } from "./hooks/use-sdk-session.js";
|
|
7
|
+
import { RealtimeSessionOptions, RealtimeSessionRegistry, RealtimeSessionRegistryProps, RealtimeSessionState, RealtimeSessionTarget, useRealtimeSession } from "./hooks/use-realtime-session.js";
|
|
8
|
+
import { AgentStreamEvent, AutomationStreamEvent, BotStreamEvent, ConnectionState, SSEEvent, TaskStreamEvent, TerminalStreamEvent, UseSSEStreamOptions, UseSSEStreamResult, useSSEStream } from "./hooks/use-sse-stream.js";
|
|
2
9
|
export { type AgentStreamEvent, type AppendUserMessageOptions, type ApplySdkEventOptions, type AutomationStreamEvent, type BeginAssistantMessageOptions, type BotStreamEvent, type CompleteAssistantMessageOptions, type ConnectionState, type RealtimeSessionOptions, RealtimeSessionRegistry, type RealtimeSessionRegistryProps, type RealtimeSessionState, type RealtimeSessionTarget, type SSEEvent, type SdkSessionAttachment, type SdkSessionEvent, type SdkSessionSeed, type TaskStreamEvent, type TerminalStreamEvent, type UseRunGroupsOptions, type UseSSEStreamOptions, type UseSSEStreamResult, type UseSdkSessionOptions, type UseSdkSessionReturn, type UseToolCallStreamReturn, useAutoScroll, useDropdownMenu, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useToolCallStream };
|