agentic-ui-kit 0.8.0 → 0.9.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.
Files changed (41) hide show
  1. package/README.md +19 -15
  2. package/dist/ask-user-CwDYhXX4.js +388 -0
  3. package/dist/core.js +3 -103
  4. package/dist/extensions-CJ4Asuxk.js +329 -0
  5. package/dist/index.js +43 -1394
  6. package/dist/partial-json-w_oXePqJ.js +111 -0
  7. package/dist/types/core/src/blocks.d.ts +1 -1
  8. package/dist/types/core/src/events.d.ts +1 -1
  9. package/dist/types/core/src/index.d.ts +9 -20
  10. package/dist/types/core/src/reduce.d.ts +2 -2
  11. package/dist/types/core/src/sse.d.ts +1 -1
  12. package/dist/types/core/src/ui-components.d.ts +1 -1
  13. package/dist/types/core/src/ui-markup.d.ts +1 -1
  14. package/dist/types/core/src/visuals.d.ts +11 -0
  15. package/dist/types/react/src/components/approval-card.d.ts +1 -1
  16. package/dist/types/react/src/components/ask-user.d.ts +1 -1
  17. package/dist/types/react/src/components/chat-list.d.ts +1 -1
  18. package/dist/types/react/src/components/composer.d.ts +1 -1
  19. package/dist/types/react/src/components/extensions.d.ts +50 -0
  20. package/dist/types/react/src/components/message-list.d.ts +1 -1
  21. package/dist/types/react/src/components/messages.d.ts +1 -1
  22. package/dist/types/react/src/components/tool-prompt.d.ts +1 -1
  23. package/dist/types/react/src/components/tools.d.ts +2 -2
  24. package/dist/types/react/src/hooks/sse-transport.d.ts +1 -1
  25. package/dist/types/react/src/hooks/use-chat.d.ts +1 -1
  26. package/dist/types/react/src/index.d.ts +86 -90
  27. package/dist/types/react/src/primitives/chat-theme.d.ts +3 -3
  28. package/dist/types/react/src/views/chat-transcript.d.ts +2 -5
  29. package/dist/types/react/src/views/chat-view.d.ts +4 -11
  30. package/dist/types/react/src/views/sidebar.d.ts +1 -1
  31. package/dist/types/react/src/visuals/core.d.ts +1 -0
  32. package/dist/types/react/src/visuals/index.d.ts +8 -0
  33. package/dist/types/react/src/visuals/provider.d.ts +26 -0
  34. package/dist/types/react/src/{components → visuals}/ui-components.d.ts +2 -2
  35. package/dist/types/react/src/{components → visuals}/ui-tree.d.ts +2 -1
  36. package/dist/types/react/src/{components → visuals}/widget-frame.d.ts +2 -1
  37. package/dist/{src-BrPYkHdt.js → visuals-CxCXnEob.js} +96 -490
  38. package/dist/visuals-core.js +1 -0
  39. package/dist/visuals.js +1134 -0
  40. package/package.json +9 -1
  41. /package/dist/types/react/src/{components → visuals}/replacements.d.ts +0 -0
