@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @tangle-network/ui
|
|
2
2
|
|
|
3
|
+
## 11.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5cbda07: Load the full Highlight.js syntax renderer only when a code block mounts.
|
|
8
|
+
Keep code readable until highlighting arrives, and leave prose-only Markdown free of syntax-engine requests.
|
|
9
|
+
|
|
10
|
+
## 11.13.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 11a29e6: Port Sandbox's Heading and PageShell into the generic UI package. Use one
|
|
15
|
+
Heading renderer for page and card titles; preserve existing PageHeader inputs
|
|
16
|
+
and map the existing Sandbox inputs. Normalize card padding, keep hover
|
|
17
|
+
decorative, support explicit card title levels, and make table-wrapper
|
|
18
|
+
accessibility configurable with a wrapper opt-out for caller-owned scrolling.
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 805a2d1: Repair Input and Textarea accessibility relationships with stable generated IDs, shared Label styling, merged descriptions, and invalid state. Keep hints available alongside errors. Preserve Button action names and form defaults while enforcing disabled/loading behavior for native and slotted controls, exposing busy state, and respecting reduced motion.
|
|
23
|
+
- ac3344e: Use canonical Brand colors for the RichFileTree background, search field, rows, hover, border, and focus ring in light and dark themes.
|
|
24
|
+
- 48b9dcf: Keep Brand dark-default while exporting a checked, generated light-default compatibility stylesheet. Re-resolve shared aliases and syntax colors at nested mode boundaries, retain named identities, and make ThemeToggle SSR-, storage- and system-change-safe. CodeBlock now uses scoped semantic CSS variables with immediate browser recoloring.
|
|
25
|
+
- fe145f8: Preserve UI output modules so unused heavyweight exports can be removed through existing package entrypoints, retaining the legacy primitives CodeBlock export. Add packed-consumer import-boundary, compatibility, and controlled bundle-layout comparison checks.
|
|
26
|
+
|
|
3
27
|
## 11.12.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ButtonProps } from "../primitives/button.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/auth/auth.d.ts
|
|
4
|
+
export interface SessionUser {
|
|
5
|
+
customer_id: string;
|
|
6
|
+
email: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
tier?: string;
|
|
9
|
+
github?: {
|
|
10
|
+
login: string;
|
|
11
|
+
connected: boolean;
|
|
12
|
+
} | null;
|
|
13
|
+
session_expires_at: string;
|
|
14
|
+
}
|
|
15
|
+
export interface GitHubLoginButtonProps extends Omit<ButtonProps, "onClick"> {
|
|
16
|
+
/** API base URL (defaults to /auth/github) */
|
|
17
|
+
authUrl?: string;
|
|
18
|
+
/** Product variant for styling */
|
|
19
|
+
variant?: "sandbox" | "default" | "outline";
|
|
20
|
+
}
|
|
21
|
+
export declare function GitHubLoginButton({ authUrl, variant, className, children, ...props }: GitHubLoginButtonProps): React.JSX.Element;
|
|
22
|
+
export interface UserMenuProps {
|
|
23
|
+
user: SessionUser;
|
|
24
|
+
/** API base URL for logout */
|
|
25
|
+
logoutUrl?: string;
|
|
26
|
+
/** Links to show in menu */
|
|
27
|
+
links?: Array<{
|
|
28
|
+
href: string;
|
|
29
|
+
label: string;
|
|
30
|
+
icon?: React.ReactNode;
|
|
31
|
+
}>;
|
|
32
|
+
/** Product variant for styling */
|
|
33
|
+
variant?: "sandbox";
|
|
34
|
+
/** Callback when logout is clicked */
|
|
35
|
+
onLogout?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function UserMenu({ user, logoutUrl, links, variant, onLogout }: UserMenuProps): React.JSX.Element;
|
|
38
|
+
export interface AuthHeaderProps {
|
|
39
|
+
/** Current session user (null if not logged in) */
|
|
40
|
+
user: SessionUser | null;
|
|
41
|
+
/** Whether session is loading */
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/** Product variant */
|
|
44
|
+
variant?: "sandbox";
|
|
45
|
+
/** API base URL */
|
|
46
|
+
apiBaseUrl?: string;
|
|
47
|
+
/** Links for user menu */
|
|
48
|
+
menuLinks?: UserMenuProps["links"];
|
|
49
|
+
/** Custom className */
|
|
50
|
+
className?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function AuthHeader({ user, loading, variant, apiBaseUrl, menuLinks, className }: AuthHeaderProps): React.JSX.Element;
|
|
53
|
+
//#endregion
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
1
|
+
"use client";
|
|
2
|
+
import { focusRing } from "../lib/focus.js";
|
|
3
|
+
import { cn } from "../lib/utils.js";
|
|
4
|
+
import { Button } from "../primitives/button.js";
|
|
5
|
+
import { Avatar, AvatarFallback, AvatarImage } from "../primitives/avatar.js";
|
|
6
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../primitives/dropdown-menu.js";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Terminal } from "lucide-react";
|
|
8
8
|
//#region src/auth/auth.tsx
|
|
9
9
|
function GitHubIcon({ className }) {
|
|
10
10
|
return /* @__PURE__ */ jsx("svg", {
|
|
@@ -121,34 +121,4 @@ function AuthHeader({ user, loading = false, variant = "sandbox", apiBaseUrl = "
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
//#endregion
|
|
124
|
-
|
|
125
|
-
function LoginLayout({ title = "Welcome Back", subtitle = "Sign in to your workspace.", brandIcon, children, className }) {
|
|
126
|
-
return /* @__PURE__ */ jsx("div", {
|
|
127
|
-
className: cn("relative flex min-h-screen items-center justify-center bg-background overflow-hidden antialiased font-sans flex-col", className),
|
|
128
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
129
|
-
className: "z-10 w-full max-w-md px-6 animate-in flex flex-col items-center",
|
|
130
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
131
|
-
className: "mb-10 text-center flex flex-col items-center",
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ jsx("div", {
|
|
134
|
-
className: "inline-flex h-14 w-14 mb-4 items-center justify-center rounded-lg bg-muted border border-border",
|
|
135
|
-
children: brandIcon || /* @__PURE__ */ jsx(Terminal, { className: "h-7 w-7 text-foreground" })
|
|
136
|
-
}),
|
|
137
|
-
/* @__PURE__ */ jsx("h1", {
|
|
138
|
-
className: "text-2xl font-bold tracking-tight text-foreground font-display",
|
|
139
|
-
children: title
|
|
140
|
-
}),
|
|
141
|
-
/* @__PURE__ */ jsx("p", {
|
|
142
|
-
className: "mt-2 text-sm text-muted-foreground",
|
|
143
|
-
children: subtitle
|
|
144
|
-
})
|
|
145
|
-
]
|
|
146
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
147
|
-
className: "w-full bg-card p-8 border border-border rounded-lg",
|
|
148
|
-
children
|
|
149
|
-
})]
|
|
150
|
-
})
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
//#endregion
|
|
154
|
-
export { UserMenu as i, AuthHeader as n, GitHubLoginButton as r, LoginLayout as t };
|
|
124
|
+
export { AuthHeader, GitHubLoginButton, UserMenu };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/auth/login-layout.d.ts
|
|
3
|
+
export interface LoginLayoutProps {
|
|
4
|
+
title?: React.ReactNode;
|
|
5
|
+
subtitle?: React.ReactNode;
|
|
6
|
+
brandIcon?: React.ReactNode;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
/** (Deprecated) terminal lines from legacy layout, kept for backwards compatibility */
|
|
10
|
+
terminalLines?: string[];
|
|
11
|
+
/** (Deprecated) tagline, kept for backwards compatibility */
|
|
12
|
+
tagline?: React.ReactNode;
|
|
13
|
+
/** (Deprecated) footerLinks, kept for backwards compatibility */
|
|
14
|
+
footerLinks?: {
|
|
15
|
+
label: string;
|
|
16
|
+
href: string;
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
export declare function LoginLayout({ title, subtitle, brandIcon, children, className }: LoginLayoutProps): React.JSX.Element;
|
|
20
|
+
//#endregion
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Terminal } from "lucide-react";
|
|
6
|
+
//#region src/auth/login-layout.tsx
|
|
7
|
+
function LoginLayout({ title = "Welcome Back", subtitle = "Sign in to your workspace.", brandIcon, children, className }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
className: cn("relative flex min-h-screen items-center justify-center bg-background overflow-hidden antialiased font-sans flex-col", className),
|
|
10
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: "z-10 w-full max-w-md px-6 animate-in flex flex-col items-center",
|
|
12
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: "mb-10 text-center flex flex-col items-center",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsx("div", {
|
|
16
|
+
className: "inline-flex h-14 w-14 mb-4 items-center justify-center rounded-lg bg-muted border border-border",
|
|
17
|
+
children: brandIcon || /* @__PURE__ */ jsx(Terminal, { className: "h-7 w-7 text-foreground" })
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("h1", {
|
|
20
|
+
className: "text-2xl font-bold tracking-tight text-foreground font-display",
|
|
21
|
+
children: title
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsx("p", {
|
|
24
|
+
className: "mt-2 text-sm text-muted-foreground",
|
|
25
|
+
children: subtitle
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: "w-full bg-card p-8 border border-border rounded-lg",
|
|
30
|
+
children
|
|
31
|
+
})]
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { LoginLayout };
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthHeader, AuthHeaderProps, GitHubLoginButton, GitHubLoginButtonProps, SessionUser, UserMenu, UserMenuProps } from "./auth/auth.js";
|
|
2
|
+
import { LoginLayout, LoginLayoutProps } from "./auth/login-layout.js";
|
|
2
3
|
export { AuthHeader, type AuthHeaderProps, GitHubLoginButton, type GitHubLoginButtonProps, LoginLayout, type LoginLayoutProps, type SessionUser, UserMenu, type UserMenuProps };
|
package/dist/auth.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthHeader, GitHubLoginButton, UserMenu } from "./auth/auth.js";
|
|
2
|
+
import { LoginLayout } from "./auth/login-layout.js";
|
|
2
3
|
export { AuthHeader, GitHubLoginButton, LoginLayout, UserMenu };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ToolPart } from "../types/parts.js";
|
|
2
|
+
import { MessageRole } from "./chat-message.js";
|
|
3
|
+
import { ToolCallData } from "../run/tool-call-feed.js";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
//#region src/chat/agent-timeline.d.ts
|
|
6
|
+
export type AgentTimelineTone = "default" | "info" | "success" | "warning" | "error";
|
|
7
|
+
export interface AgentTimelineMessageItem {
|
|
8
|
+
id: string;
|
|
9
|
+
kind: "message";
|
|
10
|
+
role: MessageRole;
|
|
11
|
+
content: string;
|
|
12
|
+
toolCalls?: ReactNode;
|
|
13
|
+
isStreaming?: boolean;
|
|
14
|
+
/** Shown beside a user bubble on hover. Assistant prose carries no
|
|
15
|
+
* timestamp of its own — the turn's user message dates the exchange. */
|
|
16
|
+
timestamp?: Date;
|
|
17
|
+
after?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export interface AgentTimelineToolItem {
|
|
20
|
+
id: string;
|
|
21
|
+
kind: "tool";
|
|
22
|
+
call: ToolCallData;
|
|
23
|
+
/** Source tool part, so a consumer's `renderToolActions` gets the real
|
|
24
|
+
* input/output (the flat `call` is display-only). */
|
|
25
|
+
part?: ToolPart;
|
|
26
|
+
}
|
|
27
|
+
export interface AgentTimelineToolGroupItem {
|
|
28
|
+
id: string;
|
|
29
|
+
kind: "tool_group";
|
|
30
|
+
/** Accessible name of the group. Not drawn — the rows are the label. */
|
|
31
|
+
title?: string;
|
|
32
|
+
calls: ToolCallData[];
|
|
33
|
+
/** Source tool parts, parallel to `calls`. */
|
|
34
|
+
parts?: ToolPart[];
|
|
35
|
+
}
|
|
36
|
+
export interface AgentTimelineStatusItem {
|
|
37
|
+
id: string;
|
|
38
|
+
kind: "status";
|
|
39
|
+
label: string;
|
|
40
|
+
detail?: string;
|
|
41
|
+
tone?: AgentTimelineTone;
|
|
42
|
+
}
|
|
43
|
+
export interface AgentTimelineArtifactItem {
|
|
44
|
+
id: string;
|
|
45
|
+
kind: "artifact";
|
|
46
|
+
title: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
meta?: ReactNode;
|
|
49
|
+
icon?: ReactNode;
|
|
50
|
+
tone?: AgentTimelineTone;
|
|
51
|
+
action?: ReactNode;
|
|
52
|
+
onClick?: () => void;
|
|
53
|
+
}
|
|
54
|
+
export interface AgentTimelineCustomItem {
|
|
55
|
+
id: string;
|
|
56
|
+
kind: "custom";
|
|
57
|
+
/** Laid out as a run row: it takes the same horizontal bleed as tool rows,
|
|
58
|
+
* so a `RunRowShell`-based row (reasoning) aligns its glyph with the prose
|
|
59
|
+
* edge. */
|
|
60
|
+
content: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
export type AgentTimelineItem = AgentTimelineMessageItem | AgentTimelineToolItem | AgentTimelineToolGroupItem | AgentTimelineStatusItem | AgentTimelineArtifactItem | AgentTimelineCustomItem;
|
|
63
|
+
export interface AgentTimelineProps {
|
|
64
|
+
items: AgentTimelineItem[];
|
|
65
|
+
isThinking?: boolean;
|
|
66
|
+
emptyState?: ReactNode;
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Optional actions rendered beside each tool item (e.g. "open in artifacts").
|
|
69
|
+
* Receives the source tool part carried on the item. */
|
|
70
|
+
renderToolActions?: (part: ToolPart) => ReactNode;
|
|
71
|
+
/** When set, collapse the timeline to the first N step rows (every item
|
|
72
|
+
* except user messages) behind a "Show N more steps" toggle. Omit to always
|
|
73
|
+
* show every row. */
|
|
74
|
+
collapseAfter?: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* AgentTimeline — unified mixed-content transcript for agent-backed sandbox
|
|
78
|
+
* sessions. Renders messages, tool rows, status cards, and artifact handoffs
|
|
79
|
+
* as one plain column: prose at the reading size, tool calls as quiet
|
|
80
|
+
* one-liners between the paragraphs, no connector chrome.
|
|
81
|
+
*/
|
|
82
|
+
export declare function AgentTimeline({ items, isThinking, emptyState, className, renderToolActions, collapseAfter }: AgentTimelineProps): import("react").JSX.Element | null;
|
|
83
|
+
//#endregion
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { focusRing } from "../lib/focus.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
import { Markdown } from "../markdown/markdown.js";
|
|
4
|
+
import { UserMessage } from "./user-message.js";
|
|
5
|
+
import { ThinkingIndicator } from "./thinking-indicator.js";
|
|
6
|
+
import { ToolCallGroup, ToolCallStep } from "../run/tool-call-step.js";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { AlertTriangle, CheckCircle2, CircleDot, FileText, Info } from "lucide-react";
|
|
10
|
+
//#region src/chat/agent-timeline.tsx
|
|
11
|
+
const TONE_STYLES = {
|
|
12
|
+
default: {
|
|
13
|
+
card: "border-border bg-card",
|
|
14
|
+
text: "text-foreground",
|
|
15
|
+
supportingText: "text-muted-foreground",
|
|
16
|
+
icon: CircleDot
|
|
17
|
+
},
|
|
18
|
+
info: {
|
|
19
|
+
card: "border-[var(--surface-info-border)] bg-[var(--surface-info-bg)]",
|
|
20
|
+
text: "text-[var(--surface-info-text)]",
|
|
21
|
+
supportingText: "text-[var(--surface-info-text)]",
|
|
22
|
+
icon: Info
|
|
23
|
+
},
|
|
24
|
+
success: {
|
|
25
|
+
card: "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)]",
|
|
26
|
+
text: "text-[var(--surface-success-text)]",
|
|
27
|
+
supportingText: "text-[var(--surface-success-text)]",
|
|
28
|
+
icon: CheckCircle2
|
|
29
|
+
},
|
|
30
|
+
warning: {
|
|
31
|
+
card: "border-[var(--surface-warning-border)] bg-[var(--surface-warning-bg)]",
|
|
32
|
+
text: "text-[var(--surface-warning-text)]",
|
|
33
|
+
supportingText: "text-[var(--surface-warning-text)]",
|
|
34
|
+
icon: AlertTriangle
|
|
35
|
+
},
|
|
36
|
+
error: {
|
|
37
|
+
card: "border-[var(--surface-danger-border)] bg-[var(--surface-danger-bg)]",
|
|
38
|
+
text: "text-[var(--surface-danger-text)]",
|
|
39
|
+
supportingText: "text-[var(--surface-danger-text)]",
|
|
40
|
+
icon: AlertTriangle
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function stepKind(item) {
|
|
44
|
+
if (item.kind === "message") return item.role === "user" ? "user" : "prose";
|
|
45
|
+
if (item.kind === "status" || item.kind === "artifact") return "card";
|
|
46
|
+
return "tool";
|
|
47
|
+
}
|
|
48
|
+
function spacingBefore(prev, next) {
|
|
49
|
+
if (prev === void 0) return "";
|
|
50
|
+
if (prev === "user" || next === "user") return "mt-4";
|
|
51
|
+
if (prev === "card" || next === "card") return "mt-2";
|
|
52
|
+
if (prev === "tool" || next === "tool") return "mt-1";
|
|
53
|
+
return "mt-3";
|
|
54
|
+
}
|
|
55
|
+
const ROW_BLEED = "-mx-3";
|
|
56
|
+
function AssistantMessage({ item }) {
|
|
57
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
58
|
+
item.content && /* @__PURE__ */ jsx(Markdown, {
|
|
59
|
+
className: "tangle-prose text-[var(--font-size-base)] leading-[1.5]",
|
|
60
|
+
children: item.content
|
|
61
|
+
}),
|
|
62
|
+
item.isStreaming && /* @__PURE__ */ jsx("span", {
|
|
63
|
+
"aria-hidden": true,
|
|
64
|
+
"data-streaming-caret": "",
|
|
65
|
+
className: "ml-0.5 inline-block h-[1em] w-0.5 animate-pulse rounded-full bg-muted-foreground align-text-bottom"
|
|
66
|
+
}),
|
|
67
|
+
item.toolCalls && /* @__PURE__ */ jsx("div", {
|
|
68
|
+
className: "mt-1",
|
|
69
|
+
children: item.toolCalls
|
|
70
|
+
}),
|
|
71
|
+
item.after && /* @__PURE__ */ jsx("div", {
|
|
72
|
+
className: "mt-3 border-t border-border pt-3",
|
|
73
|
+
children: item.after
|
|
74
|
+
})
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
function StatusCard({ item }) {
|
|
78
|
+
const tone = TONE_STYLES[item.tone ?? "default"];
|
|
79
|
+
const Icon = tone.icon;
|
|
80
|
+
return /* @__PURE__ */ jsx("div", {
|
|
81
|
+
className: cn("rounded-[var(--radius-lg)] border px-4 py-3", tone.card),
|
|
82
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
83
|
+
className: "flex items-start gap-3",
|
|
84
|
+
children: [/* @__PURE__ */ jsx(Icon, { className: cn("mt-0.5 h-4 w-4 shrink-0", tone.text) }), /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
className: "min-w-0",
|
|
86
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: cn("text-sm font-medium", tone.text),
|
|
88
|
+
children: item.label
|
|
89
|
+
}), item.detail && /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: cn("mt-0.5 text-sm", tone.supportingText),
|
|
91
|
+
children: item.detail
|
|
92
|
+
})]
|
|
93
|
+
})]
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function ArtifactCard({ item }) {
|
|
98
|
+
const tone = TONE_STYLES[item.tone ?? "default"];
|
|
99
|
+
const content = /* @__PURE__ */ jsx("div", {
|
|
100
|
+
className: cn("rounded-[var(--radius-lg)] border px-4 py-3", tone.card),
|
|
101
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
className: "flex items-start gap-3",
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "mt-0.5 flex h-[var(--avatar-size)] w-[var(--avatar-size)] shrink-0 items-center justify-center rounded-[var(--radius-md)] bg-muted/50 text-foreground",
|
|
106
|
+
children: item.icon ?? /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" })
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ jsxs("div", {
|
|
109
|
+
className: "min-w-0 flex-1",
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx("div", {
|
|
112
|
+
className: cn("text-sm font-medium", tone.text),
|
|
113
|
+
children: item.title
|
|
114
|
+
}),
|
|
115
|
+
item.description && /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: cn("mt-1 text-sm", tone.supportingText),
|
|
117
|
+
children: item.description
|
|
118
|
+
}),
|
|
119
|
+
item.meta && /* @__PURE__ */ jsx("div", {
|
|
120
|
+
className: cn("mt-2 flex flex-wrap items-center gap-2 text-xs", tone.supportingText),
|
|
121
|
+
children: item.meta
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
}),
|
|
125
|
+
item.action && /* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: "shrink-0",
|
|
127
|
+
children: item.action
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
if (!item.onClick) return content;
|
|
133
|
+
return /* @__PURE__ */ jsx("div", {
|
|
134
|
+
role: "button",
|
|
135
|
+
tabIndex: 0,
|
|
136
|
+
onClick: item.onClick,
|
|
137
|
+
onKeyDown: (event) => {
|
|
138
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
item.onClick?.();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
className: cn("block w-full rounded-[var(--radius-lg)] text-left transition-transform hover:-translate-y-0.5", focusRing),
|
|
144
|
+
children: content
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* AgentTimeline — unified mixed-content transcript for agent-backed sandbox
|
|
149
|
+
* sessions. Renders messages, tool rows, status cards, and artifact handoffs
|
|
150
|
+
* as one plain column: prose at the reading size, tool calls as quiet
|
|
151
|
+
* one-liners between the paragraphs, no connector chrome.
|
|
152
|
+
*/
|
|
153
|
+
function AgentTimeline({ items, isThinking, emptyState, className, renderToolActions, collapseAfter }) {
|
|
154
|
+
const [expanded, setExpanded] = useState(false);
|
|
155
|
+
if (items.length === 0 && !isThinking) return emptyState ? /* @__PURE__ */ jsx("div", {
|
|
156
|
+
className: cn("flex h-full items-center justify-center p-4", className),
|
|
157
|
+
children: emptyState
|
|
158
|
+
}) : null;
|
|
159
|
+
const renderedItems = isThinking ? [...items, {
|
|
160
|
+
id: "__thinking__",
|
|
161
|
+
kind: "custom",
|
|
162
|
+
content: /* @__PURE__ */ jsx(ThinkingIndicator, {})
|
|
163
|
+
}] : items;
|
|
164
|
+
const isUserMessage = (item) => item.kind === "message" && item.role === "user";
|
|
165
|
+
const stepItems = renderedItems.filter((item) => !isUserMessage(item));
|
|
166
|
+
const limit = collapseAfter ?? Infinity;
|
|
167
|
+
const collapsible = stepItems.length > limit;
|
|
168
|
+
const collapsed = collapsible && !expanded;
|
|
169
|
+
let renderList = renderedItems;
|
|
170
|
+
let hiddenCount = 0;
|
|
171
|
+
if (collapsed) {
|
|
172
|
+
const visible = [];
|
|
173
|
+
let stepCount = 0;
|
|
174
|
+
for (const item of renderedItems) {
|
|
175
|
+
if (stepCount >= limit) break;
|
|
176
|
+
visible.push(item);
|
|
177
|
+
if (!isUserMessage(item)) stepCount += 1;
|
|
178
|
+
}
|
|
179
|
+
renderList = visible;
|
|
180
|
+
hiddenCount = stepItems.length - limit;
|
|
181
|
+
}
|
|
182
|
+
const renderItem = (item) => {
|
|
183
|
+
if (item.kind === "message") return item.role === "user" ? /* @__PURE__ */ jsx(UserMessage, {
|
|
184
|
+
content: item.content,
|
|
185
|
+
timestamp: item.timestamp
|
|
186
|
+
}) : /* @__PURE__ */ jsx(AssistantMessage, { item });
|
|
187
|
+
if (item.kind === "tool") return /* @__PURE__ */ jsx(ToolCallStep, {
|
|
188
|
+
type: item.call.type,
|
|
189
|
+
label: item.call.label,
|
|
190
|
+
status: item.call.status,
|
|
191
|
+
detail: item.call.detail,
|
|
192
|
+
output: item.call.output,
|
|
193
|
+
duration: item.call.duration,
|
|
194
|
+
part: item.part,
|
|
195
|
+
actions: item.part ? renderToolActions?.(item.part) : void 0
|
|
196
|
+
});
|
|
197
|
+
if (item.kind === "tool_group") return /* @__PURE__ */ jsx(ToolCallGroup, {
|
|
198
|
+
title: item.title,
|
|
199
|
+
children: item.calls.map((call, callIndex) => {
|
|
200
|
+
const part = item.parts?.[callIndex];
|
|
201
|
+
return /* @__PURE__ */ jsx(ToolCallStep, {
|
|
202
|
+
type: call.type,
|
|
203
|
+
label: call.label,
|
|
204
|
+
status: call.status,
|
|
205
|
+
detail: call.detail,
|
|
206
|
+
output: call.output,
|
|
207
|
+
duration: call.duration,
|
|
208
|
+
part,
|
|
209
|
+
actions: part ? renderToolActions?.(part) : void 0
|
|
210
|
+
}, call.id);
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
if (item.kind === "status") return /* @__PURE__ */ jsx(StatusCard, { item });
|
|
214
|
+
if (item.kind === "artifact") return /* @__PURE__ */ jsx(ArtifactCard, { item });
|
|
215
|
+
return item.content;
|
|
216
|
+
};
|
|
217
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
218
|
+
className: cn("mx-auto flex w-full max-w-5xl flex-col px-4 py-4", className),
|
|
219
|
+
children: [renderList.map((item, index) => {
|
|
220
|
+
const kind = stepKind(item);
|
|
221
|
+
const prev = index > 0 ? stepKind(renderList[index - 1]) : void 0;
|
|
222
|
+
return /* @__PURE__ */ jsx("div", {
|
|
223
|
+
"data-timeline-step": kind,
|
|
224
|
+
className: cn(spacingBefore(prev, kind), kind === "tool" && ROW_BLEED),
|
|
225
|
+
children: renderItem(item)
|
|
226
|
+
}, item.id);
|
|
227
|
+
}), collapsible ? /* @__PURE__ */ jsx("button", {
|
|
228
|
+
type: "button",
|
|
229
|
+
onClick: () => setExpanded((value) => !value),
|
|
230
|
+
className: "mt-2 self-start text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",
|
|
231
|
+
children: collapsed ? `Show ${hiddenCount} more step${hiddenCount === 1 ? "" : "s"}` : "Show less"
|
|
232
|
+
}) : null]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
export { AgentTimeline };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SessionMessage } from "../types/message.js";
|
|
2
|
+
import { SessionPart, ToolPart } from "../types/parts.js";
|
|
3
|
+
import { AgentBranding } from "../types/branding.js";
|
|
4
|
+
import { CustomToolRenderer } from "../types/tool-display.js";
|
|
5
|
+
import { Run } from "../types/run.js";
|
|
6
|
+
import { OpenUIAction } from "../openui/openui-artifact-renderer.js";
|
|
7
|
+
import { ReactNode } from "react";
|
|
8
|
+
//#region src/chat/chat-container.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Transcript-only container: message list + auto-scroll. Composers are
|
|
11
|
+
* composed BELOW this by the app (the canonical one is `AgentComposer` in
|
|
12
|
+
* `@tangle-network/sandbox-ui`) — this component never renders an input.
|
|
13
|
+
*/
|
|
14
|
+
export interface ChatContainerProps {
|
|
15
|
+
messages: SessionMessage[];
|
|
16
|
+
partMap: Record<string, SessionPart[]>;
|
|
17
|
+
isStreaming: boolean;
|
|
18
|
+
branding?: AgentBranding;
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Custom renderer for tool details. Return ReactNode to override, null to use default. */
|
|
21
|
+
renderToolDetail?: CustomToolRenderer;
|
|
22
|
+
/** Presentation mode for the session view. */
|
|
23
|
+
presentation?: "runs" | "timeline";
|
|
24
|
+
/** Callback when an OpenUI action button is pressed within inline OpenUI blocks. */
|
|
25
|
+
onOpenUIAction?: (action: OpenUIAction) => void;
|
|
26
|
+
/** Enable rendering OpenUI schemas inline in the chat timeline. Defaults to true. */
|
|
27
|
+
enableOpenUI?: boolean;
|
|
28
|
+
/** Optional actions rendered beside each grouped assistant run. */
|
|
29
|
+
renderRunActions?: (run: Run) => ReactNode;
|
|
30
|
+
/** Optional actions rendered below each user message bubble. */
|
|
31
|
+
renderUserMessageActions?: (message: SessionMessage, parts: SessionPart[]) => ReactNode;
|
|
32
|
+
/** Optional actions rendered beside individual tool items in the run-grouped
|
|
33
|
+
* (`runs`) presentation. */
|
|
34
|
+
renderToolActions?: (part: ToolPart, options: {
|
|
35
|
+
run: Run;
|
|
36
|
+
messageId: string;
|
|
37
|
+
partIndex: number;
|
|
38
|
+
}) => ReactNode;
|
|
39
|
+
/** Optional actions rendered beside individual tool items in the `timeline`
|
|
40
|
+
* presentation, which has no run/message grouping (hence part-only). */
|
|
41
|
+
renderTimelineToolActions?: (part: ToolPart) => ReactNode;
|
|
42
|
+
/** In the `timeline` presentation, collapse to the first N spine rows behind
|
|
43
|
+
* a "Show N more steps" toggle. Omit to always show every row. */
|
|
44
|
+
collapseTimelineAfter?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Chat transcript container: message list + auto-scroll.
|
|
48
|
+
* Orchestrates useRunGroups, useRunCollapseState, and useAutoScroll.
|
|
49
|
+
*/
|
|
50
|
+
export declare const ChatContainer: import("react").MemoExoticComponent<({ messages, partMap, isStreaming, branding, className, renderToolDetail, presentation, onOpenUIAction, enableOpenUI, renderRunActions, renderUserMessageActions, renderToolActions, renderTimelineToolActions, collapseTimelineAfter }: ChatContainerProps) => import("react").JSX.Element>;
|
|
51
|
+
//#endregion
|