@tangle-network/sandbox-ui 0.2.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -10
- package/dist/auth.js +2 -2
- package/dist/chat-container-C8eHLw8z.d.ts +67 -0
- package/dist/chat.d.ts +70 -78
- package/dist/chat.js +8 -8
- package/dist/chunk-4F2GJRGU.js +756 -0
- package/dist/{chunk-HYEAX3DC.js → chunk-5LV6DZZF.js} +445 -114
- package/dist/chunk-67C53XVV.js +1106 -0
- package/dist/{chunk-QSQBDR3N.js → chunk-BX6AQMUS.js} +5 -2
- package/dist/chunk-CCKNIAS7.js +124 -0
- package/dist/chunk-CJ2RYVZH.js +128 -0
- package/dist/{chunk-KMXV7DDX.js → chunk-CNWVHQFY.js} +1 -1
- package/dist/{chunk-OU4TRNQZ.js → chunk-COCSO7FG.js} +3 -3
- package/dist/chunk-FJSVPBKY.js +85 -0
- package/dist/chunk-FRGMMANX.js +102 -0
- package/dist/{chunk-E6FS7R4X.js → chunk-HWLX5NME.js} +1 -1
- package/dist/chunk-JF6E2DS5.js +610 -0
- package/dist/chunk-MUOL44AE.js +121 -0
- package/dist/chunk-MXCSSOGH.js +105 -0
- package/dist/{chunk-J4OADEUK.js → chunk-OM6ON27W.js} +24 -9
- package/dist/{chunk-NI2EI43H.js → chunk-PDV7W4NY.js} +9 -124
- package/dist/chunk-TQN3VR4F.js +92 -0
- package/dist/{chunk-SOT2V7TX.js → chunk-TXI4MZAZ.js} +62 -144
- package/dist/chunk-WUR652Y3.js +1140 -0
- package/dist/chunk-YDBXQQLC.js +336 -0
- package/dist/{chunk-4EIWPJMJ.js → chunk-ZP6GSX4D.js} +36 -27
- package/dist/dashboard.d.ts +5 -2
- package/dist/dashboard.js +5 -4
- package/dist/{expanded-tool-detail-OkXGqTHe.d.ts → expanded-tool-detail-BDi_h_dZ.d.ts} +11 -4
- package/dist/file-tabs-CmaoDVBI.d.ts +72 -0
- package/dist/files.d.ts +25 -44
- package/dist/files.js +8 -3
- package/{src/styles → dist}/globals.css +16 -67
- package/dist/hooks.d.ts +5 -4
- package/dist/hooks.js +14 -9
- package/dist/index.d.ts +38 -9
- package/dist/index.js +100 -126
- package/dist/markdown.d.ts +1 -24
- package/dist/markdown.js +1 -7
- package/dist/openui.d.ts +115 -0
- package/dist/openui.js +11 -0
- package/dist/pages.d.ts +3 -2
- package/dist/pages.js +19 -16
- package/dist/primitives.js +25 -19
- package/dist/run.d.ts +2 -2
- package/dist/run.js +8 -7
- package/dist/{use-sidecar-auth-Bb0-w3lX.d.ts → sdk-hooks.d.ts} +61 -72
- package/dist/sdk-hooks.js +29 -0
- package/dist/styles.css +179 -0
- package/dist/tokens.css +165 -0
- package/dist/{tool-display-BvsVW_Ur.d.ts → tool-display-Ct9nFAzJ.d.ts} +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/{usage-chart-DINgSVL5.d.ts → usage-chart-CY9xo3KX.d.ts} +8 -3
- package/dist/use-pty-session-DeZSxOCN.d.ts +69 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/workspace.d.ts +171 -33
- package/dist/workspace.js +25 -1
- package/package.json +10 -3
- package/dist/chunk-2UHPE5T7.js +0 -201
- package/dist/chunk-6MQIDUPA.js +0 -502
- package/dist/chunk-KYY2X6LY.js +0 -318
- package/dist/chunk-L6ZDH5F4.js +0 -334
- package/dist/chunk-M34OA6PQ.js +0 -233
- package/dist/chunk-M6VLC32S.js +0 -219
- package/dist/chunk-U62G5TS7.js +0 -472
- package/src/styles/tokens.css +0 -73
package/README.md
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="https://raw.githubusercontent.com/tangle-network/sandbox-ui/main/.github/banner.svg" alt="Tangle Sandbox UI" width="100%" />
|
|
3
|
-
</p>
|
|
1
|
+