@@ -0,0 +1,111 @@
1
+ // ../core/src/partial-json.ts
2
+ const tryParse = (text) => {
3
+ try {
4
+ return JSON.parse(text);
5
+ } catch {
6
+ return;
7
+ }
8
+ };
9
+ /**
10
+ * Best-effort value of JSON that is still streaming, so a tool call's fields can show while the model
11
+ * writes them: `{"title":"Stand-up","day":"Tu` gives `{ title: "Stand-up", day: "Tu" }`. Open strings are
12
+ * cut where the text ends, open objects and arrays are closed, and a key without its value yet is left
13
+ * out. Returns undefined when nothing usable has arrived. One pass over the text.
14
+ */
15
+ function parsePartialJson(text) {
16
+ const whole = tryParse(text);
17
+ if (whole !== void 0) return whole;
18
+ const stack = [];
19
+ const closers = () => stack.map((f) => f.close).reverse().join("");
20
+ let safe = 0;
21
+ let safeClose = "";
22
+ const valueDone = (end) => {
23
+ const top = stack.at(-1);
24
+ if (top) top.expect = "comma";
25
+ safe = end;
26
+ safeClose = closers();
27
+ };
28
+ let i = 0;
29
+ const n = text.length;
30
+ while (i < n) {
31
+ const ch = text[i];
32
+ if (ch === " " || ch === "\n" || ch === "\r" || ch === " ") {
33
+ i++;
34
+ continue;
35
+ }
36
+ const top = stack.at(-1);
37
+ if (ch === "\"") {
38
+ let j = i + 1;
39
+ let escaped = false;
40
+ for (; j < n; j++) {
41
+ const c = text[j];
42
+ if (escaped) escaped = false;
43
+ else if (c === "\\") escaped = true;
44
+ else if (c === "\"") break;
45
+ }
46
+ const isKey = top?.close === "}" && top.expect === "key";
47
+ if (j >= n) {
48
+ if (isKey) break;
49
+ const body = text.slice(i, n).replace(/\\(u[0-9a-fA-F]{0,3})?$/, "");
50
+ return tryParse(text.slice(0, i) + body + "\"" + closers()) ?? tryParse(text.slice(0, safe) + safeClose);
51
+ }
52
+ i = j + 1;
53
+ if (isKey) top.expect = "colon";
54
+ else valueDone(i);
55
+ continue;
56
+ }
57
+ if (ch === ":") {
58
+ if (top) top.expect = "value";
59
+ i++;
60
+ continue;
61
+ }
62
+ if (ch === ",") {
63
+ if (top) top.expect = top.close === "}" ? "key" : "value";
64
+ i++;
65
+ continue;
66
+ }
67
+ if (ch === "{" || ch === "[") {
68
+ stack.push({
69
+ close: ch === "{" ? "}" : "]",
70
+ expect: ch === "{" ? "key" : "value"
71
+ });
72
+ i++;
73
+ safe = i;
74
+ safeClose = closers();
75
+ continue;
76
+ }
77
+ if (ch === "}" || ch === "]") {
78
+ stack.pop();
79
+ i++;
80
+ valueDone(i);
81
+ continue;
82
+ }
83
+ let j = i;
84
+ while (j < n && !" \n\r ,]}:".includes(text[j])) j++;
85
+ if (j >= n) {
86
+ if (/^-?\d+(\.\d+)?$/.test(text.slice(i, j))) return tryParse(text.slice(0, j) + closers()) ?? tryParse(text.slice(0, safe) + safeClose);
87
+ break;
88
+ }
89
+ i = j;
90
+ valueDone(i);
91
+ }
92
+ return safe === 0 ? void 0 : tryParse(text.slice(0, safe) + safeClose);
93
+ }
94
+ /**
95
+ * JSON as far as it is valid: a stray bracket midway keeps what came before it, instead of losing it all.
96
+ * `error` says where it broke, for feedback to the model.
97
+ */
98
+ function salvageJson(text) {
99
+ try {
100
+ return { value: JSON.parse(text) };
101
+ } catch (error) {
102
+ const m = /position (\d+)|line 1 column (\d+)/.exec(String(error));
103
+ const at = m ? Number(m[1] ?? Number(m[2]) - 1) : text.length;
104
+ const near = text.slice(Math.max(0, at - 30), at + 10);
105
+ return {
106
+ value: parsePartialJson(text.slice(0, at)),
107
+ error: `invalid JSON at character ${at}, near ${JSON.stringify(near)}`
108
+ };
109
+ }
110
+ }
111
+ export { salvageJson as n, parsePartialJson as t };
@@ -1,4 +1,4 @@
1
- import type { Part, ThinkingPart, ToolCallPart } from "./types";
1
+ import type { Part, ThinkingPart, ToolCallPart } from "./types.js";
2
2
  export type ActivityPart = ThinkingPart | ToolCallPart;
3
3
  /**
4
4
  * How an assistant message is laid out: runs of consecutive thinking and tool-call parts fold into one
@@ -1,4 +1,4 @@
1
- import type { MessageStatus, Part, PartStatus, Usage } from "./types";
1
+ import type { MessageStatus, Part, PartStatus, Usage } from "./types.js";
2
2
  /**
3
3
  * The stream a backend sends for one run (one assistant reply). Sent as server-sent events: the SSE `id`
4
4
  * is `seq`, the `data` is the JSON event. Any backend in any language that emits these works with the UI.
@@ -1,20 +1,9 @@
1
- export type * from "./types";
2
- export type * from "./events";
3
- export { applyEvent, reduceEvents, estimateTokens, outputTokens, activityTokens, resolveEffort, awaitingToolCalls, settleToolCall } from "./reduce";
4
- export { toBlocks, isActivityPart } from "./blocks";
5
- export type { Block, ActivityPart } from "./blocks";
6
- export { readEventStream, formatEvent } from "./sse";
7
- export { parsePartialJson, salvageJson } from "./partial-json";
8
- export { widgetFrameLoader, widgetLoaderMessages } from "./widget-loader";
9
- export { replacesProperty, replacesGuide, replacedId, resolveReplaces, withCallId } from "./replaces";
10
- export { visualizeTool, visualizeGuide, checkWidgetCode } from "./visualize";
11
- export type { VisualizeInput, WidgetCodeCheck } from "./visualize";
12
- export { askUserTool, readAskUserInput, readAskUserResult } from "./ask-user";
13
- export type { AskUserKind, AskUserQuestion, AskUserInput, AskUserAnswer, AskUserResult } from "./ask-user";
14
- export { matchesSchema, schemaErrors, checkUiTree, isStateRef, renderUiTool, renderUiToolName, uiActionSchema } from "./ui-tree";
15
- export type { UiNode, UiAction, RenderUiInput, UiComponentSpec, UiTreeCheck } from "./ui-tree";
16
- export { parseUiMarkup, readUiValue, findUiBlocks, checkUiMarkup, checkUiMarkupCode, showUiTool, showUiToolName, uiMarkupGuide, uiMarkupLanguage } from "./ui-markup";
17
- export type { UiMarkup, UiMarkupBlock, UiMarkupCheck, ShowUiInput } from "./ui-markup";
18
- export type { UiTreeCheckOptions } from "./ui-tree";
19
- export { uiSpecs, uiSpecGroups, uiSpecSet, uiComponentSpecs } from "./ui-components";
20
- export type { UiSpecName, UiSpecPick, UiSpecSelection } from "./ui-components";
1
+ export type * from "./types.js";
2
+ export type * from "./events.js";
3
+ export { applyEvent, reduceEvents, estimateTokens, outputTokens, activityTokens, resolveEffort, awaitingToolCalls, settleToolCall } from "./reduce.js";
4
+ export { toBlocks, isActivityPart } from "./blocks.js";
5
+ export type { Block, ActivityPart } from "./blocks.js";
6
+ export { readEventStream, formatEvent } from "./sse.js";
7
+ export { parsePartialJson, salvageJson } from "./partial-json.js";
8
+ export { askUserTool, readAskUserInput, readAskUserResult } from "./ask-user.js";
9
+ export type { AskUserKind, AskUserQuestion, AskUserInput, AskUserAnswer, AskUserResult } from "./ask-user.js";
@@ -1,5 +1,5 @@
1
- import type { StreamEvent } from "./events";
2
- import type { Message, ModelInfo, Part, ToolCallPart } from "./types";
1
+ import type { StreamEvent } from "./events.js";
2
+ import type { Message, ModelInfo, Part, ToolCallPart } from "./types.js";
3
3
  /**
4
4
  * Applies one stream event to the message it builds. Pure and immutable: returns the same object when the
5
5
  * event changes nothing, so React can skip renders.
@@ -1,4 +1,4 @@
1
- import type { StreamEvent } from "./events";
1
+ import type { StreamEvent } from "./events.js";
2
2
  /**
3
3
  * Reads a server-sent event stream of `StreamEvent`s. Each SSE message carries one JSON event in `data`;
4
4
  * comments and messages without data (keep-alives) are skipped.
@@ -1,4 +1,4 @@
1
- import { type JsonSchema, type UiComponentSpec } from "./ui-tree";
1
+ import { type JsonSchema, type UiComponentSpec } from "./ui-tree.js";
2
2
  /**
3
3
  * The specs by name, so a host can pick or adjust one: `{ ...uiSpecs.Card, description: "..." }`.
4
4
  * Stack, Grid, Card, Heading, Text, Metric, List, Table, Badge, Progress, Checklist, Tabs, Show, Button.
@@ -8,7 +8,7 @@
8
8
  * lenient where the intent is clear (JS-style objects, `{$state.k}`, `{"$state":"k"}`, text children) and
9
9
  * tolerates a block cut short while it streams.
10
10
  */
