@timbal-ai/timbal-react 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -4
- package/dist/app.cjs +5311 -0
- package/dist/app.d.cts +29 -0
- package/dist/app.d.ts +29 -0
- package/dist/app.esm.js +81 -0
- package/dist/chart-artifact-C71dk4xI.d.ts +329 -0
- package/dist/chart-artifact-CPEpOmtV.d.cts +329 -0
- package/dist/chat-CWtQWDtJ.d.cts +650 -0
- package/dist/chat-CWtQWDtJ.d.ts +650 -0
- package/dist/chat.cjs +4162 -0
- package/dist/chat.d.cts +13 -0
- package/dist/chat.d.ts +13 -0
- package/dist/chat.esm.js +51 -0
- package/dist/chunk-4TCJQSIX.esm.js +565 -0
- package/dist/chunk-IYENDIRY.esm.js +119 -0
- package/dist/chunk-KC5QLVUG.esm.js +22 -0
- package/dist/chunk-M4V6Q6XO.esm.js +1082 -0
- package/dist/chunk-OFHLFNJH.esm.js +138 -0
- package/dist/chunk-OVHR7J3J.esm.js +1574 -0
- package/dist/chunk-WLTW56MC.esm.js +66 -0
- package/dist/chunk-YJQLLFKP.esm.js +3672 -0
- package/dist/index.cjs +1823 -359
- package/dist/index.d.cts +15 -931
- package/dist/index.d.ts +15 -931
- package/dist/index.esm.js +187 -5578
- package/dist/layout-B9VayJhZ.d.cts +75 -0
- package/dist/layout-CQWngNQ7.d.ts +75 -0
- package/dist/studio.cjs +5734 -0
- package/dist/studio.d.cts +15 -0
- package/dist/studio.d.ts +15 -0
- package/dist/studio.esm.js +27 -0
- package/dist/styles.css +52 -2
- package/dist/timbal-v2-button-F4-z7m33.d.cts +40 -0
- package/dist/timbal-v2-button-F4-z7m33.d.ts +40 -0
- package/dist/ui.cjs +720 -0
- package/dist/ui.d.cts +74 -0
- package/dist/ui.d.ts +74 -0
- package/dist/ui.esm.js +44 -0
- package/dist/welcome--80i_O0p.d.cts +190 -0
- package/dist/welcome-BOizSp5h.d.ts +190 -0
- package/package.json +35 -3
- package/scripts/dev-linked.mjs +66 -0
- package/vite/local-dev.d.ts +4 -0
- package/vite/local-dev.mjs +71 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,846 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import React__default, { ReactNode, FC, ComponentType, Dispatch, ElementType } from 'react';
|
|
4
|
-
import { AttachmentAdapter, ToolCallMessagePartComponent } from '@assistant-ui/react';
|
|
5
|
-
export { ActionBarPrimitive, AssistantRuntimeProvider, AttachmentAdapter, AuiIf, ComposerPrimitive, MessagePrimitive, ThreadPrimitive, useComposerRuntime, useMessageRuntime, useThread, useThreadRuntime } from '@assistant-ui/react';
|
|
1
|
+
import { D as UiArtifact, E as UiNode, F as AnyArtifact, Q as QuestionArtifact, H as HtmlArtifact, J as JsonArtifact, G as TableArtifact } from './chat-CWtQWDtJ.cjs';
|
|
2
|
+
export { I as ArtifactRegistry, K as ArtifactRegistryProvider, L as ArtifactRenderer, M as ArtifactRendererProps, N as ArtifactView, C as ChartArtifact, c as ChatAttachment, d as ChatMessage, e as Composer, f as ComposerProps, g as ContentPart, O as CreateDefaultAttachmentAdapterOptions, P as CreateUploadAttachmentAdapterOptions, R as DEFAULT_UPLOAD_ACCEPT, V as QuestionOption, W as ResolveAttachmentAdapterOptions, S as SendOptions, h as Suggestions, i as SuggestionsComponent, j as SuggestionsSlotProps, k as SuggestionsSource, l as TextContentPart, m as ThinkingContentPart, n as Thread, o as ThreadArtifactsConfig, p as ThreadComponents, q as ThreadProps, r as ThreadSuggestion, s as ThreadSuggestionsProps, T as ThreadVariant, t as ThreadWelcomeConfig, u as ThreadWelcomeProps, X as TimbalArtifact, Y as TimbalAttachmentsConfig, Z as TimbalAttachmentsProp, a as TimbalChat, b as TimbalChatProps, v as TimbalRuntimeProvider, w as TimbalRuntimeProviderProps, x as TimbalStreamApi, y as ToolCallContentPart, _ as UiAction, $ as UiCustomNodeRegistryProvider, a0 as UiEventEnvelope, a1 as UiEventProvider, a2 as UploadFetchFn, U as UseTimbalStreamOptions, a3 as createDefaultAttachmentAdapter, a4 as createUploadAttachmentAdapter, a5 as defaultArtifactRenderers, a6 as getPath, a7 as isArtifact, a8 as isUiBinding, a9 as resolveAttachmentAdapter, aa as resolveBindable, ab as setPath, ac as useArtifactRegistry, z as useResolvedSuggestions, A as useTimbalRuntime, B as useTimbalStream, ad as useUiCustomNodeRegistry, ae as useUiDispatch, af as useUiEventEmitter, ag as useUiState } from './chat-CWtQWDtJ.cjs';
|
|
6
3
|
import { WorkforceItem, Session } from '@timbal-ai/timbal-sdk';
|
|
7
4
|
export { parseSSELine } from '@timbal-ai/timbal-sdk';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { ToolCallMessagePartComponent } from '@assistant-ui/react';
|
|
6
|
+
export { ActionBarPrimitive, AssistantRuntimeProvider, AttachmentAdapter, AuiIf, ComposerPrimitive, MessagePrimitive, ThreadPrimitive, useComposerRuntime, useMessageRuntime, useThread, useThreadRuntime } from '@assistant-ui/react';
|
|
7
|
+
export { M as ModeToggle, a as ModeToggleProps, b as ModeToggleTheme, S as STUDIO_NAV_MODE, c as StudioModeSwitch, d as StudioModeSwitchProps, e as StudioNavMode, f as StudioSidebar, g as StudioSidebarProps, h as StudioWelcome, i as StudioWelcomeProps, T as TimbalChatShell, j as TimbalChatShellProps, k as TimbalMark, l as TimbalMarkProps, m as TimbalStudioShell, n as TimbalStudioShellProps } from './welcome--80i_O0p.cjs';
|
|
8
|
+
export { M as MarkdownText, T as THREAD_DEFAULT_MAX_WIDTH, a as ToolFallback, b as TooltipIconButton, c as TooltipIconButtonProps, W as WorkforceSelector, d as WorkforceSelectorProps, e as assistantMessageContentClass, f as assistantMessageRootClass, t as threadMessageColumnClass, u as useToolRunning, g as userMessageRootClass } from './layout-B9VayJhZ.cjs';
|
|
9
|
+
export { A as AppChatPanel, a as AppChatPanelProps, b as AppConfirmDialog, c as AppConfirmDialogProps, d as AppCopilotContextValue, e as AppCopilotProvider, f as AppCopilotProviderProps, g as AppShell, h as AppShellChatControls, i as AppShellChatTrigger, j as AppShellChatTriggerProps, k as AppShellProps, l as AppShellTopbar, m as AppShellTopbarProps, B as BreadcrumbItem, n as Breadcrumbs, o as BreadcrumbsProps, C as ChartArtifactView, p as ChartPanel, q as ChartPanelProps, D as DataTable, r as DataTableColumn, s as DataTableProps, t as DataTableSort, u as DataTableSortDirection, E as EmptyState, v as EmptyStateProps, F as Field, w as FieldInput, x as FieldInputProps, y as FieldProps, z as FieldSelect, G as FieldSelectProps, H as FieldSwitch, I as FieldSwitchProps, J as FieldTextarea, K as FieldTextareaProps, L as FilterBar, M as FilterBarProps, N as FormSection, O as FormSectionProps, P as Page, Q as PageHeader, R as PageHeaderProps, S as PageProps, T as SearchInput, U as SearchInputProps, V as Section, W as SectionProps, X as StatTile, Y as StatTileProps, Z as StatusBadge, _ as StatusBadgeProps, $ as StatusBadgeTone, a0 as SubNav, a1 as SubNavItem, a2 as SubNavProps, a3 as SurfaceCard, a4 as SurfaceCardProps, a5 as useAppCopilotContext, a6 as useAppShellChat } from './chart-artifact-CPEpOmtV.cjs';
|
|
10
|
+
import React__default, { FC, ReactNode } from 'react';
|
|
11
|
+
export { Avatar, AvatarFallback, AvatarImage, Button, Dialog, DialogClose, DialogContent, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, MemoPillSegmentedTabs, PillSegmentedTab, PillSegmentedTabs, PillSegmentedTabsProps, Shimmer, TextShimmerProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui.cjs';
|
|
11
12
|
import { ClassValue } from 'clsx';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* omitted. Trailing slashes are stripped. Defaults to `""` (relative
|
|
18
|
-
* `/files/upload`).
|
|
19
|
-
*/
|
|
20
|
-
baseUrl?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Absolute or relative URL the adapter `POST`s the multipart upload to.
|
|
23
|
-
* Defaults to `${baseUrl}/files/upload`.
|
|
24
|
-
*/
|
|
25
|
-
uploadUrl?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Custom fetch used for the upload. Defaults to {@link authFetch}. Do not
|
|
28
|
-
* set `Content-Type` on multipart uploads — the boundary must be automatic.
|
|
29
|
-
*/
|
|
30
|
-
fetch?: UploadFetchFn;
|
|
31
|
-
/**
|
|
32
|
-
* MIME / extension `accept` string for the file picker.
|
|
33
|
-
*/
|
|
34
|
-
accept?: string;
|
|
35
|
-
}
|
|
36
|
-
/** @deprecated Use {@link CreateDefaultAttachmentAdapterOptions}. */
|
|
37
|
-
type CreateUploadAttachmentAdapterOptions = CreateDefaultAttachmentAdapterOptions;
|
|
38
|
-
declare const DEFAULT_UPLOAD_ACCEPT = "image/*,application/pdf,text/*,.md,.json,.csv,.tsv,.xlsx,.docx";
|
|
39
|
-
/**
|
|
40
|
-
* Build an `AttachmentAdapter` that uploads each file to a Timbal-style
|
|
41
|
-
* `/files/upload` endpoint and returns a `CompleteAttachment` whose
|
|
42
|
-
* `content[]` references the returned URL.
|
|
43
|
-
*/
|
|
44
|
-
declare function createDefaultAttachmentAdapter({ baseUrl, uploadUrl, fetch: fetchFn, accept, }?: CreateDefaultAttachmentAdapterOptions): AttachmentAdapter;
|
|
45
|
-
/** @deprecated Alias of {@link createDefaultAttachmentAdapter}. */
|
|
46
|
-
declare const createUploadAttachmentAdapter: typeof createDefaultAttachmentAdapter;
|
|
47
|
-
|
|
48
|
-
/** Tweaks for the built-in upload adapter (see {@link createDefaultAttachmentAdapter}). */
|
|
49
|
-
type TimbalAttachmentsConfig = {
|
|
50
|
-
uploadUrl?: string;
|
|
51
|
-
accept?: string;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Enable or customise composer attachments.
|
|
55
|
-
*
|
|
56
|
-
* - `true` — built-in adapter posting to `${baseUrl}/files/upload`
|
|
57
|
-
* - `{ uploadUrl?, accept? }` — same adapter with overrides
|
|
58
|
-
* - `AttachmentAdapter` — fully custom (e.g. presigned S3)
|
|
59
|
-
* - `null` — disable attachments (no `+` button / dropzone wiring)
|
|
60
|
-
* - `undefined` — off unless legacy `attachmentsUploadUrl` / `attachmentsAccept` are set
|
|
61
|
-
*/
|
|
62
|
-
type TimbalAttachmentsProp = boolean | TimbalAttachmentsConfig | AttachmentAdapter | null;
|
|
63
|
-
interface ResolveAttachmentAdapterOptions {
|
|
64
|
-
baseUrl?: string;
|
|
65
|
-
fetch?: CreateDefaultAttachmentAdapterOptions["fetch"];
|
|
66
|
-
/** @deprecated Prefer `attachments={{ uploadUrl }}` */
|
|
67
|
-
uploadUrl?: string;
|
|
68
|
-
/** @deprecated Prefer `attachments={{ accept }}` */
|
|
69
|
-
accept?: string;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Resolve the `AttachmentAdapter` (if any) for {@link TimbalRuntimeProvider}.
|
|
73
|
-
*/
|
|
74
|
-
declare function resolveAttachmentAdapter(attachments: TimbalAttachmentsProp | undefined, options?: ResolveAttachmentAdapterOptions): AttachmentAdapter | undefined;
|
|
75
|
-
|
|
76
|
-
interface TextContentPart {
|
|
77
|
-
type: "text";
|
|
78
|
-
text: string;
|
|
79
|
-
}
|
|
80
|
-
interface ThinkingContentPart {
|
|
81
|
-
type: "thinking";
|
|
82
|
-
text: string;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* A tool invocation. `argsText` accumulates from streaming `tool_use_delta`
|
|
86
|
-
* events; `result` is set once the matching `tool_result` arrives in the
|
|
87
|
-
* `OUTPUT` event.
|
|
88
|
-
*
|
|
89
|
-
* `result` is always a JSON-serializable value (string, number, object, array)
|
|
90
|
-
* — the runtime preserves whatever the agent returns. `resultText` is the
|
|
91
|
-
* text representation of the result blocks from `tool_result.content`, useful
|
|
92
|
-
* as a quick fallback when callers don't want to walk the structured result.
|
|
93
|
-
*/
|
|
94
|
-
interface ToolCallContentPart {
|
|
95
|
-
type: "tool-call";
|
|
96
|
-
toolCallId: string;
|
|
97
|
-
toolName: string;
|
|
98
|
-
argsText: string;
|
|
99
|
-
result?: unknown;
|
|
100
|
-
resultText?: string;
|
|
101
|
-
status?: "running" | "complete" | "error";
|
|
102
|
-
}
|
|
103
|
-
type ContentPart = TextContentPart | ThinkingContentPart | ToolCallContentPart;
|
|
104
|
-
type MessageRole = "user" | "assistant";
|
|
105
|
-
/**
|
|
106
|
-
* A file attached to a user message. We carry a single `dataUrl` field
|
|
107
|
-
* (despite the name, it may be either a `data:<mime>;base64,<bytes>` URL
|
|
108
|
-
* or a real `https://...` URL returned by an upload adapter) and project
|
|
109
|
-
* it both onto the wire (`{type:"file", file: dataUrl}`) and onto the
|
|
110
|
-
* assistant-ui display layer (`ImageMessagePart` / `FileMessagePart`
|
|
111
|
-
* inside `attachments[].content`).
|
|
112
|
-
*
|
|
113
|
-
* Both forms are accepted by Timbal's `FileContent` factory, so the same
|
|
114
|
-
* field works whether the attachment was inlined as base64 or uploaded
|
|
115
|
-
* to object storage.
|
|
116
|
-
*/
|
|
117
|
-
interface ChatAttachment {
|
|
118
|
-
id: string;
|
|
119
|
-
type: "image" | "document" | "file";
|
|
120
|
-
name?: string;
|
|
121
|
-
contentType?: string;
|
|
122
|
-
/**
|
|
123
|
-
* Either a `data:<mime>;base64,<bytes>` URL (inline) or a remote
|
|
124
|
-
* `https://...` URL produced by an upload-style {@link AttachmentAdapter}.
|
|
125
|
-
*/
|
|
126
|
-
dataUrl: string;
|
|
127
|
-
}
|
|
128
|
-
interface ChatMessage {
|
|
129
|
-
id: string;
|
|
130
|
-
role: MessageRole;
|
|
131
|
-
content: ContentPart[];
|
|
132
|
-
/** Files attached to a user message. Empty/undefined for assistant messages. */
|
|
133
|
-
attachments?: ChatAttachment[];
|
|
134
|
-
/** Run id stamped from the top-level `START` SSE event. */
|
|
135
|
-
runId?: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
type FetchFn$1 = (url: string, options?: RequestInit) => Promise<Response>;
|
|
139
|
-
interface UseTimbalStreamOptions {
|
|
140
|
-
workforceId: string;
|
|
141
|
-
baseUrl?: string;
|
|
142
|
-
fetch?: FetchFn$1;
|
|
143
|
-
/**
|
|
144
|
-
* When true, every parsed SSE event is `console.debug`-ed with a
|
|
145
|
-
* `[timbal]` prefix. Useful for diagnosing tool/artifact rendering issues
|
|
146
|
-
* without screen-sharing. Default: `false`.
|
|
147
|
-
*/
|
|
148
|
-
debug?: boolean;
|
|
149
|
-
}
|
|
150
|
-
interface SendOptions {
|
|
151
|
-
attachments?: ChatAttachment[];
|
|
152
|
-
/** Override the parent run id resolution. Pass `null` to start a new thread. */
|
|
153
|
-
parentId?: string | null;
|
|
154
|
-
}
|
|
155
|
-
interface TimbalStreamApi {
|
|
156
|
-
messages: ChatMessage[];
|
|
157
|
-
isRunning: boolean;
|
|
158
|
-
send: (input: string, options?: SendOptions) => Promise<void>;
|
|
159
|
-
reload: (messageId?: string | null) => Promise<void>;
|
|
160
|
-
cancel: () => void;
|
|
161
|
-
clear: () => void;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Lower-level streaming hook for callers that don't want the full `<Thread>`
|
|
165
|
-
* UI. Exposes the internal message state plus `send`, `reload`, `cancel`, and
|
|
166
|
-
* `clear` actions. Use this to build custom chat surfaces while reusing the
|
|
167
|
-
* Timbal SSE wire format and auth-aware fetching.
|
|
168
|
-
*/
|
|
169
|
-
declare function useTimbalStream({ workforceId, baseUrl, fetch: fetchFn, debug, }: UseTimbalStreamOptions): TimbalStreamApi;
|
|
170
|
-
/**
|
|
171
|
-
* Access the underlying `useTimbalStream` API from inside a component tree
|
|
172
|
-
* wrapped by `<TimbalRuntimeProvider>` (or `<TimbalChat>`). Useful for custom
|
|
173
|
-
* UIs that need direct access to messages, send, or cancel without going
|
|
174
|
-
* through the assistant-ui runtime.
|
|
175
|
-
*/
|
|
176
|
-
declare function useTimbalRuntime(): TimbalStreamApi;
|
|
177
|
-
interface TimbalRuntimeProviderProps {
|
|
178
|
-
workforceId: string;
|
|
179
|
-
children: ReactNode;
|
|
180
|
-
/**
|
|
181
|
-
* Base URL for API calls. Defaults to `/api`.
|
|
182
|
-
* The provider will POST to `{baseUrl}/workforce/{workforceId}/stream`.
|
|
183
|
-
*/
|
|
184
|
-
baseUrl?: string;
|
|
185
|
-
/**
|
|
186
|
-
* Custom fetch function for API calls. Defaults to `authFetch` which
|
|
187
|
-
* attaches Bearer tokens from localStorage and auto-refreshes on 401.
|
|
188
|
-
*/
|
|
189
|
-
fetch?: FetchFn$1;
|
|
190
|
-
/**
|
|
191
|
-
* Enable composer attachments. `true` or `{ uploadUrl?, accept? }` uses
|
|
192
|
-
* the built-in upload adapter (`POST` to `${baseUrl}/files/upload` by
|
|
193
|
-
* default). Pass a custom {@link AttachmentAdapter} for full control, or
|
|
194
|
-
* `null` to disable. Omitted = off (back-compat with pre-attachment chats).
|
|
195
|
-
*/
|
|
196
|
-
attachments?: TimbalAttachmentsProp;
|
|
197
|
-
/**
|
|
198
|
-
* Shorthand to enable the default upload adapter with a custom endpoint.
|
|
199
|
-
* Equivalent to `attachments={{ uploadUrl }}` when `attachments` is omitted.
|
|
200
|
-
*/
|
|
201
|
-
attachmentsUploadUrl?: string;
|
|
202
|
-
/**
|
|
203
|
-
* Shorthand MIME `accept` for the default upload adapter when `attachments`
|
|
204
|
-
* is omitted or `true`.
|
|
205
|
-
*/
|
|
206
|
-
attachmentsAccept?: string;
|
|
207
|
-
/**
|
|
208
|
-
* Forwarded to {@link useTimbalStream}. When `true`, every parsed SSE
|
|
209
|
-
* event is logged via `console.debug` with a `[timbal]` prefix.
|
|
210
|
-
*/
|
|
211
|
-
debug?: boolean;
|
|
212
|
-
}
|
|
213
|
-
declare function TimbalRuntimeProvider({ workforceId, children, baseUrl, fetch: fetchFn, attachments, attachmentsUploadUrl, attachmentsAccept, debug, }: TimbalRuntimeProviderProps): react_jsx_runtime.JSX.Element;
|
|
214
|
-
|
|
215
|
-
interface ComposerProps {
|
|
216
|
-
/** Placeholder shown in the textarea. Default: "Send a message..." */
|
|
217
|
-
placeholder?: string;
|
|
218
|
-
/**
|
|
219
|
-
* Show the file-attach button and dropzone. Default: follow the runtime
|
|
220
|
-
* (`attachments` on `TimbalChat`). Pass `false` to hide even when uploads
|
|
221
|
-
* are enabled; pass `true` to show only when an attachment adapter is active.
|
|
222
|
-
*/
|
|
223
|
-
showAttachments?: boolean;
|
|
224
|
-
/** Extra content rendered inside the toolbar, left of the send button. */
|
|
225
|
-
toolbar?: ReactNode;
|
|
226
|
-
/** Tooltip shown on the send button. Default: "Send message". */
|
|
227
|
-
sendTooltip?: string;
|
|
228
|
-
/** Disable autofocus on mount. Default: false. */
|
|
229
|
-
noAutoFocus?: boolean;
|
|
230
|
-
/** Extra className applied to the outer composer wrapper. */
|
|
231
|
-
className?: string;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Default chat composer — auto-resizing textarea with Enter-to-send,
|
|
235
|
-
* Shift+Enter for newline, attach pill on the left, and a circular send /
|
|
236
|
-
* cancel button on the right. Wraps `ComposerPrimitive` so consumers can
|
|
237
|
-
* override individual slots without losing the Studio chrome.
|
|
238
|
-
*/
|
|
239
|
-
declare const Composer: FC<ComposerProps>;
|
|
240
|
-
|
|
241
|
-
interface ThreadSuggestion {
|
|
242
|
-
/** Title shown on the row. Also sent verbatim as the user message. */
|
|
243
|
-
title: string;
|
|
244
|
-
/** Optional secondary line. */
|
|
245
|
-
description?: string;
|
|
246
|
-
/** Optional leading icon. */
|
|
247
|
-
icon?: ReactNode;
|
|
248
|
-
/**
|
|
249
|
-
* Override the prompt sent when the row is clicked. Useful when the row
|
|
250
|
-
* label is short ("Weekly recap") but the prompt should be longer.
|
|
251
|
-
*/
|
|
252
|
-
prompt?: string;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Suggestions can be passed as a static array, a thunk that returns an
|
|
256
|
-
* array, or an async function for dynamic / per-user suggestions.
|
|
257
|
-
*/
|
|
258
|
-
type SuggestionsSource = ThreadSuggestion[] | (() => ThreadSuggestion[] | Promise<ThreadSuggestion[]>);
|
|
259
|
-
interface ThreadSuggestionsProps {
|
|
260
|
-
suggestions?: SuggestionsSource;
|
|
261
|
-
className?: string;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Render suggestions as a stacked column of full-width rows. Each row reads
|
|
265
|
-
* like a list item rather than a chip, matching the Studio playground.
|
|
266
|
-
*
|
|
267
|
-
* On click the row's `prompt` (or `title` if no prompt) is appended as a
|
|
268
|
-
* user message via the thread runtime.
|
|
269
|
-
*/
|
|
270
|
-
declare const Suggestions: FC<ThreadSuggestionsProps>;
|
|
271
|
-
/**
|
|
272
|
-
* Resolve a `SuggestionsSource` to an array. Re-runs when the source
|
|
273
|
-
* identity changes. Sync arrays / sync functions resolve immediately;
|
|
274
|
-
* async functions stream in once the promise settles.
|
|
275
|
-
*/
|
|
276
|
-
declare function useResolvedSuggestions(source?: SuggestionsSource): ThreadSuggestion[] | undefined;
|
|
277
|
-
interface SuggestionsSlotProps {
|
|
278
|
-
suggestions?: SuggestionsSource;
|
|
279
|
-
className?: string;
|
|
280
|
-
}
|
|
281
|
-
type SuggestionsComponent = ComponentType<SuggestionsSlotProps>;
|
|
282
|
-
|
|
283
|
-
/** A value that is either a literal or a binding into local state. */
|
|
284
|
-
type UiBindable<T> = T | {
|
|
285
|
-
$bind: string;
|
|
286
|
-
};
|
|
287
|
-
interface UiArtifact {
|
|
288
|
-
type: "ui";
|
|
289
|
-
title?: string;
|
|
290
|
-
/** Initial values for `$bind` references. */
|
|
291
|
-
initialState?: Record<string, unknown>;
|
|
292
|
-
/** Root of the node tree. */
|
|
293
|
-
root: UiNode;
|
|
294
|
-
}
|
|
295
|
-
interface UiNodeBase {
|
|
296
|
-
id?: string;
|
|
297
|
-
className?: string;
|
|
298
|
-
}
|
|
299
|
-
interface UiBoxNode extends UiNodeBase {
|
|
300
|
-
kind: "box";
|
|
301
|
-
/** Flex direction. Default: "col". */
|
|
302
|
-
direction?: "row" | "col";
|
|
303
|
-
/** Tailwind spacing units (gap = `gap * 0.25rem`). */
|
|
304
|
-
gap?: number;
|
|
305
|
-
align?: "start" | "center" | "end" | "stretch";
|
|
306
|
-
justify?: "start" | "center" | "end" | "between" | "around";
|
|
307
|
-
wrap?: boolean;
|
|
308
|
-
padding?: number;
|
|
309
|
-
children?: UiNode[];
|
|
310
|
-
}
|
|
311
|
-
interface UiTextNode extends UiNodeBase {
|
|
312
|
-
kind: "text";
|
|
313
|
-
value: UiBindable<string | number>;
|
|
314
|
-
muted?: boolean;
|
|
315
|
-
size?: "xs" | "sm" | "base" | "lg";
|
|
316
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
317
|
-
}
|
|
318
|
-
interface UiHeadingNode extends UiNodeBase {
|
|
319
|
-
kind: "heading";
|
|
320
|
-
value: UiBindable<string>;
|
|
321
|
-
level?: 1 | 2 | 3 | 4;
|
|
322
|
-
}
|
|
323
|
-
interface UiBadgeNode extends UiNodeBase {
|
|
324
|
-
kind: "badge";
|
|
325
|
-
value: UiBindable<string>;
|
|
326
|
-
tone?: "default" | "primary" | "success" | "warn" | "danger";
|
|
327
|
-
}
|
|
328
|
-
interface UiButtonNode extends UiNodeBase {
|
|
329
|
-
kind: "button";
|
|
330
|
-
label: UiBindable<string>;
|
|
331
|
-
variant?: "default" | "outline" | "ghost" | "secondary" | "destructive" | "link";
|
|
332
|
-
size?: "sm" | "default" | "lg";
|
|
333
|
-
disabled?: UiBindable<boolean>;
|
|
334
|
-
onClick?: UiAction | UiAction[];
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Two-state toggle. `binding` is a dotted state path; clicking flips the
|
|
338
|
-
* stored boolean. Optional `onChange` fires *after* the state flip.
|
|
339
|
-
*/
|
|
340
|
-
interface UiToggleNode extends UiNodeBase {
|
|
341
|
-
kind: "toggle";
|
|
342
|
-
label?: UiBindable<string>;
|
|
343
|
-
binding: string;
|
|
344
|
-
onChange?: UiAction | UiAction[];
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Numeric range input. `binding` is a dotted state path; the slider reads and
|
|
348
|
-
* writes the stored number. Optional `onChange` fires after each commit.
|
|
349
|
-
*/
|
|
350
|
-
interface UiSliderNode extends UiNodeBase {
|
|
351
|
-
kind: "slider";
|
|
352
|
-
binding: string;
|
|
353
|
-
min?: number;
|
|
354
|
-
max?: number;
|
|
355
|
-
step?: number;
|
|
356
|
-
label?: UiBindable<string>;
|
|
357
|
-
/** Show the current value next to the slider. Default: true. */
|
|
358
|
-
showValue?: boolean;
|
|
359
|
-
onChange?: UiAction | UiAction[];
|
|
360
|
-
}
|
|
361
|
-
interface UiTooltipNode extends UiNodeBase {
|
|
362
|
-
kind: "tooltip";
|
|
363
|
-
content: UiBindable<string>;
|
|
364
|
-
side?: "top" | "bottom" | "left" | "right";
|
|
365
|
-
child: UiNode;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Wrap any node to make it draggable. Drag is purely visual — release fires
|
|
369
|
-
* `onDragEnd`. If `snapBack` (default) the child returns to its origin.
|
|
370
|
-
*/
|
|
371
|
-
interface UiDraggableNode extends UiNodeBase {
|
|
372
|
-
kind: "draggable";
|
|
373
|
-
child: UiNode;
|
|
374
|
-
axis?: "x" | "y" | "both";
|
|
375
|
-
snapBack?: boolean;
|
|
376
|
-
onDragEnd?: UiAction | UiAction[];
|
|
377
|
-
}
|
|
378
|
-
/**
|
|
379
|
-
* Escape hatch: a host-app-registered component. The host registers a
|
|
380
|
-
* renderer by name via `UiCustomNodeRegistryProvider`; props are passed
|
|
381
|
-
* through after binding resolution and children render recursively.
|
|
382
|
-
*/
|
|
383
|
-
interface UiCustomNode extends UiNodeBase {
|
|
384
|
-
kind: "custom";
|
|
385
|
-
name: string;
|
|
386
|
-
props?: Record<string, unknown>;
|
|
387
|
-
children?: UiNode[];
|
|
388
|
-
}
|
|
389
|
-
type UiNode = UiBoxNode | UiTextNode | UiHeadingNode | UiBadgeNode | UiButtonNode | UiToggleNode | UiSliderNode | UiTooltipNode | UiDraggableNode | UiCustomNode;
|
|
390
|
-
type UiAction =
|
|
391
|
-
/** Append a user message to the active thread. */
|
|
392
|
-
{
|
|
393
|
-
kind: "message";
|
|
394
|
-
text: UiBindable<string>;
|
|
395
|
-
}
|
|
396
|
-
/** Set a path in local state to a (possibly bound) value. */
|
|
397
|
-
| {
|
|
398
|
-
kind: "set";
|
|
399
|
-
path: string;
|
|
400
|
-
value: UiBindable<unknown>;
|
|
401
|
-
}
|
|
402
|
-
/** Flip a boolean at the given local-state path. */
|
|
403
|
-
| {
|
|
404
|
-
kind: "toggle";
|
|
405
|
-
path: string;
|
|
406
|
-
}
|
|
407
|
-
/** Bubble a named event to the host app via `UiEventProvider`. */
|
|
408
|
-
| {
|
|
409
|
-
kind: "emit";
|
|
410
|
-
name: string;
|
|
411
|
-
payload?: unknown;
|
|
412
|
-
};
|
|
413
|
-
declare function isUiBinding(value: unknown): value is {
|
|
414
|
-
$bind: string;
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
interface ChartArtifact {
|
|
418
|
-
type: "chart";
|
|
419
|
-
/** Chart kind. Renderer maps these to the underlying lib (e.g. recharts). */
|
|
420
|
-
chartType?: "bar" | "line" | "area" | "pie";
|
|
421
|
-
/** Optional title rendered above the chart. */
|
|
422
|
-
title?: string;
|
|
423
|
-
/** Array of data points. Keys map to series via `dataKey` / `xKey`. */
|
|
424
|
-
data: Array<Record<string, unknown>>;
|
|
425
|
-
/** Field name on each data point used for the X axis / category. */
|
|
426
|
-
xKey?: string;
|
|
427
|
-
/** Field name(s) used for series. Defaults to all keys except `xKey`. */
|
|
428
|
-
dataKey?: string | string[];
|
|
429
|
-
/** Optional unit label appended to numeric axis ticks. */
|
|
430
|
-
unit?: string;
|
|
431
|
-
}
|
|
432
|
-
interface QuestionOption {
|
|
433
|
-
id: string;
|
|
434
|
-
label: string;
|
|
435
|
-
description?: string;
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Question artifact — renders an in-thread choice widget. When the user picks
|
|
439
|
-
* an option, the renderer calls back into the runtime with the selected
|
|
440
|
-
* label as a new user message. Agents should treat the user response as the
|
|
441
|
-
* answer.
|
|
442
|
-
*/
|
|
443
|
-
interface QuestionArtifact {
|
|
444
|
-
type: "question";
|
|
445
|
-
/** Optional prompt shown above the options. Falls back to the message text. */
|
|
446
|
-
prompt?: string;
|
|
447
|
-
options: QuestionOption[];
|
|
448
|
-
/** Allow selecting more than one option. Default: false. */
|
|
449
|
-
multi?: boolean;
|
|
450
|
-
}
|
|
451
|
-
/** HTML/CSS/JS rendered in an iframe. See {@link HtmlArtifactView}. */
|
|
452
|
-
interface HtmlArtifact {
|
|
453
|
-
type: "html";
|
|
454
|
-
content: string;
|
|
455
|
-
/**
|
|
456
|
-
* When true (default) the HTML renders inside a sandboxed iframe. The
|
|
457
|
-
* sandbox allows scripts, forms, and modals but still isolates the
|
|
458
|
-
* document from the host page. Set to `false` for fully unrestricted
|
|
459
|
-
* inline HTML (scripts, external CDN assets, etc.) — trusted content only.
|
|
460
|
-
*/
|
|
461
|
-
sandboxed?: boolean;
|
|
462
|
-
/** Optional title rendered above the iframe. */
|
|
463
|
-
title?: string;
|
|
464
|
-
/** Iframe height in CSS pixels or any valid CSS length. Default: "320px". */
|
|
465
|
-
height?: string;
|
|
466
|
-
}
|
|
467
|
-
interface JsonArtifact {
|
|
468
|
-
type: "json";
|
|
469
|
-
title?: string;
|
|
470
|
-
data: unknown;
|
|
471
|
-
}
|
|
472
|
-
interface TableArtifact {
|
|
473
|
-
type: "table";
|
|
474
|
-
title?: string;
|
|
475
|
-
columns?: Array<{
|
|
476
|
-
key: string;
|
|
477
|
-
label?: string;
|
|
478
|
-
}>;
|
|
479
|
-
rows: Array<Record<string, unknown>>;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
type TimbalArtifact = ChartArtifact | QuestionArtifact | HtmlArtifact | JsonArtifact | TableArtifact | UiArtifact;
|
|
483
|
-
type AnyArtifact = TimbalArtifact | {
|
|
484
|
-
type: string;
|
|
485
|
-
[key: string]: unknown;
|
|
486
|
-
};
|
|
487
|
-
/**
|
|
488
|
-
* Type guard for artifact-shaped objects. Anything with a string `type` field
|
|
489
|
-
* is considered a candidate; specific renderers narrow further.
|
|
490
|
-
*/
|
|
491
|
-
declare function isArtifact(value: unknown): value is AnyArtifact;
|
|
492
|
-
|
|
493
|
-
interface ArtifactRendererProps<T extends AnyArtifact = AnyArtifact> {
|
|
494
|
-
artifact: T;
|
|
495
|
-
}
|
|
496
|
-
type ArtifactRenderer<T extends AnyArtifact = AnyArtifact> = ComponentType<ArtifactRendererProps<T>>;
|
|
497
|
-
type ArtifactRegistry = Record<string, ArtifactRenderer<AnyArtifact>>;
|
|
498
|
-
declare const defaultArtifactRenderers: ArtifactRegistry;
|
|
499
|
-
/**
|
|
500
|
-
* Provide a custom artifact registry to the subtree. Custom renderers are
|
|
501
|
-
* merged on top of the defaults — pass `override: true` to replace.
|
|
502
|
-
*/
|
|
503
|
-
declare const ArtifactRegistryProvider: FC<{
|
|
504
|
-
renderers?: ArtifactRegistry;
|
|
505
|
-
override?: boolean;
|
|
506
|
-
children: ReactNode;
|
|
507
|
-
}>;
|
|
508
|
-
declare function useArtifactRegistry(): ArtifactRegistry;
|
|
509
|
-
/**
|
|
510
|
-
* Render an artifact using the closest registry. Falls back to the JSON
|
|
511
|
-
* renderer when no entry matches the artifact's `type`.
|
|
512
|
-
*/
|
|
513
|
-
declare const ArtifactView: FC<{
|
|
514
|
-
artifact: AnyArtifact;
|
|
515
|
-
}>;
|
|
516
|
-
|
|
517
|
-
type UiState = Record<string, unknown>;
|
|
518
|
-
type UiStateAction = {
|
|
519
|
-
type: "set";
|
|
520
|
-
path: string;
|
|
521
|
-
value: unknown;
|
|
522
|
-
} | {
|
|
523
|
-
type: "toggle";
|
|
524
|
-
path: string;
|
|
525
|
-
} | {
|
|
526
|
-
type: "replace";
|
|
527
|
-
state: UiState;
|
|
528
|
-
};
|
|
529
|
-
/** Read a dotted path from a state object. Returns undefined when missing. */
|
|
530
|
-
declare function getPath(state: UiState, path: string): unknown;
|
|
531
|
-
/**
|
|
532
|
-
* Set a dotted path on a state object, returning a new object. Intermediate
|
|
533
|
-
* objects are cloned (or created when missing) so the result is safe to use
|
|
534
|
-
* directly with React state without further copying.
|
|
535
|
-
*/
|
|
536
|
-
declare function setPath(state: UiState, path: string, value: unknown): UiState;
|
|
537
|
-
/** Resolve a UiBindable into its concrete value against the given state. */
|
|
538
|
-
declare function resolveBindable<T>(value: UiBindable<T>, state: UiState): T;
|
|
539
|
-
|
|
540
|
-
declare function useUiState(): UiState;
|
|
541
|
-
declare function useUiDispatch(): Dispatch<UiStateAction>;
|
|
542
|
-
interface UiEventEnvelope {
|
|
543
|
-
name: string;
|
|
544
|
-
payload?: unknown;
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* Subscribe the host app to `emit`-kind actions fired from any UiArtifact in
|
|
548
|
-
* the subtree. Wrap your runtime / chat root once.
|
|
549
|
-
*/
|
|
550
|
-
declare const UiEventProvider: FC<{
|
|
551
|
-
onEvent: (event: UiEventEnvelope) => void;
|
|
552
|
-
children: ReactNode;
|
|
553
|
-
}>;
|
|
554
|
-
declare function useUiEventEmitter(): ((event: UiEventEnvelope) => void) | null;
|
|
555
|
-
interface UiCustomNodeProps {
|
|
556
|
-
/** Already binding-resolved props from the artifact. */
|
|
557
|
-
props: Record<string, unknown>;
|
|
558
|
-
/** Recursively rendered children. */
|
|
559
|
-
children?: ReactNode;
|
|
560
|
-
}
|
|
561
|
-
type UiCustomNodeRenderer = ComponentType<UiCustomNodeProps>;
|
|
562
|
-
/**
|
|
563
|
-
* Register named renderers for `{ kind: "custom", name: "..." }` nodes. Lets
|
|
564
|
-
* host apps extend the palette without forking the package.
|
|
565
|
-
*/
|
|
566
|
-
declare const UiCustomNodeRegistryProvider: FC<{
|
|
567
|
-
renderers: Record<string, UiCustomNodeRenderer>;
|
|
568
|
-
children: ReactNode;
|
|
569
|
-
}>;
|
|
570
|
-
declare function useUiCustomNodeRegistry(): Record<string, UiCustomNodeRenderer>;
|
|
571
|
-
|
|
572
|
-
interface ThreadWelcomeConfig {
|
|
573
|
-
heading?: string;
|
|
574
|
-
subheading?: string;
|
|
575
|
-
/**
|
|
576
|
-
* Optional brand icon rendered above the heading. Pass any ReactNode — the
|
|
577
|
-
* SDK no longer ships a default sparkle icon so apps can drop in their
|
|
578
|
-
* own logo or stay minimal.
|
|
579
|
-
*/
|
|
580
|
-
icon?: ReactNode;
|
|
581
|
-
}
|
|
582
|
-
interface ThreadWelcomeProps {
|
|
583
|
-
config?: ThreadWelcomeConfig;
|
|
584
|
-
suggestions?: SuggestionsSource;
|
|
585
|
-
/**
|
|
586
|
-
* The resolved `Suggestions` component (default or user-overridden via
|
|
587
|
-
* `components.Suggestions`). Custom Welcome implementations should render
|
|
588
|
-
* this and pass their `suggestions` source through.
|
|
589
|
-
*/
|
|
590
|
-
Suggestions?: SuggestionsComponent;
|
|
591
|
-
}
|
|
592
|
-
interface ThreadComponents {
|
|
593
|
-
/** Replace the user message bubble. Access content via `MessagePrimitive.Parts`. */
|
|
594
|
-
UserMessage?: ComponentType;
|
|
595
|
-
/** Replace the assistant message bubble. Access content via `MessagePrimitive.Parts`. */
|
|
596
|
-
AssistantMessage?: ComponentType;
|
|
597
|
-
/** Replace the inline edit composer. */
|
|
598
|
-
EditComposer?: ComponentType;
|
|
599
|
-
/** Replace the composer (input bar). Receives all `ComposerProps` from the parent. */
|
|
600
|
-
Composer?: ComponentType<ComposerProps>;
|
|
601
|
-
/** Replace the welcome / empty state. Renders only while the thread is empty. */
|
|
602
|
-
Welcome?: ComponentType<ThreadWelcomeProps>;
|
|
603
|
-
/** Replace the suggestion list (rendered inside Welcome). */
|
|
604
|
-
Suggestions?: SuggestionsComponent;
|
|
605
|
-
/** Replace the scroll-to-bottom button. */
|
|
606
|
-
ScrollToBottom?: ComponentType;
|
|
607
|
-
}
|
|
608
|
-
interface ThreadArtifactsConfig {
|
|
609
|
-
/** Custom artifact renderers, merged on top of the built-in defaults. */
|
|
610
|
-
renderers?: ArtifactRegistry;
|
|
611
|
-
/** Replace the built-in renderers entirely instead of merging. */
|
|
612
|
-
override?: boolean;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
interface ThreadProps {
|
|
616
|
-
className?: string;
|
|
617
|
-
/** Max width of the message column. Default: "44rem". */
|
|
618
|
-
maxWidth?: string;
|
|
619
|
-
/** Welcome screen text + optional brand icon. */
|
|
620
|
-
welcome?: ThreadWelcomeConfig;
|
|
621
|
-
/**
|
|
622
|
-
* Welcome-screen suggestion rows. Accepts a static array, a thunk, or an
|
|
623
|
-
* async function for per-user suggestions.
|
|
624
|
-
*/
|
|
625
|
-
suggestions?: SuggestionsSource;
|
|
626
|
-
/** Composer input placeholder. Default: "Send a message...". */
|
|
627
|
-
composerPlaceholder?: string;
|
|
628
|
-
/** Override individual UI slots while keeping the rest as defaults. */
|
|
629
|
-
components?: ThreadComponents;
|
|
630
|
-
/**
|
|
631
|
-
* Configure how rich tool/artifact results render. Pass `renderers` to add
|
|
632
|
-
* support for custom artifact `type` values. Built-in types (`chart`,
|
|
633
|
-
* `question`, `html`, `json`, `table`, `ui`) are always available unless
|
|
634
|
-
* `override: true` is set.
|
|
635
|
-
*/
|
|
636
|
-
artifacts?: ThreadArtifactsConfig;
|
|
637
|
-
/**
|
|
638
|
-
* Called when a `ui` artifact fires an `{ kind: "emit" }` action. Use this
|
|
639
|
-
* to react to slider commits, drag gestures, or other host-side logic
|
|
640
|
-
* beyond the built-in `message` action (which already appends a user
|
|
641
|
-
* message).
|
|
642
|
-
*/
|
|
643
|
-
onArtifactEvent?: (event: UiEventEnvelope) => void;
|
|
644
|
-
}
|
|
645
|
-
declare const Thread: FC<ThreadProps>;
|
|
646
|
-
|
|
647
|
-
interface TimbalChatProps extends Omit<TimbalRuntimeProviderProps, "children">, ThreadProps {
|
|
648
|
-
}
|
|
649
|
-
declare function TimbalChat({ workforceId, baseUrl, fetch, attachments, attachmentsUploadUrl, attachmentsAccept, debug, ...threadProps }: TimbalChatProps): react_jsx_runtime.JSX.Element;
|
|
650
|
-
|
|
651
|
-
interface TimbalChatShellProps extends Omit<TimbalChatProps, "workforceId"> {
|
|
652
|
-
/**
|
|
653
|
-
* Pre-selected workforce id. When omitted, the shell fetches the workforce
|
|
654
|
-
* list from `{baseUrl}/workforce` and picks the first agent automatically.
|
|
655
|
-
*/
|
|
656
|
-
workforceId?: string;
|
|
657
|
-
/** Branding rendered at the start of the header (logo, etc). */
|
|
658
|
-
brand?: ReactNode;
|
|
659
|
-
/** Extra content rendered at the end of the header (theme toggle, logout). */
|
|
660
|
-
headerActions?: ReactNode;
|
|
661
|
-
/** Hide the built-in workforce selector. Default: false. */
|
|
662
|
-
hideWorkforceSelector?: boolean;
|
|
663
|
-
/** Class for the outer flex container. */
|
|
664
|
-
className?: string;
|
|
665
|
-
/** Class for the header bar. */
|
|
666
|
-
headerClassName?: string;
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Drop-in shell that wraps `TimbalChat` with the Studio playground chrome:
|
|
670
|
-
* floating topbar with brand + workforce selector + actions, soft gradient
|
|
671
|
-
* background, and the chat thread filling the remaining vertical space.
|
|
672
|
-
*
|
|
673
|
-
* Falls back to picking the first available workforce when `workforceId`
|
|
674
|
-
* isn't supplied.
|
|
675
|
-
*/
|
|
676
|
-
declare const TimbalChatShell: FC<TimbalChatShellProps>;
|
|
677
|
-
|
|
678
|
-
interface TimbalStudioShellProps extends Omit<TimbalChatProps, "workforceId"> {
|
|
679
|
-
/**
|
|
680
|
-
* Pin the chat to a specific workforce. When omitted, the shell fetches
|
|
681
|
-
* the workforce list via `useWorkforces()` and lets the sidebar drive
|
|
682
|
-
* selection.
|
|
683
|
-
*/
|
|
684
|
-
workforceId?: string;
|
|
685
|
-
/**
|
|
686
|
-
* Pre-loaded workforce list. When omitted, the shell fetches it.
|
|
687
|
-
* Useful for stories / SSR / preview environments.
|
|
688
|
-
*/
|
|
689
|
-
workforces?: WorkforceItem[];
|
|
690
|
-
/** Custom fetch for the workforce list (mock fetch in preview mode). */
|
|
691
|
-
workforcesFetch?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
692
|
-
/** Base URL for the workforce list. Default: `/api`. */
|
|
693
|
-
workforcesBaseUrl?: string;
|
|
694
|
-
/** Brand mark rendered in the sidebar header. Default: `<TimbalMark />`. */
|
|
695
|
-
brand?: ReactNode;
|
|
696
|
-
/** Extra actions rendered at the right of the floating top bar. */
|
|
697
|
-
headerActions?: ReactNode;
|
|
698
|
-
/** Nodes rendered at the left of the floating top bar (after the menu button). */
|
|
699
|
-
headerStart?: ReactNode;
|
|
700
|
-
/** Initial collapse state when no persisted value exists. Default: false. */
|
|
701
|
-
defaultCollapsed?: boolean;
|
|
702
|
-
/** localStorage key for persisting the collapse state. Default set. */
|
|
703
|
-
persistKey?: string | null;
|
|
704
|
-
/** Pixel breakpoint below which the sidebar becomes a drawer. Default 768. */
|
|
705
|
-
mobileBreakpointPx?: number;
|
|
706
|
-
/** Caption shown in the sidebar footer when no user is signed in. */
|
|
707
|
-
sidebarEmptyCaption?: string | null;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Opinionated Timbal studio layout — floating sidebar with workforce picker,
|
|
711
|
-
* top bar with optional mode toggle / actions, and a `<TimbalChat />` filling
|
|
712
|
-
* the rest. Manages collapse state, mobile drawer, and workforce selection
|
|
713
|
-
* out of the box. For more control compose `StudioSidebar` + `TimbalChat`
|
|
714
|
-
* directly.
|
|
715
|
-
*/
|
|
716
|
-
declare const TimbalStudioShell: FC<TimbalStudioShellProps>;
|
|
717
|
-
|
|
718
|
-
declare const MarkdownText: React.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
|
|
719
|
-
|
|
720
|
-
interface ToolStatus {
|
|
721
|
-
type: string;
|
|
722
|
-
reason?: string;
|
|
723
|
-
}
|
|
724
|
-
declare function useToolRunning(props: {
|
|
725
|
-
status?: ToolStatus;
|
|
726
|
-
result?: unknown;
|
|
727
|
-
}): boolean;
|
|
728
|
-
declare const ToolFallback: ToolCallMessagePartComponent;
|
|
729
|
-
|
|
730
|
-
interface WorkforceSelectorProps {
|
|
731
|
-
/** List of workforces to choose from. */
|
|
732
|
-
workforces: WorkforceItem[];
|
|
733
|
-
/** Currently selected workforce id. */
|
|
734
|
-
value: string;
|
|
735
|
-
/** Called when the user picks a different workforce. */
|
|
736
|
-
onChange: (id: string) => void;
|
|
737
|
-
/** Hide the selector when there's only one option. Default: true. */
|
|
738
|
-
hideWhenSingle?: boolean;
|
|
739
|
-
className?: string;
|
|
740
|
-
placeholder?: string;
|
|
741
|
-
}
|
|
742
|
-
/**
|
|
743
|
-
* Minimal headless workforce picker. Wraps a styled native `<select>` so
|
|
744
|
-
* the SDK doesn't need to depend on `@radix-ui/react-select`, while still
|
|
745
|
-
* matching the Studio chrome (gradient pill, soft border, chevron).
|
|
746
|
-
*
|
|
747
|
-
* Apps that want a richer UI (search, descriptions, agent icons) can build
|
|
748
|
-
* their own using `useWorkforces()`.
|
|
749
|
-
*/
|
|
750
|
-
declare const WorkforceSelector: FC<WorkforceSelectorProps>;
|
|
751
|
-
|
|
752
|
-
interface StudioSidebarProps {
|
|
753
|
-
/**
|
|
754
|
-
* Workforces to display. When omitted, the sidebar fetches them via the
|
|
755
|
-
* shared `useWorkforces()` hook.
|
|
756
|
-
*/
|
|
757
|
-
workforces?: WorkforceItem[];
|
|
758
|
-
selectedId?: string;
|
|
759
|
-
onSelect?: (id: string) => void;
|
|
760
|
-
/** Initial collapse state when no persisted value exists. Default: false. */
|
|
761
|
-
defaultCollapsed?: boolean;
|
|
762
|
-
/**
|
|
763
|
-
* localStorage key for persisting the collapse state. Pass `null` to
|
|
764
|
-
* disable persistence. Default: `"timbal-studio-sidebar-collapsed"`.
|
|
765
|
-
*/
|
|
766
|
-
persistKey?: string | null;
|
|
767
|
-
/**
|
|
768
|
-
* Pixel breakpoint below which the sidebar becomes a drawer.
|
|
769
|
-
* Default: 768.
|
|
770
|
-
*/
|
|
771
|
-
mobileBreakpointPx?: number;
|
|
772
|
-
/** Brand element rendered in the sidebar header. Default: `<TimbalMark />`. */
|
|
773
|
-
brand?: ReactNode;
|
|
774
|
-
/** Caption shown in the footer when no user is signed in. */
|
|
775
|
-
emptyCaption?: string | null;
|
|
776
|
-
/** External control over the mobile drawer (used by `TimbalStudioShell`). */
|
|
777
|
-
mobileOpen?: boolean;
|
|
778
|
-
onMobileOpenChange?: (open: boolean) => void;
|
|
779
|
-
}
|
|
780
|
-
/**
|
|
781
|
-
* Floating, collapsible workforce sidebar. Manages its own collapse state
|
|
782
|
-
* (persisted to localStorage by default) and mobile drawer behaviour. For
|
|
783
|
-
* a fully composed shell with the chat already wired use
|
|
784
|
-
* `TimbalStudioShell`.
|
|
785
|
-
*/
|
|
786
|
-
declare const StudioSidebar: FC<StudioSidebarProps>;
|
|
787
|
-
|
|
788
|
-
interface TimbalMarkProps {
|
|
789
|
-
className?: string;
|
|
790
|
-
/** Square size in CSS pixels (matches `--studio-chrome-pill-height` at 40). */
|
|
791
|
-
size?: number;
|
|
792
|
-
/**
|
|
793
|
-
* Override the symbol shown inside the shader. Defaults to the embedded
|
|
794
|
-
* Timbal mark — pass any image URL or data URI to brand the chat with
|
|
795
|
-
* your own logo while keeping the liquid-metal motion.
|
|
796
|
-
*/
|
|
797
|
-
src?: string;
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Timbal mark rendered with the Paper Design LiquidMetal shader.
|
|
801
|
-
*
|
|
802
|
-
* The Timbal symbol is embedded as a data URI so the library works without
|
|
803
|
-
* the consumer having to host the asset. Pass `src` to use a custom logo.
|
|
804
|
-
*/
|
|
805
|
-
declare function TimbalMark({ className, size, src, }: TimbalMarkProps): react_jsx_runtime.JSX.Element;
|
|
806
|
-
|
|
807
|
-
type ModeToggleTheme = "light" | "dark" | "system";
|
|
808
|
-
interface ModeToggleProps {
|
|
809
|
-
/**
|
|
810
|
-
* Current theme. When omitted, the toggle reads from / writes to the
|
|
811
|
-
* `.dark` class on `<html>` directly — useful for apps that don't have
|
|
812
|
-
* a theme manager yet.
|
|
813
|
-
*/
|
|
814
|
-
theme?: ModeToggleTheme | string;
|
|
815
|
-
/** Called when the user clicks the toggle. */
|
|
816
|
-
setTheme?: (theme: ModeToggleTheme) => void;
|
|
817
|
-
className?: string;
|
|
818
|
-
/** ARIA label / tooltip. Default: "Toggle theme". */
|
|
819
|
-
label?: string;
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* Sun/moon theme toggle styled to sit in the studio top bar.
|
|
823
|
-
*
|
|
824
|
-
* Two integration modes:
|
|
825
|
-
*
|
|
826
|
-
* 1. Pass `theme` + `setTheme` (e.g. from `next-themes`'s `useTheme`).
|
|
827
|
-
* The component is then fully controlled.
|
|
828
|
-
* 2. Omit both. The toggle reads the current state from `.dark` on
|
|
829
|
-
* `<html>` and flips it on click. Good enough for prototypes and
|
|
830
|
-
* cases where there is no theme manager.
|
|
831
|
-
*/
|
|
832
|
-
declare const ModeToggle: FC<ModeToggleProps>;
|
|
833
|
-
|
|
834
|
-
interface StudioWelcomeProps extends ThreadWelcomeProps {
|
|
835
|
-
/** Override the brand mark rendered above the heading. */
|
|
836
|
-
icon?: ReactNode;
|
|
837
|
-
}
|
|
838
|
-
/**
|
|
839
|
-
* Welcome screen with the staggered Timbal mark + heading + subheading.
|
|
840
|
-
* Drop in as the `components.Welcome` slot of `<Thread />` /
|
|
841
|
-
* `<TimbalChat />` to replace the default sparkle illustration.
|
|
842
|
-
*/
|
|
843
|
-
declare const StudioWelcome: FC<StudioWelcomeProps>;
|
|
13
|
+
import 'react/jsx-runtime';
|
|
14
|
+
import './timbal-v2-button-F4-z7m33.cjs';
|
|
15
|
+
import 'class-variance-authority/types';
|
|
16
|
+
import 'class-variance-authority';
|
|
17
|
+
import 'radix-ui';
|
|
844
18
|
|
|
845
19
|
type FetchFn = (url: string, options?: RequestInit) => Promise<Response>;
|
|
846
20
|
interface UseWorkforcesOptions {
|
|
@@ -979,17 +153,6 @@ declare const ArtifactCard: FC<{
|
|
|
979
153
|
children: ReactNode;
|
|
980
154
|
}>;
|
|
981
155
|
|
|
982
|
-
/**
|
|
983
|
-
* Lightweight SVG chart for the four basic chart types. We deliberately don't
|
|
984
|
-
* pull in `recharts` or similar — most artifact charts are small and these
|
|
985
|
-
* render fine at the cost of a few hundred lines of SVG. Apps that need
|
|
986
|
-
* production-grade charting can register a custom renderer that wraps their
|
|
987
|
-
* preferred lib.
|
|
988
|
-
*/
|
|
989
|
-
declare const ChartArtifactView: FC<{
|
|
990
|
-
artifact: ChartArtifact;
|
|
991
|
-
}>;
|
|
992
|
-
|
|
993
156
|
/**
|
|
994
157
|
* In-thread choice widget. Single-select submits immediately on click;
|
|
995
158
|
* multi-select shows a confirm button. The answer is sent as a regular
|
|
@@ -1060,85 +223,6 @@ declare const refreshAccessToken: () => Promise<boolean>;
|
|
|
1060
223
|
declare const authFetch: (url: string, options?: RequestInit) => Promise<Response>;
|
|
1061
224
|
declare const fetchCurrentUser: () => Promise<Session | null>;
|
|
1062
225
|
|
|
1063
|
-
declare const buttonVariants: (props?: ({
|
|
1064
|
-
variant?: "default" | "outline" | "ghost" | "secondary" | "destructive" | "link" | null | undefined;
|
|
1065
|
-
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
1066
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1067
|
-
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
1068
|
-
asChild?: boolean;
|
|
1069
|
-
}): react_jsx_runtime.JSX.Element;
|
|
1070
|
-
|
|
1071
|
-
declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof Tooltip$1.Provider>): react_jsx_runtime.JSX.Element;
|
|
1072
|
-
declare function Tooltip({ ...props }: React.ComponentProps<typeof Tooltip$1.Root>): react_jsx_runtime.JSX.Element;
|
|
1073
|
-
declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof Tooltip$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1074
|
-
declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof Tooltip$1.Content>): react_jsx_runtime.JSX.Element;
|
|
1075
|
-
|
|
1076
|
-
declare function Avatar({ className, size, ...props }: React.ComponentProps<typeof Avatar$1.Root> & {
|
|
1077
|
-
size?: "default" | "sm" | "lg";
|
|
1078
|
-
}): react_jsx_runtime.JSX.Element;
|
|
1079
|
-
declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>): react_jsx_runtime.JSX.Element;
|
|
1080
|
-
declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>): react_jsx_runtime.JSX.Element;
|
|
1081
|
-
|
|
1082
|
-
declare function Dialog({ ...props }: React.ComponentProps<typeof Dialog$1.Root>): react_jsx_runtime.JSX.Element;
|
|
1083
|
-
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): react_jsx_runtime.JSX.Element;
|
|
1084
|
-
declare function DialogPortal({ ...props }: React.ComponentProps<typeof Dialog$1.Portal>): react_jsx_runtime.JSX.Element;
|
|
1085
|
-
declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): react_jsx_runtime.JSX.Element;
|
|
1086
|
-
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof Dialog$1.Overlay>): react_jsx_runtime.JSX.Element;
|
|
1087
|
-
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof Dialog$1.Content> & {
|
|
1088
|
-
showCloseButton?: boolean;
|
|
1089
|
-
}): react_jsx_runtime.JSX.Element;
|
|
1090
|
-
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof Dialog$1.Title>): react_jsx_runtime.JSX.Element;
|
|
1091
|
-
|
|
1092
|
-
interface TextShimmerProps {
|
|
1093
|
-
children: string;
|
|
1094
|
-
as?: ElementType;
|
|
1095
|
-
className?: string;
|
|
1096
|
-
duration?: number;
|
|
1097
|
-
spread?: number;
|
|
1098
|
-
}
|
|
1099
|
-
declare const Shimmer: React.MemoExoticComponent<({ children, as: Component, className, duration, spread, }: TextShimmerProps) => react_jsx_runtime.JSX.Element>;
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Timbal V2 button design tokens.
|
|
1103
|
-
*
|
|
1104
|
-
* Mirrors the `timbal-platform` design language (`TimbalV2Button`) so chat
|
|
1105
|
-
* surfaces built with the SDK feel identical to the Timbal Studio. Each record
|
|
1106
|
-
* is keyed by variant or size and ships only Tailwind utility classes — no
|
|
1107
|
-
* runtime JS — so consumers can compose them with `cn(...)` and add their own
|
|
1108
|
-
* overrides without ejecting.
|
|
1109
|
-
*
|
|
1110
|
-
* Every colour is resolved through semantic CSS variables defined in
|
|
1111
|
-
* `styles.css`. There are NO hardcoded palette literals — light/dark mode
|
|
1112
|
-
* flips by swapping the variable values, not by toggling Tailwind classes.
|
|
1113
|
-
*/
|
|
1114
|
-
type TimbalV2Variant = "primary" | "secondary" | "ghost" | "informative" | "destructive" | "link";
|
|
1115
|
-
type TimbalV2Size = "xs" | "sm" | "md" | "lg";
|
|
1116
|
-
|
|
1117
|
-
interface TimbalV2ButtonProps extends React.ComponentProps<"button"> {
|
|
1118
|
-
variant?: TimbalV2Variant;
|
|
1119
|
-
size?: TimbalV2Size;
|
|
1120
|
-
isIconOnly?: boolean;
|
|
1121
|
-
isLoading?: boolean;
|
|
1122
|
-
fullWidth?: boolean;
|
|
1123
|
-
/** When true, renders children as the underlying element (Radix Slot pattern). */
|
|
1124
|
-
asChild?: boolean;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
interface TooltipIconButtonProps extends Omit<TimbalV2ButtonProps, "isIconOnly"> {
|
|
1128
|
-
/** Visible tooltip + accessible label. Always required. */
|
|
1129
|
-
tooltip: string;
|
|
1130
|
-
/** Tooltip placement. Default: "bottom". */
|
|
1131
|
-
side?: "top" | "bottom" | "left" | "right";
|
|
1132
|
-
}
|
|
1133
|
-
/**
|
|
1134
|
-
* Icon-only Timbal pill button with a tooltip. Used by every chat-surface
|
|
1135
|
-
* toolbar (composer send/cancel, message action bar, scroll-to-bottom).
|
|
1136
|
-
*
|
|
1137
|
-
* Defaults to a soft `secondary` variant so it sits cleanly inside composers,
|
|
1138
|
-
* message bubbles, and the action bar. Override via `variant`.
|
|
1139
|
-
*/
|
|
1140
|
-
declare const TooltipIconButton: React.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
1141
|
-
|
|
1142
226
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1143
227
|
|
|
1144
|
-
export { ARTIFACT_AGENT_INSTRUCTIONS, ARTIFACT_FENCE_LANGUAGES,
|
|
228
|
+
export { ARTIFACT_AGENT_INSTRUCTIONS, ARTIFACT_FENCE_LANGUAGES, AnyArtifact, ArtifactCard, AuthGuard, HtmlArtifact, HtmlArtifactView, JsonArtifact, JsonArtifactView, type MarkdownArtifactMatch, type MarkdownSegment, QuestionArtifact, QuestionArtifactView, SessionProvider, TableArtifact, TableArtifactView, ToolArtifactFallback, UiArtifact, UiArtifactView, UiNode, UiNodeView, type UseWorkforcesOptions, type UseWorkforcesResult, authFetch, clearTokens, cn, fetchCurrentUser, findMarkdownArtifacts, getAccessToken, getRefreshToken, isArtifactFenceLanguage, parseArtifactFromToolResult, refreshAccessToken, setAccessToken, setRefreshToken, splitMarkdownByArtifacts, useOptionalSession, useSession, useWorkforces };
|