|
|
4
2
|
|
|
5
3
|
<p align="center">
|
|
6
4
|
<a href="https://www.npmjs.com/package/@tangle-network/sandbox-ui"><img src="https://img.shields.io/npm/v/@tangle-network/sandbox-ui?color=8E59FF&label=npm" alt="npm" /></a>
|
|
@@ -10,7 +8,7 @@
|
|
|
10
8
|
|
|
11
9
|
# @tangle-network/sandbox-ui
|
|
12
10
|
|
|
13
|
-
React component library for [Tangle Sandbox](https://sandbox.tangle.tools) —
|
|
11
|
+
React component library for [Tangle Sandbox](https://sandbox.tangle.tools) — a shadcn-style primitive layer plus higher-order sandbox surfaces for agent chat, files, runtime state, artifacts, and dashboard views.
|
|
14
12
|
|
|
15
13
|
## Install
|
|
16
14
|
|
|
@@ -23,9 +21,12 @@ npm install @tangle-network/sandbox-ui
|
|
|
23
21
|
## Usage
|
|
24
22
|
|
|
25
23
|
```tsx
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
import {
|
|
25
|
+
SandboxWorkbench,
|
|
26
|
+
type FileNode,
|
|
27
|
+
type SessionMessage,
|
|
28
|
+
type SessionPart,
|
|
29
|
+
} from "@tangle-network/sandbox-ui";
|
|
29
30
|
```
|
|
30
31
|
|
|
31
32
|
Import styles in your app root:
|
|
@@ -34,15 +35,203 @@ Import styles in your app root:
|
|
|
34
35
|
import "@tangle-network/sandbox-ui/styles";
|
|
35
36
|
```
|
|
36
37
|
|
|
38
|
+
If you are building on the sandbox SDK directly, use `useSdkSession` to turn raw SDK/session-gateway events into the `messages + partMap` model that `ChatContainer` and `SandboxWorkbench` expect:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import {
|
|
42
|
+
SandboxWorkbench,
|
|
43
|
+
} from "@tangle-network/sandbox-ui";
|
|
44
|
+
import { useSdkSession } from "@tangle-network/sandbox-ui/sdk-hooks";
|
|
45
|
+
|
|
46
|
+
function App() {
|
|
47
|
+
const {
|
|
48
|
+
messages,
|
|
49
|
+
partMap,
|
|
50
|
+
isStreaming,
|
|
51
|
+
appendUserMessage,
|
|
52
|
+
beginAssistantMessage,
|
|
53
|
+
applySdkEvent,
|
|
54
|
+
completeAssistantMessage,
|
|
55
|
+
failAssistantMessage,
|
|
56
|
+
} = useSdkSession();
|
|
57
|
+
|
|
58
|
+
async function runTurn(text: string) {
|
|
59
|
+
appendUserMessage({ content: text });
|
|
60
|
+
const assistantMessageId = beginAssistantMessage();
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
for await (const event of sdk.streamPrompt(text)) {
|
|
64
|
+
applySdkEvent(event, { messageId: assistantMessageId });
|
|
65
|
+
}
|
|
66
|
+
completeAssistantMessage({ messageId: assistantMessageId });
|
|
67
|
+
} catch (error) {
|
|
68
|
+
failAssistantMessage(
|
|
69
|
+
error instanceof Error ? error.message : "Agent run failed",
|
|
70
|
+
{ messageId: assistantMessageId },
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<SandboxWorkbench
|
|
77
|
+
session={{
|
|
78
|
+
messages,
|
|
79
|
+
partMap,
|
|
80
|
+
isStreaming,
|
|
81
|
+
onSend: runTurn,
|
|
82
|
+
}}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Compose sandbox applications around `SandboxWorkbench` when you want the library’s default operating model:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
const root: FileNode = {
|
|
92
|
+
name: "agent",
|
|
93
|
+
path: "/home/agent",
|
|
94
|
+
type: "directory",
|
|
95
|
+
children: [],
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const messages: SessionMessage[] = [];
|
|
99
|
+
const partMap: Record<string, SessionPart[]> = {};
|
|
100
|
+
|
|
101
|
+
<SandboxWorkbench
|
|
102
|
+
title="Tax filing workspace"
|
|
103
|
+
directory={{
|
|
104
|
+
root,
|
|
105
|
+
visibility: {
|
|
106
|
+
hiddenPathPrefixes: ["/home/agent/tax_toolkit"],
|
|
107
|
+
},
|
|
108
|
+
}}
|
|
109
|
+
session={{
|
|
110
|
+
messages,
|
|
111
|
+
partMap,
|
|
112
|
+
isStreaming: false,
|
|
113
|
+
presentation: "timeline",
|
|
114
|
+
onSend: console.log,
|
|
115
|
+
}}
|
|
116
|
+
runtime={{
|
|
117
|
+
title: "Runtime",
|
|
118
|
+
}}
|
|
119
|
+
/>;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`FileTreeVisibilityOptions` is a UI-layer policy only. Sensitive paths still need to be hidden and denied by the app/backend layer.
|
|
123
|
+
|
|
124
|
+
## Theming And Retheming
|
|
125
|
+
|
|
126
|
+
There is a built-in Tangle default theme, but consumers can restyle the library in three layers:
|
|
127
|
+
|
|
128
|
+
1. Pick a built-in surface theme
|
|
129
|
+
2. Override semantic tokens
|
|
130
|
+
3. Wrap higher-level components when you want a different product composition
|
|
131
|
+
|
|
132
|
+
### 1. Pick a Built-in Theme
|
|
133
|
+
|
|
134
|
+
`WorkspaceLayout` and `SandboxWorkbench` support:
|
|
135
|
+
|
|
136
|
+
- `theme="operator"`
|
|
137
|
+
- `theme="builder"`
|
|
138
|
+
- `theme="consumer"`
|
|
139
|
+
|
|
140
|
+
They also support `density="comfortable"` and `density="compact"`.
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<SandboxWorkbench
|
|
144
|
+
layout={{
|
|
145
|
+
theme: "consumer",
|
|
146
|
+
density: "comfortable",
|
|
147
|
+
}}
|
|
148
|
+
session={{ ... }}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
If you are not using `SandboxWorkbench`, you can set the same attributes yourself:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
<div data-sandbox-ui data-sandbox-theme="consumer" data-density="compact">
|
|
156
|
+
<YourSandboxApp />
|
|
157
|
+
</div>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 2. Override Semantic Tokens
|
|
161
|
+
|
|
162
|
+
The shared visual contract lives in [src/styles/tokens.css](./src/styles/tokens.css). The important tokens are:
|
|
163
|
+
|
|
164
|
+
- surfaces: `--bg-root`, `--bg-card`, `--bg-elevated`, `--bg-section`, `--bg-input`
|
|
165
|
+
- text: `--text-primary`, `--text-secondary`, `--text-muted`
|
|
166
|
+
- brand: `--brand-cool`, `--brand-glow`, `--brand-purple`
|
|
167
|
+
- accent surfaces: `--accent-gradient-strong`, `--accent-surface-soft`, `--accent-surface-strong`, `--accent-text`
|
|
168
|
+
- borders: `--border-subtle`, `--border-default`, `--border-accent`
|
|
169
|
+
- radii/shadows: `--radius-*`, `--shadow-card`, `--shadow-dropdown`, `--shadow-accent`
|
|
170
|
+
|
|
171
|
+
App-level overrides can be scoped to a wrapper:
|
|
172
|
+
|
|
173
|
+
```css
|
|
174
|
+
.tax-theme {
|
|
175
|
+
--brand-cool: hsl(187 75% 54%);
|
|
176
|
+
--brand-glow: hsl(164 74% 56%);
|
|
177
|
+
--bg-root: hsl(222 18% 9%);
|
|
178
|
+
--bg-card: hsl(223 20% 12%);
|
|
179
|
+
--border-accent: hsl(187 75% 48% / 0.35);
|
|
180
|
+
--font-sans: "Satoshi", ui-sans-serif, system-ui, sans-serif;
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
<div className="tax-theme">
|
|
186
|
+
<SandboxWorkbench ... />
|
|
187
|
+
</div>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### 3. Know When To Wrap Instead Of Override
|
|
191
|
+
|
|
192
|
+
Token overrides are the right tool when you want:
|
|
193
|
+
|
|
194
|
+
- a different brand color system
|
|
195
|
+
- different typography
|
|
196
|
+
- tighter or roomier density
|
|
197
|
+
- a more consumer-facing or operator-facing tone
|
|
198
|
+
|
|
199
|
+
Wrap or compose on lower-level exports when you want:
|
|
200
|
+
|
|
201
|
+
- a different page shell
|
|
202
|
+
- different header chrome
|
|
203
|
+
- a different artifact tab model
|
|
204
|
+
- app-specific empty states and actions
|
|
205
|
+
|
|
206
|
+
The higher-order dashboard/billing surfaces are now accent-token driven rather than hardcoded to the default Tangle look. The main seams are:
|
|
207
|
+
|
|
208
|
+
- `DashboardLayout.className`, `sidebarClassName`, `contentClassName`
|
|
209
|
+
- `BillingDashboard.className`, `cardClassName`
|
|
210
|
+
- `PricingCards.className`, `cardClassName`
|
|
211
|
+
- `UsageChart.className`
|
|
212
|
+
- `StandalonePricingPage.className`
|
|
213
|
+
|
|
214
|
+
For that, compose directly from:
|
|
215
|
+
|
|
216
|
+
- `/workspace`
|
|
217
|
+
- `/chat`
|
|
218
|
+
- `/run`
|
|
219
|
+
- `/files`
|
|
220
|
+
|
|
221
|
+
### Current Reality
|
|
222
|
+
|
|
223
|
+
Retheming is absolutely supported, but the documentation was thinner than it should be. The token layer is strong; the higher-level surfaces are themeable, but more opinionated. For a radically different product look, prefer keeping the token contract and wrapping the higher-level workbench/chat surfaces rather than fighting every internal class.
|
|
224
|
+
|
|
37
225
|
## Subpath Exports
|
|
38
226
|
|
|
39
227
|
| Subpath | Description |
|
|
40
228
|
|---------|-------------|
|
|
41
229
|
| `/primitives` | Button, Card, Dialog, Badge, Input, Select, Table, Tabs, Toast, etc. |
|
|
42
|
-
| `/chat` | ChatContainer, ChatInput, ChatMessage,
|
|
230
|
+
| `/chat` | ChatContainer, ChatInput, ChatMessage, AgentTimeline, ThinkingIndicator |
|
|
43
231
|
| `/run` | ToolCallFeed, RunGroup, InlineToolItem, ExpandedToolDetail |
|
|
44
|
-
| `/workspace` | WorkspaceLayout,
|
|
45
|
-
| `/
|
|
232
|
+
| `/workspace` | SandboxWorkbench, WorkspaceLayout, DirectoryPane, RuntimePane, StatusBar |
|
|
233
|
+
| `/openui` | OpenUIArtifactRenderer and schema types for structured artifact rendering |
|
|
234
|
+
| `/files` | FileTree, FilePreview, FileTabs, FileArtifactPane |
|
|
46
235
|
| `/dashboard` | DashboardLayout, BillingDashboard, UsageChart, ProfileSelector |
|
|
47
236
|
| `/editor` | TipTap collaborative editor (requires optional peers) |
|
|
48
237
|
| `/terminal` | xterm.js terminal view (requires optional peers) |
|
|
@@ -50,6 +239,7 @@ import "@tangle-network/sandbox-ui/styles";
|
|
|
50
239
|
| `/auth` | AuthHeader, GitHubLoginButton, UserMenu |
|
|
51
240
|
| `/pages` | Pre-built billing, pricing, profiles pages |
|
|
52
241
|
| `/hooks` | useSSEStream, useAuth, usePtySession, useRunGroups, etc. |
|
|
242
|
+
| `/sdk-hooks` | Lightweight session/stream hooks without the React Query CRUD hook bundle |
|
|
53
243
|
| `/stores` | Session and chat nanostores |
|
|
54
244
|
| `/types` | TypeScript types for messages, parts, runs, sessions |
|
|
55
245
|
| `/utils` | cn, formatDuration, timeAgo, tool display helpers |
|
|
@@ -61,6 +251,7 @@ import "@tangle-network/sandbox-ui/styles";
|
|
|
61
251
|
- [Tailwind CSS](https://tailwindcss.com/) v4
|
|
62
252
|
- [Lucide](https://lucide.dev/) icons
|
|
63
253
|
- [CVA](https://cva.style/) for variant management
|
|
254
|
+
- Shared semantic tokens for `operator`, `builder`, and `consumer` sandbox themes
|
|
64
255
|
- ESM-only, tree-shakeable, fully typed
|
|
65
256
|
|
|
66
257
|
## License
|
package/dist/auth.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
AuthHeader,
|
|
3
3
|
GitHubLoginButton,
|
|
4
4
|
UserMenu
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-COCSO7FG.js";
|
|
6
6
|
import "./chunk-B26TQ7SA.js";
|
|
7
7
|
import "./chunk-MCGKDCOR.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-HWLX5NME.js";
|
|
9
9
|
import "./chunk-RQHJBTEU.js";
|
|
10
10
|
export {
|
|
11
11
|
AuthHeader,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { S as SessionMessage, a as SessionPart } from './parts-CyGkM6Fp.js';
|
|
4
|
+
import { A as AgentBranding } from './branding-DCi5VEik.js';
|
|
5
|
+
import { C as CustomToolRenderer } from './tool-display-Ct9nFAzJ.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ChatInput — message input bar with file attach, send/cancel, model selector.
|
|
9
|
+
*
|
|
10
|
+
* - Auto-resizing textarea (up to max height)
|
|
11
|
+
* - Enter to send, Shift+Enter for newline
|
|
12
|
+
* - File attachment button with pending file chips
|
|
13
|
+
* - Cancel button when streaming
|
|
14
|
+
* - Optional model selector pill
|
|
15
|
+
*/
|
|
16
|
+
interface PendingFile {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
size: number;
|
|
20
|
+
status: "pending" | "uploading" | "ready" | "error";
|
|
21
|
+
}
|
|
22
|
+
interface ChatInputProps {
|
|
23
|
+
onSend: (message: string, files?: File[]) => void;
|
|
24
|
+
onCancel?: () => void;
|
|
25
|
+
isStreaming?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** Currently selected model label */
|
|
29
|
+
modelLabel?: string;
|
|
30
|
+
onModelClick?: () => void;
|
|
31
|
+
/** Pending uploaded files */
|
|
32
|
+
pendingFiles?: PendingFile[];
|
|
33
|
+
onRemoveFile?: (id: string) => void;
|
|
34
|
+
onAttach?: (files: FileList) => void;
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
declare function ChatInput({ onSend, onCancel, isStreaming, disabled, placeholder, modelLabel, onModelClick, pendingFiles, onRemoveFile, onAttach, className, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
|
|
39
|
+
interface ChatContainerProps {
|
|
40
|
+
messages: SessionMessage[];
|
|
41
|
+
partMap: Record<string, SessionPart[]>;
|
|
42
|
+
isStreaming: boolean;
|
|
43
|
+
onSend?: (text: string) => void;
|
|
44
|
+
onCancel?: () => void;
|
|
45
|
+
branding?: AgentBranding;
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
/** Hide the input area (useful for read-only views). */
|
|
49
|
+
hideInput?: boolean;
|
|
50
|
+
/** Custom renderer for tool details. Return ReactNode to override, null to use default. */
|
|
51
|
+
renderToolDetail?: CustomToolRenderer;
|
|
52
|
+
/** Presentation mode for the session view. */
|
|
53
|
+
presentation?: "runs" | "timeline";
|
|
54
|
+
modelLabel?: string;
|
|
55
|
+
onModelClick?: () => void;
|
|
56
|
+
pendingFiles?: PendingFile[];
|
|
57
|
+
onRemoveFile?: (id: string) => void;
|
|
58
|
+
onAttach?: (files: FileList) => void;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Full chat container: message list + auto-scroll + input area.
|
|
63
|
+
* Orchestrates useRunGroups, useRunCollapseState, and useAutoScroll.
|
|
64
|
+
*/
|
|
65
|
+
declare const ChatContainer: React.MemoExoticComponent<({ messages, partMap, isStreaming, onSend, onCancel, branding, placeholder, className, hideInput, renderToolDetail, presentation, modelLabel, onModelClick, pendingFiles, onRemoveFile, onAttach, disabled, }: ChatContainerProps) => react_jsx_runtime.JSX.Element>;
|
|
66
|
+
|
|
67
|
+
export { ChatContainer as C, type PendingFile as P, ChatInput as a, type ChatInputProps as b, type ChatContainerProps as c };
|
package/dist/chat.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
export { C as ChatContainer, c as ChatContainerProps, a as ChatInput, b as ChatInputProps, P as PendingFile } from './chat-container-C8eHLw8z.js';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
-
import { S as SessionMessage, a as SessionPart } from './parts-CyGkM6Fp.js';
|
|
5
|
-
import { A as AgentBranding } from './branding-DCi5VEik.js';
|
|
6
|
-
import { C as CustomToolRenderer } from './tool-display-BvsVW_Ur.js';
|
|
7
5
|
import { G as GroupedMessage } from './run-CtFZ6s-D.js';
|
|
6
|
+
import { a as SessionPart, S as SessionMessage } from './parts-CyGkM6Fp.js';
|
|
7
|
+
import { A as AgentBranding } from './branding-DCi5VEik.js';
|
|
8
|
+
import { C as CustomToolRenderer } from './tool-display-Ct9nFAzJ.js';
|
|
9
|
+
import { T as ToolCallData } from './tool-call-feed-D5Ume-Pt.js';
|
|
8
10
|
|
|
9
11
|
type MessageRole = "user" | "assistant" | "system";
|
|
10
12
|
interface ChatMessageProps {
|
|
@@ -20,80 +22,6 @@ interface ChatMessageProps {
|
|
|
20
22
|
}
|
|
21
23
|
declare function ChatMessage({ role, content, toolCalls, isStreaming, timestamp, className, }: ChatMessageProps): react_jsx_runtime.JSX.Element;
|
|
22
24
|
|
|
23
|
-
interface Message {
|
|
24
|
-
id: string;
|
|
25
|
-
role: MessageRole;
|
|
26
|
-
content: string;
|
|
27
|
-
toolCalls?: ReactNode;
|
|
28
|
-
isStreaming?: boolean;
|
|
29
|
-
timestamp?: Date;
|
|
30
|
-
}
|
|
31
|
-
interface ChatMessageListProps {
|
|
32
|
-
messages: Message[];
|
|
33
|
-
/** Render additional content after a message (e.g., tool call feed) */
|
|
34
|
-
renderAfter?: (message: Message, index: number) => ReactNode;
|
|
35
|
-
/** Content shown when no messages */
|
|
36
|
-
emptyState?: ReactNode;
|
|
37
|
-
/** Show thinking indicator at bottom */
|
|
38
|
-
isThinking?: boolean;
|
|
39
|
-
className?: string;
|
|
40
|
-
}
|
|
41
|
-
declare function ChatMessageList({ messages, renderAfter, emptyState, isThinking, className, }: ChatMessageListProps): react_jsx_runtime.JSX.Element;
|
|
42
|
-
declare function ThinkingIndicator({ className }: {
|
|
43
|
-
className?: string;
|
|
44
|
-
}): react_jsx_runtime.JSX.Element;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* ChatInput — message input bar with file attach, send/cancel, model selector.
|
|
48
|
-
*
|
|
49
|
-
* - Auto-resizing textarea (up to max height)
|
|
50
|
-
* - Enter to send, Shift+Enter for newline
|
|
51
|
-
* - File attachment button with pending file chips
|
|
52
|
-
* - Cancel button when streaming
|
|
53
|
-
* - Optional model selector pill
|
|
54
|
-
*/
|
|
55
|
-
interface PendingFile {
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
size: number;
|
|
59
|
-
status: "pending" | "uploading" | "ready" | "error";
|
|
60
|
-
}
|
|
61
|
-
interface ChatInputProps {
|
|
62
|
-
onSend: (message: string, files?: File[]) => void;
|
|
63
|
-
onCancel?: () => void;
|
|
64
|
-
isStreaming?: boolean;
|
|
65
|
-
disabled?: boolean;
|
|
66
|
-
placeholder?: string;
|
|
67
|
-
/** Currently selected model label */
|
|
68
|
-
modelLabel?: string;
|
|
69
|
-
onModelClick?: () => void;
|
|
70
|
-
/** Pending uploaded files */
|
|
71
|
-
pendingFiles?: PendingFile[];
|
|
72
|
-
onRemoveFile?: (id: string) => void;
|
|
73
|
-
onAttach?: (files: FileList) => void;
|
|
74
|
-
className?: string;
|
|
75
|
-
}
|
|
76
|
-
declare function ChatInput({ onSend, onCancel, isStreaming, disabled, placeholder, modelLabel, onModelClick, pendingFiles, onRemoveFile, onAttach, className, }: ChatInputProps): react_jsx_runtime.JSX.Element;
|
|
77
|
-
|
|
78
|
-
interface ChatContainerProps {
|
|
79
|
-
messages: SessionMessage[];
|
|
80
|
-
partMap: Record<string, SessionPart[]>;
|
|
81
|
-
isStreaming: boolean;
|
|
82
|
-
onSend?: (text: string) => void;
|
|
83
|
-
branding?: AgentBranding;
|
|
84
|
-
placeholder?: string;
|
|
85
|
-
className?: string;
|
|
86
|
-
/** Hide the input area (useful for read-only views). */
|
|
87
|
-
hideInput?: boolean;
|
|
88
|
-
/** Custom renderer for tool details. Return ReactNode to override, null to use default. */
|
|
89
|
-
renderToolDetail?: CustomToolRenderer;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Full chat container: message list + auto-scroll + input area.
|
|
93
|
-
* Orchestrates useRunGroups, useRunCollapseState, and useAutoScroll.
|
|
94
|
-
*/
|
|
95
|
-
declare const ChatContainer: React.MemoExoticComponent<({ messages, partMap, isStreaming, onSend, branding, placeholder, className, hideInput, renderToolDetail, }: ChatContainerProps) => react_jsx_runtime.JSX.Element>;
|
|
96
|
-
|
|
97
25
|
interface MessageListProps {
|
|
98
26
|
groups: GroupedMessage[];
|
|
99
27
|
partMap: Record<string, SessionPart[]>;
|
|
@@ -118,4 +46,68 @@ interface UserMessageProps {
|
|
|
118
46
|
*/
|
|
119
47
|
declare const UserMessage: React.MemoExoticComponent<({ message, parts }: UserMessageProps) => react_jsx_runtime.JSX.Element | null>;
|
|
120
48
|
|
|
121
|
-
|
|
49
|
+
interface ThinkingIndicatorProps {
|
|
50
|
+
className?: string;
|
|
51
|
+
}
|
|
52
|
+
declare function ThinkingIndicator({ className }: ThinkingIndicatorProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
|
|
54
|
+
type AgentTimelineTone = "default" | "info" | "success" | "warning" | "error";
|
|
55
|
+
interface AgentTimelineMessageItem {
|
|
56
|
+
id: string;
|
|
57
|
+
kind: "message";
|
|
58
|
+
role: MessageRole;
|
|
59
|
+
content: string;
|
|
60
|
+
toolCalls?: ReactNode;
|
|
61
|
+
isStreaming?: boolean;
|
|
62
|
+
timestamp?: Date;
|
|
63
|
+
after?: ReactNode;
|
|
64
|
+
}
|
|
65
|
+
interface AgentTimelineToolItem {
|
|
66
|
+
id: string;
|
|
67
|
+
kind: "tool";
|
|
68
|
+
call: ToolCallData;
|
|
69
|
+
}
|
|
70
|
+
interface AgentTimelineToolGroupItem {
|
|
71
|
+
id: string;
|
|
72
|
+
kind: "tool_group";
|
|
73
|
+
title?: string;
|
|
74
|
+
calls: ToolCallData[];
|
|
75
|
+
}
|
|
76
|
+
interface AgentTimelineStatusItem {
|
|
77
|
+
id: string;
|
|
78
|
+
kind: "status";
|
|
79
|
+
label: string;
|
|
80
|
+
detail?: string;
|
|
81
|
+
tone?: AgentTimelineTone;
|
|
82
|
+
}
|
|
83
|
+
interface AgentTimelineArtifactItem {
|
|
84
|
+
id: string;
|
|
85
|
+
kind: "artifact";
|
|
86
|
+
title: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
meta?: ReactNode;
|
|
89
|
+
icon?: ReactNode;
|
|
90
|
+
tone?: AgentTimelineTone;
|
|
91
|
+
action?: ReactNode;
|
|
92
|
+
onClick?: () => void;
|
|
93
|
+
}
|
|
94
|
+
interface AgentTimelineCustomItem {
|
|
95
|
+
id: string;
|
|
96
|
+
kind: "custom";
|
|
97
|
+
content: ReactNode;
|
|
98
|
+
}
|
|
99
|
+
type AgentTimelineItem = AgentTimelineMessageItem | AgentTimelineToolItem | AgentTimelineToolGroupItem | AgentTimelineStatusItem | AgentTimelineArtifactItem | AgentTimelineCustomItem;
|
|
100
|
+
interface AgentTimelineProps {
|
|
101
|
+
items: AgentTimelineItem[];
|
|
102
|
+
isThinking?: boolean;
|
|
103
|
+
emptyState?: ReactNode;
|
|
104
|
+
className?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* AgentTimeline — unified mixed-content timeline for agent-backed sandbox
|
|
108
|
+
* sessions. Renders messages, tool steps, status cards, and artifact handoffs in
|
|
109
|
+
* a single execution narrative.
|
|
110
|
+
*/
|
|
111
|
+
declare function AgentTimeline({ items, isThinking, emptyState, className, }: AgentTimelineProps): react_jsx_runtime.JSX.Element | null;
|
|
112
|
+
|
|
113
|
+
export { AgentTimeline, type AgentTimelineArtifactItem, type AgentTimelineCustomItem, type AgentTimelineItem, type AgentTimelineMessageItem, type AgentTimelineProps, type AgentTimelineStatusItem, type AgentTimelineTone, type AgentTimelineToolGroupItem, type AgentTimelineToolItem, ChatMessage, type ChatMessageProps, MessageList, type MessageListProps, type MessageRole, ThinkingIndicator, type ThinkingIndicatorProps, UserMessage, type UserMessageProps };
|
package/dist/chat.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AgentTimeline,
|
|
2
3
|
ChatContainer,
|
|
3
4
|
ChatInput,
|
|
4
5
|
ChatMessage,
|
|
5
|
-
ChatMessageList,
|
|
6
6
|
MessageList,
|
|
7
7
|
ThinkingIndicator,
|
|
8
8
|
UserMessage
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-LTFK464G.js";
|
|
13
|
-
import "./chunk-M34OA6PQ.js";
|
|
9
|
+
} from "./chunk-4F2GJRGU.js";
|
|
10
|
+
import "./chunk-CNWVHQFY.js";
|
|
11
|
+
import "./chunk-WUR652Y3.js";
|
|
14
12
|
import "./chunk-HRMUF35V.js";
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-CJ2RYVZH.js";
|
|
14
|
+
import "./chunk-BX6AQMUS.js";
|
|
15
|
+
import "./chunk-LTFK464G.js";
|
|
16
16
|
import "./chunk-RQHJBTEU.js";
|
|
17
17
|
export {
|
|
18
|
+
AgentTimeline,
|
|
18
19
|
ChatContainer,
|
|
19
20
|
ChatInput,
|
|
20
21
|
ChatMessage,
|
|
21
|
-
ChatMessageList,
|
|
22
22
|
MessageList,
|
|
23
23
|
ThinkingIndicator,
|
|
24
24
|
UserMessage
|