11
- import { type UiComponentSpec, type UiNode } from "./ui-tree";
11
+ import { type UiComponentSpec, type UiNode } from "./ui-tree.js";
12
12
  export interface UiMarkup {
13
13
  /** Top-level elements, in order. */
14
14
  nodes: UiNode[];
@@ -0,0 +1,11 @@
1
+ export { widgetFrameLoader, widgetLoaderMessages } from "./widget-loader.js";
2
+ export { replacesProperty, replacesGuide, replacedId, resolveReplaces, withCallId } from "./replaces.js";
3
+ export { visualizeTool, visualizeGuide, checkWidgetCode } from "./visualize.js";
4
+ export type { VisualizeInput, WidgetCodeCheck } from "./visualize.js";
5
+ export { matchesSchema, schemaErrors, checkUiTree, isStateRef, renderUiTool, renderUiToolName, uiActionSchema } from "./ui-tree.js";
6
+ export type { UiNode, UiAction, RenderUiInput, UiComponentSpec, UiTreeCheck } from "./ui-tree.js";
7
+ export { parseUiMarkup, readUiValue, findUiBlocks, checkUiMarkup, checkUiMarkupCode, showUiTool, showUiToolName, uiMarkupGuide, uiMarkupLanguage } from "./ui-markup.js";
8
+ export type { UiMarkup, UiMarkupBlock, UiMarkupCheck, ShowUiInput } from "./ui-markup.js";
9
+ export type { UiTreeCheckOptions } from "./ui-tree.js";
10
+ export { uiSpecs, uiSpecGroups, uiSpecSet, uiComponentSpecs } from "./ui-components.js";
11
+ export type { UiSpecName, UiSpecPick, UiSpecSelection } from "./ui-components.js";
@@ -1,4 +1,4 @@
1
- import type { PendingApproval } from "../hooks/use-chat";
1
+ import type { PendingApproval } from "../hooks/use-chat.js";
2
2
  export interface ApprovalCardProps {
3
3
  approval: PendingApproval;
4
4
  onRespond: (partId: string, granted: boolean) => void;
@@ -1,5 +1,5 @@
1
1
  import { type ToolCallPart } from "../../../core/src/index.js";
2
- import type { ToolPromptProps, ToolView } from "./tools";
2
+ import type { ToolPromptProps, ToolView } from "./tools.js";
3
3
  /**
4
4
  * The `ask_user` prompt: the model's questions one at a time with a pager, answered by clicking or the keyboard
5
5
  * (number keys, arrows, Enter; Alt+arrows reorder a rank). Submits `{ answers }` (an `AskUserResult`) after the
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import { type PopoverProps } from "../primitives/menu";
2
+ import { type PopoverProps } from "../primitives/menu.js";
3
3
  export interface ChatSummary {
4
4
  id: string;
5
5
  title: string;
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  import type React from "react";
3
- import { type DictationState } from "./dictation";
3
+ import { type DictationState } from "./dictation.js";
4
4
  export interface ComposerProps {
5
5
  onSubmit: (text: string) => void;
6
6
  /** Shown as a stop button while `busy`. */
@@ -0,0 +1,50 @@
1
+ import type { Message, Part, ToolCallPart } from "../../../core/src/index.js";
2
+ import type { ToolViews } from "./tools.js";
3
+ import { type ComponentType, type ReactNode } from "react";
4
+ /** A fenced code block handed to a `codeBlocks` renderer. `id` is stable while the block streams. */
5
+ export interface CodeBlockRendererProps {
6
+ /** Keys this block's state: the text part's id and the block's start line. */
7
+ id: string;
8
+ code: string;
9
+ /** The text is still arriving. */
10
+ streaming: boolean;
11
+ }
12
+ /** One reply's tool calls grouped into chains: each call's first call, and each first call's chain in order. */
13
+ export interface ToolCallGroups {
14
+ first: ReadonlyMap<string, string>;
15
+ chains: ReadonlyMap<string, readonly ToolCallPart[]>;
16
+ }
17
+ export interface ChatExtensions {
18
+ /** Draws fenced code blocks of a language (the key) instead of the code box. Only for text parts that have an id. */
19
+ codeBlocks?: Record<string, ComponentType<CodeBlockRendererProps>>;
20
+ /** Views for tools the host did not give a view of its own (a `ToolViewsProvider` entry of the same name wins). */
21
+ toolViews?: ToolViews;
22
+ /** Draws parts the kit has no view for (after `renderPart` on the list). */
23
+ renderPart?: (part: Part) => ReactNode;
24
+ /** Wraps the message list, with all its messages in view. */
25
+ messageScope?: ComponentType<{
26
+ messages: readonly Message[];
27
+ children: ReactNode;
28
+ }>;
29
+ /** Draws several tool calls of one reply as a single chain: `group` finds the chains, `Chain` draws one. */
30
+ toolChains?: {
31
+ group: (message: Message) => ToolCallGroups;
32
+ Chain: ComponentType<{
33
+ chain: readonly ToolCallPart[];
34
+ draw: (part: ToolCallPart) => ReactNode;
35
+ }>;
36
+ };
37
+ }
38
+ /** Plugs extensions into every message list below it. Nested providers add to (and override) the outer one. */
39
+ export declare function ChatExtensionsProvider({ extensions, children }: {
40
+ extensions: ChatExtensions;
41
+ children: ReactNode;
42
+ }): import("react").JSX.Element;
43
+ export declare function useChatExtensions(): ChatExtensions;
44
+ /** What the transcript's parts may do. `ChatView` provides its `onSend`; `ChatTranscript` is read-only. */
45
+ export interface ChatInteraction {
46
+ send?: (text: string) => void;
47
+ readOnly?: boolean;
48
+ }
49
+ export declare const ChatInteractionProvider: import("react").Provider<ChatInteraction>;
50
+ export declare function useChatInteraction(): ChatInteraction;
@@ -1,6 +1,6 @@
1
1
  import type { Message, Part } from "../../../core/src/index.js";
2
2
  import { type ReactNode } from "react";
3
- import { type Feedback, type MessageActions } from "./messages";
3
+ import { type Feedback, type MessageActions } from "./messages.js";
4
4
  export interface MessageListProps {
5
5
  messages: Message[];
6
6
  onRetry?: (assistantId: string) => void;
@@ -1,6 +1,6 @@
1
1
  import { type Message, type Part } from "../../../core/src/index.js";
2
2
  import { type ReactNode } from "react";
3
- import { type ChatLabels } from "../primitives/labels";
3
+ import { type ChatLabels } from "../primitives/labels.js";
4
4
  /** "just now", "5 minutes ago", "21 hours ago", "yesterday", then a date. */
5
5
  export declare function formatRelativeTime(iso: string, now?: number, labels?: ChatLabels): string;
6
6
  /** Plain text of a message, for copy and read aloud. */
@@ -1,4 +1,4 @@
1
- import type { PendingPrompt } from "../hooks/use-chat";
1
+ import type { PendingPrompt } from "../hooks/use-chat.js";
2
2
  export interface ToolPromptCardProps {
3
3
  prompt: PendingPrompt;
4
4
  /** The user's answer: the call's result. `useChat().answer`. */
@@ -1,7 +1,7 @@
1
1
  import type { ActivityPart, ToolCallPart } from "../../../core/src/index.js";
2
2
  import { type ComponentType, type ReactNode } from "react";
3
- import { type AgentTool } from "../hooks/agent";
4
- import { type ChatLabels } from "../primitives/labels";
3
+ import { type AgentTool } from "../hooks/agent.js";
4
+ import { type ChatLabels } from "../primitives/labels.js";
5
5
  /**
6
6
  * How one kind of tool call shows up in an activity group. Registered by tool name; hosts add their own and
7
7
  * override the built-in ones through `ChatProvider`.
@@ -1,4 +1,4 @@
1
- import type { SendRequest, Transport } from "./use-chat";
1
+ import type { SendRequest, Transport } from "./use-chat.js";
2
2
  export interface SseTransportOptions {
3
3
  /** POST endpoint. Gets the request as JSON and answers with a `text/event-stream` of events. */
4
4
  url: string;
@@ -1,5 +1,5 @@
1
1
  import { type AttachmentPart, type Message, type StreamEvent, type ToolCallPart } from "../../../core/src/index.js";
2
- import { type AgentRegistry, type ToolSpec } from "./agent";
2
+ import { type AgentRegistry, type ToolSpec } from "./agent.js";
3
3
  export interface SendRequest {
4
4
  conversationId?: string;
5
5
  /**
@@ -1,90 +1,86 @@
1
- export { Button, IconButton } from "./primitives/button";
2
- export type { ButtonProps, IconButtonProps } from "./primitives/button";
3
- export { Badge } from "./primitives/badge";
4
- export type { BadgeProps } from "./primitives/badge";
5
- export { Tooltip } from "./primitives/tooltip";
6
- export type { TooltipProps } from "./primitives/tooltip";
7
- export { CopyButton } from "./primitives/copy-button";
8
- export { SegmentedControl } from "./primitives/segmented-control";
9
- export type { SegmentedControlProps, SegmentedOption } from "./primitives/segmented-control";
10
- export { Caret } from "./primitives/caret";
11
- export { Disclosure } from "./primitives/disclosure";
12
- export type { DisclosureProps } from "./primitives/disclosure";
13
- export { Popover, Menu, MenuItem, MenuSearch, MenuSection, MenuSeparator, MenuNote, MenuTrigger, SubmenuTrigger, DialogTrigger, PopoverTrigger } from "./primitives/menu";
14
- export type { MenuSearchProps, PopoverProps, MenuProps, MenuItemProps, MenuSectionProps } from "./primitives/menu";
15
- export { ContextMenu } from "./primitives/context-menu";
16
- export type { ContextMenuProps } from "./primitives/context-menu";
17
- export { Modal, Drawer } from "./primitives/overlay";
18
- export type { ModalProps, DrawerProps } from "./primitives/overlay";
19
- export { Panel } from "./primitives/panel";
20
- export type { PanelProps } from "./primitives/panel";
21
- export { CodeBlock } from "./primitives/code-block";
22
- export type { CodeBlockProps } from "./primitives/code-block";
23
- export { ChatTheme } from "./primitives/chat-theme";
24
- export type { ChatThemeProps } from "./primitives/chat-theme";
25
- export { defaultLabels, useLabels } from "./primitives/labels";
26
- export type { ChatLabels } from "./primitives/labels";
27
- export { defaultIcons, useIcons } from "./primitives/icons";
28
- export type { ChatIcons } from "./primitives/icons";
29
- export type { CodeThemes, ChatMotion } from "./primitives/appearance";
30
- export { useChat, userMessage } from "./hooks/use-chat";
31
- export type { Transport, SendRequest, SendOptions, UseChat, UseChatOptions, PendingApproval, PendingPrompt } from "./hooks/use-chat";
32
- export { sseTransport, type SseTransportOptions, type SseRequestBody } from "./hooks/sse-transport";
33
- export { AgentProvider, AgentRegistry, useAgentRegistry, useAgentSnapshot, useAgentTool, useAgentContext } from "./hooks/agent";
34
- export type { AgentTool, ToolContext, ToolSpec, JsonSchema } from "./hooks/agent";
35
- export { useSmoothText } from "./hooks/smooth-text";
36
- export { useSidebar, useMediaQuery, DRAWER_QUERY } from "./hooks/sidebar-state";
37
- export type { SidebarState } from "./hooks/sidebar-state";
38
- export { UserMessage, AssistantMessage, formatRelativeTime, messageText } from "./components/messages";
39
- export type { UserMessageProps, AssistantMessageProps, Feedback, MessageActions } from "./components/messages";
40
- export { Markdown, MarkdownLinksProvider } from "./components/markdown";
41
- export type { LinkList, MarkdownProps, RenderImage, RenderLink, RenderLinkList } from "./components/markdown";
42
- export { ActivityGroup } from "./components/activity-group";
43
- export type { ActivityGroupProps } from "./components/activity-group";
44
- export { ToolViewsProvider, useToolView, useToolViews, activityLabel, activityHeading, commandTool, webSearchTool, webFetchTool, memoryTool, defaultToolViews, formatDuration, useChatTool, } from "./components/tools";
45
- export type { ToolView, ToolViews, ToolPromptProps, SearchResult, ChatTool } from "./components/tools";
46
- export { AskUserPrompt, AskUserAnswers, askUserToolView } from "./components/ask-user";
47
- export { ToolPromptCard } from "./components/tool-prompt";
48
- export type { ToolPromptCardProps } from "./components/tool-prompt";
49
- export { WidgetFrame, WidgetHostProvider, useWidgetHost, WidgetPartView, widgetToolView, readVisualizeInput, widgetCsp, intersectAllow, openInNewTab, WIDGET_MAX_HEIGHT } from "./components/widget-frame";
50
- export type { WidgetFrameProps, WidgetToolInput, WidgetHost, WidgetAllow, WidgetResource } from "./components/widget-frame";
51
- export { UiComponentsProvider, UiTree, UiMarkupBlock, useUiMarkupLanguage, useUiAction, useUiState, htmlComponent, uiTreeToolView, uiMarkupToolView, readTreeInput } from "./components/ui-tree";
52
- export type { UiComponent, UiStateStore, UiTreeProps, UiToolViewOptions } from "./components/ui-tree";
53
- export { uiComponents, uiComponentSet, uiRenders } from "./components/ui-components";
54
- export type { UiComponentSetOptions } from "./components/ui-components";
55
- export { ApprovalCard } from "./components/approval-card";
56
- export type { ApprovalCardProps } from "./components/approval-card";
57
- export { TokenCounter, useCountUp, formatTokens } from "./components/token-counter";
58
- export type { TokenCounterProps } from "./components/token-counter";
59
- export { ContextPanel } from "./components/context-panel";
60
- export type { ContextPanelProps } from "./components/context-panel";
61
- export { ContextMeter } from "./components/context-meter";
62
- export type { ContextMeterProps } from "./components/context-meter";
63
- export { CopyField } from "./components/copy-field";
64
- export type { CopyFieldProps } from "./components/copy-field";
65
- export { Composer, AttachButton } from "./components/composer";
66
- export { DictationButton, DictationControls, VoiceMeter, encodeWav, useDictation } from "./components/dictation";
67
- export type { Dictation, DictationButtonProps, DictationState, UseDictationOptions, VoiceMeterProps } from "./components/dictation";
68
- export { EffortSlider, EffortButton } from "./components/effort-slider";
69
- export type { EffortSliderProps, EffortButtonProps } from "./components/effort-slider";
70
- export type { ComposerProps, AttachButtonProps } from "./components/composer";
71
- export { ModelPicker } from "./components/model-picker";
72
- export type { ModelOption, ModelPickerProps } from "./components/model-picker";
73
- export { useAttachments, AttachmentCard, AttachmentRow, PastedTextDialog } from "./components/attachments";
74
- export type { DraftAttachment, UploadResult, UseAttachments, UseAttachmentsOptions, AttachmentCardData, AttachmentCardProps, AttachmentRowProps, PastedTextDialogProps, } from "./components/attachments";
75
- export { MessageList } from "./components/message-list";
76
- export type { MessageListProps } from "./components/message-list";
77
- export { ChatHeader, ChatTitleMenu } from "./components/chat-header";
78
- export type { ChatHeaderProps, ChatTitleMenuProps } from "./components/chat-header";
79
- export { ChatNotice } from "./components/chat-notice";
80
- export type { ChatNoticeProps } from "./components/chat-notice";
81
- export { ChatList, ChatListRailButton } from "./components/chat-list";
82
- export type { ChatListRailButtonProps, ChatListProps, ChatListSection, ChatListItem, ChatSummary, ProjectSummary } from "./components/chat-list";
83
- export { ChatView, EmptyState } from "./views/chat-view";
84
- export type { ChatViewProps, EmptyStateProps, Density } from "./views/chat-view";
85
- export { ChatTranscript } from "./views/chat-transcript";
86
- export type { ChatTranscriptProps } from "./views/chat-transcript";
87
- export { AppShell, SidebarToggle } from "./views/app-shell";
88
- export type { AppShellProps, SidebarToggleProps } from "./views/app-shell";
89
- export { Sidebar, SidebarItem, SidebarList, SidebarUser } from "./views/sidebar";
90
- export type { SidebarProps, SidebarItemProps, SidebarListProps, SidebarUserProps } from "./views/sidebar";
1
+ export { Button, IconButton } from "./primitives/button.js";
2
+ export type { ButtonProps, IconButtonProps } from "./primitives/button.js";
3
+ export { Badge } from "./primitives/badge.js";
4
+ export type { BadgeProps } from "./primitives/badge.js";
5
+ export { Tooltip } from "./primitives/tooltip.js";
6
+ export type { TooltipProps } from "./primitives/tooltip.js";
7
+ export { CopyButton } from "./primitives/copy-button.js";
8
+ export { SegmentedControl } from "./primitives/segmented-control.js";
9
+ export type { SegmentedControlProps, SegmentedOption } from "./primitives/segmented-control.js";
10
+ export { Caret } from "./primitives/caret.js";
11
+ export { Disclosure } from "./primitives/disclosure.js";
12
+ export type { DisclosureProps } from "./primitives/disclosure.js";
13
+ export { Popover, Menu, MenuItem, MenuSearch, MenuSection, MenuSeparator, MenuNote, MenuTrigger, SubmenuTrigger, DialogTrigger, PopoverTrigger } from "./primitives/menu.js";
14
+ export type { MenuSearchProps, PopoverProps, MenuProps, MenuItemProps, MenuSectionProps } from "./primitives/menu.js";
15
+ export { ContextMenu } from "./primitives/context-menu.js";
16
+ export type { ContextMenuProps } from "./primitives/context-menu.js";
17
+ export { Modal, Drawer } from "./primitives/overlay.js";
18
+ export type { ModalProps, DrawerProps } from "./primitives/overlay.js";
19
+ export { Panel } from "./primitives/panel.js";
20
+ export type { PanelProps } from "./primitives/panel.js";
21
+ export { CodeBlock } from "./primitives/code-block.js";
22
+ export type { CodeBlockProps } from "./primitives/code-block.js";
23
+ export { ChatTheme } from "./primitives/chat-theme.js";
24
+ export type { ChatThemeProps } from "./primitives/chat-theme.js";
25
+ export { defaultLabels, useLabels } from "./primitives/labels.js";
26
+ export type { ChatLabels } from "./primitives/labels.js";
27
+ export { defaultIcons, useIcons } from "./primitives/icons.js";
28
+ export type { ChatIcons } from "./primitives/icons.js";
29
+ export type { CodeThemes, ChatMotion } from "./primitives/appearance.js";
30
+ export { useChat, userMessage } from "./hooks/use-chat.js";
31
+ export type { Transport, SendRequest, SendOptions, UseChat, UseChatOptions, PendingApproval, PendingPrompt } from "./hooks/use-chat.js";
32
+ export { sseTransport, type SseTransportOptions, type SseRequestBody } from "./hooks/sse-transport.js";
33
+ export { AgentProvider, AgentRegistry, useAgentRegistry, useAgentSnapshot, useAgentTool, useAgentContext } from "./hooks/agent.js";
34
+ export type { AgentTool, ToolContext, ToolSpec, JsonSchema } from "./hooks/agent.js";
35
+ export { useSmoothText } from "./hooks/smooth-text.js";
36
+ export { useSidebar, useMediaQuery, DRAWER_QUERY } from "./hooks/sidebar-state.js";
37
+ export type { SidebarState } from "./hooks/sidebar-state.js";
38
+ export { UserMessage, AssistantMessage, formatRelativeTime, messageText } from "./components/messages.js";
39
+ export type { UserMessageProps, AssistantMessageProps, Feedback, MessageActions } from "./components/messages.js";
40
+ export { Markdown, MarkdownLinksProvider } from "./components/markdown.js";
41
+ export type { LinkList, MarkdownProps, RenderImage, RenderLink, RenderLinkList } from "./components/markdown.js";
42
+ export { ActivityGroup } from "./components/activity-group.js";
43
+ export type { ActivityGroupProps } from "./components/activity-group.js";
44
+ export { ToolViewsProvider, useToolView, useToolViews, activityLabel, activityHeading, commandTool, webSearchTool, webFetchTool, memoryTool, defaultToolViews, formatDuration, useChatTool, } from "./components/tools.js";
45
+ export type { ToolView, ToolViews, ToolPromptProps, SearchResult, ChatTool } from "./components/tools.js";
46
+ export { ChatExtensionsProvider, useChatExtensions, ChatInteractionProvider, useChatInteraction } from "./components/extensions.js";
47
+ export type { ChatExtensions, CodeBlockRendererProps, ToolCallGroups, ChatInteraction } from "./components/extensions.js";
48
+ export { AskUserPrompt, AskUserAnswers, askUserToolView } from "./components/ask-user.js";
49
+ export { ToolPromptCard } from "./components/tool-prompt.js";
50
+ export type { ToolPromptCardProps } from "./components/tool-prompt.js";
51
+ export { ApprovalCard } from "./components/approval-card.js";
52
+ export type { ApprovalCardProps } from "./components/approval-card.js";
53
+ export { TokenCounter, useCountUp, formatTokens } from "./components/token-counter.js";
54
+ export type { TokenCounterProps } from "./components/token-counter.js";
55
+ export { ContextPanel } from "./components/context-panel.js";
56
+ export type { ContextPanelProps } from "./components/context-panel.js";
57
+ export { ContextMeter } from "./components/context-meter.js";
58
+ export type { ContextMeterProps } from "./components/context-meter.js";
59
+ export { CopyField } from "./components/copy-field.js";
60
+ export type { CopyFieldProps } from "./components/copy-field.js";
61
+ export { Composer, AttachButton } from "./components/composer.js";
62
+ export { DictationButton, DictationControls, VoiceMeter, encodeWav, useDictation } from "./components/dictation.js";
63
+ export type { Dictation, DictationButtonProps, DictationState, UseDictationOptions, VoiceMeterProps } from "./components/dictation.js";
64
+ export { EffortSlider, EffortButton } from "./components/effort-slider.js";
65
+ export type { EffortSliderProps, EffortButtonProps } from "./components/effort-slider.js";
66
+ export type { ComposerProps, AttachButtonProps } from "./components/composer.js";
67
+ export { ModelPicker } from "./components/model-picker.js";
68
+ export type { ModelOption, ModelPickerProps } from "./components/model-picker.js";
69
+ export { useAttachments, AttachmentCard, AttachmentRow, PastedTextDialog } from "./components/attachments.js";
70
+ export type { DraftAttachment, UploadResult, UseAttachments, UseAttachmentsOptions, AttachmentCardData, AttachmentCardProps, AttachmentRowProps, PastedTextDialogProps, } from "./components/attachments.js";
71
+ export { MessageList } from "./components/message-list.js";
72
+ export type { MessageListProps } from "./components/message-list.js";
73
+ export { ChatHeader, ChatTitleMenu } from "./components/chat-header.js";
74
+ export type { ChatHeaderProps, ChatTitleMenuProps } from "./components/chat-header.js";
75
+ export { ChatNotice } from "./components/chat-notice.js";
76
+ export type { ChatNoticeProps } from "./components/chat-notice.js";
77
+ export { ChatList, ChatListRailButton } from "./components/chat-list.js";
78
+ export type { ChatListRailButtonProps, ChatListProps, ChatListSection, ChatListItem, ChatSummary, ProjectSummary } from "./components/chat-list.js";
79
+ export { ChatView, EmptyState } from "./views/chat-view.js";
80
+ export type { ChatViewProps, EmptyStateProps, Density } from "./views/chat-view.js";
81
+ export { ChatTranscript } from "./views/chat-transcript.js";
82
+ export type { ChatTranscriptProps } from "./views/chat-transcript.js";
83
+ export { AppShell, SidebarToggle } from "./views/app-shell.js";
84
+ export type { AppShellProps, SidebarToggleProps } from "./views/app-shell.js";
85
+ export { Sidebar, SidebarItem, SidebarList, SidebarUser } from "./views/sidebar.js";
86
+ export type { SidebarProps, SidebarItemProps, SidebarListProps, SidebarUserProps } from "./views/sidebar.js";
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from "react";
2
- import { type ChatMotion, type CodeThemes } from "./appearance";
3
- import { type ChatIcons } from "./icons";
4
- import { type ChatLabels } from "./labels";
2
+ import { type ChatMotion, type CodeThemes } from "./appearance.js";
3
+ import { type ChatIcons } from "./icons.js";
4
+ import { type ChatLabels } from "./labels.js";
5
5
  export interface ChatThemeProps {
6
6
  /** Value for `data-chat-theme`, matched by the host's theme CSS. */
7
7
  theme?: string;
@@ -1,12 +1,9 @@
1
1
  import type { Message, Part } from "../../../core/src/index.js";
2
2
  import { type ReactNode } from "react";
3
- import { type WidgetHost } from "../components/widget-frame";
4
- import { type Density } from "./chat-view";
3
+ import { type Density } from "./chat-view.js";
5
4
  export interface ChatTranscriptProps {
6
5
  messages: Message[];
7
6
  renderPart?: (part: Part) => ReactNode;
8
- /** What widgets may load and how their links open. Widgets here cannot send messages or call tools. */
9
- widgets?: Omit<WidgetHost, "onPrompt" | "onCallTool">;
10
7
  /** Above the conversation, e.g. a ChatHeader with the title and who shared it. */
11
8
  header?: ReactNode;
12
9
  /** Atop the conversation, scrolling with it: who shared it and what it is. E.g. a ChatNotice. */
@@ -24,4 +21,4 @@ export interface ChatTranscriptProps {
24
21
  * A conversation to read, not to continue: a shared chat, an export, a log. Same messages as ChatView,
25
22
  * with no composer, approvals, retry, edit or feedback. Copy stays.
26
23
  */
27
- export declare function ChatTranscript({ messages, renderPart, widgets, header, notice, footer, start, density, contentWidth, contentPadding, className, }: ChatTranscriptProps): import("react").JSX.Element;
24
+ export declare function ChatTranscript({ messages, renderPart, header, notice, footer, start, density, contentWidth, contentPadding, className, }: ChatTranscriptProps): import("react").JSX.Element;
@@ -1,9 +1,8 @@
1
1
  import type { Message, Part } from "../../../core/src/index.js";
2
2
  import { type CSSProperties, type ReactNode } from "react";
3
- import type { PendingApproval, PendingPrompt } from "../hooks/use-chat";
4
- import { type ComposerProps } from "../components/composer";
5
- import type { Feedback, MessageActions } from "../components/messages";
6
- import { type WidgetHost } from "../components/widget-frame";
3
+ import type { PendingApproval, PendingPrompt } from "../hooks/use-chat.js";
4
+ import { type ComposerProps } from "../components/composer.js";
5
+ import type { Feedback, MessageActions } from "../components/messages.js";
7
6
  export type Density = "full" | "panel" | "inline";
8
7
  /**
9
8
  * Column defaults per density; `contentWidth` / `contentPadding` override them. Only the message size changes
@@ -37,12 +36,6 @@ export interface ChatViewProps {
37
36
  /** Add your own buttons to each message's action row, or hide copy and the time. */
38
37
  messageActions?: MessageActions;
39
38
  renderPart?: (part: Part) => ReactNode;
40
- /**
41
- * What widgets (sandboxed visuals) may do: the domains they may load, and their callbacks. A widget's
42
- * sendPrompt sends through `onSend` and its links open in a new tab unless set here; set a callback to
43
- * `undefined` to turn it off.
44
- */
45
- widgets?: WidgetHost;
46
39
  /** Usually a `<ChatHeader>`. */
47
40
  header?: ReactNode;
48
41
  /**
@@ -72,7 +65,7 @@ export interface ChatViewProps {
72
65
  className?: string;
73
66
  }
74
67
  /** A whole chat: header, the conversation, the docked composer. An empty chat shows `emptyState`. */
75
- export declare function ChatView({ messages, busy, onSend, onStop, approvals, onApprove, prompts, onAnswer, onDecline, onRetry, onEdit, onFeedback, onReadAloud, messageActions, renderPart, widgets, header, composer, emptyState, disclaimer, renderComposer, density, contentWidth, contentPadding, className, }: ChatViewProps): import("react").JSX.Element;
68
+ export declare function ChatView({ messages, busy, onSend, onStop, approvals, onApprove, prompts, onAnswer, onDecline, onRetry, onEdit, onFeedback, onReadAloud, messageActions, renderPart, header, composer, emptyState, disclaimer, renderComposer, density, contentWidth, contentPadding, className, }: ChatViewProps): import("react").JSX.Element;
76
69
  export interface EmptyStateProps {
77
70
  /** "Good evening, Alex". */
78
71
  greeting: ReactNode;
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { type PopoverProps } from "../primitives/menu";
2
+ import { type PopoverProps } from "../primitives/menu.js";
3
3
  export interface SidebarProps {
4
4
  /** Name or logo at the top left; hidden when collapsed. */
5
5
  brand?: ReactNode;
@@ -0,0 +1 @@
1
+ export * from "../../../core/src/visuals.js";